#include <uuid.h>
..
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:
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_t & | operator= (const cmn_UUID_t &a_uuid) |
| Copy operator. | |
| cmn_UUID_t & | operator= (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] |
| cmn_UUID_t::cmn_UUID_t | ( | ) |
Creates new UUID.
Definition at line 98 of file cmn_uuid.cpp.
References Generate().
00098 { 00099 Generate(); 00100 }

| 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 }

| 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::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 }

| 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 }

| 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 }

| 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 }

| 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 |
Create stringified representation of the UUID.
Definition at line 187 of file cmn_uuid.cpp.
References ivd_UUID_STR_SIZE_d, and m_uuid.
Referenced by i_ResourceManager_i::AddPartition(), bea_MigrationThread::CheckFRI(), CheckIVDHeader(), bea_FRI::CloseVolume(), bea_FRI::CloseVolumeInRMDB(), bea_FRI::CopyFromDiskToMedium(), bea_FRI::CreateFRI(), bea_FRI::DeleteFRIOnDisk(), i_AdminJob_i::DoInitialize(), i_BackEndAgent_i::GetVolInfo(), bea_Volume::Init(), rm_MediaPool::Insert(), df_FRI::MediumVolumeStart(), bea_FRI::MoveFromWorkToFRI(), operator<<(), ParseECMAHeader(), bea_MigrationThread::PrepareVolume(), bea_FRI::ReadFRI(), i_ResourceManager_i::RegisterPartition(), bea_FRI::SaveFRIOnError(), rm_MediaPool::SelectByUUID(), i_ResourceManager_i::SetRMPartStatus(), and i_BackEndAgent_i::UpdateVolumeUsed().
00187 { 00188 char strUUID[ivd_UUID_STR_SIZE_d + 1]; 00189 00190 uuid_unparse(const_cast<unsigned char*>(m_uuid), strUUID); 00191 return string(strUUID); 00192 }

| 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 }

| bool cmn_UUID_t::IsNull | ( | ) | const |
Definition at line 199 of file cmn_uuid.cpp.
References m_uuid.
Referenced by bea_FRIThread::CheckFRI(), df_RecReader::FRIEndCheck(), df_RecReader::FRIStartCheck(), bea_MigrationThread::FRIVolumeStart(), bea_Volume::OverrideIDs(), df_SplitInfoUnpacker::ProcEndOfInput(), bea_FRIThread::ReadFromSysVol(), i_BackEndAgent_i::ReadIDs(), bea_Volume::ReadVolInfoFromMediumMem(), and i_BackEndAgent_i::VerifyIDs().
00199 { 00200 return uuid_is_null(const_cast<unsigned char*>(m_uuid) ); 00201 }

cmn_UUID_t::log_CLASSID_m [private] |
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().
1.5.6