15 #include <vlutil/vlTime.h>
16 #include "legionDataStore/writeStateInstance.h"
17 #include "legionDataStore/readStateInstance.h"
18 #include "legionDataStore/view.h"
19 #include "vrfOM/sets/readStatePropertiesRepository.hpp"
20 #include "vrfOM/sets/writeStatePropertiesRepository.hpp"
24 class DtStatePropertiesStateComponentDataStore;
31 : myStateProperties(
"state-properties")
32 , myStatePropertiesUpdated(false)
33 , myParameterProperties(new
DtRwProperties(
"parameter-properties"))
39 : myStateProperties(orig.myStateProperties)
40 , myStatePropertiesUpdated(orig.myStatePropertiesUpdated)
41 , myParameterProperties(orig.myParameterProperties)
50 myStatePropertiesUpdated =
true;
58 myStatePropertiesUpdated =
false;
64 myStatePropertiesUpdated =
true;
71 myStateProperties.clearVariables();
72 std::vector<DtReaderWriterRegistryData*>::const_iterator itr = other.
registry().
registryData().begin();
73 std::vector<DtReaderWriterRegistryData*>::const_iterator end = other.
registry().
registryData().end();
74 for(; itr != end; ++itr)
82 otherRw, &myStateProperties.
registry());
99 bool myStatePropertiesUpdated;
116 : DtFrameStateInterface(storage)
125 virtual
void setStateProperties(const DtRwProperties&) {
throw DtUnimplementedMethod(
"setStateProperties(const DtRwProperties& key) is not implemented for this class"); };
150 virtual const bool& statePropertiesUpdated()
const override;
153 virtual const DtRwProperties& parameterProperties()
const override;
158 virtual void setParameterProperties(
const DtRwProperties&)
override;
160 virtual bool isModified()
const override;
163 virtual void makeWritable()
override;
166 virtual void makeReadOnly()
override;
171 return myStatePropertiesModified;
177 myStatePropertiesModified =
false;
181 void setPublishingOnLegionNetwork(
bool);
185 void updateLegionNetwork(
double newTime);
190 return myLastTimeStatePropertiesUpdated;
208 double myLastTimeStatePropertiesUpdated = 0.;
226 virtual const bool& statePropertiesUpdated()
const override;
228 virtual const DtRwProperties& parameterProperties()
const override;
232 virtual bool findReadComponent();
234 virtual bool readComponentValid()
const;
238 void setPublishingOnLegionNetwork(
bool);
243 return myStatePropertiesModifiedByLegion;
249 myStatePropertiesModifiedByLegion =
false;
255 void handleStatePropertiesUpdated();
307 virtual void updateDataStorage()
override;
313 myCurrentFrameState.updateStateData(sd);
314 myNextFrameState.updateStateData(sd);
318 virtual bool forceAdvance()
override;
328 myCurrentFrameState.aboutToBeDeleted();
329 myNextFrameState.aboutToBeDeleted();
333 virtual void setPublishingOnLegionNetwork(
bool)
override;
void copyOnlPublishedStateProperties(const DtRwProperties &other)
Copies only the published state properties from other into this object.
Definition: statePropertiesStateComponent.h:69
Instances of DtVrfObjectParameters are the readable/writeable objects that contain the information ne...
Definition: vrfObjectParameters.h:64
DtStatePropertiesStateComponentData()
Constructs a default instance with empty state and parameter properties.
Definition: statePropertiesStateComponent.h:30
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: statePropertiesStateComponent.h:106
std::map< std::string, double > myLastTimeUpdated
Map from property name to the last time it was updated from Legion.
Definition: statePropertiesStateComponent.h:279
std::map< DtString, DtString > ExtendedData
Map type used for extended data key/value pairs.
Definition: statePropertiesStateComponent.h:110
DtStatePropertiesStateComponentNextFrame myNextFrameState
The next frame state (write access).
Definition: statePropertiesStateComponent.h:339
Exception thrown when a required method has not been implemented.
Definition: stateDataTypes.h:30
bool statePropertiesModified() const
Returns true if state properties have been modified in the next frame.
Definition: statePropertiesStateComponent.h:169
Holds the actual data for one frame of state properties associated with a simulated object...
Definition: statePropertiesStateComponent.h:27
#define UNDEFINED_METHOD(Type, Method,...)
Defines a virtual non-const method with variadic parameters that throws DtUnimplementedMethod, requiring an override in a derived class.
Definition: doubleBufferedDataStorage.h:138
bool myStatePropertiesModified
Flag indicating state properties were modified in the next frame.
Definition: statePropertiesStateComponent.h:200
2) Define the next frame class. This will be used for write access.
Definition: statePropertiesStateComponent.h:129
VRF::WriteStatePropertiesRepository myWriteStatePropertiesRepository
Legion write repository for state properties.
Definition: statePropertiesStateComponent.h:198
double lastTimeStatePropertiesUpdated() const
Returns the simulation time at which state properties were last updated.
Definition: statePropertiesStateComponent.h:188
VRF::ReadStatePropertiesRepository myReadStatePropertiesRepository
Legion read repository for state properties.
Definition: statePropertiesStateComponent.h:273
Default creator implementation for a state component type. T_StateComponent is the concrete component...
Definition: stateComponent.h:326
const DtStatePropertiesStateComponentData & frameState() const
Next frame access write access. Ensure this is only used in a single thread (i.e.a controller thread)...
Definition: statePropertiesStateComponent.h:138
void clearStatePropertiesModifiedByLegion()
Clears the flag indicating state properties were modified by the Legion network.
Definition: statePropertiesStateComponent.h:247
const std::vector< DtReaderWriterRegistryData * > & registryData() const
Definition: readerWriterRegistry.h:161
unsigned int myCallbackHandle
Handle for the Legion instance updated callback.
Definition: statePropertiesStateComponent.h:275
Definition: readerWriter.h:85
DtStatePropertiesStateComponentCurrentFrame myCurrentFrameState
The current frame state (read access).
Definition: statePropertiesStateComponent.h:337
#define UNDEFINED_RETURNREF_ACCESSORS(ReturnType, Member)
Defines both const and non-const virtual reference accessors that throw DtUnimplementedMethod, requiring overrides in a derived class.
Definition: doubleBufferedDataStorage.h:74
Contains the DtUUID class declaration.
#define UNDEFINED_RETURNREF_ACCESSOR(ReturnType, Member)
Defines a virtual const reference accessor that throws DtUnimplementedMethod, marking the method as r...
Definition: doubleBufferedDataStorage.h:60
virtual void updateStateData(DtStateData *sd) override
Updates the state data pointer for both current and next frame states.
Definition: statePropertiesStateComponent.h:311
void clearStatePropertiesUpdated()
Clears the flag indicating state properties were updated this frame.
Definition: statePropertiesStateComponent.h:56
Interface class used to define minimal interface for a property. The DtPropertyInterface class provid...
Definition: propertyInterface.h:53
virtual DtReaderWriter * cloneReaderWriter(const DtString &name, const DtReaderWriter *sourceRw, DtReaderWriterRegistry *parentRegistry) const
Creates a clone of the RW object to create a clone of the specified object. The object will first be ...
static DtReaderWriterFactory * factory()
virtual const DtFrameStateInterface * nextFrameState() const override
Returns the next frame state interface (const).
Definition: statePropertiesStateComponent.h:304
DtStatePropertiesStateComponentData & frameState()
Definition: statePropertiesStateComponent.h:139
3) Define the current frame class. This will be used for read access.
Definition: statePropertiesStateComponent.h:212
virtual DtFrameStateInterface * nextFrameState() override
Returns the next frame state interface (mutable).
Definition: statePropertiesStateComponent.h:302
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:513
void clearStatePropertiesModified()
Clears the state properties modified flag.
Definition: statePropertiesStateComponent.h:175
const DtReaderWriterRegistry & registry() const
Collection of child DtReaderWriter nodes owned by this object.
Definition: readerWriter.h:492
#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
virtual const DtFrameStateInterface * currentFrameState() const override
Returns the current frame state interface (const).
Definition: statePropertiesStateComponent.h:300
DtStatePropertiesStateComponentData myData
The next frame data storage.
Definition: statePropertiesStateComponent.h:206
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:489
const DtStatePropertiesStateComponentData & frameState() const
Current frame state only can access current frame buffers. This ensures thread safety.
Definition: statePropertiesStateComponent.h:221
std::map< std::string, Legion::InstanceHandle > myLegionStateProperties
Map from property name to Legion instance handle.
Definition: statePropertiesStateComponent.h:204
virtual void aboutToBeDeleted()
Called when the component is about to be deleted; emits signal_stateComponentAboutToBeDeleted.
virtual void aboutToBeDeleted() override
Called before the component is deleted; propagates to both frame states.
Definition: statePropertiesStateComponent.h:325
const char * source
Definition: lz4.h:442
void advanceFrame(const DtStatePropertiesStateComponentData &data)
Advances the current frame by copying parameter properties from data.
Definition: statePropertiesStateComponent.h:266
virtual bool isPublished() const =0
Whether this property should be published.
#define DEFINE_REF_ACCESSORS(ReturnType, Method, Member)
Defines const and non-const reference accessors for a member variable.
Definition: doubleBufferedDataStorage.h:17
#define DEFINE_ACCESSOR_MUTATOR(ReturnType, Accessor, Mutator)
Defines a const reference accessor and an inline setter for a member variable.
Definition: doubleBufferedDataStorage.h:37
bool myStatePropertiesModifiedByLegion
Flag indicating state properties were modified by an incoming Legion update.
Definition: statePropertiesStateComponent.h:281
const DtRwProperties & parameterProperties() const
Returns the parameter properties (const).
Definition: statePropertiesStateComponent.h:88
bool statePropertiesModifiedByLegion() const
Returns true if state properties were modified by an incoming Legion network update.
Definition: statePropertiesStateComponent.h:241
DtStatePropertiesStateComponentData & operator=(const DtStatePropertiesStateComponentData &rhs)
Assignment operator. Copies member data and marks state properties as updated.
Definition: statePropertiesStateComponent.h:46
bool myFoundComponent
Tracks whether the Legion read component has been successfully located.
Definition: statePropertiesStateComponent.h:341
DtStatePropertiesStateComponentData myData
The current frame data storage.
Definition: statePropertiesStateComponent.h:283
bool isDoubleBuffered()
Returns true, indicating this component uses double-buffered storage.
Definition: statePropertiesStateComponent.h:298
#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
bool myPublishOnLegionNetwork
Flag indicating whether to publish on the Legion network.
Definition: statePropertiesStateComponent.h:277
A list of properties. A DtPropertyInterface object that is a specialized version of DtRwVariableBindi...
Definition: rwProperties.h:122
void statePropertiesWereUpdated()
Marks state properties as having been updated this frame.
Definition: statePropertiesStateComponent.h:62
DtRwProperties & parameterProperties()
Returns the parameter properties (mutable).
Definition: statePropertiesStateComponent.h:90
Contains the DtStateComponent class declaration.
bool myPublishOnLegionNetwork
Flag indicating whether to publish on the Legion network.
Definition: statePropertiesStateComponent.h:202
DtRwProperties myStateProperties
The state properties container.
Definition: statePropertiesStateComponent.h:90
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: statePropertiesStateComponent.h:288
virtual DtSymbolString name() const
Accessor for name of this readable/writable object.
DtStateComponentCreator< DtStatePropertiesStateComponentImplementation > DtStatePropertiesStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: statePropertiesStateComponent.h:346
Base interface for accessing current or next frame state in a double-buffered state component...
Definition: stateComponent.h:354
DtStatePropertiesStateComponentData(const DtStatePropertiesStateComponentData &orig)
Copy constructor.
Definition: statePropertiesStateComponent.h:38
Definition: stateComponent.h:77
std::shared_ptr< DtRwProperties > myParameterProperties
The parameter properties, shared across copies.
Definition: statePropertiesStateComponent.h:101