36 #ifndef _IMPL_UNIQUE_ID_H_ 37 #define _IMPL_UNIQUE_ID_H_ 1 48 #include <boost/uuid/uuid_generators.hpp> 64 "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
71 static boost::uuids::name_generator
genURL(url_namespace_uuid);
80 uint64_t offset = 122192928000000000;
82 uint64_t num_hundred_epoch =
static_cast<uint64_t
>(uuid_time.
sec) / (1e-9 * 100) +
83 static_cast<uint64_t
>(uuid_time.
nsec) / 100;
86 uint64_t num_hundred_rfc = num_hundred_epoch + offset;
88 uint32_t time_low =
static_cast<uint32_t
>(num_hundred_rfc);
89 uint16_t time_mid =
static_cast<uint16_t
>(num_hundred_rfc >> 32);
90 uint16_t version = 0x1000;
91 uint16_t time_hi_and_version =
static_cast<uint16_t
>(num_hundred_rfc >> (32 + 16)) | version;
94 uint16_t clock_seq_and_reserved = (rand() % (1 << 14)) | 0x8000;
97 static_cast<uint8_t
>(time_low >> 24), static_cast<uint8_t>(time_low >> 16),
98 static_cast<uint8_t
>(time_low >> 8), static_cast<uint8_t>(time_low),
99 static_cast<uint8_t
>(time_mid >> 8), static_cast<uint8_t>(time_mid),
100 static_cast<uint8_t
>(time_hi_and_version >> 8),
101 static_cast<uint8_t>(time_hi_and_version),
102 static_cast<uint8_t
>(clock_seq_and_reserved >> 8),
103 static_cast<uint8_t>(clock_seq_and_reserved),
104 static_cast<uint8_t
>(hw_addr >> 40), static_cast<uint8_t>(hw_addr >> 32),
105 static_cast<uint8_t
>(hw_addr >> 24), static_cast<uint8_t>(hw_addr >> 16),
106 static_cast<uint8_t
>(hw_addr >> 8), static_cast<uint8_t>(hw_addr)
115 #endif // _IMPL_UNIQUE_ID_H_ static const boost::uuids::uuid url_namespace_uuid
C++ namespace for unique_id helper functions.
static boost::uuids::random_generator genRandom
static boost::uuids::uuid genTime(ros::Time uuid_time, uint64_t hw_addr)
static boost::uuids::string_generator genString
static const std::string url_namespace
static boost::uuids::name_generator genURL(url_namespace_uuid)