MatchDepository.hpp
A container for tag-based lookup, optimized for situations where tags are not removed from the lookup set.
-
template<typename Val, typename Metric, typename Selector, typename Regulator, size_t RawCacheSize = 0, size_t RegulatedCacheSize = 0>
class MatchDepository - #include <MatchDepository.hpp>
Public Types
-
using uid_t = size_t
Public Functions
-
inline const Val &GetVal(const size_t uid) const
Access a reference to a single stored value by uid.
-
inline size_t GetSize() const
Get number of stored values.
-
inline void Clear()
Clear stored values.
-
inline void DecayRegulators(const int steps = 1)
Apply decay to all regulators.
Private Functions
-
inline res_t *DoRegulatedLookup(const query_t &query)
Return ptr to cached regulated result on success, nullptr on failure.
-
inline res_t *DoRawLookup(const query_t &query)
Return ptr to cached raw result on success, nullptr on failure.
-
inline void ClearCache()
Clear cached raw, regulated results.
Private Members
-
SmallFifoMap<query_t, res_t, RawCacheSize> cache_raw
-
SmallFifoMap<query_t, res_t, RegulatedCacheSize> cache_regulated
-
using uid_t = size_t