eg_compare.h

Go to the documentation of this file.
00001 /* EGlib "Efficient General Library" provides some basic structures and
00002  * algorithms commons in many optimization algorithms.
00003  *
00004  * Copyright (C) 2005 Daniel Espinoza and Marcos Goycoolea.
00005  * 
00006  * This library is free software; you can redistribute it and/or modify it
00007  * under the terms of the GNU Lesser General Public License as published by the
00008  * Free Software Foundation; either version 2.1 of the License, or (at your
00009  * option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful, but 
00012  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
00013  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public 
00014  * License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public License
00017  * along with this library; if not, write to the Free Software Foundation,
00018  * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
00019  * */
00020 #ifndef __EG_COMPARE_H__
00021 #define __EG_COMPARE_H__
00022 #include <stdlib.h>
00023 #include <stdio.h>
00024 #include <string.h>
00025 #include <limits.h>
00026 #include "eg_config.h"
00027 #include "eg_macros.h"
00028 #include "eg_mempool.h"
00029 /* ========================================================================= */
00030 /** @defgroup EGcompare EGcompare
00031  *
00032  * Here we define an interface for comparison functions, and some default
00033  * comparators.
00034  *
00035  * -2004-08-16
00036  *          - First Implementation
00037  * */
00038 /** @file
00039  * @ingroup EGcompare */
00040 /* @{ */
00041 /* ========================================================================= */
00042 
00043 /* ========================================================================= */
00044 /** @brief comparison function type.
00045  * @par Description:
00046  * This type of function is intended to represent general comparison functions,
00047  * the comparison function must return an integer less than, equal to, or 
00048  * greater than zero if the first argument is considered to be respectively 
00049  * less than, equal to, or greater than the second. Note that the standard
00050  * function memcompare operate in the same sense.
00051  * */
00052 typedef int (*EGcompare_f) (const void *,
00053                             const void *);
00054 
00055 /* ========================================================================= */
00056 /** @brief Lexicographical order of strings.
00057  * @par Description:
00058  * This function compare two strings of (\0 terminated) chars in
00059  * lexicographical order. */
00060 extern int EGstringCompare (const void *str1,
00061                             const void *str2);
00062 
00063 /* ========================================================================= */
00064 /** @brief Normal order of doubles.
00065  * @par Description:
00066  * This function compare two doubles. */
00067 extern int EGlfCompare (const void *str1,
00068                         const void *str2);
00069 
00070 /* ========================================================================= */
00071 /** @brief Normal order of integers.
00072  * @par Description:
00073  * This function compare two integers. */
00074 extern int EGdCompare (const void *str1,
00075                        const void *str2);
00076 
00077 /* ========================================================================= */
00078 /** @brief Normal order of unsigned integers.
00079  * @par Description:
00080  * This function compare two unsigned integers. */
00081 extern int EGudCompare (const void *str1,
00082                         const void *str2);
00083 
00084 /* ========================================================================= */
00085 /** @brief Normal order of pointers.
00086  * @par Description:
00087  * This function compare pointers in 'memory' order. */
00088 extern int EGptCompare (const void *str1,
00089                         const void *str2);
00090 
00091 /* ========================================================================= */
00092 /* } */
00093 /* end of eg_compare.h */
00094 #endif

Generated on Mon Jan 30 08:48:52 2006 for EGlib by  doxygen 1.4.5