libutil++  1.9.3
 All Classes Functions Variables
UUID.h
1 /*
2 ** libutil++
3 ** $Id: UUID.h 1684 2016-06-05 18:53:47Z sella $
4 ** Copyright (c) 2011-2016 Digital Genesis, LLC. All Rights Reserved.
5 ** Released under the LGPL Version 2.1 License.
6 ** http://www.digitalgenesis.com
7 */
8 
9 #ifndef __libutilxx__sella__util__UUID_H__
10 #define __libutilxx__sella__util__UUID_H__
11 
12 #include "../../common.h"
13 #include "UUIDException.h"
14 
15 #include <uuid/uuid.h>
16 
17 #include <string>
18 #include <memory>
19 
20 namespace sella {
21  namespace util {
22  class UUID;
23  }
24 }
25 
27  public:
28  typedef std::shared_ptr<UUID> shared;
29  typedef UUID *ptr;
30 
31  public:
32  UUID() throw ();
33  UUID(uuid_t &uuid) throw ();
34  UUID(const std::string &uuid) throw (UUIDException);
35  UUID(const char *uuid) throw (UUIDException);
36  UUID(const UUID &other);
37  UUID(const UUID &&other);
38  virtual ~UUID();
39 
40  UUID& operator=(const UUID &other) throw ();
41  UUID& operator=(const UUID &&other) throw ();
42  UUID& operator=(const std::string &uuid) throw (UUIDException);
43  UUID& operator=(const char *uuid) throw (UUIDException);
44  bool operator==(const UUID &other) const throw ();
45  bool operator!=(const UUID &other) const throw ();
46  bool operator>=(const UUID &other) const throw ();
47  bool operator<=(const UUID &other) const throw ();
48  bool operator<(const UUID &other) const throw ();
49  bool operator>(const UUID &other) const throw ();
50 
51  void set(uuid_t &uuid) throw ();
52  const uuid_t& get(void) const throw ();
53 
54  void generate(void) throw ();
55  void clear(void) throw ();
56  bool isNull(void) const throw ();
57 
58  void shrink_to_fit(void) throw ();
59  const std::string& str(void) const throw ();
60  const std::string& base64(bool standard = false) const throw ();
61  const char* c_str(void) const throw ();
62  const char* c_base64(bool standard = false) const throw ();
63  static const UUID::shared shared_ptr(void) throw ();
64  static const UUID::shared shared_ptr(uuid_t &uuid) throw ();
65 
66  uint32_t getU32(void) const throw ();
67  uint32_t getHash(void) const throw ();
68 
69  private:
70  uuid_t uuid;
71 
72  mutable std::string scache;
73  mutable std::string bcache;
74  mutable bool bcache_std;
75  mutable uint32_t hcache;
76 };
77 
78 #endif
79 
80 /*
81 ** vim: noet ts=3 sw=3
82 */