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