Class documentation of Concepts

Loading...
Searching...
No Matches
concepts::DynArray< T > Class Template Reference

#include <dynArray.hh>

Inheritance diagram for concepts::DynArray< T >:
concepts::DynArrayBase concepts::OutputOperator

Public Member Functions

 DynArray (uint htblsz=2, uint pgsz=2)
 
 DynArray (uint htblsz, uint pgsz, const T &dflt)
 
 DynArray (const DynArray &d)
 Copy constructor.
 
T & operator[] (uint i)
 
const T & operator[] (uint i) const
 
bool isElm (uint i)
 
const bool isElm (uint i) const
 
float memory () const
 Approximate memory consumption in bytes.
 
void reset ()
 Clears the array.
 
uint max () const
 Maximal referenced index + 1.
 
uint min () const
 Minimal referenced index.
 

Protected Member Functions

virtual std::ostream & info (std::ostream &os) const
 Returns information in an output stream.
 

Protected Attributes

bool init_
 
bool empty_
 
uint max_
 
uint min_
 
uint npg_
 
const uint htblsz_
 Size of the hash table function (how many bits of the page number)
 
const uint htblmsk_
 Hash table mask.
 
const uint pgsz_
 Size of a page in number of entries.
 
const uint pgmsk_
 

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 105 of file dynArray.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

Returns information in an output stream.

Reimplemented from concepts::DynArrayBase.

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.

◆ max()

uint concepts::DynArrayBase::max ( ) const
inlineinherited

Maximal referenced index + 1.

Definition at line 37 of file dynArray.hh.

◆ memory()

template<class T >
float concepts::DynArray< T >::memory ( ) const
inline

Approximate memory consumption in bytes.

Definition at line 315 of file dynArray.hh.

◆ min()

uint concepts::DynArrayBase::min ( ) const
inlineinherited

Minimal referenced index.

Definition at line 40 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

◆ empty_

bool concepts::DynArrayBase::empty_
protectedinherited

Definition at line 43 of file dynArray.hh.

◆ htblmsk_

const uint concepts::DynArrayBase::htblmsk_
protectedinherited

Hash table mask.

Definition at line 52 of file dynArray.hh.

◆ htblsz_

const uint concepts::DynArrayBase::htblsz_
protectedinherited

Size of the hash table function (how many bits of the page number)

Definition at line 49 of file dynArray.hh.

◆ init_

bool concepts::DynArrayBase::init_
protectedinherited

Definition at line 42 of file dynArray.hh.

◆ max_

uint concepts::DynArrayBase::max_
protectedinherited

Definition at line 44 of file dynArray.hh.

◆ min_

uint concepts::DynArrayBase::min_
protectedinherited

Definition at line 45 of file dynArray.hh.

◆ npg_

uint concepts::DynArrayBase::npg_
protectedinherited

Definition at line 46 of file dynArray.hh.

◆ pgmsk_

const uint concepts::DynArrayBase::pgmsk_
protectedinherited

Definition at line 56 of file dynArray.hh.

◆ pgsz_

const uint concepts::DynArrayBase::pgsz_
protectedinherited

Size of a page in number of entries.

Definition at line 55 of file dynArray.hh.


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