diff options
author | Andrew Stitcher <astitcher@apache.org> | 2008-03-24 17:43:55 +0000 |
---|---|---|
committer | Andrew Stitcher <astitcher@apache.org> | 2008-03-24 17:43:55 +0000 |
commit | 3f8a466daf6eba9717c27a635f2a7307cc4d03bd (patch) | |
tree | 08aa12215ccf68d2ba046d8154f1fcb902d3487c /cpp/src/tests | |
parent | e7541b7deff38a74fe454f3b031ad013f71155ee (diff) | |
download | qpid-python-3f8a466daf6eba9717c27a635f2a7307cc4d03bd.tar.gz |
- 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
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@640479 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests')
-rw-r--r-- | cpp/src/tests/ExchangeTest.cpp | 1 | ||||
-rw-r--r-- | cpp/src/tests/ISList.cpp | 2 | ||||
-rw-r--r-- | cpp/src/tests/MessageUtils.h | 6 | ||||
-rw-r--r-- | cpp/src/tests/QueueTest.cpp | 1 | ||||
-rw-r--r-- | cpp/src/tests/RefCounted.cpp | 27 | ||||
-rw-r--r-- | cpp/src/tests/TimerTest.cpp | 2 | ||||
-rw-r--r-- | cpp/src/tests/TxAckTest.cpp | 1 | ||||
-rw-r--r-- | cpp/src/tests/TxPublishTest.cpp | 1 |
8 files changed, 12 insertions, 29 deletions
diff --git a/cpp/src/tests/ExchangeTest.cpp b/cpp/src/tests/ExchangeTest.cpp index d1eca203c6..2904424d5c 100644 --- a/cpp/src/tests/ExchangeTest.cpp +++ b/cpp/src/tests/ExchangeTest.cpp @@ -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; diff --git a/cpp/src/tests/ISList.cpp b/cpp/src/tests/ISList.cpp index de06f130ff..81301e3732 100644 --- a/cpp/src/tests/ISList.cpp +++ b/cpp/src/tests/ISList.cpp @@ -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 @@ QPID_AUTO_TEST_SUITE(ISListTestSuite) 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. diff --git a/cpp/src/tests/MessageUtils.h b/cpp/src/tests/MessageUtils.h index 117473bb5e..3def8cd41b 100644 --- a/cpp/src/tests/MessageUtils.h +++ b/cpp/src/tests/MessageUtils.h @@ -29,10 +29,10 @@ using namespace framing; 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 @@ struct MessageUtils 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); diff --git a/cpp/src/tests/QueueTest.cpp b/cpp/src/tests/QueueTest.cpp index fae0d88b7c..b1c42f3bcb 100644 --- a/cpp/src/tests/QueueTest.cpp +++ b/cpp/src/tests/QueueTest.cpp @@ -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; diff --git a/cpp/src/tests/RefCounted.cpp b/cpp/src/tests/RefCounted.cpp index d111d58712..cd08a4491a 100644 --- a/cpp/src/tests/RefCounted.cpp +++ b/cpp/src/tests/RefCounted.cpp @@ -17,39 +17,16 @@ */ #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; CountMe() { ++instances; } diff --git a/cpp/src/tests/TimerTest.cpp b/cpp/src/tests/TimerTest.cpp index 864ddaf702..2693d4a787 100644 --- a/cpp/src/tests/TimerTest.cpp +++ b/cpp/src/tests/TimerTest.cpp @@ -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 diff --git a/cpp/src/tests/TxAckTest.cpp b/cpp/src/tests/TxAckTest.cpp index 6c0bc8b5ee..89b98cb93c 100644 --- a/cpp/src/tests/TxAckTest.cpp +++ b/cpp/src/tests/TxAckTest.cpp @@ -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; diff --git a/cpp/src/tests/TxPublishTest.cpp b/cpp/src/tests/TxPublishTest.cpp index 2b363acfec..af7761acee 100644 --- a/cpp/src/tests/TxPublishTest.cpp +++ b/cpp/src/tests/TxPublishTest.cpp @@ -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; |