A template that can be used as a superclass of a class hierarchy that wants to provide a factory method which allows instantiation of objects based on a string identifier.
More...
|
| static SharedPointerType | createInstance (constructorArg) |
| | Initialisation function which needs to be provided by every subclass.
|
| |
| static SharedPointerType | fromName (const std::string &name, constructorArg params) |
| | Function which can be used to retrieve an object specified by string name.
|
| |
| static std::vector< std::string > | getAvailableClasses () |
| | getAvailableClasses retrieves a list of all registered classes as their string-representation.
|
| |
| static std::string | getName () |
| | Returns the class's name.
|
| |
| static void | registerClass (const std::string &name, initialisationFunction init) |
| | Statically called by subclasses to register their name and initialisation function so they can be found by fromName.
|
| |
template<typename Base, typename constructorArg, typename SharedPointer = std::shared_ptr<Base>>
class armarx::AbstractFactoryMethod< Base, constructorArg, SharedPointer >
A template that can be used as a superclass of a class hierarchy that wants to provide a factory method which allows instantiation of objects based on a string identifier.
The first template argument is the base class of your class hierarchy. The second argument is the parameter type for the initialisation function each subclass has to provide. If you need multiple constructor arguments it is recommended to use a boost::tuple.