NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
measurements-accessor.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26
#ifndef NFD_DAEMON_TABLE_MEASUREMENTS_ACCESSOR_HPP
27
#define NFD_DAEMON_TABLE_MEASUREMENTS_ACCESSOR_HPP
28
29
#include "
measurements.hpp
"
30
#include "
strategy-choice.hpp
"
31
32
namespace
nfd
{
33
34
namespace
fw {
35
class
Strategy
;
36
}
// namespace fw
37
38
namespace
measurements {
39
45
class
MeasurementsAccessor
: noncopyable
46
{
47
public
:
48
MeasurementsAccessor
(
Measurements
& measurements,
const
StrategyChoice
& strategyChoice,
49
const
fw::Strategy
& strategy);
50
51
~MeasurementsAccessor
();
52
55
Entry
*
56
get
(
const
Name
&
name
);
57
60
Entry
*
61
get
(
const
fib::Entry
& fibEntry);
62
65
Entry
*
66
get
(
const
pit::Entry
& pitEntry);
67
70
Entry
*
71
getParent
(
const
Entry
& child);
72
75
Entry
*
76
findLongestPrefixMatch
(
const
Name
&
name
,
77
const
EntryPredicate
& pred =
78
AnyEntry
())
const
;
79
82
Entry
*
83
findLongestPrefixMatch
(
const
pit::Entry
& pitEntry,
84
const
EntryPredicate
& pred =
85
AnyEntry
())
const
;
86
89
Entry
*
90
findExactMatch
(
const
Name
&
name
)
const
;
91
96
void
97
extendLifetime
(
Entry
& entry,
const
time::nanoseconds& lifetime);
98
99
private
:
103
Entry
*
104
filter(
Entry
* entry)
const
;
105
106
Entry
*
107
filter(
Entry
& entry)
const
;
108
109
private
:
110
Measurements
& m_measurements;
111
const
StrategyChoice
& m_strategyChoice;
112
const
fw::Strategy
* m_strategy;
113
};
114
115
inline
Entry
*
116
MeasurementsAccessor::filter(
Entry
& entry)
const
117
{
118
return
this->filter(&entry);
119
}
120
121
inline
Entry*
122
MeasurementsAccessor::get
(
const
Name
&
name
)
123
{
124
return
this->filter(m_measurements.
get
(
name
));
125
}
126
127
inline
Entry
*
128
MeasurementsAccessor::get
(
const
fib::Entry
& fibEntry)
129
{
130
return
this->filter(m_measurements.
get
(fibEntry));
131
}
132
133
inline
Entry
*
134
MeasurementsAccessor::get
(
const
pit::Entry
& pitEntry)
135
{
136
return
this->filter(m_measurements.
get
(pitEntry));
137
}
138
139
inline
Entry
*
140
MeasurementsAccessor::getParent
(
const
Entry
& child)
141
{
142
return
this->filter(m_measurements.
getParent
(child));
143
}
144
145
inline
Entry
*
146
MeasurementsAccessor::findLongestPrefixMatch
(
const
Name
&
name
,
147
const
EntryPredicate
& pred)
const
148
{
149
return
this->filter(m_measurements.
findLongestPrefixMatch
(
name
, pred));
150
}
151
152
inline
Entry
*
153
MeasurementsAccessor::findLongestPrefixMatch
(
const
pit::Entry
& pitEntry,
154
const
EntryPredicate
& pred)
const
155
{
156
return
this->filter(m_measurements.
findLongestPrefixMatch
(pitEntry, pred));
157
}
158
159
inline
Entry
*
160
MeasurementsAccessor::findExactMatch
(
const
Name
&
name
)
const
161
{
162
return
this->filter(m_measurements.
findExactMatch
(
name
));
163
}
164
165
inline
void
166
MeasurementsAccessor::extendLifetime
(
Entry
& entry,
const
time::nanoseconds& lifetime)
167
{
168
m_measurements.
extendLifetime
(entry, lifetime);
169
}
170
171
}
// namespace measurements
172
173
using
measurements::MeasurementsAccessor
;
174
175
}
// namespace nfd
176
177
#endif // NFD_DAEMON_TABLE_MEASUREMENTS_ACCESSOR_HPP
nfd::measurements::MeasurementsAccessor::MeasurementsAccessor
MeasurementsAccessor(Measurements &measurements, const StrategyChoice &strategyChoice, const fw::Strategy &strategy)
Definition:
measurements-accessor.cpp:33
nfd::fw::Strategy
Strategy
Definition:
strategy.cpp:38
nfd::measurements::MeasurementsAccessor
allows Strategy to access portion of Measurements table under its namespace
Definition:
measurements-accessor.hpp:46
nfd::measurements::Measurements::get
Entry & get(const Name &name)
Find or insert an entry by name.
Definition:
measurements.cpp:59
nfd::measurements::MeasurementsAccessor::extendLifetime
void extendLifetime(Entry &entry, const time::nanoseconds &lifetime)
extend lifetime of an entry
Definition:
measurements-accessor.hpp:166
nfd::measurements::EntryPredicate
std::function< bool(const Entry &)> EntryPredicate
A predicate that accepts or rejects an entry.
Definition:
measurements.hpp:46
nfd::measurements::MeasurementsAccessor::getParent
Entry * getParent(const Entry &child)
find or insert a Measurements entry for child's parent
Definition:
measurements-accessor.hpp:140
nfd::measurements::Measurements::findExactMatch
Entry * findExactMatch(const Name &name) const
Perform an exact match.
Definition:
measurements.cpp:120
ndn::Name
Represents an absolute name.
Definition:
name.hpp:44
nfd::measurements::MeasurementsAccessor::~MeasurementsAccessor
~MeasurementsAccessor()
Definition:
measurements-accessor.cpp:42
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
nfd::measurements::Measurements::extendLifetime
void extendLifetime(Entry &entry, const time::nanoseconds &lifetime)
Extend lifetime of an entry.
Definition:
measurements.cpp:127
nfd::measurements::Measurements
The Measurements table.
Definition:
measurements.hpp:80
nfd::pit::Entry
An Interest table entry.
Definition:
pit-entry.hpp:59
nfd::measurements::MeasurementsAccessor::get
Entry * get(const Name &name)
find or insert a Measurements entry for name
Definition:
measurements-accessor.hpp:122
nfd::measurements::Measurements::findLongestPrefixMatch
Entry * findLongestPrefixMatch(const Name &name, const EntryPredicate &pred=AnyEntry()) const
Perform a longest prefix match for name.
Definition:
measurements.cpp:108
nfd::measurements::MeasurementsAccessor::findLongestPrefixMatch
Entry * findLongestPrefixMatch(const Name &name, const EntryPredicate &pred=AnyEntry()) const
perform a longest prefix match for name
Definition:
measurements-accessor.hpp:146
nfd::fib::Entry
represents a FIB entry
Definition:
fib-entry.hpp:54
nfd::fw::Strategy
represents a forwarding strategy
Definition:
strategy.hpp:38
nfd::measurements::MeasurementsAccessor::findExactMatch
Entry * findExactMatch(const Name &name) const
perform an exact match
Definition:
measurements-accessor.hpp:160
nfd::measurements::Measurements::getParent
Entry * getParent(const Entry &child)
Find or insert a parent entry.
Definition:
measurements.cpp:80
nfd::measurements::Entry
Represents a Measurements entry.
Definition:
measurements-entry.hpp:42
ndn::name
Definition:
name-component-types.hpp:33
nfd::strategy_choice::StrategyChoice
Represents the Strategy Choice table.
Definition:
strategy-choice.hpp:52
strategy-choice.hpp
measurements.hpp
nfd::measurements::AnyEntry
An EntryPredicate that accepts any entry.
Definition:
measurements.hpp:51
ndnSIM
NFD
daemon
table
measurements-accessor.hpp
Generated on Mon Jun 1 2020 22:32:16 for ndnSIM by
1.8.18