29#include <yuni/core/string.h>
31#include <antares/inifile/inifile.h>
32#include <antares/logs/logs.h>
33#include "antares/study/area/area.h"
35namespace Antares::Data
43 using IDType = Yuni::ShortString128;
51 using TypePtr = std::shared_ptr<SetAreasType>;
54 using MapType = std::map<IDType, TypePtr>;
70 using Rule = std::pair<RuleType, std::string>;
92 void reset(
const IDType&
id)
125 using MapOptions = std::map<IDType, Options>;
155 bool forceReload(
bool )
const
161 void markAsModified()
const
171 bool hasOutput(
const Yuni::ShortString128& s)
const;
181 uint
resultSize(
const Yuni::ShortString128& s)
const;
188 void dumpToLogs()
const;
193 bool loadFromFile(
const std::filesystem::path& filename);
195 bool saveToFile(
const Yuni::String& filename)
const;
211 const IDType& nameByIndex(
const uint i)
const
213 assert(i < pMap.size() &&
"Sets: operator[] index out of bounds");
214 return pNameByIndex[i];
217 IDType caption(
const Yuni::ShortString128& s)
const;
218 IDType caption(
const uint i)
const;
224 TypePtr add(
const IDType& name)
226 TypePtr p = std::make_shared<SetAreasType>();
228 pOptions[name].reset(name);
235 pOptions[name].reset(name);
239 TypePtr add(
const IDType& name,
const TypePtr& data, Options& opts)
242 pOptions[name] = opts;
249 void rebuildFromRules(
const IDType&
id, SetHandlerAreas& handler);
250 void rebuildIndexes();
256 std::vector<TypePtr> pByIndex;
257 std::vector<IDType> pNameByIndex;
258 mutable bool pModified =
false;
A list of areas.
Definition area.h:366
uint resultSize
The number of items in the result set.
Definition sets.h:121
bool output
Enable/Disable the results in the output.
Definition sets.h:119
Yuni::String comments
Comments.
Definition sets.h:115
RuleSet rules
Rules to build the group.
Definition sets.h:117
IDType caption
Caption.
Definition sets.h:113
MapType::iterator iterator
Standard iterators from the STL.
Definition sets.h:56
std::set< Area *, CompareAreaName > SetAreasType
A single set of areas.
Definition sets.h:48
bool hasOutput(const Yuni::ShortString128 &s) const
Get if the results for a given group should be written to the output.
Definition sets.cpp:360
MapType::const_iterator const_iterator
Standard iterators from the STL (const)
Definition sets.h:58
uint resultSize(const Yuni::ShortString128 &s) const
Get the size of a result set.
Definition sets.cpp:371
bool loadFromFile(const std::filesystem::path &filename)
Load a rule set from an INI File.
Definition sets.cpp:164
void rebuildAllFromRules(SetHandlerAreas &handler)
Rebuild the lists of all group from the rules.
Definition sets.cpp:261
void defaultForAreas()
Create default groups for set of areas.
Definition sets.cpp:86
~Sets()=default
Destructor.
void clear()
Clear all groups.
Definition sets.cpp:55
std::shared_ptr< SetAreasType > TypePtr
Value.
Definition sets.h:51
std::map< IDType, TypePtr > MapType
Map of Item.
Definition sets.h:54
std::vector< Rule > RuleSet
Rule Set.
Definition sets.h:72
Sets()=default
Default constructor.
std::pair< RuleType, std::string > Rule
Definition of a single rule.
Definition sets.h:70
YString toString()
format the string to match the options
Definition sets.cpp:99