// Copyright (C) 2004-2009 Christoph Kubisch & Eike Decker
// This file is part of the "Luxinia Engine".
// For conditions of distribution and use, see copyright notice in luxiniapublicsdk.txt
//
// <Author: Eike Decker>


#ifndef __LUXCORE_MEMORYCLUSTER_H__
#define __LUXCORE_MEMORYCLUSTER_H__

#include "memorybase.h"

#ifdef __cplusplus
extern "C"{
#endif

//////////////////////////////////////////////////////////////////////////
// MemoryCluster
/**
* Author: Eike Decker
* Allows to allocate a chunk of data which is parted
* into clusters. You can malloc only one cluster per time. Usefull for data
* structures with constant size like listnodes. There is no guarantee that
* two malloced variables will be adjacent in the memory.
*/

typedef struct MemoryCluster_s* MemoryClusterPTR;

// constructs a new memorystructure
LUX_API MemoryClusterPTR	MemoryCluster_new (size_t clusterSize, size_t clusterCount);
LUX_API void* MemoryCluster_mallocVar (MemoryClusterPTR mem);
LUX_API void MemoryCluster_freeVar (MemoryClusterPTR mem, void *ptr);
LUX_API void MemoryCluster_free (MemoryClusterPTR mem);

#ifdef __cplusplus
};  
#endif

#endif
