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

ACE_Hash_Map_Iterator_Base_Ex Class Template Reference

Base iterator for the <ACE_Hash_Map_Manager_Ex>. More...

#include <Hash_Map_Manager_T.h>

Inheritance diagram for ACE_Hash_Map_Iterator_Base_Ex:

Inheritance graph
[legend]
Collaboration diagram for ACE_Hash_Map_Iterator_Base_Ex:

Collaboration graph
[legend]
List of all members.

Public Methods

 ACE_Hash_Map_Iterator_Base_Ex (ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > &mm, int head)
 Contructor. If head != 0, the iterator constructed is positioned at the head of the map, it is positioned at the end otherwise. More...

int next (ACE_Hash_Map_Entry< EXT_ID, INT_ID > *&next_entry) const
 Pass back the next <entry> that hasn't been seen in the Set. Returns 0 when all items have been seen, else 1. More...

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

ACE_Hash_Map_Entry< EXT_ID,
INT_ID > & 
operator * (void) const
 Returns a reference to the interal element <this> is pointing to. More...

ACE_Hash_Map_Manager_Ex< EXT_ID,
INT_ID, HASH_KEY, COMPARE_KEYS,
ACE_LOCK > & 
map (void)
 Returns reference the Hash_Map_Manager_Ex that is being iterated over. More...

int operator== (const ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > &) const
 Check if two iterators point to the same position. More...

int operator!= (const ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > &) const

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks. More...


Protected Methods

int forward_i (void)
 Move forward by one element in the set. Returns 0 when there's no more item in the set after the current items, else 1. More...

int reverse_i (void)
 Move backward by one element in the set. Returns 0 when there's no more item in the set before the current item, else 1. More...

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


Protected Attributes

ACE_Hash_Map_Manager_Ex< EXT_ID,
INT_ID, HASH_KEY, COMPARE_KEYS,
ACE_LOCK > * 
map_man_
 Map we are iterating over. More...

ssize_t index_
 Keeps track of how far we've advanced in the table. More...

ACE_Hash_Map_Entry< EXT_ID,
INT_ID > * 
next_
 Keeps track of how far we've advanced in a linked list in each table slot. More...


Detailed Description

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
class ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >

Base iterator for the <ACE_Hash_Map_Manager_Ex>.

This class factors out common code from its templatized subclasses.

Definition at line 476 of file Hash_Map_Manager_T.h.


Constructor & Destructor Documentation

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::ACE_Hash_Map_Iterator_Base_Ex ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > &    mm,
int    head
 

Contructor. If head != 0, the iterator constructed is positioned at the head of the map, it is positioned at the end otherwise.

Definition at line 375 of file Hash_Map_Manager_T.i.

References ACE_TRACE, next_, ssize_t, ACE_Hash_Map_Manager_Ex::table_, and ACE_Hash_Map_Manager_Ex::total_size_.

00377   : map_man_ (&mm),
00378     index_ (head != 0 ? -1 : (ssize_t) mm.total_size_),
00379     next_ (0)
00380 {
00381   ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Iterator_Base_Ex");
00382 
00383   if (mm.table_ != 0)
00384     this->next_ = &mm.table_[head != 0 ? 0 : mm.total_size_ - 1];
00385 }


Member Function Documentation

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::done void    const
 

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

Definition at line 405 of file Hash_Map_Manager_T.i.

References ACE_TRACE, index_, map_man_, and ssize_t.

00406 {
00407   ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::done");
00408 
00409   return this->map_man_->table_ == 0
00410     || this->index_ >= ACE_static_cast (ssize_t, this->map_man_->total_size_)
00411     || this->index_ < 0;
00412 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
void ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::dump_i void    const [protected]
 

Dump the state of an object.

Definition at line 376 of file Hash_Map_Manager_T.cpp.

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

Referenced by ACE_Hash_Map_Reverse_Iterator_Ex::dump, and ACE_Hash_Map_Iterator_Ex::dump.

00377 {
00378   ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump_i");
00379 
00380   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00381   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("index_ = %d "), this->index_));
00382   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("next_ = %x"), this->next_));
00383   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00384 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
int ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::forward_i void    [protected]
 

Move forward by one element in the set. Returns 0 when there's no more item in the set after the current items, else 1.

Definition at line 387 of file Hash_Map_Manager_T.cpp.

References ACE_TRACE, index_, map_man_, next_, and ssize_t.

Referenced by ACE_Hash_Map_Iterator_Ex::ACE_Hash_Map_Iterator_Ex, ACE_Hash_Map_Iterator_Ex::advance, ACE_Hash_Map_Iterator_Ex::operator++, and ACE_Hash_Map_Reverse_Iterator_Ex::operator--.

00388 {
00389   ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::forward_i");
00390 
00391   if (this->map_man_->table_ == 0)
00392     return -1;
00393   // Handle initial case specially.
00394   else if (this->index_ == -1)
00395     {
00396       this->index_++;
00397       return this->forward_i ();
00398     }
00399   else if (this->index_ >= ACE_static_cast (ssize_t, this->map_man_->total_size_))
00400     return 0;
00401 
00402   this->next_ = this->next_->next_;
00403   if (this->next_ == &this->map_man_->table_[this->index_])
00404     {
00405       while (++this->index_ < ACE_static_cast (ssize_t,
00406                                                this->map_man_->total_size_))
00407         {
00408           this->next_ = this->map_man_->table_[this->index_].next_;
00409           if (this->next_ != &this->map_man_->table_[this->index_])
00410             break;
00411         }
00412     }
00413 
00414   return this->index_ < ACE_static_cast (ssize_t, this->map_man_->total_size_);
00415 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > & ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::map void   
 

Returns reference the Hash_Map_Manager_Ex that is being iterated over.

Definition at line 433 of file Hash_Map_Manager_T.i.

References ACE_TRACE, and map_man_.

00434 {
00435   ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::map");
00436   return *this->map_man_;
00437 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::next ACE_Hash_Map_Entry< EXT_ID, INT_ID > *&    next_entry const
 

Pass back the next <entry> that hasn't been seen in the Set. Returns 0 when all items have been seen, else 1.

Definition at line 388 of file Hash_Map_Manager_T.i.

References ACE_TRACE, index_, map_man_, next_, and ssize_t.

Referenced by operator *.

00389 {
00390   ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::next");
00391 
00392   if (this->map_man_->table_ != 0
00393       && this->index_ < ACE_static_cast (ssize_t, this->map_man_->total_size_)
00394       && this->index_ >= 0
00395       && this->next_ != &this->map_man_->table_[this->index_])
00396     {
00397       entry = this->next_;
00398       return 1;
00399     }
00400   else
00401     return 0;
00402 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_Hash_Map_Entry< EXT_ID, INT_ID > & ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::operator * void    const
 

Returns a reference to the interal element <this> is pointing to.

Definition at line 416 of file Hash_Map_Manager_T.i.

References ACE_ASSERT, ACE_TRACE, and next.

00417 {
00418   ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator*");
00419   ACE_Hash_Map_Entry<EXT_ID, INT_ID> *retv = 0;
00420 
00421   int result = this->next (retv);
00422 
00423   ACE_UNUSED_ARG (result);
00424   ACE_ASSERT (result != 0);
00425 
00426   return *retv;
00427 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::operator!= const ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > &    const
 

Definition at line 449 of file Hash_Map_Manager_T.i.

References ACE_TRACE, index_, map_man_, and next_.

00450 {
00451   ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator!=");
00452   return this->next_ != rhs.next_
00453     || this->index_ != rhs.index_
00454     || this->map_man_ != rhs.map_man_;
00455 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::operator== const ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > &    const
 

Check if two iterators point to the same position.

Definition at line 440 of file Hash_Map_Manager_T.i.

References ACE_TRACE, index_, map_man_, and next_.

00441 {
00442   ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator==");
00443   return this->map_man_ == rhs.map_man_
00444     && this->index_ == rhs.index_
00445     && this->next_ == rhs.next_;
00446 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
int ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::reverse_i void    [protected]
 

Move backward by one element in the set. Returns 0 when there's no more item in the set before the current item, else 1.

Definition at line 418 of file Hash_Map_Manager_T.cpp.

References ACE_TRACE, index_, map_man_, next_, and ssize_t.

Referenced by ACE_Hash_Map_Reverse_Iterator_Ex::ACE_Hash_Map_Reverse_Iterator_Ex, ACE_Hash_Map_Reverse_Iterator_Ex::advance, ACE_Hash_Map_Reverse_Iterator_Ex::operator++, and ACE_Hash_Map_Iterator_Ex::operator--.

00419 {
00420   ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::reverse_i");
00421 
00422   if (this->map_man_->table_ == 0)
00423     return -1;
00424   else if (this->index_ == ACE_static_cast (ssize_t, this->map_man_->total_size_))
00425     {
00426       this->index_--;
00427       return this->reverse_i ();
00428     }
00429   else if (this->index_ < 0)
00430     return 0;
00431 
00432   this->next_ = this->next_->prev_;
00433   if (this->next_ == &this->map_man_->table_[this->index_])
00434     {
00435       while (--this->index_ >= 0)
00436         {
00437           this->next_ = this->map_man_->table_[this->index_].prev_;
00438           if (this->next_ != &this->map_man_->table_[this->index_])
00439             break;
00440         }
00441     }
00442 
00443   return this->index_ >= 0;
00444 }


Member Data Documentation

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_Hash_Map_Iterator_Base_Ex::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Reimplemented in ACE_Hash_Map_Iterator_Ex.

Definition at line 506 of file Hash_Map_Manager_T.h.

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ssize_t ACE_Hash_Map_Iterator_Base_Ex::index_ [protected]
 

Keeps track of how far we've advanced in the table.

Definition at line 524 of file Hash_Map_Manager_T.h.

Referenced by done, forward_i, next, operator!=, operator==, and reverse_i.

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>* ACE_Hash_Map_Iterator_Base_Ex::map_man_ [protected]
 

Map we are iterating over.

Definition at line 521 of file Hash_Map_Manager_T.h.

Referenced by done, forward_i, map, next, operator!=, operator==, and reverse_i.

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ACE_Hash_Map_Entry<EXT_ID, INT_ID>* ACE_Hash_Map_Iterator_Base_Ex::next_ [protected]
 

Keeps track of how far we've advanced in a linked list in each table slot.

Definition at line 528 of file Hash_Map_Manager_T.h.

Referenced by ACE_Hash_Map_Iterator_Base_Ex, forward_i, next, operator!=, operator==, and reverse_i.


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