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