NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
interest-filter.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22
#ifndef NDN_INTEREST_FILTER_HPP
23
#define NDN_INTEREST_FILTER_HPP
24
25
#include "
name.hpp
"
26
27
namespace
ndn
{
28
29
class
RegexPatternListMatcher;
30
31
class
InterestFilter
32
{
33
public
:
34
class
Error
:
public
std::runtime_error
35
{
36
public
:
37
explicit
38
Error
(
const
std::string& what)
39
:
std
::runtime_error(what)
40
{
41
}
42
};
43
51
InterestFilter
(
const
Name
& prefix);
52
60
InterestFilter
(
const
char
* prefixUri);
61
69
InterestFilter
(
const
std::string& prefixUri);
70
89
InterestFilter
(
const
Name
& prefix,
const
std::string& regexFilter);
90
94
operator
const
Name
&()
const
95
{
96
if
(static_cast<bool>(m_regexFilter)) {
97
BOOST_THROW_EXCEPTION(
Error
(
"Please update OnInterest callback to accept const "
98
"InterestFilter& (non-trivial Interest filter is being used)"
));
99
}
100
return
m_prefix;
101
}
102
106
bool
107
doesMatch
(
const
Name
&
name
)
const
;
108
109
const
Name
&
110
getPrefix
()
const
111
{
112
return
m_prefix;
113
}
114
115
bool
116
hasRegexFilter
()
const
117
{
118
return
static_cast<
bool
>
(m_regexFilter);
119
}
120
121
const
RegexPatternListMatcher
&
122
getRegexFilter
()
const
123
{
124
return
*m_regexFilter;
125
}
126
127
private
:
128
Name
m_prefix;
129
shared_ptr<RegexPatternListMatcher> m_regexFilter;
130
};
131
132
std::ostream&
133
operator<<
(std::ostream& os,
const
InterestFilter
& filter);
134
135
136
inline
137
InterestFilter::InterestFilter
(
const
Name
& prefix)
138
: m_prefix(prefix)
139
{
140
}
141
142
inline
143
InterestFilter::InterestFilter
(
const
char
* prefixUri)
144
: m_prefix(prefixUri)
145
{
146
}
147
148
inline
149
InterestFilter::InterestFilter
(
const
std::string& prefixUri)
150
: m_prefix(prefixUri)
151
{
152
}
153
154
}
// namespace ndn
155
156
#endif // NDN_INTEREST_FILTER_HPP
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::InterestFilter::doesMatch
bool doesMatch(const Name &name) const
Check if specified name matches the filter.
Definition:
interest-filter.cpp:36
ndn::InterestFilter::getRegexFilter
const RegexPatternListMatcher & getRegexFilter() const
Definition:
interest-filter.hpp:122
ndn::RegexPatternListMatcher
Definition:
regex-pattern-list-matcher.hpp:35
ndn::operator<<
std::ostream & operator<<(std::ostream &os, const Data &data)
Definition:
data.cpp:340
ndn::InterestFilter
Definition:
interest-filter.hpp:31
std
STL namespace.
ndn::InterestFilter::Error::Error
Error(const std::string &what)
Definition:
interest-filter.hpp:38
ndn::InterestFilter::getPrefix
const Name & getPrefix() const
Definition:
interest-filter.hpp:110
ndn::Name
Name abstraction to represent an absolute name.
Definition:
name.hpp:46
ndn::InterestFilter::InterestFilter
InterestFilter(const Name &prefix)
Create an Interest filter to match Interests by prefix.
Definition:
interest-filter.hpp:137
name.hpp
ndn::name
Definition:
name-component.cpp:37
ndn::InterestFilter::hasRegexFilter
bool hasRegexFilter() const
Definition:
interest-filter.hpp:116
ndn::InterestFilter::Error
Definition:
interest-filter.hpp:34
ndnSIM
ndn-cxx
src
interest-filter.hpp
Generated on Tue Feb 23 2016 22:18:43 for ndnSIM by
1.8.11