NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
regex-backref-manager.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
24 #ifndef NDN_UTIL_REGEX_BACKREF_MANAGER_HPP
25 #define NDN_UTIL_REGEX_BACKREF_MANAGER_HPP
26 
27 #include "../../common.hpp"
28 
29 #include <vector>
30 
31 namespace ndn {
32 
33 class RegexMatcher;
34 
36 {
37 public:
39  {
40  }
41 
42  virtual
44 
45  size_t
46  pushRef(const shared_ptr<RegexMatcher>& matcher);
47 
48  void
49  popRef();
50 
51  size_t
52  size();
53 
54  const shared_ptr<RegexMatcher>&
55  getBackref(size_t backrefNo);
56 
57 private:
58  std::vector<shared_ptr<RegexMatcher> > m_backrefs;
59 };
60 
61 
62 inline
64 {
65  m_backrefs.clear();
66 }
67 
68 inline size_t
69 RegexBackrefManager::pushRef(const shared_ptr<RegexMatcher>& matcher)
70 {
71  size_t last = m_backrefs.size();
72  m_backrefs.push_back(matcher);
73 
74  return last;
75 }
76 
77 inline void
79 {
80  m_backrefs.pop_back();
81 }
82 
83 inline size_t
85 {
86  return m_backrefs.size();
87 }
88 
89 inline const shared_ptr<RegexMatcher>&
91 {
92  return m_backrefs[backrefNo];
93 }
94 
95 
96 } // namespace ndn
97 
98 #endif // NDN_UTIL_REGEX_BACKREF_MANAGER_HPP
Copyright (c) 2011-2015 Regents of the University of California.
size_t pushRef(const shared_ptr< RegexMatcher > &matcher)
const shared_ptr< RegexMatcher > & getBackref(size_t backrefNo)