summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2006-10-24 13:29:05 +0000
committerAlan Conway <aconway@apache.org>2006-10-24 13:29:05 +0000
commit6920d8261ca0cdbb7e547a756a32dfd067cd15bc (patch)
tree981846eb1ebf8070a3fc654faf1e4e4f5f42c050 /cpp/src
parent0a453564f9624bf4c0ce98194691be9ff0184e2b (diff)
downloadqpid-python-6920d8261ca0cdbb7e547a756a32dfd067cd15bc.tar.gz
QPID-52: use of tr1 and unordered_map break build or RHEL4.
Replaced unordered_map with std::map. Use boost::shared_ptr instead of std::tr1::shared_ptr. Since we're using boost for other things now anyway it's simpler & more portable. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@467329 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/memory.h17
-rw-r--r--cpp/src/qpid/broker/Broker.h4
-rw-r--r--cpp/src/qpid/broker/Message.cpp11
-rw-r--r--cpp/src/qpid/broker/Message.h4
-rw-r--r--cpp/src/qpid/broker/Queue.h4
-rw-r--r--cpp/src/qpid/broker/SessionHandlerImpl.cpp2
-rw-r--r--cpp/src/qpid/broker/TopicExchange.cpp8
-rw-r--r--cpp/src/qpid/broker/TopicExchange.h13
-rw-r--r--cpp/src/qpid/client/Channel.cpp2
-rw-r--r--cpp/src/qpid/client/Connection.cpp4
-rw-r--r--cpp/src/qpid/framing/AMQBody.h4
-rw-r--r--cpp/src/qpid/framing/AMQContentBody.h2
-rw-r--r--cpp/src/qpid/framing/AMQHeaderBody.h2
-rw-r--r--cpp/src/qpid/framing/AMQHeartbeatBody.h2
-rw-r--r--cpp/src/qpid/framing/AMQMethodBody.h2
-rw-r--r--cpp/src/qpid/framing/BodyHandler.cpp4
-rw-r--r--cpp/src/qpid/framing/FieldTable.h9
17 files changed, 32 insertions, 62 deletions
diff --git a/cpp/src/memory.h b/cpp/src/memory.h
deleted file mode 100644
index 2d65877adb..0000000000
--- a/cpp/src/memory.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef __UTIL_MEMORY__
-#define __UTIL_MEMORY__
-
-#if __GNUC__ < 4
- #include "boost/shared_ptr.hpp"
- namespace std {
- namespace tr1 {
- using boost::shared_ptr;
- using boost::dynamic_pointer_cast;
- using boost::static_pointer_cast;
- }
- }
-#else
- #include <tr1/memory>
-#endif
-#endif
-
diff --git a/cpp/src/qpid/broker/Broker.h b/cpp/src/qpid/broker/Broker.h
index 40b171e838..8581093910 100644
--- a/cpp/src/qpid/broker/Broker.h
+++ b/cpp/src/qpid/broker/Broker.h
@@ -24,7 +24,7 @@
#include "qpid/concurrent/Runnable.h"
#include "qpid/broker/SessionHandlerFactoryImpl.h"
#include <boost/noncopyable.hpp>
-#include <tr1/memory>
+#include <boost/shared_ptr.hpp>
namespace qpid {
namespace broker {
@@ -42,7 +42,7 @@ namespace qpid {
static const int16_t DEFAULT_PORT;
virtual ~Broker();
- typedef std::tr1::shared_ptr<Broker> shared_ptr;
+ typedef boost::shared_ptr<Broker> shared_ptr;
/**
* Create a broker.
diff --git a/cpp/src/qpid/broker/Message.cpp b/cpp/src/qpid/broker/Message.cpp
index 53cfe4ee43..b5292ef043 100644
--- a/cpp/src/qpid/broker/Message.cpp
+++ b/cpp/src/qpid/broker/Message.cpp
@@ -20,12 +20,11 @@
#include "qpid/broker/ExchangeRegistry.h"
#include <iostream>
-using namespace std::tr1;//for *_pointer_cast methods
+using namespace boost;
using namespace qpid::broker;
using namespace qpid::framing;
using namespace qpid::concurrent;
-
Message::Message(const ConnectionToken* const _publisher,
const string& _exchange, const string& _routingKey,
bool _mandatory, bool _immediate) : publisher(_publisher),
@@ -34,12 +33,9 @@ Message::Message(const ConnectionToken* const _publisher,
mandatory(_mandatory),
immediate(_immediate),
redelivered(false),
- size(0){
+ size(0) {}
-}
-
-Message::~Message(){
-}
+Message::~Message(){}
void Message::setHeader(AMQHeaderBody::shared_ptr _header){
this->header = _header;
@@ -61,7 +57,6 @@ void Message::redeliver(){
void Message::deliver(OutputHandler* out, int channel,
const string& consumerTag, u_int64_t deliveryTag,
u_int32_t framesize){
-
out->send(new AMQFrame(channel, new BasicDeliverBody(consumerTag, deliveryTag, redelivered, exchange, routingKey)));
sendContent(out, channel, framesize);
}
diff --git a/cpp/src/qpid/broker/Message.h b/cpp/src/qpid/broker/Message.h
index c4e52db333..b6f41e817a 100644
--- a/cpp/src/qpid/broker/Message.h
+++ b/cpp/src/qpid/broker/Message.h
@@ -18,7 +18,7 @@
#ifndef _Message_
#define _Message_
-#include "memory.h"
+#include <boost/shared_ptr.hpp>
#include "qpid/framing/AMQContentBody.h"
#include "qpid/framing/AMQHeaderBody.h"
#include "qpid/framing/BasicHeaderProperties.h"
@@ -53,7 +53,7 @@ namespace qpid {
int channel, u_int32_t framesize);
public:
- typedef std::tr1::shared_ptr<Message> shared_ptr;
+ typedef boost::shared_ptr<Message> shared_ptr;
Message(const ConnectionToken* const publisher,
const string& exchange, const string& routingKey,
diff --git a/cpp/src/qpid/broker/Queue.h b/cpp/src/qpid/broker/Queue.h
index 8d3e4ab93b..0f20400daa 100644
--- a/cpp/src/qpid/broker/Queue.h
+++ b/cpp/src/qpid/broker/Queue.h
@@ -20,7 +20,7 @@
#include <vector>
#include <queue>
-#include "memory.h"
+#include <boost/shared_ptr.hpp>
#include "apr-1/apr_time.h"
#include "qpid/framing/amqp_types.h"
#include "qpid/broker/Binding.h"
@@ -63,7 +63,7 @@ namespace qpid {
public:
- typedef std::tr1::shared_ptr<Queue> shared_ptr;
+ typedef boost::shared_ptr<Queue> shared_ptr;
typedef std::vector<shared_ptr> vector;
diff --git a/cpp/src/qpid/broker/SessionHandlerImpl.cpp b/cpp/src/qpid/broker/SessionHandlerImpl.cpp
index 0713b84164..35f5b20854 100644
--- a/cpp/src/qpid/broker/SessionHandlerImpl.cpp
+++ b/cpp/src/qpid/broker/SessionHandlerImpl.cpp
@@ -23,7 +23,7 @@
#include "qpid/broker/TopicExchange.h"
#include "assert.h"
-using namespace std::tr1;
+using namespace boost;
using namespace qpid::broker;
using namespace qpid::io;
using namespace qpid::framing;
diff --git a/cpp/src/qpid/broker/TopicExchange.cpp b/cpp/src/qpid/broker/TopicExchange.cpp
index 6498e7600d..9ab779777c 100644
--- a/cpp/src/qpid/broker/TopicExchange.cpp
+++ b/cpp/src/qpid/broker/TopicExchange.cpp
@@ -41,14 +41,6 @@ Tokens& Tokens::operator=(const std::string& s) {
}
return *this;
}
-
-size_t Tokens::Hash::operator()(const Tokens& p) const {
- size_t hash = 0;
- for (Tokens::const_iterator i = p.begin(); i != p.end(); ++i) {
- hash += std::tr1::hash<std::string>()(*i);
- }
- return hash;
-}
TopicPattern& TopicPattern::operator=(const Tokens& tokens) {
Tokens::operator=(tokens);
diff --git a/cpp/src/qpid/broker/TopicExchange.h b/cpp/src/qpid/broker/TopicExchange.h
index 29772f5bce..d6c1946e71 100644
--- a/cpp/src/qpid/broker/TopicExchange.h
+++ b/cpp/src/qpid/broker/TopicExchange.h
@@ -18,7 +18,7 @@
#ifndef _TopicExchange_
#define _TopicExchange_
-#include <tr1/unordered_map>
+#include <map>
#include <vector>
#include "qpid/broker/Exchange.h"
#include "qpid/framing/FieldTable.h"
@@ -37,13 +37,14 @@ class Tokens : public std::vector<std::string> {
/** Tokenize s, provides automatic conversion of string to Tokens */
Tokens(const std::string& s) { operator=(s); }
- /** Tokenize s */
+ /** Tokenizing assignment operator s */
Tokens & operator=(const std::string& s);
-
- struct Hash { size_t operator()(const Tokens&) const; };
- typedef std::equal_to<Tokens> Equal;
+
+ private:
+ size_t hash;
};
+
/**
* Tokens that have been normalized as a pattern and can be matched
* with topic Tokens. Normalized meands all sequences of mixed * and
@@ -68,7 +69,7 @@ class TopicPattern : public Tokens
};
class TopicExchange : public virtual Exchange{
- typedef std::tr1::unordered_map<TopicPattern, Queue::vector, TopicPattern::Hash> BindingMap;
+ typedef std::map<TopicPattern, Queue::vector> BindingMap;
BindingMap bindings;
qpid::concurrent::MonitorImpl lock;
diff --git a/cpp/src/qpid/client/Channel.cpp b/cpp/src/qpid/client/Channel.cpp
index 99e827488c..4d994f0510 100644
--- a/cpp/src/qpid/client/Channel.cpp
+++ b/cpp/src/qpid/client/Channel.cpp
@@ -21,7 +21,7 @@
#include "qpid/client/Message.h"
#include "qpid/QpidError.h"
-using namespace std::tr1;//to use dynamic_pointer_cast
+using namespace boost; //to use dynamic_pointer_cast
using namespace qpid::client;
using namespace qpid::framing;
using namespace qpid::concurrent;
diff --git a/cpp/src/qpid/client/Connection.cpp b/cpp/src/qpid/client/Connection.cpp
index 779480eae9..b20df92e9b 100644
--- a/cpp/src/qpid/client/Connection.cpp
+++ b/cpp/src/qpid/client/Connection.cpp
@@ -68,7 +68,7 @@ void Connection::open(const std::string& _host, int _port, const std::string& ui
responses.receive(connection_tune);
- ConnectionTuneBody::shared_ptr proposal = std::tr1::dynamic_pointer_cast<ConnectionTuneBody, AMQMethodBody>(responses.getResponse());
+ ConnectionTuneBody::shared_ptr proposal = boost::dynamic_pointer_cast<ConnectionTuneBody, AMQMethodBody>(responses.getResponse());
out->send(new AMQFrame(0, new ConnectionTuneOkBody(proposal->getChannelMax(), max_frame_size, proposal->getHeartbeat())));
u_int16_t heartbeat = proposal->getHeartbeat();
@@ -86,7 +86,7 @@ void Connection::open(const std::string& _host, int _port, const std::string& ui
//ok
}else if(responses.validate(connection_redirect)){
//ignore for now
- ConnectionRedirectBody::shared_ptr redirect(std::tr1::dynamic_pointer_cast<ConnectionRedirectBody, AMQMethodBody>(responses.getResponse()));
+ ConnectionRedirectBody::shared_ptr redirect(boost::dynamic_pointer_cast<ConnectionRedirectBody, AMQMethodBody>(responses.getResponse()));
std::cout << "Received redirection to " << redirect->getHost() << std::endl;
}else{
THROW_QPID_ERROR(PROTOCOL_ERROR, "Bad response");
diff --git a/cpp/src/qpid/framing/AMQBody.h b/cpp/src/qpid/framing/AMQBody.h
index e9d77225fa..be06e43388 100644
--- a/cpp/src/qpid/framing/AMQBody.h
+++ b/cpp/src/qpid/framing/AMQBody.h
@@ -15,7 +15,7 @@
* limitations under the License.
*
*/
-#include "memory.h"
+#include <boost/shared_ptr.hpp>
#include "qpid/framing/amqp_types.h"
#include "qpid/framing/Buffer.h"
@@ -28,7 +28,7 @@ namespace qpid {
class AMQBody
{
public:
- typedef std::tr1::shared_ptr<AMQBody> shared_ptr;
+ typedef boost::shared_ptr<AMQBody> shared_ptr;
virtual ~AMQBody();
virtual u_int32_t size() const = 0;
diff --git a/cpp/src/qpid/framing/AMQContentBody.h b/cpp/src/qpid/framing/AMQContentBody.h
index 40dd8f159c..0aa1325642 100644
--- a/cpp/src/qpid/framing/AMQContentBody.h
+++ b/cpp/src/qpid/framing/AMQContentBody.h
@@ -30,7 +30,7 @@ class AMQContentBody : virtual public AMQBody
string data;
public:
- typedef std::tr1::shared_ptr<AMQContentBody> shared_ptr;
+ typedef boost::shared_ptr<AMQContentBody> shared_ptr;
AMQContentBody();
AMQContentBody(const string& data);
diff --git a/cpp/src/qpid/framing/AMQHeaderBody.h b/cpp/src/qpid/framing/AMQHeaderBody.h
index 4f3804ed75..422a473200 100644
--- a/cpp/src/qpid/framing/AMQHeaderBody.h
+++ b/cpp/src/qpid/framing/AMQHeaderBody.h
@@ -34,7 +34,7 @@ class AMQHeaderBody : virtual public AMQBody
void createProperties(int classId);
public:
- typedef std::tr1::shared_ptr<AMQHeaderBody> shared_ptr;
+ typedef boost::shared_ptr<AMQHeaderBody> shared_ptr;
AMQHeaderBody(int classId);
AMQHeaderBody();
diff --git a/cpp/src/qpid/framing/AMQHeartbeatBody.h b/cpp/src/qpid/framing/AMQHeartbeatBody.h
index 9d4c7d5b1a..34222682e5 100644
--- a/cpp/src/qpid/framing/AMQHeartbeatBody.h
+++ b/cpp/src/qpid/framing/AMQHeartbeatBody.h
@@ -28,7 +28,7 @@ namespace framing {
class AMQHeartbeatBody : virtual public AMQBody
{
public:
- typedef std::tr1::shared_ptr<AMQHeartbeatBody> shared_ptr;
+ typedef boost::shared_ptr<AMQHeartbeatBody> shared_ptr;
virtual ~AMQHeartbeatBody();
inline u_int32_t size() const { return 0; }
diff --git a/cpp/src/qpid/framing/AMQMethodBody.h b/cpp/src/qpid/framing/AMQMethodBody.h
index d22c86918c..59b297f19e 100644
--- a/cpp/src/qpid/framing/AMQMethodBody.h
+++ b/cpp/src/qpid/framing/AMQMethodBody.h
@@ -30,7 +30,7 @@ namespace framing {
class AMQMethodBody : virtual public AMQBody
{
public:
- typedef std::tr1::shared_ptr<AMQMethodBody> shared_ptr;
+ typedef boost::shared_ptr<AMQMethodBody> shared_ptr;
inline u_int8_t type() const { return METHOD_BODY; }
inline u_int32_t size() const { return 4 + bodySize(); }
diff --git a/cpp/src/qpid/framing/BodyHandler.cpp b/cpp/src/qpid/framing/BodyHandler.cpp
index ddf80b276d..77e68cf313 100644
--- a/cpp/src/qpid/framing/BodyHandler.cpp
+++ b/cpp/src/qpid/framing/BodyHandler.cpp
@@ -15,11 +15,11 @@
* limitations under the License.
*
*/
-#include "memory.h"
+#include <boost/shared_ptr.hpp>
#include "qpid/framing/BodyHandler.h"
using namespace qpid::framing;
-using namespace std::tr1;
+using namespace boost;
BodyHandler::~BodyHandler() {}
diff --git a/cpp/src/qpid/framing/FieldTable.h b/cpp/src/qpid/framing/FieldTable.h
index b48b270895..6b4d9266c1 100644
--- a/cpp/src/qpid/framing/FieldTable.h
+++ b/cpp/src/qpid/framing/FieldTable.h
@@ -17,8 +17,8 @@
*/
#include <iostream>
#include <vector>
-#include <tr1/memory>
-#include <tr1/unordered_map>
+#include <boost/shared_ptr.hpp>
+#include <map>
#include "qpid/framing/amqp_types.h"
#ifndef _FieldTable_
@@ -33,8 +33,8 @@ class Buffer;
class FieldTable
{
public:
- typedef std::tr1::shared_ptr<Value> ValuePtr;
- typedef std::tr1::unordered_map<std::string, ValuePtr> ValueMap;
+ typedef boost::shared_ptr<Value> ValuePtr;
+ typedef std::map<std::string, ValuePtr> ValueMap;
~FieldTable();
u_int32_t size() const;
@@ -61,7 +61,6 @@ class FieldTable
const ValueMap& getMap() const { return values; }
ValueMap& getMap() { return values; }
-
private:
friend std::ostream& operator<<(std::ostream& out, const FieldTable& body);
ValueMap values;