csPDelArray< T, MemoryAllocator, CapacityHandler > Class Template Reference (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions
csPDelArray< T, MemoryAllocator, CapacityHandler > Class Template Reference

An array of pointers. More...

`#include <csutil/parray.h>`

Inheritance diagram for csPDelArray< T, MemoryAllocator, CapacityHandler >:

List of all members.

## Public Member Functions
| csPDelArray (size_t ilimit=0, const CapacityHandler &ch=CapacityHandler())
| Initialize object to hold initially 'ilimit' elements, and increase storage by 'ithreshold' each time the upper bound is exceeded.
T * | Extract (size_t n)
| Extract element number 'n' from vector.
T * | GetAndClear (size_t n)
| Get and clear the element 'n' from vector.
T * | Pop ()
| Pop an element from tail end of array.
void | SetSize (size_t n)
| Set the actual number of items in this array.
void | SetSize (size_t n, T const &what)
| Variant of SetLength() which copies the pointed-to object instead of the actual pointer.

## Detailed Description

### template<class T, class MemoryAllocator = CS::Container::ArrayAllocDefault, class CapacityHandler = csArrayCapacityFixedGrow<16>>
class csPDelArray< T, MemoryAllocator, CapacityHandler >

An array of pointers.

No ref counting is done on the elements in this array. Use csRefArray if you want ref counting to happen. This array will delete elements (using 'delete') as needed. This array properly initializes new elements in the array to 0 (the NULL pointer).

Definition at line 66 of file parray.h.

## Constructor & Destructor Documentation

template<class T, class MemoryAllocator = CS::Container::ArrayAllocDefault, class CapacityHandler = csArrayCapacityFixedGrow<16>>

csPDelArray< T, MemoryAllocator, CapacityHandler >::csPDelArray | ( | size_t | ilimit = `0`,
|  | const CapacityHandler & | ch = `CapacityHandler()`
| ) |  | `[inline]`

Initialize object to hold initially 'ilimit' elements, and increase storage by 'ithreshold' each time the upper bound is exceeded.

Definition at line 82 of file parray.h.

## Member Function Documentation

template<class T, class MemoryAllocator = CS::Container::ArrayAllocDefault, class CapacityHandler = csArrayCapacityFixedGrow<16>>

T* csPDelArray< T, MemoryAllocator, CapacityHandler >::Extract | ( | size_t | n | ) | `[inline]`

Extract element number 'n' from vector.

The element is deleted from the array and returned. You are responsible for deleting the pointer later.

Definition at line 103 of file parray.h.

template<class T, class MemoryAllocator = CS::Container::ArrayAllocDefault, class CapacityHandler = csArrayCapacityFixedGrow<16>>

T* csPDelArray< T, MemoryAllocator, CapacityHandler >::GetAndClear | ( | size_t | n | ) | `[inline]`

Get and clear the element 'n' from vector.

This spot in the array will be set to 0. You are responsible for deleting the returned pointer later.

Definition at line 91 of file parray.h.

template<class T, class MemoryAllocator = CS::Container::ArrayAllocDefault, class CapacityHandler = csArrayCapacityFixedGrow<16>>

T* csPDelArray< T, MemoryAllocator, CapacityHandler >::Pop | ( |  | ) | `[inline]`

Pop an element from tail end of array.

Reimplemented from csArray< T *, csPDelArrayElementHandler< T * >, MemoryAllocator, CapacityHandler >.

Definition at line 111 of file parray.h.

template<class T, class MemoryAllocator = CS::Container::ArrayAllocDefault, class CapacityHandler = csArrayCapacityFixedGrow<16>>

void csPDelArray< T, MemoryAllocator, CapacityHandler >::SetSize | ( | size_t | n | ) | `[inline]`

Set the actual number of items in this array.

This can be used to shrink an array (like Truncate()) or to enlarge an array, in which case it will properly construct all new items using their default (zero-argument) constructor.

Parameters:

  n | New array length.

Reimplemented from csArray< T *, csPDelArrayElementHandler< T * >, MemoryAllocator, CapacityHandler >.

Definition at line 126 of file parray.h.

template<class T, class MemoryAllocator = CS::Container::ArrayAllocDefault, class CapacityHandler = csArrayCapacityFixedGrow<16>>

void csPDelArray< T, MemoryAllocator, CapacityHandler >::SetSize | ( | size_t | n,
|  | T const & | what
| ) |  | `[inline]`

Variant of SetLength() which copies the pointed-to object instead of the actual pointer.

Definition at line 135 of file parray.h.

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

- csutil/parray.h