GeoTessCPP: geotess::ArrayReuse< T > Class Template Reference

GeoTessCPP 2.0.0 Software to facilitate storage and retrieval of 3D information about the Earth.

- Main Page
- Namespaces
- Classes
- Files

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

All Classes Namespaces Files Functions Variables Typedefs Friends Macros
Public Member Functions
geotess::ArrayReuse< T > Class Template Reference

`#include <ArrayReuse.h>`

List of all members.

## Public Member Functions
| ArrayReuse ()
| ArrayReuse (int alngth, int acnt)
| ArrayReuse (int alngth, int iacnt, int acnt)
| ArrayReuse (int alngth, int iacnt, int acnt, int rsrvstr, int rsrvrefstr)
virtual | ~ArrayReuse ()
T * | getArray ()
void | reuseArray (T *a)
void | reset ()
void | resetIfRequired ()
void | initialize (int alngth, int acnt)
void | initialize (int alngth, int iacnt, int acnt)
void | initialize (int alngth, int iacnt, int acnt, int rsrvstr, int rsrvrefstr)
int | getAllocatedArrays () const
int | getUsedArrayCount () const
int | getUnusedArrayCount () const
int | getArrayLength () const

## Detailed Description

### template<typename T>
class geotess::ArrayReuse< T >

An array reuse object for cases where arrays of some fixed type and size are required by the application over and over but it is desirable to avoid the constant allocation, and subsequent deletion, of many small arrays.

## Constructor & Destructor Documentation

template<typename T>

geotess::ArrayReuse< T >::ArrayReuse | ( |  | ) |
| inline

Default constructor. Made private to prevent it from being used.

template<typename T>

geotess::ArrayReuse< T >::ArrayReuse | ( | int | alngth,
|  | int | acnt
| ) |  |
| inline

Standard constructor where alngth is the size of the arrays to be provided to requesting clients, iacnt is the initial number of arrays to create for used by clients, and acnt is the subsequent array count allocation used when getArray() is called but no more arrays are available.

Parameters:

  alngth | The size of the arrays to be provided to requesting clients.
  acnt | The subsequent array count allocation used when getArray() is called but no more arrays are available

template<typename T>

geotess::ArrayReuse< T >::ArrayReuse | ( | int | alngth,
|  | int | iacnt,
|  | int | acnt
| ) |  |
| inline

Standard constructor where alngth is the size of the arrays to be provided to requesting clients, iacnt is the initial number of arrays to create for used by clients, and acnt is the subsequent array count allocation used when getArray() is called but no more arrays are available.

Parameters:

  alngth | The size of the arrays to be provided to requesting clients.
  iacnt | The initial number of arrays to create for use by clients.
  acnt | The subsequent array count allocation used when getArray() is called but no more arrays are available

template<typename T>

geotess::ArrayReuse< T >::ArrayReuse | ( | int | alngth,
|  | int | iacnt,
|  | int | acnt,
|  | int | rsrvstr,
|  | int | rsrvrefstr
| ) |  |
| inline

Standard constructor where alngth is the size of the arrays to be provided to requesting clients, iacnt is the initial number of arrays to create for used by clients, and acnt is the subsequent array count allocation used when getArray() is called but no more arrays are available, rsrvstr is the capacity of the permanent store (store), and rsrvrefstr is the capacity of the reuseable reference store (refStore).

Parameters:

  alngth | The size of the arrays to be provided to requesting clients.
  iacnt | The initial number of arrays to create for use by clients.
  acnt | The subsequent array count allocation used when getArray() is called but no more arrays are available
  rsrvstr | The capacity of the permanent store (store).
  rsrvrefstr | The capacity of the reuseable reference store (refStore).

template<typename T>

virtual geotess::ArrayReuse< T >::~ArrayReuse | ( |  | ) |
| inlinevirtual

Destructor.

## Member Function Documentation

template<typename T>

int geotess::ArrayReuse< T >::getAllocatedArrays | ( |  | ) | const
| inline

Returns the total number of allocated arrays (each of arrayLength).

template<typename T>

T* geotess::ArrayReuse< T >::getArray | ( |  | ) |
| inline

Returns a new array of size arrayLength for use by requesting clients. This function will create more arrays if necessary.

template<typename T>

int geotess::ArrayReuse< T >::getArrayLength | ( |  | ) | const
| inline

Returns the array length setting.

template<typename T>

int geotess::ArrayReuse< T >::getUnusedArrayCount | ( |  | ) | const
| inline

Returns the current number of unused allocated arrays.

template<typename T>

int geotess::ArrayReuse< T >::getUsedArrayCount | ( |  | ) | const
| inline

Returns the number of arrays currently in use by clients.

template<typename T>

void geotess::ArrayReuse< T >::initialize | ( | int | alngth,
|  | int | acnt
| ) |  |
| inline

Initializes sizes where alngth is the size of the arrays to be provided to requesting clients, iacnt is the initial number of arrays to create for used by clients, and acnt is the subsequent array count allocation used when getArray() is called but no more arrays are available, rsrvstr is the capacity of the permanent store (store), and rsrvrefstr is the capacity of the reuseable reference store (refStore).

Parameters:

  alngth | The size of the arrays to be provided to requesting clients.
  acnt | The subsequent array count allocation used when getArray() is called but no more arrays are available

template<typename T>

void geotess::ArrayReuse< T >::initialize | ( | int | alngth,
|  | int | iacnt,
|  | int | acnt
| ) |  |
| inline

Initializes sizes where alngth is the size of the arrays to be provided to requesting clients, iacnt is the initial number of arrays to create for used by clients, and acnt is the subsequent array count allocation used when getArray() is called but no more arrays are available, rsrvstr is the capacity of the permanent store (store), and rsrvrefstr is the capacity of the reuseable reference store (refStore).

Parameters:

  alngth | The size of the arrays to be provided to requesting clients.
  iacnt | The initial number of arrays to create for use by clients.
  acnt | The subsequent array count allocation used when getArray() is called but no more arrays are available

template<typename T>

void geotess::ArrayReuse< T >::initialize | ( | int | alngth,
|  | int | iacnt,
|  | int | acnt,
|  | int | rsrvstr,
|  | int | rsrvrefstr
| ) |  |
| inline

Initializes sizes where alngth is the size of the arrays to be provided to requesting clients, iacnt is the initial number of arrays to create for used by clients, and acnt is the subsequent array count allocation used when getArray() is called but no more arrays are available, rsrvstr is the capacity of the permanent store (store), and rsrvrefstr is the capacity of the reuseable reference store (refStore).

Parameters:

  alngth | The size of the arrays to be provided to requesting clients.
  iacnt | The initial number of arrays to create for use by clients.
  acnt | The subsequent array count allocation used when getArray() is called but no more arrays are available
  rsrvstr | The capacity of the permanent store (store).
  rsrvrefstr | The capacity of the reuseable reference store (refStore).

template<typename T>

void geotess::ArrayReuse< T >::reset | ( |  | ) |
| inline

Resets refStore to all allocated references in store. NOTE: if a client is still using a reference after this reset() is called the possibility exists that it will be given out as a new request from function getArray(). Only call this function when you know all entries are no longer in use or needed by the requesting clients.

template<typename T>

void geotess::ArrayReuse< T >::resetIfRequired | ( |  | ) |
| inline

Calls reset if the size of refStore is not equal to the total number of allocated arrays (allocArrays).

template<typename T>

void geotess::ArrayReuse< T >::reuseArray | ( | T * | a | ) |
| inline

Returns an array that was being used by a client back into the reuse pool.

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

- include/ArrayReuse.h