#include <netlink/smart_buffer.h>
Smart Buffer Class
Buffer class to retrieve data of unknown size easily from a Socket
- Examples:
- webGet.cc.
SmartBuffer::SmartBuffer |
( |
size_t |
allocSize = DEFAULT_SMARTBUFFER_SIZE , |
|
|
double |
reallocRatio = DEFAULT_SMARTBUFFER_REALLOC_RATIO |
|
) |
| |
SmartBuffer Constructor
- Parameters
-
allocSize | Size in bytes of the initial reserved memory. |
reallocRatio | Growing ratio for memory reallocs. For example 1.5 means that each time the buffer is out of memory it reserves the previous size 1.5 times (150%). |
- Exceptions
-
SmartBuffer::~SmartBuffer |
( |
| ) |
|
const void * NL::SmartBuffer::buffer |
( |
| ) |
const |
|
inline |
Returns the buffer data address. Same of operator*()
- Returns
- A pointer to data
void NL::SmartBuffer::clear |
( |
| ) |
|
|
inline |
Clears the buffer.
Resets the buffer erasing all its content.
const void * NL::SmartBuffer::operator* |
( |
| ) |
const |
|
inline |
Returns the buffer data address. Same of buffer().
- Returns
- A pointer to data
Copy Operator.
- Parameters
-
- Exceptions
-
const char * NL::SmartBuffer::operator[] |
( |
size_t |
index | ) |
const |
|
inline |
Returns the byte in position index of the buffer
- Parameters
-
index | Position of the buffer we want to retrieve |
- Returns
- Char with the content of the given position
- Exceptions
-
void SmartBuffer::read |
( |
Socket * |
socket | ) |
|
Inserts the data read from a socket in the buffer
- Parameters
-
socket | Socket to be used as source |
- Exceptions
-
size_t NL::SmartBuffer::size |
( |
| ) |
const |
|
inline |
Returns the amount of bytes of data stored in the buffer
- Returns
- Size of buffer data
- Examples:
- webGet.cc.
The documentation for this class was generated from the following files: