PIDUINO
Loading...
Searching...
No Matches
Piduino::LinearBuffer

#include <linearbuffer.h>

Collaboration diagram for Piduino::LinearBuffer:

Public Member Functions

 LinearBuffer (size_t s=BUFSIZ)
 
 ~LinearBuffer ()
 
void clear ()
 
int size () const
 
int bufferSize () const
 
bool empty () const
 
int getChar ()
 
int peek (char *target, int maxlen)
 
int read (char *target, int maxlen)
 
std::vector< char > readAll ()
 
bool canReadLine () const
 
int readLine (char *target, int maxlen)
 
void skip (int n)
 
void chop (int n)
 
void ungetChar (char c)
 
void ungetBlock (const char *block, int len)
 
char * reserve (int len)
 

Protected Member Functions

void resize (size_t required, bool atEnd=false)
 

Private Attributes

size_t _buffersize
 
size_t _capacity
 
char * _pread
 
char * _pwrite
 
char * _buf
 

Detailed Description

Definition at line 34 of file linearbuffer.h.

Constructor & Destructor Documentation

◆ LinearBuffer()

Piduino::LinearBuffer::LinearBuffer ( size_t  s = BUFSIZ)
inline

Definition at line 38 of file linearbuffer.h.

◆ ~LinearBuffer()

Piduino::LinearBuffer::~LinearBuffer ( )
inline

Definition at line 40 of file linearbuffer.h.

References _buf.

Member Function Documentation

◆ bufferSize()

int Piduino::LinearBuffer::bufferSize ( ) const
inline

Definition at line 52 of file linearbuffer.h.

References _buffersize.

◆ canReadLine()

bool Piduino::LinearBuffer::canReadLine ( ) const
inline

Definition at line 90 of file linearbuffer.h.

References _pread, and size().

Here is the call graph for this function:

◆ chop()

void Piduino::LinearBuffer::chop ( int  n)
inline

Definition at line 112 of file linearbuffer.h.

References _pwrite, clear(), and size().

Here is the call graph for this function:

◆ clear()

void Piduino::LinearBuffer::clear ( )
inline

Definition at line 44 of file linearbuffer.h.

References _pread, and _pwrite.

Referenced by chop(), readAll(), and skip().

◆ empty()

bool Piduino::LinearBuffer::empty ( ) const
inline

Definition at line 56 of file linearbuffer.h.

References size().

Here is the call graph for this function:

◆ getChar()

int Piduino::LinearBuffer::getChar ( )
inline

Definition at line 60 of file linearbuffer.h.

References _pread, and size().

Here is the call graph for this function:

◆ peek()

int Piduino::LinearBuffer::peek ( char *  target,
int  maxlen 
)
inline

Definition at line 69 of file linearbuffer.h.

References _pread, and size().

Referenced by read().

Here is the call graph for this function:

◆ read()

int Piduino::LinearBuffer::read ( char *  target,
int  maxlen 
)
inline

Definition at line 75 of file linearbuffer.h.

References _pread, and peek().

Referenced by readLine().

Here is the call graph for this function:

◆ readAll()

std::vector< char > Piduino::LinearBuffer::readAll ( )
inline

Definition at line 81 of file linearbuffer.h.

References _pread, clear(), and size().

Here is the call graph for this function:

◆ readLine()

int Piduino::LinearBuffer::readLine ( char *  target,
int  maxlen 
)
inline

Definition at line 94 of file linearbuffer.h.

References _pread, read(), and size().

Here is the call graph for this function:

◆ reserve()

char * Piduino::LinearBuffer::reserve ( int  len)
inline

Definition at line 141 of file linearbuffer.h.

References _pwrite, resize(), and size().

Here is the call graph for this function:

◆ resize()

void Piduino::LinearBuffer::resize ( size_t  required,
bool  atEnd = false 
)
inlineprotected

Definition at line 152 of file linearbuffer.h.

References _buf, _buffersize, _capacity, _pread, Piduino::required, and size().

Referenced by reserve(), ungetBlock(), and ungetChar().

Here is the call graph for this function:

◆ size()

int Piduino::LinearBuffer::size ( ) const
inline

Definition at line 48 of file linearbuffer.h.

References _pread, and _pwrite.

Referenced by canReadLine(), chop(), empty(), getChar(), peek(), readAll(), readLine(), reserve(), resize(), skip(), ungetBlock(), and ungetChar().

◆ skip()

void Piduino::LinearBuffer::skip ( int  n)
inline

Definition at line 103 of file linearbuffer.h.

References _pread, clear(), and size().

Here is the call graph for this function:

◆ ungetBlock()

void Piduino::LinearBuffer::ungetBlock ( const char *  block,
int  len 
)
inline

Definition at line 129 of file linearbuffer.h.

References _buf, _pread, resize(), and size().

Here is the call graph for this function:

◆ ungetChar()

void Piduino::LinearBuffer::ungetChar ( char  c)
inline

Definition at line 121 of file linearbuffer.h.

References _buf, _pread, resize(), and size().

Here is the call graph for this function:

Member Data Documentation

◆ _buf

char* Piduino::LinearBuffer::_buf
private

Definition at line 177 of file linearbuffer.h.

Referenced by resize(), ungetBlock(), ungetChar(), and ~LinearBuffer().

◆ _buffersize

size_t Piduino::LinearBuffer::_buffersize
private

Definition at line 173 of file linearbuffer.h.

Referenced by bufferSize(), and resize().

◆ _capacity

size_t Piduino::LinearBuffer::_capacity
private

Definition at line 174 of file linearbuffer.h.

Referenced by resize().

◆ _pread

char* Piduino::LinearBuffer::_pread
private

◆ _pwrite

char* Piduino::LinearBuffer::_pwrite
private

Definition at line 176 of file linearbuffer.h.

Referenced by chop(), clear(), reserve(), and size().