You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2008/03/24 18:44:01 UTC

svn commit: r640479 - in /incubator/qpid/trunk/qpid/cpp/src: qpid/ qpid/broker/ qpid/framing/ qpid/management/ tests/

Author: astitcher
Date: Mon Mar 24 10:43:55 2008
New Revision: 640479

URL: http://svn.apache.org/viewvc?rev=640479&view=rev
Log:
- Refactored RefCounted class to avoid virtual inheritance
- Removed extraneous includes and definitions from RefCounted.h
- Fixed all the places that were relying on RefCounted.h to be including the
  intrusive_ptr header file and were assuming that something had imported
  intrusive_ptr into the qpid namespace

Modified:
    incubator/qpid/trunk/qpid/cpp/src/qpid/RefCounted.h
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Consumer.h
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DeliverableMessage.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DeliverableMessage.h
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DtxManager.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DtxWorkRecord.h
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/IncomingExecutionContext.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/IncomingExecutionContext.h
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Message.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageBuilder.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageBuilder.h
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStore.h
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.h
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.h
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/PreviewSessionManager.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/PreviewSessionManager.h
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.h
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveredDequeue.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveredDequeue.h
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveredEnqueue.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveredEnqueue.h
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManagerImpl.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SemanticHandler.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SemanticState.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SemanticState.h
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionManager.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionManager.h
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionState.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Timer.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Timer.h
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/TxPublish.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/TxPublish.h
    incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQFrame.h
    incubator/qpid/trunk/qpid/cpp/src/qpid/management/ManagementAgent.cpp
    incubator/qpid/trunk/qpid/cpp/src/tests/ExchangeTest.cpp
    incubator/qpid/trunk/qpid/cpp/src/tests/ISList.cpp
    incubator/qpid/trunk/qpid/cpp/src/tests/MessageUtils.h
    incubator/qpid/trunk/qpid/cpp/src/tests/QueueTest.cpp
    incubator/qpid/trunk/qpid/cpp/src/tests/RefCounted.cpp
    incubator/qpid/trunk/qpid/cpp/src/tests/TimerTest.cpp
    incubator/qpid/trunk/qpid/cpp/src/tests/TxAckTest.cpp
    incubator/qpid/trunk/qpid/cpp/src/tests/TxPublishTest.cpp

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/RefCounted.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/RefCounted.h?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/RefCounted.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/RefCounted.h Mon Mar 24 10:43:55 2008
@@ -10,9 +10,9 @@
  * 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
@@ -22,39 +22,28 @@
  *
  */
 
-#include "qpid/sys/AtomicCount.h"
-
-#include <boost/intrusive_ptr.hpp>
-
+#include <boost/utility.hpp>
+#include <boost/detail/atomic_count.hpp>
 
 namespace qpid {
 
-/** Abstract interface for reference counted objects */
-class AbstractRefCounted {
-  public:
-    virtual void addRef() const=0;
-    virtual void release() const=0;
-  protected:
-    virtual ~AbstractRefCounted() {}
-};
-
 /**
  * Reference-counted base class.
+ * Note: this class isn't copyable - you must copy the intrusive_ptr that points
+ * to the class that has mixed this in not the class itself (as that would sidestep
+ * the reference counting)
  */
-class RefCounted : public AbstractRefCounted {
-  public:
-    RefCounted() {}
-    virtual void addRef() const { ++count; }
-    virtual void release() const { if (--count==0) released(); }
+class RefCounted : boost::noncopyable {
+    mutable boost::detail::atomic_count count;
 
-  protected:
-    virtual ~RefCounted() {};
-    // Copy/assign do not copy refcounts. 
-    RefCounted(const RefCounted&) : AbstractRefCounted() {}
-    RefCounted& operator=(const RefCounted&) { return *this; }
-    virtual void released() const { assert(count==0); delete this; }
+public:
+    RefCounted() : count(0) {}
+    void addRef() const { ++count; }
+    void release() const { if (--count==0) delete this; }
+    long refCount() { return count; }
 
-    mutable sys::AtomicCount count;
+protected:
+    virtual ~RefCounted() {};
 };
 
 /**
@@ -62,24 +51,27 @@
  * Delegates reference counts to the parent so that the parent is
  * deleted only when there are no references to the parent or any of
  * its children.
+ * TODO: Delete this class if it's unused as I don't think this class makes much sense:
  */
-struct RefCountedChild : public AbstractRefCounted {
-  protected:
-    AbstractRefCounted& parent;
-    RefCountedChild(AbstractRefCounted& parent_) : parent(parent_) {}
-  public:
+struct RefCountedChild {
+    RefCounted& parent;
+
+protected:
+    RefCountedChild(RefCounted& parent_) : parent(parent_) {}
+
+public:
     void addRef() const { parent.addRef(); }
     void release() const { parent.release(); }
 };
 
-using boost::intrusive_ptr;
-
 } // namespace qpid
 
 // intrusive_ptr support.
 namespace boost {
-inline void intrusive_ptr_add_ref(const qpid::AbstractRefCounted* p) { p->addRef(); }
-inline void intrusive_ptr_release(const qpid::AbstractRefCounted* p) { p->release(); }
+inline void intrusive_ptr_add_ref(const qpid::RefCounted* p) { p->addRef(); }
+inline void intrusive_ptr_release(const qpid::RefCounted* p) { p->release(); }
+inline void intrusive_ptr_add_ref(const qpid::RefCountedChild* p) { p->addRef(); }
+inline void intrusive_ptr_release(const qpid::RefCountedChild* p) { p->release(); }
 }
 
 

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Consumer.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Consumer.h?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Consumer.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Consumer.h Mon Mar 24 10:43:55 2008
@@ -33,11 +33,11 @@
 
         struct QueuedMessage
         {
-            intrusive_ptr<Message> payload;
+            boost::intrusive_ptr<Message> payload;
             framing::SequenceNumber position;
             Queue* queue;
 			
-            QueuedMessage(Queue* q, intrusive_ptr<Message> msg, framing::SequenceNumber sn) : 
+            QueuedMessage(Queue* q, boost::intrusive_ptr<Message> msg, framing::SequenceNumber sn) : 
 			               payload(msg), position(sn), queue(q) {}
             QueuedMessage(Queue* q) : queue(q) {}
         };
@@ -54,8 +54,8 @@
             bool preAcquires() const { return acquires; }
             virtual bool deliver(QueuedMessage& msg) = 0;
             virtual void notify() = 0;
-            virtual bool filter(intrusive_ptr<Message>) { return true; }
-            virtual bool accept(intrusive_ptr<Message>) { return true; }
+            virtual bool filter(boost::intrusive_ptr<Message>) { return true; }
+            virtual bool accept(boost::intrusive_ptr<Message>) { return true; }
             virtual ~Consumer(){}
         };
     }

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DeliverableMessage.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DeliverableMessage.cpp?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DeliverableMessage.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DeliverableMessage.cpp Mon Mar 24 10:43:55 2008
@@ -22,7 +22,7 @@
 
 using namespace qpid::broker;
 
-DeliverableMessage::DeliverableMessage(intrusive_ptr<Message>& _msg) : msg(_msg)
+DeliverableMessage::DeliverableMessage(boost::intrusive_ptr<Message>& _msg) : msg(_msg)
 {
 }
 

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DeliverableMessage.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DeliverableMessage.h?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DeliverableMessage.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DeliverableMessage.h Mon Mar 24 10:43:55 2008
@@ -25,12 +25,14 @@
 #include "Queue.h"
 #include "Message.h"
 
+#include <boost/intrusive_ptr.hpp>
+
 namespace qpid {
     namespace broker {
         class DeliverableMessage : public Deliverable{
-            intrusive_ptr<Message> msg;
+            boost::intrusive_ptr<Message> msg;
         public:
-            DeliverableMessage(intrusive_ptr<Message>& msg);
+            DeliverableMessage(boost::intrusive_ptr<Message>& msg);
             virtual void deliverTo(Queue::shared_ptr& queue);
             Message& getMessage();
             uint64_t contentSize();

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DtxManager.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DtxManager.cpp?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DtxManager.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DtxManager.cpp Mon Mar 24 10:43:55 2008
@@ -27,6 +27,7 @@
 #include <boost/format.hpp>
 #include <iostream>
 
+using boost::intrusive_ptr;
 using qpid::sys::Mutex;
 using namespace qpid::ptr_map;
 using namespace qpid::broker;

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DtxWorkRecord.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DtxWorkRecord.h?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DtxWorkRecord.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/DtxWorkRecord.h Mon Mar 24 10:43:55 2008
@@ -21,15 +21,19 @@
 #ifndef _DtxWorkRecord_
 #define _DtxWorkRecord_
 
-#include <algorithm>
-#include <functional>
-#include <vector>
 #include "DtxBuffer.h"
 #include "DtxTimeout.h"
 #include "TransactionalStore.h"
+
 #include "qpid/framing/amqp_types.h"
 #include "qpid/sys/Mutex.h"
 
+#include <algorithm>
+#include <functional>
+#include <vector>
+
+#include <boost/intrusive_ptr.hpp>
+
 namespace qpid {
 namespace broker {
 
@@ -48,7 +52,7 @@
     bool rolledback;
     bool prepared;
     bool expired;
-    intrusive_ptr<DtxTimeout> timeout;
+    boost::intrusive_ptr<DtxTimeout> timeout;
     Work work;
     std::auto_ptr<TPCTransactionContext> txn;
     qpid::sys::Mutex lock;
@@ -65,8 +69,8 @@
     void add(DtxBuffer::shared_ptr ops);
     void recover(std::auto_ptr<TPCTransactionContext> txn, DtxBuffer::shared_ptr ops);
     void timedout();
-    void setTimeout(intrusive_ptr<DtxTimeout> t) { timeout = t; }
-    intrusive_ptr<DtxTimeout> getTimeout() { return timeout; }
+    void setTimeout(boost::intrusive_ptr<DtxTimeout> t) { timeout = t; }
+    boost::intrusive_ptr<DtxTimeout> getTimeout() { return timeout; }
 };
 
 }

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/IncomingExecutionContext.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/IncomingExecutionContext.cpp?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/IncomingExecutionContext.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/IncomingExecutionContext.cpp Mon Mar 24 10:43:55 2008
@@ -25,6 +25,7 @@
 namespace qpid {
 namespace broker {
 
+using boost::intrusive_ptr;
 using qpid::framing::AccumulatedAck;
 using qpid::framing::SequenceNumber;
 using qpid::framing::SequenceNumberSet;

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/IncomingExecutionContext.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/IncomingExecutionContext.h?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/IncomingExecutionContext.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/IncomingExecutionContext.h Mon Mar 24 10:43:55 2008
@@ -21,16 +21,19 @@
 #ifndef _IncomingExecutionContext_
 #define _IncomingExecutionContext_
 
+#include "Message.h"
+
 #include "qpid/framing/AccumulatedAck.h"
 #include "qpid/framing/SequenceNumber.h"
-#include "Message.h"
+
+#include <boost/intrusive_ptr.hpp>
 
 namespace qpid {
 namespace broker {
 
 class IncomingExecutionContext
 {
-    typedef std::list<intrusive_ptr<Message> > Messages;
+    typedef std::list<boost::intrusive_ptr<Message> > Messages;
     framing::Window window;
     framing::AccumulatedAck completed;
     Messages incomplete;
@@ -45,7 +48,7 @@
     void sync(const framing::SequenceNumber& point);
     framing::SequenceNumber next();
     void complete(const framing::SequenceNumber& command);
-    void track(intrusive_ptr<Message>);
+    void track(boost::intrusive_ptr<Message>);
 
     const framing::SequenceNumber& getMark();
     framing::SequenceNumberSet getRange();

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?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Message.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Message.cpp Mon Mar 24 10:43:55 2008
@@ -30,6 +30,7 @@
 #include "qpid/framing/TypeFilter.h"
 #include "qpid/log/Statement.h"
 
+using boost::intrusive_ptr;
 using namespace qpid::broker;
 using namespace qpid::framing;
 using std::string;

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageBuilder.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageBuilder.cpp?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageBuilder.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageBuilder.cpp Mon Mar 24 10:43:55 2008
@@ -25,6 +25,7 @@
 #include "qpid/framing/AMQFrame.h"
 #include "qpid/framing/reply_exceptions.h"
 
+using boost::intrusive_ptr;
 using namespace qpid::broker;
 using namespace qpid::framing;
 

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageBuilder.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageBuilder.h?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageBuilder.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageBuilder.h Mon Mar 24 10:43:55 2008
@@ -25,6 +25,8 @@
 #include "qpid/framing/SequenceNumber.h"
 #include "qpid/RefCounted.h"
 
+#include <boost/intrusive_ptr.hpp>
+
 namespace qpid {
     namespace broker {
         class Message;
@@ -34,13 +36,13 @@
         public:
             MessageBuilder(MessageStore* const store, uint64_t stagingThreshold);
             void handle(framing::AMQFrame& frame);
-            intrusive_ptr<Message> getMessage() { return message; }
+            boost::intrusive_ptr<Message> getMessage() { return message; }
             void start(const framing::SequenceNumber& id);
             void end();
         private:
             enum State {DORMANT, METHOD, HEADER, CONTENT};
             State state;
-            intrusive_ptr<Message> message;
+            boost::intrusive_ptr<Message> message;
             MessageStore* const store;
             const uint64_t stagingThreshold;
             bool staging;

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStore.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStore.h?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStore.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStore.h Mon Mar 24 10:43:55 2008
@@ -21,14 +21,17 @@
 #ifndef _MessageStore_
 #define _MessageStore_
 
-#include <boost/shared_ptr.hpp>
-#include <qpid/Options.h>
 #include "PersistableExchange.h"
 #include "PersistableMessage.h"
 #include "PersistableQueue.h"
 #include "RecoveryManager.h"
 #include "TransactionalStore.h"
 
+#include <qpid/Options.h>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/intrusive_ptr.hpp>
+
 namespace qpid {
 namespace broker {
 
@@ -96,7 +99,7 @@
 	 * for that queue and avoid searching based on id. Set queue = 0 for
 	 * large message staging when the queue is not known.
      */
-    virtual void stage(intrusive_ptr<PersistableMessage>& msg) = 0;
+    virtual void stage(boost::intrusive_ptr<PersistableMessage>& msg) = 0;
             
     /**
      * Destroys a previously staged message. This only needs
@@ -109,7 +112,7 @@
     /**
      * Appends content to a previously staged message
      */
-    virtual void appendContent(intrusive_ptr<const PersistableMessage>& msg,
+    virtual void appendContent(boost::intrusive_ptr<const PersistableMessage>& msg,
                                const std::string& data) = 0;
     
     /**
@@ -121,7 +124,7 @@
      * meta-data).
      */
     virtual void loadContent(const qpid::broker::PersistableQueue& queue, 
-	                         intrusive_ptr<const PersistableMessage>& msg,
+	                         boost::intrusive_ptr<const PersistableMessage>& msg,
                              std::string& data, uint64_t offset, uint32_t length) = 0;
     
     /**
@@ -138,7 +141,7 @@
      * distributed transaction in which the operation takes
      * place or null for 'local' transactions
      */
-    virtual void enqueue(TransactionContext* ctxt, intrusive_ptr<PersistableMessage>& msg,
+    virtual void enqueue(TransactionContext* ctxt, boost::intrusive_ptr<PersistableMessage>& msg,
                          const PersistableQueue& queue) = 0;
     
     /**
@@ -155,7 +158,7 @@
      * distributed transaction in which the operation takes
      * place or null for 'local' transactions
      */
-    virtual void dequeue(TransactionContext* ctxt, intrusive_ptr<PersistableMessage>& msg,
+    virtual void dequeue(TransactionContext* ctxt, boost::intrusive_ptr<PersistableMessage>& msg,
                          const PersistableQueue& queue) = 0;
 
     /**

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.cpp?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.cpp Mon Mar 24 10:43:55 2008
@@ -25,6 +25,7 @@
 // This transfer protects against the unloading of the store lib prior to the handling of the exception
 #define TRANSFER_EXCEPTION(fn) try { fn; } catch (std::exception& e) { throw Exception(e.what()); }
 
+using boost::intrusive_ptr;
 using namespace qpid::broker;
 
 MessageStoreModule::MessageStoreModule(MessageStore* _store) : store(_store) {}

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.h?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.h Mon Mar 24 10:43:55 2008
@@ -24,8 +24,11 @@
 #include "MessageStore.h"
 #include "Queue.h"
 #include "RecoveryManager.h"
+
 #include "qpid/sys/Module.h"
 
+#include <boost/intrusive_ptr.hpp>
+
 namespace qpid {
 namespace broker {
 
@@ -55,16 +58,16 @@
     void unbind(const PersistableExchange& exchange, const PersistableQueue& queue, 
                 const std::string& key, const framing::FieldTable& args);
     void recover(RecoveryManager& queues);
-    void stage(intrusive_ptr<PersistableMessage>& msg);
+    void stage(boost::intrusive_ptr<PersistableMessage>& msg);
     void destroy(PersistableMessage& msg);
-    void appendContent(intrusive_ptr<const PersistableMessage>& msg, const std::string& data);
+    void appendContent(boost::intrusive_ptr<const PersistableMessage>& msg, const std::string& data);
     void loadContent(const qpid::broker::PersistableQueue& queue, 
-	          intrusive_ptr<const PersistableMessage>& msg, std::string& data,
+	          boost::intrusive_ptr<const PersistableMessage>& msg, std::string& data,
               uint64_t offset, uint32_t length);
 
-    void enqueue(TransactionContext* ctxt, intrusive_ptr<PersistableMessage>& msg,
+    void enqueue(TransactionContext* ctxt, boost::intrusive_ptr<PersistableMessage>& msg,
                  const PersistableQueue& queue);
-    void dequeue(TransactionContext* ctxt, intrusive_ptr<PersistableMessage>& msg,
+    void dequeue(TransactionContext* ctxt, boost::intrusive_ptr<PersistableMessage>& msg,
                  const PersistableQueue& queue);
     u_int32_t outstandingQueueAIO(const PersistableQueue& queue);
     void flush(const qpid::broker::PersistableQueue& queue);

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.cpp?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.cpp Mon Mar 24 10:43:55 2008
@@ -25,6 +25,8 @@
 
 #include <iostream>
 
+using boost::intrusive_ptr;
+
 namespace qpid{
 namespace broker{
 

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.h?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.h Mon Mar 24 10:43:55 2008
@@ -25,6 +25,8 @@
 #include "MessageStore.h"
 #include "Queue.h"
 
+#include <boost/intrusive_ptr.hpp>
+
 namespace qpid {
 namespace broker {
 
@@ -56,16 +58,16 @@
     virtual void unbind(const PersistableExchange& exchange, const PersistableQueue& queue, 
                         const std::string& key, const framing::FieldTable& args);
     virtual void recover(RecoveryManager& queues);
-    virtual void stage(intrusive_ptr<PersistableMessage>& msg);
+    virtual void stage(boost::intrusive_ptr<PersistableMessage>& msg);
     virtual void destroy(PersistableMessage& msg);
-    virtual void appendContent(intrusive_ptr<const PersistableMessage>& msg,
+    virtual void appendContent(boost::intrusive_ptr<const PersistableMessage>& msg,
                                const std::string& data);
     virtual void loadContent(const qpid::broker::PersistableQueue& queue,
-                             intrusive_ptr<const PersistableMessage>& msg, std::string& data,
+                             boost::intrusive_ptr<const PersistableMessage>& msg, std::string& data,
                              uint64_t offset, uint32_t length);
-    virtual void enqueue(TransactionContext* ctxt, intrusive_ptr<PersistableMessage>& msg,
+    virtual void enqueue(TransactionContext* ctxt, boost::intrusive_ptr<PersistableMessage>& msg,
                          const PersistableQueue& queue);
-    virtual void dequeue(TransactionContext* ctxt, intrusive_ptr<PersistableMessage>& msg,
+    virtual void dequeue(TransactionContext* ctxt, boost::intrusive_ptr<PersistableMessage>& msg,
                          const PersistableQueue& queue);
     virtual u_int32_t outstandingQueueAIO(const PersistableQueue& queue);
     virtual void flush(const qpid::broker::PersistableQueue& queue);

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/PreviewSessionManager.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/PreviewSessionManager.cpp?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/PreviewSessionManager.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/PreviewSessionManager.cpp Mon Mar 24 10:43:55 2008
@@ -28,6 +28,7 @@
 
 #include <boost/bind.hpp>
 #include <boost/range.hpp>
+#include <boost/intrusive_ptr.hpp>
 
 #include <algorithm>
 #include <functional>
@@ -105,7 +106,7 @@
     }
 }
 
-void PreviewSessionManager::add(const intrusive_ptr<Observer>& o) {
+void PreviewSessionManager::add(const boost::intrusive_ptr<Observer>& o) {
     observers.push_back(o);
 }
 

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/PreviewSessionManager.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/PreviewSessionManager.h?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/PreviewSessionManager.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/PreviewSessionManager.h Mon Mar 24 10:43:55 2008
@@ -27,13 +27,14 @@
 #include <qpid/sys/Mutex.h>
 #include <qpid/RefCounted.h>
 
-#include <boost/noncopyable.hpp>
-#include <boost/ptr_container/ptr_vector.hpp>
-
 #include <set>
 #include <vector>
 #include <memory>
 
+#include <boost/noncopyable.hpp>
+#include <boost/ptr_container/ptr_vector.hpp>
+#include <boost/intrusive_ptr.hpp>
+
 namespace qpid {
 namespace broker {
 
@@ -70,12 +71,12 @@
     std::auto_ptr<PreviewSessionState> resume(const framing::Uuid&);
 
     /** Add an Observer. */
-    void add(const intrusive_ptr<Observer>&);
+    void add(const boost::intrusive_ptr<Observer>&);
     
   private:
     typedef boost::ptr_vector<PreviewSessionState> Suspended;
     typedef std::set<framing::Uuid> Active;
-    typedef std::vector<intrusive_ptr<Observer> > Observers;
+    typedef std::vector<boost::intrusive_ptr<Observer> > Observers;
 
     void erase(const framing::Uuid&);             
     void eraseExpired();             

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp Mon Mar 24 10:43:55 2008
@@ -19,21 +19,25 @@
  *
  */
 
-#include "qpid/log/Statement.h"
-#include "qpid/framing/reply_exceptions.h"
 #include "Broker.h"
 #include "Queue.h"
 #include "Exchange.h"
 #include "DeliverableMessage.h"
 #include "MessageStore.h"
+#include "QueueRegistry.h"
+
+#include "qpid/log/Statement.h"
+#include "qpid/framing/reply_exceptions.h"
 #include "qpid/sys/Monitor.h"
 #include "qpid/sys/Time.h"
+
 #include <iostream>
-#include <boost/bind.hpp>
-#include "QueueRegistry.h"
 #include <algorithm>
 #include <functional>
 
+#include <boost/bind.hpp>
+#include <boost/intrusive_ptr.hpp>
+
 using namespace qpid::broker;
 using namespace qpid::sys;
 using namespace qpid::framing;
@@ -87,7 +91,7 @@
 }
 
 
-void Queue::deliver(intrusive_ptr<Message>& msg){
+void Queue::deliver(boost::intrusive_ptr<Message>& msg){
     if (msg->isImmediate() && getConsumerCount() == 0) {
         if (alternateExchange) {
             DeliverableMessage deliverable(msg);
@@ -124,7 +128,7 @@
 }
 
 
-void Queue::recover(intrusive_ptr<Message>& msg){
+void Queue::recover(boost::intrusive_ptr<Message>& msg){
     push(msg);
     msg->enqueueComplete(); // mark the message as enqueued
     if (mgmtObject.get() != 0) {
@@ -144,7 +148,7 @@
     }
 }
 
-void Queue::process(intrusive_ptr<Message>& msg){
+void Queue::process(boost::intrusive_ptr<Message>& msg){
     push(msg);
     if (mgmtObject.get() != 0) {
         Mutex::ScopedLock alock(mgmtObject->accessorLock);
@@ -393,7 +397,7 @@
     messages.pop_front();
 }
 
-void Queue::push(intrusive_ptr<Message>& msg){
+void Queue::push(boost::intrusive_ptr<Message>& msg){
     Mutex::ScopedLock locker(messageLock);   
     messages.push_back(QueuedMessage(this, msg, ++sequence));
     if (policy.get()) {
@@ -434,11 +438,11 @@
 }
 
 // return true if store exists, 
-bool Queue::enqueue(TransactionContext* ctxt, intrusive_ptr<Message> msg)
+bool Queue::enqueue(TransactionContext* ctxt, boost::intrusive_ptr<Message> msg)
 {
     if (msg->isPersistent() && store) {
         msg->enqueueAsync(shared_from_this(), store); //increment to async counter -- for message sent to more than one queue
-        intrusive_ptr<PersistableMessage> pmsg = static_pointer_cast<PersistableMessage>(msg);
+        boost::intrusive_ptr<PersistableMessage> pmsg = boost::static_pointer_cast<PersistableMessage>(msg);
         store->enqueue(ctxt, pmsg, *this);
         return true;
     }
@@ -447,11 +451,11 @@
 }
 
 // return true if store exists, 
-bool Queue::dequeue(TransactionContext* ctxt, intrusive_ptr<Message> msg)
+bool Queue::dequeue(TransactionContext* ctxt, boost::intrusive_ptr<Message> msg)
 {
     if (msg->isPersistent() && store) {
         msg->dequeueAsync(shared_from_this(), store); //increment to async counter -- for message sent to more than one queue
-        intrusive_ptr<PersistableMessage> pmsg = static_pointer_cast<PersistableMessage>(msg);
+        boost::intrusive_ptr<PersistableMessage> pmsg = boost::static_pointer_cast<PersistableMessage>(msg);
         store->dequeue(ctxt, pmsg, *this);
         return true;
     }

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?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.h Mon Mar 24 10:43:55 2008
@@ -21,24 +21,28 @@
  * under the License.
  *
  */
-#include <vector>
-#include <memory>
-#include <deque>
-#include <set>
-#include <boost/shared_ptr.hpp>
-#include <boost/enable_shared_from_this.hpp>
-#include "qpid/framing/amqp_types.h"
 #include "OwnershipToken.h"
 #include "Consumer.h"
 #include "Message.h"
-#include "qpid/framing/FieldTable.h"
-#include "qpid/sys/Serializer.h"
-#include "qpid/sys/Monitor.h"
 #include "PersistableQueue.h"
 #include "QueuePolicy.h"
 #include "QueueBindings.h"
+
+#include "qpid/framing/FieldTable.h"
+#include "qpid/sys/Serializer.h"
+#include "qpid/sys/Monitor.h"
 #include "qpid/management/Manageable.h"
 #include "qpid/management/Queue.h"
+#include "qpid/framing/amqp_types.h"
+
+#include <vector>
+#include <memory>
+#include <deque>
+#include <set>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/enable_shared_from_this.hpp>
+#include <boost/intrusive_ptr.hpp>
 
 namespace qpid {
     namespace broker {
@@ -80,7 +84,7 @@
             management::Queue::shared_ptr mgmtObject;
 
             void pop();
-            void push(intrusive_ptr<Message>& msg);
+            void push(boost::intrusive_ptr<Message>& msg);
             void setPolicy(std::auto_ptr<QueuePolicy> policy);
             bool seek(QueuedMessage& msg, Consumer& position);
             bool getNextMessage(QueuedMessage& msg, Consumer& c);
@@ -118,12 +122,12 @@
              * Delivers a message to the queue. Will record it as
              * enqueued if persistent then process it.
              */
-            void deliver(intrusive_ptr<Message>& msg);
+            void deliver(boost::intrusive_ptr<Message>& msg);
             /**
              * Dispatches the messages immediately to a consumer if
              * one is available or stores it for later if not.
              */
-            void process(intrusive_ptr<Message>& msg);
+            void process(boost::intrusive_ptr<Message>& msg);
             /**
              * Returns a message to the in-memory queue (due to lack
              * of acknowledegement from a receiver). If a consumer is
@@ -134,7 +138,7 @@
             /**
              * Used during recovery to add stored messages back to the queue
              */
-            void recover(intrusive_ptr<Message>& msg);
+            void recover(boost::intrusive_ptr<Message>& msg);
 
             void consume(Consumer& c, bool exclusive = false);
             void cancel(Consumer& c);
@@ -153,11 +157,11 @@
             inline bool isAutoDelete() const { return autodelete; }
             bool canAutoDelete() const;
 
-            bool enqueue(TransactionContext* ctxt, intrusive_ptr<Message> msg);
+            bool enqueue(TransactionContext* ctxt, boost::intrusive_ptr<Message> msg);
             /**
              * dequeue from store (only done once messages is acknowledged)
              */
-            bool dequeue(TransactionContext* ctxt, intrusive_ptr<Message> msg);
+            bool dequeue(TransactionContext* ctxt, boost::intrusive_ptr<Message> msg);
             /**
              * dequeues from memory only
              */

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveredDequeue.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveredDequeue.cpp?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveredDequeue.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveredDequeue.cpp Mon Mar 24 10:43:55 2008
@@ -20,6 +20,7 @@
  */
 #include "RecoveredDequeue.h"
 
+using boost::intrusive_ptr;
 using namespace qpid::broker;
 
 RecoveredDequeue::RecoveredDequeue(Queue::shared_ptr _queue, intrusive_ptr<Message> _msg) : queue(_queue), msg(_msg) {}

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveredDequeue.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveredDequeue.h?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveredDequeue.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveredDequeue.h Mon Mar 24 10:43:55 2008
@@ -21,23 +21,26 @@
 #ifndef _RecoveredDequeue_
 #define _RecoveredDequeue_
 
-#include <algorithm>
-#include <functional>
-#include <list>
 #include "Deliverable.h"
 #include "Message.h"
 #include "MessageStore.h"
 #include "Queue.h"
 #include "TxOp.h"
 
+#include <boost/intrusive_ptr.hpp>
+
+#include <algorithm>
+#include <functional>
+#include <list>
+
 namespace qpid {
     namespace broker {
         class RecoveredDequeue : public TxOp{
             Queue::shared_ptr queue;
-            intrusive_ptr<Message> msg;
+            boost::intrusive_ptr<Message> msg;
 
         public:
-            RecoveredDequeue(Queue::shared_ptr queue, intrusive_ptr<Message> msg);
+            RecoveredDequeue(Queue::shared_ptr queue, boost::intrusive_ptr<Message> msg);
             virtual bool prepare(TransactionContext* ctxt) throw();
             virtual void commit() throw();
             virtual void rollback() throw();

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveredEnqueue.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveredEnqueue.cpp?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveredEnqueue.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveredEnqueue.cpp Mon Mar 24 10:43:55 2008
@@ -20,6 +20,7 @@
  */
 #include "RecoveredEnqueue.h"
 
+using boost::intrusive_ptr;
 using namespace qpid::broker;
 
 RecoveredEnqueue::RecoveredEnqueue(Queue::shared_ptr _queue, intrusive_ptr<Message> _msg) : queue(_queue), msg(_msg) {}

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveredEnqueue.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveredEnqueue.h?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveredEnqueue.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveredEnqueue.h Mon Mar 24 10:43:55 2008
@@ -21,23 +21,26 @@
 #ifndef _RecoveredEnqueue_
 #define _RecoveredEnqueue_
 
-#include <algorithm>
-#include <functional>
-#include <list>
 #include "Deliverable.h"
 #include "Message.h"
 #include "MessageStore.h"
 #include "Queue.h"
 #include "TxOp.h"
 
+#include <boost/intrusive_ptr.hpp>
+
+#include <algorithm>
+#include <functional>
+#include <list>
+
 namespace qpid {
     namespace broker {
         class RecoveredEnqueue : public TxOp{
             Queue::shared_ptr queue;
-            intrusive_ptr<Message> msg;
+            boost::intrusive_ptr<Message> msg;
 
         public:
-            RecoveredEnqueue(Queue::shared_ptr queue, intrusive_ptr<Message> msg);
+            RecoveredEnqueue(Queue::shared_ptr queue, boost::intrusive_ptr<Message> msg);
             virtual bool prepare(TransactionContext* ctxt) throw();
             virtual void commit() throw();
             virtual void rollback() throw();

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManagerImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManagerImpl.cpp?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManagerImpl.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManagerImpl.cpp Mon Mar 24 10:43:55 2008
@@ -28,7 +28,7 @@
 using namespace qpid;
 using namespace qpid::broker;
 using boost::dynamic_pointer_cast;
-
+using boost::intrusive_ptr;
 
 static const uint8_t BASIC = 1;
 static const uint8_t MESSAGE = 2;

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SemanticHandler.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SemanticHandler.cpp?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SemanticHandler.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SemanticHandler.cpp Mon Mar 24 10:43:55 2008
@@ -32,6 +32,7 @@
 #include <boost/format.hpp>
 #include <boost/bind.hpp>
 
+using boost::intrusive_ptr;
 using namespace qpid::broker;
 using namespace qpid::framing;
 using namespace qpid::sys;

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SemanticState.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SemanticState.cpp?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SemanticState.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SemanticState.cpp Mon Mar 24 10:43:55 2008
@@ -53,6 +53,7 @@
 
 using std::mem_fun_ref;
 using std::bind2nd;
+using boost::intrusive_ptr;
 using namespace qpid::broker;
 using namespace qpid::framing;
 using namespace qpid::sys;

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SemanticState.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SemanticState.h?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SemanticState.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SemanticState.h Mon Mar 24 10:43:55 2008
@@ -32,6 +32,7 @@
 #include "NameGenerator.h"
 #include "Prefetch.h"
 #include "TxBuffer.h"
+
 #include "qpid/framing/FrameHandler.h"
 #include "qpid/framing/AccumulatedAck.h"
 #include "qpid/framing/Uuid.h"
@@ -42,6 +43,8 @@
 #include <map>
 #include <vector>
 
+#include <boost/intrusive_ptr.hpp>
+
 namespace qpid {
 namespace broker {
 
@@ -69,8 +72,8 @@
         uint32_t msgCredit;
         uint32_t byteCredit;
 
-        bool checkCredit(intrusive_ptr<Message>& msg);
-        void allocateCredit(intrusive_ptr<Message>& msg);
+        bool checkCredit(boost::intrusive_ptr<Message>& msg);
+        void allocateCredit(boost::intrusive_ptr<Message>& msg);
 
       public:
         ConsumerImpl(SemanticState* parent, DeliveryToken::shared_ptr token, 
@@ -78,8 +81,8 @@
                      bool ack, bool nolocal, bool acquire);
         ~ConsumerImpl();
         bool deliver(QueuedMessage& msg);            
-        bool filter(intrusive_ptr<Message> msg);            
-        bool accept(intrusive_ptr<Message> msg);            
+        bool filter(boost::intrusive_ptr<Message> msg);            
+        bool accept(boost::intrusive_ptr<Message> msg);            
         void notify();
 
         void setWindowMode();
@@ -116,9 +119,9 @@
     boost::shared_ptr<Exchange> cacheExchange;
     sys::AggregateOutput outputTasks;
     
-    void route(intrusive_ptr<Message> msg, Deliverable& strategy);
+    void route(boost::intrusive_ptr<Message> msg, Deliverable& strategy);
     void record(const DeliveryRecord& delivery);
-    bool checkPrefetch(intrusive_ptr<Message>& msg);
+    bool checkPrefetch(boost::intrusive_ptr<Message>& msg);
     void checkDtxTimeout();
     ConsumerImpl& find(const std::string& destination);
     void ack(DeliveryId deliveryTag, DeliveryId endTag, bool cumulative);
@@ -177,7 +180,7 @@
     void acquire(DeliveryId first, DeliveryId last, DeliveryIds& acquired);
     void release(DeliveryId first, DeliveryId last);
     void reject(DeliveryId first, DeliveryId last);
-    void handle(intrusive_ptr<Message> msg);
+    void handle(boost::intrusive_ptr<Message> msg);
     bool doOutput() { return outputTasks.doOutput(); }
 
     //preview only (completed == ack):

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionManager.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionManager.cpp?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionManager.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionManager.cpp Mon Mar 24 10:43:55 2008
@@ -36,6 +36,7 @@
 namespace qpid {
 namespace broker {
 
+using boost::intrusive_ptr;
 using namespace sys;
 using namespace framing;
 

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionManager.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionManager.h?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionManager.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionManager.h Mon Mar 24 10:43:55 2008
@@ -27,13 +27,14 @@
 #include <qpid/sys/Mutex.h>
 #include <qpid/RefCounted.h>
 
-#include <boost/noncopyable.hpp>
-#include <boost/ptr_container/ptr_vector.hpp>
-
 #include <set>
 #include <vector>
 #include <memory>
 
+#include <boost/noncopyable.hpp>
+#include <boost/ptr_container/ptr_vector.hpp>
+#include <boost/intrusive_ptr.hpp>
+
 namespace qpid {
 namespace broker {
 
@@ -70,12 +71,12 @@
     std::auto_ptr<SessionState> resume(const framing::Uuid&);
 
     /** Add an Observer. */
-    void add(const intrusive_ptr<Observer>&);
+    void add(const boost::intrusive_ptr<Observer>&);
     
   private:
     typedef boost::ptr_vector<SessionState> Suspended;
     typedef std::set<framing::Uuid> Active;
-    typedef std::vector<intrusive_ptr<Observer> > Observers;
+    typedef std::vector<boost::intrusive_ptr<Observer> > Observers;
 
     void erase(const framing::Uuid&);             
     void eraseExpired();             

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionState.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionState.cpp?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionState.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionState.cpp Mon Mar 24 10:43:55 2008
@@ -35,6 +35,7 @@
 
 using namespace framing;
 using sys::Mutex;
+using boost::intrusive_ptr;
 using qpid::management::ManagementAgent;
 using qpid::management::ManagementObject;
 using qpid::management::Manageable;

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Timer.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Timer.cpp?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Timer.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Timer.cpp Mon Mar 24 10:43:55 2008
@@ -21,6 +21,7 @@
 #include "Timer.h"
 #include <iostream>
 
+using boost::intrusive_ptr;
 using qpid::sys::AbsTime;
 using qpid::sys::Duration;
 using qpid::sys::Monitor;

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Timer.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Timer.h?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Timer.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Timer.h Mon Mar 24 10:43:55 2008
@@ -29,6 +29,8 @@
 #include <memory>
 #include <queue>
 
+#include <boost/intrusive_ptr.hpp>
+
 namespace qpid {
 namespace broker {
 
@@ -45,15 +47,15 @@
 };
 
 struct Later {
-    bool operator()(const intrusive_ptr<TimerTask>& a,
-                    const intrusive_ptr<TimerTask>& b) const;
+    bool operator()(const boost::intrusive_ptr<TimerTask>& a,
+                    const boost::intrusive_ptr<TimerTask>& b) const;
 };
 
 class Timer : private qpid::sys::Runnable {
   protected:
     qpid::sys::Monitor monitor;            
-    std::priority_queue<intrusive_ptr<TimerTask>,
-                        std::vector<intrusive_ptr<TimerTask> >,
+    std::priority_queue<boost::intrusive_ptr<TimerTask>,
+                        std::vector<boost::intrusive_ptr<TimerTask> >,
                         Later> tasks;
     qpid::sys::Thread runner;
     bool active;
@@ -64,7 +66,7 @@
     Timer();
     virtual ~Timer();
 
-    void add(intrusive_ptr<TimerTask> task);
+    void add(boost::intrusive_ptr<TimerTask> task);
     void start();
     void stop();
 

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/TxPublish.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/TxPublish.cpp?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/TxPublish.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/TxPublish.cpp Mon Mar 24 10:43:55 2008
@@ -21,6 +21,7 @@
 #include "qpid/log/Statement.h"
 #include "TxPublish.h"
 
+using boost::intrusive_ptr;
 using namespace qpid::broker;
 
 TxPublish::TxPublish(intrusive_ptr<Message> _msg) : msg(_msg) {}

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/TxPublish.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/TxPublish.h?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/TxPublish.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/TxPublish.h Mon Mar 24 10:43:55 2008
@@ -21,15 +21,18 @@
 #ifndef _TxPublish_
 #define _TxPublish_
 
-#include <algorithm>
-#include <functional>
-#include <list>
 #include "Queue.h"
 #include "Deliverable.h"
 #include "Message.h"
 #include "MessageStore.h"
 #include "TxOp.h"
 
+#include <algorithm>
+#include <functional>
+#include <list>
+
+#include <boost/intrusive_ptr.hpp>
+
 namespace qpid {
     namespace broker {
         /**
@@ -45,24 +48,24 @@
         class TxPublish : public TxOp, public Deliverable{
             class Prepare{
                 TransactionContext* ctxt;
-                intrusive_ptr<Message>& msg;
+                boost::intrusive_ptr<Message>& msg;
             public:
-                Prepare(TransactionContext* ctxt, intrusive_ptr<Message>& msg);
+                Prepare(TransactionContext* ctxt, boost::intrusive_ptr<Message>& msg);
                 void operator()(Queue::shared_ptr& queue);            
             };
 
             class Commit{
-                intrusive_ptr<Message>& msg;
+                boost::intrusive_ptr<Message>& msg;
             public:
-                Commit(intrusive_ptr<Message>& msg);
+                Commit(boost::intrusive_ptr<Message>& msg);
                 void operator()(Queue::shared_ptr& queue);            
             };
 
-            intrusive_ptr<Message> msg;
+            boost::intrusive_ptr<Message> msg;
             std::list<Queue::shared_ptr> queues;
 
         public:
-            TxPublish(intrusive_ptr<Message> msg);
+            TxPublish(boost::intrusive_ptr<Message> msg);
             virtual bool prepare(TransactionContext* ctxt) throw();
             virtual void commit() throw();
             virtual void rollback() throw();

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQFrame.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQFrame.h?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQFrame.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQFrame.h Mon Mar 24 10:43:55 2008
@@ -28,6 +28,7 @@
 #include "ProtocolVersion.h"
 #include "BodyHolder.h"
 
+#include <boost/intrusive_ptr.hpp>
 #include <boost/cast.hpp>
 
 namespace qpid {
@@ -38,7 +39,7 @@
 class AMQFrame : public AMQDataBlock
 {
   public:
-    AMQFrame(intrusive_ptr<BodyHolder> b=0) : body(b) { init(); }
+    AMQFrame(boost::intrusive_ptr<BodyHolder> b=0) : body(b) { init(); }
     AMQFrame(const AMQBody& b) { setBody(b); init(); }
     ~AMQFrame();
 
@@ -50,7 +51,7 @@
     ChannelId getChannel() const { return channel; }
     void setChannel(ChannelId c) { channel = c; }
 
-    intrusive_ptr<BodyHolder> getHolder() { return body; }
+    boost::intrusive_ptr<BodyHolder> getHolder() { return body; }
     
     AMQBody* getBody() { return body ? body->get() : 0; }
     const AMQBody* getBody() const { return body ? body->get() : 0; }
@@ -94,7 +95,7 @@
   private:
     void init() { bof = eof = bos = eos = true; subchannel=0; channel=0; }
 
-    intrusive_ptr<BodyHolder> body;
+    boost::intrusive_ptr<BodyHolder> body;
     uint16_t channel : 16;
     uint8_t subchannel : 8;
     bool bof : 1;

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/management/ManagementAgent.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/management/ManagementAgent.cpp?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/management/ManagementAgent.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/management/ManagementAgent.cpp Mon Mar 24 10:43:55 2008
@@ -26,6 +26,7 @@
 #include <qpid/broker/MessageDelivery.h>
 #include <list>
 
+using boost::intrusive_ptr;
 using namespace qpid::framing;
 using namespace qpid::management;
 using namespace qpid::broker;

Modified: incubator/qpid/trunk/qpid/cpp/src/tests/ExchangeTest.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/ExchangeTest.cpp?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/ExchangeTest.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/ExchangeTest.cpp Mon Mar 24 10:43:55 2008
@@ -33,6 +33,7 @@
 #include "qpid/framing/BasicGetBody.h"
 #include "MessageUtils.h"
 
+using boost::intrusive_ptr;
 using namespace qpid::broker;
 using namespace qpid::framing;
 using namespace qpid::sys;

Modified: incubator/qpid/trunk/qpid/cpp/src/tests/ISList.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/ISList.cpp?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/ISList.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/ISList.cpp Mon Mar 24 10:43:55 2008
@@ -24,6 +24,7 @@
 #include "test_tools.h"
 #include <boost/assign/list_of.hpp>
 #include <boost/shared_ptr.hpp>
+#include <boost/intrusive_ptr.hpp>
 #include <vector>
 
 QPID_AUTO_TEST_SUITE(ISListTestSuite)
@@ -31,6 +32,7 @@
 using namespace qpid;
 using namespace std;
 using boost::assign::list_of;
+using boost::intrusive_ptr;
 
 // Comparison, op== and << for ILists in qpid namespace for template lookup.
 

Modified: incubator/qpid/trunk/qpid/cpp/src/tests/MessageUtils.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/MessageUtils.h?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/MessageUtils.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/MessageUtils.h Mon Mar 24 10:43:55 2008
@@ -29,10 +29,10 @@
 
 struct MessageUtils
 {
-    static intrusive_ptr<Message> createMessage(const string& exchange, const string& routingKey, 
+    static boost::intrusive_ptr<Message> createMessage(const string& exchange, const string& routingKey, 
                                              const string& messageId, uint64_t contentSize = 0)
     {
-        intrusive_ptr<Message> msg(new Message());
+        boost::intrusive_ptr<Message> msg(new Message());
 
         AMQFrame method(in_place<MessageTransferBody>(ProtocolVersion(), 0, exchange, 0, 0));
         AMQFrame header(in_place<AMQHeaderBody>());
@@ -46,7 +46,7 @@
         return msg;
     }
 
-    static void addContent(intrusive_ptr<Message> msg, const string& data)
+    static void addContent(boost::intrusive_ptr<Message> msg, const string& data)
     {
         AMQFrame content(in_place<AMQContentBody>(data));
         msg->getFrames().append(content);

Modified: incubator/qpid/trunk/qpid/cpp/src/tests/QueueTest.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/QueueTest.cpp?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/QueueTest.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/QueueTest.cpp Mon Mar 24 10:43:55 2008
@@ -27,6 +27,7 @@
 #include <iostream>
 #include "boost/format.hpp"
 
+using boost::intrusive_ptr;
 using namespace qpid;
 using namespace qpid::broker;
 using namespace qpid::framing;

Modified: incubator/qpid/trunk/qpid/cpp/src/tests/RefCounted.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/RefCounted.cpp?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/RefCounted.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/RefCounted.cpp Mon Mar 24 10:43:55 2008
@@ -17,38 +17,15 @@
  */
 
 #include "qpid/RefCounted.h"
+#include <boost/intrusive_ptr.hpp>
 
 #include "unit_test.h"
 
 QPID_AUTO_TEST_SUITE(RefCountedTestSuiteTestSuite)
 
+using boost::intrusive_ptr;
 using namespace std;
 using namespace qpid;
-
-struct DummyCounted : public AbstractRefCounted {
-    DummyCounted() : count(0) {}
-    mutable int count;
-    virtual void addRef() const { count++; }
-    virtual void release() const { count--; }
-};
-
-BOOST_AUTO_TEST_CASE(testIntrusivePtr) {
-    DummyCounted dummy;
-    BOOST_CHECK_EQUAL(0, dummy.count);
-    {
-        intrusive_ptr<DummyCounted> p(&dummy);
-        BOOST_CHECK_EQUAL(1, dummy.count);
-        {
-            intrusive_ptr<DummyCounted> q(p);
-            BOOST_CHECK_EQUAL(2, dummy.count);
-            intrusive_ptr<DummyCounted> r;
-            r=q;
-            BOOST_CHECK_EQUAL(3, dummy.count);
-        }
-        BOOST_CHECK_EQUAL(1, dummy.count);
-    }
-    BOOST_CHECK_EQUAL(0, dummy.count);
-}
 
 struct CountMe : public RefCounted {
     static int instances;

Modified: incubator/qpid/trunk/qpid/cpp/src/tests/TimerTest.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/TimerTest.cpp?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/TimerTest.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/TimerTest.cpp Mon Mar 24 10:43:55 2008
@@ -30,7 +30,7 @@
 
 using namespace qpid::broker;
 using namespace qpid::sys;
-using qpid::intrusive_ptr;
+using boost::intrusive_ptr;
 using boost::dynamic_pointer_cast;
 
 class TimerTest : public CppUnit::TestCase  

Modified: incubator/qpid/trunk/qpid/cpp/src/tests/TxAckTest.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/TxAckTest.cpp?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/TxAckTest.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/TxAckTest.cpp Mon Mar 24 10:43:55 2008
@@ -28,6 +28,7 @@
 
 using std::list;
 using std::vector;
+using boost::intrusive_ptr;
 using namespace qpid;
 using namespace qpid::broker;
 using namespace qpid::framing;

Modified: incubator/qpid/trunk/qpid/cpp/src/tests/TxPublishTest.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/TxPublishTest.cpp?rev=640479&r1=640478&r2=640479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/TxPublishTest.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/TxPublishTest.cpp Mon Mar 24 10:43:55 2008
@@ -30,6 +30,7 @@
 using std::list;
 using std::pair;
 using std::vector;
+using boost::intrusive_ptr;
 using namespace qpid::broker;
 using namespace qpid::framing;