Arduino DLNA Server
Public Member Functions | Protected Attributes | List of all members
tiny_dlna::RingBuffer Class Reference

Implementation of a Simple Circular Buffer. Instead of comparing the position of the read and write pointer in order to figure out if we still have characters available or space left to write we keep track of the actual length which is easier to follow. More...

#include <RingBuffer.h>

Collaboration diagram for tiny_dlna::RingBuffer:
Collaboration graph
[legend]

Public Member Functions

 RingBuffer (int size=512)
 
int available ()
 
int availableToWrite ()
 
int read ()
 
int read (uint8_t *str, int len)
 
int peek ()
 
size_t write (uint8_t ch)
 
size_t write (uint8_t *str, int len)
 
void resize (int size)
 

Protected Attributes

Vector< char > buffer {0}
 
int max_len
 
int actual_len = 0
 
int actual_read_pos = 0
 
int actual_write_pos = 0
 

Detailed Description

Implementation of a Simple Circular Buffer. Instead of comparing the position of the read and write pointer in order to figure out if we still have characters available or space left to write we keep track of the actual length which is easier to follow.

Constructor & Destructor Documentation

◆ RingBuffer()

tiny_dlna::RingBuffer::RingBuffer ( int  size = 512)
inline

Member Function Documentation

◆ available()

int tiny_dlna::RingBuffer::available ( )
inline

◆ availableToWrite()

int tiny_dlna::RingBuffer::availableToWrite ( )
inline

◆ peek()

int tiny_dlna::RingBuffer::peek ( )
inline

◆ read() [1/2]

int tiny_dlna::RingBuffer::read ( )
inline

◆ read() [2/2]

int tiny_dlna::RingBuffer::read ( uint8_t *  str,
int  len 
)
inline

◆ resize()

void tiny_dlna::RingBuffer::resize ( int  size)
inline

◆ write() [1/2]

size_t tiny_dlna::RingBuffer::write ( uint8_t *  str,
int  len 
)
inline

◆ write() [2/2]

size_t tiny_dlna::RingBuffer::write ( uint8_t  ch)
inline

Member Data Documentation

◆ actual_len

int tiny_dlna::RingBuffer::actual_len = 0
protected

◆ actual_read_pos

int tiny_dlna::RingBuffer::actual_read_pos = 0
protected

◆ actual_write_pos

int tiny_dlna::RingBuffer::actual_write_pos = 0
protected

◆ buffer

Vector<char> tiny_dlna::RingBuffer::buffer {0}
protected

◆ max_len

int tiny_dlna::RingBuffer::max_len
protected

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