CernVM-FS  2.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
uuid.h
Go to the documentation of this file.
1 
5 #ifndef CVMFS_UUID_H_
6 #define CVMFS_UUID_H_
7 
8 #include <inttypes.h>
9 #include <uuid/uuid.h>
10 
11 #include <string>
12 
13 namespace cvmfs {
14 
23 class Uuid {
24  public:
25  static Uuid *Create(const std::string &store_path);
26  static std::string CreateOneTime();
27  std::string uuid() const { return uuid_; }
28  const unsigned char *data() const {
29  return reinterpret_cast<const unsigned char *>(&uuid_presentation_.uuid);
30  }
31  unsigned size() const { return sizeof(uuid_presentation_.uuid); }
32 
33  private:
34  void MkUuid();
35  Uuid();
36 
37  std::string uuid_;
38  union {
39  uuid_t uuid;
40  struct __attribute__((__packed__)) {
41  uint32_t a;
42  uint16_t b;
43  uint16_t c;
44  uint16_t d;
45  uint32_t e1;
46  uint16_t e2;
47  } split;
49 };
50 
51 } // namespace cvmfs
52 
53 #endif // CVMFS_UUID_H_
static std::string CreateOneTime()
Definition: uuid.cc:71
struct cvmcache_object_info __attribute__
Definition: atomic.h:24
unsigned size() const
Definition: uuid.h:31
std::string uuid() const
Definition: uuid.h:27
uuid_t uuid
Definition: uuid.h:39
std::string uuid_
Definition: uuid.h:37
void MkUuid()
Definition: uuid.cc:82
static Uuid * Create(const std::string &store_path)
Definition: uuid.cc:23
Uuid()
Definition: uuid.cc:98
union cvmfs::Uuid::@7 uuid_presentation_
const unsigned char * data() const
Definition: uuid.h:28