Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

PAbstractArray Class Reference

#include <array.h>

Inheritance diagram for PAbstractArray:

PContainer PObject

List of all members.

Detailed Description

This class contains a variable length array of arbitrary memory blocks. These can be anything from individual bytes to large structures. Note that that does { not} include class objects that require construction or destruction. Elements in this array will not execute the contructors or destructors of objects.

An abstract array consists of a linear block of memory sufficient to hold PContainer::GetSize()# elements of elementSize# bytes each. The memory block itself will atuomatically be resized when required and freed when no more references to it are present.

The PAbstractArray class would very rarely be descended from directly by the user. The PBASEARRAY# macro would normally be used to create a class and any new classes descended from that. That will instantiate the template based on PBaseArray# or directly declare and define a class (using inline functions) if templates are not being used.

The PBaseArray# class or PBASEARRAY# macro will define the correctly typed operators for pointer access (operator const T *#) and subscript access (operator[]#).

Definition at line 169 of file array.h.

Comparison functions

virtual Comparison CompareObjectMemoryDirect (const PObject &obj) const
bool operator!= (const PObject &obj) const
bool operator< (const PObject &obj) const
bool operator<= (const PObject &obj) const
bool operator== (const PObject &obj) const
bool operator> (const PObject &obj) const
bool operator>= (const PObject &obj) const
enum  Comparison { LessThan = -1, EqualTo = 0, GreaterThan = 1 }

Run Time Type functions

virtual const char * GetClass (unsigned=0) const
virtual BOOL InternalIsDescendant (const char *clsName) const
BOOL IsClass (const char *cls) const
static const char * Class ()

Public Member Functions

New functions for class
void Attach (const void *buffer, PINDEX bufferSize)
BOOL Concatenate (const PAbstractArray &array)
void * GetPointer (PINDEX minSize=1)
Miscellaneous functions
virtual PObjectClone () const
virtual PINDEX HashFunction () const
Overrides from class PObject
virtual Comparison Compare (const PObject &obj) const
virtual void PrintOn (ostream &strm) const
virtual void ReadFrom (istream &strm)
Common functions for containers
virtual PINDEX GetSize () const
virtual BOOL IsEmpty () const
BOOL IsUnique () const
virtual BOOL MakeUnique ()
BOOL SetMinSize (PINDEX minSize)
 PAbstractArray (PINDEX elementSizeInBytes, const void *buffer, PINDEX bufferSizeInElements, BOOL dynamicAllocation)
 PAbstractArray (PINDEX elementSizeInBytes, PINDEX initialSize=0)
Overrides from class PContainer
virtual BOOL SetSize (PINDEX newSize)

Protected Member Functions

virtual void AssignContents (const PContainer &c)
void CloneContents (const PContainer *src)
void CopyContents (const PContainer &c)
virtual void DestroyContents ()=0
void Destruct ()
BOOL InternalSetSize (PINDEX newSize, BOOL force)
virtual void PrintElementOn (ostream &stream, PINDEX index) const
virtual void ReadElementFrom (istream &stream, PINDEX index)

Protected Attributes

BOOL allocatedDynamically
 Flag indicating the array was allocated on the heap.
PINDEX elementSize
 Size of an element in bytes.
class PContainer::Reference * reference
char * theArray
 Pointer to the allocated block of memory.

Private Member Functions

 PCONTAINERINFO (PAbstractArray, PContainer)


class PArrayObjects
I/O functions
ostream & operator<< (ostream &strm, const PObject &obj)
istream & operator>> (istream &strm, PObject &obj)

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index