- Main Page
- Modules
- Data Structures
- Files

# memory.h

    00001 /*************************************************************************
    00002  *                                                                       *
    00003  * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith.       *
    00004  * All rights reserved.  Email: russ@q12.org   Web: www.q12.org          *
    00005  *                                                                       *
    00006  * This library is free software; you can redistribute it and/or         *
    00007  * modify it under the terms of EITHER:                                  *
    00008  *   (1) The GNU Lesser General Public License as published by the Free  *
    00009  *       Software Foundation; either version 2.1 of the License, or (at  *
    00010  *       your option) any later version. The text of the GNU Lesser      *
    00011  *       General Public License is included with this library in the     *
    00012  *       file LICENSE.TXT.                                               *
    00013  *   (2) The BSD-style license that is included with this library in     *
    00014  *       the file LICENSE-BSD.TXT.                                       *
    00015  *                                                                       *
    00016  * This library is distributed in the hope that it will be useful,       *
    00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
    00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
    00019  * LICENSE.TXT and LICENSE-BSD.TXT for more details.                     *
    00020  *                                                                       *
    00021  *************************************************************************/
    00022
    00023 /* this comes from the `reuse' library. copy any changes back to the source */
    00024
    00025 #ifndef _ODE_MEMORY_H_
    00026 #define _ODE_MEMORY_H_
    00027
    00028 #include "ode/config.h"
    00029
    00030 #ifdef __cplusplus
    00031 extern "C" {
    00032 #endif
    00033
    00034 /* function types to allocate and free memory */
    00035 typedef void * dAllocFunction (size_t size);
    00036 typedef void * dReallocFunction (void *ptr, size_t oldsize, size_t newsize);
    00037 typedef void dFreeFunction (void *ptr, size_t size);
    00038
    00039 /* set new memory management functions. if fn is 0, the default handlers are
    00040  * used. */
    00041 ODE_API void dSetAllocHandler (dAllocFunction *fn);
    00042 ODE_API void dSetReallocHandler (dReallocFunction *fn);
    00043 ODE_API void dSetFreeHandler (dFreeFunction *fn);
    00044
    00045 /* get current memory management functions */
    00046 ODE_API dAllocFunction *dGetAllocHandler (void);
    00047 ODE_API dReallocFunction *dGetReallocHandler (void);
    00048 ODE_API dFreeFunction *dGetFreeHandler (void);
    00049
    00050 /* allocate and free memory. */
    00051 ODE_API void * dAlloc (size_t size);
    00052 ODE_API void * dRealloc (void *ptr, size_t oldsize, size_t newsize);
    00053 ODE_API void dFree (void *ptr, size_t size);
    00054
    00055 #ifdef __cplusplus
    00056 }
    00057 #endif
    00058
    00059 #endif