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& active() const;
67  void setActive(const bool&);
68 
69  const DtString& globalId() const;
70  void setGlobalId(const DtString&);
71 
72  const DtUUID& uuid() const;
73  void setUUID(const DtUUID&);
74 
75  const DtString& airportCode() const;
76  void setAirportCode(const DtString&);
77 
78  unsigned char value(const DtString&) const;
79  void setValue(const DtString&, unsigned char);
80  void restoreFromArchive(const DtString&);
81 
82  unsigned char runwayValue(const DtString&, const DtString& runwayName) const;
83  void setRunwayValue(const DtString&, unsigned char, const DtString& runwayName);
84 
85  std::vector<DtString> runwaysArchived() const;
86 
87  const DtString& markingText() const
88  {
89  return airportCode();
90  }
91 
92  void setMarkingText(const DtString& t)
93  {
94  setAirportCode(t);
95  }
96 
97  const DtForceType forceType() const;
98  void setForceType(const DtForceType&);
99 
100  const UInt32 appearanceBits() const;
101  void setAppearanceBits(const UInt32&);
102 
103  const DtEntityType entityType() const { return DtEntityType(objectType()); };
104  const DtObjectType objectType() const;
105  void setEntityType(const DtEntityType& t);
106 
107  const DtEntityIdentifier& entityId() const;
108  void setEntityId(const DtEntityIdentifier&);
109 
110  DtRunwayStateData& addRunway();
111  void removeRunway(const DtUUID&);
112  DtRunwayStateData& runway(const DtUUID&);
113  DtRunwayStateData& runway(const std::string&);
114  const DtRunwayStateData& runway(const DtUUID&) const;
115  const DtRunwayStateData& runway(const std::string&) const;
116  const DtRunwayLightStateData& runwayState(const std::string&) const;
117  const std::map<DtUUID, DtRunwayStateData>& runways() const;
118  void setRunways(const std::map<DtUUID, DtRunwayStateData>&);
119 
120  void restoreRunwaysFromArchive(const std::vector<DtString>&);
121 
122  protected:
125  };
126 
129  {
130  public:
133 
135  const DtAerodromeStateData& frameState() const { return myData; };
136 
137  const bool& isLocal() const;
138  const bool& active() const;
139  const DtString& globalId() const;
140  const DtUUID& uuid() const;
141  const DtString& airportCode() const;
142  const DtString& markingText() const
143  {
144  return airportCode();
145  }
146 
147  const UInt32 appearanceBits() const;
148  const DtEntityType entityType() const { return DtEntityType(objectType()); };
149  const DtObjectType objectType() const;
150  const DtEntityIdentifier& entityId() const;
151  std::vector<DtString> runwaysArchived() const;
152  unsigned char value(const DtString&) const;
153  unsigned char runwayValue(const DtString&, const DtString& runwayName) const;
154 
155  const DtForceType forceType() const;
156  const DtRunwayStateData& runway(const DtUUID&) const;
157  const DtRunwayStateData& runway(const std::string&) const;
158  const DtRunwayLightStateData& runwayState(const std::string&) const;
159  const std::map<DtUUID, DtRunwayStateData>& runways() const;
160 
161  protected:
164  {
165  myData = data;
166  }
167 
168  protected:
171  };
172 
176  {
177  public:
180 
181  bool isDoubleBuffered() { return true; };
182  const DtFrameStateInterface* currentFrameState() const { return &myCurrentFrameState; }
183  virtual DtFrameStateInterface* nextFrameState() { return &myNextFrameState; };
184  virtual const DtFrameStateInterface* nextFrameState() const { return &myNextFrameState; };
185 
187  {
188  if (myNextFrameState.isWritable())
189  {
190  myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
191  }
192 
193  myCurrentFrameState.emitComponentUpdated();
194  }
195 
197  {
198  myCurrentFrameState.updateStateData(sd);
199  myNextFrameState.updateStateData(sd);
200  }
201 
202  virtual void aboutToBeDeleted() override
203  {
205  myCurrentFrameState.aboutToBeDeleted();
206  myNextFrameState.aboutToBeDeleted();
207  }
208 
209  virtual void addAdditionalStateComponents() override;
210  Legion::WriteStateInstance writeStateInstance() override { return myWriteStateInstance; };
211 
213  virtual void convertToRemote();
214 
216  virtual void convertToLocal();
217 
218  protected:
221  Legion::WriteStateInstance myWriteStateInstance;
222  };
223 
227 }
DtAerodromeStateData myData
Definition: aerodromeStateComponent.h:124
UUID is a unique ID wrapper class.
Definition: uuid.h:59
bool isDoubleBuffered()
Definition: aerodromeStateComponent.h:181
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:226
Definition: stateDataTypes.h:23
DtStateData * myStateData
Definition: aerodromeStateComponent.h:169
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:128
virtual DtRunwayStateData & runway(const std::string &)
Definition: aerodromeStateComponent.h:35
const DtEntityType entityType() const
Definition: aerodromeStateComponent.h:103
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:92
void updateDataStorage()
Implement to update data storage. Called from advanceFrame.
Definition: aerodromeStateComponent.h:186
2) Define the next frame class. This will be used for write access.
Definition: aerodromeStateComponent.h:53
Definition: objectType.h:27
Legion::WriteStateInstance writeStateInstance() override
Definition: aerodromeStateComponent.h:210
const DtFrameStateInterface * currentFrameState() const
Definition: aerodromeStateComponent.h:182
virtual void restoreFromArchive(const DtString &)
Definition: aerodromeStateComponent.h:47
const DtString & markingText() const
Definition: aerodromeStateComponent.h:87
virtual DtFrameStateInterface * nextFrameState()
Definition: aerodromeStateComponent.h:183
const DtAerodromeStateData & frameState() const
Current frame state only can access current frame buffers. This ensures thread safety.
Definition: aerodromeStateComponent.h:135
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:123
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:196
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:184
Legion::WriteStateInstance myWriteStateInstance
Definition: aerodromeStateComponent.h:221
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:170
virtual unsigned char runwayValue(const DtString &, const DtString &runwayName) const
Definition: aerodromeStateComponent.h:43
const DtEntityType entityType() const
Definition: aerodromeStateComponent.h:148
#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:219
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: aerodromeStateComponent.h:175
DtAerodromeStateComponentNextFrame myNextFrameState
Definition: aerodromeStateComponent.h:220
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:202
const DtString & markingText() const
Definition: aerodromeStateComponent.h:142
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:163
Definition: aerodromeStateData.h:355

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)