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>
Const associative array iterator.
virtual ConstMapIter< key, value > & operator=(const Map< key, value > &other)
Assign one map iterator to a map (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 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).
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.
MapIterRep< key, value > * Rep
virtual void operator++()
Advance to the next element of the Map.
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 Map< key, value > & container() const
Returns the container on which this iterator is operating.
virtual const value & getVal() const
virtual const key & getKey() const
Get the key or value for the current position in the Map.
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 ConstMapIter< key, value > & operator=(const Map< key, value > *other)
virtual ConstMapIter< key, value > & operator=(const ConstMapIter< key, value > &other)
Assign one map iterator to another iterator (with reference semantics).
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 const key & getKey() const =0
Get the key for the current position in the Map.
value * isDefined(const key &ky)
virtual void operator++(int)=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.
virtual MapIterRep< key, value > * Clone()=0
Duplicate a map iterator.
virtual const value & getVal() const =0
const value & operator()(const key &ky) const
Allows mapping functions to be performed with the map on which this iterator operates.
value & define(const key &ky, const value &val)
These functions allow for the definition and removal of key/value relations.
Map< key, value > & container()
Returns the container on which this iterator is operating.
virtual Bool isValid() const =0
Check to see if the iterator is in a valid state.
virtual value & getVal()=0
Return the value at the current location of the map iterator.
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 void operator++()=0
Advance to the next element of the Map.
uInt ndefined() const
Returns the number of user defined mappings.
const value & defaultVal() const
This returns the default value for the map that this iterator is tracking.
virtual void toStart()=0
Move the iterator to the start of the Map.
const Map< key, value > & container() const
value & operator()(const key &ky)
MapIterRep(Map< key, value > &st)
This allows a MapIter to be constructed from a Map.
Associative array iterator.
const Map< key, value > & container() const
MapIter(Map< key, value > &st)
value * isDefined(const key &ky)
value & operator()(const key &ky)
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.
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 > *)
value & define(const key &ky, const value &val)
These functions allow for the definition and removal of key/value relations.
MapIter(const MapIter< key, value > &other)
This allows a MapIter to be constructed from another MapIter.
virtual value & getVal()
Return the value at the current location of the map iterator.
virtual MapIter< key, value > & operator=(Map< key, value > *other)
MapIter(const MapIter< key, value > *other)
void clear()
Clear all of the mappings.
virtual MapIter< key, value > & operator=(const MapIter< key, value > &other)
This assignment operator allows the Map which this MapIter tracks to be changed.
MapIter(Map< key, value > *other)
This allows a MapIter to be constructed from a Map.
void remove(const key &ky)
virtual MapIter< key, value > & operator=(Map< key, value > &other)
This assignment operator allows the Map which this MapIter tracks to be changed.
Map< key, value > & container()
Returns the container on which this iterator is operating.
virtual MapIter< key, value > & operator=(const MapIter< key, value > *other)
MapIter()
Default constructor creates an invalid Map iterator.
virtual const value & getVal() const
ConstMapIter< key, value > & operator=(const ConstMapIter< key, value > &)
Assign one map iterator to another iterator (with reference semantics).
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.
ConstMapIter< key, value > & operator=(const ConstMapIter< key, value > *)
value & defaultVal()
Returns the default value for the Map.
virtual uInt ndefined() const =0
Returns the number of user defined mappings.
virtual const value * isDefined(const key &) const =0
Returns a non-zero value if a mapping is defined for the key parameter.
virtual MapIterRep< key, value > * getRep(Map< key, value > *) const =0
virtual ~MapRep()
Does nothing.
virtual value & define(const key &, const value &)=0
These functions allow for the definition and removal of key/value relations.
value & operator()(const key &ky)
This is the mapping function which maps keys to values.
virtual void remove(const key &)=0
const value & operator()(const key &ky) const
virtual value * isDefined(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.
const value & defaultVal() const
MapRep(const value &dflt)
This is the only MapRep constructor.
virtual MapRep< key, value > * Clone() const =0
Abstract base class for associative arrays.
Map(MapRep< key, value > *nRep)
Used by derived classes.
const value & operator()(const key &ky) const
value & operator()(const key &ky)
This is the mapping function which maps keys to values.
const value * isDefined(const key &k) const
Returns a non-zero value if a mapping is defined for the key parameter.
const value & defaultVal() const
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.
MapRep< key, value > * Rep
Map< key, value > & operator=(const Map< key, value > &)
void SetRep(MapRep< key, value > *st)
Used the set the representation.
value & define(const key &k, const value &v)
These functions allow for the definition and removal of key/value relations.
MapIterRep< key, value > * getRep() const
Returns the iterator rep appropriate for this particular Map.
void remove(const key &k)
value & defaultVal()
Returns the default value for the Map.
uInt ndefined() const
Returns the number of user defined mappings.
value * isDefined(const key &k)
ConstMapIter< key, value > * getIter() const
Map< key, value > & operator=(const Map< key, value > *)
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.