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  const DtString& globalId() const;
98  void setGlobalId(const DtString&);
99 
100  const bool& isLocal() const;
101  void setIsLocal(const bool&);
102 
103  const bool& checkForNameReservation() const;
104  void setCheckForNameReservation(const bool&);
105 
106  const DtUUID& uuid() const;
107  void setUUID(const DtUUID&);
108 
109  const DtString& markingText() const;
110  void setMarkingText(const DtString&);
111 
112  const DtForceType forceType() const;
113  void setForceType(const DtForceType&);
114 
115  const UInt32 appearanceBits() const;
116  void setAppearanceBits(const UInt32&);
117 
118  const DtEntityType entityType() const;
119  void setEntityType(const DtEntityType&);
120 
121  const DtEntityIdentifier& entityId() const;
122  void setEntityId(const DtEntityIdentifier&);
123 
124  const DtObjectType objectType() const;
125 
126  protected:
128  };
129 
132  {
133  public:
135 
137  const DtMetocStateComponentData& frameState() const { return myData; };
138 
139  const DtString& globalId() const;
140  const bool& isLocal() const;
141  const bool& checkForNameReservation() const;
142  const DtUUID& uuid() const;
143  const DtString& markingText() const;
144  const DtForceType forceType() const;
145  const UInt32 appearanceBits() const;
146  const DtEntityType entityType() const;
147  const DtEntityIdentifier& entityId() const;
148  const DtObjectType objectType() const;
149 
150  protected:
152  void advanceFrame(const DtMetocStateComponentData& data);
153 
154  protected:
156  };
157 
161  {
162  public:
165 
166  bool isDoubleBuffered() { return true; };
167  const DtFrameStateInterface* currentFrameState() const { return &myCurrentFrameState; }
168  virtual DtFrameStateInterface* nextFrameState() { return &myNextFrameState; };
169  virtual const DtFrameStateInterface* nextFrameState() const { return &myNextFrameState; };
170 
172  {
173  if (myNextFrameState.isWritable())
174  {
175  myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
176  }
177 
178  myCurrentFrameState.emitComponentUpdated();
179  }
180 
181  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
unsigned int UInt32
Definition: stateDataTypes.h:18
DtMetocStateComponentData myData
Definition: metocServiceStateComponent.h:155
bool isDoubleBuffered()
Definition: metocServiceStateComponent.h:166
bool myIsLocal
Definition: metocServiceStateComponent.h:69
2) Define the next frame class. This will be used for write access.
Definition: metocServiceStateComponent.h:89
Definition: stateComponent.h:266
The DtSimulatedObjectStateComponent is an interface that all main components (those that are consider...
Definition: simulatedObjectStateComponent.h:21
void updateDataStorage()
Implement to update data storage. Called from advanceFrame.
Definition: metocServiceStateComponent.h:171
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:339
DtEntityIdentifier myEntityIdentifier
Definition: metocServiceStateComponent.h:67
#define DEFINE_STATE_COMPONENT_TYPE(CreatedComponent)
Definition: stateComponent.h:228
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:379
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 aboutToBeDeleted()
virtual const DtFrameStateInterface * nextFrameState() const
Definition: metocServiceStateComponent.h:169
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
const DtFrameStateInterface * currentFrameState() const
Definition: metocServiceStateComponent.h:167
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
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:291
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
void updateStateData(DtStateData *sd) override
Implement to update data storage to the new state data.
Definition: metocServiceStateComponent.h:181
virtual DtFrameStateInterface * nextFrameState()
Definition: metocServiceStateComponent.h:168
DtMetocStateComponentData(const DtMetocStateComponentData &orig)
Definition: metocServiceStateComponent.h:23

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)