13 #include <vlutil/vlTime.h>
14 #include "legionDataStore/writeStateInstance.h"
15 #include "legionDataStore/readStateInstance.h"
16 #include "legionDataStore/view.h"
17 #include "vrfOM/sets/readVrfStateComponentRepository.hpp"
18 #include "vrfOM/sets/writeVrfStateComponentRepository.hpp"
19 #include <tbb/spin_mutex.h>
23 class DtVrfStateComponentDataStore;
33 : myIsRemoteAttachedObject(false)
40 : myIsRemoteAttachedObject(orig.myIsRemoteAttachedObject)
41 , myEchelonId(orig.myEchelonId)
65 bool myIsRemoteAttachedObject;
67 DtEchelonId myEchelonId;
82 : DtFrameStateInterface(storage)
104 virtual
void setExtendedData(const DtString& key, const DtString& value) {
throw DtUnimplementedMethod(
"setExtendedData(const DtString& key, const DtString& value) is not implemented for this class"); };
112 mutable boost::signals2::signal<void (const DtFrameStateInterface*)> signal_extendedDataModified{};
129 virtual const bool isVrfSimulatedObject()
const override;
130 virtual void setIsVrfSimulatedObject(
const bool&)
override;
132 virtual const DtString label()
const override;
133 virtual void setLabel(
const DtString&)
override;
135 virtual const DtString overlay()
const override;
136 virtual void setOverlay(
const DtString&)
override;
138 virtual const bool independentlyTasked()
const override;
139 virtual void setIndependentlyTasked(
const bool&)
override;
141 virtual const bool& isRemoteAttachedObject()
const override;
142 virtual void setIsRemoteAttachedObject(
const bool&)
override;
144 virtual const DtString engagementRules()
const override;
145 virtual void setEngagementRules(
const DtString&)
override;
147 virtual const bool isSubordinateOfForceLevel()
const override;
148 virtual void setIsSubordinateOfForceLevel(
const bool&)
override;
150 virtual const bool isTasked()
const override;
151 virtual void setIsTasked(
const bool&)
override;
153 virtual const bool underFire()
const override;
154 virtual void setUnderFire(
const bool&)
override;
156 virtual const bool executingPlan()
const override;
157 virtual void setExecutingPlan(
const bool&)
override;
159 virtual const bool hasPlan()
const override;
160 virtual void setHasPlan(
const bool&)
override;
162 virtual const bool sensorsKilled()
const override;
163 virtual void setSensorsKilled(
const bool&)
override;
165 virtual const DtEchelonId& echelonId()
const override;
166 virtual void setEchelonId(
const DtEchelonId&)
override;
168 virtual const int sessionId()
const override;
169 virtual void setSessionId(
const int&)
override;
171 virtual const int vrfMessageVersionSupported()
const override;
172 virtual void setVrfMessageVersionSupported(
const int&)
override;
174 virtual const ExtendedData& extendedData()
const override;
175 virtual void setExtendedData(
const ExtendedData&)
override;
176 virtual void setExtendedData(
const DtString& key,
const DtString& value)
override;
179 virtual void clearExtendedData()
override;
181 void updateExtendedData();
182 virtual void removeExtendedData(
const DtString& key)
override;
184 virtual bool activated()
const override;
187 virtual void makeWritable()
override;
190 virtual void makeReadOnly()
override;
196 return myExtendedDataModified;
202 myExtendedDataModified =
false;
205 virtual ExtendedData extendedDataMap()
const override;
206 virtual bool hasExtendedData(
const DtString&)
const override;
234 virtual const bool isVrfSimulatedObject()
const override;
235 virtual const DtString label()
const override;
236 virtual const DtString overlay()
const override;
237 virtual const bool independentlyTasked()
const override;
238 virtual const bool& isRemoteAttachedObject()
const override;
239 virtual const DtString engagementRules()
const override;
240 virtual const bool isSubordinateOfForceLevel()
const override;
241 virtual const bool isTasked()
const override;
242 virtual const bool underFire()
const override;
243 virtual const bool executingPlan()
const override;
244 virtual const bool hasPlan()
const override;
245 virtual const bool sensorsKilled()
const override;
246 virtual const DtEchelonId& echelonId()
const override;
247 virtual const int sessionId()
const override;
248 virtual const int vrfMessageVersionSupported()
const override;
249 virtual const ExtendedData& extendedData()
const override;
250 virtual bool activated()
const override;
253 bool readComponentValid()
const;
254 virtual ExtendedData extendedDataMap()
const override;
255 virtual bool hasExtendedData(
const DtString&)
const override;
261 virtual bool findReadComponent();
264 void handleExtendedDataUpdated(
const std::vector<UInt32>& attributesUpdated);
314 virtual void updateDataStorage()
override;
320 myCurrentFrameState.updateStateData(sd);
321 myNextFrameState.updateStateData(sd);
325 virtual bool forceAdvance()
override;
328 virtual void firstFrameAdvance()
override;
331 virtual void addAdditionalStateComponents()
override;
341 myCurrentFrameState.aboutToBeDeleted();
342 myNextFrameState.aboutToBeDeleted();
Instances of DtVrfObjectParameters are the readable/writeable objects that contain the information ne...
Definition: vrfObjectParameters.h:64
virtual void aboutToBeDeleted() override
Notifies sub-components that this state component is about to be removed.
Definition: vrfStateComponent.h:338
void clearExtendedDataModified()
Resets the extended data modified flag to false.
Definition: vrfStateComponent.h:200
virtual const DtString & extendedData(const DtString &key) const
Definition: vrfStateComponent.h:105
Exception thrown when a required method has not been implemented.
Definition: stateDataTypes.h:30
DtVrfStateComponentCurrentFrame myCurrentFrameState
The current-frame (read) view of the VRF state component data.
Definition: vrfStateComponent.h:347
void advanceFrame(const DtVrfStateComponentData &data)
Advances the frame by copying the new state data into the current frame buffer.
Definition: vrfStateComponent.h:273
bool extendedDataModified() const
Returns true if the extended data has been modified since the last clear.
Definition: vrfStateComponent.h:194
ExtendedData myExtendedData
Cached map of extended key-value data for this frame.
Definition: vrfStateComponent.h:212
DtVrfStateComponentData myData
Per-frame state data values for the current frame.
Definition: vrfStateComponent.h:286
DtVrfStateComponentData()
Default constructor; initializes myIsRemoteAttachedObject to false.
Definition: vrfStateComponent.h:32
Default creator implementation for a state component type. T_StateComponent is the concrete component...
Definition: stateComponent.h:326
2) Define the next frame class. This will be used for write access.
Definition: vrfStateComponent.h:116
3) Define the current frame class. This will be used for read access.
Definition: vrfStateComponent.h:222
static tbb::spin_mutex theEchelonIdMutex
Mutex used to protect concurrent access to DtEchelonId data in DtVrfStateComponentData.
Definition: vrfStateComponent.h:23
Contains the DtUUID class declaration.
DtVrfStateComponentData myData
Per-frame state data values for this component.
Definition: vrfStateComponent.h:218
DtVrfStateComponentNextFrame myNextFrameState
The next-frame (write) view of the VRF state component data.
Definition: vrfStateComponent.h:349
const DtVrfStateComponentData & frameState() const
Next frame access write access. Ensure this is only used in a single thread (i.e.a controller thread)...
Definition: vrfStateComponent.h:126
virtual bool hasExtendedData(const DtString &) const
Definition: vrfStateComponent.h:109
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: vrfStateComponent.h:72
const DtVrfStateComponentData & frameState() const
Current frame state only can access current frame buffers. This ensures thread safety.
Definition: vrfStateComponent.h:232
#define UNDEFINED_CONST_METHOD(Type, Method,...)
Defines a virtual const method with variadic parameters that throws DtUnimplementedMethod, requiring an override in a derived class.
Definition: doubleBufferedDataStorage.h:130
DtEchelonId myEchelonId
Cached echelon identifier for this entity.
Definition: vrfStateComponent.h:214
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:513
virtual DtFrameStateInterface * nextFrameState() override
Returns mutable access to the next frame state for writing.
Definition: vrfStateComponent.h:308
#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
bool myExtendedDataModified
True if extended data has been modified and needs to be flushed.
Definition: vrfStateComponent.h:216
DtVrfStateComponentData & operator=(const DtVrfStateComponentData &rhs)
Assignment operator.
Definition: vrfStateComponent.h:48
virtual const DtFrameStateInterface * nextFrameState() const override
Returns read-only access to the next frame state.
Definition: vrfStateComponent.h:311
virtual const DtFrameStateInterface * currentFrameState() const override
Returns read-only access to the current frame state.
Definition: vrfStateComponent.h:305
virtual ExtendedData extendedDataMap() const
Definition: vrfStateComponent.h:108
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:489
bool myFoundComponent
True once the readable Legion VRF state component repository has been located.
Definition: vrfStateComponent.h:351
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: vrfStateComponent.h:291
#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
virtual void aboutToBeDeleted()
Called when the component is about to be deleted; emits signal_stateComponentAboutToBeDeleted.
virtual void clearExtendedData()
Definition: vrfStateComponent.h:106
ExtendedData myExtendedData
Cached map of extended key-value data for the current frame.
Definition: vrfStateComponent.h:282
DtEchelonId myEchelonId
Echelon identifier for this entity.
Definition: vrfStateComponent.h:67
Definition: echelonId.h:13
VRF::WriteVrfStateComponentRepository myWriteVrfStateComponentRepository
Writable Legion repository instance for publishing VRF state component data.
Definition: vrfStateComponent.h:210
#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
virtual void updateStateData(DtStateData *sd) override
Updates the state data pointer for both current and next frame sub-components.
Definition: vrfStateComponent.h:318
#define DEFINE_ACCESSOR_MUTATOR(ReturnType, Accessor, Mutator)
Defines a const reference accessor and an inline setter for a member variable.
Definition: doubleBufferedDataStorage.h:37
POD-style data structure holding per-frame VRF state component values.
Definition: vrfStateComponent.h:29
#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 void removeExtendedData(const DtString &key)
Definition: vrfStateComponent.h:107
DtVrfStateComponentData(const DtVrfStateComponentData &orig)
Copy constructor.
Definition: vrfStateComponent.h:39
unsigned int myCallbackHandle
Handle for the registered Legion attribute update callback.
Definition: vrfStateComponent.h:284
Contains the DtStateComponent class declaration.
Definition: stateComponent.h:76
DtVrfStateComponentData & frameState()
Definition: vrfStateComponent.h:127
bool myIsRemoteAttachedObject
True if this object is a remote attached object.
Definition: vrfStateComponent.h:65
Base interface for accessing current or next frame state in a double-buffered state component...
Definition: stateComponent.h:354
std::map< DtString, DtString > ExtendedData
Map of key-value string pairs used to store extended simulation data.
Definition: vrfStateComponent.h:76
bool isDoubleBuffered()
Returns true indicating this component uses double-buffered state storage.
Definition: vrfStateComponent.h:302
VRF::ReadVrfStateComponentRepository myReadVrfStateComponentRepository
Read-only Legion repository instance for consuming VRF state component data.
Definition: vrfStateComponent.h:280