Public Member Functions | Private Attributes

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

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

#include <uuid.h>

List of all members.

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]

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 45 of file uuid.h.


Constructor & Destructor Documentation

cmn_UUID_t::cmn_UUID_t (  ) 

Creates new UUID.

Definition at line 112 of file cmn_uuid.cpp.

References Generate().

                       {
    Generate();
}

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 117 of file cmn_uuid.cpp.

References m_uuid.

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

cmn_UUID_t::cmn_UUID_t ( const char *  a_binaryUUID  ) 

Creates a UUID from its binary form.

Definition at line 122 of file cmn_uuid.cpp.

References m_uuid.

                                               {
    uuid_copy(
        m_uuid,
        reinterpret_cast<unsigned char*>(const_cast<char*>(a_binaryUUID)) );
}

cmn_UUID_t::cmn_UUID_t ( const string &  a_stringUUID  ) 

Make an UUID from its stringified representation.

Definition at line 129 of file cmn_uuid.cpp.

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

                                                  {

    if (a_stringUUID.length() == 0) {
        Clear();
        return;
    }

    int result = uuid_parse(const_cast<char*>(a_stringUUID.c_str()), m_uuid);
    if (result != 0) {
        throw ivd_Error(ie_UUID, "UUID: " + a_stringUUID);
    }
}

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 143 of file cmn_uuid.cpp.

References m_uuid.

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

cmn_UUID_t::~cmn_UUID_t (  )  [inline]

Definition at line 53 of file uuid.h.

{};


Member Function Documentation

void cmn_UUID_t::Clear ( void   ) 

Make null UUID.

Definition at line 209 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().

                       {
    uuid_clear(m_uuid);
}

Here is the caller graph for this function:

void cmn_UUID_t::Generate (  ) 

Create new UUID.

Definition at line 191 of file cmn_uuid.cpp.

References m_uuid.

Referenced by cmn_UUID_t().

                          {
    uuid_generate(m_uuid);
}

Here is the caller graph for this function:

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

Definition at line 185 of file cmn_uuid.cpp.

References operator==().

                                                          {
    return !(operator==(a_uuid));
}

Here is the call graph for this function:

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

Make an UUID from its stringified representation.

Definition at line 158 of file cmn_uuid.cpp.

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

                                                            {

    if (a_stringUUID.length() == 0) {
        Clear();
        return *this;
    }

    int result = uuid_parse(const_cast<char*>(a_stringUUID.c_str()), m_uuid);
    if (result != 0) {
        throw ivd_Error(ie_UUID, "UUID: " + a_stringUUID);
    }

    return *this;
}

Here is the call graph for this function:

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

Copy operator.

Definition at line 150 of file cmn_uuid.cpp.

References m_uuid.

                                                          {
    if (&a_uuid != this) {
        uuid_copy(m_uuid, const_cast<unsigned char*>(a_uuid.m_uuid));
    }
    return *this;
}

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

Definition at line 173 of file cmn_uuid.cpp.

References m_uuid.

Referenced by operator!=().

                                                          {
    if (&a_uuid == this) {
        return true;
    }
    else {
        int result = uuid_compare(
            const_cast<unsigned char*>(m_uuid),
            const_cast<unsigned char*>(a_uuid.m_uuid) );
        return (result == 0);
    }
}

Here is the caller graph for this function:

const unsigned char * cmn_UUID_t::Raw (  )  const

Raw representation of UUID.

Definition at line 196 of file cmn_uuid.cpp.

References m_uuid.

                                           {
    return m_uuid;
}

string cmn_UUID_t::ToString (  )  const

Member Data Documentation

Definition at line 69 of file uuid.h.

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

Definition at line 74 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: