IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 18, 2004, 9:37:58 PM (22 years ago)
Author:
eugene
Message:

code cleanup for Doxygen support & readability

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/archive/pslib/include/psMemory.h

    r247 r257  
    66 *  \ingroup SystemGroup
    77 */
     8
     9// Structures ***********************************************************
    810
    911/** Book-keeping data for storage allocator.
     
    2123} psMemBlock;
    2224
    23 /** prototype of a basic callback used by memory functions */
     25/// prototype of a basic callback used by memory functions
    2426typedef int (*psMemCallback)(const psMemBlock *ptr);
    2527
    26 /** prototype of a callback used in error conditions */
     28/// prototype of a callback used in error conditions
    2729typedef void (*psMemProblemCallback)(const psMemBlock *ptr, const char *file, int lineno);
    2830
    29 /** prototype of a callback used when memory runs out */
     31/// prototype of a callback used when memory runs out
    3032typedef void *(*psMemExhaustedCallback)(size_t size);
    3133
    32 /*****************************************************************************/
     34/** Functions **************************************************************/
     35/** \addtogroup SystemGroup System Utilities
     36 *  \{
     37 */
    3338
    34 /** Memory allocation. Underlying private function called by macro psAlloc. */
     39/// Memory allocation. Underlying private function called by macro psAlloc.
    3540void *p_psAlloc(size_t size,            //!< Size required
    3641                const char *file,       //!< File of call
    37                 int lineno              //!< Line number of call
    38     );
     42                int lineno)             //!< Line number of call
     43;
    3944
    40 /** Memory re-allocation.  Underlying private function called by macro psRealloc. */
     45/// Memory re-allocation.  Underlying private function called by macro psRealloc.
    4146void *p_psRealloc(void *ptr,            //!< Pointer to re-allocate
    4247                  size_t size,          //!< Size required
    4348                  const char *file,     //!< File of call
    44                   int lineno            //!< Line number of call
    45     );
     49                  int lineno)           //!< Line number of call
     50;
    4651
    47 /** Free memory.  Underlying private function called by macro psFree. */
     52/// Free memory.  Underlying private function called by macro psFree.
    4853void p_psFree(void *ptr,                //!< Pointer to free
    4954              const char *file,         //!< File of call
    50               int lineno                //!< Line number of call
    51     );
     55              int lineno)               //!< Line number of call
     56;
    5257
    53 /** Memory allocation. psAlloc sends file and line number to p_psAlloc. */
     58/// Check for memory leaks
     59int psMemCheckLeaks(int id0,            //!< don't list blocks with id < id0
     60                    psMemBlock ***arr,  //!< pointer to array of pointers to leaked blocks, or NULL
     61                    FILE *fd)           //!< print list of leaks to fd (or NULL)
     62;
     63
     64/// Check for memory corruption
     65int psMemCheckCorruption(int abort_on_error) //!< Abort on detecting corruption?
     66;
     67
     68/// Return reference counter
     69int psMemGetRefCounter(void *vptr)      //!< Pointer to get refCounter for
     70;
     71
     72/// Increment reference counter and return the pointer
     73void *psMemIncrRefCounter(void *vptr)   //!< Pointer to increment refCounter, and return
     74;
     75
     76/// Decrement reference counter and return the pointer
     77void *psMemDecrRefCounter(void *vptr)   //!< Pointer to decrement refCounter, and return
     78;
     79
     80/// Set callback for problems
     81psMemProblemCallback psMemProblemSetCB(psMemProblemCallback func) //!< Function to run
     82;
     83
     84/// Set callback for out-of-memory
     85psMemExhaustedCallback psMemExhaustedSetCB(psMemExhaustedCallback func) //!< Function to run
     86;                                                                       
     87
     88/// Set call back for when a particular memory block is allocated
     89psMemCallback psMemAllocateSetCB(psMemCallback func)
     90;
     91
     92/// Set call back for when a particular memory block is freed
     93psMemCallback psMemFreeSetCB(psMemCallback func)
     94;
     95
     96/// get next memory ID
     97int psMemGetId(void)
     98;
     99
     100/// set p_psMemAllocateID to id
     101long psMemSetAllocateID(long id)
     102;
     103
     104/// set p_psMemFreeID to id
     105long psMemSetFreeID(long id)
     106;
     107
     108/* \} */ // End of SystemGroup Functions
     109
     110/// Memory allocation. psAlloc sends file and line number to p_psAlloc.
    54111#define psAlloc(size) p_psAlloc(size, __FILE__, __LINE__)
    55112
    56 /** Memory re-allocation.  psRealloc sends file and line number to p_psRealloc. */
     113/// Memory re-allocation.  psRealloc sends file and line number to p_psRealloc.
    57114#define psRealloc(ptr, size) p_psRealloc(ptr, size, __FILE__, __LINE__)
    58115
    59 /** Free memory.  psFree sends file and line number to p_psFree. */
     116/// Free memory.  psFree sends file and line number to p_psFree.
    60117#define psFree(size) p_psFree(size, __FILE__, __LINE__)
    61118
    62 /** prevent the use of 'malloc'. malloc is re-defined to throw an error in the C preprocessor */
     119/// prevent the use of 'malloc'. malloc is re-defined to throw an error in the C preprocessor
    63120#define malloc(S) for
    64121
    65 /** prevent the use of 'realloc'. realloc is re-defined to throw an error in the C preprocessor */
     122/// prevent the use of 'realloc'. realloc is re-defined to throw an error in the C preprocessor
    66123#define realloc(P,S) for
    67124
    68 /** prevent the use of 'free'. free is re-defined to throw an error in the C preprocessor */
     125/// prevent the use of 'free'. free is re-defined to throw an error in the C preprocessor
    69126#define free(P) for
    70127
    71 /*****************************************************************************/
    72 /** Check for memory leaks */
    73 int psMemCheckLeaks(int id0,            //!< don't list blocks with id < id0
    74                     psMemBlock ***arr,  //!< pointer to array of pointers to leaked blocks, or NULL
    75                     FILE *fd            //!< print list of leaks to fd (or NULL)
    76     );
    77 
    78 /** Check for memory corruption */
    79 int psMemCheckCorruption(int abort_on_error //!< Abort on detecting corruption?
    80     );
    81 
    82 /*****************************************************************************/
    83 
    84 /** Return reference counter */
    85 int psMemGetRefCounter(void *vptr       //!< Pointer to get refCounter for
    86     );
    87 /** Increment reference counter and return the pointer */
    88 void *psMemIncrRefCounter(void *vptr    //!< Pointer to increment refCounter, and return
    89     );
    90 /** Decrement reference counter and return the pointer */
    91 void *psMemDecrRefCounter(void *vptr    //!< Pointer to decrement refCounter, and return
    92     );
    93 
    94 /*****************************************************************************/
    95 /*
    96  * Functions to set and control callbacks
    97  */
    98 
    99 /** Set callback for problems */
    100 psMemProblemCallback psMemProblemSetCB(psMemProblemCallback func //!< Function to run
    101     );
    102 psMemExhaustedCallback psMemExhaustedSetCB(psMemExhaustedCallback func); //!< set call back for exhausted
    103                                                                          //!< memory
    104 
    105 psMemCallback psMemAllocateSetCB(psMemCallback func); //!< Set call back for when a particular memory block is
    106                                                       //!< allocated
    107 psMemCallback psMemFreeSetCB(psMemCallback func); //!< set call back for when a particular memory block is
    108                                                   //!< freed
    109 
    110 int psMemGetId(void);                   //!< get next memory ID
    111 long psMemSetAllocateID(long id);       //!< set p_psMemAllocateID to id
    112 long psMemSetFreeID(long id);           //!< set p_psMemFreeID to id
    113 
    114128#endif
Note: See TracChangeset for help on using the changeset viewer.