casa
$Rev:20696$
|
00001 //# OrderedPair.h: Ordered pair class 00002 //# Copyright (C) 1993,1994,1995,1999 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# $Id: OrderedPair.h 20551 2009-03-25 00:11:33Z Malte.Marquarding $ 00027 00028 #ifndef CASA_ORDEREDPAIR_H 00029 #define CASA_ORDEREDPAIR_H 00030 00031 00032 //# Includes 00033 #include <casa/aips.h> 00034 00035 00036 namespace casa { //# NAMESPACE CASA - BEGIN 00037 00038 // <summary>Ordered pair class</summary> 00039 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos=""> 00040 // </reviewed> 00041 // <use visibility=local> 00042 00043 // <synopsis> 00044 // This class is a simple class used in the Map<key,value> classes 00045 // to manage key/value pairs for maps. 00046 // The default constructor is needed for use in containers. 00047 // This implies that ALL classes ever used in OrderedPair should 00048 // have a default constructor!!!! 00049 // 00050 // <note> 00051 // This should probably be cleaned up in the future and made into a 00052 // generally useful class. 00053 // </note> 00054 // </synopsis> 00055 00056 00057 template<class K, class V> class OrderedPair 00058 { 00059 public: 00060 // 00061 // Needed for "operator>>(AipsIO &ios, Slist<elem> &list)" 00062 // 00063 OrderedPair(); 00064 00065 // 00066 // This is the "standard" constructor which takes a key and 00067 // a value and constructs an ordered pair. 00068 // 00069 OrderedPair(const K &k, const V &v); 00070 00071 // 00072 // Copy constructor (copy semantics). 00073 // 00074 OrderedPair(const OrderedPair<K,V>& that); 00075 00076 // 00077 // Assignment (copy semantics). 00078 // 00079 OrderedPair<K,V>& operator= (const OrderedPair<K,V>& that); 00080 00081 // Get access to the key or value. 00082 // <group> 00083 K &x() {return Key;} 00084 const K &x() const {return Key;} 00085 V &y() {return Val;} 00086 const V &y() const {return Val;} 00087 // </group> 00088 00089 private: 00090 K Key; 00091 V Val; 00092 00093 enum {OrderedPairVersion = 1}; 00094 }; 00095 00096 00097 } //# NAMESPACE CASA - END 00098 00099 #ifndef CASACORE_NO_AUTO_TEMPLATES 00100 #include <casa/Containers/OrderedPair.tcc> 00101 #endif //# CASACORE_NO_AUTO_TEMPLATES 00102 #endif