All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
array.h File Reference
`#include <ptlib/contain.h>`

Go to the source code of this file.

## Classes

class | PAbstractArray
| This class contains a variable length array of arbitrary memory blocks. More...
class | PBaseArray< T >
| This template class maps the `PAbstractArray` to a specific element type. More...
class | PScalarArray< T >
| This template class maps the `PAbstractArray` to a specific element type. More...
class | PCharArray
| Array of characters. More...
class | PShortArray
| Array of short integers. More...
class | PIntArray
| Array of integers. More...
class | PLongArray
| Array of long integers. More...
class | PBYTEArray
| Array of unsigned characters. More...
class | PWORDArray
| Array of unsigned short integers. More...
class | PUnsignedArray
| Array of unsigned integers. More...
class | PDWORDArray
| Array of unsigned long integers. More...
class | PArrayObjects
| An array of objects. More...
class | PArray< T >
| This template class maps the `PArrayObjects` to a specific object type. More...
class | PBitArray
| This class represents a dynamic bit array. More...

## Macros

#define | PBASEARRAY(cls, T) typedef PBaseArray<T> cls
| Declare a dynamic array base type. More...
#define | PDECLARE_BASEARRAY(cls, T)
| Begin a declaration of an array of base types. More...
#define | PSCALAR_ARRAY(cls, T) typedef PScalarArray<T> cls
| Declare a dynamic array base type. More...
#define | PARRAY(cls, T) typedef PArray<T> cls
| Declare an array to a specific type of object. More...
#define | PDECLARE_ARRAY(cls, T)
| Begin declaration an array to a specific type of object. More...

## Functions

Overrides from class PObject
virtual void | PrintOn (ostream &strm) const
| Print the array. More...
virtual void | ReadFrom (istream &strm)
| Read the array. More...

## Macro Definition Documentation

#define PARRAY | ( |  | cls,
|  |  | T
| ) |  | typedef PArray<T> cls

Declare an array to a specific type of object.

This macro is used to declare a descendent of `PArrayObjects` class, customised for a particular object type T. This macro closes the class declaration off so no additional members can be added.

If the compilation is using templates then this macro produces a typedef of the `PArray` template class.

See the `PBaseArray` class and `PDECLARE_ARRAY` macro for more information.

#define PBASEARRAY | ( |  | cls,
|  |  | T
| ) |  | typedef PBaseArray<T> cls

Declare a dynamic array base type.

This macro is used to declare a descendent of `PAbstractArray` class, customised for a particular element type T. This macro closes the class declaration off so no additional members can be added.

If the compilation is using templates then this macro produces a typedef of the `PBaseArray` template class.

#define PDECLARE_ARRAY | ( |  | cls,
|  |  | T
| ) |  |

Value:
PARRAY(cls##_PTemplate, T); \
PDECLARE_CLASS(cls, cls##_PTemplate) \
protected: \
inline cls(int dummy, const cls * c) \
: cls##_PTemplate(dummy, c) { } \
public: \
inline cls(PINDEX initialSize = 0) \
: cls##_PTemplate(initialSize) { } \
virtual PObject * Clone() const \
{ return PNEW cls(0, this); } \
PDECLARE_CLASS
#define PDECLARE_CLASS(cls, par)
Declare a class with PWLib class information.
Definition: object.h:1106
PARRAY
#define PARRAY(cls, T)
Declare an array to a specific type of object.
Definition: array.h:1084
PObject
Ultimate parent class for all objects in the class library.
Definition: object.h:1118
PNEW
#define PNEW
Macro for overriding system default new operator.
Definition: object.h:890

Begin declaration an array to a specific type of object.

This macro is used to declare a descendent of `PArrayObjects` class, customised for a particular object type T.

If the compilation is using templates then this macro produces a descendent of the `PArray` template class. If templates are not being used then the macro defines a set of inline functions to do all casting of types. The resultant classes have an identical set of functions in either case.

See the `PBaseArray` and `PAbstractArray` classes for more information.

#define PDECLARE_BASEARRAY | ( |  | cls,
|  |  | T
| ) |  |

Value:
PDECLARE_CLASS(cls, PBaseArray<T>) \
cls(PINDEX initialSize = 0) \
: PBaseArray<T>(initialSize) { } \
cls(PContainerReference & reference) \
: PBaseArray<T>(reference) { } \
cls(T const * buffer, PINDEX length, PBoolean dynamic = true) \
: PBaseArray<T>(buffer, length, dynamic) { } \
virtual PObject * Clone() const \
{ return PNEW cls(*this, GetSize()); } \
PBaseArray
This template class maps the PAbstractArray to a specific element type.
Definition: array.h:274
PDECLARE_CLASS
#define PDECLARE_CLASS(cls, par)
Declare a class with PWLib class information.
Definition: object.h:1106
PBoolean
BOOL PBoolean
Definition: object.h:102
PContainerReference
Definition: contain.h:51
PObject
Ultimate parent class for all objects in the class library.
Definition: object.h:1118
PNEW
#define PNEW
Macro for overriding system default new operator.
Definition: object.h:890

Begin a declaration of an array of base types.

This macro is used to declare a descendent of `PAbstractArray` class, customised for a particular element type T.

If the compilation is using templates then this macro produces a descendent of the `PBaseArray` template class. If templates are not being used then the macro defines a set of inline functions to do all casting of types. The resultant classes have an identical set of functions in either case.

See the `PBaseArray` and `PAbstractArray` classes for more information.

#define PSCALAR_ARRAY | ( |  | cls,
|  |  | T
| ) |  | typedef PScalarArray<T> cls

Declare a dynamic array base type.

This macro is used to declare a descendent of `PAbstractArray` class, customised for a particular element type T. This macro closes the class declaration off so no additional members can be added.

If the compilation is using templates then this macro produces a typedef of the `PBaseArray` template class.

## Function Documentation

virtual void PrintOn | ( | ostream & | strm | ) | const

virtual

Print the array.

Parameters

  strm | Stream to output to.

virtual void ReadFrom | ( | istream & | strm | ) |

virtual

Read the array.

Parameters

  strm | Stream to read the objects contents from.