00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef AXUTIL_ALLOCATOR_H
00019 #define AXUTIL_ALLOCATOR_H
00020
00026 #include <axutil_utils_defines.h>
00027
00028 #ifdef __cplusplus
00029 extern "C"
00030 {
00031 #endif
00032
00047 typedef struct axutil_allocator
00048 {
00057 void * (AXIS2_CALL *malloc_fn) (struct axutil_allocator *allocator, size_t size);
00067 void * (AXIS2_CALL *realloc) (struct axutil_allocator *allocator, void *ptr, size_t size);
00075 void (AXIS2_CALL *free_fn) (struct axutil_allocator *allocator, void *ptr);
00077 void *local_pool;
00079 void *global_pool;
00081 void *current_pool;
00082 } axutil_allocator_t;
00083
00089 AXIS2_EXTERN axutil_allocator_t * AXIS2_CALL
00090 axutil_allocator_init (axutil_allocator_t *allocator);
00091
00097 AXIS2_EXTERN void AXIS2_CALL
00098 axutil_allocator_free(axutil_allocator_t *allocator);
00099
00108 AXIS2_EXTERN void AXIS2_CALL
00109 axutil_allocator_switch_to_global_pool(axutil_allocator_t *allocator);
00110
00119 AXIS2_EXTERN void AXIS2_CALL
00120 axutil_allocator_switch_to_local_pool(axutil_allocator_t *allocator);
00121
00122 #define AXIS2_MALLOC(allocator, size) \
00123 ((allocator)->malloc_fn(allocator, size))
00124
00125 #define AXIS2_REALLOC(allocator, ptr, size) \
00126 ((allocator)->realloc(allocator, ptr, size))
00127
00128 #define AXIS2_FREE(allocator, ptr) \
00129 ((allocator)->free_fn(allocator, ptr))
00130
00133 #ifdef __cplusplus
00134 }
00135 #endif
00136
00137 #endif