casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Map.h
Go to the documentation of this file.
1 //# Map.h: Associative array classes
2 //# Copyright (C) 1994,1995,1999,2000
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 #ifndef CASA_MAP_H
29 #define CASA_MAP_H
30 
31 #ifndef AIPS_USE_DEPRECATED
32 #error "Map.h is deprecated; use -DBUILD_DEPRECATED=ON to use it"
33 #endif
34 
35 //# Includes
36 #include <casacore/casa/aips.h>
38 
39 //
40 // Work around bugs in SUN\'s stupid compiler
41 //
42 #define AIPS_STUPID_SUN 1
43 
44 namespace casacore { //#Begin casa namespace
45 
46 //# Forward Declarations
47 class AipsIO;
48 
49 extern void throw_mapiter_init_error();
50 extern void throw_map_init_error();
51 extern void throw_invalid_mapiter_error();
52 extern void throw_map_constop_error();
53 
54 template<class key, class value> class MapIterRep;
55 template<class key, class value> class ConstMapIter;
56 template<class key, class value> class Map;
57 
58 // <summary>Map representation class </summary>
59 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
60 // </reviewed>
61 
62 template<class key, class value> class MapRep {
63 public:
64 
65  //
66  // This is the only MapRep constructor. It takes as a parameter the
67  // default value for the map.
68  //
69  MapRep(const value &dflt) : DefaultVal(dflt) { }
70 
71  //
72  // This is the mapping function which maps keys to values. If the
73  // map from the key to a value is not defined, a mapping will be
74  // defined from the key to the default value (which is set from
75  // the constructor. The "isDefined()" member function can be used
76  // to check to see if a mapping is defined before using the
77  // "operator()()".
78  //
79  // <note> With a constant map in the case where the key is not
80  // defined, the mapping between key and default value is
81  // not created, but rather an exception is thrown.
82  // </note>
83  //+grp
84  value &operator()(const key &ky);
85  const value &operator()(const key &ky) const;
86  //-grp
87 
88  //
89  // Returns the default value for the Map.
90  //
91  //+grp
93  const value &defaultVal() const {return DefaultVal;}
94  //-grp
95 
96  //
97  // Returns a non-zero value if a mapping is defined for
98  // the key parameter.
99  //
100  //+grp
101  virtual const value *isDefined(const key &) const = 0;
102  virtual value *isDefined(const key &) = 0;
103  //-grp
104 
105  //
106  // Returns the number of user defined mappings
107  //
108  virtual uInt ndefined() const = 0;
109 
110  //
111  // These functions allow for the definition and removal of key/value
112  // relations. The "define(key &, value &)" call defines a key/value
113  // relation, and "remove(key &)" removes a relation if it has
114  // been previously defined.
115  //
116  //+grp
117  virtual value &define(const key &, const value &) = 0;
118  virtual void remove(const key &) = 0;
119  //-grp
120 
121  //
122  // Clear all of the mappings.
123  //
124  virtual void clear() = 0;
125 
126  virtual MapIterRep<key,value> *getRep(Map<key,value>*) const = 0;
127 
128  virtual MapRep<key,value> *Clone() const = 0;
129 
130  //
131  // Does nothing.
132  //
133  virtual ~MapRep();
134 
135  enum {MapRepVersion = 1};
136 
137 protected:
138 
139  // This is the default value which is return when no match is found.
140  // This prevents this class from being a PartialMap.
142 
143 };
144 
145 
146 //
147 // <category lib=aips sect="Containers">
148 // <summary>Abstract base class for associative arrays</summary>
149 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
150 // </reviewed>
151 //
152 // This is the abstract class for all "Map" classes which implement the
153 // equivalent of an associative array.
154 //
155 template<class key, class value> class Map
156 {
157 public:
158 
159  //
160  // This is the mapping function which maps keys to values. If the
161  // map from the key to a value is not defined, a mapping will be
162  // defined from the key to the default value (which is set from
163  // the constructor. The "isDefined()" member function can be used
164  // to check to see if a mapping is defined before using the
165  // "operator()()".
166  //
167  // <note> With a constant map in the case where the key is not
168  // defined, the mapping between key and default value is
169  // not created, but rather an exception is thrown.
170  // </note>
171  //+grp
172  value &operator()(const key &ky);
173  const value &operator()(const key &ky) const;
174  //-grp
175 
176 
177  //
178  // Returns the default value for the Map.
179  //
180  //+grp
181  value &defaultVal();
182  const value &defaultVal() const;
183  //-grp
184 
185  //
186  // Returns a non-zero value if a mapping is defined for
187  // the key parameter.
188  //
189  //+grp
190  const value *isDefined(const key &k) const;
191  value *isDefined(const key &k);
192  //-grp
193 
194  //
195  // Returns the number of user defined mappings
196  //
197  uInt ndefined() const;
198 
199  //
200  // These functions allow for the definition and removal of key/value
201  // relations. The "define(key &, value &)" call defines a key/value
202  // relation, and "remove(key &)" removes a relation if it has
203  // been previously defined.
204  //
205  //+grp
206  value &define(const key &k, const value &v);
207  void remove(const key &k);
208  //-grp
209 
210  //
211  // Clear all of the mappings.
212  //
213  void clear();
214 
215  //
216  // Returns the iterator rep appropriate for this particular Map
217  //
218  MapIterRep<key,value> *getRep() const;
219 
220  //
221  // This copy constructor will, for the moment, be the only
222  // way to create a map.
223  //
224  //+grp
225  Map(const Map<key,value> &m);
226  Map(const Map<key,value> *m);
227  //-grp
228 
231 
232  //*display 2
233  //
234  // Does nothing.
235  //
236  virtual ~Map();
237 
238  enum {MapVersion = 1};
239 
240 #if defined(AIPS_STUPID_SUN)
242 #endif
243 
244 protected:
245 
247 
248  //
249  // Used by derived classes
250  //
251  Map(MapRep<key,value> *nRep);
252 
253  //
254  // Used the set the representation.
255  // Always DELETES Rep if necessary.
256  //
258  if (Rep)
259  delete Rep;
260  Rep = st;
261  }
262 
263 };
264 
265 //
266 // <category lib=aips sect="Containers">
267 // <summary>Abstract base class for associative array iterators</summary>
268 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
269 // </reviewed>
270 //
271 // This is the abstract base class for all (Const)MapIter
272 // "letters". That is all Map specializations must provide
273 // a "IterRep" for the particular specialization which
274 // will allow the (Const)MapIter envelope to traverse the
275 // new type of map.
276 //
277 template<class key, class value> class MapIterRep {
278 public:
279 
280  //
281  // Check to see if the iterator is in a valid state.
282  //
283  virtual Bool isValid() const = 0;
284 
285  //
286  // Check to see if the iterator position is at the
287  // end or beginning of the Map.
288  //
289  //+grp
290  virtual Bool atEnd() const = 0;
291  virtual Bool atStart() const = 0;
292  //-grp
293 
294  //
295  // Move the iterator to the start of the Map.
296  //
297  virtual void toStart() = 0;
298 
299  //
300  // Advance to the next element of the Map.
301  //
302  //+grp
303  virtual void operator++() = 0;
304  virtual void operator++(int) = 0;
305  //-grp
306 
307  //
308  // Get the key for the current position in
309  // the Map.
310  //
311  virtual const key &getKey() const = 0;
312 
313  //
314  // Return the value at the current location of the map iterator.
315  // Should throw an exception if the iterator is "past the end of
316  // the Map" or if the iterator is invalid.
317  //
318  //+grp
319  virtual value &getVal() = 0;
320  virtual const value &getVal() const = 0;
321  //-grp
322 
323  //
324  // This returns the default value for the map that this iterator
325  // is tracking. With a non-const iterator the default value can
326  // be changed.
327  //
328  //+grp
329  const value &defaultVal() const;
330  value &defaultVal();
331  //-grp
332 
333  //
334  // These functions allow for the definition and removal of key/value
335  // relations. The "define(key &, value &)" function defines a key/value
336  // relation, and "remove(key &)" function removes a relation if it has
337  // been previously defined.
338  //
339  //+grp
340  value &define(const key &ky, const value &val);
341  void remove(const key &ky);
342  //-grp
343 
344  //
345  // Clear all of the mappings.
346  //
347  void clear();
348 
349 
350  //
351  // Allows mapping functions to be performed with the
352  // map on which this iterator operates. If this iterator
353  // is invalid, then an exception will be thrown. With
354  // a non-const operator, the value can be changed.
355  //
356  //+grp
357  const value &operator()(const key &ky) const;
358  value &operator()(const key &ky);
359  //-grp
360 
361  //
362  // Allows one to check to see if a given key is defined
363  // in the map which this iterator tracks. If this iterator
364  // is invalid, then an exception will be thrown. With
365  // a non-const iterator the returned pointer can be used
366  // to change the value in the map.
367  //
368  //+grp
369  const value *isDefined(const key &ky) const;
370  value *isDefined(const key &ky);
371  //-grp
372 
373  //
374  // Returns the number of user defined mappings
375  //
376  uInt ndefined() const;
377 
378  //
379  // Returns the container on which this iterator is
380  // operating.
381  //
382  //+grp
383  Map<key,value> &container();
384  const Map<key,value> &container() const;
385  //-grp
386 
387  //
388  // Duplicate a map iterator
389  //
390  //+grp
391  virtual MapIterRep<key,value> *Clone() = 0;
392  //-grp
393 
394  //
395  // This allows a MapIter to be constructed from a Map. When
396  // created the new MapIter maintains a reference to the original
397  // Map. If the Map to which this MapIter points is deleted, then
398  // the MapIter is marked as invalid.
399  //
400  //+grp
401  MapIterRep(Map<key,value> &st);
402  MapIterRep(Map<key,value> *st);
403  //-grp
404 
405  virtual ~MapIterRep();
406 
407  enum {MapIterRepVersion = 1};
408 
409 protected:
410 
412 
413 };
414 
415 //
416 // <category lib=aips sect="Containers">
417 // <summary>Const associative array iterator</summary>
418 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
419 // </reviewed>
420 //
421 // This class implements the mechanism for traversing constant
422 // associative arrays, i.e. "Map"s. This allows one to move
423 // the cursor to the beginning of the map and serially traverse
424 // the map. The key and value elements can be extracted at
425 // each position in the Map. For example:
426 // <code>
427 // template<class key,class value> void print(const Map<key,value> &xx){
428 // ConstMapIter<key,value> x(xx);
429 // x.toStart();
430 // while (!x.atEnd()) {
431 // cout << "(" << x.getKey() << "," << x.getVal() << ")" << " ";
432 // x++;
433 // }
434 // cout << endl;
435 // }
436 // </code>
437 // This example declares a templated function which accepts a const
438 // Map as a parameter, and iterates through the map displaying the
439 // key/value pairs at each positon.
440 //
441 template<class key, class value> class ConstMapIter
442 {
443 public:
444 
445  //
446  // Move the iterator to the start of the Map.
447  //
448  virtual void toStart();
449 
450  //
451  // Advance to the next element of the Map.
452  //
453  //+grp
454  virtual void operator++();
455  virtual void operator++(int);
456  //-grp
457 
458  //
459  // Get the key or value for the current position in
460  // the Map.
461  //
462  //+grp
463  virtual const key &getKey() const;
464  virtual const value &getVal() const;
465  //-grp
466 
467  //
468  // Check to see if the iterator position is at the
469  // end or beginning of the Map.
470  //
471  //+grp
472  virtual Bool atEnd() const;
473  virtual Bool atStart() const;
474  //-grp
475 
476  //
477  // Check to see if the iterator is in a valid state.
478  //
479  virtual Bool isValid() const;
480 
481  //
482  // Constructs a Map iterator from a Map (with reference semantics).
483  //
484  //+grp
485  ConstMapIter(const Map<key,value> *st);
486  ConstMapIter(const Map<key,value> &st);
487  //-grp
488 
489  //
490  // Assign one map iterator to a map (with reference semantics).
491  //
492  //+grp
493  virtual ConstMapIter<key,value> &operator=(const Map<key,value> &other);
494  virtual ConstMapIter<key,value> &operator=(const Map<key,value> *other);
495  //-grp
496 
497  //
498  // Constructs a Map iterator from another iterator (with reference semantics).
499  //
500  //+grp
503 
504  //-grp
505 
506  //
507  // Assign one map iterator to another iterator (with reference semantics).
508  //
509  //+grp
512  //-grp
513 
514  //
515  // Default constructor creates an invalid Map iterator.
516  //
517  ConstMapIter() : Rep(0) {}
518 
519 
520  //
521  // Returns the default value for the Map on which this
522  // iterator is operating if it is a valid iterator, otherwise
523  // it throws an exception.
524  //
525  const value &defaultVal() const;
526 
527  //
528  // Allows mapping functions to be performed with the
529  // map on which this iterator operates. If this iterator
530  // is invalid, then an exception will be thrown.
531  //
532  const value &operator()(const key &ky) const;
533 
534  //
535  // Allows one to check to see if a given key is defined
536  // in the map which this iterator tracks. If this iterator
537  // is invalid, then an exception will be thrown.
538  //
539  const value *isDefined(const key &ky) const;
540 
541  //
542  // Returns the number of user defined mappings
543  //
544  uInt ndefined() const;
545 
546  //
547  // Returns the container on which this iterator is
548  // operating.
549  //
550  const Map<key,value> &container() const;
551 
552  virtual ~ConstMapIter();
553 
555 
556 protected:
558 
559  //
560  // Dummy used to initialization by derived classes.
561  //
563 
564  //
565  // Always DELETES Rep if necessary
566  //
568  if (Rep)
569  delete Rep;
570  Rep = st;
571  }
572 
573 };
574 
575 
576 //#
577 //
578 // <category lib=aips sect="Containers">
579 // <summary>Associative array iterator</summary>
580 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
581 // </reviewed>
582 //
583 // This class implements the mechanism for traversing associative
584 // arrays, i.e. "Map"s. It provides the traversal mechanisms of the
585 // ConstMapIter, but adds the mechansims to modify the values, and
586 // perform other modification functions which the Maps provide, e.g.
587 // define().
588 //
589 template<class key, class value> class MapIter : virtual public ConstMapIter<key,value> {
590 public:
591 
592  //
593  // Return the value at the current location of the map iterator.
594  // Should throw an exception if the iterator is "past the end of
595  // the Map" or if the iterator is invalid.
596  //
597  //+grp
598  virtual value &getVal();
599 
600  virtual const value &getVal() const;
601  //-grp
602 
603  //
604  // These functions allow for the definition and removal of key/value
605  // relations. The "define(key &, value &)" function defines a key/value
606  // relation, and "remove(key &)" function removes a relation if it has
607  // been previously defined.
608  //
609  //+grp
610  value &define(const key &ky, const value &val) {
611  if (!this->isValid())
613  return(this->Rep->define(ky,val));
614  }
615  void remove(const key &ky) {
616  if (!this->isValid())
618  this->Rep->remove(ky);
619  }
620  //-grp
621 
622  //
623  // This returns the default value for the map that this iterator
624  // is tracking. With a non-const iterator the default value can
625  // be changed.
626  //
627  //+grp
628  const value &defaultVal() const {
630  }
631 
633  if (!this->isValid())
635  return this->Rep->defaultVal();
636  }
637  //-grp
638 
639  //
640  // Clear all of the mappings.
641  //
642  void clear() {
643  if (!this->isValid())
645  this->Rep->clear();
646  }
647 
648  //
649  // Allows mapping functions to be performed with the
650  // map on which this iterator operates. If this iterator
651  // is invalid, then an exception will be thrown. With
652  // a non-const operator, the value can be changed.
653  //
654  //+grp
655  const value &operator()(const key &ky) const {
657  }
658 
659  value &operator()(const key &ky) {
660  if (!this->isValid())
662  return(this->Rep->operator()(ky));
663  }
664  //-grp
665 
666  //
667  // Allows one to check to see if a given key is defined
668  // in the map which this iterator tracks. If this iterator
669  // is invalid, then an exception will be thrown. With
670  // a non-const iterator the returned pointer can be used
671  // to change the value in the map.
672  //
673  //+grp
674  const value *isDefined(const key &ky) const {
676  }
677 
678  value *isDefined(const key &ky) {
679  if (!this->isValid())
681  return(this->Rep->isDefined(ky));
682  }
683  //-grp
684 
685  //
686  // This allows a MapIter to be constructed from a Map. When
687  // created the new MapIter maintains a reference to the original
688  // Map. If the Map to which this MapIter points is deleted, then
689  // the MapIter is marked as invalid.
690  //
691  //+grp
693  ConstMapIter<key,value>(other ? other->getRep() : 0) {}
694  MapIter(Map<key,value> &st) : ConstMapIter<key,value>(st.getRep()) {}
695  //-grp
696 
697  //
698  // This allows a MapIter to be constructed from another MapIter.
699  // When created the new MapIter maintains a reference to the Map
700  // which the MapIter parameter tracked. If this Map is deleted, then
701  // this MapIter is marked as invalid.
702  //
703  //+grp
704  MapIter(const MapIter<key,value> &other) :
705  ConstMapIter<key,value>(other.isValid() ? other.Rep->Clone() : 0) {}
706 
707  MapIter(const MapIter<key,value> *other) :
708  ConstMapIter<key,value>(other && (*other).isValid() ? other->Rep->Clone() : 0) {}
709  //-grp
710 
711  //
712  // Default constructor creates an invalid Map iterator.
713  //
714  MapIter() : ConstMapIter<key,value>() {}
715 
716 
717  //
718  // This assignment operator allows the Map which this MapIter tracks
719  // to be changed. After a call to this operator, the MapIter will track
720  // the Map parameter.
721  //
722  //+grp
724 
726  //-grp
727 
728  //
729  // This assignment operator allows the Map which this MapIter tracks
730  // to be changed. After a call to this operator, this MapIter will track
731  // the Map which the MapIter parameter trackes, i.e. it will contain a
732  // reference to this new Map.
733  //
734  //+grp
735  virtual MapIter<key,value> &operator=(const MapIter<key,value> &other);
736 
737  virtual MapIter<key,value> &operator=(const MapIter<key,value> *other);
738  //-grp
739 
740  //
741  // Returns the container on which this iterator is
742  // operating.
743  //
744  //+grp
746  return(this->Rep->container());}
747  const Map<key,value> &container() const {
749  //-grp
750 
751  ~MapIter() {}
752 
753  enum {MapIterVersion = 1};
754 
755 protected:
756  //*display 4
757  //
758  // These assignment operators are private and ONLY throw an
759  // exception to prevent incorrect assignments to a non-const
760  // iterator.
761  //
762  //+grp
765  return *this;}
768  return *this;}
771  return *this;}
774  return *this;}
775  //-grp
776 
777 };
778 
779 } //#End casa namespace
780 #ifndef CASACORE_NO_AUTO_TEMPLATES
781 #include <casacore/casa/Containers/Map.tcc>
782 #endif //# CASACORE_NO_AUTO_TEMPLATES
783 #endif
virtual MapIter< key, value > & operator=(Map< key, value > &other)
This assignment operator allows the Map which this MapIter tracks to be changed.
virtual void toStart()=0
Move the iterator to the start of the Map.
virtual void operator++()=0
Advance to the next element of the Map.
ConstMapIter(MapIterRep< key, value > *st)
Dummy used to initialization by derived classes.
Definition: Map.h:562
Map< key, value > & container()
Returns the container on which this iterator is operating.
MapIterRep< key, value > * getRep() const
Returns the iterator rep appropriate for this particular Map.
Abstract base class for associative array iterators.
Definition: Map.h:54
const value & operator()(const key &ky) const
Allows mapping functions to be performed with the map on which this iterator operates.
value & operator()(const key &ky)
This is the mapping function which maps keys to values.
const Map< key, value > & container() const
Definition: Map.h:747
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.
virtual Bool atStart() const
value & defaultVal()
Returns the default value for the Map.
MapRep(const value &dflt)
This is the only MapRep constructor.
Definition: Map.h:69
value & define(const key &ky, const value &val)
These functions allow for the definition and removal of key/value relations.
Definition: Map.h:610
value & define(const key &k, const value &v)
These functions allow for the definition and removal of key/value relations.
virtual void operator++()
Advance to the next element of the Map.
void SetRep(MapRep< key, value > *st)
Used the set the representation.
Definition: Map.h:257
ConstMapIter< key, value > & operator=(const ConstMapIter< key, value > &)
Assign one map iterator to another iterator (with reference semantics).
Definition: Map.h:769
MapIter()
Default constructor creates an invalid Map iterator.
Definition: Map.h:714
virtual const value & getVal() const
value & defaultVal()
Returns the default value for the Map.
Definition: Map.h:92
ConstMapIter< key, value > & operator=(const Map< key, value > &)
Assign one map iterator to a map (with reference semantics).
Definition: Map.h:763
ConstMapIter()
Default constructor creates an invalid Map iterator.
Definition: Map.h:517
virtual Bool atEnd() const
Check to see if the iterator position is at the end or beginning of the Map.
uInt ndefined() const
Returns the number of user defined mappings.
virtual uInt ndefined() const =0
Returns the number of user defined mappings.
const value & defaultVal() const
This returns the default value for the map that this iterator is tracking.
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)
This allows a MapIter to be constructed from another MapIter.
Definition: Map.h:704
void throw_map_constop_error()
virtual Bool atStart() const =0
virtual MapRep< key, value > * Clone() const =0
void throw_invalid_mapiter_error()
value & define(const key &ky, const value &val)
These functions allow for the definition and removal of key/value relations.
Map(const Map< key, value > &m)
This copy constructor will, for the moment, be the only way to create a map.
const Map< key, value > & container() const
Returns the container on which this iterator is operating.
value & operator()(const key &ky)
Definition: Map.h:659
void clear()
Clear all of the mappings.
value & defaultVal()
Definition: Map.h:632
value DefaultVal
This is the default value which is return when no match is found.
Definition: Map.h:141
MapIter(Map< key, value > *other)
This allows a MapIter to be constructed from a Map.
Definition: Map.h:692
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.
Definition: aipstype.h:42
const value & operator()(const key &ky) const
Allows mapping functions to be performed with the map on which this iterator operates.
virtual Bool isValid() const =0
Check to see if the iterator is in a valid state.
MapIter(Map< key, value > &st)
Definition: Map.h:694
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 > *)
Definition: Map.h:766
Map< key, value > * Container
Definition: Map.h:411
MapIter(const MapIter< key, value > *other)
Definition: Map.h:707
Associative array iterator.
Definition: Map.h:589
virtual value & getVal()
Return the value at the current location of the map iterator.
ConstMapIter< key, value > & operator=(const ConstMapIter< key, value > *)
Definition: Map.h:772
Map< key, value > & container()
Returns the container on which this iterator is operating.
Definition: Map.h:745
MapRep< key, value > * Rep
Definition: Map.h:246
void clear()
Clear all of the mappings.
Definition: Map.h:642
virtual value & getVal()=0
Return the value at the current location of the map iterator.
const value & defaultVal() const
Returns the default value for the Map on which this iterator is operating if it is a valid iterator...
Map representation class.
Definition: Map.h:62
virtual ~Map()
virtual const key & getKey() const
Get the key or value for the current position in the Map.
Abstract base class for associative arrays.
Definition: Map.h:56
void throw_mapiter_init_error()
Const associative array iterator.
Definition: Map.h:55
const value & operator()(const key &ky) const
Allows mapping functions to be performed with the map on which this iterator operates.
Definition: Map.h:655
virtual const key & getKey() const =0
Get the key for the current position in the Map.
virtual Bool atEnd() const =0
Check to see if the iterator position is at the end or beginning of the Map.
ConstMapIter< key, value > * getIter() const
uInt ndefined() const
Returns the number of user defined mappings.
MapIterRep< key, value > * Rep
Definition: Map.h:557
const value * isDefined(const key &k) const
Returns a non-zero value if a mapping is defined for the key parameter.
virtual MapIterRep< key, value > * Clone()=0
Duplicate a map iterator.
virtual void toStart()
Move the iterator to the start of the Map.
uInt ndefined() const
Returns the number of user defined mappings.
virtual Bool isValid() const
Check to see if the iterator is in a valid state.
virtual MapIterRep< key, value > * getRep(Map< key, value > *) const =0
const value & defaultVal() const
This returns the default value for the map that this iterator is tracking.
Definition: Map.h:628
void clear()
Clear all of the mappings.
MapIterRep(Map< key, value > &st)
This allows a MapIter to be constructed from a Map.
void SetRep(MapIterRep< key, value > *st)
Always DELETES Rep if necessary.
Definition: Map.h:567
value * isDefined(const key &ky)
Definition: Map.h:678
Map< key, value > & operator=(const Map< key, value > &)
const value & defaultVal() const
Definition: Map.h:93
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 * isDefined(const key &ky) const
Allows one to check to see if a given key is defined in the map which this iterator tracks...
Definition: Map.h:674
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.
unsigned int uInt
Definition: aipstype.h:51
virtual ConstMapIter< key, value > & operator=(const Map< key, value > &other)
Assign one map iterator to a map (with reference semantics).
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42