VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
radioReceiverStateComponent.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 
11 #include "vrfutil/rwUUID.h"
12 #include <legionStandardOM/sets/readRadioReceiverRepository.hpp>
13 #include <legionStandardOM/sets/writeRadioReceiverRepository.hpp>
14 
15 namespace makVrf
16 {
20  {
23  : myHostId(DtUUID::nullUUID())
24  , myTransmitterId(DtUUID::nullUUID())
25  , myReceiverState(0)
26  , myReceivedPower(0)
27  , myRadioId(0)
28  {
29  }
30 
34  : myHostId(orig.myHostId)
35  , myTransmitterId(orig.myTransmitterId)
36  , myReceiverState(orig.myReceiverState)
37  , myReceivedPower(orig.myReceivedPower)
38  , myRadioId(orig.myRadioId)
39  {
40  }
41 
46  {
47  myHostId = orig.myHostId;
48  myTransmitterId = orig.myTransmitterId;
49  myReceivedPower = orig.myReceivedPower;
50  myReceiverState = orig.myReceiverState;
51  myRadioId = orig.myRadioId;
52 
53  return *this;
54  }
55 
57  DEFINE_ACCESSOR_MUTATOR(DtUUID, hostId, HostId)
59  DEFINE_ACCESSOR_MUTATOR(DtUUID, transmitterId, TransmitterId)
61  DEFINE_ACCESSOR_MUTATOR(unsigned int, receiverState, ReceiverState)
63  DEFINE_ACCESSOR_MUTATOR(UInt64, radioId, RadioId)
65  DEFINE_ACCESSOR_MUTATOR(float, receivedPower, ReceivedPower)
66 
67  protected:
69  DtUUID myHostId;
71  DtUUID myTransmitterId;
73  unsigned int myReceiverState;
75  float myReceivedPower;
77  UInt64 myRadioId;
78  };
79 
84  {
85  public:
87 
88 
91  : DtFrameStateInterface(storage)
92  {
93  }
94 
95  UNDEFINED_RETURNVALUE_ACCESSOR(DtUUID, hostId)
96  UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(DtUUID, transmitterId, TransmitterId)
97  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(unsigned int, receiverState, ReceiverState)
98  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(UInt64, radioId, RadioId)
99  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(float, receivedPower, ReceivedPower)
100  };
101 
105  {
106  public:
111  virtual ~DtRadioReceiverStateComponentNextFrame() override;
112 
114  const DtRadioReceiverStateComponentData& frameState() const { return myData; };
117 
119  virtual const DtUUID hostId() const override;
120 
122  virtual const DtUUID& transmitterId() const override;
124  virtual void setTransmitterId(const DtUUID&) override;
125 
127  virtual const unsigned int receiverState() const override;
129  virtual void setReceiverState(const unsigned int&) override;
130 
132  virtual const UInt64 radioId() const override;
134  virtual void setRadioId(const UInt64&) override;
135 
137  virtual const float receivedPower() const override;
139  virtual void setReceivedPower(const float&) override;
140 
142  virtual void makeWritable() override;
143 
145  virtual void makeReadOnly() override;
146 
148  virtual Legion::WriteStateInstance writeStateInstance() override;
151  virtual void updateStateData(DtStateData*) override;
152 
154  void cleanupWriteState();
157  void setPublishingOnLegionNetwork(bool b);
158 
159  protected:
163  LOM::WriteRadioReceiverRepository myWriteRadioReceiverRepository;
166  };
167 
171  {
172  public:
177  virtual ~DtRadioReceiverStateComponentCurrentFrame() override;
178 
180  const DtRadioReceiverStateComponentData& frameState() const { return myData; };
181 
183  virtual const DtUUID hostId() const override;
185  virtual const DtUUID& transmitterId() const override;
187  virtual const unsigned int receiverState() const override;
189  virtual const UInt64 radioId() const override;
191  virtual const float receivedPower() const override;
192 
194  bool readComponentValid() const;
197  bool findReadComponent();
198 
201  virtual void updateStateData(DtStateData*) override;
202 
203  protected:
208  {
209  myData = data;
210  }
212  virtual void handleDataUpdated();
213 
214  protected:
218  LOM::ReadRadioReceiverRepository myReadRadioReceiverRepository;
221  };
222 
226  {
227  public:
231 
233  bool isDoubleBuffered() { return true; };
235  virtual const DtFrameStateInterface* currentFrameState() const override { return &myCurrentFrameState; }
237  virtual DtFrameStateInterface* nextFrameState() override { return &myNextFrameState; };
239  virtual const DtFrameStateInterface* nextFrameState() const override { return &myNextFrameState; };
240 
242  virtual void updateDataStorage() override
243  {
244  if (myNextFrameState.isWritable())
245  {
246  myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
247  }
248  myCurrentFrameState.emitComponentUpdated();
249  }
250 
252  virtual bool forceAdvance() override;
253 
255  virtual void firstFrameAdvance() override;
256 
259  virtual void updateStateData(DtStateData* sd) override
260  {
261  myCurrentFrameState.updateStateData(sd);
262  myNextFrameState.updateStateData(sd);
263  }
264 
266  virtual void aboutToBeDeleted() override
267  {
269  myCurrentFrameState.aboutToBeDeleted();
270  myNextFrameState.aboutToBeDeleted();
271  }
272 
274  virtual void completeSetup() override;
276  virtual void removeAdditionalStateComponents() override;
279  virtual void setPublishingOnLegionNetwork(bool b) override;
280 
281  protected:
288  };
289 
293 }
UUID is a unique ID wrapper class.
Definition: uuid.h:59
DtStateComponentCreator< DtRadioReceiverStateComponentImplementation > DtRadioReceiverStateComponentCreator
Factory creator type for DtRadioReceiverStateComponentImplementation. Must be registered with the REG...
Definition: radioReceiverStateComponent.h:292
virtual void aboutToBeDeleted() override
Notifies both inner frame components that this component is about to be deleted.
Definition: radioReceiverStateComponent.h:266
DtRadioReceiverStateComponentNextFrame myNextFrameState
The write-access (next frame) state wrapper.
Definition: radioReceiverStateComponent.h:285
const DtRadioReceiverStateComponentData & frameState() const
Returns the current frame state data.
Definition: radioReceiverStateComponent.h:180
float myReceivedPower
Received signal power in dBm.
Definition: radioReceiverStateComponent.h:75
UInt64 myRadioId
Unique radio identifier.
Definition: radioReceiverStateComponent.h:77
bool myFoundComponent
True once the Legion read component has been successfully located.
Definition: radioReceiverStateComponent.h:287
bool isDoubleBuffered()
Definition: radioReceiverStateComponent.h:233
DtRadioReceiverStateComponentData(const DtRadioReceiverStateComponentData &orig)
Copy constructor.
Definition: radioReceiverStateComponent.h:33
Default creator implementation for a state component type. T_StateComponent is the concrete component...
Definition: stateComponent.h:326
DtUUID myTransmitterId
UUID of the transmitter being received.
Definition: radioReceiverStateComponent.h:71
Write-access (next-frame) implementation of the radio receiver state component. Manages publishing re...
Definition: radioReceiverStateComponent.h:104
Read-access (current-frame) implementation of the radio receiver state component. Subscribes to Legio...
Definition: radioReceiverStateComponent.h:170
virtual void updateStateData(DtStateData *sd) override
Propagates the new state data pointer to both inner frame components.
Definition: radioReceiverStateComponent.h:259
#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.
DtRadioReceiverStateComponentData myData
The next-frame state data snapshot.
Definition: radioReceiverStateComponent.h:161
unsigned long long UInt64
64-bit unsigned integer type.
Definition: stateDataTypes.h:19
DtRadioReceiverStateComponentData()
Default constructor. Initializes all fields to zero/null.
Definition: radioReceiverStateComponent.h:22
const DtRadioReceiverStateComponentData & frameState() const
Returns the current frame state data (read-only).
Definition: radioReceiverStateComponent.h:114
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:513
virtual DtFrameStateInterface * nextFrameState() override
Definition: radioReceiverStateComponent.h:237
LOM::WriteRadioReceiverRepository myWriteRadioReceiverRepository
Legion write repository for publishing receiver state to the network.
Definition: radioReceiverStateComponent.h:163
#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
LOM::ReadRadioReceiverRepository myReadRadioReceiverRepository
Legion read repository used to subscribe to receiver state updates.
Definition: radioReceiverStateComponent.h:218
void advanceFrame(const DtRadioReceiverStateComponentData &data)
Advances the frame by copying the next-frame data into the current frame.
Definition: radioReceiverStateComponent.h:207
Double-buffered state component implementation for radio receiver state. Owns and manages both the ne...
Definition: radioReceiverStateComponent.h:225
#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 aboutToBeDeleted()
Called when the component is about to be deleted; emits signal_stateComponentAboutToBeDeleted.
Holds the state data for a DIS/HLA radio receiver, including host entity, transmitter reference...
Definition: radioReceiverStateComponent.h:19
DtRadioReceiverStateComponentData & operator=(const DtRadioReceiverStateComponentData &orig)
Copy assignment operator.
Definition: radioReceiverStateComponent.h:45
#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 const DtFrameStateInterface * nextFrameState() const override
Definition: radioReceiverStateComponent.h:239
Abstract interface for the radio receiver state component, representing common accessors for both the...
Definition: radioReceiverStateComponent.h:83
#define DEFINE_ACCESSOR_MUTATOR(ReturnType, Accessor, Mutator)
Defines a const reference accessor and an inline setter for a member variable.
Definition: doubleBufferedDataStorage.h:37
virtual const DtFrameStateInterface * currentFrameState() const override
Definition: radioReceiverStateComponent.h:235
DtUUID myHostId
Accessor and mutator for the host entity UUID.
Definition: radioReceiverStateComponent.h:69
virtual void updateDataStorage() override
Advances the current frame by copying next-frame data, then emits the updated signal.
Definition: radioReceiverStateComponent.h:242
#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 myPublishingOnLegionNetwork
True if this component is currently publishing on the Legion network.
Definition: radioReceiverStateComponent.h:165
DtRadioReceiverStateComponentData & frameState()
Returns the current frame state data (read-write).
Definition: radioReceiverStateComponent.h:116
Contains the DtStateComponent class declaration.
DtRadioReceiverStateComponentData myData
The current-frame state data snapshot.
Definition: radioReceiverStateComponent.h:216
Base interface for accessing current or next frame state in a double-buffered state component...
Definition: stateComponent.h:354
unsigned int myReceiverState
DIS/HLA receiver operational state value.
Definition: radioReceiverStateComponent.h:73
DtRadioReceiverStateComponentCurrentFrame myCurrentFrameState
The read-access (current frame) state wrapper.
Definition: radioReceiverStateComponent.h:283
int myCallbackHandle
Handle for the registered Legion instance-update callback.
Definition: radioReceiverStateComponent.h:220

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)