rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWBagIterator Class Reference
[RWCollectable-derived]

Iterator for class RWBag, which allows sequential access to all the elements of RWBag. More...

#include <rw/rwbag.h>

Inheritance diagram for RWBagIterator:
RWIterator

List of all members.

Public Member Functions

 RWBagIterator (const RWBag &)
virtual RWCollectablefindNext (const RWCollectable *target)
virtual RWCollectablekey () const
virtual RWCollectableoperator() ()
virtual void reset ()

Detailed Description

Iterator for class RWBag, which allows sequential access to all the elements of RWBag. Note that because an RWBag is unordered, elements are not accessed in any particular order. If an item was inserted N times into the collection, then it will be visited N consecutive times.

Like all Rogue Wave iterators, the "current item" is undefined immediately after construction -- you must define it by using operator()() or some other (valid) operation.

Once the iterator has advanced beyond the end of the collection it is no longer valid, so continuing to use it has undefined results.

Synopsis

 #include <rw/rwbag.h>
 RWBag b;
 RWBagIterator it(b);

Persistence

None


Constructor & Destructor Documentation

RWBagIterator::RWBagIterator ( const RWBag  ) 

Construct an iterator for an RWBag. After construction, the position of the iterator is undefined.


Member Function Documentation

virtual RWCollectable* RWBagIterator::findNext ( const RWCollectable target  )  [virtual]

Moves the iterator to the next item that isEqual() to the object pointed to by target, and returns it. Hashing is used to find the target. If no item is found, returns rwnil and the position of the iterator is undefined.

Implements RWIterator.

virtual RWCollectable* RWBagIterator::key (  )  const [virtual]

Returns the item at the current iterator position.

Implements RWIterator.

virtual RWCollectable* RWBagIterator::operator() (  )  [virtual]

Advances the iterator and returns the next item, or rwnil if the end of the collection has been reached.

Implements RWIterator.

virtual void RWBagIterator::reset (  )  [virtual]

Resets the iterator to the state it had immediately after construction.

Implements RWIterator.

 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.