#include "RQMemoryFactoryInternal.h"
#include "RQError.h"

#include "stdlib.h"
#include <crtdbg.h>

#include <boost\pool\pool.hpp>

NDTS_Boolean CALL_CONV RQ_Alloc(void* pool, void **ppMem)
{
	boost::pool<> p = static_cast<boost::pool<> >(pool) ;
/*	
	// Preconditions.
	_ASSERTE(size) ;
	_ASSERTE(ppMem) ;

	if ((*ppMem = malloc(size)) == 0)
	{
		_ASSERTE(0) ;
		return NDTS_BFalse ;
	}
*/
	return NDTS_BTrue ;
}

NDTS_Boolean CALL_CONV RQ_Free(void* pool, void *pMem)
{
	boost::pool<> p = static_cast<boost::pool<> >(pool) ;

	// Preconditions.
	_ASSERTE(pMem) ;

	free(pMem) ;

	return NDTS_BTrue ;
}


void *CALL_CONV RQ_AllocPool(unsigned long size, unsigned long min, unsigned long max, unsigned long inc)
{
	return new boost::pool<>(size) ;
}

void CALL_CONV RQ_FreePool(void* pool)
{
	delete static_cast<boost::pool<> >(pool) ;
}

