libpromeki main
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
MemPool::Block Class Reference

Represents a contiguous region of memory in the pool. More...

#include <mempool.h>

Public Member Functions

bool operator< (const Block &other) const
 Orders blocks by address for sorted storage.
 
uintptr_t alignedAddress (size_t align) const
 Returns the address aligned to the given alignment.
 
uintptr_t alignedAddress () const
 Returns the address aligned to this block's alignment.
 
size_t padding (size_t align) const
 Returns padding bytes needed to reach the given alignment.
 
size_t padding () const
 Returns padding bytes needed for this block's alignment.
 
bool follows (const Block &block) const
 Returns true if this block immediately follows another.
 

Public Attributes

bool allocated = false
 true if this block is allocated.
 
intptr_t address = 0
 Starting address of the block.
 
size_t size = 0
 Size in bytes.
 
size_t alignment = 1
 Alignment requirement.
 

Detailed Description

Represents a contiguous region of memory in the pool.

Member Function Documentation

◆ alignedAddress() [1/2]

uintptr_t MemPool::Block::alignedAddress ( ) const
inline

Returns the address aligned to this block's alignment.

Returns
The aligned address.

◆ alignedAddress() [2/2]

uintptr_t MemPool::Block::alignedAddress ( size_t  align) const
inline

Returns the address aligned to the given alignment.

Parameters
alignThe alignment boundary (must be a power of two).
Returns
The aligned address.

◆ follows()

bool MemPool::Block::follows ( const Block block) const
inline

Returns true if this block immediately follows another.

Parameters
blockThe preceding block to check adjacency against.
Returns
true if this block starts where the other ends.

◆ padding() [1/2]

size_t MemPool::Block::padding ( ) const
inline

Returns padding bytes needed for this block's alignment.

Returns
Number of padding bytes.

◆ padding() [2/2]

size_t MemPool::Block::padding ( size_t  align) const
inline

Returns padding bytes needed to reach the given alignment.

Parameters
alignThe alignment boundary.
Returns
Number of padding bytes, or 0 if no padding needed.

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