From 48940ff89916776a611e867b6a99d85efaf34aa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org> Date: Tue, 2 Oct 2018 18:15:31 +0200 Subject: [PATCH] Convert SvarRestrictionType into a class enum --- src/ParsingDriver.cc | 12 ++++++------ src/ParsingDriver.hh | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ParsingDriver.cc b/src/ParsingDriver.cc index 7ad42300..a7428c71 100644 --- a/src/ParsingDriver.cc +++ b/src/ParsingDriver.cc @@ -1184,7 +1184,7 @@ ParsingDriver::add_restriction_equation_nbr(const string &eq_nbr) svar_equation_nbr = stoi(eq_nbr); svar_left_handside = true; // reinitialize restriction type that must be set from the first restriction element - svar_restriction_type = ParsingDriver::NOT_SET; + svar_restriction_type = SvarRestrictionType::NOT_SET; } void @@ -1247,23 +1247,23 @@ ParsingDriver::add_restriction_element(expr_t value, const string &variable, con int symb_id = mod_file->symbol_table.getID(variable); int current_lag = stoi(lag); - if (svar_restriction_type == ParsingDriver::NOT_SET) + if (svar_restriction_type == SvarRestrictionType::NOT_SET) { if (current_lag == 0) { - svar_restriction_type = ParsingDriver::Qi_TYPE; + svar_restriction_type = SvarRestrictionType::Qi_TYPE; ++svar_Qi_restriction_nbr[svar_equation_nbr]; } else { - svar_restriction_type = ParsingDriver::Ri_TYPE; + svar_restriction_type = SvarRestrictionType::Ri_TYPE; ++svar_Ri_restriction_nbr[svar_equation_nbr]; } } else { - if ((svar_restriction_type == Qi_TYPE && current_lag > 0) - || (svar_restriction_type == Ri_TYPE && current_lag == 0)) + if ((svar_restriction_type == SvarRestrictionType::Qi_TYPE && current_lag > 0) + || (svar_restriction_type == SvarRestrictionType::Ri_TYPE && current_lag == 0)) error("SVAR_IDENTIFICATION: a single restrictions must affect either Qi or Ri, but not both"); } SvarIdentificationStatement::svar_identification_restriction new_restriction; diff --git a/src/ParsingDriver.hh b/src/ParsingDriver.hh index 8ff2dac4..c94ed1c9 100644 --- a/src/ParsingDriver.hh +++ b/src/ParsingDriver.hh @@ -200,7 +200,7 @@ private: //! Stores undeclared model variables set<string> undeclared_model_vars; //! Temporary storage for restriction type - enum SvarRestrictionType + enum class SvarRestrictionType { NOT_SET, Qi_TYPE, -- GitLab