Namespaces | Functions
unique_id Namespace Reference

C++ namespace for unique_id helper functions. More...

Namespaces

namespace  impl
 

C++ namespace for private implementation details.


Functions

boost::uuids::uuid fromHexString (std::string const &str)
 Generate UUID from canonical hex string.
boost::uuids::uuid fromMsg (uuid_msgs::UniqueID const &msg)
 Create UUID object from UniqueID message.
boost::uuids::uuid fromRandom (void)
 Generate a random UUID object.
boost::uuids::uuid fromURL (std::string const &url)
 Generate UUID from Uniform Resource Identifier.
std::string toHexString (boost::uuids::uuid const &uu)
 Get the canonical string representation for a boost UUID.
std::string toHexString (uuid_msgs::UniqueID const &msg)
 Get the canonical string representation for a UniqueID message.
uuid_msgs::UniqueID toMsg (boost::uuids::uuid const &uu)
 Create a UniqueID message from a UUID object.

Detailed Description

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.


Function Documentation

boost::uuids::uuid unique_id::fromHexString ( std::string const &  str)

Generate UUID from canonical hex string.

Parameters:
strstring containing canonical hex representation
Returns:
corresponding boost::uuids::uuid object.
Note:
This is not a general service for generating a UUID from an arbitrary character string. The fromURL() function will do that for any Uniform Resource Identifier.

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".

Warning:
Strings not accepted by boost may produce undefined results: perhaps throwing a std::runtime_error exception, or silently ignoring parts of the string.

Definition at line 125 of file unique_id.h.

Create UUID object from UniqueID message.

Parameters:
msguuid_msgs/UniqueID message.
Returns:
boost::uuids::uuid object.

Definition at line 85 of file unique_id.h.

Generate a random UUID object.

Returns:
type 4 boost::uuids::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.

boost::uuids::uuid unique_id::fromURL ( std::string const &  url)

Generate UUID from Uniform Resource Identifier.

Parameters:
urlURL for identifier creation.
Returns:
type 5 boost::uuids::uuid object.

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:

  • fromURL("http://openstreetmap.org/node/123456789")
  • fromURL("http://openstreetmap.org/way/6543210")
  • fromURL("http://openstreetmap.org/relation/999999")

Definition at line 151 of file unique_id.h.

std::string unique_id::toHexString ( boost::uuids::uuid const &  uu)

Get the canonical string representation for a boost UUID.

Parameters:
uuboost::uuids::uuid object.
Returns:
canonical UUID hex string: "01234567-89ab-cdef-0123-456789abcdef".

A boost::uuids::uuid object yields the same representation via its << operator or to_string() function.

Definition at line 176 of file unique_id.h.

std::string unique_id::toHexString ( uuid_msgs::UniqueID const &  msg)

Get the canonical string representation for a UniqueID message.

Parameters:
msguuid_msgs/UniqueID message.
Returns:
canonical UUID hex string: "01234567-89ab-cdef-0123-456789abcdef".

Definition at line 186 of file unique_id.h.

Create a UniqueID message from a UUID object.

Parameters:
uuboost::uuids::uuid object.
Returns:
uuid_msgs/UniqueID message.

Definition at line 161 of file unique_id.h.



unique_id
Author(s): Jack O'Quin
autogenerated on Mon Oct 6 2014 08:23:45