IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 28, 2005, 10:17:52 AM (21 years ago)
Author:
drobbin
Message:

updated files in accordance with requested revisions in apidelta-report-cycle6

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

Legend:

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

    r4392 r4409  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.71 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-06-25 02:02:05 $
     11 *  @version $Revision: 1.72 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-06-28 20:17:52 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    137137}
    138138
    139 char* psRegionToString(psRegion region)
     139psString psRegionToString(const psRegion region)
    140140{
    141141    char tmpText[256]; // big enough to store any region as text
  • trunk/psLib/src/mathtypes/psImage.h

    r4330 r4409  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.58 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-06-21 03:01:37 $
     13 *  @version $Revision: 1.59 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-06-28 20:17:52 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    132132/** Create a string of the standard IRAF form '[x0:x1,y0:y1]' from a psRegion.
    133133 *
    134  *  @return char*:  A new string representing the psRegion as text, or NULL
     134 *  @return psString:  A new string representing the psRegion as text, or NULL
    135135 *                  is not successful.
    136136 */
    137 char* psRegionToString(
    138     psRegion region                   ///< the psRegion to convert to a string
     137psString psRegionToString(
     138    const psRegion region              ///< the psRegion to convert to a string
    139139);
    140140
  • trunk/psLib/src/mathtypes/psScalar.c

    r4330 r4409  
    88 *  @author Ross Harman, MHPCC
    99 *
    10  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2005-06-21 03:01:37 $
     10 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2005-06-28 20:17:52 $
    1212 *
    1313 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2222#include "psCollectionsErrors.h"
    2323
    24 psScalar* psScalarAlloc(psC64 value, psElemType dataType)
     24psScalar* psScalarAlloc(complex value, psElemType type)
    2525{
    2626    psScalar* scalar = NULL;
     
    3030
    3131    scalar->type.dimen = PS_DIMEN_SCALAR;
    32     scalar->type.type = dataType;
     32    scalar->type.type = type;
    3333
    34     switch (dataType) {
     34    switch (type) {
    3535    case PS_TYPE_S8:
    3636        scalar->data.S8 = (psS8) value;
     
    7272        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
    7373                PS_ERRORTEXT_psScalar_UNSUPPORTED_TYPE,
    74                 dataType);
     74                type);
    7575        psFree(scalar);
    7676        return NULL;
  • trunk/psLib/src/mathtypes/psScalar.h

    r4330 r4409  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-06-21 03:01:37 $
     13 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-06-28 20:17:52 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6666 */
    6767psScalar* psScalarAlloc(
    68     psC64 value,                       ///< Data to be put into psScalar.
    69     psElemType dataType                ///< Type of data to be held by psScalar.
     68    complex value,                     ///< Data to be put into psScalar.
     69    psElemType type                    ///< Type of data to be held by psScalar.
    7070);
    7171
  • trunk/psLib/src/mathtypes/psVector.c

    r4392 r4409  
    99*  @author Robert DeSonia, MHPCC
    1010*
    11 *  @version $Revision: 1.44 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2005-06-25 02:02:05 $
     11*  @version $Revision: 1.45 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2005-06-28 20:17:52 $
    1313*
    1414*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    4848// FUNCTION IMPLEMENTATION - PUBLIC
    4949
    50 psVector* psVectorAlloc(psU32 nalloc, psElemType elemType)
     50psVector* psVectorAlloc(unsigned long nalloc, psElemType type)
    5151{
    5252    psVector* psVec = NULL;
    5353    psS32 elementSize = 0;
    5454
    55     elementSize = PSELEMTYPE_SIZEOF(elemType);
     55    elementSize = PSELEMTYPE_SIZEOF(type);
    5656    if (elementSize < 1) {
    5757        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
    58                 PS_ERRORTEXT_psVector_UNSUPPORTED_TYPE, elemType);
     58                PS_ERRORTEXT_psVector_UNSUPPORTED_TYPE, type);
    5959        return NULL;
    6060    }
     
    6666
    6767    psVec->type.dimen = PS_DIMEN_VECTOR;
    68     psVec->type.type = elemType;
     68    psVec->type.type = type;
    6969    *(int*)&psVec->nalloc = nalloc;
    7070    psVec->n = nalloc;
     
    7676}
    7777
    78 psVector* psVectorRealloc(psVector* in, psU32 nalloc)
     78psVector* psVectorRealloc(psVector* vector, unsigned long nalloc)
    7979{
    8080    psS32 elementSize = 0;
    8181    psElemType elemType;
    8282
    83     if (in == NULL) {
     83    if (vector == NULL) {
    8484        psError(PS_ERR_BAD_PARAMETER_NULL, true,
    8585                PS_ERRORTEXT_psVector_REALLOC_NULL);
    8686        return NULL;
    87     } else if (in->nalloc != nalloc) {     // No need to realloc to same size
    88         elemType = in->type.type;
     87    } else if (vector->nalloc != nalloc) {     // No need to realloc to same size
     88        elemType = vector->type.type;
    8989        elementSize = PSELEMTYPE_SIZEOF(elemType);
    90         if (nalloc < in->n) {
    91             in->n = nalloc;
     90        if (nalloc < vector->n) {
     91            vector->n = nalloc;
    9292        }
    9393        // Realloc after decrementation to avoid accessing freed array elements
    94         in->data.U8 = psRealloc(in->data.U8, nalloc * elementSize);
    95         *(int*)&in->nalloc = nalloc;
    96     }
    97 
    98     return in;
    99 }
    100 
    101 psVector* psVectorRecycle(psVector* in, psU32 n, psElemType type)
     94        vector->data.U8 = psRealloc(vector->data.U8, nalloc * elementSize);
     95        *(int*)&vector->nalloc = nalloc;
     96    }
     97
     98    return vector;
     99}
     100
     101psVector* psVectorRecycle(psVector* vector, unsigned long nalloc, psElemType type)
    102102{
    103103    psS32 byteSize;
    104104
    105     if (in == NULL) {
    106         return psVectorAlloc(n, type);
    107     }
    108 
    109     if (in->type.dimen !=  PS_DIMEN_VECTOR &&
    110             in->type.dimen !=  PS_DIMEN_TRANSV) {
    111         psFree(in);
     105    if (vector == NULL) {
     106        return psVectorAlloc(nalloc, type);
     107    }
     108
     109    if (vector->type.dimen !=  PS_DIMEN_VECTOR &&
     110            vector->type.dimen !=  PS_DIMEN_TRANSV) {
     111        psFree(vector);
    112112        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
    113113                PS_ERRORTEXT_psVector_NOT_A_VECTOR);
     
    115115    }
    116116
    117     byteSize = n * PSELEMTYPE_SIZEOF(type);
     117    byteSize = nalloc * PSELEMTYPE_SIZEOF(type);
    118118
    119119    // need to increase data buffer?
    120     if (byteSize > in->nalloc*PSELEMTYPE_SIZEOF(in->type.type)) {
    121         in->data.U8 = psRealloc(in->data.U8, byteSize);
    122         *(int*)&in->nalloc = n;
    123     }
    124 
    125     in->type.dimen = PS_DIMEN_VECTOR;
    126     in->type.type = type;
    127     in->n = n;
    128     return in;
     120    if (byteSize > vector->nalloc*PSELEMTYPE_SIZEOF(vector->type.type)) {
     121        vector->data.U8 = psRealloc(vector->data.U8, byteSize);
     122        *(int*)&vector->nalloc = nalloc;
     123    }
     124
     125    vector->type.dimen = PS_DIMEN_VECTOR;
     126    vector->type.type = type;
     127    vector->n = nalloc;
     128    return vector;
    129129}
    130130
  • trunk/psLib/src/mathtypes/psVector.h

    r4330 r4409  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.36 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-06-21 03:01:37 $
     13 *  @version $Revision: 1.37 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-06-28 20:17:52 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2929///< Union of psVector data types.
    3030typedef union {
    31     psU8* U8;               ///< Unsigned 8-bit integer data.
    32     psU16* U16;             ///< Unsigned 16-bit integer data.
    33     psU32* U32;             ///< Unsigned 32-bit integer data.
    34     psU64* U64;             ///< Unsigned 64-bit integer data.
    35     psS8* S8;               ///< Signed 8-bit integer data.
    36     psS16* S16;             ///< Signed 16-bit integer data.
    37     psS32* S32;             ///< Signed 32-bit integer data.
    38     psS64* S64;             ///< Signed 64-bit integer data.
    39     psF32* F32;             ///< Single-precision float data.
    40     psF64* F64;             ///< Double-precision float data.
    41     psC32* C32;             ///< Single-precision complex data.
    42     psC64* C64;             ///< Double-precision complex data.
    43 } p_psVectorData;
     31    psU8* U8;                          ///< Unsigned 8-bit integer data.
     32    psU16* U16;                        ///< Unsigned 16-bit integer data.
     33    psU32* U32;                        ///< Unsigned 32-bit integer data.
     34    psU64* U64;                        ///< Unsigned 64-bit integer data.
     35    psS8* S8;                          ///< Signed 8-bit integer data.
     36    psS16* S16;                        ///< Signed 16-bit integer data.
     37    psS32* S32;                        ///< Signed 32-bit integer data.
     38    psS64* S64;                        ///< Signed 64-bit integer data.
     39    psF32* F32;                        ///< Single-precision float data.
     40    psF64* F64;                        ///< Double-precision float data.
     41    psC32* C32;                        ///< Single-precision complex data.
     42    psC64* C64;                        ///< Double-precision complex data.
     43}
     44p_psVectorData;
    4445
    4546/** An vector to support primitive types.
     
    5051typedef struct
    5152{
    52     psType type;                ///< Type of data.
    53     int n;                      ///< Number of elements in use.
    54     const int nalloc;           ///< Total number of elements available.
    55     p_psVectorData data;        ///< Union for data types.
     53    psType type;                       ///< Type of data.
     54    int n;                             ///< Number of elements in use.
     55    const int nalloc;                  ///< Total number of elements available.
     56    p_psVectorData data;               ///< Union for data types.
    5657}
    5758psVector;
     
    7273 */
    7374psVector* psVectorAlloc(
    74     psU32 nalloc,               ///< Total number of elements to make available.
    75     psElemType dataType                ///< Type of data to be held by vector.
     75    unsigned long nalloc,              ///< Total number of elements to make available.
     76    psElemType type                    ///< Type of data to be held by vector.
    7677);
    7778
     
    8687 */
    8788psVector* psVectorRealloc(
    88     psVector* psVec,                   ///< Vector to reallocate.
    89     psU32 nalloc                       ///< Total number of elements to make available.
     89    psVector* vector,                  ///< Vector to reallocate.
     90    unsigned long nalloc               ///< Total number of elements to make available.
    9091);
    9192
     
    115116 */
    116117psVector* psVectorRecycle(
    117     psVector* psVec,
     118    psVector* vector,
    118119    ///< Vector to recycle.  If NULL, a new vector is created.  No effort
    119120    ///< taken to preserve the values.
    120121
    121     psU32 nalloc,                      ///< Total number of elements to make available.
     122    unsigned long nalloc,              ///< Total number of elements to make available.
    122123    psElemType type                    ///< the datatype of the returned vector
    123124);
Note: See TracChangeset for help on using the changeset viewer.