hpx/cache/entries/entry.hpp
hpx/cache/entries/entry.hpp#
See Public API for a list of names and headers that are part of the public HPX API.
-
namespace hpx
-
namespace util
-
namespace cache#
-
namespace entries#
-
class entry#
- #include <hpx/cache/entries/entry.hpp>
- Template Parameters
Value – The data type to be stored in a cache. It has to be default constructible, copy constructible and less_than_comparable.
Derived – The (optional) type for which this type is used as a base class.
Public Types
-
using value_type = Value#
Public Functions
-
entry() = default#
Any cache entry has to be default constructible.
-
inline explicit entry(value_type const &val) noexcept(std::is_nothrow_copy_constructible_v<value_type>)#
Construct a new instance of a cache entry holding the given value.
-
inline explicit entry(value_type &&val) noexcept#
Construct a new instance of a cache entry holding the given value.
-
inline constexpr bool touch() const noexcept#
The function touch is called by a cache holding this instance whenever it has been requested (touched).
Note
It is possible to change the entry in a way influencing the sort criteria mandated by the UpdatePolicy. In this case the function should return true to indicate this to the cache, forcing to reorder the cache entries.
Note
This function is part of the CacheEntry concept
- Returns
This function should return true if the cache needs to update it’s internal heap. Usually this is needed if the entry has been changed by touch() in a way influencing the sort order as mandated by the cache’s UpdatePolicy
-
inline constexpr bool insert() const noexcept#
The function insert is called by a cache whenever it is about to be inserted into the cache.
Note
This function is part of the CacheEntry concept
- Returns
This function should return true if the entry should be added to the cache, otherwise it should return false.
-
inline constexpr bool remove() const noexcept#
The function remove is called by a cache holding this instance whenever it is about to be removed from the cache.
Note
This function is part of the CacheEntry concept
- Returns
The return value can be used to avoid removing this instance from the cache. If the value is true it is ok to remove the entry, other wise it will stay in the cache.
-
inline constexpr std::size_t get_size() const noexcept#
Return the ‘size’ of this entry. By default the size of each entry is just one (1), which is sensible if the cache has a limit (capacity) measured in number of entries.
-
inline value_type &get() noexcept#
Get a reference to the stored data value.
Note
This function is part of the CacheEntry concept
-
inline constexpr value_type const &get() const noexcept#
Private Members
-
value_type value_#
Friends
-
inline friend bool operator<(entry const &lhs, entry const &rhs) noexcept(noexcept(std::declval<value_type const&>() < std::declval<value_type const&>()))#
Forwarding operator< allowing to compare entries instead of the values.
-
class entry#
-
namespace entries#
-
namespace cache#
-
namespace util