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

The templated base class for a plugin element. More...

#include <ElementFactory.h>

Public Member Functions

 ElementFactory ()
 Default constructor.
 
void destroy ()
 This supplants the destructor. More...
 
virtual const char * name () const =0
 The name of the action. More...
 
virtual const char * description () const =0
 A description of the action. More...
 
bool thisFactory (const std::string &typeName) const
 Reports if the xml node defines an element for this factory. More...
 
ElementcreateInstance (TiXmlElement *node, const std::string &behaveFldr) const
 Parses the xml data. More...
 

Protected Member Functions

virtual ~ElementFactory ()
 Destructor.
 
virtual Elementinstance () const =0
 Create an instance of this class's condition. More...
 
virtual bool setFromXML (Element *element, TiXmlElement *node, const std::string &specFldr) const
 Given a pointer to an element instance, sets the appropriate fields from the provided XML node. More...
 

Protected Attributes

AttributeSet _attrSet
 The attribute set for this factory.
 

Detailed Description

template<class Element>
class Menge::ElementFactory< Element >

The templated base class for a plugin element.

Member Function Documentation

template<class Element>
Element* Menge::ElementFactory< Element >::createInstance ( TiXmlElement *  node,
const std::string &  behaveFldr 
) const
inline

Parses the xml data.

This should be overridden by sub-classes.

Parameters
nodeThe xml node containing the data for the condition.
behaveFldrThe path to the behavior file. If the action references resources in the file system, it should be defined relative to the behavior file location. This is the folder containing that path. It can be ignored if no file system resources are used.
Returns
A pointer to a new condition instance for this data. If there is an error in the xml, NULL is returned.
template<class Element>
virtual const char* Menge::ElementFactory< Element >::description ( ) const
pure virtual

A description of the action.

Each action factory must override this function.

Returns
A string containing the action description.

Implemented in Menge::BFSM::ZeroVCFactory, Menge::BFSM::OBBCondFactory, Menge::BFSM::NotCondFactory, Menge::BFSM::ConstDirVCFactory, Menge::BFSM::SetObstacleActFactory, Menge::BFSM::AABBCondFactory, Menge::BFSM::ScalePropertyActFactory, Menge::BFSM::OrCondFactory, Menge::BFSM::NavMeshVCFactory, Menge::BFSM::AddObstacleyActFactory, Menge::ScaleAgentPropertyEffectFactory, Menge::BFSM::OffsetPropertyActFactory, Menge::BFSM::VFVCFactory, Menge::BFSM::RoadMapVCFactory, Menge::OffsetAgentPropertyEffectFactory, Menge::BFSM::CircleCondFactory, Menge::Agents::HexLatticeGeneratorFactory, Menge::BFSM::RemoveObstacleActFactory, Menge::BFSM::OBBGoalFactory, Menge::BFSM::SetPropertyActFactory, Menge::BFSM::AndCondFactory, Menge::Agents::NavMeshSpatialQueryFactory, Menge::BFSM::ConstVCFactory, Menge::BFSM::AABBGoalFactory, Menge::BFSM::ScaleVMFactory, Menge::Agents::RectGridGeneratorFactory, Menge::StatePopIncTriggerFactory, Menge::SetAgentPropertyEffectFactory, Menge::Agents::NavMeshElevationFactory, Menge::BFSM::ReturnTargetFactory, Menge::Agents::BergKDTreeFactory, Menge::BFSM::CircleGoalFactory, Menge::BFSM::TimerCondFactory, Menge::BFSM::ProbTargetFactory, Menge::BFSM::PointGoalFactory, Menge::BFSM::GoalVCFactory, Menge::BFSM::MirrorGoalSelectorFactory, Menge::BFSM::FarthestNMGoalSelectorFactory, Menge::BFSM::NearestNMGoalSelectorFactory, Menge::BFSM::ExplicitGoalSelectorFactory, Menge::NamedStateMemberTargetFactory, Menge::BFSM::TeleportActFactory, Menge::BFSM::GoalCondFactory, Menge::Agents::ConstProfileSelectorFactory, Menge::BFSM::OffsetGoalSelectorFactory, Menge::BFSM::SharedGoalSelectorFactory, Menge::Agents::ExplicitGeneratorFactory, Menge::Agents::FlatElevationFactory, Menge::Agents::ConstStateSelectorFactory, Menge::BFSM::AutoCondFactory, Menge::Agents::NavMeshObstacleSetFactory, Menge::BFSM::IdentityGoalSelectorFactory, Menge::Agents::ExplicitObstacleSetFactory, Menge::BFSM::FarthestGoalSelectorFactory, Menge::BFSM::NearestGoalSelectorFactory, Menge::BFSM::RandomGoalSelectorFactory, and Menge::BFSM::WeightedGoalSelectorFactory.

template<class Element>
void Menge::ElementFactory< Element >::destroy ( )
inline

This supplants the destructor.

In order to preserve potential problems in windows when dlls do not share the same c-runtime library, the destructor is held to be private. To garbage collect and ConditionFactory, the destory method should be called (which in turn, will call the destructor from its own memory space, averting run-time crashes.

template<class Element>
virtual Element* Menge::ElementFactory< Element >::instance ( ) const
protectedpure virtual

Create an instance of this class's condition.

All ConditionFactory sub-classes must override this by creating (on the heap) a new instance of its corresponding condition type. The various field values of the instance will be set in a subsequent call to ConditionFactory::setFromXML. The caller of this function takes ownership of the memory.

Returns
A pointer to a newly instantiated Action class.

Implemented in Menge::BFSM::ZeroVCFactory, Menge::BFSM::OBBCondFactory, Menge::BFSM::NotCondFactory, Menge::BFSM::ConstDirVCFactory, Menge::BFSM::AABBCondFactory, Menge::BFSM::SetObstacleActFactory, Menge::BFSM::ScalePropertyActFactory, Menge::BFSM::OrCondFactory, Menge::BFSM::NavMeshVCFactory, Menge::BFSM::AddObstacleyActFactory, Menge::ScaleAgentPropertyEffectFactory, Menge::BFSM::OffsetPropertyActFactory, Menge::BFSM::VFVCFactory, Menge::BFSM::RoadMapVCFactory, Menge::OffsetAgentPropertyEffectFactory, Menge::BFSM::CircleCondFactory, Menge::Agents::HexLatticeGeneratorFactory, Menge::BFSM::RemoveObstacleActFactory, Menge::BFSM::SetPropertyActFactory, Menge::BFSM::AndCondFactory, Menge::BFSM::OBBGoalFactory, Menge::Agents::NavMeshSpatialQueryFactory, Menge::BFSM::ConstVCFactory, Menge::BFSM::AABBGoalFactory, Menge::BFSM::ScaleVMFactory, Menge::Agents::RectGridGeneratorFactory, Menge::StatePopIncTriggerFactory, Menge::SetAgentPropertyEffectFactory, Menge::Agents::NavMeshElevationFactory, Menge::BFSM::ReturnTargetFactory, Menge::Agents::BergKDTreeFactory, Menge::BFSM::TimerCondFactory, Menge::BFSM::ProbTargetFactory, Menge::BFSM::CircleGoalFactory, Menge::BFSM::GoalVCFactory, Menge::BFSM::PointGoalFactory, Menge::BFSM::MirrorGoalSelectorFactory, Menge::BFSM::FarthestNMGoalSelectorFactory, Menge::BFSM::NearestNMGoalSelectorFactory, Menge::BFSM::ExplicitGoalSelectorFactory, Menge::NamedStateMemberTargetFactory, Menge::BFSM::TeleportActFactory, Menge::BFSM::GoalCondFactory, Menge::Agents::ConstProfileSelectorFactory, Menge::BFSM::OffsetGoalSelectorFactory, Menge::Agents::ExplicitGeneratorFactory, Menge::Agents::FlatElevationFactory, Menge::BFSM::SharedGoalSelectorFactory, Menge::Agents::ConstStateSelectorFactory, Menge::BFSM::AutoCondFactory, Menge::Agents::NavMeshObstacleSetFactory, Menge::Agents::ExplicitObstacleSetFactory, Menge::BFSM::IdentityGoalSelectorFactory, Menge::BFSM::FarthestGoalSelectorFactory, Menge::BFSM::NearestGoalSelectorFactory, Menge::BFSM::RandomGoalSelectorFactory, and Menge::BFSM::WeightedGoalSelectorFactory.

template<class Element>
virtual const char* Menge::ElementFactory< Element >::name ( ) const
pure virtual

The name of the action.

The action's name must be unique among all registered actions. Each action factory must override this function.

Returns
A string containing the unique action name.

Implemented in Menge::BFSM::ZeroVCFactory, Menge::BFSM::OBBCondFactory, Menge::BFSM::NotCondFactory, Menge::BFSM::ConstDirVCFactory, Menge::BFSM::SetObstacleActFactory, Menge::BFSM::AABBCondFactory, Menge::BFSM::ScalePropertyActFactory, Menge::BFSM::OrCondFactory, Menge::BFSM::NavMeshVCFactory, Menge::BFSM::AddObstacleyActFactory, Menge::ScaleAgentPropertyEffectFactory, Menge::BFSM::OffsetPropertyActFactory, Menge::BFSM::VFVCFactory, Menge::BFSM::RoadMapVCFactory, Menge::OffsetAgentPropertyEffectFactory, Menge::BFSM::CircleCondFactory, Menge::Agents::HexLatticeGeneratorFactory, Menge::BFSM::RemoveObstacleActFactory, Menge::BFSM::OBBGoalFactory, Menge::BFSM::SetPropertyActFactory, Menge::BFSM::AndCondFactory, Menge::Agents::NavMeshSpatialQueryFactory, Menge::BFSM::ConstVCFactory, Menge::BFSM::AABBGoalFactory, Menge::BFSM::ScaleVMFactory, Menge::Agents::RectGridGeneratorFactory, Menge::StatePopIncTriggerFactory, Menge::SetAgentPropertyEffectFactory, Menge::Agents::NavMeshElevationFactory, Menge::BFSM::ReturnTargetFactory, Menge::Agents::BergKDTreeFactory, Menge::BFSM::CircleGoalFactory, Menge::BFSM::TimerCondFactory, Menge::BFSM::ProbTargetFactory, Menge::BFSM::PointGoalFactory, Menge::BFSM::GoalVCFactory, Menge::BFSM::MirrorGoalSelectorFactory, Menge::BFSM::FarthestNMGoalSelectorFactory, Menge::BFSM::NearestNMGoalSelectorFactory, Menge::BFSM::ExplicitGoalSelectorFactory, Menge::NamedStateMemberTargetFactory, Menge::BFSM::TeleportActFactory, Menge::BFSM::GoalCondFactory, Menge::Agents::ConstProfileSelectorFactory, Menge::BFSM::OffsetGoalSelectorFactory, Menge::BFSM::SharedGoalSelectorFactory, Menge::Agents::ExplicitGeneratorFactory, Menge::Agents::FlatElevationFactory, Menge::Agents::ConstStateSelectorFactory, Menge::BFSM::AutoCondFactory, Menge::Agents::NavMeshObstacleSetFactory, Menge::BFSM::IdentityGoalSelectorFactory, Menge::Agents::ExplicitObstacleSetFactory, Menge::BFSM::FarthestGoalSelectorFactory, Menge::BFSM::NearestGoalSelectorFactory, Menge::BFSM::RandomGoalSelectorFactory, and Menge::BFSM::WeightedGoalSelectorFactory.

template<class Element>
virtual bool Menge::ElementFactory< Element >::setFromXML ( Element element,
TiXmlElement *  node,
const std::string &  specFldr 
) const
inlineprotectedvirtual

Given a pointer to an element instance, sets the appropriate fields from the provided XML node.

It is assumed that the value of the type attribute will be the element's type. (i.e. ElementFactory::thisFactory has already been called and returned true.) If sub-classes of ElementFactory introduce new parameters, then the sub-class should override this method but explicitly call the parent class's version.

Parameters
elementA pointer to the element whose attributes are to be set.
nodeThe XML node containing the element attributes.
specFldrThe path to the defining file. If the element references resources in the file system, it should be defined relative to this file location. This is the folder containing that path. For elements defined in behavior files, this will be the path to that file; the same is true for those defined in scene files
Returns
A boolean reporting success (true) or failure (false).
Exceptions
AnAttributeException if there is a problem in extracting values from the attribute set.

Reimplemented in Menge::NamedStateMemberTargetFactory, Menge::AgentPropertyEffectFactory< Manipulator >, Menge::AgentPropertyEffectFactory< SetPropertyManipulator >, Menge::AgentPropertyEffectFactory< ScalePropertyManipulator >, Menge::AgentPropertyEffectFactory< OffsetPropertyManipulator >, and Menge::StateEvtTriggerFactory.

template<class Element>
bool Menge::ElementFactory< Element >::thisFactory ( const std::string &  typeName) const
inline

Reports if the xml node defines an element for this factory.

This works by comparing the name attribute (if it exists) of the xml node with this element factory's name.

Parameters
typeNamethe name of the xml node in question
Returns
Returns true if the xml (appears) to specify this factory's element.

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