All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
config-filter.hpp
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
23 #ifndef NDN_CONFIG_FILTER_HPP
24 #define NDN_CONFIG_FILTER_HPP
25 
26 #include "../../../interest.hpp"
27 #include "../../../data.hpp"
28 #include "config-name-relation.hpp"
29 
30 namespace ndn {
31 
32 class BoostInfoTree;
33 class NdnRegexTopMatcher;
34 
41 class ConfigFilter {
42 public:
43  virtual
44  ~ConfigFilter();
45 
54  bool
55  match(bool isForInterest, const Name& packetName);
56 
63  static ptr_lib::shared_ptr<ConfigFilter>
64  create(const BoostInfoTree& configSection);
65 
66 protected:
67  ConfigFilter() {}
68 
69 private:
76  static ptr_lib::shared_ptr<ConfigFilter>
77  createNameFilter(const BoostInfoTree& configSection);
78 
85  virtual bool
86  matchName(const Name& packetName) = 0;
87 
88  // Disable the copy constructor and assignment operator.
89  ConfigFilter(const ConfigFilter& other);
90  ConfigFilter& operator=(const ConfigFilter& other);
91 };
92 
107 public:
114  (const Name& name, ConfigNameRelation::Relation relation)
115  : name_(name),
116  relation_(relation)
117  {
118  }
119 
120 private:
127  virtual bool
128  matchName(const Name& packetName);
129 
130  Name name_;
131  ConfigNameRelation::Relation relation_;
132 };
133 
146 public:
151  ConfigRegexNameFilter(const std::string& regexString);
152 
153 private:
160  virtual bool
161  matchName(const Name& packetName);
162 
163 private:
164  ptr_lib::shared_ptr<NdnRegexTopMatcher> regex_;
165 };
166 
167 }
168 
169 #endif
ConfigRegexNameFilter extends ConfigFilter to check that the packet name matches the specified regula...
Definition: config-filter.hpp:145
static ptr_lib::shared_ptr< ConfigFilter > create(const BoostInfoTree &configSection)
Create a filter from the configuration section.
bool match(bool isForInterest, const Name &packetName)
Call the virtual matchName method based on the packet type.
BoostInfoTree is provided for compatibility with the Boost INFO property list format used in ndn-cxx...
Definition: boost-info-parser.hpp:46
A Name holds an array of Name::Component and represents an NDN name.
Definition: name.hpp:40
ConfigRelationNameFilter extends ConfigFilter to check that the name is in the given relation to the ...
Definition: config-filter.hpp:106
ConfigRegexNameFilter(const std::string &regexString)
Create a ConfigRegexNameFilter from the regex string.
ConfigRelationNameFilter(const Name &name, ConfigNameRelation::Relation relation)
Create a ConfigRelationNameFilter for the given values.
Definition: config-filter.hpp:114
ConfigFilter is an abstract base class for RegexNameFilter, etc.
Definition: config-filter.hpp:41