Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes

MultiDimStorage< T > Class Template Reference

List of all members.

Public Member Functions

 MultiDimStorage (int ndims, int nvals)
 MultiDimStorage (const MultiDimStorage< T > &)
virtual ~MultiDimStorage ()
bool isOK () const
MultiDimStorage< T > & operator= (const MultiDimStorage< T > &)
bool getRange (int dim, Interval< int > &) const
int nrDims () const
int nrVals () const
void setNrVals (int, bool keepdata)
void removeValue (int)
bool allowsDuplicates () const
bool allowDuplicates (bool)
bool isEmpty () const
int totalSize () const
int size () const
MultiDimStorage< T > * operator[] (int)
int indexOf (int pos) const
int getPos (int idx) const
template<class IDX >
const T & getRef (const IDX &index, int val) const
template<class IDX >
T & getRef (const IDX &index, int val)
template<class V , class POS , class IDX >
bool add (const V &vals, const POS &pos, IDX *index=0)
template<class V , class POS >
bool add (const V &vals, const POS &pos)
template<class IDX >
void remove (const IDX &index)
void empty ()
template<class POS , class IDX >
bool findFirst (const POS &, IDX &) const
template<class IDX >
bool getIndex (int global_pos, IDX &) const
template<class IDX , class POS >
bool getPos (const IDX &, POS &) const
template<class IDX >
bool next (IDX &, bool skipdups=false) const
template<class IDX >
bool prev (IDX &, bool skipdups=false) const
template<class IDX >
bool isValidPos (const IDX &) const
void removeDuplicates ()
bool divide (ObjectSet< int > &) const
template<class IDX >
bool sort (TypeSet< IDX > &indices) const
template<class POS >
void getIndicesInRange (const POS &start, const POS &stop, TypeSet< int > &res) const
template<class IDXS >
bool sort (TypeSet< IDXS > &indices) const

Protected Member Functions

void getRangeI (int dim, Interval< int > &) const
template<class IDX >
void setToLastPos (IDX &) const
int findFirstPos (int pos) const
template<class POS >
void getIndicesInRangeI (const POS &start, const POS &stop, TypeSet< int > &curpos, TypeSet< int > &res) const

Protected Attributes

TypeSet< int > positions_
ObjectSet< MultiDimStorage< T > > lowerdimstorage_
TypeSet< T > onedimstorage_
bool allowduplicates_

Private Attributes

int nrdims_
int nrvals_

Detailed Description

template<class T>
class MultiDimStorage< T >

Stores one or more values of type T that are associated with a discrete position in a N dimenstional space.


Constructor & Destructor Documentation

template<class T >
MultiDimStorage< T >::MultiDimStorage ( int  ndims,
int  nvals 
) [inline]
template<class T>
MultiDimStorage< T >::MultiDimStorage ( const MultiDimStorage< T > &  templ  )  [inline]
template<class T >
MultiDimStorage< T >::~MultiDimStorage (  )  [inline, virtual]

Member Function Documentation

template<class T >
template<class V , class POS , class IDX >
bool MultiDimStorage< T >::add ( const V &  vals,
const POS &  pos,
IDX *  index = 0 
) [inline]

Adds values to stucture.

template<class T >
template<class V , class POS >
bool MultiDimStorage< T >::add ( const V &  vals,
const POS &  pos 
) [inline]

Adds values to stucture.

template<class T >
bool MultiDimStorage< T >::allowDuplicates ( bool  nv  )  [inline]
Returns:
oldstatus.
template<class T >
bool MultiDimStorage< T >::allowsDuplicates (  )  const [inline]

Set allowance for allowing multiple instances at the same position.

template<class T >
bool MultiDimStorage< T >::divide ( ObjectSet< int > &  res  )  const [inline]

divides all items into chunks of (about equal size).

template<class T >
void MultiDimStorage< T >::empty (  )  [inline]

removes everything.

template<class T >
template<class POS , class IDX >
bool MultiDimStorage< T >::findFirst ( const POS &  posarr,
IDX &  indexarr 
) const [inline]
template<class T >
int MultiDimStorage< T >::findFirstPos ( int  pos  )  const [inline, protected]
template<class T >
template<class IDX >
bool MultiDimStorage< T >::getIndex ( int  global_pos,
IDX &  indexarr 
) const [inline]
template<class T >
template<class POS >
void MultiDimStorage< T >::getIndicesInRange ( const POS &  start,
const POS &  stop,
TypeSet< int > &  res 
) const [inline]
Returns:
all indices within a given range.

Gives all indices within a position range.

Parameters:
start array with the interval starts for each dimension
stop array with the interval stops for each dimension
res the output. The indexes are multiplexed in, so the first ndims samples are the indices for first position, the second ndim samples are the indices for the second postion and so forth.
template<class T >
template<class POS >
void MultiDimStorage< T >::getIndicesInRangeI ( const POS &  start,
const POS &  stop,
TypeSet< int > &  curpos,
TypeSet< int > &  res 
) const [inline, protected]
template<class T >
template<class IDX , class POS >
bool MultiDimStorage< T >::getPos ( const IDX &  indexarr,
POS &  pos 
) const [inline]
template<class T >
int MultiDimStorage< T >::getPos ( int  idx  )  const [inline]
Returns:
position in highest dimension
template<class T >
bool MultiDimStorage< T >::getRange ( int  dim,
Interval< int > &  rg 
) const [inline]
template<class T >
void MultiDimStorage< T >::getRangeI ( int  dim,
Interval< int > &  rg 
) const [inline, protected]
template<class T >
template<class IDX >
const T & MultiDimStorage< T >::getRef ( const IDX &  index,
int  val 
) const [inline]
Returns:
a reference to the value poited out by index and val.
template<class T >
template<class IDX >
T & MultiDimStorage< T >::getRef ( const IDX &  index,
int  val 
) [inline]
Returns:
a reference to the value poited out by index and val.
template<class T >
int MultiDimStorage< T >::indexOf ( int  pos  )  const [inline]
Returns:
index in highest dimension
template<class T >
bool MultiDimStorage< T >::isEmpty (  )  const [inline]
template<class T >
bool MultiDimStorage< T >::isOK (  )  const [inline]
template<class T >
template<class IDX >
bool MultiDimStorage< T >::isValidPos ( const IDX &  indexarr  )  const [inline]
template<class T >
template<class IDX >
bool MultiDimStorage< T >::next ( IDX &  indexarr,
bool  skipdups = false 
) const [inline]
template<class T >
int MultiDimStorage< T >::nrDims (  )  const [inline]
template<class T >
int MultiDimStorage< T >::nrVals (  )  const [inline]
template<class T>
MultiDimStorage< T > & MultiDimStorage< T >::operator= ( const MultiDimStorage< T > &  templ  )  [inline]
template<class T >
MultiDimStorage< T > * MultiDimStorage< T >::operator[] ( int  idx  )  [inline]
Returns:
zero if nrdims==1
template<class T >
template<class IDX >
bool MultiDimStorage< T >::prev ( IDX &  indexarr,
bool  skipdups = false 
) const [inline]
template<class T >
template<class IDX >
void MultiDimStorage< T >::remove ( const IDX &  index  )  [inline]
template<class T >
void MultiDimStorage< T >::removeDuplicates (  )  [inline]
template<class T>
void MultiDimStorage< T >::removeValue ( int   ) 
template<class T >
void MultiDimStorage< T >::setNrVals ( int  nn,
bool  keepdata 
) [inline]
template<class T >
template<class IDX >
void MultiDimStorage< T >::setToLastPos ( IDX &  indexarr  )  const [inline, protected]
template<class T >
int MultiDimStorage< T >::size (  )  const [inline]
Returns:
the size in highest dimension.
template<class T>
template<class IDXS >
bool MultiDimStorage< T >::sort ( TypeSet< IDXS > &  indices  )  const [inline]
template<class T>
template<class IDX >
bool MultiDimStorage< T >::sort ( TypeSet< IDX > &  indices  )  const

Sorts the array in order of globalpos.

template<class T >
int MultiDimStorage< T >::totalSize (  )  const [inline]
Returns:
the total number of instances.

Member Data Documentation

template<class T>
bool MultiDimStorage< T >::allowduplicates_ [protected]
template<class T>
ObjectSet<MultiDimStorage<T> > MultiDimStorage< T >::lowerdimstorage_ [protected]
template<class T>
int MultiDimStorage< T >::nrdims_ [private]
template<class T>
int MultiDimStorage< T >::nrvals_ [private]
template<class T>
TypeSet<T> MultiDimStorage< T >::onedimstorage_ [protected]
template<class T>
TypeSet<int> MultiDimStorage< T >::positions_ [protected]