diff options
author | Alan Conway <aconway@apache.org> | 2008-01-29 15:45:29 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2008-01-29 15:45:29 +0000 |
commit | 7681735177fa7e381137aadef48963608d0aa0a8 (patch) | |
tree | 57b7d97a02470a948b1790102196f5adeaa6d6c0 /cpp | |
parent | 6b6dfc1709eace6db0c624676ad297e34fef4aa7 (diff) | |
download | qpid-python-7681735177fa7e381137aadef48963608d0aa0a8.tar.gz |
Provide public read-access to IListNode pointers, so frame handlers
can use then to find the next frame.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@616396 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/qpid/IList.h | 7 | ||||
-rw-r--r-- | cpp/src/tests/IList.cpp | 4 |
2 files changed, 10 insertions, 1 deletions
diff --git a/cpp/src/qpid/IList.h b/cpp/src/qpid/IList.h index c0c8b503f0..4593b9a5e1 100644 --- a/cpp/src/qpid/IList.h +++ b/cpp/src/qpid/IList.h @@ -57,6 +57,8 @@ template<class T, int N=0> class IListNode : public virtual RefCounted { } friend class IList<T,N>; public: + typedef IList<T,N> IListType; + IListNode(IListNode* p=0) : prev(p), next(p) {} T* getNext() { return next ? next->self() : 0; } T* getPrev() { return prev ? prev->self() : 0; } @@ -97,7 +99,7 @@ template <class T, int N=0> class IList { public: IList() {} - ~IList() { clear(); } + ~IList() { clear(); anchor.erase(); } typedef size_t size_type; typedef T value_type; /// pointer type is an intrusive_ptr @@ -120,6 +122,7 @@ template <class T, int N=0> class IList { /// Note: takes a non-const reference, unlike standard containers. void insert(iterator pos, reference x) { x.Node::insert(pos.ptr); } + void insert(iterator pos, pointer x) { x->Node::insert(pos.ptr); } void erase(iterator pos) { pos.ptr->erase(); } void swap(IList &x) { anchor.swap(x.anchor); } @@ -128,12 +131,14 @@ template <class T, int N=0> class IList { void pop_back() { assert(!empty()); erase(last()); } /// Note: takes a non-const reference, unlike standard containers. void push_back(reference x) { insert(end(), x); } + void push_back(pointer x) { insert(end(), x); } reference front() { assert(!empty()); return *begin(); } const_reference front() const { assert(!empty()); return *begin(); } void pop_front() { assert(!empty()); erase(begin()); } /// Note: takes a non-const reference, unlike standard containers. void push_front(reference x) { insert(begin(), x); } + void push_front(pointer x) { insert(begin(), x); } bool empty() const { return begin() == end(); } void clear() { while (!empty()) { pop_front(); } } diff --git a/cpp/src/tests/IList.cpp b/cpp/src/tests/IList.cpp index f5d7cd344e..392ef4823d 100644 --- a/cpp/src/tests/IList.cpp +++ b/cpp/src/tests/IList.cpp @@ -152,6 +152,10 @@ BOOST_FIXTURE_TEST_CASE(TestIterator, Fixture) { } +BOOST_AUTO_TEST_CASE(testEmptyDtor) { + TestList l; +} + BOOST_FIXTURE_TEST_CASE(testOwnership, Fixture) { { TestList l2; |