IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 27, 2004, 9:58:54 AM (22 years ago)
Author:
gusciora
Message:

I've been unifying the naming conventions for various macros that check
functions parameters for type, size, non-NULL ...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/math/psConstants.h

    r2209 r2211  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-10-27 01:23:24 $
     8 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-10-27 19:58:54 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    1212 */
    1313
     14/*****************************************************************************
     15These constants are used by various functions in the psLib.
     16 *****************************************************************************/
    1417#define DETERMINE_BRACKET_STEP_SIZE 0.10
    1518#define MAX_LMM_ITERATIONS 100
     
    1720#define LEFT_SPLINE_DERIV 0.0
    1821#define RIGHT_SPLINE_DERIV 0.0
    19 
     22/*****************************************************************************
     23These are common mathimatical constants used by various functions in the psLib.
     24 *****************************************************************************/
     25
     26
     27
     28/*****************************************************************************
     29 
     30 *****************************************************************************/
    2031#define CONVERT_VECTOR_F64_TO_F32(OLD, NEW_PTR32, NEW_STATIC32) \
    2132if (OLD->type.type == PS_TYPE_F32) { \
     
    4455} \
    4556
    46 #define VECTOR_CHECK_TYPE_F32_OR_F64_RETURN_NULL(VEC) \
    47 if ((VEC->type.type != PS_TYPE_F32) && (VEC->type.type != PS_TYPE_F64)) { \
    48     psAbort(__func__, "Bad type for VEC (%d)", VEC->type.type); \
    49     return(NULL); \
    50 } \
    51 
    5257#define GEN_PERSIST_YERR_VEC_F32(VEC, N) \
    5358VEC = psVectorRecycle(VEC, N, PS_TYPE_F32); \
     
    8994
    9095
    91 
    92 
    93 
     96/*****************************************************************************
     97 
     98*****************************************************************************/
     99#define PS_CHECK_NULL_PTR(NAME, RVAL) \
     100if (NAME == NULL) { \
     101    psError(__func__,"Unallowable operation: %s is NULL.", #NAME); \
     102    return(RVAL); \
     103}
     104
     105/*****************************************************************************
     106 
     107 *****************************************************************************/
     108#define VECTOR_CHECK_TYPE_F32_OR_F64(VEC, RVAL) \
     109if ((VEC->type.type != PS_TYPE_F32) && (VEC->type.type != PS_TYPE_F64)) { \
     110    psAbort(__func__, "Bad type for VEC (%d)", VEC->type.type); \
     111    return(RVAL); \
     112} \
    94113
    95114/** Preprocessor macro to generate error on an incorrect type */
     
    107126} \
    108127
    109 /** Preprocessor macro to generate error on a NULL poniter */
    110 #define PS_CHECK_NULL_PTR(NAME, RVAL) \
    111 if (NAME == NULL) { \
    112     psError(__func__,"Unallowable operation: %s is NULL.", #NAME); \
    113     return(RVAL); \
    114 }
    115 
    116128/** Preprocessor macro to generate error for zero length vector */
    117129#define PS_CHECK_EMPTY_VECTOR(NAME, RVAL) \
     
    128140}
    129141
    130 
    131 
    132 
    133 
    134 /** Preprocessor macro to generate error on a NULL image */
    135 #define PS_CHECK_NULL_IMAGE_RETURN_NULL(NAME) \
    136 if (NAME == NULL || NAME->data.V == NULL) {                                                         \
    137     psError(__func__,"Unallowable operation: %s or its data is NULL.", #NAME);                          \
    138     return(NULL); \
    139 }
    140 
    141 /** Preprocessor macro to generate error for zero length rows or columns */
    142 #define PS_CHECK_EMPTY_IMAGE_RETURN_NULL(NAME) \
    143 if (NAME->numCols < 1 || NAME->numRows < 1) {                                                       \
    144     psError(__func__,"Unallowable operation: %s has zero rows or columns (%dx%d).", #NAME,              \
    145             NAME->numCols, NAME->numRows);                                                          \
    146     return(NULL); \
    147 }
    148 
    149 #define PS_CHECK_IMAGE_TYPE_RETURN_NULL(NAME, TYPE) \
    150 if (NAME->type.type != TYPE) { \
    151     psError(__func__,"Unallowable operation: %s has incorrect type.", #NAME); \
    152     return(NULL); \
    153 }
    154 
    155 /** Preprocessor macro to generate error on a NULL image */
    156 #define PS_CHECK_NULL_IMAGE_READOUT_NULL(NAME) \
    157 if (NAME == NULL || NAME->image == NULL) {                                                         \
    158     psError(__func__,"Unallowable operation: %s or its data is NULL.", #NAME);                          \
    159     return(NULL); \
    160 }
    161 
    162 #define PS_CHECK_NULL_1DPOLY_RETURN_NULL(NAME)                                                          \
    163 if (NAME == NULL || NAME->coeff == NULL) {                                                         \
    164     psError(__func__,"Unallowable operation: %s or its coeffs is NULL.", #NAME);                          \
    165     return(NULL); \
    166 } \
    167 
    168 
    169 
    170 
    171 
    172142#define PS_PRINT_VECTOR(NAME) \
    173143for (int my_i=0;my_i<NAME->n;my_i++) { \
     
    189159
    190160
     161
     162/*****************************************************************************
     163 
     164*****************************************************************************/
     165#define PS_CHECK_NULL_POLY(NAME, NULL) \
     166if (NAME == NULL || NAME->coeff == NULL) { \
     167    psError(__func__,"Unallowable operation: polynomial %s or its coeffs is NULL.", #NAME); \
     168    return(NULL); \
     169} \
     170
     171
     172
     173
     174
     175/*****************************************************************************
     176 
     177*****************************************************************************/
     178/** Preprocessor macro to generate error on a NULL image */
     179#define PS_CHECK_NULL_IMAGE(NAME, RVAL) \
     180if (NAME == NULL || NAME->data.V == NULL) { \
     181    psError(__func__,"Unallowable operation: psImage %s or its data is NULL.", #NAME); \
     182    return(RVAL); \
     183}
     184
     185/** Preprocessor macro to generate error for zero length rows or columns */
     186#define PS_CHECK_EMPTY_IMAGE(NAME, RVAL) \
     187if (NAME->numCols < 1 || NAME->numRows < 1) { \
     188    psError(__func__,"Unallowable operation: psImage %s has zero rows or columns (%dx%d).", #NAME, \
     189            NAME->numCols, NAME->numRows); \
     190    return(RVAL); \
     191}
     192
     193#define PS_CHECK_IMAGE_TYPE(NAME, TYPE, RVAL) \
     194if (NAME->type.type != TYPE) { \
     195    psError(__func__,"Unallowable operation: psImage %s has incorrect type.", #NAME); \
     196    return(RVAL); \
     197}
     198
     199/*****************************************************************************
     200 
     201 *****************************************************************************/
     202/** Preprocessor macro to generate error on a NULL image */
     203#define PS_CHECK_NULL_IMAGE_READOUT(NAME, RVAL) \
     204if (NAME == NULL || NAME->image == NULL) {                                                         \
     205    psError(__func__,"Unallowable operation: psReadout %s or its data is NULL.", #NAME); \
     206    return(RVAL); \
     207}
     208
     209
     210
     211
     212
     213/*****************************************************************************
     214 
     215 *****************************************************************************/
    191216#define PS_MAX(A, B) \
    192217(((A) > (B)) ? (A) : (B)) \
Note: See TracChangeset for help on using the changeset viewer.