Nebula
Loading...
Searching...
No Matches
Memory::RangeAllocator Class Reference

#include <rangeallocator.h>

Classes

union  BinIndex
 
struct  RangeAllocatorNode
 

Public Member Functions

 RangeAllocator ()
 Default constructor.
 
 RangeAllocator (uint size, SizeT maxNumAllocs)
 Constructor.
 
 ~RangeAllocator ()
 Destructor.
 
void Clear ()
 Clear allocator.
 
bool Empty ()
 Empty.
 
RangeAllocation Alloc (uint size, uint alignment=1)
 Allocate memory.
 
void Dealloc (const RangeAllocation &allocation)
 Deallocate memory.
 

Private Member Functions

uint InsertNode (uint size, uint offset)
 Insert node at bin location, return node index.
 
void RemoveNode (uint nodeIndex)
 Remove node from bin.
 

Static Private Member Functions

static BinIndex IndexFromSize (uint size, bool round=false)
 Get bin index from size.
 

Private Attributes

uint size
 
uint freeStorage
 
uint freeNodeIterator
 
uint bucketUsageMask
 
uint binMasks [NUM_BUCKETS]
 
uint binHeads [NUM_BUCKETS *NUM_BINS_PER_BUCKET]
 
Util::Array< RangeAllocatorNodenodes
 
Util::Array< uintfreeNodes
 

Constructor & Destructor Documentation

◆ RangeAllocator() [1/2]

Memory::RangeAllocator::RangeAllocator ( )
inline

Default constructor.

◆ RangeAllocator() [2/2]

Memory::RangeAllocator::RangeAllocator ( uint size,
SizeT maxNumAllocs )
inline

Constructor.

◆ ~RangeAllocator()

Memory::RangeAllocator::~RangeAllocator ( )
inline

Destructor.

Member Function Documentation

◆ Alloc()

RangeAllocation Memory::RangeAllocator::Alloc ( uint size,
uint alignment = 1 )
inline

Allocate memory.

◆ Clear()

void Memory::RangeAllocator::Clear ( )
inline

Clear allocator.

◆ Dealloc()

void Memory::RangeAllocator::Dealloc ( const RangeAllocation & allocation)
inline

Deallocate memory.

◆ Empty()

bool Memory::RangeAllocator::Empty ( )
inline

Empty.

◆ IndexFromSize()

RangeAllocator::BinIndex Memory::RangeAllocator::IndexFromSize ( uint size,
bool round = false )
inlinestaticprivate

Get bin index from size.

◆ InsertNode()

uint Memory::RangeAllocator::InsertNode ( uint size,
uint offset )
inlineprivate

Insert node at bin location, return node index.

◆ RemoveNode()

void Memory::RangeAllocator::RemoveNode ( uint nodeIndex)
inlineprivate

Remove node from bin.

Member Data Documentation

◆ binHeads

uint Memory::RangeAllocator::binHeads[NUM_BUCKETS *NUM_BINS_PER_BUCKET]
private

◆ binMasks

uint Memory::RangeAllocator::binMasks[NUM_BUCKETS]
private

◆ bucketUsageMask

uint Memory::RangeAllocator::bucketUsageMask
private

◆ freeNodeIterator

uint Memory::RangeAllocator::freeNodeIterator
private

◆ freeNodes

Util::Array<uint> Memory::RangeAllocator::freeNodes
private

◆ freeStorage

uint Memory::RangeAllocator::freeStorage
private

◆ nodes

Util::Array<RangeAllocatorNode> Memory::RangeAllocator::nodes
private

◆ size

uint Memory::RangeAllocator::size
private

The documentation for this class was generated from the following file: