diff options
Diffstat (limited to 'cpp/src')
24 files changed, 46 insertions, 100 deletions
diff --git a/cpp/src/Makefile.am b/cpp/src/Makefile.am index 11ef204ddb..4d2d375802 100644 --- a/cpp/src/Makefile.am +++ b/cpp/src/Makefile.am @@ -502,7 +502,6 @@ nobase_include_HEADERS = \ qpid/InlineVector.h \ qpid/InlineAllocator.h \ qpid/memory.h \ - qpid/shared_ptr.h \ qpid/Version.h \ qpid/broker/Broker.h \ qpid/broker/AclModule.h \ diff --git a/cpp/src/qpid/acl/Acl.cpp b/cpp/src/qpid/acl/Acl.cpp index 12a7ba4634..8c128e7bb9 100644 --- a/cpp/src/qpid/acl/Acl.cpp +++ b/cpp/src/qpid/acl/Acl.cpp @@ -22,7 +22,6 @@ #include "qpid/broker/Broker.h" #include "qpid/Plugin.h" #include "qpid/Options.h" -#include "qpid/shared_ptr.h" #include "qpid/log/Logger.h" #include "qmf/org/apache/qpid/acl/Package.h" #include "qmf/org/apache/qpid/acl/EventAllow.h" @@ -32,6 +31,7 @@ #include <map> +#include <boost/shared_ptr.hpp> #include <boost/utility/in_place_factory.hpp> using namespace std; diff --git a/cpp/src/qpid/acl/Acl.h b/cpp/src/qpid/acl/Acl.h index 2a522bc56d..7770843e87 100644 --- a/cpp/src/qpid/acl/Acl.h +++ b/cpp/src/qpid/acl/Acl.h @@ -23,7 +23,6 @@ #include "qpid/acl/AclReader.h" -#include "qpid/shared_ptr.h" #include "qpid/RefCounted.h" #include "qpid/broker/AclModule.h" #include "qpid/management/Manageable.h" diff --git a/cpp/src/qpid/acl/AclPlugin.cpp b/cpp/src/qpid/acl/AclPlugin.cpp index 4c6efa19dd..e4d721ea44 100644 --- a/cpp/src/qpid/acl/AclPlugin.cpp +++ b/cpp/src/qpid/acl/AclPlugin.cpp @@ -21,9 +21,9 @@ #include "qpid/broker/Broker.h" #include "qpid/Plugin.h" #include "qpid/Options.h" -#include "qpid/shared_ptr.h" #include "qpid/log/Statement.h" +#include <boost/shared_ptr.hpp> #include <boost/utility/in_place_factory.hpp> namespace qpid { diff --git a/cpp/src/qpid/broker/AclModule.h b/cpp/src/qpid/broker/AclModule.h index 4bb6ca12b4..a78b2d5b4a 100644 --- a/cpp/src/qpid/broker/AclModule.h +++ b/cpp/src/qpid/broker/AclModule.h @@ -21,9 +21,8 @@ */ - -#include "qpid/shared_ptr.h" #include "qpid/RefCounted.h" +#include <boost/shared_ptr.hpp> #include <map> #include <set> #include <string> diff --git a/cpp/src/qpid/broker/Broker.cpp b/cpp/src/qpid/broker/Broker.cpp index 3f9effc08f..a5379634b6 100644 --- a/cpp/src/qpid/broker/Broker.cpp +++ b/cpp/src/qpid/broker/Broker.cpp @@ -237,7 +237,7 @@ Broker::Broker(const Broker::Options& conf) : Exchange::shared_ptr mExchange = exchanges.get (qpid_management); Exchange::shared_ptr dExchange = exchanges.get (amq_direct); ((ManagementBroker*) managementAgent)->setExchange (mExchange, dExchange); - dynamic_pointer_cast<ManagementExchange>(mExchange)->setManagmentAgent + boost::dynamic_pointer_cast<ManagementExchange>(mExchange)->setManagmentAgent ((ManagementBroker*) managementAgent); } else diff --git a/cpp/src/qpid/broker/Message.h b/cpp/src/qpid/broker/Message.h index 96eff453c0..cd2513284a 100644 --- a/cpp/src/qpid/broker/Message.h +++ b/cpp/src/qpid/broker/Message.h @@ -28,8 +28,8 @@ #include "qpid/framing/amqp_types.h" #include "qpid/sys/Mutex.h" #include "qpid/sys/Time.h" -#include "qpid/shared_ptr.h" #include <boost/function.hpp> +#include <boost/shared_ptr.hpp> #include <string> #include <vector> diff --git a/cpp/src/qpid/broker/SemanticState.cpp b/cpp/src/qpid/broker/SemanticState.cpp index 3c7c6d9afa..5e41fa3302 100644 --- a/cpp/src/qpid/broker/SemanticState.cpp +++ b/cpp/src/qpid/broker/SemanticState.cpp @@ -146,7 +146,7 @@ void SemanticState::startDtx(const std::string& xid, DtxManager& mgr, bool join) throw CommandInvalidException(QPID_MSG("Session has not been selected for use with dtx")); } dtxBuffer = DtxBuffer::shared_ptr(new DtxBuffer(xid)); - txBuffer = static_pointer_cast<TxBuffer>(dtxBuffer); + txBuffer = boost::static_pointer_cast<TxBuffer>(dtxBuffer); if (join) { mgr.join(xid, dtxBuffer); } else { @@ -214,7 +214,7 @@ void SemanticState::resumeDtx(const std::string& xid) checkDtxTimeout(); dtxBuffer->setSuspended(false); - txBuffer = static_pointer_cast<TxBuffer>(dtxBuffer); + txBuffer = boost::static_pointer_cast<TxBuffer>(dtxBuffer); } void SemanticState::checkDtxTimeout() diff --git a/cpp/src/qpid/broker/SemanticState.h b/cpp/src/qpid/broker/SemanticState.h index c31a6978c9..9dd7cc914b 100644 --- a/cpp/src/qpid/broker/SemanticState.h +++ b/cpp/src/qpid/broker/SemanticState.h @@ -36,7 +36,6 @@ #include "qpid/framing/Uuid.h" #include "qpid/sys/AggregateOutput.h" #include "qpid/sys/Mutex.h" -#include "qpid/shared_ptr.h" #include "AclModule.h" #include <list> diff --git a/cpp/src/qpid/broker/SessionAdapter.h b/cpp/src/qpid/broker/SessionAdapter.h index 60a5a0f285..b9f8134856 100644 --- a/cpp/src/qpid/broker/SessionAdapter.h +++ b/cpp/src/qpid/broker/SessionAdapter.h @@ -102,10 +102,10 @@ class Queue; const std::string& routingKey, const framing::FieldTable& arguments); private: - void checkType(shared_ptr<Exchange> exchange, const std::string& type); + void checkType(boost::shared_ptr<Exchange> exchange, const std::string& type); - void checkAlternate(shared_ptr<Exchange> exchange, - shared_ptr<Exchange> alternate); + void checkAlternate(boost::shared_ptr<Exchange> exchange, + boost::shared_ptr<Exchange> alternate); }; class QueueHandlerImpl : public QueueHandler, diff --git a/cpp/src/qpid/broker/TxOpVisitor.h b/cpp/src/qpid/broker/TxOpVisitor.h index a5f2a018c9..ceb894896e 100644 --- a/cpp/src/qpid/broker/TxOpVisitor.h +++ b/cpp/src/qpid/broker/TxOpVisitor.h @@ -21,7 +21,6 @@ * under the License. * */ -#include "qpid/shared_ptr.h" namespace qpid { namespace broker { @@ -71,8 +70,6 @@ struct TxOpConstVisitor * under the License. * */ -#include "qpid/shared_ptr.h" - namespace qpid { namespace broker { diff --git a/cpp/src/qpid/client/CompletionImpl.h b/cpp/src/qpid/client/CompletionImpl.h index 119abc093a..cd88df79ed 100644 --- a/cpp/src/qpid/client/CompletionImpl.h +++ b/cpp/src/qpid/client/CompletionImpl.h @@ -24,6 +24,7 @@ #include "qpid/RefCounted.h" #include "Future.h" +#include <boost/shared_ptr.hpp> namespace qpid { namespace client { @@ -33,7 +34,7 @@ class CompletionImpl : public RefCounted { public: CompletionImpl() {} - CompletionImpl(Future f, shared_ptr<SessionImpl> s) : future(f), session(s) {} + CompletionImpl(Future f, boost::shared_ptr<SessionImpl> s) : future(f), session(s) {} bool isComplete() { return future.isComplete(*session); } void wait() { future.wait(*session); } @@ -41,7 +42,7 @@ public: protected: Future future; - shared_ptr<SessionImpl> session; + boost::shared_ptr<SessionImpl> session; }; }} // namespace qpid::client diff --git a/cpp/src/qpid/client/Connection.cpp b/cpp/src/qpid/client/Connection.cpp index e8415403ca..b0d9406fad 100644 --- a/cpp/src/qpid/client/Connection.cpp +++ b/cpp/src/qpid/client/Connection.cpp @@ -28,7 +28,6 @@ #include "qpid/log/Logger.h" #include "qpid/log/Options.h" #include "qpid/log/Statement.h" -#include "qpid/shared_ptr.h" #include "qpid/framing/AMQP_HighestVersion.h" #include <algorithm> @@ -37,6 +36,7 @@ #include <functional> #include <boost/format.hpp> #include <boost/bind.hpp> +#include <boost/shared_ptr.hpp> using namespace qpid::framing; using namespace qpid::sys; @@ -47,7 +47,7 @@ namespace client { Connection::Connection() : version(framing::highestProtocolVersion) {} -Connection::~Connection(){ } +Connection::~Connection() {} void Connection::open( const Url& url, @@ -119,7 +119,7 @@ void Connection::open(const ConnectionSettings& settings) if (isOpen()) throw Exception(QPID_MSG("Connection::open() was already called")); - impl = shared_ptr<ConnectionImpl>(new ConnectionImpl(version, settings)); + impl = boost::shared_ptr<ConnectionImpl>(new ConnectionImpl(version, settings)); impl->open(); if ( failureCallback ) impl->registerFailureCallback ( failureCallback ); diff --git a/cpp/src/qpid/client/SessionBase_0_10.h b/cpp/src/qpid/client/SessionBase_0_10.h index b4f713dcb5..94686ff39f 100644 --- a/cpp/src/qpid/client/SessionBase_0_10.h +++ b/cpp/src/qpid/client/SessionBase_0_10.h @@ -27,7 +27,6 @@ #include "qpid/client/Message.h" #include "qpid/client/Completion.h" #include "qpid/client/TypedResult.h" -#include "qpid/shared_ptr.h" #include "qpid/client/ClientImportExport.h" #include <string> diff --git a/cpp/src/qpid/client/SessionImpl.cpp b/cpp/src/qpid/client/SessionImpl.cpp index 5df376efa0..0c6af5d1ff 100644 --- a/cpp/src/qpid/client/SessionImpl.cpp +++ b/cpp/src/qpid/client/SessionImpl.cpp @@ -37,6 +37,7 @@ #include "qpid/sys/IntegerTypes.h" #include <boost/bind.hpp> +#include <boost/shared_ptr.hpp> namespace { const std::string EMPTY; } @@ -51,7 +52,7 @@ typedef sys::Monitor::ScopedUnlock UnLock; typedef sys::ScopedLock<sys::Semaphore> Acquire; -SessionImpl::SessionImpl(const std::string& name, shared_ptr<ConnectionImpl> conn) +SessionImpl::SessionImpl(const std::string& name, boost::shared_ptr<ConnectionImpl> conn) : state(INACTIVE), detachedLifetime(0), maxFrameSize(conn->getNegotiatedSettings().maxFrameSize), @@ -119,7 +120,7 @@ void SessionImpl::close() //user thread waitFor(DETACHED); } -void SessionImpl::resume(shared_ptr<ConnectionImpl>) // user thread +void SessionImpl::resume(boost::shared_ptr<ConnectionImpl>) // user thread { // weakPtr sessions should not be resumed. if (weakPtr) return; @@ -770,7 +771,7 @@ void SessionImpl::setWeakPtr(bool weak) { connectionShared = connectionWeak.lock(); } -shared_ptr<ConnectionImpl> SessionImpl::getConnection() +boost::shared_ptr<ConnectionImpl> SessionImpl::getConnection() { return connectionWeak.lock(); } diff --git a/cpp/src/qpid/client/SessionImpl.h b/cpp/src/qpid/client/SessionImpl.h index 851bd2ec47..4120f24011 100644 --- a/cpp/src/qpid/client/SessionImpl.h +++ b/cpp/src/qpid/client/SessionImpl.h @@ -28,8 +28,6 @@ #include "qpid/SessionId.h" #include "qpid/SessionState.h" -#include "boost/shared_ptr.hpp" -#include "boost/weak_ptr.hpp" #include "qpid/framing/FrameHandler.h" #include "qpid/framing/ChannelHandler.h" #include "qpid/framing/SequenceNumber.h" @@ -39,6 +37,8 @@ #include "qpid/sys/StateMonitor.h" #include "qpid/sys/ExceptionHolder.h" +#include <boost/weak_ptr.hpp> +#include <boost/shared_ptr.hpp> #include <boost/optional.hpp> namespace qpid { @@ -65,7 +65,7 @@ class SessionImpl : public framing::FrameHandler::InOutHandler, private framing::AMQP_ClientOperations::MessageHandler { public: - SessionImpl(const std::string& name, shared_ptr<ConnectionImpl>); + SessionImpl(const std::string& name, boost::shared_ptr<ConnectionImpl>); ~SessionImpl(); @@ -79,7 +79,7 @@ public: void open(uint32_t detachedLifetime); void close(); - void resume(shared_ptr<ConnectionImpl>); + void resume(boost::shared_ptr<ConnectionImpl>); void suspend(); void assertOpen() const; @@ -118,7 +118,7 @@ public: /** * get the Connection associated with this connection */ - shared_ptr<ConnectionImpl> getConnection(); + boost::shared_ptr<ConnectionImpl> getConnection(); private: enum State { @@ -209,7 +209,7 @@ private: const uint64_t maxFrameSize; const SessionId id; - shared_ptr<ConnectionImpl> connectionShared; + boost::shared_ptr<ConnectionImpl> connectionShared; boost::weak_ptr<ConnectionImpl> connectionWeak; bool weakPtr; diff --git a/cpp/src/qpid/cluster/Cluster.cpp b/cpp/src/qpid/cluster/Cluster.cpp index 09e053dc28..910699f913 100644 --- a/cpp/src/qpid/cluster/Cluster.cpp +++ b/cpp/src/qpid/cluster/Cluster.cpp @@ -46,10 +46,10 @@ #include "qpid/management/IdAllocator.h" #include "qpid/management/ManagementBroker.h" #include "qpid/memory.h" -#include "qpid/shared_ptr.h" #include "qpid/sys/Thread.h" #include "qpid/sys/LatencyTracker.h" +#include <boost/shared_ptr.hpp> #include <boost/bind.hpp> #include <boost/cast.hpp> #include <boost/current_function.hpp> diff --git a/cpp/src/qpid/cluster/ClusterPlugin.cpp b/cpp/src/qpid/cluster/ClusterPlugin.cpp index 0067de8ec1..66d15fa56b 100644 --- a/cpp/src/qpid/cluster/ClusterPlugin.cpp +++ b/cpp/src/qpid/cluster/ClusterPlugin.cpp @@ -28,7 +28,6 @@ #include "qpid/broker/Broker.h" #include "qpid/Plugin.h" #include "qpid/Options.h" -#include "qpid/shared_ptr.h" #include "qpid/sys/AtomicValue.h" #include "qpid/log/Statement.h" @@ -39,6 +38,7 @@ #include "qpid/broker/SessionState.h" #include "qpid/client/ConnectionSettings.h" +#include <boost/shared_ptr.hpp> #include <boost/utility/in_place_factory.hpp> #include <boost/scoped_ptr.hpp> diff --git a/cpp/src/qpid/cluster/Connection.cpp b/cpp/src/qpid/cluster/Connection.cpp index c107552905..cc0af77029 100644 --- a/cpp/src/qpid/cluster/Connection.cpp +++ b/cpp/src/qpid/cluster/Connection.cpp @@ -308,14 +308,14 @@ bool Connection::isUpdated() const { } -shared_ptr<broker::Queue> Connection::findQueue(const std::string& qname) { - shared_ptr<broker::Queue> queue = cluster.getBroker().getQueues().find(qname); +boost::shared_ptr<broker::Queue> Connection::findQueue(const std::string& qname) { + boost::shared_ptr<broker::Queue> queue = cluster.getBroker().getQueues().find(qname); if (!queue) throw Exception(QPID_MSG(cluster << " can't find queue " << qname)); return queue; } broker::QueuedMessage Connection::getUpdateMessage() { - shared_ptr<broker::Queue> updateq = findQueue(UpdateClient::UPDATE); + boost::shared_ptr<broker::Queue> updateq = findQueue(UpdateClient::UPDATE); assert(!updateq->isDurable()); broker::QueuedMessage m = updateq->get(); if (!m.payload) throw Exception(QPID_MSG(cluster << " empty update queue")); @@ -359,7 +359,7 @@ void Connection::deliveryRecord(const string& qname, } void Connection::queuePosition(const string& qname, const SequenceNumber& position) { - shared_ptr<broker::Queue> q = cluster.getBroker().getQueues().find(qname); + boost::shared_ptr<broker::Queue> q = cluster.getBroker().getQueues().find(qname); if (!q) throw InvalidArgumentException(QPID_MSG("Invalid queue name " << qname)); q->setPosition(position); } @@ -377,18 +377,21 @@ std::ostream& operator<<(std::ostream& o, const Connection& c) { } void Connection::txStart() { - txBuffer = make_shared_ptr(new broker::TxBuffer()); + txBuffer.reset(new broker::TxBuffer()); } void Connection::txAccept(const framing::SequenceSet& acked) { - txBuffer->enlist(make_shared_ptr(new broker::TxAccept(acked, semanticState().getUnacked()))); + txBuffer->enlist(boost::shared_ptr<broker::TxAccept>( + new broker::TxAccept(acked, semanticState().getUnacked()))); } void Connection::txDequeue(const std::string& queue) { - txBuffer->enlist(make_shared_ptr(new broker::RecoveredDequeue(findQueue(queue), getUpdateMessage().payload))); + txBuffer->enlist(boost::shared_ptr<broker::RecoveredDequeue>( + new broker::RecoveredDequeue(findQueue(queue), getUpdateMessage().payload))); } void Connection::txEnqueue(const std::string& queue) { - txBuffer->enlist(make_shared_ptr(new broker::RecoveredEnqueue(findQueue(queue), getUpdateMessage().payload))); + txBuffer->enlist(boost::shared_ptr<broker::RecoveredEnqueue>( + new broker::RecoveredEnqueue(findQueue(queue), getUpdateMessage().payload))); } void Connection::txPublish(const framing::Array& queues, bool delivered) { diff --git a/cpp/src/qpid/framing/AMQMethodBody.h b/cpp/src/qpid/framing/AMQMethodBody.h index a38726b0fc..c7e8931835 100644 --- a/cpp/src/qpid/framing/AMQMethodBody.h +++ b/cpp/src/qpid/framing/AMQMethodBody.h @@ -24,10 +24,10 @@ #include "amqp_types.h" #include "AMQBody.h" #include "qpid/framing/ProtocolVersion.h" -#include "qpid/shared_ptr.h" #include "qpid/CommonImportExport.h" -#include <ostream> +#include <boost/shared_ptr.hpp> +#include <ostream> #include <assert.h> namespace qpid { diff --git a/cpp/src/qpid/framing/Handler.h b/cpp/src/qpid/framing/Handler.h index e07a803e17..fa8db36f49 100644 --- a/cpp/src/qpid/framing/Handler.h +++ b/cpp/src/qpid/framing/Handler.h @@ -21,7 +21,7 @@ * under the License. * */ -#include "qpid/shared_ptr.h" +#include <boost/shared_ptr.hpp> #include <boost/type_traits/remove_reference.hpp> #include <assert.h> diff --git a/cpp/src/qpid/shared_ptr.h b/cpp/src/qpid/shared_ptr.h deleted file mode 100644 index 0c933ea6a6..0000000000 --- a/cpp/src/qpid/shared_ptr.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef _common_shared_ptr_h -#define _common_shared_ptr_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. - * - */ - -#include <boost/shared_ptr.hpp> -#include <boost/cast.hpp> - -namespace qpid { - -// Import shared_ptr definitions into qpid namespace and define some -// useful shared_ptr templates for convenience. - -using boost::shared_ptr; -using boost::dynamic_pointer_cast; -using boost::static_pointer_cast; -using boost::const_pointer_cast; -using boost::shared_polymorphic_downcast; - -template <class T> shared_ptr<T> make_shared_ptr(T* ptr) { - return shared_ptr<T>(ptr); -} - -template <class T, class D> -shared_ptr<T> make_shared_ptr(T* ptr, D deleter) { - return shared_ptr<T>(ptr, deleter); -} - -inline void nullDeleter(void const *) {} - -} // namespace qpid - - - -#endif /*!_common_shared_ptr_h*/ diff --git a/cpp/src/qpid/xml/XmlExchangePlugin.cpp b/cpp/src/qpid/xml/XmlExchangePlugin.cpp index 97e221589d..d0ec9cb959 100644 --- a/cpp/src/qpid/xml/XmlExchangePlugin.cpp +++ b/cpp/src/qpid/xml/XmlExchangePlugin.cpp @@ -20,9 +20,9 @@ #include "qpid/acl/Acl.h" #include "qpid/broker/Broker.h" #include "qpid/Plugin.h" -#include "qpid/shared_ptr.h" #include "qpid/log/Statement.h" +#include <boost/shared_ptr.hpp> #include <boost/utility/in_place_factory.hpp> #include "XmlExchange.h" diff --git a/cpp/src/tests/TxPublishTest.cpp b/cpp/src/tests/TxPublishTest.cpp index 9e9715c987..63dbf99266 100644 --- a/cpp/src/tests/TxPublishTest.cpp +++ b/cpp/src/tests/TxPublishTest.cpp @@ -63,7 +63,7 @@ QPID_AUTO_TEST_CASE(testPrepare) { TxPublishTest t; - intrusive_ptr<PersistableMessage> pmsg = static_pointer_cast<PersistableMessage>(t.msg); + intrusive_ptr<PersistableMessage> pmsg = boost::static_pointer_cast<PersistableMessage>(t.msg); //ensure messages are enqueued in store t.op.prepare(0); BOOST_CHECK_EQUAL((size_t) 2, t.store.enqueued.size()); @@ -71,7 +71,7 @@ QPID_AUTO_TEST_CASE(testPrepare) BOOST_CHECK_EQUAL(pmsg, t.store.enqueued[0].second); BOOST_CHECK_EQUAL(string("queue2"), t.store.enqueued[1].first); BOOST_CHECK_EQUAL(pmsg, t.store.enqueued[1].second); - BOOST_CHECK_EQUAL( true, ( static_pointer_cast<PersistableMessage>(t.msg))->isEnqueueComplete()); + BOOST_CHECK_EQUAL( true, ( boost::static_pointer_cast<PersistableMessage>(t.msg))->isEnqueueComplete()); } QPID_AUTO_TEST_CASE(testCommit) @@ -84,7 +84,7 @@ QPID_AUTO_TEST_CASE(testCommit) BOOST_CHECK_EQUAL((uint32_t) 1, t.queue1->getMessageCount()); intrusive_ptr<Message> msg_dequeue = t.queue1->get().payload; - BOOST_CHECK_EQUAL( true, (static_pointer_cast<PersistableMessage>(msg_dequeue))->isEnqueueComplete()); + BOOST_CHECK_EQUAL( true, (boost::static_pointer_cast<PersistableMessage>(msg_dequeue))->isEnqueueComplete()); BOOST_CHECK_EQUAL(t.msg, msg_dequeue); BOOST_CHECK_EQUAL((uint32_t) 1, t.queue2->getMessageCount()); |