Skip to content

Commit

Permalink
Allow absence of group attribute for binding constraints (#1769)
Browse files Browse the repository at this point in the history
* Add "default" to binding constraint group if empty

* Move "default" to constructors

* Remove empty group error
  • Loading branch information
flomnes authored Nov 20, 2023
1 parent 9c2546a commit 9df21bc
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ class BindingConstraint final : public Yuni::NonCopyable<BindingConstraint>
//! Comments
YString pComments;
//! Group
std::string group_;
std::string group_ = "default";

void clear();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,19 +152,6 @@ std::vector<std::shared_ptr<BindingConstraint>> BindingConstraintLoader::load(En
<< "]: Invalid operator [less,greater,equal,both]";
return {};
}
if (bc->group_.empty())
{
if (env.version >= version870)
{
logs.error() << env.iniFilename << ": in [" << env.section->name
<< "]: Missing mandatory binding constraint group";
return {};
}
else // In studies versions < 870, binding constraints have no group. From version 870, antares requires constraints to have a group.
{
bc->group_ = "default";
}
}

// The binding constraint can not be enabled if there is no weight in the table
if (bc->pLinkWeights.empty() && bc->pClusterWeights.empty())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ bool BindingConstraintSaver::saveToEnv(EnvForSaving& env, const BindingConstrain
env.section->add("operator", BindingConstraint::OperatorToCString(bindingConstraint->pOperator));
env.section->add("filter-year-by-year", datePrecisionIntoString(bindingConstraint->pFilterYearByYear));
env.section->add("filter-synthesis", datePrecisionIntoString(bindingConstraint->pFilterSynthesis));

if (!bindingConstraint->group().empty())
env.section->add("group", bindingConstraint->group());
env.section->add("group", bindingConstraint->group());

if (!bindingConstraint->pComments.empty())
env.section->add("comments", bindingConstraint->pComments);
Expand Down

0 comments on commit 9df21bc

Please sign in to comment.