qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject svn commit: r1510988 - in /qpid/trunk/qpid/cpp/src/qpid/ha: AlternateExchangeSetter.h BrokerInfo.h Primary.h PrimaryTxObserver.h QueueGuard.h QueueReplicator.h QueueSnapshots.h RemoteBackup.h hash.h
Date Tue, 06 Aug 2013 15:00:47 GMT
Author: aconway
Date: Tue Aug  6 15:00:47 2013
New Revision: 1510988

URL: http://svn.apache.org/r1510988
Log:
NO-JIRA: HA remove use of boost_hash, failes to build on some compilers.

Removed use of boost::hash entirely, build problems on RHEL5.

Added:
    qpid/trunk/qpid/cpp/src/qpid/ha/hash.h   (with props)
Modified:
    qpid/trunk/qpid/cpp/src/qpid/ha/AlternateExchangeSetter.h
    qpid/trunk/qpid/cpp/src/qpid/ha/BrokerInfo.h
    qpid/trunk/qpid/cpp/src/qpid/ha/Primary.h
    qpid/trunk/qpid/cpp/src/qpid/ha/PrimaryTxObserver.h
    qpid/trunk/qpid/cpp/src/qpid/ha/QueueGuard.h
    qpid/trunk/qpid/cpp/src/qpid/ha/QueueReplicator.h
    qpid/trunk/qpid/cpp/src/qpid/ha/QueueSnapshots.h
    qpid/trunk/qpid/cpp/src/qpid/ha/RemoteBackup.h

Modified: qpid/trunk/qpid/cpp/src/qpid/ha/AlternateExchangeSetter.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/ha/AlternateExchangeSetter.h?rev=1510988&r1=1510987&r2=1510988&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/ha/AlternateExchangeSetter.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/ha/AlternateExchangeSetter.h Tue Aug  6 15:00:47 2013
@@ -25,7 +25,6 @@
 #include "qpid/log/Statement.h"
 #include "qpid/broker/Exchange.h"
 #include "qpid/broker/ExchangeRegistry.h"
-#include "boost/function.hpp"
 #include <map>
 
 namespace qpid {

Modified: qpid/trunk/qpid/cpp/src/qpid/ha/BrokerInfo.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/ha/BrokerInfo.h?rev=1510988&r1=1510987&r2=1510988&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/ha/BrokerInfo.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/ha/BrokerInfo.h Tue Aug  6 15:00:47 2013
@@ -23,12 +23,12 @@
  */
 
 #include "types.h"
+#include "hash.h"
 #include "qpid/Url.h"
 #include "qpid/framing/FieldTable.h"
 #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>
@@ -43,8 +43,7 @@ class BrokerInfo
 {
   public:
     typedef std::set<BrokerInfo> Set;
-    typedef qpid::sys::unordered_map<types::Uuid, BrokerInfo,
-                                     boost::hash<types::Uuid> > Map;
+    typedef qpid::sys::unordered_map<types::Uuid, BrokerInfo, Hasher<types::Uuid>
> Map;
 
     BrokerInfo();
     BrokerInfo(const types::Uuid& id, BrokerStatus, const Address& = Address());

Modified: qpid/trunk/qpid/cpp/src/qpid/ha/Primary.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/ha/Primary.h?rev=1510988&r1=1510987&r2=1510988&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/ha/Primary.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/ha/Primary.h Tue Aug  6 15:00:47 2013
@@ -23,13 +23,13 @@
  */
 
 #include "types.h"
+#include "hash.h"
 #include "BrokerInfo.h"
 #include "ReplicationTest.h"
 #include "Role.h"
 #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>
 
@@ -105,13 +105,13 @@ class Primary : public Role
 
   private:
     typedef sys::unordered_map<
-      types::Uuid, RemoteBackupPtr, boost::hash<types::Uuid> > BackupMap;
+      types::Uuid, RemoteBackupPtr, Hasher<types::Uuid> > BackupMap;
 
     typedef std::set<RemoteBackupPtr > BackupSet;
 
     typedef std::pair<types::Uuid, boost::shared_ptr<broker::Queue> > UuidQueue;
     typedef sys::unordered_map<UuidQueue, ReplicatingSubscription*,
-                               boost::hash<UuidQueue> > ReplicaMap;
+                               Hasher<UuidQueue> > ReplicaMap;
 
     RemoteBackupPtr backupConnect(const BrokerInfo&, broker::Connection&, sys::Mutex::ScopedLock&);
     void backupDisconnect(RemoteBackupPtr, sys::Mutex::ScopedLock&);

Modified: qpid/trunk/qpid/cpp/src/qpid/ha/PrimaryTxObserver.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/ha/PrimaryTxObserver.h?rev=1510988&r1=1510987&r2=1510988&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/ha/PrimaryTxObserver.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/ha/PrimaryTxObserver.h Tue Aug  6 15:00:47 2013
@@ -29,7 +29,6 @@
 #include "qpid/types/Uuid.h"
 #include "qpid/sys/unordered_map.h"
 #include "qpid/sys/Monitor.h"
-#include <boost/functional/hash.hpp>
 #include <boost/enable_shared_from_this.hpp>
 
 namespace qpid {
@@ -79,7 +78,7 @@ class PrimaryTxObserver : public broker:
   private:
     class Exchange;
     typedef qpid::sys::unordered_map<
-      QueuePtr, ReplicationIdSet, boost::hash<QueuePtr> > QueueIdsMap;
+      QueuePtr, ReplicationIdSet, Hasher<QueuePtr> > QueueIdsMap;
 
     void membership(const BrokerInfo::Map&);
     void deduplicate(sys::Mutex::ScopedLock&);

Modified: qpid/trunk/qpid/cpp/src/qpid/ha/QueueGuard.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/ha/QueueGuard.h?rev=1510988&r1=1510987&r2=1510988&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/ha/QueueGuard.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/ha/QueueGuard.h Tue Aug  6 15:00:47 2013
@@ -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>,
-                                     boost::hash<ReplicationId> > Delayed;
+                                     Hasher<ReplicationId> > Delayed;
 
     bool complete(ReplicationId, sys::Mutex::ScopedLock &);
     void complete(Delayed::iterator, sys::Mutex::ScopedLock &);

Modified: qpid/trunk/qpid/cpp/src/qpid/ha/QueueReplicator.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/ha/QueueReplicator.h?rev=1510988&r1=1510987&r2=1510988&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/ha/QueueReplicator.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/ha/QueueReplicator.h Tue Aug  6 15:00:47 2013
@@ -23,10 +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>
 
 namespace qpid {
@@ -106,7 +105,7 @@ class QueueReplicator : public broker::E
 
   private:
     typedef qpid::sys::unordered_map<
-      ReplicationId, QueuePosition, boost::hash<int32_t> > PositionMap;
+      ReplicationId, QueuePosition, Hasher<ReplicationId> > PositionMap;
     class ErrorListener;
     class QueueObserver;
 

Modified: qpid/trunk/qpid/cpp/src/qpid/ha/QueueSnapshots.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/ha/QueueSnapshots.h?rev=1510988&r1=1510987&r2=1510988&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/ha/QueueSnapshots.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/ha/QueueSnapshots.h Tue Aug  6 15:00:47 2013
@@ -24,6 +24,7 @@
 
 
 #include "QueueSnapshot.h"
+#include "hash.h"
 
 #include "qpid/assert.h"
 #include "qpid/broker/BrokerObserver.h"
@@ -31,7 +32,6 @@
 #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::Br
     }
 
   private:
-    typedef qpid::sys::unordered_map<
-      boost::shared_ptr<broker::Queue>, boost::shared_ptr<QueueSnapshot>,
-      boost::hash<boost::shared_ptr<broker::Queue> > > SnapshotMap;
-
+    typedef qpid::sys::unordered_map<boost::shared_ptr<broker::Queue>,
+                                     boost::shared_ptr<QueueSnapshot>,
+                                     Hasher<boost::shared_ptr<broker::Queue> >
+                                     > SnapshotMap;
     SnapshotMap snapshots;
     mutable sys::Mutex lock;
 };

Modified: qpid/trunk/qpid/cpp/src/qpid/ha/RemoteBackup.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/ha/RemoteBackup.h?rev=1510988&r1=1510987&r2=1510988&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/ha/RemoteBackup.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/ha/RemoteBackup.h Tue Aug  6 15:00:47 2013
@@ -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 {
@@ -96,8 +96,10 @@ class RemoteBackup
     void startCatchup() { started = true; }
 
   private:
-    typedef qpid::sys::unordered_map<QueuePtr, GuardPtr,
-                                     boost::hash<QueuePtr> > GuardMap;
+    typedef qpid::sys::unordered_map<
+      QueuePtr, GuardPtr, Hasher<boost::shared_ptr<broker::Queue> >
+      > GuardMap;
+
     typedef std::set<QueuePtr> QueueSet;
 
     std::string logPrefix;

Added: qpid/trunk/qpid/cpp/src/qpid/ha/hash.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/ha/hash.h?rev=1510988&view=auto
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/ha/hash.h (added)
+++ qpid/trunk/qpid/cpp/src/qpid/ha/hash.h Tue Aug  6 15:00:47 2013
@@ -0,0 +1,71 @@
+#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 "qpid/types/Uuid.h"
+#include <boost/shared_ptr.hpp>
+#include <utility>
+
+namespace qpid {
+namespace ha {
+
+// TODO aconway 2013-08-06: would like to use boost::hash or std::hash here
+// but not available/working on some older compilers.
+// Add overloads as needed.
+
+inline std::size_t hashValue(bool v) { return static_cast<std::size_t>(v); }
+inline std::size_t hashValue(char v) { return static_cast<std::size_t>(v); }
+inline std::size_t hashValue(unsigned char v) { return static_cast<std::size_t>(v);
}
+inline std::size_t hashValue(signed char v) { return static_cast<std::size_t>(v); }
+inline std::size_t hashValue(short v) { return static_cast<std::size_t>(v); }
+inline std::size_t hashValue(unsigned short v) { return static_cast<std::size_t>(v);
}
+inline std::size_t hashValue(int v) { return static_cast<std::size_t>(v); }
+inline std::size_t hashValue(unsigned int v) { return static_cast<std::size_t>(v);
}
+inline std::size_t hashValue(long v) { return static_cast<std::size_t>(v); }
+inline std::size_t hashValue(unsigned long v) { return static_cast<std::size_t>(v);
}
+
+inline std::size_t hashValue(const types::Uuid& v) { return v.hash(); }
+
+template <class T> inline std::size_t hashValue(T* v) {
+    std::size_t x = static_cast<std::size_t>(reinterpret_cast<std::ptrdiff_t>(v));
+    return x + (x >> 3);
+}
+
+template <class T> inline void hashCombine(std::size_t& seed, const T& v) {
+    seed ^= hashValue(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
+}
+
+template <class T, class U> inline size_t hashValue(const std::pair<T,U>&
v) {
+    std::size_t seed = 0;
+    hashCombine(seed, v.first);
+    hashCombine(seed, v.second);
+    return seed;
+}
+
+template<class T> struct Hasher {
+    size_t  operator()(const T& v) const  { return hashValue(v); }
+};
+
+}} // namespace qpid::ha
+
+#endif  /*!QPID_HA_HASH_H*/

Propchange: qpid/trunk/qpid/cpp/src/qpid/ha/hash.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: qpid/trunk/qpid/cpp/src/qpid/ha/hash.h
------------------------------------------------------------------------------
    svn:keywords = Rev Date



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message