X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Floader%2FPagedAllocator.h;fp=src%2Floader%2FPagedAllocator.h;h=48cda27ea759837ccb823418092562f02b813bdd;hb=754442d4502b743a46831055484c3fa9fa621ec2;hp=0000000000000000000000000000000000000000;hpb=0ad5ca97b5df217329bc319d62564a9f46ba11d7;p=l2e.git diff --git a/src/loader/PagedAllocator.h b/src/loader/PagedAllocator.h new file mode 100644 index 0000000..48cda27 --- /dev/null +++ b/src/loader/PagedAllocator.h @@ -0,0 +1,42 @@ +/* + * PagedAllocator.h + * + * Created on: Oct 9, 2012 + * Author: holy + */ + +#ifndef LOADER_PAGEDALLOCATOR_H_ +#define LOADER_PAGEDALLOCATOR_H_ + +#include + +namespace loader { + +class PagedAllocator { + +public: + explicit PagedAllocator(unsigned int pageSize); + ~PagedAllocator(); +private: + PagedAllocator(const PagedAllocator &); + PagedAllocator &operator =(const PagedAllocator &); + +public: + char *Alloc(unsigned int size); + +private: + unsigned int Free() const; + void NewPage(); + char *CurrentPage(); + const char *CurrentPage() const; + +private: + char *head; + std::deque pages; + const unsigned int pageSize; + +}; + +} + +#endif /* LOADER_PAGEDALLOCATOR_H_ */