38 : m_nameTree(nameTree)
43 std::pair<shared_ptr<Entry>,
bool>
44 Pit::findOrInsert(
const Interest& interest,
bool allowInsert)
47 const Name& name = interest.getName();
48 bool hasDigest = name.size() > 0 && name[-1].isImplicitSha256Digest();
49 size_t nteDepth = name.size() -
static_cast<int>(hasDigest);
50 nteDepth = std::min(nteDepth, NameTree::getMaxDepth());
55 nte = &m_nameTree.lookup(name, nteDepth);
58 nte = m_nameTree.findExactMatch(name, nteDepth);
60 return {
nullptr,
true};
66 auto it = std::find_if(pitEntries.begin(), pitEntries.end(),
67 [&interest, nteDepth] (
const shared_ptr<Entry>& entry) {
69 return entry->canMatch(interest, nteDepth);
71 if (it != pitEntries.end()) {
77 return {
nullptr,
true};
80 auto entry = make_shared<Entry>(interest);
89 auto&& ntMatches = m_nameTree.findAllMatches(data.getName(), &
nteHasPitEntries);
93 for (
const shared_ptr<Entry>& pitEntry : nte.getPitEntries()) {
94 if (pitEntry->getInterest().matchesData(data))
95 matches.emplace_back(pitEntry);
106 BOOST_ASSERT(nte !=
nullptr);
110 m_nameTree.eraseIfEmpty(nte);
118 BOOST_ASSERT(entry !=
nullptr);
const_iterator begin() const
void deleteInRecord(const Face &face)
delete the in-record for face if it exists
void erasePitEntry(pit::Entry *pitEntry)
void deleteOutRecord(const Face &face)
delete the out-record for face if it exists
const std::vector< shared_ptr< pit::Entry > > & getPitEntries() const
bool hasPitEntries() const
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
void deleteInOutRecords(Entry *entry, const Face &face)
deletes in-record and out-record for face
an entry in the name tree
static bool nteHasPitEntries(const name_tree::Entry &nte)
DataMatchResult findAllDataMatches(const Data &data) const
performs a Data match
An unordered iterable of all PIT entries matching Data.
void erase(Entry *entry)
deletes an entry
void insertPitEntry(shared_ptr< pit::Entry > pitEntry)