PageRenderTime 263ms CodeModel.GetById 141ms app.highlight 3ms RepoModel.GetById 118ms app.codeStats 0ms

/opengles/src/codegen/heap.h

http://ftk.googlecode.com/
C++ Header | 76 lines | 19 code | 17 blank | 40 comment | 1 complexity | e3bc91f4f1250b675d61f535f7b6cd79 MD5 | raw file
 1#ifndef CODEGEN_HEAP_H
 2#define CODEGEN_HEAP_H 1
 3
 4/****************************************************************************/
 5/*																			*/
 6/* Copyright (c) 2004, Hans-Martin Will. All rights reserved.				*/
 7/*																			*/
 8/* Redistribution and use in source and binary forms, with or without		*/
 9/* modification, are permitted provided that the following conditions are   */
10/* met:																		*/
11/*																			*/
12/* *  Redistributions of source code must retain the above copyright		*/
13/*    notice, this list of conditions and the following disclaimer.			*/
14/*																			*/
15/* *  Redistributions in binary form must reproduce the above copyright		*/
16/*    notice, this list of conditions and the following disclaimer in the   */
17/*    documentation and/or other materials provided with the distribution.  */
18/*																			*/
19/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS		*/
20/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT		*/
21/* LIMITED TO, THEIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A   */
22/* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER */
23/* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
24/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,		*/
25/* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR		*/
26/* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF   */
27/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING		*/
28/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS		*/
29/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.				*/
30/*																			*/
31/****************************************************************************/
32
33
34#include "codegen.h"
35
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41
42/****************************************************************************/
43/* Heap data type															*/
44/****************************************************************************/
45#if defined(__GCC32__) && defined(__cplusplus)
46struct cg_heap_t;
47#else
48typedef struct cg_heap_t cg_heap_t;
49#endif
50
51cg_heap_t * cg_heap_create(size_t default_block_size);
52	/************************************************************************/
53	/* Create a new heap object.											*/
54	/************************************************************************/
55
56
57void cg_heap_destroy(cg_heap_t * heap);
58	/************************************************************************/
59	/* Destroy a heap and deallocate any memory belonging to it				*/
60	/************************************************************************/
61
62
63void * cg_heap_allocate(cg_heap_t * heap, size_t amount);
64	/************************************************************************/
65	/* Allocate a block of memory of the given size on the heap.			*/
66	/************************************************************************/
67
68
69#define NEW(Heap,Type) ((Type *) CG_Allocate(Heap, sizeof(Type)))
70
71
72#ifdef __cplusplus
73}
74#endif
75
76#endif //ndef CODEGEN_HEAP_H