rogue
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
rogue::interfaces::stream::Buffer Class Reference

Stream frame buffer container. More...

#include <Buffer.h>

Public Types

typedef uint8_t * iterator
 Iterator alias for byte-wise buffer access.
 

Public Member Functions

 Buffer (std::shared_ptr< rogue::interfaces::stream::Pool > source, void *data, uint32_t meta, uint32_t size, uint32_t alloc)
 Constructs a buffer around a pool allocation.
 
 ~Buffer ()
 Destroys the buffer wrapper and returns ownership to the pool path.
 
void setFrame (std::shared_ptr< rogue::interfaces::stream::Frame > frame)
 Associates this buffer with its owning frame.
 
uint32_t getMeta ()
 Returns metadata associated with this buffer.
 
void setMeta (uint32_t meta)
 Sets metadata associated with this buffer.
 
void adjustHeader (int32_t value)
 Adjusts header reservation size.
 
void zeroHeader ()
 Clears header reservation.
 
void adjustTail (int32_t value)
 Adjusts tail reservation size.
 
void zeroTail ()
 Clears tail reservation.
 
uint8_t * begin ()
 Returns iterator to start of buffer payload region.
 
uint8_t * end ()
 Returns iterator to end of usable buffer region.
 
uint8_t * endPayload ()
 Returns iterator to end of current payload.
 
uint32_t getSize ()
 Returns payload-capable buffer size.
 
uint32_t getAvailable ()
 Returns remaining available payload space.
 
uint32_t getPayload ()
 Returns current payload size.
 
void setPayload (uint32_t size)
 Sets payload size.
 
void minPayload (uint32_t size)
 Ensures payload size is at least size.
 
void adjustPayload (int32_t value)
 Adjusts payload size by signed delta.
 
void setPayloadFull ()
 Sets payload size to maximum available buffer space.
 
void setPayloadEmpty ()
 Clears payload (sets payload size to zero).
 
void debug (uint32_t idx)
 Emits debug information for this buffer.
 

Static Public Member Functions

static std::shared_ptr< rogue::interfaces::stream::Buffercreate (std::shared_ptr< rogue::interfaces::stream::Pool > source, void *data, uint32_t meta, uint32_t size, uint32_t alloc)
 Creates a buffer backed by memory owned by a stream Pool.
 

Detailed Description

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 through FrameIterator; Buffer is a lower-level C++ API.

Definition at line 42 of file Buffer.h.

Member Typedef Documentation

◆ iterator

Iterator alias for byte-wise buffer access.

Definition at line 78 of file Buffer.h.

Constructor & Destructor Documentation

◆ Buffer()

rogue::interfaces::stream::Buffer::Buffer ( std::shared_ptr< rogue::interfaces::stream::Pool source,
void *  data,
uint32_t  meta,
uint32_t  size,
uint32_t  alloc 
)

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 alloc size may be larger than size when the allocator rounds up to alignment or slab boundaries.

Parameters
sourcePool that owns the backing allocation.
dataPointer to raw data allocation.
metaPool-defined metadata associated with the allocation.
sizeRequested/usable raw buffer size in bytes.
allocActual allocated bytes for this buffer.

Definition at line 44 of file Buffer.cpp.

◆ ~Buffer()

rogue::interfaces::stream::Buffer::~Buffer ( )

Destroys the buffer wrapper and returns ownership to the pool path.

Destroy a buffer.

Definition at line 59 of file Buffer.cpp.

Member Function Documentation

◆ adjustHeader()

void rogue::interfaces::stream::Buffer::adjustHeader ( int32_t  value)

Adjusts header reservation size.

Adjust header by passed value.

Parameters
valueHeader adjustment in bytes.

Definition at line 79 of file Buffer.cpp.

◆ adjustPayload()

void rogue::interfaces::stream::Buffer::adjustPayload ( int32_t  value)

Adjusts payload size by signed delta.

Adjust payload size.

Parameters
valuePayload adjustment in bytes.

Definition at line 229 of file Buffer.cpp.

◆ adjustTail()

void rogue::interfaces::stream::Buffer::adjustTail ( int32_t  value)

Adjusts tail reservation size.

Adjust tail by passed value.

Parameters
valueTail adjustment in bytes.

Definition at line 113 of file Buffer.cpp.

◆ begin()

uint8_t * rogue::interfaces::stream::Buffer::begin ( )

Returns iterator to start of buffer payload region.

Excludes reserved header space.

Returns
Begin buffer iterator.

Definition at line 147 of file Buffer.cpp.

◆ create()

rogue::interfaces::stream::BufferPtr rogue::interfaces::stream::Buffer::create ( std::shared_ptr< rogue::interfaces::stream::Pool source,
void *  data,
uint32_t  meta,
uint32_t  size,
uint32_t  alloc 
)
static

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 returns std::shared_ptr ownership compatible with Rogue pointer typedefs.

Not exposed to Python.

Parameters
sourcePool that owns the backing allocation.
dataPointer to raw data allocation.
metaPool-defined metadata associated with the allocation.
sizeRequested/usable raw buffer size in bytes.
allocActual allocated bytes for this buffer.
Returns
Shared pointer to the created buffer object.

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.

Definition at line 35 of file Buffer.cpp.

◆ debug()

void rogue::interfaces::stream::Buffer::debug ( uint32_t  idx)

Emits debug information for this buffer.

Debug buffer.

Parameters
idxBuffer index/tag to print with the debug output.

Definition at line 256 of file Buffer.cpp.

◆ end()

uint8_t * rogue::interfaces::stream::Buffer::end ( )

Returns iterator to end of usable buffer region.

Excludes reserved tail space.

Returns
End buffer iterator.

Definition at line 155 of file Buffer.cpp.

◆ endPayload()

uint8_t * rogue::interfaces::stream::Buffer::endPayload ( )

Returns iterator to end of current payload.

Returns
End payload iterator.

Definition at line 163 of file Buffer.cpp.

◆ getAvailable()

uint32_t rogue::interfaces::stream::Buffer::getAvailable ( )

Returns remaining available payload space.

Returns
Available payload space in bytes.

Definition at line 182 of file Buffer.cpp.

◆ getMeta()

uint32_t rogue::interfaces::stream::Buffer::getMeta ( )

Returns metadata associated with this buffer.

Get meta data, used by pool.

Metadata is used by Pool implementations to track allocations.

Returns
Metadata value.

Definition at line 69 of file Buffer.cpp.

◆ getPayload()

uint32_t rogue::interfaces::stream::Buffer::getPayload ( )

Returns current payload size.

Returns
Payload size in bytes.

Definition at line 202 of file Buffer.cpp.

◆ getSize()

uint32_t rogue::interfaces::stream::Buffer::getSize ( )

Returns payload-capable buffer size.

Full buffer size minus current header/tail reservations.

Returns
Buffer size in bytes.

Definition at line 173 of file Buffer.cpp.

◆ minPayload()

void rogue::interfaces::stream::Buffer::minPayload ( uint32_t  size)

Ensures payload size is at least size.

Payload size is unchanged when already larger than size.

Parameters
sizeMinimum payload size in bytes.

Definition at line 224 of file Buffer.cpp.

◆ setFrame()

void rogue::interfaces::stream::Buffer::setFrame ( std::shared_ptr< rogue::interfaces::stream::Frame frame)

Associates this buffer with its owning frame.

Set container frame.

Called by Frame while building or reparenting frame buffer lists.

Parameters
frameOwning frame object.

Definition at line 64 of file Buffer.cpp.

◆ setMeta()

void rogue::interfaces::stream::Buffer::setMeta ( uint32_t  meta)

Sets metadata associated with this buffer.

Set meta data, used by pool.

Metadata is used by Pool implementations to track allocations.

Parameters
metaMetadata value.

Definition at line 74 of file Buffer.cpp.

◆ setPayload()

void rogue::interfaces::stream::Buffer::setPayload ( uint32_t  size)

Sets payload size.

Set payload size (not including header)

Parameters
sizeNew payload size in bytes.

Definition at line 207 of file Buffer.cpp.

◆ setPayloadEmpty()

void rogue::interfaces::stream::Buffer::setPayloadEmpty ( )

Clears payload (sets payload size to zero).

Set the buffer as empty (minus header reservation)

Definition at line 248 of file Buffer.cpp.

◆ setPayloadFull()

void rogue::interfaces::stream::Buffer::setPayloadFull ( )

Sets payload size to maximum available buffer space.

Set the buffer as full (minus tail reservation)

Fills buffer minus header and tail reservations.

Definition at line 240 of file Buffer.cpp.

◆ zeroHeader()

void rogue::interfaces::stream::Buffer::zeroHeader ( )

Clears header reservation.

Clear the header reservation.

Definition at line 105 of file Buffer.cpp.

◆ zeroTail()

void rogue::interfaces::stream::Buffer::zeroTail ( )

Clears tail reservation.

Clear the tail reservation.

Definition at line 136 of file Buffer.cpp.


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