|
Nebula
|
#include <sparsetable.h>
A 2D sparse table where many entries may be redundant and support for multiple entries per cell.
Classes | |
| struct | TableEntry |
| a table entry in the sparse table More... | |
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 | |
Private Attributes | |
| Array< TYPE > | uniqueElements |
| FixedTable< TableEntry > | tableEntries |
| Dictionary< StringAtom, IndexT > | colIndexMap |
| Dictionary< StringAtom, IndexT > | rowIndexMap |
| bool | inSetup |
| Util::SparseTable< TYPE >::SparseTable | ( | ) |
constructor
| void Util::SparseTable< TYPE >::AddMultiple | ( | IndexT | colIndex, |
| IndexT | rowIndex, | ||
| const TYPE * | firstElm, | ||
| SizeT | numElements ) |
add a new multiple entry
| 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!
| void Util::SparseTable< TYPE >::AddSingle | ( | IndexT | colIndex, |
| IndexT | rowIndex, | ||
| const TYPE & | elm ) |
add a single new unique entry
| void Util::SparseTable< TYPE >::BeginSetup | ( | const Array< StringAtom > & | columnNames, |
| const Array< StringAtom > & | rowNames, | ||
| SizeT | numUnique = 0 ) |
setup the sparse table
| void Util::SparseTable< TYPE >::Clear | ( | ) |
clear object
| void Util::SparseTable< TYPE >::EndSetup | ( | ) |
finish setting up the sparse table
| IndexT Util::SparseTable< TYPE >::GetColumnIndexByName | ( | const StringAtom & | colName | ) | const |
return column index by name
| const TYPE * Util::SparseTable< TYPE >::GetElements | ( | IndexT | colIndex, |
| IndexT | rowIndex, | ||
| SizeT & | outNumElements ) const |
get entry at given index
| SizeT Util::SparseTable< TYPE >::GetNumColumns | ( | ) | const |
get number of columns in the sparse table
| SizeT Util::SparseTable< TYPE >::GetNumRows | ( | ) | const |
get number of rows in the sparse table
| SizeT Util::SparseTable< TYPE >::GetNumUniqueElements | ( | ) | const |
get current number of unique elements
| IndexT Util::SparseTable< TYPE >::GetRowIndexByName | ( | const StringAtom & | rowName | ) | const |
return row index by name
| bool Util::SparseTable< TYPE >::HasColumn | ( | const StringAtom & | colName | ) | const |
return true if column exists
| bool Util::SparseTable< TYPE >::HasRow | ( | const StringAtom & | rowName | ) | const |
return true if row exists
| const TYPE * Util::SparseTable< TYPE >::LookupElements | ( | const StringAtom & | colName, |
| const StringAtom & | rowName, | ||
| SizeT & | outNumElements ) const |
lookup entry by row/column names
| void Util::SparseTable< TYPE >::SetEntryDirect | ( | IndexT | colIndex, |
| IndexT | rowIndex, | ||
| ushort | startIndex, | ||
| ushort | numElements ) |
add a direct reference using an index into the unique element array
|
private |
|
private |
|
private |
|
private |
|
private |