class PAbstractSet

Abstract set of PObjects

Inheritance:


Public Methods

[more] Construction
[more] Overrides from class PCollection


Inherited from PHashTable:

Public Methods

Overrides from class PObject

Protected Methods

Overrides from class PContainer

New functions for class


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

Miscellaneous functions

Public Members

Comparison functions


Documentation

Abstract set of PObjects
o Construction

oPINLINE PAbstractSet()
Create a new, empty, set.

Note that by default, objects placed into the list will be deleted when removed or when all references to the list are destroyed.

o Overrides from class PCollection

ovirtual PINDEX Append( PObject* obj )
Add a new object to the collection. 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.

Parameters:
obj - New object to place into the collection.
Returns:
hash function value of the newly added object.

ovirtual PINDEX Insert( const PObject & before, PObject* obj )
Add a new object to the collection. 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 is always placed in the an ordinal position dependent on its hash function. It is not placed at the specified position. The before parameter is ignored.

Parameters:
before - Object value to insert before.
obj - New object to place into the collection.
Returns:
hash function value of the newly added object.

ovirtual PINDEX InsertAt( PINDEX index, PObject* obj )
Add a new object to the collection. 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 is always placed in the an ordinal position dependent on its hash function. It is not placed at the specified position. The index parameter is ignored.

Parameters:
index - Index position in collection to place the object.
obj - New object to place into the collection.
Returns:
hash function value of the newly added object.

ovirtual BOOL Remove( const PObject* obj )
Remove the object from the collection. If the AllowDeleteObjects option is set then the object is also deleted.

Note that the comparison for searching for the object in collection is made by pointer, not by value. Thus the parameter must point to the same instance of the object that is in the collection.

Parameters:
obj - Existing object to remove from the collection.
Returns:
TRUE if the object was in the collection.

ovirtual PObject* RemoveAt( PINDEX index )
Remove an object at the specified index. If the AllowDeleteObjects option is set then the object is also deleted.

Parameters:
index - Index position in collection to place the object.
Returns:
pointer to the object being removed, or NULL if it was deleted.

ovirtual PObject* GetAt( PINDEX index ) const
This function is the same as PHashTable::AbstractGetKeyAt().

Parameters:
index - Index position in the collection of the object.
Returns:
Always NULL.

ovirtual BOOL SetAt( PINDEX index, PObject* val )
Add a new object to the collection. 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 is always placed in the an ordinal position dependent on its hash function. It is not placed at the specified position. The index parameter is ignored.

Parameters:
index - Index position in collection to set.
val - New value to place into the collection.
Returns:
TRUE if the object was successfully added.

ovirtual PINDEX GetObjectsIndex( const PObject* obj ) const
Search the collection for the specific instance of the object. The object pointers are compared, not the values. The hash table is used to locate the entry.

Note that that will require value comparisons to be made to find the equivalent entry and then a final check is made with the pointers to see if they are the same instance.

Parameters:
obj - Object to find.
Returns:
ordinal index position of the object, or P_MAX_INDEX.

ovirtual PINDEX GetValuesIndex( const PObject & obj ) const
Search the collection for the specified value of the object. 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:
obj - Object to find equal value.
Returns:
ordinal index position of the object, or P_MAX_INDEX.


Direct child classes:
PSet

Alphabetic index HTML hierarchy of classes or Java



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