API Documentation
FreeListPager.h
1 // FreeListPager.h
3 //
5 
6 namespace nkMemory
7 {
11  template <typename T>
13  {
18 
23  unsigned long long _index ;
24  } ;
25 }
26 
27 namespace nkMemory
28 {
41  template <typename T = char*, typename U = DefaultMemorySpace>
42  class FreeListPager final
43  {
44  public :
45 
52  FreeListPager (unsigned long long pageSize, UniquePtr<MemorySpaceAllocator<U>> allocator = makeUnique<DefaultMemorySpaceAllocator<U>>()) noexcept ;
53 
54  // Getters
58  unsigned long long getPageSize () const ;
62  unsigned long long getAllocatedPageCount () const ;
66  const FreeListMemorySpaceWrapper<T, U>& getPage (unsigned long long index) ;
67 
68  // Allocations
78  FreeListAllocation<T> allocate (unsigned long long size, unsigned long long alignment = 1) ;
84  void free (unsigned long long allocationIndex) ;
85  } ;
86 }
nkMemory::FreeListPager
A pager implementing the free list pattern.
Definition: FreeListPager.h:43
nkMemory::DefaultMemorySpaceAllocator
A default memory space allocator, offering the most basic memory allocation method.
Definition: DefaultMemorySpaceAllocator.h:24
nkMemory::FreeListAllocation::_index
unsigned long long _index
Definition: FreeListPager.h:23
nkMemory::FreeListPager::allocate
FreeListAllocation< T > allocate(unsigned long long size, unsigned long long alignment=1)
nkMemory::FreeListPager::free
void free(unsigned long long allocationIndex)
nkMemory::UniquePtr
Smart pointer owning the object instance it encapsulates.
Definition: UniquePtr.h:17
nkMemory::FreeListPager::getPageSize
unsigned long long getPageSize() const
nkMemory::FreeListPager::FreeListPager
FreeListPager(unsigned long long pageSize, UniquePtr< MemorySpaceAllocator< U >> allocator=makeUnique< DefaultMemorySpaceAllocator< U >>()) noexcept
nkMemory::FreeListPager::getAllocatedPageCount
unsigned long long getAllocatedPageCount() const
nkMemory::FreeListAllocation
Holds information about an allocation returned by the pager.
Definition: FreeListPager.h:13
nkMemory::FreeListPager::getPage
const FreeListMemorySpaceWrapper< T, U > & getPage(unsigned long long index)
nkMemory::FreeListAllocation::_allocation
T _allocation
Definition: FreeListPager.h:17
nkMemory::MemorySpaceAllocator
Defines the interface for a memory space allocator, to be used within the pagers.
Definition: MemorySpaceAllocator.h:13
nkMemory
Encompasses all API of component NilkinsMemory.
Definition: Allocator.h:7