Emergency 20 Dokumentation  4.2.0
HydrantComponent.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 #include <qsf/math/EnumBitmask.h>
17 
18 
19 //[-------------------------------------------------------]
20 //[ Namespace ]
21 //[-------------------------------------------------------]
22 namespace em5
23 {
24 
25 
26  //[-------------------------------------------------------]
27  //[ Classes ]
28  //[-------------------------------------------------------]
34  {
35 
36 
37  //[-------------------------------------------------------]
38  //[ Public definitions ]
39  //[-------------------------------------------------------]
40  public:
41  static const uint32 COMPONENT_ID;
42 
44  // Order of hydrant types defines which ones are preferred, i.e. if there is a fixed hydrant in range of a fire, the vehicle hydrants will be ignored
46  {
47  VEHICLE_HOSE_CONNECTOR = 0,
48  FIXED_HYDRANT = 1,
49  GROUND_HYDRANT
50  };
51 
52 
53  //[-------------------------------------------------------]
54  //[ Public methods ]
55  //[-------------------------------------------------------]
56  public:
64  inline explicit HydrantComponent(qsf::Prototype* prototype);
65 
70  inline virtual ~HydrantComponent();
71 
72  inline HydrantType getHydrantType() const;
73  inline void setHydrantType(HydrantType hydrantType);
74 
82  inline bool isReserved() const;
83 
91  inline void setReserved(bool reserved);
92 
100  inline bool isConnected() const;
101 
109  inline qsf::Entity* getConnectedFireman() const;
110 
118  void connectFireman(qsf::Entity& firemanEntity);
119 
124  void disconnectFireman();
125 
126 
127  //[-------------------------------------------------------]
128  //[ Protected virtual qsf::Component methods ]
129  //[-------------------------------------------------------]
130  protected:
136  virtual void onSetActive(bool active) override;
137 
138 
139  //[-------------------------------------------------------]
140  //[ Private definitions ]
141  //[-------------------------------------------------------]
142  private:
143  enum InternalFlags
144  {
145  RESERVE_HYDRANT
146  };
147  typedef qsf::EnumBitmask<uint8, InternalFlags> InternalFlagSet;
148 
149 
150  //[-------------------------------------------------------]
151  //[ Private data ]
152  //[-------------------------------------------------------]
153  private:
154  // Connected to CAMP
155  HydrantType mHydrantType;
156 
157  // Internal
158  qsf::WeakPtr<qsf::Entity> mConnectedFireman;
159  InternalFlagSet mInternalFlags;
160 
161 
162  //[-------------------------------------------------------]
163  //[ CAMP reflection system ]
164  //[-------------------------------------------------------]
165  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
166 
167 
168  };
169 
170 
171 //[-------------------------------------------------------]
172 //[ Namespace ]
173 //[-------------------------------------------------------]
174 } // em5
175 
176 
177 //[-------------------------------------------------------]
178 //[ Implementation ]
179 //[-------------------------------------------------------]
181 
182 
183 //[-------------------------------------------------------]
184 //[ CAMP reflection system ]
185 //[-------------------------------------------------------]
187 QSF_CAMP_TYPE_NONCOPYABLE(em5::HydrantComponent::HydrantType)
Definition: ActionPriority.h:13
Abstract component class.
Definition: Component.h:105
Entity class.
Definition: Entity.h:46
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
HydrantType
Definition: HydrantComponent.h:45
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
EMERGENCY 5 hydrant component class.
Definition: HydrantComponent.h:33
Prototype class.
Definition: Prototype.h:100
static const uint32 COMPONENT_ID
"em5::HydrantComponent" unique component ID
Definition: HydrantComponent.h:41