#ifndef BREEZE_OBJECT_POOL_H
#define BREEZE_OBJECT_POOL_H

#include "../defines.h"

typedef struct BzObjectPool BzObjectPool;

typedef void (*BzObjectPoolFunc)(void *object);

typedef struct BzObjectPoolDesc {
    size_t objectSize;
    size_t objectsPerPage;
    BzObjectPoolFunc constructor;
    BzObjectPoolFunc destructor;
} BzObjectPoolDesc;

BzObjectPool *bzObjectPoolCreate(const BzObjectPoolDesc *desc);
void bzObjectPoolDestroy(BzObjectPool *pool);

size_t bzObjectPoolGetObjectSize(BzObjectPool *pool);

size_t bzObjectPoolGetNumFree(BzObjectPool *pool);
void *bzObjectPool(BzObjectPool *pool);
void *bzObjectPoolGetObject(BzObjectPool *pool, u32 idx);
u32 bzObjectPoolGetIdx(BzObjectPool *pool, void *object);
void bzObjectPoolRelease(BzObjectPool *pool, void *object);

#endif //BREEZE_OBJECT_POOL_H
