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  {
20  : myUUID(DtUUID::nullUUID())
21  {
22  }
23 
25  {
26  *this = orig;
27  };
28 
30  {
31  myData = orig.myData;
32  myUUID = orig.myUUID;
33  myUserData = orig.myUserData;
34  myObjectId = orig.myObjectId;
35 
36  return *this;
37  };
38 
39  const DtRwOrbatData& data() const
40  {
41  return myData;
42  }
43 
45  {
46  return myData;
47  }
48 
49  DEFINE_ACCESSOR_MUTATOR(DtUUID, uuid, UUID)
50  DEFINE_ACCESSOR_MUTATOR(DtEntityIdentifier, entityId, EntityId)
51  DEFINE_ACCESSOR_MUTATOR(unsigned long long, userData, UserData)
52  DEFINE_ACCESSOR_MUTATOR(unsigned long long, objectId, ObjectId)
53 
54  protected:
55  DtUUID myUUID;
56  DtEntityIdentifier myEntityId;
57  DtRwOrbatData myData;
58  unsigned long long myUserData = 0;
59  unsigned long long myObjectId = 0;
60  };
61 
65  {
66  public:
68 
70  : DtSimulatedObjectStateComponent(storage)
71  {
72  }
73 
75  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(int, orbatOrder, OrbatOrder);
78  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(unsigned long long, objectId, ObjectId);
80 
81  virtual bool mainComponentOnLegion() const override { return false; };
82  };
83 
86  {
87  public:
89 
90  virtual const DtUUID& orbatUUID() const override;
91 
92  virtual const int orbatOrder() const override;
93  virtual void setOrbatOrder(const int&) override;
94 
95  virtual const unsigned long long& objectId() const override;
96  virtual void setObjectId(const unsigned long long&) override;
97 
98  virtual const DtRwOrbatData& data() const override;
99  virtual void setData(const DtRwOrbatData&) override;
100 
101  virtual const DtUUID& parent() const override;
102  virtual void setParent(const DtUUID&) override;
103 
105 
106  DtOrbatStateComponentData& frameState() { return myData; };
107  const DtOrbatStateComponentData& frameState() const { return myData; };
108 
109  virtual const bool& isLocal() const override;
110  virtual void setIsLocal(const bool&) override;
111 
112  virtual const bool& checkForNameReservation() const override;
113  virtual void setCheckForNameReservation(const bool&) override;
114 
115  virtual const DtEntityIdentifier& entityId() const override;
116  virtual void setEntityId(const DtEntityIdentifier&) override;
117 
118  virtual const DtString& globalId() const override;
119  virtual void setGlobalId(const DtString&) override;
120 
121  virtual const UInt32 appearanceBits() const override;
122 
123  virtual const DtString& label() const override;
124  virtual void setLabel(const DtString&) override;
125 
126  virtual const DtUUID& uuid() const override;
127  virtual void setUUID(const DtUUID& u) override;
128 
129  virtual const DtString& markingText() const override;
130  virtual void setMarkingText(const DtString&) override;
131 
132  virtual const DtForceType forceType() const override;
133  virtual void setForceType(const DtForceType&) override;
134 
135  virtual const DtEntityType entityType() const override { return objectType(); };
136  virtual const DtEntityType objectType() const override;
137  virtual void setEntityType(const DtEntityType& t) override;
138  virtual const DtSimulationAddress simEngineAddress() const override;
139 
140  virtual const unsigned long long userLongLongData() const override;
141  virtual void setUserLongLongData(const unsigned long long&) override;
142 
144  virtual void makeWritable() override;
145 
147  virtual void makeReadOnly() override;
148 
149  protected:
151  };
152 
155  {
156  public:
158 
159  virtual const UInt32 appearanceBits() const override;
160  virtual const unsigned long long& objectId() const override;
161  virtual const bool& checkForNameReservation() const override;
162  virtual const bool& isLocal() const override;
163  virtual const DtUUID& orbatUUID() const override;
164  virtual const int orbatOrder() const override;
165  virtual const DtString& label() const override;
166  virtual const DtUUID& parent() const override;
167  virtual const DtEntityIdentifier& entityId() const override;
168  virtual const DtString& globalId() const override;
169  virtual const DtUUID& uuid() const override;
170  virtual const DtString& markingText() const override;
171  virtual const DtForceType forceType() const override;
172  virtual const DtEntityType entityType() const override { return objectType(); };
173  virtual const DtEntityType objectType() const override;
174  virtual const unsigned long long userLongLongData() const override;
175  virtual const DtSimulationAddress simEngineAddress() const override;
176 
177  virtual const DtRwOrbatData& data() const override;
178  const DtOrbatStateComponentData& frameState() const { return myData; };
179 
180  protected:
183  {
184  myData = data;
185  }
186 
187  protected:
189  };
190 
194  {
195  public:
197  virtual ~DtOrbatStateComponentImplementation() override;
198 
199  bool isDoubleBuffered() { return true; };
200  virtual const DtFrameStateInterface* currentFrameState() const override { return &myCurrentFrameState; }
201  virtual DtFrameStateInterface* nextFrameState() override { return &myNextFrameState; };
202  virtual const DtFrameStateInterface* nextFrameState() const override { return &myNextFrameState; };
203 
204  virtual void updateDataStorage() override
205  {
206  if (myNextFrameState.isWritable())
207  {
208  myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
209  }
210 
211  myCurrentFrameState.emitComponentUpdated();
212  }
213 
214  virtual void updateStateData(DtStateData* sd) override
215  {
216  myCurrentFrameState.updateStateData(sd);
217  myNextFrameState.updateStateData(sd);
218  }
219 
220  virtual void aboutToBeDeleted() override
221  {
223  myCurrentFrameState.aboutToBeDeleted();
224  myNextFrameState.aboutToBeDeleted();
225  }
226 
227  virtual void convertToLocal() override;
228  virtual void convertToRemote() override;
229 
230  protected:
233  };
234 
238 }
3) Define the current frame class. This will be used for read access.
Definition: orbatStateComponent.h:154
UUID is a unique ID wrapper class.
Definition: uuid.h:59
const DtRwOrbatData & data() const
Definition: orbatStateComponent.h:39
unsigned int UInt32
Definition: stateDataTypes.h:18
Definition: stateComponent.h:269
The DtSimulatedObjectStateComponent is an interface that all main components (those that are consider...
Definition: simulatedObjectStateComponent.h:21
virtual DtFrameStateInterface * nextFrameState() override
Definition: orbatStateComponent.h:201
0) Define the State Component Data. This struct replaces the legion stuff
Definition: orbatStateComponent.h:17
virtual const DtEntityType entityType() const override
Definition: orbatStateComponent.h:135
#define UNDEFINED_RETURNREF_ACCESSOR(ReturnType, Member)
Definition: doubleBufferedDataStorage.h:34
const DtOrbatStateComponentData & frameState() const
Definition: orbatStateComponent.h:107
DtRwOrbatData & data()
Definition: orbatStateComponent.h:44
virtual void updateDataStorage() override
Implement to update data storage. Called from advanceFrame.
Definition: orbatStateComponent.h:204
DtOrbatStateComponentData myData
Definition: orbatStateComponent.h:150
DtOrbatStateComponentData(const DtOrbatStateComponentData &orig)
Definition: orbatStateComponent.h:24
1) Define the interface class that will be used to represent the next and current frames...
Definition: orbatStateComponent.h:64
virtual bool mainComponentOnLegion() const override
Definition: orbatStateComponent.h:81
Definition: stateComponent.h:69
void advanceFrame(const DtOrbatStateComponentData &data)
Definition: orbatStateComponent.h:182
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:398
#define DEFINE_STATE_COMPONENT_TYPE(CreatedComponent)
Definition: stateComponent.h:231
Definition: rwOrbatData.h:20
virtual const DtFrameStateInterface * currentFrameState() const override
Definition: orbatStateComponent.h:200
DtUUID myUUID
Definition: orbatStateComponent.h:55
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:384
DtOrbatStateComponentData myData
Definition: orbatStateComponent.h:188
#define UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(Type, Member, Set)
Definition: doubleBufferedDataStorage.h:53
DtOrbatStateComponentCurrentFrame myCurrentFrameState
Definition: orbatStateComponent.h:231
DtOrbatStateComponentData()
Definition: orbatStateComponent.h:19
virtual void aboutToBeDeleted()
2) Define the next frame class. This will be used for write access.
Definition: orbatStateComponent.h:85
virtual void aboutToBeDeleted() override
Definition: orbatStateComponent.h:220
DtOrbatStateComponentNextFrame myNextFrameState
Definition: orbatStateComponent.h:232
#define UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(Type, Member, Set)
Definition: doubleBufferedDataStorage.h:57
#define DEFINE_ACCESSOR_MUTATOR(ReturnType, Accessor, Mutator)
Definition: doubleBufferedDataStorage.h:23
unsigned long long myObjectId
Definition: orbatStateComponent.h:59
bool isDoubleBuffered()
Definition: orbatStateComponent.h:199
DtOrbatStateComponentData & operator=(const DtOrbatStateComponentData &orig)
Definition: orbatStateComponent.h:29
DtStateComponentCreator< DtOrbatStateComponentImplementation > DtOrbatStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: orbatStateComponent.h:237
DtRwOrbatData myData
Definition: orbatStateComponent.h:57
virtual const DtFrameStateInterface * nextFrameState() const override
Definition: orbatStateComponent.h:202
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: orbatStateComponent.h:193
#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 const DtEntityType entityType() const override
Definition: orbatStateComponent.h:172
virtual void updateStateData(DtStateData *sd) override
Implement to update data storage to the new state data.
Definition: orbatStateComponent.h:214
Contains the DtStateComponent class declaration.
This is a simple base class that will be used to return a pointer to current or next frame state...
Definition: stateComponent.h:294
DtOrbatStateComponentData & frameState()
Next frame access write access. Ensure this is only used in a single thread (i.e.a controller thread)...
Definition: orbatStateComponent.h:106
unsigned long long myUserData
Definition: orbatStateComponent.h:58

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)