qmultialloc.h 472 Bytes
Newer Older
qon's avatar
qon committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef QMULTIALLOC_H
#define QMULTIALLOC_H
#ifdef _WIN32
#include <windows.h>
#include <winbase.h>
#else
#include <stddef.h>
#endif

class qMultiAlloc
{
public:
	qMultiAlloc();
	~qMultiAlloc();

	void AddAlloc(void** ptr, size_t size, size_t align = 1024);
	size_t Allocate();
	void Free();

private:
	struct ptr_struct
	{
		void** ptr;
		size_t size;
	};

	ptr_struct* p;
	int np;
	int npalloc;
	size_t maxalign;
	void* ptr;
};

#endif