FastArduino  v1.8
C++ library to build fast but small Arduino/AVR projects
streams::istreambuf Class Reference

Input API based on a ring buffer. More...

#include <fastarduino/streambuf.h>

Inheritance diagram for streams::istreambuf:
Collaboration diagram for streams::istreambuf:

Public Member Functions

 istreambuf (const istreambuf &)=delete
 
istreambufoperator= (const istreambuf &)=delete
 
template<uint8_t SIZE>
 istreambuf (char(&buffer)[SIZE])
 
int in_avail () const
 
int sbumpc ()
 
int sgetc ()
 
QUEUE & queue ()
 Return the underlying queue. More...
 

Static Public Attributes

static const int EOF = -1
 Special value returned by sbumpc() when buffer is empty.
 

Detailed Description

Input API based on a ring buffer.

Provides general methods to pull characters or strings from the buffer; the buffer content is supposed to be produced by another class (e.g. serial::hard::UARX).

Parameters
bufferthe original ring buffer containing all pushed content; once passed to the constructor, it should never be used directly as it will be consumed by a containers::Queue.

Definition at line 208 of file streambuf.h.

Member Function Documentation

◆ in_avail()

int streams::istreambuf::in_avail ( ) const
inline
Returns
number of available characters in buffer

Definition at line 227 of file streambuf.h.

◆ sbumpc()

int streams::istreambuf::sbumpc ( )
inline
Returns
next character to be read from buffer, or EOF if buffer is empty

Definition at line 236 of file streambuf.h.

◆ sgetc()

int streams::istreambuf::sgetc ( )
inline
Returns
next character to be read from buffer (or EOF if buffer is empty) but does not remove it from the buffer.

Definition at line 247 of file streambuf.h.

◆ queue()

QUEUE& streams::istreambuf::queue ( )
inline

Return the underlying queue.

Normally you will not need this method.

Definition at line 258 of file streambuf.h.


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