HTM SpatialIndex Class Reference

template class LinPool

Dynamic linear pool of objects

Public Fields

size_t increment_
linear growth increment
T** vector_
dynamic array of pointers

Public Methods

~LinPool ( void )
Destructor
LinPool ( size_t capacity=0, size_t increment=0 )
Default constructor
const T*& operator () ( size_t index ) const
Efficient array operator (const version): no bounds checking
T*& operator () ( size_t index )
Efficient array operator (non-const version): no bounds checking
const T*& operator [] ( size_t index ) const
Bounds-checking array operator (const version): throws sxBoundsError
T*& operator [] ( size_t index )
Bounds-checking array operator (non-const version): throws sxBoundsError
T*& use ( void )
Use Method
size_t length ( void ) const
Returns current occupied length of the pool
size_t free ( size_t count = 0)
Declare pool objects as free for new use

Documentation

Dynamic linear pool of objects. This is a template for a dynamic pool of objects. The design is very similar to the dynamic array of pointers. A pool is defined to be an array of pointers to preallocated default objects. Whenever a new object is needed, it can be accessed from the pool with the use() member function. The size of the pool extends automatically if its initial limit is reached. This pool is a linear pool, i.e. we can rely upon their index to be sequential. So in order to return a specific object into the pool's disposal, all objects having larger indices have to be free (like a reverse LIFO - last out first back). The free member function returns objects to the pool's disposal. Upon destruction, all pool objects are destroyed using their destructor. It does not make sense to have a copy constructor or assignment op.
~LinPool( void )
Destructor

LinPool( size_t capacity=0, size_t increment=0 )
Default constructor. optionally specify initial capacity, reallocation increment, and whether the pointers are internal.

const T*& operator ()( size_t index ) const
Efficient array operator (const version): no bounds checking

T*& operator ()( size_t index )
Efficient array operator (non-const version): no bounds checking

const T*& operator []( size_t index ) const
Bounds-checking array operator (const version): throws sxBoundsError

T*& operator []( size_t index )
Bounds-checking array operator (non-const version): throws sxBoundsError

T*& use( void )
Use Method. Bounds-adjusting operator that returns the pool element as an lvalue to be used by the user. It is a combination of append() and at() of VarVec and PtrVec. If the bounds of the pool array are reached, it is extended by increment_.

size_t length( void ) const
Returns current occupied length of the pool

size_t free( size_t count = 0)
Declare pool objects as free for new use. If no argument is given, all elements are free to use again. Else, the number of elements specified is freed up from the end.

size_t increment_
linear growth increment

T** vector_
dynamic array of pointers


This class has no child classes.

alphabetic index hierarchy of classes


© Copyright The Johns Hopkins University 1999, All Rights Reserved.
Peter Z. Kunszt,

generated by doc++