$search

Dashel::ExpandableBuffer Class Reference

A simple buffer that can expand when data is added (like std::vector), but that can also return a pointer to the underlying data (like std::valarray). More...

#include <dashel-private.h>

List of all members.

Public Member Functions

void add (const void *data, const size_t size)
 Append data to the buffer.
void clear ()
 Remove all data from the buffer, the allocated memory is not freed to speed-up further reduce.
 ExpandableBuffer (size_t size=0)
 Construct an expandable buffer of specific size.
unsigned char * get ()
 Return a pointer to the underlying data.
size_t reservedSize () const
 Return the amount of allocated memory, always >= size(), to reduce the amount of reallocation required.
size_t size () const
 Return the actual amount of data stored.
 ~ExpandableBuffer ()
 Destroy the buffer and frees the allocated memory.

Private Attributes

unsigned char * _data
 data buffer. Its size is increased when required.
size_t _pos
 size of used part of data
size_t _size
 allocated size of data

Detailed Description

A simple buffer that can expand when data is added (like std::vector), but that can also return a pointer to the underlying data (like std::valarray).

Definition at line 54 of file dashel-private.h.


Constructor & Destructor Documentation

Dashel::ExpandableBuffer::ExpandableBuffer ( size_t  size = 0  ) 

Construct an expandable buffer of specific size.

Definition at line 64 of file dashel-common.cpp.

Dashel::ExpandableBuffer::~ExpandableBuffer (  ) 

Destroy the buffer and frees the allocated memory.

Definition at line 71 of file dashel-common.cpp.


Member Function Documentation

void Dashel::ExpandableBuffer::add ( const void *  data,
const size_t  size 
)

Append data to the buffer.

Definition at line 81 of file dashel-common.cpp.

void Dashel::ExpandableBuffer::clear (  ) 

Remove all data from the buffer, the allocated memory is not freed to speed-up further reduce.

Definition at line 76 of file dashel-common.cpp.

unsigned char* Dashel::ExpandableBuffer::get (  )  [inline]

Return a pointer to the underlying data.

Definition at line 72 of file dashel-private.h.

size_t Dashel::ExpandableBuffer::reservedSize (  )  const [inline]

Return the amount of allocated memory, always >= size(), to reduce the amount of reallocation required.

Definition at line 76 of file dashel-private.h.

size_t Dashel::ExpandableBuffer::size (  )  const [inline]

Return the actual amount of data stored.

Definition at line 74 of file dashel-private.h.


Member Data Documentation

unsigned char* Dashel::ExpandableBuffer::_data [private]

data buffer. Its size is increased when required.

Definition at line 57 of file dashel-private.h.

size of used part of data

Definition at line 59 of file dashel-private.h.

allocated size of data

Definition at line 58 of file dashel-private.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


dashel
Author(s): Stéphane Magnenat
autogenerated on Sat Mar 2 12:31:31 2013