-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Data for new modeler (4.1) : coding the data series repository
- Loading branch information
1 parent
965173f
commit fe02503
Showing
5 changed files
with
31 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include <stdexcept> | ||
#include "antares/solver/modeler/dataSeries/dataSeriesRepo.h" | ||
|
||
namespace Antares::Solver::Modeler::DataSeries | ||
{ | ||
void DataSeriesRepository::addDataSeries(std::unique_ptr<IDataSeries> dataSeries) | ||
{ | ||
dataSeries_[dataSeries->name()] = std::move(dataSeries); | ||
} | ||
IDataSeries& DataSeriesRepository::getDataSeries(std::string setId) | ||
{ | ||
if (!dataSeries_.contains(setId)) | ||
{ | ||
std::string error_message = "Data series repo : data series named '" + setId + "' does not exist."; | ||
throw std::invalid_argument(error_message); | ||
} | ||
return *(dataSeries_[setId]); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/solver/modeler/dataSeries/include/antares/solver/modeler/dataSeries/dataSeries.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,23 @@ | ||
|
||
#pragma once | ||
|
||
#include <string> | ||
|
||
namespace Antares::Solver::Modeler::DataSeries | ||
{ | ||
|
||
class IDataSeries | ||
{ | ||
public: | ||
std::string name() | ||
{ | ||
return name_; | ||
} | ||
|
||
virtual double getData(unsigned int rank, unsigned int hour) = 0; | ||
|
||
private: | ||
std::string name_; | ||
}; | ||
|
||
} // namespace Antares::Solver::Modeler::DataSeries |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters