$treeview $search $mathjax
Palabos  Version 1.1
$projectbrief
$projectbrief
$searchbox

plb::util::Buffer< T > Class Template Reference

A simple class for handling buffer memory. More...

#include <util.h>

List of all members.

Public Member Functions

 Buffer ()
 Default constructor allcoates no memory.
 Buffer (pluint bufferSize_)
 Constructor with buffer size; buffer elements are not default-initialized.
 Buffer (Buffer< T > const &rhs)
 ~Buffer ()
Buffer< T > & operator= (Buffer< T > const &rhs)
 Assignment-operator is thread-safe.
void swap (Buffer< T > &rhs)
 Swap with other buffer; this operation cannot throw.
void resize (pluint newBufferSize)
 Resize the buffer, and keep values from before.
void reallocate (pluint newBufferSize)
 Resize the buffer, but don't keep values from before.
T * get ()
 Pointer to raw data.
T const * get () const
 Const-pointer to raw data.
T & operator[] (pluint index)
 Element access.
T const & operator[] (pluint index) const
 Const-element access.
pluint size () const

Detailed Description

template<typename T>
class plb::util::Buffer< T >

A simple class for handling buffer memory.

This class can be seen as a replacement of the std::vector template. It is less powerful, but at least, unlike std::vector, it treats the type bool appropriately (this is the only reason why class Buffer was written). Note that class Buffer is not STL compatible (it is not an STL container), but it is thread- safe.


Constructor & Destructor Documentation

template<typename T>
plb::util::Buffer< T >::Buffer (  )  [inline]

Default constructor allcoates no memory.

template<typename T>
plb::util::Buffer< T >::Buffer ( pluint  bufferSize_  )  [inline]

Constructor with buffer size; buffer elements are not default-initialized.

template<typename T>
plb::util::Buffer< T >::Buffer ( Buffer< T > const &  rhs  )  [inline]
template<typename T>
plb::util::Buffer< T >::~Buffer (  )  [inline]

Member Function Documentation

template<typename T>
T const* plb::util::Buffer< T >::get (  )  const [inline]

Const-pointer to raw data.

template<typename T>
T* plb::util::Buffer< T >::get (  )  [inline]

Pointer to raw data.

template<typename T>
Buffer<T>& plb::util::Buffer< T >::operator= ( Buffer< T > const &  rhs  )  [inline]

Assignment-operator is thread-safe.

References plb::util::Buffer< T >::swap().

template<typename T>
T const& plb::util::Buffer< T >::operator[] ( pluint  index  )  const [inline]

Const-element access.

References PLB_PRECONDITION.

template<typename T>
T& plb::util::Buffer< T >::operator[] ( pluint  index  )  [inline]

Element access.

References PLB_PRECONDITION.

template<typename T>
void plb::util::Buffer< T >::reallocate ( pluint  newBufferSize  )  [inline]

Resize the buffer, but don't keep values from before.

References plb::util::Buffer< T >::swap().

template<typename T>
void plb::util::Buffer< T >::resize ( pluint  newBufferSize  )  [inline]

Resize the buffer, and keep values from before.

References plb::util::Buffer< T >::swap().

template<typename T>
pluint plb::util::Buffer< T >::size (  )  const [inline]
template<typename T>
void plb::util::Buffer< T >::swap ( Buffer< T > &  rhs  )  [inline]

Swap with other buffer; this operation cannot throw.

Referenced by plb::util::Buffer< T >::operator=(), plb::util::Buffer< T >::reallocate(), and plb::util::Buffer< T >::resize().


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