xentara-utils v2.0.4
The Xentara Utility Library
|
A factory for creating objects derived from of a certain base class. More...
#include <xentara/utils/core/Factory.hpp>
Public Types | |
using | BaseClass = typename std::pointer_traits< SmartPointer >::element_type |
Public Member Functions | |
template<typename ConcreteClass > | |
Factory (FactoryTag< ConcreteClass > tag) | |
Constructs a factory for a certain concrete class. | |
auto | operator() (ConstructorArguments... constructorArguments) const -> SmartPointer |
Creates an object. | |
Related Symbols | |
(Note that these are not member symbols.) | |
template<typename ConcreteClass > | |
constexpr FactoryTag< ConcreteClass > | kFactory |
A marker used to create factories for a specific concrete type. | |
A factory for creating objects derived from of a certain base class.
SmartPointer | The base class pointer used to manage the created object. Must be a unique_ptr or a shared_ptr to the base class object type. |
ConstructorArguments | Arguments that will be passed to the objects' constructor when creating them. If SmartPointer is a unique_ptr, and the first argument is the corresponding deleter, or a reference to it, then that deleter will be passed to the constructor of unique_ptr instead of the object. |
using xentara::utils::core::Factory< SmartPointer, ConstructorArguments >::BaseClass = typename std::pointer_traits<SmartPointer>::element_type |
xentara::utils::core::Factory< SmartPointer, ConstructorArguments >::Factory | ( | FactoryTag< ConcreteClass > | tag | ) |
Constructs a factory for a certain concrete class.
tag | The tag used to specify the conrete class of the objects to create. Pass kFactory<ConcreteClass> for the concrete class of object you want to create |
auto xentara::utils::core::Factory< SmartPointer, ConstructorArguments >::operator() | ( | ConstructorArguments... | constructorArguments | ) | const -> SmartPointer |
Creates an object.
constructorArguments | Arguments that should be passed to the object's constructor when creating it |
|
related |
A marker used to create factories for a specific concrete type.
ConcreteClass | The class of object to create |