29 #include <boost/concept/assert.hpp> 30 #include <boost/concept_check.hpp> 31 #include <type_traits> 49 const Node* node =
nullptr;
50 Entry* parent =
nullptr;
52 for (
size_t prefixLen = 0; prefixLen <= name.
size(); ++prefixLen) {
54 std::tie(node, isNew) = m_ht.
insert(name, prefixLen, hashes);
56 if (isNew && parent !=
nullptr) {
59 parent = &node->
entry;
82 BOOST_ASSERT(nte !=
nullptr);
85 [&pitEntry] (
const shared_ptr<pit::Entry>& pitEntry1) {
86 return pitEntry1.get() == &pitEntry;
104 BOOST_ASSERT(nte !=
nullptr);
114 BOOST_ASSERT(nte !=
nullptr);
123 BOOST_ASSERT(entry !=
nullptr);
126 for (
Entry* parent =
nullptr; entry !=
nullptr && entry->
isEmpty(); entry = parent) {
129 if (parent !=
nullptr) {
136 if (!canEraseAncestors) {
151 return node ==
nullptr ? nullptr : &node->
entry;
159 for (ssize_t prefixLen = name.
size(); prefixLen >= 0; --prefixLen) {
160 const Node* node = m_ht.
find(name, prefixLen, hashes);
161 if (node !=
nullptr && entrySelector(node->
entry)) {
173 while (entry !=
nullptr) {
174 if (entrySelector(*entry)) {
182 template<
typename ENTRY>
187 BOOST_ASSERT(nte !=
nullptr);
206 BOOST_ASSERT(nte !=
nullptr);
214 if (exact !=
nullptr) {
222 boost::iterator_range<NameTree::const_iterator>
232 return {
Iterator(make_shared<PrefixMatchImpl>(*
this, entrySelector), entry),
end()};
235 boost::iterator_range<NameTree::const_iterator>
238 return {
Iterator(make_shared<FullEnumerationImpl>(*
this, entrySelector),
nullptr),
end()};
241 boost::iterator_range<NameTree::const_iterator>
246 return {
Iterator(make_shared<PartialEnumerationImpl>(*
this, entrySubTreeSelector), entry),
end()};
PartialName getPrefix(ssize_t nComponents) const
Extract a prefix (PartialName) of the name, containing first nComponents components.
const Name & getPrefix() const
HashSequence computeHashes(const Name &name)
computes hash values for each prefix of name
const Component & at(ssize_t i) const
Get component at the specified index.
const std::vector< shared_ptr< pit::Entry > > & getPitEntries() const
const_iterator end() const
std::pair< const Node *, bool > insert(const Name &name, size_t prefixLen, const HashSequence &hashes)
find or insert node for name.getPrefix(prefixLen)
Entry * findExactMatch(const Name &name) const
exact match lookup
fib::Entry * getFibEntry() const
function< std::pair< bool, bool >const Entry &entry)> EntrySubTreeSelector
a predicate to accept or reject an Entry and its children
provides options for Hashtable
const Node * find(const Name &name, size_t prefixLen) const
find node for name.getPrefix(prefixLen)
void setParent(Entry &entry)
set parent of this entry
Entry * findLongestPrefixMatch(const Name &name, const EntrySelector &entrySelector=AnyEntry()) const
longest prefix matching
represents a Measurements entry
Range partialEnumerate(const Name &prefix, const EntrySubTreeSelector &entrySubTreeSelector=AnyEntrySubTree()) const
enumerate all entries under a prefix
Range findAllMatches(const Name &name, const EntrySelector &entrySelector=AnyEntry()) const
all-prefixes match lookup
measurements::Entry * getMeasurementsEntry() const
#define NFD_LOG_TRACE(expression)
Copyright (c) 2011-2015 Regents of the University of California.
Entry & lookup(const Name &name)
find or insert an entry with specified name
bool isImplicitSha256Digest() const
Check if the component is ImplicitSha256DigestComponent.
Name abstraction to represent an absolute name.
represents a Strategy Choice entry
std::vector< HashValue > HashSequence
a sequence of hash values
function< bool(const Entry &entry)> EntrySelector
a predicate to accept or reject an Entry in find operations
Range fullEnumerate(const EntrySelector &entrySelector=AnyEntry()) const
enumerate all entries
Node * getNode(const Entry &entry)
size_t size() const
Get the number of components.
NameTree(size_t nBuckets=1024)
size_t eraseIfEmpty(Entry *entry, bool canEraseAncestors=true)
delete the entry if it is empty
const Name & getName() const
bool empty() const
Check if name is emtpy.
Entry * getEntry(const ENTRY &tableEntry) const
void unsetParent()
unset parent of this entry
strategy_choice::Entry * getStrategyChoiceEntry() const
Entry * getParent() const
#define NFD_LOG_INIT(name)
const Name & getName() const
an entry in the name tree
void erase(Node *node)
delete node