00001 /* @file psCompare.h 00002 * @brief Comparison functions for sorting routines 00003 * 00004 * @author Robert Daniel DeSonia, MHPCC 00005 * 00006 * @version $Revision: 1.9 $ $Name: $ 00007 * @date $Date: 2007/01/23 22:47:23 $ 00008 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 00009 */ 00010 00011 #ifndef PS_COMPARE_H 00012 #define PS_COMPARE_H 00013 00014 /// @addtogroup MathOps Mathematical Operations 00015 /// @{ 00016 00017 #include "psType.h" 00018 00019 /** A comparison function for sorting elements that are pointers to data, 00020 * e.g., for psList of pointers to numeric values. 00021 * 00022 * @return int an integer less than, equal to, or greater than zero if 00023 * the first argument is considered to be respectively less 00024 * than, equal to, or greater than the second. 00025 */ 00026 typedef int (*psComparePtrFunc) ( 00027 const void **a, ///< first comparison target 00028 const void **b ///< second comparison target 00029 ); 00030 00031 /** A comparison function for sorting. 00032 * 00033 * @return int an integer less than, equal to, or greater than zero if 00034 * the first argument is considered to be respectively less 00035 * than, equal to, or greater than the second. 00036 */ 00037 typedef int (*psCompareFcn) ( 00038 const void *a, ///< first comparison target 00039 const void *b ///< second comparison target 00040 ); 00041 00042 /** Compare function of psS8 data. For use with psListSort. 00043 * 00044 * @return int an integer less than, equal to, or greater than zero if 00045 * the first argument is considered to be respectively less 00046 * than, equal to, or greater than the second. 00047 */ 00048 int psCompareS8Ptr( 00049 const void **a, ///< first comparison target 00050 const void **b ///< second comparison target 00051 ); 00052 00053 /** Compare function of psS16 data. For use with psListSort. 00054 * 00055 * @return int an integer less than, equal to, or greater than zero if 00056 * the first argument is considered to be respectively less 00057 * than, equal to, or greater than the second. 00058 */ 00059 int psCompareS16Ptr( 00060 const void **a, ///< first comparison target 00061 const void **b ///< second comparison target 00062 ); 00063 00064 /** Compare function of psS32 data. For use with psListSort. 00065 * 00066 * @return int an integer less than, equal to, or greater than zero if 00067 * the first argument is considered to be respectively less 00068 * than, equal to, or greater than the second. 00069 */ 00070 int psCompareS32Ptr( 00071 const void **a, ///< first comparison target 00072 const void **b ///< second comparison target 00073 ); 00074 00075 /** Compare function of psS64 data. For use with psListSort. 00076 * 00077 * @return int an integer less than, equal to, or greater than zero if 00078 * the first argument is considered to be respectively less 00079 * than, equal to, or greater than the second. 00080 */ 00081 int psCompareS64Ptr( 00082 const void **a, ///< first comparison target 00083 const void **b ///< second comparison target 00084 ); 00085 00086 /** Compare function of psU8 data. For use with psListSort. 00087 * 00088 * @return int an integer less than, equal to, or greater than zero if 00089 * the first argument is considered to be respectively less 00090 * than, equal to, or greater than the second. 00091 */ 00092 int psCompareU8Ptr( 00093 const void **a, ///< first comparison target 00094 const void **b ///< second comparison target 00095 ); 00096 00097 /** Compare function of psU16 data. For use with psListSort. 00098 * 00099 * @return int an integer less than, equal to, or greater than zero if 00100 * the first argument is considered to be respectively less 00101 * than, equal to, or greater than the second. 00102 */ 00103 int psCompareU16Ptr( 00104 const void **a, ///< first comparison target 00105 const void **b ///< second comparison target 00106 ); 00107 00108 /** Compare function of psU32 data. For use with psListSort. 00109 * 00110 * @return int an integer less than, equal to, or greater than zero if 00111 * the first argument is considered to be respectively less 00112 * than, equal to, or greater than the second. 00113 */ 00114 int psCompareU32Ptr( 00115 const void **a, ///< first comparison target 00116 const void **b ///< second comparison target 00117 ); 00118 00119 /** Compare function of psU64 data. For use with psListSort. 00120 * 00121 * @return int an integer less than, equal to, or greater than zero if 00122 * the first argument is considered to be respectively less 00123 * than, equal to, or greater than the second. 00124 */ 00125 int psCompareU64Ptr( 00126 const void **a, ///< first comparison target 00127 const void **b ///< second comparison target 00128 ); 00129 00130 /** Compare function of psF32 data. For use with psListSort. 00131 * 00132 * @return int an integer less than, equal to, or greater than zero if 00133 * the first argument is considered to be respectively less 00134 * than, equal to, or greater than the second. 00135 */ 00136 int psCompareF32Ptr( 00137 const void **a, ///< first comparison target 00138 const void **b ///< second comparison target 00139 ); 00140 00141 /** Compare function of psF64 data. For use with psListSort. 00142 * 00143 * @return int an integer less than, equal to, or greater than zero if 00144 * the first argument is considered to be respectively less 00145 * than, equal to, or greater than the second. 00146 */ 00147 int psCompareF64Ptr( 00148 const void **a, ///< first comparison target 00149 const void **b ///< second comparison target 00150 ); 00151 00152 /** Compare function of psS8 data. For use with psListSort for descending ordering. 00153 * 00154 * @return int an integer less than, equal to, or greater than zero if 00155 * the first argument is considered to be respectively greater 00156 * than, equal to, or less than the second. 00157 */ 00158 int psCompareDescendingS8Ptr( 00159 const void **a, ///< first comparison target 00160 const void **b ///< second comparison target 00161 ); 00162 00163 /** Compare function of psS16 data. For use with psListSort for descending ordering. 00164 * 00165 * @return int an integer less than, equal to, or greater than zero if 00166 * the first argument is considered to be respectively greater 00167 * than, equal to, or less than the second. 00168 */ 00169 int psCompareDescendingS16Ptr( 00170 const void **a, ///< first comparison target 00171 const void **b ///< second comparison target 00172 ); 00173 00174 /** Compare function of psS32 data. For use with psListSort for descending ordering. 00175 * 00176 * @return int an integer less than, equal to, or greater than zero if 00177 * the first argument is considered to be respectively greater 00178 * than, equal to, or less than the second. 00179 */ 00180 int psCompareDescendingS32Ptr( 00181 const void **a, ///< first comparison target 00182 const void **b ///< second comparison target 00183 ); 00184 00185 /** Compare function of psS64 data. For use with psListSort for descending ordering. 00186 * 00187 * @return int an integer less than, equal to, or greater than zero if 00188 * the first argument is considered to be respectively greater 00189 * than, equal to, or less than the second. 00190 */ 00191 int psCompareDescendingS64Ptr( 00192 const void **a, ///< first comparison target 00193 const void **b ///< second comparison target 00194 ); 00195 00196 /** Compare function of psU8 data. For use with psListSort for descending ordering. 00197 * 00198 * @return int an integer less than, equal to, or greater than zero if 00199 * the first argument is considered to be respectively greater 00200 * than, equal to, or less than the second. 00201 */ 00202 int psCompareDescendingU8Ptr( 00203 const void **a, ///< first comparison target 00204 const void **b ///< second comparison target 00205 ); 00206 00207 /** Compare function of psU16 data. For use with psListSort for descending ordering. 00208 * 00209 * @return int an integer less than, equal to, or greater than zero if 00210 * the first argument is considered to be respectively greater 00211 * than, equal to, or less than the second. 00212 */ 00213 int psCompareDescendingU16Ptr( 00214 const void **a, ///< first comparison target 00215 const void **b ///< second comparison target 00216 ); 00217 00218 /** Compare function of psU32 data. For use with psListSort for descending ordering. 00219 * 00220 * @return int an integer less than, equal to, or greater than zero if 00221 * the first argument is considered to be respectively greater 00222 * than, equal to, or lessg than the second. 00223 */ 00224 int psCompareDescendingU32Ptr( 00225 const void **a, ///< first comparison target 00226 const void **b ///< second comparison target 00227 ); 00228 00229 /** Compare function of psU64 data. For use with psListSort for descending ordering. 00230 * 00231 * @return int an integer less than, equal to, or greater than zero if 00232 * the first argument is considered to be respectively greater 00233 * than, equal to, or lessg than the second. 00234 */ 00235 int psCompareDescendingU64Ptr( 00236 const void **a, ///< first comparison target 00237 const void **b ///< second comparison target 00238 ); 00239 00240 /** Compare function of psF32 data. For use with psListSort for descending ordering. 00241 * 00242 * @return int an integer less than, equal to, or greater than zero if 00243 * the first argument is considered to be respectively greater 00244 * than, equal to, or lessg than the second. 00245 */ 00246 int psCompareDescendingF32Ptr( 00247 const void **a, ///< first comparison target 00248 const void **b ///< second comparison target 00249 ); 00250 00251 /** Compare function of psF64 data. For use with psListSort for descending ordering. 00252 * 00253 * @return int an integer less than, equal to, or greater than zero if 00254 * the first argument is considered to be respectively greater 00255 * than, equal to, or lessg than the second. 00256 */ 00257 int psCompareDescendingF64Ptr( 00258 const void **a, ///< first comparison target 00259 const void **b ///< second comparison target 00260 ); 00261 00262 /** Compare function of psS8 data. 00263 * 00264 * @return int an integer less than, equal to, or greater than zero if 00265 * the first argument is considered to be respectively less 00266 * than, equal to, or greater than the second. 00267 */ 00268 int psCompareS8( 00269 const void *a, ///< first comparison target 00270 const void *b ///< second comparison target 00271 ); 00272 00273 00274 /** Compare function of psS16 data. 00275 * 00276 * @return int an integer less than, equal to, or greater than zero if 00277 * the first argument is considered to be respectively less 00278 * than, equal to, or greater than the second. 00279 */ 00280 int psCompareS16( 00281 const void *a, ///< first comparison target 00282 const void *b ///< second comparison target 00283 ); 00284 00285 00286 /** Compare function of psS32 data. 00287 * 00288 * @return int an integer less than, equal to, or greater than zero if 00289 * the first argument is considered to be respectively less 00290 * than, equal to, or greater than the second. 00291 */ 00292 int psCompareS32( 00293 const void *a, ///< first comparison target 00294 const void *b ///< second comparison target 00295 ); 00296 00297 00298 /** Compare function of psS64 data. 00299 * 00300 * @return int an integer less than, equal to, or greater than zero if 00301 * the first argument is considered to be respectively less 00302 * than, equal to, or greater than the second. 00303 */ 00304 int psCompareS64( 00305 const void *a, ///< first comparison target 00306 const void *b ///< second comparison target 00307 ); 00308 00309 00310 /** Compare function of psU8 data. 00311 * 00312 * @return int an integer less than, equal to, or greater than zero if 00313 * the first argument is considered to be respectively less 00314 * than, equal to, or greater than the second. 00315 */ 00316 int psCompareU8( 00317 const void *a, ///< first comparison target 00318 const void *b ///< second comparison target 00319 ); 00320 00321 00322 /** Compare function of psU16 data. 00323 * 00324 * @return int an integer less than, equal to, or greater than zero if 00325 * the first argument is considered to be respectively less 00326 * than, equal to, or greater than the second. 00327 */ 00328 int psCompareU16( 00329 const void *a, ///< first comparison target 00330 const void *b ///< second comparison target 00331 ); 00332 00333 00334 /** Compare function of psU32 data. 00335 * 00336 * @return int an integer less than, equal to, or greater than zero if 00337 * the first argument is considered to be respectively less 00338 * than, equal to, or greater than the second. 00339 */ 00340 int psCompareU32( 00341 const void *a, ///< first comparison target 00342 const void *b ///< second comparison target 00343 ); 00344 00345 00346 /** Compare function of psU64 data. 00347 * 00348 * @return int an integer less than, equal to, or greater than zero if 00349 * the first argument is considered to be respectively less 00350 * than, equal to, or greater than the second. 00351 */ 00352 int psCompareU64( 00353 const void *a, ///< first comparison target 00354 const void *b ///< second comparison target 00355 ); 00356 00357 00358 /** Compare function of psF32 data. 00359 * 00360 * @return int an integer less than, equal to, or greater than zero if 00361 * the first argument is considered to be respectively less 00362 * than, equal to, or greater than the second. 00363 */ 00364 int psCompareF32( 00365 const void *a, ///< first comparison target 00366 const void *b ///< second comparison target 00367 ); 00368 00369 00370 /** Compare function of psF64 data. 00371 * 00372 * @return int an integer less than, equal to, or greater than zero if 00373 * the first argument is considered to be respectively less 00374 * than, equal to, or greater than the second. 00375 */ 00376 int psCompareF64( 00377 const void *a, ///< first comparison target 00378 const void *b ///< second comparison target 00379 ); 00380 00381 00382 /** Compare function of psS8 data. 00383 * 00384 * @return int an integer less than, equal to, or greater than zero if 00385 * the first argument is considered to be respectively greater 00386 * than, equal to, or less than the second. 00387 */ 00388 int psCompareDescendingS8( 00389 const void *a, ///< first comparison target 00390 const void *b ///< second comparison target 00391 ); 00392 00393 00394 /** Compare function of psS16 data. 00395 * 00396 * @return int an integer less than, equal to, or greater than zero if 00397 * the first argument is considered to be respectively greater 00398 * than, equal to, or less than the second. 00399 */ 00400 int psCompareDescendingS16( 00401 const void *a, ///< first comparison target 00402 const void *b ///< second comparison target 00403 ); 00404 00405 00406 /** Compare function of psS32 data. 00407 * 00408 * @return int an integer less than, equal to, or greater than zero if 00409 * the first argument is considered to be respectively greater 00410 * than, equal to, or less than the second. 00411 */ 00412 int psCompareDescendingS32( 00413 const void *a, ///< first comparison target 00414 const void *b ///< second comparison target 00415 ); 00416 00417 00418 /** Compare function of psS64 data. 00419 * 00420 * @return int an integer less than, equal to, or greater than zero if 00421 * the first argument is considered to be respectively greater 00422 * than, equal to, or less than the second. 00423 */ 00424 int psCompareDescendingS64( 00425 const void *a, ///< first comparison target 00426 const void *b ///< second comparison target 00427 ); 00428 00429 00430 /** Compare function of psU8 data. 00431 * 00432 * @return int an integer less than, equal to, or greater than zero if 00433 * the first argument is considered to be respectively greater 00434 * than, equal to, or less than the second. 00435 */ 00436 int psCompareDescendingU8( 00437 const void *a, ///< first comparison target 00438 const void *b ///< second comparison target 00439 ); 00440 00441 00442 /** Compare function of psU16 data. 00443 * 00444 * @return int an integer less than, equal to, or greater than zero if 00445 * the first argument is considered to be respectively greater 00446 * than, equal to, or less than the second. 00447 */ 00448 int psCompareDescendingU16( 00449 const void *a, ///< first comparison target 00450 const void *b ///< second comparison target 00451 ); 00452 00453 00454 /** Compare function of psU32 data. 00455 * 00456 * @return int an integer less than, equal to, or greater than zero if 00457 * the first argument is considered to be respectively greater 00458 * than, equal to, or less than the second. 00459 */ 00460 int psCompareDescendingU32( 00461 const void *a, ///< first comparison target 00462 const void *b ///< second comparison target 00463 ); 00464 00465 00466 /** Compare function of psU64 data. 00467 * 00468 * @return int an integer less than, equal to, or greater than zero if 00469 * the first argument is considered to be respectively greater 00470 * than, equal to, or less than the second. 00471 */ 00472 int psCompareDescendingU64( 00473 const void *a, ///< first comparison target 00474 const void *b ///< second comparison target 00475 ); 00476 00477 00478 /** Compare function of psF32 data. 00479 * 00480 * @return int an integer less than, equal to, or greater than zero if 00481 * the first argument is considered to be respectively greater 00482 * than, equal to, or less than the second. 00483 */ 00484 int psCompareDescendingF32( 00485 const void *a, ///< first comparison target 00486 const void *b ///< second comparison target 00487 ); 00488 00489 00490 /** Compare function of psF64 data. 00491 * 00492 * @return int an integer less than, equal to, or greater than zero if 00493 * the first argument is considered to be respectively greater 00494 * than, equal to, or less than the second. 00495 */ 00496 int psCompareDescendingF64( 00497 const void *a, ///< first comparison target 00498 const void *b ///< second comparison target 00499 ); 00500 00501 /// @} 00502 #endif // #ifndef PS_COMPARE_H
1.5.1