Public Types | Public Member Functions | Private Attributes
icl_core::ZBuffer< T, TCompare > Class Template Reference

#include <ZBuffer.h>

List of all members.

Public Types

typedef std::vector
< boost::optional< T > > 
Buffer
 The type of the internal buffer.
typedef Buffer::size_type size_type
 Shorthand to vector size type.

Public Member Functions

boost::optional< T > at (const std::size_t pos) const
 Read-only access to a specific buffer element.
const Bufferbuffer () const
 Read-only access to the buffer.
boost::optional< T > operator[] (const std::size_t pos) const
 Read-only access to a specific buffer element.
void reset ()
 Empties the Z buffer.
const size_type size () const
 Returns the buffer size.
bool update (const std::size_t pos, const T &value)
 ZBuffer (const std::size_t size, const TCompare &cmp=TCompare())

Private Attributes

Buffer m_buffer
 The actual buffer (a vector with optionally empty elements).
TCompare m_cmp
 The comparison operator.

Detailed Description

template<typename T, typename TCompare = std::less<T>>
class icl_core::ZBuffer< T, TCompare >

A simple Z buffer implementation. Values are stored inside the buffer only if their corresponding buffer cell is currently empty, or the values are less than the currently stored value (where the meaning of "less" can be defined by a custom operator).

Template Parameters:
TThe stored type. Elements of the buffer will be of type boost::optional<T>.
TCompareComparison operator. A stored element is updated with a new element if the comparison m_cmp(new_elem, current_elem) returns true.

Definition at line 43 of file ZBuffer.h.


Member Typedef Documentation

template<typename T , typename TCompare = std::less<T>>
typedef std::vector<boost::optional<T> > icl_core::ZBuffer< T, TCompare >::Buffer

The type of the internal buffer.

Definition at line 47 of file ZBuffer.h.

template<typename T , typename TCompare = std::less<T>>
typedef Buffer::size_type icl_core::ZBuffer< T, TCompare >::size_type

Shorthand to vector size type.

Definition at line 49 of file ZBuffer.h.


Constructor & Destructor Documentation

template<typename T , typename TCompare = std::less<T>>
icl_core::ZBuffer< T, TCompare >::ZBuffer ( const std::size_t  size,
const TCompare &  cmp = TCompare() 
) [inline, explicit]

Constructs a Z buffer.

Parameters:
sizeThe number of elements in the Z buffer.
cmpComparison operator. Elements are replaced in the buffer if cmp(new_elem, current_elem) returns true.

Definition at line 56 of file ZBuffer.h.


Member Function Documentation

template<typename T , typename TCompare = std::less<T>>
boost::optional<T> icl_core::ZBuffer< T, TCompare >::at ( const std::size_t  pos) const [inline]

Read-only access to a specific buffer element.

Definition at line 86 of file ZBuffer.h.

template<typename T , typename TCompare = std::less<T>>
const Buffer& icl_core::ZBuffer< T, TCompare >::buffer ( ) const [inline]

Read-only access to the buffer.

Definition at line 84 of file ZBuffer.h.

template<typename T , typename TCompare = std::less<T>>
boost::optional<T> icl_core::ZBuffer< T, TCompare >::operator[] ( const std::size_t  pos) const [inline]

Read-only access to a specific buffer element.

Definition at line 88 of file ZBuffer.h.

template<typename T , typename TCompare = std::less<T>>
void icl_core::ZBuffer< T, TCompare >::reset ( ) [inline]

Empties the Z buffer.

Definition at line 80 of file ZBuffer.h.

template<typename T , typename TCompare = std::less<T>>
const size_type icl_core::ZBuffer< T, TCompare >::size ( ) const [inline]

Returns the buffer size.

Definition at line 82 of file ZBuffer.h.

template<typename T , typename TCompare = std::less<T>>
bool icl_core::ZBuffer< T, TCompare >::update ( const std::size_t  pos,
const T &  value 
) [inline]

Updates the element at pos with value, provided the comparison operator agrees.

Parameters:
posPosition to update.
valueThe potential replacement.
Returns:
true if the current value in the buffer was replaced with the new value.

Definition at line 68 of file ZBuffer.h.


Member Data Documentation

template<typename T , typename TCompare = std::less<T>>
Buffer icl_core::ZBuffer< T, TCompare >::m_buffer [private]

The actual buffer (a vector with optionally empty elements).

Definition at line 92 of file ZBuffer.h.

template<typename T , typename TCompare = std::less<T>>
TCompare icl_core::ZBuffer< T, TCompare >::m_cmp [private]

The comparison operator.

Definition at line 94 of file ZBuffer.h.


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


schunk_svh_driver
Author(s): Georg Heppner
autogenerated on Fri Aug 28 2015 12:59:20