The Nebula Device 3: Util::SparseTable< TYPE > Class Template Reference

The Nebula Device 3

Util::SparseTable< TYPE > Class Template Reference

#include <sparsetable.h>


Detailed Description

template<class TYPE>
class Util::SparseTable< TYPE >

A 2D sparse table where many entries may be redundant and support for multiple entries per cell.

(C) 2009 Radon Labs GmbH


Public Member Functions

 SparseTable ()
 constructor
void BeginSetup (const Array< StringAtom > &columnNames, const Array< StringAtom > &rowNames, SizeT numUnique=0)
 setup the sparse table
void AddSingle (IndexT colIndex, IndexT rowIndex, const TYPE &elm)
 add a single new unique entry
void AddMultiple (IndexT colIndex, IndexT rowIndex, const TYPE *firstElm, SizeT numElements)
 add a new multiple entry
void AddReference (IndexT colIndex, IndexT rowIndex, IndexT refColIndex, IndexT refRowIndex)
 add a reference to another column/index
void SetEntryDirect (IndexT colIndex, IndexT rowIndex, ushort startIndex, ushort numElements)
 add a direct reference using an index into the unique element array
void EndSetup ()
 finish setting up the sparse table
void Clear ()
 clear object
SizeT GetNumColumns () const
 get number of columns in the sparse table
SizeT GetNumRows () const
 get number of rows in the sparse table
bool HasColumn (const StringAtom &colName) const
 return true if column exists
bool HasRow (const StringAtom &rowName) const
 return true if row exists
IndexT GetColumnIndexByName (const StringAtom &colName) const
 return column index by name
IndexT GetRowIndexByName (const StringAtom &rowName) const
 return row index by name
SizeT GetNumUniqueElements () const
 get current number of unique elements
const TYPE * GetElements (IndexT colIndex, IndexT rowIndex, SizeT &outNumElements) const
 get entry at given index
const TYPE * LookupElements (const StringAtom &colName, const StringAtom &rowName, SizeT &outNumElements) const
 lookup entry by row/column names

Member Function Documentation

template<class TYPE>
void Util::SparseTable< TYPE >::AddReference ( IndexT  colIndex,
IndexT  rowIndex,
IndexT  refColIndex,
IndexT  refRowIndex 
)

add a reference to another column/index

NOTE: forward references are not allowed!