NetLink Sockets C++ 1.0.0
Networking C++ Library @ Get NetLink Sockets C++ Library at SourceForge.net. Fast, secure and Free Open Source software downloads
Public Member Functions

NL::SmartBuffer Class Reference

#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:
allocSizeSize in bytes of the initial reserved memory.
reallocRatioGrowing 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:
ExceptionERROR_ALLOC
SmartBuffer::~SmartBuffer ( )

SmartBuffer Destructor


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:
indexPosition of the buffer we want to retrieve
Returns:
Char with the content of the given position
Exceptions:
ExceptionOUT_OF_RANGE

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Enumerations Enumerator