Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
xstream::buffer Class Reference

buffer management More...

#include <common.h>

Public Member Functions

 buffer (size_t size)
 
void grow (unsigned int factor=2)
 increases the size of buffer More...
 
void resize (size_t size)
 resets the size of the buffer More...
 
 ~buffer ()
 deallocates buffer More...
 

Public Attributes

char * buf
 
size_t size
 

Detailed Description

buffer management

Definition at line 46 of file common.h.

Constructor & Destructor Documentation

xstream::buffer::buffer ( size_t  size)

Definition at line 11 of file common.cpp.

References LOG, and resize().

xstream::buffer::~buffer ( )

deallocates buffer

Definition at line 46 of file common.cpp.

References buf, and LOG.

Member Function Documentation

void xstream::buffer::grow ( unsigned int  factor = 2)

increases the size of buffer

Parameters
factorsize is updated according to $ size'=size*factor $
Note
old data is copied to the new buffer

Definition at line 18 of file common.cpp.

References buf, f, LOG, and size.

void xstream::buffer::resize ( size_t  size)

resets the size of the buffer

Parameters
sizenew length of the buffer
Note
no copying of data is done

Definition at line 35 of file common.cpp.

References buf, LOG, and size.

Referenced by buffer().

Member Data Documentation

char* xstream::buffer::buf

buffer where data is kept

Definition at line 49 of file common.h.

Referenced by grow(), resize(), xstream::digest::stream::stream(), xstream::digest::stream::sync(), and ~buffer().

size_t xstream::buffer::size

size of buffer

Definition at line 50 of file common.h.

Referenced by grow(), resize(), xstream::digest::stream::stream(), and xstream::digest::stream::sync().


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