casacore
Loading...
Searching...
No Matches
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>
37#include <casacore/casa/Exceptions/Error.h>
38
39//
40// Work around bugs in SUN\'s stupid compiler
41//
42#define AIPS_STUPID_SUN 1
43
44namespace casacore { //#Begin casa namespace
45
46//# Forward Declarations
47class AipsIO;
48
53
54template<class key, class value> class MapIterRep;
55template<class key, class value> class ConstMapIter;
56template<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
62template<class key, class value> class MapRep {
63public:
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
127
128 virtual MapRep<key,value> *Clone() const = 0;
129
130 //
131 // Does nothing.
132 //
133 virtual ~MapRep();
134
135 enum {MapRepVersion = 1};
136
137protected:
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//
155template<class key, class value> class Map
156{
157public:
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
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 //
219
220 //
221 // This copy constructor will, for the moment, be the only
222 // way to create a map.
223 //
224 //+grp
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
244protected:
245
247
248 //
249 // Used by derived classes
250 //
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//
277template<class key, class value> class MapIterRep {
278public:
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;
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
384 const Map<key,value> &container() const;
385 //-grp
386
387 //
388 // Duplicate a map iterator
389 //
390 //+grp
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
403 //-grp
404
405 virtual ~MapIterRep();
406
408
409protected:
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//
441template<class key, class value> class ConstMapIter
442{
443public:
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
487 //-grp
488
489 //
490 // Assign one map iterator to a map (with reference semantics).
491 //
492 //+grp
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 //
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
556protected:
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//
589template<class key, class value> class MapIter : virtual public ConstMapIter<key,value> {
590public:
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
705 ConstMapIter<key,value>(other.isValid() ? other.Rep->Clone() : 0) {}
706
708 ConstMapIter<key,value>(other && (*other).isValid() ? other->Rep->Clone() : 0) {}
709 //-grp
710
711 //
712 // Default constructor creates an invalid Map iterator.
713 //
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
736
738 //-grp
739
740 //
741 // Returns the container on which this iterator is
742 // operating.
743 //
744 //+grp
746 return(this->Rep->container());}
749 //-grp
750
752
753 enum {MapIterVersion = 1};
754
755protected:
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
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
Const associative array iterator.
Definition Map.h:442
virtual ConstMapIter< key, value > & operator=(const ConstMapIter< key, value > &other)
Assign one map iterator to another iterator (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.
Definition Map.h:517
virtual ConstMapIter< key, value > & operator=(const Map< key, value > *other)
virtual const key & getKey() const
Get the key or value for the current position in the Map.
virtual Bool atStart() const
void SetRep(MapIterRep< key, value > *st)
Always DELETES Rep if necessary.
Definition Map.h:567
ConstMapIter(const ConstMapIter< key, value > *st)
Constructs a Map iterator from another iterator (with reference semantics).
MapIterRep< key, value > * Rep
Definition Map.h:557
virtual void operator++()
Advance to the next element of the Map.
virtual ConstMapIter< key, value > & operator=(const Map< key, value > &other)
Assign one map iterator to a map (with reference semantics).
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 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 Map< key, value > & container() const
Returns the container on which this iterator is operating.
virtual const value & getVal() const
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.
Definition Map.h:562
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.
Definition Map.h:277
virtual Bool atStart() const =0
virtual void operator++(int)=0
const Map< key, value > & container() const
virtual const key & getKey() const =0
Get the key for the current position in the Map.
Map< key, value > & container()
Returns the container on which this iterator is operating.
value * isDefined(const key &ky)
virtual Bool isValid() const =0
Check to see if the iterator is in a valid state.
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
Definition Map.h:411
void remove(const key &ky)
virtual value & getVal()=0
Return the value at the current location of the map iterator.
virtual void operator++()=0
Advance to the next element of the Map.
uInt ndefined() const
Returns the number of user defined mappings.
virtual MapIterRep< key, value > * Clone()=0
Duplicate a map iterator.
virtual void toStart()=0
Move the iterator to the start of the Map.
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.
value & define(const key &ky, const value &val)
These functions allow for the definition and removal of key/value relations.
MapIterRep(Map< key, value > &st)
This allows a MapIter to be constructed from a Map.
virtual const value & getVal() const =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.
value & operator()(const key &ky)
Associative array iterator.
Definition Map.h:589
MapIter(Map< key, value > &st)
Definition Map.h:694
ConstMapIter< key, value > & operator=(const Map< key, value > &)
Assign one map iterator to a map (with reference semantics).
Definition Map.h:763
ConstMapIter< key, value > & operator=(const Map< key, value > *)
Definition Map.h:766
virtual MapIter< key, value > & operator=(Map< key, value > &other)
This assignment operator allows the Map which this MapIter tracks to be changed.
const value & defaultVal() const
This returns the default value for the map that this iterator is tracking.
Definition Map.h:628
value & operator()(const key &ky)
Definition Map.h:659
virtual value & getVal()
Return the value at the current location of the map iterator.
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 MapIter< key, value > & operator=(const MapIter< key, value > *other)
virtual MapIter< key, value > & operator=(Map< key, value > *other)
virtual const value & getVal() const
Map< key, value > & container()
Returns the container on which this iterator is operating.
Definition Map.h:745
ConstMapIter< key, value > & operator=(const ConstMapIter< key, value > *)
Definition Map.h:772
MapIter(const MapIter< key, value > &other)
This allows a MapIter to be constructed from another MapIter.
Definition Map.h:704
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
MapIter(const MapIter< key, value > *other)
Definition Map.h:707
void clear()
Clear all of the mappings.
Definition Map.h:642
ConstMapIter< key, value > & operator=(const ConstMapIter< key, value > &)
Assign one map iterator to another iterator (with reference semantics).
Definition Map.h:769
const Map< key, value > & container() const
Definition Map.h:747
value * isDefined(const key &ky)
Definition Map.h:678
value & defaultVal()
Definition Map.h:632
MapIter(Map< key, value > *other)
This allows a MapIter to be constructed from a Map.
Definition Map.h:692
void remove(const key &ky)
Definition Map.h:615
value & define(const key &ky, const value &val)
These functions allow for the definition and removal of key/value relations.
Definition Map.h:610
MapIter()
Default constructor creates an invalid Map iterator.
Definition Map.h:714
virtual MapIter< key, value > & operator=(const MapIter< key, value > &other)
This assignment operator allows the Map which this MapIter tracks to be changed.
virtual MapIterRep< key, value > * getRep(Map< key, value > *) const =0
virtual uInt ndefined() const =0
Returns the number of user defined mappings.
value & defaultVal()
Returns the default value for the Map.
Definition Map.h:92
virtual MapRep< key, value > * Clone() const =0
const value & defaultVal() const
Definition Map.h:93
virtual const value * isDefined(const key &) const =0
Returns a non-zero value if a mapping is defined for the key parameter.
virtual ~MapRep()
Does nothing.
virtual value * isDefined(const key &)=0
virtual value & define(const key &, const value &)=0
These functions allow for the definition and removal of key/value relations.
virtual void remove(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.
Definition Map.h:141
MapRep(const value &dflt)
This is the only MapRep constructor.
Definition Map.h:69
const value & operator()(const key &ky) const
value & operator()(const key &ky)
This is the mapping function which maps keys to values.
Abstract base class for associative arrays.
Definition Map.h:156
Map(MapRep< key, value > *nRep)
Used by derived classes.
value * isDefined(const key &k)
const value * isDefined(const key &k) const
Returns a non-zero value if a mapping is defined for the key parameter.
virtual ~Map()
Map< key, value > & operator=(const Map< key, value > *)
Map< key, value > & operator=(const Map< key, value > &)
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.
const value & operator()(const key &ky) const
MapRep< key, value > * Rep
Definition Map.h:246
const value & defaultVal() const
void SetRep(MapRep< key, value > *st)
Used the set the representation.
Definition Map.h:257
@ MapVersion
Definition Map.h:238
MapIterRep< key, value > * getRep() const
Returns the iterator rep appropriate for this particular Map.
value & operator()(const key &ky)
This is the mapping function which maps keys to values.
value & defaultVal()
Returns the default value for the Map.
void remove(const key &k)
value & define(const key &k, const value &v)
These functions allow for the definition and removal of key/value relations.
uInt ndefined() const
Returns the number of user defined mappings.
ConstMapIter< key, value > * getIter() const
void clear()
Clear all of the mappings.
this file contains all the compiler specific defines
Definition mainpage.dox:28
void throw_invalid_mapiter_error()
void throw_map_constop_error()
unsigned int uInt
Definition aipstype.h:51
void throw_mapiter_init_error()
void throw_map_init_error()
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:42
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.