14 #include <vlutil/vlString.h>
15 #include <matrix/vlVector.h>
26 : myModeSettingsList(
"mode-settings")
27 , myHostId(
DtUUID::nullUUID())
33 : myModeSettingsList(orig.myModeSettingsList)
34 , myHostId(orig.myHostId)
52 return myModeSettingsList.hasModeSetting(i);
60 return myModeSettingsList.modeSetting(i);
68 return myModeSettingsList.modeSetting(i);
75 return myModeSettingsList.enabledModes();
81 return myModeSettingsList;
87 return myModeSettingsList;
110 : DtFrameStateInterface(sd)
136 virtual
bool canHaveModeCodeSet(DtModeType modeType)
const
156 virtual void setEnabledModes(
const std::vector<DtModeType>&)
override;
158 virtual std::vector<DtModeType> enabledModes()
const override;
160 virtual bool anyModeIsOn()
const override;
162 virtual bool modeIsOn(DtModeType)
const override;
164 virtual bool hasModeSetting(DtModeType)
const override;
171 virtual const DtUUID& hostId()
const override;
174 virtual void setHostId(
const DtUUID&)
override;
182 virtual void makeReadOnly()
override {};
201 virtual bool anyModeIsOn()
const override;
205 virtual std::vector<DtModeType> enabledModes()
const override;
207 virtual const DtUUID& hostId()
const override;
211 virtual bool modeIsOn(DtModeType)
const override;
213 virtual bool hasModeSetting(DtModeType)
const override;
250 if (myNextFrameState.isWritable())
252 myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
255 myCurrentFrameState.emitComponentUpdated();
262 myCurrentFrameState.updateStateData(sd);
263 myNextFrameState.updateStateData(sd);
270 myCurrentFrameState.aboutToBeDeleted();
271 myNextFrameState.aboutToBeDeleted();
DtIffModeSettingsList & modeSettings()
Returns a mutable reference to the IFF mode settings list.
Definition: iffStateComponent.h:79
UUID is a unique ID wrapper class.
Definition: uuid.h:59
virtual bool modeIsOn(DtModeType) const
Returns true if the specified IFF mode is currently on.
Definition: iffStateComponent.h:125
Exception thrown when a required method has not been implemented.
Definition: stateDataTypes.h:30
DtIffStateComponentData()
Default modes to be enabled mimic current VRL mode enabled.
Definition: iffStateComponent.h:25
DtIffStateComponentNextFrame myNextFrameState
The next-frame IFF state sub-component (writable from the controller thread).
Definition: iffStateComponent.h:278
const DtIffStateComponentData & frameState() const
Next frame access write access. Ensure this is only used in a single thread (i.e.a controller thread)...
Definition: iffStateComponent.h:167
DtStateComponentCreator< DtIffStateComponentImplementation > DtIffStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: iffStateComponent.h:283
std::vector< DtModeType > enabledModes() const
Returns the list of currently enabled IFF mode types.
Definition: iffStateComponent.h:73
virtual std::vector< DtModeType > enabledModes() const
Returns the list of currently enabled IFF mode types.
Definition: iffStateComponent.h:121
virtual bool hasModeSetting(DtModeType) const
Returns true if a mode setting for the specified mode type exists.
Definition: iffStateComponent.h:127
virtual DtFrameStateInterface * nextFrameState() override
Returns the next-frame state interface for modification.
Definition: iffStateComponent.h:243
Default creator implementation for a state component type. T_StateComponent is the concrete component...
Definition: stateComponent.h:326
virtual bool anyModeIsOn() const
Returns true if any IFF mode is currently on.
Definition: iffStateComponent.h:123
bool isDoubleBuffered()
Returns true to indicate this component uses double-buffered storage.
Definition: iffStateComponent.h:239
bool hasModeSetting(int i) const
Returns true if a mode setting for mode index i exists.
Definition: iffStateComponent.h:50
virtual const DtFrameStateInterface * currentFrameState() const override
Returns the current-frame state interface.
Definition: iffStateComponent.h:241
const DtIffModeSettingsList & modeSettings() const
Returns a const reference to the IFF mode settings list.
Definition: iffStateComponent.h:85
2) Define the next frame class. This will be used for write access.
Definition: iffStateComponent.h:143
3) Define the current frame class. This will be used for read access.
Definition: iffStateComponent.h:190
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
DtIffModeSettingsList myModeSettingsList
Accessor and mutator for the host entity UUID.
Definition: iffStateComponent.h:95
DtIffStateComponentCurrentFrame myCurrentFrameState
The current-frame IFF state sub-component (read-only, updated each frame).
Definition: iffStateComponent.h:276
Definition: stateComponent.h:86
virtual void makeWritable() override
Override to make component writable.
Definition: iffStateComponent.h:179
DtUUID myHostId
UUID of the host entity associated with this IFF state.
Definition: iffStateComponent.h:97
DtIffModeSetting * modeSetting(int i)
Returns a mutable pointer to the mode setting for mode index i, or nullptr if not found...
Definition: iffStateComponent.h:66
virtual void updateDataStorage() override
Advances the current frame from the next frame if writable, then emits the component-updated signal...
Definition: iffStateComponent.h:248
virtual void aboutToBeDeleted() override
Notifies this component and its sub-components that the owning entity is about to be deleted...
Definition: iffStateComponent.h:267
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:513
virtual const DtIffModeSetting * modeSetting(int) const
Returns a const pointer to the mode setting for the given mode index.
Definition: iffStateComponent.h:115
Definition: iffModeSettings.h:89
#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
Definition: iffModeSettings.h:125
virtual void updateStateData(DtStateData *sd) override
Updates the state data pointer on both current and next frame sub-components.
Definition: iffStateComponent.h:260
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:489
#define CAN_HAVE_CODES_SET(modeType)
Definition: iffModeSettings.h:51
const DtIffModeSetting * modeSetting(int i) const
Returns a const pointer to the mode setting for mode index i, or nullptr if not found.
Definition: iffStateComponent.h:58
Data container for the IFF (Identification Friend or Foe) state of an entity. Holds a list of IFF mod...
Definition: iffStateComponent.h:22
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: iffStateComponent.h:231
virtual void aboutToBeDeleted()
Called when the component is about to be deleted; emits signal_stateComponentAboutToBeDeleted.
virtual DtIffModeSetting * modeSetting(int)
Returns a mutable pointer to the mode setting for the given mode index.
Definition: iffStateComponent.h:117
const DtIffStateComponentData & frameState() const
Current frame state only can access current frame buffers. This ensures thread safety.
Definition: iffStateComponent.h:198
#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_ACCESSOR_MUTATOR(ReturnType, Accessor, Mutator)
Defines a const reference accessor and an inline setter for a member variable.
Definition: doubleBufferedDataStorage.h:37
DtIffStateComponentData(const DtIffStateComponentData &orig)
Copy constructor.
Definition: iffStateComponent.h:32
DtIffStateComponentData & operator=(const DtIffStateComponentData &rhs)
Assignment operator.
Definition: iffStateComponent.h:39
virtual const DtFrameStateInterface * nextFrameState() const override
Returns the next-frame state interface (const overload).
Definition: iffStateComponent.h:245
#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
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: iffStateComponent.h:102
void advanceFrame(const DtIffStateComponentData &data)
Advances the current frame by copying IFF state data from the next frame.
Definition: iffStateComponent.h:219
Contains the DtStateComponent class declaration.
DtIffStateComponentData & frameState()
Definition: iffStateComponent.h:168
virtual void setEnabledModes(const std::vector< DtModeType > &)
Enables the specified IFF modes.
Definition: iffStateComponent.h:119
Base interface for accessing current or next frame state in a double-buffered state component...
Definition: stateComponent.h:354
DtIffStateComponentData myData
The read-only IFF state data for the current frame.
Definition: iffStateComponent.h:226