A singleton class to register derived nodes, and create instances of them later NOTE! This is a factory method and must be Mutex protected if it is used in multithreaded environments! More...
#include <uhal/DerivedNodeFactory.hpp>
Classes | |
class | Creator |
Templated concrete implementation with a CreatorInterface interface. More... | |
class | CreatorInterface |
An abstract base class for defining the interface to the creators. More... | |
Public Member Functions | |
virtual | ~DerivedNodeFactory () |
Destructor. More... | |
Static Public Member Functions | |
static DerivedNodeFactory & | getInstance () |
Static method to retrieve the single instance of the class. More... | |
Private Member Functions | |
DerivedNodeFactory () | |
Default constructor This is private since only a single instance is to be created, using the getInstance method. More... | |
Node * | convertToClassType (Node *aNode) |
template<class T > | |
void | add (const std::string &aNodeClassName) |
Method to create an associate between a node type identifier and a Creator of that particular node type. More... | |
Private Attributes | |
boost::unordered_map< std::string, boost::shared_ptr< CreatorInterface > > | mCreators |
Hash map associating a creator for a particular node type with a string identifier for that node type. More... | |
Static Private Attributes | |
static boost::shared_ptr< DerivedNodeFactory > | mInstance |
The single instance of the class. More... | |
Friends | |
class | NodeTreeBuilder |
template<typename T > | |
struct | RegistrationHelper |
EXPERIMENTAL! Give the RegistrationHelper access to the private factory. More... | |
A singleton class to register derived nodes, and create instances of them later NOTE! This is a factory method and must be Mutex protected if it is used in multithreaded environments!
Definition at line 68 of file DerivedNodeFactory.hpp.
|
private |
Default constructor This is private since only a single instance is to be created, using the getInstance method.
Definition at line 53 of file DerivedNodeFactory.cpp.
Referenced by getInstance().
|
virtual |
Destructor.
Definition at line 58 of file DerivedNodeFactory.cpp.
|
private |
Method to create an associate between a node type identifier and a Creator of that particular node type.
aNodeClassName | the node type identifier |
Definition at line 44 of file DerivedNodeFactory.hxx.
References uhal::log(), mCreators, and uhal::Warning.
Referenced by uhal::RegistrationHelper< T >::RegistrationHelper().
Definition at line 74 of file DerivedNodeFactory.cpp.
References uhal::log(), uhal::Node::mClassName, mCreators, uhal::Quote(), and uhal::Warning.
Referenced by uhal::NodeTreeBuilder::moduleNodeCreator(), and uhal::NodeTreeBuilder::plainNodeCreator().
|
static |
Static method to retrieve the single instance of the class.
Definition at line 63 of file DerivedNodeFactory.cpp.
References DerivedNodeFactory(), and mInstance.
Referenced by uhal::NodeTreeBuilder::moduleNodeCreator(), uhal::NodeTreeBuilder::plainNodeCreator(), and uhal::RegistrationHelper< T >::RegistrationHelper().
|
friend |
Definition at line 70 of file DerivedNodeFactory.hpp.
|
friend |
EXPERIMENTAL! Give the RegistrationHelper access to the private factory.
Definition at line 75 of file DerivedNodeFactory.hpp.
|
private |
Hash map associating a creator for a particular node type with a string identifier for that node type.
Definition at line 160 of file DerivedNodeFactory.hpp.
Referenced by add(), and convertToClassType().
|
staticprivate |
The single instance of the class.
Definition at line 157 of file DerivedNodeFactory.hpp.
Referenced by getInstance().