Commit d6055c14 authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

C++11: convert SymbolType to a class enum

parent c12088f3
......@@ -139,20 +139,20 @@ enum BlockSimulationType
//! Enumeration of possible symbol types
/*! Warning: do not to change existing values for 0 to 4: the values matter for homotopy_setup command */
enum SymbolType
{
eEndogenous = 0, //!< Endogenous
eExogenous = 1, //!< Exogenous
eExogenousDet = 2, //!< Exogenous deterministic
eParameter = 4, //!< Parameter
eModelLocalVariable = 10, //!< Local variable whose scope is model (pound expression)
eModFileLocalVariable = 11, //!< Local variable whose scope is mod file (model excluded)
eExternalFunction = 12, //!< External (user-defined) function
eTrend = 13, //!< Trend variable
eStatementDeclaredVariable = 14, //!< Local variable assigned within a Statement (see subsample statement for example)
eLogTrend = 15, //!< Log-trend variable
eUnusedEndogenous = 16,
eEndogenousVAR = 17 //!< Variables declared in a var_model statement
enum class SymbolType
{
endogenous = 0, //!< Endogenous
exogenous = 1, //!< Exogenous
exogenousDet = 2, //!< Exogenous deterministic
parameter = 4, //!< Parameter
modelLocalVariable = 10, //!< Local variable whose scope is model (pound expression)
modFileLocalVariable = 11, //!< Local variable whose scope is mod file (model excluded)
externalFunction = 12, //!< External (user-defined) function
trend = 13, //!< Trend variable
statementDeclaredVariable = 14, //!< Local variable assigned within a Statement (see subsample statement for example)
logTrend = 15, //!< Log-trend variable
unusedEndogenous = 16,
endogenousVAR = 17 //!< Variables declared in a var_model statement
};
enum ExpressionType
......
......@@ -298,13 +298,13 @@ PacModelStatement::writeOutput(ostream &output, const string &basename, bool min
<< "M_.pac." << name << ".growth_type = ";
switch(symbol_table.getType(growth))
{
case eEndogenous:
case SymbolType::endogenous:
output << "'endogenous';" << endl;
break;
case eExogenous:
case SymbolType::exogenous:
output << "'exogenous';" << endl;
break;
case eParameter:
case SymbolType::parameter:
output << "'parameter';" << endl;
break;
default:
......@@ -354,13 +354,13 @@ PacModelStatement::writeJsonOutput(ostream &output) const
<< "\"growth_type\": ";
switch(symbol_table.getType(growth))
{
case eEndogenous:
case SymbolType::endogenous:
output << "\"endogenous\"" << endl;
break;
case eExogenous:
case SymbolType::exogenous:
output << "\"exogenous\"" << endl;
break;
case eParameter:
case SymbolType::parameter:
output << "\"parameter\"" << endl;
break;
default:
......@@ -1060,7 +1060,7 @@ RamseyPolicyStatement::checkRamseyPolicyList()
cerr << "ERROR: ramsey_policy: " << it << " was not declared." << endl;
exit(EXIT_FAILURE);
}
if (symbol_table.getType(it) != eEndogenous)
if (symbol_table.getType(it) != SymbolType::endogenous)
{
cerr << "ERROR: ramsey_policy: " << it << " is not endogenous." << endl;
exit(EXIT_FAILURE);
......@@ -1528,9 +1528,9 @@ EstimatedParamsStatement::writeOutput(ostream &output, const string &basename, b
switch (it.type)
{
case 1:
if (symb_type == eExogenous)
if (symb_type == SymbolType::exogenous)
output << "estim_params_.var_exo = [estim_params_.var_exo; ";
else if (symb_type == eEndogenous)
else if (symb_type == SymbolType::endogenous)
output << "estim_params_.var_endo = [estim_params_.var_endo; ";
output << symb_id;
break;
......@@ -1539,9 +1539,9 @@ EstimatedParamsStatement::writeOutput(ostream &output, const string &basename, b
<< symb_id;
break;
case 3:
if (symb_type == eExogenous)
if (symb_type == SymbolType::exogenous)
output << "estim_params_.corrx = [estim_params_.corrx; ";
else if (symb_type == eEndogenous)
else if (symb_type == SymbolType::endogenous)
output << "estim_params_.corrn = [estim_params_.corrn; ";
output << symb_id << " " << symbol_table.getTypeSpecificID(it.name2)+1;
break;
......@@ -1644,21 +1644,21 @@ EstimatedParamsInitStatement::writeOutput(ostream &output, const string &basenam
if (it.type < 3)
{
if (symb_type == eExogenous)
if (symb_type == SymbolType::exogenous)
{
output << "tmp1 = find(estim_params_.var_exo(:,1)==" << symb_id << ");" << endl;
output << "estim_params_.var_exo(tmp1,2) = ";
it.init_val->writeOutput(output);
output << ";" << endl;
}
else if (symb_type == eEndogenous)
else if (symb_type == SymbolType::endogenous)
{
output << "tmp1 = find(estim_params_.var_endo(:,1)==" << symb_id << ");" << endl;
output << "estim_params_.var_endo(tmp1,2) = ";
it.init_val->writeOutput(output);
output << ";" << endl;
}
else if (symb_type == eParameter)
else if (symb_type == SymbolType::parameter)
{
output << "tmp1 = find(estim_params_.param_vals(:,1)==" << symb_id << ");" << endl;
output << "estim_params_.param_vals(tmp1,2) = ";
......@@ -1668,7 +1668,7 @@ EstimatedParamsInitStatement::writeOutput(ostream &output, const string &basenam
}
else
{
if (symb_type == eExogenous)
if (symb_type == SymbolType::exogenous)
{
output << "tmp1 = find((estim_params_.corrx(:,1)==" << symb_id << " & estim_params_.corrx(:,2)==" << symbol_table.getTypeSpecificID(it.name2)+1 << ") | "
<< "(estim_params_.corrx(:,2)==" << symb_id << " & estim_params_.corrx(:,1)==" << symbol_table.getTypeSpecificID(it.name2)+1 << "));" << endl;
......@@ -1676,7 +1676,7 @@ EstimatedParamsInitStatement::writeOutput(ostream &output, const string &basenam
it.init_val->writeOutput(output);
output << ";" << endl;
}
else if (symb_type == eEndogenous)
else if (symb_type == SymbolType::endogenous)
{
output << "tmp1 = find((estim_params_.corrn(:,1)==" << symb_id << " & estim_params_.corrn(:,2)==" << symbol_table.getTypeSpecificID(it.name2)+1 << ") | "
<< "(estim_params_.corrn(:,2)==" << symb_id << " & estim_params_.corrn(:,1)==" << symbol_table.getTypeSpecificID(it.name2)+1 << "));" << endl;
......@@ -1740,7 +1740,7 @@ EstimatedParamsBoundsStatement::writeOutput(ostream &output, const string &basen
if (it.type < 3)
{
if (symb_type == eExogenous)
if (symb_type == SymbolType::exogenous)
{
output << "tmp1 = find(estim_params_.var_exo(:,1)==" << symb_id << ");" << endl;
......@@ -1752,7 +1752,7 @@ EstimatedParamsBoundsStatement::writeOutput(ostream &output, const string &basen
it.up_bound->writeOutput(output);
output << ";" << endl;
}
else if (symb_type == eEndogenous)
else if (symb_type == SymbolType::endogenous)
{
output << "tmp1 = find(estim_params_.var_endo(:,1)==" << symb_id << ");" << endl;
......@@ -1764,7 +1764,7 @@ EstimatedParamsBoundsStatement::writeOutput(ostream &output, const string &basen
it.up_bound->writeOutput(output);
output << ";" << endl;
}
else if (symb_type == eParameter)
else if (symb_type == SymbolType::parameter)
{
output << "tmp1 = find(estim_params_.param_vals(:,1)==" << symb_id << ");" << endl;
......@@ -1779,7 +1779,7 @@ EstimatedParamsBoundsStatement::writeOutput(ostream &output, const string &basen
}
else
{
if (symb_type == eExogenous)
if (symb_type == SymbolType::exogenous)
{
output << "tmp1 = find((estim_params_.corrx(:,1)==" << symb_id << " & estim_params_.corrx(:,2)==" << symbol_table.getTypeSpecificID(it.name2)+1 << ") | "
<< "(estim_params_.corrx(:,2)==" << symb_id << " & estim_params_.corrx(:,1)==" << symbol_table.getTypeSpecificID(it.name2)+1 << "));" << endl;
......@@ -1792,7 +1792,7 @@ EstimatedParamsBoundsStatement::writeOutput(ostream &output, const string &basen
it.up_bound->writeOutput(output);
output << ";" << endl;
}
else if (symb_type == eEndogenous)
else if (symb_type == SymbolType::endogenous)
{
output << "tmp1 = find((estim_params_.corrn(:,1)==" << symb_id << " & estim_params_.corrn(:,2)==" << symbol_table.getTypeSpecificID(it.name2)+1 << ") | "
<< "(estim_params_.corrn(:,2)==" << symb_id << " & estim_params_.corrn(:,1)==" << symbol_table.getTypeSpecificID(it.name2)+1 << "));" << endl;
......@@ -1856,7 +1856,7 @@ ObservationTrendsStatement::writeOutput(ostream &output, const string &basename,
for (const auto & trend_element : trend_elements)
{
SymbolType type = symbol_table.getType(trend_element.first);
if (type == eEndogenous)
if (type == SymbolType::endogenous)
{
output << "tmp1 = strmatch('" << trend_element.first << "',options_.varobs,'exact');" << endl;
output << "options_.trend_coeffs{tmp1} = '";
......@@ -1876,7 +1876,7 @@ ObservationTrendsStatement::writeJsonOutput(ostream &output) const
bool printed = false;
for (const auto & trend_element : trend_elements)
{
if (symbol_table.getType(trend_element.first) == eEndogenous)
if (symbol_table.getType(trend_element.first) == SymbolType::endogenous)
{
if (printed)
output << ", ";
......@@ -3562,9 +3562,9 @@ SubsamplesStatement::writeOutput(ostream &output, const string &basename, bool m
// Initialize associated subsample substructures in estimation_info
const SymbolType symb_type = symbol_table.getType(name1);
string lhs_field;
if (symb_type == eParameter)
if (symb_type == SymbolType::parameter)
lhs_field = "parameter";
else if (symb_type == eExogenous || symb_type == eExogenousDet)
else if (symb_type == SymbolType::exogenous || symb_type == SymbolType::exogenousDet)
lhs_field = "structural_innovation";
else
lhs_field = "measurement_error";
......@@ -3648,9 +3648,9 @@ SubsamplesEqualStatement::writeOutput(ostream &output, const string &basename, b
// Initialize associated subsample substructures in estimation_info
const SymbolType symb_type = symbol_table.getType(to_name1);
string lhs_field;
if (symb_type == eParameter)
if (symb_type == SymbolType::parameter)
lhs_field = "parameter";
else if (symb_type == eExogenous || symb_type == eExogenousDet)
else if (symb_type == SymbolType::exogenous || symb_type == SymbolType::exogenousDet)
lhs_field = "structural_innovation";
else
lhs_field = "measurement_error";
......@@ -3909,7 +3909,7 @@ BasicPriorStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
bool
BasicPriorStatement::is_structural_innovation(const SymbolType symb_type) const
{
if (symb_type == eExogenous || symb_type == eExogenousDet)
if (symb_type == SymbolType::exogenous || symb_type == SymbolType::exogenousDet)
return true;
return false;
}
......@@ -3917,7 +3917,7 @@ BasicPriorStatement::is_structural_innovation(const SymbolType symb_type) const
void
BasicPriorStatement::get_base_name(const SymbolType symb_type, string &lhs_field) const
{
if (symb_type == eExogenous || symb_type == eExogenousDet)
if (symb_type == SymbolType::exogenous || symb_type == SymbolType::exogenousDet)
lhs_field = "structural_innovation";
else
lhs_field = "measurement_error";
......@@ -4314,7 +4314,7 @@ PriorEqualStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
void
PriorEqualStatement::get_base_name(const SymbolType symb_type, string &lhs_field) const
{
if (symb_type == eExogenous || symb_type == eExogenousDet)
if (symb_type == SymbolType::exogenous || symb_type == SymbolType::exogenousDet)
lhs_field = "structural_innovation";
else
lhs_field = "measurement_error";
......@@ -4416,7 +4416,7 @@ BasicOptionsStatement::checkPass(ModFileStructure &mod_file_struct, WarningConso
bool
BasicOptionsStatement::is_structural_innovation(const SymbolType symb_type) const
{
if (symb_type == eExogenous || symb_type == eExogenousDet)
if (symb_type == SymbolType::exogenous || symb_type == SymbolType::exogenousDet)
return true;
return false;
}
......@@ -4424,7 +4424,7 @@ BasicOptionsStatement::is_structural_innovation(const SymbolType symb_type) cons
void
BasicOptionsStatement::get_base_name(const SymbolType symb_type, string &lhs_field) const
{
if (symb_type == eExogenous || symb_type == eExogenousDet)
if (symb_type == SymbolType::exogenous || symb_type == SymbolType::exogenousDet)
lhs_field = "structural_innovation";
else
lhs_field = "measurement_error";
......@@ -4692,7 +4692,7 @@ OptionsEqualStatement::writeJsonOutput(ostream &output) const
void
OptionsEqualStatement::get_base_name(const SymbolType symb_type, string &lhs_field) const
{
if (symb_type == eExogenous || symb_type == eExogenousDet)
if (symb_type == SymbolType::exogenous || symb_type == SymbolType::exogenousDet)
lhs_field = "structural_innovation";
else
lhs_field = "measurement_error";
......
......@@ -79,7 +79,7 @@ bool
DataTree::ParamUsedWithLeadLagInternal() const
{
for (const auto & it : variable_node_map)
if (symbol_table.getType(it.first.first) == eParameter && it.first.second != 0)
if (symbol_table.getType(it.first.first) == SymbolType::parameter && it.first.second != 0)
return true;
return false;
}
......@@ -507,7 +507,7 @@ DataTree::AddExpectation(int iArg1, expr_t iArg2)
expr_t
DataTree::AddVarExpectation(const int symb_id, const int forecast_horizon, const string &model_name)
{
assert(symbol_table.getType(symb_id) == eEndogenous);
assert(symbol_table.getType(symb_id) == SymbolType::endogenous);
auto it = var_expectation_node_map.find({ model_name, symb_id, forecast_horizon });
if (it != var_expectation_node_map.end())
......@@ -535,7 +535,7 @@ DataTree::AddEqual(expr_t iArg1, expr_t iArg2)
void
DataTree::AddLocalVariable(int symb_id, expr_t value) noexcept(false)
{
assert(symbol_table.getType(symb_id) == eModelLocalVariable);
assert(symbol_table.getType(symb_id) == SymbolType::modelLocalVariable);
// Throw an exception if symbol already declared
auto it = local_variables_table.find(symb_id);
......@@ -549,7 +549,7 @@ DataTree::AddLocalVariable(int symb_id, expr_t value) noexcept(false)
expr_t
DataTree::AddExternalFunction(int symb_id, const vector<expr_t> &arguments)
{
assert(symbol_table.getType(symb_id) == eExternalFunction);
assert(symbol_table.getType(symb_id) == SymbolType::externalFunction);
auto it = external_function_node_map.find({ arguments, symb_id });
if (it != external_function_node_map.end())
......@@ -561,7 +561,7 @@ DataTree::AddExternalFunction(int symb_id, const vector<expr_t> &arguments)
expr_t
DataTree::AddFirstDerivExternalFunction(int top_level_symb_id, const vector<expr_t> &arguments, int input_index)
{
assert(symbol_table.getType(top_level_symb_id) == eExternalFunction);
assert(symbol_table.getType(top_level_symb_id) == SymbolType::externalFunction);
auto it
= first_deriv_external_function_node_map.find({ arguments, input_index, top_level_symb_id });
......@@ -574,7 +574,7 @@ DataTree::AddFirstDerivExternalFunction(int top_level_symb_id, const vector<expr
expr_t
DataTree::AddSecondDerivExternalFunction(int top_level_symb_id, const vector<expr_t> &arguments, int input_index1, int input_index2)
{
assert(symbol_table.getType(top_level_symb_id) == eExternalFunction);
assert(symbol_table.getType(top_level_symb_id) == SymbolType::externalFunction);
auto it
= second_deriv_external_function_node_map.find({ arguments, input_index1, input_index2,
......
This diff is collapsed.
......@@ -688,13 +688,13 @@ change_type : CHANGE_TYPE '(' change_type_arg ')' change_type_var_list ';'
;
change_type_arg : PARAMETERS
{ $$ = eParameter; }
{ $$ = SymbolType::parameter; }
| VAR
{ $$ = eEndogenous; }
{ $$ = SymbolType::endogenous; }
| VAREXO
{ $$ = eExogenous; }
{ $$ = SymbolType::exogenous; }
| VAREXO_DET
{ $$ = eExogenousDet; }
{ $$ = SymbolType::exogenousDet; }
;
change_type_var_list : symbol
......@@ -894,11 +894,11 @@ hand_side : '(' hand_side ')'
| symbol
{ $$ = driver.add_model_variable($1); }
| symbol PIPE_E
{ $$ = driver.declare_or_change_type(eEndogenous, $1); }
{ $$ = driver.declare_or_change_type(SymbolType::endogenous, $1); }
| symbol PIPE_X
{ $$ = driver.declare_or_change_type(eExogenous, $1); }
{ $$ = driver.declare_or_change_type(SymbolType::exogenous, $1); }
| symbol PIPE_P
{ $$ = driver.declare_or_change_type(eParameter, $1); }
{ $$ = driver.declare_or_change_type(SymbolType::parameter, $1); }
| non_negative_number
{ $$ = driver.add_non_negative_constant($1); }
| hand_side PLUS hand_side
......
This diff is collapsed.
......@@ -83,8 +83,8 @@ ModFile::evalAllExpressions(bool warn_uninit, const bool nopreprocessoroutput)
for (int id = 0; id <= symbol_table.maxID(); id++)
{
SymbolType type = symbol_table.getType(id);
if ((type == eEndogenous || type == eExogenous || type == eExogenousDet
|| type == eParameter || type == eModelLocalVariable)
if ((type == SymbolType::endogenous || type == SymbolType::exogenous || type == SymbolType::exogenousDet
|| type == SymbolType::parameter || type == SymbolType::modelLocalVariable)
&& global_eval_context.find(id) == global_eval_context.end())
{
if (warn_uninit)
......@@ -214,7 +214,7 @@ ModFile::checkPass(bool nostrict, bool stochastic)
if (symbol_table.exists("dsge_prior_weight"))
{
if (symbol_table.getType("dsge_prior_weight") != eParameter)
if (symbol_table.getType("dsge_prior_weight") != SymbolType::parameter)
{
cerr << "ERROR: dsge_prior_weight may only be used as a parameter." << endl;
exit(EXIT_FAILURE);
......@@ -357,7 +357,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const
set<int> unusedEndogs = dynamic_model.findUnusedEndogenous();
for (int unusedEndog : unusedEndogs)
{
symbol_table.changeType(unusedEndog, eUnusedEndogenous);
symbol_table.changeType(unusedEndog, SymbolType::unusedEndogenous);
warnings << "WARNING: '" << symbol_table.getName(unusedEndog)
<< "' not used in model block, removed by nostrict command-line option" << endl;
}
......@@ -554,7 +554,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const
if (mod_file_struct.dsge_var_estimated || !mod_file_struct.dsge_var_calibrated.empty())
try
{
int sid = symbol_table.addSymbol("dsge_prior_weight", eParameter);
int sid = symbol_table.addSymbol("dsge_prior_weight", SymbolType::parameter);
if (!mod_file_struct.dsge_var_calibrated.empty())
addStatementAtFront(new InitParamStatement(sid,
expressions_tree.AddNonNegativeConstant(mod_file_struct.dsge_var_calibrated),
......
......@@ -128,7 +128,7 @@ ModelTree::computeNormalization(const jacob_map_t &contemporaneous_jacobian, boo
{
if (verbose)
cerr << "ERROR: Could not normalize the model. Variable "
<< symbol_table.getName(symbol_table.getID(eEndogenous, it - mate_map.begin()))
<< symbol_table.getName(symbol_table.getID(SymbolType::endogenous, it - mate_map.begin()))
<< " is not in the maximum cardinality matching." << endl;
check = false;
}
......@@ -208,12 +208,12 @@ ModelTree::computeNonSingularNormalization(jacob_map_t &contemporaneous_jacobian
contemporaneous_jacobian[{ it->first.first, it->first.second }] = 0;
try
{
if (first_derivatives.find({ it->first.first, getDerivID(symbol_table.getID(eEndogenous, it->first.second), 0) }) == first_derivatives.end())
first_derivatives[{ it->first.first, getDerivID(symbol_table.getID(eEndogenous, it->first.second), 0) }] = Zero;
if (first_derivatives.find({ it->first.first, getDerivID(symbol_table.getID(SymbolType::endogenous, it->first.second), 0) }) == first_derivatives.end())
first_derivatives[{ it->first.first, getDerivID(symbol_table.getID(SymbolType::endogenous, it->first.second), 0) }] = Zero;
}
catch (DataTree::UnknownDerivIDException &e)
{
cerr << "The variable " << symbol_table.getName(symbol_table.getID(eEndogenous, it->first.second))
cerr << "The variable " << symbol_table.getName(symbol_table.getID(SymbolType::endogenous, it->first.second))
<< " does not appear at the current period (i.e. with no lead and no lag); this case is not handled by the 'block' option of the 'model' block." << endl;
exit(EXIT_FAILURE);
}
......@@ -238,7 +238,7 @@ ModelTree::computeNormalizedEquations(multimap<int, int> &endo2eqs) const
continue;
int symb_id = lhs->get_symb_id();
if (symbol_table.getType(symb_id) != eEndogenous)
if (symbol_table.getType(symb_id) != SymbolType::endogenous)
continue;
set<pair<int, int>> endo;
......@@ -260,7 +260,7 @@ ModelTree::evaluateAndReduceJacobian(const eval_context_t &eval_context, jacob_m
it != first_derivatives.end(); it++)
{
int deriv_id = it->first.second;
if (getTypeByDerivID(deriv_id) == eEndogenous)
if (getTypeByDerivID(deriv_id) == SymbolType::endogenous)
{
expr_t Id = it->second;
int eq = it->first.first;
......@@ -457,7 +457,7 @@ ModelTree::equationTypeDetermination(const map<pair<int, pair<int, int>>, expr_t
derivative->second->collectEndogenous(result);
auto d_endo_variable = result.find({ var, 0 });
//Determine whether the equation could be evaluated rather than to be solved
if (lhs->isVariableNodeEqualTo(eEndogenous, Index_Var_IM[i], 0) && derivative->second->isNumConstNodeEqualTo(1))
if (lhs->isVariableNodeEqualTo(SymbolType::endogenous, Index_Var_IM[i], 0) && derivative->second->isNumConstNodeEqualTo(1))
{
Equation_Simulation_Type = E_EVALUATE;
}
......@@ -1120,7 +1120,7 @@ ModelTree::computeTemporaryTerms(bool is_matlab)
// All used model local variables are automatically set as temporary variables
set<int> used_local_vars;
for (auto & equation : equations)
equation->collectVariables(eModelLocalVariable, used_local_vars);
equation->collectVariables(SymbolType::modelLocalVariable, used_local_vars);
for (int used_local_var : used_local_vars)
{
......@@ -1459,7 +1459,7 @@ ModelTree::writeJsonModelLocalVariables(ostream &output, deriv_node_temp_terms_t
const temporary_terms_t tt;
for (auto equation : equations)
equation->collectVariables(eModelLocalVariable, used_local_vars);
equation->collectVariables(SymbolType::modelLocalVariable, used_local_vars);
output << "\"model_local_variables\": [";
bool printed = false;
......@@ -1621,7 +1621,7 @@ ModelTree::Write_Inf_To_Bin_File(const string &filename,
for (const auto & first_derivative : first_derivatives)
{
int deriv_id = first_derivative.first.second;
if (getTypeByDerivID(deriv_id) == eEndogenous)
if (getTypeByDerivID(deriv_id) == SymbolType::endogenous)
{
int eq = first_derivative.first.first;
int symb = getSymbIDByDerivID(deriv_id);
......
......@@ -127,9 +127,9 @@ InitOrEndValStatement::getUninitializedVariables(SymbolType type)
if (!all_values_required)
return unused;
if (type == eEndogenous)
if (type == SymbolType::endogenous)
unused = symbol_table.getEndogenous();
else if (type == eExogenous)
else if (type == SymbolType::exogenous)
unused = symbol_table.getExogenous();
else
{
......@@ -158,11 +158,11 @@ InitOrEndValStatement::writeInitValues(ostream &output) const
SymbolType type = symbol_table.getType(symb_id);
int tsid = symbol_table.getTypeSpecificID(symb_id) + 1;
if (type == eEndogenous)
if (type == SymbolType::endogenous)
output << "oo_.steady_state";
else if (type == eExogenous)
else if (type == SymbolType::exogenous)
output << "oo_.exo_steady_state";
else if (type == eExogenousDet)
else if (type == SymbolType::exogenousDet)
output << "oo_.exo_det_steady_state";
output << "( " << tsid << " ) = ";
......@@ -195,8 +195,8 @@ InitValStatement::InitValStatement(const init_values_t &init_values_arg,
void
InitValStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
{
set<int> exogs = getUninitializedVariables(eExogenous);
set<int> endogs = getUninitializedVariables(eEndogenous);
set<int> exogs = getUninitializedVariables(SymbolType::exogenous);
set<int> endogs = getUninitializedVariables(SymbolType::endogenous);
if (endogs.size() > 0)
{
......@@ -259,8 +259,8 @@ EndValStatement::EndValStatement(const init_values_t &init_values_arg,
void
EndValStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
{
set<int> exogs = getUninitializedVariables(eExogenous);
set<int> endogs = getUninitializedVariables(eEndogenous);
set<int> exogs = getUninitializedVariables(SymbolType::exogenous);
set<int> endogs = getUninitializedVariables(SymbolType::endogenous);
if (endogs.size() > 0)
{
......@@ -375,18 +375,18 @@ HistValStatement::writeOutput(ostream &output, const string &basename, bool mini
SymbolType type = symbol_table.getType(symb_id);
// For a lag greater than 1 on endo, or for any exo, lookup for auxiliary variable
if ((type == eEndogenous && lag < 0) || type == eExogenous)
if ((type == SymbolType::endogenous && lag < 0) || type == SymbolType::exogenous)
{
try
{
// This function call must remain the 1st statement in this block
symb_id = symbol_table.searchAuxiliaryVars(symb_id, lag);
lag = 0;
type = eEndogenous;
type = SymbolType::endogenous;
}
catch (SymbolTable::SearchFailedException &e)
{
if (type == eEndogenous)
if (type == SymbolType::endogenous)
{
cerr << "HISTVAL: internal error of Dynare, please contact the developers";
exit(EXIT_FAILURE);
......@@ -398,11 +398,11 @@ HistValStatement::writeOutput(ostream &output, const string &basename, bool mini
int tsid = symbol_table.getTypeSpecificID(symb_id) + 1;
if (type == eEndogenous)
if (type == SymbolType::endogenous)
output << "M_.endo_histval( " << tsid << ", M_.maximum_lag + " << lag << ") = ";
else if (type == eExogenous)
else if (type == SymbolType::exogenous)
output << "M_.exo_histval( " << tsid << ", M_.maximum_lag + " << lag << ") = ";
else if (type == eExogenousDet)
else if (type == SymbolType::exogenousDet)
output << "M_.exo_det_histval( " << tsid << ", M_.maximum_lag + " << lag << ") = ";
expression->writeOutput(output);
......@@ -494,7 +494,7 @@ HomotopyStatement::writeOutput(ostream &output, const string &basename, bool min
const SymbolType type = symbol_table.getType(symb_id);
const int tsid = symbol_table.getTypeSpecificID(symb_id) + 1;
output << "options_.homotopy_values = vertcat(options_.homotopy_values, [ " << type << ", " << tsid << ", ";
output << "options_.homotopy_values = vertcat(options_.homotopy_values, [ " << static_cast<int>(type) << ", " << tsid << ", ";
if (expression1 != nullptr)
expression1->writeOutput(output);
else
......@@ -590,16 +590,16 @@ LoadParamsAndSteadyStateStatement::writeOutput(ostream &output, const string &ba
{
switch (symbol_table.getType(it.first))
{
case eParameter:
case SymbolType::parameter:
output << "M_.params";
break;
case eEndogenous:
case SymbolType::endogenous:
output << "oo_.steady_state";
break;
case eExogenous:
case SymbolType::exogenous:
output << "oo_.exo_steady_state";
break;
case eExogenousDet:
case SymbolType::exogenousDet:
output << "oo_.exo_det_steady_state";
break;
default:
......
This diff is collapsed.
......@@ -43,7 +43,7 @@ AbstractShocksStatement::writeDetShocks(ostream &output) const
for (const auto & det_shock : det_shocks)
{
int id = symbol_table.getTypeSpecificID(det_shock.first) + 1;
bool exo_det = (symbol_table.getType(det_shock.first) == eExogenousDet);
bool exo_det = (symbol_table.getType(det_shock.first) == SymbolType::exogenousDet);