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 #include "core/asserts.hpp"
28 
29 namespace nfd {
30 namespace pit {
31 
33 
34 Iterator::Iterator(const NameTree::const_iterator& ntIt, size_t iPitEntry)
35  : m_ntIt(ntIt)
36  , m_iPitEntry(iPitEntry)
37 {
38 }
39 
40 Iterator&
42 {
43  BOOST_ASSERT(m_ntIt != NameTree::const_iterator());
44  BOOST_ASSERT(m_iPitEntry < m_ntIt->getPitEntries().size());
45 
46  if (++m_iPitEntry >= m_ntIt->getPitEntries().size()) {
47  ++m_ntIt;
48  m_iPitEntry = 0;
49  BOOST_ASSERT(m_ntIt == NameTree::const_iterator() || m_ntIt->hasPitEntries());
50  }
51 
52  return *this;
53 }
54 
57 {
58  Iterator copy = *this;
59  this->operator++();
60  return copy;
61 }
62 
63 } // namespace pit
64 } // namespace nfd
PIT iterator.
NFD_ASSERT_FORWARD_ITERATOR(Iterator)
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
Definition: algorithm.hpp:32
Iterator & operator++()
Iterator(const NameTree::const_iterator &ntIt=NameTree::const_iterator(), size_t iPitEntry=0)
constructor