VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
groundVehicleLightingStateComponent.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2023 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  : myLeftIndicatorLightsOn(false)
20  , myRightIndicatorLightsOn(false)
21  , myEmergencyLightsOn(false)
22  {};
23 
25  {
26  myLeftIndicatorLightsOn = orig.myLeftIndicatorLightsOn;
27  myRightIndicatorLightsOn = orig.myRightIndicatorLightsOn;
28  myEmergencyLightsOn = orig.myEmergencyLightsOn;
29  }
30 
32  {
33  myLeftIndicatorLightsOn = orig.myLeftIndicatorLightsOn;
34  myRightIndicatorLightsOn = orig.myRightIndicatorLightsOn;
35  myEmergencyLightsOn = orig.myEmergencyLightsOn;
36 
37  return *this;
38  }
39 
40  DEFINE_ACCESSOR_MUTATOR(bool, leftIndicatorLightsOn, LeftIndicatorLightsOn)
41  DEFINE_ACCESSOR_MUTATOR(bool, rightIndicatorLightsOn, RightIndicatorLightsOn)
42  DEFINE_ACCESSOR_MUTATOR(bool, emergencyLightsOn, EmergencyLightsOn)
43 
44  protected:
45  bool myLeftIndicatorLightsOn;
46  bool myRightIndicatorLightsOn;
47  bool myEmergencyLightsOn;
48  };
49 
53  {
54  public:
56 
58  : DtFrameStateInterface(storage)
59  {
60  }
61 
62  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(bool, leftIndicatorLightsOn, LeftIndicatorLightsOn)
63  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(bool, rightIndicatorLightsOn, RightIndicatorLightsOn)
64  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(bool, emergencyLightsOn, EmergencyLightsOn)
65 
66  };
67 
70  {
71  public:
74 
77  const DtGroundVehicleLightingStateComponentData& frameState() const { return myData; };
79 
80  virtual const bool leftIndicatorLightsOn() const override;
81  virtual void setLeftIndicatorLightsOn(const bool&) override;
82 
83  virtual const bool rightIndicatorLightsOn() const override;
84  virtual void setRightIndicatorLightsOn(const bool&) override;
85 
86  virtual const bool emergencyLightsOn() const override;
87  virtual void setEmergencyLightsOn(const bool&) override;
88 
90  virtual void makeWritable() override {};
91 
93  virtual void makeReadOnly() override {};
94 
95 
96  protected:
98  };
99 
102  {
103  public:
104 
107 
109  const DtGroundVehicleLightingStateComponentData& frameState() const { return myData; };
110 
111  virtual const bool leftIndicatorLightsOn() const override;
112  virtual const bool rightIndicatorLightsOn() const override;
113  virtual const bool emergencyLightsOn() const override;
114 
115  friend class DtGroundVehicleLightingStateImplementation;
117  {
118  myData = data;
119  }
120 
121  protected:
123  };
124 
128  {
129  public:
131 
132  bool isDoubleBuffered() { return true; };
133  virtual const DtFrameStateInterface* currentFrameState() const override { return &myCurrentFrameState; }
134  virtual DtFrameStateInterface* nextFrameState() override { return &myNextFrameState; };
135  virtual const DtFrameStateInterface* nextFrameState() const override { return &myNextFrameState; };
136 
137  virtual void updateDataStorage() override
138  {
139  if (myNextFrameState.isWritable())
140  {
141  myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
142  }
143 
144  myCurrentFrameState.emitComponentUpdated();
145  }
146 
147  virtual void updateStateData(DtStateData* sd) override
148  {
149  myCurrentFrameState.updateStateData(sd);
150  myNextFrameState.updateStateData(sd);
151  }
152 
153  virtual void aboutToBeDeleted() override
154  {
156  myCurrentFrameState.aboutToBeDeleted();
157  myNextFrameState.aboutToBeDeleted();
158  }
159 
160  protected:
163  };
164 
168 }
const DtGroundVehicleLightingStateComponentData & frameState() const
Current frame state only can access current frame buffers. This ensures thread safety.
Definition: groundVehicleLightingStateComponent.h:109
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: groundVehicleLightingStateComponent.h:52
bool myLeftIndicatorLightsOn
Definition: groundVehicleLightingStateComponent.h:45
DtGroundVehicleLightingStateComponentData & operator=(const DtGroundVehicleLightingStateComponentData &orig)
Definition: groundVehicleLightingStateComponent.h:31
bool myRightIndicatorLightsOn
Definition: groundVehicleLightingStateComponent.h:46
Definition: stateComponent.h:269
virtual void makeWritable() override
Override to make component writable.
Definition: groundVehicleLightingStateComponent.h:90
DtGroundVehicleLightingStateComponentCurrentFrame myCurrentFrameState
Definition: groundVehicleLightingStateComponent.h:161
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: groundVehicleLightingStateComponent.h:127
bool isDoubleBuffered()
Definition: groundVehicleLightingStateComponent.h:132
virtual void aboutToBeDeleted() override
Definition: groundVehicleLightingStateComponent.h:153
virtual void updateDataStorage() override
Implement to update data storage. Called from advanceFrame.
Definition: groundVehicleLightingStateComponent.h:137
const DtGroundVehicleLightingStateComponentData & frameState() const
Next frame access write access. Ensure this is only used in a single thread (i.e.a controller thread)...
Definition: groundVehicleLightingStateComponent.h:77
void advanceFrame(const DtGroundVehicleLightingStateComponentData &data)
Definition: groundVehicleLightingStateComponent.h:116
bool myEmergencyLightsOn
Definition: groundVehicleLightingStateComponent.h:47
virtual DtFrameStateInterface * nextFrameState() override
Definition: groundVehicleLightingStateComponent.h:134
DtStateComponentCreator< DtGroundVehicleLightingStateComponentImplementation > DtGroundVehicleLightingStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: groundVehicleLightingStateComponent.h:167
virtual const DtFrameStateInterface * currentFrameState() const override
Definition: groundVehicleLightingStateComponent.h:133
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:398
Definition: groundVehicleLightingStateComponent.h:16
#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
#define UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(Type, Member, Set)
Definition: doubleBufferedDataStorage.h:53
virtual void aboutToBeDeleted()
3) Define the current frame class. This will be used for read access.
Definition: groundVehicleLightingStateComponent.h:101
virtual const DtFrameStateInterface * nextFrameState() const override
Definition: groundVehicleLightingStateComponent.h:135
2) Define the next frame class. This will be used for write access.
Definition: groundVehicleLightingStateComponent.h:69
#define DEFINE_ACCESSOR_MUTATOR(ReturnType, Accessor, Mutator)
Definition: doubleBufferedDataStorage.h:23
virtual void updateStateData(DtStateData *sd) override
Implement to update data storage to the new state data.
Definition: groundVehicleLightingStateComponent.h:147
DtGroundVehicleLightingStateComponentData myData
Definition: groundVehicleLightingStateComponent.h:122
DtGroundVehicleLightingStateComponentData()
Definition: groundVehicleLightingStateComponent.h:18
DtGroundVehicleLightingStateComponentNextFrame myNextFrameState
Definition: groundVehicleLightingStateComponent.h:162
DtGroundVehicleLightingStateComponentData(const DtGroundVehicleLightingStateComponentData &orig)
Definition: groundVehicleLightingStateComponent.h:24
#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
Contains the DtStateComponent class declaration.
DtGroundVehicleLightingStateComponentData & frameState()
Definition: groundVehicleLightingStateComponent.h:78
This is a simple base class that will be used to return a pointer to current or next frame state...
Definition: stateComponent.h:294

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)