PSet< T > Class Template Reference

#include <dict.h>

Inheritance diagram for PSet< T >:

PAbstractSet PHashTable PCollection PContainer PObject PStringSet List of all members.

Public Member Functions

Overrides from class PObject
virtual PObjectClone () const
New functions for class
void Include (const T *obj)
PSetoperator+= (const T &obj)
void Exclude (const T *obj)
PSetoperator-= (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)

Detailed Description

template<class T>
class PSet< T >

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.


Constructor & Destructor Documentation

template<class T>
PSet< T >::PSet ( PBoolean  initialDeleteObjects = PFalse  )  [inline]

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.

template<class T>
PSet< T >::PSet ( int  dummy,
const PSet< T > *  c 
) [inline, protected]

template<class T>
PSet< T >::PSet ( PBoolean  initialDeleteObjects = PFalse  )  [inline]

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.


Member Function Documentation

template<class T>
virtual PObject* PSet< T >::Clone (  )  const [inline, virtual]

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.

template<class T>
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.

template<class T>
PSet& PSet< T >::operator+= ( const T &  obj  )  [inline]

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.

template<class T>
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.

template<class T>
PSet& PSet< T >::operator-= ( const T &  obj  )  [inline]

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.

template<class T>
PBoolean PSet< T >::Contains ( const T &  key  )  const [inline]

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.

Returns:
PTrue if the object value is in the set.
Parameters:
key  Key to look for in the set.

template<class T>
PBoolean PSet< T >::operator[] ( const T &  key  )  const [inline]

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.

Returns:
PTrue if the object value is in the set.
Parameters:
key  Key to look for in the set.

template<class T>
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.

Returns:
reference to key at the index position.
Parameters:
index  Index of value to get.


The documentation for this class was generated from the following file:
Generated on Mon Sep 15 01:21:38 2008 for PTLib by  doxygen 1.5.1