chunks: move getNextSegmentNo() to PipelineInterests base class

This hides the "excluded segment" logic from subclasses and
reduces code duplication.

Change-Id: I9f7b5b88e6010e4e16a0876e79fc2ecb9ff8dc00
diff --git a/tools/chunks/catchunks/pipeline-interests-fixed-window.cpp b/tools/chunks/catchunks/pipeline-interests-fixed-window.cpp
index 04cbf03..b81ec97 100644
--- a/tools/chunks/catchunks/pipeline-interests-fixed-window.cpp
+++ b/tools/chunks/catchunks/pipeline-interests-fixed-window.cpp
@@ -36,7 +36,6 @@
 PipelineInterestsFixedWindow::PipelineInterestsFixedWindow(Face& face, const Options& options)
   : PipelineInterests(face)
   , m_options(options)
-  , m_nextSegmentNo(0)
   , m_hasFailure(false)
 {
   m_segmentFetchers.resize(m_options.maxPipelineSize);
@@ -71,17 +70,15 @@
     return false;
   }
 
-  if (m_nextSegmentNo == m_excludedSegmentNo)
-    m_nextSegmentNo++;
-
-  if (m_hasFinalBlockId && m_nextSegmentNo > m_lastSegmentNo)
-   return false;
+  uint64_t nextSegmentNo = getNextSegmentNo();
+  if (m_hasFinalBlockId && nextSegmentNo > m_lastSegmentNo)
+    return false;
 
   // send interest for next segment
   if (m_options.isVerbose)
-    std::cerr << "Requesting segment #" << m_nextSegmentNo << std::endl;
+    std::cerr << "Requesting segment #" << nextSegmentNo << std::endl;
 
-  Interest interest(Name(m_prefix).appendSegment(m_nextSegmentNo));
+  Interest interest(Name(m_prefix).appendSegment(nextSegmentNo));
   interest.setInterestLifetime(m_options.interestLifetime);
   interest.setMustBeFresh(m_options.mustBeFresh);
   interest.setMaxSuffixComponents(1);
@@ -95,8 +92,7 @@
                                     m_options.isVerbose);
 
   BOOST_ASSERT(!m_segmentFetchers[pipeNo].first || !m_segmentFetchers[pipeNo].first->isRunning());
-  m_segmentFetchers[pipeNo] = make_pair(fetcher, m_nextSegmentNo);
-  m_nextSegmentNo++;
+  m_segmentFetchers[pipeNo] = make_pair(fetcher, nextSegmentNo);
 
   return true;
 }