SGDK
A free and open development kit for the Sega Mega Drive
Loading...
Searching...
No Matches
pool.h
Go to the documentation of this file.
1
36
37#ifndef _POOL_H_
38#define _POOL_H_
39
40
56typedef struct
57{
58 void* bank;
59 void** allocStack;
60 void** free;
61 u16 objectSize;
62 u16 size;
63} Pool;
64
65
80Pool* POOL_create(u16 size, u16 objectSize);
90void POOL_destroy(Pool* pool);
91
101void POOL_reset(Pool* pool, bool clear);
102
114void* POOL_allocate(Pool* pool);
129void POOL_release(Pool* pool, void* object, bool maintainCoherency);
130
138u16 POOL_getFree(Pool* pool);
147
157void** POOL_getFirst(Pool* pool);
158
168s16 POOL_find(Pool* pool, void* object);
169
170
171#endif // _POOL_H_
void * POOL_allocate(Pool *pool)
Allocate a new 'object' from the specified object pool.
Definition pool.c:136
s16 POOL_find(Pool *pool, void *object)
Definition pool.c:217
void POOL_reset(Pool *pool, bool clear)
Reset the 'object' pool allocator.
Definition pool.c:72
Pool * POOL_create(u16 size, u16 objectSize)
Create and allocate a new object pool allocator.
Definition pool.c:10
void POOL_release(Pool *pool, void *object, bool maintainCoherency)
Release an objet from the specified object pool.
Definition pool.c:159
void POOL_destroy(Pool *pool)
Release the specified object pool allocator.
Definition pool.c:105
void ** POOL_getFirst(Pool *pool)
Definition pool.c:211
u16 POOL_getNumAllocated(Pool *pool)
Definition pool.c:206
u16 POOL_getFree(Pool *pool)
Definition pool.c:201
Object pool allocator structure.
Definition pool.h:57
short s16
Definition types.h:84
unsigned short u16
Definition types.h:100