Skip to content

Commit

Permalink
dirty
Browse files Browse the repository at this point in the history
  • Loading branch information
a-zakir committed Oct 31, 2024
1 parent b00bb91 commit 4befaee
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/api/API.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

namespace Antares::API
{
SimulationResults APIInternal::run(const IStudyLoader& study_loader)
SimulationResults APIInternal::run(IStudyLoader& study_loader)
{
try
{
Expand Down
2 changes: 1 addition & 1 deletion src/api/private/API.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class APIInternal
* load the study that will be simulated.
* @return SimulationResults object which contains the results of the simulation.
*/
SimulationResults run(const IStudyLoader& study_loader);
SimulationResults run(IStudyLoader& study_loader);

private:
std::shared_ptr<Antares::Data::Study> study_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ namespace Antares
FileTreeStudyLoader::FileTreeStudyLoader(std::filesystem::path study_path):
study_path_{std::move(study_path)}
{
study_path_c_str_ = study_path_.string().c_str();
study_path_str_ = study_path_.string();
argv_ = {"", study_path_str_.c_str(), "--parallel"};
}

std::unique_ptr<Antares::Data::Study> FileTreeStudyLoader::load() const
std::unique_ptr<Antares::Data::Study> FileTreeStudyLoader::load()
{
using namespace std::literals::string_literals;
Antares::Solver::Application application;
constexpr unsigned int argc = 3;

std::array<const char*, argc> argv{"", study_path_c_str_, "--parallel"};
application.prepare(argc, argv.data());
application.prepare(argc, argv_.data());

return application.acquireStudy();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,12 @@ class FileTreeStudyLoader: public IStudyLoader
*
* @return std::shared_ptr<Antares::Data::Study> A shared_ptr to the loaded Study object.
*/
[[nodiscard]] std::unique_ptr<Antares::Data::Study> load() const override;
[[nodiscard]] std::unique_ptr<Antares::Data::Study> load() override;

private:
std::filesystem::path study_path_;
std::string study_path_str_ = "";
const char* study_path_c_str_ = nullptr;
std::vector<const char*> argv_;
};
} // namespace Antares
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ class IStudyLoader
* @brief The load method is used to load a study.
* @return A shared pointer to a Study object.
*/
[[nodiscard]] virtual std::unique_ptr<Antares::Data::Study> load() const = 0;
[[nodiscard]] virtual std::unique_ptr<Antares::Data::Study> load() = 0;
};
} // namespace Antares
2 changes: 1 addition & 1 deletion src/tests/src/api_internal/test_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class InMemoryStudyLoader: public Antares::IStudyLoader
{
}

[[nodiscard]] std::unique_ptr<Antares::Data::Study> load() const override
[[nodiscard]] std::unique_ptr<Antares::Data::Study> load() override
{
if (!success_)
{
Expand Down

0 comments on commit 4befaee

Please sign in to comment.