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  };
51 
54  {
55  public:
58 
60  const DtAerodromeStateData& frameState() const { return myData; };
61  DtAerodromeStateData& frameState() { return myData; };
62 
63  const bool& isLocal() const;
64  void setIsLocal(const bool&);
65 
66  const bool& checkForNameReservation() const;
67  void setCheckForNameReservation(const bool&);
68 
69  const bool& active() const;
70  void setActive(const bool&);
71 
72  const DtString& globalId() const;
73  void setGlobalId(const DtString&);
74 
75  const DtUUID& uuid() const;
76  void setUUID(const DtUUID&);
77 
78  const DtString& airportCode() const;
79  void setAirportCode(const DtString&);
80 
81  unsigned char value(const DtString&) const;
82  void setValue(const DtString&, unsigned char);
83  void restoreFromArchive(const DtString&);
84 
85  unsigned char runwayValue(const DtString&, const DtString& runwayName) const;
86  void setRunwayValue(const DtString&, unsigned char, const DtString& runwayName);
87 
88  std::vector<DtString> runwaysArchived() const;
89 
90  const DtString& markingText() const
91  {
92  return airportCode();
93  }
94 
95  void setMarkingText(const DtString& t)
96  {
97  setAirportCode(t);
98  }
99 
100  const DtForceType forceType() const;
101  void setForceType(const DtForceType&);
102 
103  const UInt32 appearanceBits() const;
104  void setAppearanceBits(const UInt32&);
105 
106  const DtEntityType entityType() const { return DtEntityType(objectType()); };
107  const DtObjectType objectType() const;
108  void setEntityType(const DtEntityType& t);
109 
110  const DtEntityIdentifier& entityId() const;
111  void setEntityId(const DtEntityIdentifier&);
112 
113  DtRunwayStateData& addRunway();
114  void removeRunway(const DtUUID&);
115  DtRunwayStateData& runway(const DtUUID&);
116  DtRunwayStateData& runway(const std::string&);
117  const DtRunwayStateData& runway(const DtUUID&) const;
118  const DtRunwayStateData& runway(const std::string&) const;
119  const DtRunwayLightStateData& runwayState(const std::string&) const;
120  const std::map<DtUUID, DtRunwayStateData>& runways() const;
121  void setRunways(const std::map<DtUUID, DtRunwayStateData>&);
122 
123  void restoreRunwaysFromArchive(const std::vector<DtString>&);
124 
125  protected:
128  };
129 
132  {
133  public:
136 
138  const DtAerodromeStateData& frameState() const { return myData; };
139 
140  const bool& isLocal() const;
141  const bool& checkForNameReservation() const;
142  const bool& active() const;
143  const DtString& globalId() const;
144  const DtUUID& uuid() const;
145  const DtString& airportCode() const;
146  const DtString& markingText() const
147  {
148  return airportCode();
149  }
150 
151  const UInt32 appearanceBits() const;
152  const DtEntityType entityType() const { return DtEntityType(objectType()); };
153  const DtObjectType objectType() const;
154  const DtEntityIdentifier& entityId() const;
155  std::vector<DtString> runwaysArchived() const;
156  unsigned char value(const DtString&) const;
157  unsigned char runwayValue(const DtString&, const DtString& runwayName) const;
158 
159  const DtForceType forceType() const;
160  const DtRunwayStateData& runway(const DtUUID&) const;
161  const DtRunwayStateData& runway(const std::string&) const;
162  const DtRunwayLightStateData& runwayState(const std::string&) const;
163  const std::map<DtUUID, DtRunwayStateData>& runways() const;
164 
165  protected:
168  {
169  myData = data;
170  }
171 
172  protected:
175  };
176 
180  {
181  public:
184 
185  bool isDoubleBuffered() { return true; };
186  const DtFrameStateInterface* currentFrameState() const { return &myCurrentFrameState; }
187  virtual DtFrameStateInterface* nextFrameState() { return &myNextFrameState; };
188  virtual const DtFrameStateInterface* nextFrameState() const { return &myNextFrameState; };
189 
191  {
192  if (myNextFrameState.isWritable())
193  {
194  myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
195  }
196 
197  myCurrentFrameState.emitComponentUpdated();
198  }
199 
201  {
202  myCurrentFrameState.updateStateData(sd);
203  myNextFrameState.updateStateData(sd);
204  }
205 
206  virtual void aboutToBeDeleted() override
207  {
209  myCurrentFrameState.aboutToBeDeleted();
210  myNextFrameState.aboutToBeDeleted();
211  }
212 
213  virtual void addAdditionalStateComponents() override;
214  Legion::WriteStateInstance writeStateInstance() override { return myWriteStateInstance; };
215 
217  virtual void convertToRemote();
218 
220  virtual void convertToLocal();
221 
222  protected:
225  Legion::WriteStateInstance myWriteStateInstance;
226  };
227 
231 }
DtAerodromeStateData myData
Definition: aerodromeStateComponent.h:127
UUID is a unique ID wrapper class.
Definition: uuid.h:59
bool isDoubleBuffered()
Definition: aerodromeStateComponent.h:185
unsigned int UInt32
Definition: stateDataTypes.h:18
DtStateComponentCreator< DtAerodromeStateComponentImplementation > DtAerodromeStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: aerodromeStateComponent.h:230
Definition: stateDataTypes.h:23
DtStateData * myStateData
Definition: aerodromeStateComponent.h:173
virtual const DtRunwayLightStateData & runwayState(const std::string &) const
Definition: aerodromeStateComponent.h:38
3) Define the current frame class. This will be used for read access.
Definition: aerodromeStateComponent.h:131
virtual DtRunwayStateData & runway(const std::string &)
Definition: aerodromeStateComponent.h:35
const DtEntityType entityType() const
Definition: aerodromeStateComponent.h:106
Definition: aerodromeStateData.h:498
Definition: stateComponent.h:266
The DtSimulatedObjectStateComponent is an interface that all main components (those that are consider...
Definition: simulatedObjectStateComponent.h:21
const DtAerodromeStateData & frameState() const
Next frame access write access. Ensure this is only used in a single thread (i.e.a controller thread)...
Definition: aerodromeStateComponent.h:60
#define UNDEFINED_RETURNREF_ACCESSOR(ReturnType, Member)
Definition: doubleBufferedDataStorage.h:34
DtAerodromeStateData & frameState()
Definition: aerodromeStateComponent.h:61
void setMarkingText(const DtString &t)
Definition: aerodromeStateComponent.h:95
void updateDataStorage()
Implement to update data storage. Called from advanceFrame.
Definition: aerodromeStateComponent.h:190
2) Define the next frame class. This will be used for write access.
Definition: aerodromeStateComponent.h:53
Legion::WriteStateInstance writeStateInstance() override
Definition: aerodromeStateComponent.h:214
const DtFrameStateInterface * currentFrameState() const
Definition: aerodromeStateComponent.h:186
virtual void restoreFromArchive(const DtString &)
Definition: aerodromeStateComponent.h:47
const DtString & markingText() const
Definition: aerodromeStateComponent.h:90
virtual DtFrameStateInterface * nextFrameState()
Definition: aerodromeStateComponent.h:187
const DtAerodromeStateData & frameState() const
Current frame state only can access current frame buffers. This ensures thread safety.
Definition: aerodromeStateComponent.h:138
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:339
virtual void restoreRunwaysFromArchive(const std::vector< DtString > &)
Definition: aerodromeStateComponent.h:42
#define DEFINE_STATE_COMPONENT_TYPE(CreatedComponent)
Definition: stateComponent.h:228
DtStateData * myStateData
Definition: aerodromeStateComponent.h:126
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 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:379
void updateStateData(DtStateData *sd)
Implement to update data storage to the new state data.
Definition: aerodromeStateComponent.h:200
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()
virtual const DtFrameStateInterface * nextFrameState() const
Definition: aerodromeStateComponent.h:188
Legion::WriteStateInstance myWriteStateInstance
Definition: aerodromeStateComponent.h:225
virtual void setValue(const DtString &, unsigned char)
Definition: aerodromeStateComponent.h:46
virtual DtRunwayStateData & runway(const DtUUID &)
Definition: aerodromeStateComponent.h:34
DtAerodromeStateData myData
Definition: aerodromeStateComponent.h:174
virtual unsigned char runwayValue(const DtString &, const DtString &runwayName) const
Definition: aerodromeStateComponent.h:43
const DtEntityType entityType() const
Definition: aerodromeStateComponent.h:152
#define UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(Type, Member, Set)
Definition: doubleBufferedDataStorage.h:57
virtual const DtRunwayStateData & runway(const DtUUID &) const
Definition: aerodromeStateComponent.h:36
DtAerodromeStateComponentCurrentFrame myCurrentFrameState
Definition: aerodromeStateComponent.h:223
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: aerodromeStateComponent.h:179
DtAerodromeStateComponentNextFrame myNextFrameState
Definition: aerodromeStateComponent.h:224
virtual unsigned char value(const DtString &) const
Definition: aerodromeStateComponent.h:45
#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:206
const DtString & markingText() const
Definition: aerodromeStateComponent.h:146
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
This is a simple base class that will be used to return a pointer to current or next frame state...
Definition: stateComponent.h:291
virtual void removeRunway(const DtUUID &)
Definition: aerodromeStateComponent.h:33
void advanceFrame(const DtAerodromeStateData &data)
Definition: aerodromeStateComponent.h:167
Definition: aerodromeStateData.h:355

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)