pit-entry.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014-2019, Regents of the University of California,
4  * Arizona Board of Regents,
5  * Colorado State University,
6  * University Pierre & Marie Curie, Sorbonne University,
7  * Washington University in St. Louis,
8  * Beijing Institute of Technology,
9  * The University of Memphis.
10  *
11  * This file is part of NFD (Named Data Networking Forwarding Daemon).
12  * See AUTHORS.md for complete list of NFD authors and contributors.
13  *
14  * NFD is free software: you can redistribute it and/or modify it under the terms
15  * of the GNU General Public License as published by the Free Software Foundation,
16  * either version 3 of the License, or (at your option) any later version.
17  *
18  * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
19  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
20  * PURPOSE. See the GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License along with
23  * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
24  */
25 
26 #ifndef NFD_DAEMON_TABLE_PIT_ENTRY_HPP
27 #define NFD_DAEMON_TABLE_PIT_ENTRY_HPP
28 
29 #include "pit-in-record.hpp"
30 #include "pit-out-record.hpp"
31 
32 #include <list>
33 
34 namespace nfd {
35 
36 namespace name_tree {
37 class Entry;
38 } // namespace name_tree
39 
40 namespace pit {
41 
44 typedef std::list<InRecord> InRecordCollection;
45 
48 typedef std::list<OutRecord> OutRecordCollection;
49 
58 class Entry : public StrategyInfoHost, noncopyable
59 {
60 public:
61  explicit
62  Entry(const Interest& interest);
63 
69  const Interest&
70  getInterest() const
71  {
72  return *m_interest;
73  }
74 
77  const Name&
78  getName() const
79  {
80  return m_interest->getName();
81  }
82 
87  bool
88  canMatch(const Interest& interest, size_t nEqualNameComps = 0) const;
89 
90 public: // in-record
93  const InRecordCollection&
94  getInRecords() const
95  {
96  return m_inRecords;
97  }
98 
104  bool
105  hasInRecords() const
106  {
107  return !m_inRecords.empty();
108  }
109 
110  InRecordCollection::iterator
112  {
113  return m_inRecords.begin();
114  }
115 
116  InRecordCollection::const_iterator
117  in_begin() const
118  {
119  return m_inRecords.begin();
120  }
121 
122  InRecordCollection::iterator
124  {
125  return m_inRecords.end();
126  }
127 
128  InRecordCollection::const_iterator
129  in_end() const
130  {
131  return m_inRecords.end();
132  }
133 
137  InRecordCollection::iterator
138  getInRecord(const Face& face);
139 
143  InRecordCollection::iterator
144  insertOrUpdateInRecord(Face& face, const Interest& interest);
145 
148  void
149  deleteInRecord(const Face& face);
150 
153  void
154  clearInRecords();
155 
156 public: // out-record
159  const OutRecordCollection&
161  {
162  return m_outRecords;
163  }
164 
171  bool
173  {
174  return !m_outRecords.empty();
175  }
176 
177  OutRecordCollection::iterator
179  {
180  return m_outRecords.begin();
181  }
182 
183  OutRecordCollection::const_iterator
184  out_begin() const
185  {
186  return m_outRecords.begin();
187  }
188 
189  OutRecordCollection::iterator
191  {
192  return m_outRecords.end();
193  }
194 
195  OutRecordCollection::const_iterator
196  out_end() const
197  {
198  return m_outRecords.end();
199  }
200 
204  OutRecordCollection::iterator
205  getOutRecord(const Face& face);
206 
210  OutRecordCollection::iterator
211  insertOrUpdateOutRecord(Face& face, const Interest& interest);
212 
215  void
216  deleteOutRecord(const Face& face);
217 
218 public:
223  scheduler::EventId expiryTimer;
224 
227  bool isSatisfied = false;
228 
232  time::milliseconds dataFreshnessPeriod = 0_ms;
233 
234 private:
235  shared_ptr<const Interest> m_interest;
236  InRecordCollection m_inRecords;
237  OutRecordCollection m_outRecords;
238 
239  name_tree::Entry* m_nameTreeEntry = nullptr;
240 
241  friend class name_tree::Entry;
242 };
243 
244 } // namespace pit
245 } // namespace nfd
246 
247 #endif // NFD_DAEMON_TABLE_PIT_ENTRY_HPP
const InRecordCollection & getInRecords() const
Definition: pit-entry.hpp:94
bool hasInRecords() const
Definition: pit-entry.hpp:105
OutRecordCollection::const_iterator out_begin() const
Definition: pit-entry.hpp:184
Base class for an entity onto which StrategyInfo items may be placed.
bool hasOutRecords() const
Definition: pit-entry.hpp:172
OutRecordCollection::const_iterator out_end() const
Definition: pit-entry.hpp:196
InRecordCollection::const_iterator in_begin() const
Definition: pit-entry.hpp:117
std::list< InRecord > InRecordCollection
An unordered collection of in-records.
Definition: pit-entry.hpp:44
scheduler::EventId expiryTimer
Expiry timer.
Definition: pit-entry.hpp:223
InRecordCollection::const_iterator in_end() const
Definition: pit-entry.hpp:129
An Interest table entry.
Definition: pit-entry.hpp:58
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
Definition: algorithm.hpp:32
InRecordCollection::iterator in_end()
Definition: pit-entry.hpp:123
const Interest & getInterest() const
Definition: pit-entry.hpp:70
An entry in the name tree.
std::list< OutRecord > OutRecordCollection
An unordered collection of out-records.
Definition: pit-entry.hpp:48
OutRecordCollection::iterator out_begin()
Definition: pit-entry.hpp:178
OutRecordCollection::iterator out_end()
Definition: pit-entry.hpp:190
const OutRecordCollection & getOutRecords() const
Definition: pit-entry.hpp:160
const Name & getName() const
Definition: pit-entry.hpp:78
InRecordCollection::iterator in_begin()
Definition: pit-entry.hpp:111