Lumiera
0.pre.03
»edit your freedom«
|
#include "vault/mem/extent-family.hpp"
Memory manager to provide a sequence of Extents for cyclic usage.
Storage extents, once allocated, will be re-used without invoking any ctors or dtors on the objects nominally located in »slots« within the Extent.
Definition at line 80 of file extent-family.hpp.
Public Types | |
using | iterator = lib::IterableDecorator< Extent, IdxLink > |
allow transparent iteration of Extents, with the ability to expand storage | |
Public Member Functions | |
ExtentFamily (size_t initialCnt=1) | |
iterator | begin () |
iterate over all the currently active Extents | |
void | dropOld (size_t cnt) |
discard oldest cnt extents | |
bool | empty () const |
iterator | end () |
iterator | last () |
positioned to the last / latest storage extent opened More... | |
void | openNew (size_t cnt=1) |
claim next cnt extents, possibly allocate. More... | |
void | reserve (size_t expectedMaxExtents) |
Classes | |
struct | Extent |
logical structure of a memory Extent More... | |
struct | IdxLink |
Iteration »State Core« based on Extents index position. More... | |
struct | Storage |
Entry in the Extents management datastructure. More... | |
Friends | |
iterator | begin (ExtentFamily &exFam) |
iterator | end (ExtentFamily &exFam) |
class | ExtentDiagnostic< T, siz > |
„backdoor“ to watch internals from tests | |
Private Types | |
using | _UniqueStoragePtr = std::unique_ptr< lib::UninitialisedStorage< T, siz > > |
using | Extents = std::vector< Storage > |
Private Member Functions | |
void | ___sanityCheckAllocSize (size_t addCnt) |
Extent & | access (size_t idx) const |
size_t | activeSlotCnt () const |
bool | canAccomodate (size_t addCnt) const |
size_t | freeSlotCnt () const |
size_t | incWrap (size_t idx, size_t inc=1) |
increment index, but wrap at array end. More... | |
bool | isValidPos (size_t idx) const |
bool | isWrapped () const |
bool | matchPos (size_t idx, void *address) |
size_t | slotCnt () const |
Private Member Functions inherited from NonCopyable | |
NonCopyable (NonCopyable const &)=delete | |
NonCopyable & | operator= (NonCopyable const &)=delete |
Private Attributes | |
size_t | after_ |
Extents | extents_ |
size_t | start_ |
Static Private Attributes | |
static const size_t | EXCESS_ALLOC {5} |
number of excess new extents to add whenever new storage is required | |
|
inline |
claim next cnt extents, possibly allocate.
Definition at line 232 of file extent-family.hpp.
Referenced by ExtentFamily_test::reuseUnclean(), and ExtentFamily_test::simpleUsage().
|
inline |
positioned to the last / latest storage extent opened
Definition at line 285 of file extent-family.hpp.
|
inlineprivate |
Definition at line 308 of file extent-family.hpp.
|
inlineprivate |
increment index, but wrap at array end.
Definition at line 337 of file extent-family.hpp.