30 #include <boost/range/concepts.hpp> 37 BOOST_CONCEPT_ASSERT((boost::ForwardRangeConcept<Range>));
49 : m_impl(std::move(impl))
54 m_impl->advance(*
this);
61 BOOST_ASSERT(m_impl !=
nullptr);
62 m_impl->advance(*
this);
78 return m_entry == other.m_entry;
84 if (i.m_impl ==
nullptr) {
87 if (i.m_entry ==
nullptr) {
88 return os <<
"uninitialized";
91 os <<
"entry=" << i.m_entry->
getName();
92 if (i.m_ref ==
nullptr) {
96 os <<
" ref=" << i.m_ref->
getName();
98 os <<
" state=" << i.m_state;
118 if (i.m_entry ==
nullptr) {
119 for (
size_t bucket = 0; bucket <
ht.
getNBuckets(); ++bucket) {
121 if (node !=
nullptr) {
122 i.m_entry = &node->
entry;
126 if (i.m_entry ==
nullptr) {
130 if (m_pred(*i.m_entry)) {
137 if (m_pred(node->entry)) {
138 i.m_entry = &node->entry;
145 for (
size_t bucket = currentBucket + 1; bucket <
ht.
getNBuckets(); ++bucket) {
147 if (m_pred(node->entry)) {
148 i.m_entry = &node->entry;
167 bool wantSelf =
false;
168 bool wantChildren =
false;
171 if (i.m_entry ==
nullptr) {
172 if (i.m_ref ==
nullptr) {
178 std::tie(wantSelf, wantChildren) = m_pred(*i.m_entry);
180 i.m_state = wantChildren;
185 wantChildren = static_cast<bool>(i.m_state);
187 BOOST_ASSERT(i.m_ref !=
nullptr);
190 while (i.m_entry != i.m_ref || (wantChildren && i.m_entry->
hasChildren())) {
193 std::tie(wantSelf, wantChildren) = m_pred(*i.m_entry);
195 i.m_state = wantChildren;
202 const std::vector<Entry*>& siblings = parent->
getChildren();
203 auto sibling = std::find(siblings.begin(), siblings.end(), i.m_entry);
204 BOOST_ASSERT(sibling != siblings.end());
205 while (++sibling != siblings.end()) {
206 i.m_entry = *sibling;
207 std::tie(wantSelf, wantChildren) = m_pred(*i.m_entry);
209 i.m_state = wantChildren;
217 if (sibling == siblings.end()) {
219 wantChildren =
false;
235 PrefixMatchImpl::advance(
Iterator& i)
237 if (i.m_entry ==
nullptr) {
238 if (i.m_ref ==
nullptr) {
244 if (m_pred(*i.m_entry)) {
250 while ((i.m_entry = i.m_entry->
getParent()) !=
nullptr) {
251 if (m_pred(*i.m_entry)) {
EnumerationImpl(const NameTree &nt)
size_t getNBuckets() const
bool operator==(const Iterator &other) const
const Node * getBucket(size_t bucket) const
void advance(Iterator &i) override
size_t computeBucketIndex(HashValue h) const
FullEnumerationImpl(const NameTree &nt, const EntrySelector &pred)
std::ostream & operator<<(std::ostream &os, const Iterator &i)
const std::vector< Entry * > & getChildren() const
Copyright (c) 2011-2015 Regents of the University of California.
NDN_CXX_ASSERT_FORWARD_ITERATOR(Iterator)
PrefixMatchImpl(const NameTree &nt, const EntrySelector &pred)
Node * getNode(const Entry &entry)
a common index structure for FIB, PIT, StrategyChoice, and Measurements
std::function< std::pair< bool, bool >(const Entry &)> EntrySubTreeSelector
a predicate to accept or reject an Entry and its children
Entry * getParent() const
std::function< bool(const Entry &)> EntrySelector
a predicate to accept or reject an Entry in find operations
#define NFD_LOG_INIT(name)
void advance(Iterator &i) override
const Name & getName() const
enumeration operation implementation
an entry in the name tree
PartialEnumerationImpl(const NameTree &nt, const EntrySubTreeSelector &pred)