dictionary_hash< K, V > Class Template Reference

#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< entryall_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 >

Detailed Description

template<class K, class V>
class dictionary_hash< K, V >

Definition at line 80 of file Dictionary.h.


Member Typedef Documentation

template<class K, class V>
typedef dictionary_hash_iter<K,V> dictionary_hash< K, V >::const_iterator

Definition at line 90 of file Dictionary.h.

template<class K, class V>
typedef RET dictionary_hash< K, V >::iter_value_return_type

Definition at line 87 of file Dictionary.h.

template<class K, class V>
typedef dictionary_hash_iter<K,V> dictionary_hash< K, V >::iterator

Definition at line 91 of file Dictionary.h.

template<class K, class V>
typedef K dictionary_hash< K, V >::key_type

Definition at line 85 of file Dictionary.h.

template<class K, class V>
typedef const V& dictionary_hash< K, V >::RET [private]

Definition at line 81 of file Dictionary.h.

template<class K, class V>
typedef V& dictionary_hash< K, V >::value_reference_type

Definition at line 88 of file Dictionary.h.

template<class K, class V>
typedef V dictionary_hash< K, V >::value_type

Definition at line 86 of file Dictionary.h.


Constructor & Destructor Documentation

template<class K , class V >
dictionary_hash< K, V >::dictionary_hash ( unsigned(*)(const K &)  hashfunc,
unsigned  nbins = 101,
unsigned  max_bin_load = 70 
) [inline]
template<class K, class V>
dictionary_hash< K, V >::~dictionary_hash (  )  [inline]

Definition at line 100 of file Dictionary.h.

template<class K , class V >
dictionary_hash< K, V >::dictionary_hash ( const dictionary_hash< K, V > &  src  )  [inline]

Member Function Documentation

template<class K , class V >
unsigned dictionary_hash< K, V >::add ( const K &  key,
const V &  val 
) [inline, private]
template<class K, class V>
const_iterator dictionary_hash< K, V >::begin (  )  const [inline]
template<class K , class V >
void dictionary_hash< K, V >::clear (  )  [inline]
template<class K , class V >
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().

template<class K, class V>
const_iterator dictionary_hash< K, V >::end (  )  const [inline]
template<class K, class V>
bool dictionary_hash< K, V >::enoughBins (  )  const [inline, private]
template<class K, class V>
bool dictionary_hash< K, V >::enoughBinsIf1MoreItemAdded (  )  const [inline, private]
template<class K , class V >
TYPENAME dictionary_hash< K, V >::const_iterator dictionary_hash< K, V >::find ( const K &  key  )  const [inline]
template<class K , class V >
TYPENAME dictionary_hash< K, V >::iterator dictionary_hash< K, V >::find ( const K &  key  )  [inline]
template<class K , class V >
bool dictionary_hash< K, V >::find ( const K &  key,
const V **  el 
) const [inline]
template<class K , class V >
bool dictionary_hash< K, V >::find ( const K &  key,
V &  el 
) const [inline]
template<class K , class V >
bool dictionary_hash< K, V >::find_and_remove ( const K &  key,
V &  val 
) [inline]
template<class K , class V >
const V & dictionary_hash< K, V >::get ( const K &  key  )  const [inline]
template<class K , class V >
V & dictionary_hash< K, V >::get ( const K &  key  )  [inline]
template<class K , class V >
const V & dictionary_hash< K, V >::get_and_remove ( const K &  key  )  [inline]
template<class K, class V>
unsigned dictionary_hash< K, V >::getMemUsage_exceptObjItself_AndExtraFromKeyOrValue (  )  const [inline]
template<class K , class V >
void dictionary_hash< K, V >::grow_numbins ( unsigned  new_numbins  )  [inline, private]
template<class K , class V >
pdvector< K > dictionary_hash< K, V >::keys (  )  const [inline]
template<class K , class V >
pdvector< pdpair< K, V > > dictionary_hash< K, V >::keysAndValues (  )  const [inline]
template<class K , class V >
unsigned dictionary_hash< K, V >::locate ( const K &  key,
bool  even_if_removed 
) const [inline, private]
template<class K , class V >
unsigned dictionary_hash< K, V >::locate_addIfNotFound ( const K &  key  )  [inline, private]
template<class K , class V >
dictionary_hash< K, V > & dictionary_hash< K, V >::operator= ( const dictionary_hash< K, V > &  src  )  [inline]
template<class K , class V >
const V & dictionary_hash< K, V >::operator[] ( const K &  key  )  const [inline]
template<class K , class V >
V & dictionary_hash< K, V >::operator[] ( const K &  key  )  [inline]
template<class K , class V >
void dictionary_hash< K, V >::set ( const K &  key,
const V &  val 
) [inline]
template<class K , class V >
unsigned dictionary_hash< K, V >::size (  )  const [inline]
template<class K , class V >
void dictionary_hash< K, V >::undef ( const K &  key  )  [inline]
template<class K , class V >
pdvector< V > dictionary_hash< K, V >::values (  )  const [inline]

Friends And Related Function Documentation

template<class K, class V>
friend class dictionary_hash_iter< K, V > [friend]

Definition at line 82 of file Dictionary.h.


Field Documentation

template<class K, class V>
pdvector<entry> dictionary_hash< K, V >::all_elems [private]
template<class K, class V>
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().

template<class K, class V>
pdvector<unsigned> dictionary_hash< K, V >::bins [private]
template<class K, class V>
unsigned(* dictionary_hash< K, V >::hasher)(const K &) [private]
template<class K, class V>
unsigned dictionary_hash< K, V >::max_bin_load [private]
template<class K, class V>
unsigned dictionary_hash< K, V >::num_removed_elems [private]

The documentation for this class was generated from the following files:
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 12 Jul 2013 for SymtabAPI by  doxygen 1.6.1