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

Detailed Description

DtEntityResolver provides a central service for mapping between different representations of entities in the simulation. It maintains mappings between display names (marking text), object IDs, element IDs, and scene objects. This enables the application to find and work with entities regardless of which identifier system is used to reference them.

The resolver also emits signals when entities are added or removed, allowing other components to react to entity lifecycle events.

#include <entityResolver.h>

Public Types

using StringToElementIdMap = std::map<std::string, makVrv::DtElementID>
 
using ElementIdToStringMap = std::map<makVrv::DtElementID, std::string>
 
using SceneObjectMap = std::map<makVrv::DtElementID, makVrv::DtSceneObject*>
 

Public Member Functions

 DtEntityResolver (makVrv::DtDe &de)
 
virtual ~DtEntityResolver ()
 
makVrv::DtSceneObject * sceneObjectFromElementId (makVrv::DtElementID elementId, makVrv::DtModelSetId modelSet)
 
const StringToElementIdMapdisplayNames () const
 
const DtEntityResolver::SceneObjectMapsceneObjects () const
 
makVrv::DtElementID findElementID (const std::string &displayName) const
 
makVrv::DtElementID findElementIdByObjectId (const std::string &objectId) const
 
makVrv::DtElementID findElementIdByEntityId (const DtEntityIdentifier &entityId) const
 
DtUUID findUUID (makVrv::DtElementID elementID) const
 
DtUUID findUUID (const DtEntityIdentifier &entityId) const
 
std::string findDisplayName (makVrv::DtElementID elementID) const
 
std::string findDisplayName (const DtEntityIdentifier &entityId) const
 
std::string findObjectId (makVrv::DtElementID elementID) const
 
DtEntityIdentifier findEntityId (makVrv::DtElementID elementID) const
 
DtEntityIdentifier findEntityId (const std::string &displayName) const
 
std::string findObjectType (makVrv::DtElementID elementID) const
 
std::string findObjectType (const DtEntityIdentifier &entityId) const
 
makVre::DtVreMessageResult handleEntityDiscovered (makVre::DtVreMessage *msg)
 
makVre::DtVreMessageResult handleEntityRemoved (makVre::DtVreMessage *msg)
 
void onElementIdRealized (makVrv::DtElementID id)
 
makVrv::DtSceneObject * findSceneObject (makVrv::DtElementID elementId) const
 
makVrv::DtSceneObject * findSceneObject (const std::string &displayName) const
 
makVrv::DtSceneObject * findSceneObjectByObjectId (const std::string &objectId) const
 
makVrv::DtSceneObject * findSceneObjectByEntityId (const DtEntityIdentifier &entityId) const
 

Public Attributes

boost::signalslib::signal< void(makVrv::DtElementID entity)> signal_entityAdded
 
boost::signalslib::signal< void(makVrv::DtElementID entity)> signal_entityRemoved
 

Protected Member Functions

void slot_elementsReadyToProcess (const makVrv::DtElementData::ElementIdList &elements)
 
void slot_elementsRemoved (const makVrv::DtElementData::ElementIdList &elements)
 
void slot_elementsChanged (const makVrv::DtElementAttributeManager::EntryAttributesList &attrs)
 

Protected Attributes

makVrv::DtDe & myDe
 
StringToElementIdMap myDisplayNameToElementIdMap
 
ElementIdToStringMap myElementIdToDisplayNameMap
 
StringToElementIdMap myObjectIdToElementIdMap
 
ElementIdToStringMap myElementIdToObjectIdMap
 
SceneObjectMap mySceneObjectMap
 
std::vector< std::shared_ptr< EntityDiscoveredMessage > > myPendingRealization
 

Member Typedef Documentation

◆ StringToElementIdMap

using makVre::DtEntityResolver::StringToElementIdMap = std::map<std::string, makVrv::DtElementID>

Type definition for mapping from strings to element IDs.

◆ ElementIdToStringMap

using makVre::DtEntityResolver::ElementIdToStringMap = std::map<makVrv::DtElementID, std::string>

Type definition for mapping from element IDs to strings.

◆ SceneObjectMap

using makVre::DtEntityResolver::SceneObjectMap = std::map<makVrv::DtElementID, makVrv::DtSceneObject*>

Type definition for mapping from element IDs to scene objects.

Constructor & Destructor Documentation

◆ DtEntityResolver()

makVre::DtEntityResolver::DtEntityResolver ( makVrv::DtDe & de)

Constructor.

Parameters
deReference to the display engine

Creates a new entity resolver associated with the given display engine. The display engine provides access to the visual representation of entities.

References de().

◆ ~DtEntityResolver()

virtual makVre::DtEntityResolver::~DtEntityResolver ( )
virtual

Virtual destructor.

Cleans up resources used by the entity resolver.

Member Function Documentation

◆ sceneObjectFromElementId()

makVrv::DtSceneObject * makVre::DtEntityResolver::sceneObjectFromElementId ( makVrv::DtElementID elementId,
makVrv::DtModelSetId modelSet )

Retrieves a scene object from an element ID.

Parameters
elementIdElement ID to look up
modelSetModel set to search in
Returns
Pointer to the scene object, or NULL if not found

Utility function to find a scene object associated with an element ID in the specified model set. This is useful for accessing the visual representation of an entity when only its element ID is known.

◆ displayNames()

const StringToElementIdMap & makVre::DtEntityResolver::displayNames ( ) const

Gets the map of all display names to element IDs.

Returns
Constant reference to the display name mapping

Provides access to the complete mapping of display names to element IDs. When iterating through this map, iterator->first provides the display name, and iterator->second provides the corresponding element ID.

◆ sceneObjects()

const DtEntityResolver::SceneObjectMap & makVre::DtEntityResolver::sceneObjects ( ) const

Gets the map of all scene objects.

Returns
Constant reference to the scene object mapping

Provides access to the complete mapping of element IDs to scene objects. When iterating through this map, iterator->first provides the element ID, and iterator->second provides the corresponding scene object pointer.

◆ findElementID()

makVrv::DtElementID makVre::DtEntityResolver::findElementID ( const std::string & displayName) const

Element ID lookup methods.

Finds the element ID for an entity by its display name

Parameters
displayNameDisplay name (marking text) of the entity
Returns
Element ID of the entity, or NULL_ELEMENT_ID if not found

Looks up the element ID associated with a particular display name. This is typically used to find an entity by its visible name or marking text.

Referenced by findEntityId().

◆ findElementIdByObjectId()

makVrv::DtElementID makVre::DtEntityResolver::findElementIdByObjectId ( const std::string & objectId) const

Finds the element ID for an entity by its object ID.

Parameters
objectIdObject ID of the entity
Returns
Element ID of the entity, or NULL_ELEMENT_ID if not found

Looks up the element ID associated with a particular object ID. The object ID is typically a unique identifier from the network protocol.

Referenced by findElementIdByEntityId().

◆ findElementIdByEntityId()

makVrv::DtElementID makVre::DtEntityResolver::findElementIdByEntityId ( const DtEntityIdentifier & entityId) const
inline

Finds the element ID for an entity by its entity identifier.

Parameters
entityIdEntity identifier of the entity
Returns
Element ID of the entity, or NULL_ELEMENT_ID if not found

Looks up the element ID associated with a particular entity identifier. In DIS and RPR HLA, the VRL Connection Object ID is a string representation of a DtEntityIdentifier, so this delegates to findElementIdByObjectId.

References findElementIdByObjectId().

Referenced by findDisplayName(), findObjectType(), and findUUID().

◆ findUUID() [1/2]

DtUUID makVre::DtEntityResolver::findUUID ( makVrv::DtElementID elementID) const

UUID lookup methods.

Finds the UUID for an entity by its element ID

Parameters
elementIDElement ID of the entity
Returns
UUID of the entity

Retrieves the UUID associated with a particular element ID. Currently this performs the lookup by marking text, which may be ambiguous if multiple elements have the same marking text.

◆ findUUID() [2/2]

DtUUID makVre::DtEntityResolver::findUUID ( const DtEntityIdentifier & entityId) const
inline

Finds the UUID for an entity by its entity identifier.

Parameters
entityIdEntity identifier of the entity
Returns
UUID of the entity

Convenience method that combines findElementIdByEntityId and findUUID to retrieve the UUID associated with a particular entity identifier.

References findElementIdByEntityId(), and findUUID().

Referenced by findUUID().

◆ findDisplayName() [1/2]

std::string makVre::DtEntityResolver::findDisplayName ( makVrv::DtElementID elementID) const

Display name lookup methods.

Finds the display name for an entity by its element ID

Parameters
elementIDElement ID of the entity
Returns
Display name of the entity, or empty string if not found

Retrieves the display name (marking text) associated with a particular element ID. This is typically the human-readable name of the entity as shown in the UI.

Referenced by findDisplayName().

◆ findDisplayName() [2/2]

std::string makVre::DtEntityResolver::findDisplayName ( const DtEntityIdentifier & entityId) const
inline

Finds the display name for an entity by its entity identifier.

Parameters
entityIdEntity identifier of the entity
Returns
Display name of the entity, or empty string if not found

Convenience method that combines findElementIdByEntityId and findDisplayName to retrieve the display name associated with a particular entity identifier.

References findDisplayName(), and findElementIdByEntityId().

◆ findObjectId()

std::string makVre::DtEntityResolver::findObjectId ( makVrv::DtElementID elementID) const

Object ID lookup methods.

Finds the object ID for an entity by its element ID

Parameters
elementIDElement ID of the entity
Returns
Object ID of the entity, or empty string if not found

Retrieves the object ID associated with a particular element ID. The object ID is typically a unique identifier from the network protocol.

Referenced by findEntityId().

◆ findEntityId() [1/2]

DtEntityIdentifier makVre::DtEntityResolver::findEntityId ( makVrv::DtElementID elementID) const
inline

Entity identifier lookup methods.

Finds the entity identifier for an entity by its element ID

Parameters
elementIDElement ID of the entity
Returns
Entity identifier of the entity

Retrieves the entity identifier associated with a particular element ID. In DIS and RPR HLA, the VRL Connection Object ID is a string representation of a DtEntityIdentifier, so this converts the object ID to an entity identifier.

References findObjectId().

Referenced by findEntityId().

◆ findEntityId() [2/2]

DtEntityIdentifier makVre::DtEntityResolver::findEntityId ( const std::string & displayName) const
inline

Finds the entity identifier for an entity by its display name.

Parameters
displayNameDisplay name (marking text) of the entity
Returns
Entity identifier of the entity

Convenience method that combines findElementID and findEntityId to retrieve the entity identifier associated with a particular display name.

References findElementID(), and findEntityId().

◆ findObjectType() [1/2]

std::string makVre::DtEntityResolver::findObjectType ( makVrv::DtElementID elementID) const

Object type lookup methods.

Finds the object type for an entity by its element ID

Parameters
elementIDElement ID of the entity
Returns
Object type of the entity, or empty string if not found

Retrieves the object type associated with a particular element ID. The object type describes the kind of entity (e.g., "Tank", "Aircraft").

Referenced by findObjectType().

◆ findObjectType() [2/2]

std::string makVre::DtEntityResolver::findObjectType ( const DtEntityIdentifier & entityId) const
inline

Finds the object type for an entity by its entity identifier.

Parameters
entityIdEntity identifier of the entity
Returns
Object type of the entity, or empty string if not found

Convenience method that combines findElementIdByEntityId and findObjectType to retrieve the object type associated with a particular entity identifier.

References findElementIdByEntityId(), and findObjectType().

◆ handleEntityDiscovered()

makVre::DtVreMessageResult makVre::DtEntityResolver::handleEntityDiscovered ( makVre::DtVreMessage * msg)

Message handlers.

Handles entity discovered messages

Parameters
msgPointer to the entity discovered message
Returns
Message handling result

Processes notifications about newly discovered entities, adding them to the resolver's tracking system and pending realization list.

◆ handleEntityRemoved()

makVre::DtVreMessageResult makVre::DtEntityResolver::handleEntityRemoved ( makVre::DtVreMessage * msg)

Handles entity removed messages.

Parameters
msgPointer to the entity removed message
Returns
Message handling result

Processes notifications about entities being removed from the simulation, removing them from the resolver's tracking system.

◆ onElementIdRealized()

void makVre::DtEntityResolver::onElementIdRealized ( makVrv::DtElementID id)

Handles element ID realization.

Parameters
idElement ID that has been realized

Called when an element ID has been fully realized in the simulation. This triggers the sending of EntityRealizedMessages for pending entities.

◆ findSceneObject() [1/2]

makVrv::DtSceneObject * makVre::DtEntityResolver::findSceneObject ( makVrv::DtElementID elementId) const

Scene object lookup methods.

Finds the scene object for an entity by its element ID

Parameters
elementIdElement ID of the entity
Returns
Pointer to the scene object, or NULL if not found

Retrieves the scene object associated with a particular element ID. Note that DtSceneObject has an elementID method, so given a DtSceneObject, you can also look up the display name (which, when using DIS or HLA/RPR is the marking text).

◆ findSceneObject() [2/2]

makVrv::DtSceneObject * makVre::DtEntityResolver::findSceneObject ( const std::string & displayName) const

Finds the scene object for an entity by its display name.

Parameters
displayNameDisplay name (marking text) of the entity
Returns
Pointer to the scene object, or NULL if not found

Retrieves the scene object associated with a particular display name.

◆ findSceneObjectByObjectId()

makVrv::DtSceneObject * makVre::DtEntityResolver::findSceneObjectByObjectId ( const std::string & objectId) const

Finds the scene object for an entity by its object ID.

Parameters
objectIdObject ID of the entity
Returns
Pointer to the scene object, or NULL if not found

Retrieves the scene object associated with a particular object ID.

Referenced by findSceneObjectByEntityId().

◆ findSceneObjectByEntityId()

makVrv::DtSceneObject * makVre::DtEntityResolver::findSceneObjectByEntityId ( const DtEntityIdentifier & entityId) const
inline

Finds the scene object for an entity by its entity identifier.

Parameters
entityIdEntity identifier of the entity
Returns
Pointer to the scene object, or NULL if not found

Convenience method that retrieves the scene object associated with a particular entity identifier. In DIS and RPR HLA, the VRL Connection Object ID is a string representation of a DtEntityIdentifier.

References findSceneObjectByObjectId().

◆ slot_elementsReadyToProcess()

void makVre::DtEntityResolver::slot_elementsReadyToProcess ( const makVrv::DtElementData::ElementIdList & elements)
protected

Element processing slots.

Slot called when elements are ready to process

Parameters
elementsList of element IDs that are ready

Internal handler that processes element ready notifications, updating the resolver's tracking system with the new elements.

◆ slot_elementsRemoved()

void makVre::DtEntityResolver::slot_elementsRemoved ( const makVrv::DtElementData::ElementIdList & elements)
protected

Slot called when elements are removed.

Parameters
elementsList of element IDs that were removed

Internal handler that processes element removal notifications, removing the elements from the resolver's tracking system and emitting the signal_entityRemoved signal.

◆ slot_elementsChanged()

void makVre::DtEntityResolver::slot_elementsChanged ( const makVrv::DtElementAttributeManager::EntryAttributesList & attrs)
protected

Slot called when element attributes are changed.

Parameters
attrsList of element attributes that were changed

Internal handler that processes element attribute change notifications, updating the resolver's tracking system with the modified attributes.

Member Data Documentation

◆ signal_entityAdded

boost::signalslib::signal<void(makVrv::DtElementID entity)> makVre::DtEntityResolver::signal_entityAdded

Signal emitted when an entity is added.

This signal is emitted whenever a new entity is added to the simulation. Handlers can connect to this signal to perform initialization or other operations when new entities are added.

◆ signal_entityRemoved

boost::signalslib::signal<void(makVrv::DtElementID entity)> makVre::DtEntityResolver::signal_entityRemoved

Signal emitted when an entity is removed.

This signal is emitted whenever an entity is removed from the simulation. Handlers can connect to this signal to perform cleanup or other operations when entities are removed.

◆ myDe

makVrv::DtDe& makVre::DtEntityResolver::myDe
protected

Reference to the display engine.

Provides access to the 3D visualization and scene management system.

◆ myDisplayNameToElementIdMap

StringToElementIdMap makVre::DtEntityResolver::myDisplayNameToElementIdMap
protected

Mapping from display names to element IDs.

◆ myElementIdToDisplayNameMap

ElementIdToStringMap makVre::DtEntityResolver::myElementIdToDisplayNameMap
protected

Mapping from element IDs to display names.

◆ myObjectIdToElementIdMap

StringToElementIdMap makVre::DtEntityResolver::myObjectIdToElementIdMap
protected

Mapping from object IDs to element IDs.

◆ myElementIdToObjectIdMap

ElementIdToStringMap makVre::DtEntityResolver::myElementIdToObjectIdMap
protected

Mapping from element IDs to object IDs.

◆ mySceneObjectMap

SceneObjectMap makVre::DtEntityResolver::mySceneObjectMap
protected

Mapping from element IDs to scene objects.

◆ myPendingRealization

std::vector<std::shared_ptr<EntityDiscoveredMessage> > makVre::DtEntityResolver::myPendingRealization
protected

List of discovered entities awaiting realization.

When an entity is discovered but not yet fully realized in the system, it is added to this list. Once realized, an EntityRealizedMessage is sent.


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