VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
tacticalSmokeStateComponent.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 
12 
13 namespace makVrf
14 {
17  {
20  : myPuffDataList("puff-list")
21  , myDeadReckoningThresholds("thresholds")
22  , myDeadReckoningDensityThreshold(1.0)
23  , myDeadReckoningSigmaThreshold(1.0)
24  {
25  }
26 
30  : myPuffDataList(orig.myPuffDataList)
31  , myDeadReckoningThresholds(orig.myDeadReckoningThresholds)
32  , myDeadReckoningDensityThreshold(orig.myDeadReckoningDensityThreshold)
33  , myDeadReckoningSigmaThreshold(orig.myDeadReckoningSigmaThreshold)
34  {
35  }
36 
41  {
42  myPuffDataList = rhs.myPuffDataList;
43  myDeadReckoningThresholds = rhs.myDeadReckoningThresholds;
44  myDeadReckoningDensityThreshold = rhs.myDeadReckoningDensityThreshold;
45  myDeadReckoningSigmaThreshold = rhs.myDeadReckoningSigmaThreshold;
46 
47  return *this;
48  }
49 
52  {
53  myPuffDataList.removeAndDeleteAll();
54  }
55 
56  DEFINE_REF_ACCESSORS(DtGaussianPuffDataList, puffDataList, PuffDataList)
57  DEFINE_REF_ACCESSORS(DtRwDeadReckonThresholds, deadReckoningThresholds, DeadReckoningThresholds)
58  DEFINE_ACCESSOR_MUTATOR(double, deadReckoningDensityThreshold, DeadReckoningDensityThreshold)
59  DEFINE_ACCESSOR_MUTATOR(double, deadReckoningSigmaThreshold, DeadReckoningSigmaThreshold)
60 
61  protected:
63  DtGaussianPuffDataList myPuffDataList;
65  DtRwDeadReckonThresholds myDeadReckoningThresholds;
67  double myDeadReckoningDensityThreshold;
69  double myDeadReckoningSigmaThreshold;
70  };
71 
75  {
76  public:
78 
79 
82  : DtFrameStateInterface(storage)
83  {
84  }
85 
87  UNDEFINED_RETURNREF_ACCESSORS(DtRwDeadReckonThresholds, deadReckoningThresholds)
88  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(double, deadReckoningDensityThreshold, DeadReckoningDensityThreshold)
89  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(double, deadReckoningSigmaThreshold, DeadReckoningSigmaThreshold)
90  };
91 
94  {
95  public:
99 
101  const DtTacticalSmokeStateComponentData& frameState() const { return myData; };
103 
105  virtual const DtGaussianPuffDataList& puffDataList() const override;
107  virtual DtGaussianPuffDataList& puffDataList() override;
108 
110  virtual const DtRwDeadReckonThresholds& deadReckoningThresholds() const override;
112  virtual DtRwDeadReckonThresholds& deadReckoningThresholds() override;
113 
115  virtual const double& deadReckoningDensityThreshold() const override;
118  virtual void setDeadReckoningDensityThreshold(const double&) override;
119 
121  virtual const double& deadReckoningSigmaThreshold() const override;
124  virtual void setDeadReckoningSigmaThreshold(const double&) override;
125 
127  virtual void makeWritable() override {};
128 
130  virtual void makeReadOnly() override {};
131 
132  protected:
135  };
136 
139  {
140  public:
144 
146  const DtTacticalSmokeStateComponentData& frameState() const { return myData; };
147 
149  virtual const DtGaussianPuffDataList& puffDataList() const override;
151  virtual const DtRwDeadReckonThresholds& deadReckoningThresholds() const override;
153  virtual const double& deadReckoningDensityThreshold() const override;
155  virtual const double& deadReckoningSigmaThreshold() const override;
156 
157  protected:
162  {
163  myData = data;
164  }
165 
166  protected:
169  };
170 
174  {
175  public:
179 
181  bool isDoubleBuffered() { return true; };
183  virtual const DtFrameStateInterface* currentFrameState() const override { return &myCurrentFrameState; }
185  virtual DtFrameStateInterface* nextFrameState() override { return &myNextFrameState; };
187  virtual const DtFrameStateInterface* nextFrameState() const override { return &myNextFrameState; };
188 
190  virtual void updateDataStorage() override
191  {
192  if (myNextFrameState.isWritable())
193  {
194  myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
195  }
196 
197  myCurrentFrameState.emitComponentUpdated();
198  }
199 
202  virtual void updateStateData(DtStateData* sd) override
203  {
204  myNextFrameState.updateStateData(sd);
205  myCurrentFrameState.updateStateData(sd);
206  }
207 
210  virtual void initializeFromParameters(const DtVrfObjectParameters*) override;
211 
213  virtual void aboutToBeDeleted() override
214  {
216  myCurrentFrameState.aboutToBeDeleted();
217  myNextFrameState.aboutToBeDeleted();
218  }
219 
220  protected:
225  };
226 
230 }
Instances of DtVrfObjectParameters are the readable/writeable objects that contain the information ne...
Definition: vrfObjectParameters.h:64
virtual void updateDataStorage() override
Copies next-frame data to the current frame if the next frame is writable, then emits a component-upd...
Definition: tacticalSmokeStateComponent.h:190
double myDeadReckoningSigmaThreshold
Threshold for dead-reckoning based on Gaussian sigma changes.
Definition: tacticalSmokeStateComponent.h:69
bool isDoubleBuffered()
Definition: tacticalSmokeStateComponent.h:181
virtual DtFrameStateInterface * nextFrameState() override
Definition: tacticalSmokeStateComponent.h:185
const DtTacticalSmokeStateComponentData & frameState() const
Next frame access write access. Ensure this is only used in a single thread (i.e.a controller thread)...
Definition: tacticalSmokeStateComponent.h:101
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: tacticalSmokeStateComponent.h:173
virtual void makeWritable() override
Override to make component writable.
Definition: tacticalSmokeStateComponent.h:127
DtGaussianPuffDataList myPuffDataList
List of Gaussian puff data representing smoke cloud positions and properties.
Definition: tacticalSmokeStateComponent.h:63
Default creator implementation for a state component type. T_StateComponent is the concrete component...
Definition: stateComponent.h:326
virtual const DtFrameStateInterface * currentFrameState() const override
Definition: tacticalSmokeStateComponent.h:183
DtTacticalSmokeStateComponentData myData
Read-only snapshot of the tactical smoke state data for the current frame.
Definition: tacticalSmokeStateComponent.h:168
DtTacticalSmokeStateComponentData(const DtTacticalSmokeStateComponentData &orig)
Copy constructor.
Definition: tacticalSmokeStateComponent.h:29
#define UNDEFINED_RETURNREF_ACCESSORS(ReturnType, Member)
Defines both const and non-const virtual reference accessors that throw DtUnimplementedMethod, requiring overrides in a derived class.
Definition: doubleBufferedDataStorage.h:74
3) Define the current frame class. This will be used for read access.
Definition: tacticalSmokeStateComponent.h:138
const DtTacticalSmokeStateComponentData & frameState() const
Current frame state only can access current frame buffers. This ensures thread safety.
Definition: tacticalSmokeStateComponent.h:146
void advanceFrame(const DtTacticalSmokeStateComponentData &data)
Advances the current frame by copying the provided data snapshot.
Definition: tacticalSmokeStateComponent.h:161
2) Define the next frame class. This will be used for write access.
Definition: tacticalSmokeStateComponent.h:93
virtual const DtFrameStateInterface * nextFrameState() const override
Definition: tacticalSmokeStateComponent.h:187
virtual void updateStateData(DtStateData *sd) override
Updates the state data pointer on both current and next frame state views.
Definition: tacticalSmokeStateComponent.h:202
Definition: rwDeadReckonThresholds.h:23
DtTacticalSmokeStateComponentCurrentFrame myCurrentFrameState
Current frame state view, used for thread-safe read access.
Definition: tacticalSmokeStateComponent.h:222
Data container for tactical smoke state, holding Gaussian puff data and dead-reckoning thresholds...
Definition: tacticalSmokeStateComponent.h:16
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 ~DtTacticalSmokeStateComponentData()
Destructor. Removes and deletes all puff data entries.
Definition: tacticalSmokeStateComponent.h:51
DtStateComponentCreator< DtTacticalSmokeStateComponentImplementation > DtTacticalSmokeStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: tacticalSmokeStateComponent.h:229
DtRwDeadReckonThresholds myDeadReckoningThresholds
Dead-reckoning thresholds for position and orientation updates.
Definition: tacticalSmokeStateComponent.h:65
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:489
DtTacticalSmokeStateComponentData()
Default constructor. Initializes puff data list and dead-reckoning thresholds with default values...
Definition: tacticalSmokeStateComponent.h:19
virtual void aboutToBeDeleted()
Called when the component is about to be deleted; emits signal_stateComponentAboutToBeDeleted.
DtTacticalSmokeStateComponentData & operator=(const DtTacticalSmokeStateComponentData &rhs)
Assignment operator.
Definition: tacticalSmokeStateComponent.h:40
virtual void aboutToBeDeleted() override
Notifies the current and next frame states that the component is about to be deleted.
Definition: tacticalSmokeStateComponent.h:213
#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_REF_ACCESSORS(ReturnType, Method, Member)
Defines const and non-const reference accessors for a member variable.
Definition: doubleBufferedDataStorage.h:17
#define DEFINE_ACCESSOR_MUTATOR(ReturnType, Accessor, Mutator)
Defines a const reference accessor and an inline setter for a member variable.
Definition: doubleBufferedDataStorage.h:37
#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
DtTacticalSmokeStateComponentData & frameState()
Definition: tacticalSmokeStateComponent.h:102
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: tacticalSmokeStateComponent.h:74
Contains the DtStateComponent class declaration.
double myDeadReckoningDensityThreshold
Threshold for dead-reckoning based on smoke density changes.
Definition: tacticalSmokeStateComponent.h:67
Base interface for accessing current or next frame state in a double-buffered state component...
Definition: stateComponent.h:354
DtTacticalSmokeStateComponentNextFrame myNextFrameState
Next frame state view, used for single-threaded write access.
Definition: tacticalSmokeStateComponent.h:224

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)