Logo Search packages:      
Sourcecode: djvulibre version File versions

GMap< KTYPE, VTYPE > Class Template Reference

#include <GContainer.h>

Inheritance diagram for GMap< KTYPE, VTYPE >:

GMapTemplate< KTYPE, VTYPE, VTYPE >

List of all members.


Detailed Description

template<class KTYPE, class VTYPE>
class GMap< KTYPE, VTYPE >

Associative maps. Template class GMap<KTYPE,VTYPE># implements an associative map. The map contains an arbitrary number of entries. Each entry is a pair containing one element of type KTYPE# (named the "key") and one element of type VTYPE# (named the "value"). The entry associated to a particular value of the key can retrieved very efficiently. This class only implement constructors. See class {GMapTemplate} and {GPosition} for a description of all access methods.

Definition at line 1313 of file GContainer.h.


Public Member Functions

GPosition contains (const KTYPE &key, GPosition &pos) const
GPosition contains (const KTYPE &key) const
void del (const KTYPE &key)
void del (GPosition &pos)
void empty ()
void first (GPosition &pos) const
GPosition firstpos () const
bool isempty () const
const KTYPE & key (const GPosition &pos) const
VTYPE * next (GPosition &pos)
const VTYPE * next (GPosition &pos) const
 operator GPosition () const
GMapoperator= (const GMap &r)
VTYPE & operator[] (const KTYPE &key)
const VTYPE & operator[] (const KTYPE &key) const
const VTYPE & operator[] (const GPosition &pos) const
VTYPE & operator[] (const GPosition &pos)
int size () const

Protected Types

typedef GCONT MapNode< K, TI > MNode
typedef GCONT SetNode< K > SNode

Protected Member Functions

GPosition contains (const K &key) const
void del (const K &key)
void deletenode (HNode *n)
HNode * hashnode (unsigned int hashcode) const
HNode * installnode (HNode *n)
Associative Maps
These template classes implements a associative maps. The associative map contains an arbitrary number of entries. Each entry is a pair containing one element of type KTYPE# (named the "key") and one element of type VTYPE# (named the "value"). All entries have distinct keys. These template class must be able to access the following functions: {itemize} a VTYPE# default constructor VTYPE::VTYPE()#, a VTYPE# copy constructor VTYPE::VTYPE(const VTYPE &)#, optionally a VTYPE# destructor VTYPE::~VTYPE()#, a KTYPE# default constructor KTYPE::KTYPE()#, a KTYPE# copy constructor KTYPE::KTYPE(const KTYPE &)#, optionally a KTYPE# destructor KTYPE::~KTYPE()#, a KTYPE# comparison operator KTYPE::operator==(const KTYPE &)#, and a KTYPE# hashing function hash(const KTYPE&)#. {itemize} The hashing function must return an unsigned int# number. Multiple invocations of the hashing function with equal arguments (in the sense of KTYPE::operator==#) must always return the same number. Position objects (see {GPosition}) may be used to iterate over the entries contained by an associative map. Associative maps.

HNode * get (const K &key) const
GCONT HNode * get_or_create (const K &key)
HNode * get_or_throw (const K &key) const

Static Protected Member Functions

static GCONT HNode * newnode (const void *key)

Protected Attributes

HNode * first
GPBuffer< HNode * > gtable
int nbuckets
int nelems
HNode ** table
const Traits & traits

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

Generated by  Doxygen 1.6.0   Back to index