10 #include <vlpi/disEnums.h>
11 #include <legionStandardOM/sets/writeEntityRepository.hpp>
12 #include "legionStandardOM/sets/readEntityRepository.hpp"
13 #include "legionDataStore/view.h"
14 #include <tbb/spin_mutex.h>
18 class ReadEntityRepository;
30 : myUUID(
DtUUID::nullUUID())
32 , myCheckForNameReservation(true)
36 : myGlobalId(orig.myGlobalId)
38 , myMarkingText(orig.myMarkingText)
39 , myCallsign(orig.myCallsign)
40 , myEntityId(orig.myEntityId)
41 , myIsLocal(orig.myIsLocal)
42 , myUserData(orig.myUserData)
43 , myOrbatId(orig.myOrbatId)
44 , myCheckForNameReservation(orig.myCheckForNameReservation)
45 , mySimEngineAddress(orig.mySimEngineAddress)
78 DtString myMarkingText;
80 DtEntityIdentifier myEntityId;
83 unsigned long long myUserData = 0;
84 unsigned long long myOrbatId = 0;
85 bool myCheckForNameReservation;
86 DtSimulationAddress mySimEngineAddress;
97 : DtSimulatedObjectStateComponent(storage)
98 , myUUIDColumn(0xFFFFFFFF)
99 , myIsClutterEntityColumn(0xFFFFFFFF)
109 virtual const std::set<DtUUID> attachments()
const {
throw DtUnimplementedMethod(
"std::set<DtUUID> attachments() is not implemented for this class."); };
112 virtual void removeAttachment(
const DtUUID&) {
throw DtUnimplementedMethod(
"void removeAttachment(const DtUUID&) is not implemented for this class."); };
114 mutable boost::signals2::signal<void (int oldState, int newState, makVrf::SimStateID)> signal_damageStateChanged;
126 template <
typename T_BaseComponent>
137 const bool& isLocal()
const;
138 void setIsLocal(
const bool&);
140 const bool& checkForNameReservation()
const;
141 void setCheckForNameReservation(
const bool&);
146 const DtUUID& uuid()
const;
147 void setUUID(
const DtUUID&);
149 const bool isClutterEntity()
const;
150 void setIsClutterEntity(
const bool&);
152 const DtString& markingText()
const;
153 void setMarkingText(
const DtString&);
158 const DtForceType forceType()
const;
159 void setForceType(
const DtForceType&);
161 const UInt32 appearanceBits()
const;
162 void setAppearanceBits(
const UInt32&);
164 const DtEntityType
entityType()
const {
return objectType(); };
165 const DtEntityType objectType()
const;
166 void setEntityType(
const DtEntityType&);
168 const DtEntityIdentifier& entityId()
const;
169 void setEntityId(
const DtEntityIdentifier&);
171 const UInt32 capabilities()
const;
172 void setCapabilities(
const UInt32&);
174 const DtEntityType guise()
const;
175 void setGuise(
const DtEntityType&);
178 const DtUUID& superior()
const;
179 void setSuperior(
const DtUUID&);
181 const unsigned long long userLongLongData()
const;
182 void setUserLongLongData(
const unsigned long long&);
184 const unsigned long long orbatId()
const;
185 void setOrbatId(
const unsigned long long&);
187 const DtSimulationAddress simEngineAddress()
const override;
188 void setSimEngineAddress(
const DtSimulationAddress&)
override;
190 virtual void setAppearance(
const DtAppearance& app);
193 virtual void makeWritable();
196 virtual void makeReadOnly();
207 template <
typename T_BaseComponent>
217 const bool& isLocal()
const;
218 const bool& checkForNameReservation()
const;
220 const DtUUID& uuid()
const;
221 const DtString& markingText()
const;
223 const DtForceType forceType()
const;
224 const DtEntityType
entityType()
const {
return DtEntityType(objectType()); };
225 const DtEntityType objectType()
const;
226 const DtEntityIdentifier& entityId()
const;
227 const UInt32 appearanceBits()
const;
228 const bool isClutterEntity()
const;
229 const UInt32 capabilities()
const;
230 const DtEntityType guise()
const;
231 const unsigned long long userLongLongData()
const;
232 const unsigned long long orbatId()
const;
233 const DtSimulationAddress simEngineAddress()
const override;
235 const DtUUID& superior()
const;
240 void addAttachment(
const DtUUID&);
241 void removeAttachment(
const DtUUID&);
242 const std::set<DtUUID> attachments()
const;
245 bool checkForUpdatedItems();
248 const DtUUID _uuid()
const;
249 const DtString _markingText()
const;
250 const DtEntityIdentifier _entityId()
const;
252 bool checkEntityIdChanged();
253 bool checkUUIDChanged();
254 bool checkForceChanged();
255 bool checkMarkingTextChanged();
256 bool checkDamageStateChanged();
257 bool checkIsClutterChanged();
259 void handleDataUpdated(
const std::vector<UInt32>& attributesUpdated);
260 void completeSetup();
270 void setSuperior(
const DtUUID&);
303 virtual void updateDataStorage()
override;
307 myCurrentFrameState.updateStateData(sd);
308 myNextFrameState.updateStateData(sd);
311 static void addAdditionalTableColumns(Legion::SimulationDatabase*);
315 virtual Legion::WriteStateInstance
writeStateInstance()
override {
return myWriteEntityStateRepository; };
318 virtual void convertToRemote()
override;
321 virtual void convertToLocal()
override;
323 virtual void addAdditionalStateComponents()
override;
328 myCurrentFrameState.aboutToBeDeleted();
329 myNextFrameState.aboutToBeDeleted();
343 #define _ENTITY_STATE_COMPONENT 1
344 #include "vrfStateData/entityStateComponent.inl"
2) Define the next frame class. This will be used for write access.
Definition: entityStateComponent.h:127
UUID is a unique ID wrapper class.
Definition: uuid.h:59
boost::signals2::signal< void(const DtFrameStateInterface *)> signal_attachmentsChanged
Definition: entityStateComponent.h:115
unsigned int myCallbackHandle
Definition: entityStateComponent.h:278
Instances of DtVrfObjectParameters are the readable/writeable objects that contain the information ne...
Definition: vrfObjectParameters.h:64
LOM::WriteEntityRepository myWriteEntityStateRepository
Definition: entityStateComponent.h:199
const DtEntityType entityType() const
Definition: entityStateComponent.h:224
const DtEntityStateComponentData & frameState() const
Next frame access write access. Ensure this is only used in a single thread (i.e.a controller thread)...
Definition: entityStateComponent.h:134
Definition: stateDataTypes.h:23
DtString myMarkingText
Definition: entityStateComponent.h:78
tbb::spin_mutex myCompleteSetupMutex
Definition: entityStateComponent.h:284
unsigned long long myOrbatId
Definition: entityStateComponent.h:84
bool myCheckForNameReservation
Definition: entityStateComponent.h:85
bool myIsClutterEntity
Definition: entityStateComponent.h:279
int myForceId
Definition: entityStateComponent.h:275
Definition: stateComponent.h:63
virtual void addAttachment(const DtUUID &)
Definition: entityStateComponent.h:111
1) Define the interface class that will be used to represent the next and current frames...
Definition: entityStateComponent.h:91
unsigned int UInt32
Definition: stateDataTypes.h:18
Definition: stateComponent.h:269
The DtSimulatedObjectStateComponent is an interface that all main components (those that are consider...
Definition: simulatedObjectStateComponent.h:21
UInt32 myIsClutterEntityColumn
Definition: entityStateComponent.h:122
DtEntityStateComponentData(const DtEntityStateComponentData &orig)
Definition: entityStateComponent.h:35
bool isDoubleBuffered()
Definition: entityStateComponent.h:298
boost::signals2::scoped_connection myCompleteSetupConnection
Definition: entityStateComponent.h:283
boost::signals2::signal< void(const DtUUID &oldSuperior, const DtUUID &newSuperior)> signal_superiorChanged
Definition: entityStateComponent.h:116
boost::signals2::signal< void(bool oldIsClutter, bool newIsClutter)> signal_isClutterChanged
Definition: entityStateComponent.h:117
virtual void setEntityType(const DtEntityType &ot) override
Definition: entityStateComponent.h:110
const DtEntityStateComponentData & frameState() const
Current frame state only can access current frame buffers. This ensures thread safety.
Definition: entityStateComponent.h:215
Definition: entityStateComponent.h:25
void advanceFrame(const DtEntityStateComponentData &data)
Definition: entityStateComponent.h:263
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: entityStateComponent.h:292
std::set< DtUUID > myAttachments
Definition: entityStateComponent.h:281
virtual void aboutToBeDeleted() override
Definition: entityStateComponent.h:325
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:398
DtEntityStateComponentData()
Definition: entityStateComponent.h:29
#define DEFINE_STATE_COMPONENT_TYPE(CreatedComponent)
Definition: stateComponent.h:231
std::string myMarkingText
Definition: entityStateComponent.h:276
3) Define the current frame class. This will be used for read access.
Definition: entityStateComponent.h:208
virtual Legion::WriteStateInstance writeStateInstance() override
Definition: entityStateComponent.h:315
DtString myGlobalId
Definition: entityStateComponent.h:77
boost::signals2::signal< void(const DtString &, const DtString &, makVrf::SimStateID)> signal_callsignChanged
Definition: entityStateComponent.h:118
DtEntityStateComponentNextFrame myNextFrameState
Definition: entityStateComponent.h:334
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:384
typedef long(ZCALLBACK *tell_file_func) OF((voidpf opaque
DtUUID mySuperior
Definition: entityStateComponent.h:274
DtEntityIdentifier myEntityId
Definition: entityStateComponent.h:80
#define UNDEFINED_RETURNVALUE_ACCESSOR_MUTATOR(Type, Member, Set)
Definition: doubleBufferedDataStorage.h:53
virtual void aboutToBeDeleted()
unsigned long long SimStateID
Definition: entityStateComponent.h:27
LOM::ReadEntityRepository myReadEntityStateRepository
Definition: entityStateComponent.h:273
virtual const DtFrameStateInterface * currentFrameState() const override
Definition: entityStateComponent.h:299
UInt32 myUUIDColumn
Definition: entityStateComponent.h:121
virtual void updateStateData(DtStateData *sd) override
Implement to update data storage to the new state data.
Definition: entityStateComponent.h:305
#define UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(Type, Member, Set)
Definition: doubleBufferedDataStorage.h:57
LOM::WriteEntityRepository myWriteEntityStateRepository
Definition: entityStateComponent.h:335
#define DEFINE_ACCESSOR_MUTATOR(ReturnType, Accessor, Mutator)
Definition: doubleBufferedDataStorage.h:23
DtEntityStateComponentData myData
Definition: entityStateComponent.h:201
DtStateComponentCreator< DtEntityStateComponentImplementation > DtEntityStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: entityStateComponent.h:340
DtEntityStateComponentData myData
Definition: entityStateComponent.h:285
DtEntityStateComponentCurrentFrame myCurrentFrameState
Definition: entityStateComponent.h:333
DtString myCallsign
Definition: entityStateComponent.h:79
virtual DtFrameStateInterface * nextFrameState() override
Definition: entityStateComponent.h:300
DtSimulationAddress mySimEngineAddress
Definition: entityStateComponent.h:86
#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
DtUUID myUUID
Definition: entityStateComponent.h:81
DtEntityStateComponentData & frameState()
Definition: entityStateComponent.h:135
int myDamageState
Definition: entityStateComponent.h:277
DtEntityStateComponentData & operator=(const DtEntityStateComponentData &rhs)
Definition: entityStateComponent.h:49
unsigned long long myUserData
Definition: entityStateComponent.h:83
virtual const DtFrameStateInterface * nextFrameState() const override
Definition: entityStateComponent.h:301
bool myIsLocal
Definition: entityStateComponent.h:82
DtUUID mySuperior
Definition: entityStateComponent.h:200
This is a simple base class that will be used to return a pointer to current or next frame state...
Definition: stateComponent.h:294
tbb::spin_rw_mutex myAttachmentsMutex
Definition: entityStateComponent.h:282
const DtEntityType entityType() const
Definition: entityStateComponent.h:164
This class holds the state data that represents each simulation object in the system.
Definition: stateDataManager.h:73