Emergency 20 Dokumentation  4.2.0
Observer.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 
16 
17 
18 //[-------------------------------------------------------]
19 //[ Forward declarations ]
20 //[-------------------------------------------------------]
21 namespace em5
22 {
23  class FreeplayEvent;
24 }
25 
26 
27 //[-------------------------------------------------------]
28 //[ Namespace ]
29 //[-------------------------------------------------------]
30 namespace em5
31 {
32 
33 
34  //[-------------------------------------------------------]
35  //[ Classes ]
36  //[-------------------------------------------------------]
42  {
43 
44 
45  //[-------------------------------------------------------]
46  //[ Friends ]
47  //[-------------------------------------------------------]
48  friend class FreeplayEvent;
49 
50 
51  //[-------------------------------------------------------]
52  //[ Public methods ]
53  //[-------------------------------------------------------]
54  public:
59  virtual ~Observer();
60 
65  inline const std::string& getName() const;
66 
71  inline void setName(const std::string& name);
72 
73 
74  //[-------------------------------------------------------]
75  //[ Public virtual qsf::GameLogic methods ]
76  //[-------------------------------------------------------]
77  public:
82  virtual bool onStartup() override;
83 
88  virtual void onShutdown() override;
89 
90 
91  //[-------------------------------------------------------]
92  //[ Protected methods ]
93  //[-------------------------------------------------------]
94  protected:
99  explicit Observer(uint32 typeId);
100 
105  FreeplayEvent* getParentEvent() const;
106 
111  template<typename T>
112  T& createObserver(uint64 entityId);
113 
118  template<typename T>
119  T* getObserver(uint64 entityId);
120 
121 
122  //[-------------------------------------------------------]
123  //[ Private data ]
124  //[-------------------------------------------------------]
125  private:
126  FreeplayEvent* mParentEvent;
127  std::string mName;
128 
129 
130  };
131 
132 
133 //[-------------------------------------------------------]
134 //[ Namespace ]
135 //[-------------------------------------------------------]
136 } // em5
137 
138 
139 //[-------------------------------------------------------]
140 //[ Implementation ]
141 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
EMERGENCY 5 observer base class.
Definition: Observer.h:41
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
uint64_t uint64
Definition: PlatformTypes.h:184
Game logic base class.
Definition: GameLogic.h:44
Abstract EMERGENCY 5 freeplay event base class.
Definition: FreeplayEvent.h:66