VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
orbatStateComponent.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2023 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #pragma once
7 
11 #include <vrfutil/rwOrbatData.h>
12 
13 namespace makVrf
14 {
15 
18  {
21  : myUUID(DtUUID::nullUUID())
22  {
23  }
24 
27  {
28  *this = orig;
29  };
30 
33  {
34  myData = orig.myData;
35  myUUID = orig.myUUID;
36  myUserData = orig.myUserData;
37  myObjectId = orig.myObjectId;
38 
39  return *this;
40  };
41 
43  const DtRwOrbatData& data() const
44  {
45  return myData;
46  }
47 
50  {
51  return myData;
52  }
53 
55  DEFINE_ACCESSOR_MUTATOR(DtUUID, uuid, UUID)
57  DEFINE_ACCESSOR_MUTATOR(DtEntityIdentifier, entityId, EntityId)
59  DEFINE_ACCESSOR_MUTATOR(unsigned long long, userData, UserData)
61  DEFINE_ACCESSOR_MUTATOR(unsigned long long, objectId, ObjectId)
62 
63  protected:
65  DtUUID myUUID;
67  DtEntityIdentifier myEntityId;
69  DtRwOrbatData myData;
71  unsigned long long myUserData = 0;
73  unsigned long long myObjectId = 0;
74  };
75 
79  {
80  public:
82 
83 
86  : DtSimulatedObjectStateComponent(storage)
87  {
88  }
89 
93  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(int, orbatOrder, OrbatOrder);
99  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(unsigned long long, objectId, ObjectId);
102 
104  virtual bool mainComponentOnLegion() const override { return false; };
105  };
106 
110  {
111  public:
115 
116  virtual const DtUUID& orbatUUID() const override;
117 
118  virtual const int orbatOrder() const override;
119  virtual void setOrbatOrder(const int&) override;
120 
121  virtual const unsigned long long& objectId() const override;
122  virtual void setObjectId(const unsigned long long&) override;
123 
124  virtual const DtRwOrbatData& data() const override;
125  virtual void setData(const DtRwOrbatData&) override;
126 
127  virtual const DtUUID& parent() const override;
128  virtual void setParent(const DtUUID&) override;
129 
132  DtOrbatStateComponentData& frameState() { return myData; };
134  const DtOrbatStateComponentData& frameState() const { return myData; };
135 
136  virtual const bool& isLocal() const override;
137  virtual void setIsLocal(const bool&) override;
138 
139  virtual const bool& checkForNameReservation() const override;
140  virtual void setCheckForNameReservation(const bool&) override;
141 
142  virtual const DtEntityIdentifier& entityId() const override;
143  virtual void setEntityId(const DtEntityIdentifier&) override;
144 
145  virtual const DtString& globalId() const override;
146  virtual void setGlobalId(const DtString&) override;
147 
148  virtual const UInt32 appearanceBits() const override;
149 
150  virtual const DtString& label() const override;
151  virtual void setLabel(const DtString&) override;
152 
153  virtual const DtUUID& uuid() const override;
154  virtual void setUUID(const DtUUID& u) override;
155 
156  virtual const DtString& markingText() const override;
157  virtual void setMarkingText(const DtString&) override;
158 
160  virtual const DtString& sidc() const override;
161  virtual void setSidc(const DtString&) override;
162 
163  virtual const DtForceType forceType() const override;
164  virtual void setForceType(const DtForceType&) override;
165 
166  virtual const DtEntityType entityType() const override { return objectType(); };
167  virtual const DtEntityType objectType() const override;
168  virtual void setEntityType(const DtEntityType& t) override;
169  virtual const DtSimulationAddress simEngineAddress() const override;
170 
171  virtual const unsigned long long userLongLongData() const override;
172  virtual void setUserLongLongData(const unsigned long long&) override;
173 
175  virtual void makeWritable() override;
176 
178  virtual void makeReadOnly() override;
179 
180  protected:
183  };
184 
188  {
189  public:
193 
194  virtual const UInt32 appearanceBits() const override;
195  virtual const unsigned long long& objectId() const override;
196  virtual const bool& checkForNameReservation() const override;
197  virtual const bool& isLocal() const override;
198  virtual const DtUUID& orbatUUID() const override;
199  virtual const int orbatOrder() const override;
200  virtual const DtString& label() const override;
201  virtual const DtUUID& parent() const override;
202  virtual const DtEntityIdentifier& entityId() const override;
203  virtual const DtString& globalId() const override;
204  virtual const DtUUID& uuid() const override;
205  virtual const DtString& markingText() const override;
207  virtual const DtString& sidc() const override;
208  virtual const DtForceType forceType() const override;
209  virtual const DtEntityType entityType() const override { return objectType(); };
210  virtual const DtEntityType objectType() const override;
211  virtual const unsigned long long userLongLongData() const override;
212  virtual const DtSimulationAddress simEngineAddress() const override;
213 
214  virtual const DtRwOrbatData& data() const override;
216  const DtOrbatStateComponentData& frameState() const { return myData; };
217 
218  protected:
223  {
224  myData = data;
225  }
226 
227  protected:
230  };
231 
236  {
237  public:
242  virtual ~DtOrbatStateComponentImplementation() override;
243 
245  bool isDoubleBuffered() { return true; };
247  virtual const DtFrameStateInterface* currentFrameState() const override { return &myCurrentFrameState; }
249  virtual DtFrameStateInterface* nextFrameState() override { return &myNextFrameState; };
251  virtual const DtFrameStateInterface* nextFrameState() const override { return &myNextFrameState; };
252 
254  virtual void updateDataStorage() override
255  {
256  if (myNextFrameState.isWritable())
257  {
258  myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
259  }
260 
261  myCurrentFrameState.emitComponentUpdated();
262  }
263 
266  virtual void updateStateData(DtStateData* sd) override
267  {
268  myCurrentFrameState.updateStateData(sd);
269  myNextFrameState.updateStateData(sd);
270  }
271 
273  virtual void aboutToBeDeleted() override
274  {
276  myCurrentFrameState.aboutToBeDeleted();
277  myNextFrameState.aboutToBeDeleted();
278  }
279 
281  virtual void convertToLocal() override;
283  virtual void convertToRemote() override;
284 
285  protected:
290  };
291 
295 }
Read-only current frame implementation of DtOrbatStateComponent. Provides access to the committed ORB...
Definition: orbatStateComponent.h:187
UUID is a unique ID wrapper class.
Definition: uuid.h:59
const DtRwOrbatData & data() const
Returns the ORBAT data payload (read-only).
Definition: orbatStateComponent.h:43
unsigned int UInt32
32-bit unsigned integer type.
Definition: stateDataTypes.h:21
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 DtFrameStateInterface * nextFrameState() override
Returns the writable next frame state interface.
Definition: orbatStateComponent.h:249
Holds the ORBAT (Order of Battle) data payload for a single ORBAT entry in the simulation state...
Definition: orbatStateComponent.h:17
virtual const DtEntityType entityType() const override
Definition: orbatStateComponent.h:166
#define UNDEFINED_RETURNREF_ACCESSOR(ReturnType, Member)
Defines a virtual const reference accessor that throws DtUnimplementedMethod, marking the method as r...
Definition: doubleBufferedDataStorage.h:60
const DtOrbatStateComponentData & frameState() const
Returns read-only access to the raw frame state data.
Definition: orbatStateComponent.h:134
DtRwOrbatData & data()
Returns the ORBAT data payload (read-write).
Definition: orbatStateComponent.h:49
virtual void updateDataStorage() override
Promotes the next frame state to the current frame if it is writable, then emits an update notificati...
Definition: orbatStateComponent.h:254
DtOrbatStateComponentData myData
The pending ORBAT state data to be promoted on the next frame advance.
Definition: orbatStateComponent.h:182
DtOrbatStateComponentData(const DtOrbatStateComponentData &orig)
Copy constructor.
Definition: orbatStateComponent.h:26
Abstract interface for the ORBAT state component, representing both the current and next frame views...
Definition: orbatStateComponent.h:78
virtual bool mainComponentOnLegion() const override
Returns false; ORBAT components are not managed on the Legion network layer.
Definition: orbatStateComponent.h:104
Definition: stateComponent.h:69
void advanceFrame(const DtOrbatStateComponentData &data)
Copies the given state data into this frame, advancing the current frame.
Definition: orbatStateComponent.h:222
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:513
#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
Definition: rwOrbatData.h:20
virtual const DtFrameStateInterface * currentFrameState() const override
Returns the read-only current frame state interface.
Definition: orbatStateComponent.h:247
DtUUID myUUID
Accessor and mutator for the persistent UUID of this ORBAT entry.
Definition: orbatStateComponent.h:65
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:489
DtOrbatStateComponentData myData
The committed ORBAT state data for the current simulation frame.
Definition: orbatStateComponent.h:229
#define UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(Type, Member, Set)
Defines an undefined virtual by-value accessor and an undefined virtual setter, both throwing DtUnimp...
Definition: doubleBufferedDataStorage.h:103
DtOrbatStateComponentCurrentFrame myCurrentFrameState
The read-only current frame state.
Definition: orbatStateComponent.h:287
DtOrbatStateComponentData()
Constructs a default DtOrbatStateComponentData with a null UUID.
Definition: orbatStateComponent.h:20
virtual void aboutToBeDeleted()
Called when the component is about to be deleted; emits signal_stateComponentAboutToBeDeleted.
Write-access frame implementation of DtOrbatStateComponent. Holds the pending ORBAT state that will b...
Definition: orbatStateComponent.h:109
virtual void aboutToBeDeleted() override
Notifies both frame states that this component is about to be destroyed.
Definition: orbatStateComponent.h:273
DtOrbatStateComponentNextFrame myNextFrameState
The writable next frame state.
Definition: orbatStateComponent.h:289
#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
#define DEFINE_ACCESSOR_MUTATOR(ReturnType, Accessor, Mutator)
Defines a const reference accessor and an inline setter for a member variable.
Definition: doubleBufferedDataStorage.h:37
unsigned long long myObjectId
Simulation object store correlation ID.
Definition: orbatStateComponent.h:73
bool isDoubleBuffered()
Returns true; this component uses double buffering.
Definition: orbatStateComponent.h:245
DtOrbatStateComponentData & operator=(const DtOrbatStateComponentData &orig)
Assignment operator.
Definition: orbatStateComponent.h:32
DtStateComponentCreator< DtOrbatStateComponentImplementation > DtOrbatStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: orbatStateComponent.h:294
DtRwOrbatData myData
Full ORBAT payload (hierarchy, force side, symbol, etc.).
Definition: orbatStateComponent.h:69
virtual const DtFrameStateInterface * nextFrameState() const override
Returns the next frame state interface (read-only).
Definition: orbatStateComponent.h:251
Double-buffered state component implementation for ORBAT data. Owns both a current-frame (read) and n...
Definition: orbatStateComponent.h:235
#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 DtEntityType entityType() const override
Definition: orbatStateComponent.h:209
virtual void updateStateData(DtStateData *sd) override
Updates the state data pointer for both current and next frame states.
Definition: orbatStateComponent.h:266
Contains the DtStateComponent class declaration.
Base interface for accessing current or next frame state in a double-buffered state component...
Definition: stateComponent.h:354
DtOrbatStateComponentData & frameState()
Returns write access to the raw frame state data.
Definition: orbatStateComponent.h:132
unsigned long long myUserData
64-bit application user tag.
Definition: orbatStateComponent.h:71

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)