VR-Forces 5.0.2 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
windCorridorStateComponent.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 <vlutil/vlString.h>
11 
12 namespace makVrf
13 {
15  {
17  : myWindSpeed(0.)
18  , myPriority(1)
19  {};
20 
22  {
23  myWindSpeed = orig.myWindSpeed;
24  myPriority = orig.myPriority;
25  }
26 
28  {
29  myWindSpeed = orig.myWindSpeed;
30  myPriority = orig.myPriority;
31 
32  return *this;
33  }
34 
35  DEFINE_ACCESSOR_MUTATOR(double, windSpeed, WindSpeed)
36  DEFINE_ACCESSOR_MUTATOR(int, priority, Priority)
37 
38  protected:
39  double myWindSpeed;
40  int myPriority;
41  };
42 
46  {
47  public:
49 
51  : DtFrameStateInterface(storage)
52  {
53  }
54 
55  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(double, windSpeed, WindSoeed)
56  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(int, priority, Priority)
57  };
58 
61  {
62  public:
64 
66  const DtWindCorridorStateComponentData& frameState() const { return myData; };
68 
69  const double& windSpeed() const;
70  void setWindSpeed(const double&);
71 
72  const int& priority() const;
73  void setPriority(const int&);
74 
76  virtual void makeWritable() {};
77 
79  virtual void makeReadOnly() {};
80 
81  protected:
82  DtStateData* myStateData;
84  };
85 
88  {
89  public:
92 
94  const DtWindCorridorStateComponentData& frameState() const { return myData; };
95 
96  const double& windSpeed() const;
97  const int& priority() const;
98 
99  protected:
101  void completeSetup();
102 
103  protected:
104  void updateVrfStateComponentParameters();
105 
106  void updateWindCorridorData();
107 
110  {
111  myData = data;
112  }
113 
114  protected:
115  boost::signals2::scoped_connection myVrfStateComponentChangedConnection;
118  };
119 
123  {
124  public:
126 
127  bool isDoubleBuffered() { return true; };
128  const DtFrameStateInterface* currentFrameState() const { return &myCurrentFrameState; }
129  virtual DtFrameStateInterface* nextFrameState() { return &myNextFrameState; };
130  virtual const DtFrameStateInterface* nextFrameState() const { return &myNextFrameState; };
131 
132  virtual void completeSetup() override;
133 
135  {
136  if (myNextFrameState.isWritable())
137  {
138  myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
139  }
140 
141  myCurrentFrameState.emitComponentUpdated();
142  }
143 
145  {
146  myCurrentFrameState.updateStateData(sd);
147  myNextFrameState.updateStateData(sd);
148  }
149 
150  virtual void aboutToBeDeleted() override
151  {
153  myCurrentFrameState.aboutToBeDeleted();
154  myNextFrameState.aboutToBeDeleted();
155  }
156 
157  protected:
160  };
161 
165 }
DtWindCorridorStateComponentData()
Definition: windCorridorStateComponent.h:16
void updateDataStorage()
Implement to update data storage. Called from advanceFrame.
Definition: windCorridorStateComponent.h:134
const DtWindCorridorStateComponentData & frameState() const
Current frame state only can access current frame buffers. This ensures thread safety.
Definition: windCorridorStateComponent.h:94
Definition: stateComponent.h:257
double myWindSpeed
Definition: windCorridorStateComponent.h:39
DtWindCorridorStateComponentNextFrame myNextFrameState
Definition: windCorridorStateComponent.h:159
void updateStateData(DtStateData *sd)
Implement to update data storage to the new state data.
Definition: windCorridorStateComponent.h:144
2) Define the next frame class. This will be used for write access.
Definition: windCorridorStateComponent.h:60
DtWindCorridorStateComponentData myData
Definition: windCorridorStateComponent.h:83
DtWindCorridorStateComponentCurrentFrame myCurrentFrameState
Definition: windCorridorStateComponent.h:158
DtWindCorridorStateComponentData & frameState()
Definition: windCorridorStateComponent.h:67
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:336
boost::signals2::scoped_connection myVrfStateComponentChangedConnection
Definition: windCorridorStateComponent.h:115
#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:370
virtual const DtFrameStateInterface * nextFrameState() const
Definition: windCorridorStateComponent.h:130
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: windCorridorStateComponent.h:45
virtual DtFrameStateInterface * nextFrameState()
Definition: windCorridorStateComponent.h:129
virtual void aboutToBeDeleted()
bool isDoubleBuffered()
Definition: windCorridorStateComponent.h:127
Definition: windCorridorStateComponent.h:14
DtWindCorridorStateComponentData(const DtWindCorridorStateComponentData &orig)
Definition: windCorridorStateComponent.h:21
const DtWindCorridorStateComponentData & frameState() const
Next frame access write access. Ensure this is only used in a single thread (i.e.a controller thread)...
Definition: windCorridorStateComponent.h:66
DtStateComponentCreator< DtWindCorridorStateComponentImplementation > DtWindCorridorStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: windCorridorStateComponent.h:164
#define UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(Type, Member, Set)
Definition: doubleBufferedDataStorage.h:57
#define DEFINE_ACCESSOR_MUTATOR(ReturnType, Accessor, Mutator)
Definition: doubleBufferedDataStorage.h:23
DtWindCorridorStateComponentData myData
Definition: windCorridorStateComponent.h:117
DtStateData * myStateData
Definition: windCorridorStateComponent.h:116
const DtFrameStateInterface * currentFrameState() const
Definition: windCorridorStateComponent.h:128
void advanceFrame(const DtWindCorridorStateComponentData &data)
Definition: windCorridorStateComponent.h:109
#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
3) Define the current frame class. This will be used for read access.
Definition: windCorridorStateComponent.h:87
int myPriority
Definition: windCorridorStateComponent.h:40
virtual void aboutToBeDeleted() override
Definition: windCorridorStateComponent.h:150
virtual void makeWritable()
Override to make component writable.
Definition: windCorridorStateComponent.h:76
DtWindCorridorStateComponentData & operator=(const DtWindCorridorStateComponentData &orig)
Definition: windCorridorStateComponent.h:27
Contains the DtStateComponent class declaration.
This is a simple base class that will be used to return a pointer to current or next frame state...
Definition: stateComponent.h:282
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: windCorridorStateComponent.h:122

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)