FX::QIntDict< type > Class Template Reference
[Qt Template Library]

#include <qintdict.h>

Inheritance diagram for FX::QIntDict< type >:

Inheritance graph
[legend]

List of all members.


Detailed Description

template<class type>
class FX::QIntDict< type >

An implementation of Qt's QIntDict.

See also:
FX::QDict

Public Types

enum  { HasSlowKeyCompare }
typedef keytype KeyType
typedef type ItemType

Public Member Functions

 QIntDict (int size=13, bool wantAutoDel=false)
void insert (FXint k, const type *d)
void replace (FXint k, const type *d)
bool remove (FXint k)
type * take (FXint k)
type * find (FXint k) const
type * operator[] (FXint k) const
template<>
void deleteItem (void *)
bool autoDelete () const
void setAutoDelete (bool a)
uint count () const
bool isEmpty () const
uint size () const
void clear ()
void append (const QDictBase< keytype, type > &o)
QDictBase< keytype, type > & operator+= (const QDictBase< keytype, type > &o)
void resize (uint newsize)
void safeResize (uint newsize) throw ()
void spread (float *full, float *slotsspread, float *avrgkeysperslot, float *spread) const
void statistics () const
FXint dictionaryBias () const throw ()

Protected Types

typedef std::map< keytype,
hashitemlist > 
keyitemlist
typedef keyitemlist::value_type keyitem

Protected Member Functions

virtual void deleteItem (type *d)
keyitem * findKey (FXuint h, const keytype &k)
const keyitem * findKey (FXuint h, const keytype &k) const
void insert (FXuint h, const keytype &k, type *d)
void replace (FXuint h, const keytype &k, type *d)
bool remove (FXuint h, const keytype &k)
type * take (FXuint h, const keytype &k)
type * find (FXuint h, const keytype &k) const

Member Typedef Documentation

template<class keytype, class type>
typedef keytype FX::QDictBase< keytype, type >::KeyType [inherited]

The type of the key.

template<class keytype, class type>
typedef type FX::QDictBase< keytype, type >::ItemType [inherited]

The type of the container's item.


Constructor & Destructor Documentation

template<class type>
FX::QIntDict< type >::QIntDict ( int  size = 13,
bool  wantAutoDel = false 
) [inline, explicit]

Creates a hash table indexed by FXint's. Choose a prime for size.


Member Function Documentation

template<class type>
void FX::QIntDict< type >::insert ( FXint  k,
const type *  d 
) [inline]

Inserts item d into the dictionary under key k.

template<class type>
void FX::QIntDict< type >::replace ( FXint  k,
const type *  d 
) [inline]

Replaces item d in the dictionary under key k.

template<class type>
bool FX::QIntDict< type >::remove ( FXint  k  )  [inline]

Deletes the most recently placed item in the dictionary under key k.

template<class type>
type* FX::QIntDict< type >::take ( FXint  k  )  [inline]

Removes the most recently placed item in the dictionary under key k without auto-deletion.

template<class type>
type* FX::QIntDict< type >::find ( FXint  k  )  const [inline]

Finds the most recently placed item in the dictionary under key k.

template<class keytype, class type>
bool FX::QDictBase< keytype, type >::autoDelete (  )  const [inline, inherited]

Returns if auto-deletion is enabled.

template<class keytype, class type>
void FX::QDictBase< keytype, type >::setAutoDelete ( bool  a  )  [inline, inherited]

Sets if auto-deletion is enabled.

template<class keytype, class type>
uint FX::QDictBase< keytype, type >::count (  )  const [inline, inherited]

Returns the number of items in the list.

template<class keytype, class type>
bool FX::QDictBase< keytype, type >::isEmpty (  )  const [inline, inherited]

Returns true if the list is empty.

template<class keytype, class type>
uint FX::QDictBase< keytype, type >::size (  )  const [inline, inherited]

Returns the size of the hash table.

template<class keytype, class type>
void FX::QDictBase< keytype, type >::clear (  )  [inline, inherited]

Clears the list of items, auto-deleting if enabled.

template<class keytype, class type>
void FX::QDictBase< keytype, type >::append ( const QDictBase< keytype, type > &  o  )  [inline, inherited]

Appends the contents of another dictionary.

Referenced by FX::QDictBase< FX::FXString, type >::operator+=().

template<class keytype, class type>
QDictBase<keytype, type>& FX::QDictBase< keytype, type >::operator+= ( const QDictBase< keytype, type > &  o  )  [inline, inherited]

template<class keytype, class type>
void FX::QDictBase< keytype, type >::resize ( uint  newsize  )  [inline, inherited]

Resizes the hash table (see QDICTDYNRESIZE()). Invalidates all iterators.

template<class keytype, class type>
void FX::QDictBase< keytype, type >::safeResize ( uint  newsize  )  throw () [inline, inherited]

Resizes the hash table with no threat of memory full exceptions. Invalidates all iterators.

template<class keytype, class type>
void FX::QDictBase< keytype, type >::spread ( float *  full,
float *  slotsspread,
float *  avrgkeysperslot,
float *  spread 
) const [inline, inherited]

Returns statistics useful for dynamic balancing of the table. If full exceeds 100%, then there are more items than slots and the table is no longer performing at maximum efficiency. If slotsspread is less than 50% then the hash function is broken. Ideally for performance purposes avrgkeysperslot should be near 1.0 and finally spread is slotsspread divided by avrgskeysperslot which is an overall indication of spread and thus efficiency of the table. Of course maximum efficiency is pointless for very large sets of data where avrgkeysperslot could be as much as eight - but slotsspread should always be near 100%

Referenced by FX::QDictBase< FX::FXString, type >::statistics().

template<class keytype, class type>
void FX::QDictBase< keytype, type >::statistics (  )  const [inline, inherited]

Prints some statistics about the hash table (only debug builds).

Reimplemented in FX::FXLRUCache< FX::QIntDict< type > >, and FX::FXLRUCache< FX::QDict< type > >.

template<class keytype, class type>
FXint FX::QDictBase< keytype, type >::dictionaryBias (  )  const throw () [inline, inherited]

Returns a number indicating how biased between lookups and insert/removals the usage of this dictionary has been so far. Is negative for more insert/removals than lookups and positive for the opposite.


The documentation for this class was generated from the following file:

(C) 2002-2008 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Jun 13 22:27:57 2008 for TnFOX by doxygen v1.5.6