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_FRAMING_UUID_H
2 #define QPID_FRAMING_UUID_H
3 
4 /*
5  *
6  * Copyright (c) 2006 The Apache Software Foundation
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21 
23 #include "qpid/sys/IntegerTypes.h"
24 
25 #include <boost/array.hpp>
26 
27 #include <ostream>
28 #include <istream>
29 
30 namespace qpid {
31 namespace framing {
32 
33 class Buffer;
34 
44 struct Uuid : public boost::array<uint8_t, 16> {
46  QPID_COMMON_EXTERN Uuid(bool unique=false);
47 
49  QPID_COMMON_EXTERN Uuid(const uint8_t* data);
50 
52  QPID_COMMON_EXTERN Uuid(const std::string&);
53 
54  // Default op= and copy ctor are fine.
55  // boost::array gives us ==, < etc.
56 
58  QPID_COMMON_EXTERN void assign(const uint8_t* data);
59 
62 
65 
67  QPID_COMMON_EXTERN bool isNull() const;
68  QPID_COMMON_INLINE_EXTERN operator bool() const { return !isNull(); }
69  QPID_COMMON_INLINE_EXTERN bool operator!() const { return isNull(); }
70 
71  QPID_COMMON_EXTERN void encode(framing::Buffer& buf) const;
74  { return static_cast<uint32_t>(size()); }
75 
77  QPID_COMMON_EXTERN std::string str() const;
78 
79  template <class S> void serialize(S& s) {
80  s.raw(begin(), size());
81  }
82 };
83 
85 QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream&, Uuid);
86 
88 QPID_COMMON_EXTERN std::istream& operator>>(std::istream&, Uuid&);
89 
90 }} // namespace qpid::framing
91 
92 
93 
94 #endif
void generate()
Set to a new unique identifier.
#define QPID_COMMON_EXTERN
QPID_COMMON_INLINE_EXTERN bool operator!() const
Definition: Uuid.h:69
unsigned int uint32_t
Definition: IntegerTypes.h:27
unsigned char uint8_t
Definition: IntegerTypes.h:24
std::string str() const
String value in format 1b4e28ba-2fa1-11d2-883f-b9a761bde3fb.
A UUID is represented as a boost::array of 16 bytes.
Definition: Uuid.h:44
void assign(const uint8_t *data)
Copy from 16 bytes of data.
void clear()
Set to all zeros.
std::ostream & operator<<(std::ostream &, const Buffer &)
void decode(framing::Buffer &buf)
This file was automatically generated from the AMQP specification.
Definition: Address.h:27
std::istream & operator>>(std::istream &, Uuid &)
Read from format 1b4e28ba-2fa1-11d2-883f-b9a761bde3fb.
void serialize(S &s)
Definition: Uuid.h:79
#define QPID_COMMON_INLINE_EXTERN
void encode(framing::Buffer &buf) const
QPID_COMMON_INLINE_EXTERN uint32_t encodedSize() const
Definition: Uuid.h:73
Uuid(bool unique=false)
If unique is true, generate a unique ID else a null ID.
bool isNull() const
Test for null (all zeros).

Qpid C++ API Reference
Generated on Tue Jan 27 2015 for Qpid C++ Client API by doxygen 1.8.9.1