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 232 of file name-tree.hpp.
|
inline |
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.
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.
Entry * nfd::name_tree::NameTree::findExactMatch | ( | const Name & | name | ) | const |
exact match lookup
name
, or nullptr if it does not exist Definition at line 148 of file name-tree.cpp.
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.
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.
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.
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.
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.
|
inline |
Definition at line 64 of file name-tree.hpp.
|
inline |
Definition at line 54 of file name-tree.hpp.
Entry & nfd::name_tree::NameTree::lookup | ( | const Name & | name | ) |
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.
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.
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.
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.
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.
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.
|
inline |
Definition at line 46 of file name-tree.hpp.
|
friend |
Definition at line 249 of file name-tree.hpp.