15 #include <legionDataStore/writeStateInstance.h>
16 #include <legionDataStore/readStateInstance.h>
18 #include <boost/signals2.hpp>
20 #include <vlutil/vlPrint.h>
33 class WriteEntityRepository;
34 class ReadEntityRepository;
39 class SimulationDatabase;
47 class DtStateComponent;
49 class DtFrameStateInterface;
61 SimulatedObjectStateComponent = 0,
62 EntityStateComponent = SimulatedObjectStateComponent,
63 EnvironmentalStateComponent = SimulatedObjectStateComponent,
64 AggregateStateComponent = SimulatedObjectStateComponent,
65 MetocServiceStateComponent = SimulatedObjectStateComponent,
66 AerodromeStateComponent = SimulatedObjectStateComponent,
67 LocationStateComponent = 1,
68 EntityLocationStateComponent = LocationStateComponent,
69 EnvironmentalLocationStateComponent = LocationStateComponent,
70 StaticLocationStateComponent = LocationStateComponent,
71 HumanStateComponent = 2,
72 ArticulatedPartStateComponent = 3,
73 VrfStateComponent = 4,
74 StatePropertiesStateComponent = 5,
75 VrfGeometryStateComponent = 6,
76 SubordinateManagerStateComponent = 7,
77 RangeItemsStateComponent = 8,
78 CloudLayerStateComponent = 9,
79 TimeAndDateStateComponent = 10,
80 WeatherStateComponent = 11,
81 LaserDesignatorStateComponent = 12,
82 EmitterSystemStateComponent = 13,
83 IffStateComponent = 14,
84 ActiveSonarStateComponent = 15,
85 UnderwaterAcousticsStateComponent = 16,
86 SensorFieldOfViewStateComponent = 17,
87 RadioTransmitterStateComponent = 18,
88 TaskVisualizationStateComponent = 19,
89 TacticalSmokeStateComponent = 20,
90 DynamicTerrainStateComponent = 21,
91 RadioReceiverStateComponent = 22,
92 WindCorridorStateComponent = 23,
93 AirTurbulenceStateComponent = 24,
94 NavAidRadioTransmitterStateComponent = 25,
95 AisDataStateComponent = 26,
96 AircraftLightingStateComponent = 27,
97 LandSurfaceStateComponent = 28,
98 WaterSurfaceStateComponent = 29,
99 TroposphereStateComponent = 30,
100 SubsurfaceStateComponent = 31,
101 GroundVehicleLightingStateComponent = 32,
102 UserStateComponent = 64
113 virtual void advanceFrame();
117 virtual StateComponentType typeWithCreator()
const = 0;
118 virtual StateComponentType componentType()
const = 0;
127 virtual void setPublishingOnLegionNetwork(
bool );
130 return myPublishingOnLegionNetwork;
135 myIsRemoteComponent = b;
139 virtual void convertToRemote();
142 virtual void convertToLocal();
146 return myIsRemoteComponent;
153 virtual void completeSetup();
155 virtual void aboutToBeDeleted();
158 virtual void setId(
UInt64 id );
167 return myAdvancedFrame;
171 virtual void firstFrameAdvance();
177 UInt64 legionGlobalId()
const;
196 return myCoordinateSystem;
204 virtual bool isDoubleBuffered()
const;
214 virtual const char* stringType()
const = 0;
228 #define DEFINE_STATE_COMPONENT_TYPE(CreatedComponent) \
229 static const DtStateComponent::StateComponentType theComponentType = CreatedComponent; \
230 static const char* StringType() { return #CreatedComponent; } \
231 virtual DtStateComponent::StateComponentType typeWithCreator() const { return TypeWithCreator(); }; \
232 virtual DtStateComponent::StateComponentType componentType() const { return ComponentType(); }; \
233 virtual const char* stringType() const { return #CreatedComponent; }; \
234 static DtStateComponent::StateComponentType TypeWithCreator() { return (DtStateComponent::StateComponentType)((unsigned int)(theComponentCreatorType << 16) | theComponentType); }; \
235 static void SetCreatorType(UInt32 type) { theComponentCreatorType = type; }; \
236 static DtStateComponent::StateComponentType ComponentType() { return theComponentType; }; \
237 static UInt32 CreatorType() { return theComponentCreatorType; }; \
239 static UInt32 theComponentCreatorType; \
242 #define DEFINE_STATE_COMPONENT_HELPER(Component) \
243 static const char* StringType() { return #Component; } \
244 virtual DtStateComponent::StateComponentType typeWithCreator() const { return Component::TypeWithCreator(); }; \
245 virtual DtStateComponent::StateComponentType componentType() const { return Component::ComponentType(); }; \
246 virtual DtStateComponent::StateComponentType setCreatorType(UInt32 type) const { return SetCreatorType(type); }; \
247 virtual const char* stringType() const { return #Component; }; \
248 static DtStateComponent::StateComponentType TypeWithCreator() { return Component::TypeWithCreator(); }; \
249 static DtStateComponent::StateComponentType ComponentType() { return Component::ComponentType(); }; \
250 static UInt32 SetCreatorType(UInt32 type) { Component::SetCreatorType(type); return type; };
260 virtual void registerLegionComponent( Legion::SimulationDatabase* ) = 0;
261 virtual void addAdditionalTableColumns( Legion::SimulationDatabase* ) = 0;
262 virtual bool autoCreateForRemoteObject()
const = 0;
265 template <
typename T_StateComponent,
bool T_AutoCreateForRemoteObject = true>
274 T_StateComponent::registerLegionComponent( db );
279 T_StateComponent::addAdditionalTableColumns( db );
284 return T_AutoCreateForRemoteObject;
328 signal_componentModified(
this );
338 return myAdvancedFrame;
343 myAdvancedFrame =
true;
347 virtual void convertToRemote();
350 virtual void convertToLocal();
351 virtual void aboutToBeDeleted();
378 template <
typename T_Component>
virtual bool forceAdvance()
Override to force an advance, even if not modified.
Definition: stateComponent.h:200
const DtStateData * stateData() const
Definition: stateComponent.h:179
Instances of DtVrfObjectParameters are the readable/writeable objects that contain the information ne...
Definition: vrfObjectParameters.h:63
unsigned int UInt32
Definition: stateDataTypes.h:18
void emitComponentUpdated()
Definition: stateComponent.h:326
void setLegionGlobalId(UInt64 d)
Definition: stateComponent.h:309
void setId(UInt64 id)
Definition: stateComponent.h:317
virtual const DtFrameStateInterface * currentFrameState() const
Definition: stateComponent.h:205
Definition: stateDataTypes.h:23
const Coordinate_System * coordinateSystem() const
Definition: stateComponent.h:194
virtual bool forceAdvance()
Override to force an advance, even if not modified.
Definition: stateComponent.h:418
UInt64 stateId() const
Definition: stateComponent.h:307
bool myAdvancedFrame
Definition: stateComponent.h:372
virtual Legion::WriteStateInstance writeStateInstance()
Definition: stateComponent.h:208
bool myAdvancedFrame
Definition: stateComponent.h:224
virtual void setIsRemoteComponent(bool b)
Definition: stateComponent.h:133
unsigned int StateComponentType
Definition: stateComponent.h:55
virtual void registerLegionComponent(Legion::SimulationDatabase *db)
Definition: stateComponent.h:272
Definition: stateComponent.h:266
static void registerLegionComponent(Legion::SimulationDatabase *)
Definition: stateComponent.h:441
virtual Legion::WriteStateInstance writeStateInstance()
Definition: stateComponent.h:324
virtual void removeAdditionalStateComponents()
Override this method to destroy any allocated legion extensions that need to be destroyed.
Definition: stateComponent.h:212
boost::signals2::signal< void(const DtFrameStateInterface *)> signal_componentModified
Definition: stateComponent.h:354
virtual void frameAdvanced()
Definition: stateComponent.h:341
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...
Definition: stateComponent.h:390
bool myPublishingOnLegionNetwork
Definition: stateComponent.h:223
bool publishingOnLegionNetwork() const
Definition: stateComponent.h:128
bool isWritable() const
Definition: stateComponent.h:305
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:165
virtual void advanceFrame()
Definition: stateComponent.h:419
void clearModified()
Definition: stateComponent.h:311
virtual void setStateData(DtStateData *sd)
Call with care. This will only succeed if the current state data is nullptr, else it will no-op...
Definition: stateComponent.h:405
boost::signals2::signal< void(DtFrameStateInterface *)> signal_stateComponentAboutToBeDeleted
Definition: stateComponent.h:353
boost::signals2::signal< void(DtStateComponent *)> signal_stateComponentAboutToBeDeleted
Definition: stateComponent.h:120
virtual void makeWritable()
Override to make component writable.
Definition: stateComponent.h:359
virtual UInt64 id() const
Definition: stateComponent.h:318
bool cleared() const
Definition: stateComponent.h:331
Definition: coordSystem.h:54
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:339
#define DEFINE_STATE_COMPONENT_HELPER(Component)
Definition: stateComponent.h:242
void markModified()
Definition: stateComponent.h:312
UInt64 legionGlobalId() const
Definition: stateComponent.h:308
virtual bool autoCreateForRemoteObject() const
Definition: stateComponent.h:282
bool myIsWritable
Definition: stateComponent.h:370
DtStateData * stateData()
Definition: stateComponent.h:189
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:379
DtStateData * myStateData
Definition: stateComponent.h:219
UInt64 myStateId
Definition: stateComponent.h:368
virtual DtStateComponent::StateComponentType type() const
Definition: stateComponent.h:314
virtual void updateDataStorage()=0
Implement to update data storage. Called from advanceFrame.
unsigned long long UInt64
Definition: stateDataTypes.h:17
The creator that is used to create a state component.
Definition: stateComponent.h:253
virtual void addAdditionalTableColumns(Legion::SimulationDatabase *db)
Definition: stateComponent.h:277
StateComponentTypeEnum
List of all current state components. User components start at the UserStateComponent enum...
Definition: stateComponent.h:58
virtual DtStateComponent * create(DtStateData *sd)
Definition: stateComponent.h:270
virtual const DtFrameStateInterface * nextFrameState() const
Definition: stateComponent.h:207
bool myCleared
Definition: stateComponent.h:222
Definition: stateComponent.h:51
bool isRemoteComponent() const
Definition: stateComponent.h:144
void setIsWritable(bool b)
Definition: stateComponent.h:304
UInt64 myLegionId
Definition: stateComponent.h:369
virtual Legion::ReadStateInstance readStateInstance() const
If supported, the read or write state legion instance of this component.
Definition: stateComponent.h:323
bool advancedFrame() const
Definition: stateComponent.h:336
#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:160
virtual void updateStateData(DtStateData *)=0
Implement to update data storage to the new state data.
const Coordinate_System * myCoordinateSystem
Definition: stateComponent.h:220
virtual bool isDoubleBuffered() const
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:415
bool myCleared
Definition: stateComponent.h:371
virtual void addAdditionalStateComponents()
Definition: stateComponent.h:209
virtual DtFrameStateInterface * nextFrameState()
Definition: stateComponent.h:206
bool cleared() const
Definition: stateComponent.h:184
static void addAdditionalTableColumns(Legion::SimulationDatabase *)
Definition: stateComponent.h:442
This is a simple base class that will be used to return a pointer to current or next frame state...
Definition: stateComponent.h:291
UInt64 myId
Definition: stateComponent.h:367
UInt64 myId
Definition: stateComponent.h:218
bool myIsRemoteComponent
Definition: stateComponent.h:221
bool isModified() const
Definition: stateComponent.h:310
boost::signals2::signal< void(DtStateComponent *)> signal_componentModified
Definition: stateComponent.h:121
virtual void setStateData(DtStateData *)
Call with care. This will only succeed if the current state data is nullptr, else it will no-op...