32 namespace measurements {
35 : m_nameTree(nameTree)
44 if (entry !=
nullptr) {
54 bind(&Measurements::cleanup,
this, ref(*entry)));
63 return this->
get(nte);
70 return this->
get(nte);
77 return this->
get(nte);
89 BOOST_ASSERT(nte !=
nullptr);
90 return &this->
get(*nte);
95 Measurements::findLongestPrefixMatchImpl(
const K& key,
const EntryPredicate& pred)
const 100 return entry !=
nullptr && pred(*entry);
102 if (match !=
nullptr) {
111 return this->findLongestPrefixMatchImpl(name, pred);
117 return this->findLongestPrefixMatchImpl(pitEntry, pred);
130 BOOST_ASSERT(m_nameTree.
getEntry(entry) !=
nullptr);
133 if (entry.m_expiry >= expiry) {
139 entry.m_expiry = expiry;
140 entry.m_cleanup =
scheduler::schedule(lifetime, bind(&Measurements::cleanup,
this, ref(entry)));
144 Measurements::cleanup(
Entry& entry)
147 BOOST_ASSERT(nte !=
nullptr);
const Name & getName() const
Entry * findExactMatch(const Name &name) const
perform an exact match
void cancel(const EventId &eventId)
cancel a scheduled event
static time_point now() noexcept
Entry * findExactMatch(const Name &name) const
exact match lookup
std::function< bool(const Entry &)> EntryPredicate
a predicate that accepts or rejects an entry
Entry * findLongestPrefixMatch(const Name &name, const EntryPredicate &pred=AnyEntry()) const
perform a longest prefix match for name
Entry * findLongestPrefixMatch(const Name &name, const EntrySelector &entrySelector=AnyEntry()) const
longest prefix matching
void setMeasurementsEntry(unique_ptr< measurements::Entry > measurementsEntry)
represents a Measurements entry
measurements::Entry * getMeasurementsEntry() const
Entry * getParent(const Entry &child)
find or insert a Measurements entry for child's parent
Copyright (c) 2011-2015 Regents of the University of California.
void extendLifetime(Entry &entry, const time::nanoseconds &lifetime)
extend lifetime of an entry
Entry & lookup(const Name &name)
find or insert an entry with specified name
Measurements(NameTree &nametree)
Name abstraction to represent an absolute name.
size_t eraseIfEmpty(Entry *entry, bool canEraseAncestors=true)
delete the entry if it is empty
a common index structure for FIB, PIT, StrategyChoice, and Measurements
EventId schedule(const time::nanoseconds &after, const Scheduler::Event &event)
schedule an event
bool empty() const
Check if name is emtpy.
Entry * getEntry(const ENTRY &tableEntry) const
Entry * getParent() const
Entry & get(const Name &name)
find or insert a Measurements entry for name
const Name & getName() const
static time::nanoseconds getInitialLifetime()
an entry in the name tree