cmn_UUID_t Class Reference
[Common, basic classes, functions and types]

#include <uuid.h>

List of all members.


Detailed Description

Struct encapsulates UUID generation, comparison, copying, making string versions,.

..

UUID is 128-bit (16-byte) value, that is accepted by both Microsoft and DCE. This was proposed to be an Internet standard.

An example of stringified UUID:

    696c7a33-2bf7-4b37-b769-8dd94f3c9eab
    

Usage:

Create new UUID:

    cmn_UUID_t newUUID;
    // OR
    myUUID.Generate();
    

Get an existing UUID from a buffer:

    cmn_UUID_t partUUID(volHdr.partID);
    cmn_UUID_t poolUUID = volHdr.partID;
    

Parse an existing UUID from a string:

    string strUUID("696c7a33-2bf7-4b37-b769-8dd94f3c9eab");

    cmn_UUID_t uuid1 = strUUID;
    cmn_UUID_t uuid2(strUUID);
    

Print a stringified UUID:

    cout << uuid << endl;
    cout << uuid.ToString() << endl;
    

Copy an UUID to a buffer:

    unsigned char buf[ivd_UUID_SIZE_d];
    cmn_UUID_t    uuid;

    memcpy(buf, uuid.Raw(), ivd_UUID_SIZE_d);
    

Structure of the UUID:

UUID-structure.gif

Definition at line 31 of file uuid.h.


Public Member Functions

 cmn_UUID_t ()
 Creates new UUID.
 cmn_UUID_t (const unsigned char *a_binaryUUID)
 Creates a UUID from its binary form.
 cmn_UUID_t (const char *a_binaryUUID)
 Creates a UUID from its binary form.
 cmn_UUID_t (const string &a_stringUUID)
 Make an UUID from its stringified representation.
 cmn_UUID_t (const cmn_UUID_t &a_uuid)
 Copy constructor.
 ~cmn_UUID_t ()
cmn_UUID_toperator= (const cmn_UUID_t &a_uuid)
 Copy operator.
cmn_UUID_toperator= (const string &a_stringUUID)
 Make an UUID from its stringified representation.
bool operator== (const cmn_UUID_t &a_uuid) const
bool operator!= (const cmn_UUID_t &a_uuid) const
void Generate ()
 Create new UUID.
const unsigned char * Raw () const
 Raw representation of UUID.
string ToString () const
 Create stringified representation of the UUID.
void Clear ()
 Make null UUID.
bool IsNull () const

Private Attributes

 log_CLASSID_m
unsigned char m_uuid [ivd_UUID_SIZE_d]

Constructor & Destructor Documentation

cmn_UUID_t::cmn_UUID_t (  ) 

Creates new UUID.

Definition at line 98 of file cmn_uuid.cpp.

References Generate().

00098                        {
00099     Generate();
00100 }

Here is the call graph for this function:

cmn_UUID_t::cmn_UUID_t ( const unsigned char *  a_binaryUUID  ) 

Creates a UUID from its binary form.

Definition at line 103 of file cmn_uuid.cpp.

References m_uuid.

00103                                                         {
00104     uuid_copy(m_uuid, const_cast<unsigned char*>(a_binaryUUID));
00105 }

cmn_UUID_t::cmn_UUID_t ( const char *  a_binaryUUID  ) 

Creates a UUID from its binary form.

Definition at line 108 of file cmn_uuid.cpp.

References m_uuid.

00108                                                {
00109     uuid_copy(
00110         m_uuid,
00111         reinterpret_cast<unsigned char*>(const_cast<char*>(a_binaryUUID)) );
00112 }

cmn_UUID_t::cmn_UUID_t ( const string &  a_stringUUID  ) 

Make an UUID from its stringified representation.

Definition at line 115 of file cmn_uuid.cpp.

References Clear(), ie_UUID, ivd_Error, and m_uuid.

00115                                                   {
00116 
00117     if (a_stringUUID.length() == 0) {
00118         Clear();
00119         return;
00120     }
00121 
00122     int result = uuid_parse(const_cast<char*>(a_stringUUID.c_str()), m_uuid);
00123     if (result != 0) {
00124         throw ivd_Error(ie_UUID, "UUID: " + a_stringUUID);
00125     }
00126 }

Here is the call graph for this function:

cmn_UUID_t::cmn_UUID_t ( const cmn_UUID_t a_uuid  ) 

Copy constructor.

Definition at line 129 of file cmn_uuid.cpp.

References m_uuid.

00129                                                {
00130     if (&a_uuid != this) {
00131         uuid_copy(m_uuid, const_cast<unsigned char*>(a_uuid.m_uuid) );
00132     }
00133 }

cmn_UUID_t::~cmn_UUID_t (  )  [inline]

Definition at line 39 of file uuid.h.

00039 {};


Member Function Documentation

cmn_UUID_t & cmn_UUID_t::operator= ( const cmn_UUID_t a_uuid  ) 

Copy operator.

Definition at line 136 of file cmn_uuid.cpp.

References m_uuid.

00136                                                           {
00137     if (&a_uuid != this) {
00138         uuid_copy(m_uuid, const_cast<unsigned char*>(a_uuid.m_uuid));
00139     }
00140     return *this;
00141 }

cmn_UUID_t & cmn_UUID_t::operator= ( const string &  a_stringUUID  ) 

Make an UUID from its stringified representation.

Definition at line 144 of file cmn_uuid.cpp.

References Clear(), ie_UUID, ivd_Error, and m_uuid.

00144                                                             {
00145 
00146     if (a_stringUUID.length() == 0) {
00147         Clear();
00148         return *this;
00149     }
00150 
00151     int result = uuid_parse(const_cast<char*>(a_stringUUID.c_str()), m_uuid);
00152     if (result != 0) {
00153         throw ivd_Error(ie_UUID, "UUID: " + a_stringUUID);
00154     }
00155 
00156     return *this;
00157 }

Here is the call graph for this function:

bool cmn_UUID_t::operator== ( const cmn_UUID_t a_uuid  )  const

Definition at line 159 of file cmn_uuid.cpp.

References m_uuid.

Referenced by operator!=().

00159                                                           {
00160     if (&a_uuid == this) {
00161         return true;
00162     }
00163     else {
00164         int result = uuid_compare(
00165             const_cast<unsigned char*>(m_uuid),
00166             const_cast<unsigned char*>(a_uuid.m_uuid) );
00167         return (result == 0);
00168     }
00169 }

Here is the caller graph for this function:

bool cmn_UUID_t::operator!= ( const cmn_UUID_t a_uuid  )  const

Definition at line 171 of file cmn_uuid.cpp.

References operator==().

00171                                                           {
00172     return !(operator==(a_uuid));
00173 }

Here is the call graph for this function:

void cmn_UUID_t::Generate (  ) 

Create new UUID.

Definition at line 177 of file cmn_uuid.cpp.

References m_uuid.

Referenced by cmn_UUID_t().

00177                           {
00178     uuid_generate(m_uuid);
00179 }

Here is the caller graph for this function:

const unsigned char * cmn_UUID_t::Raw (  )  const

Raw representation of UUID.

Definition at line 182 of file cmn_uuid.cpp.

References m_uuid.

00182                                            {
00183     return m_uuid;
00184 }

string cmn_UUID_t::ToString (  )  const

void cmn_UUID_t::Clear ( void   ) 

Make null UUID.

Definition at line 195 of file cmn_uuid.cpp.

References m_uuid.

Referenced by bea_VolInfo_t::bea_VolInfo_t(), bea_FRIThread::CheckFRI(), cmn_UUID_t(), df_RecReader::FRIEndCheck(), operator=(), bea_FRI::ReadFRIStart(), and bea_FRIThread::ReadFromSysVol().

00195                        {
00196     uuid_clear(m_uuid);
00197 }

Here is the caller graph for this function:

bool cmn_UUID_t::IsNull (  )  const


Member Data Documentation

Definition at line 55 of file uuid.h.

unsigned char cmn_UUID_t::m_uuid[ivd_UUID_SIZE_d] [private]

Definition at line 60 of file uuid.h.

Referenced by Clear(), cmn_UUID_t(), Generate(), IsNull(), operator=(), operator==(), Raw(), and ToString().


The documentation for this class was generated from the following files:

Generated on Mon Feb 27 19:06:08 2012 for OPENARCHIVE by  doxygen 1.5.6