10 #include <vlpi/entityIdentifier.h>
24 : myObjectIdentifier(orig.myObjectIdentifier)
25 , myGeometryAndData(orig.myGeometryAndData)
42 DtEntityIdentifier myObjectIdentifier;
44 DtTerrainGeometryAndDataList myGeometryAndData;
55 : DtFrameStateInterface(storage)
71 DtU32 priority, DtU32 eventNumber) {
throw DtUnimplementedMethod(
"virtual void setDataForEntry(unsigned index) is unimplemented by this class."); }
87 virtual const DtEntityIdentifier& objectIdentifier()
const override;
90 virtual void setObjectIdentifier(
const DtEntityIdentifier&
id)
override;
104 virtual void removeGeometryAndDataEntry(
unsigned index)
override;
109 DtU32 priority, DtU32 eventNumber)
override;
115 virtual void makeReadOnly()
override {};
133 virtual const DtEntityIdentifier& objectIdentifier()
const override;
172 if (myNextFrameState.isWritable())
174 myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
177 myCurrentFrameState.emitComponentUpdated();
184 myCurrentFrameState.updateStateData(sd);
185 myNextFrameState.updateStateData(sd);
192 myCurrentFrameState.aboutToBeDeleted();
193 myNextFrameState.aboutToBeDeleted();
virtual void setDataForEntry(unsigned index, const DtKeyValuePairList &val, DtU32 priority, DtU32 eventNumber)
Sets the key/value data, priority, and event number for the geometry entry at the given index...
Definition: dynamicTerrainStateComponent.h:70
DtDynamicTerrainStateComponentData(const DtDynamicTerrainStateComponentData &orig)
Definition: dynamicTerrainStateComponent.h:23
Exception thrown when a required method has not been implemented.
Definition: stateDataTypes.h:30
virtual void setGeometryAndDataEntry(unsigned index, const DtTerrainGeometryAndData &val)
Sets the geometry and data entry at the given index.
Definition: dynamicTerrainStateComponent.h:66
Definition: terrainGeometryAndData.h:24
DtDynamicTerrainStateComponentData()
Definition: dynamicTerrainStateComponent.h:19
DtDynamicTerrainStateComponentData & frameState()
Returns a mutable reference to the next frame data buffer (write access).
Definition: dynamicTerrainStateComponent.h:84
Definition: keyValuePairList.h:18
virtual void updateStateData(DtStateData *sd) override
Updates the underlying state data pointer for both current and next frame states. ...
Definition: dynamicTerrainStateComponent.h:182
const DtDynamicTerrainStateComponentData & frameState() const
Current frame state only can access current frame buffers. This ensures thread safety.
Definition: dynamicTerrainStateComponent.h:130
Default creator implementation for a state component type. T_StateComponent is the concrete component...
Definition: stateComponent.h:326
DtStateComponentCreator< DtDynamicTerrainStateComponentImplementation > DtDynamicTerrainStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: dynamicTerrainStateComponent.h:205
bool isDoubleBuffered()
Returns true, indicating this component uses double-buffered state storage.
Definition: dynamicTerrainStateComponent.h:160
void advanceFrame(const DtDynamicTerrainStateComponentData &data)
Advances the current frame by copying the given data into the local buffer.
Definition: dynamicTerrainStateComponent.h:141
DtTerrainGeometryAndDataList myGeometryAndData
Geometry entries paired with key/value metadata.
Definition: dynamicTerrainStateComponent.h:44
#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
DtDynamicTerrainStateComponentCurrentFrame myCurrentFrameState
The read-only current frame state.
Definition: dynamicTerrainStateComponent.h:198
Definition: terrainGeometryAndDataList.h:23
DtDynamicTerrainStateComponentData & operator=(const DtDynamicTerrainStateComponentData &rhs)
Definition: dynamicTerrainStateComponent.h:29
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:513
#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 DtFrameStateInterface * nextFrameState() override
Returns a mutable pointer to the next frame state interface.
Definition: dynamicTerrainStateComponent.h:164
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:489
virtual void updateDataStorage() override
Promotes the next frame data to the current frame if the next frame is writable, then emits a compone...
Definition: dynamicTerrainStateComponent.h:170
const DtDynamicTerrainStateComponentData & frameState() const
Next frame access write access. Ensure this is only used in a single thread (i.e.a controller thread)...
Definition: dynamicTerrainStateComponent.h:82
virtual void aboutToBeDeleted()
Called when the component is about to be deleted; emits signal_stateComponentAboutToBeDeleted.
Data container holding the state for a dynamic terrain object, including its network-visible identifi...
Definition: dynamicTerrainStateComponent.h:17
DtDynamicTerrainStateComponentData myData
The current frame state data buffer.
Definition: dynamicTerrainStateComponent.h:148
2) Define the next frame class. This will be used for write access.
Definition: dynamicTerrainStateComponent.h:75
virtual void makeWritable() override
Override to make component writable.
Definition: dynamicTerrainStateComponent.h:112
#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
#define DEFINE_REF_ACCESSORS(ReturnType, Method, Member)
Defines const and non-const reference accessors for a member variable.
Definition: doubleBufferedDataStorage.h:17
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: dynamicTerrainStateComponent.h:153
#define DEFINE_ACCESSOR_MUTATOR(ReturnType, Accessor, Mutator)
Defines a const reference accessor and an inline setter for a member variable.
Definition: doubleBufferedDataStorage.h:37
Definition: stateComponent.h:93
virtual const DtFrameStateInterface * nextFrameState() const override
Returns a const pointer to the next frame state interface.
Definition: dynamicTerrainStateComponent.h:166
#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 const DtFrameStateInterface * currentFrameState() const override
Returns a const pointer to the current frame state interface.
Definition: dynamicTerrainStateComponent.h:162
virtual void removeGeometryAndDataEntry(unsigned index)
Removes the geometry and data entry at the given index.
Definition: dynamicTerrainStateComponent.h:68
DtDynamicTerrainStateComponentNextFrame myNextFrameState
The writable next frame state.
Definition: dynamicTerrainStateComponent.h:200
Contains the DtStateComponent class declaration.
Base interface for accessing current or next frame state in a double-buffered state component...
Definition: stateComponent.h:354
DtEntityIdentifier myObjectIdentifier
The network-visible identifier for this terrain object.
Definition: dynamicTerrainStateComponent.h:42
virtual void aboutToBeDeleted() override
Notifies the base class and both frame states that this component is about to be deleted.
Definition: dynamicTerrainStateComponent.h:189
3) Define the current frame class. This will be used for read access.
Definition: dynamicTerrainStateComponent.h:123
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: dynamicTerrainStateComponent.h:49