casacore
OrderedPair.h
Go to the documentation of this file.
1 //# OrderedPair.h: Ordered pair class
2 //# Copyright (C) 1993,1994,1995,1999
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_ORDEREDPAIR_H
29 #define CASA_ORDEREDPAIR_H
30 
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
34 
35 
36 namespace casacore { //# NAMESPACE CASACORE - BEGIN
37 
38 // <summary>Ordered pair class</summary>
39 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
40 // </reviewed>
41 // <use visibility=local>
42 
43 // <synopsis>
44 // This class is a simple class used in the Map<key,value> classes
45 // to manage key/value pairs for maps.
46 // The default constructor is needed for use in containers.
47 // This implies that ALL classes ever used in OrderedPair should
48 // have a default constructor!!!!
49 //
50 // <note>
51 // This should probably be cleaned up in the future and made into a
52 // generally useful class.
53 // </note>
54 // </synopsis>
55 
56 
57 template<class K, class V> class OrderedPair
58 {
59 public:
60  //
61  // Needed for "operator>>(AipsIO &ios, Slist<elem> &list)"
62  //
63  OrderedPair();
64 
65  //
66  // This is the "standard" constructor which takes a key and
67  // a value and constructs an ordered pair.
68  //
69  OrderedPair(const K &k, const V &v);
70 
71  //
72  // Copy constructor (copy semantics).
73  //
74  OrderedPair(const OrderedPair<K,V>& that);
75 
76  //
77  // Assignment (copy semantics).
78  //
80 
81  // Get access to the key or value.
82  // <group>
83  K &x() {return Key;}
84  const K &x() const {return Key;}
85  V &y() {return Val;}
86  const V &y() const {return Val;}
87  // </group>
88 
89 private:
90  K Key;
91  V Val;
92 
93  enum {OrderedPairVersion = 1};
94 };
95 
96 
97 } //# NAMESPACE CASACORE - END
98 
99 #ifndef CASACORE_NO_AUTO_TEMPLATES
100 #include <casacore/casa/Containers/OrderedPair.tcc>
101 #endif //# CASACORE_NO_AUTO_TEMPLATES
102 #endif
Ordered pair class.
Definition: OrderedPair.h:57
const V & y() const
Definition: OrderedPair.h:86
OrderedPair()
Needed for "operator>>(AipsIO &ios, Slist<elem> &list)".
K & x()
Get access to the key or value.
Definition: OrderedPair.h:83
const K & x() const
Definition: OrderedPair.h:84
this file contains all the compiler specific defines
Definition: mainpage.dox:28
OrderedPair< K, V > & operator=(const OrderedPair< K, V > &that)
Assignment (copy semantics).