10 #include <legionStandardOM/sets/readDesignatorRepository.hpp>
11 #include <legionStandardOM/sets/writeDesignatorRepository.hpp>
13 #include <matrix/vlVector.h>
22 : myDesignatedObject(
DtUUID::nullUUID())
23 , myDesignatorId(
DtUUID::nullUUID())
29 : myDesignatedObject(orig.myDesignatedObject)
30 , myDesignatorId(orig.myDesignatorId)
31 , myGlobalId(orig.myGlobalId)
32 , myUserData(orig.myUserData)
53 DtUUID myDesignatedObject;
55 DtUUID myDesignatorId;
59 unsigned long long myUserData;
70 : DtFrameStateInterface(storage)
101 virtual const DtUUID& designatedObject()
const override;
103 virtual void setDesignatedObject(
const DtUUID&)
override;
106 virtual const DtUUID& designatorId()
const override;
108 virtual void setDesignatorId(
const DtUUID&)
override;
111 virtual const unsigned int designatorCode()
const override;
113 virtual void setDesignatorCode(
const unsigned int&)
override;
116 virtual const unsigned long long userData()
const override;
118 virtual void setUserData(
const unsigned long long&)
override;
121 virtual const unsigned int drAlgorithm()
const override;
123 virtual void setDrAlgorithm(
const unsigned int&)
override;
126 virtual const unsigned int codeName()
const override;
128 virtual void setCodeName(
const unsigned int&)
override;
131 virtual const DtVector spotLinearAcceleration()
const override;
133 virtual void setSpotLinearAcceleration(
const DtVector&)
override;
136 virtual const double designatorPower()
const override;
138 virtual void setDesignatorPower(
const double&)
override;
141 virtual const double designatorWavelength()
const override;
143 virtual void setDesignatorWavelength(
const double&)
override;
146 virtual const DtVector designatorSpotLocation()
const override;
148 virtual void setDesignatorSpotLocation(
const DtVector&)
override;
151 virtual const DtVector relativeSpotLocation()
const override;
153 virtual void setRelativeSpotLocation(
const DtVector&)
override;
156 virtual const DtVector relativePosition()
const override;
158 virtual void setRelativePosition(
const DtVector&)
override;
161 virtual const DtString& globalId()
const override;
163 virtual void setGlobalId(
const DtString&)
override;
166 virtual void makeWritable()
override;
169 virtual void makeReadOnly()
override;
171 void cleanupWriteState();
191 virtual const unsigned long long userData()
const override;
193 virtual const DtUUID& designatedObject()
const override;
195 virtual const DtUUID& designatorId()
const override;
197 virtual const unsigned int designatorCode()
const override;
199 virtual const double designatorPower()
const override;
201 virtual const double designatorWavelength()
const override;
203 virtual const DtVector designatorSpotLocation()
const override;
205 virtual const DtVector relativeSpotLocation()
const override;
207 virtual const DtVector relativePosition()
const override;
209 virtual const unsigned int codeName()
const override;
211 virtual const DtVector spotLinearAcceleration()
const override;
213 virtual const unsigned int drAlgorithm()
const override;
215 virtual const DtString& globalId()
const override;
218 bool readComponentValid()
const;
221 bool findReadComponent();
225 void handleDataUpdated();
262 virtual bool forceAdvance()
override;
268 if (myNextFrameState.isWritable())
270 if (!myFoundComponent)
272 myFoundComponent = myCurrentFrameState.findReadComponent();
275 myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
278 myCurrentFrameState.emitComponentUpdated();
285 myCurrentFrameState.updateStateData(sd);
286 myNextFrameState.updateStateData(sd);
293 myCurrentFrameState.aboutToBeDeleted();
294 myNextFrameState.aboutToBeDeleted();
298 virtual void firstFrameAdvance()
override;
300 virtual void removeAdditionalStateComponents()
override;
UUID is a unique ID wrapper class.
Definition: uuid.h:59
const DtLaserDesignatorStateComponentData & frameState() const
Current frame state only can access current frame buffers. This ensures thread safety.
Definition: laserDesignatorStateComponent.h:188
Definition: stateComponent.h:84
DtLaserDesignatorStateComponentData myData
Laser designator state data for the current frame.
Definition: laserDesignatorStateComponent.h:237
DtUUID myDesignatedObject
UUID of the entity currently being designated by this laser designator.
Definition: laserDesignatorStateComponent.h:53
LOM::ReadDesignatorRepository myReadDesignatorRepository
Read-access Legion designator repository for consuming state.
Definition: laserDesignatorStateComponent.h:239
Default creator implementation for a state component type. T_StateComponent is the concrete component...
Definition: stateComponent.h:326
DtStateComponentCreator< DtLaserDesignatorStateComponentImplementation > DtLaserDesignatorStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: laserDesignatorStateComponent.h:313
DtLaserDesignatorStateComponentData & operator=(const DtLaserDesignatorStateComponentData &rhs)
Definition: laserDesignatorStateComponent.h:36
virtual const DtFrameStateInterface * nextFrameState() const override
Definition: laserDesignatorStateComponent.h:258
DtLaserDesignatorStateComponentNextFrame myNextFrameState
Next frame laser designator state component (write access).
Definition: laserDesignatorStateComponent.h:306
Contains the DtUUID class declaration.
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: laserDesignatorStateComponent.h:246
virtual const DtFrameStateInterface * currentFrameState() const override
Definition: laserDesignatorStateComponent.h:254
virtual void updateDataStorage() override
Copies the next frame state into the current frame, and attempts to locate the read component if it h...
Definition: laserDesignatorStateComponent.h:266
Holds the state data for a single laser designator, including the designated target entity...
Definition: laserDesignatorStateComponent.h:19
DtLaserDesignatorStateComponentData()
Definition: laserDesignatorStateComponent.h:21
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:513
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: laserDesignatorStateComponent.h:64
#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
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:489
unsigned long long myUserData
Application-defined tag for associating arbitrary data with this designator.
Definition: laserDesignatorStateComponent.h:59
#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
LOM::WriteDesignatorRepository myWriteDesignatorRepository
Write-access Legion designator repository for publishing state.
Definition: laserDesignatorStateComponent.h:177
DtUUID myDesignatorId
Unique identifier for this laser designator instance.
Definition: laserDesignatorStateComponent.h:55
DtLaserDesignatorStateComponentData & frameState()
Definition: laserDesignatorStateComponent.h:98
2) Define the next frame class. This will be used for write access.
Definition: laserDesignatorStateComponent.h:90
virtual void aboutToBeDeleted()
Called when the component is about to be deleted; emits signal_stateComponentAboutToBeDeleted.
bool isDoubleBuffered()
Definition: laserDesignatorStateComponent.h:252
virtual void updateStateData(DtStateData *sd) override
Updates the state data pointer for both the current and next frame states.
Definition: laserDesignatorStateComponent.h:283
3) Define the current frame class. This will be used for read access.
Definition: laserDesignatorStateComponent.h:181
#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
DtLaserDesignatorStateComponentData myData
Laser designator state data for the next frame.
Definition: laserDesignatorStateComponent.h:175
virtual void aboutToBeDeleted() override
Notifies the current and next frame states that the component is about to be deleted.
Definition: laserDesignatorStateComponent.h:290
int myCallbackHandle
Handle for the instance-updated callback registered with the read repository.
Definition: laserDesignatorStateComponent.h:241
#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
const DtLaserDesignatorStateComponentData & frameState() const
Next frame access write access. Ensure this is only used in a single thread (i.e.a controller thread)...
Definition: laserDesignatorStateComponent.h:97
DtLaserDesignatorStateComponentCurrentFrame myCurrentFrameState
Current frame laser designator state component (read access).
Definition: laserDesignatorStateComponent.h:304
virtual DtFrameStateInterface * nextFrameState() override
Definition: laserDesignatorStateComponent.h:256
Contains the DtStateComponent class declaration.
bool myFoundComponent
Tracks whether the read designator repository has been located.
Definition: laserDesignatorStateComponent.h:308
DtString myGlobalId
Protocol-independent string identifier for this laser designator.
Definition: laserDesignatorStateComponent.h:57
DtLaserDesignatorStateComponentData(const DtLaserDesignatorStateComponentData &orig)
Definition: laserDesignatorStateComponent.h:28
Base interface for accessing current or next frame state in a double-buffered state component...
Definition: stateComponent.h:354
void advanceFrame(const DtLaserDesignatorStateComponentData &data)
Advances the current frame state to the provided data.
Definition: laserDesignatorStateComponent.h:230