The class LevelSetCacheCollection allows to store a collection of caches. More...
#include <levelSetCache.hpp>

Classes | |
interface | Item |
The class LevelSetCacheCollection::Item defines the items stored in a cache collection. Each item stores the cache and the factory that will be used to create the cache. More... | |
Public Types | |
typedef std::vector< Item > | Caches |
typedef Caches::const_iterator | const_iterator |
typedef Caches::iterator | iterator |
typedef key_t | key_type |
Public Member Functions | |
LevelSetCacheCollection (const LevelSetCacheCollection &other) | |
LevelSetCacheCollection (LevelSetCacheCollection &&other)=default | |
Item & | at (std::size_t index) |
const Item & | at (std::size_t index) const |
iterator | begin () |
const_iterator | begin () const |
const_iterator | cbegin () const |
const_iterator | cend () const |
void | clear () |
virtual std::unique_ptr< LevelSetCacheCollection< key_t > > | clone () const |
iterator | end () |
const_iterator | end () const |
void | erase (std::size_t index) |
template<typename container_t, typename... Args> | |
std::size_t | insert (std::size_t index, Args &&... args) |
Item & | operator[] (std::size_t index) |
const Item & | operator[] (std::size_t index) const |
std::size_t | size () const |
Static Public Attributes | |
static const std::size_t | NULL_CACHE_ID |
Protected Attributes | |
Caches | m_caches |
Caches owned by the collection. | |
Detailed Description
interface bitpit::LevelSetCacheCollection< key_t >
The class LevelSetCacheCollection allows to store a collection of caches.
Creation of the caches is lazy: they will be created the first time they are needed. The creation of the caches is handled by the cache factory defined when the cache was added to the collection. This means that, when iterating the collection, it is necessary to check if the single caches have been allocated.
Definition at line 590 of file levelSetCache.hpp.
Member Typedef Documentation
◆ Caches
typedef std::vector<Item> bitpit::LevelSetCacheCollection< key_t >::Caches |
Definition at line 627 of file levelSetCache.hpp.
◆ const_iterator
typedef Caches::const_iterator bitpit::LevelSetCacheCollection< key_t >::const_iterator |
Definition at line 630 of file levelSetCache.hpp.
◆ iterator
typedef Caches::iterator bitpit::LevelSetCacheCollection< key_t >::iterator |
Definition at line 629 of file levelSetCache.hpp.
◆ key_type
typedef key_t bitpit::LevelSetCacheCollection< key_t >::key_type |
Definition at line 625 of file levelSetCache.hpp.
Constructor & Destructor Documentation
◆ LevelSetCacheCollection()
bitpit::LevelSetCacheCollection< key_t >::LevelSetCacheCollection | ( | const LevelSetCacheCollection< key_t > & | other | ) |
Copy constructor.
- Parameters
-
other is another collection whose content is copied in this collection
Definition at line 1658 of file levelSetCache.tpp.
Member Function Documentation
◆ at() [1/2]
LevelSetCacheCollection< key_t >::Item & bitpit::LevelSetCacheCollection< key_t >::at | ( | std::size_t | index | ) |
Get a reference to the cache item with the specified index.
If this specified index is greater than, or equal to, the collection size, an exception of type out_of_range is thrown.
- Parameters
-
index is the index of the cache
- Returns
- A reference to the cache item with the specified index.
Definition at line 1877 of file levelSetCache.tpp.
◆ at() [2/2]
const LevelSetCacheCollection< key_t >::Item & bitpit::LevelSetCacheCollection< key_t >::at | ( | std::size_t | index | ) | const |
Get a constant reference to the cache item with the specified index.
If this specified index is greater than, or equal to, the collection size, an exception of type out_of_range is thrown.
- Parameters
-
index is the index of the cache
- Returns
- A constant reference to the cache item with the specified index.
Definition at line 1892 of file levelSetCache.tpp.
◆ begin() [1/2]
LevelSetCacheCollection< key_t >::iterator bitpit::LevelSetCacheCollection< key_t >::begin | ( | ) |
Get an iterator pointing to the first entry.
- Returns
- An iterator pointing to the first entry.
Definition at line 1683 of file levelSetCache.tpp.
◆ begin() [2/2]
LevelSetCacheCollection< key_t >::const_iterator bitpit::LevelSetCacheCollection< key_t >::begin | ( | ) | const |
Get a constant iterator pointing to the first entry.
- Returns
- A constant iterator pointing to the first entry.
Definition at line 1705 of file levelSetCache.tpp.
◆ cbegin()
LevelSetCacheCollection< key_t >::const_iterator bitpit::LevelSetCacheCollection< key_t >::cbegin | ( | ) | const |
Get a constant iterator pointing to the first entry.
- Returns
- A constant iterator pointing to the first entry.
Definition at line 1727 of file levelSetCache.tpp.
◆ cend()
LevelSetCacheCollection< key_t >::const_iterator bitpit::LevelSetCacheCollection< key_t >::cend | ( | ) | const |
Get a constant iterator referring to the past-the-end entry.
- Returns
- A constant iterator referring to the past-the-end entry.
Definition at line 1738 of file levelSetCache.tpp.
◆ clear()
void bitpit::LevelSetCacheCollection< key_t >::clear | ( | ) |
Delete all the registered caches.
Definition at line 1829 of file levelSetCache.tpp.
◆ clone()
|
virtual |
Clone the cache collection.
- Returns
- The cloned cache collection.
Definition at line 1672 of file levelSetCache.tpp.
◆ end() [1/2]
LevelSetCacheCollection< key_t >::iterator bitpit::LevelSetCacheCollection< key_t >::end | ( | ) |
Get an iterator referring to the past-the-end entry.
- Returns
- An iterator referring to the past-the-end entry.
Definition at line 1694 of file levelSetCache.tpp.
◆ end() [2/2]
LevelSetCacheCollection< key_t >::const_iterator bitpit::LevelSetCacheCollection< key_t >::end | ( | ) | const |
Get a constant iterator referring to the past-the-end entry.
- Returns
- a constant iterator referring to the past-the-end entry.
Definition at line 1716 of file levelSetCache.tpp.
◆ erase()
void bitpit::LevelSetCacheCollection< key_t >::erase | ( | std::size_t | index | ) |
Erase the specified cache.
- Parameters
-
index is the entry that will be erased.
Definition at line 1809 of file levelSetCache.tpp.
◆ insert()
std::size_t bitpit::LevelSetCacheCollection< id_t >::insert | ( | std::size_t | index, |
Args &&... | args ) |
Insert a new cache with a specified index.
- Parameters
-
index is the index that will be assigned to the cache, if a NULL_ID is specified the index will be assigned automatically args are the arguments that will be used to create the cache factory
- Returns
- The index associated with the newly created cache.
Definition at line 1764 of file levelSetCache.tpp.
◆ operator[]() [1/2]
LevelSetCacheCollection< key_t >::Item & bitpit::LevelSetCacheCollection< key_t >::operator[] | ( | std::size_t | index | ) |
Get a reference to the cache item with the specified index.
A similar member function, Item::at, has the same behavior as this operator function, except that Item::at is bound-checked and signals if the requested position is out of range by throwing an out_of_range exception.
- Parameters
-
index is the index of the cache
- Returns
- A reference to the cache item with the specified index.
Definition at line 1846 of file levelSetCache.tpp.
◆ operator[]() [2/2]
const LevelSetCacheCollection< key_t >::Item & bitpit::LevelSetCacheCollection< key_t >::operator[] | ( | std::size_t | index | ) | const |
Get a constant reference to the cache item with the specified index.
A similar member function, Item::at, has the same behavior as this operator function, except that Item::at is bound-checked and signals if the requested position is out of range by throwing an out_of_range exception.
- Parameters
-
index is the index of the cache
- Returns
- A constant reference to the cache item with the specified index.
Definition at line 1862 of file levelSetCache.tpp.
◆ size()
std::size_t bitpit::LevelSetCacheCollection< key_t >::size | ( | ) | const |
Get a size of the collection.
- Returns
- The size of the collection.
Definition at line 1749 of file levelSetCache.tpp.
Member Data Documentation
◆ m_caches
|
protected |
Caches owned by the collection.
Definition at line 666 of file levelSetCache.hpp.
◆ NULL_CACHE_ID
|
static |
Definition at line 632 of file levelSetCache.hpp.
The documentation for this interface was generated from the following files:
- src/levelset/levelSetCache.hpp
- src/levelset/levelSetCache.tpp
