dict.h File Reference
`#include <ptlib/array.h>`

Go to the source code of this file.

## Classes

class | POrdinalKey
| This class is used when an ordinal index value is the key for `PSet` and `PDictionary` classes. More...
struct | PHashTableElement
class | PHashTable
| The hash table class is the basis for implementing the `PSet` and `PDictionary` classes. More...
class | PAbstractSet
| Abstract set of PObjects. More...
class | PSet< T >
| This template class maps the `PAbstractSet` to a specific object type. More...
class | PAbstractDictionary
| An abstract dictionary container. More...
class | PDictionary< K, D >
| This template class maps the `PAbstractDictionary` to a specific key and data types. More...
class | POrdinalDictionary< K >
| This template class maps the `PAbstractDictionary` to a specific key type and a `POrdinalKey` data type. More...

## Macros

#define | PSET(cls, T) typedef PSet<T> cls
| Declare set class. More...
#define | PDECLARE_SET(cls, T, initDelObj)
| Begin declaration of a set class. More...
#define | PDICTIONARY(cls, K, D) typedef PDictionary<K, D> cls
| Declare a dictionary class. More...
#define | PDECLARE_DICTIONARY(cls, K, D)
| Begin declaration of dictionary class. More...
#define | PORDINAL_DICTIONARY(cls, K) typedef POrdinalDictionary<K> cls
| Declare an ordinal dictionary class. More...
#define | PDECLARE_ORDINAL_DICTIONARY(cls, K)
| Begin declaration of an ordinal dictionary class. More...

## Typedefs

typedef PHashTableElement | Element

## Functions

PINDEX | AppendElement (PObject *key, PObject *data)
PObject * | RemoveElement (const PObject &key)
PBoolean | SetLastElementAt (PINDEX index, PHashTableElement *&lastElement)
PHashTableElement * | GetElementAt (const PObject &key)
PINDEX | GetElementsIndex (const PObject *obj, PBoolean byVal, PBoolean keys) const

## Variables

PBoolean | deleteKeys

## Macro Definition Documentation

## PDECLARE_DICTIONARY

#define PDECLARE_DICTIONARY | ( |  | cls,
|  |  | K,
|  |  | D
| ) |  |

Value:
PDICTIONARY(cls##_PTemplate, K, D); \
PDECLARE_CLASS(cls, cls##_PTemplate) \
protected: \
cls(int dummy, const cls * c) \
: cls##_PTemplate(dummy, c) { } \
public: \
cls() \
: cls##_PTemplate() { } \
virtual PObject * Clone() const \
{ return PNEW cls(0, this); } \
PDICTIONARY
#define PDICTIONARY(cls, K, D)
Declare a dictionary class.
Definition: dict.h:1004
PObject
Ultimate parent class for all objects in the class library.
Definition: object.h:1118
PNEW
#define PNEW
Macro for overriding system default new operator.
Definition: object.h:890

Begin declaration of dictionary class.

This macro is used to declare a descendent of PAbstractDictionary class, customised for a particular key type K and data object type D.

If the compilation is using templates then this macro produces a descendent of the `PDictionary` template class. If templates are not being used then the macro defines a set of inline functions to do all casting of types. The resultant classes have an identical set of functions in either case.

See the `PDictionary` and `PAbstractDictionary` classes for more information.

## PDECLARE_ORDINAL_DICTIONARY

#define PDECLARE_ORDINAL_DICTIONARY | ( |  | cls,
|  |  | K
| ) |  |

Value:
PORDINAL_DICTIONARY(cls##_PTemplate, K); \
PDECLARE_CLASS(cls, POrdinalDictionary<K>) \
protected: \
cls(int dummy, const cls * c) \
: cls##_PTemplate(dummy, c) { } \
public: \
cls() \
: cls##_PTemplate() { } \
virtual PObject * Clone() const \
{ return PNEW cls(0, this); } \
PORDINAL_DICTIONARY
#define PORDINAL_DICTIONARY(cls, K)
Declare an ordinal dictionary class.
Definition: dict.h:1197
POrdinalDictionary
This template class maps the PAbstractDictionary to a specific key type and a POrdinalKey data type...
Definition: dict.h:1039
PObject
Ultimate parent class for all objects in the class library.
Definition: object.h:1118
PNEW
#define PNEW
Macro for overriding system default new operator.
Definition: object.h:890

Begin declaration of an ordinal dictionary class.

This macro is used to declare a descendent of PAbstractList class, customised for a particular key type K and data object type of `POrdinalKey`.

If the compilation is using templates then this macro produces a descendent of the `POrdinalDictionary` template class. If templates are not being used then the macro defines a set of inline functions to do all casting of types. The resultant classes have an identical set of functions in either case.

See the `POrdinalDictionary` and `PAbstractDictionary` classes for more information.

## PDECLARE_SET

#define PDECLARE_SET | ( |  | cls,
|  |  | T,
|  |  | initDelObj
| ) |  |

Value:
class cls : public PSet<T> { \
typedef PSet<T> BaseClass; PCLASSINFO(cls, BaseClass) \
protected: \
cls(int dummy, const cls * c) \
: BaseClass(dummy, c) { } \
public: \
cls(PBoolean initialDeleteObjects = initDelObj) \
: BaseClass(initialDeleteObjects) { } \
virtual PObject * Clone() const \
{ return PNEW cls(0, this); } \
PSet::Clone
virtual PObject * Clone() const
Make a complete duplicate of the set.
Definition: dict.h:478
PCLASSINFO
#define PCLASSINFO(cls, par)
Declare all the standard PTLib class information.
Definition: object.h:1049
PBoolean
BOOL PBoolean
Definition: object.h:102
PSet
This template class maps the PAbstractSet to a specific object type.
Definition: dict.h:455
PObject
Ultimate parent class for all objects in the class library.
Definition: object.h:1118
PNEW
#define PNEW
Macro for overriding system default new operator.
Definition: object.h:890

Begin declaration of a set class.

This macro is used to declare a descendent of `PAbstractSet` class, customised for a particular object type T.

If the compilation is using templates then this macro produces a descendent of the `PSet` template class. If templates are not being used then the macro defines a set of inline functions to do all casting of types. The resultant classes have an identical set of functions in either case.

See the `PSet` and `PAbstractSet` classes for more information.

## PDICTIONARY

#define PDICTIONARY | ( |  | cls,
|  |  | K,
|  |  | D
| ) |  | typedef PDictionary<K, D> cls

Declare a dictionary class.

This macro is used to declare a descendent of PAbstractDictionary class, customised for a particular key type K and data object type D. This macro closes the class declaration off so no additional members can be added.

If the compilation is using templates then this macro produces a typedef of the `PDictionary` template class.

See the `PDictionary` class and `PDECLARE_DICTIONARY` macro for more information.

## PORDINAL_DICTIONARY

#define PORDINAL_DICTIONARY | ( |  | cls,
|  |  | K
| ) |  | typedef POrdinalDictionary<K> cls

Declare an ordinal dictionary class.

This macro is used to declare a descendent of PAbstractDictionary class, customised for a particular key type K and data object type of `POrdinalKey`. This macro closes the class declaration off so no additional members can be added.

If the compilation is using templates then this macro produces a typedef of the `POrdinalDictionary` template class.

See the `POrdinalDictionary` class and `PDECLARE_ORDINAL_DICTIONARY` macro for more information.

## PSET

#define PSET | ( |  | cls,
|  |  | T
| ) |  | typedef PSet<T> cls

Declare set class.

This macro is used to declare a descendent of `PAbstractSet` class, customised for a particular object type T. This macro closes the class declaration off so no additional members can be added.

If the compilation is using templates then this macro produces a typedef of the `PSet` template class.

See the `PSet` class and `PDECLARE_SET` macro for more information.

## Typedef Documentation

## Element

typedef PHashTableElement Element

## Function Documentation

## AppendElement()

PINDEX AppendElement | ( | PObject * | key,
|  | PObject * | data
| ) |  |

## GetElementAt()

PHashTableElement* GetElementAt | ( | const PObject & | key | ) |

## GetElementsIndex()

PINDEX GetElementsIndex | ( | const PObject * | obj,
|  | PBoolean | byVal,
|  | PBoolean | keys
| ) |  | const

## RemoveElement()

PObject* RemoveElement | ( | const PObject & | key | ) |

## SetLastElementAt()

PBoolean SetLastElementAt | ( | PINDEX | index,
|  | PHashTableElement *& | lastElement
| ) |  |

## Variable Documentation

## deleteKeys

PBoolean deleteKeys