|
NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
|
API Documentation
|
Go to the documentation of this file.
29 #include <boost/concept/assert.hpp>
30 #include <boost/concept_check.hpp>
31 #include <type_traits>
47 BOOST_ASSERT(prefixLen <=
name.size());
51 const Node* node =
nullptr;
52 Entry* parent =
nullptr;
54 for (
size_t i = 0; i <= prefixLen; ++i) {
56 std::tie(node, isNew) = m_ht.
insert(
name, i, hashes);
58 if (isNew && parent !=
nullptr) {
61 parent = &node->
entry;
86 bool hasDigest =
name.size() > 0 &&
name[-1].isImplicitSha256Digest();
92 BOOST_ASSERT(nte !=
nullptr);
94 [&pitEntry] (
const auto& pitEntry1) {
95 return pitEntry1.get() == &pitEntry;
105 BOOST_ASSERT(nte !=
nullptr);
116 BOOST_ASSERT(nte !=
nullptr);
125 BOOST_ASSERT(entry !=
nullptr);
128 for (
Entry* parent =
nullptr; entry !=
nullptr && entry->
isEmpty(); entry = parent) {
131 if (parent !=
nullptr) {
138 if (!canEraseAncestors) {
152 prefixLen = std::min(
name.size(), prefixLen);
158 return node ==
nullptr ? nullptr : &node->
entry;
167 for (ssize_t i = depth; i >= 0; --i) {
169 if (node !=
nullptr && entrySelector(node->
entry)) {
181 while (entry !=
nullptr) {
182 if (entrySelector(*entry)) {
194 BOOST_ASSERT(nte !=
nullptr);
200 for (
size_t i = nte->
getName().
size() + 1; i <= depth; ++i) {
202 if (exact ==
nullptr) {
212 boost::iterator_range<NameTree::const_iterator>
222 return {
Iterator(make_shared<PrefixMatchImpl>(*
this, entrySelector), entry),
end()};
225 boost::iterator_range<NameTree::const_iterator>
228 return {
Iterator(make_shared<FullEnumerationImpl>(*
this, entrySelector),
nullptr),
end()};
231 boost::iterator_range<NameTree::const_iterator>
236 return {
Iterator(make_shared<PartialEnumerationImpl>(*
this, entrySubTreeSelector), entry),
end()};
An entry in the name tree.
void setParent(Entry &entry)
Set parent of this entry.
Entry * getEntry(const EntryT &tableEntry) const
NameTree(size_t nBuckets=1024)
Range fullEnumerate(const EntrySelector &entrySelector=AnyEntry()) const
Enumerate all entries.
A common index structure for FIB, PIT, StrategyChoice, and Measurements.
HashSequence computeHashes(const Name &name, size_t prefixLen)
computes hash values for each prefix of name.getPrefix(prefixLen)
size_t size() const
Returns the number of components.
Node * getNode(const Entry &entry)
const std::vector< shared_ptr< pit::Entry > > & getPitEntries() const
const_iterator end() const
NDN_CXX_NODISCARD bool empty() const
Checks if the name is empty, i.e.
size_t eraseIfEmpty(Entry *entry, bool canEraseAncestors=true)
Delete the entry if it is empty.
std::function< bool(const Entry &)> EntrySelector
a predicate to accept or reject an Entry in find operations
std::function< std::pair< bool, bool >(const Entry &)> EntrySubTreeSelector
a predicate to accept or reject an Entry and its children
void unsetParent()
Unset parent of this entry.
Entry & lookup(const Name &name, size_t prefixLen)
Find or insert an entry by name.
const Name & getPrefix() const
Entry * findExactMatch(const Name &name, size_t prefixLen=std::numeric_limits< size_t >::max()) const
Exact match lookup.
Represents an absolute name.
const Name & getName() const
const Name & getName() const
Copyright (c) 2011-2015 Regents of the University of California.
strategy_choice::Entry * getStrategyChoiceEntry() const
const Name & getName() const
measurements::Entry * getMeasurementsEntry() const
Represents a Strategy Choice entry.
Range partialEnumerate(const Name &prefix, const EntrySubTreeSelector &entrySubTreeSelector=AnyEntrySubTree()) const
Enumerate all entries under a prefix.
static constexpr size_t getMaxDepth()
Maximum depth of the name tree.
const Node * find(const Name &name, size_t prefixLen) const
find node for name.getPrefix(prefixLen)
Represents a Measurements entry.
Range findAllMatches(const Name &name, const EntrySelector &entrySelector=AnyEntry()) const
All-prefixes match lookup.
std::vector< HashValue > HashSequence
a sequence of hash values
provides options for Hashtable
Entry * findLongestPrefixMatch(const Name &name, const EntrySelector &entrySelector=AnyEntry()) const
Longest prefix matching.
void erase(Node *node)
delete node
std::pair< const Node *, bool > insert(const Name &name, size_t prefixLen, const HashSequence &hashes)
find or insert node for name.getPrefix(prefixLen)
fib::Entry * getFibEntry() const
Entry * getParent() const
#define NFD_LOG_INIT(name)
const Name & getPrefix() const