13#include <vlutil/vlUtil.h>
29template <
typename BASE_T>
53template <
typename BASE_T,
typename CREATE_T>
68 CREATE_T* obj =
new CREATE_T();
79template <
typename BASE_T>
84 using CreatorMap = std::map<std::string, DtBaseCreator<BASE_T>*>;
96 DtDELETE(iter->second);
102 template <
typename CREATE_T>
107 name =
typeid(CREATE_T).name();
113 LOG_INFO(
"Util",
"Removing creator %s\n", name.c_str());
128 template <
typename CREATE_T>
133 name =
typeid(CREATE_T).name();
142 LOG_WARN(
"Util",
"Replacing existing creator %s\n", name.c_str());
146 LOG_INFO(
"Util",
"Adding creator%s\n", name.c_str());
159 LOG_WARN(
"Util",
"Cannot find creator for %s\n", name.c_str());
163 return iter->second->create();
virtual BASE_T * create()=0
Pure virtual method to create an object.
DtBaseCreator()
Default constructor.
Definition factory.h:34
virtual ~DtBaseCreator()
Virtual destructor.
Definition factory.h:37
Concrete creator class for objects with a default constructor.
Definition factory.h:55
DtCreator()
Default constructor.
Definition factory.h:58
virtual CREATE_T * create() override
Creates a new instance of CREATE_T.
Definition factory.h:66
virtual ~DtCreator() override
Virtual destructor.
Definition factory.h:61
CreatorMap myCreators
Definition factory.h:173
BASE_T * create(std::string name)
Creates an object by name.
Definition factory.h:154
std::map< std::string, DtBaseCreator< DtValueTransform > * > CreatorMap
Definition factory.h:84
DtFactory()
Default constructor.
Definition factory.h:87
virtual ~DtFactory()
Virtual destructor.
Definition factory.h:92
void removeCreator(std::string name="")
Definition factory.h:103
CreatorMap & creatorMap()
Gets the map of registered creators.
Definition factory.h:169
void addCreator(std::string name="")
Registers a creator for a specific type.
Definition factory.h:129
Provides logging functionality with various severity levels and channels.
#define LOG_WARN(channel, format,...)
Macro to log a warning message using printf-style formatting.
Definition logger.h:150
#define LOG_INFO(channel, format,...)
Macro to log an informational message using printf-style formatting.
Definition logger.h:156
!
Definition glsVreMessageUtil.h:50