Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_Malloc_LIFO_Iterator_T Class Template Reference

LIFO iterator for names stored in Malloc'd memory. More...

#include <Malloc_T.h>

Inheritance diagram for ACE_Malloc_LIFO_Iterator_T:

Inheritance graph
[legend]
Collaboration diagram for ACE_Malloc_LIFO_Iterator_T:

Collaboration graph
[legend]
List of all members.

Public Types

typedef ACE_TYPENAME ACE_CB::ACE_Name_Node NAME_NODE
typedef ACE_TYPENAME ACE_CB::ACE_Malloc_Header MALLOC_HEADER

Public Methods

 ACE_Malloc_LIFO_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. More...

 ~ACE_Malloc_LIFO_Iterator_T (void)
 Destructor. More...

int done (void) const
 Returns 1 when all items have been seen, else 0. More...

int 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. More...

int next (void *&next_entry, const char *&name)
int advance (void)
 Move forward by one element in the set. Returns 0 when all the items in the set have been seen, else 1. More...

void dump (void) const
 Dump the state of an object. More...


Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks. More...


Private Attributes

ACE_Malloc_T< ACE_MEM_POOL_2,
ACE_LOCK, ACE_CB > & 
malloc_
 Malloc we are iterating over. More...

NAME_NODEcurr_
 Keeps track of how far we've advanced... More...

ACE_Read_Guard< ACE_LOCK > guard_
 Lock Malloc for the lifetime of the iterator. More...

const char * name_
 Name that we are searching for. More...


Detailed Description

template<ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB>
class ACE_Malloc_LIFO_Iterator_T<, ACE_LOCK, ACE_CB >

LIFO iterator for names stored in Malloc'd memory.

Does not support deletions while iteration is occurring.

Definition at line 653 of file Malloc_T.h.


Member Typedef Documentation

template<ACE_MEM_POOL_1 , class ACE_LOCK, class ACE_CB>
typedef ACE_TYPENAME ACE_CB::ACE_Malloc_Header ACE_Malloc_LIFO_Iterator_T::MALLOC_HEADER
 

Definition at line 657 of file Malloc_T.h.

template<ACE_MEM_POOL_1 , class ACE_LOCK, class ACE_CB>
typedef ACE_TYPENAME ACE_CB::ACE_Name_Node ACE_Malloc_LIFO_Iterator_T::NAME_NODE
 

Definition at line 656 of file Malloc_T.h.

Referenced by ACE_Malloc_LIFO_Iterator_T.


Constructor & Destructor Documentation

template<ACE_MEM_POOL_1 , class ACE_LOCK, class ACE_CB>
ACE_Malloc_LIFO_Iterator_T<, ACE_LOCK, ACE_CB >::ACE_Malloc_LIFO_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 843 of file Malloc_T.cpp.

References ACE_TRACE, advance, ACE_Malloc_T< ACE_MEM_POOL_2, ACE_LOCK, ACE_CB >::cb_ptr_, curr_, malloc_, and NAME_NODE.

00845   : malloc_ (malloc),
00846     curr_ (0),
00847     guard_ (*malloc_.lock_),
00848     name_ (name != 0 ? ACE_OS::strdup (name) : 0)
00849 {
00850   ACE_TRACE ("ACE_Malloc_LIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_LIFO_Iterator_T");
00851   // Cheap trick to make code simple.
00852   // @@ Doug, this looks like trouble...
00853   NAME_NODE temp;
00854   this->curr_ = &temp;
00855   this->curr_->next_ = malloc_.cb_ptr_->name_head_;
00856 
00857   this->advance ();
00858 }

template<ACE_MEM_POOL_1 , class ACE_LOCK, class ACE_CB>
ACE_Malloc_LIFO_Iterator_T<, ACE_LOCK, ACE_CB >::~ACE_Malloc_LIFO_Iterator_T void   
 

Destructor.

Definition at line 861 of file Malloc_T.cpp.

References ACE_OS_Memory::free.

00862 {
00863   ACE_OS::free ((void *) this->name_);
00864 }


Member Function Documentation

template<ACE_MEM_POOL_1 , class ACE_LOCK, class ACE_CB>
int ACE_Malloc_LIFO_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 905 of file Malloc_T.cpp.

References ACE_TRACE, curr_, name_, and ACE_OS_String::strcmp.

Referenced by ACE_Malloc_LIFO_Iterator_T.

00906 {
00907   ACE_TRACE ("ACE_Malloc_LIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::advance");
00908 
00909   this->curr_ = this->curr_->next_;
00910 
00911   if (this->name_ == 0)
00912     return this->curr_ != 0;
00913 
00914   while (this->curr_ != 0
00915          && ACE_OS::strcmp (this->name_,
00916                             this->curr_->name ()) != 0)
00917     this->curr_ = this->curr_->next_;
00918 
00919   return this->curr_ != 0;
00920 }

template<ACE_MEM_POOL_1 , class ACE_LOCK, class ACE_CB>
int ACE_Malloc_LIFO_Iterator_T<, ACE_LOCK, ACE_CB >::done void    const
 

Returns 1 when all items have been seen, else 0.

Definition at line 897 of file Malloc_T.cpp.

References ACE_TRACE, and curr_.

00898 {
00899   ACE_TRACE ("ACE_Malloc_LIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::done");
00900 
00901   return this->curr_ == 0;
00902 }

template<ACE_MEM_POOL_1 , class ACE_LOCK, class ACE_CB>
void ACE_Malloc_LIFO_Iterator_T<, ACE_LOCK, ACE_CB >::dump void    const
 

Dump the state of an object.

Definition at line 830 of file Malloc_T.cpp.

References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_LIB_TEXT, ACE_TRACE, curr_, guard_, and LM_DEBUG.

00831 {
00832   ACE_TRACE ("ACE_Malloc_LIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::dump");
00833 
00834   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00835   this->curr_->dump ();
00836   this->guard_.dump ();
00837   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("name_ = %s"), this->name_));
00838   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\n")));
00839   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00840 }

template<ACE_MEM_POOL_1 , class ACE_LOCK, class ACE_CB>
int ACE_Malloc_LIFO_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 867 of file Malloc_T.cpp.

References ACE_TRACE, and curr_.

00869 {
00870   ACE_TRACE ("ACE_Malloc_LIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::next");
00871 
00872   if (this->curr_ != 0)
00873     {
00874       next_entry = (char *) this->curr_->pointer_;
00875       name = this->curr_->name ();
00876       return 1;
00877     }
00878   else
00879     return 0;
00880 }

template<ACE_MEM_POOL_1 , class ACE_LOCK, class ACE_CB>
int ACE_Malloc_LIFO_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 883 of file Malloc_T.cpp.

References ACE_TRACE, and curr_.

00884 {
00885   ACE_TRACE ("ACE_Malloc_LIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::next");
00886 
00887   if (this->curr_ != 0)
00888     {
00889       next_entry = this->curr_->pointer_;
00890       return 1;
00891     }
00892   else
00893     return 0;
00894 }


Member Data Documentation

template<ACE_MEM_POOL_1 , class ACE_LOCK, class ACE_CB>
ACE_Malloc_LIFO_Iterator_T::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Definition at line 693 of file Malloc_T.h.

template<ACE_MEM_POOL_1 , class ACE_LOCK, class ACE_CB>
NAME_NODE* ACE_Malloc_LIFO_Iterator_T::curr_ [private]
 

Keeps track of how far we've advanced...

Definition at line 700 of file Malloc_T.h.

Referenced by ACE_Malloc_LIFO_Iterator_T, advance, done, dump, and next.

template<ACE_MEM_POOL_1 , class ACE_LOCK, class ACE_CB>
ACE_Read_Guard<ACE_LOCK> ACE_Malloc_LIFO_Iterator_T::guard_ [private]
 

Lock Malloc for the lifetime of the iterator.

Definition at line 703 of file Malloc_T.h.

Referenced by dump.

template<ACE_MEM_POOL_1 , class ACE_LOCK, class ACE_CB>
ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>& ACE_Malloc_LIFO_Iterator_T::malloc_ [private]
 

Malloc we are iterating over.

Definition at line 697 of file Malloc_T.h.

Referenced by ACE_Malloc_LIFO_Iterator_T.

template<ACE_MEM_POOL_1 , class ACE_LOCK, class ACE_CB>
const char* ACE_Malloc_LIFO_Iterator_T::name_ [private]
 

Name that we are searching for.

Definition at line 706 of file Malloc_T.h.

Referenced by advance.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:49:49 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002