]> git.localhorst.tv Git - l2e.git/blob - src/loader/PagedAllocator.h
Merge branch 'master' into feature-33-capsules
[l2e.git] / src / loader / PagedAllocator.h
1 #ifndef LOADER_PAGEDALLOCATOR_H_
2 #define LOADER_PAGEDALLOCATOR_H_
3
4 #include <deque>
5
6 namespace loader {
7
8 class PagedAllocator {
9
10 public:
11         explicit PagedAllocator(unsigned int pageSize);
12         ~PagedAllocator();
13 private:
14         PagedAllocator(const PagedAllocator &);
15         PagedAllocator &operator =(const PagedAllocator &);
16
17 public:
18         char *Alloc(unsigned int size);
19
20 private:
21         unsigned int Free() const;
22         void NewPage();
23         char *CurrentPage();
24         const char *CurrentPage() const;
25
26 private:
27         char *head;
28         std::deque<char *> pages;
29         const unsigned int pageSize;
30
31 };
32
33 }
34
35 #endif /* LOADER_PAGEDALLOCATOR_H_ */