NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
cs-policy-lru.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26
#ifndef NFD_DAEMON_TABLE_CS_POLICY_LRU_HPP
27
#define NFD_DAEMON_TABLE_CS_POLICY_LRU_HPP
28
29
#include "
cs-policy.hpp
"
30
#include "common.hpp"
31
32
#include <boost/multi_index_container.hpp>
33
#include <boost/multi_index/sequenced_index.hpp>
34
#include <boost/multi_index/hashed_index.hpp>
35
36
namespace
nfd
{
37
namespace
cs {
38
namespace
lru {
39
40
struct
EntryItComparator
41
{
42
bool
43
operator()
(
const
iterator
& a,
const
iterator
& b)
const
44
{
45
return
*a < *b;
46
}
47
};
48
49
typedef
boost::multi_index_container<
50
iterator
,
51
boost::multi_index::indexed_by<
52
boost::multi_index::sequenced<>,
53
boost::multi_index::ordered_unique<
54
boost::multi_index::identity<iterator>,
EntryItComparator
55
>
56
>
57
>
Queue
;
58
65
class
LruPolicy
:
public
Policy
66
{
67
public
:
68
LruPolicy
();
69
70
public
:
71
static
const
std::string
POLICY_NAME
;
72
73
private
:
74
virtual
void
75
doAfterInsert(iterator i)
DECL_OVERRIDE
;
76
77
virtual
void
78
doAfterRefresh(iterator i)
DECL_OVERRIDE
;
79
80
virtual
void
81
doBeforeErase(iterator i)
DECL_OVERRIDE
;
82
83
virtual
void
84
doBeforeUse(iterator i)
DECL_OVERRIDE
;
85
86
virtual
void
87
evictEntries() DECL_OVERRIDE;
88
89
private:
92
void
93
insertToQueue(iterator i,
bool
isNewEntry);
94
95
private:
96
Queue
m_queue;
97
};
98
99
}
// namespace lru
100
101
using lru::
LruPolicy
;
102
103
}
// namespace cs
104
}
// namespace nfd
105
106
#endif // NFD_DAEMON_TABLE_CS_POLICY_LRU_HPP
nfd::cs::lru::EntryItComparator
Definition:
cs-policy-lru.hpp:40
DECL_OVERRIDE
#define DECL_OVERRIDE
expands to 'override' if compiler supports this feature, otherwise expands to nothing ...
Definition:
common.hpp:49
nfd::cs::iterator
Table::const_iterator iterator
Definition:
cs-internal.hpp:41
nfd::cs::Policy
represents a CS replacement policy
Definition:
cs-policy.hpp:39
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:38
nfd::cs::lru::Queue
boost::multi_index_container< iterator, boost::multi_index::indexed_by< boost::multi_index::sequenced<>, boost::multi_index::ordered_unique< boost::multi_index::identity< iterator >, EntryItComparator > > > Queue
Definition:
cs-policy-lru.hpp:57
nfd::cs::lru::EntryItComparator::operator()
bool operator()(const iterator &a, const iterator &b) const
Definition:
cs-policy-lru.hpp:43
nfd::cs::lru::LruPolicy
LRU cs replacement policy.
Definition:
cs-policy-lru.hpp:65
cs-policy.hpp
nfd::cs::lru::LruPolicy::POLICY_NAME
static const std::string POLICY_NAME
Definition:
cs-policy-lru.hpp:71
ndnSIM
NFD
daemon
table
cs-policy-lru.hpp
Generated on Tue Feb 23 2016 22:18:44 for ndnSIM by
1.8.11