RWTPtrHashDictionaryIterator(3C++)

RWTPtrHashDictionaryIterator<K,V> - Rogue Wave library class

Showing IRIX 6.5.15. Unchanged since IRIX 6.5.

Name
     RWTPtrHashDictionaryIterator<K,V> - Rogue Wave library class

Synopsis
              #include <rw/tphdict.h>



              unsigned hashFun(const K&);
          RWTPtrHashDictionary<K,V> dictionary(hashFun);
          RWTPtrHashDictionaryIterator<K,V> iterator(dictionary);

Please Note!
     If you do not have the Standard C++ Library, use the interface described
     here.  Otherwise, use the interface to RWTPtrHashMapIterator described in
     the Class Reference.






Description
     Iterator for class RWTPtrHashDictionary<K,V> allowing sequential access
     to all keys and values of a parameterized hash dictionary.  Elements are
     not accessed in any particular order.  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 -- continuing to use it will bring undefined results.

Persistence
     None

Public Constructor
              RWTPtrHashDictionaryIterator(RWTPtrHashDictionary& c);


     Constructs an iterator to be used with the dictionary c.





Public Operators
              RWBoolean
          operator++();


     Advances the iterator to the next key-value pair and returns TRUE.  When
     the end of the collection is reached, returns FALSE and the position of
     the iterator will be undefined.
              K*
          operator()();


     Advances the iterator to the next key-value pair and returns a pointer to
     the key.  When the end of the collection is reached, returns nil and the
     position of the iterator will be undefined.  Use member function value()
     to recover the dictionary value.

Public Member Functions
              RWTPtrHashDictionary*
          container() const;


     Returns a pointer to the collection over which this iterator is
     iterating.

              K*
          key() const;


     Returns a pointer to the key at the iterator's current position.  The
     results are undefined if the iterator is no longer valid.

              void
          reset();


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

              void
          reset(RWTPtrHashDictionary& c);


     Resets the iterator to iterate over the collection c.

              V*
          value() const;


     Returns a pointer to the value at the iterator's current position.  The
     results are undefined if the iterator is no longer valid.