Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
sets.h
1/*
2** Copyright 2007-2024, RTE (https://www.rte-france.com)
3** See AUTHORS.txt
4** SPDX-License-Identifier: MPL-2.0
5** This file is part of Antares-Simulator,
6** Adequacy and Performance assessment for interconnected energy networks.
7**
8** Antares_Simulator is free software: you can redistribute it and/or modify
9** it under the terms of the Mozilla Public Licence 2.0 as published by
10** the Mozilla Foundation, either version 2 of the License, or
11** (at your option) any later version.
12**
13** Antares_Simulator is distributed in the hope that it will be useful,
14** but WITHOUT ANY WARRANTY; without even the implied warranty of
15** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16** Mozilla Public Licence 2.0 for more details.
17**
18** You should have received a copy of the Mozilla Public Licence 2.0
19** along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>.
20*/
21#ifndef __LIBS_STUDY_SCENARIO_BUILDER_SETS_H__
22#define __LIBS_STUDY_SCENARIO_BUILDER_SETS_H__
23
24#include <yuni/yuni.h>
25
26#include "rules.h"
27
28namespace Antares
29{
30namespace Data
31{
32namespace ScenarioBuilder
33{
37class Sets final: private Yuni::NonCopyable<Sets>
38{
39public:
41 using iterator = Rules::Map::iterator;
43 using const_iterator = Rules::Map::const_iterator;
44
45public:
49
50public:
52
53
58 Sets();
60 ~Sets();
62
63 void setStudy(Study& study);
64
66
67
70 bool loadFromStudy(Study& study);
71
75 void clear();
76
80 template<class StringT>
81 bool loadFromINIFile(const StringT& filename);
85 template<class StringT>
86 bool saveToINIFile(const StringT& filename);
88
90
91
96 Rules::Ptr createNew(const RulesScenarioName& name);
97
103 bool exists(const RulesScenarioName& lname) const;
104
108 Rules::Ptr find(const RulesScenarioName& lname) const;
109
115 Rules::Ptr rename(const RulesScenarioName& lname, const RulesScenarioName& newname);
116
122 bool remove(const RulesScenarioName& lname);
123
124 iterator begin();
125 const_iterator begin() const;
126
127 iterator end();
128 const_iterator end() const;
129
133 uint size() const;
134
138 bool empty() const;
140
141private:
143 bool internalLoadFromINIFile(const AnyString& filename);
145 bool internalSaveToIniFile(const AnyString& filename) const;
146
147private:
149 Rules::Map pMap;
151 Study* pStudy;
152}; // class Sets
153
154} // namespace ScenarioBuilder
155} // namespace Data
156} // namespace Antares
157
158#include "sets.hxx"
159
160#endif // __LIBS_STUDY_SCENARIO_BUILDER_SETS_H__
std::map< RulesScenarioName, Ptr > Map
Map.
Definition rules.h:57
std::shared_ptr< Rules > Ptr
Smart pointer.
Definition rules.h:55
Sets for TS numbers, for all years and a single timeseries.
Definition sets.h:38
Rules::Ptr rename(const RulesScenarioName &lname, const RulesScenarioName &newname)
Rename a given ruleset.
Definition sets.cpp:103
Rules::Ptr createNew(const RulesScenarioName &name)
Create a new set.
Definition sets.cpp:83
Sets()
Default constructor.
Definition sets.cpp:31
bool empty() const
Get if empty.
Definition sets.hxx:35
bool saveToINIFile(const StringT &filename)
Save all rulesets into a mere INI file.
Definition sets.hxx:77
bool remove(const RulesScenarioName &lname)
Delete a ruleset.
Definition sets.cpp:129
bool loadFromINIFile(const StringT &filename)
Load all rulesets from an INI file.
Definition sets.hxx:84
void clear()
Clear all data.
Definition sets.cpp:47
bool inUpdaterMode
Definition sets.h:48
Rules::Map::iterator iterator
Iterator.
Definition sets.h:41
bool loadFromStudy(Study &study)
Load data from the study.
Definition sets.cpp:53
Rules::Ptr find(const RulesScenarioName &lname) const
Find a rule set.
Definition sets.hxx:65
bool exists(const RulesScenarioName &lname) const
Test if a rules set exist.
Definition sets.hxx:60
~Sets()
Destructor.
Definition sets.cpp:37
Rules::Map::const_iterator const_iterator
Const iterator.
Definition sets.h:43
uint size() const
Get the number of available sets.
Definition sets.hxx:30
Definition study.h:61