VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
aerodromeStateComponent.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #pragma once
7 
11 #include "legionDataStore/writeStateInstance.h"
12 #include <boost/signals2.hpp>
13 
14 #include <vlutil/vlString.h>
15 
16 namespace makVrf
17 {
21  {
22  public:
24 
27  {
28  }
29 
30  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(DtString, airportCode, AirportCode)
31  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(bool, active, Active)
32  virtual DtRunwayStateData& addRunway() { throw DtUnimplementedMethod("The DtRunwayStateData addRunway() method is unimplemented"); };
33  virtual void removeRunway(const DtUUID&) { throw DtUnimplementedMethod("The void removeRunway(const DtUUID&) method is unimplemented"); };
34  virtual DtRunwayStateData& runway(const DtUUID&) { throw DtUnimplementedMethod("DtRunwayStateData& runway(const DtUUID&) method is unimplemented"); };
35  virtual DtRunwayStateData& runway(const std::string&) { throw DtUnimplementedMethod("DtRunwayStateData& runway(const std::string&) method is unimplemented"); };
36  virtual const DtRunwayStateData& runway(const DtUUID&) const { throw DtUnimplementedMethod("The const DtRunwayStateData& runway(const DtUUID&) const method is unimplemented"); };
37  virtual const DtRunwayStateData& runway(const std::string&) const { throw DtUnimplementedMethod("The const DtRunwayStateData& runway(const std::string&) const method is unimplemented"); };
38  virtual const DtRunwayLightStateData& runwayState(const std::string&) const { throw DtUnimplementedMethod("The const DtRunwayLightStateData& runwayState(const std::string&) const method is unimplemented"); };
39  virtual const std::map<DtUUID, DtRunwayStateData>& runways() const { throw DtUnimplementedMethod("The std::map<DtUUID, DtRunwayStateData> runways() const method is unimplemented"); };
40  virtual void setRunways(const std::map<DtUUID, DtRunwayStateData>&) { throw DtUnimplementedMethod("The void setRunways(const std::map<DtUUID, DtRunwayStateData>&) method is unimplemented"); };
41  virtual std::vector<DtString> runwaysArchived() const { throw DtUnimplementedMethod("The std::vector<DtString> runwaysArchived() const method is unimplemented"); };
42  virtual void restoreRunwaysFromArchive(const std::vector<DtString>&) { throw DtUnimplementedMethod("The void restoreRunwaysFromArchive(const std::vector<DtString>&) method is unimplemented"); };
43  virtual unsigned char runwayValue(const DtString&, const DtString& runwayName) const { throw DtUnimplementedMethod("The unsigned char runwayValue(const DtString&, const DtString& runwayName) const method is unimplemented"); };
44  virtual void setRunwayValue(const DtString&, unsigned char, const DtString& runwayName) { throw DtUnimplementedMethod("The void setRunwayValue(const DtString&, unsigned char, const DtString& runwayName) const method is unimplemented"); };
45  virtual unsigned char value(const DtString&) const { throw DtUnimplementedMethod("The unsigned char value(const DtString&) const method is unimplemented"); };
46  virtual void setValue(const DtString&, unsigned char) { throw DtUnimplementedMethod("The void setValue(const DtString&, unsigned char) const method is unimplemented"); };
47  virtual void restoreFromArchive(const DtString&) { throw DtUnimplementedMethod("The void restoreFromArchive(const DtString&) const method is unimplemented"); };
49  };
50 
53  {
54  public:
56  virtual ~DtAerodromeStateComponentNextFrame() override;
57 
59  virtual const DtAerodromeStateData& frameState() const override { return myData; };
60  DtAerodromeStateData& frameState() { return myData; };
61 
62  virtual const bool& isLocal() const override;
63  virtual void setIsLocal(const bool&) override;
64 
65  virtual const bool& checkForNameReservation() const override;
66  virtual void setCheckForNameReservation(const bool&) override;
67 
68  virtual const bool& active() const override;
69  virtual void setActive(const bool&) override;
70 
71  virtual const DtString& globalId() const override;
72  virtual void setGlobalId(const DtString&) override;
73 
74  virtual const DtUUID& uuid() const override;
75  virtual void setUUID(const DtUUID&) override;
76 
77  virtual const DtString& airportCode() const override;
78  virtual void setAirportCode(const DtString&) override;
79 
80  virtual unsigned char value(const DtString&) const override;
81  virtual void setValue(const DtString&, unsigned char) override;
82  virtual void restoreFromArchive(const DtString&) override;
83 
84  virtual unsigned char runwayValue(const DtString&, const DtString& runwayName) const override;
85  virtual void setRunwayValue(const DtString&, unsigned char, const DtString& runwayName) override;
86 
87  virtual std::vector<DtString> runwaysArchived() const override;
88 
89  virtual const DtString& markingText() const override
90  {
91  return airportCode();
92  }
93 
94  virtual void setMarkingText(const DtString& t) override
95  {
96  setAirportCode(t);
97  }
98 
100  virtual const unsigned long long orbatId() const override { return 0; };
101  virtual void setOrbatId(const unsigned long long&) override {};
102 
103  virtual void setUserLongLongData(const unsigned long long&) override;
104  virtual const UInt64 userLongLongData() const override;
105 
106  virtual const DtForceType forceType() const override;
107  virtual void setForceType(const DtForceType&) override;
108 
109  virtual const UInt32 appearanceBits() const override;
110  virtual void setAppearanceBits(const UInt32&) override;
111 
112  virtual const DtEntityType entityType() const override { return DtEntityType(objectType()); };
113  virtual const DtEntityType objectType() const override;
114  virtual void setEntityType(const DtEntityType& t) override;
115 
116  virtual const DtEntityIdentifier& entityId() const override;
117  virtual void setEntityId(const DtEntityIdentifier&) override;
118 
119  virtual const DtSimulationAddress simEngineAddress() const override;
120 
121  virtual DtRunwayStateData& addRunway() override;
122  virtual void removeRunway(const DtUUID&) override;
123  virtual DtRunwayStateData& runway(const DtUUID&) override;
124  virtual DtRunwayStateData& runway(const std::string&) override;
125  virtual const DtRunwayStateData& runway(const DtUUID&) const override;
126  virtual const DtRunwayStateData& runway(const std::string&) const override;
127  virtual const DtRunwayLightStateData& runwayState(const std::string&) const override;
128 
129  virtual const std::map<DtUUID, DtRunwayStateData>& runways() const override;
130  virtual void setRunways(const std::map<DtUUID, DtRunwayStateData>&) override;
131 
132  virtual void restoreRunwaysFromArchive(const std::vector<DtString>&) override;
133 
134  protected:
136  };
137 
140  {
141  public:
143  virtual ~DtAerodromeStateComponentCurrentFrame() override;
144 
146  virtual const DtAerodromeStateData& frameState() const override { return myData; };
147 
148  virtual const bool& isLocal() const override;
149  virtual const bool& checkForNameReservation() const override;
150  virtual const bool& active() const override;
151  virtual const DtString& globalId() const override;
152  virtual const DtUUID& uuid() const override;
153  virtual const DtString& airportCode() const override;
154  virtual const DtString& markingText() const override { return airportCode(); }
155 
156  virtual const UInt64 userLongLongData() const override;
157 
158  virtual const UInt32 appearanceBits() const override;
159  virtual const DtEntityType entityType() const override { return DtEntityType(objectType()); };
160  virtual const DtEntityType objectType() const override;
161  virtual const DtEntityIdentifier& entityId() const override;
162  virtual const DtSimulationAddress simEngineAddress() const override;
163  virtual std::vector<DtString> runwaysArchived() const override;
164  virtual unsigned char value(const DtString&) const override;
165  virtual unsigned char runwayValue(const DtString&, const DtString& runwayName) const override;
166  virtual const unsigned long long orbatId() const override { return 0; };
167 
168  virtual const DtForceType forceType() const override;
169  virtual const DtRunwayStateData& runway(const DtUUID&) const override;
170  virtual const DtRunwayStateData& runway(const std::string&) const override;
171  virtual const DtRunwayLightStateData& runwayState(const std::string&) const override;
172  virtual const std::map<DtUUID, DtRunwayStateData>& runways() const override;
173 
174  protected:
177  {
178  myData = data;
179  }
180 
181  protected:
183  };
184 
188  {
189  public:
191  virtual ~DtAerodromeStateComponentImplementation() override;
192 
193  bool isDoubleBuffered() { return true; };
194  virtual const DtFrameStateInterface* currentFrameState() const override { return &myCurrentFrameState; }
195  virtual DtFrameStateInterface* nextFrameState() override { return &myNextFrameState; };
196  virtual const DtFrameStateInterface* nextFrameState() const override { return &myNextFrameState; };
197 
198  virtual void updateDataStorage() override
199  {
200  if (myNextFrameState.isWritable())
201  {
202  myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
203  }
204 
205  myCurrentFrameState.emitComponentUpdated();
206  }
207 
208  virtual void updateStateData(DtStateData* sd) override
209  {
210  myCurrentFrameState.updateStateData(sd);
211  myNextFrameState.updateStateData(sd);
212  }
213 
214  virtual void aboutToBeDeleted() override
215  {
217  myCurrentFrameState.aboutToBeDeleted();
218  myNextFrameState.aboutToBeDeleted();
219  }
220 
221  virtual void addAdditionalStateComponents() override;
222  virtual Legion::WriteStateInstance writeStateInstance() override { return myWriteStateInstance; };
223 
225  virtual void convertToRemote() override;
226 
228  virtual void convertToLocal() override;
229 
230  protected:
233  Legion::WriteStateInstance myWriteStateInstance;
234  };
235 
239 }
DtAerodromeStateData myData
Definition: aerodromeStateComponent.h:135
UUID is a unique ID wrapper class.
Definition: uuid.h:59
bool isDoubleBuffered()
Definition: aerodromeStateComponent.h:193
virtual const unsigned long long orbatId() const override
Aerodromes cannot be in orbat.
Definition: aerodromeStateComponent.h:100
DtStateComponentCreator< DtAerodromeStateComponentImplementation > DtAerodromeStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: aerodromeStateComponent.h:238
Definition: stateDataTypes.h:23
virtual const DtRunwayLightStateData & runwayState(const std::string &) const
Definition: aerodromeStateComponent.h:38
virtual const unsigned long long orbatId() const override
Definition: aerodromeStateComponent.h:166
3) Define the current frame class. This will be used for read access.
Definition: aerodromeStateComponent.h:139
virtual DtRunwayStateData & runway(const std::string &)
Definition: aerodromeStateComponent.h:35
unsigned int UInt32
Definition: stateDataTypes.h:18
Definition: aerodromeStateData.h:498
virtual const DtString & markingText() const override
Definition: aerodromeStateComponent.h:89
Definition: stateComponent.h:269
The DtSimulatedObjectStateComponent is an interface that all main components (those that are consider...
Definition: simulatedObjectStateComponent.h:21
virtual const DtAerodromeStateData & frameState() const override
Current frame state only can access current frame buffers. This ensures thread safety.
Definition: aerodromeStateComponent.h:146
unsigned long long UInt64
Definition: stateDataTypes.h:17
#define UNDEFINED_RETURNREF_ACCESSOR(ReturnType, Member)
Definition: doubleBufferedDataStorage.h:34
DtAerodromeStateData & frameState()
Definition: aerodromeStateComponent.h:60
2) Define the next frame class. This will be used for write access.
Definition: aerodromeStateComponent.h:52
virtual void restoreFromArchive(const DtString &)
Definition: aerodromeStateComponent.h:47
virtual DtFrameStateInterface * nextFrameState() override
Definition: aerodromeStateComponent.h:195
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:398
virtual void restoreRunwaysFromArchive(const std::vector< DtString > &)
Definition: aerodromeStateComponent.h:42
#define DEFINE_STATE_COMPONENT_TYPE(CreatedComponent)
Definition: stateComponent.h:231
virtual const DtEntityType entityType() const override
Definition: aerodromeStateComponent.h:159
virtual const std::map< DtUUID, DtRunwayStateData > & runways() const
Definition: aerodromeStateComponent.h:39
virtual const DtRunwayStateData & runway(const std::string &) const
Definition: aerodromeStateComponent.h:37
virtual const DtAerodromeStateData & frameState() const override
Next frame access write access. Ensure this is only used in a single thread (i.e.a controller thread)...
Definition: aerodromeStateComponent.h:59
virtual std::vector< DtString > runwaysArchived() const
Definition: aerodromeStateComponent.h:41
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:384
virtual const DtEntityType entityType() const override
Definition: aerodromeStateComponent.h:112
1) Define the interface class that will be used to represent the next and curent frames. The UNDEFINED_ macros are convenience macros that will define methods that throw exceptions (until they are implemented)
Definition: aerodromeStateComponent.h:20
Definition: aerodromeStateData.h:17
virtual void aboutToBeDeleted()
Legion::WriteStateInstance myWriteStateInstance
Definition: aerodromeStateComponent.h:233
virtual void setMarkingText(const DtString &t) override
Definition: aerodromeStateComponent.h:94
virtual void setValue(const DtString &, unsigned char)
Definition: aerodromeStateComponent.h:46
virtual void updateDataStorage() override
Implement to update data storage. Called from advanceFrame.
Definition: aerodromeStateComponent.h:198
virtual DtRunwayStateData & runway(const DtUUID &)
Definition: aerodromeStateComponent.h:34
DtAerodromeStateData myData
Definition: aerodromeStateComponent.h:182
virtual unsigned char runwayValue(const DtString &, const DtString &runwayName) const
Definition: aerodromeStateComponent.h:43
#define UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(Type, Member, Set)
Definition: doubleBufferedDataStorage.h:57
virtual const DtRunwayStateData & runway(const DtUUID &) const
Definition: aerodromeStateComponent.h:36
virtual const DtString & markingText() const override
Definition: aerodromeStateComponent.h:154
DtAerodromeStateComponentCurrentFrame myCurrentFrameState
Definition: aerodromeStateComponent.h:231
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: aerodromeStateComponent.h:187
DtAerodromeStateComponentNextFrame myNextFrameState
Definition: aerodromeStateComponent.h:232
virtual unsigned char value(const DtString &) const
Definition: aerodromeStateComponent.h:45
virtual Legion::WriteStateInstance writeStateInstance() override
Definition: aerodromeStateComponent.h:222
virtual void updateStateData(DtStateData *sd) override
Implement to update data storage to the new state data.
Definition: aerodromeStateComponent.h:208
virtual const DtFrameStateInterface * currentFrameState() const override
Definition: aerodromeStateComponent.h:194
#define DT_DLL_vrfStateData
This file is used to determine how to build Disable inconsistent dll linkage warning Visual Studio 6...
Definition: vrfStateDataDefines.h:26
virtual void aboutToBeDeleted() override
Definition: aerodromeStateComponent.h:214
virtual void setRunwayValue(const DtString &, unsigned char, const DtString &runwayName)
Definition: aerodromeStateComponent.h:44
virtual void setRunways(const std::map< DtUUID, DtRunwayStateData > &)
Definition: aerodromeStateComponent.h:40
virtual void setOrbatId(const unsigned long long &) override
Definition: aerodromeStateComponent.h:101
virtual const DtFrameStateInterface * nextFrameState() const override
Definition: aerodromeStateComponent.h:196
This is a simple base class that will be used to return a pointer to current or next frame state...
Definition: stateComponent.h:294
virtual void removeRunway(const DtUUID &)
Definition: aerodromeStateComponent.h:33
void advanceFrame(const DtAerodromeStateData &data)
Definition: aerodromeStateComponent.h:176
Definition: aerodromeStateData.h:355

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)