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 | |
T | 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.
Constructor & Destructor Documentation
◆ DynArray() [1/3]
|
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
-
htblsz Size of the hash table, ie. how many bits of the page number. pgsz Page size in number of entries.
Definition at line 162 of file dynArray.hh.
◆ DynArray() [2/3]
|
inline |
Definition at line 170 of file dynArray.hh.
◆ DynArray() [3/3]
|
inline |
Copy constructor.
Definition at line 178 of file dynArray.hh.
◆ ~DynArray()
|
inline |
Definition at line 187 of file dynArray.hh.
Member Function Documentation
◆ info()
|
protectedvirtual |
Definition at line 336 of file dynArray.hh.
◆ isElm() [1/2]
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]
const bool concepts::DynArray< T >::isElm | ( | uint | i | ) | const |
Definition at line 289 of file dynArray.hh.
◆ memory()
|
inline |
Approximate memory consumption in bytes.
Definition at line 315 of file dynArray.hh.
◆ operator[]() [1/2]
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]
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()
void concepts::DynArray< T >::reset |
Clears the array.
Definition at line 322 of file dynArray.hh.
Member Data Documentation
◆ dflt_
|
private |
Definition at line 158 of file dynArray.hh.
◆ htbl_
|
private |
Definition at line 156 of file dynArray.hh.
◆ lru_
|
private |
Definition at line 157 of file dynArray.hh.
The documentation for this class was generated from the following files:
- geometry/mesh.hh
- toolbox/dynArray.hh