Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
BIAS::SparseArray2D< T > Class Template Reference

generic two dimensional psarsly populated rectangular array holding arbitrary data types More...

#include <Base/Common/SparseArray2D.hh>

+ Collaboration diagram for BIAS::SparseArray2D< T >:

Classes

class  const_iterator
 for const_iterator access todo: derive from std::iterator class(es) More...
 
class  iterator
 for iterator access todo: derive from std::iterator class(es) More...
 

Public Member Functions

const_iterator begin () const
 
iterator begin ()
 
void clear ()
 frees the memory More...
 
bool empty () const
 
const_iterator end () const
 
iterator end ()
 
void erase (const unsigned row, const unsigned col)
 
bool is_valid (const unsigned row, const unsigned col) const
 
unsigned ncols () const
 
unsigned nrows () const
 
unsigned num_entries () const
 
T & operator() (const unsigned row, const unsigned col)
 checked element access More...
 
const T & operator() (const unsigned row, const unsigned col) const
 
SparseArray2D< T > & operator= (const SparseArray2D< T > &m)
 copy operator More...
 
void position (const const_iterator &it, unsigned &row, unsigned &col) const
 
void position (const iterator &it, unsigned &row, unsigned &col) const
 
void resize (const unsigned nrows, const unsigned ncols)
 preserves the content More...
 
unsigned size () const
 
 SparseArray2D ()
 
 SparseArray2D (const unsigned nrows, const unsigned ncols)
 
 SparseArray2D (const SparseArray2D< T > &m)
 
 ~SparseArray2D ()
 

Protected Member Functions

long long unsigned Indices2Map_ (const unsigned row, const unsigned col) const
 
void Map2Indices_ (const long long unsigned &map, unsigned &row, unsigned &col) const
 

Protected Attributes

std::map< long long unsigned, T > Data_
 
unsigned Ncols_
 
unsigned Nrows_
 

Friends

std::ostream & operator (std::ostream &os, const SparseArray2D< T > &t)
 

Detailed Description

template<class T>
class BIAS::SparseArray2D< T >

generic two dimensional psarsly populated rectangular array holding arbitrary data types

Test:
tested with TestSparseArray2D.cpp

The syntax of the access functions is kept similar to the stl::classes

Author
woelk 11/2007 (c) www.vision-n.de
Examples:
ExampleSparseArray2D.cpp.

Definition at line 34 of file SparseArray2D.hh.

Constructor & Destructor Documentation

template<class T >
BIAS::SparseArray2D< T >::SparseArray2D ( )

Definition at line 186 of file SparseArray2D.hh.

template<class T >
BIAS::SparseArray2D< T >::SparseArray2D ( const unsigned  nrows,
const unsigned  ncols 
)

Definition at line 192 of file SparseArray2D.hh.

template<class T >
BIAS::SparseArray2D< T >::SparseArray2D ( const SparseArray2D< T > &  m)

Definition at line 201 of file SparseArray2D.hh.

template<class T >
BIAS::SparseArray2D< T >::~SparseArray2D ( )

Definition at line 207 of file SparseArray2D.hh.

Member Function Documentation

template<class T>
const_iterator BIAS::SparseArray2D< T >::begin ( ) const
inline

Definition at line 142 of file SparseArray2D.hh.

References BIAS::SparseArray2D< T >::Data_.

template<class T>
iterator BIAS::SparseArray2D< T >::begin ( )
inline

Definition at line 152 of file SparseArray2D.hh.

References BIAS::SparseArray2D< T >::Data_.

template<class T >
void BIAS::SparseArray2D< T >::clear ( )

frees the memory

Definition at line 224 of file SparseArray2D.hh.

template<class T>
bool BIAS::SparseArray2D< T >::empty ( ) const
inline
template<class T>
const_iterator BIAS::SparseArray2D< T >::end ( ) const
inline

Definition at line 147 of file SparseArray2D.hh.

References BIAS::SparseArray2D< T >::Data_.

template<class T>
iterator BIAS::SparseArray2D< T >::end ( )
inline

Definition at line 153 of file SparseArray2D.hh.

References BIAS::SparseArray2D< T >::Data_.

template<class T >
void BIAS::SparseArray2D< T >::erase ( const unsigned  row,
const unsigned  col 
)

Definition at line 255 of file SparseArray2D.hh.

template<class T>
long long unsigned BIAS::SparseArray2D< T >::Indices2Map_ ( const unsigned  row,
const unsigned  col 
) const
inlineprotected

Definition at line 168 of file SparseArray2D.hh.

References BIAS::SparseArray2D< T >::Ncols_.

template<class T >
bool BIAS::SparseArray2D< T >::is_valid ( const unsigned  row,
const unsigned  col 
) const

Definition at line 246 of file SparseArray2D.hh.

template<class T>
void BIAS::SparseArray2D< T >::Map2Indices_ ( const long long unsigned &  map,
unsigned &  row,
unsigned &  col 
) const
inlineprotected

Definition at line 173 of file SparseArray2D.hh.

References BIAS::SparseArray2D< T >::Ncols_.

Referenced by BIAS::SparseArray2D< T >::position().

template<class T>
unsigned BIAS::SparseArray2D< T >::ncols ( ) const
inline

Definition at line 72 of file SparseArray2D.hh.

References BIAS::SparseArray2D< T >::Ncols_.

template<class T>
unsigned BIAS::SparseArray2D< T >::nrows ( ) const
inline

Definition at line 74 of file SparseArray2D.hh.

References BIAS::SparseArray2D< T >::Nrows_.

template<class T>
unsigned BIAS::SparseArray2D< T >::num_entries ( ) const
inline

Definition at line 78 of file SparseArray2D.hh.

References BIAS::SparseArray2D< T >::Data_.

template<class T >
T & BIAS::SparseArray2D< T >::operator() ( const unsigned  row,
const unsigned  col 
)

checked element access

Definition at line 266 of file SparseArray2D.hh.

template<class T >
const T & BIAS::SparseArray2D< T >::operator() ( const unsigned  row,
const unsigned  col 
) const

Definition at line 276 of file SparseArray2D.hh.

template<class T >
SparseArray2D< T > & BIAS::SparseArray2D< T >::operator= ( const SparseArray2D< T > &  m)
template<class T>
void BIAS::SparseArray2D< T >::position ( const const_iterator it,
unsigned &  row,
unsigned &  col 
) const
inline
template<class T>
void BIAS::SparseArray2D< T >::position ( const iterator it,
unsigned &  row,
unsigned &  col 
) const
inline
template<class T >
void BIAS::SparseArray2D< T >::resize ( const unsigned  nrows,
const unsigned  ncols 
)

preserves the content

Definition at line 229 of file SparseArray2D.hh.

template<class T>
unsigned BIAS::SparseArray2D< T >::size ( ) const
inline

Friends And Related Function Documentation

template<class T>
std::ostream& operator ( std::ostream &  os,
const SparseArray2D< T > &  t 
)
friend

Member Data Documentation

template<class T>
std::map<long long unsigned, T> BIAS::SparseArray2D< T >::Data_
protected
template<class T>
unsigned BIAS::SparseArray2D< T >::Ncols_
protected
template<class T>
unsigned BIAS::SparseArray2D< T >::Nrows_
protected

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