Frame

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

typedef std::shared_ptr<rogue::interfaces::stream::Frame> rogue::interfaces::stream::FramePtr

Alias for using shared pointer as FramePtr.

The class description is shown below:

class Frame : public rogue::EnableSharedFromThis<rogue::interfaces::stream::Frame>

Frame container.

In the stream interface the Frame class is a container for moving streaming data through the system. A single Frame instance exists for each frame of data being transferred. The frame object itself does not contain any data, instead it is a container for one or more blocks of data contained within the Buffer class.

This class is a container for an array of Buffer class objects which contain the stream data. A FrameIterator object is used to read and write data from and to the Frame.

Public Types

typedef std::vector<std::shared_ptr<rogue::interfaces::stream::Buffer>>::iterator BufferIterator

Alias for using std::vector<std::shared_ptr<rogue::interfaces::stream::Buffer> >::iterator as Buffer::iterator.

Public Functions

std::shared_ptr<rogue::interfaces::stream::FrameLock> lock()

Lock frame and return a FrameLockPtr object.

Exposed as lock() to Python

Returns:

FrameLock pointer (FrameLockPtr)

std::vector<std::shared_ptr<rogue::interfaces::stream::Buffer>>::iterator appendFrame(std::shared_ptr<rogue::interfaces::stream::Frame> frame)

Append passed frame to the end of this 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

Parameters:

frame – Source frame pointer (FramePtr) to append

Returns:

Buffer list iterator (Frame::BufferIterator) pointing to the first inserted buffer from passed frame

std::vector<std::shared_ptr<rogue::interfaces::stream::Buffer>>::iterator appendBuffer(std::shared_ptr<rogue::interfaces::stream::Buffer> buff)

Add a buffer to end of frame,.

Not exposed to Python This is for advanced manipulation of the underlying buffers.

Parameters:

buff – The buffer pointer (BufferPtr) to append to the end of the frame

Returns:

Buffer list iterator (Frame::BufferIterator) pointing to the added buffer

std::vector<std::shared_ptr<rogue::interfaces::stream::Buffer>>::iterator beginBuffer()

Get Buffer list begin iterator.

Not exposed to Python This is for advanced manipulation of the underlying buffers.

Returns:

Buffer list iterator (Frame::BufferIterator) pointing to the start of the Buffer list

std::vector<std::shared_ptr<rogue::interfaces::stream::Buffer>>::iterator endBuffer()

Get Buffer list end iterator.

Not exposed to Python This is for advanced manipulation of the underlying buffers.

Returns:

Buffer list iterator (Frame::BufferIterator) pointing to the end of the Buffer list

uint32_t bufferCount()

Get Buffer list count.

Not exposed to Python This is for advanced manipulation of the underlying buffers.

Returns:

Number of buffers in the Buffer list

void clear()

Empty the frame, removing all buffers.

Not exposed to Python

bool isEmpty()

Buffer list empty state.

Not exposed to Python

Returns:

True if frame Buffer list is empty.

uint32_t getSize()

Get total size of the Frame.

This function returns the full buffer size

Exposed as getSize() to Python

Returns:

Total raw Buffer size of Frame in bytes

uint32_t getAvailable()

Get total available size of the Frame.

This is the space remaining for payload

Exposed as getAvailable() to Python

Returns:

Remaining bytes available for payload in the Frame

uint32_t getPayload()

Get total payload size of the Frame.

Exposed as getPayload() to Python

Returns:

Total payload bytes in the Frame

void setPayload(uint32_t size)

Set payload size.

Not exposed to Python

Parameters:

size – New payload size

void minPayload(uint32_t size)

Set payload size to at least the passed value.

If current payload size is larger then passed value, the payload size is unchanged.

Not exposed to Python

Parameters:

size – New minimum size

void adjustPayload(int32_t value)

Adjust payload size.

Pass is a positive or negative size adjustment.

Not exposed to Python

Parameters:

value – Size adjustment value

void setPayloadFull()

Set the Frame payload to full.

Set the current payload size to equal the total available size of the buffers.

Not exposed to Python

void setPayloadEmpty()

Set the Frame payload to zero.

uint16_t getFlags()

Get Frame 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() to Python

Returns:

16-bit Flag value

void setFlags(uint16_t flags)

Set Frame flags.

Exposed as setFlags() to Python

Parameters:

flags – 16-bit flag value

uint8_t getFirstUser()

The first user value is stored in the lower 8-bits of the flag field.

Exposed as getFirstuser() to Python

Returns:

tuser 8-bit first user value

void setFirstUser(uint8_t fuser)

Exposed as setFirstUser() to Python

Parameters:

tuser – 8-bit first user value

uint8_t getLastUser()

The last user value is stored in the upper 8-bits of the flag field.

Exposed as getLastUser() to Python

Returns:

tuser 8-bit last user value

void setLastUser(uint8_t fuser)

Exposed as setLastUser() to Python

Parameters:

tuser – 8-bit last user value

uint8_t getChannel()

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() to Python

Returns:

8-bit channel ID

void setChannel(uint8_t channel)

Set channel.

Exposed as setChannel() to Python

Parameters:

channel – 8-bit channel ID

uint8_t getError()

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() to Python

void setError(uint8_t error)

Set error state.

Exposed as setError() to Python

Parameters:

error – New error value

rogue::interfaces::stream::FrameIterator begin()

Get begin FrameIterator.

Return 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

Returns:

FrameIterator pointing to beginning of payload

rogue::interfaces::stream::FrameIterator end()

Get end FrameIterator.

This iterator is used to detect when the end of the Frame payload is reached when iterating through the Frame.

Not exposed to Python

Returns:

FrameIterator read end position

void readPy(boost::python::object p, uint32_t offset)

Python Frame data read function.

Read data from Frame into passed Python byte array.

Exposed as read() to Python

Parameters:
  • p – Python object containing byte array

  • offset – First location of Frame data to copy to byte array

boost::python::object getBytearrayPy(uint32_t offset, uint32_t count)

Python Frame data read function.

Read data from Frame into a python bytearray which is allocated and returned

Exposed as getBa() to Python

Parameters:
  • offset – First location of Frame data to copy to byte array

  • count – Number of bytes to read

boost::python::object getMemoryviewPy()

Python Frame data read function.

Read data from Frame into a python bytearray which is allocated and returned as a memoryview

Exposed as getMemoryview() to Python

void writePy(boost::python::object p, uint32_t offset)

Python Frame data write function.

Write data into from Frame from passed Python byte array.

Exposed as write() to Python

Parameters:
  • p – Python object containing byte array

  • offset – First location to write byte array into Frame

boost::python::object getNumpy(uint32_t offset, uint32_t count, boost::python::object dtype)

Python Frame data read returning a numpy array.

void putNumpy(boost::python::object np, uint32_t offset)

Python Frame data write using a numpy array as the source.

void debug()

Debug Frame.

Public Static Functions

static std::shared_ptr<rogue::interfaces::stream::Frame> create()

Class factory which returns a FramePtr to an empty Frame.

Not exposed to Python