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 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);
238 enum {MapVersion = 1};
240 #if defined(AIPS_STUPID_SUN) 277 template<
class key,
class value>
class MapIterRep {
283 virtual Bool isValid()
const = 0;
290 virtual Bool atEnd()
const = 0;
291 virtual Bool atStart()
const = 0;
297 virtual void toStart() = 0;
303 virtual void operator++() = 0;
304 virtual void operator++(
int) = 0;
311 virtual const key &getKey()
const = 0;
319 virtual value &getVal() = 0;
320 virtual const value &getVal()
const = 0;
341 void remove(
const key &ky);
407 enum {MapIterRepVersion = 1};
448 virtual void toStart();
454 virtual void operator++();
455 virtual void operator++(
int);
463 virtual const key &getKey()
const;
464 virtual const value &getVal()
const;
472 virtual Bool atEnd()
const;
473 virtual Bool atStart()
const;
479 virtual Bool isValid()
const;
554 enum {ConstMapIterVersion = 1};
598 virtual value &getVal();
600 virtual const value &getVal()
const;
611 if (!this->isValid())
613 return(this->Rep->define(ky,val));
615 void remove(
const key &ky) {
616 if (!this->isValid())
618 this->Rep->remove(ky);
633 if (!this->isValid())
635 return this->Rep->defaultVal();
643 if (!this->isValid())
660 if (!this->isValid())
662 return(this->Rep->operator()(ky));
679 if (!this->isValid())
681 return(this->Rep->isDefined(ky));
746 return(this->Rep->container());}
753 enum {MapIterVersion = 1};
780 #ifndef CASACORE_NO_AUTO_TEMPLATES 781 #include <casacore/casa/Containers/Map.tcc> 782 #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.