NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
cs-policy.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #include "cs-policy.hpp"
27 #include "cs.hpp"
28 
29 namespace nfd {
30 namespace cs {
31 
32 Policy::Policy(const std::string& policyName)
33  : m_policyName(policyName)
34 {
35 }
36 
38 {
39 }
40 
41 void
42 Policy::setLimit(size_t nMaxEntries)
43 {
44  BOOST_ASSERT(nMaxEntries > 0);
45  m_limit = nMaxEntries;
46 
47  this->evictEntries();
48 }
49 
50 void
52 {
53  BOOST_ASSERT(m_cs != nullptr);
54  this->doAfterInsert(i);
55 }
56 
57 void
59 {
60  BOOST_ASSERT(m_cs != nullptr);
61  this->doAfterRefresh(i);
62 }
63 
64 void
66 {
67  BOOST_ASSERT(m_cs != nullptr);
68  this->doBeforeErase(i);
69 }
70 
71 void
73 {
74  BOOST_ASSERT(m_cs != nullptr);
75  this->doBeforeUse(i);
76 }
77 
78 } // namespace cs
79 } // namespace nfd
virtual void evictEntries()=0
evicts zero or more entries
void setLimit(size_t nMaxEntries)
sets hard limit (in number of entries)
Definition: cs-policy.cpp:42
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
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
virtual ~Policy()
Definition: cs-policy.cpp:37
Table::const_iterator iterator
Definition: cs-internal.hpp:41
void beforeErase(iterator i)
invoked by CS before an entry is erased due to management command
Definition: cs-policy.cpp:65
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:38
void beforeUse(iterator i)
invoked by CS before an entry is used to match a lookup
Definition: cs-policy.cpp:72
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
Definition: cs-policy.cpp:51
virtual void doAfterInsert(iterator i)=0
invoked after a new entry is created in CS
Policy(const std::string &policyName)
Definition: cs-policy.cpp:32
void afterRefresh(iterator i)
invoked by CS after an existing entry is refreshed by same Data
Definition: cs-policy.cpp:58