NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
measurements.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_HPP
27
#define NFD_DAEMON_TABLE_MEASUREMENTS_HPP
28
29
#include "
measurements-entry.hpp
"
30
#include "
name-tree.hpp
"
31
32
namespace
nfd
{
33
34
namespace
fib {
35
class
Entry;
36
}
// namespace fib
37
38
namespace
pit {
39
class
Entry;
40
}
// namespace pit
41
42
namespace
measurements {
43
46
typedef
std::function<bool(const Entry&)>
EntryPredicate
;
47
50
class
AnyEntry
51
{
52
public
:
53
bool
54
operator()
(
const
Entry
& entry)
const
55
{
56
return
true
;
57
}
58
};
59
62
template
<
typename
T>
63
class
EntryWithStrategyInfo
64
{
65
public
:
66
bool
67
operator()
(
const
Entry
& entry)
const
68
{
69
return
entry.
getStrategyInfo
<T>() !=
nullptr
;
70
}
71
};
72
75
class
Measurements
: noncopyable
76
{
77
public
:
78
explicit
79
Measurements
(
NameTree
& nametree);
80
83
Entry
&
84
get
(
const
Name
&
name
);
85
88
Entry
&
89
get
(
const
fib::Entry
& fibEntry);
90
93
Entry
&
94
get
(
const
pit::Entry
& pitEntry);
95
99
Entry
*
100
getParent
(
const
Entry
& child);
101
104
Entry
*
105
findLongestPrefixMatch
(
const
Name
&
name
,
106
const
EntryPredicate
& pred =
AnyEntry
())
const
;
107
110
Entry
*
111
findLongestPrefixMatch
(
const
pit::Entry
& pitEntry,
112
const
EntryPredicate
& pred =
AnyEntry
())
const
;
113
116
Entry
*
117
findExactMatch
(
const
Name
&
name
)
const
;
118
119
static
time::nanoseconds
120
getInitialLifetime
();
121
126
void
127
extendLifetime
(
Entry
& entry,
const
time::nanoseconds& lifetime);
128
129
size_t
130
size
()
const
;
131
132
private
:
133
void
134
cleanup(
Entry
& entry);
135
136
Entry
&
137
get
(
name_tree::Entry
& nte);
138
141
template
<
typename
K>
142
Entry
*
143
findLongestPrefixMatchImpl(
const
K& key,
const
EntryPredicate
& pred)
const
;
144
145
private
:
146
NameTree
& m_nameTree;
147
size_t
m_nItems;
148
};
149
150
inline
time::nanoseconds
151
Measurements::getInitialLifetime
()
152
{
153
return
time::seconds(4);
154
}
155
156
inline
size_t
157
Measurements::size
()
const
158
{
159
return
m_nItems;
160
}
161
162
}
// namespace measurements
163
164
using
measurements::Measurements
;
165
166
}
// namespace nfd
167
168
#endif // NFD_DAEMON_TABLE_MEASUREMENTS_HPP
nfd::measurements::Measurements::findExactMatch
Entry * findExactMatch(const Name &name) const
perform an exact match
Definition:
measurements.cpp:123
nfd::fib::Entry
represents a FIB entry
Definition:
fib-entry.hpp:51
nfd::measurements::EntryPredicate
std::function< bool(const Entry &)> EntryPredicate
a predicate that accepts or rejects an entry
Definition:
measurements.hpp:46
nfd::measurements::Measurements::findLongestPrefixMatch
Entry * findLongestPrefixMatch(const Name &name, const EntryPredicate &pred=AnyEntry()) const
perform a longest prefix match for name
Definition:
measurements.cpp:111
nfd::measurements::Entry
represents a Measurements entry
Definition:
measurements-entry.hpp:42
nfd::measurements::Measurements::size
size_t size() const
Definition:
measurements.hpp:157
nfd::measurements::Measurements::getParent
Entry * getParent(const Entry &child)
find or insert a Measurements entry for child's parent
Definition:
measurements.cpp:83
nfd::measurements::EntryWithStrategyInfo::operator()
bool operator()(const Entry &entry) const
Definition:
measurements.hpp:67
nfd::measurements::AnyEntry::operator()
bool operator()(const Entry &entry) const
Definition:
measurements.hpp:54
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
nfd::pit::Entry
an Interest table entry
Definition:
pit-entry.hpp:57
nfd::measurements::Measurements::extendLifetime
void extendLifetime(Entry &entry, const time::nanoseconds &lifetime)
extend lifetime of an entry
Definition:
measurements.cpp:130
nfd::measurements::EntryWithStrategyInfo
an EntryPredicate that accepts an entry if it has StrategyInfo of type T
Definition:
measurements.hpp:63
nfd::measurements::Measurements::Measurements
Measurements(NameTree &nametree)
Definition:
measurements.cpp:34
nfd::measurements::Measurements
represents the Measurements table
Definition:
measurements.hpp:75
measurements-entry.hpp
nfd::measurements::AnyEntry
an EntryPredicate that accepts any entry
Definition:
measurements.hpp:50
ndn::Name
Represents an absolute name.
Definition:
name.hpp:42
nfd::name_tree::NameTree
a common index structure for FIB, PIT, StrategyChoice, and Measurements
Definition:
name-tree.hpp:36
name-tree.hpp
nfd::measurements::Measurements::getInitialLifetime
static time::nanoseconds getInitialLifetime()
Definition:
measurements.hpp:151
ndn::name
Definition:
name-component.cpp:38
nfd::name_tree::Entry
an entry in the name tree
Definition:
name-tree-entry.hpp:41
nfd::StrategyInfoHost::getStrategyInfo
T * getStrategyInfo() const
get a StrategyInfo item
Definition:
strategy-info-host.hpp:44
ndnSIM
NFD
daemon
table
measurements.hpp
Generated on Sun Feb 25 2018 13:27:06 for ndnSIM by
1.8.14