NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
ndnlp-sequence-generator.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
25 #ifndef NFD_DAEMON_FACE_NDNLP_SEQUENCE_GENERATOR_HPP
26 #define NFD_DAEMON_FACE_NDNLP_SEQUENCE_GENERATOR_HPP
27 
28 #include "common.hpp"
29 
30 namespace nfd {
31 namespace ndnlp {
32 
36 {
37 public:
38  SequenceBlock(uint64_t start, size_t count);
39 
42  uint64_t
43  operator[](size_t pos) const;
44 
45  size_t
46  count() const;
47 
48 private:
49  uint64_t m_start;
50  size_t m_count;
51 };
52 
53 inline uint64_t
54 SequenceBlock::operator[](size_t pos) const
55 {
56  if (pos >= m_count)
57  BOOST_THROW_EXCEPTION(std::out_of_range("pos"));
58  return m_start + static_cast<uint64_t>(pos);
59 }
60 
61 inline size_t
63 {
64  return m_count;
65 }
66 
70 class SequenceGenerator : noncopyable
71 {
72 public:
74 
80  nextBlock(size_t count);
81 
82 private:
84  uint64_t m_next;
85 };
86 
87 } // namespace ndnlp
88 } // namespace nfd
89 
90 #endif // NFD_DAEMON_FACE_NDNLP_SEQUENCE_GENERATOR_HPP
uint64_t operator[](size_t pos) const
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:38
represents a block of sequence numbers
SequenceBlock(uint64_t start, size_t count)