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

Serial buffering to wrap a Reader. More...

#include <BufferedReader.hpp>

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

Public Member Functions

 SerialBufferedReader (Pointer_ reader, std::size_t buffer_size)
 
- Public Member Functions inherited from byteme::BufferedReader< 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)
 

Detailed Description

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

Serial buffering to wrap a Reader.

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 is a subclass of BufferedReader that calls Reader::read() on the main thread.

Constructor & Destructor Documentation

◆ SerialBufferedReader()

template<typename Type_ , class Pointer_ = std::unique_ptr<Reader>>
byteme::SerialBufferedReader< Type_, Pointer_ >::SerialBufferedReader ( Pointer_ reader,
std::size_t buffer_size )
inline
Parameters
readerPointer to a source of input bytes.
buffer_sizeSize of the internal buffer in which to store bytes that have been read from reader but not yet used. Larger values reduce the number of reader calls at the cost of greater memory usage. Should be positive.

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