IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 11696


Ignore:
Timestamp:
Feb 7, 2007, 4:31:59 PM (19 years ago)
Author:
jhoblitt
Message:

change psVectorAllocEmpty() & psVectorAllocEmpty() into wrappers so file/lineo/func can be recorded in the memBlock

Location:
trunk/psLib/src/mathtypes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/mathtypes/psVector.c

    r11668 r11696  
    99*  @author Robert DeSonia, MHPCC
    1010*
    11 *  @version $Revision: 1.91 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2007-02-06 21:36:09 $
     11*  @version $Revision: 1.92 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2007-02-08 02:31:59 $
    1313*
    1414*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    7373
    7474// Allocate a psVector; does not set vector->n (left to the caller)
    75 static psVector *vectorAlloc(long nalloc, // Number of elements to allocate
    76                              psElemType type // Type of elements
    77                             )
     75static psVector *vectorAlloc(const char *file,
     76                             unsigned int lineno,
     77                             const char *func,
     78                             long nalloc, // Number of elements to allocate
     79                             psElemType type) // Type of elements
    7880{
    7981    int elementSize = PSELEMTYPE_SIZEOF(type); // Size, in bytes, of element
     
    8587
    8688    // Create vector struct
    87     psVector *vector = (psVector*) psAlloc(sizeof(psVector));
     89    psVector *vector = (psVector*) p_psAlloc(file, lineno, func, sizeof(psVector));
    8890    psMemSetDeallocator(vector, (psFreeFunc) vectorFree);
    8991
     
    98100}
    99101
    100 psVector* psVectorAlloc(long nalloc,
    101                         psElemType type)
    102 {
    103     psVector *vector = vectorAlloc(nalloc, type);
     102psVector* p_psVectorAlloc(const char *file,
     103                          unsigned int lineno,
     104                          const char *func,
     105                          long nalloc,
     106                          psElemType type)
     107{
     108    psVector *vector = vectorAlloc(file, lineno, func, nalloc, type);
    104109    if (!vector) {
    105110        return NULL;
     
    109114}
    110115
    111 psVector* psVectorAllocEmpty(long nalloc,
    112                              psElemType type)
    113 {
    114     psVector *vector = vectorAlloc(nalloc, type);
     116psVector* p_psVectorAllocEmpty(const char *file,
     117                               unsigned int lineno,
     118                               const char *func,
     119                               long nalloc,
     120                               psElemType type)
     121{
     122    psVector *vector = vectorAlloc(file, lineno, func, nalloc, type);
    115123    if (!vector) {
    116124        return NULL;
  • trunk/psLib/src/mathtypes/psVector.h

    r11668 r11696  
    99 * @author Ross Harman, MHPCC
    1010 *
    11  * @version $Revision: 1.62 $ $Name: not supported by cvs2svn $
    12  * @date $Date: 2007-02-06 21:36:09 $
     11 * @version $Revision: 1.63 $ $Name: not supported by cvs2svn $
     12 * @date $Date: 2007-02-08 02:31:59 $
    1313 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
    1414 */
     
    7777 * @return psVector*    Pointer to psVector.
    7878 */
     79#ifdef DOXYGEN
    7980psVector* psVectorAlloc(
    8081    long nalloc,                       ///< Total number of elements to make available.
    8182    psElemType type                    ///< Type of data to be held by vector.
    8283);
     84#else // ifdef DOXYGEN
     85psVector* p_psVectorAlloc(
     86    const char *file,                   ///< File of caller
     87    unsigned int lineno,                ///< Line number of caller
     88    const char *func,                   ///< Function name of caller
     89    long nalloc,                        ///< Total number of elements to make available.
     90    psElemType type                    ///< Type of data to be held by vector.
     91//#ifdef __GNUC__
     92//) __attribute__((malloc));
     93//#else // ifdef __GNUC__
     94);
     95//#endif // ifdef __GNUC__
     96#define psVectorAlloc(nalloc, type) \
     97      p_psVectorAlloc(__FILE__, __LINE__, __func__, nalloc, type)
     98#endif // ifdef DOXYGEN
     99
    83100
    84101/** Allocate a vector, with length set to zero
     
    89106 * @return psVector*    Pointer to psVector.
    90107 */
     108#ifdef DOXYGEN
    91109psVector* psVectorAllocEmpty(
    92110    long nalloc,                       ///< Total number of elements to make available.
    93111    psElemType type                    ///< Type of data to be held by vector.
    94112);
     113#else // ifdef DOXYGEN
     114psVector* p_psVectorAllocEmpty(
     115    const char *file,                   ///< File of caller
     116    unsigned int lineno,                ///< Line number of caller
     117    const char *func,                   ///< Function name of caller
     118    long nalloc,                       ///< Total number of elements to make available.
     119    psElemType type                    ///< Type of data to be held by vector.
     120//#ifdef __GNUC__
     121//) __attribute__((malloc));
     122//#else // ifdef __GNUC__
     123);
     124//#endif // ifdef __GNUC__
     125#define psVectorAllocEmpty(nalloc, type) \
     126      p_psVectorAllocEmpty(__FILE__, __LINE__, __func__, nalloc, type)
     127#endif // ifdef DOXYGEN
     128
    95129
    96130/** Reallocate a vector.
     
    107141    long nalloc                        ///< Total number of elements to make available.
    108142);
     143
    109144
    110145/** Extend a vector's length.
     
    123158);
    124159
     160
    125161/** Recycle a vector.
    126162 *
     
    141177);
    142178
     179
    143180/** Copy a vector, converting types.
    144181 *
     
    155192);
    156193
     194
    157195/** Sort an array of floats.
    158196 *
     
    167205);
    168206
     207
    169208/** Creates an array of indices based on sort ordered of array.
    170209 *
     
    179218);
    180219
     220
    181221/** Creates a string from a psVector's values in the form "[x0,x1,x2]".
    182222 *
     
    188228);
    189229
     230
    190231/** Returns an element in the vector as a psF64 value
    191232 *
     
    196237    int position                       ///< the vector position to get
    197238);
     239
    198240
    199241/** Print a vector to a stream
     
    207249);
    208250
     251
    209252/** Initializes the vector with the given value.
    210253 *
    211  *  The input data is cast to match the vector datatype, allowing for integers to be preserved.
     254 *  The input data is cast to match the vector datatype, allowing for integers
     255 *  to be preserved.
    212256 *
    213257 *  @return bool:       True if successful, otherwise false.
     
    218262);
    219263
     264
    220265/** Creates a new vector, or reallocates the provided vector if input is not NULL.
    221266 *
    222  *  The created vector consists of the data range starting at lower, running to upper,
    223  *  in steps of delta.  The upper-end value is exclusive; the sequence is equivalent to
    224  *  for (x = lower; x <= upper - 1; x += delta).
     267 *  The created vector consists of the data range starting at lower, running to
     268 *  upper, in steps of delta.  The upper-end value is exclusive; the sequence
     269 *  is equivalent to for (x = lower; x <= upper - 1; x += delta).
    225270 *
    226271 *  @return psVector*:       the newly created psVector
     
    234279);
    235280
     281
    236282/** Sets the value of the input vector at the specified position to value.
    237283 *
     
    246292);
    247293
     294
    248295/** Returns the value of the input vector at the specified position.
    249296 *
     
    257304);
    258305
     306
    259307/** Returns the number of pixels in the vector which satisfy any of the mask bits.
    260308 *
    261  *  An error (eg, invalid vector) results in a return value of -1.  The vector must be U8.
     309 *  An error (eg, invalid vector) results in a return value of -1.  The vector
     310 *  must be U8.
    262311 *
    263312 *  @return long:       the number of pixels counted
     
    267316    psMaskType value                   ///< the mask value to satisfy
    268317);
     318
    269319
    270320/** Get the number of elements in use from a specified psVector. (vector.n)
Note: See TracChangeset for help on using the changeset viewer.