21 #ifndef __ANTARES_LIBS_STUDY_SCENARIO_BUILDER_UPDATER_HXX__
22 #define __ANTARES_LIBS_STUDY_SCENARIO_BUILDER_UPDATER_HXX__
24 #include <yuni/yuni.h>
26 #include "antares/study/study.h"
30 #define SEP IO::Separator
36 class ScenarioBuilderUpdater final
45 if (study.scenarioRules)
47 study.scenarioRules->inUpdaterMode =
true;
48 logs.debug() <<
"[scenario-builder] updater mode ON";
51 <<
"[scenario-builder] writing data to a temporary file before structure changes";
52 pTempFile << memory.
cacheFolder() << SEP <<
"antares-scenbld-save-"
53 << memory.
processID() <<
'-' << (size_t)(
this) <<
"-scenariobuilder.tmp";
56 study.scenarioRules->saveToINIFile(pTempFile);
58 study.scenarioRules->clear();
62 ~ScenarioBuilderUpdater()
66 if (not pTempFile.empty())
70 logs.debug() <<
"[scenario-builder] reloading data from a temporary file";
74 logs.debug() <<
"[scenario-builder] updater mode OFF";
77 IO::File::Delete(pTempFile);
83 Yuni::String pTempFile;
std::unique_ptr< ScenarioBuilder::Sets > scenarioRules
Rules for building scenarios (can be null)
Definition: study.h:555
const Yuni::String & cacheFolder() const
\nane Cache Folder
Definition: memory.cpp:137
uint64_t processID() const
Get the process ID of the application.
Definition: memory.hxx:26