Emergency 20 Dokumentation  4.2.0
ActivityStep.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/forward/BoostPTree.h>
17 #include <qsf/time/Time.h>
19 
20 
21 //[-------------------------------------------------------]
22 //[ Forward declarations ]
23 //[-------------------------------------------------------]
24 namespace qsf
25 {
26  class Entity;
27 }
28 
29 
30 //[-------------------------------------------------------]
31 //[ Namespace ]
32 //[-------------------------------------------------------]
33 namespace em5
34 {
35 
36 
37  //[-------------------------------------------------------]
38  //[ Classes ]
39  //[-------------------------------------------------------]
45  {
46 
47 
48  //[-------------------------------------------------------]
49  //[ Public definitions ]
50  //[-------------------------------------------------------]
51  public:
52  struct Parameters
53  {
58 
59  Parameters(qsf::Entity& entity) : mEntity(entity), mFirstUpdate(true) {}
60  };
61 
62  struct Result
63  {
64  enum Type
65  {
69  STOP
70  };
71 
73  };
74 
75 
76  //[-------------------------------------------------------]
77  //[ Public methods ]
78  //[-------------------------------------------------------]
79  public:
80  virtual ~ActivityStep() {}
81  inline const std::string& getType() const { return mType; }
82 
83  bool loadFromBoostPTree(const std::string& type, const boost::property_tree::ptree& rootPTree)
84  {
85  mType = type;
86  return loadFromBoostPTree(rootPTree);
87  }
88 
89 
90  //[-------------------------------------------------------]
91  //[ Public virtual em5::ActivityStep methods ]
92  //[-------------------------------------------------------]
93  public:
94  virtual bool loadFromBoostPTree(const boost::property_tree::ptree& rootPTree) = 0;
95  virtual Result::Type execute(const Parameters& parameters, Result& result) = 0;
96 
97 
98  //[-------------------------------------------------------]
99  //[ Private data ]
100  //[-------------------------------------------------------]
101  private:
102  std::string mType;
103 
104 
105  //[-------------------------------------------------------]
106  //[ CAMP reflection system ]
107  //[-------------------------------------------------------]
108  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
109 
110 
111  };
112 
113 
114 //[-------------------------------------------------------]
115 //[ Namespace ]
116 //[-------------------------------------------------------]
117 } // em5
118 
119 
120 //[-------------------------------------------------------]
121 //[ CAMP reflection system ]
122 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
qsf::Entity & mEntity
Definition: ActivityStep.h:54
Entity class.
Definition: Entity.h:46
#define EM5_API_EXPORT
Definition: Export.h:28
Definition: ActivityStep.h:62
Definition: ActivityStep.h:66
virtual ~ActivityStep()
Definition: ActivityStep.h:80
Definition: ActivityStep.h:67
Type
Definition: ActivityStep.h:64
qsf::NamedIdentifier mNextState
Definition: ActivityStep.h:72
Parameters(qsf::Entity &entity)
Definition: ActivityStep.h:59
bool mFirstUpdate
Definition: ActivityStep.h:55
Definition: PickupPersonByParamedicAction.h:21
#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
bool loadFromBoostPTree(const std::string &type, const boost::property_tree::ptree &rootPTree)
Definition: ActivityStep.h:83
const std::string & getType() const
Definition: ActivityStep.h:81
Definition: DensityCalculator.h:29
Activity step base class.
Definition: ActivityStep.h:44
Definition: ActivityStep.h:68
Class combining strings with their hashes.
Definition: NamedIdentifier.h:34
qsf::Time mTotalTime
Definition: ActivityStep.h:56
Definition: ActivityStep.h:52
Result
Definition: ActionResult.h:20
Type
Definition: GameModeType.h:21
qsf::Time mTimePassed
Definition: ActivityStep.h:57
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32