11 #include <matrix/vlVector.h>
12 #include <matrix/vlTaitBryan.h>
15 #include <vlpi/entityIdentifier.h>
16 #include <vlpi/entityType.h>
17 #include <legionStandardOM/sets/writeEntityRepository.hpp>
18 #include "legionStandardOM/sets/readEntityRepository.hpp"
28 { myWorldPositions.push_back(DtVector::zero()); };
80 return !(*
this == rhs);
96 double simulationTimeSent()
const
98 return myDictionary.doubleValue(
"SimulationTime");
104 std::string str = myDictionary.value(
"DisplayType");
112 return myDictionary.value(
"PerceivedType");
119 return atoi(myDictionary.value(
"PerceivedAppearance").c_str());
125 return (DtForceType)(atoi(myDictionary.value(
"PerceivedForce").c_str()));
131 return DtEntityType(myDictionary.value(
"PerceivedType").c_str());
137 return myWorldPositions;
143 return myWorldPositions;
149 if (!myWorldPositions.empty())
151 return myWorldPositions[0];
154 return DtVector::zero();
161 if (myWorldPositions.empty())
163 myWorldPositions.push_back(v);
167 myWorldPositions[0] = v;
189 std::map<DtUUID, double>::iterator iter = myObservedBy.find(s);
191 if (iter == myObservedBy.end())
193 myObservedBy[s] = simTime;
198 iter->second = simTime;
207 std::map<DtUUID, double>::iterator iter = myObservedBy.find(s);
209 if (iter != myObservedBy.end())
211 myObservedBy.erase(iter);
220 return (myObservedBy.find(s) != myObservedBy.end());
233 myDictionary.setValue(
"Protocol", s);
239 return myDictionary.value(
"Protocol");
246 myDictionary.setValue(
"Domain", s);
252 return myDictionary.value(
"Domain");
279 unsigned long long myUserData = 0;
331 virtual const std::map<DtUUID, double>&
observedBy()
const {
throw DtUnimplementedMethod(
"The const std::map<DtUUID, double>& observedBy() const method is unimplemented"); };
347 virtual const std::string displayType()
const override;
349 virtual const std::string protocol()
const override;
350 virtual void setProtocol(
const std::string&)
override;
352 virtual const std::string domain()
const override;
353 virtual void setDomain(
const std::string&)
override;
355 virtual void setWorldPosition(
const DtVector&)
override;
356 virtual const DtVector worldPosition()
const override;
357 virtual const std::vector<DtVector>& worldPositions()
const override;
359 virtual void setWorldOrientation(
const DtTaitBryan&)
override;
360 virtual const DtTaitBryan& worldOrientation()
const override;
362 virtual void setWorldVelocity(
const DtVector&)
override;
363 virtual const DtVector& worldVelocity()
const override;
365 virtual void setContactUUID(
const DtUUID&)
override;
366 virtual const DtUUID& contactUUID()
const override;
368 virtual void setDateTimeOfReport(
const double&)
override;
369 virtual const double& dateTimeOfReport()
const override;
371 virtual const std::string& uniqueIdentifier()
const override;
372 virtual void setUniqueIdentifier(
const std::string&)
override;
374 virtual bool addObservedBy(
const DtUUID& s,
double simTime)
override;
375 virtual void removeObservedBy(
const DtUUID& s)
override;
376 virtual bool observedBy(
const DtUUID& s)
const override;
377 virtual const std::map<DtUUID, double>& observedBy()
const override;
384 virtual const bool& isLocal()
const override;
385 virtual void setIsLocal(
const bool&)
override;
387 virtual const bool& checkForNameReservation()
const override;
388 virtual void setCheckForNameReservation(
const bool&)
override;
390 virtual const DtString& globalId()
const override;
391 virtual void setGlobalId(
const DtString&)
override;
393 virtual const DtUUID& uuid()
const override;
394 virtual void setUUID(
const DtUUID& u)
override;
397 virtual const DtString& sidc()
const override;
398 virtual void setSidc(
const DtString&)
override;
400 virtual const DtString& markingText()
const override;
401 virtual void setMarkingText(
const DtString&)
override;
403 virtual const DtForceType forceType()
const override;
404 virtual void setForceType(
const DtForceType&)
override;
406 virtual const UInt32 appearanceBits()
const override;
407 virtual void setAppearanceBits(
const UInt32&)
override;
409 virtual const DtEntityType
entityType()
const override {
return objectType(); };
410 virtual const DtEntityType objectType()
const override;
411 virtual void setEntityType(
const DtEntityType& t)
override;
413 virtual const unsigned long long userLongLongData()
const override;
414 virtual void setUserLongLongData(
const unsigned long long&)
override;
416 virtual const DtEntityIdentifier& entityId()
const override;
417 virtual void setEntityId(
const DtEntityIdentifier&)
override;
418 virtual const DtSimulationAddress simEngineAddress()
const override;
421 virtual void makeWritable()
override;
424 virtual void makeReadOnly()
override;
437 virtual const std::string protocol()
const override;
438 virtual const std::string domain()
const override;
439 virtual const std::string displayType()
const override;
441 virtual const std::string& uniqueIdentifier()
const override;
442 virtual const DtUUID& contactUUID()
const override;
443 virtual const double& dateTimeOfReport()
const override;
444 virtual const DtVector worldPosition()
const override;
445 virtual const std::vector<DtVector>& worldPositions()
const override;
446 virtual const DtTaitBryan& worldOrientation()
const override;
447 virtual const DtVector& worldVelocity()
const override;
448 virtual const bool& isLocal()
const override;
450 virtual const bool& checkForNameReservation()
const override;
451 virtual const DtString& globalId()
const override;
452 virtual const DtUUID& uuid()
const override;
454 virtual const DtString& sidc()
const override;
455 virtual const DtString& markingText()
const override;
456 virtual const DtForceType forceType()
const override;
457 virtual const UInt32 appearanceBits()
const override;
458 virtual const DtEntityType
entityType()
const override {
return objectType(); };
459 virtual const DtEntityType objectType()
const override;
460 virtual const unsigned long long userLongLongData()
const override;
461 virtual const DtEntityIdentifier& entityId()
const override;
462 virtual const DtSimulationAddress simEngineAddress()
const override;
464 virtual bool observedBy(
const DtUUID& s)
const override;
465 virtual const std::map<DtUUID, double>& observedBy()
const override;
505 if (myNextFrameState.isWritable())
507 myCurrentFrameState.advanceFrame(myNextFrameState.frameState());
510 myCurrentFrameState.emitComponentUpdated();
517 myCurrentFrameState.updateStateData(sd);
518 myNextFrameState.updateStateData(sd);
525 myCurrentFrameState.aboutToBeDeleted();
526 myNextFrameState.aboutToBeDeleted();
530 virtual void convertToLocal()
override;
532 virtual void convertToRemote()
override;
UUID is a unique ID wrapper class.
Definition: uuid.h:59
void removeObservedBy(const DtUUID &s)
Removes an entity from the observer list.
Definition: spotReportStateComponent.h:205
Exception thrown when a required method has not been implemented.
Definition: stateDataTypes.h:30
const std::map< DtUUID, double > & observedBy() const
Definition: spotReportStateComponent.h:224
virtual const std::map< DtUUID, double > & observedBy() const
Definition: spotReportStateComponent.h:331
double myDateTimeOfReport
Simulation date and time at which this report was generated.
Definition: spotReportStateComponent.h:265
DtString mySidc
Symbol Id (Sidc) for this object.
Definition: spotReportStateComponent.h:283
const std::vector< DtVector > & worldPositions() const
Definition: spotReportStateComponent.h:135
virtual const DtEntityType entityType() const override
Definition: spotReportStateComponent.h:458
DtUUID myUUID
UUID of this spot report.
Definition: spotReportStateComponent.h:263
2) Define the next frame class. This will be used for write access.
Definition: spotReportStateComponent.h:339
DtSpotReportStateComponentData myData
The next frame state data (writable pending commit).
Definition: spotReportStateComponent.h:428
bool observedBy(const DtUUID &s) const
Returns whether the given entity is currently observing this contact.
Definition: spotReportStateComponent.h:218
bool addObservedBy(const DtUUID &s, double simTime)
Adds or updates an observer of this contact.
Definition: spotReportStateComponent.h:187
unsigned int UInt32
32-bit unsigned integer type.
Definition: stateDataTypes.h:21
Default creator implementation for a state component type. T_StateComponent is the concrete component...
Definition: stateComponent.h:326
The DtSimulatedObjectStateComponent is an interface that all main components (those that are consider...
Definition: simulatedObjectStateComponent.h:21
unsigned long long myUserData
User-defined 64-bit data field.
Definition: spotReportStateComponent.h:279
virtual void updateDataStorage() override
Advances the current frame state from the next frame state if the next frame is writable, then emits a component update.
Definition: spotReportStateComponent.h:503
virtual bool addObservedBy(const DtUUID &s, double simTime)
Records an observer of this contact.
Definition: spotReportStateComponent.h:322
DtSimpleTypedDictionary & dictionary()
Definition: spotReportStateComponent.h:172
#define UNDEFINED_RETURNVALUE_ACCESSOR(ReturnType, Member)
Defines a virtual const accessor that throws DtUnimplementedMethod, marking the method as requiring a...
Definition: doubleBufferedDataStorage.h:53
DtTaitBryan myWorldOrientation
World-coordinate orientation of the reported contact in Tait-Bryan angles.
Definition: spotReportStateComponent.h:273
DtSpotReportStateComponentData & frameState()
Definition: spotReportStateComponent.h:381
Contains the DtUUID class declaration.
bool isDoubleBuffered()
Definition: spotReportStateComponent.h:494
int appearanceBits() const
Definition: spotReportStateComponent.h:117
std::string domain() const
Definition: spotReportStateComponent.h:250
std::vector< DtVector > & worldPositions()
Definition: spotReportStateComponent.h:141
DtString myMarkingText
Marking text label for this contact.
Definition: spotReportStateComponent.h:281
std::map< DtUUID, double > myObservedBy
Map of observers (by unique ID) to the simulation time at which they last observed this contact...
Definition: spotReportStateComponent.h:257
DtVector worldPosition() const
Definition: spotReportStateComponent.h:147
DtSpotReportStateComponentCurrentFrame myCurrentFrameState
The read-only current frame state.
Definition: spotReportStateComponent.h:536
virtual const DtFrameStateInterface * nextFrameState() const override
Definition: spotReportStateComponent.h:500
virtual const DtEntityType entityType() const override
Definition: spotReportStateComponent.h:409
virtual const DtSimpleTypedDictionary & dictionary() const
Definition: spotReportStateComponent.h:333
4) Define the state component that will contain the wrappers to the next and current frame states tha...
Definition: spotReportStateComponent.h:487
DtUUID myContactUUID
UUID of the contact entity being reported.
Definition: spotReportStateComponent.h:261
virtual const DtFrameStateInterface * currentFrameState() const override
Definition: spotReportStateComponent.h:496
DtSpotReportStateComponentData & operator=(const DtSpotReportStateComponentData &orig)
Assignment operator.
Definition: spotReportStateComponent.h:40
DtVector myWorldVelocity
World-coordinate velocity of the reported contact.
Definition: spotReportStateComponent.h:271
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:513
A keyword/value pair dictionary with typed accessors for common VR-Forces types.
Definition: simpleTypedDictionary.h:26
1) Define the interface class that will be used to represent the next and current frames...
Definition: spotReportStateComponent.h:288
virtual DtSimpleTypedDictionary & dictionary()
Definition: spotReportStateComponent.h:335
#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
std::vector< DtVector > myWorldPositions
World-coordinate positions of the reported contact; supports multi-point contacts.
Definition: spotReportStateComponent.h:269
Subclass from this to indicate that this will be a double buffered state component.
Definition: stateComponent.h:489
DtStateComponentCreator< DtSpotReportStateComponentImplementation > DtSpotReportStateComponentCreator
5) Define the creator. This will need to be registered with the REGISTER_STATE_COMPONENT macro in the...
Definition: spotReportStateComponent.h:545
#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
virtual void aboutToBeDeleted()
Called when the component is about to be deleted; emits signal_stateComponentAboutToBeDeleted.
0) Define the State Component Data. This struct replaces the legion stuff
Definition: spotReportStateComponent.h:24
virtual const std::vector< DtVector > & worldPositions() const
Definition: spotReportStateComponent.h:312
virtual const DtSpotReportStateComponentData & frameState() const override
Next frame access write access. Ensure this is only used in a single thread (i.e.a controller thread)...
Definition: spotReportStateComponent.h:468
void advanceFrame(const DtSpotReportStateComponentData &data)
Advances the current frame by replacing its state data with the provided next frame data...
Definition: spotReportStateComponent.h:475
const DtEntityType entityType() const
Definition: spotReportStateComponent.h:129
3) Define the current frame class. This will be used for read access.
Definition: spotReportStateComponent.h:432
virtual DtFrameStateInterface * nextFrameState() override
Definition: spotReportStateComponent.h:498
LOM::WriteEntityRepository myWriteSpotReportStateRepository
Legion write entity repository used when publishing this component to the network.
Definition: spotReportStateComponent.h:540
DtSimpleTypedDictionary myDictionary
Key-value dictionary of additional typed properties for this report.
Definition: spotReportStateComponent.h:267
#define UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(Type, Member, Set)
Defines an undefined virtual const-reference accessor and an undefined virtual setter, both throwing DtUnimplementedMethod and requiring overrides in a derived class.
Definition: doubleBufferedDataStorage.h:112
DtSpotReportStateComponentData()
Constructs a default spot report state with null UUIDs and a single zero world position.
Definition: spotReportStateComponent.h:27
virtual void setFrameState(const DtSpotReportStateComponentData &)
Replaces the entire frame state for this spot report.
Definition: spotReportStateComponent.h:317
#define DEFINE_ACCESSOR_MUTATOR(ReturnType, Accessor, Mutator)
Defines a const reference accessor and an inline setter for a member variable.
Definition: doubleBufferedDataStorage.h:37
void setWorldPosition(const DtVector &v)
Sets the primary world-coordinate position of the reported contact.
Definition: spotReportStateComponent.h:159
void setDomain(const std::string &s)
Sets the simulation domain string in the dictionary.
Definition: spotReportStateComponent.h:244
const DtSimpleTypedDictionary & dictionary() const
Definition: spotReportStateComponent.h:178
DtString myGlobalId
Global identifier string for this contact.
Definition: spotReportStateComponent.h:275
DtEntityIdentifier myEntityId
Entity identifier for this contact.
Definition: spotReportStateComponent.h:277
DtSpotReportStateComponentData(const DtSpotReportStateComponentData &orig)
Copy constructor.
Definition: spotReportStateComponent.h:32
const DtForceType forceType() const
Definition: spotReportStateComponent.h:123
bool operator==(const DtSpotReportStateComponentData &rhs) const
Definition: spotReportStateComponent.h:60
void setProtocol(const std::string &s)
Sets the network protocol string in the dictionary.
Definition: spotReportStateComponent.h:231
virtual void aboutToBeDeleted() override
Notifies both frame states and the base class that this component is about to be deleted.
Definition: spotReportStateComponent.h:522
#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
bool operator!=(const DtSpotReportStateComponentData &rhs) const
Definition: spotReportStateComponent.h:78
DtSpotReportStateComponentData myData
The current frame state data snapshot (read-only).
Definition: spotReportStateComponent.h:482
virtual void removeObservedBy(const DtUUID &s)
Removes an entity from the observer list.
Definition: spotReportStateComponent.h:325
virtual const DtSpotReportStateComponentData & frameState() const
Definition: spotReportStateComponent.h:314
Contains the DtStateComponent class declaration.
const std::string displayType() const
Definition: spotReportStateComponent.h:102
virtual bool observedBy(const DtUUID &s) const
Returns whether the given entity is currently observing this contact.
Definition: spotReportStateComponent.h:329
Base interface for accessing current or next frame state in a double-buffered state component...
Definition: stateComponent.h:354
virtual void updateStateData(DtStateData *sd) override
Updates the state data pointer for both current and next frame states.
Definition: spotReportStateComponent.h:515
DtSpotReportStateComponentNextFrame myNextFrameState
The writable next frame state.
Definition: spotReportStateComponent.h:538
std::string protocol() const
Definition: spotReportStateComponent.h:237
std::string myUniqueIdentifier
Application-defined unique string identifier for this spot report.
Definition: spotReportStateComponent.h:259
virtual const DtSpotReportStateComponentData & frameState() const override
Next frame access write access. Ensure this is only used in a single thread (i.e.a controller thread)...
Definition: spotReportStateComponent.h:380
Definition: stateComponent.h:68