Description
A class factory.
It can create C++ objects from their string name. Just use the ChClassFactory::create() function, given a string. NOTE: desired classes must be previously registered via the CH_FACTORY_REGISTER macro, or using ClassRegister, otherwise the ChClassFactory::create() throws an exception. NOTE: You do not need to explicitly create it: a static ChClassFactory class factory is automatically instanced once, at the first time that someone registers a class. It is consistent also across different DLLs.
#include <ChClassFactory.h>
| Static Public Member Functions | |
| static void | ClassRegister (const std::string &keyName, ChClassRegistrationBase *mregistration) | 
| Register a class into the global class factory.  More... | |
| static void | ClassUnregister (const std::string &keyName) | 
| Unregister a class from the global class factory.  More... | |
| static bool | IsClassRegistered (const std::string &keyName) | 
| Tell if a class is registered, from its name. | |
| static std::string & | GetClassTagName (const std::type_info &mtype) | 
| Tell the tag name of a class.  More... | |
| template<class T > | |
| static void | create (const std::string &keyName, T **ptr) | 
| Create from tag name, for registered classes.  More... | |
| template<class T > | |
| static void | create (const std::string &keyName, ChArchiveIn &marchive, T **ptr) | 
| Create from tag name, for registered classes.  More... | |
Member Function Documentation
◆ ClassRegister()
| 
 | inlinestatic | 
Register a class into the global class factory.
Provide an unique name and a ChClassRegistration object. If multiple registrations with the same name are attempted, only one is done.
◆ ClassUnregister()
| 
 | inlinestatic | 
Unregister a class from the global class factory.
Provide an unique name.
◆ create() [1/2]
| 
 | inlinestatic | 
Create from tag name, for registered classes.
If a static T* ArchiveINconstructor(ChArchiveIn&) function is available, call it instead. The created object is returned in "ptr"
◆ create() [2/2]
| 
 | inlinestatic | 
Create from tag name, for registered classes.
The created object is returned in "ptr"
◆ GetClassTagName()
| 
 | inlinestatic | 
Tell the tag name of a class.
This is the mnemonic name, given at registration, not the typeid.name().
The documentation for this class was generated from the following files:
- /builds/uwsbel/chrono/src/chrono/core/ChClassFactory.h
- /builds/uwsbel/chrono/src/chrono/core/ChClassFactory.cpp
