roo_io
API Documentation for roo_io
Loading...
Searching...
No Matches
roo_io::MultipassGenericMemoryIterator< PtrTypeT > Class Template Reference

Multipass bounded iterator reading from [begin, end). More...

#include <memory_input_iterator.h>

Public Types

using PtrType = PtrTypeT
 

Public Member Functions

 MultipassGenericMemoryIterator (PtrType begin, PtrType end)
 Creates multipass iterator over [begin, end).
 
byte read ()
 Reads one byte at current position and advances.
 
size_t read (byte *result, size_t count)
 Reads up to count bytes from current position and advances.
 
void skip (size_t count)
 Advances by up to count bytes.
 
Status status () const
 Returns kEndOfStream after EOS is observed, otherwise kOk.
 
PtrType ptr () const
 Returns pointer at current position.
 
uint64_t size () const
 Returns total iterable size.
 
uint64_t position () const
 Returns current position.
 
void rewind ()
 Resets position to start and clears EOS.
 
void seek (uint64_t position)
 Sets absolute position and clears EOS.
 

Detailed Description

template<typename PtrTypeT>
class roo_io::MultipassGenericMemoryIterator< PtrTypeT >

Multipass bounded iterator reading from [begin, end).

Supports size(), position(), rewind(), and seek().

Memory footprint: three pointers and a boolean.

Implements multipass input iterator contract.

Definition at line 143 of file memory_input_iterator.h.

Member Typedef Documentation

◆ PtrType

Constructor & Destructor Documentation

◆ MultipassGenericMemoryIterator()

template<typename PtrTypeT >
roo_io::MultipassGenericMemoryIterator< PtrTypeT >::MultipassGenericMemoryIterator ( PtrType  begin,
PtrType  end 
)
inline

Creates multipass iterator over [begin, end).

Definition at line 148 of file memory_input_iterator.h.

Member Function Documentation

◆ position()

template<typename PtrTypeT >
uint64_t roo_io::MultipassGenericMemoryIterator< PtrTypeT >::position ( ) const
inline

Returns current position.

Definition at line 203 of file memory_input_iterator.h.

Referenced by roo_io::MultipassGenericMemoryIterator< PtrTypeT >::seek().

◆ ptr()

Returns pointer at current position.

Definition at line 197 of file memory_input_iterator.h.

◆ read() [1/2]

Reads one byte at current position and advances.

If position is already at/after size, returns zero byte and sets EOS.

Definition at line 154 of file memory_input_iterator.h.

◆ read() [2/2]

template<typename PtrTypeT >
size_t roo_io::MultipassGenericMemoryIterator< PtrTypeT >::read ( byte result,
size_t  count 
)
inline

Reads up to count bytes from current position and advances.

If already at/after size, returns zero and sets EOS. Reading exactly to end does not set EOS.

Definition at line 166 of file memory_input_iterator.h.

References roo_io::count.

◆ rewind()

Resets position to start and clears EOS.

Definition at line 206 of file memory_input_iterator.h.

◆ seek()

Sets absolute position and clears EOS.

Position is not range-checked here; out-of-range is detected by subsequent read/skip operations.

Definition at line 215 of file memory_input_iterator.h.

References roo_io::MultipassGenericMemoryIterator< PtrTypeT >::position().

◆ size()

Returns total iterable size.

Definition at line 200 of file memory_input_iterator.h.

◆ skip()

Advances by up to count bytes.

Advancing past end clamps to end and sets EOS. Advancing exactly to end keeps status kOk.

Definition at line 183 of file memory_input_iterator.h.

References roo_io::count.

◆ status()

Returns kEndOfStream after EOS is observed, otherwise kOk.

Definition at line 194 of file memory_input_iterator.h.

References roo_io::kEndOfStream, and roo_io::kOk.


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