15 #include <legionDataStore/writeStateInstance.h>
16 #include <legionDataStore/readStateInstance.h>
18 #include <boost/signals2.hpp>
20 #include <vlutil/vlPrint.h>
21 #include <vlpi/simulationAddress.h>
34 class WriteEntityRepository;
35 class ReadEntityRepository;
40 class SimulationDatabase;
48 class DtStateComponent;
50 class DtFrameStateInterface;
62 SimulatedObjectStateComponent = 0,
63 EntityStateComponent = SimulatedObjectStateComponent,
64 EnvironmentalStateComponent = SimulatedObjectStateComponent,
65 AggregateStateComponent = SimulatedObjectStateComponent,
66 MetocServiceStateComponent = SimulatedObjectStateComponent,
67 AerodromeStateComponent = SimulatedObjectStateComponent,
68 SpotReportStateComponent = SimulatedObjectStateComponent,
69 OrbatStateComponent = SimulatedObjectStateComponent,
70 LocationStateComponent = 1,
71 EntityLocationStateComponent = LocationStateComponent,
72 EnvironmentalLocationStateComponent = LocationStateComponent,
73 StaticLocationStateComponent = LocationStateComponent,
74 HumanStateComponent = 2,
75 ArticulatedPartStateComponent = 3,
76 VrfStateComponent = 4,
77 StatePropertiesStateComponent = 5,
78 VrfGeometryStateComponent = 6,
79 SubordinateManagerStateComponent = 7,
80 RangeItemsStateComponent = 8,
81 CloudLayerStateComponent = 9,
82 TimeAndDateStateComponent = 10,
83 WeatherStateComponent = 11,
84 LaserDesignatorStateComponent = 12,
85 EmitterSystemStateComponent = 13,
86 IffStateComponent = 14,
87 ActiveSonarStateComponent = 15,
88 UnderwaterAcousticsStateComponent = 16,
89 SensorFieldOfViewStateComponent = 17,
90 RadioTransmitterStateComponent = 18,
91 TaskVisualizationStateComponent = 19,
92 TacticalSmokeStateComponent = 20,
93 DynamicTerrainStateComponent = 21,
94 RadioReceiverStateComponent = 22,
95 WindCorridorStateComponent = 23,
96 AirTurbulenceStateComponent = 24,
97 NavAidRadioTransmitterStateComponent = 25,
98 AisDataStateComponent = 26,
99 AircraftLightingStateComponent = 27,
100 LandSurfaceStateComponent = 28,
101 WaterSurfaceStateComponent = 29,
102 TroposphereStateComponent = 30,
103 SubsurfaceStateComponent = 31,
104 GroundVehicleLightingStateComponent = 32,
105 UserStateComponent = 64
116 virtual void advanceFrame();
120 virtual StateComponentType typeWithCreator()
const = 0;
121 virtual StateComponentType componentType()
const = 0;
130 virtual void setPublishingOnLegionNetwork(
bool );
133 return myPublishingOnLegionNetwork;
138 myIsRemoteComponent = b;
142 virtual void convertToRemote();
145 virtual void convertToLocal();
149 return myIsRemoteComponent;
156 virtual void completeSetup();
158 virtual void aboutToBeDeleted();
161 virtual void setId(
UInt64 id );
170 return myAdvancedFrame;
174 virtual void firstFrameAdvance();
180 UInt64 legionGlobalId()
const;
199 return myCoordinateSystem;
207 virtual bool isDoubleBuffered()
const;
217 virtual const char* stringType()
const = 0;
231 #define DEFINE_STATE_COMPONENT_TYPE(CreatedComponent) \
232 constexpr static DtStateComponent::StateComponentType theComponentType = CreatedComponent; \
233 constexpr static const char* StringType() { return #CreatedComponent; } \
234 virtual DtStateComponent::StateComponentType typeWithCreator() const { return TypeWithCreator(); }; \
235 virtual DtStateComponent::StateComponentType componentType() const override { return ComponentType(); }; \
236 virtual const char* stringType() const override { return #CreatedComponent; }; \
237 static DtStateComponent::StateComponentType TypeWithCreator() { return (DtStateComponent::StateComponentType)((unsigned int)(theComponentCreatorType << 16) | theComponentType); }; \
238 static void SetCreatorType(UInt32 type) { theComponentCreatorType = type; }; \
239 constexpr static DtStateComponent::StateComponentType ComponentType() { return theComponentType; }; \
240 static UInt32 CreatorType() { return theComponentCreatorType; }; \
242 static UInt32 theComponentCreatorType; \
245 #define DEFINE_STATE_COMPONENT_HELPER(Component) \
246 static const char* StringType() { return #Component; } \
247 virtual DtStateComponent::StateComponentType typeWithCreator() const { return Component::TypeWithCreator(); }; \
248 virtual DtStateComponent::StateComponentType componentType() const override { return Component::ComponentType(); }; \
249 virtual DtStateComponent::StateComponentType setCreatorType(UInt32 type) const { return SetCreatorType(type); }; \
250 virtual const char* stringType() const { return #Component; }; \
251 constexpr static DtStateComponent::StateComponentType TypeWithCreator() { return Component::TypeWithCreator(); }; \
252 constexpr static DtStateComponent::StateComponentType ComponentType() { return Component::ComponentType(); }; \
253 static UInt32 SetCreatorType(UInt32 type) { Component::SetCreatorType(type); return type; };
263 virtual void registerLegionComponent( Legion::SimulationDatabase* ) = 0;
264 virtual void addAdditionalTableColumns( Legion::SimulationDatabase* ) = 0;
265 virtual bool autoCreateForRemoteObject()
const = 0;
268 template <
typename T_StateComponent,
bool T_AutoCreateForRemoteObject = true>
277 T_StateComponent::registerLegionComponent(db);
282 T_StateComponent::addAdditionalTableColumns(db);
287 return T_AutoCreateForRemoteObject;
315 virtual void markModified();
320 virtual const char* stringType()
const = 0;
334 signal_componentModified(
this );
344 return myAdvancedFrame;
349 myAdvancedFrame =
true;
353 virtual void convertToRemote();
356 virtual void convertToLocal();
357 virtual void aboutToBeDeleted();
383 template <
typename T_Component>
unsigned int StateComponentType
Definition: stateComponent.h:56
virtual bool forceAdvance()
Override to force an advance, even if not modified.
Definition: stateComponent.h:203
const DtStateData * stateData() const
Definition: stateComponent.h:182
Instances of DtVrfObjectParameters are the readable/writeable objects that contain the information ne...
Definition: vrfObjectParameters.h:64
void emitComponentUpdated()
Definition: stateComponent.h:332
void setLegionGlobalId(UInt64 d)
Definition: stateComponent.h:312
void setId(UInt64 id)
Definition: stateComponent.h:323
virtual const DtFrameStateInterface * currentFrameState() const
Definition: stateComponent.h:208
Definition: stateDataTypes.h:23
const Coordinate_System * coordinateSystem() const
Definition: stateComponent.h:197
virtual void advanceFrame() override
Definition: stateComponent.h:424
virtual void addAdditionalTableColumns(Legion::SimulationDatabase *db) override
Definition: stateComponent.h:280
UInt64 stateId() const
Definition: stateComponent.h:310
bool myAdvancedFrame
Definition: stateComponent.h:377
virtual Legion::WriteStateInstance writeStateInstance()
Definition: stateComponent.h:211
bool myAdvancedFrame
Definition: stateComponent.h:227
virtual void setIsRemoteComponent(bool b)
Definition: stateComponent.h:136
unsigned int UInt32
Definition: stateDataTypes.h:18
Definition: stateComponent.h:269
static void registerLegionComponent(Legion::SimulationDatabase *)
Definition: stateComponent.h:446
virtual Legion::WriteStateInstance writeStateInstance()
Definition: stateComponent.h:330
virtual void removeAdditionalStateComponents()
Override this method to destroy any allocated legion extensions that need to be destroyed.
Definition: stateComponent.h:215
virtual bool isDoubleBuffered() const override
Returns true if this item implements the nextFrameState()/currentFrameState methods. If this returns false and you call the nextFrameState()/currentFrameState an exception will be thrown.
Definition: stateComponent.h:420
boost::signals2::signal< void(const DtFrameStateInterface *)> signal_componentModified
Definition: stateComponent.h:360
virtual void frameAdvanced()
Definition: stateComponent.h:347
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
bool myPublishingOnLegionNetwork
Definition: stateComponent.h:226
bool publishingOnLegionNetwork() const
Definition: stateComponent.h:131
unsigned long long UInt64
Definition: stateDataTypes.h:17
bool isWritable() const
Definition: stateComponent.h:308
virtual void setId(UInt64 id)
If this component is part of a list and needs to be uniquely identified, this wil be that unique id...
bool advancedFrame() const
Definition: stateComponent.h:168
virtual bool autoCreateForRemoteObject() const override
Definition: stateComponent.h:285
boost::signals2::signal< void(DtFrameStateInterface *)> signal_stateComponentAboutToBeDeleted
Definition: stateComponent.h:359
boost::signals2::signal< void(DtStateComponent *)> signal_stateComponentAboutToBeDeleted
Definition: stateComponent.h:123
virtual void makeWritable()
Override to make component writable.
Definition: stateComponent.h:365
virtual UInt64 id() const
Definition: stateComponent.h:324
bool cleared() const
Definition: stateComponent.h:337
Definition: coordSystem.h:54
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:398
#define DEFINE_STATE_COMPONENT_HELPER(Component)
Definition: stateComponent.h:245
UInt64 legionGlobalId() const
Definition: stateComponent.h:311
bool myIsWritable
Definition: stateComponent.h:375
DtStateData * stateData()
Definition: stateComponent.h:192
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:384
DtStateData * myStateData
Definition: stateComponent.h:222
UInt64 myStateId
Definition: stateComponent.h:373
virtual DtStateComponent::StateComponentType type() const
Definition: stateComponent.h:317
virtual void updateDataStorage()=0
Implement to update data storage. Called from advanceFrame.
virtual bool isModified() const
Definition: stateComponent.h:313
The creator that is used to create a state component.
Definition: stateComponent.h:256
StateComponentTypeEnum
List of all current state components. User components start at the UserStateComponent enum...
Definition: stateComponent.h:59
virtual const DtFrameStateInterface * nextFrameState() const
Definition: stateComponent.h:210
virtual void setId(UInt64 id) override
If this component is part of a list and needs to be uniquely identified, this wil be that unique id...
Definition: stateComponent.h:395
bool myCleared
Definition: stateComponent.h:225
virtual void markModified()
Definition: stateComponent.h:52
virtual void registerLegionComponent(Legion::SimulationDatabase *db) override
Definition: stateComponent.h:275
bool isRemoteComponent() const
Definition: stateComponent.h:147
void setIsWritable(bool b)
Definition: stateComponent.h:307
UInt64 myLegionId
Definition: stateComponent.h:374
virtual void clearModified()
Definition: stateComponent.h:314
virtual Legion::ReadStateInstance readStateInstance() const
If supported, the read or write state legion instance of this component.
Definition: stateComponent.h:329
bool advancedFrame() const
Definition: stateComponent.h:342
#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
virtual UInt64 id() const
Definition: stateComponent.h:163
virtual void updateStateData(DtStateData *)=0
Implement to update data storage to the new state data.
const Coordinate_System * myCoordinateSystem
Definition: stateComponent.h:223
bool myCleared
Definition: stateComponent.h:376
virtual DtStateComponent * create(DtStateData *sd) override
Definition: stateComponent.h:273
virtual void addAdditionalStateComponents()
Definition: stateComponent.h:212
DtStateData * myStateData
Definition: stateComponent.h:378
virtual DtFrameStateInterface * nextFrameState()
Definition: stateComponent.h:209
bool cleared() const
Definition: stateComponent.h:187
virtual bool forceAdvance() override
Override to force an advance, even if not modified.
Definition: stateComponent.h:423
static void addAdditionalTableColumns(Legion::SimulationDatabase *)
Definition: stateComponent.h:447
This is a simple base class that will be used to return a pointer to current or next frame state...
Definition: stateComponent.h:294
UInt64 myId
Definition: stateComponent.h:372
UInt64 myId
Definition: stateComponent.h:221
bool myIsRemoteComponent
Definition: stateComponent.h:224
virtual void setStateData(DtStateData *sd) override
Call with care. This will only succeed if the current state data is nullptr, else it will no-op...
Definition: stateComponent.h:410
boost::signals2::signal< void(DtStateComponent *)> signal_componentModified
Definition: stateComponent.h:124
virtual void setStateData(DtStateData *)
Call with care. This will only succeed if the current state data is nullptr, else it will no-op...