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/lpnamer/helper/ProblemGenerationLogger.h"
7#include "antares-xpansion/lpnamer/model/SimulationInputMode.h"
8#include "antares-xpansion/xpansion_interfaces/LogUtils.h"
9
11{
12private:
13 const std::filesystem::path antares_archive_path_;
14 const std::filesystem::path xpansion_output_dir_;
15 std::shared_ptr<ProblemGenerationLog::ProblemGenerationLogger> logger_;
16 const SimulationInputMode mode_;
17 const std::filesystem::path& simulation_dir_;
18
19public:
20 explicit LpFilesExtractor(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 {
31 }
32
33 void ExtractFiles() const;
34
35 class ErrorWithAreaFile: public LogUtils::XpansionError<std::runtime_error>
36 {
37 using LogUtils::XpansionError<std::runtime_error>::XpansionError;
38 };
39
40 class ErrorWithIntercosFile: public LogUtils::XpansionError<std::runtime_error>
41 {
42 using LogUtils::XpansionError<std::runtime_error>::XpansionError;
43 };
44
45private:
46 using areaAndIntercoPaths = std::pair<std::vector<std::filesystem::path>,
47 std::vector<std::filesystem::path>>;
48 [[nodiscard]] areaAndIntercoPaths getFiles() const;
49 [[nodiscard]] areaAndIntercoPaths getFilesFromArchive() const;
50 void checkProperNumberOfAreaFiles(
51 const std::vector<std::filesystem::path>& vect_area_files) const;
52 void produceAreatxtFile(const std::vector<std::filesystem::path>& vect_area_files) const;
53 void checkProperNumberOfIntercoFiles(
54 const std::vector<std::filesystem::path>& vect_interco_files) const;
55 void produceIntercotxtFile(const std::vector<std::filesystem::path>& vect_interco_files) const;
56};
57#endif // SRC_CPP_LPNAMER_INPUTREADER_LP_FILES_EXTRACTOR_H
Definition LpFilesExtractor.h:36
Definition LpFilesExtractor.h:41
Definition LpFilesExtractor.h:11