Antares Simulator
Power System Simulator
dataSeriesRepo.h
1 
2 /*
3  * Copyright 2007-2025, RTE (https://www.rte-france.com)
4  * See AUTHORS.txt
5  * SPDX-License-Identifier: MPL-2.0
6  * This file is part of Antares-Simulator,
7  * Adequacy and Performance assessment for interconnected energy networks.
8  *
9  * Antares_Simulator is free software: you can redistribute it and/or modify
10  * it under the terms of the Mozilla Public Licence 2.0 as published by
11  * the Mozilla Foundation, either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Antares_Simulator is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * Mozilla Public Licence 2.0 for more details.
18  *
19  * You should have received a copy of the Mozilla Public Licence 2.0
20  * along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>.
21  */
22 
23 #pragma once
24 
25 #include <map>
26 #include <memory>
27 #include <stdexcept>
28 #include <string>
29 
30 #include "dataSeries.h"
31 
32 namespace Antares::Optimisation::LinearProblemDataImpl
33 {
34 
36 {
37 public:
38  void addDataSeries(std::unique_ptr<IDataSeries> dataSeries);
39  [[nodiscard]] IDataSeries& getDataSeries(const std::string& setId) const;
40  // Constructeurs et opĂ©rateurs
41  DataSeriesRepository() = default;
43  DataSeriesRepository& operator=(const DataSeriesRepository&) = delete;
44 
45  DataSeriesRepository(DataSeriesRepository&&) noexcept = default;
46  DataSeriesRepository& operator=(DataSeriesRepository&&) noexcept = default;
47 
48 private:
49  std::map<std::string, std::unique_ptr<IDataSeries>> dataSeries_;
50 
51 public:
52  // Exception classes
53  class Empty: public std::invalid_argument
54  {
55  public:
56  Empty();
57  };
58 
59  class DataSeriesNotExist: public std::invalid_argument
60  {
61  public:
62  explicit DataSeriesNotExist(const std::string&);
63  };
64 
65  class DataSeriesAlreadyExists: public std::invalid_argument
66  {
67  public:
68  explicit DataSeriesAlreadyExists(const std::string&);
69  };
70 };
71 
72 } // namespace Antares::Optimisation::LinearProblemDataImpl