VR-Forces 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 #include <matrix/vlVector.h>
12 
13 namespace makVrf
14 {
17  {
20  : myWindSpeed(0.)
21  , myPriority(1)
22  , myWidth(0.)
23  , myHeight(0.)
24  {};
25 
29  {
30  myWindSpeed = orig.myWindSpeed;
31  myPriority = orig.myPriority;
32  myWidth = orig.myWidth;
33  myHeight = orig.myHeight;
34  myWorldPositions = orig.myWorldPositions;
35  }
36 
41  {
42  myWindSpeed = orig.myWindSpeed;
43  myPriority = orig.myPriority;
44  myWidth = orig.myWidth;
45  myHeight = orig.myHeight;
46  myWorldPositions = orig.myWorldPositions;
47 
48  return *this;
49  }
50 
51  DEFINE_ACCESSOR_MUTATOR(double, width, Width)
52  DEFINE_ACCESSOR_MUTATOR(double, height, Height)
53  DEFINE_ACCESSOR_MUTATOR(double, windSpeed, WindSpeed)
54  DEFINE_ACCESSOR_MUTATOR(std::vector<DtVector>, worldPositions, WorldPositions)
55  DEFINE_ACCESSOR_MUTATOR(int, priority, Priority)
56 
57  protected:
59  double myWindSpeed;
61  double myWidth;
63  double myHeight;
65  std::vector<DtVector> myWorldPositions{};
68  };
69 
73  {
74  public:
76 
77 
80  : DtFrameStateInterface(storage)
81  {
82  }
83 
84  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(double, width, Width)
85  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(double, height, Height)
86  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(double, windSpeed, WindSpeed)
87  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(int, priority, Priority)
88  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(std::vector<DtVector>, worldPositions, WorldPositions)
89  };
90 
93  {
94  public:
98 
100  const DtWindCorridorStateComponentData& frameState() const { return myData; };
103 
105  virtual const double& width() const override;
108  virtual void setWidth(const double&) override;
109 
111  virtual const double& height() const override;
114  virtual void setHeight(const double&) override;
115 
117  virtual const std::vector<DtVector> worldPositions() const override;
120  virtual void setWorldPositions(const std::vector<DtVector>&) override;
121 
123  virtual const double& windSpeed() const override;
126  virtual void setWindSpeed(const double&) override;
127 
129  virtual const int& priority() const override;
132  virtual void setPriority(const int&) override;
133 
135  virtual void updateWindCorridorData();
136 
138  virtual void makeWritable() override {};
139 
141  virtual void makeReadOnly() override {};
142 
144  virtual void completeSetup();
145 
146  protected:
148  boost::signals2::scoped_connection myVrfStateComponentChangedConnection;
151  };
152 
155  {
156  public:
161  virtual ~DtWindCorridorStateComponentCurrentFrame() override;
162 
164  const DtWindCorridorStateComponentData& frameState() const { return myData; };
165 
167  virtual const double& width() const override;
169  virtual const double& height() const override;
171  virtual const std::vector<DtVector> worldPositions() const override;
173  virtual const double& windSpeed() const override;
175  virtual const int& priority() const override;
176 
177  protected:
180  void completeSetup();
181 
182  protected:
184  void updateVrfStateComponentParameters();
185 
187  void updateWindCorridorData();
188 
193  {
194  myData = data;
195  }
196 
197  protected:
199  boost::signals2::scoped_connection myVrfStateComponentChangedConnection;
202  };
203 
207  {
208  public:
212 
214  bool isDoubleBuffered() { return true; };
216  virtual const DtFrameStateInterface* currentFrameState() const override { return &myCurrentFrameState; }
218  virtual DtFrameStateInterface* nextFrameState() override { return &myNextFrameState; };
220  virtual const DtFrameStateInterface* nextFrameState() const override { return &myNextFrameState; };
221 
223  virtual void completeSetup() override;
224 
226  virtual void updateDataStorage() override
227  {
228  if (myNextFrameState.isWritable())
229  {
230  myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
231  }
232 
233  myCurrentFrameState.emitComponentUpdated();
234  }
235 
238  virtual void updateStateData(DtStateData* sd) override
239  {
240  myCurrentFrameState.updateStateData(sd);
241  myNextFrameState.updateStateData(sd);
242  }
243 
245  virtual void aboutToBeDeleted() override
246  {
248  myCurrentFrameState.aboutToBeDeleted();
249  myNextFrameState.aboutToBeDeleted();
250  }
251 
252  protected:
257  };
258 
262 }
DtWindCorridorStateComponentData()
Default constructor. Initializes wind speed and dimensions to zero with default priority.
Definition: windCorridorStateComponent.h:19
virtual const DtFrameStateInterface * nextFrameState() const override
Returns the next (write) frame state interface (const overload).
Definition: windCorridorStateComponent.h:220
std::vector< DtVector > myWorldPositions
World-space positions defining the corridor path vertices.
Definition: windCorridorStateComponent.h:65
virtual void makeWritable() override
Override to make component writable.
Definition: windCorridorStateComponent.h:138
const DtWindCorridorStateComponentData & frameState() const
Current frame state only can access current frame buffers. This ensures thread safety.
Definition: windCorridorStateComponent.h:164
Default creator implementation for a state component type. T_StateComponent is the concrete component...
Definition: stateComponent.h:326
double myWindSpeed
Wind speed of the corridor in meters per second.
Definition: windCorridorStateComponent.h:59
DtWindCorridorStateComponentNextFrame myNextFrameState
Next frame state instance providing write access to wind corridor data.
Definition: windCorridorStateComponent.h:256
virtual const DtFrameStateInterface * currentFrameState() const override
Returns the current (read) frame state interface.
Definition: windCorridorStateComponent.h:216
double myHeight
Height of the wind corridor in meters.
Definition: windCorridorStateComponent.h:63
2) Define the next frame class. This will be used for write access.
Definition: windCorridorStateComponent.h:92
DtWindCorridorStateComponentData myData
Local copy of the wind corridor data for the next frame.
Definition: windCorridorStateComponent.h:150
DtWindCorridorStateComponentCurrentFrame myCurrentFrameState
Current frame state instance providing read access to wind corridor data.
Definition: windCorridorStateComponent.h:254
DtWindCorridorStateComponentData & frameState()
Returns a mutable reference to the next frame state data for write access.
Definition: windCorridorStateComponent.h:102
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:513
boost::signals2::scoped_connection myVrfStateComponentChangedConnection
Connection to the VRF state component&#39;s extended data modification signal.
Definition: windCorridorStateComponent.h:199
#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
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:489
virtual DtFrameStateInterface * nextFrameState() override
Returns the next (write) frame state interface.
Definition: windCorridorStateComponent.h:218
virtual void makeReadOnly() override
Override to make component read-only.
Definition: windCorridorStateComponent.h:141
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:72
#define UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(Type, Member, Set)
Defines an undefined virtual by-value accessor and an undefined virtual setter, both throwing DtUnimp...
Definition: doubleBufferedDataStorage.h:103
virtual void updateStateData(DtStateData *sd) override
Updates the state data pointer for both current and next frame state components.
Definition: windCorridorStateComponent.h:238
virtual void aboutToBeDeleted()
Called when the component is about to be deleted; emits signal_stateComponentAboutToBeDeleted.
bool isDoubleBuffered()
Returns true since this component uses double-buffered data storage.
Definition: windCorridorStateComponent.h:214
Data container holding all state properties for a wind corridor entity.
Definition: windCorridorStateComponent.h:16
DtWindCorridorStateComponentData(const DtWindCorridorStateComponentData &orig)
Copy constructor.
Definition: windCorridorStateComponent.h:28
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:100
DtStateComponentCreator< DtWindCorridorStateComponentImplementation > DtWindCorridorStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: windCorridorStateComponent.h:261
#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_ACCESSOR_MUTATOR(ReturnType, Accessor, Mutator)
Defines a const reference accessor and an inline setter for a member variable.
Definition: doubleBufferedDataStorage.h:37
DtWindCorridorStateComponentData myData
Local copy of the wind corridor data for the current frame.
Definition: windCorridorStateComponent.h:201
virtual void updateDataStorage() override
Advances the current frame state from the next frame state if the next frame is writable.
Definition: windCorridorStateComponent.h:226
void advanceFrame(const DtWindCorridorStateComponentData &data)
Advances to the next frame by replacing the current frame state with the provided data...
Definition: windCorridorStateComponent.h:192
#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
3) Define the current frame class. This will be used for read access.
Definition: windCorridorStateComponent.h:154
int myPriority
Priority of this wind corridor relative to other wind corridors.
Definition: windCorridorStateComponent.h:67
virtual void aboutToBeDeleted() override
Notifies both frame state components that this component is about to be deleted.
Definition: windCorridorStateComponent.h:245
DtWindCorridorStateComponentData & operator=(const DtWindCorridorStateComponentData &orig)
Assignment operator.
Definition: windCorridorStateComponent.h:40
Contains the DtStateComponent class declaration.
double myWidth
Width of the wind corridor in meters.
Definition: windCorridorStateComponent.h:61
Base interface for accessing current or next frame state in a double-buffered state component...
Definition: stateComponent.h:354
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: windCorridorStateComponent.h:206
boost::signals2::scoped_connection myVrfStateComponentChangedConnection
Connection to the VRF state component&#39;s extended data modification signal.
Definition: windCorridorStateComponent.h:148

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)