NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 }
37 
40 class MeasurementsAccessor : noncopyable
41 {
42 public:
43  MeasurementsAccessor(Measurements& measurements, StrategyChoice& strategyChoice,
44  fw::Strategy* strategy);
45 
47 
50  shared_ptr<measurements::Entry>
51  get(const Name& name);
52 
55  shared_ptr<measurements::Entry>
56  get(const fib::Entry& fibEntry);
57 
60  shared_ptr<measurements::Entry>
61  get(const pit::Entry& pitEntry);
62 
66  shared_ptr<measurements::Entry>
67  getParent(const measurements::Entry& child);
68 
73  void
74  extendLifetime(measurements::Entry& entry, const time::nanoseconds& lifetime);
75 
76 private:
80  shared_ptr<measurements::Entry>
81  filter(const shared_ptr<measurements::Entry>& entry);
82 
83 private:
84  Measurements& m_measurements;
85  StrategyChoice& m_strategyChoice;
86  fw::Strategy* m_strategy;
87 };
88 
89 inline shared_ptr<measurements::Entry>
91 {
92  return this->filter(m_measurements.get(name));
93 }
94 
95 inline shared_ptr<measurements::Entry>
97 {
98  return this->filter(m_measurements.get(fibEntry));
99 }
100 
101 inline shared_ptr<measurements::Entry>
103 {
104  return this->filter(m_measurements.get(pitEntry));
105 }
106 
107 inline shared_ptr<measurements::Entry>
109 {
110  return this->filter(m_measurements.getParent(child));
111 }
112 
113 inline void
115  const time::nanoseconds& lifetime)
116 {
117  m_measurements.extendLifetime(entry, lifetime);
118 }
119 
120 } // namespace nfd
121 
122 #endif // NFD_DAEMON_TABLE_MEASUREMENTS_ACCESSOR_HPP
shared_ptr< measurements::Entry > getParent(const measurements::Entry &child)
find or insert a Measurements entry for child's parent
represents the Strategy Choice table
represents a FIB entry
Definition: fib-entry.hpp:53
shared_ptr< measurements::Entry > get(const Name &name)
find or insert a Measurements entry for name
represents a Measurements entry
allows Strategy to access portion of Measurements table under its namespace
represents a PIT entry
Definition: pit-entry.hpp:67
MeasurementsAccessor(Measurements &measurements, StrategyChoice &strategyChoice, fw::Strategy *strategy)
represents a forwarding strategy
Definition: strategy.hpp:37
void extendLifetime(measurements::Entry &entry, const time::nanoseconds &lifetime)
extend lifetime of an entry
void extendLifetime(measurements::Entry &entry, const time::nanoseconds &lifetime)
extend lifetime of an entry
shared_ptr< measurements::Entry > get(const Name &name)
find or insert a Measurements entry for name
shared_ptr< measurements::Entry > getParent(const measurements::Entry &child)
find or insert a Measurements entry for child's parent