|
rogue
|
Container for one stream frame payload and metadata. More...
#include <Frame.h>
Public Types | |
| typedef std::vector< std::shared_ptr< rogue::interfaces::stream::Buffer > >::iterator | BufferIterator |
| Iterator alias for the internal buffer list. | |
Public Member Functions | |
| Frame () | |
| Constructs an empty frame. | |
| ~Frame () | |
| Destroys the frame instance. | |
| std::shared_ptr< rogue::interfaces::stream::FrameLock > | lock () |
| Locks the frame and returns a scoped lock object. | |
| std::vector< std::shared_ptr< rogue::interfaces::stream::Buffer > >::iterator | appendFrame (std::shared_ptr< rogue::interfaces::stream::Frame > frame) |
| Appends another frame's buffers to the end of this frame. | |
| std::vector< std::shared_ptr< rogue::interfaces::stream::Buffer > >::iterator | appendBuffer (std::shared_ptr< rogue::interfaces::stream::Buffer > buff) |
| Appends one buffer to the end of the frame. | |
| std::vector< std::shared_ptr< rogue::interfaces::stream::Buffer > >::iterator | beginBuffer () |
| Returns iterator to first underlying buffer. | |
| std::vector< std::shared_ptr< rogue::interfaces::stream::Buffer > >::iterator | endBuffer () |
| Returns end iterator for underlying buffer list. | |
| uint32_t | bufferCount () |
| Returns number of underlying buffers in the frame. | |
| void | clear () |
| Removes all buffers from the frame. | |
| bool | isEmpty () |
| Returns whether the frame contains no buffers. | |
| uint32_t | getSize () |
| Returns total raw frame capacity in bytes. | |
| uint32_t | getAvailable () |
| Returns remaining available payload space in bytes. | |
| uint32_t | getPayload () |
| Returns current payload size in bytes. | |
| void | setPayload (uint32_t size) |
| Sets payload size in bytes. | |
| void | minPayload (uint32_t size) |
| Expands payload size to at least the passed value. | |
| void | adjustPayload (int32_t value) |
| Adjusts payload size by a signed delta. | |
| void | setPayloadFull () |
| Sets payload size to full available frame capacity. | |
| void | setPayloadEmpty () |
| Sets the frame payload size to zero bytes. | |
| uint16_t | getFlags () |
| Returns 16-bit frame flags field. | |
| void | setFlags (uint16_t flags) |
| Sets 16-bit frame flags field. | |
| uint8_t | getFirstUser () |
| Returns the lower 8-bit user field from flags (SSI/Axi-Stream). | |
| void | setFirstUser (uint8_t fuser) |
| Sets the lower 8-bit user field in flags (SSI/Axi-Stream). | |
| uint8_t | getLastUser () |
| Returns the upper 8-bit user field from flags (SSI/Axi-Stream). | |
| void | setLastUser (uint8_t fuser) |
| Sets the upper 8-bit user field in flags (SSI/Axi-Stream). | |
| uint8_t | getChannel () |
| Returns frame channel value. | |
| void | setChannel (uint8_t channel) |
| Sets frame channel value. | |
| uint8_t | getError () |
| Returns frame error status value. | |
| void | setError (uint8_t error) |
| Sets frame error status value. | |
| rogue::interfaces::stream::FrameIterator | begin () |
| Returns begin iterator over frame payload. | |
| rogue::interfaces::stream::FrameIterator | end () |
| Returns end iterator over frame payload. | |
| rogue::interfaces::stream::FrameIterator | beginRead () |
| Returns legacy read-begin iterator. | |
| rogue::interfaces::stream::FrameIterator | endRead () |
| Returns legacy read-end iterator. | |
| rogue::interfaces::stream::FrameIterator | beginWrite () |
| Returns legacy write-begin iterator. | |
| rogue::interfaces::stream::FrameIterator | endWrite () |
| Returns legacy write-end iterator. | |
| void | readPy (boost::python::object p, uint32_t offset) |
| Reads frame bytes into a passed Python bytearray/buffer. | |
| boost::python::object | getBytearrayPy (uint32_t offset, uint32_t count) |
| Reads frame bytes into a newly allocated Python bytearray. | |
| boost::python::object | getMemoryviewPy () |
Returns a Python memoryview of frame payload data. | |
| void | writePy (boost::python::object p, uint32_t offset) |
| Writes bytes from a Python bytearray/buffer into the frame. | |
| boost::python::object | getNumpy (uint32_t offset, uint32_t count) |
Reads frame data and returns it as a NumPy uint8 array. | |
| void | putNumpy (boost::python::object np, uint32_t offset) |
| Writes NumPy array data into the frame payload. | |
| void | debug () |
| Prints debug information for this frame. | |
Public Member Functions inherited from rogue::EnableSharedFromThis< rogue::interfaces::stream::Frame > | |
| std::shared_ptr< rogue::interfaces::stream::Frame > | shared_from_this () |
Returns a shared_ptr<T> for this instance. | |
Public Member Functions inherited from rogue::EnableSharedFromThisBase | |
| virtual | ~EnableSharedFromThisBase () |
| Virtual destructor for polymorphic base usage. | |
Static Public Member Functions | |
| static void | setup_python () |
| Registers Python bindings for this class. | |
| static std::shared_ptr< rogue::interfaces::stream::Frame > | create () |
| Creates an empty frame. | |
Protected Member Functions | |
| void | setSizeDirty () |
| Set size values dirty. | |
Protected Attributes | |
| std::mutex | lock_ |
Friends | |
| class | Buffer |
| class | FrameLock |
Container for one stream frame payload and metadata.
In Rogue stream interfaces, each logical frame in flight is represented by one Frame instance. The frame object does not directly allocate contiguous payload memory. Instead, it owns an ordered list of Buffer objects that provide the underlying storage.
FrameIterator traverses payload bytes across buffer boundaries, so higher-level protocol code can read or write frame content without manual buffer stitching. The frame also carries transport metadata (flags, channel, error) and payload accounting (size, payload, and available space).
| typedef std::vector<std::shared_ptr<rogue::interfaces::stream::Buffer>>::iterator rogue::interfaces::stream::Frame::BufferIterator |
| rogue::interfaces::stream::Frame::Frame | ( | ) |
| rogue::interfaces::stream::Frame::~Frame | ( | ) |
| void rogue::interfaces::stream::Frame::adjustPayload | ( | int32_t | value | ) |
| rogue::interfaces::stream::Frame::BufferIterator rogue::interfaces::stream::Frame::appendBuffer | ( | std::shared_ptr< rogue::interfaces::stream::Buffer > | buff | ) |
| rogue::interfaces::stream::Frame::BufferIterator rogue::interfaces::stream::Frame::appendFrame | ( | std::shared_ptr< rogue::interfaces::stream::Frame > | frame | ) |
Appends another frame's buffers to the end of this frame.
Append passed frame buffers to end of frame.
Buffers from the passed frame are appended to the end of this frame and will be removed from the source frame.
Not exposed to Python.
| frame | Source frame pointer (FramePtr) to append. |
frame. | rogue::interfaces::stream::FrameIterator rogue::interfaces::stream::Frame::begin | ( | ) |
Returns begin iterator over frame payload.
Get start iterator.
Returns an iterator for accessing data within the frame. This iterator assumes the payload size of the frame has already been set. This means the frame has either been received already containing data, or the setPayload() method has been called.
Not exposed to Python.
FrameIterator pointing to beginning of payload. | rogue::interfaces::stream::Frame::BufferIterator rogue::interfaces::stream::Frame::beginBuffer | ( | ) |
| rogue::interfaces::stream::FrameIterator rogue::interfaces::stream::Frame::beginRead | ( | ) |
| rogue::interfaces::stream::FrameIterator rogue::interfaces::stream::Frame::beginWrite | ( | ) |
| uint32_t rogue::interfaces::stream::Frame::bufferCount | ( | ) |
| void rogue::interfaces::stream::Frame::clear | ( | ) |
|
static |
Creates an empty frame.
Create an empty frame.
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.
| void rogue::interfaces::stream::Frame::debug | ( | ) |
| rogue::interfaces::stream::FrameIterator rogue::interfaces::stream::Frame::end | ( | ) |
Returns end iterator over frame payload.
Get end iterator.
This iterator is used to detect when the end of the frame payload is reached when iterating through the frame.
Not exposed to Python.
FrameIterator end position. | rogue::interfaces::stream::Frame::BufferIterator rogue::interfaces::stream::Frame::endBuffer | ( | ) |
| rogue::interfaces::stream::FrameIterator rogue::interfaces::stream::Frame::endRead | ( | ) |
| rogue::interfaces::stream::FrameIterator rogue::interfaces::stream::Frame::endWrite | ( | ) |
| uint32_t rogue::interfaces::stream::Frame::getAvailable | ( | ) |
Returns remaining available payload space in bytes.
This is the space remaining for payload.
Exposed as getAvailable() in Python.
| boost::python::object rogue::interfaces::stream::Frame::getBytearrayPy | ( | uint32_t | offset, |
| uint32_t | count | ||
| ) |
Reads frame bytes into a newly allocated Python bytearray.
Allocate a bytearray and read bytes from frame into it starting at offset, return array.
Exposed as getBa() to Python.
| offset | Byte offset in frame payload to start reading from. |
| count | Number of bytes to read. |
bytearray containing the copied bytes. | uint8_t rogue::interfaces::stream::Frame::getChannel | ( | ) |
Returns frame channel value.
Get channel.
Most Frames in Rogue will not use this channel field since most Master to Slave connections are not channelized. Exceptions include data coming out of a data file reader.
Exposed as getChannel() in Python.
| uint8_t rogue::interfaces::stream::Frame::getError | ( | ) |
Returns frame error status value.
Get error state.
The error value is application specific, depending on the stream Master implementation. A non-zero value is considered an error.
Exposed as getError() in Python.
| uint8_t rogue::interfaces::stream::Frame::getFirstUser | ( | ) |
Returns the lower 8-bit user field from flags (SSI/Axi-Stream).
The first user value is stored in the lower 8 bits of the flag field.
Exposed as getFirstUser() in Python.
| uint16_t rogue::interfaces::stream::Frame::getFlags | ( | ) |
Returns 16-bit frame flags field.
Get flags.
The Frame flags field is a 16-bit application specific field for passing data between a stream Master and Slave. A typical use in Rogue is to pass the first and last user Axi-Stream fields.
Exposed as getFlags() in Python.
| uint8_t rogue::interfaces::stream::Frame::getLastUser | ( | ) |
Returns the upper 8-bit user field from flags (SSI/Axi-Stream).
The last user value is stored in the upper 8 bits of the flag field.
Exposed as getLastUser() in Python.
| boost::python::object rogue::interfaces::stream::Frame::getMemoryviewPy | ( | ) |
| boost::python::object rogue::interfaces::stream::Frame::getNumpy | ( | uint32_t | offset, |
| uint32_t | count | ||
| ) |
Reads frame data and returns it as a NumPy uint8 array.
Read the specified number of bytes at the specified offset of frame data into a numpy array.
| offset | Byte offset in frame payload to start reading from. |
| count | Number of bytes to read. |
uint8. | uint32_t rogue::interfaces::stream::Frame::getPayload | ( | ) |
Returns current payload size in bytes.
Exposed as getPayload() in Python.
| uint32_t rogue::interfaces::stream::Frame::getSize | ( | ) |
| bool rogue::interfaces::stream::Frame::isEmpty | ( | ) |
| rogue::interfaces::stream::FrameLockPtr rogue::interfaces::stream::Frame::lock | ( | ) |
Locks the frame and returns a scoped lock object.
Get lock.
Acquire this lock before operating on a Frame object from user code, especially when reading or writing payload bytes, adjusting payload size, or changing metadata fields (flags, channel, error). This is the standard synchronization mechanism for frame access and should be treated as required whenever a frame can be observed or modified outside a single thread's private scope.
Exposed as lock() in Python.
FrameLock. | void rogue::interfaces::stream::Frame::minPayload | ( | uint32_t | size | ) |
| void rogue::interfaces::stream::Frame::putNumpy | ( | boost::python::object | np, |
| uint32_t | offset | ||
| ) |
| void rogue::interfaces::stream::Frame::readPy | ( | boost::python::object | p, |
| uint32_t | offset | ||
| ) |
Reads frame bytes into a passed Python bytearray/buffer.
Read bytes from frame into a passed bytearray, starting from offset. Python version.
Exposed as read() to Python.
| p | Python object containing writable byte storage. |
| offset | Byte offset in frame payload to start copying from. |
| void rogue::interfaces::stream::Frame::setChannel | ( | uint8_t | channel | ) |
Sets frame channel value.
Set channel.
Exposed as setChannel() in Python.
| channel | 8-bit channel ID. |
| void rogue::interfaces::stream::Frame::setError | ( | uint8_t | error | ) |
Sets frame error status value.
Set error state.
Exposed as setError() in Python.
| error | New error value. |
| void rogue::interfaces::stream::Frame::setFirstUser | ( | uint8_t | fuser | ) |
Sets the lower 8-bit user field in flags (SSI/Axi-Stream).
Exposed as setFirstUser() to Python.
| fuser | 8-bit first-user value. |
| void rogue::interfaces::stream::Frame::setFlags | ( | uint16_t | flags | ) |
Sets 16-bit frame flags field.
Set error state.
Exposed as setFlags() in Python.
| flags | 16-bit flag value. |
| void rogue::interfaces::stream::Frame::setLastUser | ( | uint8_t | fuser | ) |
Sets the upper 8-bit user field in flags (SSI/Axi-Stream).
Exposed as setLastUser() to Python.
| fuser | 8-bit last-user value. |
| void rogue::interfaces::stream::Frame::setPayload | ( | uint32_t | size | ) |
| void rogue::interfaces::stream::Frame::setPayloadEmpty | ( | ) |
| void rogue::interfaces::stream::Frame::setPayloadFull | ( | ) |
|
protected |
|
static |
| void rogue::interfaces::stream::Frame::writePy | ( | boost::python::object | p, |
| uint32_t | offset | ||
| ) |
Writes bytes from a Python bytearray/buffer into the frame.
Write python buffer to frame, starting at offset. Python Version.
Exposed as write() to Python.
| p | Python object containing source byte storage. |
| offset | Byte offset in frame payload to start writing to. |