NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
pit.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #ifndef NFD_DAEMON_TABLE_PIT_HPP
27 #define NFD_DAEMON_TABLE_PIT_HPP
28 
29 #include "pit-entry.hpp"
30 #include "pit-iterator.hpp"
31 
32 namespace nfd {
33 namespace pit {
34 
42 typedef std::vector<shared_ptr<Entry>> DataMatchResult;
43 
46 class Pit : noncopyable
47 {
48 public:
49  explicit
50  Pit(NameTree& nameTree);
51 
54  size_t
55  size() const
56  {
57  return m_nItems;
58  }
59 
64  shared_ptr<Entry>
65  find(const Interest& interest) const
66  {
67  return const_cast<Pit*>(this)->findOrInsert(interest, false).first;
68  }
69 
75  std::pair<shared_ptr<Entry>, bool>
76  insert(const Interest& interest)
77  {
78  return this->findOrInsert(interest, true);
79  }
80 
84  DataMatchResult
85  findAllDataMatches(const Data& data) const;
86 
89  void
90  erase(Entry* entry)
91  {
92  this->erase(entry, true);
93  }
94 
97  void
98  deleteInOutRecords(Entry* entry, const Face& face);
99 
100 public: // enumeration
102 
108  const_iterator
109  begin() const;
110 
114  const_iterator
115  end() const
116  {
117  return Iterator();
118  }
119 
120 private:
121  void
122  erase(Entry* pitEntry, bool canDeleteNte);
123 
132  std::pair<shared_ptr<Entry>, bool>
133  findOrInsert(const Interest& interest, bool allowInsert);
134 
135 private:
136  NameTree& m_nameTree;
137  size_t m_nItems;
138 };
139 
140 } // namespace pit
141 
142 using pit::Pit;
143 
144 } // namespace nfd
145 
146 #endif // NFD_DAEMON_TABLE_PIT_HPP
void erase(Entry *entry)
deletes an entry
Definition: pit.hpp:90
shared_ptr< Entry > find(const Interest &interest) const
finds a PIT entry for Interest
Definition: pit.hpp:65
void deleteInOutRecords(Entry *entry, const Face &face)
deletes in-record and out-record for face
Definition: pit.cpp:117
const_iterator end() const
Definition: pit.hpp:115
PIT iterator.
represents an Interest packet
Definition: interest.hpp:42
Iterator const_iterator
Definition: pit.hpp:101
represents the Interest Table
Definition: pit.hpp:46
ndn Face
Definition: face-impl.hpp:41
const_iterator begin() const
Definition: pit.cpp:128
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
an Interest table entry
Definition: pit-entry.hpp:57
std::pair< shared_ptr< Entry >, bool > insert(const Interest &interest)
inserts a PIT entry for Interest
Definition: pit.hpp:76
size_t size() const
Definition: pit.hpp:55
Pit(NameTree &nameTree)
Definition: pit.cpp:37
Represents a Data packet.
Definition: data.hpp:35
std::vector< shared_ptr< Entry > > DataMatchResult
Definition: pit.hpp:42
DataMatchResult findAllDataMatches(const Data &data) const
performs a Data match
Definition: pit.cpp:88