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 {
13  {
15  : myUUID(DtUUID::nullUUID())
16  , myForceType(DtForceOther)
17  , myAppearanceBits(0)
18  , myIsLocal(true)
19  , myCheckForNameReservation(true)
20  {
21  }
22 
24  : myUUID(orig.myUUID)
25  , myMarkingText(orig.myMarkingText)
26  , myEntityType(orig.myEntityType)
27  , myForceType(orig.myForceType)
28  , myAppearanceBits(orig.myAppearanceBits)
29  , myEntityIdentifier(orig.myEntityIdentifier)
30  , myGlobalId(orig.myGlobalId)
31  , myIsLocal(orig.myIsLocal)
32  , myCheckForNameReservation(orig.myCheckForNameReservation)
33  {
34  }
35 
37  {
38  myUUID = rhs.myUUID;
39  myMarkingText = rhs.myMarkingText;
40  myEntityType = rhs.myEntityType;
41  myForceType = rhs.myForceType;
42  myAppearanceBits = rhs.myAppearanceBits;
43  myEntityIdentifier = rhs.myEntityIdentifier;
44  myGlobalId = rhs.myGlobalId;
45  myIsLocal = rhs.myIsLocal;
46  myCheckForNameReservation = rhs.myCheckForNameReservation;
47 
48  return *this;
49  }
50 
51  DEFINE_ACCESSOR_MUTATOR(DtUUID, uuid, UUID)
52  DEFINE_ACCESSOR_MUTATOR(DtString, markingText, MarkingText)
53  DEFINE_ACCESSOR_MUTATOR(DtEntityType, entityType, EntityType)
54  DEFINE_ACCESSOR_MUTATOR(DtForceType, forceType, ForceType)
55  DEFINE_ACCESSOR_MUTATOR(UInt32, appearanceBits, AppearanceBits)
56  DEFINE_ACCESSOR_MUTATOR(DtEntityIdentifier, entityIdentifier, EntityIdentifier)
57  DEFINE_ACCESSOR_MUTATOR(DtString, globalId, GlobalId)
58  DEFINE_ACCESSOR_MUTATOR(bool, isLocal, IsLocal)
59  DEFINE_ACCESSOR_MUTATOR(bool, checkForNameReservation, CheckForNameReservation)
60 
61  protected:
62  DtUUID myUUID;
63  DtString myMarkingText;
64  DtEntityType myEntityType;
65  DtForceType myForceType;
66  UInt32 myAppearanceBits;
67  DtEntityIdentifier myEntityIdentifier;
68  DtString myGlobalId;
69  bool myIsLocal;
70  bool myCheckForNameReservation;
71  };
72 
76  {
77  public:
79 
81  : DtSimulatedObjectStateComponent(sd)
82  {
83  }
84 
85  virtual bool mainComponentOnLegion() const override { return false; };
86  };
87 
90  {
91  public:
93 
94  const DtMetocStateComponentData& frameState() const { return myData; };
95  DtMetocStateComponentData& frameState() { return myData; };
96 
97  virtual const DtString& globalId() const override;
98  virtual void setGlobalId(const DtString&) override;
99 
100  virtual const bool& isLocal() const override;
101  virtual void setIsLocal(const bool&) override;
102 
103  virtual const bool& checkForNameReservation() const override;
104  virtual void setCheckForNameReservation(const bool&) override;
105 
106  virtual const DtUUID& uuid() const override;
107  virtual void setUUID(const DtUUID&) override;
108 
109  virtual const DtString& markingText() const override;
110  virtual void setMarkingText(const DtString&) override;
111 
112  virtual const DtForceType forceType() const override;
113  virtual void setForceType(const DtForceType&) override;
114 
115  virtual const UInt32 appearanceBits() const override;
116  virtual void setAppearanceBits(const UInt32&) override;
117 
118  virtual const DtEntityType entityType() const override;
119  virtual void setEntityType(const DtEntityType&) override;
120 
121  virtual const DtEntityIdentifier& entityId() const override;
122  virtual void setEntityId(const DtEntityIdentifier&) override;
123 
124  virtual const DtEntityType objectType() const override;
125 
126  protected:
128  };
129 
132  {
133  public:
135 
137  const DtMetocStateComponentData& frameState() const { return myData; };
138 
139  virtual const DtString& globalId() const override;
140  virtual const bool& isLocal() const override;
141  virtual const bool& checkForNameReservation() const override;
142  virtual const DtUUID& uuid() const override;
143  virtual const DtString& markingText() const override;
144  virtual const DtForceType forceType() const override;
145  virtual const UInt32 appearanceBits() const override;
146  virtual const DtEntityType entityType() const override;
147  virtual const DtEntityIdentifier& entityId() const override;
148  virtual const DtEntityType objectType() const override;
149 
150  protected:
152  void advanceFrame(const DtMetocStateComponentData& data);
153 
154  protected:
156  };
157 
161  {
162  public:
164  virtual ~DtMetocServiceStateComponentImplementation() override;
165 
166  bool isDoubleBuffered() { return true; };
167  virtual const DtFrameStateInterface* currentFrameState() const override { return &myCurrentFrameState; }
168  virtual DtFrameStateInterface* nextFrameState() override { return &myNextFrameState; };
169  virtual const DtFrameStateInterface* nextFrameState() const override { return &myNextFrameState; };
170 
171  virtual void updateDataStorage() override
172  {
173  if (myNextFrameState.isWritable())
174  {
175  myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
176  }
177 
178  myCurrentFrameState.emitComponentUpdated();
179  }
180 
181  virtual void updateStateData(DtStateData* sd) override
182  {
183  myCurrentFrameState.updateStateData(sd);
184  myNextFrameState.updateStateData(sd);
185  }
186 
187  virtual void aboutToBeDeleted() override
188  {
190  myCurrentFrameState.aboutToBeDeleted();
191  myNextFrameState.aboutToBeDeleted();
192  }
193 
194  virtual void addAdditionalStateComponents() override;
195 
196  protected:
199  };
200 
204 }
UUID is a unique ID wrapper class.
Definition: uuid.h:59
DtMetocStateComponentData myData
Definition: metocServiceStateComponent.h:155
bool isDoubleBuffered()
Definition: metocServiceStateComponent.h:166
bool myIsLocal
Definition: metocServiceStateComponent.h:69
unsigned int UInt32
Definition: stateDataTypes.h:18
2) Define the next frame class. This will be used for write access.
Definition: metocServiceStateComponent.h:89
Definition: stateComponent.h:269
The DtSimulatedObjectStateComponent is an interface that all main components (those that are consider...
Definition: simulatedObjectStateComponent.h:21
DtString myGlobalId
Definition: metocServiceStateComponent.h:68
const DtMetocStateComponentData & frameState() const
Current frame state only can access current frame buffers. This ensures thread safety.
Definition: metocServiceStateComponent.h:137
DtMetocStateComponentData myData
Definition: metocServiceStateComponent.h:127
virtual void aboutToBeDeleted() override
Definition: metocServiceStateComponent.h:187
DtMetocStateComponentData()
Definition: metocServiceStateComponent.h:14
DtEntityType myEntityType
Definition: metocServiceStateComponent.h:64
DtString myMarkingText
Definition: metocServiceStateComponent.h:63
const DtMetocStateComponentData & frameState() const
Definition: metocServiceStateComponent.h:94
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:398
DtEntityIdentifier myEntityIdentifier
Definition: metocServiceStateComponent.h:67
#define DEFINE_STATE_COMPONENT_TYPE(CreatedComponent)
Definition: stateComponent.h:231
virtual const DtFrameStateInterface * currentFrameState() const override
Definition: metocServiceStateComponent.h:167
DtMetocStateComponentData & operator=(const DtMetocStateComponentData &rhs)
Definition: metocServiceStateComponent.h:36
virtual bool mainComponentOnLegion() const override
Definition: metocServiceStateComponent.h:85
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:384
DtStateComponentCreator< DtMetocServiceStateComponentImplementation > DtMetocServiceStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: metocServiceStateComponent.h:203
virtual void updateStateData(DtStateData *sd) override
Implement to update data storage to the new state data.
Definition: metocServiceStateComponent.h:181
virtual void aboutToBeDeleted()
bool myCheckForNameReservation
Definition: metocServiceStateComponent.h:70
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: metocServiceStateComponent.h:160
DtMetocServiceStateComponentNextFrame myNextFrameState
Definition: metocServiceStateComponent.h:198
DtForceType myForceType
Definition: metocServiceStateComponent.h:65
#define DEFINE_ACCESSOR_MUTATOR(ReturnType, Accessor, Mutator)
Definition: doubleBufferedDataStorage.h:23
DtUUID myUUID
Definition: metocServiceStateComponent.h:62
DtMetocStateComponentData & frameState()
Definition: metocServiceStateComponent.h:95
UInt32 myAppearanceBits
Definition: metocServiceStateComponent.h:66
#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 DtFrameStateInterface * nextFrameState() const override
Definition: metocServiceStateComponent.h:169
3) Define the current frame class. This will be used for read access.
Definition: metocServiceStateComponent.h:131
DtMetocServiceStateComponentCurrentFrame myCurrentFrameState
Definition: metocServiceStateComponent.h:197
Definition: metocServiceStateComponent.h:12
This is a simple base class that will be used to return a pointer to current or next frame state...
Definition: stateComponent.h:294
virtual void updateDataStorage() override
Implement to update data storage. Called from advanceFrame.
Definition: metocServiceStateComponent.h:171
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: metocServiceStateComponent.h:75
virtual DtFrameStateInterface * nextFrameState() override
Definition: metocServiceStateComponent.h:168
DtMetocStateComponentData(const DtMetocStateComponentData &orig)
Definition: metocServiceStateComponent.h:23

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)