Public Member Functions | List of all members
ndn::InterestFilter Class Reference

An InterestFilter holds a Name prefix and optional regex match expression for use in Face::setInterestFilter. More...

#include <interest-filter.hpp>

Public Member Functions

 InterestFilter (const Name &prefix)
 Create an InterestFilter to match any Interest whose name starts with the given prefix. More...
 
 InterestFilter (const std::string &prefixUri)
 Create an InterestFilter to match any Interest whose name starts with the given prefix. More...
 
 InterestFilter (const char *prefixUri)
 Create an InterestFilter to match any Interest whose name starts with the given prefix. More...
 
 InterestFilter (const Name &prefix, const std::string &regexFilter)
 Create an InterestFilter to match any Interest whose name starts with the given prefix and the remaining components match the regexFilter regular expression as described in doesMatch. More...
 
 InterestFilter (const Name &prefix, const char *regexFilter)
 Create an InterestFilter to match any Interest whose name starts with the given prefix URI and the remaining components match the regexFilter regular expression as described in doesMatch. More...
 
 InterestFilter (const std::string &prefixUri, const std::string &regexFilter)
 Create an InterestFilter to match any Interest whose name starts with the given prefix URI and the remaining components match the regexFilter regular expression as described in doesMatch. More...
 
 InterestFilter (const char *prefixUri, const std::string &regexFilter)
 Create an InterestFilter to match any Interest whose name starts with the given prefix URI and the remaining components match the regexFilter regular expression as described in doesMatch. More...
 
 InterestFilter (const std::string &prefixUri, const char *regexFilter)
 Create an InterestFilter to match any Interest whose name starts with the given prefix URI and the remaining components match the regexFilter regular expression as described in doesMatch. More...
 
 InterestFilter (const char *prefixUri, const char *regexFilter)
 Create an InterestFilter to match any Interest whose name starts with the given prefix URI and the remaining components match the regexFilter regular expression as described in doesMatch. More...
 
bool doesMatch (const Name &name) const
 Check if the given name matches this filter. More...
 
const NamegetPrefix () const
 Get the prefix given to the constructor. More...
 
bool hasRegexFilter () const
 Check if a regexFilter was supplied to the constructor. More...
 
const std::string & getRegexFilter () const
 Get the regex filter. More...
 

Detailed Description

An InterestFilter holds a Name prefix and optional regex match expression for use in Face::setInterestFilter.

Constructor & Destructor Documentation

ndn::InterestFilter::InterestFilter ( const Name prefix)
inline

Create an InterestFilter to match any Interest whose name starts with the given prefix.

Parameters
prefixThe prefix Name. This makes a copy of the Name.
ndn::InterestFilter::InterestFilter ( const std::string &  prefixUri)
inline

Create an InterestFilter to match any Interest whose name starts with the given prefix.

Parameters
prefixUriThe URI of the prefix Name.
ndn::InterestFilter::InterestFilter ( const char *  prefixUri)
inline

Create an InterestFilter to match any Interest whose name starts with the given prefix.

Parameters
prefixUriThe URI of the prefix Name.
ndn::InterestFilter::InterestFilter ( const Name prefix,
const std::string &  regexFilter 
)

Create an InterestFilter to match any Interest whose name starts with the given prefix and the remaining components match the regexFilter regular expression as described in doesMatch.

Parameters
prefixThe prefix Name. This makes a copy of the Name.
regexFilterThe regular expression for matching the remaining name components.
ndn::InterestFilter::InterestFilter ( const Name prefix,
const char *  regexFilter 
)

Create an InterestFilter to match any Interest whose name starts with the given prefix URI and the remaining components match the regexFilter regular expression as described in doesMatch.

Parameters
prefixThe prefix Name. This makes a copy of the Name.
regexFilterThe regular expression for matching the remaining name components.
ndn::InterestFilter::InterestFilter ( const std::string &  prefixUri,
const std::string &  regexFilter 
)

Create an InterestFilter to match any Interest whose name starts with the given prefix URI and the remaining components match the regexFilter regular expression as described in doesMatch.

Parameters
prefixUriThe URI of the prefix Name.
regexFilterThe regular expression for matching the remaining name components.
ndn::InterestFilter::InterestFilter ( const char *  prefixUri,
const std::string &  regexFilter 
)

Create an InterestFilter to match any Interest whose name starts with the given prefix URI and the remaining components match the regexFilter regular expression as described in doesMatch.

Parameters
prefixUriThe URI of the prefix Name.
regexFilterThe regular expression for matching the remaining name components.
ndn::InterestFilter::InterestFilter ( const std::string &  prefixUri,
const char *  regexFilter 
)

Create an InterestFilter to match any Interest whose name starts with the given prefix URI and the remaining components match the regexFilter regular expression as described in doesMatch.

Parameters
prefixUriThe URI of the prefix Name.
regexFilterThe regular expression for matching the remaining name components.
ndn::InterestFilter::InterestFilter ( const char *  prefixUri,
const char *  regexFilter 
)

Create an InterestFilter to match any Interest whose name starts with the given prefix URI and the remaining components match the regexFilter regular expression as described in doesMatch.

Parameters
prefixUriThe URI of the prefix Name.
regexFilterThe regular expression for matching the remaining name components.

Member Function Documentation

bool ndn::InterestFilter::doesMatch ( const Name name) const

Check if the given name matches this filter.

Match if name starts with this filter's prefix. If this filter has the optional regexFilter then the remaining components match the regexFilter regular expression. For example, the following InterestFilter:

InterestFilter("/hello", "<world><>+")

will match all Interests, whose name has the prefix /hello which is followed by a component world and has at least one more component after it. Examples:

/hello/world/! /hello/world/x/y/z

Note that the regular expression will need to match all remaining components (e.g., there are implicit heading ^ and trailing $ symbols in the regular expression).

Parameters
nameThe name to check against this filter.
Returns
True if name matches this filter, otherwise false.
const Name& ndn::InterestFilter::getPrefix ( ) const
inline

Get the prefix given to the constructor.

Returns
The prefix Name.
const std::string& ndn::InterestFilter::getRegexFilter ( ) const
inline

Get the regex filter.

This is only valid if hasRegexFilter()is true.

Returns
The regular expression for matching the remaining name components.
bool ndn::InterestFilter::hasRegexFilter ( ) const
inline

Check if a regexFilter was supplied to the constructor.

Returns
True if a regexFilter was supplied to the constructor.

The documentation for this class was generated from the following files: