VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
aisDataStateComponent.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 "legionDataStore/writeStateInstance.h"
11 
12 #include <vlutil/vlString.h>
13 
14 namespace makVrf
15 {
16 
20  {
22  : myMmsi(0)
23  , myImo(0)
24  , myEta(0)
25  , myStatus(0)
26  , myDestination()
27  , myShipClass(DtAisShipClass_A)
28  {};
29 
31  {
32  myMmsi = orig.myMmsi;
33  myImo = orig.myImo;
34  myEta = orig.myEta;
35  myStatus = orig.myStatus;
36  myDestination = orig.myDestination;
37  myShipClass = orig.myShipClass;
38  }
39 
41  {
42  myMmsi = orig.myMmsi;
43  myImo = orig.myImo;
44  myEta = orig.myEta;
45  myStatus = orig.myStatus;
46  myDestination = orig.myDestination;
47  myShipClass = orig.myShipClass;
48 
49  return *this;
50  }
51 
52  DEFINE_ACCESSOR_MUTATOR(int, mmsi, Mmsi)
53  DEFINE_ACCESSOR_MUTATOR(int, imo, Imo)
54  DEFINE_ACCESSOR_MUTATOR(int, eta, Eta)
55  DEFINE_ACCESSOR_MUTATOR(int, status, Status)
56  DEFINE_ACCESSOR_MUTATOR(DtString, destination, Destination)
57  DEFINE_ACCESSOR_MUTATOR(DtAisShipClass, shipClass, ShipClass)
58 
59  protected:
61  int myMmsi;
63  int myImo;
65  int myEta;
67  int myStatus;
69  DtString myDestination;
71  DtAisShipClass myShipClass;
72  };
73 
77  {
78  public:
80 
82  : DtFrameStateInterface(storage)
83  {
84  }
85 
89  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(DtString, destination, Destination)
90  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(int, status, Status)
91  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(DtAisShipClass, shipClass, ShipClass)
92 
93  };
94 
97  {
98  public:
100  virtual ~DtAisDataStateComponentNextFrame() override;
101 
105  const DtAisDataStateComponentData& frameState() const { return myData; };
108 
110  virtual const int mmsi() const override;
112  virtual void setMmsi(const int&) override;
113 
115  virtual const int imo() const override;
117  virtual void setImo(const int&) override;
118 
120  virtual const int eta() const override;
122  virtual void setEta(const int&) override;
123 
125  virtual const DtString destination() const override;
127  virtual void setDestination(const DtString&) override;
128 
130  virtual const int status() const override;
132  virtual void setStatus(const int&) override;
133 
135  virtual void makeWritable() override {};
136 
138  virtual void makeReadOnly() override {};
139 
141  virtual const DtAisShipClass shipClass() const override;
143  virtual void setShipClass(const DtAisShipClass&) override;
144 
145 
146  protected:
149  };
150 
153  {
154  public:
155 
157  virtual ~DtAisDataStateComponentCurrentFrame() override;
158 
161  const DtAisDataStateComponentData& frameState() const { return myData; };
162 
164  virtual const int mmsi() const override;
166  virtual const int imo() const override;
168  virtual const int eta() const override;
170  virtual const DtString destination() const override;
172  virtual const int status() const override;
174  virtual const DtAisShipClass shipClass() const override;
175 
176  friend class DtAisDataStateImplementation;
180  {
181  myData = data;
182  }
183 
184  protected:
187  };
188 
192  {
193  public:
195 
197  bool isDoubleBuffered() { return true; };
199  virtual const DtFrameStateInterface* currentFrameState() const override { return &myCurrentFrameState; }
201  virtual DtFrameStateInterface* nextFrameState() override { return &myNextFrameState; };
203  virtual const DtFrameStateInterface* nextFrameState() const override { return &myNextFrameState; };
204 
206  virtual void updateDataStorage() override
207  {
208  if (myNextFrameState.isWritable())
209  {
210  myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
211  }
212 
213  myCurrentFrameState.emitComponentUpdated();
214  }
215 
218  virtual void updateStateData(DtStateData* sd) override
219  {
220  myCurrentFrameState.updateStateData(sd);
221  myNextFrameState.updateStateData(sd);
222  }
223 
225  virtual void aboutToBeDeleted() override
226  {
228  myCurrentFrameState.aboutToBeDeleted();
229  myNextFrameState.aboutToBeDeleted();
230  }
231 
232  protected:
237  };
238 
242 }
DtAisDataStateComponentData myData
AIS data for the next frame.
Definition: aisDataStateComponent.h:148
virtual void makeReadOnly() override
Override to make component read-only.
Definition: aisDataStateComponent.h:138
int myImo
IMO (International Maritime Organization) number.
Definition: aisDataStateComponent.h:63
virtual const DtFrameStateInterface * currentFrameState() const override
Definition: aisDataStateComponent.h:199
bool isDoubleBuffered()
Definition: aisDataStateComponent.h:197
3) Define the current frame class. This will be used for read access.
Definition: aisDataStateComponent.h:152
Default creator implementation for a state component type. T_StateComponent is the concrete component...
Definition: stateComponent.h:326
const DtAisDataStateComponentData & frameState() const
Next frame access write access. Ensure this is only used in a single thread (i.e.a controller thread)...
Definition: aisDataStateComponent.h:105
virtual void aboutToBeDeleted() override
Notifies the current and next frame states that the component is about to be deleted.
Definition: aisDataStateComponent.h:225
virtual void updateStateData(DtStateData *sd) override
Updates the state data pointer for both the current and next frame states.
Definition: aisDataStateComponent.h:218
DtAisShipClass myShipClass
AIS ship class, classified by size/capacity.
Definition: aisDataStateComponent.h:71
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: aisDataStateComponent.h:191
virtual void updateDataStorage() override
Copies the next frame state into the current frame state if the next frame is writable.
Definition: aisDataStateComponent.h:206
DtStateComponentCreator< DtAisDataStateComponentImplementation > DtAisDataStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: aisDataStateComponent.h:241
DtAisDataStateComponentData()
Definition: aisDataStateComponent.h:21
int myStatus
Navigational status code.
Definition: aisDataStateComponent.h:67
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:513
#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
void advanceFrame(const DtAisDataStateComponentData &data)
Advances the current frame state to the provided data.
Definition: aisDataStateComponent.h:179
#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.
virtual DtFrameStateInterface * nextFrameState() override
Definition: aisDataStateComponent.h:201
DtAisDataStateComponentData & frameState()
Returns the AIS data state for the next frame (mutable).
Definition: aisDataStateComponent.h:107
Holds AIS (Automatic Identification System) navigation data for a surface vessel, including MMSI...
Definition: aisDataStateComponent.h:19
int myMmsi
MMSI (Maritime Mobile Service Identity) number.
Definition: aisDataStateComponent.h:61
#define DEFINE_ACCESSOR_MUTATOR(ReturnType, Accessor, Mutator)
Defines a const reference accessor and an inline setter for a member variable.
Definition: doubleBufferedDataStorage.h:37
const DtAisDataStateComponentData & frameState() const
Current frame state only can access current frame buffers. This ensures thread safety Returns the AIS...
Definition: aisDataStateComponent.h:161
DtAisDataStateComponentData & operator=(const DtAisDataStateComponentData &orig)
Definition: aisDataStateComponent.h:40
DtAisDataStateComponentNextFrame myNextFrameState
Next frame AIS state component (write access).
Definition: aisDataStateComponent.h:236
#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
DtString myDestination
Destination port name.
Definition: aisDataStateComponent.h:69
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: aisDataStateComponent.h:76
2) Define the next frame class. This will be used for write access.
Definition: aisDataStateComponent.h:96
DtAisDataStateComponentData(const DtAisDataStateComponentData &orig)
Definition: aisDataStateComponent.h:30
virtual const DtFrameStateInterface * nextFrameState() const override
Definition: aisDataStateComponent.h:203
Contains the DtStateComponent class declaration.
int myEta
AIS estimated time of arrival (ETA).
Definition: aisDataStateComponent.h:65
DtAisDataStateComponentData myData
AIS data for the current frame.
Definition: aisDataStateComponent.h:186
Base interface for accessing current or next frame state in a double-buffered state component...
Definition: stateComponent.h:354
DtAisDataStateComponentCurrentFrame myCurrentFrameState
Current frame AIS state component (read access).
Definition: aisDataStateComponent.h:234
virtual void makeWritable() override
Override to make component writable.
Definition: aisDataStateComponent.h:135

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)