21#ifndef __ANTARES_LIBS_STUDY_PARTS_COMMON_CLUSTER_LIST_H__
22#define __ANTARES_LIBS_STUDY_PARTS_COMMON_CLUSTER_LIST_H__
29#include <antares/logs/logs.h>
30#include <antares/writer/i_writer.h>
44template<
class ClusterT>
48 using SharedPtr =
typename std::shared_ptr<ClusterT>;
59 ClusterT*
findInAll(std::string_view
id)
const;
67 bool exists(
const Data::ClusterName&
id)
const;
69 auto each_enabled()
const
71 return allClusters_ | std::views::filter(&ClusterT::isEnabled);
74 std::vector<std::shared_ptr<ClusterT>> all()
const;
86 bool rename(Data::ClusterName idToFind, Data::ClusterName newName);
91 virtual bool remove(
const Data::ClusterName&
id);
95 SharedPtr operator[](std::size_t idx)
97 return allClusters_[idx];
100 SharedPtr operator[](std::size_t idx)
const
102 return allClusters_[idx];
105 SharedPtr enabledClusterAt(
unsigned int index)
const;
129 bool loadDataSeriesFromFolder(
Study& study,
const std::filesystem::path& folder);
131 bool saveDataSeriesToFolder(
const AnyString& folder)
const;
133 virtual bool saveToFolder(
const AnyString& folder)
const = 0;
148 unsigned int enabledCount()
const;
149 unsigned int allClustersCount()
const;
150 void addToCompleteList(std::shared_ptr<ClusterT> cluster);
151 void sortCompleteList();
154 std::vector<std::shared_ptr<ClusterT>> allClusters_;
156 virtual std::string typeID()
const = 0;
159 void rebuildIndexes();
162 bool alreadyInAllClusters(std::string clusterName);
Generic list of clustersThis class implements the base functions for a list of cluster It's used for ...
Definition cluster_list.h:46
void resizeAllTimeseriesNumbers(uint n) const
Resize all matrices dedicated to the sampled timeseries numbers.
Definition cluster_list.cpp:83
void markAsModified() const
Mark the clusters as modified.
Definition cluster_list.cpp:232
bool exists(const Data::ClusterName &id) const
Get if a cluster exists.
Definition cluster_list.cpp:71
bool forceReload(bool reload=false) const
Invalidate all clusters.
Definition cluster_list.cpp:225
ClusterT * findInAll(std::string_view id) const
Try to find a cluster from its id (const) in the complete cluster list.
Definition cluster_list.cpp:52
virtual bool remove(const Data::ClusterName &id)
Remove properly a cluster.
Definition cluster_list.cpp:241
void retrieveTotalCapacityAndUnitCount(double &total, uint &unitCount) const
Retrieve the total capacity and the total unit count.
Definition cluster_list.cpp:269
bool rename(Data::ClusterName idToFind, Data::ClusterName newName)
Rename a cluster.
Definition cluster_list.cpp:167