template<class T> class PSet

This template class maps the PAbstractSet to a specific object type.

Inheritance:


Public Methods

[more] Construction
[more] Overrides from class PObject
[more] New functions for class


Inherited from PAbstractSet:

Public Methods

Overrides from class PCollection


Inherited from PHashTable:

Protected Methods

Overrides from class PContainer


Inherited from PCollection:

Public Methods

Common functions for collections


Inherited from PContainer:

Public Methods

Common functions for containers

Protected Methods

ovirtual void DestroyContents()
ovirtual void AssignContents(const PContainer & c)
ovoid CopyContents(const PContainer & c)
ovoid CloneContents(const PContainer* src)
ovoid Destruct()


Inherited from PObject:

Public Methods

Run Time Type functions

I/O functions

Public Members

Comparison functions


Documentation

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.

o Construction

oinline PSet(BOOL initialDeleteObjects = FALSE)
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.

o Overrides from class PObject

ovirtual PObject* Clone() const
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.

o New functions for class

ovoid Include( const T* obj )
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.

oPSet& operator+=( const T & obj )
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.

ovoid Exclude( const T* obj )
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.

oPSet& operator-=( const T & obj )
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.

oBOOL Contains( const T & key ) const
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.

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

oBOOL operator[]( const T & key ) const
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.

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

ovirtual const T& GetKeyAt( PINDEX index ) const
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.

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


Direct child classes:
PStringSet

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.