Emergency 20 Dokumentation  4.2.0
FreeplayEventPool.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Header guard ]
6 //[-------------------------------------------------------]
7 #pragma once
8 
9 
10 //[-------------------------------------------------------]
11 //[ Includes ]
12 //[-------------------------------------------------------]
13 #include "em5/Export.h"
14 
15 #include <qsf/base/StringHash.h>
16 
17 #include <boost/property_tree/ptree.hpp> // TODO(co) Can we get rid of this heavy weighted include, please? (this does not mean just moving it to the cpp file while this header still has a real dependency)
18 
19 #include <unordered_map>
20 #include <string>
21 #include <vector>
22 
23 
24 //[-------------------------------------------------------]
25 //[ Namespace ]
26 //[-------------------------------------------------------]
27 namespace em5
28 {
29 
30 
31  //[-------------------------------------------------------]
32  //[ Classes ]
33  //[-------------------------------------------------------]
39  {
40 
41 
42  //[-------------------------------------------------------]
43  //[ Fiends ]
44  //[-------------------------------------------------------]
46 
47 
48  //[-------------------------------------------------------]
49  //[ Public definitions ]
50  //[-------------------------------------------------------]
51  public:
52  typedef std::vector<boost::property_tree::ptree> EventPTreeArray;
53 
55  {
57  {
60  ERROR
61  };
62 
63  std::string mName;
64  EventPTreeArray mEventPTrees;
67  };
68  typedef std::vector<EventDefinition*> EventDefinitionArray;
69  typedef std::unordered_map<uint32, EventDefinition*> EventDefinitionMap;
70 
71 
72  //[-------------------------------------------------------]
73  //[ Public methods ]
74  //[-------------------------------------------------------]
75  public:
78 
83  const std::string& getName() const;
84 
89  const EventDefinitionArray& getEventDefinitions() const;
90 
91 
92  //[-------------------------------------------------------]
93  //[ Private methods ]
94  //[-------------------------------------------------------]
95  private:
100  void clear();
101 
106  bool insertEventPTrees(const std::string& key, const EventPTreeArray& factoryPTree);
107 
112  EventDefinition* getEventDefinition(const qsf::StringHash& key);
113 
118  const EventDefinitionMap& getEventDefinitionMap() const;
119 
124  void setName(const std::string& name);
125 
126 
127  //[-------------------------------------------------------]
128  //[ Private data ]
129  //[-------------------------------------------------------]
130  private:
131  EventDefinitionArray mEventDefinitionArray;
132  EventDefinitionMap mEventDefinitionMap;
133  std::string mName;
134 
135 
136  };
137 
138 
139 //[-------------------------------------------------------]
140 //[ Namespace ]
141 //[-------------------------------------------------------]
142 } // em5
Definition: ActionPriority.h:13
EventPTreeArray mEventPTrees
Property trees holding the actual event definition; there may be more than one if using multiple vari...
Definition: FreeplayEventPool.h:64
std::unordered_map< uint32, EventDefinition * > EventDefinitionMap
Definition: FreeplayEventPool.h:69
EMERGENCY 5 freeplay event pool class.
Definition: FreeplayEventPool.h:38
ProcessingState mProcessingState
Only for internal usage during load.
Definition: FreeplayEventPool.h:66
#define EM5_API_EXPORT
Definition: Export.h:28
std::string mName
Name as denoted in the event definition JSON file.
Definition: FreeplayEventPool.h:63
ProcessingState
Definition: FreeplayEventPool.h:56
Definition: FreeplayEventPool.h:54
Definition: FreeplayEventPool.h:59
EMERGENCY 5 freeplay event pool manager.
Definition: FreeplayEventPoolManager.h:44
std::vector< boost::property_tree::ptree > EventPTreeArray
Definition: FreeplayEventPool.h:52
EventDefinition * mCoreDefinition
Pointer to the core event definition; may be a null pointer.
Definition: FreeplayEventPool.h:65
Compile time string hash class.
Definition: StringHash.h:59
std::vector< EventDefinition * > EventDefinitionArray
Definition: FreeplayEventPool.h:68