#include <Dictionary.h>
Data Structures | |
| struct | entry |
Public Types | |
| typedef K | key_type |
| typedef V | value_type |
| typedef RET | iter_value_return_type |
| typedef V & | value_reference_type |
| typedef dictionary_hash_iter < K, V > | const_iterator |
| typedef dictionary_hash_iter < K, V > | iterator |
Public Member Functions | |
| dictionary_hash (unsigned(*hashfunc)(const K &), unsigned nbins=101, unsigned max_bin_load=70) | |
| ~dictionary_hash () | |
| dictionary_hash (const dictionary_hash< K, V > &) | |
| dictionary_hash< K, V > & | operator= (const dictionary_hash< K, V > &) |
| unsigned | getMemUsage_exceptObjItself_AndExtraFromKeyOrValue () const |
| unsigned | size () const |
| V & | operator[] (const K &) |
| const V & | operator[] (const K &) const |
| V & | get (const K &) |
| const V & | get (const K &) const |
| const V & | get_and_remove (const K &) |
| bool | find_and_remove (const K &, V &) |
| void | set (const K &, const V &) |
| bool | find (const K &, V &) const |
| bool | find (const K &, const V **) const |
| iterator | find (const K &) |
| const_iterator | find (const K &) const |
| bool | defines (const K &) const |
| void | undef (const K &) |
| pdvector< K > | keys () const |
| pdvector< V > | values () const |
| pdvector< pdpair< K, V > > | keysAndValues () const |
| void | clear () |
| const_iterator | begin () const |
| const_iterator | end () const |
Private Types | |
| typedef const V & | RET |
Private Member Functions | |
| bool | enoughBins () const |
| bool | enoughBinsIf1MoreItemAdded () const |
| unsigned | add (const K &, const V &) |
| unsigned | locate_addIfNotFound (const K &) |
| unsigned | locate (const K &, bool even_if_removed) const |
| void | grow_numbins (unsigned new_numbins) |
Private Attributes | |
| unsigned(* | hasher )(const K &) |
| pdvector< entry > | all_elems |
| pdvector< unsigned > | bins |
| unsigned | num_removed_elems |
| unsigned | max_bin_load |
Static Private Attributes | |
| static const unsigned | bin_grow_factor = 2 |
Friends | |
| class | dictionary_hash_iter< K, V > |
Definition at line 80 of file Dictionary.h.
| typedef dictionary_hash_iter<K,V> dictionary_hash< K, V >::const_iterator |
Definition at line 90 of file Dictionary.h.
| typedef RET dictionary_hash< K, V >::iter_value_return_type |
Definition at line 87 of file Dictionary.h.
| typedef dictionary_hash_iter<K,V> dictionary_hash< K, V >::iterator |
Definition at line 91 of file Dictionary.h.
| typedef K dictionary_hash< K, V >::key_type |
Definition at line 85 of file Dictionary.h.
typedef const V& dictionary_hash< K, V >::RET [private] |
Definition at line 81 of file Dictionary.h.
| typedef V& dictionary_hash< K, V >::value_reference_type |
Definition at line 88 of file Dictionary.h.
| typedef V dictionary_hash< K, V >::value_type |
Definition at line 86 of file Dictionary.h.
| dictionary_hash< K, V >::dictionary_hash | ( | unsigned(*)(const K &) | hashfunc, | |
| unsigned | nbins = 101, |
|||
| unsigned | max_bin_load = 70 | |||
| ) | [inline] |
Definition at line 49 of file Dictionary.C.
References dictionary_hash< K, V >::bins, dictionary_hash< K, V >::enoughBins(), dictionary_hash< K, V >::hasher, dictionary_hash< K, V >::max_bin_load, and dictionary_hash< K, V >::num_removed_elems.
| dictionary_hash< K, V >::~dictionary_hash | ( | ) | [inline] |
Definition at line 100 of file Dictionary.h.
| dictionary_hash< K, V >::dictionary_hash | ( | const dictionary_hash< K, V > & | src | ) | [inline] |
Definition at line 75 of file Dictionary.C.
References dictionary_hash< K, V >::enoughBins(), dictionary_hash< K, V >::hasher, dictionary_hash< K, V >::max_bin_load, and dictionary_hash< K, V >::num_removed_elems.
| unsigned dictionary_hash< K, V >::add | ( | const K & | key, | |
| const V & | val | |||
| ) | [inline, private] |
Definition at line 450 of file Dictionary.C.
References dictionary_hash< K, V >::all_elems, dictionary_hash< K, V >::bin_grow_factor, dictionary_hash< K, V >::bins, dictionary_hash< K, V >::enoughBins(), dictionary_hash< K, V >::enoughBinsIf1MoreItemAdded(), dictionary_hash< K, V >::grow_numbins(), dictionary_hash< K, V >::hasher, and dictionary_hash< K, V >::entry::next.
Referenced by dictionary_hash< K, V >::locate_addIfNotFound(), and dictionary_hash< K, V >::set().
| const_iterator dictionary_hash< K, V >::begin | ( | ) | const [inline] |
Definition at line 149 of file Dictionary.h.
Referenced by dictionary_hash< K, V >::keys(), dictionary_hash< K, V >::keysAndValues(), and dictionary_hash< K, V >::values().
| void dictionary_hash< K, V >::clear | ( | ) | [inline] |
Definition at line 392 of file Dictionary.C.
References dictionary_hash< K, V >::all_elems, dictionary_hash< K, V >::bins, dictionary_hash< K, V >::enoughBins(), dictionary_hash< K, V >::num_removed_elems, and dictionary_hash< K, V >::size().
| bool dictionary_hash< K, V >::defines | ( | const K & | key | ) | const [inline] |
Definition at line 283 of file Dictionary.C.
References dictionary_hash< K, V >::locate().
| const_iterator dictionary_hash< K, V >::end | ( | ) | const [inline] |
Definition at line 153 of file Dictionary.h.
Referenced by dictionary_hash< K, V >::find(), dictionary_hash< K, V >::keys(), dictionary_hash< K, V >::keysAndValues(), and dictionary_hash< K, V >::values().
| bool dictionary_hash< K, V >::enoughBins | ( | ) | const [inline, private] |
Definition at line 160 of file Dictionary.h.
References dictionary_hash< K, V >::all_elems, dictionary_hash< K, V >::bins, and dictionary_hash< K, V >::max_bin_load.
Referenced by dictionary_hash< K, V >::add(), dictionary_hash< K, V >::clear(), dictionary_hash< K, V >::dictionary_hash(), dictionary_hash< K, V >::grow_numbins(), and dictionary_hash< K, V >::operator=().
| bool dictionary_hash< K, V >::enoughBinsIf1MoreItemAdded | ( | ) | const [inline, private] |
Definition at line 165 of file Dictionary.h.
References dictionary_hash< K, V >::all_elems, dictionary_hash< K, V >::bins, and dictionary_hash< K, V >::max_bin_load.
Referenced by dictionary_hash< K, V >::add().
| TYPENAME dictionary_hash< K, V >::const_iterator dictionary_hash< K, V >::find | ( | const K & | key | ) | const [inline] |
Definition at line 242 of file Dictionary.C.
References dictionary_hash< K, V >::all_elems, dictionary_hash< K, V >::end(), GET_ITER, dictionary_hash< K, V >::locate(), and TYPENAME.
| TYPENAME dictionary_hash< K, V >::iterator dictionary_hash< K, V >::find | ( | const K & | key | ) | [inline] |
Definition at line 227 of file Dictionary.C.
References dictionary_hash< K, V >::all_elems, dictionary_hash< K, V >::end(), GET_ITER, dictionary_hash< K, V >::locate(), and TYPENAME.
| bool dictionary_hash< K, V >::find | ( | const K & | key, | |
| const V ** | el | |||
| ) | const [inline] |
Definition at line 272 of file Dictionary.C.
References dictionary_hash< K, V >::all_elems, and dictionary_hash< K, V >::locate().
| bool dictionary_hash< K, V >::find | ( | const K & | key, | |
| V & | el | |||
| ) | const [inline] |
Definition at line 261 of file Dictionary.C.
References dictionary_hash< K, V >::all_elems, and dictionary_hash< K, V >::locate().
| bool dictionary_hash< K, V >::find_and_remove | ( | const K & | key, | |
| V & | val | |||
| ) | [inline] |
| const V & dictionary_hash< K, V >::get | ( | const K & | key | ) | const [inline] |
Definition at line 130 of file Dictionary.C.
References dictionary_hash< K, V >::all_elems, and dictionary_hash< K, V >::locate().
| V & dictionary_hash< K, V >::get | ( | const K & | key | ) | [inline] |
Definition at line 141 of file Dictionary.C.
References dictionary_hash< K, V >::all_elems, and dictionary_hash< K, V >::locate().
| const V & dictionary_hash< K, V >::get_and_remove | ( | const K & | key | ) | [inline] |
| unsigned dictionary_hash< K, V >::getMemUsage_exceptObjItself_AndExtraFromKeyOrValue | ( | ) | const [inline] |
Definition at line 107 of file Dictionary.h.
References dictionary_hash< K, V >::all_elems, and dictionary_hash< K, V >::bins.
| void dictionary_hash< K, V >::grow_numbins | ( | unsigned | new_numbins | ) | [inline, private] |
Definition at line 530 of file Dictionary.C.
References dictionary_hash< K, V >::all_elems, dictionary_hash< K, V >::bins, dictionary_hash< K, V >::enoughBins(), dictionary_hash< K, V >::entry::key_hashval, dictionary_hash< K, V >::entry::next, dictionary_hash< K, V >::num_removed_elems, and dictionary_hash< K, V >::entry::removed.
Referenced by dictionary_hash< K, V >::add().
| pdvector< K > dictionary_hash< K, V >::keys | ( | ) | const [inline] |
Definition at line 314 of file Dictionary.C.
References dictionary_hash< K, V >::begin(), dictionary_hash< K, V >::end(), and dictionary_hash< K, V >::size().
| pdvector< pdpair< K, V > > dictionary_hash< K, V >::keysAndValues | ( | ) | const [inline] |
Definition at line 348 of file Dictionary.C.
References dictionary_hash< K, V >::begin(), dictionary_hash< K, V >::end(), and dictionary_hash< K, V >::size().
| unsigned dictionary_hash< K, V >::locate | ( | const K & | key, | |
| bool | even_if_removed | |||
| ) | const [inline, private] |
Definition at line 414 of file Dictionary.C.
References dictionary_hash< K, V >::all_elems, dictionary_hash< K, V >::bins, dictionary_hash< K, V >::hasher, dictionary_hash< K, V >::entry::key, dictionary_hash< K, V >::entry::key_hashval, dictionary_hash< K, V >::entry::next, and dictionary_hash< K, V >::entry::removed.
Referenced by dictionary_hash< K, V >::defines(), dictionary_hash< K, V >::find(), dictionary_hash< K, V >::find_and_remove(), dictionary_hash< K, V >::get(), dictionary_hash< K, V >::get_and_remove(), dictionary_hash< K, V >::locate_addIfNotFound(), dictionary_hash< K, V >::operator[](), dictionary_hash< K, V >::set(), and dictionary_hash< K, V >::undef().
| unsigned dictionary_hash< K, V >::locate_addIfNotFound | ( | const K & | key | ) | [inline, private] |
Definition at line 495 of file Dictionary.C.
References dictionary_hash< K, V >::add(), dictionary_hash< K, V >::all_elems, dictionary_hash< K, V >::locate(), dictionary_hash< K, V >::num_removed_elems, dictionary_hash< K, V >::entry::removed, and dictionary_hash< K, V >::entry::val.
Referenced by dictionary_hash< K, V >::operator[]().
| dictionary_hash< K, V > & dictionary_hash< K, V >::operator= | ( | const dictionary_hash< K, V > & | src | ) | [inline] |
Definition at line 88 of file Dictionary.C.
References dictionary_hash< K, V >::all_elems, dictionary_hash< K, V >::bins, dictionary_hash< K, V >::enoughBins(), dictionary_hash< K, V >::hasher, dictionary_hash< K, V >::max_bin_load, and dictionary_hash< K, V >::num_removed_elems.
| const V & dictionary_hash< K, V >::operator[] | ( | const K & | key | ) | const [inline] |
Definition at line 121 of file Dictionary.C.
References dictionary_hash< K, V >::all_elems, and dictionary_hash< K, V >::locate().
| V & dictionary_hash< K, V >::operator[] | ( | const K & | key | ) | [inline] |
Definition at line 112 of file Dictionary.C.
References dictionary_hash< K, V >::all_elems, and dictionary_hash< K, V >::locate_addIfNotFound().
| void dictionary_hash< K, V >::set | ( | const K & | key, | |
| const V & | val | |||
| ) | [inline] |
| unsigned dictionary_hash< K, V >::size | ( | ) | const [inline] |
Definition at line 106 of file Dictionary.C.
References dictionary_hash< K, V >::all_elems, and dictionary_hash< K, V >::num_removed_elems.
Referenced by dictionary_hash< K, V >::clear(), dictionary_hash< K, V >::find_and_remove(), dictionary_hash< K, V >::get_and_remove(), dictionary_hash< K, V >::keys(), dictionary_hash< K, V >::keysAndValues(), dictionary_hash< K, V >::undef(), and dictionary_hash< K, V >::values().
| void dictionary_hash< K, V >::undef | ( | const K & | key | ) | [inline] |
Definition at line 289 of file Dictionary.C.
References dictionary_hash< K, V >::all_elems, dictionary_hash< K, V >::locate(), dictionary_hash< K, V >::num_removed_elems, dictionary_hash< K, V >::entry::removed, and dictionary_hash< K, V >::size().
| pdvector< V > dictionary_hash< K, V >::values | ( | ) | const [inline] |
Definition at line 331 of file Dictionary.C.
References dictionary_hash< K, V >::begin(), dictionary_hash< K, V >::end(), and dictionary_hash< K, V >::size().
friend class dictionary_hash_iter< K, V > [friend] |
Definition at line 82 of file Dictionary.h.
pdvector<entry> dictionary_hash< K, V >::all_elems [private] |
Definition at line 228 of file Dictionary.h.
Referenced by dictionary_hash< K, V >::add(), dictionary_hash< K, V >::clear(), dictionary_hash< K, V >::enoughBins(), dictionary_hash< K, V >::enoughBinsIf1MoreItemAdded(), dictionary_hash< K, V >::find(), dictionary_hash< K, V >::find_and_remove(), dictionary_hash< K, V >::get(), dictionary_hash< K, V >::get_and_remove(), dictionary_hash< K, V >::getMemUsage_exceptObjItself_AndExtraFromKeyOrValue(), dictionary_hash< K, V >::grow_numbins(), dictionary_hash< K, V >::locate(), dictionary_hash< K, V >::locate_addIfNotFound(), dictionary_hash< K, V >::operator=(), dictionary_hash< K, V >::operator[](), dictionary_hash< K, V >::set(), dictionary_hash< K, V >::size(), and dictionary_hash< K, V >::undef().
const unsigned dictionary_hash< K, V >::bin_grow_factor = 2 [inline, static, private] |
Definition at line 247 of file Dictionary.h.
Referenced by dictionary_hash< K, V >::add().
pdvector<unsigned> dictionary_hash< K, V >::bins [private] |
Definition at line 232 of file Dictionary.h.
Referenced by dictionary_hash< K, V >::add(), dictionary_hash< K, V >::clear(), dictionary_hash< K, V >::dictionary_hash(), dictionary_hash< K, V >::enoughBins(), dictionary_hash< K, V >::enoughBinsIf1MoreItemAdded(), dictionary_hash< K, V >::getMemUsage_exceptObjItself_AndExtraFromKeyOrValue(), dictionary_hash< K, V >::grow_numbins(), dictionary_hash< K, V >::locate(), and dictionary_hash< K, V >::operator=().
unsigned(* dictionary_hash< K, V >::hasher)(const K &) [private] |
unsigned dictionary_hash< K, V >::max_bin_load [private] |
Definition at line 246 of file Dictionary.h.
Referenced by dictionary_hash< K, V >::dictionary_hash(), dictionary_hash< K, V >::enoughBins(), dictionary_hash< K, V >::enoughBinsIf1MoreItemAdded(), and dictionary_hash< K, V >::operator=().
unsigned dictionary_hash< K, V >::num_removed_elems [private] |
Definition at line 237 of file Dictionary.h.
Referenced by dictionary_hash< K, V >::clear(), dictionary_hash< K, V >::dictionary_hash(), dictionary_hash< K, V >::find_and_remove(), dictionary_hash< K, V >::get_and_remove(), dictionary_hash< K, V >::grow_numbins(), dictionary_hash< K, V >::locate_addIfNotFound(), dictionary_hash< K, V >::operator=(), dictionary_hash< K, V >::set(), dictionary_hash< K, V >::size(), and dictionary_hash< K, V >::undef().
1.6.1