GeoTessCPP  2.2
Software to facilitate storage and retrieval of 3D information about the Earth.
Public Member Functions | List of all members
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 ()
 Default constructor. More...
 
 ArrayReuse (int alngth, int acnt)
 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. More...
 
 ArrayReuse (int alngth, int iacnt, int acnt)
 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. More...
 
 ArrayReuse (int alngth, int iacnt, int acnt, int rsrvstr, int rsrvrefstr)
 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). More...
 
virtual ~ArrayReuse ()
 Destructor. More...
 
int getAllocatedArrays () const
 Returns the total number of allocated arrays (each of arrayLength). More...
 
T * getArray ()
 Returns a new array of size arrayLength for use by requesting clients. More...
 
int getArrayLength () const
 Returns the array length setting. More...
 
int getUnusedArrayCount () const
 Returns the current number of unused allocated arrays. More...
 
int getUsedArrayCount () const
 Returns the number of arrays currently in use by clients. More...
 
void initialize (int alngth, int acnt)
 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). More...
 
void initialize (int alngth, int iacnt, int acnt)
 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). More...
 
void initialize (int alngth, int iacnt, int acnt, int rsrvstr, int rsrvrefstr)
 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). More...
 
void reset ()
 Resets refStore to all allocated references in store. More...
 
void resetIfRequired ()
 Calls reset if the size of refStore is not equal to the total number of allocated arrays (allocArrays). More...
 
void reuseArray (T *a)
 Returns an array that was being used by a client back into the reuse pool. More...
 

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.

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
alngthThe size of the arrays to be provided to requesting clients.
acntThe 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
alngthThe size of the arrays to be provided to requesting clients.
iacntThe initial number of arrays to create for use by clients.
acntThe 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
alngthThe size of the arrays to be provided to requesting clients.
iacntThe initial number of arrays to create for use by clients.
acntThe subsequent array count allocation used when getArray() is called but no more arrays are available
rsrvstrThe capacity of the permanent store (store).
rsrvrefstrThe 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).

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.

Returns
a new array of size arrayLength
template<typename T >
int geotess::ArrayReuse< T >::getArrayLength ( ) const
inline

Returns the array length setting.

Returns
the array length settting
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.
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.
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
alngthThe size of the arrays to be provided to requesting clients.
acntThe 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
alngthThe size of the arrays to be provided to requesting clients.
iacntThe initial number of arrays to create for use by clients.
acntThe 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
alngthThe size of the arrays to be provided to requesting clients.
iacntThe initial number of arrays to create for use by clients.
acntThe subsequent array count allocation used when getArray() is called but no more arrays are available
rsrvstrThe capacity of the permanent store (store).
rsrvrefstrThe 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.

Parameters
athe array that is to be returned to the reuse pool

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