|
|
The node ID is composed of two uint64_t integers. The first integer is the unique node ID. The second integer is the node positiion and is set to the unique node ID of the previous node. If it is the first node, then the position is set to 0. The upper half of the unique node ID (the most significant 32 bits) is the instance ID. The lower half of the unique node ID (the least significant 32 bits) is the unique part of the node ID for that instance.
typedef uint64_t UniqueNodeId | UniqueNodeId |
typedef uint64_t Position | Position |
typedef uint32_t InstanceId | InstanceId |
explicit ConfigNodeId (const string& s)
throw (InvalidString) | ConfigNodeId |
Constructor from a string.
The string format is two uint64_t integers separated by space. The first integer is the unique node ID. The second integer is the node positiion and is set to the unique node ID of the previous node. If it is the first node, then the position is set to 0.
Parameters:
s | the initialization string. |
ConfigNodeId (const UniqueNodeId& unique_node_id, const Position& position)
| ConfigNodeId |
Constructor for a given unique node ID and position.
Parameters:
unique_node_id | the unique node ID. |
position | the position of the node. |
~ConfigNodeId ()
| ~ConfigNodeId |
[virtual]
size_t copy_in (const string& from_string)
throw (InvalidString) | copy_in |
Copy an unique node ID from a string into ConfigNodeId structure.
Parameters:
from_string | the string to copy the node ID from. |
Returns: the number of copied octets.
bool operator== (const ConfigNodeId& other)
| operator== |
[const]
Equality Operator
Parameters:
other | the right-hand operand to compare against. |
Returns: true if the left-hand operand is numerically same as the right-hand operand.
const UniqueNodeId& unique_node_id ()
| unique_node_id |
[const]
Return the unique node ID.
Returns: the unique node ID.
const Position& position ()
| position |
[const]
Return the position of the node.
Returns: the position of the node.
void set_instance_id (const InstanceId& v)
| set_instance_id |
Set the instance ID.
Parameters:
v | the instance ID. |
void set_position (const Position& v)
| set_position |
Set the node position.
The node position is equal to the unique node ID of the previous node.
Parameters:
v | the node position. |
const ConfigNodeId& generate_unique_node_id ()
| generate_unique_node_id |
Generate a new unique node ID.
Note that this instance is modified to the value of the new unique node ID.
Returns: a new unique node ID.
string str ()
| str |
[const]
Convert this node ID from binary form to presentation format.
Returns: C++ string with the human-readable ASCII representation of the node ID.
bool is_empty ()
| is_empty |
[const]
Test if the node ID is empty.
Returns: true if the node ID is empty, otherwise false.
ConfigNodeId ZERO ()
| ZERO |
[static]
Pre-defined constants.