Pool

For conceptual usage, see:

Pool objects in C++ are referenced by the following shared pointer typedef:

typedef std::shared_ptr<rogue::interfaces::stream::Pool> rogue::interfaces::stream::PoolPtr
[header]

Shared pointer alias for Pool.

The class description is shown below:

class Pool : public rogue::EnableSharedFromThis<rogue::interfaces::stream::Pool>
[header]

Frame and buffer allocator for stream endpoints.

Pool is the stream-memory allocation layer used by Slave objects to service frame requests from upstream Master objects (Master::reqFrame() eventually resolves through Pool::acceptReq() on the primary slave).

Core responsibilities:

  • Allocate and construct Frame objects.

  • Allocate and construct the underlying Buffer objects used by each frame.

  • Reclaim and optionally recycle buffer data when buffers are returned.

  • Track allocation statistics (getAllocBytes(), getAllocCount()).

Default behavior:

  • A request typically returns a frame with one buffer sized for the request.

  • Buffer memory is released when returned (no caching required).

Fixed-size mode (setFixedSize()):

  • Each allocated buffer uses the configured fixed buffer size.

  • If a frame request is larger than one fixed buffer, the frame is built from multiple buffers so total capacity satisfies the request.

Pooling mode (setPoolSize() with fixed-size operation):

  • Returned buffer memory blocks are cached in an internal free queue for reuse.

  • Pool size defines the maximum number of cached entries retained.

  • Reuse reduces allocator churn for high-rate streaming workloads.

Subclassing/advanced use:

  • Override acceptReq() to customize how frames are assembled.

  • Override retBuffer() to customize return/recycle behavior.

  • Use protected helpers (allocBuffer(), createBuffer(), decCounter()) when integrating external memory providers, such as DMA-backed memory.

Subclassed by rogue::interfaces::stream::Slave

Public Functions

Pool()
[header] [impl]

Constructs a pool with default allocation behavior enabled.

Creator.

Company : SLAC National Accelerator Laboratory

Description: Stream memory pool The function calls in this are a mess! create buffer, allocate buffer, etc need to be reworked.

This file is part of the rogue software platform. It is subject to the license terms in the LICENSE.txt file found in the top-level directory of this distribution and at: https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. No part of the rogue software platform, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the LICENSE.txt file.

virtual ~Pool()
[header] [impl]

Destroys the pool and releases any cached buffer storage.

Destructor.

uint32_t getAllocBytes()
[header] [impl]

Returns total currently allocated bytes.

Get allocated memory.

This value is incremented as buffers are allocated and decremented as buffers are freed.

Exposed as getAllocBytes() in Python.

Returns:

Total currently allocated bytes.

uint32_t getAllocCount()
[header] [impl]

Returns total currently allocated buffer count.

Get allocated count.

This value is incremented as buffers are allocated and decremented as buffers are freed.

Exposed as getAllocCount() in Python.

Returns:

Total currently allocated buffers.

virtual std::shared_ptr<rogue::interfaces::stream::Frame> acceptReq(uint32_t size, bool zeroCopyEn)
[header] [impl]

Services a frame allocation request from a master.

Accept a frame request. Called from master.

Called by Master::reqFrame() to allocate a frame and one or more buffers.

Parameters:
  • size – Minimum requested payload size in bytes.

  • zeroCopyEn – True to allow zero-copy buffers when supported.

Returns:

Newly allocated frame.

virtual void retBuffer(uint8_t *data, uint32_t meta, uint32_t size)
[header] [impl]

Returns buffer data to the allocator.

Return a buffer.

This method is called by the Buffer destructor in order to free the associated Buffer memory. May be overridden by a subclass to change the way the buffer data is returned.

Parameters:
  • data – Data pointer to release.

  • meta – Metadata specific to the allocator.

  • size – Size of data buffer.

void setFixedSize(uint32_t size)
[header] [impl]

Sets fixed-size mode.

Set fixed size mode.

This method puts the allocator into fixed size mode.

Exposed as setFixedSize() in Python.

Parameters:

size – Fixed size value.

uint32_t getFixedSize()
[header] [impl]

Returns fixed-size allocation setting.

Get fixed size mode.

A return value of 0 means fixed-size mode is disabled.

Exposed as getFixedSize() in Python.

Returns:

Fixed size value or 0 when fixed-size mode is disabled.

void setPoolSize(uint32_t size)
[header] [impl]

Sets buffer pool size.

Set buffer pool size.

Exposed as setPoolSize() in Python.

Parameters:

size – Number of entries to keep in the pool.

uint32_t getPoolSize()
[header] [impl]

Returns configured maximum number of cached pool entries.

Get pool size.

Exposed as getPoolSize() in Python.

Returns:

Pool size.

Public Static Functions

static void setup_python()
[header] [impl]

Registers this type with Python bindings.