27 #include <type_traits> 29 #include <boost/concept/assert.hpp> 30 #include <boost/concept_check.hpp> 31 #include <type_traits> 36 #if HAVE_IS_MOVE_CONSTRUCTIBLE 37 static_assert(std::is_move_constructible<DataMatchResult>::value,
38 "DataMatchResult must be MoveConstructible");
39 #endif // HAVE_IS_MOVE_CONSTRUCTIBLE 44 BOOST_CONCEPT_ASSERT((boost::ForwardIterator<Pit::const_iterator>));
47 #ifdef HAVE_IS_DEFAULT_CONSTRUCTIBLE 48 static_assert(std::is_default_constructible<Pit::const_iterator>::value,
49 "Pit::const_iterator must be default-constructible");
51 BOOST_CONCEPT_ASSERT((boost::DefaultConstructible<Pit::const_iterator>));
52 #endif // HAVE_IS_DEFAULT_CONSTRUCTIBLE 55 : m_nameTree(nameTree)
64 std::pair<shared_ptr<pit::Entry>,
bool>
69 shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.
lookup(interest.
getName());
70 BOOST_ASSERT(static_cast<bool>(nameTreeEntry));
72 const std::vector<shared_ptr<pit::Entry>>& pitEntries = nameTreeEntry->getPitEntries();
75 auto it = std::find_if(pitEntries.begin(), pitEntries.end(),
76 [&interest] (
const shared_ptr<pit::Entry>& entry) {
77 return entry->getInterest().getName() == interest.
getName() &&
78 entry->getInterest().getSelectors() == interest.
getSelectors();
80 if (it != pitEntries.end()) {
81 return { *it,
false };
84 shared_ptr<pit::Entry> entry = make_shared<pit::Entry>(interest);
85 nameTreeEntry->insertPitEntry(entry);
87 return { entry,
true };
98 for (
const shared_ptr<pit::Entry>& pitEntry : nte.getPitEntries()) {
99 if (pitEntry->getInterest().matchesData(data))
100 matches.emplace_back(pitEntry);
110 shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.
get(*pitEntry);
111 BOOST_ASSERT(static_cast<bool>(nameTreeEntry));
113 nameTreeEntry->erasePitEntry(pitEntry);
123 [] (
const name_tree::Entry& entry) { return entry.hasPitEntries(); }).begin());
const Name & getName() const
void erase(shared_ptr< pit::Entry > pitEntry)
erases a PIT Entry
bool eraseEntryIfEmpty(shared_ptr< name_tree::Entry > entry)
Delete a Name Tree Entry if this entry is empty.
shared_ptr< name_tree::Entry > get(const fib::Entry &fibEntry) const
get NameTree entry from attached FIB entry
boost::iterator_range< const_iterator > findAllMatches(const Name &prefix, const name_tree::EntrySelector &entrySelector=name_tree::AnyEntry()) const
Enumerate all the name prefixes that satisfy the prefix and entrySelector.
represents an Interest packet
pit::DataMatchResult findAllDataMatches(const Data &data) const
performs a Data match
const Name & getName() const
Get name of the Data packet.
const Selectors & getSelectors() const
Copyright (c) 2011-2015 Regents of the University of California.
std::pair< shared_ptr< pit::Entry >, bool > insert(const Interest &interest)
inserts a PIT entry for Interest
shared_ptr< name_tree::Entry > lookup(const Name &prefix)
Look for the Name Tree Entry that contains this name prefix.
const_iterator begin() const
returns an iterator pointing to the first PIT entry
boost::iterator_range< const_iterator > fullEnumerate(const name_tree::EntrySelector &entrySelector=name_tree::AnyEntry()) const
Enumerate all entries, optionally filtered by an EntrySelector.
std::vector< shared_ptr< pit::Entry > > DataMatchResult