29 #include <boost/range/adaptor/map.hpp> 30 #include <boost/range/algorithm/copy.hpp> 40 static Registry registry;
47 Registry& registry = getRegistry();
48 auto i = registry.find(policyName);
49 return i == registry.end() ? nullptr : i->second();
55 std::set<std::string> policyNames;
56 boost::copy(getRegistry() | boost::adaptors::map_keys,
57 std::inserter(policyNames, policyNames.end()));
62 : m_policyName(policyName)
70 m_limit = nMaxEntries;
77 BOOST_ASSERT(m_cs !=
nullptr);
84 BOOST_ASSERT(m_cs !=
nullptr);
91 BOOST_ASSERT(m_cs !=
nullptr);
98 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
#define NFD_LOG_INFO(expression)
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