Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t > Class Template Referenceabstract

The class LevelSetContainerBaseCache is the base class for defining caches that stores the values inside a container owned by them. More...

#include <levelSetCache.hpp>

Inheritance diagram for bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >:
Inheritance graph
[legend]
Collaboration diagram for bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >:
Collaboration graph
[legend]

Public Types

typedef container_t::const_iterator const_iterator
 
typedef const_reference_t const_reference
 
typedef container_t container_type
 
typedef LevelSetValueCache< key_t, value_t >::Entry Entry
 
typedef container_t::iterator iterator
 
typedef const key_t & key_type
 
typedef reference_t reference
 
typedef value_t value_type
 
- Public Types inherited from bitpit::LevelSetValueCache< key_t, value_t >
typedef LevelSetValueCacheEntry< value_t > Entry
 

Public Member Functions

reference at (const key_t &key)
 
const_reference at (const key_t &key) const
 
iterator begin ()
 
const_iterator begin () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
bool contains (const key_t &key) const override
 
iterator end ()
 
const_iterator end () const
 
virtual const_iterator find (const key_t &key) const =0
 
virtual iterator find (const key_t &key)=0
 
Entry findEntry (const key_t &key) const override
 
std::size_t getEntryBinarySize () const override
 
virtual iterator insert (const key_t &key, const value_t &value)=0
 
virtual iterator insert (const key_t &key, value_t &&value)=0
 
Entry insertEntry (const key_t &key, const value_t &value) override
 
Entry insertEntry (const key_t &key, value_t &&value) override
 
reference operator[] (const key_t &key)
 
const_reference operator[] (const key_t &key) const
 
void readBuffer (const std::vector< key_t > &ids, RecvBuffer &buffer) override
 
void writeBuffer (const std::vector< key_t > &ids, SendBuffer &buffer) const override
 
- Public Member Functions inherited from bitpit::LevelSetCache< key_t >
virtual void clear ()=0
 
virtual std::unique_ptr< LevelSetCache< key_t > > clone () const =0
 
virtual void dump (std::ostream &stream)=0
 
virtual std::size_t erase (const key_t &key)=0
 
template<typename Keys >
std::size_t erase (const Keys &keys)
 
virtual bool isVolatile () const =0
 
virtual void reserve (std::size_t n)=0
 
virtual void restore (std::istream &stream)=0
 
virtual void shrink_to_fit ()=0
 

Protected Member Functions

template<typename... Args>
 LevelSetContainerBaseCache (Args &&... args)
 
virtual key_t getKey (const const_iterator &itr) const =0
 
virtual const_reference getValue (const const_iterator &itr) const =0
 
virtual reference getValue (const iterator &itr) const =0
 

Protected Attributes

container_t m_container
 

Detailed Description

template<typename key_t, typename container_t, typename value_t = typename container_t::value_type, typename reference_t = value_t &, typename const_reference_t = const value_t &>
class bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >

The class LevelSetContainerBaseCache is the base class for defining caches that stores the values inside a container owned by them.

Definition at line 174 of file levelSetCache.hpp.

Member Typedef Documentation

◆ const_iterator

template<typename key_t , typename container_t , typename value_t = typename container_t::value_type, typename reference_t = value_t &, typename const_reference_t = const value_t &>
typedef container_t::const_iterator bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::const_iterator

Definition at line 187 of file levelSetCache.hpp.

◆ const_reference

template<typename key_t , typename container_t , typename value_t = typename container_t::value_type, typename reference_t = value_t &, typename const_reference_t = const value_t &>
typedef const_reference_t bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::const_reference

Definition at line 184 of file levelSetCache.hpp.

◆ container_type

template<typename key_t , typename container_t , typename value_t = typename container_t::value_type, typename reference_t = value_t &, typename const_reference_t = const value_t &>
typedef container_t bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::container_type

Definition at line 179 of file levelSetCache.hpp.

◆ Entry

template<typename key_t , typename container_t , typename value_t = typename container_t::value_type, typename reference_t = value_t &, typename const_reference_t = const value_t &>
typedef LevelSetValueCache<key_t,value_t>::Entry bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::Entry

Definition at line 177 of file levelSetCache.hpp.

◆ iterator

template<typename key_t , typename container_t , typename value_t = typename container_t::value_type, typename reference_t = value_t &, typename const_reference_t = const value_t &>
typedef container_t::iterator bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::iterator

Definition at line 186 of file levelSetCache.hpp.

◆ key_type

template<typename key_t , typename container_t , typename value_t = typename container_t::value_type, typename reference_t = value_t &, typename const_reference_t = const value_t &>
typedef const key_t& bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::key_type

Definition at line 180 of file levelSetCache.hpp.

◆ reference

template<typename key_t , typename container_t , typename value_t = typename container_t::value_type, typename reference_t = value_t &, typename const_reference_t = const value_t &>
typedef reference_t bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::reference

Definition at line 183 of file levelSetCache.hpp.

◆ value_type

template<typename key_t , typename container_t , typename value_t = typename container_t::value_type, typename reference_t = value_t &, typename const_reference_t = const value_t &>
typedef value_t bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::value_type

Definition at line 181 of file levelSetCache.hpp.

Constructor & Destructor Documentation

◆ LevelSetContainerBaseCache()

template<typename key_t , typename container_t , typename value_t , typename reference_t , typename const_reference_t >
template<typename... Args>
bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::LevelSetContainerBaseCache ( Args &&... args)
protected

Constructor.

Parameters
argsare the arguments that will be used to create the container

Definition at line 121 of file levelSetCache.tpp.

Member Function Documentation

◆ at() [1/2]

template<typename key_t , typename container_t , typename value_t , typename reference_t , typename const_reference_t >
LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::reference bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::at ( const key_t & key)

Get a reference to the entry associated with the specified key.

Attempting to access a non-existent entry results in undefined behavior.

Parameters
keyis key associated with the entry
Returns
A reference to the entry associated with the specified key.

Definition at line 270 of file levelSetCache.tpp.

◆ at() [2/2]

template<typename key_t , typename container_t , typename value_t , typename reference_t , typename const_reference_t >
LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::const_reference bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::at ( const key_t & key) const

Get a constant reference to the entry associated with the specified key.

Attempting to access a non-existent entry results in undefined behavior.

Parameters
keyis key associated with the entry
Returns
A constant reference to the entry associated with the specified key.

Definition at line 284 of file levelSetCache.tpp.

◆ begin() [1/2]

template<typename key_t , typename container_t , typename value_t , typename reference_t , typename const_reference_t >
LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::iterator bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::begin ( )

Get an iterator pointing to the first entry.

Returns
An iterator pointing to the first entry.

Definition at line 132 of file levelSetCache.tpp.

◆ begin() [2/2]

template<typename key_t , typename container_t , typename value_t , typename reference_t , typename const_reference_t >
LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::const_iterator bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::begin ( ) const

Get a constant iterator pointing to the first entry.

Returns
A constant iterator pointing to the first entry.

Definition at line 154 of file levelSetCache.tpp.

◆ cbegin()

template<typename key_t , typename container_t , typename value_t , typename reference_t , typename const_reference_t >
LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::const_iterator bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::cbegin ( ) const

Get a constant iterator pointing to the first entry.

Returns
A constant iterator pointing to the first entry.

Definition at line 176 of file levelSetCache.tpp.

◆ cend()

template<typename key_t , typename container_t , typename value_t , typename reference_t , typename const_reference_t >
LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::const_iterator bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_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 187 of file levelSetCache.tpp.

◆ contains()

template<typename key_t , typename container_t , typename value_t , typename reference_t , typename const_reference_t >
bool bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::contains ( const key_t & key) const
overridevirtual

Check if the cache contains an entry for the specified key.

Parameters
keyis key associated with the entry
Returns
True if the cache contains an entry for the specified key, false otherwise.

Implements bitpit::LevelSetCache< key_t >.

Definition at line 199 of file levelSetCache.tpp.

◆ end() [1/2]

template<typename key_t , typename container_t , typename value_t , typename reference_t , typename const_reference_t >
LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::iterator bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_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 143 of file levelSetCache.tpp.

◆ end() [2/2]

template<typename key_t , typename container_t , typename value_t , typename reference_t , typename const_reference_t >
LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::const_iterator bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_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 165 of file levelSetCache.tpp.

◆ find() [1/2]

template<typename key_t , typename container_t , typename value_t = typename container_t::value_type, typename reference_t = value_t &, typename const_reference_t = const value_t &>
virtual const_iterator bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::find ( const key_t & key) const
pure virtual

◆ find() [2/2]

template<typename key_t , typename container_t , typename value_t = typename container_t::value_type, typename reference_t = value_t &, typename const_reference_t = const value_t &>
virtual iterator bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::find ( const key_t & key)
pure virtual

◆ findEntry()

template<typename key_t , typename container_t , typename value_t , typename reference_t , typename const_reference_t >
LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::Entry bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::findEntry ( const key_t & key) const
overridevirtual

Find the entry associated with the specified key.

If the cache doesn't contain an entry associated with the specified key, an invalid entry will be returned.

Parameters
keyis key associated with the entry
Returns
The entry associated with the specified key or an invalid entry if the cache doesn't contain an actual entry associated with the key.

Implements bitpit::LevelSetValueCache< key_t, value_t >.

Definition at line 215 of file levelSetCache.tpp.

◆ getEntryBinarySize()

template<typename key_t , typename container_t , typename value_t , typename reference_t , typename const_reference_t >
std::size_t bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::getEntryBinarySize ( ) const
overridevirtual

Get the size, expressed in bytes, of an entry.

Returns
The size, expressed in bytes, of an entry.

Implements bitpit::LevelSetCache< key_t >.

Definition at line 324 of file levelSetCache.tpp.

◆ getKey()

template<typename key_t , typename container_t , typename value_t = typename container_t::value_type, typename reference_t = value_t &, typename const_reference_t = const value_t &>
virtual key_t bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::getKey ( const const_iterator & itr) const
protectedpure virtual

◆ getValue() [1/2]

template<typename key_t , typename container_t , typename value_t = typename container_t::value_type, typename reference_t = value_t &, typename const_reference_t = const value_t &>
virtual const_reference bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::getValue ( const const_iterator & itr) const
protectedpure virtual

◆ getValue() [2/2]

template<typename key_t , typename container_t , typename value_t = typename container_t::value_type, typename reference_t = value_t &, typename const_reference_t = const value_t &>
virtual reference bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::getValue ( const iterator & itr) const
protectedpure virtual

◆ insert() [1/2]

template<typename key_t , typename container_t , typename value_t = typename container_t::value_type, typename reference_t = value_t &, typename const_reference_t = const value_t &>
virtual iterator bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::insert ( const key_t & key,
const value_t & value )
pure virtual

◆ insert() [2/2]

template<typename key_t , typename container_t , typename value_t = typename container_t::value_type, typename reference_t = value_t &, typename const_reference_t = const value_t &>
virtual iterator bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::insert ( const key_t & key,
value_t && value )
pure virtual

◆ insertEntry() [1/2]

template<typename key_t , typename container_t , typename value_t , typename reference_t , typename const_reference_t >
LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::Entry bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::insertEntry ( const key_t & key,
const value_t & value )
overridevirtual

Insert a cache entry for the specified key.

If an entry associated with the same key is already in the cache, the existing cached value will be replaced by the one passed to the function.

Parameters
keyis key associated with the entry
valueis the value that will be inserted into the cache
Returns
The entry associated with the key.

Implements bitpit::LevelSetValueCache< key_t, value_t >.

Definition at line 236 of file levelSetCache.tpp.

◆ insertEntry() [2/2]

template<typename key_t , typename container_t , typename value_t , typename reference_t , typename const_reference_t >
LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::Entry bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::insertEntry ( const key_t & key,
value_t && value )
overridevirtual

Insert a cache entry for the specified key.

If an entry associated with the same key is already in the cache, the existing cached value will be replaced by the one passed to the function.

Parameters
keyis key associated with the entry
valueis the value that will be inserted into the cache
Returns
The entry associated with the key.

Implements bitpit::LevelSetValueCache< key_t, value_t >.

Definition at line 254 of file levelSetCache.tpp.

◆ operator[]() [1/2]

template<typename key_t , typename container_t , typename value_t , typename reference_t , typename const_reference_t >
LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::reference bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::operator[] ( const key_t & key)

Get a reference to the entry associated with the specified key.

Attempting to access a non-existent entry results in undefined behavior.

Parameters
keyis key associated with the entry
Returns
A reference to the entry associated with the specified key.

Definition at line 298 of file levelSetCache.tpp.

◆ operator[]() [2/2]

template<typename key_t , typename container_t , typename value_t , typename reference_t , typename const_reference_t >
LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::const_reference bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::operator[] ( const key_t & key) const

Get a constant reference to the entry associated with the specified key.

Attempting to access a non-existent entry results in undefined behavior.

Parameters
keyis key associated with the entry
Returns
A constant reference to the entry associated with the specified key.

Definition at line 312 of file levelSetCache.tpp.

◆ readBuffer()

template<typename key_t , typename container_t , typename value_t , typename reference_t , typename const_reference_t >
void bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::readBuffer ( const std::vector< key_t > & keys,
RecvBuffer & buffer )
overridevirtual

Read the specified entries from the given buffer.

Parameters
keysis the list of keys whose data need to be received
[in,out]bufferis the buffer to read from

Implements bitpit::LevelSetCache< key_t >.

Definition at line 356 of file levelSetCache.tpp.

◆ writeBuffer()

template<typename key_t , typename container_t , typename value_t , typename reference_t , typename const_reference_t >
void bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::writeBuffer ( const std::vector< key_t > & keys,
SendBuffer & buffer ) const
overridevirtual

Write the specified entries to the given buffer.

Parameters
[in]keysis the list of keys whose data need to be send
[in,out]bufferis the buffer to write to

Implements bitpit::LevelSetCache< key_t >.

Definition at line 336 of file levelSetCache.tpp.

Member Data Documentation

◆ m_container

template<typename key_t , typename container_t , typename value_t = typename container_t::value_type, typename reference_t = value_t &, typename const_reference_t = const value_t &>
container_t bitpit::LevelSetContainerBaseCache< key_t, container_t, value_t, reference_t, const_reference_t >::m_container
protected

Definition at line 223 of file levelSetCache.hpp.


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