Frame Iterator
The FrameIterator class is also aliased as a Frame::iterator
rogue::interfaces::stream::Frame::iterator
The class description is shown below:
-
class FrameIterator : public std::iterator<std::random_access_iterator_tag, uint8_t>
Random-access byte iterator across a
Framepayload.FrameIteratorprovides STL-style random-access semantics over frame payload bytes, even when payload storage spans multiple underlying buffers. It hides buffer boundary transitions and allows efficient copy operations with helper APIs (toFrame,fromFrame,copyFrame).This class is C++ only and is not exposed directly to Python.
Public Functions
-
FrameIterator()
Constructs an empty iterator for later assignment.
-
const rogue::interfaces::stream::FrameIterator operator=(const rogue::interfaces::stream::FrameIterator &rhs)
Copy-assigns iterator state.
- Parameters:
rhs – Source iterator.
- Returns:
Copy of the assigned iterator.
-
rogue::interfaces::stream::FrameIterator endBuffer()
Returns iterator marking the end of the current buffer segment.
The returned iterator is an end marker for the current buffer, and possibly the end of the frame. If the current Buffer is followed by another buffer containing valid data for a Read or available space for a write, the returned iterator will mark the start of the next Buffer. Having this iterator is useful when iterating through contiguous memory blocks for more efficient data copying when using std::copy().
- Returns:
Iterator marking the end of the current buffer span.
-
uint32_t remBuffer()
Returns remaining bytes in the current buffer span.
Similar to
endBuffer(), this returns remaining bytes in the current underlying buffer region without crossing to the next one.- Returns:
Remaining bytes in the current buffer.
-
uint8_t &operator*() const
Dereferences iterator to current byte.
Allows data at the current iterator position to be accessed using
*itsyntax.- Returns:
Reference to current byte.
-
uint8_t *ptr() const
Returns pointer to byte at current iterator position.
- Returns:
Pointer to current byte location.
-
uint8_t operator[](const uint32_t offset) const
Returns byte value at relative offset from current position.
- Parameters:
offset – Relative offset to access.
- Returns:
Data byte at passed offset.
-
const rogue::interfaces::stream::FrameIterator &operator++()
Prefix-increments iterator by one byte.
Increment the current iterator position by a single location and return a reference to the current iterator.
- Returns:
Reference to iterator at the new position.
-
rogue::interfaces::stream::FrameIterator operator++(int)
Postfix-increments iterator by one byte.
Increment the current iterator position by a single location and return a reference to the previous iterator position. This results in a copy of the iterator being created before the increment.
- Returns:
Reference to iterator at the old position.
-
const rogue::interfaces::stream::FrameIterator &operator--()
Prefix-decrements iterator by one byte.
Decrement the current iterator position by a single location and return a reference to the current iterator.
- Returns:
Reference to iterator at the new position.
-
rogue::interfaces::stream::FrameIterator operator--(int)
Postfix-decrements iterator by one byte.
Decrement the current iterator position by a single location and return a reference to the previous iterator position. This results in a copy of the iterator being created before the decrement.
- Returns:
Reference to iterator at the old position.
-
bool operator!=(const rogue::interfaces::stream::FrameIterator &other) const
Compares two iterators for inequality.
Compare this iterator to another iterator and return
trueif they are at different positions.- Parameters:
other – Iterator to compare against.
- Returns:
trueif the two iterators are not equal.
-
bool operator==(const rogue::interfaces::stream::FrameIterator &other) const
Compares two iterators for equality.
Compare this iterator to another iterator and return
trueif they reference the same position within the frame.- Parameters:
other – Iterator to compare against.
- Returns:
trueif the two iterators are equal.
-
bool operator<(const rogue::interfaces::stream::FrameIterator &other) const
Returns whether this iterator is before another iterator.
Compare this iterator to another iterator and return
trueif the local iterator (left of<) is less than the iterator being compared against.- Parameters:
other – Iterator to compare against.
- Returns:
trueif the left iterator is less than the right.
-
bool operator>(const rogue::interfaces::stream::FrameIterator &other) const
Returns whether this iterator is after another iterator.
Compare this iterator to another iterator and return
trueif the local iterator (left of>) is greater than the iterator being compared against.- Parameters:
other – Iterator to compare against.
- Returns:
trueif the left iterator is greater than the right.
-
bool operator<=(const rogue::interfaces::stream::FrameIterator &other) const
Returns whether this iterator is before or equal to another iterator.
Compare this iterator to another iterator and return
trueif the local iterator (left of<=) is less than or equal to the iterator being compared against.- Parameters:
other – Iterator to compare against.
- Returns:
trueif the left iterator is less than or equal to the right.
-
bool operator>=(const rogue::interfaces::stream::FrameIterator &other) const
Returns whether this iterator is after or equal to another iterator.
Compare this iterator to another iterator and return
trueif the local iterator (left of>=) is greater than or equal to the iterator being compared against.- Parameters:
other – Iterator to compare against.
- Returns:
trueif the left iterator is greater than or equal to the right.
-
rogue::interfaces::stream::FrameIterator operator+(const int32_t add) const
Returns a new iterator offset forward by
add.Create a new iterator and increment its position by the passed value.
- Parameters:
add – Positive or negative value to increment the current position by.
- Returns:
New iterator at the new position.
-
rogue::interfaces::stream::FrameIterator operator-(const int32_t sub) const
Returns a new iterator offset backward by
sub.Create a new iterator and decrement its position by the passed value.
- Parameters:
sub – Positive or negative value to decrement the current position by.
- Returns:
New iterator at the new position.
-
int32_t operator-(const rogue::interfaces::stream::FrameIterator &other) const
Returns byte-distance between two iterators.
Return the difference between the current iterator position (left of
-) and the compared iterator position.- Parameters:
other – Iterator to compare against.
- Returns:
Difference of the two positions as an
int32_t.
-
rogue::interfaces::stream::FrameIterator &operator+=(const int32_t add)
In-place increments iterator by
add.Increment the current iterator by the passed value.
- Parameters:
add – Positive or negative value to increment the current position by.
- Returns:
Reference to current iterator at the new position.
-
rogue::interfaces::stream::FrameIterator &operator-=(const int32_t sub)
In-place decrements iterator by
sub.Decrement the current iterator by the passed value.
- Parameters:
sub – Positive or negative value to decrement the current position by.
- Returns:
Reference to current iterator at the new position.
-
FrameIterator()