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

Detailed Description

This class provides unique identification and hierarchical matching for VREngage messages. It supports dot-notation hierarchies (e.g., "category.subcategory.name") and wildcard matching using the "*" character. Message IDs are used for message routing, filtering, and identification in the VREngage messaging system.

Message IDs are created from string type names, which are hashed for efficient comparison. The string is also tokenized by dots to support hierarchical matching.

#include <vreMessageId.h>

Public Member Functions

 DtVreMessageId ()
 
 DtVreMessageId (const std::string &name)
 
 DtVreMessageId (const DtVreMessageId &orig)
 
 ~DtVreMessageId ()
 
bool matches (const DtVreMessageId &id) const
 
bool matches (const DtVreMessageId &id, int depth) const
 
const std::string & type () const
 
void setType (const std::string &newType)
 
DtHashId idAtDepth (int depth) const
 
DtHashId hashType () const
 
bool operator== (const DtVreMessageId &rhs) const
 
bool operator!= (const DtVreMessageId &rhs) const
 

Protected Attributes

DtHashId myHashType
 
std::string myType
 
std::vector< DtHashId > myIds
 

Static Protected Attributes

static DtHashId theWildcard
 

Constructor & Destructor Documentation

◆ DtVreMessageId() [1/3]

makVre::DtVreMessageId::DtVreMessageId ( )

Default constructor.

Initializes a new message ID with an "INVALID TYPE" type string. This constructor should generally not be used directly.

Referenced by DtVreMessageId(), matches(), matches(), operator!=(), and operator==().

◆ DtVreMessageId() [2/3]

makVre::DtVreMessageId::DtVreMessageId ( const std::string & name)

Constructor with type string.

Parameters
nameType name string for the message ID

Initializes a new message ID with the specified type string. The type string is hashed for efficient comparison and tokenized by dots to support hierarchical matching. The string can contain wildcards (*) to match any value at a specific hierarchy level.

◆ DtVreMessageId() [3/3]

makVre::DtVreMessageId::DtVreMessageId ( const DtVreMessageId & orig)

Copy constructor.

Parameters
origMessage ID to copy

Creates a new message ID that is a copy of the specified message ID.

References DtVreMessageId().

◆ ~DtVreMessageId()

makVre::DtVreMessageId::~DtVreMessageId ( )

Destructor.

Cleans up resources used by the message ID.

Member Function Documentation

◆ matches() [1/2]

bool makVre::DtVreMessageId::matches ( const DtVreMessageId & id) const

Checks if this message ID matches another message ID.

Parameters
idMessage ID to compare against
Returns
True if the IDs match, false otherwise

This method checks if this message ID matches the specified message ID. If the hash values match exactly, the result is true. Otherwise, it performs a hierarchical comparison, taking wildcards into account. A wildcard in this ID will match any value in the corresponding position of the other ID.

References DtVreMessageId().

◆ matches() [2/2]

bool makVre::DtVreMessageId::matches ( const DtVreMessageId & id,
int depth ) const

Checks if this message ID matches another message ID at a specific depth.

Parameters
idMessage ID to compare against
depthHierarchy level to compare at (0-based index)
Returns
True if the IDs match at the specified depth, false otherwise

This method checks if this message ID matches the specified message ID at the given hierarchy depth. It compares the hash values at the specified depth, taking wildcards into account. A wildcard in this ID will match any value in the corresponding position of the other ID.

References DtVreMessageId().

◆ type()

const std::string & makVre::DtVreMessageId::type ( ) const
inline

Gets the type string of this message ID.

Returns
Reference to the type string

This method returns the original type string used to create this message ID.

References myType.

◆ setType()

void makVre::DtVreMessageId::setType ( const std::string & newType)

Sets a new type string for this message ID.

Parameters
newTypeNew type string to set

This method sets a new type string for this message ID and recomputes the hash values and tokenized hierarchy. It is generally not recommended to change the type of a message ID after creation.

◆ idAtDepth()

DtHashId makVre::DtVreMessageId::idAtDepth ( int depth) const
inline

Gets the hash value at a specific hierarchy depth.

Parameters
depthHierarchy level to get the hash for (0-based index)
Returns
Hash value at the specified depth

This method returns the hash value at the specified hierarchy depth. It is used for hierarchical matching in the message routing system.

References myIds.

◆ hashType()

DtHashId makVre::DtVreMessageId::hashType ( ) const
inline

Gets the hash value of the complete type string.

Returns
Hash value of the type string

This method returns the hash value of the complete type string. It is used for efficient message type identification and comparison.

References myHashType.

◆ operator==()

bool makVre::DtVreMessageId::operator== ( const DtVreMessageId & rhs) const

Equality operator.

Parameters
rhsRight-hand side message ID to compare with
Returns
True if the message IDs have the same hash value, false otherwise

This operator compares the hash values of the two message IDs. Two message IDs are considered equal if their hash values match exactly.

References DtVreMessageId().

◆ operator!=()

bool makVre::DtVreMessageId::operator!= ( const DtVreMessageId & rhs) const
inline

Inequality operator.

Parameters
rhsRight-hand side message ID to compare with
Returns
True if the message IDs have different hash values, false otherwise

This operator is the logical negation of the equality operator.

References DtVreMessageId().

Member Data Documentation

◆ myHashType

DtHashId makVre::DtVreMessageId::myHashType
protected

Hash value of the complete type string.

This hash value is used for efficient message type identification and comparison.

Referenced by hashType().

◆ myType

std::string makVre::DtVreMessageId::myType
protected

Original type string used to create this message ID.

Referenced by type().

◆ myIds

std::vector<DtHashId> makVre::DtVreMessageId::myIds
protected

Vector of hash values for each hierarchy level.

This vector contains the hash values for each level of the dot-separated hierarchy. Wildcards are represented by the special theWildcard value.

Referenced by idAtDepth().

◆ theWildcard

DtHashId makVre::DtVreMessageId::theWildcard
staticprotected

Special hash value used to represent wildcards in the hierarchy.

This value is used in the myIds vector to represent wildcards (*) in the type string hierarchy.


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