rogue
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
rogue::interfaces::stream::FrameIterator Class Reference

Random-access byte iterator across a Frame payload. More...

#include <FrameIterator.h>

Inheritance diagram for rogue::interfaces::stream::FrameIterator:

Public Member 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.
 
rogue::interfaces::stream::FrameIterator endBuffer ()
 Returns iterator marking the end of the current buffer segment.
 
uint32_t remBuffer ()
 Returns remaining bytes in the current buffer span.
 
uint8_t & operator* () const
 Dereferences iterator to current byte.
 
uint8_t * ptr () const
 Returns pointer to byte at current iterator position.
 
uint8_t operator[] (const uint32_t offset) const
 Returns byte value at relative offset from current position.
 
const rogue::interfaces::stream::FrameIteratoroperator++ ()
 Prefix-increments iterator by one byte.
 
rogue::interfaces::stream::FrameIterator operator++ (int)
 Postfix-increments iterator by one byte.
 
const rogue::interfaces::stream::FrameIteratoroperator-- ()
 Prefix-decrements iterator by one byte.
 
rogue::interfaces::stream::FrameIterator operator-- (int)
 Postfix-decrements iterator by one byte.
 
bool operator!= (const rogue::interfaces::stream::FrameIterator &other) const
 Compares two iterators for inequality.
 
bool operator== (const rogue::interfaces::stream::FrameIterator &other) const
 Compares two iterators for equality.
 
bool operator< (const rogue::interfaces::stream::FrameIterator &other) const
 Returns whether this iterator is before another iterator.
 
bool operator> (const rogue::interfaces::stream::FrameIterator &other) const
 Returns whether this iterator is after another iterator.
 
bool operator<= (const rogue::interfaces::stream::FrameIterator &other) const
 Returns whether this iterator is before or equal to another iterator.
 
bool operator>= (const rogue::interfaces::stream::FrameIterator &other) const
 Returns whether this iterator is after or equal to another iterator.
 
rogue::interfaces::stream::FrameIterator operator+ (const int32_t add) const
 Returns a new iterator offset forward by add.
 
rogue::interfaces::stream::FrameIterator operator- (const int32_t sub) const
 Returns a new iterator offset backward by sub.
 
int32_t operator- (const rogue::interfaces::stream::FrameIterator &other) const
 Returns byte-distance between two iterators.
 
rogue::interfaces::stream::FrameIteratoroperator+= (const int32_t add)
 In-place increments iterator by add.
 
rogue::interfaces::stream::FrameIteratoroperator-= (const int32_t sub)
 In-place decrements iterator by sub.
 

Friends

class Frame
 

Detailed Description

Random-access byte iterator across a Frame payload.

FrameIterator provides 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.

Definition at line 45 of file FrameIterator.h.

Constructor & Destructor Documentation

◆ FrameIterator()

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

Constructs an empty iterator for later assignment.

Definition at line 107 of file FrameIterator.cpp.

Member Function Documentation

◆ endBuffer()

rogue::interfaces::stream::FrameIterator rogue::interfaces::stream::FrameIterator::endBuffer ( )

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.

Definition at line 130 of file FrameIterator.cpp.

◆ operator!=()

bool rogue::interfaces::stream::FrameIterator::operator!= ( const rogue::interfaces::stream::FrameIterator other) const

Compares two iterators for inequality.

Not Equal.

Compare this iterator to another iterator and return true if they are at different positions.

Parameters
otherIterator to compare against.
Returns
true if the two iterators are not equal.

Definition at line 190 of file FrameIterator.cpp.

◆ operator*()

uint8_t & rogue::interfaces::stream::FrameIterator::operator* ( ) const

Dereferences iterator to current byte.

De-reference.

Allows data at the current iterator position to be accessed using *it syntax.

Returns
Reference to current byte.

Definition at line 142 of file FrameIterator.cpp.

◆ operator+()

rogue::interfaces::stream::FrameIterator rogue::interfaces::stream::FrameIterator::operator+ ( const int32_t  add) const

Returns a new iterator offset forward by add.

Increment by value.

Create a new iterator and increment its position by the passed value.

Parameters
addPositive or negative value to increment the current position by.
Returns
New iterator at the new position.

Definition at line 220 of file FrameIterator.cpp.

◆ operator++() [1/2]

const rogue::interfaces::stream::FrameIterator & rogue::interfaces::stream::FrameIterator::operator++ ( )

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.

Definition at line 164 of file FrameIterator.cpp.

◆ operator++() [2/2]

rogue::interfaces::stream::FrameIterator rogue::interfaces::stream::FrameIterator::operator++ ( int  )

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.

Definition at line 170 of file FrameIterator.cpp.

◆ operator+=()

rogue::interfaces::stream::FrameIterator & rogue::interfaces::stream::FrameIterator::operator+= ( const int32_t  add)

In-place increments iterator by add.

Increment by value.

Increment the current iterator by the passed value.

Parameters
addPositive or negative value to increment the current position by.
Returns
Reference to current iterator at the new position.

Definition at line 245 of file FrameIterator.cpp.

◆ operator-() [1/2]

rogue::interfaces::stream::FrameIterator rogue::interfaces::stream::FrameIterator::operator- ( const int32_t  sub) const

Returns a new iterator offset backward by sub.

Descrment by value.

Create a new iterator and decrement its position by the passed value.

Parameters
subPositive or negative value to decrement the current position by.
Returns
New iterator at the new position.

Definition at line 230 of file FrameIterator.cpp.

◆ operator-() [2/2]

int32_t rogue::interfaces::stream::FrameIterator::operator- ( const rogue::interfaces::stream::FrameIterator other) const

Returns byte-distance between two iterators.

Sub incrementers.

Return the difference between the current iterator position (left of -) and the compared iterator position.

Parameters
otherIterator to compare against.
Returns
Difference of the two positions as an int32_t.

Definition at line 240 of file FrameIterator.cpp.

◆ operator--() [1/2]

const rogue::interfaces::stream::FrameIterator & rogue::interfaces::stream::FrameIterator::operator-- ( )

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.

Definition at line 177 of file FrameIterator.cpp.

◆ operator--() [2/2]

rogue::interfaces::stream::FrameIterator rogue::interfaces::stream::FrameIterator::operator-- ( int  )

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.

Definition at line 183 of file FrameIterator.cpp.

◆ operator-=()

rogue::interfaces::stream::FrameIterator & rogue::interfaces::stream::FrameIterator::operator-= ( const int32_t  sub)

In-place decrements iterator by sub.

Descrment by value.

Decrement the current iterator by the passed value.

Parameters
subPositive or negative value to decrement the current position by.
Returns
Reference to current iterator at the new position.

Definition at line 254 of file FrameIterator.cpp.

◆ operator<()

bool rogue::interfaces::stream::FrameIterator::operator< ( const rogue::interfaces::stream::FrameIterator other) const

Returns whether this iterator is before another iterator.

Less than.

Compare this iterator to another iterator and return true if the local iterator (left of <) is less than the iterator being compared against.

Parameters
otherIterator to compare against.
Returns
true if the left iterator is less than the right.

Definition at line 200 of file FrameIterator.cpp.

◆ operator<=()

bool rogue::interfaces::stream::FrameIterator::operator<= ( const rogue::interfaces::stream::FrameIterator other) const

Returns whether this iterator is before or equal to another iterator.

Less than equal.

Compare this iterator to another iterator and return true if the local iterator (left of <=) is less than or equal to the iterator being compared against.

Parameters
otherIterator to compare against.
Returns
true if the left iterator is less than or equal to the right.

Definition at line 210 of file FrameIterator.cpp.

◆ operator=()

const rogue::interfaces::stream::FrameIterator rogue::interfaces::stream::FrameIterator::operator= ( const rogue::interfaces::stream::FrameIterator rhs)

Copy-assigns iterator state.

Copy assignment.

Parameters
rhsSource iterator.
Returns
Copy of the assigned iterator.

Definition at line 117 of file FrameIterator.cpp.

◆ operator==()

bool rogue::interfaces::stream::FrameIterator::operator== ( const rogue::interfaces::stream::FrameIterator other) const

Compares two iterators for equality.

Equal.

Compare this iterator to another iterator and return true if they reference the same position within the frame.

Parameters
otherIterator to compare against.
Returns
true if the two iterators are equal.

Definition at line 195 of file FrameIterator.cpp.

◆ operator>()

bool rogue::interfaces::stream::FrameIterator::operator> ( const rogue::interfaces::stream::FrameIterator other) const

Returns whether this iterator is after another iterator.

greater than

Compare this iterator to another iterator and return true if the local iterator (left of >) is greater than the iterator being compared against.

Parameters
otherIterator to compare against.
Returns
true if the left iterator is greater than the right.

Definition at line 205 of file FrameIterator.cpp.

◆ operator>=()

bool rogue::interfaces::stream::FrameIterator::operator>= ( const rogue::interfaces::stream::FrameIterator other) const

Returns whether this iterator is after or equal to another iterator.

greater than equal

Compare this iterator to another iterator and return true if the local iterator (left of >=) is greater than or equal to the iterator being compared against.

Parameters
otherIterator to compare against.
Returns
true if the left iterator is greater than or equal to the right.

Definition at line 215 of file FrameIterator.cpp.

◆ operator[]()

uint8_t rogue::interfaces::stream::FrameIterator::operator[] ( const uint32_t  offset) const

Returns byte value at relative offset from current position.

De-reference by index.

Parameters
offsetRelative offset to access.
Returns
Data byte at passed offset.

Definition at line 157 of file FrameIterator.cpp.

◆ ptr()

uint8_t * rogue::interfaces::stream::FrameIterator::ptr ( ) const

Returns pointer to byte at current iterator position.

Pointer.

Returns
Pointer to current byte location.

Pointer

Definition at line 152 of file FrameIterator.cpp.

◆ remBuffer()

uint32_t rogue::interfaces::stream::FrameIterator::remBuffer ( )

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.

Definition at line 137 of file FrameIterator.cpp.

Friends And Related Symbol Documentation

◆ Frame

friend class Frame
friend

Definition at line 46 of file FrameIterator.h.


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