#include <casa/Containers/HashMap.h> #include <casa/BasicSL/String.h> #include <casa/iostream.h> main() { HashMap<String,Int> hash; hash.define("one",1); hash.define("two",2); hash.define("three",3); hash.define("four",4); hash.define("five",5); hash.define("six",6); ConstHashMapIter<String,Int> iter(hash); for ( iter.toStart(); ! iter.atEnd(); iter++ ) cout << iter.getVal() << ": " << iter.getKey() << endl; }
Move the iterator to the start of the Map.
Advance to the next element of the Map.
Get the key or value for the current position in the Map.
Check to see if the iterator position is at the end or beginning of the Map.
Check to see if the iterator is in a valid state.
Constructs a Map iterator from a Map (with reference semantics).
Assign one map iterator to a map (with reference semantics).
Constructs a Map iterator from another iterator (with reference semantics).
Assign one map iterator to another iterator (with reference semantics).
Default constructor creates an invalid Map iterator.
Returns the default value for the Map on which this iterator is operating if it is a valid iterator, otherwise it throws an exception.
Allows mapping functions to be performed with the map on which this iterator operates. If this iterator is invalid, then an exception will be thrown.
Allows one to check to see if a given key is defined in the map which this iterator tracks. If this iterator is invalid, then an exception will be thrown.
Returns the number of user defined mappings
Returns the container on which this iterator is operating.
dtor
#include <aips/Containers/HashMap.h> #include <casa/BasicSL/String.h> #include <iostream> main() { HashMap<String,Int> hash; hash.define("one",1); hash.define("two",2); hash.define("three",3); hash.define("four",4); hash.define("five",5); hash.define("six",6); HashMapIter<String,Int> iter(hash); for ( iter.toStart(); ! iter.atEnd(); iter++ ) cout << iter.getVal() << ": " << iter.getKey() << endl; }
Get the key or value for the current position in the Map.
These functions allow for the definition and removal of key/value relations. The "define(key &, value &)" function defines a key/value relation, and "remove(key &)" function removes a relation if it has been previously defined.
This returns the default value for the map that this iterator is tracking. With a non-const iterator the default value can be changed.
Clear all of the mappings.
Allows mapping functions to be performed with the map on which this iterator operates. If this iterator is invalid, then an exception will be thrown. With a non-const operator, the value can be changed.
This allows a MapIter to be constructed from a Map. When created the new MapIter maintains a reference to the original Map. If the Map to which this MapIter points is deleted, then the MapIter is marked as invalid.
This allows a MapIter to be constructed from another MapIter. When created the new MapIter maintains a reference to the Map which the MapIter parameter tracked. If this Map is deleted, then this MapIter is marked as invalid.
Default constructor creates an invalid Map iterator.
This assignment operator allows the Map which this MapIter tracks to be changed. After a call to this operator, the MapIter will track the Map parameter.
This assignment operator allows the Map which this MapIter tracks to be changed. After a call to this operator, this MapIter will track the Map which the MapIter parameter tracks, i.e. it will contain a reference to this new Map.
Returns the container on which this iterator is operating.
dtor