Simpatico  v1.10
List of all members | Public Member Functions
Util::ListArray< Data > Class Template Reference

Detailed Description

template<typename Data>
class Util::ListArray< Data >

An array of objects that are accessible by one or more linked List objects.

A ListArray is an allocatable array of data objects that also provides access to some or all of its via one or more associated List objects. Each element of the array may be part of at most one List.

Definition at line 30 of file ListArray.h.

#include <ListArray.h>

Public Member Functions

 ListArray ()
 Constructor. More...
 
virtual ~ListArray ()
 Destructor. More...
 
void allocate (int capacity, int nList)
 Allocate arrays of Node and List objects. More...
 
int nList () const
 Get the number of associated linked lists. More...
 
int capacity () const
 Return allocated size of underlying array of nodes. More...
 
Data & operator[] (int i)
 Return data for node element i. More...
 
const Data & operator[] (int i) const
 Return const refereence to Data in Node element number i. More...
 
List< Data > & list (int i)
 Return a reference to a specific List. More...
 
const List< Data > & list (int i) const
 Return a const reference to a specific List. More...
 
Node< Data > & node (int i)
 Return reference to node number i. More...
 
bool isValid () const
 Return true if the ListAray is valid, or throw an exception. More...
 

Constructor & Destructor Documentation

template<typename Data >
Util::ListArray< Data >::ListArray ( )

Constructor.

Definition at line 148 of file ListArray.h.

template<typename Data >
Util::ListArray< Data >::~ListArray ( )
virtual

Destructor.

Delete dynamically allocated arrays of Node and List objects.

Definition at line 161 of file ListArray.h.

Member Function Documentation

template<typename Data >
void Util::ListArray< Data >::allocate ( int  capacity,
int  nList 
)

Allocate arrays of Node and List objects.

Parameters
capacitysize of array Node<Data> objects
nListsize of array of List<Data> linked list objects

Definition at line 178 of file ListArray.h.

References Util::ListArray< Data >::capacity(), and Util::ListArray< Data >::nList().

template<typename Data >
int Util::ListArray< Data >::nList ( ) const
inline

Get the number of associated linked lists.

Returns
size of array of associated List<Data> objects.

Definition at line 201 of file ListArray.h.

Referenced by Util::ListArray< Data >::allocate().

template<typename Data >
int Util::ListArray< Data >::capacity ( ) const
inline

Return allocated size of underlying array of nodes.

Returns
Number of elements allocated in array.

Definition at line 67 of file ListArray.h.

Referenced by Util::ListArray< Data >::allocate().

template<typename Data >
Data& Util::ListArray< Data >::operator[] ( int  i)
inline

Return data for node element i.

Parameters
iarray index
Returns
reference to element i

Definition at line 76 of file ListArray.h.

template<typename Data >
const Data& Util::ListArray< Data >::operator[] ( int  i) const
inline

Return const refereence to Data in Node element number i.

Parameters
iarray index
Returns
const reference to element i

Definition at line 90 of file ListArray.h.

References Util::ListArray< Data >::isValid(), Util::ListArray< Data >::list(), and Util::ListArray< Data >::node().

template<typename Data >
List< Data > & Util::ListArray< Data >::list ( int  i)

Return a reference to a specific List.

Parameters
iarray index
Returns
reference to List number i

Definition at line 211 of file ListArray.h.

Referenced by Util::ListArray< Data >::operator[]().

template<typename Data >
const List< Data > & Util::ListArray< Data >::list ( int  i) const

Return a const reference to a specific List.

Parameters
iarray index
Returns
reference to List number i

Definition at line 227 of file ListArray.h.

template<typename Data >
Node< Data > & Util::ListArray< Data >::node ( int  i)

Return reference to node number i.

Parameters
iarray index
Returns
reference to Data object element number i

Definition at line 243 of file ListArray.h.

Referenced by Util::ListArray< Data >::operator[]().

template<typename Data >
bool Util::ListArray< Data >::isValid ( ) const

Return true if the ListAray is valid, or throw an exception.

Definition at line 256 of file ListArray.h.

References UTIL_THROW.

Referenced by Util::ListArray< Data >::operator[]().


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