VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
airTurbulenceStateComponent.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 {
16  {
18  : myAirTurbulence(0)
19  {};
20 
22  {
23  myAirTurbulence = orig.myAirTurbulence;
24  }
25 
27  {
28  myAirTurbulence = orig.myAirTurbulence;
29 
30  return *this;
31  }
32 
33  DEFINE_ACCESSOR_MUTATOR(int, airTurbulence, AirTurbulence)
34 
35  protected:
37  int myAirTurbulence;
38  };
39 
43  {
44  public:
46 
47 
49  : DtFrameStateInterface(storage)
50  {
51  }
52 
54  };
55 
58  {
59  public:
62 
64  const DtAirTurbulenceStateComponentData& frameState() const { return myData; };
66 
68  virtual const int& airTurbulence() const override;
71  virtual void setAirTurbulence(const int&) override;
72 
74  virtual void makeWritable() override {};
75 
77  virtual void makeReadOnly() override {};
78 
79  protected:
82  };
83 
86  {
87  public:
91 
93  const DtAirTurbulenceStateComponentData& frameState() const { return myData; };
94 
96  virtual const int& airTurbulence() const override;
97 
98  protected:
100  void completeSetup();
102  void updateVrfStateComponentParameters();
103 
105  void updateAirTurbulence();
106 
107  protected:
111  {
112  myData = data;
113  }
114 
115  protected:
117  boost::signals2::scoped_connection myVrfStateComponentChangedConnection;
119  boost::signals2::scoped_connection myCompleteSetupConnection;
120 
121  protected:
124  };
125 
129  {
130  public:
133 
135  bool isDoubleBuffered() { return true; };
137  virtual const DtFrameStateInterface* currentFrameState() const override { return &myCurrentFrameState; }
139  virtual DtFrameStateInterface* nextFrameState() override { return &myNextFrameState; };
141  virtual const DtFrameStateInterface* nextFrameState() const override { return &myNextFrameState; };
142 
145  virtual void updateDataStorage() override
146  {
147  if (myNextFrameState.isWritable())
148  {
149  myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
150  }
151 
152  myCurrentFrameState.emitComponentUpdated();
153  }
154 
157  virtual void updateStateData(DtStateData* sd) override
158  {
159  myCurrentFrameState.updateStateData(sd);
160  myNextFrameState.updateStateData(sd);
161  }
162 
164  virtual void aboutToBeDeleted() override
165  {
167  myCurrentFrameState.aboutToBeDeleted();
168  myNextFrameState.aboutToBeDeleted();
169  }
170 
171  protected:
176  };
177 
181 }
DtAirTurbulenceStateComponentData & frameState()
Definition: airTurbulenceStateComponent.h:65
boost::signals2::scoped_connection myVrfStateComponentChangedConnection
Signal connection for VRF state component change notifications.
Definition: airTurbulenceStateComponent.h:117
DtAirTurbulenceStateComponentData myData
Current-frame air turbulence data buffer.
Definition: airTurbulenceStateComponent.h:123
Default creator implementation for a state component type. T_StateComponent is the concrete component...
Definition: stateComponent.h:326
virtual void updateDataStorage() override
Copies next-frame data into the current frame buffer if the next frame is writable, then notifies listeners that the component has been updated.
Definition: airTurbulenceStateComponent.h:145
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: airTurbulenceStateComponent.h:42
DtAirTurbulenceStateComponentData & operator=(const DtAirTurbulenceStateComponentData &orig)
Definition: airTurbulenceStateComponent.h:26
2) Define the next frame class. This will be used for write access.
Definition: airTurbulenceStateComponent.h:57
virtual const DtFrameStateInterface * currentFrameState() const override
Definition: airTurbulenceStateComponent.h:137
virtual void updateStateData(DtStateData *sd) override
Updates the state data pointer for both current and next frame states.
Definition: airTurbulenceStateComponent.h:157
void advanceFrame(const DtAirTurbulenceStateComponentData &data)
Advances the current frame by copying data into the local buffer.
Definition: airTurbulenceStateComponent.h:110
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:513
DtStateComponentCreator< DtAirTurbulenceStateComponentImplementation > DtAirTurbulenceStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: airTurbulenceStateComponent.h:180
3) Define the current frame class. This will be used for read access.
Definition: airTurbulenceStateComponent.h:85
#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 void makeWritable() override
Override to make component writable.
Definition: airTurbulenceStateComponent.h:74
boost::signals2::scoped_connection myCompleteSetupConnection
Signal connection used to defer component setup until after the first frame advance.
Definition: airTurbulenceStateComponent.h:119
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:489
const DtAirTurbulenceStateComponentData & frameState() const
Current frame state only can access current frame buffers. This ensures thread safety.
Definition: airTurbulenceStateComponent.h:93
const DtAirTurbulenceStateComponentData & frameState() const
Next frame access write access. Ensure this is only used in a single thread (i.e.a controller thread)...
Definition: airTurbulenceStateComponent.h:64
virtual void aboutToBeDeleted()
Called when the component is about to be deleted; emits signal_stateComponentAboutToBeDeleted.
virtual DtFrameStateInterface * nextFrameState() override
Definition: airTurbulenceStateComponent.h:139
virtual const DtFrameStateInterface * nextFrameState() const override
Definition: airTurbulenceStateComponent.h:141
bool isDoubleBuffered()
Definition: airTurbulenceStateComponent.h:135
#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
virtual void aboutToBeDeleted() override
Performs cleanup on both current and next frame states before deletion.
Definition: airTurbulenceStateComponent.h:164
#define DEFINE_ACCESSOR_MUTATOR(ReturnType, Accessor, Mutator)
Defines a const reference accessor and an inline setter for a member variable.
Definition: doubleBufferedDataStorage.h:37
DtAirTurbulenceStateComponentData(const DtAirTurbulenceStateComponentData &orig)
Definition: airTurbulenceStateComponent.h:21
#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
Data container holding air turbulence parameters for a single simulation entity.
Definition: airTurbulenceStateComponent.h:15
int myAirTurbulence
Air turbulence intensity level.
Definition: airTurbulenceStateComponent.h:37
Contains the DtStateComponent class declaration.
DtAirTurbulenceStateComponentCurrentFrame myCurrentFrameState
Current-frame (read) state instance.
Definition: airTurbulenceStateComponent.h:173
Definition: vrfObjectManipulationHandlerBaseClass.h:68
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: airTurbulenceStateComponent.h:128
Base interface for accessing current or next frame state in a double-buffered state component...
Definition: stateComponent.h:354
DtAirTurbulenceStateComponentData()
Definition: airTurbulenceStateComponent.h:17
DtAirTurbulenceStateComponentNextFrame myNextFrameState
Next-frame (write) state instance.
Definition: airTurbulenceStateComponent.h:175

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)