diff options
author | okellogg <okellogg@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-03-24 17:11:45 +0000 |
---|---|---|
committer | okellogg <okellogg@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-03-24 17:11:45 +0000 |
commit | ec156983d2c1ea5adc99a22f7e89105d596b0b6a (patch) | |
tree | bc267bf9fab3a1ae0f7b8ed39e02278c14826ac2 | |
parent | f5bbeced261c9141ff701e2e8fb85c2e40ad306c (diff) | |
download | ATCD-ec156983d2c1ea5adc99a22f7e89105d596b0b6a.tar.gz |
ChangeLogTag:Mon Mar 24 18:03:34 CET 2003 Oliver Kellogg <oliver.kellogg@sysde.eads.net>
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | ace/Unbounded_Set.cpp | 17 | ||||
-rw-r--r-- | ace/Unbounded_Set.h | 10 |
3 files changed, 29 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog index 68defcbd887..2793883ea39 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Mon Mar 24 18:03:34 CET 2003 Oliver Kellogg <oliver.kellogg@sysde.eads.net> + + * ace/Unbounded_Set.{h,cpp}: + + Added method const_iterator_leave() in class ACE_Unbounded_Set. + The destructor of the ACE_Unbounded_Set_Const_Iterator calls it. + Deleted elements are not cleaned up in that case, but they + probably don't need to, given that we are dealing with a "const" + set. + Thanks to Jeff Parsons for noticing the problem. + Mon Mar 24 06:54:55 2003 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu> * ace/config-linux-common.h: Change the ACE_DEFAULT_BASE_ADDR for diff --git a/ace/Unbounded_Set.cpp b/ace/Unbounded_Set.cpp index cc5fc9ea0a1..b6dabe59348 100644 --- a/ace/Unbounded_Set.cpp +++ b/ace/Unbounded_Set.cpp @@ -287,20 +287,27 @@ ACE_Unbounded_Set<T>::end (void) } template <class T> void -ACE_Unbounded_Set<T>::iterator_add (void) +ACE_Unbounded_Set<T>::iterator_add (void) const { number_of_iterators_++; } template <class T> void -ACE_Unbounded_Set<T>::iterator_leave (void) +ACE_Unbounded_Set<T>::iterator_leave (void) const { - ACE_ASSERT (number_of_iterators_>0); + ACE_ASSERT (number_of_iterators_ > 0); number_of_iterators_--; - if (number_of_iterators_==0) + if (number_of_iterators_ == 0) cleanup (); } +template <class T> void +ACE_Unbounded_Set<T>::const_iterator_leave (void) const +{ + ACE_ASSERT (number_of_iterators_ > 0); + number_of_iterators_--; +} + ACE_ALLOC_HOOK_DEFINE(ACE_Unbounded_Set_Iterator) template <class T> void @@ -471,7 +478,7 @@ void ACE_Unbounded_Set_Const_Iterator<T>::operator=(const ACE_Unbounded_Set_Cons template <class T> ACE_Unbounded_Set_Const_Iterator<T>::~ACE_Unbounded_Set_Const_Iterator() { - set_->iterator_leave (); + set_->const_iterator_leave (); } template <class T> int diff --git a/ace/Unbounded_Set.h b/ace/Unbounded_Set.h index 5978cbc819e..c629a69642a 100644 --- a/ace/Unbounded_Set.h +++ b/ace/Unbounded_Set.h @@ -285,9 +285,11 @@ public: ACE_Unbounded_Set_Iterator<T> end (void); /// An Iterator has to register itself here. - void iterator_add (); - /// An Iterator has to unregister itself here. - void iterator_leave (); + void iterator_add () const; + /// A non-const Iterator has to unregister itself here. + void iterator_leave () const; + /// A Const_Iterator has to unregister itself here. + void const_iterator_leave () const; /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; @@ -312,7 +314,7 @@ private: ACE_Allocator *allocator_; /// Number of iterators working on this set. - int number_of_iterators_; + mutable int number_of_iterators_; }; #if defined (__ACE_INLINE__) |