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 {
17  {
19  : myMmsi(0)
20  , myImo(0)
21  , myEta(0)
22  , myStatus(0)
23  , myDestination()
24  {};
25 
27  {
28  myMmsi = orig.myMmsi;
29  myImo = orig.myImo;
30  myEta = orig.myEta;
31  myStatus = orig.myStatus;
32  myDestination = orig.myDestination;
33  }
34 
36  {
37  myMmsi = orig.myMmsi;
38  myImo = orig.myImo;
39  myEta = orig.myEta;
40  myStatus = orig.myStatus;
41  myDestination = orig.myDestination;
42 
43  return *this;
44  }
45 
46  DEFINE_ACCESSOR_MUTATOR(int, mmsi, Mmsi)
47  DEFINE_ACCESSOR_MUTATOR(int, imo, Imo)
48  DEFINE_ACCESSOR_MUTATOR(int, eta, Eta)
49  DEFINE_ACCESSOR_MUTATOR(int, status, Status)
50  DEFINE_ACCESSOR_MUTATOR(DtString, destination, Destination)
51 
52  protected:
53  int myMmsi;
54  int myImo;
55  int myEta;
56  int myStatus;
57  DtString myDestination;
58  };
59 
63  {
64  public:
66 
68  : DtFrameStateInterface(storage)
69  {
70  }
71 
75  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(DtString, destination, Destination)
76  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(int, status, Status)
77 
78  };
79 
82  {
83  public:
85  virtual ~DtAisDataStateComponentNextFrame() override;
86 
89  const DtAisDataStateComponentData& frameState() const { return myData; };
90  DtAisDataStateComponentData& frameState() { return myData; };
91 
92  virtual const int mmsi() const override;
93  virtual void setMmsi(const int&) override;
94 
95  virtual const int imo() const override;
96  virtual void setImo(const int&) override;
97 
98  virtual const int eta() const override;
99  virtual void setEta(const int&) override;
100 
101  virtual const DtString destination() const override;
102  virtual void setDestination(const DtString&) override;
103 
104  virtual const int status() const override;
105  virtual void setStatus(const int&) override;
106 
108  virtual void makeWritable() override {};
109 
111  virtual void makeReadOnly() override {};
112 
113 
114  protected:
115  mutable DtAisDataStateComponentData myData;
116  };
117 
120  {
121  public:
122 
124  virtual ~DtAisDataStateComponentCurrentFrame() override;
125 
127  const DtAisDataStateComponentData& frameState() const { return myData; };
128 
129  virtual const int mmsi() const override;
130  virtual const int imo() const override;
131  virtual const int eta() const override;
132  virtual const DtString destination() const override;
133  virtual const int status() const override;
134 
135  friend class DtAisDataStateImplementation;
137  {
138  myData = data;
139  }
140 
141  protected:
143  };
144 
148  {
149  public:
151 
152  bool isDoubleBuffered() { return true; };
153  virtual const DtFrameStateInterface* currentFrameState() const override { return &myCurrentFrameState; }
154  virtual DtFrameStateInterface* nextFrameState() override { return &myNextFrameState; };
155  virtual const DtFrameStateInterface* nextFrameState() const override { return &myNextFrameState; };
156 
157  virtual void updateDataStorage() override
158  {
159  if (myNextFrameState.isWritable())
160  {
161  myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
162  }
163 
164  myCurrentFrameState.emitComponentUpdated();
165  }
166 
167  virtual void updateStateData(DtStateData* sd) override
168  {
169  myCurrentFrameState.updateStateData(sd);
170  myNextFrameState.updateStateData(sd);
171  }
172 
173  virtual void aboutToBeDeleted() override
174  {
176  myCurrentFrameState.aboutToBeDeleted();
177  myNextFrameState.aboutToBeDeleted();
178  }
179 
180  protected:
183  };
184 
188 }
int myImo
Definition: aisDataStateComponent.h:54
virtual const DtFrameStateInterface * currentFrameState() const override
Definition: aisDataStateComponent.h:153
bool isDoubleBuffered()
Definition: aisDataStateComponent.h:152
3) Define the current frame class. This will be used for read access.
Definition: aisDataStateComponent.h:119
Definition: stateComponent.h:269
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:89
virtual void aboutToBeDeleted() override
Definition: aisDataStateComponent.h:173
virtual void updateStateData(DtStateData *sd) override
Implement to update data storage to the new state data.
Definition: aisDataStateComponent.h:167
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: aisDataStateComponent.h:147
virtual void updateDataStorage() override
Implement to update data storage. Called from advanceFrame.
Definition: aisDataStateComponent.h:157
DtStateComponentCreator< DtAisDataStateComponentImplementation > DtAisDataStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: aisDataStateComponent.h:187
DtAisDataStateComponentData()
Definition: aisDataStateComponent.h:18
int myStatus
Definition: aisDataStateComponent.h:56
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:398
#define DEFINE_STATE_COMPONENT_TYPE(CreatedComponent)
Definition: stateComponent.h:231
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:384
void advanceFrame(const DtAisDataStateComponentData &data)
Definition: aisDataStateComponent.h:136
#define UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(Type, Member, Set)
Definition: doubleBufferedDataStorage.h:53
virtual void aboutToBeDeleted()
virtual DtFrameStateInterface * nextFrameState() override
Definition: aisDataStateComponent.h:154
DtAisDataStateComponentData & frameState()
Definition: aisDataStateComponent.h:90
Definition: aisDataStateComponent.h:16
int myMmsi
Definition: aisDataStateComponent.h:53
#define DEFINE_ACCESSOR_MUTATOR(ReturnType, Accessor, Mutator)
Definition: doubleBufferedDataStorage.h:23
const DtAisDataStateComponentData & frameState() const
Current frame state only can access current frame buffers. This ensures thread safety.
Definition: aisDataStateComponent.h:127
DtAisDataStateComponentData & operator=(const DtAisDataStateComponentData &orig)
Definition: aisDataStateComponent.h:35
DtAisDataStateComponentNextFrame myNextFrameState
Definition: aisDataStateComponent.h:182
#define DT_DLL_vrfStateData
This file is used to determine how to build Disable inconsistent dll linkage warning Visual Studio 6...
Definition: vrfStateDataDefines.h:26
DtString myDestination
Definition: aisDataStateComponent.h:57
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:62
2) Define the next frame class. This will be used for write access.
Definition: aisDataStateComponent.h:81
DtAisDataStateComponentData(const DtAisDataStateComponentData &orig)
Definition: aisDataStateComponent.h:26
virtual const DtFrameStateInterface * nextFrameState() const override
Definition: aisDataStateComponent.h:155
Contains the DtStateComponent class declaration.
int myEta
Definition: aisDataStateComponent.h:55
DtAisDataStateComponentData myData
Definition: aisDataStateComponent.h:142
This is a simple base class that will be used to return a pointer to current or next frame state...
Definition: stateComponent.h:294
DtAisDataStateComponentCurrentFrame myCurrentFrameState
Definition: aisDataStateComponent.h:181
virtual void makeWritable() override
Override to make component writable.
Definition: aisDataStateComponent.h:108

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)