#include <netlink/smart_buffer.h>
List of all members.
Public Member Functions |
| | SmartBuffer (size_t allocSize=DEFAULT_SMARTBUFFER_SIZE, double reallocRatio=DEFAULT_SMARTBUFFER_REALLOC_RATIO) |
| | ~SmartBuffer () |
| const void * | operator* () const |
| const char * | operator[] (size_t index) const |
| const void * | buffer () const |
|
size_t | size () const |
|
void | read (Socket *socket) |
| void | clear () |
Detailed Description
Smart Buffer Class
Buffer class to retrieve data of unknown size easily from a Socket
- Examples:
-
webGet.cc.
Constructor & Destructor Documentation
| 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 |
( |
| ) |
|
Member Function Documentation
| const void * SmartBuffer::buffer |
( |
| ) |
const [inline] |
Returns the buffer data address. Same of operator*()
- Returns:
- A pointer to data
| void SmartBuffer::clear |
( |
| ) |
[inline] |
Clears the buffer.
Resets the buffer erasing all its content.
| NL_NAMESPACE_USE const void * SmartBuffer::operator* |
( |
| ) |
const [inline] |
Returns the buffer data address. Same of buffer().
- Returns:
- A pointer to data
| const char * 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:
-
The documentation for this class was generated from the following files: