diff options
| author | Andrew Stitcher <astitcher@apache.org> | 2009-08-31 23:41:53 +0000 |
|---|---|---|
| committer | Andrew Stitcher <astitcher@apache.org> | 2009-08-31 23:41:53 +0000 |
| commit | 7f9a8e2b4493df4413cbbfdc6804cebd977e44ab (patch) | |
| tree | 38a2a06e63d1f6929002360403b008c76a93c565 /cpp/include | |
| parent | 447c941935ae75a91093e5b49f05a40cc188ab60 (diff) | |
| download | qpid-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/include')
| -rw-r--r-- | cpp/include/qpid/framing/Uuid.h | 27 | ||||
| -rw-r--r-- | cpp/include/qpid/sys/uuid.h | 28 | ||||
| -rw-r--r-- | cpp/include/qpid/sys/windows/uuid.h | 38 |
3 files changed, 12 insertions, 81 deletions
diff --git a/cpp/include/qpid/framing/Uuid.h b/cpp/include/qpid/framing/Uuid.h index 0dfa7a58e7..8e817178da 100644 --- a/cpp/include/qpid/framing/Uuid.h +++ b/cpp/include/qpid/framing/Uuid.h @@ -20,7 +20,6 @@ */ #include "qpid/CommonImportExport.h" -#include "qpid/sys/uuid.h" #include "qpid/sys/IntegerTypes.h" #include <boost/array.hpp> @@ -38,33 +37,31 @@ class Buffer; * * Full value semantics, operators ==, < etc. are provided by * boost::array so Uuid can be the key type in a map etc. + * + * TODO: change this implementation as it leaks boost into the + * client API */ struct Uuid : public boost::array<uint8_t, 16> { /** If unique is true, generate a unique ID else a null ID. */ - Uuid(bool unique=false) { if (unique) generate(); else clear(); } + Uuid(bool unique=false); /** Copy from 16 bytes of data. */ - Uuid(const uint8_t* data) { assign(data); } + Uuid(const uint8_t* data); + + // Default op= and copy ctor are fine. + // boost::array gives us ==, < etc. /** Copy from 16 bytes of data. */ - void assign(const uint8_t* data) { - uuid_copy(c_array(), data); - } + void assign(const uint8_t* data); /** Set to a new unique identifier. */ - void generate() { uuid_generate(c_array()); } + void generate(); /** Set to all zeros. */ - void clear() { uuid_clear(c_array()); } + void clear(); /** Test for null (all zeros). */ - // Force int 0/!0 to false/true; avoids compile warnings. - bool isNull() { - return !!uuid_is_null(data()); - } - - // Default op= and copy ctor are fine. - // boost::array gives us ==, < etc. + bool isNull(); QPID_COMMON_EXTERN void encode(framing::Buffer& buf) const; QPID_COMMON_EXTERN void decode(framing::Buffer& buf); diff --git a/cpp/include/qpid/sys/uuid.h b/cpp/include/qpid/sys/uuid.h deleted file mode 100644 index 804ab34463..0000000000 --- a/cpp/include/qpid/sys/uuid.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef _sys_uuid_h -#define _sys_uuid_h - -/* - * - * Copyright (c) 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifdef _WIN32 -# include "qpid/sys/windows/uuid.h" -#else -# include <uuid/uuid.h> -#endif /* _WIN32 */ - -#endif /* _sys_uuid_h */ diff --git a/cpp/include/qpid/sys/windows/uuid.h b/cpp/include/qpid/sys/windows/uuid.h deleted file mode 100644 index c79abe95c6..0000000000 --- a/cpp/include/qpid/sys/windows/uuid.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef _sys_windows_uuid_h -#define _sys_windows_uuid_h - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include "qpid/CommonImportExport.h" -#include <qpid/sys/IntegerTypes.h> - -namespace qpid { namespace sys { const size_t UuidSize = 16; }} -typedef uint8_t uuid_t[qpid::sys::UuidSize]; - -QPID_COMMON_EXTERN void uuid_clear (uuid_t uu); -QPID_COMMON_EXTERN void uuid_copy (uuid_t dst, const uuid_t src); -QPID_COMMON_EXTERN void uuid_generate (uuid_t out); -QPID_COMMON_EXTERN int uuid_is_null (const uuid_t uu); // Returns 1 if null, else 0 -QPID_COMMON_EXTERN int uuid_parse (const char *in, uuid_t uu); // Returns 0 on success, else -1 -QPID_COMMON_EXTERN void uuid_unparse (const uuid_t uu, char *out); - -#endif /*!_sys_windows_uuid_h*/ |
