10 #include <vlpi/netStructs.h>
11 #include <vlutil/vlString.h>
13 #include "legionDataStore/writeStateInstance.h"
14 #include "legionDataStore/readStateInstance.h"
15 #include "vrfOM/sets/writeSimulationDateTimeRepository.hpp"
16 #include "vrfOM/sets/readSimulationDateTimeRepository.hpp"
31 myUpdateWhenTimeChangedBy = 60.;
32 myDateAndTimeOfDay = 43200.0;
33 myNetworkDateAndTimeOfDay = 0.;
59 return (myDateAndTimeOfDay != 43200.0);
68 double myUpdateWhenTimeChangedBy;
70 double myDateAndTimeOfDay;
72 double myNetworkDateAndTimeOfDay;
85 : DtFrameStateInterface(storage)
101 virtual void setDateAndTimeOfDay(
const double&,
bool markModified =
false) {
throw DtUnimplementedMethod(
"void setDateAndTimeOfDay(double, bool markModified = false) is not implemented for this class."); };
132 virtual const double dateAndTimeOfDay()
const override;
135 virtual void setDateAndTimeOfDay(
const double&,
bool markModified =
false)
override;
138 virtual const double networkDateAndTimeOfDay()
const override;
140 virtual void setNetworkDateAndTimeOfDay(
const double&)
override;
143 virtual const double updateWhenTimeChangedBy()
const override;
145 virtual void setUpdateWhenTimeChangedBy(
const double&)
override;
148 virtual const double timeOfDayAdvancementSpeed()
const override;
150 virtual void setTimeOfDayAdvancementSpeed(
const double&)
override;
153 virtual const bool useDayNightIlluminationModel()
const override;
155 virtual void setUseDayNightIlluminationModel(
const bool&)
override;
158 virtual void setTimeToLocalOnFirstPlacement(
const bool&)
override;
159 virtual const bool timeToLocalOnFirstPlacement()
const override;
162 virtual void setUserModifiedTime(
const bool&)
override;
163 virtual const bool userModifiedTime()
const override;
166 virtual void setAlreadySetTimePlacement(
const bool&)
override;
167 virtual const bool alreadySetTimePlacement()
const override;
170 virtual void setCanSetScenarioPreStartTime(
const bool&)
override;
171 virtual const bool canSetScenarioPreStartTime()
const override;
174 virtual const DtString timeOfDayString()
const override;
177 virtual void setTimeOfDay(
const double& value)
override;
180 virtual const double timeOfDay()
const override;
183 virtual void makeWritable()
override;
186 virtual void makeReadOnly()
override;
209 bool readComponentValid()
const;
212 bool findReadComponent();
214 virtual const double updateWhenTimeChangedBy()
const override;
215 virtual const double dateAndTimeOfDay()
const override;
216 virtual const double networkDateAndTimeOfDay()
const override;
217 virtual const double timeOfDayAdvancementSpeed()
const override;
218 virtual const bool useDayNightIlluminationModel()
const override;
219 virtual const DtString timeOfDayString()
const override;
220 virtual const bool timeToLocalOnFirstPlacement()
const override;
221 virtual const bool userModifiedTime()
const override;
224 virtual const bool alreadySetTimePlacement()
const override;
226 virtual const bool canSetScenarioPreStartTime()
const override;
227 virtual const double timeOfDay()
const override;
231 void dateAndTimeOfDayChanged();
269 virtual void updateDataStorage()
override;
275 myCurrentFrameState.updateStateData(sd);
276 myNextFrameState.updateStateData(sd);
280 virtual bool forceAdvance()
override;
283 virtual void firstFrameAdvance()
override;
293 myCurrentFrameState.aboutToBeDeleted();
294 myNextFrameState.aboutToBeDeleted();
UUID is a unique ID wrapper class.
Definition: uuid.h:59
Instances of DtVrfObjectParameters are the readable/writeable objects that contain the information ne...
Definition: vrfObjectParameters.h:64
bool dateAndTimeOfDayHasBeenSet() const
Definition: timeAndDateStateComponent.h:57
Exception thrown when a required method has not been implemented.
Definition: stateDataTypes.h:30
DtTimeAndDateStateComponentData myData
Current-frame data storage for this component.
Definition: timeAndDateStateComponent.h:247
bool myFoundComponent
True once the Legion read repository component has been successfully located.
Definition: timeAndDateStateComponent.h:303
Definition: stateComponent.h:82
DtTimeAndDateStateComponentData(const DtTimeAndDateStateComponentData &orig)
Copy constructor.
Definition: timeAndDateStateComponent.h:38
2) Define the next frame class. This will be used for write access.
Definition: timeAndDateStateComponent.h:120
DtTimeAndDateStateComponentData & operator=(const DtTimeAndDateStateComponentData &rhs)
Assignment operator.
Definition: timeAndDateStateComponent.h:48
Default creator implementation for a state component type. T_StateComponent is the concrete component...
Definition: stateComponent.h:326
virtual void aboutToBeDeleted() override
Notifies both frame sub-components that the owning object is about to be destroyed.
Definition: timeAndDateStateComponent.h:290
unsigned int myCallbackHandle
Handle for the registered date/time update callback; 0 if not registered.
Definition: timeAndDateStateComponent.h:245
3) Define the current frame class. This will be used for read access.
Definition: timeAndDateStateComponent.h:196
void advanceFrame(const DtTimeAndDateStateComponentData &data)
Commits the given next-frame state data into the current frame buffer.
Definition: timeAndDateStateComponent.h:236
DtTimeAndDateStateComponentData()
Default constructor; initializes date/time to noon (43200s since epoch) with a 60-second network upda...
Definition: timeAndDateStateComponent.h:29
#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.
double myUpdateWhenTimeChangedBy
Minimum elapsed time in seconds before broadcasting a date/time update to the network.
Definition: timeAndDateStateComponent.h:68
virtual DtFrameStateInterface * nextFrameState() override
Definition: timeAndDateStateComponent.h:264
DtStateComponentCreator< DtTimeAndDateStateComponentImplementation > DtTimeAndDateStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: timeAndDateStateComponent.h:308
const DtTimeAndDateStateComponentData & frameState() const
Current frame state only can access current frame buffers. This ensures thread safety.
Definition: timeAndDateStateComponent.h:206
double myDateAndTimeOfDay
Current dead-reckoned date and time of day, in seconds since epoch.
Definition: timeAndDateStateComponent.h:70
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: timeAndDateStateComponent.h:77
DtTimeAndDateStateComponentNextFrame myNextFrameState
Next-frame (writable) sub-component for time and date state.
Definition: timeAndDateStateComponent.h:301
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
Contains the enums for cloud layers.
DtTimeAndDateStateComponentData & frameState()
Definition: timeAndDateStateComponent.h:129
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
double myNetworkDateAndTimeOfDay
Exact date and time of day as last received from the network; 0 if no network value is present...
Definition: timeAndDateStateComponent.h:72
virtual void aboutToBeDeleted()
Called when the component is about to be deleted; emits signal_stateComponentAboutToBeDeleted.
virtual const DtFrameStateInterface * nextFrameState() const override
Definition: timeAndDateStateComponent.h:266
virtual void updateStateData(DtStateData *sd) override
Updates the owning DtStateData pointer in both current and next frame sub-components.
Definition: timeAndDateStateComponent.h:273
DtTimeAndDateStateComponentCurrentFrame myCurrentFrameState
Current-frame (read-only) sub-component for time and date state.
Definition: timeAndDateStateComponent.h:299
#define DEFINE_ACCESSOR_MUTATOR(ReturnType, Accessor, Mutator)
Defines a const reference accessor and an inline setter for a member variable.
Definition: doubleBufferedDataStorage.h:37
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: timeAndDateStateComponent.h:252
VRF::WriteSimulationDateTimeRepository myWriteSimulationDateTimeRepository
Write-access Legion repository for publishing simulation date/time updates.
Definition: timeAndDateStateComponent.h:190
DtTimeAndDateStateComponentData myData
Next-frame data storage for this component.
Definition: timeAndDateStateComponent.h:192
virtual const DtFrameStateInterface * currentFrameState() const override
Definition: timeAndDateStateComponent.h:262
static DtUUID DtGlobalWeatherObjectUUID("VRF_UUID:73666f77-63d6-e041-a002-f2690e990574")
UUID identifying the global weather object used as a shared reference across VRF simulation objects...
#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
VRF::ReadSimulationDateTimeRepository myReadSimulationDateTimeRepository
Read-access Legion repository for receiving simulation date/time updates.
Definition: timeAndDateStateComponent.h:243
dateAndTimeOfDay is a possible dead reckoned date and time of day. networkDateAndTimeOfDay is the exa...
Definition: timeAndDateStateComponent.h:26
Contains the DtStateComponent class declaration.
bool isDoubleBuffered()
Definition: timeAndDateStateComponent.h:260
Base interface for accessing current or next frame state in a double-buffered state component...
Definition: stateComponent.h:354
const DtTimeAndDateStateComponentData & frameState() const
Next frame access write access. Ensure this is only used in a single thread (i.e.a controller thread)...
Definition: timeAndDateStateComponent.h:128