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

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

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

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.

Constructor & Destructor Documentation

◆ ListArray()

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

Constructor.

Definition at line 148 of file ListArray.h.

◆ ~ListArray()

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

◆ allocate()

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.

◆ nList()

template<typename Data >
int Util::ListArray< Data >::nList
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.

◆ capacity()

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.

◆ operator[]() [1/2]

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.

◆ operator[]() [2/2]

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.

◆ list() [1/2]

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.

◆ list() [2/2]

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.

◆ node()

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.

◆ isValid()

template<typename Data >
bool Util::ListArray< Data >::isValid

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

Definition at line 256 of file ListArray.h.

References UTIL_THROW.


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