|
Maze Builder Docs 7.5.6
|
Modern factory interface using registration pattern. More...
#include <factory_interface.h>
Public Types | |
| using | factory_creator_t = std::function<std::unique_ptr<InterfaceType>(const configurator &)> |
| Type alias for product creation function. | |
Public Member Functions | |
| virtual bool | register_creator (const std::string &key, factory_creator_t creator) noexcept=0 |
| Register a product creator function with a unique identifier. | |
| virtual bool | unregister_creator (const std::string &key) noexcept=0 |
| Unregister a product creator function. | |
| virtual bool | is_registered (const std::string &key) const =0 |
| Check if a creator is registered for the given key. | |
| virtual std::optional< std::unique_ptr< InterfaceType > > | create (const std::string &key, const configurator &config) const noexcept=0 |
| Create a product using a registered creator. | |
| virtual std::vector< std::string > | get_registered_keys () const =0 |
| Get all registered creator keys. | |
| virtual void | clear () noexcept=0 |
| Clear all registered creators. | |
Modern factory interface using registration pattern.
Uses function objects for flexible product creation with registration capabilities
| InterfaceType | The interface type that products must implement |
|
pure virtualnoexcept |
Clear all registered creators.
Implemented in mazes::grid_factory, and mazes::maze_factory.
|
pure virtualnoexcept |
Create a product using a registered creator.
| key | Unique identifier for the product type |
| config | Configuration parameters |
Implemented in mazes::grid_factory, and mazes::maze_factory.
|
pure virtual |
Get all registered creator keys.
Implemented in mazes::grid_factory, and mazes::maze_factory.
|
pure virtual |
Check if a creator is registered for the given key.
| key | Unique identifier to check |
Implemented in mazes::grid_factory, and mazes::maze_factory.
|
pure virtualnoexcept |
Register a product creator function with a unique identifier.
| key | Unique identifier for the product type |
| creator | Function object that creates the product |
Implemented in mazes::grid_factory, and mazes::maze_factory.
|
pure virtualnoexcept |
Unregister a product creator function.
| key | Unique identifier for the product type to remove |
Implemented in mazes::grid_factory, and mazes::maze_factory.