Logo Search packages:      
Sourcecode: djvulibre version File versions  Download package

GPMap< KTYPE, VTYPE > Class Template Reference

#include <GContainer.h>

Inheritance diagram for GPMap< KTYPE, VTYPE >:

GMapTemplate< KTYPE, GP< VTYPE >, GPBase >

List of all members.

Detailed Description

template<class KTYPE, class VTYPE>
class GPMap< KTYPE, VTYPE >

Associative maps for smart-pointers. Template class GMap<KTYPE,VTYPE># implements an associative map for key type KTYPE# and value type GP<VTYPE># (see {GSmartPointer.h}). The map contains an arbitrary number of entries. Each entry is a pair containing one element of type KTYPE# (named the "key") and one aelement of type VTYPE# (named the "value"). The entry associated to a particular value of the key can retrieved very efficiently. Significantly smaller code sizes can be achieved by using this class instead of the more general GMap<KTYPE,GP<VTYPE>># (see {GMap}). This class only implement constructors. See class {GMapTemplate} and {GPosition} for a description of all access methods.

Definition at line 1260 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
GP< VTYPE > * next (GPosition &pos)
const GP< VTYPE > * next (GPosition &pos) const
 operator GPosition () const
GPMapoperator= (const GPMap &r)
GP< VTYPE > & operator[] (const KTYPE &key)
const GP< VTYPE > & operator[] (const KTYPE &key) const
const GP< VTYPE > & operator[] (const GPosition &pos) const
GP< 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