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 {
16  {
18  : myPuffDataList("puff-list")
19  , myDeadReckoningThresholds("thresholds")
20  , myDeadReckoningDensityThreshold(1.0)
21  , myDeadReckoningSigmaThreshold(1.0)
22  {
23  }
24 
26  : myPuffDataList(orig.myPuffDataList)
27  , myDeadReckoningThresholds(orig.myDeadReckoningThresholds)
28  , myDeadReckoningDensityThreshold(orig.myDeadReckoningDensityThreshold)
29  , myDeadReckoningSigmaThreshold(orig.myDeadReckoningSigmaThreshold)
30  {
31  }
32 
34  {
35  myPuffDataList = rhs.myPuffDataList;
36  myDeadReckoningThresholds = rhs.myDeadReckoningThresholds;
37  myDeadReckoningDensityThreshold = rhs.myDeadReckoningDensityThreshold;
38  myDeadReckoningSigmaThreshold = rhs.myDeadReckoningSigmaThreshold;
39 
40  return *this;
41  }
42 
44  {
45  myPuffDataList.removeAndDeleteAll();
46  }
47 
48  DEFINE_REF_ACCESSORS(DtGaussianPuffDataList, puffDataList, PuffDataList)
49  DEFINE_REF_ACCESSORS(DtRwDeadReckonThresholds, deadReckoningThresholds, DeadReckoningThresholds)
50  DEFINE_ACCESSOR_MUTATOR(double, deadReckoningDensityThreshold, DeadReckoningDensityThreshold)
51  DEFINE_ACCESSOR_MUTATOR(double, deadReckoningSigmaThreshold, DeadReckoningSigmaThreshold)
52 
53  protected:
54  DtGaussianPuffDataList myPuffDataList;
55  DtRwDeadReckonThresholds myDeadReckoningThresholds;
56  double myDeadReckoningDensityThreshold;
57  double myDeadReckoningSigmaThreshold;
58  };
59 
63  {
64  public:
66 
68  : DtFrameStateInterface(storage)
69  {
70  }
71 
74  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(double, deadReckoningDensityThreshold, DeadReckoningDensityThreshold)
75  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(double, deadReckoningSigmaThreshold, DeadReckoningSigmaThreshold)
76  };
77 
80  {
81  public:
83 
85  const DtTacticalSmokeStateComponentData& frameState() const { return myData; };
87 
88  const DtGaussianPuffDataList& puffDataList() const;
89  DtGaussianPuffDataList& puffDataList();
90 
91  const DtRwDeadReckonThresholds& deadReckoningThresholds() const;
92  DtRwDeadReckonThresholds& deadReckoningThresholds();
93 
94  const double& deadReckoningDensityThreshold() const;
95  void setDeadReckoningDensityThreshold(const double&);
96 
97  const double& deadReckoningSigmaThreshold() const;
98  void setDeadReckoningSigmaThreshold(const double&);
99 
101  virtual void makeWritable() {};
102 
104  virtual void makeReadOnly() {};
105 
106  protected:
108  };
109 
112  {
113  public:
115 
117  const DtTacticalSmokeStateComponentData& frameState() const { return myData; };
118 
119  const DtGaussianPuffDataList& puffDataList() const;
120  const DtRwDeadReckonThresholds& deadReckoningThresholds() const;
121  const double& deadReckoningDensityThreshold() const;
122  const double& deadReckoningSigmaThreshold() const;
123 
124  protected:
127  {
128  myData = data;
129  }
130 
131  protected:
133  };
134 
138  {
139  public:
141 
142  bool isDoubleBuffered() { return true; };
143  const DtFrameStateInterface* currentFrameState() const { return &myCurrentFrameState; }
144  virtual DtFrameStateInterface* nextFrameState() { return &myNextFrameState; };
145  virtual const DtFrameStateInterface* nextFrameState() const { return &myNextFrameState; };
146 
148  {
149  if (myNextFrameState.isWritable())
150  {
151  myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
152  }
153 
154  myCurrentFrameState.emitComponentUpdated();
155  }
156 
158  {
159  myNextFrameState.updateStateData(sd);
160  myCurrentFrameState.updateStateData(sd);
161  }
162 
163  virtual void initializeFromParameters(const DtVrfObjectParameters*);
164 
165  virtual void aboutToBeDeleted() override
166  {
168  myCurrentFrameState.aboutToBeDeleted();
169  myNextFrameState.aboutToBeDeleted();
170  }
171 
172  protected:
175  };
176 
180 }
Instances of DtVrfObjectParameters are the readable/writeable objects that contain the information ne...
Definition: vrfObjectParameters.h:63
double myDeadReckoningSigmaThreshold
Definition: tacticalSmokeStateComponent.h:57
bool isDoubleBuffered()
Definition: tacticalSmokeStateComponent.h:142
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:85
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: tacticalSmokeStateComponent.h:137
DtGaussianPuffDataList myPuffDataList
Definition: tacticalSmokeStateComponent.h:54
Definition: stateComponent.h:266
const DtFrameStateInterface * currentFrameState() const
Definition: tacticalSmokeStateComponent.h:143
DtTacticalSmokeStateComponentData myData
Definition: tacticalSmokeStateComponent.h:132
DtTacticalSmokeStateComponentData(const DtTacticalSmokeStateComponentData &orig)
Definition: tacticalSmokeStateComponent.h:25
#define UNDEFINED_RETURNREF_ACCESSORS(ReturnType, Member)
Definition: doubleBufferedDataStorage.h:40
3) Define the current frame class. This will be used for read access.
Definition: tacticalSmokeStateComponent.h:111
const DtTacticalSmokeStateComponentData & frameState() const
Current frame state only can access current frame buffers. This ensures thread safety.
Definition: tacticalSmokeStateComponent.h:117
void updateStateData(DtStateData *sd)
Implement to update data storage to the new state data.
Definition: tacticalSmokeStateComponent.h:157
void advanceFrame(const DtTacticalSmokeStateComponentData &data)
Definition: tacticalSmokeStateComponent.h:126
2) Define the next frame class. This will be used for write access.
Definition: tacticalSmokeStateComponent.h:79
Definition: rwDeadReckonThresholds.h:23
virtual const DtFrameStateInterface * nextFrameState() const
Definition: tacticalSmokeStateComponent.h:145
DtTacticalSmokeStateComponentCurrentFrame myCurrentFrameState
Definition: tacticalSmokeStateComponent.h:173
Definition: tacticalSmokeStateComponent.h:15
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:339
#define DEFINE_STATE_COMPONENT_TYPE(CreatedComponent)
Definition: stateComponent.h:228
virtual ~DtTacticalSmokeStateComponentData()
Definition: tacticalSmokeStateComponent.h:43
DtStateComponentCreator< DtTacticalSmokeStateComponentImplementation > DtTacticalSmokeStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: tacticalSmokeStateComponent.h:179
DtRwDeadReckonThresholds myDeadReckoningThresholds
Definition: tacticalSmokeStateComponent.h:55
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:379
DtTacticalSmokeStateComponentData()
Definition: tacticalSmokeStateComponent.h:17
virtual DtFrameStateInterface * nextFrameState()
Definition: tacticalSmokeStateComponent.h:144
virtual void aboutToBeDeleted()
DtTacticalSmokeStateComponentData & operator=(const DtTacticalSmokeStateComponentData &rhs)
Definition: tacticalSmokeStateComponent.h:33
virtual void aboutToBeDeleted() override
Definition: tacticalSmokeStateComponent.h:165
#define UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(Type, Member, Set)
Definition: doubleBufferedDataStorage.h:57
#define DEFINE_REF_ACCESSORS(ReturnType, Method, Member)
Definition: doubleBufferedDataStorage.h:13
#define DEFINE_ACCESSOR_MUTATOR(ReturnType, Accessor, Mutator)
Definition: doubleBufferedDataStorage.h:23
#define DT_DLL_vrfStateData
This file is used to determine how to build Disable inconsistent dll linkage warning Visual Studio 6...
Definition: vrfStateDataDefines.h:26
DtTacticalSmokeStateComponentData & frameState()
Definition: tacticalSmokeStateComponent.h:86
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:62
virtual void makeWritable()
Override to make component writable.
Definition: tacticalSmokeStateComponent.h:101
Contains the DtStateComponent class declaration.
void updateDataStorage()
Implement to update data storage. Called from advanceFrame.
Definition: tacticalSmokeStateComponent.h:147
double myDeadReckoningDensityThreshold
Definition: tacticalSmokeStateComponent.h:56
This is a simple base class that will be used to return a pointer to current or next frame state...
Definition: stateComponent.h:291
DtTacticalSmokeStateComponentNextFrame myNextFrameState
Definition: tacticalSmokeStateComponent.h:174

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)