TinyPPP
PPP networking over any Arduino Stream
Loading...
Searching...
No Matches
Public Member Functions | List of all members
RingBuffer< N > Class Template Reference

Byte ring buffer with a fixed capacity of N bytes. More...

#include <IPStack.h>

Public Member Functions

size_t available () const
 Number of stored bytes.
 
void clear ()
 Removes all data.
 
size_t contiguous (size_t offset, size_t len, const uint8_t *&p) const
 Contiguous data at offset (max len): returns the number of bytes at p.
 
void discard (size_t len)
 Removes up to len bytes.
 
size_t free () const
 Free space in bytes.
 
int peek () const
 Returns the next byte without removing it (-1 if empty)
 
size_t peek (size_t offset, uint8_t *data, size_t len) const
 Copies data at offset without removing it.
 
int read ()
 Removes and returns one byte (-1 if empty)
 
size_t read (uint8_t *data, size_t len)
 Removes up to len bytes into data.
 
size_t size () const
 Capacity in bytes.
 
size_t write (const uint8_t *data, size_t len)
 Appends data: returns the number of bytes stored.
 

Detailed Description

template<size_t N>
class tinyppp::RingBuffer< N >

Byte ring buffer with a fixed capacity of N bytes.

Member Function Documentation

◆ available()

template<size_t N>
size_t available ( ) const
inline

Number of stored bytes.

◆ clear()

template<size_t N>
void clear ( )
inline

Removes all data.

◆ contiguous()

template<size_t N>
size_t contiguous ( size_t  offset,
size_t  len,
const uint8_t *&  p 
) const
inline

Contiguous data at offset (max len): returns the number of bytes at p.

◆ discard()

template<size_t N>
void discard ( size_t  len)
inline

Removes up to len bytes.

◆ free()

template<size_t N>
size_t free ( ) const
inline

Free space in bytes.

◆ peek() [1/2]

template<size_t N>
int peek ( ) const
inline

Returns the next byte without removing it (-1 if empty)

◆ peek() [2/2]

template<size_t N>
size_t peek ( size_t  offset,
uint8_t *  data,
size_t  len 
) const
inline

Copies data at offset without removing it.

◆ read() [1/2]

template<size_t N>
int read ( )
inline

Removes and returns one byte (-1 if empty)

◆ read() [2/2]

template<size_t N>
size_t read ( uint8_t *  data,
size_t  len 
)
inline

Removes up to len bytes into data.

◆ size()

template<size_t N>
size_t size ( ) const
inline

Capacity in bytes.

◆ write()

template<size_t N>
size_t write ( const uint8_t *  data,
size_t  len 
)
inline

Appends data: returns the number of bytes stored.


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