concepts::DynArray< T > Class Template Reference

Container class: a dynamic array. More...

#include <mesh.hh>

Public Member Functions

 DynArray (const DynArray &d)
 Copy constructor. More...
 
 DynArray (uint htblsz, uint pgsz, const T &dflt)
 
 DynArray (uint htblsz=2, uint pgsz=2)
 Constructor. More...
 
bool isElm (uint i)
 Checks if the element is not equal to the default element. More...
 
const bool isElm (uint i) const
 
float memory () const
 Approximate memory consumption in bytes. More...
 
T & operator[] (uint i)
 Index operator for the container. More...
 
const T & operator[] (uint i) const
 Index operator for the container. More...
 
void reset ()
 Clears the array. More...
 
 ~DynArray ()
 

Protected Member Functions

virtual std::ostream & info (std::ostream &os) const
 

Private Attributes

dflt_
 
DynArrayPage< T > ** htbl_
 
DynArrayPage< T > * lru_
 

Detailed Description

template<class T>
class concepts::DynArray< T >

Container class: a dynamic array.

The entries of the array are managed in chunks of fixed size (so called pages). The access is done over a hash function.

Definition at line 30 of file mesh.hh.

Constructor & Destructor Documentation

◆ DynArray() [1/3]

template<class T >
concepts::DynArray< T >::DynArray ( uint  htblsz = 2,
uint  pgsz = 2 
)
inline

Constructor.

The entries of the array are managed in pages of size pgsz. The larger the page size, the larger the probably unused space. The smaller the page size, the higher the cost of management.

The have fast access to the pages, a simple hash table algorithm is implemented. The hash function is the last htblsz bits of the page number.

Parameters
htblszSize of the hash table, ie. how many bits of the page number.
pgszPage size in number of entries.

Definition at line 162 of file dynArray.hh.

◆ DynArray() [2/3]

template<class T >
concepts::DynArray< T >::DynArray ( uint  htblsz,
uint  pgsz,
const T &  dflt 
)
inline

Definition at line 170 of file dynArray.hh.

◆ DynArray() [3/3]

template<class T >
concepts::DynArray< T >::DynArray ( const DynArray< T > &  d)
inline

Copy constructor.

Definition at line 178 of file dynArray.hh.

◆ ~DynArray()

template<class T >
concepts::DynArray< T >::~DynArray
inline

Definition at line 187 of file dynArray.hh.

Member Function Documentation

◆ info()

template<class T >
std::ostream & concepts::DynArray< T >::info ( std::ostream &  os) const
protectedvirtual

Definition at line 336 of file dynArray.hh.

◆ isElm() [1/2]

template<class T >
bool concepts::DynArray< T >::isElm ( uint  i)

Checks if the element is not equal to the default element.

Returns
1: element not equal to default, 0: element equal to default

Definition at line 265 of file dynArray.hh.

◆ isElm() [2/2]

template<class T >
const bool concepts::DynArray< T >::isElm ( uint  i) const

Definition at line 289 of file dynArray.hh.

◆ memory()

template<class T >
float concepts::DynArray< T >::memory
inline

Approximate memory consumption in bytes.

Definition at line 315 of file dynArray.hh.

◆ operator[]() [1/2]

template<class T >
T & concepts::DynArray< T >::operator[] ( uint  i)

Index operator for the container.

If an item is not existing, it is created, inserted into the array and then returned.

Returns
The ith element of the array.

Definition at line 201 of file dynArray.hh.

◆ operator[]() [2/2]

template<class T >
const T & concepts::DynArray< T >::operator[] ( uint  i) const

Index operator for the container.

Returns
The ith element of the array.

Definition at line 233 of file dynArray.hh.

◆ reset()

template<class T >
void concepts::DynArray< T >::reset

Clears the array.

Definition at line 322 of file dynArray.hh.

Member Data Documentation

◆ dflt_

template<class T >
T concepts::DynArray< T >::dflt_
private

Definition at line 158 of file dynArray.hh.

◆ htbl_

template<class T >
DynArrayPage<T>** concepts::DynArray< T >::htbl_
private

Definition at line 156 of file dynArray.hh.

◆ lru_

template<class T >
DynArrayPage<T>* concepts::DynArray< T >::lru_
private

Definition at line 157 of file dynArray.hh.


The documentation for this class was generated from the following files:
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich