summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/tests/RefCounted.cpp
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2008-03-24 17:43:55 +0000
committerAndrew Stitcher <astitcher@apache.org>2008-03-24 17:43:55 +0000
commit65a26e7d25cf8155693981b0f2b245cc1dff8f0f (patch)
tree23c5495e6d96f4f143225ec6d1bd4ee0758a790e /qpid/cpp/src/tests/RefCounted.cpp
parentdca5c9779cf1671156931a7c50641162908b0ce0 (diff)
downloadqpid-python-65a26e7d25cf8155693981b0f2b245cc1dff8f0f.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@640479 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/RefCounted.cpp')
-rw-r--r--qpid/cpp/src/tests/RefCounted.cpp27
1 files changed, 2 insertions, 25 deletions
diff --git a/qpid/cpp/src/tests/RefCounted.cpp b/qpid/cpp/src/tests/RefCounted.cpp
index d111d58712..cd08a4491a 100644
--- a/qpid/cpp/src/tests/RefCounted.cpp
+++ b/qpid/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; }