summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2013-08-05 16:35:13 +0000
committerAlan Conway <aconway@apache.org>2013-08-05 16:35:13 +0000
commitb377462185d9f7bafe87acea8319ea07434ced2b (patch)
tree5d9ab23158a7cb481012092205e65328c02dac47
parent96f8d7a0b88250926c27dfe2ef4aedd040af4542 (diff)
downloadqpid-python-b377462185d9f7bafe87acea8319ea07434ced2b.tar.gz
NO-JIRA: Corrected use of boost_hash, failing to build on some compilers.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1510597 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--cpp/include/qpid/types/Uuid.h3
-rw-r--r--cpp/src/qpid/ha/BrokerInfo.h4
-rw-r--r--cpp/src/qpid/ha/Primary.h4
-rw-r--r--cpp/src/qpid/ha/QueueGuard.h4
-rw-r--r--cpp/src/qpid/ha/QueueReplicator.h4
-rw-r--r--cpp/src/qpid/ha/QueueSnapshots.h10
-rw-r--r--cpp/src/qpid/ha/RemoteBackup.h4
-rw-r--r--cpp/src/qpid/ha/hash.h42
8 files changed, 19 insertions, 56 deletions
diff --git a/cpp/include/qpid/types/Uuid.h b/cpp/include/qpid/types/Uuid.h
index b931670d97..eb9cf33693 100644
--- a/cpp/include/qpid/types/Uuid.h
+++ b/cpp/include/qpid/types/Uuid.h
@@ -82,6 +82,9 @@ class QPID_TYPES_CLASS_EXTERN Uuid
unsigned char bytes[16];
};
+/** Hash value function for use with boots::hash or std::hash */
+inline size_t hash_value(const Uuid& uuid) { return uuid.hash(); }
+
/** Returns true if the uuids are equal, false otherwise. **/
QPID_TYPES_EXTERN bool operator==(const Uuid&, const Uuid&);
/** Returns true if the uuids are NOT equal, false if they are. **/
diff --git a/cpp/src/qpid/ha/BrokerInfo.h b/cpp/src/qpid/ha/BrokerInfo.h
index bd1ad86392..8e62665088 100644
--- a/cpp/src/qpid/ha/BrokerInfo.h
+++ b/cpp/src/qpid/ha/BrokerInfo.h
@@ -28,6 +28,7 @@
#include "qpid/types/Uuid.h"
#include "qpid/types/Variant.h"
#include "qpid/sys/unordered_map.h"
+#include <boost/functional/hash.hpp>
#include <string>
#include <iosfwd>
#include <vector>
@@ -42,7 +43,8 @@ class BrokerInfo
{
public:
typedef std::set<BrokerInfo> Set;
- typedef qpid::sys::unordered_map<types::Uuid, BrokerInfo, types::Uuid::Hasher> Map;
+ typedef qpid::sys::unordered_map<types::Uuid, BrokerInfo,
+ boost::hash<types::Uuid> > Map;
BrokerInfo();
BrokerInfo(const types::Uuid& id, BrokerStatus, const Address& = Address());
diff --git a/cpp/src/qpid/ha/Primary.h b/cpp/src/qpid/ha/Primary.h
index a34f8f5a30..c13d60991e 100644
--- a/cpp/src/qpid/ha/Primary.h
+++ b/cpp/src/qpid/ha/Primary.h
@@ -29,9 +29,9 @@
#include "qpid/sys/Mutex.h"
#include "qpid/sys/unordered_map.h"
#include <boost/shared_ptr.hpp>
+#include <boost/functional/hash.hpp>
#include <boost/intrusive_ptr.hpp>
#include <string>
-#include <boost/functional/hash.hpp>
namespace qpid {
@@ -105,7 +105,7 @@ class Primary : public Role
private:
typedef sys::unordered_map<
- types::Uuid, RemoteBackupPtr, types::Uuid::Hasher > BackupMap;
+ types::Uuid, RemoteBackupPtr, boost::hash<types::Uuid> > BackupMap;
typedef std::set<RemoteBackupPtr > BackupSet;
diff --git a/cpp/src/qpid/ha/QueueGuard.h b/cpp/src/qpid/ha/QueueGuard.h
index e41a92c74f..5a5f80996d 100644
--- a/cpp/src/qpid/ha/QueueGuard.h
+++ b/cpp/src/qpid/ha/QueueGuard.h
@@ -23,12 +23,12 @@
*/
#include "types.h"
-#include "hash.h"
#include "qpid/types/Uuid.h"
#include "qpid/sys/Mutex.h"
#include "qpid/sys/unordered_map.h"
#include <boost/shared_ptr.hpp>
#include <boost/intrusive_ptr.hpp>
+#include <boost/functional/hash.hpp>
#include <deque>
#include <set>
@@ -89,7 +89,7 @@ class QueueGuard {
class QueueObserver;
typedef qpid::sys::unordered_map<ReplicationId,
boost::intrusive_ptr<broker::AsyncCompletion>,
- TrivialHasher<ReplicationId> > Delayed;
+ boost::hash<ReplicationId> > Delayed;
bool complete(ReplicationId, sys::Mutex::ScopedLock &);
void complete(Delayed::iterator, sys::Mutex::ScopedLock &);
diff --git a/cpp/src/qpid/ha/QueueReplicator.h b/cpp/src/qpid/ha/QueueReplicator.h
index cbc950d4bc..24baeb9a89 100644
--- a/cpp/src/qpid/ha/QueueReplicator.h
+++ b/cpp/src/qpid/ha/QueueReplicator.h
@@ -23,9 +23,9 @@
*/
#include "BrokerInfo.h"
-#include "hash.h"
#include "qpid/broker/Exchange.h"
#include <boost/enable_shared_from_this.hpp>
+#include <boost/functional/hash.hpp>
#include <boost/function.hpp>
#include <iosfwd>
@@ -106,7 +106,7 @@ class QueueReplicator : public broker::Exchange,
private:
typedef qpid::sys::unordered_map<
- ReplicationId, QueuePosition, TrivialHasher<int32_t> > PositionMap;
+ ReplicationId, QueuePosition, boost::hash<int32_t> > PositionMap;
class ErrorListener;
class QueueObserver;
diff --git a/cpp/src/qpid/ha/QueueSnapshots.h b/cpp/src/qpid/ha/QueueSnapshots.h
index e28bcd95a8..c12ee743e8 100644
--- a/cpp/src/qpid/ha/QueueSnapshots.h
+++ b/cpp/src/qpid/ha/QueueSnapshots.h
@@ -24,7 +24,6 @@
#include "QueueSnapshot.h"
-#include "hash.h"
#include "qpid/assert.h"
#include "qpid/broker/BrokerObserver.h"
@@ -32,6 +31,7 @@
#include "qpid/sys/Mutex.h"
#include <boost/shared_ptr.hpp>
+#include <boost/functional/hash.hpp>
namespace qpid {
namespace ha {
@@ -67,10 +67,10 @@ class QueueSnapshots : public broker::BrokerObserver
}
private:
- typedef qpid::sys::unordered_map<boost::shared_ptr<broker::Queue>,
- boost::shared_ptr<QueueSnapshot>,
- SharedPtrHasher<broker::Queue>
- > SnapshotMap;
+ typedef qpid::sys::unordered_map<
+ boost::shared_ptr<broker::Queue>, boost::shared_ptr<QueueSnapshot>,
+ boost::hash<boost::shared_ptr<broker::Queue> > > SnapshotMap;
+
SnapshotMap snapshots;
mutable sys::Mutex lock;
};
diff --git a/cpp/src/qpid/ha/RemoteBackup.h b/cpp/src/qpid/ha/RemoteBackup.h
index 1d0a129c82..d2533e8b5c 100644
--- a/cpp/src/qpid/ha/RemoteBackup.h
+++ b/cpp/src/qpid/ha/RemoteBackup.h
@@ -25,8 +25,8 @@
#include "ReplicationTest.h"
#include "BrokerInfo.h"
#include "types.h"
-#include "hash.h"
#include "qpid/sys/unordered_map.h"
+#include <boost/functional/hash.hpp>
#include <set>
namespace qpid {
@@ -97,7 +97,7 @@ class RemoteBackup
private:
typedef qpid::sys::unordered_map<QueuePtr, GuardPtr,
- SharedPtrHasher<broker::Queue> > GuardMap;
+ boost::hash<QueuePtr> > GuardMap;
typedef std::set<QueuePtr> QueueSet;
std::string logPrefix;
diff --git a/cpp/src/qpid/ha/hash.h b/cpp/src/qpid/ha/hash.h
deleted file mode 100644
index a513673cce..0000000000
--- a/cpp/src/qpid/ha/hash.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef QPID_HA_HASH_H
-#define QPID_HA_HASH_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 <boost/shared_ptr.hpp>
-
-namespace qpid {
-namespace ha {
-
-template<class T> struct TrivialHasher {
- size_t operator()(T value) const { return static_cast<size_t>(value); }
-};
-
-template<class T> struct SharedPtrHasher {
- size_t operator()(const boost::shared_ptr<T>& ptr) const {
- return reinterpret_cast<size_t>(ptr.get());
- }
-};
-
-}} // namespace qpid::ha
-
-#endif /*!QPID_HA_HASH_H*/