|
VR-Engage
2.2
|
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 |
| 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==().
| makVre::DtVreMessageId::DtVreMessageId | ( | const std::string & | name | ) |
Constructor with type string.
| name | Type 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.
| makVre::DtVreMessageId::DtVreMessageId | ( | const DtVreMessageId & | orig | ) |
Copy constructor.
| orig | Message ID to copy |
Creates a new message ID that is a copy of the specified message ID.
References DtVreMessageId().
| makVre::DtVreMessageId::~DtVreMessageId | ( | ) |
Destructor.
Cleans up resources used by the message ID.
| bool makVre::DtVreMessageId::matches | ( | const DtVreMessageId & | id | ) | const |
Checks if this message ID matches another message ID.
| id | Message ID to compare against |
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().
| bool makVre::DtVreMessageId::matches | ( | const DtVreMessageId & | id, |
| int | depth ) const |
Checks if this message ID matches another message ID at a specific depth.
| id | Message ID to compare against |
| depth | Hierarchy level to compare at (0-based index) |
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().
|
inline |
Gets the type string of this message ID.
This method returns the original type string used to create this message ID.
References myType.
| void makVre::DtVreMessageId::setType | ( | const std::string & | newType | ) |
Sets a new type string for this message ID.
| newType | New 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.
|
inline |
Gets the hash value at a specific hierarchy depth.
| depth | Hierarchy level to get the hash for (0-based index) |
This method returns the hash value at the specified hierarchy depth. It is used for hierarchical matching in the message routing system.
References myIds.
|
inline |
Gets the hash value of the complete 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.
| bool makVre::DtVreMessageId::operator== | ( | const DtVreMessageId & | rhs | ) | const |
Equality operator.
| rhs | Right-hand side message ID to compare with |
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().
|
inline |
Inequality operator.
| rhs | Right-hand side message ID to compare with |
This operator is the logical negation of the equality operator.
References DtVreMessageId().
|
protected |
Hash value of the complete type string.
This hash value is used for efficient message type identification and comparison.
Referenced by hashType().
|
protected |
Original type string used to create this message ID.
Referenced by type().
|
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().
|
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.