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

Bounded iterator reading from [begin, end). More...

#include <memory_input_iterator.h>

Public Types

using PtrType = PtrTypeT
 

Public Member Functions

 SafeGenericMemoryIterator (PtrType begin, PtrType end)
 Creates bounded iterator over [begin, end).
 
byte read ()
 Reads one byte when available.
 
size_t read (byte *result, size_t count)
 Reads up to count bytes when available.
 
void skip (size_t count)
 Skips up to count bytes.
 
Status status () const
 Returns kEndOfStream after EOS marker is set, otherwise kOk.
 
PtrType ptr () const
 Returns current pointer.
 

Detailed Description

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

Bounded iterator reading from [begin, end).

Reaching end transitions status to kEndOfStream.

Memory footprint: two pointers (8 bytes on 32-bit targets).

Implements input iterator contract.

Definition at line 63 of file memory_input_iterator.h.

Member Typedef Documentation

◆ PtrType

Constructor & Destructor Documentation

◆ SafeGenericMemoryIterator()

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

Creates bounded iterator over [begin, end).

Definition at line 68 of file memory_input_iterator.h.

Member Function Documentation

◆ ptr()

Returns current pointer.

Definition at line 125 of file memory_input_iterator.h.

◆ read() [1/2]

Reads one byte when available.

If already exhausted, returns zero byte and keeps EOS state. If this call detects exhaustion, marks EOS by setting internal end marker to null.

Definition at line 76 of file memory_input_iterator.h.

◆ read() [2/2]

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

Reads up to count bytes when available.

Returns zero when exhausted and keeps EOS state. If this call detects exhaustion before reading, marks EOS. Reading exactly to the original end keeps status kOk until a later call detects exhaustion.

Definition at line 90 of file memory_input_iterator.h.

References roo_io::count.

◆ skip()

template<typename PtrTypeT >
void roo_io::SafeGenericMemoryIterator< PtrTypeT >::skip ( size_t  count)
inline

Skips up to count bytes.

Skipping past available range sets EOS. Skipping exactly to end keeps status kOk until a later operation detects exhaustion.

Definition at line 109 of file memory_input_iterator.h.

References roo_io::count.

◆ status()

template<typename PtrTypeT >
Status roo_io::SafeGenericMemoryIterator< PtrTypeT >::status ( ) const
inline

Returns kEndOfStream after EOS marker is set, otherwise kOk.

Definition at line 122 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: