12 #include <matrix/vlVector.h>
26 , myAzimuthBeamWidth(0.)
27 , myElevationCenter(0.)
28 , myElevationBeamWidth(0.)
29 , myActiveEmissionParameterIndex(0)
37 : mySystemId(orig.mySystemId)
38 , myBeamId(orig.myBeamId)
39 , myAzimuthCenter(orig.myAzimuthCenter)
40 , myAzimuthBeamWidth(orig.myAzimuthBeamWidth)
41 , myElevationCenter(orig.myElevationCenter)
42 , myElevationBeamWidth(orig.myElevationBeamWidth)
43 , myActiveEmissionParameterIndex(orig.myActiveEmissionParameterIndex)
44 , myScanPattern(orig.myScanPattern)
87 unsigned int myBeamId;
89 unsigned int mySystemId;
91 double myAzimuthCenter;
93 double myAzimuthBeamWidth;
95 double myElevationCenter;
97 double myElevationBeamWidth;
99 unsigned int myActiveEmissionParameterIndex;
101 unsigned int myScanPattern;
145 std::vector<DtActiveSonarBeamStateData>::iterator iter = beams.begin();
146 std::vector<DtActiveSonarBeamStateData>::iterator end = beams.end();
149 if (iter->beamId() == beamId)
165 std::vector<DtActiveSonarBeamStateData>::const_iterator iter = beams.begin();
166 std::vector<DtActiveSonarBeamStateData>::const_iterator end = beams.end();
169 if (iter->beamId() == beamId)
184 std::vector<DtActiveSonarBeamStateData>::iterator iter = beams.begin();
185 std::vector<DtActiveSonarBeamStateData>::iterator end = beams.end();
188 if (iter->beamId() == beamId)
203 return (*
this)[beamId];
211 return (*
this)[beamId];
219 if (index < beams.size())
221 return &beams[index];
232 if (index < beams.size())
234 return &beams[index];
244 unsigned short id = nextBeamId();
249 beams.push_back(data);
251 return &beams[beams.size() - 1];
269 std::vector<DtActiveSonarBeamStateData> beams{};
271 unsigned short nextId{ 0 };
278 , mySystemFunction(0)
286 : myPublish(orig.myPublish)
287 , mySystemName(orig.mySystemName)
288 , mySystemFunction(orig.mySystemFunction)
289 , myMountLocation(orig.myMountLocation)
290 , myBeamsList(orig.myBeamsList)
291 , mySystemId(orig.mySystemId)
298 DtActiveSonarStateComponentData&
operator=(
const DtActiveSonarStateComponentData& rhs)
315 return myBeamsList.beamByBeamId(beamId);
323 return myBeamsList.beamByBeamId(beamId);
331 return myBeamsList.beamByBeamIndex(beamId);
339 return myBeamsList.beamByBeamIndex(beamId);
343 unsigned int numBeams()
const {
return myBeamsList.size(); };
352 const std::vector<DtActiveSonarBeamStateData>&
rawBeams()
const {
return myBeamsList.beams; };
354 std::vector<DtActiveSonarBeamStateData>&
rawBeams() {
return myBeamsList.beams; };
359 void removeBeam(
unsigned short beamId) { myBeamsList.removeBeam(beamId); };
379 unsigned int mySystemId;
381 unsigned int mySystemName;
383 unsigned int mySystemFunction;
385 DtVector myMountLocation;
405 : DtFrameStateInterface(storage)
446 virtual const DtActiveSonarStateComponentData&
frameState()
const {
throw DtUnimplementedMethod(
"The const DtActiveSonarStateComponentData& const frameState() method is unimplemented"); };
466 virtual const std::vector<DtActiveSonarBeamStateData>& beams()
const override;
468 virtual std::vector<DtActiveSonarBeamStateData>& beams()
override;
471 virtual const DtUUID hostId()
const override;
474 virtual const unsigned int& systemName()
const override;
477 virtual void setSystemName(
const unsigned int&)
override;
480 virtual const unsigned int& systemFunction()
const override;
483 virtual void setSystemFunction(
const unsigned int&)
override;
486 virtual const bool& publish()
const override;
489 virtual void setPublish(
const bool&)
override;
492 virtual const DtVector& mountLocation()
const override;
495 virtual void setMountLocation(
const DtVector&)
override;
498 virtual const unsigned int numBeams()
const override;
520 virtual void removeAllBeams()
override;
523 virtual void removeBeam(
unsigned short beamId)
override;
532 virtual void makeReadOnly()
override {};
536 unsigned short myNextBeamId;
553 virtual const std::vector<DtActiveSonarBeamStateData>& beams()
const override;
555 virtual const DtUUID hostId()
const override;
557 virtual const unsigned int& systemName()
const override;
559 virtual const unsigned int& systemFunction()
const override;
561 virtual const bool& publish()
const override;
563 virtual const DtVector& mountLocation()
const override;
565 virtual const unsigned int numBeams()
const override;
613 if (myNextFrameState.isWritable())
615 myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
618 myCurrentFrameState.emitComponentUpdated();
625 myCurrentFrameState.updateStateData(sd);
626 myNextFrameState.updateStateData(sd);
633 myCurrentFrameState.aboutToBeDeleted();
634 myNextFrameState.aboutToBeDeleted();
UUID is a unique ID wrapper class.
Definition: uuid.h:59
double myAzimuthBeamWidth
Azimuth beam width, in radians.
Definition: activeSonarStateComponent.h:93
Manages a list of DtActiveSonarBeamStateData objects with auto-incrementing beam IDs.
Definition: activeSonarStateComponent.h:109
void removeAllBeams()
Removes all beams from the system.
Definition: activeSonarStateComponent.h:356
unsigned int myActiveEmissionParameterIndex
Index into the active emission parameter table for this beam.
Definition: activeSonarStateComponent.h:99
Exception thrown when a required method has not been implemented.
Definition: stateDataTypes.h:30
unsigned int numBeams() const
Definition: activeSonarStateComponent.h:343
DtVector myMountLocation
The mount location of this sonar system relative to the entity origin.
Definition: activeSonarStateComponent.h:385
Holds the state data for a single active sonar beam, including the beam's geometry (azimuth and eleva...
Definition: activeSonarStateComponent.h:19
DtActiveSonarBeamStateData * operator[](unsigned short beamId)
Looks up a beam by its beam ID.
Definition: activeSonarStateComponent.h:143
virtual DtActiveSonarBeamStateData * beamByBeamId(unsigned short beamId)
Returns the beam with the given beam ID.
Definition: activeSonarStateComponent.h:444
#define UNDEFINED_METHOD(Type, Method,...)
Defines a virtual non-const method with variadic parameters that throws DtUnimplementedMethod, requiring an override in a derived class.
Definition: doubleBufferedDataStorage.h:138
unsigned int myScanPattern
Scan pattern type for this beam.
Definition: activeSonarStateComponent.h:101
unsigned int mySystemId
Identifier of the sonar system that produced this beam.
Definition: activeSonarStateComponent.h:89
DtActiveSonarBeamStateData * beamByBeamIndex(unsigned short beamId)
Returns a pointer to the beam at the given zero-based index.
Definition: activeSonarStateComponent.h:329
const DtActiveSonarBeamStateData * beamByBeamId(unsigned short beamId) const
Returns the beam with the given beam ID (const overload).
Definition: activeSonarStateComponent.h:209
const DtActiveSonarBeamStateData * operator[](unsigned short beamId) const
Looks up a beam by its beam ID (const overload).
Definition: activeSonarStateComponent.h:163
const DtActiveSonarBeamStateData * beamByBeamId(unsigned short beamId) const
Returns a const pointer to the beam with the given beam ID.
Definition: activeSonarStateComponent.h:321
virtual void aboutToBeDeleted() override
Notifies both frame buffers that this component is about to be deleted.
Definition: activeSonarStateComponent.h:630
Default creator implementation for a state component type. T_StateComponent is the concrete component...
Definition: stateComponent.h:326
DtActiveSonarStateComponentData & frameState()
Definition: activeSonarStateComponent.h:464
virtual DtFrameStateInterface * nextFrameState() override
Definition: activeSonarStateComponent.h:605
virtual DtActiveSonarBeamStateData * beamByBeamIndex(unsigned short beamIndex)
Returns the beam at the given zero-based index.
Definition: activeSonarStateComponent.h:440
unsigned int mySystemId
Unique identifier for this sonar system.
Definition: activeSonarStateComponent.h:379
#define UNDEFINED_RETURNREF_ACCESSORS(ReturnType, Member)
Defines both const and non-const virtual reference accessors that throw DtUnimplementedMethod, requiring overrides in a derived class.
Definition: doubleBufferedDataStorage.h:74
unsigned int mySystemFunction
The system function enumeration value for this sonar system.
Definition: activeSonarStateComponent.h:383
#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.
const std::vector< DtActiveSonarBeamStateData > & rawBeams() const
Definition: activeSonarStateComponent.h:352
void advanceFrame(const DtActiveSonarStateComponentData &data)
Advances the current frame by copying in the committed next-frame state data. Called by DtActiveSonar...
Definition: activeSonarStateComponent.h:580
unsigned int myBeamId
Identifier of the sonar system that produced this beam.
Definition: activeSonarStateComponent.h:87
std::vector< DtActiveSonarBeamStateData > & rawBeams()
Definition: activeSonarStateComponent.h:354
unsigned int mySystemName
The system name enumeration value for this sonar system.
Definition: activeSonarStateComponent.h:381
virtual void updateStateData(DtStateData *sd) override
Updates the state data storage pointer in both frame buffers.
Definition: activeSonarStateComponent.h:623
const DtActiveSonarBeams & beams() const
Definition: activeSonarStateComponent.h:350
DtActiveSonarBeamStateData(const DtActiveSonarBeamStateData &orig)
Copy constructor.
Definition: activeSonarStateComponent.h:36
DtActiveSonarStateComponentNextFrame myNextFrameState
The writable next-frame state buffer.
Definition: activeSonarStateComponent.h:641
double myElevationCenter
Elevation center angle of the beam, in radians.
Definition: activeSonarStateComponent.h:95
virtual const DtActiveSonarStateComponentData & frameState() const override
Definition: activeSonarStateComponent.h:551
virtual const DtActiveSonarBeamStateData * beamByBeamId(unsigned short beamId) const
Returns the beam with the given beam ID (const overload).
Definition: activeSonarStateComponent.h:436
double myElevationBeamWidth
Elevation beam width, in radians.
Definition: activeSonarStateComponent.h:97
DtActiveSonarBeamStateData * beamByBeamId(unsigned short beamId)
Returns a pointer to the beam with the given beam ID.
Definition: activeSonarStateComponent.h:313
virtual void updateDataStorage() override
Advances the current frame from the next frame if the next frame is writable, then notifies listeners...
Definition: activeSonarStateComponent.h:611
void removeBeam(unsigned short beamId)
Removes the beam with the given beam ID.
Definition: activeSonarStateComponent.h:359
const DtActiveSonarBeamStateData * beamByBeamIndex(unsigned short beamId) const
Returns a const pointer to the beam at the given zero-based index.
Definition: activeSonarStateComponent.h:337
Holds the complete state data for an active sonar system, including its identifiers, publish flag, mount location, and the collection of beams it emits.
Definition: activeSonarStateComponent.h:106
DtActiveSonarBeamStateData * beamByBeamId(unsigned short beamId)
Returns the beam with the given beam ID.
Definition: activeSonarStateComponent.h:201
DtActiveSonarStateComponentData myData
The current committed sonar system state data.
Definition: activeSonarStateComponent.h:587
Read-only implementation of the active sonar state component for the current (committed) frame...
Definition: activeSonarStateComponent.h:543
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:513
DtActiveSonarBeamStateData()
Default constructor. Initializes all numeric fields to zero.
Definition: activeSonarStateComponent.h:22
#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
Abstract interface class for the active sonar state component, representing either the next or curren...
Definition: activeSonarStateComponent.h:396
DtActiveSonarStateComponentData(const DtActiveSonarStateComponentData &orig)
Copy constructor.
Definition: activeSonarStateComponent.h:285
void removeBeam(unsigned short beamId)
Removes the beam with the given beam ID from the collection.
Definition: activeSonarStateComponent.h:182
DtActiveSonarBeams(const DtActiveSonarBeams &orig)
Copy constructor.
Definition: activeSonarStateComponent.h:119
DtActiveSonarBeamStateData * addBeam()
Adds a new beam with an auto-incremented beam ID and returns a pointer to it.
Definition: activeSonarStateComponent.h:242
DtActiveSonarStateComponentData & operator=(const DtActiveSonarStateComponentData &rhs)
Assignment operator.
Definition: activeSonarStateComponent.h:298
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:489
DtActiveSonarBeamStateData & operator=(const DtActiveSonarBeamStateData &rhs)
Assignment operator.
Definition: activeSonarStateComponent.h:51
virtual void aboutToBeDeleted()
Called when the component is about to be deleted; emits signal_stateComponentAboutToBeDeleted.
bool myPublish
Unique identifier for this sonar system.
Definition: activeSonarStateComponent.h:377
DtActiveSonarBeams()
Default constructor. Initializes to an empty beam collection.
Definition: activeSonarStateComponent.h:113
Write-access implementation of the active sonar state component for the next (pending) frame...
Definition: activeSonarStateComponent.h:454
virtual void makeWritable() override
Override to make component writable (no-op; next frame is always writable).
Definition: activeSonarStateComponent.h:529
int size() const
Definition: activeSonarStateComponent.h:135
std::vector< DtActiveSonarBeamStateData > beams
The list of beam state data objects.
Definition: activeSonarStateComponent.h:269
#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
DtActiveSonarBeams & beams()
Definition: activeSonarStateComponent.h:348
#define DEFINE_ACCESSOR_MUTATOR(ReturnType, Accessor, Mutator)
Defines a const reference accessor and an inline setter for a member variable.
Definition: doubleBufferedDataStorage.h:37
static const char * SystemName
Definition: vrfXmlTypes.h:46
Definition: stateComponent.h:87
Full double-buffered state component implementation for an active sonar system. Owns both the current...
Definition: activeSonarStateComponent.h:593
DtActiveSonarBeamStateData * beamByBeamIndex(unsigned short index)
Returns the beam at the given zero-based index in the underlying vector.
Definition: activeSonarStateComponent.h:217
DtActiveSonarStateComponentData()
Default constructor. Initializes publish to true and all numeric fields to zero.
Definition: activeSonarStateComponent.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
bool isDoubleBuffered()
Definition: activeSonarStateComponent.h:601
DtStateComponentCreator< DtActiveSonarStateComponentImplementation > DtActiveSonarStateComponentCreator
Creator factory class for DtActiveSonarStateComponentImplementation. Registered with the state compon...
Definition: activeSonarStateComponent.h:646
virtual const DtFrameStateInterface * nextFrameState() const override
Definition: activeSonarStateComponent.h:607
virtual const DtActiveSonarStateComponentData & frameState() const override
Definition: activeSonarStateComponent.h:462
Contains the DtStateComponent class declaration.
const DtActiveSonarBeamStateData * beamByBeamIndex(unsigned short index) const
Returns the beam at the given zero-based index in the underlying vector (const overload).
Definition: activeSonarStateComponent.h:230
unsigned short nextBeamId()
Increments and returns the next available beam ID.
Definition: activeSonarStateComponent.h:256
DtActiveSonarBeams & operator=(const DtActiveSonarBeams &rhs)
Assignment operator.
Definition: activeSonarStateComponent.h:127
void removeAllBeams()
Removes all beams and resets the auto-increment counter.
Definition: activeSonarStateComponent.h:262
DtActiveSonarStateComponentData myData
The next-frame sonar system state data.
Definition: activeSonarStateComponent.h:538
DtActiveSonarBeamStateData * addBeam()
Adds a new beam and returns a pointer to it.
Definition: activeSonarStateComponent.h:346
double myAzimuthCenter
Azimuth center angle of the beam, in radians.
Definition: activeSonarStateComponent.h:91
virtual const DtActiveSonarStateComponentData & frameState() const
Definition: activeSonarStateComponent.h:446
DtActiveSonarStateComponentCurrentFrame myCurrentFrameState
The read-only current-frame state buffer.
Definition: activeSonarStateComponent.h:639
Base interface for accessing current or next frame state in a double-buffered state component...
Definition: stateComponent.h:354
virtual const DtFrameStateInterface * currentFrameState() const override
Definition: activeSonarStateComponent.h:603
DtActiveSonarBeams myBeamsList
The list of beams associated with this sonar system.
Definition: activeSonarStateComponent.h:387