Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
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.

Classes

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

Static Public Member Functions

static StorageManageraccess (AllocationCluster &clu)
 

Public Member Functions

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

Private Types

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

Private Member Functions

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

Private Attributes

ManagementView view_
 

Constructor & Destructor Documentation

◆ StorageManager()

StorageManager ( )
privatedelete
Note
used as overlay view only, never created

Class Documentation

◆ lib::AllocationCluster::StorageManager::ManagementView

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

Member Typedef Documentation

◆ Destructors

using Destructors = lib::LinkedElements<Destructor, PolicyInvokeDtor>
private

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

◆ Extents

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

Member Function Documentation

◆ access()

static StorageManager & access ( AllocationCluster clu)
inlinestatic

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

Referenced by AllocationCluster::~AllocationCluster(), AllocationCluster::expandStorage(), AllocationCluster::numBytes(), AllocationCluster::numExtents(), and AllocationCluster::registerDestructor().

+ Here is the caller graph for this function:

◆ addBlock()

void addBlock ( )
inline

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

References AllocationCluster::StorageManager::closeCurrentBlock(), and AllocationCluster::StorageManager::prependNextBlock().

Referenced by AllocationCluster::expandStorage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ discardAll()

void discardAll ( )
inline

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

References LinkedElements< N, ALO >::clear(), AllocationCluster::StorageManager::closeCurrentBlock(), AllocationCluster::StorageManager::ManagementView::extents, and AllocationCluster::StorageManager::view_.

Referenced by AllocationCluster::~AllocationCluster().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ attach()

void attach ( Destructor dtor)
inline

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

References AllocationCluster::StorageManager::Extent::dtors, AllocationCluster::StorageManager::getCurrentBlockStart(), and LinkedElements< N, ALO >::push().

Referenced by AllocationCluster::registerDestructor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ empty()

bool empty ( ) const
inline

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

References AllocationCluster::Storage::pos, AllocationCluster::StorageManager::ManagementView::storage, and AllocationCluster::StorageManager::view_.

Referenced by AllocationCluster::StorageManager::closeCurrentBlock(), AllocationCluster::StorageManager::determineExtentCnt(), and AllocationCluster::StorageManager::getCurrentBlockStart().

+ Here is the caller graph for this function:

◆ determineExtentCnt()

size_t determineExtentCnt ( ) const
inline

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

References lib::asLinkedElements(), AllocationCluster::StorageManager::empty(), and AllocationCluster::StorageManager::getCurrentBlockStart().

Referenced by AllocationCluster::numExtents().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calcAllocInCurrentBlock()

size_t calcAllocInCurrentBlock ( ) const
inline

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

References AllocationCluster::max_size(), AllocationCluster::Storage::rest, AllocationCluster::StorageManager::ManagementView::storage, and AllocationCluster::StorageManager::view_.

Referenced by AllocationCluster::numBytes().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCurrentBlockStart()

Extent * getCurrentBlockStart ( ) const
inlineprivate

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

References AllocationCluster::StorageManager::empty(), AllocationCluster::EXTENT_SIZ, AllocationCluster::Storage::pos, AllocationCluster::Storage::rest, AllocationCluster::StorageManager::ManagementView::storage, and AllocationCluster::StorageManager::view_.

Referenced by AllocationCluster::StorageManager::attach(), AllocationCluster::StorageManager::closeCurrentBlock(), and AllocationCluster::StorageManager::determineExtentCnt().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ closeCurrentBlock()

void closeCurrentBlock ( )
inlineprivate

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

References AllocationCluster::StorageManager::empty(), AllocationCluster::StorageManager::getCurrentBlockStart(), AllocationCluster::Storage::pos, AllocationCluster::Storage::rest, AllocationCluster::StorageManager::ManagementView::storage, and AllocationCluster::StorageManager::view_.

Referenced by AllocationCluster::StorageManager::addBlock(), and AllocationCluster::StorageManager::discardAll().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prependNextBlock()

void prependNextBlock ( )
inlineprivate

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

References LinkedElements< N, ALO >::emplace(), AllocationCluster::StorageManager::ManagementView::extents, AllocationCluster::max_size(), AllocationCluster::Storage::pos, AllocationCluster::Storage::rest, AllocationCluster::StorageManager::Extent::storage, AllocationCluster::StorageManager::ManagementView::storage, LinkedElements< N, ALO >::top(), and AllocationCluster::StorageManager::view_.

Referenced by AllocationCluster::StorageManager::addBlock().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ view_

+ Collaboration diagram for AllocationCluster::StorageManager:

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