libktorrent  2.1.1
Public Member Functions | List of all members
bt::CircularBuffer Class Reference

#include <circularbuffer.h>

Public Member Functions

 CircularBuffer (bt::Uint32 cap=64 *1024)
 
bt::Uint32 available () const
 Get the available space.
 
bt::Uint32 capacity () const
 How much capacity is available.
 
bool empty () const
 Is the buffer empty.
 
bool full () const
 Is the buffer full.
 
virtual bt::Uint32 read (bt::Uint8 *ptr, bt::Uint32 max_len)
 
bt::Uint32 size () const
 How much of the buffer is used.
 
virtual bt::Uint32 write (const bt::Uint8 *ptr, bt::Uint32 len)
 

Detailed Description

Circular buffer class

Definition at line 52 of file circularbuffer.h.

Member Function Documentation

◆ read()

virtual bt::Uint32 bt::CircularBuffer::read ( bt::Uint8 *  ptr,
bt::Uint32  max_len 
)
virtual

Read up to max_len bytes from the buffer and store it in data

Parameters
ptrThe place to store the data
max_lenMaximum amount to read
Returns
The amount read

◆ write()

virtual bt::Uint32 bt::CircularBuffer::write ( const bt::Uint8 *  ptr,
bt::Uint32  len 
)
virtual

Write up to len bytes from data and store it in the window.

Parameters
ptrThe data to copy
max_lenAmount to write
Returns
The amount written

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