Antares Xpansion
Investment simulations for Antares studies
Loading...
Searching...
No Matches
LpFilesExtractor.h
1#ifndef SRC_CPP_LPNAMER_INPUTREADER_LP_FILES_EXTRACTOR_H
2#define SRC_CPP_LPNAMER_INPUTREADER_LP_FILES_EXTRACTOR_H
3#include <filesystem>
4#include <utility>
5
6#include "antares-xpansion/xpansion_interfaces/LogUtils.h"
7#include "antares-xpansion/lpnamer/helper/ProblemGenerationLogger.h"
8#include "antares-xpansion/lpnamer/model/SimulationInputMode.h"
9
11 private:
12 const std::filesystem::path antares_archive_path_;
13 const std::filesystem::path xpansion_output_dir_;
14 std::shared_ptr<ProblemGenerationLog::ProblemGenerationLogger> logger_;
15 const SimulationInputMode mode_;
16 const std::filesystem::path& simulation_dir_;
17
18 public:
19 explicit LpFilesExtractor(
20 std::filesystem::path antares_archive_path,
21 std::filesystem::path xpansion_output_dir,
22 std::shared_ptr<ProblemGenerationLog::ProblemGenerationLogger> logger,
23 SimulationInputMode mode,
24 const std::filesystem::path& simulation_dir = {})
25 : antares_archive_path_(std::move(antares_archive_path)),
26 xpansion_output_dir_(std::move(xpansion_output_dir)),
27 logger_(std::move(logger)),
28 mode_(mode),
29 simulation_dir_(simulation_dir) {}
30 void ExtractFiles() const;
31
32 class ErrorWithAreaFile : public LogUtils::XpansionError<std::runtime_error> {
33 using LogUtils::XpansionError<std::runtime_error>::XpansionError;
34 };
35 class ErrorWithIntercosFile : public LogUtils::XpansionError<std::runtime_error> {
36 using LogUtils::XpansionError<std::runtime_error>::XpansionError;
37 };
38 private:
39 using areaAndIntercoPaths = std::pair<std::vector<std::filesystem::path>, std::vector<std::filesystem::path>>;
40 [[nodiscard]] areaAndIntercoPaths getFiles() const;
41 [[nodiscard]] areaAndIntercoPaths getFilesFromArchive() const;
42 void checkProperNumberOfAreaFiles(
43 const std::vector<std::filesystem::path>& vect_area_files) const;
44 void produceAreatxtFile(const std::vector<std::filesystem::path>& vect_area_files) const;
45 void checkProperNumberOfIntercoFiles(
46 const std::vector<std::filesystem::path>& vect_interco_files) const;
47 void produceIntercotxtFile(
48 const std::vector<std::filesystem::path>& vect_interco_files) const;
49};
50#endif // SRC_CPP_LPNAMER_INPUTREADER_LP_FILES_EXTRACTOR_H
Definition LpFilesExtractor.h:32
Definition LpFilesExtractor.h:35
Definition LpFilesExtractor.h:10