VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
metocServiceStateComponent.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2021 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #pragma once
7 
9 
10 namespace makVrf
11 {
16  {
20  : myUUID(DtUUID::nullUUID())
21  , myForceType(DtForceOther)
22  , myAppearanceBits(0)
23  , myIsLocal(true)
24  , myCheckForNameReservation(true)
25  {
26  }
27 
31  : myUUID(orig.myUUID)
32  , myMarkingText(orig.myMarkingText)
33  , myEntityType(orig.myEntityType)
34  , myForceType(orig.myForceType)
35  , myAppearanceBits(orig.myAppearanceBits)
36  , myEntityIdentifier(orig.myEntityIdentifier)
37  , myGlobalId(orig.myGlobalId)
38  , myIsLocal(orig.myIsLocal)
39  , myCheckForNameReservation(orig.myCheckForNameReservation)
40  {
41  }
42 
47  {
48  myUUID = rhs.myUUID;
49  myMarkingText = rhs.myMarkingText;
50  myEntityType = rhs.myEntityType;
51  myForceType = rhs.myForceType;
52  myAppearanceBits = rhs.myAppearanceBits;
53  myEntityIdentifier = rhs.myEntityIdentifier;
54  myGlobalId = rhs.myGlobalId;
55  myIsLocal = rhs.myIsLocal;
56  myCheckForNameReservation = rhs.myCheckForNameReservation;
57 
58  return *this;
59  }
60 
62  DEFINE_ACCESSOR_MUTATOR(DtUUID, uuid, UUID)
64  DEFINE_ACCESSOR_MUTATOR(DtString, markingText, MarkingText)
66  DEFINE_ACCESSOR_MUTATOR(DtEntityType, entityType, EntityType)
68  DEFINE_ACCESSOR_MUTATOR(DtForceType, forceType, ForceType)
70  DEFINE_ACCESSOR_MUTATOR(UInt32, appearanceBits, AppearanceBits)
72  DEFINE_ACCESSOR_MUTATOR(DtEntityIdentifier, entityIdentifier, EntityIdentifier)
74  DEFINE_ACCESSOR_MUTATOR(DtString, globalId, GlobalId)
76  DEFINE_ACCESSOR_MUTATOR(bool, isLocal, IsLocal)
78  DEFINE_ACCESSOR_MUTATOR(bool, checkForNameReservation, CheckForNameReservation)
79 
80  protected:
82  DtUUID myUUID;
84  DtString myMarkingText;
86  DtEntityType myEntityType;
88  DtForceType myForceType;
90  UInt32 myAppearanceBits;
92  DtEntityIdentifier myEntityIdentifier;
94  DtString myGlobalId;
96  bool myIsLocal;
98  bool myCheckForNameReservation;
99  };
100 
106  {
107  public:
109 
110 
113  : DtSimulatedObjectStateComponent(sd)
114  {
115  }
116 
118  virtual bool mainComponentOnLegion() const override { return false; };
119  };
120 
124  {
125  public:
129 
131  const DtMetocStateComponentData& frameState() const { return myData; };
133  DtMetocStateComponentData& frameState() { return myData; };
134 
136  virtual const DtString& globalId() const override;
138  virtual void setGlobalId(const DtString&) override;
139 
141  virtual const bool& isLocal() const override;
143  virtual void setIsLocal(const bool&) override;
144 
146  virtual const bool& checkForNameReservation() const override;
148  virtual void setCheckForNameReservation(const bool&) override;
149 
151  virtual const DtUUID& uuid() const override;
153  virtual void setUUID(const DtUUID&) override;
154 
156  virtual const DtString& markingText() const override;
158  virtual void setMarkingText(const DtString&) override;
159 
161  virtual const DtString& sidc() const override;
162  virtual void setSidc(const DtString&) override;
163 
165  virtual const DtForceType forceType() const override;
167  virtual void setForceType(const DtForceType&) override;
168 
170  virtual const UInt32 appearanceBits() const override;
172  virtual void setAppearanceBits(const UInt32&) override;
173 
175  virtual const DtEntityType entityType() const override;
177  virtual void setEntityType(const DtEntityType&) override;
178 
180  virtual const DtEntityIdentifier& entityId() const override;
182  virtual void setEntityId(const DtEntityIdentifier&) override;
183 
185  virtual const DtEntityType objectType() const override;
186 
187  protected:
190  };
191 
195  {
196  public:
200 
202  const DtMetocStateComponentData& frameState() const { return myData; };
203 
205  virtual const DtString& globalId() const override;
207  virtual const bool& isLocal() const override;
209  virtual const bool& checkForNameReservation() const override;
211  virtual const DtUUID& uuid() const override;
213  virtual const DtString& markingText() const override;
214 
216  virtual const DtString& sidc() const override;
217 
219  virtual const DtForceType forceType() const override;
221  virtual const UInt32 appearanceBits() const override;
223  virtual const DtEntityType entityType() const override;
225  virtual const DtEntityIdentifier& entityId() const override;
227  virtual const DtEntityType objectType() const override;
228 
229  protected:
234  void advanceFrame(const DtMetocStateComponentData& data);
235 
236  protected:
239  };
240 
245  {
246  public:
251  virtual ~DtMetocServiceStateComponentImplementation() override;
252 
254  bool isDoubleBuffered() { return true; };
256  virtual const DtFrameStateInterface* currentFrameState() const override { return &myCurrentFrameState; }
258  virtual DtFrameStateInterface* nextFrameState() override { return &myNextFrameState; };
260  virtual const DtFrameStateInterface* nextFrameState() const override { return &myNextFrameState; };
261 
264  virtual void updateDataStorage() override
265  {
266  if (myNextFrameState.isWritable())
267  {
268  myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
269  }
270 
271  myCurrentFrameState.emitComponentUpdated();
272  }
273 
276  virtual void updateStateData(DtStateData* sd) override
277  {
278  myCurrentFrameState.updateStateData(sd);
279  myNextFrameState.updateStateData(sd);
280  }
281 
283  virtual void aboutToBeDeleted() override
284  {
286  myCurrentFrameState.aboutToBeDeleted();
287  myNextFrameState.aboutToBeDeleted();
288  }
289 
291  virtual void addAdditionalStateComponents() override;
292 
293  protected:
298  };
299 
303 }
UUID is a unique ID wrapper class.
Definition: uuid.h:59
DtMetocStateComponentData myData
Buffered METOC state data for the current (read) simulation frame.
Definition: metocServiceStateComponent.h:238
bool isDoubleBuffered()
Definition: metocServiceStateComponent.h:254
bool myIsLocal
True if this entity is locally owned; false if it is a remote entity.
Definition: metocServiceStateComponent.h:96
unsigned int UInt32
32-bit unsigned integer type.
Definition: stateDataTypes.h:21
Write-access implementation of DtMetocServiceStateComponent for the next simulation frame...
Definition: metocServiceStateComponent.h:123
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
DtString myGlobalId
Application-level global identifier string.
Definition: metocServiceStateComponent.h:94
const DtMetocStateComponentData & frameState() const
Current frame state only can access current frame buffers. This ensures thread safety.
Definition: metocServiceStateComponent.h:202
DtMetocStateComponentData myData
Buffered METOC state data for the next simulation frame.
Definition: metocServiceStateComponent.h:189
virtual void aboutToBeDeleted() override
Notifies the base class and both frame state objects that this component is about to be deleted...
Definition: metocServiceStateComponent.h:283
DtMetocStateComponentData()
Constructs a DtMetocStateComponentData with default values: null UUID, DtForceOther affiliation...
Definition: metocServiceStateComponent.h:19
DtEntityType myEntityType
DIS entity type classifying this METOC service entity.
Definition: metocServiceStateComponent.h:86
DtString myMarkingText
Human-readable marking text label for the METOC service area.
Definition: metocServiceStateComponent.h:84
const DtMetocStateComponentData & frameState() const
Definition: metocServiceStateComponent.h:131
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:513
DtEntityIdentifier myEntityIdentifier
DIS entity identifier (site, application, entity number).
Definition: metocServiceStateComponent.h:92
#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 DtFrameStateInterface * currentFrameState() const override
Definition: metocServiceStateComponent.h:256
DtMetocStateComponentData & operator=(const DtMetocStateComponentData &rhs)
Assignment operator; copies all fields from rhs.
Definition: metocServiceStateComponent.h:46
virtual bool mainComponentOnLegion() const override
Definition: metocServiceStateComponent.h:118
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:489
DtStateComponentCreator< DtMetocServiceStateComponentImplementation > DtMetocServiceStateComponentCreator
Factory type used to create DtMetocServiceStateComponentImplementation instances. Registered with the...
Definition: metocServiceStateComponent.h:302
virtual void updateStateData(DtStateData *sd) override
Propagates a new state data pointer to both the current and next frame state objects.
Definition: metocServiceStateComponent.h:276
virtual void aboutToBeDeleted()
Called when the component is about to be deleted; emits signal_stateComponentAboutToBeDeleted.
bool myCheckForNameReservation
True if a name reservation check should be performed before publishing.
Definition: metocServiceStateComponent.h:98
Double-buffered state component implementation for METOC service entities. Owns both the current-fram...
Definition: metocServiceStateComponent.h:244
DtMetocServiceStateComponentNextFrame myNextFrameState
The next (write) frame state object.
Definition: metocServiceStateComponent.h:297
DtForceType myForceType
Force affiliation of this METOC service entity.
Definition: metocServiceStateComponent.h:88
#define DEFINE_ACCESSOR_MUTATOR(ReturnType, Accessor, Mutator)
Defines a const reference accessor and an inline setter for a member variable.
Definition: doubleBufferedDataStorage.h:37
DtUUID myUUID
Unique identifier for this METOC service entity.
Definition: metocServiceStateComponent.h:82
DtMetocStateComponentData & frameState()
Definition: metocServiceStateComponent.h:133
UInt32 myAppearanceBits
Packed DIS appearance bits for the visual state of this entity.
Definition: metocServiceStateComponent.h:90
#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 const DtFrameStateInterface * nextFrameState() const override
Definition: metocServiceStateComponent.h:260
Read-only implementation of DtMetocServiceStateComponent for the current simulation frame...
Definition: metocServiceStateComponent.h:194
DtMetocServiceStateComponentCurrentFrame myCurrentFrameState
The current (read) frame state object.
Definition: metocServiceStateComponent.h:295
Holds the identity and classification data for a METOC (meteorological and oceanographic) service ent...
Definition: metocServiceStateComponent.h:15
Base interface for accessing current or next frame state in a double-buffered state component...
Definition: stateComponent.h:354
virtual void updateDataStorage() override
Promotes the next-frame data into the current frame and emits a component-updated signal...
Definition: metocServiceStateComponent.h:264
Abstract interface representing the METOC (meteorological and oceanographic) service state component ...
Definition: metocServiceStateComponent.h:105
virtual DtFrameStateInterface * nextFrameState() override
Definition: metocServiceStateComponent.h:258
DtMetocStateComponentData(const DtMetocStateComponentData &orig)
Copy constructor; initialises all fields from orig.
Definition: metocServiceStateComponent.h:30

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)