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

The main event engine – causes event triggers to be evaluated and effects to be applied. More...

#include <EventSystem.h>

Public Member Functions

 EventSystem ()
 Constructor.
 
 ~EventSystem ()
 Destructor.
 
void addEvent (Event *evt)
 Adds an event to the system. More...
 
void evaluateEvents ()
 Evaluates the registered events.
 
void finalize ()
 Finalize the event system.
 
bool parseEvents (TiXmlElement *node, const std::string &behaveFldr)
 Parses events from an "Events" tag. More...
 

Static Public Member Functions

static void finalizeException (const std::string msg)
 Causes an event exception to be thrown based on the the system's tolerance for event configuration errors. More...
 

Static Public Attributes

static bool CONSERVATIVE_SETUP = true
 Global variable to indicate how event configuration errors should be handled. More...
 

Protected Attributes

std::vector< Event * > _events
 The events to process.
 
HASH_MAP< std::string,
EventTarget * > 
_targets
 A mapping from target names to targets.
 
HASH_MAP< std::string,
EventEffect * > 
_effects
 A mapping from effect names to effects.
 

Friends

class Event
 
class EventEffect
 
class EventTarget
 
class EventResponse
 
EventparseEvent (TiXmlElement *node, const std::string &specFldr)
 Parses the xml specification of an event and returns a parsed event. More...
 

Detailed Description

The main event engine – causes event triggers to be evaluated and effects to be applied.

Member Function Documentation

void Menge::EventSystem::addEvent ( Event evt)
inline

Adds an event to the system.

The system becomes the owner of the event and will take responsibility for deleting it.

Parameters
evtThe event to add to the system.
void Menge::EventSystem::finalizeException ( const std::string  msg)
static

Causes an event exception to be thrown based on the the system's tolerance for event configuration errors.

Parameters
msgThe event associated with the problem.
Exceptions
EventExceptionif the system is not conservative; i.e., configuration errors will be noted, but simulation will continue.
EventFatalExceptionif the system is conservative.
bool Menge::EventSystem::parseEvents ( TiXmlElement *  node,
const std::string &  behaveFldr 
)

Parses events from an "Events" tag.

Parameters
nodeThe node containing the event system description.
behaveFldrThe folder containing the behavior specification. all event paths are defined relative to this folder.
Returns
True if parsing was successful, false otherwise.

Friends And Related Function Documentation

Event* parseEvent ( TiXmlElement *  node,
const std::string &  specFldr 
)
friend

Parses the xml specification of an event and returns a parsed event.

The event instance will still need to be finalized.

Parameters
nodeThe tiny xml node containing the event specification.
specFldrThe path to the specification file. All external resource references in the spec file are defined relative to this folder.
Returns
A new instance of an Event. Null if there is a parsing error. The caller assumes responsibility to delete the instance.

Member Data Documentation

bool Menge::EventSystem::CONSERVATIVE_SETUP = true
static

Global variable to indicate how event configuration errors should be handled.

If true, event configuration errors result in fatal exceptions, if false they are merely warnings.


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