#include <windows.h>

#ifndef __MEMORYCLASS
#define __MEMORYCLASS

#define MEMORY_ALLOC_UNIT		512

#ifdef _DEBUG
	extern DWORD _mem_new_;
	extern DWORD _mem_cmemory_;
	extern DWORD _mem_alloc_;

	#define _NEW(x) new x; _mem_new_++;
	#define _DELETE(x) delete x; _mem_new_--;
#else
	#define _NEW(x) new x;
	#define _DELETE(x) delete x;
#endif

void *mallocx(size_t size);
void freex(void* mem);

class CMemory
{
	private:
		void* mem;
		void* lockedMem;
		DWORD allocsize;//velkost alokovanej pamate
		DWORD size;//velkost realne pouzitej pamate

	public:
		CMemory();
		~CMemory();
		int AddData(void* mem, DWORD size);
		void DeleteData();//pointer nastavi na zaciatok, data budu stratene
		void ClearMemory();//vymaze pamat
		void* GetPointer();
		DWORD GetSize();

		static char *printstr(char *src, ...);
};

#endif __MEMORYCLASS