NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: 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 
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 
174 
175 } // namespace nfd
176 
177 #endif // NFD_DAEMON_TABLE_MEASUREMENTS_ACCESSOR_HPP
represents a FIB entry
Definition: fib-entry.hpp:51
std::function< bool(const Entry &)> EntryPredicate
a predicate that accepts or rejects an entry
represents a Measurements entry
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
an Interest table entry
Definition: pit-entry.hpp:57
represents the Measurements table
an EntryPredicate that accepts any entry
Represents an absolute name.
Definition: name.hpp:42
represents a forwarding strategy
Definition: strategy.hpp:37
allows Strategy to access portion of Measurements table under its namespace