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

Loading...
Searching...
No Matches
geotess::ArrayReuse< T > Class Template Reference

An array reuse object for cases where arrays of some fixed type and size are required by the application over and over. More...

`#include <ArrayReuse.h>`

## 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.

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.

Definition at line 70 of file ArrayReuse.h.

## Constructor & Destructor Documentation

## ◆ ArrayReuse() [1/4]

template<typename T>

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

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

Definition at line 146 of file ArrayReuse.h.

## ◆ ArrayReuse() [2/4]

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

Definition at line 164 of file ArrayReuse.h.

## ◆ ArrayReuse() [3/4]

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

Definition at line 183 of file ArrayReuse.h.

## ◆ ArrayReuse() [4/4]

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).

Definition at line 208 of file ArrayReuse.h.

## ◆ ~ArrayReuse()

template<typename T>

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

Destructor.

Definition at line 215 of file ArrayReuse.h.

## Member Function Documentation

## ◆ getAllocatedArrays()

template<typename T>

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

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

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

Definition at line 351 of file ArrayReuse.h.

## ◆ getArray()

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.

Returns
  a new array of size arrayLength

Definition at line 224 of file ArrayReuse.h.

## ◆ getArrayLength()

template<typename T>

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

Returns the array length setting.

Returns
  the array length settting

Definition at line 375 of file ArrayReuse.h.

## ◆ getUnusedArrayCount()

template<typename T>

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

Returns the current number of unused allocated arrays.

Returns
  the current number of unused allocated arrays.

Definition at line 367 of file ArrayReuse.h.

## ◆ getUsedArrayCount()

template<typename T>

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

Returns the number of arrays currently in use by clients.

Returns
  the number of arrays currently in use by clients.

Definition at line 359 of file ArrayReuse.h.

## ◆ initialize() [1/3]

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

Definition at line 285 of file ArrayReuse.h.

## ◆ initialize() [2/3]

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

Definition at line 306 of file ArrayReuse.h.

## ◆ initialize() [3/3]

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).

Definition at line 331 of file ArrayReuse.h.

## ◆ reset()

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.

Definition at line 249 of file ArrayReuse.h.

## ◆ resetIfRequired()

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).

Definition at line 265 of file ArrayReuse.h.

## ◆ reuseArray()

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.

Parameters

  a | the array that is to be returned to the reuse pool

Definition at line 238 of file ArrayReuse.h.

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

- rstt_v3.2.1/GeoTessCPP/include/ArrayReuse.h