33 #include <casacore/casa/aips.h> 34 #include <casacore/casa/Exceptions/Error.h> 39 #define AIPS_STUPID_SUN 1 53 template<
class key,
class value>
class Map;
59 template<
class key,
class value>
class MapRep {
115 virtual void remove(
const key &) = 0;
121 virtual void clear() = 0;
152 template<
class key,
class value>
class Map 204 void remove(
const key &k);
235 enum {MapVersion = 1};
237 #if defined(AIPS_STUPID_SUN) 274 template<
class key,
class value>
class MapIterRep {
280 virtual Bool isValid()
const = 0;
287 virtual Bool atEnd()
const = 0;
288 virtual Bool atStart()
const = 0;
294 virtual void toStart() = 0;
300 virtual void operator++() = 0;
301 virtual void operator++(
int) = 0;
308 virtual const key &getKey()
const = 0;
316 virtual value &getVal() = 0;
317 virtual const value &getVal()
const = 0;
338 void remove(
const key &ky);
404 enum {MapIterRepVersion = 1};
445 virtual void toStart();
451 virtual void operator++();
452 virtual void operator++(
int);
460 virtual const key &getKey()
const;
461 virtual const value &getVal()
const;
469 virtual Bool atEnd()
const;
470 virtual Bool atStart()
const;
476 virtual Bool isValid()
const;
551 enum {ConstMapIterVersion = 1};
595 virtual value &getVal();
597 virtual const value &getVal()
const;
608 if (!this->isValid())
610 return(this->Rep->define(ky,val));
612 void remove(
const key &ky) {
613 if (!this->isValid())
615 this->Rep->remove(ky);
630 if (!this->isValid())
632 return this->Rep->defaultVal();
640 if (!this->isValid())
657 if (!this->isValid())
659 return(this->Rep->operator()(ky));
676 if (!this->isValid())
678 return(this->Rep->isDefined(ky));
743 return(this->Rep->container());}
750 enum {MapIterVersion = 1};
777 #ifndef CASACORE_NO_AUTO_TEMPLATES 778 #include <casacore/casa/Containers/Map.tcc> 779 #endif //# CASACORE_NO_AUTO_TEMPLATES ConstMapIter(MapIterRep< key, value > *st)
Dummy used to initialization by derived classes.
Abstract base class for associative array iterators.
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.
MapRep(const value &dflt)
This is the only MapRep constructor.
PtrHolder< T > & operator=(const PtrHolder< T > &other)
value & define(const key &ky, const value &val)
These functions allow for the definition and removal of key/value relations.
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...
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.
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.
const Map< key, value > & container() const
virtual uInt ndefined() const =0
Returns the number of user defined mappings.
MapIter(const MapIter< key, value > &other)
This allows a MapIter to be constructed from another MapIter.
void throw_map_constop_error()
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 & defaultVal() const
virtual MapRep< key, value > * Clone() const =0
void throw_invalid_mapiter_error()
value & operator()(const key &ky)
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.
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.
ConstMapIter< key, value > & operator=(const ConstMapIter< key, value > *)
const value & operator()(const key &ky) const
Allows mapping functions to be performed with the map on which this iterator operates.
Map< key, value > & container()
Returns the container on which this iterator is operating.
MapRep< key, value > * Rep
void clear()
Clear all of the mappings.
Map representation class.
Abstract base class for associative arrays.
void throw_mapiter_init_error()
Const associative array iterator.
const value & defaultVal() const
Returns the default value for the Map on which this iterator is operating if it is a valid iterator...
const value & operator()(const key &ky) const
Allows mapping functions to be performed with the map on which this iterator operates.
MapIterRep< key, value > * Rep
const value & defaultVal() const
This returns the default value for the map that this iterator is tracking.
virtual MapIterRep< key, value > * getRep(Map< key, value > *) const =0
void SetRep(MapIterRep< key, value > *st)
Always DELETES Rep if necessary.
value * isDefined(const key &ky)
this file contains all the compiler specific defines
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.