face: NDNLP slicer

refs #1206

Change-Id: Ifbf0aeedff8fc9300799c97772d988dce2fce306
diff --git a/daemon/face/ndnlp-sequence-generator.hpp b/daemon/face/ndnlp-sequence-generator.hpp
new file mode 100644
index 0000000..f067552
--- /dev/null
+++ b/daemon/face/ndnlp-sequence-generator.hpp
@@ -0,0 +1,72 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (C) 2014 Named Data Networking Project
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NFD_FACE_NDNLP_SEQUENCE_GENERATOR_HPP
+#define NFD_FACE_NDNLP_SEQUENCE_GENERATOR_HPP
+
+#include "common.hpp"
+
+namespace nfd {
+namespace ndnlp {
+
+/** \brief represents a block of sequence numbers
+ */
+class SequenceBlock
+{
+public:
+  SequenceBlock(uint64_t start, size_t count);
+  
+  /** \return{ the pos-th sequence number }
+   */
+  uint64_t
+  operator[](size_t pos) const;
+  
+  size_t
+  count() const;
+  
+private:
+  uint64_t m_start;
+  size_t m_count;
+};
+
+inline uint64_t
+SequenceBlock::operator[](size_t pos) const
+{
+  if (pos >= m_count)
+    throw std::out_of_range("pos");
+  return m_start + static_cast<uint64_t>(pos);
+}
+
+inline size_t
+SequenceBlock::count() const
+{
+  return m_count;
+}
+
+/** \class SequenceGenerator
+ *  \brief generates sequence numbers
+ */
+class SequenceGenerator : noncopyable
+{
+public:
+  SequenceGenerator();
+  
+  /** \brief generates a block of consecutive sequence numbers
+   *
+   *  This block must not overlap with a recent block.
+   */
+  SequenceBlock
+  nextBlock(size_t count);
+
+private:
+  /// next sequence number
+  uint64_t m_next;
+};
+
+} // namespace ndnlp
+} // namespace nfd
+
+#endif // NFD_FACE_NDNLP_SEQUENCE_GENERATOR_HPP