Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
DataBufferPool Class Reference

Proxy Pool that can allocate DataBuffer objects of a certain size. More...

#include <DataBuffer.hxx>

Inheritance diagram for DataBufferPool:
Pool

Public Member Functions

 DataBufferPool (unsigned payload_size)
 
size_t free_items () override
 Number of free items in the pool.
 
size_t free_items (size_t size) override
 Number of free items in the pool for a given allocation size.
 
void alloc (DataBuffer **result)
 Get a free item out of the pool with untyped data of the size specified in the constructor.
 
void alloc (DataBufferPtr *result)
 Get a free item out of the pool with untyped data of the size specified in the constructor.
 
- Public Member Functions inherited from Pool
size_t total_size ()
 
template<class BufferType >
void alloc (Buffer< BufferType > **result, Executable *flow=NULL)
 Get a free item out of the pool.
 
template<class BufferType >
void alloc (BufferPtr< BufferType > *result)
 Get a free item out of the pool.
 
template<class BufferType >
void alloc_async (Executable *flow)
 Get a free item out of the pool.
 

Private Member Functions

BufferBasealloc_untyped (size_t size, Executable *flow) override
 Internal helper funciton used by the default Buffer allocimplementation.
 
void free (BufferBase *item) override
 Function called when a buffer refcount reaches zero.
 
Poolbase_pool ()
 
uint16_t alloc_size ()
 
uint16_t payload_size ()
 

Private Attributes

uint16_t payloadSize_
 Number of bytes that need to be stored in each buffer.
 

Additional Inherited Members

- Static Public Member Functions inherited from Pool
template<class BufferType >
static void alloc_async_init (BufferBase *base, Buffer< BufferType > **result)
 Cast the result of an asynchronous allocation and perform a placement new on it.
 
- Protected Member Functions inherited from Pool
 Pool ()
 Default Constructor.
 
virtual ~Pool ()
 default destructor.
 
- Protected Attributes inherited from Pool
size_t totalSize
 keep track of total allocated size of memory
 

Detailed Description

Proxy Pool that can allocate DataBuffer objects of a certain size.

All memory comes from the mainBufferPool.

Definition at line 658 of file DataBuffer.hxx.

Constructor & Destructor Documentation

◆ DataBufferPool()

DataBufferPool::DataBufferPool ( unsigned  payload_size)
inline

Definition at line 661 of file DataBuffer.hxx.

Member Function Documentation

◆ alloc() [1/2]

void DataBufferPool::alloc ( DataBuffer **  result)
inline

Get a free item out of the pool with untyped data of the size specified in the constructor.

Parameters
resultpointer to a pointer to the result

Definition at line 694 of file DataBuffer.hxx.

◆ alloc() [2/2]

void DataBufferPool::alloc ( DataBufferPtr *  result)
inline

Get a free item out of the pool with untyped data of the size specified in the constructor.

Parameters
resultholder pointer

Definition at line 713 of file DataBuffer.hxx.

◆ alloc_size()

uint16_t DataBufferPool::alloc_size ( )
inlineprivate
Returns
size of the buffers to allocate.

Definition at line 746 of file DataBuffer.hxx.

◆ alloc_untyped()

BufferBase * DataBufferPool::alloc_untyped ( size_t  size,
Executable flow 
)
inlineoverrideprivatevirtual

Internal helper funciton used by the default Buffer allocimplementation.

Implements Pool.

Definition at line 723 of file DataBuffer.hxx.

◆ base_pool()

Pool * DataBufferPool::base_pool ( )
inlineprivate
Returns
the pool from which we should get the actual memory we have.

Definition at line 740 of file DataBuffer.hxx.

◆ free()

void DataBufferPool::free ( BufferBase item)
inlineoverrideprivatevirtual

Function called when a buffer refcount reaches zero.

Implements Pool.

Definition at line 729 of file DataBuffer.hxx.

◆ free_items() [1/2]

size_t DataBufferPool::free_items ( )
inlineoverridevirtual

Number of free items in the pool.

Implements Pool.

Definition at line 677 of file DataBuffer.hxx.

◆ free_items() [2/2]

size_t DataBufferPool::free_items ( size_t  size)
inlineoverridevirtual

Number of free items in the pool for a given allocation size.

Parameters
sizesize of interest
Returns
number of free items in the pool for a given allocation size

Implements Pool.

Definition at line 685 of file DataBuffer.hxx.

◆ payload_size()

uint16_t DataBufferPool::payload_size ( )
inlineprivate
Returns
maximum number of bytes that can be stored inside an allocated buffer.

Definition at line 753 of file DataBuffer.hxx.

Member Data Documentation

◆ payloadSize_

uint16_t DataBufferPool::payloadSize_
private

Number of bytes that need to be stored in each buffer.

Definition at line 759 of file DataBuffer.hxx.


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