33 namespace measurements {
36 : m_nameTree(nameTree)
44 if (entry !=
nullptr) {
62 return this->
get(nte);
69 return this->
get(nte);
76 return this->
get(nte);
88 BOOST_ASSERT(nte !=
nullptr);
89 return &this->
get(*nte);
94 Measurements::findLongestPrefixMatchImpl(
const K& key,
const EntryPredicate& pred)
const 99 return entry !=
nullptr && pred(*entry);
101 if (match !=
nullptr) {
129 BOOST_ASSERT(m_nameTree.
getEntry(entry) !=
nullptr);
132 if (entry.m_expiry >= expiry) {
138 entry.m_expiry = expiry;
139 entry.m_cleanup =
getScheduler().schedule(lifetime, [&] { cleanup(entry); });
143 Measurements::cleanup(
Entry& entry)
146 BOOST_ASSERT(nte !=
nullptr);
const Name & getName() const
Entry * findExactMatch(const Name &name) const
Perform an exact match.
PartialName getPrefix(ssize_t nComponents) const
Returns a prefix of the name.
Measurements(NameTree &nameTree)
static time_point now() noexcept
Entry * findLongestPrefixMatch(const Name &name, const EntryPredicate &pred=AnyEntry()) const
Perform a longest prefix match for name.
static time::nanoseconds getInitialLifetime()
Entry & lookup(const Name &name, size_t prefixLen)
Find or insert an entry by name.
Entry * findLongestPrefixMatch(const Name &name, const EntrySelector &entrySelector=AnyEntry()) const
Longest prefix matching.
void setMeasurementsEntry(unique_ptr< measurements::Entry > measurementsEntry)
Scheduler & getScheduler()
Returns the global Scheduler instance for the calling thread.
Represents a Measurements entry.
std::function< bool(const Entry &)> EntryPredicate
A predicate that accepts or rejects an entry.
measurements::Entry * getMeasurementsEntry() const
Entry * getParent(const Entry &child)
Find or insert a parent entry.
NDN_CXX_NODISCARD bool empty() const
Checks if the name is empty, i.e.
Copyright (c) 2011-2015 Regents of the University of California.
void extendLifetime(Entry &entry, const time::nanoseconds &lifetime)
Extend lifetime of an entry.
static constexpr size_t getMaxDepth()
maximum depth of a Measurements entry
Entry * getEntry(const EntryT &tableEntry) const
Represents an absolute name.
size_t size() const
Returns the number of components.
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.
const Name & getName() const
Entry * findExactMatch(const Name &name, size_t prefixLen=std::numeric_limits< size_t >::max()) const
Exact match lookup.
Entry * getParent() const
Entry & get(const Name &name)
Find or insert an entry by name.
void cancel() const
Cancel the operation.
const Name & getName() const
boost::chrono::nanoseconds nanoseconds
An entry in the name tree.
static constexpr size_t getMaxDepth()
Maximum depth of the name tree.