FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
Loading...
Searching...
No Matches
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
 
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. More...
 

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 256 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 277 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 286 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 297 of file streambuf.h.

◆ queue()

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

Return the underlying queue.

Normally you will not need this method.

Definition at line 308 of file streambuf.h.

Member Data Documentation

◆ EOF

const int streams::istreambuf::EOF = -1
static

Special value returned by sbumpc() when buffer is empty.

Definition at line 268 of file streambuf.h.


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