45 #ifndef __ELEMENT_DATABASE_H__
46 #define __ELEMENT_DATABASE_H__
64 template <
class Factory,
class Element >
89 const char * typeCStr = node->Attribute(
"type" );
94 std::string typeName( typeCStr );
95 typename std::list< Factory * >::iterator itr =
_factories.begin();
97 const Factory * factory = *itr;
98 if ( factory->thisFactory( typeName ) ) {
100 Element * element = factory->createInstance( node, behaveFldr );
143 std::string testName( factory->name() );
144 typename std::list< Factory * >::iterator itr =
_factories.begin();
146 std::string prevName( (*itr)->name() );
147 if ( testName == prevName ) {
150 logger <<
"\tDescription of the first " <<
getElementName() <<
" type: " << (*itr)->description() <<
".\n";
151 logger <<
"\tDescription of the new " <<
getElementName() <<
" type: " << factory->description() <<
".";
171 typename std::list< Factory * >::iterator itr =
_factories.begin();
196 template <
class Factory,
class Element >
199 template <
class Factory,
class Element >
202 template <
class Factory,
class Element >
205 template <
class Factory,
class Element >
209 #endif // __ELEMENT_DATABASE_H__
static size_t count()
Reports the number of registered target factories.
Definition: ElementDatabase.h:72
static void clear()
Removes all registered factories from the database.
Definition: ElementDatabase.h:170
The core namespace. All elements of Menge are contained in this namespace.
Definition: AgentGenerator.cpp:43
The base functionality of an element database.
Definition: ElementDatabase.h:65
static Element * getInstance(TiXmlElement *node, const std::string &behaveFldr)
Returns an instance of the TransitionTarget defined in the XML node.
Definition: ElementDatabase.h:87
static void addBuiltins()
Adds the built-in factories to the database.
Definition: ElementDatabase.h:197
static void initialize()
Initializes the database.
Definition: ElementDatabase.h:116
The basic interface of extendible Menge Elements.
Definition: Element.h:67
The specificaiton of a message logger for menge, such that all messages to the system get properly re...
static bool addFactory(Factory *factory)
Adds a new Target factory to the database.
Definition: ElementDatabase.h:142
static bool _initialized
Tracks whether the database has been initialized, so that multiple calls to initialize will not cause...
Definition: ElementDatabase.h:182
static std::list< Factory * > _factories
The registered factories.
Definition: ElementDatabase.h:187
Logger logger
Globally available Logger.
Definition: Logger.cpp:49
static std::string getElementName()
Returns the name of the element managed by this database.
Definition: ElementDatabase.h:200
Error encountered but not handled.
Definition: Logger.h:69