Logo Search packages:      
Sourcecode: djvulibre version File versions

GMapTemplate< KTYPE, VTYPE, TI > Class Template Reference

#include <GContainer.h>

Inheritance diagram for GMapTemplate< KTYPE, VTYPE, TI >:

List of all members.

Detailed Description

template<class KTYPE, class VTYPE, class TI>
class GMapTemplate< KTYPE, VTYPE, TI >

Common base class for all associative maps. Class {GArrayTemplate} implements all methods for manipulating associative maps with key type KTYPE# and value type VTYPE#. You should not however create instances of this class. You should instead use class {GMap} or {GPMap}.

Definition at line 1147 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
int isempty () const
const KTYPE & key (const GPosition &pos) const
VTYPE * next (GPosition &pos)
const VTYPE * next (GPosition &pos) const
 operator GPosition () const
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