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 {
22  {
23  public:
25 
26 
30  {
31  }
32 
34  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(DtString, airportCode, AirportCode)
36  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(bool, active, Active)
39  virtual DtRunwayStateData& addRunway() { throw DtUnimplementedMethod("The DtRunwayStateData addRunway() method is unimplemented"); };
42  virtual void removeRunway(const DtUUID&) { throw DtUnimplementedMethod("The void removeRunway(const DtUUID&) method is unimplemented"); };
46  virtual DtRunwayStateData& runway(const DtUUID&) { throw DtUnimplementedMethod("DtRunwayStateData& runway(const DtUUID&) method is unimplemented"); };
50  virtual DtRunwayStateData& runway(const std::string&) { throw DtUnimplementedMethod("DtRunwayStateData& runway(const std::string&) method is unimplemented"); };
54  virtual const DtRunwayStateData& runway(const DtUUID&) const { throw DtUnimplementedMethod("The const DtRunwayStateData& runway(const DtUUID&) const method is unimplemented"); };
58  virtual const DtRunwayStateData& runway(const std::string&) const { throw DtUnimplementedMethod("The const DtRunwayStateData& runway(const std::string&) const method is unimplemented"); };
62  virtual const DtRunwayLightStateData& runwayState(const std::string&) const { throw DtUnimplementedMethod("The const DtRunwayLightStateData& runwayState(const std::string&) const method is unimplemented"); };
65  virtual const std::map<DtUUID, DtRunwayStateData>& runways() const { throw DtUnimplementedMethod("The std::map<DtUUID, DtRunwayStateData> runways() const method is unimplemented"); };
68  virtual void setRunways(const std::map<DtUUID, DtRunwayStateData>&) { throw DtUnimplementedMethod("The void setRunways(const std::map<DtUUID, DtRunwayStateData>&) method is unimplemented"); };
71  virtual std::vector<DtString> runwaysArchived() const { throw DtUnimplementedMethod("The std::vector<DtString> runwaysArchived() const method is unimplemented"); };
74  virtual void restoreRunwaysFromArchive(const std::vector<DtString>&) { throw DtUnimplementedMethod("The void restoreRunwaysFromArchive(const std::vector<DtString>&) method is unimplemented"); };
79  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"); };
84  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"); };
88  virtual unsigned char value(const DtString&) const { throw DtUnimplementedMethod("The unsigned char value(const DtString&) const method is unimplemented"); };
92  virtual void setValue(const DtString&, unsigned char) { throw DtUnimplementedMethod("The void setValue(const DtString&, unsigned char) const method is unimplemented"); };
95  virtual void restoreFromArchive(const DtString&) { throw DtUnimplementedMethod("The void restoreFromArchive(const DtString&) const method is unimplemented"); };
99  };
100 
104  {
105  public:
109  virtual ~DtAerodromeStateComponentNextFrame() override;
110 
112  virtual const DtAerodromeStateData& frameState() const override { return myData; };
115  DtAerodromeStateData& frameState() { return myData; };
116 
118  virtual const bool& isLocal() const override;
121  virtual void setIsLocal(const bool&) override;
122 
124  virtual const bool& checkForNameReservation() const override;
127  virtual void setCheckForNameReservation(const bool&) override;
128 
130  virtual const bool& active() const override;
133  virtual void setActive(const bool&) override;
134 
136  virtual const DtString& globalId() const override;
139  virtual void setGlobalId(const DtString&) override;
140 
142  virtual const DtUUID& uuid() const override;
145  virtual void setUUID(const DtUUID&) override;
146 
148  virtual const DtString& airportCode() const override;
151  virtual void setAirportCode(const DtString&) override;
152 
155  virtual unsigned char value(const DtString&) const override;
159  virtual void setValue(const DtString&, unsigned char) override;
162  virtual void restoreFromArchive(const DtString&) override;
163 
167  virtual unsigned char runwayValue(const DtString&, const DtString& runwayName) const override;
172  virtual void setRunwayValue(const DtString&, unsigned char, const DtString& runwayName) override;
173 
175  virtual std::vector<DtString> runwaysArchived() const override;
176 
178  virtual const DtString& markingText() const override
179  {
180  return airportCode();
181  }
182 
185  virtual void setMarkingText(const DtString& t) override
186  {
187  setAirportCode(t);
188  }
189 
191  virtual const unsigned long long orbatId() const override { return 0; };
192  virtual void setOrbatId(const unsigned long long&) override {};
193 
196  virtual void setUserLongLongData(const unsigned long long&) override;
198  virtual const UInt64 userLongLongData() const override;
199 
201  virtual const DtString& sidc() const override;
202  virtual void setSidc(const DtString&) override;
203 
205  virtual const DtForceType forceType() const override;
208  virtual void setForceType(const DtForceType&) override;
209 
211  virtual const UInt32 appearanceBits() const override;
214  virtual void setAppearanceBits(const UInt32&) override;
215 
217  virtual const DtEntityType entityType() const override { return DtEntityType(objectType()); };
219  virtual const DtEntityType objectType() const override;
222  virtual void setEntityType(const DtEntityType& t) override;
223 
225  virtual const DtEntityIdentifier& entityId() const override;
228  virtual void setEntityId(const DtEntityIdentifier&) override;
229 
231  virtual const DtSimulationAddress simEngineAddress() const override;
232 
234  virtual DtRunwayStateData& addRunway() override;
237  virtual void removeRunway(const DtUUID&) override;
240  virtual DtRunwayStateData& runway(const DtUUID&) override;
243  virtual DtRunwayStateData& runway(const std::string&) override;
246  virtual const DtRunwayStateData& runway(const DtUUID&) const override;
249  virtual const DtRunwayStateData& runway(const std::string&) const override;
252  virtual const DtRunwayLightStateData& runwayState(const std::string&) const override;
253 
255  virtual const std::map<DtUUID, DtRunwayStateData>& runways() const override;
258  virtual void setRunways(const std::map<DtUUID, DtRunwayStateData>&) override;
259 
262  virtual void restoreRunwaysFromArchive(const std::vector<DtString>&) override;
263 
264  protected:
267  };
268 
272  {
273  public:
277  virtual ~DtAerodromeStateComponentCurrentFrame() override;
278 
280  virtual const DtAerodromeStateData& frameState() const override { return myData; };
281 
283  virtual const bool& isLocal() const override;
285  virtual const bool& checkForNameReservation() const override;
287  virtual const bool& active() const override;
289  virtual const DtString& globalId() const override;
291  virtual const DtUUID& uuid() const override;
293  virtual const DtString& airportCode() const override;
295  virtual const DtString& markingText() const override { return airportCode(); }
296 
298  virtual const UInt64 userLongLongData() const override;
299 
301  virtual const UInt32 appearanceBits() const override;
303  virtual const DtEntityType entityType() const override { return DtEntityType(objectType()); };
305  virtual const DtEntityType objectType() const override;
307  virtual const DtEntityIdentifier& entityId() const override;
309  virtual const DtSimulationAddress simEngineAddress() const override;
311  virtual std::vector<DtString> runwaysArchived() const override;
314  virtual unsigned char value(const DtString&) const override;
318  virtual unsigned char runwayValue(const DtString&, const DtString& runwayName) const override;
320  virtual const unsigned long long orbatId() const override { return 0; };
321 
323  virtual const DtString& sidc() const override;
324 
326  virtual const DtForceType forceType() const override;
329  virtual const DtRunwayStateData& runway(const DtUUID&) const override;
332  virtual const DtRunwayStateData& runway(const std::string&) const override;
335  virtual const DtRunwayLightStateData& runwayState(const std::string&) const override;
337  virtual const std::map<DtUUID, DtRunwayStateData>& runways() const override;
338 
339  protected:
344  {
345  myData = data;
346  }
347 
348  protected:
351  };
352 
357  {
358  public:
362  virtual ~DtAerodromeStateComponentImplementation() override;
363 
365  bool isDoubleBuffered() { return true; };
367  virtual const DtFrameStateInterface* currentFrameState() const override { return &myCurrentFrameState; }
369  virtual DtFrameStateInterface* nextFrameState() override { return &myNextFrameState; };
371  virtual const DtFrameStateInterface* nextFrameState() const override { return &myNextFrameState; };
372 
374  virtual void updateDataStorage() override
375  {
376  if (myNextFrameState.isWritable())
377  {
378  myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
379  }
380 
381  myCurrentFrameState.emitComponentUpdated();
382  }
383 
386  virtual void updateStateData(DtStateData* sd) override
387  {
388  myCurrentFrameState.updateStateData(sd);
389  myNextFrameState.updateStateData(sd);
390  }
391 
393  virtual void aboutToBeDeleted() override
394  {
396  myCurrentFrameState.aboutToBeDeleted();
397  myNextFrameState.aboutToBeDeleted();
398  }
399 
401  virtual void addAdditionalStateComponents() override;
403  virtual Legion::WriteStateInstance writeStateInstance() override { return myWriteStateInstance; };
404 
406  virtual void convertToRemote() override;
407 
409  virtual void convertToLocal() override;
410 
411  protected:
417  Legion::WriteStateInstance myWriteStateInstance;
418  };
419 
423 }
DtAerodromeStateData myData
Mutable aerodrome state data buffer for the next frame.
Definition: aerodromeStateComponent.h:266
UUID is a unique ID wrapper class.
Definition: uuid.h:59
bool isDoubleBuffered()
Returns true, indicating this component uses double-buffered state storage.
Definition: aerodromeStateComponent.h:365
virtual const unsigned long long orbatId() const override
Aerodromes cannot be in orbat.
Definition: aerodromeStateComponent.h:191
DtStateComponentCreator< DtAerodromeStateComponentImplementation > DtAerodromeStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: aerodromeStateComponent.h:422
Exception thrown when a required method has not been implemented.
Definition: stateDataTypes.h:30
virtual const DtRunwayLightStateData & runwayState(const std::string &) const
Returns the runway light state data for the runway end identified by the given name.
Definition: aerodromeStateComponent.h:62
virtual const unsigned long long orbatId() const override
Aerodromes cannot be in orbat.
Definition: aerodromeStateComponent.h:320
3) Define the current frame class. This will be used for read access. Read-only implementation of DtA...
Definition: aerodromeStateComponent.h:271
virtual DtRunwayStateData & runway(const std::string &)
Returns a mutable reference to the runway identified by the given name.
Definition: aerodromeStateComponent.h:50
unsigned int UInt32
32-bit unsigned integer type.
Definition: stateDataTypes.h:21
Definition: aerodromeStateData.h:498
virtual const DtString & markingText() const override
Returns the airport code as the marking text for this aerodrome.
Definition: aerodromeStateComponent.h:178
Default creator implementation for a state component type. T_StateComponent is the concrete component...
Definition: stateComponent.h:326
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:280
unsigned long long UInt64
64-bit unsigned integer type.
Definition: stateDataTypes.h:19
#define UNDEFINED_RETURNREF_ACCESSOR(ReturnType, Member)
Defines a virtual const reference accessor that throws DtUnimplementedMethod, marking the method as r...
Definition: doubleBufferedDataStorage.h:60
DtAerodromeStateData & frameState()
Returns a mutable reference to the aerodrome state data for the next frame.
Definition: aerodromeStateComponent.h:115
2) Define the next frame class. This will be used for write access. Write-access implementation of Dt...
Definition: aerodromeStateComponent.h:103
virtual void restoreFromArchive(const DtString &)
Restores this aerodrome&#39;s state from the given archived state string.
Definition: aerodromeStateComponent.h:95
virtual DtFrameStateInterface * nextFrameState() override
Returns the writable next-frame state interface.
Definition: aerodromeStateComponent.h:369
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:513
virtual void restoreRunwaysFromArchive(const std::vector< DtString > &)
Restores all runways from the provided list of archived state strings.
Definition: aerodromeStateComponent.h:74
#define DEFINE_STATE_COMPONENT_TYPE(CreatedComponent)
Macro to define all required static and virtual state component type methods. Place in the public sec...
Definition: stateComponent.h:272
virtual const DtEntityType entityType() const override
Returns the entity type (wraps objectType()).
Definition: aerodromeStateComponent.h:303
virtual const std::map< DtUUID, DtRunwayStateData > & runways() const
Returns a const map of all runways keyed by UUID.
Definition: aerodromeStateComponent.h:65
virtual const DtRunwayStateData & runway(const std::string &) const
Returns a const reference to the runway identified by the given name.
Definition: aerodromeStateComponent.h:58
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:112
virtual std::vector< DtString > runwaysArchived() const
Returns a list of archived runway state strings.
Definition: aerodromeStateComponent.h:71
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:489
virtual const DtEntityType entityType() const override
Returns the entity type (wraps objectType()).
Definition: aerodromeStateComponent.h:217
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) Abstract interface for aerodrome (airport) state, providing access to runway and airport code data.
Definition: aerodromeStateComponent.h:21
Definition: aerodromeStateData.h:17
virtual void aboutToBeDeleted()
Called when the component is about to be deleted; emits signal_stateComponentAboutToBeDeleted.
Legion::WriteStateInstance myWriteStateInstance
Legion write state instance for distributed state publication.
Definition: aerodromeStateComponent.h:417
virtual void setMarkingText(const DtString &t) override
Sets the airport code via the marking text interface.
Definition: aerodromeStateComponent.h:185
virtual void setValue(const DtString &, unsigned char)
Sets the named appearance value for this aerodrome.
Definition: aerodromeStateComponent.h:92
virtual void updateDataStorage() override
Advances the current frame by copying the next-frame data if writable, then emits the component-updat...
Definition: aerodromeStateComponent.h:374
virtual DtRunwayStateData & runway(const DtUUID &)
Returns a mutable reference to the runway identified by the given UUID.
Definition: aerodromeStateComponent.h:46
DtAerodromeStateData myData
Aerodrome state data buffer for the current (committed) frame.
Definition: aerodromeStateComponent.h:350
virtual unsigned char runwayValue(const DtString &, const DtString &runwayName) const
Returns the named appearance value for the specified runway.
Definition: aerodromeStateComponent.h:79
#define UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(Type, Member, Set)
Defines an undefined virtual const-reference accessor and an undefined virtual setter, both throwing DtUnimplementedMethod and requiring overrides in a derived class.
Definition: doubleBufferedDataStorage.h:112
virtual const DtRunwayStateData & runway(const DtUUID &) const
Returns a const reference to the runway identified by the given UUID.
Definition: aerodromeStateComponent.h:54
virtual const DtString & markingText() const override
Returns the airport code as the marking text for this aerodrome.
Definition: aerodromeStateComponent.h:295
DtAerodromeStateComponentCurrentFrame myCurrentFrameState
Read-only current-frame state buffer.
Definition: aerodromeStateComponent.h:413
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: aerodromeStateComponent.h:356
DtAerodromeStateComponentNextFrame myNextFrameState
Writable next-frame state buffer.
Definition: aerodromeStateComponent.h:415
virtual unsigned char value(const DtString &) const
Returns the named appearance value for this aerodrome.
Definition: aerodromeStateComponent.h:88
virtual Legion::WriteStateInstance writeStateInstance() override
Returns the Legion write state instance used for distributed state publication.
Definition: aerodromeStateComponent.h:403
virtual void updateStateData(DtStateData *sd) override
Updates the state data pointer on both frame buffers.
Definition: aerodromeStateComponent.h:386
virtual const DtFrameStateInterface * currentFrameState() const override
Returns the read-only current-frame state interface.
Definition: aerodromeStateComponent.h:367
#define DT_DLL_vrfStateData
This file is used to determine how to build Disable inconsistent dll linkage warning Visual Studio 6...
Definition: vrfStateDataDefines.h:29
virtual void aboutToBeDeleted() override
Notifies both frame buffers that this component is about to be deleted.
Definition: aerodromeStateComponent.h:393
virtual void setRunwayValue(const DtString &, unsigned char, const DtString &runwayName)
Sets the named appearance value for the specified runway.
Definition: aerodromeStateComponent.h:84
virtual void setRunways(const std::map< DtUUID, DtRunwayStateData > &)
Replaces all runways with the provided map.
Definition: aerodromeStateComponent.h:68
virtual void setOrbatId(const unsigned long long &) override
Definition: aerodromeStateComponent.h:192
virtual const DtFrameStateInterface * nextFrameState() const override
Returns the next-frame state interface as a const pointer.
Definition: aerodromeStateComponent.h:371
Base interface for accessing current or next frame state in a double-buffered state component...
Definition: stateComponent.h:354
virtual void removeRunway(const DtUUID &)
Removes the runway identified by the given UUID.
Definition: aerodromeStateComponent.h:42
void advanceFrame(const DtAerodromeStateData &data)
Copies the next-frame data into the current frame buffer; called by the implementation during frame a...
Definition: aerodromeStateComponent.h:343
Definition: aerodromeStateData.h:355

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)