VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
laserLightStateComponent.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2025 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #pragma once
7 
10 #include "legionDataStore/writeStateInstance.h"
11 #include "vrfutil/uuid.h"
12 
13 #include <vlutil/vlString.h>
14 
15 namespace makVrf
16 {
19  {
22  : mySignal(0)
23  , mySpread(0.0f)
24  , myWavelength(0.0f)
25  , myPowerOn(false)
26  , myTrackingMode(0)
27  , myLaserId()
33  {};
34 
38  {
39  mySignal = orig.mySignal;
40  mySpread = orig.mySpread;
42 
43  myPowerOn = orig.myPowerOn;
45  myLaserId = orig.myLaserId;
50 
52  }
53 
58  {
59  mySignal = orig.mySignal;
60  mySpread = orig.mySpread;
62 
63  myPowerOn = orig.myPowerOn;
65  myLaserId = orig.myLaserId;
70 
72 
73  return *this;
74  }
75 
77  DEFINE_ACCESSOR_MUTATOR(unsigned, signal, Signal)
78  DEFINE_ACCESSOR_MUTATOR(double, spread, Spread)
79  DEFINE_ACCESSOR_MUTATOR(double, wavelength, Wavelength)
80 
82  DEFINE_ACCESSOR_MUTATOR(bool, powerOn, PowerOn)
83  DEFINE_ACCESSOR_MUTATOR(unsigned, trackingMode, TrackingMode)
84  DEFINE_ACCESSOR_MUTATOR(DtString, laserId, LaserId)
85  DEFINE_ACCESSOR_MUTATOR(DtTaitBryan, relativeOrientation, RelativeOrientation)
86  DEFINE_ACCESSOR_MUTATOR(DtVector, targetedLocation, TargetedLocation)
87  DEFINE_ACCESSOR_MUTATOR(DtVector, targetedRelativeLocation, TargetedRelativeLocation)
88  DEFINE_ACCESSOR_MUTATOR(DtUUID, targetedEntity, TargetedEntity)
89 
91  DEFINE_ACCESSOR_MUTATOR(DtVector, relativeLocation, RelativeLocation)
92 
93  protected:
94 
97  unsigned mySignal;
99  double mySpread;
101  double myWavelength;
102 
105  bool myPowerOn;
107  unsigned myTrackingMode;
109  DtString myLaserId;
118 
122  };
123 
129  {
130  public:
132 
133 
136  : DtFrameStateInterface(sd)
137  { }
138 
141  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(unsigned, signal, Signal)
143  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(double, spread, Spread)
145  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(double, wavelength, Wavelength)
146 
147 
148  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(bool, powerOn, PowerOn)
151  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(unsigned, trackingMode, TrackingMode)
153  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(DtString, laserId, LaserId)
155  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(DtTaitBryan, relativeOrientation, RelativeOrientation)
157  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(DtVector, targetedLocation, TargetedLocation)
159  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(DtVector, targetedRelativeLocation, TargetedRelativeLocation)
161  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(DtUUID, targetedEntity, TargetedEntity)
162 
163 
164  UNDEFINED_RETURNREF_ACCESSOR(DtUUID, host)
167  UNDEFINED_RETURNREF_ACCESSOR(DtEntityIdentifier, entityId)
169  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(DtVector, relativeLocation, RelativeLocation)
170  };
171 
175  {
176  public:
181  virtual ~DtLaserLightStateComponentNextFrame() override;
182 
185  const DtLaserLightStateComponentData& frameState() const { return myData; };
187 
189 
193  virtual const unsigned signal() const override;
194  virtual void setSignal(const unsigned&) override;
196 
200  virtual const double spread() const override;
201  virtual void setSpread(const double&) override;
203 
207  virtual const double wavelength() const override;
208  virtual void setWavelength(const double&) override;
210 
212 
216  virtual const bool powerOn() const override;
217  virtual void setPowerOn(const bool&) override;
219 
223  virtual const unsigned trackingMode() const override;
224  virtual void setTrackingMode(const unsigned&) override;
226 
230  virtual const DtString& laserId() const override;
231  virtual void setLaserId(const DtString&) override;
233 
237  virtual const DtTaitBryan& relativeOrientation() const override;
238  virtual void setRelativeOrientation(const DtTaitBryan&) override;
240 
244  virtual const DtVector& targetedLocation() const override;
245  virtual void setTargetedLocation(const DtVector&) override;
247 
251  virtual const DtVector& targetedRelativeLocation() const override;
252  virtual void setTargetedRelativeLocation(const DtVector&) override;
254 
258  virtual const DtUUID& targetedEntity() const override;
259  virtual void setTargetedEntity(const DtUUID&) override;
261 
263 
265  virtual const DtUUID& host() const override;
266 
268  virtual const DtEntityIdentifier& entityId() const override;
269 
273  virtual const DtVector& relativeLocation() const override;
274  virtual void setRelativeLocation(const DtVector&) override;
276 
278  virtual void makeWritable() override {};
279 
281  virtual void makeReadOnly() override {};
282 
283  protected:
285  mutable DtLaserLightStateComponentData myData;
286  };
287 
290  {
291  public:
296  virtual ~DtLaserLightStateComponentCurrentFrame() override;
297 
299  const DtLaserLightStateComponentData& frameState() const { return myData; };
300 
303  virtual const unsigned signal() const override;
305  virtual const double spread() const override;
307  virtual const double wavelength() const override;
308 
311  virtual const bool powerOn() const override;
313  virtual const unsigned trackingMode() const override;
315  virtual const DtString& laserId() const override;
317  virtual const DtTaitBryan& relativeOrientation() const override;
319  virtual const DtVector& targetedLocation() const override;
321  virtual const DtVector& targetedRelativeLocation() const override;
323  virtual const DtUUID& targetedEntity() const override;
324 
327  virtual const DtUUID& host() const override;
329  virtual const DtEntityIdentifier& entityId() const override;
331  virtual const DtVector& relativeLocation() const override;
332 
333  friend class DtLaserLightStateImplementation;
336  void advanceFrame(const DtLaserLightStateComponentData& data) { myData = data; };
337 
338  protected:
341  };
342 
347  {
348  public:
352 
354  bool isDoubleBuffered() { return true; };
356  virtual const DtFrameStateInterface* currentFrameState() const override { return &myCurrentFrameState; }
358  virtual DtFrameStateInterface* nextFrameState() override { return &myNextFrameState; }
360  virtual const DtFrameStateInterface* nextFrameState() const override { return &myNextFrameState; }
361 
363  virtual void updateDataStorage() override
364  {
365  if (myNextFrameState.isWritable())
366  {
367  myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
368  }
369 
370  myCurrentFrameState.emitComponentUpdated();
371  }
372 
375  virtual void updateStateData(DtStateData* sd) override
376  {
377  myCurrentFrameState.updateStateData(sd);
378  myNextFrameState.updateStateData(sd);
379  }
380 
382  virtual void aboutToBeDeleted() override
383  {
385  myCurrentFrameState.aboutToBeDeleted();
386  myNextFrameState.aboutToBeDeleted();
387  }
388 
389  protected:
394  };
395 
398 }
UUID is a unique ID wrapper class.
Definition: uuid.h:59
virtual const DtFrameStateInterface * currentFrameState() const override
Definition: laserLightStateComponent.h:356
DtString myLaserId
Application-defined string identifier for this laser-light entry.
Definition: laserLightStateComponent.h:109
DtLaserLightStateComponentNextFrame myNextFrameState
The next-frame (writable) state instance.
Definition: laserLightStateComponent.h:393
Read-only access implementation of DtLaserLightStateComponent for the current simulation frame...
Definition: laserLightStateComponent.h:289
unsigned myTrackingMode
Tracking mode controlling how the laser light follows a target.
Definition: laserLightStateComponent.h:107
DtStateComponentCreator< DtLaserLightStateComponentImplementation > DtLaserLightStateComponentCreator
Factory creator type for DtLaserLightStateComponentImplementation; register with REGISTER_STATE_COMPO...
Definition: laserLightStateComponent.h:397
DtLaserLightStateComponentData()
Default constructor. Initializes all laser properties and aim state to their off/zero defaults...
Definition: laserLightStateComponent.h:21
Default creator implementation for a state component type. T_StateComponent is the concrete component...
Definition: stateComponent.h:326
virtual const DtFrameStateInterface * nextFrameState() const override
Definition: laserLightStateComponent.h:360
Contains the DtUUID class declaration.
bool isDoubleBuffered()
Definition: laserLightStateComponent.h:354
unsigned mySignal
Laser Light accessor/mutators:
Definition: laserLightStateComponent.h:97
#define UNDEFINED_RETURNREF_ACCESSOR(ReturnType, Member)
Defines a virtual const reference accessor that throws DtUnimplementedMethod, marking the method as r...
Definition: doubleBufferedDataStorage.h:60
DtUUID myTargetedEntity
UUID of the entity currently targeted by this laser light.
Definition: laserLightStateComponent.h:117
virtual DtFrameStateInterface * nextFrameState() override
Definition: laserLightStateComponent.h:358
Abstract interface representing the laser-light state for an entity. Provides accessors and mutators ...
Definition: laserLightStateComponent.h:128
Cached frame data for the laser-light state component.
Definition: laserLightStateComponent.h:18
const DtLaserLightStateComponentData & frameState() const
Next frame access write access. Ensure this is only used in a single thread (i.e.a controller thread)...
Definition: laserLightStateComponent.h:185
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
DtLaserLightStateComponentCurrentFrame myCurrentFrameState
The current-frame (read-only) state instance.
Definition: laserLightStateComponent.h:391
DtLaserLightStateComponentData & operator=(const DtLaserLightStateComponentData &orig)
Assignment operator.
Definition: laserLightStateComponent.h:57
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:489
virtual void aboutToBeDeleted() override
Notifies both frame states that this component is about to be removed.
Definition: laserLightStateComponent.h:382
virtual void updateStateData(DtStateData *sd) override
Propagates the new state data pointer to both the current- and next-frame states. ...
Definition: laserLightStateComponent.h:375
#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.
DtVector myTargetedLocation
World-space location that the laser light is pointing at (meters, geocentric).
Definition: laserLightStateComponent.h:113
Concrete double-buffered state component implementation for laser-light data. Owns both a current-fra...
Definition: laserLightStateComponent.h:346
DtVector myRelativeLocation
Embedded System members: Position of the laser light relative to the host entity (meters, body frame).
Definition: laserLightStateComponent.h:121
Write-access implementation of DtLaserLightStateComponent for the next simulation frame...
Definition: laserLightStateComponent.h:174
#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
double mySpread
Angular spread of the laser beam (radians).
Definition: laserLightStateComponent.h:99
#define DEFINE_ACCESSOR_MUTATOR(ReturnType, Accessor, Mutator)
Defines a const reference accessor and an inline setter for a member variable.
Definition: doubleBufferedDataStorage.h:37
DtLaserLightStateComponentData & frameState()
Definition: laserLightStateComponent.h:186
double myWavelength
Wavelength of the laser beam (nanometers).
Definition: laserLightStateComponent.h:101
#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 updateDataStorage() override
Copies next-frame state into the current frame and emits a component-updated signal.
Definition: laserLightStateComponent.h:363
const DtLaserLightStateComponentData & frameState() const
Current frame state only can access current frame buffers. This ensures thread safety.
Definition: laserLightStateComponent.h:299
DtLaserLightStateComponentData(const DtLaserLightStateComponentData &orig)
Copy constructor.
Definition: laserLightStateComponent.h:37
Contains the DtStateComponent class declaration.
DtVector myTargetedRelativeLocation
Body-relative location relative to the targeted entity that the laser light is pointing at (meters)...
Definition: laserLightStateComponent.h:115
virtual void makeWritable() override
Override to make component writable.
Definition: laserLightStateComponent.h:278
DtTaitBryan myRelativeOrientation
Orientation of the laser light relative to the host entity body frame (Tait-Bryan angles)...
Definition: laserLightStateComponent.h:111
Base interface for accessing current or next frame state in a double-buffered state component...
Definition: stateComponent.h:354
bool myPowerOn
Aimable System members: Boolean indicating whether or not the system is powered on.
Definition: laserLightStateComponent.h:105

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)