a common index structure for FIB, PIT, StrategyChoice, and Measurements More...
#include <name-tree.hpp>
Public Types | |
typedef Iterator | const_iterator |
Public Member Functions | |
NameTree (size_t nBuckets=1024) | |
size_t | size () const |
size_t | getNBuckets () const |
template<typename ENTRY > | |
Entry * | getEntry (const ENTRY &tableEntry) const |
Entry & | lookup (const Name &name) |
find or insert an entry with specified name More... | |
Entry & | lookup (const fib::Entry &fibEntry) |
equivalent to .lookup(fibEntry.getPrefix()) More... | |
Entry & | lookup (const pit::Entry &pitEntry) |
equivalent to .lookup(pitEntry.getName()). More... | |
Entry & | lookup (const measurements::Entry &measurementsEntry) |
equivalent to .lookup(measurementsEntry.getName()) More... | |
Entry & | lookup (const strategy_choice::Entry &strategyChoiceEntry) |
equivalent to .lookup(strategyChoiceEntry.getPrefix()) More... | |
size_t | eraseIfEmpty (Entry *entry, bool canEraseAncestors=true) |
delete the entry if it is empty More... | |
Entry * | findExactMatch (const Name &name) const |
exact match lookup More... | |
Entry * | findLongestPrefixMatch (const Name &name, const EntrySelector &entrySelector=AnyEntry()) const |
longest prefix matching More... | |
Entry * | findLongestPrefixMatch (const Entry &entry, const EntrySelector &entrySelector=AnyEntry()) const |
equivalent to .findLongestPrefixMatch(entry.getName(), entrySelector) More... | |
template<typename ENTRY > | |
Entry * | findLongestPrefixMatch (const ENTRY &tableEntry, const EntrySelector &entrySelector=AnyEntry()) const |
equivalent to .findLongestPrefixMatch(getEntry(tableEntry)->getName(), entrySelector) More... | |
Entry * | findLongestPrefixMatch (const pit::Entry &pitEntry, const EntrySelector &entrySelector=AnyEntry()) const |
equivalent to .findLongestPrefixMatch(pitEntry.getName(), entrySelector) More... | |
Range | findAllMatches (const Name &name, const EntrySelector &entrySelector=AnyEntry()) const |
all-prefixes match lookup More... | |
Range | fullEnumerate (const EntrySelector &entrySelector=AnyEntry()) const |
enumerate all entries More... | |
Range | partialEnumerate (const Name &prefix, const EntrySubTreeSelector &entrySubTreeSelector=AnyEntrySubTree()) const |
enumerate all entries under a prefix More... | |
const_iterator | begin () const |
const_iterator | end () const |
Friends | |
class | EnumerationImpl |
a common index structure for FIB, PIT, StrategyChoice, and Measurements
Definition at line 36 of file name-tree.hpp.
Definition at line 188 of file name-tree.hpp.
|
explicit |
Definition at line 38 of file name-tree.cpp.
|
inline |
Definition at line 46 of file name-tree.hpp.
References nfd::name_tree::Hashtable::size().
Referenced by nfd::ForwarderStatusManager::ForwarderStatusManager().
|
inline |
Definition at line 54 of file name-tree.hpp.
References nfd::name_tree::Hashtable::getNBuckets().
|
inline |
Definition at line 64 of file name-tree.hpp.
References eraseIfEmpty(), findAllMatches(), findExactMatch(), findLongestPrefixMatch(), nfd::name_tree::Entry::get(), and lookup().
Referenced by nfd::strategy_choice::clearStrategyInfo(), nfd::fib::Fib::erase(), nfd::measurements::Measurements::extendLifetime(), nfd::pit::Pit::findAllDataMatches(), findLongestPrefixMatch(), nfd::measurements::Measurements::getParent(), lookup(), and nfd::fib::Fib::removeNextHop().
find or insert an entry with specified name
name | a name prefix |
name
name
and all ancestors are created Definition at line 44 of file name-tree.cpp.
References nfd::name_tree::computeHashes(), nfd::name_tree::Node::entry, nfd::name_tree::Hashtable::insert(), NFD_LOG_TRACE, nfd::name_tree::Entry::setParent(), and ndn::Name::size().
Referenced by nfd::strategy_choice::StrategyChoice::findEffectiveStrategy(), nfd::measurements::Measurements::get(), getEntry(), nfd::strategy_choice::StrategyChoice::insert(), nfd::fib::Fib::insert(), lookup(), and nfd::pit::Pit::Pit().
Entry & nfd::name_tree::NameTree::lookup | ( | const fib::Entry & | fibEntry | ) |
equivalent to .lookup(fibEntry.getPrefix())
fibEntry | a FIB entry attached to this name tree, or Fib::s_emptyEntry |
Definition at line 65 of file name-tree.cpp.
References ndn::Name::empty(), getEntry(), nfd::name_tree::Entry::getFibEntry(), nfd::fib::Entry::getPrefix(), and lookup().
Entry & nfd::name_tree::NameTree::lookup | ( | const pit::Entry & | pitEntry | ) |
equivalent to .lookup(pitEntry.getName()).
pitEntry | a PIT entry attached to this name tree |
Definition at line 79 of file name-tree.cpp.
References ndn::Name::at(), getEntry(), nfd::name_tree::Entry::getName(), nfd::pit::Entry::getName(), nfd::name_tree::Entry::getPitEntries(), ndn::Name::getPrefix(), ndn::name::Component::isImplicitSha256Digest(), lookup(), and ndn::Name::size().
Entry & nfd::name_tree::NameTree::lookup | ( | const measurements::Entry & | measurementsEntry | ) |
equivalent to .lookup(measurementsEntry.getName())
measurementsEntry | a Measurements entry attached to this name tree |
Definition at line 101 of file name-tree.cpp.
References getEntry(), and nfd::name_tree::Entry::getMeasurementsEntry().
Entry & nfd::name_tree::NameTree::lookup | ( | const strategy_choice::Entry & | strategyChoiceEntry | ) |
equivalent to .lookup(strategyChoiceEntry.getPrefix())
strategyChoiceEntry | a StrategyChoice entry attached to this name tree |
Definition at line 111 of file name-tree.cpp.
References getEntry(), and nfd::name_tree::Entry::getStrategyChoiceEntry().
size_t nfd::name_tree::NameTree::eraseIfEmpty | ( | Entry * | entry, |
bool | canEraseAncestors = true |
||
) |
delete the entry if it is empty
entry | a valid entry |
canEraseAncestors | whether ancestors should be deleted if they become empty |
Definition at line 121 of file name-tree.cpp.
References nfd::name_tree::Hashtable::erase(), nfd::name_tree::Entry::getName(), nfd::name_tree::getNode(), nfd::name_tree::Entry::getParent(), nfd::name_tree::Entry::isEmpty(), NFD_LOG_TRACE, and nfd::name_tree::Entry::unsetParent().
Referenced by nfd::strategy_choice::StrategyChoice::erase(), nfd::measurements::Measurements::extendLifetime(), nfd::pit::Pit::findAllDataMatches(), getEntry(), and nfd::fib::Fib::insert().
exact match lookup
name
, or nullptr if it does not exist Definition at line 148 of file name-tree.cpp.
References nfd::name_tree::Node::entry, nfd::name_tree::Hashtable::find(), and ndn::Name::size().
Referenced by nfd::fib::Fib::erase(), nfd::strategy_choice::StrategyChoice::erase(), nfd::fib::Fib::findExactMatch(), nfd::measurements::Measurements::findExactMatch(), findLongestPrefixMatch(), nfd::strategy_choice::StrategyChoice::get(), getEntry(), partialEnumerate(), and nfd::pit::Pit::Pit().
Entry * nfd::name_tree::NameTree::findLongestPrefixMatch | ( | const Name & | name, |
const EntrySelector & | entrySelector = AnyEntry() |
||
) | const |
longest prefix matching
name
and passes entrySelector
, where no other entry with a longer name satisfies those requirements; or nullptr if no entry satisfying those requirements exists Definition at line 155 of file name-tree.cpp.
References nfd::name_tree::computeHashes(), nfd::name_tree::Node::entry, nfd::name_tree::Hashtable::find(), and ndn::Name::size().
Referenced by nfd::fib::Fib::Fib(), findAllMatches(), nfd::strategy_choice::StrategyChoice::findEffectiveStrategyImpl(), findLongestPrefixMatch(), getEntry(), and nfd::measurements::Measurements::getParent().
Entry * nfd::name_tree::NameTree::findLongestPrefixMatch | ( | const Entry & | entry, |
const EntrySelector & | entrySelector = AnyEntry() |
||
) | const |
equivalent to .findLongestPrefixMatch(entry.getName(), entrySelector)
Definition at line 170 of file name-tree.cpp.
References nfd::name_tree::Entry::getParent().
Entry * nfd::name_tree::NameTree::findLongestPrefixMatch | ( | const ENTRY & | tableEntry, |
const EntrySelector & | entrySelector = AnyEntry() |
||
) | const |
equivalent to .findLongestPrefixMatch(getEntry(tableEntry)->getName(), entrySelector)
ENTRY | fib::Entry or measurements::Entry or strategy_choice::Entry |
Definition at line 184 of file name-tree.cpp.
References findLongestPrefixMatch(), and getEntry().
Entry * nfd::name_tree::NameTree::findLongestPrefixMatch | ( | const pit::Entry & | pitEntry, |
const EntrySelector & | entrySelector = AnyEntry() |
||
) | const |
equivalent to .findLongestPrefixMatch(pitEntry.getName(), entrySelector)
Definition at line 203 of file name-tree.cpp.
References ndn::Name::at(), findExactMatch(), findLongestPrefixMatch(), getEntry(), nfd::name_tree::Entry::getName(), nfd::pit::Entry::getName(), ndn::Name::getPrefix(), ndn::name::Component::isImplicitSha256Digest(), and ndn::Name::size().
boost::iterator_range< NameTree::const_iterator > nfd::name_tree::NameTree::findAllMatches | ( | const Name & | name, |
const EntrySelector & | entrySelector = AnyEntry() |
||
) | const |
all-prefixes match lookup
name
, and matches entrySelector
.Example:
name
is inserted during the enumeration, it may or may not be visited. If a name tree entry whose name is a prefix of name
is deleted during the enumeration, undefined behavior may occur. Definition at line 223 of file name-tree.cpp.
References end(), and findLongestPrefixMatch().
Referenced by nfd::pit::Pit::findAllDataMatches(), and getEntry().
boost::iterator_range< NameTree::const_iterator > nfd::name_tree::NameTree::fullEnumerate | ( | const EntrySelector & | entrySelector = AnyEntry() | ) | const |
enumerate all entries
entrySelector
Example:
Definition at line 236 of file name-tree.cpp.
References end().
Referenced by nfd::pit::Pit::begin(), begin(), nfd::strategy_choice::clearStrategyInfo(), and nfd::fib::Fib::removeNextHop().
boost::iterator_range< NameTree::const_iterator > nfd::name_tree::NameTree::partialEnumerate | ( | const Name & | prefix, |
const EntrySubTreeSelector & | entrySubTreeSelector = AnyEntrySubTree() |
||
) | const |
enumerate all entries under a prefix
prefix
, and matches entrySubTreeSelector
.Example:
prefix
is inserted or deleted during the enumeration, it may cause the enumeration to skip entries or visit some entries twice. Definition at line 242 of file name-tree.cpp.
References end(), and findExactMatch().
Referenced by nfd::strategy_choice::clearStrategyInfo().
|
inline |
Definition at line 232 of file name-tree.hpp.
References fullEnumerate().
|
inline |
Definition at line 241 of file name-tree.hpp.
Referenced by findAllMatches(), fullEnumerate(), and partialEnumerate().
|
friend |
Definition at line 249 of file name-tree.hpp.