NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
name-tree-iterator.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26
#ifndef NFD_DAEMON_TABLE_NAME_TREE_ITERATOR_HPP
27
#define NFD_DAEMON_TABLE_NAME_TREE_ITERATOR_HPP
28
29
#include "
name-tree-hashtable.hpp
"
30
31
namespace
nfd
{
32
namespace
name_tree {
33
34
class
NameTree
;
35
38
typedef
function<bool(const Entry& entry)>
EntrySelector
;
39
42
struct
AnyEntry
43
{
44
bool
45
operator()
(
const
Entry
& entry)
const
46
{
47
return
true
;
48
}
49
};
50
55
typedef
function<std::pair<bool,bool>(
const
Entry
& entry)>
EntrySubTreeSelector
;
56
59
struct
AnyEntrySubTree
60
{
61
std::pair<bool, bool>
62
operator()
(
const
Entry
& entry)
const
63
{
64
return
{
true
,
true
};
65
}
66
};
67
68
class
EnumerationImpl
;
69
72
class
Iterator
:
public
std::iterator
<std::forward_iterator_tag, const Entry>
73
{
74
public
:
75
Iterator
();
76
77
Iterator
(shared_ptr<EnumerationImpl> impl,
const
Entry
* ref);
78
79
const
Entry
&
80
operator*
()
const
81
{
82
BOOST_ASSERT(m_impl !=
nullptr
);
83
return
*m_entry;
84
}
85
86
const
Entry
*
87
operator->
()
const
88
{
89
BOOST_ASSERT(m_impl !=
nullptr
);
90
return
m_entry;
91
}
92
93
Iterator
&
94
operator++();
95
96
Iterator
97
operator++(
int
);
98
99
bool
100
operator==
(
const
Iterator
& other)
const
;
101
102
bool
103
operator!=
(
const
Iterator
& other)
const
104
{
105
return
!this->
operator==
(other);
106
}
107
108
private
:
111
shared_ptr<EnumerationImpl> m_impl;
112
115
const
Entry
* m_entry;
116
119
const
Entry
* m_ref;
120
123
int
m_state;
124
125
friend
std::ostream&
operator<<
(std::ostream&,
const
Iterator
&);
126
friend
class
FullEnumerationImpl
;
127
friend
class
PartialEnumerationImpl
;
128
friend
class
PrefixMatchImpl
;
129
};
130
131
std::ostream&
132
operator<<
(std::ostream& os,
const
Iterator
& i);
133
136
class
EnumerationImpl
137
{
138
public
:
139
explicit
140
EnumerationImpl
(
const
NameTree
& nt);
141
142
virtual
void
143
advance(
Iterator
& i) = 0;
144
145
protected
:
146
const
NameTree
&
nt
;
147
const
Hashtable
&
ht
;
148
};
149
152
class
FullEnumerationImpl
:
public
EnumerationImpl
153
{
154
public
:
155
FullEnumerationImpl
(
const
NameTree
& nt,
const
EntrySelector& pred);
156
157
virtual
void
158
advance(
Iterator
& i)
override
;
159
160
private
:
161
EntrySelector m_pred;
162
};
163
169
class
PartialEnumerationImpl
:
public
EnumerationImpl
170
{
171
public
:
172
PartialEnumerationImpl
(
const
NameTree
& nt,
const
EntrySubTreeSelector
& pred);
173
174
virtual
void
175
advance(
Iterator
& i)
override
;
176
177
private
:
178
EntrySubTreeSelector
m_pred;
179
};
180
185
class
PrefixMatchImpl
:
public
EnumerationImpl
186
{
187
public
:
188
PrefixMatchImpl
(
const
NameTree
& nt,
const
EntrySelector& pred);
189
190
private
:
191
virtual
void
192
advance(
Iterator
& i)
override
;
193
194
private
:
195
EntrySelector m_pred;
196
};
197
203
typedef
boost::iterator_range<Iterator>
Range
;
204
205
}
// namespace name_tree
206
}
// namespace nfd
207
208
#endif // NFD_DAEMON_TABLE_NAME_TREE_ITERATOR_HPP
name-tree-hashtable.hpp
nfd::name_tree::Iterator::operator->
const Entry * operator->() const
Definition:
name-tree-iterator.hpp:87
nfd::name_tree::FullEnumerationImpl
full enumeration implementation
Definition:
name-tree-iterator.hpp:152
nfd::name_tree::EntrySubTreeSelector
function< std::pair< bool, bool >const Entry &entry)> EntrySubTreeSelector
a predicate to accept or reject an Entry and its children
Definition:
name-tree-iterator.hpp:55
nfd::name_tree::EnumerationImpl::nt
const NameTree & nt
Definition:
name-tree-iterator.hpp:146
nfd::name_tree::AnyEntry
an EntrySelector that accepts every Entry
Definition:
name-tree-iterator.hpp:42
nfd::name_tree::AnyEntry::operator()
bool operator()(const Entry &entry) const
Definition:
name-tree-iterator.hpp:45
nfd::name_tree::AnyEntrySubTree
an EntrySubTreeSelector that accepts every Entry and its children
Definition:
name-tree-iterator.hpp:59
nfd::name_tree::Iterator::operator*
const Entry & operator*() const
Definition:
name-tree-iterator.hpp:80
nfd::name_tree::operator<<
std::ostream & operator<<(std::ostream &os, const Iterator &i)
Definition:
name-tree-iterator.cpp:87
nfd::name_tree::AnyEntrySubTree::operator()
std::pair< bool, bool > operator()(const Entry &entry) const
Definition:
name-tree-iterator.hpp:62
nfd::name_tree::Hashtable
a hashtable for fast exact name lookup
Definition:
name-tree-hashtable.hpp:152
nfd::name_tree::Iterator::operator!=
bool operator!=(const Iterator &other) const
Definition:
name-tree-iterator.hpp:103
nfd::cs::iterator
Table::const_iterator iterator
Definition:
cs-internal.hpp:41
nfd::name_tree::PrefixMatchImpl
partial enumeration implementation
Definition:
name-tree-iterator.hpp:185
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
nfd::name_tree::Iterator
NameTree iterator.
Definition:
name-tree-iterator.hpp:72
nfd::name_tree::PartialEnumerationImpl
partial enumeration implementation
Definition:
name-tree-iterator.hpp:169
nfd::name_tree::EntrySelector
function< bool(const Entry &entry)> EntrySelector
a predicate to accept or reject an Entry in find operations
Definition:
name-tree-iterator.hpp:34
nfd::name_tree::NameTree
a common index structure for FIB, PIT, StrategyChoice, and Measurements
Definition:
name-tree.hpp:36
nfd::name_tree::Range
boost::iterator_range< Iterator > Range
a Forward Range of name tree entries
Definition:
name-tree-iterator.hpp:203
nfd::name_tree::EnumerationImpl::ht
const Hashtable & ht
Definition:
name-tree-iterator.hpp:147
nfd::name_tree::EnumerationImpl
enumeration operation implementation
Definition:
name-tree-iterator.hpp:136
nfd::name_tree::Entry
an entry in the name tree
Definition:
name-tree-entry.hpp:41
ns3::ndn::operator==
bool operator==(const GlobalRouter::Incidency &a, const GlobalRouter::Incidency &b)
Definition:
ndn-global-router.hpp:132
ndnSIM
NFD
daemon
table
name-tree-iterator.hpp
Generated on Wed Jan 11 2017 18:17:15 for ndnSIM by
1.8.13