Artec 3D Scanning SDK  2.0
Uuid.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 namespace artec { namespace sdk { namespace base
8 {
9 
10 /// Unique identifier
11 class Uuid;
12 
13 extern "C"
14 {
15  /**
16  * @brief Generate new UUID
17  * @param uuid pointer to UUID to be created.
18  * @return Error code.
19  */
21 
22  /**
23  * @brief Convert Uuid to string
24  */
25  ErrorCode ABASESDK_LINK_SPEC convertUuidtoString(IString** string, const Uuid* uuid);
26 
27  /**
28  * @brief Convert string to Uuid
29  */
30  ErrorCode ABASESDK_LINK_SPEC converStringtoUuid(Uuid* uuid, IString* string);
31 }
32 
33 class Uuid
34 {
35 public:
36  enum { UuidSize = 16 };
37 
38  /**
39  * @brief Create empty UUID {00000000-0000-0000-0000-000000000000}
40  */
41  Uuid()
42  {
43  for (int i = 0; i < UuidSize; ++i)
44  {
45  data_[i] = 0;
46  }
47  }
48 
49  /**
50  * @brief Compare two UUIDs
51  */
52  static bool less(const Uuid& left, const Uuid& right)
53  {
54  for (size_t i = 0; i < Uuid::UuidSize; ++i)
55  {
56  if (left.data_[i] == right.data_[i])
57  {
58  continue;
59  }
60  return left.data_[i] < right.data_[i];
61  }
62  return false;
63  }
64 
65  friend ErrorCode generateUuid(Uuid* uuid);
66  friend ErrorCode convertUuidtoString(IString** string, const Uuid* uuid);
67  friend ErrorCode converStringtoUuid(Uuid* uuid, IString* string);
68 
69 private:
70  unsigned char data_[UuidSize];
71 };
72 
73 } } }
ErrorCode ABASESDK_LINK_SPEC converStringtoUuid(Uuid *uuid, IString *string)
Convert string to Uuid.
friend ErrorCode generateUuid(Uuid *uuid)
Generate new UUID.
ErrorCode ABASESDK_LINK_SPEC convertUuidtoString(IString **string, const Uuid *uuid)
Convert Uuid to string.
friend ErrorCode convertUuidtoString(IString **string, const Uuid *uuid)
Convert Uuid to string.
ErrorCode ABASESDK_LINK_SPEC generateUuid(Uuid *uuid)
Generate new UUID.
Interface for string with smart reference counting.
Definition: IString.h:33
Uuid()
Create empty UUID {00000000-0000-0000-0000-000000000000}.
Definition: Uuid.h:41
static bool less(const Uuid &left, const Uuid &right)
Compare two UUIDs.
Definition: Uuid.h:52
friend ErrorCode converStringtoUuid(Uuid *uuid, IString *string)
Convert string to Uuid.
#define ABASESDK_LINK_SPEC