ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > 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< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >:
Inheritance graph
[legend]

List of all members.

Public Types

typedef
ACE_Hash_Map_Manager_Ex
< EXT_ID, INT_ID, HASH_KEY,
COMPARE_KEYS, ACE_LOCK > 
container_type
typedef container_type::value_type value_type
typedef container_type::reference reference
typedef container_type::pointer pointer
typedef
container_type::difference_type 
difference_type

Public Member Functions

 ACE_Hash_Map_Iterator_Base_Ex (ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > &mm, bool head)
 Contructor.
 ACE_Hash_Map_Iterator_Base_Ex (ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK > &mm, ACE_Hash_Map_Entry< EXT_ID, INT_ID > *entry, size_t index)
 Contructor.
int next (ACE_Hash_Map_Entry< EXT_ID, INT_ID > *&next_entry) const
int done (void) const
 Returns 1 when all items have been seen, else 0.
ACE_Hash_Map_Entry< EXT_ID,
INT_ID > & 
operator* (void) const
 Returns a reference to the interal element this is pointing to.
ACE_Hash_Map_Entry< EXT_ID,
INT_ID > * 
operator-> (void) const
 Returns a pointer to the interal element this is pointing to.
ACE_Hash_Map_Manager_Ex
< EXT_ID, INT_ID, HASH_KEY,
COMPARE_KEYS, ACE_LOCK > & 
map (void)
bool 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.
bool 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.

Protected Member Functions

int forward_i (void)
int reverse_i (void)
void dump_i (void) const
 Dump the state of an object.

Protected Attributes

ACE_Hash_Map_Manager_Ex
< EXT_ID, INT_ID, HASH_KEY,
COMPARE_KEYS, ACE_LOCK > * 
map_man_
 Map we are iterating over.
ssize_t index_
 Keeps track of how far we've advanced in the table.
ACE_Hash_Map_Entry< EXT_ID,
INT_ID > * 
next_

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 592 of file Hash_Map_Manager_T.h.


Member Typedef Documentation

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
typedef 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 >::container_type
template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
typedef container_type::difference_type ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::difference_type
template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
typedef container_type::pointer ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::pointer
template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
typedef container_type::reference ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::reference
template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
typedef container_type::value_type ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::value_type

Constructor & Destructor Documentation

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
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,
bool  head 
) [inline]

Contructor.

If head != false, the iterator constructed is positioned at the head of the map. It is positioned at the end otherwise.

Definition at line 484 of file Hash_Map_Manager_T.inl.

00491   : map_man_ (&mm),
00492     index_ (head ? -1 : (ssize_t) mm.total_size_),
00493     next_ (0)
00494 {
00495   if (mm.table_ != 0)
00496     this->next_ = &mm.table_[head ? 0 : mm.total_size_ - 1];
00497 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
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,
ACE_Hash_Map_Entry< EXT_ID, INT_ID > *  entry,
size_t  index 
) [inline]

Contructor.

This constructor positions the iterator to the given entry.

Definition at line 509 of file Hash_Map_Manager_T.inl.

00517   : map_man_ (&mm)
00518   , index_ (static_cast<ssize_t> (index))
00519   , next_ (entry)
00520 {
00521 }


Member Function Documentation

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 >::done ( void   )  const [inline]

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

Definition at line 542 of file Hash_Map_Manager_T.inl.

00543 {
00544   ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::done");
00545 
00546   return this->map_man_->table_ == 0
00547     || this->index_ >= static_cast<ssize_t> (this->map_man_->total_size_)
00548     || this->index_ < 0;
00549 }

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 [inline, protected]

Dump the state of an object.

Definition at line 397 of file Hash_Map_Manager_T.cpp.

00398 {
00399   ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::dump_i");
00400 
00401   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00402   ACE_DEBUG ((LM_DEBUG,  ACE_TEXT ("index_ = %d "), this->index_));
00403   ACE_DEBUG ((LM_DEBUG,  ACE_TEXT ("next_ = %x"), this->next_));
00404   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00405 }

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   )  [inline, 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 408 of file Hash_Map_Manager_T.cpp.

00409 {
00410   ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::forward_i");
00411 
00412   if (this->map_man_->table_ == 0)
00413     return -1;
00414   // Handle initial case specially.
00415   else if (this->index_ == -1)
00416     {
00417       this->index_++;
00418       return this->forward_i ();
00419     }
00420   else if (this->index_ >= static_cast<ssize_t> (this->map_man_->total_size_))
00421     return 0;
00422 
00423   this->next_ = this->next_->next_;
00424   if (this->next_ == &this->map_man_->table_[this->index_])
00425     {
00426       while (++this->index_ < static_cast<ssize_t> (this->map_man_->total_size_))
00427         {
00428           this->next_ = this->map_man_->table_[this->index_].next_;
00429           if (this->next_ != &this->map_man_->table_[this->index_])
00430             break;
00431         }
00432     }
00433 
00434   return this->index_ < static_cast<ssize_t> (this->map_man_->total_size_);
00435 }

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< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::map ( void   )  [inline]

Returns reference the Hash_Map_Manager_Ex that is being iterated over.

Definition at line 585 of file Hash_Map_Manager_T.inl.

00586 {
00587   ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::map");
00588   return *this->map_man_;
00589 }

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 >::next ( ACE_Hash_Map_Entry< EXT_ID, INT_ID > *&  next_entry  )  const [inline]

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 525 of file Hash_Map_Manager_T.inl.

00526 {
00527   ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::next");
00528 
00529   if (this->map_man_->table_ != 0
00530       && this->index_ < static_cast<ssize_t> (this->map_man_->total_size_)
00531       && this->index_ >= 0
00532       && this->next_ != &this->map_man_->table_[this->index_])
00533     {
00534       entry = this->next_;
00535       return 1;
00536     }
00537   else
00538     return 0;
00539 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
bool 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 > &  rhs  )  const [inline]

Definition at line 601 of file Hash_Map_Manager_T.inl.

00602 {
00603   ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator!=");
00604   return this->next_ != rhs.next_
00605     || this->index_ != rhs.index_
00606     || this->map_man_ != rhs.map_man_;
00607 }

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< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::operator* ( void   )  const [inline]

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

Definition at line 553 of file Hash_Map_Manager_T.inl.

00554 {
00555   ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator*");
00556   ACE_Hash_Map_Entry<EXT_ID, INT_ID> *retv = 0;
00557 
00558   int result = this->next (retv);
00559 
00560   ACE_UNUSED_ARG (result);
00561   ACE_ASSERT (result != 0);
00562 
00563   return *retv;
00564 }

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< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::operator-> ( void   )  const [inline]

Returns a pointer to the interal element this is pointing to.

Definition at line 568 of file Hash_Map_Manager_T.inl.

00569 {
00570   ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator->");
00571   ACE_Hash_Map_Entry<EXT_ID, INT_ID> *retv = 0;
00572 
00573   int result = this->next (retv);
00574 
00575   ACE_UNUSED_ARG (result);
00576   ACE_ASSERT (result != 0);
00577 
00578   return retv;
00579 }

template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
bool 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 > &  rhs  )  const [inline]

Check if two iterators point to the same position.

Definition at line 592 of file Hash_Map_Manager_T.inl.

00593 {
00594   ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::operator==");
00595   return this->map_man_ == rhs.map_man_
00596     && this->index_ == rhs.index_
00597     && this->next_ == rhs.next_;
00598 }

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   )  [inline, 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 438 of file Hash_Map_Manager_T.cpp.

00439 {
00440   ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::reverse_i");
00441 
00442   if (this->map_man_->table_ == 0)
00443     return -1;
00444   else if (this->index_ == static_cast<ssize_t> (this->map_man_->total_size_))
00445     {
00446       --this->index_;
00447       return this->reverse_i ();
00448     }
00449   else if (this->index_ < 0)
00450     return 0;
00451 
00452   this->next_ = this->next_->prev_;
00453   if (this->next_ == &this->map_man_->table_[this->index_])
00454     {
00455       while (--this->index_ >= 0)
00456         {
00457           this->next_ = this->map_man_->table_[this->index_].prev_;
00458           if (this->next_ != &this->map_man_->table_[this->index_])
00459             break;
00460         }
00461     }
00462 
00463   return this->index_ >= 0;
00464 }


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< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::ACE_ALLOC_HOOK_DECLARE
template<class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK>
ssize_t ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::index_ [protected]

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

Definition at line 675 of file Hash_Map_Manager_T.h.

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< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::map_man_ [protected]

Map we are iterating over.

Definition at line 672 of file Hash_Map_Manager_T.h.

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< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::next_ [protected]

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

Definition at line 679 of file Hash_Map_Manager_T.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Sun Nov 22 23:14:46 2009 for ACE by  doxygen 1.6.1