# PScalarArray< T > Class Template Reference

This template class maps the `PAbstractArray` to a specific element type. More...

`#include <array.h>`

Inheritance diagram for PScalarArray< T >:

List of all members.

## Public Member Functions

Construction
| PScalarArray (PINDEX initialSize=0)
| Construct a new dynamic array of elements of the specified type.
| PScalarArray (T const *buffer, PINDEX length, PBoolean dynamic=true)
| Construct a new dynamic array of elements of the specified type.

## Protected Member Functions

virtual void | ReadElementFrom (istream &stream, PINDEX index)

## Detailed Description

### template<class T>
class PScalarArray< T >

This template class maps the `PAbstractArray` to a specific element type.

The functions in this class primarily do all the appropriate casting of types.

Note that if templates are not used the `PSCALAR_ARRAY` macro will simulate the template instantiation.

The following classes are instantiated automatically for the basic scalar types:

- `PBYTEArray`
- `PShortArray`
- `PWORDArray`
- `PIntArray`
- `PUnsignedArray`
- `PLongArray`
- `PDWORDArray`

## Constructor & Destructor Documentation

template<class T>

PScalarArray< T >::PScalarArray | ( | PINDEX | initialSize = `0` | ) | `[inline]`

Construct a new dynamic array of elements of the specified type.

The array is initialised to all zero bytes. Note that this may not be logically equivalent to the zero value for the type, though this would be very rare.

Parameters:

  initialSize | Initial number of elements in the array.

template<class T>

PScalarArray< T >::PScalarArray | ( | T const * | buffer,
|  | PINDEX | length,
|  | PBoolean | dynamic = `true` |
| ) |  |  | `[inline]`

Construct a new dynamic array of elements of the specified type.

Parameters:

  buffer | Pointer to an array of the elements of type T.
  length | Number of elements pointed to by `buffer`.
  dynamic | Buffer is copied and dynamically allocated.

## Member Function Documentation

template<class T>

virtual void PScalarArray< T >::ReadElementFrom | ( | istream & | stream,
|  | PINDEX | index |
| ) |  |  | `[inline, protected, virtual]`

Reimplemented from PAbstractArray.

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

- array.h