// Copyright 2019 Florian Uhlig /// \file /// \brief Defines the fles::TimesliceMultiInputArchive class. #pragma once #include "TimesliceSource.hpp" #include "StorableTimeslice.hpp" #include "log.hpp" #include #include #include #include #include namespace fles { /** * \brief The TimesliceMultiInputArchive class reads timeslice data from * several TimesliceInputArchives and returns the timslice with the * smallest index. */ class TimesliceMultiInputArchive : public TimesliceSource { public: // Construct an input archive object for each of the files passed in the input string // open the archive files for reading, and read the archive descriptors // If a directory is passed as second parameter build first a list of filenames which // contains the full path explicit TimesliceMultiInputArchive(const std::string&, const std::string& =""); /// Delete copy constructor (non-copyable). TimesliceMultiInputArchive(const TimesliceMultiInputArchive&) = delete; /// Delete assignment operator (non-copyable). void operator=(const TimesliceMultiInputArchive&) = delete; ~TimesliceMultiInputArchive() override = default; /** * \brief Retrieve the next item. * * \return pointer to the item, or nullptr if no more * timeslices available in the input archives */ std::unique_ptr get() { return (GetNextTimeslice()); }; bool eos() const override { return sortedSource_.size() == 0; } private: Timeslice* do_get() override; void InitTimesliceArchive(); void CreateInputFileList(std::string); bool OpenNextFile(int); std::unique_ptr GetNextTimeslice(); std::vector> source_; std::vector> InputFileList; std::vector> timesliceCont; std::set> sortedSource_; logging::OstreamLog status_log_{status}; logging::OstreamLog debug_log_{debug}; }; } // namespace fles