IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 30, 2005, 5:57:42 PM (21 years ago)
Author:
drobbin
Message:

revised psMemory structs in accordance with psLib SDRS rev. 15. added psDataType

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/sysUtils/psMemory.h

    r4401 r4444  
    1212 *  @ingroup MemoryManagement
    1313 *
    14  *  @version $Revision: 1.44 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2005-06-27 20:38:12 $
     14 *  @version $Revision: 1.45 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2005-07-01 03:57:39 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    4949
    5050/// typedef for memory identification numbers.  Guaranteed to be some variety of integer.
    51 typedef psU64 psMemId;
     51typedef unsigned long psMemId;
    5252
    5353/// typedef for a memory block's reference count. Guaranteed to be some variety of integer.
    54 typedef psU64 psReferenceCount;
     54typedef unsigned long psReferenceCount;
    5555
    5656/// typedef for deallocator.
    57 typedef void (*psFreeFunc) (psPtr ptr);
     57typedef void (*psFreeFunc) (void* ptr);
    5858
    5959/** Book-keeping data for storage allocator.
     
    6464typedef struct psMemBlock
    6565{
    66     const psPtr startblock;            ///< initialised to p_psMEMMAGIC
     66    const void* startblock;            ///< initialised to p_psMEMMAGIC
    6767    struct psMemBlock* previousBlock;  ///< previous block in allocation list
    6868    struct psMemBlock* nextBlock;      ///< next block allocation list
     
    7171    const psMemId id;                  ///< a unique ID for this allocation
    7272    const char *file;                  ///< set from __FILE__ in e.g. p_psAlloc
    73     const psS32 lineno;                ///< set from __LINE__ in e.g. p_psAlloc
     73    const unsigned int lineno;         ///< set from __LINE__ in e.g. p_psAlloc
    7474    pthread_mutex_t refCounterMutex;   ///< mutex to ensure exclusive access to reference counter
    7575    psReferenceCount refCounter;       ///< how many times pointer is referenced
    76     psBool persistent;                 ///< marks if this non-user persistent data like error stack, etc.
    77     const psPtr endblock;              ///< initialised to p_psMEMMAGIC
     76    bool persistent;                   ///< marks if this non-user persistent data like error stack, etc.
     77    const void* endblock;              ///< initialised to p_psMEMMAGIC
    7878}
    7979psMemBlock;
     
    8181/** prototype of a basic callback used by memory functions
    8282 *
    83  *  @see psMemAllocateCallbackSet
    84  *  @ingroup memCallback
    85  */
    86 typedef psMemId(*psMemAllocateCallback) (
     83 *  @see psMemAllocCallbackSet
     84 *  @ingroup memCallback
     85 */
     86typedef psMemId(*psMemAllocCallback) (
    8787    const psMemBlock* ptr              ///< the psMemBlock just allocated
    8888);
     
    105105 */
    106106typedef void (*psMemProblemCallback) (
    107     const psMemBlock* ptr,             ///< the pointer to the problematic memory block.
    108     const char *file,                  ///< the file in which the problem originated
    109     psS32 lineno                         ///< the line number in which the problem originated
     107    psMemBlock* ptr,                   ///< the pointer to the problematic memory block.
     108    const char *filename,                    ///< the file in which the problem originated
     109    unsigned int lineno                ///< the line number in which the problem originated
    110110);
    111111
     
    118118 *  @ingroup memCallback
    119119 */
    120 typedef psPtr (*psMemExhaustedCallback) (
     120typedef void* (*psMemExhaustedCallback) (
    121121    size_t size                        ///< the size of buffer required
    122122);
     
    128128 */
    129129#ifdef DOXYGEN
    130 psPtr psAlloc(size_t size       ///< Size required
    131              );
     130
     131psPtr psAlloc(
     132    size_t size                        ///< Size required
     133);
     134
    132135#else // #ifdef DOXYGEN
    133 psPtr p_psAlloc(size_t size,    ///< Size required
    134                 const char *file,       ///< File of call
    135                 psS32 lineno      ///< Line number of call
    136                );
     136psPtr p_psAlloc(
     137    size_t size,                       ///< Size required
     138    const char *filename,              ///< File of call
     139    unsigned int lineno                ///< Line number of call
     140);
    137141
    138142/// Memory allocation. psAlloc sends file and line number to p_psAlloc.
     
    203207 */
    204208#ifdef DOXYGEN
     209
    205210psPtr psRealloc(
    206     psPtr ptr,                          ///< Pointer to re-allocate
    207     size_t size                         ///< Size required
     211    psPtr ptr,                         ///< Pointer to re-allocate
     212    size_t size                        ///< Size required
    208213);
    209214#else // #ifdef DOXYGEN
     215
    210216psPtr p_psRealloc(
    211217    psPtr ptr,                         ///< Pointer to re-allocate
    212218    size_t size,                       ///< Size required
    213     const char *file,                  ///< File of call
    214     psS32 lineno                       ///< Line number of call
     219    const char *filename,              ///< File of call
     220    unsigned int lineno                ///< Line number of call
    215221);
    216222
     
    234240    psPtr ptr,                         ///< Pointer to free
    235241    const char *file,                  ///< File of call
    236     psS32 lineno                       ///< Line number of call
     242    unsigned int lineno                ///< Line number of call
    237243);
    238244
     
    259265 */
    260266psS32 psMemCheckLeaks(
    261     psMemId id0,                    ///< don't list blocks with id < id0
     267    psMemId id0,                       ///< don't list blocks with id < id0
    262268    psMemBlock* ** arr,                ///< pointer to array of pointers to leaked blocks, or NULL
    263269    FILE * fd,                         ///< print list of leaks to fd (or NULL)
     
    288294#ifdef DOXYGEN
    289295psPtr psMemIncrRefCounter(
    290     const psPtr ptr                         ///< Pointer to increment refCounter, and return
     296    const psPtr ptr                    ///< Pointer to increment refCounter, and return
    291297);
    292298#else
     
    294300    psPtr vptr,                        ///< Pointer to increment refCounter, and return
    295301    const char *file,                  ///< File of call
    296     psS32 lineno                         ///< Line number of call
     302    psS32 lineno                       ///< Line number of call
    297303);
    298304
     
    318324    psPtr vptr,                        ///< Pointer to decrement refCounter, and return
    319325    const char *file,                  ///< File of call
    320     psS32 lineno                         ///< Line number of call
     326    psS32 lineno                       ///< Line number of call
    321327);
    322328
     
    362368/** Set call back for when a particular memory block is allocated
    363369 *
    364  *  A private variable, p_psMemAllocateID, can be used to trace the allocation
    365  *  and freeing of specific memory blocks. If p_psMemAllocateID is set and a
    366  *  memory block with that ID is allocated, psMemAllocateCallback is called
     370 *  A private variable, p_psMemAllocID, can be used to trace the allocation
     371 *  and freeing of specific memory blocks. If p_psMemAllocID is set and a
     372 *  memory block with that ID is allocated, psMemAllocCallback is called
    367373 *  just before memory is returned to the calling function.
    368374 *
    369375 *  @ingroup memCallback
    370376 *
    371  *  @return psMemAllocateCallback      old psMemAllocateCallback function
    372  */
    373 psMemAllocateCallback psMemAllocateCallbackSet(
    374     psMemAllocateCallback func       ///< Function to run at memory allocation of specific mem block
     377 *  @return psMemAllocCallback      old psMemAllocCallback function
     378 */
     379psMemAllocCallback psMemAllocCallbackSet(
     380    psMemAllocCallback func            ///< Function to run at memory allocation of specific mem block
    375381);
    376382
     
    398404psMemId psMemGetId(void);
    399405
    400 /** set p_psMemAllocateID to specific id
    401  *
    402  *  A private variable, p_psMemAllocateID, can be used to trace the allocation
    403  *  and freeing of specific memory blocks. If p_psMemAllocateID is set and a
    404  *  memory block with that ID is allocated, psMemAllocateCallback is called
     406/** set p_psMemAllocID to specific id
     407 *
     408 *  A private variable, p_psMemAllocID, can be used to trace the allocation
     409 *  and freeing of specific memory blocks. If p_psMemAllocID is set and a
     410 *  memory block with that ID is allocated, psMemAllocCallback is called
    405411 *  just before memory is returned to the calling function.
    406412 *
     
    409415 *  @return psMemId
    410416 *
    411  *  @see psMemAllocateCallbackSet
    412  */
    413 psMemId psMemAllocateCallbackSetID(
    414     psMemId id                      ///< ID to set
     417 *  @see psMemAllocCallbackSet
     418 */
     419psMemId psMemAllocCallbackSetID(
     420    psMemId id                         ///< ID to set
    415421);
    416422
     
    429435 */
    430436psMemId psMemFreeCallbackSetID(
    431     psMemId id                      ///< ID to set
     437    psMemId id                         ///< ID to set
    432438);
    433439
Note: See TracChangeset for help on using the changeset viewer.