30 #include <boost/range/adaptor/map.hpp> 31 #include <boost/range/algorithm/copy.hpp> 41 static Registry registry;
48 Registry& registry = getRegistry();
49 auto i = registry.find(policyName);
50 return i == registry.end() ? nullptr : i->second();
56 std::set<std::string> policyNames;
57 boost::copy(getRegistry() | boost::adaptors::map_keys,
58 std::inserter(policyNames, policyNames.end()));
63 : m_policyName(policyName)
71 m_limit = nMaxEntries;
78 BOOST_ASSERT(m_cs !=
nullptr);
85 BOOST_ASSERT(m_cs !=
nullptr);
92 BOOST_ASSERT(m_cs !=
nullptr);
99 BOOST_ASSERT(m_cs !=
nullptr);
virtual void evictEntries()=0
evicts zero or more entries
void setLimit(size_t nMaxEntries)
sets hard limit (in number of entries)
static unique_ptr< Policy > create(const std::string &policyName)
virtual void doAfterRefresh(iterator i)=0
invoked after an existing entry is refreshed by same Data
virtual void doBeforeUse(iterator i)=0
invoked before an entry is used to match a lookup
Table::const_iterator iterator
static std::set< std::string > getPolicyNames()
void beforeErase(iterator i)
invoked by CS before an entry is erased due to management command
Copyright (c) 2011-2015 Regents of the University of California.
void beforeUse(iterator i)
invoked by CS before an entry is used to match a lookup
virtual void doBeforeErase(iterator i)=0
invoked before an entry is erased due to management command
void afterInsert(iterator i)
invoked by CS after a new entry is inserted
virtual void doAfterInsert(iterator i)=0
invoked after a new entry is created in CS
Policy(const std::string &policyName)
#define NFD_LOG_INIT(name)
void afterRefresh(iterator i)
invoked by CS after an existing entry is refreshed by same Data