NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
pit-iterator.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_ITERATOR_HPP
27 #define NFD_DAEMON_TABLE_PIT_ITERATOR_HPP
28 
29 #include "name-tree.hpp"
30 #include "pit-entry.hpp"
31 
32 namespace nfd {
33 namespace pit {
34 
37 class Iterator : public std::iterator<std::forward_iterator_tag, const Entry>
38 {
39 public:
44  explicit
45  Iterator(const NameTree::const_iterator& ntIt = NameTree::const_iterator(), size_t iPitEntry = 0);
46 
47  const Entry&
48  operator*() const
49  {
50  return *this->operator->();
51  }
52 
53  const shared_ptr<Entry>&
54  operator->() const
55  {
56  BOOST_ASSERT(m_ntIt != NameTree::const_iterator());
57  BOOST_ASSERT(m_iPitEntry < m_ntIt->getPitEntries().size());
58  return m_ntIt->getPitEntries()[m_iPitEntry];
59  }
60 
61  Iterator&
62  operator++();
63 
64  Iterator
65  operator++(int);
66 
67  bool
68  operator==(const Iterator& other) const
69  {
70  return m_ntIt == other.m_ntIt && m_iPitEntry == other.m_iPitEntry;
71  }
72 
73  bool
74  operator!=(const Iterator& other) const
75  {
76  return !this->operator==(other);
77  }
78 
79 private:
80  NameTree::const_iterator m_ntIt;
81  size_t m_iPitEntry;
82 };
83 
84 } // namespace pit
85 } // namespace nfd
86 
87 #endif // NFD_DAEMON_TABLE_PIT_ITERATOR_HPP
const shared_ptr< Entry > & operator->() const
Iterator(const NameTree::const_iterator &ntIt=NameTree::const_iterator(), size_t iPitEntry=0)
constructor
PIT iterator.
Table::const_iterator iterator
Definition: cs-internal.hpp:41
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
an Interest table entry
Definition: pit-entry.hpp:57
bool operator==(const Iterator &other) const
Iterator & operator++()
bool operator!=(const Iterator &other) const
const Entry & operator*() const