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  m_limit = nMaxEntries;
45  this->evictEntries();
46 }
47 
48 void
50 {
51  BOOST_ASSERT(m_cs != nullptr);
52  this->doAfterInsert(i);
53 }
54 
55 void
57 {
58  BOOST_ASSERT(m_cs != nullptr);
59  this->doAfterRefresh(i);
60 }
61 
62 void
64 {
65  BOOST_ASSERT(m_cs != nullptr);
66  this->doBeforeErase(i);
67 }
68 
69 void
71 {
72  BOOST_ASSERT(m_cs != nullptr);
73  this->doBeforeUse(i);
74 }
75 
76 } // namespace cs
77 } // 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-2016, 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:63
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
void beforeUse(iterator i)
invoked by CS before an entry is used to match a lookup
Definition: cs-policy.cpp:70
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:49
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:56