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 LocationStateComponent = 1,
67 EntityLocationStateComponent = LocationStateComponent,
68 EnvironmentalLocationStateComponent = LocationStateComponent,
69 HumanStateComponent = 2,
70 ArticulatedPartStateComponent = 3,
71 VrfStateComponent = 4,
72 StatePropertiesStateComponent = 5,
73 VrfGeometryStateComponent = 6,
74 SubordinateManagerStateComponent = 7,
75 RangeItemsStateComponent = 8,
76 CloudLayerStateComponent = 9,
77 GlobalEnvironmentStateComponent = 10,
78 WeatherStateComponent = 11,
79 LaserDesignatorStateComponent = 12,
80 EmitterSystemStateComponent = 13,
81 IffStateComponent = 14,
82 ActiveSonarStateComponent = 15,
83 UnderwaterAcousticsStateComponent = 16,
84 SensorFieldOfViewStateComponent = 17,
85 RadioTransmitterStateComponent = 18,
86 TaskVisualizationStateComponent = 19,
87 TacticalSmokeStateComponent = 20,
88 DynamicTerrainStateComponent = 21,
89 RadioReceiverStateComponent = 22,
90 WindCorridorStateComponent = 23,
91 AirTurbulenceStateComponent = 24,
92 NavAidRadioTransmitterStateComponent = 25,
93 UserStateComponent = 64
104 virtual void advanceFrame();
108 virtual StateComponentType typeWithCreator()
const = 0;
109 virtual StateComponentType componentType()
const = 0;
118 virtual void setPublishingOnLegionNetwork(
bool );
121 return myPublishingOnLegionNetwork;
126 myIsRemoteComponent = b;
130 virtual void convertToRemote();
133 virtual void convertToLocal();
137 return myIsRemoteComponent;
144 virtual void completeSetup();
146 virtual void aboutToBeDeleted();
149 virtual void setId(
UInt64 id );
158 return myAdvancedFrame;
162 virtual void firstFrameAdvance();
168 UInt64 legionGlobalId()
const;
187 return myCoordinateSystem;
195 virtual bool isDoubleBuffered()
const;
205 virtual const char* stringType()
const = 0;
219 #define DEFINE_STATE_COMPONENT_TYPE(CreatedComponent) \
220 static const DtStateComponent::StateComponentType theComponentType = CreatedComponent; \
221 static const char* StringType() { return #CreatedComponent; } \
222 virtual DtStateComponent::StateComponentType typeWithCreator() const { return TypeWithCreator(); }; \
223 virtual DtStateComponent::StateComponentType componentType() const { return ComponentType(); }; \
224 virtual const char* stringType() const { return #CreatedComponent; }; \
225 static DtStateComponent::StateComponentType TypeWithCreator() { return (DtStateComponent::StateComponentType)((unsigned int)(theComponentCreatorType << 16) | theComponentType); }; \
226 static void SetCreatorType(UInt32 type) { theComponentCreatorType = type; }; \
227 static DtStateComponent::StateComponentType ComponentType() { return theComponentType; }; \
228 static UInt32 CreatorType() { return theComponentCreatorType; }; \
230 static UInt32 theComponentCreatorType; \
233 #define DEFINE_STATE_COMPONENT_HELPER(Component) \
234 static const char* StringType() { return #Component; } \
235 virtual DtStateComponent::StateComponentType typeWithCreator() const { return Component::TypeWithCreator(); }; \
236 virtual DtStateComponent::StateComponentType componentType() const { return Component::ComponentType(); }; \
237 virtual DtStateComponent::StateComponentType setCreatorType(UInt32 type) const { return SetCreatorType(type); }; \
238 virtual const char* stringType() const { return #Component; }; \
239 static DtStateComponent::StateComponentType TypeWithCreator() { return Component::TypeWithCreator(); }; \
240 static DtStateComponent::StateComponentType ComponentType() { return Component::ComponentType(); }; \
241 static UInt32 SetCreatorType(UInt32 type) { Component::SetCreatorType(type); return type; };
251 virtual void registerLegionComponent( Legion::SimulationDatabase* ) = 0;
252 virtual void addAdditionalTableColumns( Legion::SimulationDatabase* ) = 0;
253 virtual bool autoCreateForRemoteObject()
const = 0;
256 template <
typename T_StateComponent,
bool T_AutoCreateForRemoteObject = true>
265 T_StateComponent::registerLegionComponent( db );
270 T_StateComponent::addAdditionalTableColumns( db );
275 return T_AutoCreateForRemoteObject;
319 signal_componentModified(
this );
324 return myAdvancedFrame;
329 myAdvancedFrame =
true;
333 virtual void convertToRemote();
336 virtual void convertToLocal();
337 virtual void aboutToBeDeleted();
364 template <
typename T_Component>
virtual bool forceAdvance()
Override to force an advance, even if not modified.
Definition: stateComponent.h:191
const DtStateData * stateData() const
Definition: stateComponent.h:170
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:317
void setLegionGlobalId(UInt64 d)
Definition: stateComponent.h:300
void setId(UInt64 id)
Definition: stateComponent.h:308
virtual const DtFrameStateInterface * currentFrameState() const
Definition: stateComponent.h:196
Definition: stateDataTypes.h:23
const Coordinate_System * coordinateSystem() const
Definition: stateComponent.h:185
virtual bool forceAdvance()
Override to force an advance, even if not modified.
Definition: stateComponent.h:404
UInt64 stateId() const
Definition: stateComponent.h:298
bool myAdvancedFrame
Definition: stateComponent.h:358
virtual Legion::WriteStateInstance writeStateInstance()
Definition: stateComponent.h:199
bool myAdvancedFrame
Definition: stateComponent.h:215
unsigned int StateComponentType
Definition: stateComponent.h:55
virtual void registerLegionComponent(Legion::SimulationDatabase *db)
Definition: stateComponent.h:263
Definition: stateComponent.h:257
static void registerLegionComponent(Legion::SimulationDatabase *)
Definition: stateComponent.h:427
virtual Legion::WriteStateInstance writeStateInstance()
Definition: stateComponent.h:315
virtual void removeAdditionalStateComponents()
Override this method to destroy any allocated legion extensions that need to be destroyed.
Definition: stateComponent.h:203
boost::signals2::signal< void(const DtFrameStateInterface *)> signal_componentModified
Definition: stateComponent.h:340
virtual void frameAdvanced()
Definition: stateComponent.h:327
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:376
bool myPublishingOnLegionNetwork
Definition: stateComponent.h:214
bool publishingOnLegionNetwork() const
Definition: stateComponent.h:119
bool isWritable() const
Definition: stateComponent.h:296
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:156
virtual void advanceFrame()
Definition: stateComponent.h:405
void clearModified()
Definition: stateComponent.h:302
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:391
boost::signals2::signal< void(DtFrameStateInterface *)> signal_stateComponentAboutToBeDeleted
Definition: stateComponent.h:339
boost::signals2::signal< void(DtStateComponent *)> signal_stateComponentAboutToBeDeleted
Definition: stateComponent.h:111
virtual void makeWritable()
Override to make component writable.
Definition: stateComponent.h:345
void setIsRemoteComponent(bool b)
Definition: stateComponent.h:124
virtual UInt64 id() const
Definition: stateComponent.h:309
Definition: coordSystem.h:54
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:336
#define DEFINE_STATE_COMPONENT_HELPER(Component)
Definition: stateComponent.h:233
void markModified()
Definition: stateComponent.h:303
UInt64 legionGlobalId() const
Definition: stateComponent.h:299
virtual bool autoCreateForRemoteObject() const
Definition: stateComponent.h:273
bool myIsWritable
Definition: stateComponent.h:356
DtStateData * stateData()
Definition: stateComponent.h:180
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:365
DtStateData * myStateData
Definition: stateComponent.h:210
UInt64 myStateId
Definition: stateComponent.h:354
virtual DtStateComponent::StateComponentType type() const
Definition: stateComponent.h:305
virtual void updateDataStorage()=0
Implement to update data storage. Called from advanceFrame.
The creator that is used to create a state component.
Definition: stateComponent.h:244
virtual void addAdditionalTableColumns(Legion::SimulationDatabase *db)
Definition: stateComponent.h:268
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:261
virtual const DtFrameStateInterface * nextFrameState() const
Definition: stateComponent.h:198
bool myCleared
Definition: stateComponent.h:213
Definition: stateComponent.h:51
bool isRemoteComponent() const
Definition: stateComponent.h:135
void setIsWritable(bool b)
Definition: stateComponent.h:295
UInt64 myLegionId
Definition: stateComponent.h:355
virtual Legion::ReadStateInstance readStateInstance() const
If supported, the read or write state legion instance of this component.
Definition: stateComponent.h:314
bool advancedFrame() const
Definition: stateComponent.h:322
#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:151
virtual void updateStateData(DtStateData *)=0
Implement to update data storage to the new state data.
const Coordinate_System * myCoordinateSystem
Definition: stateComponent.h:211
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:401
bool myCleared
Definition: stateComponent.h:357
virtual void addAdditionalStateComponents()
Definition: stateComponent.h:200
virtual DtFrameStateInterface * nextFrameState()
Definition: stateComponent.h:197
bool cleared() const
Definition: stateComponent.h:175
static void addAdditionalTableColumns(Legion::SimulationDatabase *)
Definition: stateComponent.h:428
This is a simple base class that will be used to return a pointer to current or next frame state...
Definition: stateComponent.h:282
UInt64 myId
Definition: stateComponent.h:353
UInt64 myId
Definition: stateComponent.h:209
bool myIsRemoteComponent
Definition: stateComponent.h:212
bool isModified() const
Definition: stateComponent.h:301
boost::signals2::signal< void(DtStateComponent *)> signal_componentModified
Definition: stateComponent.h:112
virtual void setStateData(DtStateData *)
Call with care. This will only succeed if the current state data is nullptr, else it will no-op...