An array of objects.
![]() | Construction |
![]() | Overrides from class PObject |
![]() | Overrides from class PContainer |
![]() | Overrides from class PCollection |
Common functions for collections
Common functions for containers
Run Time Type functions
Comparison functions
I/O functions
Miscellaneous functions
An array of objects. This class is a collection of objects which are descendents of the PObject class. It is implemeted as a dynamic, linear array of pointers to the objects.The implementation of an array allows very fast random access to items in the collection, but has severe penalties for inserting and deleting objects as all other objects must be moved to accommodate the change.
An array of objects may have "gaps" in it. These are array entries that contain NULL as the object pointer.
The PArrayObjects class would very rarely be descended from directly by the user. The PARRAY macro would normally be used to create a class. That will instantiate the template based on PArray or directly declare and define the class (using inline functions) if templates are not being used.
The PArray class or PARRAY macro will define the correctly typed operators for pointer access (operator const T *) and subscript access (operator[]).
Note that by default, objects placed into the list will be deleted when removed or when all references to the list are destroyed.
This is also returned if all objects are equal and the instances array length is less than the obj parameters array length.
This is also returned if all objects are equal and the instances array length is greater than the obj parameters array length.
virtual BOOL SetSize( PINDEX newSize )
All objects, including the before object are shifted up
one in the array. Note that the object values are compared for the search of the
before parameter, not the pointers. So the objects in the
collection must correctly implement the PObject::Compare()
function.
All objects, including the
shifted up one in the array.
All objects are shifted down to fill the vacated position.
All objects are shifted down to fill the vacated position. Note if the index is beyond the size of the collection then the
function will assert.
The objects are removed from the last, at index
(GetSize()-1) toward the first at index zero.
virtual PINDEX Insert( const PObject & before, PObject * obj )
obj - New object to place into the collection.virtual PINDEX InsertAt( PINDEX index, PObject * obj )
obj - New object to place into the collection.virtual BOOL Remove( const PObject * obj )
virtual PObject* RemoveAt( PINDEX index )
virtual BOOL SetAt( PINDEX index, PObject * val )
val - New value to place into the collection.virtual PObject* GetAt( PINDEX index ) const
virtual PINDEX GetObjectsIndex( const PObject * obj ) const
virtual PINDEX GetValuesIndex( const PObject & obj ) const
virtual void RemoveAll()
Alphabetic index HTML hierarchy of classes or Java