diff --git a/libs/uuid/uuid.html b/libs/uuid/uuid.html index 6bc4802..575b4db 100644 --- a/libs/uuid/uuid.html +++ b/libs/uuid/uuid.html @@ -2,19 +2,20 @@ Uuid Library + -

boost.png (6897 bytes) -Uuid

+

BoostUuid

-

Contents

+

Contents

  1. Introduction
  2. Class uuid synopsis
  3. Rationale
  4. -
  5. Interface
  6. +
  7. Interface +
  8. Serialization
  9. Design notes
  10. References
  11. History and Acknowledgements
-

Introduction

-UUIDs are a 128 bit or 16 byte value. They are often +

Introduction

+

UUIDs are a 128 bit or 16 byte value. They are often used to tag objects. If a UUID is generated by one of the defined mechanisms, it is either guaranteed to be unique, different from all other generated UUIDs (that is, it has never been generated before and it will @@ -56,16 +58,16 @@ public: , state(state) {} - object(object const& rhs) + object(object const& rhs) : tag(rhs.tag) , state(rhs.state) {} - bool operator==(object const& rhs) const { + bool operator==(object const& rhs) const { return tag == rhs.tag; } - object& operator=(object const& rhs) { + object& operator=(object const& rhs) { tag = rhs.tag; state = rhs.state; } @@ -110,7 +112,7 @@ the defined mechanisms. boost::uuids::uuid u; - memcpy(&u, uuid_data, 16); + memcpy(&u, uuid_data, 16); } { // example using aggregate initializers @@ -134,16 +136,16 @@ public: : boost::uuids::uuid(boost::uuids::random_generator()()) {} - explicit uuid_class(boost::uuids::uuid const& u) + explicit uuid_class(boost::uuids::uuid const& u) : boost::uuids::uuid(u) {} operator boost::uuids::uuid() { - return static_cast<boost::uuids::uuid&>(*this); + return static_cast<boost::uuids::uuid&>(*this); } operator boost::uuids::uuid() const { - return static_cast<boost::uuids::uuid const&>(*this); + return static_cast<boost::uuids::uuid const&>(*this); } }; @@ -153,7 +155,7 @@ uuid_class u2; assert(u1 != u2); -

Class uuid synopsis

+

Class uuid synopsis

 #include <boost/uuid/uuid.hpp>
 
@@ -163,8 +165,8 @@ namespace uuids {
 class uuid {
 public:
     typedef uint8_t value_type;
-    typedef uint8_t& reference;
-    typedef uint8_t const& const_reference;
+    typedef uint8_t& reference;
+    typedef uint8_t const& const_reference;
     typedef uint8_t* iterator;
     typedef uint8_t const* const_iterator;
     typedef std::size_t size_type;
@@ -201,22 +203,22 @@ public:
     version_type version() const;
 
     // Swap function
-    void swap(uuid& rhs);
+    void swap(uuid& rhs);
 
     uint8_t data[static_size()];
 };
 
 // standard operators
-bool operator==(uuid const& lhs, uuid const& rhs);
-bool operator!=(uuid const& lhs, uuid const& rhs);
-bool operator<(uuid const& lhs, uuid const& rhs);
-bool operator>(uuid const& lhs, uuid const& rhs);
-bool operator<=(uuid const& lhs, uuid const& rhs);
-bool operator>=(uuid const& lhs, uuid const& rhs);
+bool operator==(uuid const& lhs, uuid const& rhs);
+bool operator!=(uuid const& lhs, uuid const& rhs);
+bool operator<(uuid const& lhs, uuid const& rhs);
+bool operator>(uuid const& lhs, uuid const& rhs);
+bool operator<=(uuid const& lhs, uuid const& rhs);
+bool operator>=(uuid const& lhs, uuid const& rhs);
 
-void swap(uuid& lhs, uuid& rhs);
+void swap(uuid& lhs, uuid& rhs);
 
-std::size_t hash_value(uuid const& u);
+std::size_t hash_value(uuid const& u);
 
 }} // namespace boost::uuids
 
@@ -227,10 +229,10 @@ namespace boost { namespace uuids { template <typename ch, typename char_traits> - std::basic_ostream<ch, char_traits>& operator<<(std::basic_ostream<ch, char_traits> &os, uuid const& u); + std::basic_ostream<ch, char_traits>& operator<<(std::basic_ostream<ch, char_traits> &os, uuid const& u); template <typename ch, typename char_traits> - std::basic_istream<ch, char_traits>& operator>>(std::basic_istream<ch, char_traits> &is, uuid &u); + std::basic_istream<ch, char_traits>& operator>>(std::basic_istream<ch, char_traits> &is, uuid &u); }} // namespace boost::uuids @@ -261,19 +263,19 @@ struct string_generator { typedef uuid result_type; template <typename ch, typename char_traits, typename alloc> - uuid operator()(std::basic_string<ch, char_traits, alloc> const& s) const; + uuid operator()(std::basic_string<ch, char_traits, alloc> const& s) const; }; class name_generator { public: typedef uuid result_type; - explicit name_generator(uuid const& namespace_uuid); + explicit name_generator(uuid const& namespace_uuid); uuid operator()(const char* name) const; uuid operator()(const wchar_t* name) const; tempate <typename ch, typename char_traits, typename alloc> - uuid operator()(std::basic_string<ch, char_traits, alloc> const& name) const; + uuid operator()(std::basic_string<ch, char_traits, alloc> const& name) const; uuid operator()(void const* buffer, std::size_t byte_count) const; }; @@ -283,7 +285,7 @@ public: typedef uuid result_type; basic_random_generator(); - explicit basic_random_generator(UniformRandomNumberGenerator& gen); + explicit basic_random_generator(UniformRandomNumberGenerator& gen); explicit basic_random_generator(UniformRandomNumberGenerator* pGen); uuid operator()(); @@ -292,8 +294,9 @@ typedef basic_random_generator<mt19937> random_generator; }} // namespace boost::uuids -

Rationale

+

Rationale

+

A UUID, or Universally unique identifier, is intended to uniquely identify information in a distributed environment without significant central coordination. It can be used to tag objects with very short lifetimes, or @@ -316,13 +319,12 @@ An attractive feature of UUIDs when compared to alternatives is their relative small size, of 128-bits, or 16-bytes. Another is that the creation of UUIDs does not require a centralized authority. -

Interface

+

Interface

-

Operators

+

Operators

+

All of the standard numeric operators are defined for the uuid class. These include: -
-

     operator==
     operator!=
@@ -332,21 +334,26 @@ class. These include:
     operator>=
 
-

Input and Output

+

Input and Output

+

Input and output stream operators << and >> are provided by including boost/uuid/uuid_io.hpp. The external representation of a uuid is a string of hexidecimal digits of the following form: -
+

 hhhhhhhh-hhhh-hhhh-hhhh-hhhhhhhhhhhh
+
-

Nil uuid

+

Nil uuid

+

The function, boost::uuids::uuid::is_null() returns true if and only if the uuid is equal to {00000000-0000-0000-0000-000000000000} and returns false otherwise. Note that boost::uuids::uuid().is_null() == true. +

-

Byte Extraction

+

Byte Extraction

+

These functions are useful to get at the 16 bytes of a uuid. Typical use is as follows:

@@ -357,7 +364,8 @@ std::copy(u.begin(), u.end(), v.begin());
 
 

Note: boost::uuids::uuid::size() always returnes 16. -

Hash Function

+

Hash Function

+

This function allows uuids to be used with boost::hash @@ -366,7 +374,8 @@ boost::hash<boost::uuids::uuid> uuid_hasher; std::size_t uuid_hash_value = uuid_hasher(boost::uuids::uuid());

-

Generation

+

Generation

+

There are a number of classes provided that generate uuids.

Include boost/uuid/uuid_generators.hpp. @@ -382,7 +391,7 @@ assert(u.is_nil() == true); boost::uuids::uuid u = boost::uuids::nil_uuid(); assert(u.is_nil() == true); - +

The boost::uuids::string_generator class generates a uuid from a string.

 boost::uuids::string_generator gen;
@@ -391,7 +400,7 @@ boost::uuids::uuid u2 = gen(L"01234567-89ab-cdef-0123456789abcdef");
 boost::uuids::uuid u3 = gen(std::string("0123456789abcdef0123456789abcdef"));
 boost::uuids::uuid u4 = gen(std::wstring(L"01234567-89ab-cdef-0123456789abcdef"));
 
- +

The boost::uuids::name_generator class generates a name based uuid from a namespace uuid and a name.

@@ -400,7 +409,7 @@ boost::uuids::uuid dns_namespace_uuid; // initialize to {6ba7b810-9dad-11d1-80b4
 boost::uuids::name_generator gen(dns_namespace_uuid);
 boost::uuids::uuid u = gen("boost.org");
 
- +

The boost::uuids::basic_random_generator class generates a random number based uuid from a random number generator (one that conforms to the UniformRandomNumberGenerator @@ -418,11 +427,12 @@ boost::uuids::uuid u = gen(); //use an existing random number generator //pass either a reference or a pointer to the random number generator boost::mt19937 ran; -boost::uuids::basic_random_generator<boost::mt19937> gen(&ran); +boost::uuids::basic_random_generator<boost::mt19937> gen(&ran); boost::uuids::uuid u = gen(); -

Serialization

+

Serialization

+

Serialization is accomplished with the Boost Serialization library. A uuid is serialized as a @@ -430,8 +440,9 @@ primitive type, thus only the uuid value will be saved to/loaded from

Include boost/uuid/uuid_serialize.hpp to enable serialization for uuids. -

Design notes

-The document, +

Design notes

+

+The document, http://www.itu.int/ITU-T/studygroups/com17/oid/X.667-E.pdf, was used to design and implement the boost::uuids::uuid struct. @@ -446,7 +457,7 @@ compute the uuid.

All functions are re-entrant. Classes are as thread-safe as an int. That is an instance can not be shared between threads without proper synchronization. -

References

+

References

-

History and Acknowledgements

- +

History and Acknowledgements

+

A number of people on the boost.org mailing list provided useful comments and greatly helped to shape the library.