NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
pit-iterator.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #include "pit-iterator.hpp"
27 
28 #include <boost/concept/assert.hpp>
29 #include <boost/concept_check.hpp>
30 #include <type_traits>
31 
32 namespace nfd {
33 namespace pit {
34 
35 BOOST_CONCEPT_ASSERT((boost::ForwardIterator<Iterator>));
36 static_assert(std::is_default_constructible<Iterator>::value,
37  "Iterator must be default-constructible");
38 
39 Iterator::Iterator(const NameTree::const_iterator& ntIt, size_t iPitEntry)
40  : m_ntIt(ntIt)
41  , m_iPitEntry(iPitEntry)
42 {
43 }
44 
45 Iterator&
47 {
48  BOOST_ASSERT(m_ntIt != NameTree::const_iterator());
49  BOOST_ASSERT(m_iPitEntry < m_ntIt->getPitEntries().size());
50 
51  if (++m_iPitEntry >= m_ntIt->getPitEntries().size()) {
52  ++m_ntIt;
53  m_iPitEntry = 0;
54  BOOST_ASSERT(m_ntIt == NameTree::const_iterator() || m_ntIt->hasPitEntries());
55  }
56 
57  return *this;
58 }
59 
62 {
63  Iterator copy = *this;
64  this->operator++();
65  return copy;
66 }
67 
68 } // namespace pit
69 } // namespace nfd
Iterator(const NameTree::const_iterator &ntIt=NameTree::const_iterator(), size_t iPitEntry=0)
constructor
const std::vector< shared_ptr< pit::Entry > > & getPitEntries() const
PIT iterator.
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
Iterator & operator++()