Menge
Modular Pedestrian Simulation Framework for Research and Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PluginEngine.h
Go to the documentation of this file.
1 /*
2 
3 License
4 
5 Menge
6 Copyright and trademark 2012-14 University of North Carolina at Chapel Hill.
7 All rights reserved.
8 
9 Permission to use, copy, modify, and distribute this software and its documentation
10 for educational, research, and non-profit purposes, without fee, and without a
11 written agreement is hereby granted, provided that the above copyright notice,
12 this paragraph, and the following four paragraphs appear in all copies.
13 
14 This software program and documentation are copyrighted by the University of North
15 Carolina at Chapel Hill. The software program and documentation are supplied "as is,"
16 without any accompanying services from the University of North Carolina at Chapel
17 Hill or the authors. The University of North Carolina at Chapel Hill and the
18 authors do not warrant that the operation of the program will be uninterrupted
19 or error-free. The end-user understands that the program was developed for research
20 purposes and is advised not to rely exclusively on the program for any reason.
21 
22 IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE AUTHORS
23 BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
24 DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
25 DOCUMENTATION, EVEN IF THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE
26 AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS SPECIFICALLY
29 DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
30 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY STATUTORY WARRANTY
31 OF NON-INFRINGEMENT. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND
32 THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS HAVE NO OBLIGATIONS
33 TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
34 
35 Any questions or comments should be sent to the authors {menge,geom}@cs.unc.edu
36 
37 */
38 
44 #ifndef __PLUGIN_ENGINE_H__
45 #define __PLUGIN_ENGINE_H__
46 
47 #include <string>
48 #include <map>
49 #include "Plugin.h"
50 
51 namespace Menge {
52 
53  // Forward declaration
54  class SimulatorDBEntry;
55  class SimulatorDB;
56 
57  namespace BFSM {
58  class ActionFactory;
59  class ConditionFactory;
60  class TargetFactory;
61  class VelCompFactory;
62  class VelModFactory;
63  class TaskFactory;
64  class GoalFactory;
65  class GoalSelectorFactory;
66  }
67 
68  namespace Agents {
69  class ElevationFactory;
70  class SpatialQueryFactory;
71  class AgentGeneratorFactory;
72  class ProfileSelectorFactory;
73  class StateSelectorFactory;
74  class ObstacleSetFactory;
75  }
76 
77  class EventTriggerFactory;
78  class EventEffectFactory;
80 
85  typedef std::map< std::string, Plugin * > PluginMap;
86 
91  class PluginEngine {
92  public:
93  // TODO: Make the make SimulatorDB a PedestrianDB and make it static, like
94  // the ActionFactory
100  MENGE_API PluginEngine( SimulatorDB * simDB );
101 
105  MENGE_API ~PluginEngine();
106 
113  MENGE_API size_t loadPlugins( const std::string & pluginFldr );
114 
120  MENGE_API void registerModelDBEntry( SimulatorDBEntry * dbEntry );
121 
127  MENGE_API void registerActionFactory( BFSM::ActionFactory * factory );
128 
134  MENGE_API void registerConditionFactory( BFSM::ConditionFactory * factory );
135 
141  MENGE_API void registerTargetFactory( BFSM::TargetFactory * factory );
142 
148  MENGE_API void registerVelCompFactory( BFSM::VelCompFactory * factory );
149 
155  MENGE_API void registerVelModFactory( BFSM::VelModFactory * factory );
156 
162  MENGE_API void registerTaskFactory( BFSM::TaskFactory * factory );
163 
169  MENGE_API void registerGoalFactory( BFSM::GoalFactory * factory );
170 
176  MENGE_API void registerGoalSelectorFactory( BFSM::GoalSelectorFactory * factory );
177 
183  MENGE_API void registerElevationFactory( Agents::ElevationFactory * factory );
184 
190  MENGE_API void registerSpatialQueryFactory( Agents::SpatialQueryFactory * factory );
191 
198 
204  MENGE_API void registerObstacleSetFactory( Agents::ObstacleSetFactory * factory );
205 
212 
219 
225  MENGE_API void registerEventEffectFactory( EventEffectFactory * factory );
226 
232  MENGE_API void registerEventTriggerFactory( EventTriggerFactory * factory );
233 
239  MENGE_API void registerEventTargetFactory( EventTargetFactory * factory );
240 
241  protected:
245  PluginMap _plugins;
246 
251  };
252 } // namespace Menge
253 #endif // __PLUGIN_ENGINE_H__
A class for parsing the xml description of a task and instantiating particular instances.
Definition: TaskFactory.h:61
A class for parsing the xml description of a goal and instantiating particular instances.
Definition: GoalFactory.h:62
PluginMap _plugins
The loaded plugins.
Definition: PluginEngine.h:245
MENGE_API void registerGoalFactory(BFSM::GoalFactory *factory)
Register a GoalFactory.
Definition: PluginEngine.cpp:189
MENGE_API void registerGoalSelectorFactory(BFSM::GoalSelectorFactory *factory)
Register a GoalSelectorFactory.
Definition: PluginEngine.cpp:195
The core namespace. All elements of Menge are contained in this namespace.
Definition: AgentGenerator.cpp:43
MENGE_API void registerAgentGeneratorFactory(Agents::AgentGeneratorFactory *factory)
Register an AgentGeneratorFactory.
Definition: PluginEngine.cpp:213
A class for parsing the xml description of a velocity MODIFIER and instantiating particular instances...
Definition: VelModifierFactory.h:61
The class for parsing the xml description of a Condition and instantiating particular instances...
Definition: ConditionFactory.h:61
An entry in the simulator database.
Definition: SimulatorDBEntry.h:95
A class for parsing the xml description of a velocity component and instantiating particular instance...
Definition: VelComponentFactory.h:60
MENGE_API void registerElevationFactory(Agents::ElevationFactory *factory)
Register an ElevationFactory.
Definition: PluginEngine.cpp:201
A class for parsing the xml description of a spatial query and instantiating particular instances...
Definition: SpatialQueryFactory.h:62
SimulatorDB * _simDB
The simulator database for registration.
Definition: PluginEngine.h:250
MENGE_API void registerTaskFactory(BFSM::TaskFactory *factory)
Register a TaskFactory.
Definition: PluginEngine.cpp:183
MENGE_API PluginEngine(SimulatorDB *simDB)
Default constructor.
Definition: PluginEngine.cpp:72
MENGE_API ~PluginEngine()
Destructor.
Definition: PluginEngine.cpp:96
MENGE_API void registerSpatialQueryFactory(Agents::SpatialQueryFactory *factory)
Register an SpatialQueryFactory.
Definition: PluginEngine.cpp:207
MENGE_API void registerProfileSelectorFactory(Agents::ProfileSelectorFactory *factory)
Register an ProfileSelectorFactory.
Definition: PluginEngine.cpp:225
A class for parsing the xml description of an initial state selector element and instantiating partic...
Definition: StateSelectorFactory.h:59
The basic specification of a plug in.
The simulator database class.
Definition: SimulatorDB.h:117
MENGE_API void registerActionFactory(BFSM::ActionFactory *factory)
Register an ActionFactory.
Definition: PluginEngine.cpp:153
MENGE_API void registerEventTargetFactory(EventTargetFactory *factory)
Register an EventTargetFactory.
Definition: PluginEngine.cpp:249
MENGE_API void registerModelDBEntry(SimulatorDBEntry *dbEntry)
Register a simulator database entry.
Definition: PluginEngine.cpp:147
MENGE_API void registerObstacleSetFactory(Agents::ObstacleSetFactory *factory)
Register an ObstacleSetFactory.
Definition: PluginEngine.cpp:219
A class for parsing the xml description of an action and instantiating particular instances...
Definition: ElevationFactory.h:59
A class for parsing the xml description of an agent generator and instantiating particular instances...
Definition: ObstacleSetFactory.h:60
MENGE_API void registerTargetFactory(BFSM::TargetFactory *factory)
Register a TargetFactory.
Definition: PluginEngine.cpp:165
MENGE_API void registerVelModFactory(BFSM::VelModFactory *factory)
Register a VelModFactory.
Definition: PluginEngine.cpp:177
The base class for generating event triggers.
Definition: EventTriggerFactory.h:56
The class responsible for finding, managing, and deleting plugins.
Definition: PluginEngine.h:91
The base class for generating event effects.
Definition: EventEffectFactory.h:56
A class for parsing the xml description of an agent profile selector elements and instantiating parti...
Definition: ProfileSelectorFactory.h:59
MENGE_API void registerVelCompFactory(BFSM::VelCompFactory *factory)
Register a VelCompFactory.
Definition: PluginEngine.cpp:171
The namespace contains the Behavior Finite State Machine (BFSM) definition.
A class for parsing the xml description of a TransitionTarget and instantiating particular instances...
Definition: TargetFactory.h:61
MENGE_API size_t loadPlugins(const std::string &pluginFldr)
Initialize plug-ins from the given directory.
Definition: PluginEngine.cpp:101
A class for parsing the xml description of an agent generator and instantiating particular instances...
Definition: AgentGeneratorFactory.h:59
MENGE_API void registerEventEffectFactory(EventEffectFactory *factory)
Register an EventEffectFactory.
Definition: PluginEngine.cpp:237
MENGE_API void registerConditionFactory(BFSM::ConditionFactory *factory)
Register a ConditionFactory.
Definition: PluginEngine.cpp:159
MENGE_API void registerEventTriggerFactory(EventTriggerFactory *factory)
Register an EventTriggerFactory.
Definition: PluginEngine.cpp:243
A class for parsing the xml description of an action and instantiating particular instances...
Definition: ActionFactory.h:62
std::map< std::string, Plugin * > PluginMap
Mapping from the file name of the dynamic library to a pointer to the loaded plugin.
Definition: PluginEngine.h:79
The namespace that contains the basic simulation mechanisms.
MENGE_API void registerStateSelectorFactory(Agents::StateSelectorFactory *factory)
Register an StateSelectorFactory.
Definition: PluginEngine.cpp:231
The base class for generating event targets.
Definition: EventTargetFactory.h:56
A class for parsing the xml description of a goal selector and instantiating particular instances...
Definition: GoalSelectorFactory.h:63