17#ifndef __ROGUE_INTERFACES_STREAM_FRAME_ITERATOR_H__
18#define __ROGUE_INTERFACES_STREAM_FRAME_ITERATOR_H__
45class FrameIterator :
public std::iterator<std::random_access_iterator_tag, uint8_t> {
50 FrameIterator(std::shared_ptr<rogue::interfaces::stream::Frame> frame,
bool write,
bool end);
56 std::shared_ptr<rogue::interfaces::stream::Frame> frame_;
65 std::vector<std::shared_ptr<rogue::interfaces::stream::Buffer> >::iterator buff_;
77 inline void increment(int32_t diff);
80 inline void decrement(int32_t diff);
137 uint8_t*
ptr()
const;
145 uint8_t
operator[](
const uint32_t offset)
const;
338 uint8_t* ptr =
reinterpret_cast<uint8_t*
>(src);
343 std::memcpy(iter.
ptr(), ptr, csize);
347 }
while (size > 0 && csize > 0);
366 uint8_t* ptr =
reinterpret_cast<uint8_t*
>(dst);
371 std::memcpy(ptr, iter.
ptr(), csize);
375 }
while (size > 0 && csize > 0);
401 std::memcpy(dstIter.
ptr(), srcIter.
ptr(), csize);
405 }
while (size > 0 && csize > 0);
Random-access byte iterator across a Frame payload.
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 add)
In-place increments iterator by add.
uint8_t * ptr() const
Returns pointer to byte at current iterator position.
bool operator<(const rogue::interfaces::stream::FrameIterator &other) const
Returns whether this iterator is before another iterator.
uint8_t operator[](const uint32_t offset) const
Returns byte value at relative offset from current position.
bool operator!=(const rogue::interfaces::stream::FrameIterator &other) const
Compares two iterators for inequality.
bool operator>(const rogue::interfaces::stream::FrameIterator &other) const
Returns whether this iterator is after another iterator.
rogue::interfaces::stream::FrameIterator endBuffer()
Returns iterator marking the end of the current buffer segment.
uint8_t & operator*() const
Dereferences iterator to current byte.
const rogue::interfaces::stream::FrameIterator operator=(const rogue::interfaces::stream::FrameIterator &rhs)
Copy-assigns iterator state.
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
Compares two iterators for equality.
const rogue::interfaces::stream::FrameIterator & operator--()
Prefix-decrements iterator by one byte.
bool operator>=(const rogue::interfaces::stream::FrameIterator &other) const
Returns whether this iterator is after or equal to another iterator.
FrameIterator()
Constructs an empty iterator for later assignment.
rogue::interfaces::stream::FrameIterator & operator-=(const int32_t sub)
In-place decrements iterator by sub.
const rogue::interfaces::stream::FrameIterator & operator++()
Prefix-increments iterator by one byte.
rogue::interfaces::stream::FrameIterator operator-(const int32_t sub) const
Returns a new iterator offset backward by sub.
uint32_t remBuffer()
Returns remaining bytes in the current buffer span.
Container for one stream frame payload and metadata.
static void fromFrame(rogue::interfaces::stream::FrameIterator &iter, uint32_t size, void *dst)
Copies bytes from a frame iterator to a destination pointer.
static void copyFrame(rogue::interfaces::stream::FrameIterator &srcIter, uint32_t size, rogue::interfaces::stream::FrameIterator &dstIter)
Copies bytes between frame iterators.
static void toFrame(rogue::interfaces::stream::FrameIterator &iter, uint32_t size, void *src)
Copies bytes from a source pointer into a frame iterator.