00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef AXIS2_ALLOCATOR_H
00019 #define AXIS2_ALLOCATOR_H
00020
00026 #include <axis2_utils_defines.h>
00027
00028 #ifdef __cplusplus
00029 extern "C"
00030 {
00031 #endif
00032
00047 typedef struct axis2_allocator
00048 {
00049
00050
00059 void * (AXIS2_CALL *malloc_fn) (struct axis2_allocator *allocator, size_t size);
00069 void * (AXIS2_CALL *realloc) (struct axis2_allocator *allocator, void *ptr, size_t size);
00077 void (AXIS2_CALL *free_fn) (struct axis2_allocator *allocator, void *ptr);
00079 void *local_pool;
00081 void *global_pool;
00082 } axis2_allocator_t;
00083
00089 AXIS2_EXTERN axis2_allocator_t * AXIS2_CALL
00090 axis2_allocator_init (axis2_allocator_t *allocator);
00091
00097 AXIS2_EXTERN axis2_status_t AXIS2_CALL
00098 axis2_allocator_free(axis2_allocator_t *allocator);
00099
00108 AXIS2_EXTERN void AXIS2_CALL
00109 axis2_allocator_switch_to_global_pool(axis2_allocator_t *allocator);
00110
00119 AXIS2_EXTERN void AXIS2_CALL
00120 axis2_allocator_switch_to_local_pool(axis2_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