Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
DataBlockGenerator.h 1.08 KiB
// 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 +
#pragma once

#include "MantidDataHandling/DataBlock.h"
#include <boost/optional.hpp>

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<spectrumPair> &intervals);
  class DataBlock;
  DataBlockGenerator &operator++();
  DataBlockGenerator operator++(int);
  bool isDone();
  specnum_t getValue();
  void next();

public:
  std::vector<spectrumPair> m_intervals;
  specnum_t m_currentSpectrum;

  boost::optional<size_t> m_currentIntervalIndex;
};

} // namespace DataHandling
} // namespace Mantid