dictionary< kind > Class Template Reference

Keyed collection of objects. More...

#include <dictionary.h>

Collaboration diagram for dictionary< kind >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void clear (void)
kind & operator[] (const statstring &st)
kind & operator[] (const string &st)
kind & operator[] (const char *st)
kind & operator[] (int index)
kind * visitchild (int index)
void set (const statstring &id, kind *to)
void set (const statstring &id, kind &to)
bool exists (const statstring &s)
int count (void)

Protected Member Functions

dictionaryEntrynewentry (const statstring &id, bool alloc=true)
dictionaryEntrydemand (const statstring &s, bool alloc=true)
void remove (const statstring &s)
dictionaryEntrydemand (unsigned int key, bool alloc=true)

Protected Attributes

class dictionaryEntry ** _array
int _arraysz
int _count

Detailed Description

template<class kind>
class dictionary< kind >

Keyed collection of objects.

Keeps an indexed collection of objects, using string keys.


Member Function Documentation

template<class kind>
int dictionary< kind >::count ( void   )  [inline]

Get item count.

Returns:
Number of objects in the dictionary.

Referenced by dbfile::commit(), stringdict::count(), and dbrecord::operator[]().

template<class kind>
dictionaryEntry* dictionary< kind >::demand ( unsigned int  key,
bool  alloc = true 
) [inline, protected]

Look up an entry in the dictionary by its numeric key.

Parameters:
key The object's numeric key.
alloc If false, no new objects will be allocated.
Returns:
Pointer to the dictionaryObject associated with the key.
template<class kind>
dictionaryEntry* dictionary< kind >::demand ( const statstring s,
bool  alloc = true 
) [inline, protected]

Look up an entry in the dictionary.

Parameters:
s The object's key.
alloc If false, no new objects will be allocated.
Returns:
Pointer to the dictionaryObject associated with the key.

Referenced by dictionary< dbrecord >::operator[](), and dictionary< dbrecord >::set().

template<class kind>
bool dictionary< kind >::exists ( const statstring s  )  [inline]

Check the dictionary for a key.

Parameters:
s The key.
Returns:
Result, true if the key is in the dictionary.

Referenced by stringdict::get(), dbrecord::operator[](), httpdfileshare::run(), and httpdscriptparser::run().

template<class kind>
dictionaryEntry* dictionary< kind >::newentry ( const statstring id,
bool  alloc = true 
) [inline, protected]

Adds a new entry to the array (without linking it into the tree).

Parameters:
id The object's key.
alloc If false, no new objects will be allocated - OBSOLETE.
Returns:
Pointer to the new dictionaryEntry object which can contain a pointer to the element object.

Referenced by dictionary< dbrecord >::demand().

template<class kind>
kind& dictionary< kind >::operator[] ( int  index  )  [inline]

Array access.

Looks up an entry by array index.

Parameters:
idnex The entry's index.).
Returns:
Reference to the object.
template<class kind>
kind& dictionary< kind >::operator[] ( const char *  st  )  [inline]

Array access.

Looks up an entry by key.

Parameters:
st The entry's key.
Returns:
Reference to the object.
template<class kind>
kind& dictionary< kind >::operator[] ( const string st  )  [inline]

Array access.

Looks up an entry by key.

Parameters:
st The entry's key.
Returns:
Reference to the object.
template<class kind>
kind& dictionary< kind >::operator[] ( const statstring st  )  [inline]

Array access.

Looks up an entry by key.

Parameters:
st The entry's key.
Returns:
Reference to the object.
template<class kind>
void dictionary< kind >::set ( const statstring id,
kind *  to 
) [inline]

Associate an object with a key.

Parameters:
id The key for the object.
to Pointer to the object.

Referenced by dbrecord::operator[]().


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

Generated on Sun Feb 28 10:35:34 2010 for GRACE by  doxygen 1.6.1