Template Struct Pool
Defined in File pool.h
Inheritance Relationships
Base Types
public CE::Memory::AbstractBlockManager< T >(Template Struct AbstractBlockManager)public CE::State::Singleton< Pool< T > >(Template Class Singleton)
Struct Documentation
-
template<typename T>
struct Pool : public CE::Memory::AbstractBlockManager<T>, public CE::State::Singleton<Pool<T>> Singleton entry point for allocating objects.
Existing manager methods remain available; release_context() gives handles a retained PoolState.
Public Types
Public Functions
-
inline Pool()
Create a facade with a shared-owned PoolState over the per-T block domain.
- Template Parameters:
T – Class type whose objects fit representable aligned storage. The facade itself need not outlive handles that captured release_context(); concurrent direct facade use still requires it to remain alive.
-
inline std::shared_ptr<release_context_type> release_context() const
Declaration:
[[nodiscard]]- Returns:
Retained typed pool/release state captured while this facade is live. Later construction/final release may use it without looking up the singleton.
Delegate batch construction to the retained pool state.
See also
- Parameters:
N – Object count; zero returns no handles.
args – Stored constructor arguments forwarded for each object; repeated forwarding can reuse already moved-from values.
- Returns:
Independent per-object handles retaining the release state, which may outlive this facade. Construction/allocation failure destroys completed objects and returns remaining storage; see PoolState::retrieve_objects().
-
inline ::CE::Memory::Block<T> retrieve_block(std::size_t N)
Reserve a raw checked-out block through the retained context.
- Parameters:
N – Positive object-slot count.
- Returns:
Unconstructed storage metadata, potentially enlarged by byte growth/alignment. No objects are constructed; return the range only after users/lifetimes end.
-
inline void return_objects(T *p, std::size_t length)
Delegate a positive in-bounds slot-range return; this does not itself destroy objects.
- Parameters:
p – First slot no longer in use.
length – Number of T slots, not bytes. Unknown/already-pooled/out-of-bounds returns throw bad_request. Destroy live objects through the compatible tracker before returning raw storage.
-
inline void return_block(const ::CE::Memory::Block<T> &block)
Return an exact current block to the retained typed pool state.
- Parameters:
block – Checked-out metadata with no remaining live users. Invalid returns throw failed_operation; object construction/destruction remains a separate responsibility.
-
inline virtual void cull(std::chrono::minutes age) override
Queue complete free owners old enough for later release.
- Parameters:
age – Minimum stale age; does not force checked-out/split owners free. No final backing destruction occurs until release_culled().
-
inline virtual void release_culled() override
Remove still-complete free queued owners transactionally, then destroy final backing owners after unlocking.
Retained user ranges are not forcibly invalidated.
-
inline Pool()