byteme
C++ wrappers for buffered inputs
Loading...
Searching...
No Matches
byteme::PerByteSerial< Type_, Pointer_ > Class Template Referencefinal

Serial byte-by-byte extraction from a Reader source. More...

#include <PerByte.hpp>

Inheritance diagram for byteme::PerByteSerial< Type_, Pointer_ >:
Collaboration diagram for byteme::PerByteSerial< Type_, Pointer_ >:

Public Member Functions

 PerByteSerial (Pointer_ reader)
 
- Public Member Functions inherited from byteme::PerByteInterface< Type_ >
bool advance ()
 
Type_ get () const
 
unsigned long long position () const
 
bool valid () const
 
std::pair< std::size_t, bool > extract (std::size_t number, Type_ *output)
 

Protected Member Functions

void refill ()
 
- Protected Member Functions inherited from byteme::PerByteInterface< Type_ >

Additional Inherited Members

- Protected Attributes inherited from byteme::PerByteInterface< Type_ >
const Type_ * ptr = nullptr
 
std::size_t available = 0
 

Detailed Description

template<typename Type_, class Pointer_ = std::unique_ptr<Reader>>
class byteme::PerByteSerial< Type_, Pointer_ >

Serial byte-by-byte extraction from a Reader source.

Template Parameters
Type_Type of the output bytes, usually char for text or unsigned char for binary.
Pointer_Pointer to a class that serves as a source of input bytes. The pointed-to class should satisfy the Reader interface; it may also be a concrete Reader subclass to enable devirtualization. Either a smart or raw pointer may be supplied depending on how the caller wants to manage the lifetime of the pointed-to object.

This wraps a Reader so that developers can avoid the boilerplate of managing blocks of bytes, when all they want is to iterate over the bytes of the input.

Constructor & Destructor Documentation

◆ PerByteSerial()

template<typename Type_ , class Pointer_ = std::unique_ptr<Reader>>
byteme::PerByteSerial< Type_, Pointer_ >::PerByteSerial ( Pointer_ reader)
inline
Parameters
readerPointer to a source of input bytes.

Member Function Documentation

◆ refill()

template<typename Type_ , class Pointer_ = std::unique_ptr<Reader>>
void byteme::PerByteSerial< Type_, Pointer_ >::refill ( )
inlineprotectedvirtual

Set ptr and available to refer to an array of new bytes from a Reader.

Implements byteme::PerByteInterface< Type_ >.


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