qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject svn commit: r616396 - in /incubator/qpid/trunk/qpid/cpp/src: qpid/IList.h tests/IList.cpp
Date Tue, 29 Jan 2008 15:45:31 GMT
Author: aconway
Date: Tue Jan 29 07:45:29 2008
New Revision: 616396

URL: http://svn.apache.org/viewvc?rev=616396&view=rev
Log:

Provide public read-access to IListNode pointers, so frame handlers
can use then to find the next frame.

Modified:
    incubator/qpid/trunk/qpid/cpp/src/qpid/IList.h
    incubator/qpid/trunk/qpid/cpp/src/tests/IList.cpp

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/IList.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/IList.h?rev=616396&r1=616395&r2=616396&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/IList.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/IList.h Tue Jan 29 07:45:29 2008
@@ -57,6 +57,8 @@
     }
   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 @@
 
   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 @@
 
     /// 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 @@
     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(); } }

Modified: incubator/qpid/trunk/qpid/cpp/src/tests/IList.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/IList.cpp?rev=616396&r1=616395&r2=616396&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/IList.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/IList.cpp Tue Jan 29 07:45:29 2008
@@ -152,6 +152,10 @@
 }    
 
 
+BOOST_AUTO_TEST_CASE(testEmptyDtor) {
+    TestList l;
+}
+
 BOOST_FIXTURE_TEST_CASE(testOwnership, Fixture) {
     { 
         TestList l2;



Mime
View raw message