VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
sensorFieldOfViewStateComponent.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #pragma once
7 
11 #include <vrfutil/rwUUID.h>
12 #include <matrix/vlVector.h>
13 #include <matrix/vlTaitBryan.h>
14 #include "vrfOM/sets/readSensorFieldOfViewRepository.hpp"
15 #include "vrfOM/sets/writeSensorFieldOfViewRepository.hpp"
16 
17 namespace makVrf
18 {
19 
22  {
25  : myPowerOn(false)
27  {};
28 
32  {
33  myPowerOn = orig.myPowerOn;
35  }
36 
41  {
42  myPowerOn = orig.myPowerOn;
44 
45  return *this;
46  }
47 
48  DEFINE_ACCESSOR_MUTATOR(bool, powerOn, PowerOn)
49  DEFINE_ACCESSOR_MUTATOR(DtVector, targetedRelativeLocation, TargetedRelativeLocation)
50 
51  protected:
52 
54  bool myPowerOn;
57  };
58 
64  {
65  public:
67 
68 
71  : DtFrameStateInterface(storage)
72  {
73  }
74 
77  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(unsigned int, color, Color)
79  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(double, maximumAzimuthAngle, MaximumAzimuthAngle)
81  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(double, maximumElevationAngle, MaximumElevationAngle)
83  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(double, maximumZoomLevel, MaximumZoomLevel)
85  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(double, minimumAzimuthAngle, MinimumAzimuthAngle)
87  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(double, minimumElevationAngle, MinimumElevationAngle)
89  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(double, radius, Radius)
91  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(double, xHalfAngle, XHalfAngle)
93  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(double, yHalfAngle, YHalfAngle)
95  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(double, zoomLevel, ZoomLevel)
96 
97 
98  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(bool, powerOn, PowerOn)
101  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(unsigned int, trackingMode, TrackingMode)
105  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(DtTaitBryan, relativeOrientation, RelativeOrientation)
107  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(DtVector, targetedLocation, TargetedLocation)
109  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(DtVector, targetedRelativeLocation, TargetedRelativeLocation)
111  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(DtUUID, targetedEntity, TargetedEntity)
112 
113 
117  UNDEFINED_RETURNREF_ACCESSOR(DtEntityIdentifier, entityId)
119  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(DtVector, relativeLocation, RelativeLocation)
120  };
121 
125  {
126  public:
131  virtual ~DtSensorFieldOfViewStateComponentNextFrame() override;
132 
135  const DtSensorFieldOfViewStateComponentData& frameState() const { return myData; };
137 
142  virtual const unsigned int color() const override;
143  virtual void setColor(const unsigned int&) override;
145 
149  virtual const double maximumAzimuthAngle() const override;
150  virtual void setMaximumAzimuthAngle(const double&) override;
152 
156  virtual const double maximumElevationAngle() const override;
157  virtual void setMaximumElevationAngle(const double&) override;
159 
163  virtual const double maximumZoomLevel() const override;
164  virtual void setMaximumZoomLevel(const double&) override;
166 
170  virtual const double minimumAzimuthAngle() const override;
171  virtual void setMinimumAzimuthAngle(const double&) override;
173 
177  virtual const double minimumElevationAngle() const override;
178  virtual void setMinimumElevationAngle(const double&) override;
180 
184  virtual const double radius() const override;
185  virtual void setRadius(const double&) override;
187 
191  virtual const double xHalfAngle() const override;
192  virtual void setXHalfAngle(const double&) override;
194 
198  virtual const double yHalfAngle() const override;
199  virtual void setYHalfAngle(const double&) override;
201 
205  virtual const double zoomLevel() const override;
206  virtual void setZoomLevel(const double&) override;
208 
213  virtual const bool powerOn() const override;
214  virtual void setPowerOn(const bool&) override;
216 
220  virtual const unsigned int trackingMode() const override;
221  virtual void setTrackingMode(const unsigned int&) override;
226  virtual const DtString fovId() const override;
227  virtual void setFovId(const DtString&) override;
229 
233  virtual const DtTaitBryan relativeOrientation() const override;
234  virtual void setRelativeOrientation(const DtTaitBryan&) override;
236 
240  virtual const DtVector targetedLocation() const override;
241  virtual void setTargetedLocation(const DtVector&) override;
243 
247  virtual const DtVector targetedRelativeLocation() const override;
248  virtual void setTargetedRelativeLocation(const DtVector&) override;
250 
254  virtual const DtUUID& targetedEntity() const override;
255  virtual void setTargetedEntity(const DtUUID&) override;
257 
260  virtual const DtUUID& host() const override;
262  virtual const DtEntityIdentifier& entityId() const override;
263 
267  virtual const DtVector relativeLocation() const override;
268  virtual void setRelativeLocation(const DtVector&) override;
270 
272  virtual void makeWritable() override;
273 
275  virtual Legion::WriteStateInstance writeStateInstance() override;
276 
278  virtual void makeReadOnly() override;
279 
280  protected:
282  VRF::WriteSensorFieldOfViewRepository myWriteSensorFieldOfViewRepository;
285 
287  };
288 
292  {
293  public:
299 
301  const DtSensorFieldOfViewStateComponentData& frameState() const { return myData; };
302 
305  virtual const unsigned int color() const override;
307  virtual const double maximumAzimuthAngle() const override;
309  virtual const double maximumElevationAngle() const override;
311  virtual const double maximumZoomLevel() const override;
313  virtual const double minimumAzimuthAngle() const override;
315  virtual const double minimumElevationAngle() const override;
317  virtual const double radius() const override;
319  virtual const double xHalfAngle() const override;
321  virtual const double yHalfAngle() const override;
323  virtual const double zoomLevel() const override;
324 
327  virtual const bool powerOn() const override;
329  virtual const unsigned int trackingMode() const override;
331  virtual const DtString fovId() const override;
333  virtual const DtTaitBryan relativeOrientation() const override;
335  virtual const DtVector targetedLocation() const override;
337  virtual const DtVector targetedRelativeLocation() const override;
339  virtual const DtUUID& targetedEntity() const override;
340 
343  virtual const DtUUID& host() const override;
345  virtual const DtEntityIdentifier& entityId() const override;
347  virtual const DtVector relativeLocation() const override;
348 
350  bool readComponentValid() const;
353  bool findReadComponent();
354 
355  protected:
357  virtual void handleDataUpdated();
358 
360 
363  virtual void setTargetedEntity(const DtUUID& u) override { myTargetedEntity = u; };
364 
365  void advanceFrame(const DtSensorFieldOfViewStateComponentData& data) { myData = data; };
366 
367  protected:
369  VRF::ReadSensorFieldOfViewRepository myReadSensorFieldOfViewRepository;
374 
376  };
377 
382  {
383  public:
387 
389  bool isDoubleBuffered() { return true; };
391  virtual const DtFrameStateInterface* currentFrameState() const override { return &myCurrentFrameState; }
393  virtual DtFrameStateInterface* nextFrameState() override { return &myNextFrameState; };
395  virtual const DtFrameStateInterface* nextFrameState() const override { return &myNextFrameState; };
396 
398  virtual void updateDataStorage() override
399  {
400  if (myNextFrameState.isWritable())
401  {
402  myCurrentFrameState.setTargetedEntity(myNextFrameState.targetedEntity());
403  myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
404  }
405  myCurrentFrameState.emitComponentUpdated();
406  }
407 
410  virtual void updateStateData(DtStateData* sd) override
411  {
412  myCurrentFrameState.updateStateData(sd);
413  myNextFrameState.updateStateData(sd);
414  }
415 
417  virtual void aboutToBeDeleted() override
418  {
420  myCurrentFrameState.aboutToBeDeleted();
421  myNextFrameState.aboutToBeDeleted();
422  }
423 
425  virtual void firstFrameAdvance() override;
428  virtual bool forceAdvance() override;
429 
430  protected:
437  };
438 
442 }
UUID is a unique ID wrapper class.
Definition: uuid.h:59
virtual void setTargetedEntity(const DtUUID &u) override
Directly sets the cached targeted entity UUID (used by the implementation class). ...
Definition: sensorFieldOfViewStateComponent.h:363
virtual DtFrameStateInterface * nextFrameState() override
Definition: sensorFieldOfViewStateComponent.h:393
const DtSensorFieldOfViewStateComponentData & frameState() const
Current frame state only can access current frame buffers. This ensures thread safety.
Definition: sensorFieldOfViewStateComponent.h:301
virtual void updateStateData(DtStateData *sd) override
Propagates the new state data pointer to both the current- and next-frame states. ...
Definition: sensorFieldOfViewStateComponent.h:410
DtSensorFieldOfViewStateComponentData myData
Definition: sensorFieldOfViewStateComponent.h:375
Cached frame data for the sensor field-of-view state component.
Definition: sensorFieldOfViewStateComponent.h:21
DtSensorFieldOfViewStateComponentCurrentFrame myCurrentFrameState
The current-frame (read-only) state instance.
Definition: sensorFieldOfViewStateComponent.h:432
Default creator implementation for a state component type. T_StateComponent is the concrete component...
Definition: stateComponent.h:326
bool myPowerOn
Boolean indicating whether or not the system is powered on.
Definition: sensorFieldOfViewStateComponent.h:54
virtual void updateDataStorage() override
Copies next-frame targeted entity into the current frame and emits a component-updated signal...
Definition: sensorFieldOfViewStateComponent.h:398
DtSensorFieldOfViewStateComponentData & frameState()
Definition: sensorFieldOfViewStateComponent.h:136
bool isDoubleBuffered()
Definition: sensorFieldOfViewStateComponent.h:389
Contains the DtUUID class declaration.
Read-only access implementation of DtSensorFieldOfViewStateComponent for the current simulation frame...
Definition: sensorFieldOfViewStateComponent.h:291
#define UNDEFINED_RETURNREF_ACCESSOR(ReturnType, Member)
Defines a virtual const reference accessor that throws DtUnimplementedMethod, marking the method as r...
Definition: doubleBufferedDataStorage.h:60
Abstract interface representing the sensor field-of-view state for an entity. Provides accessors and ...
Definition: sensorFieldOfViewStateComponent.h:63
DtVector myTargetedRelativeLocation
Body-relative location relative to the targeted entity that the sensor is pointing at (meters)...
Definition: sensorFieldOfViewStateComponent.h:56
Write-access implementation of DtSensorFieldOfViewStateComponent for the next simulation frame...
Definition: sensorFieldOfViewStateComponent.h:124
const DtSensorFieldOfViewStateComponentData & frameState() const
Next frame access write access. Ensure this is only used in a single thread (i.e.a controller thread)...
Definition: sensorFieldOfViewStateComponent.h:135
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 void aboutToBeDeleted() override
Notifies both frame states that this component is about to be removed.
Definition: sensorFieldOfViewStateComponent.h:417
DtSensorFieldOfViewStateComponentData myData
Definition: sensorFieldOfViewStateComponent.h:286
DtSensorFieldOfViewStateComponentNextFrame myNextFrameState
The next-frame (writable) state instance.
Definition: sensorFieldOfViewStateComponent.h:434
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:489
#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.
DtStateComponentCreator< DtSensorFieldOfViewStateComponentImplementation > DtSensorFieldOfViewStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: sensorFieldOfViewStateComponent.h:441
virtual const DtFrameStateInterface * currentFrameState() const override
Definition: sensorFieldOfViewStateComponent.h:391
VRF::WriteSensorFieldOfViewRepository myWriteSensorFieldOfViewRepository
Legion write repository providing access to the next-frame sensor field-of-view data.
Definition: sensorFieldOfViewStateComponent.h:282
Concrete double-buffered state component implementation for sensor field-of-view data. Owns both a current-frame (read) and next-frame (write) state and manages advancing data between them each simulation frame.
Definition: sensorFieldOfViewStateComponent.h:381
#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
DtSensorFieldOfViewStateComponentData(const DtSensorFieldOfViewStateComponentData &orig)
Copy constructor.
Definition: sensorFieldOfViewStateComponent.h:31
#define DEFINE_ACCESSOR_MUTATOR(ReturnType, Accessor, Mutator)
Defines a const reference accessor and an inline setter for a member variable.
Definition: doubleBufferedDataStorage.h:37
DtUUID myTargetedEntity
UUID of the entity currently targeted by this sensor (cached locally).
Definition: sensorFieldOfViewStateComponent.h:284
int myCallbackHandle
Handle for the instance-updated callback registered with the state data manager.
Definition: sensorFieldOfViewStateComponent.h:373
#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 * nextFrameState() const override
Definition: sensorFieldOfViewStateComponent.h:395
bool myFoundComponent
True after the read component has been successfully located and bound.
Definition: sensorFieldOfViewStateComponent.h:436
Contains the DtStateComponent class declaration.
Base interface for accessing current or next frame state in a double-buffered state component...
Definition: stateComponent.h:354
DtSensorFieldOfViewStateComponentData & operator=(const DtSensorFieldOfViewStateComponentData &orig)
Assignment operator.
Definition: sensorFieldOfViewStateComponent.h:40
DtSensorFieldOfViewStateComponentData()
Default constructor. Initializes the power state to off and a default targeted relative location...
Definition: sensorFieldOfViewStateComponent.h:24
DtUUID myTargetedEntity
Cached UUID of the entity currently targeted by this sensor.
Definition: sensorFieldOfViewStateComponent.h:371

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)