98 virtual void PrintOn(ostream & strm)
const;
105 PINLINE operator PINDEX()
const;
155 virtual ~PHashTableInfo() { Destruct(); }
156 virtual void DestroyContents();
430 const PAbstractSet & set
437 const PAbstractSet & set1,
438 const PAbstractSet & set2,
439 PAbstractSet * intersection = NULL
506 ) {
Append(obj.Clone());
return *
this; }
590 #define PSET(cls, T) typedef PSet<T> cls
604 #define PDECLARE_SET(cls, T, initDelObj) \
605 class cls : public PSet<T> { \
606 typedef PSet<T> BaseClass; PCLASSINFO(cls, BaseClass) \
608 cls(int dummy, const cls * c) \
609 : BaseClass(dummy, c) { } \
611 cls(PBoolean initialDeleteObjects = initDelObj) \
612 : BaseClass(initialDeleteObjects) { } \
613 virtual PObject * Clone() const \
614 { return PNEW cls(0, this); } \
814 virtual PINDEX Append(
1004 #define PDICTIONARY(cls, K, D) typedef PDictionary<K, D> cls
1019 #define PDECLARE_DICTIONARY(cls, K, D) \
1020 PDICTIONARY(cls##_PTemplate, K, D); \
1021 PDECLARE_CLASS(cls, cls##_PTemplate) \
1023 cls(int dummy, const cls * c) \
1024 : cls##_PTemplate(dummy, c) { } \
1027 : cls##_PTemplate() { } \
1028 virtual PObject * Clone() const \
1029 { return PNEW cls(0, this); } \
1197 #define PORDINAL_DICTIONARY(cls, K) typedef POrdinalDictionary<K> cls
1214 #define PDECLARE_ORDINAL_DICTIONARY(cls, K) \
1215 PORDINAL_DICTIONARY(cls##_PTemplate, K); \
1216 PDECLARE_CLASS(cls, POrdinalDictionary<K>) \
1218 cls(int dummy, const cls * c) \
1219 : cls##_PTemplate(dummy, c) { } \
1222 : cls##_PTemplate() { } \
1223 virtual PObject * Clone() const \
1224 { return PNEW cls(0, this); } \
1227 #endif // PTLIB_DICT_H
PINLINE PBoolean AbstractContains(const PObject &key) const
Determine if the value of the object is contained in the hash table.
virtual const T & GetKeyAt(PINDEX index) const
Get the key in the set at the ordinal index position.
Definition: dict.h:565
virtual POrdinalKey * GetAt(const K &key) const
Definition: dict.h:1095
virtual PINDEX GetObjectsIndex(const PObject *obj) const
Search the collection for the specific instance of the object.
void Include(const T *obj)
Include the specified object into the set.
Definition: dict.h:493
PHashTable()
Create a new, empty, hash table.
virtual PBoolean SetAt(PINDEX index, PObject *val)
Set the object at the specified index to the new value.
bool Union(const PAbstractSet &set)
Calculate union of sets.
const K & GetKeyAt(PINDEX index) const
Get the key in the dictionary at the ordinal index position.
Definition: dict.h:1157
PINDEX GetElementsIndex(const PObject *obj, PBoolean byVal, PBoolean keys) const
virtual void PrintOn(ostream &strm) const
Output the contents of the object to the stream.
An array of objects.
Definition: array.h:813
D & operator[](const K &key) const
Get the object contained in the dictionary at the key position.
Definition: dict.h:881
virtual PINDEX InsertAt(PINDEX index, PObject *obj)
Add a new object to the collection.
virtual PBoolean SetAt(const K &key, PINDEX ordinal)
Add a new object to the collection.
Definition: dict.h:1129
virtual PINDEX RemoveAt(const K &key)
Remove an object at the specified key.
Definition: dict.h:1142
PObject * data
Definition: dict.h:143
PSet(int dummy, const PSet *c)
Definition: dict.h:573
PBoolean SetLastElementAt(PINDEX index, PHashTableElement *&lastElement)
virtual Comparison Compare(const PObject &obj) const
Compare the two objects and return their relative rank.
virtual PBoolean SetAt(PINDEX index, PObject *val)
Add a new object to the collection.
PBoolean Contains(const K &key) const
Determine if the value of the object is contained in the hash table.
Definition: dict.h:1091
PINLINE void AllowDeleteObjects(PBoolean yes=true)
Allow or disallow the deletion of the objects contained in the collection.
virtual PINDEX GetValuesIndex(const PObject &obj) const
Search the collection for the specified value of the object.
POrdinalDictionary()
Create a new, empty, dictionary.
Definition: dict.h:1052
virtual PObject * Clone() const
Make a complete duplicate of the dictionary.
Definition: dict.h:1062
PINLINE POrdinalKey(PINDEX newKey=0)
Create a new key for ordinal index values.
This template class maps the PAbstractDictionary to a specific key and data types.
Definition: dict.h:842
virtual PINDEX HashFunction() const
This function calculates a hash table index value for the implementation of PSet and PDictionary clas...
PHashTableElement * prev
Definition: dict.h:145
#define PINLINE
Definition: object.h:127
PINDEX AppendElement(PObject *key, PObject *data)
Comparison
Result of the comparison operation performed by the Compare() function.
Definition: object.h:1184
virtual PINDEX GetObjectsIndex(const PObject *obj) const
Search the collection for the specific instance of the object.
virtual PINDEX Append(PObject *obj)
Add a new object to the collection.
PINLINE PAbstractDictionary()
Create a new, empty, dictionary.
An abstract dictionary container.
Definition: dict.h:626
PINLINE PINDEX operator--()
Operator to pre-decrement the ordinal.
PINLINE POrdinalKey & operator-=(PINDEX)
Operator to subtract from the ordinal.
PHashTableElement Element
Definition: dict.h:166
virtual PObject * GetAt(PINDEX index) const
This function is the same as PHashTable::AbstractGetKeyAt().
PINDEX operator[](const K &key) const
Get the object contained in the dictionary at the key position.
Definition: dict.h:1078
virtual void AbstractGetKeys(PArrayObjects &keys) const
Get an array containing all the keys for the dictionary.
virtual PINDEX GetValuesIndex(const PObject &obj) const
Search the collection for the specified value of the object.
PHashTableElement Element
Definition: dict.h:277
virtual Comparison Compare(const PObject &obj) const
Get the relative rank of the two hash tables.
PHashTableInfo Table
Definition: dict.h:278
PBoolean Contains(const T &key) const
Determine if the value of the object is contained in the set.
Definition: dict.h:538
BOOL PBoolean
Definition: object.h:102
virtual PBoolean AbstractSetAt(const PObject &key, PObject *obj)
Add a new object to the collection.
PObject * key
Definition: dict.h:142
virtual PBoolean SetSize(PINDEX newSize)
This function is meaningless for hash table.
POrdinalDictionary(int dummy, const POrdinalDictionary *c)
Definition: dict.h:1180
PBoolean operator[](const T &key) const
Determine if the value of the object is contained in the set.
Definition: dict.h:550
virtual PObject * Clone() const
Make a complete duplicate of the set.
Definition: dict.h:478
PDictionary(int dummy, const PDictionary *c)
Definition: dict.h:987
virtual void PrintOn(ostream &strm) const
Output the ordinal index to the specified stream.
Abstract set of PObjects.
Definition: dict.h:287
virtual PObject * AbstractGetAt(const PObject &key) const
Get the object at the specified key position.
virtual PBoolean SetDataAt(PINDEX index, PObject *obj)
Set the data at the specified ordinal index position in the dictionary.
D & GetDataAt(PINDEX index) const
Get the data in the dictionary at the ordinal index position.
Definition: dict.h:969
PINLINE PINDEX operator++()
Operator to pre-increment the ordinal.
PBoolean Contains(const K &key) const
Determine if the value of the object is contained in the hash table.
Definition: dict.h:894
#define PDECLARE_BASEARRAY(cls, T)
Begin a declaration of an array of base types.
Definition: array.h:474
This template class maps the PAbstractSet to a specific object type.
Definition: dict.h:455
#define PDECLARE_SET(cls, T, initDelObj)
Begin declaration of a set class.
Definition: dict.h:604
virtual D * GetAt(const K &key) const
Get the object at the specified key position.
Definition: dict.h:938
virtual PINDEX Insert(const PObject &before, PObject *obj)
Add a new object to the collection.
The hash table class is the basis for implementing the PSet and PDictionary classes.
Definition: dict.h:182
bool deleteObjects
Definition: contain.h:72
PSet & operator+=(const T &obj)
Include the specified objects value into the set.
Definition: dict.h:504
virtual PINDEX Insert(const PObject &key, PObject *obj)
Insert a new object into the dictionary.
virtual PObject * RemoveAt(PINDEX index)
Remove an object at the specified index.
static bool Intersection(const PAbstractSet &set1, const PAbstractSet &set2, PAbstractSet *intersection=NULL)
Calculate intersection of sets.
virtual PINDEX InsertAt(PINDEX index, PObject *obj)
Insert a new object at the specified index.
std::pair< K, D * > value_type
Definition: dict.h:984
virtual PObject * GetAt(PINDEX index) const
Get the object at the specified index position.
void Exclude(const T *obj)
Remove the object from the set.
Definition: dict.h:515
PSet & operator-=(const T &obj)
Remove the objects value from the set.
Definition: dict.h:526
virtual PObject * Clone() const
Create a duplicate of the POrdinalKey.
PSet(PBoolean initialDeleteObjects=false)
Create a new, empty, dictionary.
Definition: dict.h:469
PBoolean deleteKeys
Definition: dict.h:164
virtual PObject & GetRefAt(const PObject &key) const
Get the object at the specified key position.
PHashTableElement * GetElementAt(const PObject &key)
virtual const PObject & AbstractGetKeyAt(PINDEX index) const
Get the key in the hash table at the ordinal index position.
PINLINE POrdinalKey & operator+=(PINDEX)
Operator to add the ordinal.
virtual PBoolean SetAt(const K &key, D *obj)
Add a new object to the collection.
Definition: dict.h:927
This template class maps the PArrayObjects to a specific object type.
Definition: array.h:1024
const K & GetKeyAt(PINDEX index) const
Get the key in the dictionary at the ordinal index position.
Definition: dict.h:953
PINLINE POrdinalKey & operator=(PINDEX)
Operator to assign the ordinal.
virtual PObject * RemoveAt(PINDEX index)
Remove an object at the specified index.
virtual PBoolean SetDataAt(PINDEX index, PINDEX ordinal)
Set the data at the specified ordinal index position in the dictionary.
Definition: dict.h:1113
virtual D * RemoveAt(const K &key)
Remove an object at the specified key.
Definition: dict.h:909
virtual PBoolean Remove(const PObject *obj)
Remove the object from the collection.
PDECLARE_POOL_ALLOCATOR()
PINLINE PAbstractSet()
Create a new, empty, set.
PINDEX GetDataAt(PINDEX index) const
Get the data in the dictionary at the ordinal index position.
Definition: dict.h:1173
PContainerReference * reference
Definition: contain.h:291
virtual PObject & AbstractGetDataAt(PINDEX index) const
Get the data in the hash table at the ordinal index position.
PObject * RemoveElement(const PObject &key)
This template class maps the PAbstractDictionary to a specific key type and a POrdinalKey data type...
Definition: dict.h:1039
Ultimate parent class for all objects in the class library.
Definition: object.h:1118
A collection is a container that collects together descendents of the PObject class.
Definition: contain.h:395
virtual PObject * Clone() const
Make a complete duplicate of the dictionary.
Definition: dict.h:865
PDictionary()
Create a new, empty, dictionary.
Definition: dict.h:855
PHashTableElement * next
Definition: dict.h:144
PArray< K > GetKeys() const
Get an array containing all the keys for the dictionary.
Definition: dict.h:976
PHashTableInfo * hashTable
Definition: dict.h:279
#define PNEW
Macro for overriding system default new operator.
Definition: object.h:890
This class is used when an ordinal index value is the key for PSet and PDictionary classes...
Definition: dict.h:50