Antares Xpansion
Investment simulations for Antares studies
Loading...
Searching...
No Matches
CandidatesINIReader.h
1//
2
3#ifndef ANTARESXPANSION_CANDIDATESINIREADER_H
4#define ANTARESXPANSION_CANDIDATESINIREADER_H
5
6#include <filesystem>
7#include <string>
8#include <utility>
9#include <vector>
10
11#include "antares-xpansion/lpnamer/helper/ProblemGenerationLogger.h"
12#include "antares-xpansion/lpnamer/input_reader/INIReader.h"
13#include "antares-xpansion/lpnamer/model/Candidate.h"
14
16{
17 int index_interco;
18 int index_pays_origine;
19 int index_pays_extremite;
20};
21
23{
24public:
25 CandidatesINIReader(const std::filesystem::path& antaresIntercoFile,
26 const std::filesystem::path& areaFile,
27 std::shared_ptr<ProblemGenerationLog::ProblemGenerationLogger> logger);
28
29 explicit CandidatesINIReader(
30 std::shared_ptr<ProblemGenerationLog::ProblemGenerationLogger> logger):
31 logger_(logger)
32 {
33 }
34
35 std::vector<IntercoFileData> ReadAntaresIntercoFile(
36 const std::filesystem::path& antaresIntercoFile) const;
37 std::vector<IntercoFileData> ReadAntaresIntercoFile(
38 std::istringstream& antaresIntercoFileInStringStream) const;
39
40 std::vector<IntercoFileData> ReadLineByLineInterco(std::istream& stream) const;
41 std::vector<CandidateData> readCandidateData(const std::filesystem::path& candidateFile) const;
42
43 class InvalidIntercoFile: public LogUtils::XpansionError<std::runtime_error>
44 {
45 using LogUtils::XpansionError<std::runtime_error>::XpansionError;
46 };
47
48private:
49 bool checkArea(const std::string& areaName_p) const;
50 CandidateData readCandidateSection(const std::filesystem::path& candidateFile,
51 const INIReader& reader,
52 const std::string& sectionName,
53 std::ostringstream& err_msg) const;
54
55 std::map<std::string, int> _intercoIndexMap;
56 std::vector<IntercoFileData> _intercoFileData;
57 std::vector<std::string> _areaNames;
58 std::shared_ptr<ProblemGenerationLog::ProblemGenerationLogger> logger_;
59 void ProcessAreaFile(const std::filesystem::path& areaFile);
60};
61
62#endif // ANTARESXPANSION_CANDIDATESINIREADER_H
Definition CandidatesINIReader.h:44
Definition CandidatesINIReader.h:23
Definition INIReader.h:337
Definition Candidate.h:9
Definition CandidatesINIReader.h:16