aimstil  5.0.5
til::rle_array< T, TCount > Class Template Reference

A run-length encoded array. More...

#include <til/rle_array.h>

Classes

class  const_iterator
 
class  const_sparse_iterator
 
class  iterator
 
class  Segment
 A Segment is composed of a value and a length. More...
 
class  sparse_iterator
 

Public Types

typedef rle_array< T, TCount > Self
 
typedef T value_type
 
typedef const T & const_reference
 
typedef const T * const_pointer
 
typedef ValueProxy reference
 
typedef TCount count_type
 

Public Member Functions

 rle_array ()
 Default constructor, yield a zero-size container. More...
 
 rle_array (std::size_t i, T value=T())
 Standard constructor providing a size and an optional fill value. More...
 
const_iterator begin () const
 
const_iterator end () const
 
iterator begin ()
 
iterator end ()
 
const T & operator[] (std::size_t i) const
 
ValueProxy operator[] (std::size_t i)
 
void set (std::pair< typename Data::iterator, TCount > &index, const T &value)
 
template<typename XIterator >
const T & get (std::pair< XIterator, TCount > &index) const
 
std::size_t size () const
 
void print () const
 

Detailed Description

template<typename T, typename TCount = unsigned int>
class til::rle_array< T, TCount >

A run-length encoded array.

Run-length encoding is a simple way to compress data. It stores data using two parameters: a value, and the number of time this value is repeated. The range of usefulness of this scheme is therefore limited to arrays where successive values have a very high probability to be strictly equal. This is generally true for smooth segmentation/label images, where this encoding is most useful. Due to the simplicity of its compression scheme, reading from an rle_array is fast, and extremely so when iterating; writing is a more complex operation, but still tractable.

Definition at line 24 of file rle_array.h.

Member Typedef Documentation

◆ const_pointer

template<typename T, typename TCount = unsigned int>
typedef const T* til::rle_array< T, TCount >::const_pointer

Definition at line 44 of file rle_array.h.

◆ const_reference

template<typename T, typename TCount = unsigned int>
typedef const T& til::rle_array< T, TCount >::const_reference

Definition at line 43 of file rle_array.h.

◆ count_type

template<typename T, typename TCount = unsigned int>
typedef TCount til::rle_array< T, TCount >::count_type

Definition at line 46 of file rle_array.h.

◆ reference

template<typename T, typename TCount = unsigned int>
typedef ValueProxy til::rle_array< T, TCount >::reference

Definition at line 45 of file rle_array.h.

◆ Self

template<typename T, typename TCount = unsigned int>
typedef rle_array<T,TCount> til::rle_array< T, TCount >::Self

Definition at line 41 of file rle_array.h.

◆ value_type

template<typename T, typename TCount = unsigned int>
typedef T til::rle_array< T, TCount >::value_type

Definition at line 42 of file rle_array.h.

Constructor & Destructor Documentation

◆ rle_array() [1/2]

template<typename T, typename TCount = unsigned int>
til::rle_array< T, TCount >::rle_array ( )
inline

Default constructor, yield a zero-size container.

Definition at line 51 of file rle_array.h.

◆ rle_array() [2/2]

template<typename T, typename TCount = unsigned int>
til::rle_array< T, TCount >::rle_array ( std::size_t  i,
value = T() 
)
inline

Standard constructor providing a size and an optional fill value.

If not value is provided, the default value of type T is used.

Definition at line 58 of file rle_array.h.

Member Function Documentation

◆ begin() [1/2]

template<typename T, typename TCount = unsigned int>
const_iterator til::rle_array< T, TCount >::begin ( ) const
inline

Definition at line 65 of file rle_array.h.

◆ begin() [2/2]

template<typename T, typename TCount = unsigned int>
iterator til::rle_array< T, TCount >::begin ( )
inline

Definition at line 69 of file rle_array.h.

◆ end() [1/2]

template<typename T, typename TCount = unsigned int>
const_iterator til::rle_array< T, TCount >::end ( ) const
inline

Definition at line 67 of file rle_array.h.

◆ end() [2/2]

template<typename T, typename TCount = unsigned int>
iterator til::rle_array< T, TCount >::end ( )
inline

Definition at line 71 of file rle_array.h.

References til::rle_array< T, TCount >::operator[]().

◆ get()

template<typename T, typename TCount = unsigned int>
template<typename XIterator >
const T& til::rle_array< T, TCount >::get ( std::pair< XIterator, TCount > &  index) const
inline

Definition at line 83 of file rle_array.h.

◆ operator[]() [1/2]

template<typename T, typename TCount = unsigned int>
const T& til::rle_array< T, TCount >::operator[] ( std::size_t  i) const

◆ operator[]() [2/2]

template<typename T, typename TCount = unsigned int>
ValueProxy til::rle_array< T, TCount >::operator[] ( std::size_t  i)

◆ print()

template<typename T, typename TCount = unsigned int>
void til::rle_array< T, TCount >::print ( ) const
inline

Definition at line 89 of file rle_array.h.

◆ set()

template<typename T, typename TCount = unsigned int>
void til::rle_array< T, TCount >::set ( std::pair< typename Data::iterator, TCount > &  index,
const T &  value 
)

◆ size()

template<typename T, typename TCount = unsigned int>
std::size_t til::rle_array< T, TCount >::size ( ) const
inline

Definition at line 86 of file rle_array.h.


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