34 : m_nameTree(nameTree)
39 shared_ptr<measurements::Entry>
46 entry = make_shared<measurements::Entry>(nte.
getPrefix());
52 bind(&Measurements::cleanup,
this, ref(*entry)));
57 shared_ptr<measurements::Entry>
60 shared_ptr<name_tree::Entry> nte = m_nameTree.
lookup(name);
61 return this->
get(*nte);
64 shared_ptr<measurements::Entry>
67 shared_ptr<name_tree::Entry> nte = m_nameTree.
get(fibEntry);
68 return this->
get(*nte);
71 shared_ptr<measurements::Entry>
74 shared_ptr<name_tree::Entry> nte = m_nameTree.
get(pitEntry);
75 return this->
get(*nte);
78 shared_ptr<measurements::Entry>
81 if (child.
getName().size() == 0) {
85 shared_ptr<name_tree::Entry> nteChild = m_nameTree.
get(child);
86 shared_ptr<name_tree::Entry> nte = nteChild->
getParent();
87 BOOST_ASSERT(nte !=
nullptr);
88 return this->
get(*nte);
91 shared_ptr<measurements::Entry>
102 shared_ptr<measurements::Entry>
105 shared_ptr<name_tree::Entry> nte = m_nameTree.
lookup(name);
107 return nte->getMeasurementsEntry();
113 const time::nanoseconds& lifetime)
115 shared_ptr<name_tree::Entry> nte = m_nameTree.
get(entry);
116 if (nte ==
nullptr ||
117 nte->getMeasurementsEntry().get() != &entry) {
122 time::steady_clock::TimePoint expiry = time::steady_clock::now() + lifetime;
123 if (entry.m_expiry >= expiry) {
129 entry.m_expiry = expiry;
130 entry.m_cleanup =
scheduler::schedule(lifetime, bind(&Measurements::cleanup,
this, ref(entry)));
136 shared_ptr<name_tree::Entry> nte = m_nameTree.
get(entry);
137 if (nte !=
nullptr) {
138 nte->setMeasurementsEntry(
nullptr);
shared_ptr< measurements::Entry > getParent(const measurements::Entry &child)
find or insert a Measurements entry for child's parent
shared_ptr< Entry > getParent() const
void cancel(const EventId &eventId)
cancel a scheduled event
const Name & getName() const
bool eraseEntryIfEmpty(shared_ptr< name_tree::Entry > entry)
Delete a Name Tree Entry if this entry is empty.
shared_ptr< name_tree::Entry > get(const fib::Entry &fibEntry) const
get NameTree entry from attached FIB entry
shared_ptr< name_tree::Entry > findLongestPrefixMatch(const Name &prefix, const name_tree::EntrySelector &entrySelector=name_tree::AnyEntry()) const
Longest prefix matching for the given name.
represents a Measurements entry
void setMeasurementsEntry(shared_ptr< measurements::Entry > measurementsEntry)
shared_ptr< measurements::Entry > findExactMatch(const Name &name) const
perform an exact match
EventId schedule(const time::nanoseconds &after, const std::function< void()> &event)
schedule an event
shared_ptr< name_tree::Entry > lookup(const Name &prefix)
Look for the Name Tree Entry that contains this name prefix.
const Name & getPrefix() const
static time::nanoseconds getInitialLifetime()
shared_ptr< measurements::Entry > findLongestPrefixMatch(const Name &name) const
perform a longest prefix match
Measurements(NameTree &nametree)
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 > getMeasurementsEntry() const