26 #ifndef NFD_DAEMON_TABLE_CS_HPP 27 #define NFD_DAEMON_TABLE_CS_HPP 32 #include <ndn-cxx/util/signal.hpp> 33 #include <boost/iterator/transform_iterator.hpp> 48 class Cs : noncopyable
52 Cs(
size_t nMaxPackets = 10);
57 insert(
const Data& data,
bool isUnsolicited =
false);
70 using HitCallback = std::function<void(const Interest&, const Data&)>;
90 return m_table.size();
99 return m_policy->getLimit();
107 return m_policy->setLimit(nMaxPackets);
115 return m_policy.get();
130 return m_shouldAdmit;
145 return m_shouldServe;
168 typedef boost::transform_iterator<EntryFromEntryImpl, iterator, const Entry&>
const_iterator;
202 setPolicyImpl(unique_ptr<Policy> policy);
210 unique_ptr<Policy> m_policy;
223 #endif // NFD_DAEMON_TABLE_CS_HPP #define PUBLIC_WITH_TESTS_ELSE_PRIVATE
std::function< void(size_t nErased)> AfterEraseCallback
std::set< EntryImpl > Table
size_t getLimit() const
get capacity (in number of packets)
const Entry & operator()(const EntryImpl &entry) const
bool shouldAdmit() const
get CS_ENABLE_ADMIT flag
Represents an Interest packet.
bool shouldServe() const
get CS_ENABLE_SERVE flag
const_iterator begin() const
const Entry & result_type
void enableAdmit(bool shouldAdmit)
set CS_ENABLE_ADMIT flag
declares ContentStore internal types
an Entry in ContentStore implementation
Table::const_iterator iterator
represents a CS replacement policy
size_t size() const
get number of stored packets
void insert(const Data &data, bool isUnsolicited=false)
inserts a Data packet
Copyright (c) 2011-2015 Regents of the University of California.
void erase(const Name &prefix, size_t limit, const AfterEraseCallback &cb)
asynchronously erases entries under prefix
boost::transform_iterator< EntryFromEntryImpl, iterator, const Entry & > const_iterator
ContentStore iterator (public API)
void setPolicy(unique_ptr< Policy > policy)
change replacement policy
Cs(size_t nMaxPackets=10)
represents a base class for CS entry
disconnects a Connection automatically upon destruction
void setLimit(size_t nMaxPackets)
change capacity (in number of packets)
Represents an absolute name.
void find(const Interest &interest, const HitCallback &hitCallback, const MissCallback &missCallback) const
finds the best matching Data packet
implements the Content Store
const_iterator end() const
std::function< void(const Interest &, const Data &)> HitCallback
Represents a Data packet.
std::function< void(const Interest &)> MissCallback
void enableServe(bool shouldServe)
set CS_ENABLE_SERVE flag
Policy * getPolicy() const
get replacement policy