#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.
|
Definition at line 793 of file Malloc_T.h. |
|
Definition at line 792 of file Malloc_T.h. |
|
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_MEM_POOL_2, ACE_LOCK, ACE_CB >::cb_ptr_, 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 } |
|
Destructor.
Definition at line 1180 of file Malloc_T.cpp. References ACE_OS::free().
01181 { 01182 ACE_OS::free ((void *) this->name_); 01183 } |
|
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, 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 } |
|
Returns 1 when all items have been seen, else 0.
Definition at line 1216 of file Malloc_T.cpp. References ACE_TRACE.
|
|
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, 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 } |
|
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.
|
|
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.
|
|
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. 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 } |
|
Declare the dynamic allocation hooks.
Definition at line 833 of file Malloc_T.h. |
|
Keeps track of how far we've advanced...
Definition at line 840 of file Malloc_T.h. |
|
Lock Malloc for the lifetime of the iterator.
Definition at line 843 of file Malloc_T.h. |
|
Malloc we are iterating over.
Definition at line 837 of file Malloc_T.h. |
|
Name that we are searching for.
Definition at line 846 of file Malloc_T.h. |