VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
environmentalLocationStateComponent.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 
9 #include <legionStandardOM/sets/readEnvironmentProcessRepository.hpp>
10 #include <legionStandardOM/sets/writeEnvironmentProcessRepository.hpp>
11 #include <tbb/mutex.h>
12 
13 class Coordinate_System;
14 
15 namespace makVrf
16 {
17  class DtStateDataManager;
20  {
23  : myFrozen(false)
24  {};
25 
29  : myFrozen(orig.myFrozen)
30  {
31  }
32 
37  {
38  myFrozen = rhs.myFrozen;
39 
40  return *this;
41  }
42 
43  DEFINE_ACCESSOR_MUTATOR(bool, frozen, Frozen)
44 
45  protected:
47  bool myFrozen;
48  };
49 
54  {
55  public:
57 
58 
61  : DtLocationStateComponent(storage)
62  , myCenterPositionColumn(0xFFFFFFFF)
63  , myOrientationColumn(0xFFFFFFFF)
64  {
65  }
66 
67  UNDEFINED_MUTATOR(int, ObjectAttachMode)
68 
69 
70  virtual const DtString& markingText() const;
72 
73  protected:
80  };
81 
85  {
86  public:
92 
94  const DtEnvironmentalLocationStateComponentData& frameState() const { return myData; };
96 
97  virtual const DtUUID& hostGlobalId() const override;
98  virtual void setHostGlobalId( const DtUUID& id) override;
99 
100  virtual const int objectAttachMode() const override;
101  virtual void setObjectAttachMode(const int&) override;
102 
103  virtual const DtVector location() const override;
104  virtual void setLocation(const DtVector&) override;
105 
106  virtual const bool locationChanged() const override;
107 
108  virtual const double heading() const override;
109  virtual const double pitch() const override;
110  virtual const double roll() const override;
111 
112  virtual const DtVector& worldPosition() const override;
113  virtual const DtVector& relativePosition() const override;
114  virtual const DtVector& parentPosition() const override;
115  virtual const DtVector& localPosition() const override;
116  virtual const DtDcm& worldOrientationMatrix() const override;
117  virtual const bool localPositionIsValid() const override;
118  virtual const bool frozen() const override;
119  virtual void setFrozen(const bool&) override;
120 
121  virtual const DtDcm& parentOrientationMatrix() const override;
122  virtual void setLocalOrientationMatrix(const DtDcm&) override;
123 
124  virtual const DtDcm& localOrientationMatrix() const override;
125 
126  virtual void setLocalPosition(const DtVector&) override;
127  virtual void setWorldPosition(const DtVector&) override;
128  virtual void setParentPosition(const DtVector&) override;
129  virtual void setWorldOrientationMatrix(const DtDcm&) override;
130 
131  virtual const DtTaitBryan orientation() const override;
132  virtual void setOrientation(const DtTaitBryan&) override;
133 
134  virtual const DtTaitBryan& worldOrientation() const override;
135  virtual const DtTaitBryan& topographicOrientation() const override;
136  virtual const DtTaitBryan& parentOrientation() const override;
137  virtual const DtTaitBryan& localOrientation() const override;
138 
139  virtual void setLocalOrientation(const DtTaitBryan&) override;
140  virtual void setLocalOrientationWrtDatabase(const DtTaitBryan&) override;
141  virtual const DtTaitBryan& localOrientationWrtDatabase() const override;
142  virtual void setWorldOrientation(const DtTaitBryan&) override;
143  virtual void setParentOrientation(const DtTaitBryan&) override;
144 
147  void setCoordinateSystem(const Coordinate_System* cs);
150  virtual void setKinematicState(const DtRwVrfKinematicState&) override;
153  virtual const DtRwVrfKinematicState& kinematicState() const override;
156  virtual void refreshKinematicState(const DtEnvironmentalLocationStateComponent&);
157 
160  const bool spatiallyFrozen() const;
161 
163  virtual void makeWritable() override;
164 
166  virtual void makeReadOnly() override;
168  void slot_hostDestroyed();
169 
170  protected:
172  LOM::WriteEnvironmentProcessRepository myWriteEnvironmentProcessRepository;
178  boost::signals2::scoped_connection myHostDeletedConnection;
179  };
180 
184  {
185  public:
191 
193  const DtEnvironmentalLocationStateComponentData& frameState() const { return myData; };
194 
195  virtual const DtUUID& hostGlobalId() const override;
196  virtual const int objectAttachMode() const override;
197 
198  virtual const bool localPositionIsValid() const override;
199  virtual const DtVector location() const override;
200 
201  virtual const DtVector& worldPosition() const override;
202  virtual const DtVector& relativePosition() const override;
203  virtual const DtVector& parentPosition() const override;
204 
205  virtual const DtDcm& parentOrientationMatrix() const override;
206 
207  virtual const DtVector& localPosition() const override;
208 
209  virtual const DtDcm& worldOrientationMatrix() const override;
210  virtual const DtDcm& localOrientationMatrix() const override;
211  virtual const DtTaitBryan& localOrientationWrtDatabase() const override;
212 
213  virtual const double heading() const override;
214  virtual const double pitch() const override;
215  virtual const double roll() const override;
216 
217  virtual const DtTaitBryan orientation() const override;
218  virtual const DtTaitBryan& worldOrientation() const override;
219  virtual const DtTaitBryan& topographicOrientation() const override;
220  virtual const DtTaitBryan& parentOrientation() const override;
221  virtual const DtTaitBryan& localOrientation() const override;
222  virtual const bool frozen() const override;
223 
224  virtual const bool locationChanged() const override;
225 
228  void setCoordinateSystem(const Coordinate_System* cs);
230  void refreshKinematicState() const;
233  virtual const DtRwVrfKinematicState& kinematicState() const override;
234 
237  const bool spatiallyFrozen() const;
238 
239  protected:
244  {
245  myData = data;
246  }
247 
250  void setLocationChanged(bool);
252  virtual void needsKinematicStateRefresh();
253 
254  protected:
257  void handleDataUpdated(const std::vector<UInt32>& attributesUpdated);
258 
259  protected:
261  const LOM::ReadEnvironmentProcessRepository myReadEnvironmentProcessRepository;
267  unsigned int myCallbackHandle;
269  mutable tbb::mutex myKinematicStateMutex;
274  };
275 
279  {
280  public:
284 
287  bool isDoubleBuffered() { return true; };
290  virtual const DtFrameStateInterface* currentFrameState() const override { return &myCurrentFrameState; }
293  virtual DtFrameStateInterface* nextFrameState() override { return &myNextFrameState; };
296  virtual const DtFrameStateInterface* nextFrameState() const override { return &myNextFrameState; };
297 
299  virtual void setCoordinateSystem(const Coordinate_System*) override;
300 
302  virtual bool forceAdvance() override;
303 
305  virtual void updateDataStorage() override;
306 
309  virtual void updateStateData(DtStateData* sd) override
310  {
311  myCurrentFrameState.updateStateData(sd);
312  myNextFrameState.updateStateData(sd);
313  }
314 
317  virtual void initializeFromParameters(const DtVrfObjectParameters* params) override;
318 
320  virtual void aboutToBeDeleted() override
321  {
323  myCurrentFrameState.aboutToBeDeleted();
324  myNextFrameState.aboutToBeDeleted();
325  }
326 
327  protected:
334  };
335 
338 }
339 
UUID is a unique ID wrapper class.
Definition: uuid.h:59
Instances of DtVrfObjectParameters are the readable/writeable objects that contain the information ne...
Definition: vrfObjectParameters.h:64
tbb::mutex myKinematicStateMutex
Mutex protecting kinematic state refresh against concurrent read access.
Definition: environmentalLocationStateComponent.h:269
virtual void aboutToBeDeleted() override
Cleans up both frame states before the component is deleted.
Definition: environmentalLocationStateComponent.h:320
virtual DtFrameStateInterface * nextFrameState() override
Returns a pointer to the next (write) frame state.
Definition: environmentalLocationStateComponent.h:293
UInt32 myOrientationColumn
Column index for the Orientation attribute in the environment process repository. ...
Definition: environmentalLocationStateComponent.h:79
The DtLocationStateComponent interface contains the interface that all DtLocationStateComponents can ...
Definition: locationStateComponent.h:25
bool myLocationChanged
Whether the entity location changed during this frame.
Definition: environmentalLocationStateComponent.h:263
bool isDoubleBuffered()
Returns true since this component uses double buffering.
Definition: environmentalLocationStateComponent.h:287
const DtEnvironmentalLocationStateComponentData & frameState() const
Current frame state only can access current frame buffers. This ensures thread safety.
Definition: environmentalLocationStateComponent.h:193
unsigned int UInt32
32-bit unsigned integer type.
Definition: stateDataTypes.h:21
Default creator implementation for a state component type. T_StateComponent is the concrete component...
Definition: stateComponent.h:326
virtual const DtFrameStateInterface * currentFrameState() const override
Returns a pointer to the current (read) frame state.
Definition: environmentalLocationStateComponent.h:290
DtStateDataManager * myStateDataManager
Manager used to look up state data for parent (host) entities.
Definition: environmentalLocationStateComponent.h:265
DtRwVrfKinematicState * myKinematicState
Derived kinematic state for position and orientation computations.
Definition: environmentalLocationStateComponent.h:176
DtEnvironmentalLocationStateComponentNextFrame myNextFrameState
Next (write) frame state buffer.
Definition: environmentalLocationStateComponent.h:331
DtEnvironmentalLocationStateComponentData()
Constructs the data with default values (not frozen).
Definition: environmentalLocationStateComponent.h:22
DtRwVrfKinematicState * myKinematicState
Derived kinematic state for position and orientation computations.
Definition: environmentalLocationStateComponent.h:273
DtEnvironmentalLocationStateComponentData & operator=(const DtEnvironmentalLocationStateComponentData &rhs)
Assignment operator.
Definition: environmentalLocationStateComponent.h:36
const DtEnvironmentalLocationStateComponentData & frameState() const
Next frame access write access. Ensure this is only used in a single thread (i.e.a controller thread)...
Definition: environmentalLocationStateComponent.h:94
DtEnvironmentalLocationStateComponentData(const DtEnvironmentalLocationStateComponentData &orig)
Copy constructor.
Definition: environmentalLocationStateComponent.h:28
boost::signals2::scoped_connection myHostDeletedConnection
Signal connection that fires when the host entity is destroyed.
Definition: environmentalLocationStateComponent.h:178
DtEnvironmentalLocationStateComponentData & frameState()
Definition: environmentalLocationStateComponent.h:95
bool myNeedsKinematicStateRefresh
Whether the kinematic state needs to be recomputed before next access.
Definition: environmentalLocationStateComponent.h:271
virtual void updateStateData(DtStateData *sd) override
Updates the state data pointer in both frame state buffers.
Definition: environmentalLocationStateComponent.h:309
Double-buffered state component implementation for environmental location. Manages the current (read)...
Definition: environmentalLocationStateComponent.h:278
Definition: coordSystem.h:54
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
unsigned int myCallbackHandle
Handle for the data-updated callback registered with the state data.
Definition: environmentalLocationStateComponent.h:267
Current-frame (read) implementation of the environmental location state component. Provides thread-safe read access to the committed position and orientation data.
Definition: environmentalLocationStateComponent.h:183
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:489
DtVector myParentLocation
Cached world position of the parent entity, used to detect parent movement.
Definition: environmentalLocationStateComponent.h:333
void advanceFrame(const DtEnvironmentalLocationStateComponentData &data)
Advances the internal frame state to the given data, called when a new frame is committed.
Definition: environmentalLocationStateComponent.h:243
virtual void aboutToBeDeleted()
Called when the component is about to be deleted; emits signal_stateComponentAboutToBeDeleted.
bool myFrozen
Whether this environmental entity&#39;s position is frozen.
Definition: environmentalLocationStateComponent.h:47
Data storage for environmental location state, shared between frame buffers.
Definition: environmentalLocationStateComponent.h:19
DtEnvironmentalLocationStateComponentCurrentFrame myCurrentFrameState
Current (read) frame state buffer.
Definition: environmentalLocationStateComponent.h:329
DtStateComponentCreator< DtEnvironmentalLocationStateComponentImplementation > DtEnvironmentalLocationStateComponentCreator
Creator type for DtEnvironmentalLocationStateComponentImplementation, registered via REGISTER_STATE_C...
Definition: environmentalLocationStateComponent.h:337
#define DEFINE_ACCESSOR_MUTATOR(ReturnType, Accessor, Mutator)
Defines a const reference accessor and an inline setter for a member variable.
Definition: doubleBufferedDataStorage.h:37
const LOM::ReadEnvironmentProcessRepository myReadEnvironmentProcessRepository
Read repository for accessing environment process data store attributes.
Definition: environmentalLocationStateComponent.h:261
DtEnvironmentalLocationStateComponentData myData
Frame state data (frozen flag and related fields).
Definition: environmentalLocationStateComponent.h:75
LOM::WriteEnvironmentProcessRepository myWriteEnvironmentProcessRepository
Write repository for accessing and modifying environment process data store attributes.
Definition: environmentalLocationStateComponent.h:172
A subclass extension of DtRwSimKinematicState for VRF-specific movable objects. This class is a DtRwS...
Definition: rwVrfKinematicState.h:28
#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
DtStateDataManager * myStateDataManager
Manager used to look up state data for parent (host) entities.
Definition: environmentalLocationStateComponent.h:174
virtual const DtFrameStateInterface * nextFrameState() const override
Returns a const pointer to the next (write) frame state.
Definition: environmentalLocationStateComponent.h:296
Base interface class representing the location state of an environmental process entity. Provides access to position, orientation, and attachment information for environmental objects. Derived classes provide next-frame (write) and current-frame (read) access.
Definition: environmentalLocationStateComponent.h:53
Base interface for accessing current or next frame state in a double-buffered state component...
Definition: stateComponent.h:354
Next-frame (write) implementation of the environmental location state component. Used by a single con...
Definition: environmentalLocationStateComponent.h:84
#define UNDEFINED_MUTATOR(Type, Set)
Defines a virtual setter that throws DtUnimplementedMethod, requiring an override in a derived class...
Definition: doubleBufferedDataStorage.h:81
UInt32 myCenterPositionColumn
Column index for the CenterPosition attribute in the environment process repository.
Definition: environmentalLocationStateComponent.h:77
This class holds the state data that represents each simulation object in the system.
Definition: stateDataManager.h:76

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)