--- Begin Message ---
Author: aconway
Date: Tue Oct 24 06:29:05 2006
New Revision: 467329
URL: http://svn.apache.org/viewvc?view=rev&rev=467329
Log:
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.
Removed:
incubator/qpid/trunk/qpid/cpp/src/memory.h
Modified:
incubator/qpid/trunk/qpid/cpp/Makefile
incubator/qpid/trunk/qpid/cpp/etc/stylesheets/cpp.xsl
incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.h
incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Message.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Message.h
incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.h
incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionHandlerImpl.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/broker/TopicExchange.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/broker/TopicExchange.h
incubator/qpid/trunk/qpid/cpp/src/qpid/client/Channel.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/client/Connection.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQBody.h
incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQContentBody.h
incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQHeaderBody.h
incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQHeartbeatBody.h
incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQMethodBody.h
incubator/qpid/trunk/qpid/cpp/src/qpid/framing/BodyHandler.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldTable.h
incubator/qpid/trunk/qpid/cpp/test/unit/qpid/broker/ChannelTest.cpp
Modified: incubator/qpid/trunk/qpid/cpp/Makefile
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/Makefile?view=diff&rev=467329&r1=467328&r2=467329
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/Makefile (original)
+++ incubator/qpid/trunk/qpid/cpp/Makefile Tue Oct 24 06:29:05 2006
@@ -60,8 +60,8 @@
generate: gen/timestamp
gen/timestamp: $(wildcard etc/stylesheets/*.xsl) $(SPEC)
mkdir -p gen/qpid/framing
- echo > gen/timestamp
- cd gen/qpid/framing && for s in $(STYLESHEETS) ; do $(TRANSFORM) $$s ;
done
+ ( cd gen/qpid/framing && for s in $(STYLESHEETS) ; do $(TRANSFORM) $$s
; done ) && echo > gen/timestamp
+
gen $(wildcard gen/qpid/framing/*.cpp): gen/timestamp
## Libraries
Modified: incubator/qpid/trunk/qpid/cpp/etc/stylesheets/cpp.xsl
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/etc/stylesheets/cpp.xsl?view=diff&rev=467329&r1=467328&r2=467329
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/etc/stylesheets/cpp.xsl (original)
+++ incubator/qpid/trunk/qpid/cpp/etc/stylesheets/cpp.xsl Tue Oct 24 06:29:05
2006
@@ -68,7 +68,7 @@
</xsl:for-each>
public:
- typedef std::tr1::shared_ptr<<xsl:value-of select="$f/@name"/>>
shared_ptr;
+ typedef boost::shared_ptr<<xsl:value-of select="$f/@name"/>>
shared_ptr;
virtual ~<xsl:value-of select="$f/@name"/>() {}
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.h
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.h?view=diff&rev=467329&r1=467328&r2=467329
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.h Tue Oct 24 06:29:05
2006
@@ -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 @@
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.
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Message.cpp
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Message.cpp?view=diff&rev=467329&r1=467328&r2=467329
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Message.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Message.cpp Tue Oct 24
06:29:05 2006
@@ -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 @@
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::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);
}
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Message.h
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Message.h?view=diff&rev=467329&r1=467328&r2=467329
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Message.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Message.h Tue Oct 24 06:29:05
2006
@@ -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 @@
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,
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.h
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.h?view=diff&rev=467329&r1=467328&r2=467329
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.h Tue Oct 24 06:29:05
2006
@@ -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 @@
public:
- typedef std::tr1::shared_ptr<Queue> shared_ptr;
+ typedef boost::shared_ptr<Queue> shared_ptr;
typedef std::vector<shared_ptr> vector;
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionHandlerImpl.cpp
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionHandlerImpl.cpp?view=diff&rev=467329&r1=467328&r2=467329
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionHandlerImpl.cpp
(original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionHandlerImpl.cpp Tue
Oct 24 06:29:05 2006
@@ -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;
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/TopicExchange.cpp
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/TopicExchange.cpp?view=diff&rev=467329&r1=467328&r2=467329
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/TopicExchange.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/TopicExchange.cpp Tue Oct 24
06:29:05 2006
@@ -41,14 +41,6 @@
}
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);
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/TopicExchange.h
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/TopicExchange.h?view=diff&rev=467329&r1=467328&r2=467329
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/TopicExchange.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/TopicExchange.h Tue Oct 24
06:29:05 2006
@@ -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 @@
/** 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 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;
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/client/Channel.cpp
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/client/Channel.cpp?view=diff&rev=467329&r1=467328&r2=467329
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/client/Channel.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/client/Channel.cpp Tue Oct 24
06:29:05 2006
@@ -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;
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/client/Connection.cpp
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/client/Connection.cpp?view=diff&rev=467329&r1=467328&r2=467329
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/client/Connection.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/client/Connection.cpp Tue Oct 24
06:29:05 2006
@@ -68,7 +68,7 @@
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 @@
//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");
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQBody.h
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQBody.h?view=diff&rev=467329&r1=467328&r2=467329
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQBody.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQBody.h Tue Oct 24
06:29:05 2006
@@ -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 @@
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;
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQContentBody.h
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQContentBody.h?view=diff&rev=467329&r1=467328&r2=467329
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQContentBody.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQContentBody.h Tue Oct 24
06:29:05 2006
@@ -30,7 +30,7 @@
string data;
public:
- typedef std::tr1::shared_ptr<AMQContentBody> shared_ptr;
+ typedef boost::shared_ptr<AMQContentBody> shared_ptr;
AMQContentBody();
AMQContentBody(const string& data);
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQHeaderBody.h
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQHeaderBody.h?view=diff&rev=467329&r1=467328&r2=467329
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQHeaderBody.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQHeaderBody.h Tue Oct 24
06:29:05 2006
@@ -34,7 +34,7 @@
void createProperties(int classId);
public:
- typedef std::tr1::shared_ptr<AMQHeaderBody> shared_ptr;
+ typedef boost::shared_ptr<AMQHeaderBody> shared_ptr;
AMQHeaderBody(int classId);
AMQHeaderBody();
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQHeartbeatBody.h
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQHeartbeatBody.h?view=diff&rev=467329&r1=467328&r2=467329
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQHeartbeatBody.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQHeartbeatBody.h Tue Oct
24 06:29:05 2006
@@ -28,7 +28,7 @@
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; }
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQMethodBody.h
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQMethodBody.h?view=diff&rev=467329&r1=467328&r2=467329
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQMethodBody.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQMethodBody.h Tue Oct 24
06:29:05 2006
@@ -30,7 +30,7 @@
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(); }
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/framing/BodyHandler.cpp
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/framing/BodyHandler.cpp?view=diff&rev=467329&r1=467328&r2=467329
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/framing/BodyHandler.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/framing/BodyHandler.cpp Tue Oct 24
06:29:05 2006
@@ -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() {}
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldTable.h
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldTable.h?view=diff&rev=467329&r1=467328&r2=467329
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldTable.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldTable.h Tue Oct 24
06:29:05 2006
@@ -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 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 @@
const ValueMap& getMap() const { return values; }
ValueMap& getMap() { return values; }
-
private:
friend std::ostream& operator<<(std::ostream& out, const FieldTable& body);
ValueMap values;
Modified: incubator/qpid/trunk/qpid/cpp/test/unit/qpid/broker/ChannelTest.cpp
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/test/unit/qpid/broker/ChannelTest.cpp?view=diff&rev=467329&r1=467328&r2=467329
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/test/unit/qpid/broker/ChannelTest.cpp
(original)
+++ incubator/qpid/trunk/qpid/cpp/test/unit/qpid/broker/ChannelTest.cpp Tue Oct
24 06:29:05 2006
@@ -21,7 +21,7 @@
#include <iostream>
#include <memory>
-using namespace std::tr1;
+using namespace boost;
using namespace qpid::broker;
using namespace qpid::framing;
using namespace qpid::concurrent;
--- End Message ---