38 : m_nameTree(nameTree)
42 std::pair<shared_ptr<Entry>,
bool>
43 Pit::findOrInsert(
const Interest& interest,
bool allowInsert)
47 bool hasDigest = name.
size() > 0 && name[-1].isImplicitSha256Digest();
48 size_t nteDepth = name.
size() -
static_cast<int>(hasDigest);
54 nte = &m_nameTree.
lookup(name, nteDepth);
59 return {
nullptr,
true};
65 auto it = std::find_if(pitEntries.begin(), pitEntries.end(),
66 [&interest, nteDepth] (
const shared_ptr<Entry>& entry) {
68 return entry->canMatch(interest, nteDepth);
70 if (it != pitEntries.end()) {
76 return {
nullptr,
true};
79 auto entry = make_shared<Entry>(interest);
91 for (
const auto& nte : ntMatches) {
92 for (
const auto& pitEntry : nte.getPitEntries()) {
93 if (pitEntry->getInterest().matchesData(data))
94 matches.emplace_back(pitEntry);
105 BOOST_ASSERT(nte !=
nullptr);
117 BOOST_ASSERT(entry !=
nullptr);
void insertPitEntry(shared_ptr< pit::Entry > pitEntry)
void erase(Entry *entry)
Deletes an entry.
void deleteInOutRecords(Entry *entry, const Face &face)
Deletes in-records and out-records for face.
const std::vector< shared_ptr< pit::Entry > > & getPitEntries() const
void erasePitEntry(pit::Entry *pitEntry)
Represents an Interest packet.
DataMatchResult findAllDataMatches(const Data &data) const
Performs a Data match.
Entry & lookup(const Name &name, size_t prefixLen)
Find or insert an entry by name.
Range findAllMatches(const Name &name, const EntrySelector &entrySelector=AnyEntry()) const
All-prefixes match lookup.
Copyright (c) 2011-2015 Regents of the University of California.
Entry * getEntry(const EntryT &tableEntry) const
void deleteOutRecord(const Face &face)
delete the out-record for face if it exists
const Name & getName() const noexcept
Get name.
Represents an absolute name.
Range fullEnumerate(const EntrySelector &entrySelector=AnyEntry()) const
Enumerate all entries.
void deleteInRecord(const Face &face)
delete the in-record for face if it exists
size_t size() const
Returns the number of components.
static bool nteHasPitEntries(const name_tree::Entry &nte)
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.
bool hasPitEntries() const
const Name & getName() const noexcept
An unordered iterable of all PIT entries matching Data.
const_iterator begin() const
Entry * findExactMatch(const Name &name, size_t prefixLen=std::numeric_limits< size_t >::max()) const
Exact match lookup.
Represents a Data packet.
An entry in the name tree.
static constexpr size_t getMaxDepth()
Maximum depth of the name tree.