VR-Forces 5.0.1 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  {
20  }
21 
23  : myUUID(orig.myUUID)
24  , myMarkingText(orig.myMarkingText)
25  , myEntityType(orig.myEntityType)
26  , myForceType(orig.myForceType)
27  , myAppearanceBits(orig.myAppearanceBits)
28  , myEntityIdentifier(orig.myEntityIdentifier)
29  , myGlobalId(orig.myGlobalId)
30  , myIsLocal(orig.myIsLocal)
31  {
32  }
33 
35  {
36  myUUID = rhs.myUUID;
37  myMarkingText = rhs.myMarkingText;
38  myEntityType = rhs.myEntityType;
39  myForceType = rhs.myForceType;
40  myAppearanceBits = rhs.myAppearanceBits;
41  myEntityIdentifier = rhs.myEntityIdentifier;
42  myGlobalId = rhs.myGlobalId;
43  myIsLocal = rhs.myIsLocal;
44 
45  return *this;
46  }
47 
48  DEFINE_ACCESSOR_MUTATOR(DtUUID, uuid, UUID)
49  DEFINE_ACCESSOR_MUTATOR(DtString, markingText, MarkingText)
50  DEFINE_ACCESSOR_MUTATOR(DtEntityType, entityType, EntityType)
51  DEFINE_ACCESSOR_MUTATOR(DtForceType, forceType, ForceType)
52  DEFINE_ACCESSOR_MUTATOR(UInt32, appearanceBits, AppearanceBits)
53  DEFINE_ACCESSOR_MUTATOR(DtEntityIdentifier, entityIdentifier, EntityIdentifier)
54  DEFINE_ACCESSOR_MUTATOR(DtString, globalId, GlobalId)
55  DEFINE_ACCESSOR_MUTATOR(bool, isLocal, IsLocal)
56 
57  protected:
58  DtUUID myUUID;
59  DtString myMarkingText;
60  DtEntityType myEntityType;
61  DtForceType myForceType;
62  UInt32 myAppearanceBits;
63  DtEntityIdentifier myEntityIdentifier;
64  DtString myGlobalId;
65  bool myIsLocal;
66  };
67 
71  {
72  public:
74 
76  : DtSimulatedObjectStateComponent(sd)
77  {
78  }
79 
80  virtual bool mainComponentOnLegion() const override { return false; };
81  };
82 
85  {
86  public:
88 
89  const DtMetocStateComponentData& frameState() const { return myData; };
90  DtMetocStateComponentData& frameState() { return myData; };
91 
92  const DtString& globalId() const;
93  void setGlobalId(const DtString&);
94 
95  const bool& isLocal() const;
96  void setIsLocal(const bool&);
97 
98  const DtUUID& uuid() const;
99  void setUUID(const DtUUID&);
100 
101  const DtString& markingText() const;
102  void setMarkingText(const DtString&);
103 
104  const DtForceType forceType() const;
105  void setForceType(const DtForceType&);
106 
107  const UInt32 appearanceBits() const;
108  void setAppearanceBits(const UInt32&);
109 
110  const DtEntityType entityType() const;
111  void setEntityType(const DtEntityType&);
112 
113  const DtEntityIdentifier& entityId() const;
114  void setEntityId(const DtEntityIdentifier&);
115 
116  const DtObjectType objectType() const;
117 
118  protected:
120  };
121 
124  {
125  public:
127 
129  const DtMetocStateComponentData& frameState() const { return myData; };
130 
131  const DtString& globalId() const;
132  const bool& isLocal() const;
133  const DtUUID& uuid() const;
134  const DtString& markingText() const;
135  const DtForceType forceType() const;
136  const UInt32 appearanceBits() const;
137  const DtEntityType entityType() const;
138  const DtEntityIdentifier& entityId() const;
139  const DtObjectType objectType() const;
140 
141  protected:
143  void advanceFrame(const DtMetocStateComponentData& data);
144 
145  protected:
147  };
148 
152  {
153  public:
156 
157  bool isDoubleBuffered() { return true; };
158  const DtFrameStateInterface* currentFrameState() const { return &myCurrentFrameState; }
159  virtual DtFrameStateInterface* nextFrameState() { return &myNextFrameState; };
160  virtual const DtFrameStateInterface* nextFrameState() const { return &myNextFrameState; };
161 
163  {
164  if (myNextFrameState.isWritable())
165  {
166  myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
167  }
168 
169  myCurrentFrameState.emitComponentUpdated();
170  }
171 
172  void updateStateData(DtStateData* sd) override
173  {
174  myCurrentFrameState.updateStateData(sd);
175  myNextFrameState.updateStateData(sd);
176  }
177 
178  virtual void aboutToBeDeleted() override
179  {
181  myCurrentFrameState.aboutToBeDeleted();
182  myNextFrameState.aboutToBeDeleted();
183  }
184 
185  virtual void addAdditionalStateComponents() override;
186 
187  protected:
190  };
191 
195 }
UUID is a unique ID wrapper class.
Definition: rwUUID.h:226
unsigned int UInt32
Definition: stateDataTypes.h:18
DtMetocStateComponentData myData
Definition: metocServiceStateComponent.h:146
bool isDoubleBuffered()
Definition: metocServiceStateComponent.h:157
bool myIsLocal
Definition: metocServiceStateComponent.h:65
2) Define the next frame class. This will be used for write access.
Definition: metocServiceStateComponent.h:84
Definition: stateComponent.h:257
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:162
DtString myGlobalId
Definition: metocServiceStateComponent.h:64
const DtMetocStateComponentData & frameState() const
Current frame state only can access current frame buffers. This ensures thread safety.
Definition: metocServiceStateComponent.h:129
DtMetocStateComponentData myData
Definition: metocServiceStateComponent.h:119
virtual void aboutToBeDeleted() override
Definition: metocServiceStateComponent.h:178
DtMetocStateComponentData()
Definition: metocServiceStateComponent.h:14
Definition: objectType.h:27
DtEntityType myEntityType
Definition: metocServiceStateComponent.h:60
DtString myMarkingText
Definition: metocServiceStateComponent.h:59
const DtMetocStateComponentData & frameState() const
Definition: metocServiceStateComponent.h:89
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:336
DtEntityIdentifier myEntityIdentifier
Definition: metocServiceStateComponent.h:63
#define DEFINE_STATE_COMPONENT_TYPE(CreatedComponent)
Definition: stateComponent.h:219
DtMetocStateComponentData & operator=(const DtMetocStateComponentData &rhs)
Definition: metocServiceStateComponent.h:34
virtual bool mainComponentOnLegion() const override
Definition: metocServiceStateComponent.h:80
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:365
DtStateComponentCreator< DtMetocServiceStateComponentImplementation > DtMetocServiceStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: metocServiceStateComponent.h:194
virtual void aboutToBeDeleted()
virtual const DtFrameStateInterface * nextFrameState() const
Definition: metocServiceStateComponent.h:160
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: metocServiceStateComponent.h:151
DtMetocServiceStateComponentNextFrame myNextFrameState
Definition: metocServiceStateComponent.h:189
DtForceType myForceType
Definition: metocServiceStateComponent.h:61
#define DEFINE_ACCESSOR_MUTATOR(ReturnType, Accessor, Mutator)
Definition: doubleBufferedDataStorage.h:23
DtUUID myUUID
Definition: metocServiceStateComponent.h:58
const DtFrameStateInterface * currentFrameState() const
Definition: metocServiceStateComponent.h:158
DtMetocStateComponentData & frameState()
Definition: metocServiceStateComponent.h:90
UInt32 myAppearanceBits
Definition: metocServiceStateComponent.h:62
#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:123
DtMetocServiceStateComponentCurrentFrame myCurrentFrameState
Definition: metocServiceStateComponent.h:188
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:282
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:70
void updateStateData(DtStateData *sd) override
Implement to update data storage to the new state data.
Definition: metocServiceStateComponent.h:172
virtual DtFrameStateInterface * nextFrameState()
Definition: metocServiceStateComponent.h:159
DtMetocStateComponentData(const DtMetocStateComponentData &orig)
Definition: metocServiceStateComponent.h:22

Document ID: Generated on Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)