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 | Friends | List of all members
Menge::BFSM::FSMDescrip Class Reference

The full description of the behavioral finite state machine. More...

#include <FSMDescrip.h>

Public Member Functions

 FSMDescrip ()
 Default constructor.
 
 ~FSMDescrip ()
 Destructor.
 
StateaddState (StateDescrip *sData)
 Instantiates a state based on the description. More...
 
bool loadFromXML (const std::string &xmlName, bool verbose)
 Initializes the configuration from an xml file. More...
 

Protected Member Functions

void addTransition (const std::string &name, Transition *trans)
 Adds the transition(s) associated with the given name. More...
 

Protected Attributes

std::list< StateDescrip * > _states
 List of state descriptions.
 
std::map< std::string,
std::list< Transition * > > 
_transitions
 List of transitions.
 
std::map< std::string, State * > _stateNameMap
 Map of state names to states.
 
std::list< Task * > _tasks
 A map from agent class id to a behavior description instance.
 
std::map< size_t, GoalSet * > _goalSets
 A mapping of goal sets to goals. The goal sets are represented by their id. The goals for each goal set are stored in a map, mapping the goal's local id to a descriptor for that goal. This is to facilitate set additions.
 
std::vector< VelModifier * > _velModifiers
 A list of velocity modifiers to be applied to all states in the simulator.
 
std::string _behaviorFldr
 The folder in which the behavior specification file appears.
 

Friends

FSMbuildFSM (FSMDescrip &fsmDescrip, Agents::SimulatorInterface *sim, bool VERBOSE)
 Creates an FSM instance from the config file. More...
 
Loggeroperator<< (Logger &out, const FSMDescrip &fsmDescrip)
 Friend operator for printing the behavior configuration to an output stream. More...
 

Detailed Description

The full description of the behavioral finite state machine.

Member Function Documentation

State * Menge::BFSM::FSMDescrip::addState ( StateDescrip sData)

Instantiates a state based on the description.

This is a behavior operation, because the behavior is responsible for:

  • tracking its states by name,
  • confirming no State name conflicts, and
  • connecting states with transitions.
Parameters
sDataThe description of the state to create.
Returns
A pointer to the created state. If there are two states with the same name in this behavior, NULL is returned.
void Menge::BFSM::FSMDescrip::addTransition ( const std::string &  name,
Transition trans 
)
protected

Adds the transition(s) associated with the given name.

Parameters
nameThe name of the state from which the transition originates. Alternatively, a comma-separated list.
transThe transition to add. The FSMDescrip takes ownership of the transition.
bool Menge::BFSM::FSMDescrip::loadFromXML ( const std::string &  xmlName,
bool  verbose 
)

Initializes the configuration from an xml file.

Parameters
xmlNameThe path to the xml file containing the behavior specification.
verboseDictates whether the parsing is verbose.
Returns
True if parsing was successfful, false otherwise.

Friends And Related Function Documentation

FSM* buildFSM ( FSMDescrip fsmDescrip,
Agents::SimulatorInterface sim,
bool  VERBOSE 
)
friend

Creates an FSM instance from the config file.

Parameters
fsmDescripThe behavior configuration description.
simAn instance of the simulator.
VERBOSEDictates whether the construction process is verbose (true) or not (false).
fsmDescripThe Behavior configuration.
simThe simulator which uses the BFSM.
VERBOSEThe optional argument which causes the construction process to report actions as it goes.
Returns
A pointer to the resultant FSM. If there is an error in construction, NULL is returned.
Logger& operator<< ( Logger out,
const FSMDescrip fsmDescrip 
)
friend

Friend operator for printing the behavior configuration to an output stream.

Parameters
outThe logger.
fsmDescripA behavior configuration to write to the stream.
Returns
The provided output stream.

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