IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7901 for trunk/psLib/src/math


Ignore:
Timestamp:
Jul 13, 2006, 4:26:25 PM (20 years ago)
Author:
drobbin
Message:

Added str check test for error handling of psString fxns, namely stringSubstitute. Edited memory and type to include MemCheck's for string, line, and region. Added is_psType function to check for NULLs and native types first. <-will have to update all fxns next wrt to this change. Added psStringAlloc, stringFree, regionFree. Added doxygen comments.

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

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/math/psRegion.c

    r7563 r7901  
    66#include "psRegion.h"
    77
     8static void regionFree(psRegion *region)
     9{
     10    // There are non dynamic allocated items
     11}
     12
    813psRegion *psRegionAlloc(float x0,
    914                        float x1,
     
    1217{
    1318    psRegion *region = psAlloc(sizeof(psRegion)); // New region, to be returned
     19    psMemSetDeallocator(region, (psFreeFunc)regionFree);
    1420    // No complex structures, so no special deallocator
    1521    *region = psRegionSet(x0, x1, y0, y1);
     
    101107}
    102108
     109bool psMemCheckRegion(psPtr ptr)
     110{
     111    if (!is_psType(ptr)) {
     112        return false;
     113    }
     114    return ( psMemGetDeallocator(ptr) == (psFreeFunc)regionFree );
     115}
     116
     117
  • trunk/psLib/src/math/psRegion.h

    r7563 r7901  
    2727                        float y1        ///< the last row of the region + 1.
    2828                       );
     29
     30/** Checks the type of a particular pointer.
     31 *
     32 *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
     33 *
     34 *  @return bool:       True if the pointer matches a psRegion structure, false otherwise.
     35 */
     36bool psMemCheckRegion(
     37    psPtr ptr                          ///< the pointer whose type to check
     38);
    2939
    3040/** Create a psRegion with the specified attributes.
     
    7080);
    7181
    72 // Test if any element of the region is NaN
    73 bool psRegionIsNaN(psRegion region// Region to check
    74                   );
     82/** Test if any element of the region is NaN
     83 *
     84 * @return bool:        True if an element is NaN, otherwise false.
     85 */
     86bool psRegionIsNaN(
     87    psRegion region                    ///< Region to check
     88);
    7589
    7690#endif
Note: See TracChangeset for help on using the changeset viewer.