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