Frame Iterator
For conceptual usage, see:
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>
[header] 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
-
const rogue::interfaces::stream::FrameIterator operator=(const rogue::interfaces::stream::FrameIterator &rhs)
[header] [impl] Copy-assigns iterator state.
Copy assignment.
- Parameters:
rhs – Source iterator.
- Returns:
Copy of the assigned iterator.
-
rogue::interfaces::stream::FrameIterator endBuffer()
[header] [impl] Returns iterator marking the end of the current buffer segment.
Get iterator to end of buffer or end of frame, whichever is lower.
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()
[header] [impl] Returns remaining bytes in the current buffer span.
Get remaining bytes in current buffer.
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
[header] [impl] Dereferences iterator to current byte.
De-reference.
Allows data at the current iterator position to be accessed using
*itsyntax.- Returns:
Reference to current byte.
-
uint8_t *ptr() const
[header] [impl] Returns pointer to byte at current iterator position.
Pointer.
Pointer
- Returns:
Pointer to current byte location.
-
uint8_t operator[](const uint32_t offset) const
[header] [impl] Returns byte value at relative offset from current position.
De-reference by index.
- Parameters:
offset – Relative offset to access.
- Returns:
Data byte at passed offset.
-
const rogue::interfaces::stream::FrameIterator &operator++()
[header] [impl] Prefix-increments iterator by one byte.
Increment.
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)
[header] [impl] Postfix-increments iterator by one byte.
post Increment
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--()
[header] [impl] Prefix-decrements iterator by one byte.
Decrement.
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)
[header] [impl] Postfix-decrements iterator by one byte.
post Decrement
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
[header] [impl] Compares two iterators for inequality.
Not Equal.
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
[header] [impl] Compares two iterators for equality.
Equal.
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
[header] [impl] Returns whether this iterator is before another iterator.
Less than.
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
[header] [impl] Returns whether this iterator is after another iterator.
greater than
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
[header] [impl] Returns whether this iterator is before or equal to another iterator.
Less than equal.
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
[header] [impl] Returns whether this iterator is after or equal to another iterator.
greater than equal
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
[header] [impl] Returns a new iterator offset forward by
add.Increment by value.
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
[header] [impl] Returns a new iterator offset backward by
sub.Descrment by value.
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
[header] [impl] Returns byte-distance between two iterators.
Sub incrementers.
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)
[header] [impl] In-place increments iterator by
add.Increment by value.
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)
[header] [impl] In-place decrements iterator by
sub.Descrment by value.
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.
-
const rogue::interfaces::stream::FrameIterator operator=(const rogue::interfaces::stream::FrameIterator &rhs)