C++ namespace for unique_id helper functions. More...
Namespaces | |
impl | |
C++ namespace for private implementation details. | |
Functions | |
static boost::uuids::uuid | fromHexString (std::string const &str) |
Generate UUID from canonical hex string. More... | |
static boost::uuids::uuid | fromMsg (uuid_msgs::UniqueID const &msg) |
Create UUID object from UniqueID message. More... | |
static boost::uuids::uuid | fromRandom (void) |
Generate a random UUID object. More... | |
static boost::uuids::uuid | fromTime (ros::Time timestamp, uint64_t hw_addr) |
Generate a Time Based UUID object. Users are recommended to seed the random number generator using srand from the calling application to generate the clock_id. More... | |
static boost::uuids::uuid | fromURL (std::string const &url) |
Generate UUID from Uniform Resource Identifier. More... | |
static std::string | toHexString (boost::uuids::uuid const &uu) |
Get the canonical string representation for a boost UUID. More... | |
static std::string | toHexString (uuid_msgs::UniqueID const &msg) |
Get the canonical string representation for a UniqueID message. More... | |
static uuid_msgs::UniqueID | toMsg (boost::uuids::uuid const &uu) |
Create a UniqueID message from a UUID object. More... | |
C++ namespace for unique_id helper functions.
Various ROS components use universally unique identifiers. This header provides functions for working with a common uuid_msgs/UniqueID message, and the boost uuid class.
Programmers are free to create UUID objects using any approved RFC 4122 method. The boost uuid interface supports them all.
Functions in this namespace provide simple APIs, not requiring detailed knowledge of RFC 4122 or the boost uuid interface. ROS applications are likely to need either a random or a name-based UUID.
|
inlinestatic |
Generate UUID from canonical hex string.
str | string containing canonical hex representation |
The canonical hex string is a human-readable representation of a correctly-formatted sixteen-byte UUID. In addition to the dashes, it should contain exactly 32 hexadecimal digits. The str can be any accepted by the boost uuid string generator, but that is not well-defined. The format produced by toHexString() works reliably: "01234567-89ab-cdef-0123-456789abcdef".
std::runtime_error
exception, or silently ignoring parts of the string. Definition at line 125 of file unique_id.h.
|
inlinestatic |
Create UUID object from UniqueID message.
msg | uuid_msgs/UniqueID message. |
Definition at line 85 of file unique_id.h.
|
inlinestatic |
Generate a random UUID object.
Different calls to this function at any time or place will almost certainly generate different UUIDs. The method used is RFC 4122 variant 4.
Definition at line 100 of file unique_id.h.
|
inlinestatic |
Generate a Time Based UUID object. Users are recommended to seed the random number generator using srand from the calling application to generate the clock_id.
timestamp | The ros::Time timestamp for UUID generation |
hw_addr | A 48-bit (6 octets) network address assigned to the 48 LSBs |
Different calls to this function at any time or place will almost certainly generate different UUIDs. The method used is RFC 4122 version 1.
Definition at line 167 of file unique_id.h.
|
inlinestatic |
Generate UUID from Uniform Resource Identifier.
url | URL for identifier creation. |
Matching url strings must yield the same UUID. Different url strings will almost certainly generate different UUIDs. The method used is RFC 4122 variant 5, computing the SHA-1 hash of the url.
For any given url, this function returns the same UUID as the corresponding Python unique_id.fromURL()
function.
For example, Open Street Map identifiers are encoded like this, with decimal representations of the integer OSM node, way, or relation identifiers appended to the URL:
Definition at line 151 of file unique_id.h.
|
inlinestatic |
Get the canonical string representation for a boost UUID.
uu | boost::uuids::uuid object. |
A boost::uuids::uuid
object yields the same representation via its <<
operator or to_string()
function.
Definition at line 192 of file unique_id.h.
|
inlinestatic |
Get the canonical string representation for a UniqueID message.
msg | uuid_msgs/UniqueID message. |
Definition at line 202 of file unique_id.h.
|
inlinestatic |
Create a UniqueID message from a UUID object.
uu | boost::uuids::uuid object. |
Definition at line 177 of file unique_id.h.