1#ifndef IPPL_BUFFER_HANDLER_H
2#define IPPL_BUFFER_HANDLER_H
20 template <
typename MemorySpace>
94 template <
typename MemorySpace>
Interface for memory buffer handling.
virtual size_type getFreeSize() const =0
Gets the size of all free buffers.
ippl::detail::size_type size_type
ippl::detail::Archive< MemorySpace > archive_type
std::shared_ptr< archive_type > buffer_type
virtual void deleteAllBuffers()=0
Deletes all buffers.
virtual void freeAllBuffers()=0
Frees all currently used buffers.
virtual void freeBuffer(buffer_type buffer)=0
Frees a specified buffer.
virtual buffer_type getBuffer(size_type size, double overallocation)=0
Requests a memory buffer of a specified size.
virtual size_type getUsedSize() const =0
Gets the size of all buffers in use.
Concrete implementation of BufferHandler for managing memory buffers.
void releaseUsedBuffer(buffer_type buffer)
buffer_type reallocateLargestFreeBuffer(size_type requiredSize)
size_type freeSize_m
Total size of all free buffers.
size_type usedSize_m
Total size of all allocated buffers.
buffer_type getFreeBuffer(buffer_type buffer)
size_type getUsedSize() const override
Frees a specified buffer.
buffer_set_type used_buffers
Set of used buffers.
void deleteAllBuffers() override
Frees a specified buffer.
~DefaultBufferHandler() override
bool(*)(const buffer_type &, const buffer_type &) buffer_comparator_type
std::set< buffer_type, buffer_comparator_type > buffer_set_type
bool isBufferUsed(buffer_type buffer) const
static bool bufferSizeComparator(const buffer_type &lhs, const buffer_type &rhs)
buffer_type findFreeBuffer(size_type requiredSize)
void freeBuffer(buffer_type buffer) override
Frees a specified buffer.
buffer_type getBuffer(size_type size, double overallocation) override
Acquires a buffer of at least the specified size.
buffer_type allocateNewBuffer(size_type requiredSize)
void freeAllBuffers() override
Frees a specified buffer.
buffer_set_type::iterator findSmallestSufficientBuffer(size_type requiredSize)
buffer_set_type free_buffers
Set of free buffers.
size_type getFreeSize() const override
Frees a specified buffer.