Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
bitpit::LevelSetCacheCollection< key_t > Interface Template Reference

The class LevelSetCacheCollection allows to store a collection of caches. More...

#include <levelSetCache.hpp>

Inheritance diagram for bitpit::LevelSetCacheCollection< key_t >:
Inheritance graph
[legend]

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< ItemCaches
 
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
 
Itemat (std::size_t index)
 
const Itemat (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)
 
Itemoperator[] (std::size_t index)
 
const Itemoperator[] (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.
 

Detailed Description

template<typename key_t>
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

template<typename key_t >
typedef std::vector<Item> bitpit::LevelSetCacheCollection< key_t >::Caches

Definition at line 627 of file levelSetCache.hpp.

◆ const_iterator

template<typename key_t >
typedef Caches::const_iterator bitpit::LevelSetCacheCollection< key_t >::const_iterator

Definition at line 630 of file levelSetCache.hpp.

◆ iterator

template<typename key_t >
typedef Caches::iterator bitpit::LevelSetCacheCollection< key_t >::iterator

Definition at line 629 of file levelSetCache.hpp.

◆ key_type

template<typename key_t >
typedef key_t bitpit::LevelSetCacheCollection< key_t >::key_type

Definition at line 625 of file levelSetCache.hpp.

Constructor & Destructor Documentation

◆ LevelSetCacheCollection()

template<typename key_t >
bitpit::LevelSetCacheCollection< key_t >::LevelSetCacheCollection ( const LevelSetCacheCollection< key_t > & other)

Copy constructor.

Parameters
otheris another collection whose content is copied in this collection

Definition at line 1658 of file levelSetCache.tpp.

Member Function Documentation

◆ at() [1/2]

template<typename key_t >
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
indexis 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]

template<typename key_t >
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
indexis 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]

template<typename key_t >
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]

template<typename key_t >
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()

template<typename key_t >
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()

template<typename key_t >
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()

template<typename key_t >
void bitpit::LevelSetCacheCollection< key_t >::clear ( )

Delete all the registered caches.

Definition at line 1829 of file levelSetCache.tpp.

◆ clone()

template<typename key_t >
std::unique_ptr< LevelSetCacheCollection< key_t > > bitpit::LevelSetCacheCollection< key_t >::clone ( ) const
virtual

Clone the cache collection.

Returns
The cloned cache collection.

Definition at line 1672 of file levelSetCache.tpp.

◆ end() [1/2]

template<typename key_t >
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]

template<typename key_t >
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()

template<typename key_t >
void bitpit::LevelSetCacheCollection< key_t >::erase ( std::size_t index)

Erase the specified cache.

Parameters
indexis the entry that will be erased.

Definition at line 1809 of file levelSetCache.tpp.

◆ insert()

template<typename id_t >
template<typename container_t , typename... Args>
std::size_t bitpit::LevelSetCacheCollection< id_t >::insert ( std::size_t index,
Args &&... args )

Insert a new cache with a specified index.

Parameters
indexis the index that will be assigned to the cache, if a NULL_ID is specified the index will be assigned automatically
argsare 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]

template<typename key_t >
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
indexis 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]

template<typename key_t >
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
indexis 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()

template<typename key_t >
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

template<typename key_t >
Caches bitpit::LevelSetCacheCollection< key_t >::m_caches
protected

Caches owned by the collection.

Definition at line 666 of file levelSetCache.hpp.

◆ NULL_CACHE_ID

template<typename key_t >
const std::size_t bitpit::LevelSetCacheCollection< key_t >::NULL_CACHE_ID = std::numeric_limits<std::size_t>::max()
static

Is the index associated with an invalid cache.

Definition at line 632 of file levelSetCache.hpp.


The documentation for this interface was generated from the following files:
--- layout: doxygen_footer ---