VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtExtendedStateConnector Class Reference

Detailed Description

DtExtendedStateConnector manages access to extended state properties of entities in the simulation. It provides mechanisms to request specific property values, monitor entity states, and convert between different data types. The connector supports bool, int, float, string, and more complex types like ammo clip maps.

#include <extendedStateConnector.h>

Inheritance diagram for makVre::DtExtendedStateConnector:
[legend]

Public Member Functions

 DtExtendedStateConnector ()
 
virtual ~DtExtendedStateConnector () override
 
virtual void install (DtPlayerStationApp *app, makVrv::DT_PROTOCOL_NAMESPACE::DtVrlinkConnection *connection) override
 
virtual void tick () override
 
virtual void shutdown () override
 
- Public Member Functions inherited from makVre::DT_PROTOCOL_NAMESPACE::DtSimEventConnector
 DtSimEventConnector ()
 
virtual ~DtSimEventConnector () override
 
- Public Member Functions inherited from makVre::DtConnector
 DtConnector ()
 
virtual ~DtConnector ()
 
virtual DtConnectorType type ()
 
virtual std::string name ()
 

Protected Member Functions

virtual DtVreMessageResult handleExtendedRequest (DtVreMessage *msg)
 
virtual DtVreMessageResult handleExtendedInit (DtVreMessage *msg)
 
virtual DtReflectedExtEntity * findEntity (DtEntityIdentifier entityId)
 
template<typename ValueType, typename MessageType>
void sendAttributeMessage (const std::string &name, ValueType value, const DtEntityIdentifier &entityId)
 
template<typename RwType, typename ValueType, typename MessageType>
bool sendStatePropertyMessage (DtReflectedExtEntity *entity, const std::string &name)
 
virtual void sendExtendedDataMessage (DtReflectedExtEntity *entity, const std::string &name, const std::string &type)
 
virtual bool sendStatePropertyMessage (DtReflectedExtEntity *entity, const std::string &name, const std::string &type)
 
void logMissingStateProperty (const std::string &name, const std::string &type)
 

Protected Attributes

std::map< std::string, std::string > myNameTypeMap
 
std::map< std::string, std::string > myPropertyTypeMap
 
DtEntityIdentifier myEntityId
 
DtGlobalObjectDesignator myGlobalId
 
DtReflectedExtEntityList * myRel
 
std::set< std::string > myMissingStateProperties
 
- Protected Attributes inherited from makVre::DT_PROTOCOL_NAMESPACE::DtSimEventConnector
DtPlayerStationAppmyApp
 
makVrv::DT_PROTOCOL_NAMESPACE::DtVrlinkConnection * myConnection
 
- Protected Attributes inherited from makVre::DtConnector
std::string myName
 
DtConnectorType myType
 

Additional Inherited Members

- Public Types inherited from makVre::DtConnector
enum  DtConnectorType {
  DIS , HLA13 , HLA1516 , HLA1516E ,
  HLA4
}
 
- Static Public Member Functions inherited from makVre::DtConnector
static std::string extension (DtConnectorType type)
 

Constructor & Destructor Documentation

◆ DtExtendedStateConnector()

makVre::DtExtendedStateConnector::DtExtendedStateConnector ( )

Default constructor.

Initializes member variables with default values

◆ ~DtExtendedStateConnector()

virtual makVre::DtExtendedStateConnector::~DtExtendedStateConnector ( )
overridevirtual

Virtual destructor.

Member Function Documentation

◆ install()

virtual void makVre::DtExtendedStateConnector::install ( DtPlayerStationApp * app,
makVrv::DT_PROTOCOL_NAMESPACE::DtVrlinkConnection * connection )
overridevirtual

Installs the extended state connector with the application and connection.

Parameters
appPointer to the player station application
connectionPointer to the protocol-specific VR-Link connection

Registers message handlers for extended state requests and initialization, and retrieves the reflected extended entity list

Reimplemented from makVre::DT_PROTOCOL_NAMESPACE::DtSimEventConnector.

◆ tick()

virtual void makVre::DtExtendedStateConnector::tick ( )
overridevirtual

Performs periodic processing of entity state updates.

For monitored entities, checks and sends updates for registered state properties

Reimplemented from makVre::DT_PROTOCOL_NAMESPACE::DtSimEventConnector.

◆ shutdown()

virtual void makVre::DtExtendedStateConnector::shutdown ( )
overridevirtual

Shuts down the extended state connector.

Removes message handlers for extended state requests and initialization

Reimplemented from makVre::DT_PROTOCOL_NAMESPACE::DtSimEventConnector.

◆ handleExtendedRequest()

virtual DtVreMessageResult makVre::DtExtendedStateConnector::handleExtendedRequest ( DtVreMessage * msg)
protectedvirtual

Handles requests for extended state properties.

Parameters
msgPointer to the extended state request message
Returns
Message result indicating how the message was handled

Processes ExtendedStateRequestMessage by finding the requested entity and sending the requested state property or extended data

◆ handleExtendedInit()

virtual DtVreMessageResult makVre::DtExtendedStateConnector::handleExtendedInit ( DtVreMessage * msg)
protectedvirtual

Handles initialization of extended state monitoring.

Parameters
msgPointer to the extended state monitor initialization message
Returns
Message result indicating how the message was handled

Processes ExtendedStateMonitorInitMessage by setting up tracking for the requested entity and state properties

◆ findEntity()

virtual DtReflectedExtEntity * makVre::DtExtendedStateConnector::findEntity ( DtEntityIdentifier entityId)
protectedvirtual

Finds an extended entity by its identifier.

Parameters
entityIdThe entity identifier to look up
Returns
Pointer to the found extended entity, or nullptr if not found

Searches the reflected extended entity list for an entity with the given ID

◆ sendAttributeMessage()

template<typename ValueType, typename MessageType>
void makVre::DtExtendedStateConnector::sendAttributeMessage ( const std::string & name,
ValueType value,
const DtEntityIdentifier & entityId )
protected

Sends an attribute message with a specific value type.

Template Parameters
ValueTypeThe type of the attribute value
MessageTypeThe type of message to create and send
Parameters
nameThe name of the attribute
valueThe value of the attribute
entityIdThe entity identifier to associate with the message

Creates and queues a message containing the attribute name, value, and entity ID

References makVre::DtConnector::name().

◆ sendStatePropertyMessage() [1/2]

template<typename RwType, typename ValueType, typename MessageType>
bool makVre::DtExtendedStateConnector::sendStatePropertyMessage ( DtReflectedExtEntity * entity,
const std::string & name )
protected

Sends a state property message with type conversion.

Template Parameters
RwTypeThe reader/writer type for the property
ValueTypeThe target value type
MessageTypeThe type of message to create and send
Parameters
entityPointer to the entity containing the property
nameThe name of the state property
Returns
True if the property was found and sent, false otherwise

Looks up a property of the specified reader/writer type, converts it to the target value type, and sends it in a message of the specified message type

References makVre::DtConnector::name().

◆ sendExtendedDataMessage()

virtual void makVre::DtExtendedStateConnector::sendExtendedDataMessage ( DtReflectedExtEntity * entity,
const std::string & name,
const std::string & type )
protectedvirtual

Sends an extended data message for a specific entity.

Parameters
entityPointer to the entity containing the extended data
nameThe name of the extended data property
typeThe type of the extended data property

Creates and sends a message containing extended data from the entity

References makVre::DtConnector::name(), and makVre::DtConnector::type().

◆ sendStatePropertyMessage() [2/2]

virtual bool makVre::DtExtendedStateConnector::sendStatePropertyMessage ( DtReflectedExtEntity * entity,
const std::string & name,
const std::string & type )
protectedvirtual

Sends a state property message with type dispatching.

Parameters
entityPointer to the entity containing the property
nameThe name of the state property
typeThe type of the state property ("bool", "int", "float", "string", "ammoClipMap")
Returns
True if the property was found and sent, false otherwise

Dispatches to the appropriate typed sendStatePropertyMessage based on the type string

References makVre::DtConnector::name(), and makVre::DtConnector::type().

◆ logMissingStateProperty()

void makVre::DtExtendedStateConnector::logMissingStateProperty ( const std::string & name,
const std::string & type )
protected

Logs a warning about missing extended state data.

Parameters
nameThe name of the missing state property
typeThe type of the missing state property

Logs a warning message the first time a specific state property is not found. Subsequent missing properties with the same name and type won't generate additional log messages to prevent log spam.

References makVre::DtConnector::name(), and makVre::DtConnector::type().

Member Data Documentation

◆ myNameTypeMap

std::map<std::string, std::string> makVre::DtExtendedStateConnector::myNameTypeMap
protected

Mapping of state names to their types.

◆ myPropertyTypeMap

std::map<std::string, std::string> makVre::DtExtendedStateConnector::myPropertyTypeMap
protected

Mapping of property names to their types.

◆ myEntityId

DtEntityIdentifier makVre::DtExtendedStateConnector::myEntityId
protected

Entity identifier for the monitored entity.

◆ myGlobalId

DtGlobalObjectDesignator makVre::DtExtendedStateConnector::myGlobalId
protected

Global object designator for the monitored entity.

◆ myRel

DtReflectedExtEntityList* makVre::DtExtendedStateConnector::myRel
protected

Pointer to the reflected extended entity list.

◆ myMissingStateProperties

std::set<std::string> makVre::DtExtendedStateConnector::myMissingStateProperties
protected

Cache for extended state data that is missing.

Used to limit the amount of warning messages put into the log by tracking which properties have already had warnings issued


The documentation for this class was generated from the following file: