31 #ifndef AIPS_USE_DEPRECATED
32 #error "Map.h is deprecated; use -DBUILD_DEPRECATED=ON to use it"
42 #define AIPS_STUPID_SUN 1
56 template<
class key,
class value>
class Map;
62 template<
class key,
class value>
class MapRep {
118 virtual void remove(
const key &) = 0;
124 virtual void clear() = 0;
155 template<
class key,
class value>
class Map
207 void remove(
const key &k);
240 #if defined(AIPS_STUPID_SUN)
277 template<
class key,
class value>
class MapIterRep {
311 virtual const key &
getKey()
const = 0;
341 void remove(
const key &ky);
391 virtual MapIterRep<key,value> *
Clone() = 0;
463 virtual const key &
getKey()
const;
613 return(this->
Rep->define(ky,val));
615 void remove(
const key &ky) {
618 this->
Rep->remove(ky);
635 return this->
Rep->defaultVal();
662 return(this->
Rep->operator()(ky));
681 return(this->
Rep->isDefined(ky));
746 return(this->
Rep->container());}
780 #ifndef CASACORE_NO_AUTO_TEMPLATES
781 #include <casacore/casa/Containers/Map.tcc>
782 #endif //# CASACORE_NO_AUTO_TEMPLATES
virtual MapIter< key, value > & operator=(Map< key, value > &other)
This assignment operator allows the Map which this MapIter tracks to be changed.
virtual void toStart()=0
Move the iterator to the start of the Map.
virtual void operator++()=0
Advance to the next element of the Map.
ConstMapIter(MapIterRep< key, value > *st)
Dummy used to initialization by derived classes.
Map< key, value > & container()
Returns the container on which this iterator is operating.
MapIterRep< key, value > * getRep() const
Returns the iterator rep appropriate for this particular Map.
Abstract base class for associative array iterators.
const value & operator()(const key &ky) const
Allows mapping functions to be performed with the map on which this iterator operates.
value & operator()(const key &ky)
This is the mapping function which maps keys to values.
const Map< key, value > & container() const
void throw_map_init_error()
virtual const value * isDefined(const key &) const =0
Returns a non-zero value if a mapping is defined for the key parameter.
virtual Bool atStart() const
value & defaultVal()
Returns the default value for the Map.
MapRep(const value &dflt)
This is the only MapRep constructor.
value & define(const key &ky, const value &val)
These functions allow for the definition and removal of key/value relations.
value & define(const key &k, const value &v)
These functions allow for the definition and removal of key/value relations.
virtual void operator++()
Advance to the next element of the Map.
void SetRep(MapRep< key, value > *st)
Used the set the representation.
ConstMapIter< key, value > & operator=(const ConstMapIter< key, value > &)
Assign one map iterator to another iterator (with reference semantics).
MapIter()
Default constructor creates an invalid Map iterator.
virtual const value & getVal() const
value & defaultVal()
Returns the default value for the Map.
ConstMapIter< key, value > & operator=(const Map< key, value > &)
Assign one map iterator to a map (with reference semantics).
ConstMapIter()
Default constructor creates an invalid Map iterator.
virtual Bool atEnd() const
Check to see if the iterator position is at the end or beginning of the Map.
uInt ndefined() const
Returns the number of user defined mappings.
virtual uInt ndefined() const =0
Returns the number of user defined mappings.
const value & defaultVal() const
This returns the default value for the map that this iterator is tracking.
const value * isDefined(const key &ky) const
Allows one to check to see if a given key is defined in the map which this iterator tracks...
MapIter(const MapIter< key, value > &other)
This allows a MapIter to be constructed from another MapIter.
void throw_map_constop_error()
virtual Bool atStart() const =0
virtual MapRep< key, value > * Clone() const =0
void throw_invalid_mapiter_error()
value & define(const key &ky, const value &val)
These functions allow for the definition and removal of key/value relations.
Map(const Map< key, value > &m)
This copy constructor will, for the moment, be the only way to create a map.
const Map< key, value > & container() const
Returns the container on which this iterator is operating.
value & operator()(const key &ky)
void clear()
Clear all of the mappings.
value DefaultVal
This is the default value which is return when no match is found.
MapIter(Map< key, value > *other)
This allows a MapIter to be constructed from a Map.
virtual ~MapRep()
Does nothing.
value & operator()(const key &ky)
This is the mapping function which maps keys to values.
bool Bool
Define the standard types used by Casacore.
const value & operator()(const key &ky) const
Allows mapping functions to be performed with the map on which this iterator operates.
virtual Bool isValid() const =0
Check to see if the iterator is in a valid state.
MapIter(Map< key, value > &st)
virtual value & define(const key &, const value &)=0
These functions allow for the definition and removal of key/value relations.
ConstMapIter< key, value > & operator=(const Map< key, value > *)
Map< key, value > * Container
MapIter(const MapIter< key, value > *other)
Associative array iterator.
virtual value & getVal()
Return the value at the current location of the map iterator.
ConstMapIter< key, value > & operator=(const ConstMapIter< key, value > *)
Map< key, value > & container()
Returns the container on which this iterator is operating.
MapRep< key, value > * Rep
void clear()
Clear all of the mappings.
virtual value & getVal()=0
Return the value at the current location of the map iterator.
const value & defaultVal() const
Returns the default value for the Map on which this iterator is operating if it is a valid iterator...
Map representation class.
virtual const key & getKey() const
Get the key or value for the current position in the Map.
Abstract base class for associative arrays.
void throw_mapiter_init_error()
Const associative array iterator.
const value & operator()(const key &ky) const
Allows mapping functions to be performed with the map on which this iterator operates.
virtual const key & getKey() const =0
Get the key for the current position in the Map.
virtual Bool atEnd() const =0
Check to see if the iterator position is at the end or beginning of the Map.
ConstMapIter< key, value > * getIter() const
uInt ndefined() const
Returns the number of user defined mappings.
MapIterRep< key, value > * Rep
const value * isDefined(const key &k) const
Returns a non-zero value if a mapping is defined for the key parameter.
virtual MapIterRep< key, value > * Clone()=0
Duplicate a map iterator.
virtual void toStart()
Move the iterator to the start of the Map.
uInt ndefined() const
Returns the number of user defined mappings.
virtual Bool isValid() const
Check to see if the iterator is in a valid state.
virtual MapIterRep< key, value > * getRep(Map< key, value > *) const =0
const value & defaultVal() const
This returns the default value for the map that this iterator is tracking.
void clear()
Clear all of the mappings.
MapIterRep(Map< key, value > &st)
This allows a MapIter to be constructed from a Map.
void SetRep(MapIterRep< key, value > *st)
Always DELETES Rep if necessary.
value * isDefined(const key &ky)
Map< key, value > & operator=(const Map< key, value > &)
const value & defaultVal() const
const value * isDefined(const key &ky) const
Allows one to check to see if a given key is defined in the map which this iterator tracks...
const value * isDefined(const key &ky) const
Allows one to check to see if a given key is defined in the map which this iterator tracks...
virtual void clear()=0
Clear all of the mappings.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
virtual ConstMapIter< key, value > & operator=(const Map< key, value > &other)
Assign one map iterator to a map (with reference semantics).
#define casacore
<X11/Intrinsic.h> #defines true, false, casacore::Bool, and String.