stream
0.10.0
stream analysis framework
|
Memory management class. More...
#include <base/Buffer.h>
Public Member Functions | |
Buffer () | |
constructor | |
Buffer (const Buffer &src) | |
constructor | |
~Buffer () | |
destructor | |
Buffer & | operator= (const Buffer &src) |
assign operator | |
bool | null () const |
returns true if empty | |
void | reset () |
reset buffer | |
RawDataRec & | operator() (void) const |
access operator | |
RawDataRec & | rec () const |
access operator | |
unsigned | datalen () const |
Returns length of memory buffer. | |
bool | setdatalen (unsigned newlen) |
Change length of memory buffer - only can be reduced. More... | |
void * | ptr (unsigned shift=0) const |
return pointer with shift | |
uint32_t | getuint32 (unsigned indx) const |
get uint32_t at given index | |
void | makenew (unsigned datalen) |
Method produces empty buffer with specified amount of memory. More... | |
void | makecopyof (void *buf, unsigned datalen) |
Method produces buffer instance with deep copy of provided raw data Means extra memory will be allocated and content of source data will be copied. More... | |
void | makereferenceof (void *buf, unsigned datalen) |
Method produces buffer instance with reference to provided raw data Means buffer will only contain pointer of source data Source data should exists until single instance of buffer is existing. More... | |
Protected Attributes | |
RawDataRec * | fRec |
data | |
Memory management class.
It allows to keep many references on same raw data and automatically release it
void base::Buffer::makecopyof | ( | void * | buf, |
unsigned | datalen | ||
) |
Method produces buffer instance with deep copy of provided raw data Means extra memory will be allocated and content of source data will be copied.
create copy of memory
void base::Buffer::makenew | ( | unsigned | datalen | ) |
Method produces empty buffer with specified amount of memory.
allocate new buffer
void base::Buffer::makereferenceof | ( | void * | buf, |
unsigned | datalen | ||
) |
Method produces buffer instance with reference to provided raw data Means buffer will only contain pointer of source data Source data should exists until single instance of buffer is existing.
make reference on external buffer
bool base::Buffer::setdatalen | ( | unsigned | newlen | ) |
Change length of memory buffer - only can be reduced.
set data length