NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
cs-policy-priority-fifo.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_FIFO_HPP
27
#define NFD_DAEMON_TABLE_CS_POLICY_FIFO_HPP
28
29
#include "
cs-policy.hpp
"
30
#include "common.hpp"
31
#include "
core/scheduler.hpp
"
32
33
namespace
nfd
{
34
namespace
cs {
35
namespace
priority_fifo {
36
37
typedef
std::list<iterator>
Queue
;
38
typedef
Queue::iterator
QueueIt
;
39
40
enum
QueueType
{
41
QUEUE_UNSOLICITED
,
42
QUEUE_STALE
,
43
QUEUE_FIFO
,
44
QUEUE_MAX
45
};
46
47
struct
EntryInfo
48
{
49
QueueType
queueType
;
50
QueueIt
queueIt
;
51
scheduler::EventId
moveStaleEventId
;
52
};
53
54
struct
EntryItComparator
55
{
56
bool
57
operator()
(
const
iterator
& a,
const
iterator
& b)
const
58
{
59
return
*a < *b;
60
}
61
};
62
63
typedef
std::map<iterator, EntryInfo*, EntryItComparator>
EntryInfoMapFifo
;
64
73
class
PriorityFifoPolicy
:
public
Policy
74
{
75
public
:
76
PriorityFifoPolicy
();
77
78
virtual
79
~
PriorityFifoPolicy
();
80
81
public
:
82
static
const
std::string
POLICY_NAME
;
83
84
private
:
85
virtual
void
86
doAfterInsert(
iterator
i)
DECL_OVERRIDE
;
87
88
virtual
void
89
doAfterRefresh(
iterator
i)
DECL_OVERRIDE
;
90
91
virtual
void
92
doBeforeErase(
iterator
i)
DECL_OVERRIDE
;
93
94
virtual
void
95
doBeforeUse(
iterator
i)
DECL_OVERRIDE
;
96
97
virtual
void
98
evictEntries() DECL_OVERRIDE;
99
100
private:
104
void
105
evictOne();
106
110
void
111
attachQueue(
iterator
i);
112
116
void
117
detachQueue(
iterator
i);
118
121
void
122
moveToStaleQueue(
iterator
i);
123
124
private:
125
Queue m_queues[
QUEUE_MAX
];
126
EntryInfoMapFifo m_entryInfoMap;
127
};
128
129
}
// namespace priorityfifo
130
131
using priority_fifo::
PriorityFifoPolicy
;
132
133
}
// namespace cs
134
}
// namespace nfd
135
136
#endif // NFD_DAEMON_TABLE_CS_POLICY_FIFO_HPP
nfd::cs::priority_fifo::EntryInfo::queueIt
QueueIt queueIt
Definition:
cs-policy-priority-fifo.hpp:50
nfd::cs::priority_fifo::QueueType
QueueType
Definition:
cs-policy-priority-fifo.hpp:40
nfd::cs::priority_fifo::QUEUE_FIFO
Definition:
cs-policy-priority-fifo.hpp:43
DECL_OVERRIDE
#define DECL_OVERRIDE
expands to 'override' if compiler supports 'override' specifier, otherwise expands to nothing ...
Definition:
common.hpp:50
nfd::cs::priority_fifo::QUEUE_STALE
Definition:
cs-policy-priority-fifo.hpp:42
nfd::cs::iterator
Table::const_iterator iterator
Definition:
cs-internal.hpp:41
ndn::util::scheduler::EventId
std::shared_ptr< ns3::EventId > EventId
Definition:
scheduler.hpp:39
nfd::cs::Policy
represents a CS replacement policy
Definition:
cs-policy.hpp:39
nfd::cs::priority_fifo::QUEUE_UNSOLICITED
Definition:
cs-policy-priority-fifo.hpp:41
nfd::cs::priority_fifo::Queue
std::list< iterator > Queue
Definition:
cs-policy-priority-fifo.hpp:37
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
nfd::cs::priority_fifo::PriorityFifoPolicy::POLICY_NAME
static const std::string POLICY_NAME
Definition:
cs-policy-priority-fifo.hpp:82
nfd::cs::priority_fifo::EntryItComparator
Definition:
cs-policy-priority-fifo.hpp:54
nfd::cs::priority_fifo::EntryInfo::queueType
QueueType queueType
Definition:
cs-policy-priority-fifo.hpp:49
scheduler.hpp
nfd::cs::priority_fifo::EntryInfo::moveStaleEventId
scheduler::EventId moveStaleEventId
Definition:
cs-policy-priority-fifo.hpp:51
cs-policy.hpp
nfd::cs::priority_fifo::QUEUE_MAX
Definition:
cs-policy-priority-fifo.hpp:44
nfd::cs::priority_fifo::EntryInfoMapFifo
std::map< iterator, EntryInfo *, EntryItComparator > EntryInfoMapFifo
Definition:
cs-policy-priority-fifo.hpp:63
nfd::cs::priority_fifo::EntryItComparator::operator()
bool operator()(const iterator &a, const iterator &b) const
Definition:
cs-policy-priority-fifo.hpp:57
nfd::cs::priority_fifo::QueueIt
Queue::iterator QueueIt
Definition:
cs-policy-priority-fifo.hpp:38
nfd::cs::priority_fifo::PriorityFifoPolicy
Priority Fifo cs replacement policy.
Definition:
cs-policy-priority-fifo.hpp:73
nfd::cs::priority_fifo::EntryInfo
Definition:
cs-policy-priority-fifo.hpp:47
ndnSIM
NFD
daemon
table
cs-policy-priority-fifo.hpp
Generated on Sat Nov 12 2016 16:02:54 for ndnSIM by
1.8.12