Buffer
For conceptual usage, see:
The list of Buffer objects in a Frame is iterated using a the following typedef:
rogue::interfaces::stream::Frame::BufferIterator
The uint8_t data within a Buffer is iterated using a the following typedef:
rogue::interfaces::stream::Buffer::iterator
Buffer objects in C++ are referenced by the following shared pointer typedef:
-
typedef std::shared_ptr<rogue::interfaces::stream::Buffer> rogue::interfaces::stream::BufferPtr
[header] Shared pointer alias for
Buffer.
The class description is shown below:
-
class Buffer
[header] Stream frame buffer container.
Represents a contiguous memory block (allocated by a
Pool) that contributes to a frame. Buffers reserve header/tail regions for protocol layers. Most users should access payload data throughFrameIterator;Bufferis a lower-level C++ API.Public Functions
Constructs a buffer around a pool allocation.
Create a buffer.
This constructor is a low-level C++ allocation path. Prefer
create()when shared ownership or Python exposure is required.This constructor is used internally by pool implementations when a frame buffer is allocated. The
allocsize may be larger thansizewhen the allocator rounds up to alignment or slab boundaries.- Parameters:
source – Pool that owns the backing allocation.
data – Pointer to raw data allocation.
meta – Pool-defined metadata associated with the allocation.
size – Requested/usable raw buffer size in bytes.
alloc – Actual allocated bytes for this buffer.
-
~Buffer()
[header] [impl] Destroys the buffer wrapper and returns ownership to the pool path.
Destroy a buffer.
Associates this buffer with its owning frame.
Set container frame.
Called by
Framewhile building or reparenting frame buffer lists.- Parameters:
frame – Owning frame object.
-
uint32_t getMeta()
[header] [impl] Returns metadata associated with this buffer.
Get meta data, used by pool.
Metadata is used by
Poolimplementations to track allocations.- Returns:
Metadata value.
-
void setMeta(uint32_t meta)
[header] [impl] Sets metadata associated with this buffer.
Set meta data, used by pool.
Metadata is used by
Poolimplementations to track allocations.- Parameters:
meta – Metadata value.
-
void adjustHeader(int32_t value)
[header] [impl] Adjusts header reservation size.
Adjust header by passed value.
- Parameters:
value – Header adjustment in bytes.
-
void adjustTail(int32_t value)
[header] [impl] Adjusts tail reservation size.
Adjust tail by passed value.
- Parameters:
value – Tail adjustment in bytes.
-
uint8_t *begin()
[header] [impl] Returns iterator to start of buffer payload region.
Excludes reserved header space.
- Returns:
Begin buffer iterator.
-
uint8_t *end()
[header] [impl] Returns iterator to end of usable buffer region.
Excludes reserved tail space.
- Returns:
End buffer iterator.
-
uint8_t *endPayload()
[header] [impl] Returns iterator to end of current payload.
- Returns:
End payload iterator.
-
uint32_t getSize()
[header] [impl] Returns payload-capable buffer size.
Full buffer size minus current header/tail reservations.
- Returns:
Buffer size in bytes.
-
uint32_t getAvailable()
[header] [impl] Returns remaining available payload space.
- Returns:
Available payload space in bytes.
-
uint32_t getPayload()
[header] [impl] Returns current payload size.
- Returns:
Payload size in bytes.
-
void setPayload(uint32_t size)
[header] [impl] Sets payload size.
Set payload size (not including header)
- Parameters:
size – New payload size in bytes.
-
void minPayload(uint32_t size)
[header] [impl] Ensures payload size is at least
size.Payload size is unchanged when already larger than
size.- Parameters:
size – Minimum payload size in bytes.
-
void adjustPayload(int32_t value)
[header] [impl] Adjusts payload size by signed delta.
Adjust payload size.
- Parameters:
value – Payload adjustment in bytes.
-
void setPayloadFull()
[header] [impl] Sets payload size to maximum available buffer space.
Set the buffer as full (minus tail reservation)
Fills buffer minus header and tail reservations.
Public Static Functions
Creates a buffer backed by memory owned by a stream
Pool.Class creation.
Parameter semantics are identical to the constructor; see
Buffer()for allocation and ownership behavior details. This static factory is the preferred construction path when the object is shared across Rogue graph connections or exposed to Python. It returnsstd::shared_ptrownership compatible with Rogue pointer typedefs.Not exposed to Python.
Company : SLAC National Accelerator Laboratory
Description: Stream frame container
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.
- Parameters:
source – Pool that owns the backing allocation.
data – Pointer to raw data allocation.
meta – Pool-defined metadata associated with the allocation.
size – Requested/usable raw buffer size in bytes.
alloc – Actual allocated bytes for this buffer.
- Returns:
Shared pointer to the created buffer object.