Atoms Crowd  7.0.0
SimulationEvents.h
1 #pragma once
2 // ===========================================================================
3 // Copyright (c) 2015 Toolchefs Ltd. All rights reserved.
4 //
5 // Use of this software is subject to the terms of the Toolchefs license
6 // agreement provided at the time of installation or download, or which
7 // otherwise accompanies this software in either electronic or hard copy form.
8 // ===========================================================================
9 
10 
11 #include <Atoms/Globals.h>
12 #include <AtomsCore/Globals.h>
13 #include <Atoms/SimulationEvent.h>
14 #include <map>
15 #include <vector>
16 
17 
18 namespace Atoms
19 {
21 
23  class ATOMS_EXPORT SimulationEvents
24  {
25  public:
26 
27  typedef SimulationEvent* (*creatorFn)(const std::string& parameter);
28 
31 
33 
37  AtomsPtr<SimulationEvent> createSimulationEvent(const std::string& name);
38 
40 
44  SimulationEvent* createSimulationEventRawPtr(const std::string& name);
45 
47 
53  bool registerSimulationEvent(const std::string& eventName, creatorFn func, unsigned int moduleType = SimulationEvent::kNative, bool replace = false);
54 
56 
60  bool deregisterSimulationEvent(const std::string& name);
61 
63 
66  std::vector<std::string> getRegisteredSimulationEvents();
67 
69 
73  bool isRegistered(const std::string& name);
74 
76  void clear();
77 
79  short eventType(const std::string& name);
80 
81  private:
82 
85 
88 
91 
93  SimulationEvents& operator=(const SimulationEvents&);
94 
95  private:
96 
98 
101  std::map<std::string, creatorFn> m_factoryMap;
102 
103  std::map<std::string, short> m_eventTypes;
104  };
105 }
Simiation Event.
Definition: SimulationEvent.h:22
Simulation event factory.
Definition: SimulationEvents.h:24
short eventType(const std::string &name)
Gets the event type.
static SimulationEvents & instance()
Singleton access.
bool registerSimulationEvent(const std::string &eventName, creatorFn func, unsigned int moduleType=SimulationEvent::kNative, bool replace=false)
Registers a behaviour module in the factory.
std::vector< std::string > getRegisteredSimulationEvents()
Gets all Simulation Event modules.
SimulationEvent * createSimulationEventRawPtr(const std::string &name)
Creates a SimulationEvent.
void clear()
Clears factory.
bool deregisterSimulationEvent(const std::string &name)
Deregisters a SimulationEventtype from the factory.
AtomsPtr< SimulationEvent > createSimulationEvent(const std::string &name)
Creates a SimulationEvent.
bool isRegistered(const std::string &name)
Checks if a Simulation Event is registered.
Atoms namespace.
Definition: Agent.h:29