#include <dict.h>
Public Member Functions | |
Construction | |
PSet (PBoolean initialDeleteObjects=PFalse) | |
Overrides from class PObject | |
virtual PObject * | Clone () const |
New functions for class | |
void | Include (const T *obj) |
PSet & | operator+= (const T &obj) |
void | Exclude (const T *obj) |
PSet & | operator-= (const T &obj) |
PBoolean | Contains (const T &key) const |
PBoolean | operator[] (const T &key) const |
virtual const T & | GetKeyAt (PINDEX index) const |
Protected Member Functions | |
PSet (int dummy, const PSet *c) |
This template class maps the PAbstractSet to a specific object type. The functions in this class primarily do all the appropriate casting of types.
By default, objects placed into the set will not be deleted when removed or when all references to the set are destroyed. This is different from the default on most collection classes.
Note that if templates are not used the PDECLARE_SET macro will simulate the template instantiation.
Create a new, empty, dictionary. The parameter indicates whether to delete objects that are removed from the set.
Note that by default, objects placed into the set will not be deleted when removed or when all references to the set are destroyed. This is different from the default on most collection classes.
References PCollection::AllowDeleteObjects().
Referenced by PSet< T >::Clone().
References PContainerReference::deleteObjects, and PContainer::reference.
Make a complete duplicate of the set. Note that all objects in the array are also cloned, so this will make a complete copy of the set.
Reimplemented from PObject.
References PNEW, and PSet< T >::PSet().
Determine if the value of the object is contained in the set. The object values are compared, not the pointers. So the objects in the collection must correctly implement the PObject::Compare() function. The hash table is used to locate the entry.
key | Key to look for in the set. |
References PHashTable::AbstractContains().
void PSet< T >::Exclude | ( | const T * | obj | ) | [inline] |
Remove the object from the set. If the AllowDeleteObjects option is set then the object is also deleted.
The object values are compared, not the pointers. So the objects in the collection must correctly implement the PObject::Compare() function. The hash table is used to locate the entry.
References PAbstractSet::Remove().
virtual const T& PSet< T >::GetKeyAt | ( | PINDEX | index | ) | const [inline, virtual] |
Get the key in the set at the ordinal index position.
The ordinal position in the set is determined by the hash values of the keys and the order of insertion.
The last key/data pair is remembered by the class so that subseqent access is very fast.
index | Index of value to get. |
References PHashTable::AbstractGetKeyAt().
void PSet< T >::Include | ( | const T * | obj | ) | [inline] |
Include the specified object into the set. If the objects value is already in the set then the object is not included. If the AllowDeleteObjects option is set then the obj
parameter is also deleted.
The object values are compared, not the pointers. So the objects in the collection must correctly implement the PObject::Compare() function. The hash table is used to locate the entry.
References PAbstractSet::Append().
Include the specified objects value into the set. If the objects value is already in the set then the object is not included.
The object values are compared, not the pointers. So the objects in the collection must correctly implement the PObject::Compare() function. The hash table is used to locate the entry.
References PAbstractSet::Append().
Remove the objects value from the set. If the AllowDeleteObjects option is set then the object is also deleted.
The object values are compared, not the pointers. So the objects in the collection must correctly implement the PObject::Compare() function. The hash table is used to locate the entry.
References PAbstractSet::GetValuesIndex(), and PAbstractSet::RemoveAt().
Determine if the value of the object is contained in the set. The object values are compared, not the pointers. So the objects in the collection must correctly implement the PObject::Compare() function. The hash table is used to locate the entry.
key | Key to look for in the set. |
References PHashTable::AbstractContains().