Pool whose buffers are carved from one new[] block and kept on a Queue of PoolEntry (spin-locked); allocation returns nullptr when the queue is empty.
More...
#include <GenericPool.hh>
Inherits Pds::Queue< T >, and Pds::Pool.
Inherited by Pds::GenericPoolW.
|
| | GenericPool (size_t sizeofObject, int numberofObjects) |
| | Allocate a block for numberofObjects buffers of sizeofObject bytes plus headers and put all buffers on the free list.
|
| |
| | GenericPool (size_t sizeofObject, int numberofObjects, unsigned alignBoundary) |
| | Like GenericPool(sizeofObject, numberofObjects), with each user buffer aligned to alignBoundary (the block gets alignBoundary extra bytes).
|
| |
| | ~GenericPool () |
| | Free the block.
|
| |
| void * | buffer () const |
| | Return the start of the block.
|
| |
| size_t | size () const |
| | Return the block size in bytes.
|
| |
| void | dump () const |
| | Print the block size, address and fill offset, the object size and count, and the counters to stdout.
|
| |
| virtual | ~Pool () |
| | Does nothing; empty virtual destructor.
|
| |
| | Pool (size_t sizeofObject, int numberofOfObjects) |
| | Set the object size and count and round each allocation (object plus PoolEntry header) up to a multiple of the PoolEntry size; the subclass calls populate() to create the buffers.
|
| |
| | Pool (size_t sizeofObject, int numberofOfObjects, unsigned alignBoundary) |
| | Like Pool(sizeofObject, numberofOfObjects), but rounds each allocation up to a multiple of alignBoundary.
|
| |
| void * | alloc (size_t size) |
| | Take a buffer from the free list and count the allocation; returns nullptr if size exceeds the object size or none is available.
|
| |
| virtual void | free (PoolEntry *) |
| | Return entry to the free list (enque()).
|
| |
| void | clearCounters () |
| | Zero the allocation and free counters.
|
| |
| size_t | sizeofObject () const |
| | Return the object size given to the constructor.
|
| |
| int | numberofObjects () const |
| | Return the number of buffers.
|
| |
| const uint64_t & | numberofAllocs () const |
| | Return a reference to the allocation counter.
|
| |
| const uint64_t & | numberofFrees () const |
| | Return a reference to the free counter.
|
| |
| int | numberOfAllocatedObjects () const |
| | Return allocations minus frees.
|
| |
| int | numberOfFreeObjects () const |
| | Return the number of buffers minus numberOfAllocatedObjects().
|
| |
Pool whose buffers are carved from one new[] block and kept on a Queue of PoolEntry (spin-locked); allocation returns nullptr when the queue is empty.
◆ GenericPool() [1/2]
| Pds::GenericPool::GenericPool |
( |
size_t |
sizeofObject, |
|
|
int |
numberofObjects |
|
) |
| |
|
inline |
Allocate a block for numberofObjects buffers of sizeofObject bytes plus headers and put all buffers on the free list.
◆ GenericPool() [2/2]
| Pds::GenericPool::GenericPool |
( |
size_t |
sizeofObject, |
|
|
int |
numberofObjects, |
|
|
unsigned |
alignBoundary |
|
) |
| |
|
inline |
Like GenericPool(sizeofObject, numberofObjects), with each user buffer aligned to alignBoundary (the block gets alignBoundary extra bytes).
◆ ~GenericPool()
| Pds::GenericPool::~GenericPool |
( |
| ) |
|
|
inline |
◆ allocate()
| void * Pds::GenericPool::allocate |
( |
size_t |
size | ) |
|
|
inlineprotectedvirtual |
◆ buffer()
| void * Pds::GenericPool::buffer |
( |
| ) |
const |
|
inline |
Return the start of the block.
◆ deque()
| void * Pds::GenericPool::deque |
( |
| ) |
|
|
inlineprotectedvirtual |
◆ dump()
| void Pds::GenericPool::dump |
( |
| ) |
const |
Print the block size, address and fill offset, the object size and count, and the counters to stdout.
◆ enque()
| void Pds::GenericPool::enque |
( |
PoolEntry * |
entry | ) |
|
|
inlineprotectedvirtual |
◆ size()
| size_t Pds::GenericPool::size |
( |
| ) |
const |
|
inline |
Return the block size in bytes.
The documentation for this class was generated from the following file: