#include <dbuffer.h>
Inheritance diagram for sockets::DBuffer:

Public Types | |
| typedef std::list< Chunk * > | chunks_list |
Public Member Functions | |
| DBuffer (uint8_t chunkmul, size_t maxsize) | |
| Constructor. | |
| virtual | ~DBuffer () |
| Destructor. | |
| virtual bool | read (size_t max, char const **data, size_t *len) const |
| Implements Buffer::read(). | |
| virtual bool | write (char const *data, size_t len) |
| Implements Buffer::write(). | |
| virtual bool | erase (size_t len) |
| Implements Buffer::erase(). | |
| virtual bool | clear () |
| Implements Buffer::clear(). | |
| virtual bool | empty () const |
| Implements Buffer::empty(). | |
| virtual size_type | size () const |
| Implements Buffer::size(). | |
| virtual size_type | max_size () const |
| Implements Buffer::max_size(). | |
Static Public Attributes | |
| static size_t const | chunk_unit = 1024 |
| The chunk unit. | |
Protected Member Functions | |
| virtual bool | read_byte (size_type pos, char *ch) const |
| Implements Buffer::read_byte(). | |
Classes | |
| class | Chunk |
This buffer, while still having a maximum size, allocates memory progressively by small chunks and frees them as needed so the buffer never grows bigger than needed, which makes it ideal when used with a large number of sockets.
When freeing memory chunks, the buffer may choose to "recycle" it instead, which means that they are placed in a pool for being reused by this or another buffer who need a chunk of the same size.
|
||||||||||||
|
Constructor.
|
1.4.6