Rosetta  2020.37
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Attributes | List of all members
utility::thread::MutableCache< K, V > Class Template Reference

#include <mutable_cache.hh>

Public Member Functions

 MutableCache ()=default
 
 ~MutableCache ()=default
 
 MutableCache (MutableCache const &src)
 
 MutableCache (MutableCache &&src)
 
MutableCacheoperator= (MutableCache const &src)
 
MutableCacheoperator= (MutableCache &&src)
 
bool has (K const &key) const
 
V const & get (K const &key) const
 
void add_if_missing (K const &key, V const &value)
 Add the key:value pair to the map, but only if the key isn't already present. More...
 
void add_if_missing (K const &key, std::function< V() > creator)
 Add a key:value pair to the map if the key isn't present. The creator function will be called to generate the value. More...
 
void add_if_missing (K const &key, std::function< V(K const &) > creator)
 Add a key:value pair to the map if the key isn't present. The creator function will be called to generate the value. More...
 

Private Attributes

std::map< K, V > data_
 

Constructor & Destructor Documentation

template<class K , class V >
utility::thread::MutableCache< K, V >::MutableCache ( )
default
template<class K , class V >
utility::thread::MutableCache< K, V >::~MutableCache ( )
default
template<class K , class V >
utility::thread::MutableCache< K, V >::MutableCache ( MutableCache< K, V > const &  src)
template<class K , class V >
utility::thread::MutableCache< K, V >::MutableCache ( MutableCache< K, V > &&  src)

Member Function Documentation

template<class K , class V >
void utility::thread::MutableCache< K, V >::add_if_missing ( K const &  key,
V const &  value 
)

Add the key:value pair to the map, but only if the key isn't already present.

References basic::options::OptionKeys::cloud::key, and value.

template<class K , class V >
void utility::thread::MutableCache< K, V >::add_if_missing ( K const &  key,
std::function< V() >  creator 
)

Add a key:value pair to the map if the key isn't present. The creator function will be called to generate the value.

References basic::options::OptionKeys::cloud::key.

template<class K , class V >
void utility::thread::MutableCache< K, V >::add_if_missing ( K const &  key,
std::function< V(K const &) >  creator 
)

Add a key:value pair to the map if the key isn't present. The creator function will be called to generate the value.

References basic::options::OptionKeys::cloud::key.

template<class K , class V >
V const & utility::thread::MutableCache< K, V >::get ( K const &  key) const
template<class K , class V >
bool utility::thread::MutableCache< K, V >::has ( K const &  key) const
template<class K , class V >
MutableCache< K, V > & utility::thread::MutableCache< K, V >::operator= ( MutableCache< K, V > const &  src)
template<class K , class V >
MutableCache< K, V > & utility::thread::MutableCache< K, V >::operator= ( MutableCache< K, V > &&  src)

Member Data Documentation

template<class K , class V >
std::map< K, V > utility::thread::MutableCache< K, V >::data_
private

The documentation for this class was generated from the following file: