Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.atnf.csiro.au/computing/software/casacore/casacore-1.2.0/doc/html/Compare_8h_source.html
Дата изменения: Unknown Дата индексирования: Mon Feb 14 19:51:24 2011 Кодировка: Поисковые слова: п п п п п п п п п п п п п п п п п п п п п п п |
00001 //# Compare.h: compare two objects of the same type 00002 //# Copyright (C) 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: Compare.h 20551 2009-03-25 00:11:33Z Malte.Marquarding $ 00027 00028 #ifndef CASA_COMPARE_H 00029 #define CASA_COMPARE_H 00030 00031 //# Includes 00032 #include <casa/aips.h> 00033 #include <casa/Utilities/DataType.h> 00034 00035 namespace casa { //# NAMESPACE CASA - BEGIN 00036 00037 // <summary> signature of comparison functions </summary> 00038 // <use visibility=export> 00039 // <reviewed reviewer="Friso Olnon" date="1995/02/24" tests="" demos=""> 00040 00041 // <synopsis> 00042 // This typedef defines the signature of the comparison functions used 00043 // in, for instance, the <linkto class="Sort">Sort</linkto> class: functions 00044 // with two <src>const void*</src> arguments returning an 00045 // <src>int</src> value. One such function is defined in the 00046 // <linkto class="ObjCompare">ObjCompare</linkto> class. 00047 // </synopsis> 00048 00049 // <group name=ObjCompareFunc> 00050 typedef int ObjCompareFunc (const void*, const void*); 00051 // </group> 00052 00053 // <summary> compare two objects </summary> 00054 // <use visibility=export> 00055 // <reviewed reviewer="Friso Olnon" date="1995/02/24" tests="" demos=""> 00056 00057 // <synopsis> 00058 // The templated class <src>ObjCompare<T></src> really is only a place 00059 // holder for the static function <src>compare</src> which compares two 00060 // objects of type T. 00061 // </synopsis> 00062 00063 // <templating arg=T> 00064 // <li> operator== 00065 // <li> operator< 00066 // </templating> 00067 00068 template<class T> class ObjCompare 00069 { 00070 public: 00071 // Compare two objects, and return 00072 // <ul> 00073 // <li> -1 if obj1 < obj2; 00074 // <li> 0 if obj1 == obj2; 00075 // <li> 1 otherwise. 00076 // </ul> 00077 // The function is not inlined allowing one to take the address of 00078 // it. Furthermore, the function's signature agrees with 00079 // <linkto group="Compare.h#ObjCompareFunc">ObjCompareFunc</linkto> so 00080 // that it can be used in the <linkto class="Sort">Sort</linkto> class. 00081 static int compare (const void* obj1, const void* obj2); 00082 }; 00083 00084 00085 } //# NAMESPACE CASA - END 00086 00087 #ifndef CASACORE_NO_AUTO_TEMPLATES 00088 #include <casa/Utilities/Compare.tcc> 00089 #endif //# CASACORE_NO_AUTO_TEMPLATES 00090 #endif