VR-Forces 5.0.1 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
laserDesignatorStateComponent.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 
10 #include <legionStandardOM/sets/readDesignatorRepository.hpp>
11 #include <legionStandardOM/sets/writeDesignatorRepository.hpp>
12 #include <vrfutil/rwUUID.h>
13 #include <matrix/vlVector.h>
14 
15 namespace makVrf
16 {
21  {
23  : myDesignatedObject(DtUUID::nullUUID())
24  , myDesignatorId(DtUUID::nullUUID())
25  {
26  }
27 
29  : myDesignatedObject(orig.myDesignatedObject)
30  , myDesignatorId(orig.myDesignatorId)
31  , myGlobalId(orig.myGlobalId)
32  {
33  }
34 
36  {
37  myDesignatedObject = rhs.myDesignatedObject;
38  myDesignatorId = rhs.myDesignatorId;
39  myGlobalId = rhs.myGlobalId;
40 
41  return *this;
42  }
43 
44  DEFINE_ACCESSOR_MUTATOR(DtUUID, designatedObject, DesignatedObject)
45  DEFINE_ACCESSOR_MUTATOR(DtUUID, designatorId, DesignatorId)
46  DEFINE_ACCESSOR_MUTATOR(DtString, globalId, GlobalId)
47 
48  protected:
49  DtUUID myDesignatedObject;
50  DtUUID myDesignatorId;
51  DtString myGlobalId;
52  };
53 
57  {
58  public:
60 
62  : DtFrameStateInterface(storage)
63  {
64  }
65 
66  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(DtUUID, designatedObject, DesignatedObject)
67  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(DtUUID, designatorId, DesignatorId)
68  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(unsigned int, designatorCode, DesignatorCode)
69  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(unsigned int, drAlgorithm, DrAlgorithm)
70  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(double, designatorPower, DesignatorPower)
71  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(double, designatorWavelength, DesignatorWavelength)
72  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(DtVector, designatorSpotLocation, DesignatorSpotLocation)
73  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(unsigned int, codeName, CodeName)
74  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(DtVector, spotLinearAcceleration, SpotLinearAcceleration)
76  };
77 
80  {
81  public:
84 
86  const DtLaserDesignatorStateComponentData& frameState() const { return myData; };
88 
89  const DtUUID& designatedObject() const;
90  void setDesignatedObject(const DtUUID&);
91 
92  const DtUUID& designatorId() const;
93  void setDesignatorId(const DtUUID&);
94 
95  const unsigned int designatorCode() const;
96  void setDesignatorCode(const unsigned int&);
97 
98  const unsigned int drAlgorithm() const;
99  void setDrAlgorithm(const unsigned int&);
100 
101  const unsigned int codeName() const;
102  void setCodeName(const unsigned int&);
103 
104  const DtVector spotLinearAcceleration() const;
105  void setSpotLinearAcceleration(const DtVector&);
106 
107  const double designatorPower() const;
108  void setDesignatorPower(const double&);
109 
110  const double designatorWavelength() const;
111  void setDesignatorWavelength(const double&);
112 
113  const DtVector designatorSpotLocation() const;
114  void setDesignatorSpotLocation(const DtVector&);
115 
116  const DtString& globalId() const;
117  void setGlobalId(const DtString&);
118 
120  virtual void makeWritable();
121 
123  virtual void makeReadOnly();
124  void cleanupWriteState();
125 
126  protected:
128  LOM::WriteDesignatorRepository myWriteDesignatorRepository;
130  };
131 
134  {
135  public:
138 
140  const DtLaserDesignatorStateComponentData& frameState() const { return myData; };
141 
142  const DtUUID& designatedObject() const;
143  const DtUUID& designatorId() const;
144  const unsigned int designatorCode() const;
145  const double designatorPower() const;
146  const double designatorWavelength() const;
147  const DtVector designatorSpotLocation() const;
148  const unsigned int codeName() const;
149  const DtVector spotLinearAcceleration() const;
150  const unsigned int drAlgorithm() const;
151  const DtString& globalId() const;
152 
153  bool readComponentValid() const;
154  bool findReadComponent();
155 
156  protected:
157  void handleDataUpdated();
158 
161  {
162  myData = data;
163  }
164 
165  protected:
167  LOM::ReadDesignatorRepository myReadDesignatorRepository;
170  };
171 
175  {
176  public:
178 
179  bool isDoubleBuffered() { return true; };
180  const DtFrameStateInterface* currentFrameState() const { return &myCurrentFrameState; }
181  virtual DtFrameStateInterface* nextFrameState() { return &myNextFrameState; };
182  virtual const DtFrameStateInterface* nextFrameState() const { return &myNextFrameState; };
183 
184  virtual bool forceAdvance() override;
185 
187  {
188  if (myNextFrameState.isWritable())
189  {
190  myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
191  }
192 
193  myCurrentFrameState.emitComponentUpdated();
194  }
195 
197  {
198  myCurrentFrameState.updateStateData(sd);
199  myNextFrameState.updateStateData(sd);
200  }
201 
202  virtual void aboutToBeDeleted() override
203  {
205  myCurrentFrameState.aboutToBeDeleted();
206  myNextFrameState.aboutToBeDeleted();
207  }
208 
209  virtual void firstFrameAdvance() override;
210  virtual void removeAdditionalStateComponents() override;
211 
212  protected:
216  };
217 
221 }
UUID is a unique ID wrapper class.
Definition: rwUUID.h:226
const DtLaserDesignatorStateComponentData & frameState() const
Current frame state only can access current frame buffers. This ensures thread safety.
Definition: laserDesignatorStateComponent.h:140
void updateStateData(DtStateData *sd)
Implement to update data storage to the new state data.
Definition: laserDesignatorStateComponent.h:196
DtLaserDesignatorStateComponentData myData
Definition: laserDesignatorStateComponent.h:166
DtUUID myDesignatedObject
Definition: laserDesignatorStateComponent.h:49
DtStateData * myStateData
Definition: laserDesignatorStateComponent.h:169
LOM::ReadDesignatorRepository myReadDesignatorRepository
Definition: laserDesignatorStateComponent.h:167
Definition: stateComponent.h:257
DtStateComponentCreator< DtLaserDesignatorStateComponentImplementation > DtLaserDesignatorStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: laserDesignatorStateComponent.h:220
DtLaserDesignatorStateComponentData & operator=(const DtLaserDesignatorStateComponentData &rhs)
Definition: laserDesignatorStateComponent.h:35
DtLaserDesignatorStateComponentNextFrame myNextFrameState
Definition: laserDesignatorStateComponent.h:214
Contains the DtUUID class declaration.
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: laserDesignatorStateComponent.h:174
void updateDataStorage()
Implement to update data storage. Called from advanceFrame.
Definition: laserDesignatorStateComponent.h:186
DtStateData * myStateData
Definition: laserDesignatorStateComponent.h:129
virtual DtFrameStateInterface * nextFrameState()
Definition: laserDesignatorStateComponent.h:181
The DtLaserDesignatorStateComponentList is a collection of laser designators. Each laser designator m...
Definition: laserDesignatorStateComponent.h:20
DtLaserDesignatorStateComponentData()
Definition: laserDesignatorStateComponent.h:22
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:336
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: laserDesignatorStateComponent.h:56
#define DEFINE_STATE_COMPONENT_TYPE(CreatedComponent)
Definition: stateComponent.h:219
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:365
#define UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(Type, Member, Set)
Definition: doubleBufferedDataStorage.h:53
LOM::WriteDesignatorRepository myWriteDesignatorRepository
Definition: laserDesignatorStateComponent.h:128
DtUUID myDesignatorId
Definition: laserDesignatorStateComponent.h:50
DtLaserDesignatorStateComponentData & frameState()
Definition: laserDesignatorStateComponent.h:87
2) Define the next frame class. This will be used for write access.
Definition: laserDesignatorStateComponent.h:79
virtual void aboutToBeDeleted()
bool isDoubleBuffered()
Definition: laserDesignatorStateComponent.h:179
3) Define the current frame class. This will be used for read access.
Definition: laserDesignatorStateComponent.h:133
#define UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(Type, Member, Set)
Definition: doubleBufferedDataStorage.h:57
#define DEFINE_ACCESSOR_MUTATOR(ReturnType, Accessor, Mutator)
Definition: doubleBufferedDataStorage.h:23
DtLaserDesignatorStateComponentData myData
Definition: laserDesignatorStateComponent.h:127
virtual void aboutToBeDeleted() override
Definition: laserDesignatorStateComponent.h:202
int myCallbackHandle
Definition: laserDesignatorStateComponent.h:168
#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
const DtLaserDesignatorStateComponentData & frameState() const
Next frame access write access. Ensure this is only used in a single thread (i.e.a controller thread)...
Definition: laserDesignatorStateComponent.h:86
const DtFrameStateInterface * currentFrameState() const
Definition: laserDesignatorStateComponent.h:180
DtLaserDesignatorStateComponentCurrentFrame myCurrentFrameState
Definition: laserDesignatorStateComponent.h:213
Contains the DtStateComponent class declaration.
bool myFoundComponent
Definition: laserDesignatorStateComponent.h:215
DtString myGlobalId
Definition: laserDesignatorStateComponent.h:51
DtLaserDesignatorStateComponentData(const DtLaserDesignatorStateComponentData &orig)
Definition: laserDesignatorStateComponent.h:28
This is a simple base class that will be used to return a pointer to current or next frame state...
Definition: stateComponent.h:282
void advanceFrame(const DtLaserDesignatorStateComponentData &data)
Definition: laserDesignatorStateComponent.h:160
virtual const DtFrameStateInterface * nextFrameState() const
Definition: laserDesignatorStateComponent.h:182

Document ID: Generated on Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)