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

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
......
This diff is collapsed.
......@@ -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);
for (size_t i = 0; i < det_shock.second.size(); i++)
{
......@@ -220,10 +220,10 @@ ShocksStatement::writeVarOrStdShock(ostream &output, var_and_std_shocks_t::const
bool stddev) const
{
SymbolType type = symbol_table.getType(it->first);
assert(type == eExogenous || symbol_table.isObservedVariable(it->first));
assert(type == SymbolType::exogenous || symbol_table.isObservedVariable(it->first));
int id;
if (type == eExogenous)
if (type == SymbolType::exogenous)
{
output << "M_.Sigma_e(";
id = symbol_table.getTypeSpecificID(it->first) + 1;
......@@ -261,11 +261,11 @@ ShocksStatement::writeCovarOrCorrShock(ostream &output, covar_and_corr_shocks_t:
{
SymbolType type1 = symbol_table.getType(it->first.first);
SymbolType type2 = symbol_table.getType(it->first.second);
assert((type1 == eExogenous && type2 == eExogenous)
assert((type1 == SymbolType::exogenous && type2 == SymbolType::exogenous)
|| (symbol_table.isObservedVariable(it->first.first) && symbol_table.isObservedVariable(it->first.second)));
string matrix, corr_matrix;
int id1, id2;
if (type1 == eExogenous)
if (type1 == SymbolType::exogenous)
{
matrix = "M_.Sigma_e";
corr_matrix = "M_.Correlation_matrix";
......@@ -319,7 +319,7 @@ ShocksStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidati
Also Determine if there is a calibrated measurement error */
for (auto var_shock : var_shocks)
{
if (symbol_table.getType(var_shock.first) != eExogenous
if (symbol_table.getType(var_shock.first) != SymbolType::exogenous
&& !symbol_table.isObservedVariable(var_shock.first))
{
cerr << "shocks: setting a variance on '"
......@@ -330,7 +330,7 @@ ShocksStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidati
for (auto std_shock : std_shocks)
{
if (symbol_table.getType(std_shock.first) != eExogenous
if (symbol_table.getType(std_shock.first) != SymbolType::exogenous
&& !symbol_table.isObservedVariable(std_shock.first))
{
cerr << "shocks: setting a standard error on '"
......@@ -344,8 +344,8 @@ ShocksStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidati
int symb_id1 = covar_shock.first.first;
int symb_id2 = covar_shock.first.second;
if (!((symbol_table.getType(symb_id1) == eExogenous
&& symbol_table.getType(symb_id2) == eExogenous)
if (!((symbol_table.getType(symb_id1) == SymbolType::exogenous
&& symbol_table.getType(symb_id2) == SymbolType::exogenous)
|| (symbol_table.isObservedVariable(symb_id1)
&& symbol_table.isObservedVariable(symb_id2))))
{
......@@ -361,8 +361,8 @@ ShocksStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidati
int symb_id1 = corr_shock.first.first;
int symb_id2 = corr_shock.first.second;
if (!((symbol_table.getType(symb_id1) == eExogenous
&& symbol_table.getType(symb_id2) == eExogenous)
if (!((symbol_table.getType(symb_id1) == SymbolType::exogenous
&& symbol_table.getType(symb_id2) == SymbolType::exogenous)
|| (symbol_table.isObservedVariable(symb_id1)
&& symbol_table.isObservedVariable(symb_id2))))
{
......@@ -378,13 +378,13 @@ ShocksStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidati
// Fill in mod_file_struct.parameters_with_shocks_values (related to #469)
for (auto var_shock : var_shocks)
var_shock.second->collectVariables(eParameter, mod_file_struct.parameters_within_shocks_values);
var_shock.second->collectVariables(SymbolType::parameter, mod_file_struct.parameters_within_shocks_values);
for (auto std_shock : std_shocks)
std_shock.second->collectVariables(eParameter, mod_file_struct.parameters_within_shocks_values);
std_shock.second->collectVariables(SymbolType::parameter, mod_file_struct.parameters_within_shocks_values);
for (const auto & covar_shock : covar_shocks)
covar_shock.second->collectVariables(eParameter, mod_file_struct.parameters_within_shocks_values);
covar_shock.second->collectVariables(SymbolType::parameter, mod_file_struct.parameters_within_shocks_values);
for (const auto & corr_shock : corr_shocks)
corr_shock.second->collectVariables(eParameter, mod_file_struct.parameters_within_shocks_values);
corr_shock.second->collectVariables(SymbolType::parameter, mod_file_struct.parameters_within_shocks_values);
}
......
This diff is collapsed.
......@@ -32,9 +32,9 @@ SteadyStateModel::addDefinition(int symb_id, expr_t expr)
{
AddVariable(symb_id); // Create the variable node to be used in write method
assert(symbol_table.getType(symb_id) == eEndogenous
|| symbol_table.getType(symb_id) == eModFileLocalVariable
|| symbol_table.getType(symb_id) == eParameter);
assert(symbol_table.getType(symb_id) == SymbolType::endogenous
|| symbol_table.getType(symb_id) == SymbolType::modFileLocalVariable
|| symbol_table.getType(symb_id) == SymbolType::parameter);
// Add the variable
vector<int> v;
......@@ -48,9 +48,9 @@ SteadyStateModel::addMultipleDefinitions(const vector<int> &symb_ids, expr_t exp
for (int symb_id : symb_ids)
{
AddVariable(symb_id); // Create the variable nodes to be used in write method
assert(symbol_table.getType(symb_id) == eEndogenous
|| symbol_table.getType(symb_id) == eModFileLocalVariable
|| symbol_table.getType(symb_id) == eParameter);
assert(symbol_table.getType(symb_id) == SymbolType::endogenous
|| symbol_table.getType(symb_id) == SymbolType::modFileLocalVariable
|| symbol_table.getType(symb_id) == SymbolType::parameter);
}
def_table.emplace_back(symb_ids, expr);
}
......@@ -79,8 +79,8 @@ SteadyStateModel::checkPass(ModFileStructure &mod_file_struct, WarningConsolidat
{
set<int> used_symbols;
const expr_t &expr = i.second;
expr->collectVariables(eEndogenous, used_symbols);
expr->collectVariables(eModFileLocalVariable, used_symbols);
expr->collectVariables(SymbolType::endogenous, used_symbols);
expr->collectVariables(SymbolType::modFileLocalVariable, used_symbols);
for (int used_symbol : used_symbols)
if (find(so_far_defined.begin(), so_far_defined.end(), used_symbol)
== so_far_defined.end())
......
......@@ -112,19 +112,19 @@ SymbolTable::freeze() noexcept(false)
int tsi;
switch (getType(i))
{
case eEndogenous:
case SymbolType::endogenous:
tsi = endo_ids.size();
endo_ids.push_back(i);
break;
case eExogenous:
case SymbolType::exogenous:
tsi = exo_ids.size();
exo_ids.push_back(i);
break;
case eExogenousDet:
case SymbolType::exogenousDet:
tsi = exo_det_ids.size();
exo_det_ids.push_back(i);
break;
case eParameter:
case SymbolType::parameter:
tsi = param_ids.size();
param_ids.push_back(i);
break;
......@@ -166,22 +166,22 @@ SymbolTable::getID(SymbolType type, int tsid) const noexcept(false)
switch (type)
{
case eEndogenous:
case SymbolType::endogenous:
if (tsid < 0 || tsid >= (int) endo_ids.size())
throw UnknownTypeSpecificIDException(tsid, type);
else
return endo_ids[tsid];
case eExogenous:
case SymbolType::exogenous:
if (tsid < 0 || tsid >= (int) exo_ids.size())
throw UnknownTypeSpecificIDException(tsid, type);
else
return exo_ids[tsid];
case eExogenousDet:
case SymbolType::exogenousDet:
if (tsid < 0 || tsid >= (int) exo_det_ids.size())
throw UnknownTypeSpecificIDException(tsid, type);
else
return exo_det_ids[tsid];
case eParameter:
case SymbolType::parameter:
if (tsid < 0 || tsid >= (int) param_ids.size())
throw UnknownTypeSpecificIDException(tsid, type);
else
......@@ -222,7 +222,7 @@ SymbolTable::writeOutput(ostream &output) const noexcept(false)
output << "M_.exo_names(" << id+1 << ") = {'" << getName(exo_ids[id]) << "'};" << endl
<< "M_.exo_names_tex(" << id+1 << ") = {'" << getTeXName(exo_ids[id]) << "'};" << endl
<< "M_.exo_names_long(" << id+1 << ") = {'" << getLongName(exo_ids[id]) << "'};" << endl;
map<string, map<int, string>> partitions = getPartitionsForType(eExogenous);
map<string, map<int, string>> partitions = getPartitionsForType(SymbolType::exogenous);
for (map<string, map<int, string>>::const_iterator it = partitions.begin();
it != partitions.end(); it++)
if (it->first != "long_name")
......@@ -251,7 +251,7 @@ SymbolTable::writeOutput(ostream &output) const noexcept(false)
<< "M_.exo_det_names_tex(" << id+1 << ") = {'" << getTeXName(exo_det_ids[id]) << "'};" << endl
<< "M_.exo_det_names_long(" << id+1 << ") = {'" << getLongName(exo_det_ids[id]) << "'};" << endl;
output << "M_.exo_det_partitions = struct();" << endl;
map<string, map<int, string>> partitions = getPartitionsForType(eExogenousDet);
map<string, map<int, string>> partitions = getPartitionsForType(SymbolType::exogenousDet);
for (map<string, map<int, string>>::const_iterator it = partitions.begin();
it != partitions.end(); it++)
if (it->first != "long_name")
......@@ -280,7 +280,7 @@ SymbolTable::writeOutput(ostream &output) const noexcept(false)
<< "M_.endo_names_tex(" << id+1 << ") = {'" << getTeXName(endo_ids[id]) << "'};" << endl
<< "M_.endo_names_long(" << id+1 << ") = {'" << getLongName(endo_ids[id]) << "'};" << endl;
output << "M_.endo_partitions = struct();" << endl;
map<string, map<int, string>> partitions = getPartitionsForType(eEndogenous);
map<string, map<int, string>> partitions = getPartitionsForType(SymbolType::endogenous);
for (map<string, map<int, string>>::const_iterator it = partitions.begin();
it != partitions.end(); it++)
if (it->first != "long_name")
......@@ -313,7 +313,7 @@ SymbolTable::writeOutput(ostream &output) const noexcept(false)
output << "options_.dsge_var = 1;" << endl;
}
output << "M_.param_partitions = struct();" << endl;
map<string, map<int, string>> partitions = getPartitionsForType(eParameter);
map<string, map<int, string>> partitions = getPartitionsForType(SymbolType::parameter);
for (map<string, map<int, string>>::const_iterator it = partitions.begin();
it != partitions.end(); it++)
if (it->first != "long_name")
......@@ -627,7 +627,7 @@ SymbolTable::addLeadAuxiliaryVarInternal(bool endo, int index, expr_t expr_arg)
int symb_id;
try
{
symb_id = addSymbol(varname.str(), eEndogenous);
symb_id = addSymbol(varname.str(), SymbolType::endogenous);
}
catch (AlreadyDeclaredException &e)
{
......@@ -653,7 +653,7 @@ SymbolTable::addLagAuxiliaryVarInternal(bool endo, int orig_symb_id, int orig_le
int symb_id;
try
{
symb_id = addSymbol(varname.str(), eEndogenous);
symb_id = addSymbol(varname.str(), SymbolType::endogenous);
}
catch (AlreadyDeclaredException &e)
{
......@@ -701,7 +701,7 @@ SymbolTable::addExpectationAuxiliaryVar(int information_set, int index, expr_t e
try
{
symb_id = addSymbol(varname.str(), eEndogenous);
symb_id = addSymbol(varname.str(), SymbolType::endogenous);
}
catch (AlreadyDeclaredException &e)
{
......@@ -724,7 +724,7 @@ SymbolTable::addDiffLagAuxiliaryVar(int index, expr_t expr_arg, int orig_symb_id
try
{
symb_id = addSymbol(varname.str(), eEndogenous);
symb_id = addSymbol(varname.str(), SymbolType::endogenous);
}
catch (AlreadyDeclaredException &e)
{
......@@ -747,7 +747,7 @@ SymbolTable::addDiffAuxiliaryVar(int index, expr_t expr_arg, int orig_symb_id, i
try
{
symb_id = addSymbol(varname.str(), eEndogenous);
symb_id = addSymbol(varname.str(), SymbolType::endogenous);
}
catch (AlreadyDeclaredException &e)
{
......@@ -775,7 +775,7 @@ SymbolTable::addUnaryOpAuxiliaryVar(int index, expr_t expr_arg, int orig_symb_id
varname << "AUX_UOP_" << index;
try
{
symb_id = addSymbol(varname.str(), eEndogenous);
symb_id = addSymbol(varname.str(), SymbolType::endogenous);
}
catch (AlreadyDeclaredException &e)
{
......@@ -797,7 +797,7 @@ SymbolTable::addVarModelEndoLagAuxiliaryVar(int orig_symb_id, int orig_lead_lag,
try
{
symb_id = addSymbol(varname.str(), eEndogenous);
symb_id = addSymbol(varname.str(), SymbolType::endogenous);
}
catch (AlreadyDeclaredException &e)
{
......@@ -819,7 +819,7 @@ SymbolTable::addMultiplierAuxiliaryVar(int index) noexcept(false)
try
{
symb_id = addSymbol(varname.str(), eEndogenous);
symb_id = addSymbol(varname.str(), SymbolType::endogenous);
}
catch (AlreadyDeclaredException &e)
{
......@@ -840,7 +840,7 @@ SymbolTable::addDiffForwardAuxiliaryVar(int orig_symb_id, expr_t expr_arg) noexc
try
{
symb_id = addSymbol(varname.str(), eEndogenous);
symb_id = addSymbol(varname.str(), SymbolType::endogenous);
}
catch (AlreadyDeclaredException &e)
{
......@@ -896,7 +896,7 @@ SymbolTable::markPredetermined(int symb_id) noexcept(false)
if (frozen)
throw FrozenException();
assert(getType(symb_id) == eEndogenous);
assert(getType(symb_id) == SymbolType::endogenous);
predetermined_variables.insert(symb_id);
}
......@@ -918,7 +918,7 @@ void
SymbolTable::addObservedVariable(int symb_id) noexcept(false)
{
validateSymbID(symb_id);
assert(getType(symb_id) == eEndogenous);
assert(getType(symb_id) == SymbolType::endogenous);
varobs.push_back(symb_id);
}
......@@ -946,7 +946,7 @@ void
SymbolTable::addObservedExogenousVariable(int symb_id) noexcept(false)
{
validateSymbID(symb_id);
assert(getType(symb_id) != eEndogenous);
assert(getType(symb_id) != SymbolType::endogenous);
varexobs.push_back(symb_id);