Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET Apache Qpid Documentation
Uuid.h
Go to the documentation of this file.
1 #ifndef QPID_TYPES_UUID_H
2 #define QPID_TYPES_UUID_H
3 
4 /*
5  *
6  * Licensed to the Apache Software Foundation (ASF) under one
7  * or more contributor license agreements. See the NOTICE file
8  * distributed with this work for additional information
9  * regarding copyright ownership. The ASF licenses this file
10  * to you under the Apache License, Version 2.0 (the
11  * "License"); you may not use this file except in compliance
12  * with the License. You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing,
17  * software distributed under the License is distributed on an
18  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19  * KIND, either express or implied. See the License for the
20  * specific language governing permissions and limitations
21  * under the License.
22  *
23  */
24 
26 #include <iosfwd>
27 #include <string>
28 
29 namespace qpid {
30 namespace types {
31 
33 {
34  public:
35  QPID_TYPES_EXTERN static const size_t SIZE;
40  QPID_TYPES_EXTERN Uuid(bool unique=false);
41  QPID_TYPES_EXTERN Uuid(const Uuid&);
42  QPID_TYPES_EXTERN Uuid& operator=(const Uuid&);
44  QPID_TYPES_EXTERN Uuid(const unsigned char* data16);
45  QPID_TYPES_EXTERN Uuid(const char* data16);
46 
48  QPID_TYPES_EXTERN void generate();
49 
51  QPID_TYPES_EXTERN void clear();
52 
54  QPID_TYPES_EXTERN bool isNull() const;
55  QPID_TYPES_EXTERN operator bool() const;
56  QPID_TYPES_EXTERN bool operator!() const;
57 
59  QPID_TYPES_EXTERN std::string str() const;
60 
61  QPID_TYPES_EXTERN size_t size() const;
62  QPID_TYPES_EXTERN const unsigned char* data() const;
63 
64  friend QPID_TYPES_EXTERN bool operator==(const Uuid&, const Uuid&);
65  friend QPID_TYPES_EXTERN bool operator!=(const Uuid&, const Uuid&);
66  friend QPID_TYPES_EXTERN bool operator<(const Uuid&, const Uuid&);
67  friend QPID_TYPES_EXTERN bool operator>(const Uuid&, const Uuid&);
68  friend QPID_TYPES_EXTERN bool operator<=(const Uuid&, const Uuid&);
69  friend QPID_TYPES_EXTERN bool operator>=(const Uuid&, const Uuid&);
70  friend QPID_TYPES_EXTERN std::ostream& operator<<(std::ostream&, Uuid);
71  friend QPID_TYPES_EXTERN std::istream& operator>>(std::istream&, Uuid&);
72 
74  QPID_TYPES_EXTERN size_t hash() const;
75 
77  struct Hasher {
78  size_t operator()(const Uuid& u) const { return u.hash(); }
79  };
80 
81  private:
82  unsigned char bytes[16];
83 };
84 
86 inline size_t hash_value(const Uuid& uuid) { return uuid.hash(); }
87 
89 QPID_TYPES_EXTERN bool operator==(const Uuid&, const Uuid&);
91 QPID_TYPES_EXTERN bool operator!=(const Uuid&, const Uuid&);
92 
93 QPID_TYPES_EXTERN bool operator<(const Uuid&, const Uuid&);
94 QPID_TYPES_EXTERN bool operator>(const Uuid&, const Uuid&);
95 QPID_TYPES_EXTERN bool operator<=(const Uuid&, const Uuid&);
96 QPID_TYPES_EXTERN bool operator>=(const Uuid&, const Uuid&);
97 
99 QPID_TYPES_EXTERN std::ostream& operator<<(std::ostream&, Uuid);
100 
102 QPID_TYPES_EXTERN std::istream& operator>>(std::istream&, Uuid&);
103 
104 }} // namespace qpid::types
105 
106 
107 #endif
QPID_TYPES_EXTERN bool operator==(const Uuid &, const Uuid &)
Returns true if the uuids are equal, false otherwise.
QPID_TYPES_EXTERN bool operator>(const Uuid &, const Uuid &)
Hasher for use with unordered_map.
Definition: Uuid.h:77
QPID_TYPES_EXTERN size_t hash() const
Hash value suitable for use with unordered_map.
#define QPID_TYPES_EXTERN
Definition: ImportExport.h:30
QPID_TYPES_EXTERN std::ostream & operator<<(std::ostream &, Uuid)
Print in format 1b4e28ba-2fa1-11d2-883f-b9a761bde3fb.
QPID_TYPES_EXTERN bool operator<(const Uuid &, const Uuid &)
static QPID_TYPES_EXTERN const size_t SIZE
Definition: Uuid.h:35
QPID_TYPES_EXTERN std::istream & operator>>(std::istream &, Uuid &)
Read from format 1b4e28ba-2fa1-11d2-883f-b9a761bde3fb.
QPID_TYPES_EXTERN bool operator>=(const Uuid &, const Uuid &)
size_t operator()(const Uuid &u) const
Definition: Uuid.h:78
QPID_TYPES_EXTERN bool operator<=(const Uuid &, const Uuid &)
#define QPID_TYPES_CLASS_EXTERN
Definition: ImportExport.h:31
QPID_TYPES_EXTERN bool operator!=(const Uuid &, const Uuid &)
Returns true if the uuids are NOT equal, false if they are.
size_t hash_value(const Uuid &uuid)
Hash value function for use with boots::hash or std::hash.
Definition: Uuid.h:86

Qpid C++ API Reference
Generated on Tue Oct 28 2014 for Qpid C++ Client API by doxygen 1.8.5