Skip to content

Commit

Permalink
code smells 4
Browse files Browse the repository at this point in the history
  • Loading branch information
payetvin committed Feb 19, 2024
1 parent 59d249f commit 106db37
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class ClusterList
** \param id ID of the cluster to find
** \return A pointer to a cluster. nullptr if not found
*/
ClusterT* findInAll(const Data::ClusterName& id) const;
ClusterT* findInAll(std::string_view id) const;

/*!
** \brief Get if a cluster exists
Expand Down
2 changes: 1 addition & 1 deletion src/libs/antares/study/parts/common/cluster_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ std::shared_ptr<ClusterT> ClusterList<ClusterT>::enabledClusterAt(unsigned int i
}

template<class ClusterT>
ClusterT* ClusterList<ClusterT>::findInAll(const Data::ClusterName& id) const
ClusterT* ClusterList<ClusterT>::findInAll(std::string_view id) const
{
for (auto cluster : all())
if (cluster->id() == id)
Expand Down
4 changes: 2 additions & 2 deletions src/libs/antares/study/parts/thermal/cluster_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,9 +484,9 @@ bool ThermalClusterList::loadPreproFromFolder(Study& study,
= study.parameters.timeSeriesToGenerate & timeSeriesThermal;

Clob buffer;
auto hasPrepro = [&](auto c) { return (bool) c->prepro; };
auto hasPrepro = [](auto c) { return (bool) c->prepro; };

auto loadAndCheckPrepro = [&](auto c)
auto loadAndCheckPrepro = [&buffer, &folder, &study, &globalThermalTSgeneration](auto c)
{
assert(c->parentArea && "cluster: invalid parent area");
buffer.clear() << folder << SEP << c->parentArea->id << SEP << c->id();
Expand Down
2 changes: 1 addition & 1 deletion src/solver/ts-generator/generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void ResizeGeneratedTimeSeries(Data::AreaList& areas, Data::Parameters& params)

// Thermal
bool globalThermalTSgeneration = params.timeSeriesToGenerate & Data::timeSeriesThermal;
for (auto& cluster : area.thermal.list.all())
for (const auto& cluster : area.thermal.list.all())
{
if (cluster->doWeGenerateTS(globalThermalTSgeneration))
cluster->series.timeSeries.reset(params.nbTimeSeriesThermal, HOURS_PER_YEAR);
Expand Down
4 changes: 2 additions & 2 deletions src/ui/simulator/toolbox/input/renewable-cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ void RenewableCluster::internalAddPlant(void*)
// Trying to find an uniq name
YString sFl;
sFl.clear() << "new cluster";
while (pArea->renewable.list.findInAll(sFl))
while (pArea->renewable.list.findInAll(sFl.c_str()))
{
++indx;
sFl.clear() << "new cluster " << indx;
Expand Down Expand Up @@ -440,7 +440,7 @@ void RenewableCluster::internalClonePlant(void*)

YString sFl;
sFl << copy << indx; // lowercase
while (pArea->renewable.list.findInAll(sFl))
while (pArea->renewable.list.findInAll(sFl.c_str()))
{
++indx;
sFl.clear() << copy << indx;
Expand Down
4 changes: 2 additions & 2 deletions src/ui/simulator/toolbox/input/thermal-cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ void ThermalCluster::internalAddPlant(void*)
// Trying to find an uniq name
YString sFl;
sFl.clear() << "new cluster";
while (pArea->thermal.list.findInAll(sFl))
while (pArea->thermal.list.findInAll(sFl.c_str()))
{
++indx;
sFl.clear() << "new cluster " << indx;
Expand Down Expand Up @@ -500,7 +500,7 @@ void ThermalCluster::internalClonePlant(void*)

YString sFl;
sFl << copy << indx; // lowercase
while (pArea->thermal.list.findInAll(sFl))
while (pArea->thermal.list.findInAll(sFl.c_str()))
{
++indx;
sFl.clear() << copy << indx;
Expand Down

0 comments on commit 106db37

Please sign in to comment.