Skip to content
Snippets Groups Projects
DataBlockGenerator.h 1.14 KiB
Newer Older
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2016 ISIS Rutherford Appleton Laboratory UKRI,
//   NScD Oak Ridge National Laboratory, European Spallation Source,
//   Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +

#include "MantidDataHandling/DllConfig.h"
#include <boost/optional.hpp>
#include <memory>
#include <vector>

namespace Mantid {
namespace DataHandling {

class DataBlock;

/** DataBlockGenerator: The DataBlockGenerator class provides increasing
    int64_t numbers from a collection of intervals which are being input
    into the generator at construction.
*/
class DLLExport DataBlockGenerator {
public:
  DataBlockGenerator(const std::vector<std::pair<int64_t, int64_t>> &intervals);
  class DataBlock;
  DataBlockGenerator &operator++();
  DataBlockGenerator operator++(int);
  int64_t getValue();
  void next();
  std::vector<std::pair<int64_t, int64_t>> m_intervals;
  int64_t m_currentSpectrum;

  boost::optional<size_t> m_currentIntervalIndex;
};

} // namespace DataHandling
} // namespace Mantid