#include <iso_data_indexhash.h>
Public Member Functions | |
IndexHash () | |
default constructor | |
~IndexHash () | |
destructor | |
QVector< ValueType * > & | vector () |
return vector of data | |
QHash< KeyType, ValueType * > & | hash () |
return hash table of data | |
unsigned int | size () const |
returns number of elements stored | |
bool | contains (KeyType pKey) const |
check whether hash table contains key | |
unsigned int | index (KeyType pKey) const throw (base::Exception) |
return index for key | |
const KeyType & | key (unsigned int pIndex) const throw (base::Exception) |
return key | |
const ValueType & | value (unsigned int pIndex) const throw (base::Exception) |
return value | |
ValueType & | value (unsigned int pIndex) throw (base::Exception) |
return value | |
ValueType & | operator[] (unsigned int pIndex) throw (base::Exception) |
access element | |
const ValueType & | operator[] (unsigned int pIndex) const throw (base::Exception) |
access element | |
ValueType & | operator[] (const KeyType &pKey) throw (base::Exception) |
access element | |
const ValueType & | operator[] (const KeyType &pKey) const throw (base::Exception) |
access element | |
void | add (const KeyType &pKey, ValueType &pValue) throw (base::Exception) |
add element | |
void | insert (const KeyType &pKey, ValueType &pValue) throw (base::Exception) |
insert element | |
void | insert (const KeyType &pKey, ValueType &pValue, unsigned int pIndex) throw (base::Exception) |
insert element | |
void | move (unsigned int pFromIndex, unsigned int pToIndex) throw (base::Exception) |
move element | |
void | replace (const KeyType &pKey, ValueType &pValue) throw (base::Exception) |
replace element | |
void | replace (unsigned int pIndex, ValueType &pValue) throw (base::Exception) |
replace element | |
void | set (const KeyType &pKey, ValueType &pValue) |
set element | |
void | set (unsigned int pIndex, ValueType &pValue) throw (base::Exception) |
set element | |
void | remove (const KeyType &pKey) throw (base::Exception) |
remove element | |
void | remove (unsigned int pIndex) throw (base::Exception) |
remove element | |
void | clear () |
remove all elements | |
Protected Attributes | |
QVector< ValueType * > | mValueVector |
vector of data | |
QVector< KeyType > | mKeyVector |
vector of keys | |
QHash< KeyType, ValueType * > | mHash |
hash table of data |
data structure that allows to retrieve data both by key and index
data structure stores pointers only. It manages data both via a hash table and vector data structure.
the data structure is relatively slow in removing / replacing elements since it has to find the element in both the hash table and vector
Created by Daniel Bisig on 4/14/07.
iso::data::IndexHash< KeyType, ValueType >::IndexHash | ( | ) |
default constructor
iso::data::IndexHash< KeyType, ValueType >::~IndexHash | ( | ) |
destructor
QVector< ValueType * > & iso::data::IndexHash< KeyType, ValueType >::vector | ( | ) |
return vector of data
QHash< KeyType, ValueType * > & iso::data::IndexHash< KeyType, ValueType >::hash | ( | ) |
return hash table of data
unsigned int iso::data::IndexHash< KeyType, ValueType >::size | ( | ) | const |
returns number of elements stored
bool iso::data::IndexHash< KeyType, ValueType >::contains | ( | KeyType | pKey | ) | const |
check whether hash table contains key
pKey | key to look for |
unsigned int iso::data::IndexHash< KeyType, ValueType >::index | ( | KeyType | pKey | ) | const throw (base::Exception) |
return index for key
pKey | key to look for |
base::Exception | key not found |
const KeyType & iso::data::IndexHash< KeyType, ValueType >::key | ( | unsigned int | pIndex | ) | const throw (base::Exception) [inline] |
return key
pIndex | index of element |
base::Exception | index out of range |
const ValueType & iso::data::IndexHash< KeyType, ValueType >::value | ( | unsigned int | pIndex | ) | const throw (base::Exception) [inline] |
return value
pIndex | index of element |
base::Exception | index out of range |
ValueType & iso::data::IndexHash< KeyType, ValueType >::value | ( | unsigned int | pIndex | ) | throw (base::Exception) [inline] |
return value
pIndex | index of element |
base::Exception | index out of range |
ValueType & iso::data::IndexHash< KeyType, ValueType >::operator[] | ( | unsigned int | pIndex | ) | throw (base::Exception) [inline] |
access element
pIndex | index of element |
base::Exception | index out of range |
const ValueType & iso::data::IndexHash< KeyType, ValueType >::operator[] | ( | unsigned int | pIndex | ) | const throw (base::Exception) [inline] |
access element
pIndex | index of element |
base::Exception | index out of range |
ValueType & iso::data::IndexHash< KeyType, ValueType >::operator[] | ( | const KeyType & | pKey | ) | throw (base::Exception) [inline] |
access element
pKey | key of element |
base::Exception | key not found |
const ValueType & iso::data::IndexHash< KeyType, ValueType >::operator[] | ( | const KeyType & | pKey | ) | const throw (base::Exception) [inline] |
access element
pKey | key of element |
base::Exception | key not found |
void iso::data::IndexHash< KeyType, ValueType >::add | ( | const KeyType & | pKey, | |
ValueType & | pValue | |||
) | throw (base::Exception) |
add element
pKey | storage key | |
pValue | element value |
base::Exception | key alreay stored |
void iso::data::IndexHash< KeyType, ValueType >::insert | ( | const KeyType & | pKey, | |
ValueType & | pValue | |||
) | throw (base::Exception) |
insert element
pKey | storage key | |
pValue | element value |
base::Exception | key alreay stored |
void iso::data::IndexHash< KeyType, ValueType >::insert | ( | const KeyType & | pKey, | |
ValueType & | pValue, | |||
unsigned int | pIndex | |||
) | throw (base::Exception) |
insert element
pKey | storage key | |
pValue | element value | |
pIndex | insert position index |
base::Exception | key alreay stored |
void iso::data::IndexHash< KeyType, ValueType >::move | ( | unsigned int | pFromIndex, | |
unsigned int | pToIndex | |||
) | throw (base::Exception) |
move element
pFromIndex | from index position | |
pToIndex | to indey position |
base::Exception | index out of bounds |
void iso::data::IndexHash< KeyType, ValueType >::replace | ( | const KeyType & | pKey, | |
ValueType & | pValue | |||
) | throw (base::Exception) |
replace element
pKey | storage key | |
pValue | element value |
base::Exception | key not found |
void iso::data::IndexHash< KeyType, ValueType >::replace | ( | unsigned int | pIndex, | |
ValueType & | pValue | |||
) | throw (base::Exception) |
replace element
pIndex | index of element | |
pValue | element value |
base::Exception | index out of range |
void iso::data::IndexHash< KeyType, ValueType >::set | ( | const KeyType & | pKey, | |
ValueType & | pValue | |||
) |
set element
pKey | storage key | |
pValue | element value |
void iso::data::IndexHash< KeyType, ValueType >::set | ( | unsigned int | pIndex, | |
ValueType & | pValue | |||
) | throw (base::Exception) |
set element
pIndex | index of element | |
pValue | element value |
base::Exception | index out of range |
void iso::data::IndexHash< KeyType, ValueType >::remove | ( | const KeyType & | pKey | ) | throw (base::Exception) |
remove element
pKey | storage key |
base::Exception | key not found |
void iso::data::IndexHash< KeyType, ValueType >::remove | ( | unsigned int | pIndex | ) | throw (base::Exception) |
remove element
pIndex | index of element |
base::Exception | index out of range |
void iso::data::IndexHash< KeyType, ValueType >::clear | ( | ) |
remove all elements
QVector<ValueType*> iso::data::IndexHash< KeyType, ValueType >::mValueVector [protected] |
vector of data
QVector<KeyType> iso::data::IndexHash< KeyType, ValueType >::mKeyVector [protected] |
vector of keys
QHash<KeyType, ValueType*> iso::data::IndexHash< KeyType, ValueType >::mHash [protected] |
hash table of data