Menge
Modular Pedestrian Simulation Framework for Research and Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Static Public Member Functions | Static Protected Attributes | List of all members
Menge::ElementDB< Factory, Element > Class Template Reference

The base functionality of an element database. More...

#include <ElementDatabase.h>

Static Public Member Functions

static size_t count ()
 Reports the number of registered target factories. More...
 
static ElementgetInstance (TiXmlElement *node, const std::string &behaveFldr)
 Returns an instance of the TransitionTarget defined in the XML node. More...
 
static void initialize ()
 Initializes the database.
 
static void addBuiltins ()
 Adds the built-in factories to the database. More...
 
static bool addFactory (Factory *factory)
 Adds a new Target factory to the database. More...
 
static std::string getElementName ()
 Returns the name of the element managed by this database. More...
 
static void clear ()
 Removes all registered factories from the database.
 

Static Protected Attributes

static bool _initialized = false
 Tracks whether the database has been initialized, so that multiple calls to initialize will not cause problems.
 
static std::list< Factory * > _factories
 The registered factories.
 

Detailed Description

template<class Factory, class Element>
class Menge::ElementDB< Factory, Element >

The base functionality of an element database.

Queries for parsing element XML and instantiating the appropriate elements for the finite state machine pass through the appropriate element database.

For plug-in-compatible elements, they should have their own database and factory. For simplicity, they should sub-class a specialization of this template.

Member Function Documentation

template<class Factory , class Element >
void Menge::ElementDB< Factory, Element >::addBuiltins ( )
static

Adds the built-in factories to the database.

Sub-classes will specialize this function to add the built-in factory types.

template<class Factory , class Element >
static bool Menge::ElementDB< Factory, Element >::addFactory ( Factory *  factory)
inlinestatic

Adds a new Target factory to the database.

The database takes ownership of the data pointed to. To be added, the new factory must have a unique name to all previous actions. If the factory cannot be added, it will be deleted.

Parameters
factoryA pointer to the factory to add.
Returns
True if the factory is successfully added, false othrewise.
template<class Factory , class Element >
static size_t Menge::ElementDB< Factory, Element >::count ( )
inlinestatic

Reports the number of registered target factories.

Returns
The number of registered target factories.
template<class Factory , class Element >
std::string Menge::ElementDB< Factory, Element >::getElementName ( )
static

Returns the name of the element managed by this database.

Returns
the name of the element managed by this database
template<class Factory , class Element >
static Element* Menge::ElementDB< Factory, Element >::getInstance ( TiXmlElement *  node,
const std::string &  behaveFldr 
)
inlinestatic

Returns an instance of the TransitionTarget defined in the XML node.

The caller is responsible for deleting the TransitionTarget instance.

Parameters
nodeThe tinyxml node holding the TransitionTarget definition.
behaveFldrThe path to the behavior file. If the transition references resources in the file system, it should be defined relative to the behavior file location. This is the folder containing that path.
Returns
A pointer to a TransitionTarget instance for the given Condtion XML data. If no valid TargetFactory matches the data, NULL is returned.

The documentation for this class was generated from the following file: