11 #include <legionStandardOM/sets/readPropulsionNoiseRepository.hpp>
12 #include <legionStandardOM/sets/writePropulsionNoiseRepository.hpp>
15 #include <vlutil/vlString.h>
16 #include <matrix/vlVector.h>
27 : myCurrentShaftRPM(0.)
28 , myOrderedShaftRPM(0.)
29 , myShaftRPM_RateOfChange(0.)
34 : myCurrentShaftRPM(orig.myCurrentShaftRPM)
35 , myOrderedShaftRPM(orig.myOrderedShaftRPM)
36 , myShaftRPM_RateOfChange(orig.myShaftRPM_RateOfChange)
58 return !(*
this == rhs);
67 unsigned short myCurrentShaftRPM;
69 unsigned short myOrderedShaftRPM;
71 unsigned short myShaftRPM_RateOfChange;
76 , myPassiveParameterIndex(1)
81 : myPublish(orig.myPublish)
82 , myShaftData(orig.myShaftData)
83 , myPassiveParameterIndex(orig.myPassiveParameterIndex)
96 typedef std::vector<UnderwaterAcousticShaftSpeed>
ShaftData;
101 ShaftData& shaftData() {
return myShaftData; };
147 virtual const DtUUID hostId()
const override;
151 virtual const bool& publish()
const override;
154 virtual void setPublish(
const bool&)
override;
158 virtual const bool hullMaskerOn()
const override;
161 virtual void setHullMaskerOn(
const bool&)
override;
165 virtual const int& passiveParameterIndex()
const override;
168 virtual void setPassiveParameterIndex(
const int&)
override;
172 virtual const unsigned int propulsionPlantConfiguration()
const override;
175 virtual void setPropulsionPlantConfiguration(
const unsigned int&)
override;
185 virtual void makeWritable()
override;
188 virtual void makeReadOnly()
override;
211 virtual const DtUUID hostId()
const override;
214 virtual const bool& publish()
const override;
217 virtual const bool hullMaskerOn()
const override;
223 virtual const int& passiveParameterIndex()
const override;
226 virtual const unsigned int propulsionPlantConfiguration()
const override;
229 bool readComponentValid()
const;
233 bool findReadComponent();
237 void handleDataUpdated();
280 if (myNextFrameState.isWritable())
282 myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
285 myCurrentFrameState.emitComponentUpdated();
292 myCurrentFrameState.updateStateData(sd);
293 myNextFrameState.updateStateData(sd);
300 myCurrentFrameState.aboutToBeDeleted();
301 myNextFrameState.aboutToBeDeleted();
305 virtual bool forceAdvance()
override;
308 virtual void firstFrameAdvance()
override;
Definition: stateComponent.h:88
UUID is a unique ID wrapper class.
Definition: uuid.h:59
bool myPublish
Whether this component's data should be published to the network.
Definition: underwaterAcousticsStateComponent.h:101
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: underwaterAcousticsStateComponent.h:258
std::vector< UnderwaterAcousticShaftSpeed > ShaftData
Definition: underwaterAcousticsStateComponent.h:96
DtUnderwaterAcousticsStateComponentData myData
Current frame data storage for this component.
Definition: underwaterAcousticsStateComponent.h:249
LOM::WritePropulsionNoiseRepository myWritePropulsionNoiseRepository
Legion write interface for propulsion noise data.
Definition: underwaterAcousticsStateComponent.h:194
virtual void updateDataStorage() override
Advances the current frame data from the next frame and emits an update notification.
Definition: underwaterAcousticsStateComponent.h:278
3) Define the current frame class. This will be used for read access.
Definition: underwaterAcousticsStateComponent.h:198
DtUnderwaterAcousticsStateComponentData myData
Next frame data storage for this component.
Definition: underwaterAcousticsStateComponent.h:192
LOM::ReadPropulsionNoiseRepository myReadPropulsionNoiseRepository
Legion read interface for propulsion noise data.
Definition: underwaterAcousticsStateComponent.h:251
Default creator implementation for a state component type. T_StateComponent is the concrete component...
Definition: stateComponent.h:326
UnderwaterAcousticShaftSpeed()
Definition: underwaterAcousticsStateComponent.h:26
DtUnderwaterAcousticsStateComponentData(const DtUnderwaterAcousticsStateComponentData &orig)
Definition: underwaterAcousticsStateComponent.h:80
DtUnderwaterAcousticsStateComponentNextFrame myNextFrameState
Next (writable) frame state for this component.
Definition: underwaterAcousticsStateComponent.h:314
DtUnderwaterAcousticsStateComponentCurrentFrame myCurrentFrameState
Current (read-only) frame state for this component.
Definition: underwaterAcousticsStateComponent.h:312
#define UNDEFINED_RETURNVALUE_ACCESSOR(ReturnType, Member)
Defines a virtual const accessor that throws DtUnimplementedMethod, marking the method as requiring a...
Definition: doubleBufferedDataStorage.h:53
Contains the DtUUID class declaration.
virtual void aboutToBeDeleted() override
Cleans up both frame states before this component is deleted.
Definition: underwaterAcousticsStateComponent.h:297
UnderwaterAcousticShaftSpeed(const UnderwaterAcousticShaftSpeed &orig)
Definition: underwaterAcousticsStateComponent.h:33
ShaftData myShaftData
Per-shaft speed data for all propeller shafts.
Definition: underwaterAcousticsStateComponent.h:107
const DtUnderwaterAcousticsStateComponentData & frameState() const
Next frame access write access. Ensure this is only used in a single thread (i.e.a controller thread)...
Definition: underwaterAcousticsStateComponent.h:142
bool operator==(const UnderwaterAcousticShaftSpeed &rhs) const
Definition: underwaterAcousticsStateComponent.h:49
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:513
unsigned short myShaftRPM_RateOfChange
Rate of change of shaft RPM.
Definition: underwaterAcousticsStateComponent.h:71
int myPassiveParameterIndex
Index into the passive acoustic parameter set.
Definition: underwaterAcousticsStateComponent.h:109
#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
void advanceFrame(const DtUnderwaterAcousticsStateComponentData &data)
Advances the current frame to the given data snapshot.
Definition: underwaterAcousticsStateComponent.h:242
virtual const DtFrameStateInterface * currentFrameState() const override
Returns the current (read) frame state interface.
Definition: underwaterAcousticsStateComponent.h:269
UnderwaterAcousticShaftSpeed & operator=(const UnderwaterAcousticShaftSpeed &rhs)
Definition: underwaterAcousticsStateComponent.h:40
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:489
bool isDoubleBuffered()
Returns true; this component uses double-buffered data storage.
Definition: underwaterAcousticsStateComponent.h:266
#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
DtUnderwaterAcousticsStateComponentData & operator=(const DtUnderwaterAcousticsStateComponentData &rhs)
Definition: underwaterAcousticsStateComponent.h:87
virtual void aboutToBeDeleted()
Called when the component is about to be deleted; emits signal_stateComponentAboutToBeDeleted.
unsigned int myCallbackHandle
Handle for the legion instance-updated callback.
Definition: underwaterAcousticsStateComponent.h:253
bool myFoundComponent
Tracks whether the legion read component has been successfully found.
Definition: underwaterAcousticsStateComponent.h:316
#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 DtFrameStateInterface * nextFrameState() override
Returns the next (write) frame state interface.
Definition: underwaterAcousticsStateComponent.h:272
#define DEFINE_ACCESSOR_MUTATOR(ReturnType, Accessor, Mutator)
Defines a const reference accessor and an inline setter for a member variable.
Definition: doubleBufferedDataStorage.h:37
unsigned short myCurrentShaftRPM
Current measured shaft rotation rate in RPM.
Definition: underwaterAcousticsStateComponent.h:67
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: underwaterAcousticsStateComponent.h:114
virtual const DtFrameStateInterface * nextFrameState() const override
Returns the next (write) frame state interface (const overload).
Definition: underwaterAcousticsStateComponent.h:275
#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
Shaft speed record for a single propeller shaft.
Definition: underwaterAcousticsStateComponent.h:24
virtual void updateStateData(DtStateData *sd) override
Updates both frame states to reference the new state data storage.
Definition: underwaterAcousticsStateComponent.h:290
const DtUnderwaterAcousticsStateComponentData & frameState() const
Current frame state only can access current frame buffers. This ensures thread safety.
Definition: underwaterAcousticsStateComponent.h:207
2) Define the next frame class. This will be used for write access.
Definition: underwaterAcousticsStateComponent.h:133
DtStateComponentCreator< DtUnderwaterAcousticsStateComponentImplementation > DtUnderwaterAcousticsStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: underwaterAcousticsStateComponent.h:321
Data container for the underwater acoustics state component, holding shaft speed and acoustic paramet...
Definition: underwaterAcousticsStateComponent.h:21
Contains the DtStateComponent class declaration.
Base interface for accessing current or next frame state in a double-buffered state component...
Definition: stateComponent.h:354
bool operator!=(const UnderwaterAcousticShaftSpeed &rhs) const
Definition: underwaterAcousticsStateComponent.h:56
unsigned short myOrderedShaftRPM
Ordered (commanded) shaft rotation rate in RPM.
Definition: underwaterAcousticsStateComponent.h:69
DtUnderwaterAcousticsStateComponentData & frameState()
Definition: underwaterAcousticsStateComponent.h:143