stream  0.10.0
stream analysis framework
Public Member Functions | Protected Attributes
base::Buffer Class Reference

Memory management class. More...

#include <base/Buffer.h>

Public Member Functions

 Buffer ()
 constructor
 
 Buffer (const Buffer &src)
 constructor
 
 ~Buffer ()
 destructor
 
Bufferoperator= (const Buffer &src)
 assign operator
 
bool null () const
 returns true if empty
 
void reset ()
 reset buffer
 
RawDataRecoperator() (void) const
 access operator
 
RawDataRecrec () 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

RawDataRecfRec
 data
 

Detailed Description

Memory management class.

It allows to keep many references on same raw data and automatically release it

Member Function Documentation

◆ makecopyof()

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

◆ makenew()

void base::Buffer::makenew ( unsigned  datalen)

Method produces empty buffer with specified amount of memory.

allocate new buffer

◆ makereferenceof()

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

◆ setdatalen()

bool base::Buffer::setdatalen ( unsigned  newlen)

Change length of memory buffer - only can be reduced.

set data length


The documentation for this class was generated from the following files: