summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/framing/Uuid.cpp
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2009-08-31 23:41:53 +0000
committerAndrew Stitcher <astitcher@apache.org>2009-08-31 23:41:53 +0000
commit7f9a8e2b4493df4413cbbfdc6804cebd977e44ab (patch)
tree38a2a06e63d1f6929002360403b008c76a93c565 /cpp/src/qpid/framing/Uuid.cpp
parent447c941935ae75a91093e5b49f05a40cc188ab60 (diff)
downloadqpid-python-7f9a8e2b4493df4413cbbfdc6804cebd977e44ab.tar.gz
Working towards abstracting away the cross platform uuid mess:
* Stop including indirectly from uuid.h in qpid/framing/Uuid.h and move inline definitions there into the implementation file git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@809781 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/framing/Uuid.cpp')
-rw-r--r--cpp/src/qpid/framing/Uuid.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/cpp/src/qpid/framing/Uuid.cpp b/cpp/src/qpid/framing/Uuid.cpp
index c0b41c6906..71fa6a7329 100644
--- a/cpp/src/qpid/framing/Uuid.cpp
+++ b/cpp/src/qpid/framing/Uuid.cpp
@@ -17,6 +17,8 @@
*/
#include "qpid/framing/Uuid.h"
+
+#include "qpid/sys/uuid.h"
#include "qpid/Exception.h"
#include "qpid/framing/Buffer.h"
#include "qpid/framing/reply_exceptions.h"
@@ -28,6 +30,35 @@ using namespace std;
static const size_t UNPARSED_SIZE=36;
+Uuid::Uuid(bool unique) {
+ if (unique) {
+ generate();
+ } else {
+ clear();
+ }
+}
+
+Uuid::Uuid(const uint8_t* data) {
+ assign(data);
+}
+
+void Uuid::assign(const uint8_t* data) {
+ uuid_copy(c_array(), data);
+}
+
+void Uuid::generate() {
+ uuid_generate(c_array());
+}
+
+void Uuid::clear() {
+ uuid_clear(c_array());
+}
+
+// Force int 0/!0 to false/true; avoids compile warnings.
+bool Uuid::isNull() {
+ return !!uuid_is_null(data());
+}
+
void Uuid::encode(Buffer& buf) const {
buf.putRawData(data(), size());
}