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 = std::numeric_limits<std::size_t>::max() |
Protected Attributes | |
Caches | m_caches |
Caches owned by the collection. | |
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.
typedef std::vector<Item> bitpit::LevelSetCacheCollection< key_t >::Caches |
Definition at line 627 of file levelSetCache.hpp.
typedef Caches::const_iterator bitpit::LevelSetCacheCollection< key_t >::const_iterator |
Definition at line 630 of file levelSetCache.hpp.
typedef Caches::iterator bitpit::LevelSetCacheCollection< key_t >::iterator |
Definition at line 629 of file levelSetCache.hpp.
typedef key_t bitpit::LevelSetCacheCollection< key_t >::key_type |
Definition at line 625 of file levelSetCache.hpp.
bitpit::LevelSetCacheCollection< key_t >::LevelSetCacheCollection | ( | const LevelSetCacheCollection< key_t > & | other | ) |
Copy constructor.
other | is another collection whose content is copied in this collection |
Definition at line 1658 of file levelSetCache.tpp.
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.
index | is the index of the cache |
Definition at line 1877 of file levelSetCache.tpp.
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.
index | is the index of the cache |
Definition at line 1892 of file levelSetCache.tpp.
LevelSetCacheCollection< key_t >::iterator bitpit::LevelSetCacheCollection< key_t >::begin | ( | ) |
Get an iterator pointing to the first entry.
Definition at line 1683 of file levelSetCache.tpp.
LevelSetCacheCollection< key_t >::const_iterator bitpit::LevelSetCacheCollection< key_t >::begin | ( | ) | const |
Get a constant iterator pointing to the first entry.
Definition at line 1705 of file levelSetCache.tpp.
LevelSetCacheCollection< key_t >::const_iterator bitpit::LevelSetCacheCollection< key_t >::cbegin | ( | ) | const |
Get a constant iterator pointing to the first entry.
Definition at line 1727 of file levelSetCache.tpp.
LevelSetCacheCollection< key_t >::const_iterator bitpit::LevelSetCacheCollection< key_t >::cend | ( | ) | const |
Get a constant iterator referring to the past-the-end entry.
Definition at line 1738 of file levelSetCache.tpp.
void bitpit::LevelSetCacheCollection< key_t >::clear | ( | ) |
Delete all the registered caches.
Definition at line 1829 of file levelSetCache.tpp.
|
virtual |
Clone the cache collection.
Definition at line 1672 of file levelSetCache.tpp.
LevelSetCacheCollection< key_t >::iterator bitpit::LevelSetCacheCollection< key_t >::end | ( | ) |
Get an iterator referring to the past-the-end entry.
Definition at line 1694 of file levelSetCache.tpp.
LevelSetCacheCollection< key_t >::const_iterator bitpit::LevelSetCacheCollection< key_t >::end | ( | ) | const |
Get a constant iterator referring to the past-the-end entry.
Definition at line 1716 of file levelSetCache.tpp.
void bitpit::LevelSetCacheCollection< key_t >::erase | ( | std::size_t | index | ) |
Erase the specified cache.
index | is the entry that will be erased. |
Definition at line 1809 of file levelSetCache.tpp.
std::size_t bitpit::LevelSetCacheCollection< id_t >::insert | ( | std::size_t | index, |
Args &&... | args ) |
Insert a new cache with a specified index.
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 |
Definition at line 1764 of file levelSetCache.tpp.
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.
index | is the index of the cache |
Definition at line 1846 of file levelSetCache.tpp.
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.
index | is the index of the cache |
Definition at line 1862 of file levelSetCache.tpp.
std::size_t bitpit::LevelSetCacheCollection< key_t >::size | ( | ) | const |
Get a size of the collection.
Definition at line 1749 of file levelSetCache.tpp.
|
protected |
Caches owned by the collection.
Definition at line 666 of file levelSetCache.hpp.
|
static |
Is the index associated with an invalid cache.
Definition at line 632 of file levelSetCache.hpp.