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 {
18  {
20  : myLeftIndicatorLightsOn(false)
21  , myRightIndicatorLightsOn(false)
22  , myEmergencyLightsOn(false)
23  {};
24 
26  {
27  myLeftIndicatorLightsOn = orig.myLeftIndicatorLightsOn;
28  myRightIndicatorLightsOn = orig.myRightIndicatorLightsOn;
29  myEmergencyLightsOn = orig.myEmergencyLightsOn;
30  }
31 
33  {
34  myLeftIndicatorLightsOn = orig.myLeftIndicatorLightsOn;
35  myRightIndicatorLightsOn = orig.myRightIndicatorLightsOn;
36  myEmergencyLightsOn = orig.myEmergencyLightsOn;
37 
38  return *this;
39  }
40 
41  DEFINE_ACCESSOR_MUTATOR(bool, leftIndicatorLightsOn, LeftIndicatorLightsOn)
42  DEFINE_ACCESSOR_MUTATOR(bool, rightIndicatorLightsOn, RightIndicatorLightsOn)
43  DEFINE_ACCESSOR_MUTATOR(bool, emergencyLightsOn, EmergencyLightsOn)
44 
45  protected:
47  bool myLeftIndicatorLightsOn;
49  bool myRightIndicatorLightsOn;
51  bool myEmergencyLightsOn;
52  };
53 
57  {
58  public:
60 
62  : DtFrameStateInterface(storage)
63  {
64  }
65 
66  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(bool, leftIndicatorLightsOn, LeftIndicatorLightsOn)
67  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(bool, rightIndicatorLightsOn, RightIndicatorLightsOn)
68  UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(bool, emergencyLightsOn, EmergencyLightsOn)
69 
70  };
71 
74  {
75  public:
78 
82  const DtGroundVehicleLightingStateComponentData& frameState() const { return myData; };
85 
87  virtual const bool leftIndicatorLightsOn() const override;
89  virtual void setLeftIndicatorLightsOn(const bool&) override;
90 
92  virtual const bool rightIndicatorLightsOn() const override;
94  virtual void setRightIndicatorLightsOn(const bool&) override;
95 
97  virtual const bool emergencyLightsOn() const override;
99  virtual void setEmergencyLightsOn(const bool&) override;
100 
102  virtual void makeWritable() override {};
103 
105  virtual void makeReadOnly() override {};
106 
107 
108  protected:
111  };
112 
115  {
116  public:
117 
120 
123  const DtGroundVehicleLightingStateComponentData& frameState() const { return myData; };
124 
126  virtual const bool leftIndicatorLightsOn() const override;
128  virtual const bool rightIndicatorLightsOn() const override;
130  virtual const bool emergencyLightsOn() const override;
131 
132  friend class DtGroundVehicleLightingStateImplementation;
136  {
137  myData = data;
138  }
139 
140  protected:
143  };
144 
148  {
149  public:
151 
153  bool isDoubleBuffered() { return true; };
155  virtual const DtFrameStateInterface* currentFrameState() const override { return &myCurrentFrameState; }
157  virtual DtFrameStateInterface* nextFrameState() override { return &myNextFrameState; };
159  virtual const DtFrameStateInterface* nextFrameState() const override { return &myNextFrameState; };
160 
162  virtual void updateDataStorage() override
163  {
164  if (myNextFrameState.isWritable())
165  {
166  myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
167  }
168 
169  myCurrentFrameState.emitComponentUpdated();
170  }
171 
174  virtual void updateStateData(DtStateData* sd) override
175  {
176  myCurrentFrameState.updateStateData(sd);
177  myNextFrameState.updateStateData(sd);
178  }
179 
181  virtual void aboutToBeDeleted() override
182  {
184  myCurrentFrameState.aboutToBeDeleted();
185  myNextFrameState.aboutToBeDeleted();
186  }
187 
188  protected:
193  };
194 
198 }
const DtGroundVehicleLightingStateComponentData & frameState() const
Current frame state only can access current frame buffers. This ensures thread safety.
Definition: groundVehicleLightingStateComponent.h:123
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:56
bool myLeftIndicatorLightsOn
True if the left turn-signal indicator lights are on.
Definition: groundVehicleLightingStateComponent.h:47
DtGroundVehicleLightingStateComponentData & operator=(const DtGroundVehicleLightingStateComponentData &orig)
Definition: groundVehicleLightingStateComponent.h:32
bool myRightIndicatorLightsOn
True if the right turn-signal indicator lights are on.
Definition: groundVehicleLightingStateComponent.h:49
Default creator implementation for a state component type. T_StateComponent is the concrete component...
Definition: stateComponent.h:326
virtual void makeWritable() override
Override to make component writable.
Definition: groundVehicleLightingStateComponent.h:102
DtGroundVehicleLightingStateComponentCurrentFrame myCurrentFrameState
Current frame ground vehicle lighting state component (read access).
Definition: groundVehicleLightingStateComponent.h:190
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: groundVehicleLightingStateComponent.h:147
bool isDoubleBuffered()
Definition: groundVehicleLightingStateComponent.h:153
virtual void aboutToBeDeleted() override
Notifies the current and next frame states that the component is about to be deleted.
Definition: groundVehicleLightingStateComponent.h:181
virtual void updateDataStorage() override
Copies the next frame state into the current frame state if the next frame is writable.
Definition: groundVehicleLightingStateComponent.h:162
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:82
void advanceFrame(const DtGroundVehicleLightingStateComponentData &data)
Advances the current frame state to the provided data.
Definition: groundVehicleLightingStateComponent.h:135
bool myEmergencyLightsOn
True if the emergency/hazard lights are on.
Definition: groundVehicleLightingStateComponent.h:51
virtual DtFrameStateInterface * nextFrameState() override
Definition: groundVehicleLightingStateComponent.h:157
DtStateComponentCreator< DtGroundVehicleLightingStateComponentImplementation > DtGroundVehicleLightingStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: groundVehicleLightingStateComponent.h:197
virtual const DtFrameStateInterface * currentFrameState() const override
Definition: groundVehicleLightingStateComponent.h:155
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:513
Holds ground vehicle lighting state, including left/right indicator lights and emergency hazard light...
Definition: groundVehicleLightingStateComponent.h:17
#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
#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.
3) Define the current frame class. This will be used for read access.
Definition: groundVehicleLightingStateComponent.h:114
virtual const DtFrameStateInterface * nextFrameState() const override
Definition: groundVehicleLightingStateComponent.h:159
2) Define the next frame class. This will be used for write access.
Definition: groundVehicleLightingStateComponent.h:73
#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 void updateStateData(DtStateData *sd) override
Updates the state data pointer for both the current and next frame states.
Definition: groundVehicleLightingStateComponent.h:174
DtGroundVehicleLightingStateComponentData myData
Ground vehicle lighting data for the current frame.
Definition: groundVehicleLightingStateComponent.h:142
DtGroundVehicleLightingStateComponentData()
Definition: groundVehicleLightingStateComponent.h:19
DtGroundVehicleLightingStateComponentNextFrame myNextFrameState
Next frame ground vehicle lighting state component (write access).
Definition: groundVehicleLightingStateComponent.h:192
DtGroundVehicleLightingStateComponentData(const DtGroundVehicleLightingStateComponentData &orig)
Definition: groundVehicleLightingStateComponent.h:25
#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
Contains the DtStateComponent class declaration.
DtGroundVehicleLightingStateComponentData & frameState()
Definition: groundVehicleLightingStateComponent.h:84
Base interface for accessing current or next frame state in a double-buffered state component...
Definition: stateComponent.h:354

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)