1 /******************************************************************************
2 *  LibGHT, software to manage point clouds.
3 *  LibGHT is free and open source software provided by the Government of Canada
4 *  Copyright (c) 2012 Natural Resources Canada
5 *
6 *  Nouri Sabo <nsabo@NRCan.gc.ca>, Natural Resources Canada
7 *  Paul Ramsey <pramsey@opengeo.org>, OpenGeo
8 *
9 ******************************************************************************/
10 
11 #ifndef _GHT_MEM_H
12 #define _GHT_MEM_H
13 
14 /* Global function signatures for memory/logging handlers. */
15 typedef void* (*GhtAllocator)(size_t size);
16 typedef void* (*GhtReallocator)(void *mem, size_t size);
17 typedef void  (*GhtDeallocator)(void *mem);
18 typedef void  (*GhtMessageHandler)(const char *string, va_list ap);
19 
20 /** Initialize memory/message handling */
21 void ght_set_handlers(GhtAllocator allocator, GhtReallocator reallocator,
22                       GhtDeallocator deallocator, GhtMessageHandler error_handler,
23                       GhtMessageHandler info_handler, GhtMessageHandler warn_handler);
24 
25 /** Set the malloc handler */
26 void   ght_set_allocator(GhtAllocator allocator);
27 
28 /** Set the free handler */
29 void   ght_set_deallocator(GhtDeallocator deallocator);
30 
31 #endif /* _GHT_MEM_H */