lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
Pds::GenericPoolW Class Reference

GenericPool whose allocation blocks on a condition variable until a buffer is freed (or stop() is called); frees wake one waiter. More...

#include <GenericPoolW.hh>

Inherits Pds::GenericPool.

Public Member Functions

 GenericPoolW (size_t sizeofObject, int numberofObjects)
 Construct the base pool of numberofObjects buffers of sizeofObject bytes.
 
 GenericPoolW (size_t sizeofObject, int numberofObjects, unsigned alignBoundary)
 Construct the base pool with buffers aligned to alignBoundary.
 
virtual ~GenericPoolW ()
 Does nothing; empty virtual destructor.
 
void stop ()
 Set the stopping flag and wake all waiting allocations, which then return nullptr.
 
- Public Member Functions inherited from Pds::GenericPool
 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.
 
- Public Member Functions inherited from Pds::Pool
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().
 

Protected Member Functions

virtual void * deque ()
 
virtual void enque (PoolEntry *)
 
- Protected Member Functions inherited from Pds::GenericPool
virtual void * allocate (size_t size)
 
- Protected Member Functions inherited from Pds::Pool
size_t sizeofAllocate () const
 
void populate ()
 

Additional Inherited Members

- Static Public Member Functions inherited from Pds::Pool
static void free (void *buffer)
 Return the user buffer buffer to the pool recorded in its PoolEntry header and count the free.
 
static int numberOfFreeObjects (void *buffer)
 Return numberOfFreeObjects() of the pool that owns buffer.
 

Detailed Description

GenericPool whose allocation blocks on a condition variable until a buffer is freed (or stop() is called); frees wake one waiter.

Constructor & Destructor Documentation

◆ GenericPoolW() [1/2]

Pds::GenericPoolW::GenericPoolW ( size_t  sizeofObject,
int  numberofObjects 
)

Construct the base pool of numberofObjects buffers of sizeofObject bytes.

◆ GenericPoolW() [2/2]

Pds::GenericPoolW::GenericPoolW ( size_t  sizeofObject,
int  numberofObjects,
unsigned  alignBoundary 
)

Construct the base pool with buffers aligned to alignBoundary.

◆ ~GenericPoolW()

virtual Pds::GenericPoolW::~GenericPoolW ( )
virtual

Does nothing; empty virtual destructor.

Member Function Documentation

◆ deque()

void * Pds::GenericPoolW::deque ( )
inlineprotectedvirtual

Reimplemented from Pds::GenericPool.

◆ enque()

void Pds::GenericPoolW::enque ( PoolEntry *  entry)
inlineprotectedvirtual

Reimplemented from Pds::GenericPool.

◆ stop()

void Pds::GenericPoolW::stop ( )

Set the stopping flag and wake all waiting allocations, which then return nullptr.


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