Lumiera  0.pre.03
»edit your freedom«
AllocationCluster::StorageManager Class Reference

Description

An overlay view for the AllocationCluster to add functionality for adding / clearing extents and registering optional deleter functions.

Warning
this is a tricky construct to operate each Allocation Cluster with the absolute minimum of organisational overhead necessary. The key point to note is that StorageManager is layout compatible with AllocationCluster itself — achieved through use of the union ManagementView, which holds a Storage descriptor member, but also an alternate view to manage a chain of extents as intrusive linked list (lib::LinkedElements).
Remarks
this trick relies on std::align(pos,rest) to manage the storage coordinates coherently, allowing to re-establish the begin of each storage block always, using pointer arithmetics.

Definition at line 91 of file allocation-cluster.cpp.

Public Member Functions

void addBlock ()
 
void attach (Destructor &dtor)
 
size_t calcAllocInCurrentBlock () const
 
size_t determineExtentCnt () const
 
void discardAll ()
 
bool empty () const
 

Static Public Member Functions

static StorageManageraccess (AllocationCluster &clu)
 

Classes

struct  Extent
 Block of allocated storage. More...
 
union  ManagementView
 

Private Types

using Destructors = lib::LinkedElements< Destructor, PolicyInvokeDtor >
 
using Extents = lib::LinkedElements< Extent >
 

Private Member Functions

 StorageManager ()=delete
 
void closeCurrentBlock ()
 
ExtentgetCurrentBlockStart () const
 
void prependNextBlock ()
 

Private Attributes

ManagementView view_
 

Class Documentation

◆ lib::AllocationCluster::StorageManager::ManagementView

union lib::AllocationCluster::StorageManager::ManagementView
Class Members
Storage storage
Extents extents
+ Collaboration diagram for AllocationCluster::StorageManager::ManagementView:

Constructor & Destructor Documentation

◆ StorageManager()

StorageManager ( )
privatedelete
Note
used as overlay view only, never created
+ Collaboration diagram for AllocationCluster::StorageManager:

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