#include <Malloc_T.h>
Collaboration diagram for ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >:
Public Types | |
typedef ACE_CB::ACE_Name_Node | NAME_NODE |
typedef ACE_CB::ACE_Malloc_Header | MALLOC_HEADER |
Public Member Functions | |
ACE_Malloc_FIFO_Iterator_T (ACE_Malloc_T< ACE_MEM_POOL_2, ACE_LOCK, ACE_CB > &malloc, const char *name=0) | |
~ACE_Malloc_FIFO_Iterator_T (void) | |
Destructor. | |
int | done (void) const |
Returns 1 when all items have been seen, else 0. | |
int | next (void *&next_entry) |
int | next (void *&next_entry, const char *&name) |
int | advance (void) |
int | start (void) |
void | dump (void) const |
Dump the state of an object. | |
Public Attributes | |
ACE_ALLOC_HOOK_DECLARE | |
Declare the dynamic allocation hooks. | |
Private Attributes | |
ACE_Malloc_T< ACE_MEM_POOL_2, ACE_LOCK, ACE_CB > & | malloc_ |
Malloc we are iterating over. | |
NAME_NODE * | curr_ |
Keeps track of how far we've advanced... | |
ACE_Read_Guard< ACE_LOCK > | guard_ |
Lock Malloc for the lifetime of the iterator. | |
const char * | name_ |
Name that we are searching for. |
This class can be configured flexibly with different types of ACE_LOCK strategies that support the ACE_Thread_Mutex and ACE_Process_Mutex constructor API.
Does not support deletions while iteration is occurring.
Definition at line 789 of file Malloc_T.h.
typedef ACE_CB::ACE_Malloc_Header ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::MALLOC_HEADER |
Definition at line 793 of file Malloc_T.h.
typedef ACE_CB::ACE_Name_Node ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::NAME_NODE |
Definition at line 792 of file Malloc_T.h.
ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::ACE_Malloc_FIFO_Iterator_T | ( | ACE_Malloc_T< ACE_MEM_POOL_2, ACE_LOCK, ACE_CB > & | malloc, | |
const char * | name = 0 | |||
) |
If name = 0 it will iterate through everything else only through those entries whose name match.
Definition at line 1160 of file Malloc_T.cpp.
References ACE_TRACE, ACE_Malloc_T<, ACE_LOCK, ACE_CB >::cb_ptr_, ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::curr_, ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::malloc_, and ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::start().
01162 : malloc_ (malloc), 01163 curr_ (0), 01164 guard_ (*malloc_.lock_), 01165 name_ (name != 0 ? ACE_OS::strdup (name) : 0) 01166 { 01167 ACE_TRACE ("ACE_Malloc_FIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_FIFO_Iterator"); 01168 // Cheap trick to make code simple. 01169 // @@ Doug, this looks like trouble... 01170 NAME_NODE temp; 01171 this->curr_ = &temp; 01172 this->curr_->next_ = malloc_.cb_ptr_->name_head_; 01173 this->curr_->prev_ = 0; 01174 01175 // Go to the first element that was inserted. 01176 this->start (); 01177 }
ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::~ACE_Malloc_FIFO_Iterator_T | ( | void | ) |
Destructor.
Definition at line 1180 of file Malloc_T.cpp.
References ACE_OS::free().
01181 { 01182 ACE_OS::free ((void *) this->name_); 01183 }
int ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::advance | ( | void | ) |
Move forward by one element in the set. Returns 0 when all the items in the set have been seen, else 1.
Definition at line 1224 of file Malloc_T.cpp.
References ACE_TRACE, ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::curr_, and ACE_OS::strcmp().
01225 { 01226 ACE_TRACE ("ACE_Malloc_FIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::advance"); 01227 01228 this->curr_ = this->curr_->prev_; 01229 01230 if (this->name_ == 0) 01231 return this->curr_ != 0; 01232 01233 while (this->curr_ != 0 01234 && ACE_OS::strcmp (this->name_, 01235 this->curr_->name ()) != 0) 01236 this->curr_ = this->curr_->prev_; 01237 01238 return this->curr_ != 0; 01239 }
int ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::done | ( | void | ) | const |
Returns 1 when all items have been seen, else 0.
Definition at line 1216 of file Malloc_T.cpp.
References ACE_TRACE, and ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::curr_.
01217 { 01218 ACE_TRACE ("ACE_Malloc_FIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::done"); 01219 01220 return this->curr_ == 0; 01221 }
void ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::dump | ( | void | ) | const |
Dump the state of an object.
Definition at line 1145 of file Malloc_T.cpp.
References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_TEXT, ACE_TRACE, ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::curr_, ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::guard_, and LM_DEBUG.
01146 { 01147 #if defined (ACE_HAS_DUMP) 01148 ACE_TRACE ("ACE_Malloc_FIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::dump"); 01149 01150 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); 01151 this->curr_->dump (); 01152 this->guard_.dump (); 01153 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("name_ = %s"), this->name_)); 01154 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); 01155 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); 01156 #endif /* ACE_HAS_DUMP */ 01157 }
int ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::next | ( | void *& | next_entry, | |
const char *& | name | |||
) |
Pass back the next entry (and the name associated with it) in the set that hasn't yet been visited. Returns 0 when all items have been seen, else 1.
Definition at line 1186 of file Malloc_T.cpp.
References ACE_TRACE.
01188 { 01189 ACE_TRACE ("ACE_Malloc_FIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::next"); 01190 01191 if (this->curr_ != 0) 01192 { 01193 next_entry = (char *) this->curr_->pointer_; 01194 name = this->curr_->name (); 01195 return 1; 01196 } 01197 else 01198 return 0; 01199 }
int ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::next | ( | void *& | next_entry | ) |
Pass back the next entry in the set that hasn't yet been visited. Returns 0 when all items have been seen, else 1.
Definition at line 1202 of file Malloc_T.cpp.
References ACE_TRACE, and ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::curr_.
01203 { 01204 ACE_TRACE ("ACE_Malloc_FIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::next"); 01205 01206 if (this->curr_ != 0) 01207 { 01208 next_entry = this->curr_->pointer_; 01209 return 1; 01210 } 01211 else 01212 return 0; 01213 }
int ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::start | ( | void | ) |
Go to the starting element that was inserted first. Returns 0 when there is no item in the set, else 1.
Definition at line 1242 of file Malloc_T.cpp.
References ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::curr_.
Referenced by ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::ACE_Malloc_FIFO_Iterator_T().
01243 { 01244 this->curr_ = this->curr_->next_; 01245 NAME_NODE *prev = 0; 01246 01247 // Locate the element that was inserted first. 01248 // @@ We could optimize this by making the list a circular list or 01249 // storing an extra pointer. 01250 while (this->curr_ != 0) 01251 { 01252 prev = this->curr_; 01253 this->curr_ = this->curr_->next_; 01254 } 01255 01256 this->curr_ = prev; 01257 return this->curr_ != 0; 01258 }
ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::ACE_ALLOC_HOOK_DECLARE |
NAME_NODE* ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::curr_ [private] |
Keeps track of how far we've advanced...
Definition at line 840 of file Malloc_T.h.
Referenced by ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::ACE_Malloc_FIFO_Iterator_T(), ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::advance(), ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::done(), ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::dump(), ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::next(), and ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::start().
ACE_Read_Guard<ACE_LOCK> ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::guard_ [private] |
Lock Malloc for the lifetime of the iterator.
Definition at line 843 of file Malloc_T.h.
Referenced by ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::dump().
ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>& ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::malloc_ [private] |
Malloc we are iterating over.
Definition at line 837 of file Malloc_T.h.
Referenced by ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::ACE_Malloc_FIFO_Iterator_T().
const char* ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::name_ [private] |