IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4898


Ignore:
Timestamp:
Aug 29, 2005, 3:14:13 PM (21 years ago)
Author:
drobbin
Message:

Implemented psMemCheckType functions and tests. Some testing remains unfinished.

Location:
trunk/psLib
Files:
41 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/astro/psCoord.c

    r4857 r4898  
    1010*  @author GLG, MHPCC
    1111*
    12 *  @version $Revision: 1.83 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2005-08-23 23:23:05 $
     12*  @version $Revision: 1.84 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2005-08-30 01:14:10 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    219219}
    220220
     221
     222bool psMemCheckPlane(psPtr ptr)
     223{
     224    return ( psMemGetDeallocator(ptr) == (psFreeFunc)planeFree );
     225}
     226
     227bool psMemCheckSphere(psPtr ptr)
     228{
     229    return ( psMemGetDeallocator(ptr) == (psFreeFunc)sphereFree );
     230}
     231
     232bool psMemCheckCube(psPtr ptr)
     233{
     234    return ( psMemGetDeallocator(ptr) == (psFreeFunc)cubeFree );
     235}
     236
     237bool psMemCheckPlaneTransform(psPtr ptr)
     238{
     239    return ( psMemGetDeallocator(ptr) == (psFreeFunc)planeTransformFree );
     240}
     241
    221242psPlane* psPlaneTransformApply(psPlane* out,
    222243                               const psPlaneTransform* transform,
     
    267288    return(pt);
    268289}
     290
     291bool psMemCheckPlaneDistort(psPtr ptr)
     292{
     293    return ( psMemGetDeallocator(ptr) == (psFreeFunc)planeDistortFree );
     294}
     295
     296
    269297
    270298/******************************************************************************
     
    343371    return(p);
    344372}
     373
     374bool psMemCheckProjection(psPtr ptr)
     375{
     376    return ( psMemGetDeallocator(ptr) == (psFreeFunc)projectionFree );
     377}
     378
     379
    345380
    346381psPlane* psProject(const psSphere* coord,
  • trunk/psLib/src/astro/psCoord.h

    r4877 r4898  
    1010*  @author GLG, MHPCC
    1111*
    12 *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2005-08-25 23:42:01 $
     12*  @version $Revision: 1.42 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2005-08-30 01:14:10 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    219219);
    220220
     221/** Checks the type of a particular pointer.
     222 *
     223 *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     224 *
     225 *  @return bool:       True if the pointer matches a psPlane structure, false otherwise.
     226 */
     227bool psMemCheckPlane(
     228    psPtr ptr                          ///< the pointer whose type to check
     229);
     230
     231/** Checks the type of a particular pointer.
     232 *
     233 *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     234 *
     235 *  @return bool:       True if the pointer matches a psSphere structure, false otherwise.
     236 */
     237bool psMemCheckSphere(
     238    psPtr ptr                          ///< the pointer whose type to check
     239);
     240
     241/** Checks the type of a particular pointer.
     242 *
     243 *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     244 *
     245 *  @return bool:       True if the pointer matches a psCube structure, false otherwise.
     246 */
     247bool psMemCheckCube(
     248    psPtr ptr                          ///< the pointer whose type to check
     249);
     250
     251/** Checks the type of a particular pointer.
     252 *
     253 *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     254 *
     255 *  @return bool:       True if the pointer matches a psPlaneTransform structure, false otherwise.
     256 */
     257bool psMemCheckPlaneTransform(
     258    psPtr ptr                          ///< the pointer whose type to check
     259);
     260
     261/** Checks the type of a particular pointer.
     262 *
     263 *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     264 *
     265 *  @return bool:       True if the pointer matches a psPlaneDistort structure, false otherwise.
     266 */
     267bool psMemCheckPlaneDistort(
     268    psPtr ptr                          ///< the pointer whose type to check
     269);
     270
     271/** Checks the type of a particular pointer.
     272 *
     273 *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     274 *
     275 *  @return bool:       True if the pointer matches a psProjection structure, false otherwise.
     276 */
     277bool psMemCheckProjection(
     278    psPtr ptr                          ///< the pointer whose type to check
     279);
     280
     281
    221282/** Projects a spherical coordinate to a linear coordinate system
    222283 *
  • trunk/psLib/src/astro/psSphereOps.c

    r4708 r4898  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-08-05 01:40:45 $
     9 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-08-30 01:14:10 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3333#define JULIAN_CENTURY 36525.0
    3434
     35static void sphereRotFree(psSphereRot *result)
     36{
     37    // There are non dynamic allocated items
     38}
    3539
    3640psSphereRot* psSphereRotAlloc(double alphaP,
     
    5862    // calculate t*s*r.
    5963    psSphereRot* result = psSphereRotCombine(NULL,&t,&s);
     64    psMemSetDeallocator(result, (psFreeFunc)sphereRotFree);
    6065    psSphereRotCombine(result,result,&r);
    6166
    6267    return result;
    6368}
     69
     70bool psMemCheckSphereRot(psPtr ptr)
     71{
     72    return ( psMemGetDeallocator(ptr) == (psFreeFunc)sphereRotFree );
     73}
     74
    6475
    6576psSphereRot* psSphereRotQuat(double q0,
  • trunk/psLib/src/astro/psSphereOps.h

    r4708 r4898  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-08-05 01:40:45 $
     9 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-08-30 01:14:10 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    7272);
    7373
     74
     75/** Checks the type of a particular pointer.
     76 *
     77 *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     78 *
     79 *  @return bool:       True if the pointer matches a psSphereRot structure, false otherwise.
     80 */
     81bool psMemCheckSphereRot(
     82    psPtr ptr                          ///< the pointer whose type to check
     83);
     84
     85
    7486/** Allocator for psSphereRot given quaternions.
    7587 *
  • trunk/psLib/src/astro/psTime.c

    r4540 r4898  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.66 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2005-07-12 19:12:00 $
     12 *  @version $Revision: 1.67 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2005-08-30 01:14:10 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    434434}
    435435
     436static void timeFree(psTime *outTime)
     437{
     438    // There are non dynamic allocated items
     439}
     440
    436441psTime* psTimeAlloc(psTimeType type)
    437442{
     
    449454    // Allocate memory for structure
    450455    outTime = (psTime*)psAlloc(sizeof(psTime));
    451 
     456    psMemSetDeallocator(outTime, (psFreeFunc)timeFree);
    452457    // Initialize members
    453458    outTime->sec = 0;
     
    458463    return outTime;
    459464}
     465
     466
     467bool psMemCheckTime(psPtr ptr)
     468{
     469    return ( psMemGetDeallocator(ptr) == (psFreeFunc)timeFree );
     470}
     471
    460472
    461473psTime* psTimeGetNow(psTimeType type)
  • trunk/psLib/src/astro/psTime.h

    r4590 r4898  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-07-21 02:39:57 $
     13 *  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-08-30 01:14:10 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    100100);
    101101
     102
     103/** Checks the type of a particular pointer.
     104 *
     105 *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     106 *
     107 *  @return bool:       True if the pointer matches a psTime structure, false otherwise.
     108 */
     109bool psMemCheckTime(
     110    psPtr ptr                          ///< the pointer whose type to check
     111);
     112
     113
    102114/** Get current time.
    103115 *
  • trunk/psLib/src/fits/psFits.c

    r4891 r4898  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.42 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-08-27 01:33:41 $
     9 *  @version $Revision: 1.43 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-08-30 01:14:13 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    253253    return fits;
    254254}
     255
     256
     257bool psMemCheckFits(psPtr ptr)
     258{
     259    return ( psMemGetDeallocator(ptr) == (psFreeFunc)fitsFree );
     260}
     261
    255262
    256263bool psFitsMoveExtName(const psFits* fits,
  • trunk/psLib/src/fits/psFits.h

    r4343 r4898  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-06-22 03:00:27 $
     9 *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-08-30 01:14:13 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6262);
    6363
     64/** Checks the type of a particular pointer.
     65 *
     66 *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     67 *
     68 *  @return bool:       True if the pointer matches a psFits structure, false otherwise.
     69 */
     70bool psMemCheckFits(
     71    psPtr ptr                          ///< the pointer whose type to check
     72);
     73
     74
    6475/** Moves the FITS HDU to the specified extension name.
    6576 *
  • trunk/psLib/src/imageops/psImageConvolve.c

    r4815 r4898  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2005-08-18 21:44:40 $
     7 *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2005-08-30 01:14:13 $
    99 *
    1010 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    8686    }
    8787}
     88
     89
     90bool psMemCheckKernel(psPtr ptr)
     91{
     92    return ( psMemGetDeallocator(ptr) == (psFreeFunc)freeKernel );
     93}
     94
    8895
    8996psKernel* psKernelGenerate(const psVector* tShifts,
  • trunk/psLib/src/imageops/psImageConvolve.h

    r4815 r4898  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-08-18 21:44:40 $
     9 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-08-30 01:14:13 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    7777);
    7878
     79/** Checks the type of a particular pointer.
     80 *
     81 *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     82 *
     83 *  @return bool:       True if the pointer matches a psKernel structure, false otherwise.
     84 */
     85bool psMemCheckKernel(
     86    psPtr ptr                          ///< the pointer whose type to check
     87);
     88
     89
    7990/** Generates a kernel given a list of shift values
    8091 *
  • trunk/psLib/src/math/psFunctions.c

    r4876 r4898  
    77*  polynomials.  It also contains a Gaussian functions.
    88*
    9 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2005-08-25 22:52:29 $
     9*  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2005-08-30 01:14:13 $
    1111*
    1212*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    871871    return(newPoly);
    872872}
     873
     874
     875bool psMemCheckPolynomial1D(psPtr ptr)
     876{
     877    return ( psMemGetDeallocator(ptr) == (psFreeFunc)polynomial1DFree );
     878}
     879
     880bool psMemCheckPolynomial2D(psPtr ptr)
     881{
     882    return ( psMemGetDeallocator(ptr) == (psFreeFunc)polynomial2DFree );
     883}
     884
     885bool psMemCheckPolynomial3D(psPtr ptr)
     886{
     887    return ( psMemGetDeallocator(ptr) == (psFreeFunc)polynomial3DFree );
     888}
     889
     890bool psMemCheckPolynomial4D(psPtr ptr)
     891{
     892    return ( psMemGetDeallocator(ptr) == (psFreeFunc)polynomial4DFree );
     893}
     894
     895bool psMemCheckSpline1D(psPtr ptr)
     896{
     897    return ( psMemGetDeallocator(ptr) == (psFreeFunc)spline1DFree );
     898}
     899
    873900
    874901psF64 psPolynomial1DEval(const psPolynomial1D* poly, psF64 x)
  • trunk/psLib/src/math/psFunctions.h

    r4581 r4898  
    1212 *  @author GLG, MHPCC
    1313 *
    14  *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2005-07-20 01:21:13 $
     14 *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2005-08-30 01:14:13 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    163163);
    164164
     165/** Checks the type of a particular pointer.
     166 *
     167 *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     168 *
     169 *  @return bool:       True if the pointer matches a psPolynomial1D structure, false otherwise.
     170 */
     171bool psMemCheckPolynomial1D(
     172    psPtr ptr                          ///< the pointer whose type to check
     173);
     174
     175/** Checks the type of a particular pointer.
     176 *
     177 *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     178 *
     179 *  @return bool:       True if the pointer matches a psPolynomial2D structure, false otherwise.
     180 */
     181bool psMemCheckPolynomial2D(
     182    psPtr ptr                          ///< the pointer whose type to check
     183);
     184
     185/** Checks the type of a particular pointer.
     186 *
     187 *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     188 *
     189 *  @return bool:       True if the pointer matches a psPolynomial3D structure, false otherwise.
     190 */
     191bool psMemCheckPolynomial3D(
     192    psPtr ptr                          ///< the pointer whose type to check
     193);
     194
     195/** Checks the type of a particular pointer.
     196 *
     197 *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     198 *
     199 *  @return bool:       True if the pointer matches a psPolynomial4D structure, false otherwise.
     200 */
     201bool psMemCheckPolynomial4D(
     202    psPtr ptr                          ///< the pointer whose type to check
     203);
     204
     205/** Checks the type of a particular pointer.
     206 *
     207 *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     208 *
     209 *  @return bool:       True if the pointer matches a psSpline1D structure, false otherwise.
     210 */
     211bool psMemCheckSpline1D(
     212    psPtr ptr                          ///< the pointer whose type to check
     213);
     214
     215
     216
    165217/** Evaluates a 1-D polynomial at specific coordinates.
    166218 *
  • trunk/psLib/src/math/psMinimize.c

    r4858 r4898  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.131 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-08-24 01:04:37 $
     11 *  @version $Revision: 1.132 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-08-30 01:14:13 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    13721372}
    13731373
    1374 
     1374static void minimizationFree(psMinimization *min)
     1375{
     1376    // There are non dynamic allocated items
     1377}
    13751378
    13761379/******************************************************************************
     
    13821385
    13831386    psMinimization *min = psAlloc(sizeof(psMinimization));
     1387    psMemSetDeallocator(min, (psFreeFunc)minimizationFree);
    13841388    *(int*)&min->maxIter = maxIter;
    13851389    *(float*)&min->tol = tol;
     
    13901394    return(min);
    13911395}
     1396
     1397bool psMemCheckMinimization(psPtr ptr)
     1398{
     1399    return ( psMemGetDeallocator(ptr) == (psFreeFunc)minimizationFree );
     1400}
     1401
    13921402
    13931403// This macro takes as input the vector BASE and adds a multiple of the vector
  • trunk/psLib/src/math/psMinimize.h

    r4760 r4898  
    88 *  @author GLG, MHPCC
    99 *
    10  *  @version $Revision: 1.52 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2005-08-11 23:04:32 $
     10 *  @version $Revision: 1.53 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2005-08-30 01:14:13 $
    1212 *
    1313 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6060);
    6161
     62/** Checks the type of a particular pointer.
     63 *
     64 *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     65 *
     66 *  @return bool:       True if the pointer matches a psMinimization structure, false otherwise.
     67 */
     68bool psMemCheckMinimization(
     69    psPtr ptr                          ///< the pointer whose type to check
     70);
     71
     72
    6273/** Derive a polynomial fit.
    6374 *
  • trunk/psLib/src/math/psStats.c

    r4620 r4898  
    1414 *      stats->binsize
    1515 *
    16  *  @version $Revision: 1.138 $ $Name: not supported by cvs2svn $
    17  *  @date $Date: 2005-07-27 19:55:16 $
     16 *  @version $Revision: 1.139 $ $Name: not supported by cvs2svn $
     17 *  @date $Date: 2005-08-30 01:14:13 $
    1818 *
    1919 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    17531753static void histogramFree(psHistogram* myHist);
    17541754
     1755static void statsFree(psStats *newStruct)
     1756{
     1757    // There are non dynamic allocated items
     1758}
     1759
    17551760/******************************************************************************
    17561761    psStatsAlloc(): This routine must create a new psStats data structure.
     
    17611766
    17621767    newStruct = (psStats* ) psAlloc(sizeof(psStats));
     1768    psMemSetDeallocator(newStruct, (psFreeFunc)statsFree);
    17631769    newStruct->sampleMean = NAN;
    17641770    newStruct->sampleMedian = NAN;
     
    17871793}
    17881794
     1795
     1796bool psMemCheckStats(psPtr ptr)
     1797{
     1798    return ( psMemGetDeallocator(ptr) == (psFreeFunc)statsFree );
     1799}
     1800
     1801
     1802
    17891803/******************************************************************************
    17901804psHistogramAlloc(lower, upper, n): allocate a uniform histogram structure
     
    18851899    psFree(myHist->nums);
    18861900}
     1901
     1902
     1903bool psMemCheckHistogram(psPtr ptr)
     1904{
     1905    return ( psMemGetDeallocator(ptr) == (psFreeFunc)histogramFree );
     1906}
     1907
     1908
    18871909
    18881910/*****************************************************************************
  • trunk/psLib/src/math/psStats.h

    r4857 r4898  
    1414 *  @author GLG, MHPCC
    1515 *
    16  *  @version $Revision: 1.47 $ $Name: not supported by cvs2svn $
    17  *  @date $Date: 2005-08-23 23:23:05 $
     16 *  @version $Revision: 1.48 $ $Name: not supported by cvs2svn $
     17 *  @date $Date: 2005-08-30 01:14:13 $
    1818 *
    1919 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    105105);
    106106
     107
     108/** Checks the type of a particular pointer.
     109 *
     110 *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     111 *
     112 *  @return bool:       True if the pointer matches a psStats structure, false otherwise.
     113 */
     114bool psMemCheckStats(
     115    psPtr ptr                          ///< the pointer whose type to check
     116);
     117
     118
    107119/******************************************************************************
    108120    Histogram functions and data structures.
     
    140152);
    141153
     154
     155/** Checks the type of a particular pointer.
     156 *
     157 *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     158 *
     159 *  @return bool:       True if the pointer matches a psHistogram structure, false otherwise.
     160 */
     161bool psMemCheckHistogram(
     162    psPtr ptr                          ///< the pointer whose type to check
     163);
     164
     165
    142166/** Allocator for psHistogram where the bounds of the bins are explicitly
    143167 *  specified.
  • trunk/psLib/src/mathtypes/psImage.c

    r4887 r4898  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.77 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-08-26 23:01:17 $
     11 *  @version $Revision: 1.78 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-08-30 01:14:13 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    9090    return image;
    9191}
     92
     93
     94bool psMemCheckImage(psPtr ptr)
     95{
     96    return ( psMemGetDeallocator(ptr) == (psFreeFunc)imageFree );
     97}
     98
    9299
    93100psRegion psRegionSet(float x0,
  • trunk/psLib/src/mathtypes/psImage.h

    r4886 r4898  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.63 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-08-26 03:35:02 $
     13 *  @version $Revision: 1.64 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-08-30 01:14:13 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    111111;
    112112
     113
     114/** Checks the type of a particular pointer.
     115 *
     116 *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     117 *
     118 *  @return bool:       True if the pointer matches a psImage structure, false otherwise.
     119 */
     120bool psMemCheckImage(
     121    psPtr ptr                          ///< the pointer whose type to check
     122);
     123
     124
    113125/** Create a psRegion with the specified attributes.
    114126 *
  • trunk/psLib/src/mathtypes/psScalar.c

    r4540 r4898  
    88 *  @author Ross Harman, MHPCC
    99 *
    10  *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2005-07-12 19:12:01 $
     10 *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2005-08-30 01:14:13 $
    1212 *
    1313 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2222#include "psErrorText.h"
    2323
     24static void scalarFree(psScalar *scalar)
     25{
     26    // There are non dynamic allocated items
     27}
     28
    2429psScalar* psScalarAlloc(complex value, psElemType type)
    2530{
     
    2833    // Create scalar
    2934    scalar = (psScalar* ) psAlloc(sizeof(psScalar));
    30 
     35    psMemSetDeallocator(scalar, (psFreeFunc)scalarFree);
    3136    scalar->type.dimen = PS_DIMEN_SCALAR;
    3237    scalar->type.type = type;
     
    7984    return scalar;
    8085}
     86
     87
     88bool psMemCheckScalar(psPtr ptr)
     89{
     90    return ( psMemGetDeallocator(ptr) == (psFreeFunc)scalarFree );
     91}
     92
    8193
    8294psScalar* psScalarCopy(const psScalar *value)
  • trunk/psLib/src/mathtypes/psScalar.h

    r4540 r4898  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-07-12 19:12:01 $
     13 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-08-30 01:14:13 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    7070);
    7171
     72
     73/** Checks the type of a particular pointer.
     74 *
     75 *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     76 *
     77 *  @return bool:       True if the pointer matches a psScalar structure, false otherwise.
     78 */
     79bool psMemCheckScalar(
     80    psPtr ptr                          ///< the pointer whose type to check
     81);
     82
     83
    7284/** Copy a scalar.
    7385 *
  • trunk/psLib/src/mathtypes/psVector.c

    r4887 r4898  
    99*  @author Robert DeSonia, MHPCC
    1010*
    11 *  @version $Revision: 1.49 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2005-08-26 23:01:17 $
     11*  @version $Revision: 1.50 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2005-08-30 01:14:13 $
    1313*
    1414*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6060
    6161// FUNCTION IMPLEMENTATION - PUBLIC
     62bool psMemCheckVector(psPtr ptr)
     63{
     64    return ( psMemGetDeallocator(ptr) == (psFreeFunc)vectorFree );
     65}
     66
    6267
    6368psVector* psVectorAlloc(long nalloc,
  • trunk/psLib/src/mathtypes/psVector.h

    r4887 r4898  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-08-26 23:01:17 $
     13 *  @version $Revision: 1.42 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-08-30 01:14:13 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6161/*****************************************************************************/
    6262
     63/** Checks the type of a particular pointer.
     64 *
     65 *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     66 *
     67 *  @return bool:       True if the pointer matches a psVector structure, false otherwise.
     68 */
     69bool psMemCheckVector(
     70    psPtr ptr                          ///< the pointer whose type to check
     71)
     72;
    6373
    6474/** Allocate a vector.
     
    7282    long nalloc,                       ///< Total number of elements to make available.
    7383    psElemType type                    ///< Type of data to be held by vector.
    74 )
    75 ;
     84);
    7685
    7786/** Reallocate a vector.
  • trunk/psLib/src/sys/psMemory.c

    r4877 r4898  
    88*  @author Robert Lupton, Princeton University
    99*
    10 *  @version $Revision: 1.61 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2005-08-25 23:42:07 $
     10*  @version $Revision: 1.62 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2005-08-30 01:14:13 $
    1212*
    1313*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2424#include "psAbort.h"
    2525#include "psLogMsg.h"
     26
     27#include "psBitSet.h"
     28//#include "psArray.h"
     29//#include "psImage.h"
     30//#include "psList.h"
     31//#include "psLookupTable.h"
     32//#include "psHash.h"
     33
     34//#include "psMetadata.h"
     35#include "psFits.h"
     36#include "psPixels.h"
     37//#include "psScalar.h"
     38//#include "psVector.h"
     39//#include "psFunctions.h"
     40//#include "psTime.h"
     41//#include "psCoord.h"
     42#include "psSphereOps.h"
     43//#include "psStats.h"
     44#include "psMinimize.h"
     45#include "psImageConvolve.h"
     46#include "psTime.h"
    2647
    2748#include "psErrorText.h"
     
    688709}
    689710
     711
     712bool psMemCheckType(psDataType type,
     713                    psPtr ptr)
     714{
     715    switch(type) {
     716    case PS_DATA_ARRAY:
     717        if ( psMemCheckArray(ptr) )
     718            return true;
     719        else {
     720            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     721            break;
     722        }
     723    case PS_DATA_BITSET:
     724        if ( psMemCheckBitSet(ptr) )
     725            return true;
     726        else {
     727            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     728            break;
     729        }
     730        /*    case PS_DATA_CELL:
     731                if ( psMemCheckCell(ptr) )
     732                    return true;
     733                else
     734                {
     735                    psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     736                    break;
     737                }
     738            case PS_DATA_CHIP:
     739                if ( psMemCheckChip(ptr) )
     740                    return true;
     741                else
     742                {
     743                    psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     744                    break;
     745                }
     746        */
     747    case PS_DATA_CUBE:
     748        if ( psMemCheckCube(ptr) )
     749            return true;
     750        else {
     751            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     752            break;
     753        }
     754
     755
     756    case PS_DATA_FITS:
     757        if ( psMemCheckFits(ptr) )
     758            return true;
     759        else {
     760            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     761            break;
     762        }
     763
     764    case PS_DATA_HASH:
     765        if ( psMemCheckHash(ptr) )
     766            return true;
     767        else {
     768            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     769            break;
     770        }
     771    case PS_DATA_HISTOGRAM:
     772        if ( psMemCheckHistogram(ptr) )
     773            return true;
     774        else {
     775            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     776            break;
     777        }
     778    case PS_DATA_IMAGE:
     779        if ( psMemCheckImage(ptr) )
     780            return true;
     781        else {
     782            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     783            break;
     784        }
     785    case PS_DATA_KERNEL:
     786        if ( psMemCheckKernel(ptr) )
     787            return true;
     788        else {
     789            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     790            break;
     791        }
     792    case PS_DATA_LIST:
     793        if ( psMemCheckList(ptr) )
     794            return true;
     795        else {
     796            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     797            break;
     798        }
     799    case PS_DATA_LOOKUPTABLE:
     800        if ( psMemCheckLookupTable(ptr) )
     801            return true;
     802        else {
     803            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     804            break;
     805        }
     806    case PS_DATA_METADATA:
     807        if ( psMemCheckMetadata(ptr) )
     808            return true;
     809        else {
     810            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     811            break;
     812        }
     813    case PS_DATA_METADATAITEM:
     814        if ( psMemCheckMetadataItem(ptr) )
     815            return true;
     816        else {
     817            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     818            break;
     819        }
     820    case PS_DATA_MINIMIZATION:
     821        if ( psMemCheckMinimization(ptr) )
     822            return true;
     823        else {
     824            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     825            break;
     826        }
     827    case PS_DATA_PIXELS:
     828        if ( psMemCheckPixels(ptr) )
     829            return true;
     830        else {
     831            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     832            break;
     833        }
     834    case PS_DATA_PLANE:
     835        if ( psMemCheckPlane(ptr) )
     836            return true;
     837        else {
     838            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     839            break;
     840        }
     841    case PS_DATA_PLANEDISTORT:
     842        if ( psMemCheckPlaneDistort(ptr) )
     843            return true;
     844        else {
     845            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     846            break;
     847        }
     848    case PS_DATA_PLANETRANSFORM:
     849        if ( psMemCheckPlaneTransform(ptr) )
     850            return true;
     851        else {
     852            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     853            break;
     854        }
     855    case PS_DATA_POLYNOMIAL1D:
     856        if ( psMemCheckPolynomial1D(ptr) )
     857            return true;
     858        else {
     859            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     860            break;
     861        }
     862    case PS_DATA_POLYNOMIAL2D:
     863        if ( psMemCheckPolynomial2D(ptr) )
     864            return true;
     865        else {
     866            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     867            break;
     868        }
     869    case PS_DATA_POLYNOMIAL3D:
     870        if ( psMemCheckPolynomial3D(ptr) )
     871            return true;
     872        else {
     873            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     874            break;
     875        }
     876    case PS_DATA_POLYNOMIAL4D:
     877        if ( psMemCheckPolynomial4D(ptr) )
     878            return true;
     879        else {
     880            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     881            break;
     882        }
     883    case PS_DATA_PROJECTION:
     884        if ( psMemCheckProjection(ptr) )
     885            return true;
     886        else {
     887            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     888            break;
     889        }
     890
     891        /*    case PS_DATA_READOUT:
     892                if ( psMemCheckReadout(ptr) )
     893                    return true;
     894                else
     895                {
     896                    psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     897                    break;
     898                }
     899         
     900        *//*    case PS_DATA_REGION:
     901                if ( psMemCheckRegion(ptr) )
     902                    return true;
     903                else
     904                {
     905                    psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     906                    break;
     907                }
     908        */
     909    case PS_DATA_SCALAR:
     910        if ( psMemCheckScalar(ptr) )
     911            return true;
     912        else {
     913            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     914            break;
     915        }
     916    case PS_DATA_SPHERE:
     917        if ( psMemCheckSphere(ptr) )
     918            return true;
     919        else {
     920            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     921            break;
     922        }
     923    case PS_DATA_SPHEREROT:
     924        if ( psMemCheckSphereRot(ptr) )
     925            return true;
     926        else {
     927            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     928            break;
     929        }
     930    case PS_DATA_SPLINE1D:
     931        if ( psMemCheckSpline1D(ptr) )
     932            return true;
     933        else {
     934            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     935            break;
     936        }
     937    case PS_DATA_STATS:
     938        if ( psMemCheckStats(ptr) )
     939            return true;
     940        else {
     941            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     942            break;
     943        }
     944    case PS_DATA_TIME:
     945        if ( psMemCheckTime(ptr) )
     946            return true;
     947        else {
     948            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     949            break;
     950        }
     951    case PS_DATA_VECTOR:
     952        if ( psMemCheckVector(ptr) )
     953            return true;
     954        else {
     955            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Incorrect pointer.  Datatypes do not match.\n");
     956            break;
     957        }
     958    default:
     959        psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Invalid datatype specified.\n");
     960    }
     961    return false;
     962}
     963
     964
    690965bool p_psMemGetPersistent(psPtr vptr)
    691966{
  • trunk/psLib/src/sys/psMemory.h

    r4590 r4898  
    1212 *  @ingroup MemoryManagement
    1313 *
    14  *  @version $Revision: 1.48 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2005-07-21 02:39:57 $
     14 *  @version $Revision: 1.49 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2005-08-30 01:14:13 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    172172);
    173173
     174/** Checks the deallocator to see if the pointer matches the desired datatype.
     175 *
     176 *  @return bool:       True if type matches, otherwise false.
     177 */
     178bool psMemCheckType(
     179    psDataType type,                   ///< The desired psDataType to match
     180    psPtr ptr                          ///< The desired pointer to match
     181);
     182
     183
    174184/** Set the memory as persistent so that it is ignored when detecting memory leaks.
    175185 *
  • trunk/psLib/src/types/psArray.c

    r4600 r4898  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.36 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-07-22 23:47:13 $
     11 *  @version $Revision: 1.37 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-08-30 01:14:13 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    4545    psFree(psArr->data);
    4646}
     47
     48bool psMemCheckArray(psPtr ptr)
     49{
     50    return ( psMemGetDeallocator(ptr) == (psFreeFunc)arrayFree );
     51}
     52
    4753
    4854/*****************************************************************************
  • trunk/psLib/src/types/psArray.h

    r4600 r4898  
    1212 *  @author Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2005-07-22 23:47:13 $
     14 *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2005-08-30 01:14:13 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    4747/*****************************************************************************/
    4848
     49/** Checks the type of a particular pointer.
     50 *
     51 *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     52 *
     53 *  @return bool:       True if the pointer matches a psArray structure, false otherwise.
     54 */
     55bool psMemCheckArray(
     56    psPtr ptr                          ///< the pointer whose type to check
     57)
     58;
     59
     60
    4961/** Allocate an array.
    5062 *
     
    5769psArray* psArrayAlloc(
    5870    long nalloc                        ///< Total number of elements to make available.
    59 )
    60 ;
     71);
    6172
    6273/** Reallocate an array.
  • trunk/psLib/src/types/psBitSet.c

    r4819 r4898  
    1111 *  @author Robert DeSonia, MHPCC
    1212 *
    13  *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-08-19 00:31:42 $
     13 *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-08-30 01:14:13 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6565    psFree(inBitSet->bits);
    6666}
     67
     68bool psMemCheckBitSet(psPtr ptr)
     69{
     70    return ( psMemGetDeallocator(ptr) == (psFreeFunc)bitSetFree );
     71}
     72
    6773
    6874psBitSet* psBitSetAlloc(long nalloc)
  • trunk/psLib/src/types/psBitSet.h

    r4610 r4898  
    1212 *  @author Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2005-07-26 00:44:45 $
     14 *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2005-08-30 01:14:13 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    4747/*****************************************************************************/
    4848
     49/** Checks the type of a particular pointer.
     50 *
     51 *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     52 *
     53 *  @return bool:       True if the pointer matches a psBitSet structure, false otherwise.
     54 */
     55bool psMemCheckBitSet(
     56    psPtr ptr                          ///< the pointer whose type to check
     57)
     58;
     59
     60
    4961/** Allocate a psBitSet.
    5062 *
     
    5668psBitSet* psBitSetAlloc(
    5769    long nalloc                            ///< Number of bits in psBitSet array
    58 )
    59 ;
     70);
    6071
    6172/** Set a bit.
  • trunk/psLib/src/types/psHash.c

    r4556 r4898  
    1212*  @author GLG, MHPCC
    1313*
    14 *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
    15 *  @date $Date: 2005-07-15 02:33:54 $
     14*  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
     15*  @date $Date: 2005-08-30 01:14:13 $
    1616*
    1717*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    160160}
    161161
     162bool psMemCheckHash(psPtr ptr)
     163{
     164    return ( psMemGetDeallocator(ptr) == (psFreeFunc)hashFree );
     165}
     166
     167
    162168/******************************************************************************
    163169hashFree(table): This procedure deallocates the specified hash
  • trunk/psLib/src/types/psHash.h

    r4556 r4898  
    1111 *  @author GLG, MHPCC
    1212 *
    13  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-07-15 02:33:54 $
     13 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-08-30 01:14:13 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    4646psHash;
    4747
     48/** Checks the type of a particular pointer.
     49 *
     50 *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     51 *
     52 *  @return bool:       True if the pointer matches a psHash structure, false otherwise.
     53 */
     54bool psMemCheckHash(
     55    psPtr ptr                          ///< the pointer whose type to check
     56)
     57;
     58
     59
    4860/// Allocate hash buckets in table.
    4961psHash* psHashAlloc(
    5062    long nalloc                        ///< The number of buckets to allocate.
    51 )
    52 ;
     63);
    5364
    5465/// Insert entry into table.
  • trunk/psLib/src/types/psList.c

    r4556 r4898  
    66 *  @author Robert Daniel DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-07-15 02:33:54 $
     8 *  @version $Revision: 1.42 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-08-30 01:14:13 $
    1010 *
    1111 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    148148    return list;
    149149}
     150
     151bool psMemCheckList(psPtr ptr)
     152{
     153    return ( psMemGetDeallocator(ptr) == (psFreeFunc)listFree );
     154}
     155
     156
    150157
    151158psListIterator* psListIteratorAlloc(psList* list, long location, bool mutable)
  • trunk/psLib/src/types/psList.h

    r4590 r4898  
    77 *  @ingroup LinkedList
    88 *
    9  *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-07-21 02:39:57 $
     9 *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-08-30 01:14:13 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    8484
    8585
    86 /** Creates a psList linked list object.
    87  *
    88  *  @return psList* A new psList object.
    89  */
    90 psList* psListAlloc(
    91     psPtr data
    92     ///< initial data item; may be NULL if no an empty psList is desired
     86/** Checks the type of a particular pointer.
     87 *
     88 *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     89 *
     90 *  @return bool:       True if the pointer matches a psList structure, false otherwise.
     91 */
     92bool psMemCheckList(
     93    psPtr ptr                          ///< the pointer whose type to check
    9394)
    9495;
     96
     97
     98/** Creates a psList linked list object.
     99 *
     100 *  @return psList* A new psList object.
     101 */
     102psList* psListAlloc(
     103    psPtr data          ///< initial data item; may be NULL if an empty psList is desired
     104);
    95105
    96106/** Creates a psListIterator object and associates it with a psList.
  • trunk/psLib/src/types/psLookupTable.c

    r4589 r4898  
    77*  @author Ross Harman, MHPCC
    88*
    9 *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2005-07-21 01:40:10 $
     9*  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2005-08-30 01:14:13 $
    1111*
    1212*  Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
     
    263263/* FUNCTION IMPLEMENTATION - PUBLIC                                          */
    264264/*****************************************************************************/
     265
     266bool psMemCheckLookupTable(psPtr ptr)
     267{
     268    return ( psMemGetDeallocator(ptr) == (psFreeFunc)lookupTableFree );
     269}
     270
    265271
    266272psLookupTable* psLookupTableAlloc(const char *filename,
  • trunk/psLib/src/types/psLookupTable.h

    r4589 r4898  
    77*  @author Ross Harman, MHPCC
    88*
    9 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2005-07-21 01:40:10 $
     9*  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2005-08-30 01:14:13 $
    1111*
    1212*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6060    PS_PARSE_ERROR_GENERAL        = 0x0104         ///< Any other type of lookup error
    6161}psParseErrorType;
     62
     63/** Checks the type of a particular pointer.
     64 *
     65 *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     66 *
     67 *  @return bool:       True if the pointer matches a psLookupTable structure, false otherwise.
     68 */
     69bool psMemCheckLookupTable(
     70    psPtr ptr                          ///< the pointer whose type to check
     71);
     72
    6273
    6374/** Allocator for psLookupTable struct
  • trunk/psLib/src/types/psMetadata.c

    r4891 r4898  
    1212*  @author Ross Harman, MHPCC
    1313*
    14 *  @version $Revision: 1.78 $ $Name: not supported by cvs2svn $
    15 *  @date $Date: 2005-08-27 01:33:41 $
     14*  @version $Revision: 1.79 $ $Name: not supported by cvs2svn $
     15*  @date $Date: 2005-08-30 01:14:13 $
    1616*
    1717*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    162162    return metadataItem;
    163163}
     164
     165bool psMemCheckMetadataItem(psPtr ptr)
     166{
     167    return ( psMemGetDeallocator(ptr) == (psFreeFunc)metadataItemFree );
     168}
     169
    164170
    165171#define METADATAITEM_ALLOC_TYPE(NAME,TYPE,METATYPE) \
     
    273279    return metadata;
    274280}
     281
     282
     283bool psMemCheckMetadata(psPtr ptr)
     284{
     285    return ( psMemGetDeallocator(ptr) == (psFreeFunc)metadataFree );
     286}
     287
     288
    275289
    276290bool psMetadataAddItem(psMetadata *md,
  • trunk/psLib/src/types/psMetadata.h

    r4891 r4898  
    1111*  @author Ross Harman, MHPCC
    1212*
    13 *  @version $Revision: 1.59 $ $Name: not supported by cvs2svn $
    14 *  @date $Date: 2005-08-27 01:33:41 $
     13*  @version $Revision: 1.60 $ $Name: not supported by cvs2svn $
     14*  @date $Date: 2005-08-30 01:14:13 $
    1515*
    1616*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    155155;
    156156
     157
     158/** Checks the type of a particular pointer.
     159 *
     160 *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     161 *
     162 *  @return bool:       True if the pointer matches a psMetadataItem structure, false otherwise.
     163 */
     164bool psMemCheckMetadataItem(
     165    psPtr ptr                          ///< the pointer whose type to check
     166);
     167
     168
    157169/** Create a metadata item with specified string data.
    158170 *
     
    253265psMetadata* psMetadataAlloc(void);
    254266
     267
     268/** Checks the type of a particular pointer.
     269 *
     270 *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     271 *
     272 *  @return bool:       True if the pointer matches a psMetadata structure, false otherwise.
     273 */
     274bool psMemCheckMetadata(
     275    psPtr ptr                          ///< the pointer whose type to check
     276);
     277
     278
    255279/** Add existing metadata item to metadata collection.
    256280 *
  • trunk/psLib/src/types/psPixels.c

    r4597 r4898  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-07-22 22:19:27 $
     9 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-08-30 01:14:13 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    7171    return out;
    7272}
     73
     74
     75bool psMemCheckPixels(psPtr ptr)
     76{
     77    return ( psMemGetDeallocator(ptr) == (psFreeFunc)pixelsFree );
     78}
     79
    7380
    7481psPixels* psPixelsRealloc(psPixels* pixels, long nalloc)
  • trunk/psLib/src/types/psPixels.h

    r4608 r4898  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-07-25 20:49:04 $
     9 *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-08-30 01:14:13 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    5757)
    5858;
     59
     60/** Checks the type of a particular pointer.
     61 *
     62 *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     63 *
     64 *  @return bool:       True if the pointer matches a psPixels structure, false otherwise.
     65 */
     66bool psMemCheckPixels(
     67    psPtr ptr                          ///< the pointer whose type to check
     68);
     69
    5970
    6071/** resizes a psPixels structure
  • trunk/psLib/test/sys/tst_psMemory.c

    r4877 r4898  
    66*  @author Robert DeSonia, MHPCC
    77*
    8 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2005-08-25 23:42:07 $
     8*  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2005-08-30 01:14:13 $
    1010*
    1111*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3535static psS32 TPmemCorruption( void );
    3636static psS32 TPmultipleFree( void );
     37static psS32 memCheckTypes( void );
    3738void memProblemCallback( psMemBlock *ptr, const char *filename, unsigned int lineno );
    3839
     
    5354                              {TPFreeReferencedMemory, 456, "freeReferencedMemory", 0, false},
    5455                              {TPmultipleFree, 699, "multipleFree", -6, false},
     56                              {memCheckTypes, 700, "psMemCheckType", 0, false},
    5557                              {NULL}
    5658                          };
     
    534536    return 0;
    535537}
     538
     539static psS32 memCheckTypes( void )
     540{
     541    //    psArray *negative;
     542    //    negative = psArrayAlloc(2);
     543    //    psMetadata *neg;
     544    //    neg = psMetadataAlloc();
     545
     546    psArray *array;
     547    array = psArrayAlloc(100);
     548    if ( !psMemCheckType(PS_DATA_ARRAY, array) ) {
     549        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckArray failed in memCheckType. \n");
     550        psFree(array);
     551        return 1;
     552    }
     553    //    if ( psMemCheckType(PS_DATA_ARRAY, neg) )
     554    //    {
     555    //        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckArray failed in memCheckType. \n");
     556    //        return 1;
     557    //    }
     558    psFree(array);
     559
     560    psBitSet *bits;
     561    bits = psBitSetAlloc(100);
     562    if ( !psMemCheckType(PS_DATA_BITSET, bits) ) {
     563        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckBitSet failed in memCheckType. \n");
     564        psFree(bits);
     565        return 1;
     566    }
     567    //    if ( psMemCheckType(PS_DATA_BITSET, negative) )
     568    //    {
     569    //        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckBitSet failed in memCheckType. \n");
     570    //        return 1;
     571    //    }
     572    psFree(bits);
     573
     574    psCube *cube;
     575    cube = psCubeAlloc();
     576    if ( !psMemCheckType(PS_DATA_CUBE, cube) ) {
     577        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckCube failed in memCheckType. \n");
     578        psFree(cube);
     579        return 1;
     580    }
     581    psFree(cube);
     582
     583    /*
     584        psFits *fits;
     585        char *filename = "";
     586        fits = psFitsAlloc(filename);
     587        if ( !psMemCheckType(PS_DATA_FITS, fits) )
     588        {
     589            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckFits failed in memCheckType. \n");
     590            psFree(fits);
     591            return 1;
     592        }
     593        psFree(fits);
     594    */
     595    psHash *hash;
     596    hash = psHashAlloc(100);
     597    if ( !psMemCheckType(PS_DATA_HASH, hash) ) {
     598        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckHash failed in memCheckType. \n");
     599        psFree(hash);
     600        return 1;
     601    }
     602    psFree(hash);
     603
     604    psHistogram *histogram;
     605    histogram = psHistogramAlloc(1.1, 2.2, 2);
     606    if ( !psMemCheckType(PS_DATA_HISTOGRAM, histogram) ) {
     607        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckHistogram failed in memCheckType. \n");
     608        psFree(histogram);
     609        return 1;
     610    }
     611    psFree(histogram);
     612
     613    psImage *image;
     614    image = psImageAlloc(5, 5, PS_TYPE_F32);
     615    if ( !psMemCheckType(PS_DATA_IMAGE, image) ) {
     616        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckImage failed in memCheckType. \n");
     617        psFree(image);
     618        return 1;
     619    }
     620    psFree(image);
     621
     622    psKernel *kernel;
     623    kernel = psKernelAlloc(0, 1, 0, 1);
     624    if ( !psMemCheckType(PS_DATA_KERNEL, kernel) ) {
     625        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckKernel failed in memCheckType. \n");
     626        psFree(kernel);
     627        return 1;
     628    }
     629    psFree(kernel);
     630
     631    psList *list;
     632    list = psListAlloc(NULL);
     633    if ( !psMemCheckType(PS_DATA_LIST, list) ) {
     634        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckList failed in memCheckType. \n");
     635        psFree(list);
     636        return 1;
     637    }
     638    psFree(list);
     639
     640    /*
     641        psLookupTable *lookup;
     642        char *filename = "";
     643        char *format = "%d";
     644        lookup = psLookupTableAlloc(filename, format, 0);
     645        if ( !psMemCheckType(PS_DATA_LOOKUPTABLE, lookup) )
     646        {
     647            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckLookupTable failed in memCheckType. \n");
     648            psFree(lookup);
     649            return 1;
     650        }
     651        psFree(lookup);
     652    */
     653    psMetadata *metadata;
     654    metadata = psMetadataAlloc();
     655    if ( !psMemCheckType(PS_DATA_METADATA, metadata) ) {
     656        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckMetadata failed in memCheckType. \n");
     657        psFree(metadata);
     658        return 1;
     659    }
     660    psFree(metadata);
     661
     662    psMetadataItem *metaItem;
     663    metaItem = psMetadataItemAlloc("name", PS_DATA_S32, "COMMENT", 1);
     664    if ( !psMemCheckType(PS_DATA_METADATAITEM, metaItem) ) {
     665        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckMetadataItem failed in memCheckType. \n");
     666        psFree(metaItem);
     667        return 1;
     668    }
     669    psFree(metaItem);
     670
     671    psMinimization *min;
     672    min = psMinimizationAlloc(3, 0.1);
     673    if ( !psMemCheckType(PS_DATA_MINIMIZATION, min) ) {
     674        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckMinimization failed in memCheckType. \n");
     675        psFree(min);
     676        return 1;
     677    }
     678    psFree(min);
     679
     680    psPixels *pixels;
     681    pixels = psPixelsAlloc(100);
     682    if ( !psMemCheckType(PS_DATA_PIXELS, pixels) ) {
     683        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckPixels failed in memCheckType. \n");
     684        psFree(pixels);
     685        return 1;
     686    }
     687    psFree(pixels);
     688
     689    psPlane *plane;
     690    plane = psPlaneAlloc();
     691    if ( !psMemCheckType(PS_DATA_PLANE, plane) ) {
     692        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckPlane failed in memCheckType. \n");
     693        psFree(plane);
     694        return 1;
     695    }
     696    psFree(plane);
     697
     698    psPlaneDistort *planeDistort;
     699    planeDistort = psPlaneDistortAlloc(1, 1, 1, 1);
     700    if ( !psMemCheckType(PS_DATA_PLANEDISTORT, planeDistort) ) {
     701        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckPlaneDistort failed in memCheckType. \n");
     702        psFree(planeDistort);
     703        return 1;
     704    }
     705    psFree(planeDistort);
     706
     707    psPlaneTransform *planeTransform;
     708    planeTransform = psPlaneTransformAlloc(1, 1);
     709    if ( !psMemCheckType(PS_DATA_PLANETRANSFORM, planeTransform) ) {
     710        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckPlaneTransform failed in memCheckType. \n");
     711        psFree(planeTransform);
     712        return 1;
     713    }
     714    psFree(planeTransform);
     715
     716    psPolynomial1D *poly1;
     717    poly1 = psPolynomial1DAlloc(2, PS_POLYNOMIAL_ORD);
     718    if ( !psMemCheckType(PS_DATA_POLYNOMIAL1D, poly1) ) {
     719        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckPolynomial1D failed in memCheckType. \n");
     720        psFree(poly1);
     721        return 1;
     722    }
     723    psFree(poly1);
     724
     725    psPolynomial2D *poly2;
     726    poly2 = psPolynomial2DAlloc(2, 1, PS_POLYNOMIAL_ORD);
     727    if ( !psMemCheckType(PS_DATA_POLYNOMIAL2D, poly2) ) {
     728        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckPolynomial2D failed in memCheckType. \n");
     729        psFree(poly2);
     730        return 1;
     731    }
     732    psFree(poly2);
     733
     734    psPolynomial3D *poly3;
     735    poly3 = psPolynomial3DAlloc(2, 1, 2, PS_POLYNOMIAL_ORD);
     736    if ( !psMemCheckType(PS_DATA_POLYNOMIAL3D, poly3) ) {
     737        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckPolynomial3D failed in memCheckType. \n");
     738        psFree(poly3);
     739        return 1;
     740    }
     741    psFree(poly3);
     742
     743    psPolynomial4D *poly4;
     744    poly4 = psPolynomial4DAlloc(2, 1, 2, 1, PS_POLYNOMIAL_ORD);
     745    if ( !psMemCheckType(PS_DATA_POLYNOMIAL4D, poly4) ) {
     746        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckPolynomial4D failed in memCheckType. \n");
     747        psFree(poly4);
     748        return 1;
     749    }
     750    psFree(poly4);
     751
     752    psProjection *proj;
     753    proj = psProjectionAlloc(1, 1, 2.1, 2.1, PS_PROJ_TAN);
     754    if ( !psMemCheckType(PS_DATA_PROJECTION, proj) ) {
     755        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckProjection failed in memCheckType. \n");
     756        psFree(proj);
     757        return 1;
     758    }
     759    psFree(proj);
     760
     761    psScalar *scalar;
     762    psC64 c64 = 1.1 + 7I;
     763    scalar = psScalarAlloc(c64, PS_TYPE_F64);
     764    if ( !psMemCheckType(PS_DATA_SCALAR, scalar) ) {
     765        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckScalar failed in memCheckType. \n");
     766        psFree(scalar);
     767        return 1;
     768    }
     769    psFree(scalar);
     770
     771    psSphere *sphere;
     772    sphere = psSphereAlloc();
     773    if ( !psMemCheckType(PS_DATA_SPHERE, sphere) ) {
     774        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckSphere failed in memCheckType. \n");
     775        psFree(sphere);
     776        return 1;
     777    }
     778    psFree(sphere);
     779
     780    psSphereRot *sphereRot;
     781    sphereRot = psSphereRotAlloc(0, 0, 20);
     782    if ( !psMemCheckType(PS_DATA_SPHEREROT, sphereRot) ) {
     783        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckSphereRot failed in memCheckType. \n");
     784        psFree(sphereRot);
     785        return 1;
     786    }
     787    psFree(sphereRot);
     788
     789    psSpline1D *spline;
     790    spline = psSpline1DAlloc(2, 1, 0, 2);
     791    if ( !psMemCheckType(PS_DATA_SPLINE1D, spline) ) {
     792        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckSpline1D failed in memCheckType. \n");
     793        psFree(spline);
     794        return 1;
     795    }
     796    psFree(spline);
     797
     798    psStats *stats;
     799    stats = psStatsAlloc(PS_STAT_MAX);
     800    if ( !psMemCheckType(PS_DATA_STATS, stats) ) {
     801        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckStats failed in memCheckType. \n");
     802        psFree(stats);
     803        return 1;
     804    }
     805    psFree(stats);
     806
     807    /*    psTime *time;
     808        time = psTimeAlloc(PS_TIME_UT1);
     809        if ( !psMemCheckType(PS_DATA_TIME, time) )
     810        {
     811            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckTime failed in memCheckType. \n");
     812            psFree(time);
     813            return 1;
     814        }
     815        psFree(time);
     816    */
     817    psVector *vector;
     818    vector = psVectorAlloc(100, PS_TYPE_F32);
     819    if ( !psMemCheckType(PS_DATA_VECTOR, vector) ) {
     820        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psMemCheckVector failed in memCheckType. \n");
     821        psFree(vector);
     822        return 1;
     823    }
     824    psFree(vector);
     825
     826
     827    //    psFree(negative);
     828    //    psFree(neg);
     829
     830    return 0;
     831}
  • trunk/psLib/test/sys/verified/tst_psMemory.stderr

    r4547 r4898  
    151151---> TESTPOINT PASSED (psMemory{multipleFree} | tst_psMemory.c)
    152152
     153/***************************** TESTPOINT ******************************************\
     154*             TestFile: tst_psMemory.c                                             *
     155*            TestPoint: psMemory{psMemCheckType}                                   *
     156*             TestType: Positive                                                   *
     157\**********************************************************************************/
     158
     159
     160---> TESTPOINT PASSED (psMemory{psMemCheckType} | tst_psMemory.c)
     161
  • trunk/psLib/test/types/tst_psArray.c

    r4547 r4898  
    1717 *  @author  Ross Harman, MHPCC
    1818 *
    19  *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
    20  *  @date  $Date: 2005-07-13 02:47:01 $
     19 *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
     20 *  @date  $Date: 2005-08-30 01:14:13 $
    2121 *
    2222 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    5252static psS32 testArray01( void );
    5353static psS32 testArrayAdd( void );
     54
    5455
    5556testDescription tests[] = {
     
    439440    return 0;  // the value that indicates success is part of the testDescription
    440441}
    441 
Note: See TracChangeset for help on using the changeset viewer.