From b88e0de53febbbcfe1b7c3baeaca69e6b71b307b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Wed, 28 Nov 2018 14:32:26 +0100
Subject: [PATCH] Remove useless accessor methods for data members that are
 const in ExprNode classes

Those const data members are simply made public.
---
 src/ComputingTasks.cc |   2 +-
 src/DataTree.cc       |  12 ++---
 src/DynamicModel.cc   | 100 +++++++++++++++++++++---------------------
 src/ExprNode.cc       |  46 +++++++++----------
 src/ExprNode.hh       |  86 ++++++++++--------------------------
 src/ModelTree.cc      |  26 +++++------
 src/ParsingDriver.cc  |   2 +-
 src/StaticModel.cc    |  36 +++++++--------
 8 files changed, 134 insertions(+), 176 deletions(-)

diff --git a/src/ComputingTasks.cc b/src/ComputingTasks.cc
index 05f02867..5947437d 100644
--- a/src/ComputingTasks.cc
+++ b/src/ComputingTasks.cc
@@ -4936,7 +4936,7 @@ VarExpectationModelStatement::writeOutput(ostream &output, const string &basenam
          << mstruct << ".variable_id = " << symbol_table.getTypeSpecificID(variable)+1 << ";" << endl;
   auto disc_var = dynamic_cast<const VariableNode *>(discount);
   if (disc_var)
-    output << mstruct << ".discount_index = " << symbol_table.getTypeSpecificID(disc_var->get_symb_id()) + 1 << ';' << endl;
+    output << mstruct << ".discount_index = " << symbol_table.getTypeSpecificID(disc_var->symb_id) + 1 << ';' << endl;
   else
     {
       output << mstruct << ".discount_value = ";
diff --git a/src/DataTree.cc b/src/DataTree.cc
index 463fa073..0e3c22b7 100644
--- a/src/DataTree.cc
+++ b/src/DataTree.cc
@@ -174,13 +174,13 @@ DataTree::AddPlus(expr_t iArg1, expr_t iArg2)
     {
       // Simplify x+(-y) in x-y
       auto uarg2 = dynamic_cast<UnaryOpNode *>(iArg2);
-      if (uarg2 != nullptr && uarg2->get_op_code() == UnaryOpcode::uminus)
-        return AddMinus(iArg1, uarg2->get_arg());
+      if (uarg2 != nullptr && uarg2->op_code == UnaryOpcode::uminus)
+        return AddMinus(iArg1, uarg2->arg);
 
       // Simplify (-x)+y in y-x
       auto uarg1 = dynamic_cast<UnaryOpNode *>(iArg1);
-      if (uarg1 != nullptr && uarg1->get_op_code() == UnaryOpcode::uminus)
-        return AddMinus(iArg2, uarg1->get_arg());
+      if (uarg1 != nullptr && uarg1->op_code == UnaryOpcode::uminus)
+        return AddMinus(iArg2, uarg1->arg);
 
       // To treat commutativity of "+"
       // Nodes iArg1 and iArg2 are sorted by index
@@ -219,8 +219,8 @@ DataTree::AddUMinus(expr_t iArg1)
     {
       // Simplify -(-x) in x
       auto *uarg = dynamic_cast<UnaryOpNode *>(iArg1);
-      if (uarg != nullptr && uarg->get_op_code() == UnaryOpcode::uminus)
-        return uarg->get_arg();
+      if (uarg != nullptr && uarg->op_code == UnaryOpcode::uminus)
+        return uarg->arg;
 
       return AddUnaryOp(UnaryOpcode::uminus, iArg1);
     }
diff --git a/src/DynamicModel.cc b/src/DynamicModel.cc
index 83282bb0..8cd9d89b 100644
--- a/src/DynamicModel.cc
+++ b/src/DynamicModel.cc
@@ -649,8 +649,8 @@ DynamicModel::writeModelEquationsOrdered_M(const string &basename) const
           EquationType equ_type = getBlockEquationType(block, i);
           string sModel = symbol_table.getName(symbol_table.getID(SymbolType::endogenous, variable_ID));
           eq_node = (BinaryOpNode *) getBlockEquationExpr(block, i);
-          lhs = eq_node->get_arg1();
-          rhs = eq_node->get_arg2();
+          lhs = eq_node->arg1;
+          rhs = eq_node->arg2;
           tmp_output.str("");
           lhs->writeOutput(tmp_output, local_output_type, local_temporary_terms, {});
           switch (simulation_type)
@@ -677,8 +677,8 @@ DynamicModel::writeModelEquationsOrdered_M(const string &basename) const
                       output << endl << "    ";
                       tmp_output.str("");
                       eq_node = (BinaryOpNode *) getBlockEquationRenormalizedExpr(block, i);
-                      lhs = eq_node->get_arg1();
-                      rhs = eq_node->get_arg2();
+                      lhs = eq_node->arg1;
+                      rhs = eq_node->arg2;
                       lhs->writeOutput(output, local_output_type, local_temporary_terms, {});
                       output << " = ";
                       rhs->writeOutput(output, local_output_type, local_temporary_terms, {});
@@ -1415,16 +1415,16 @@ DynamicModel::writeModelEquationsCode_Block(const string &basename, const map_id
               if (equ_type == E_EVALUATE)
                 {
                   eq_node = (BinaryOpNode *) getBlockEquationExpr(block, i);
-                  lhs = eq_node->get_arg1();
-                  rhs = eq_node->get_arg2();
+                  lhs = eq_node->arg1;
+                  rhs = eq_node->arg2;
                   rhs->compile(code_file, instruction_number, false, temporary_terms, map_idx, true, false);
                   lhs->compile(code_file, instruction_number, true, temporary_terms, map_idx, true, false);
                 }
               else if (equ_type == E_EVALUATE_S)
                 {
                   eq_node = (BinaryOpNode *) getBlockEquationRenormalizedExpr(block, i);
-                  lhs = eq_node->get_arg1();
-                  rhs = eq_node->get_arg2();
+                  lhs = eq_node->arg1;
+                  rhs = eq_node->arg2;
                   rhs->compile(code_file, instruction_number, false, temporary_terms, map_idx, true, false);
                   lhs->compile(code_file, instruction_number, true, temporary_terms, map_idx, true, false);
                 }
@@ -1445,8 +1445,8 @@ DynamicModel::writeModelEquationsCode_Block(const string &basename, const map_id
               FNUMEXPR_ fnumexpr(ModelEquation, getBlockEquationID(block, i));
               fnumexpr.write(code_file, instruction_number);
               eq_node = (BinaryOpNode *) getBlockEquationExpr(block, i);
-              lhs = eq_node->get_arg1();
-              rhs = eq_node->get_arg2();
+              lhs = eq_node->arg1;
+              rhs = eq_node->arg2;
               lhs->compile(code_file, instruction_number, false, temporary_terms, map_idx, true, false);
               rhs->compile(code_file, instruction_number, false, temporary_terms, map_idx, true, false);
 
@@ -3681,7 +3681,7 @@ DynamicModel::updateVarAndTrendModel() const
           for (auto eqn : it.second)
             {
               set<pair<int, int>> rhs_set;
-              equations[eqn]->get_arg2()->collectDynamicVariables(SymbolType::endogenous, rhs_set);
+              equations[eqn]->arg2->collectDynamicVariables(SymbolType::endogenous, rhs_set);
               rhs.push_back(rhs_set);
 
               if (i == 1)
@@ -3695,7 +3695,7 @@ DynamicModel::updateVarAndTrendModel() const
                     catch (...)
                       {
                       }
-                  int trend_var_symb_id = equations[eqn]->get_arg2()->findTargetVariable(lhs_symb_id);
+                  int trend_var_symb_id = equations[eqn]->arg2->findTargetVariable(lhs_symb_id);
                   if (trend_var_symb_id >= 0)
                     {
                       if (symbol_table.isAuxiliaryVariable(trend_var_symb_id))
@@ -3764,9 +3764,9 @@ DynamicModel::fillVarModelTable() const
               exit(EXIT_FAILURE);
             }
 
-          equations[eqn]->get_arg1()->collectDynamicVariables(SymbolType::endogenous, lhs_set);
-          equations[eqn]->get_arg1()->collectDynamicVariables(SymbolType::exogenous, lhs_tmp_set);
-          equations[eqn]->get_arg1()->collectDynamicVariables(SymbolType::parameter, lhs_tmp_set);
+          equations[eqn]->arg1->collectDynamicVariables(SymbolType::endogenous, lhs_set);
+          equations[eqn]->arg1->collectDynamicVariables(SymbolType::exogenous, lhs_tmp_set);
+          equations[eqn]->arg1->collectDynamicVariables(SymbolType::parameter, lhs_tmp_set);
 
           if (lhs_set.size() != 1 || !lhs_tmp_set.empty())
             {
@@ -3788,10 +3788,10 @@ DynamicModel::fillVarModelTable() const
           lhs.push_back(itlhs->first);
           lhs_set.clear();
           set<expr_t> lhs_expr_t_set;
-          equations[eqn]->get_arg1()->collectVARLHSVariable(lhs_expr_t_set);
+          equations[eqn]->arg1->collectVARLHSVariable(lhs_expr_t_set);
           lhs_expr_t.push_back(*(lhs_expr_t_set.begin()));
 
-          equations[eqn]->get_arg2()->collectDynamicVariables(SymbolType::endogenous, rhs_set);
+          equations[eqn]->arg2->collectDynamicVariables(SymbolType::endogenous, rhs_set);
           for (const auto & itrhs : rhs_set)
             if (itrhs.second > 0)
               {
@@ -3830,7 +3830,7 @@ DynamicModel::fillVarModelTableFromOrigModel(StaticModel &static_model) const
       for (auto eqn : it.second)
         {
           // ensure no leads in equations
-          if (equations[eqn]->get_arg2()->VarMinLag() <= 0)
+          if (equations[eqn]->arg2->VarMinLag() <= 0)
             {
               cerr << "ERROR in VAR model Equation (#" << eqn << "). "
                    << "Leaded exogenous variables "
@@ -3840,14 +3840,14 @@ DynamicModel::fillVarModelTableFromOrigModel(StaticModel &static_model) const
             }
 
           // save lhs variables
-          equations[eqn]->get_arg1()->collectVARLHSVariable(lhs);
+          equations[eqn]->arg1->collectVARLHSVariable(lhs);
 
-          equations[eqn]->get_arg1()->countDiffs() > 0 ?
+          equations[eqn]->arg1->countDiffs() > 0 ?
             diff_vec.push_back(true) : diff_vec.push_back(false);
           if (diff_vec.back())
             {
               set<pair<int, int>> diff_set;
-              equations[eqn]->get_arg1()->collectDynamicVariables(SymbolType::endogenous, diff_set);
+              equations[eqn]->arg1->collectDynamicVariables(SymbolType::endogenous, diff_set);
 
               if (diff_set.size() != 1)
                 {
@@ -3874,7 +3874,7 @@ DynamicModel::fillVarModelTableFromOrigModel(StaticModel &static_model) const
 
       vector<int> max_lag;
       for (auto eqn : it.second)
-        max_lag.push_back(equations[eqn]->get_arg2()->VarMaxLag(static_model, lhs_static));
+        max_lag.push_back(equations[eqn]->arg2->VarMaxLag(static_model, lhs_static));
       lags[it.first] = max_lag;
       diff[it.first] = diff_vec;
       orig_diff_var[it.first] = orig_diff_var_vec;
@@ -3896,7 +3896,7 @@ DynamicModel::fillAutoregressiveMatrix(map<string, map<tuple<int, int, int>, exp
       vector<int> lhs = is_trend_component_model ?
         trend_component_model_table.getLhs(it.first) : var_model_table.getLhs(it.first);
       for (auto eqn : it.second)
-        equations[eqn]->get_arg2()->fillAutoregressiveRow(i++, lhs, AR);
+        equations[eqn]->arg2->fillAutoregressiveRow(i++, lhs, AR);
       ARr[it.first] = AR;
     }
 }
@@ -3957,9 +3957,9 @@ DynamicModel::fillTrendComponentModelTable() const
               exit(EXIT_FAILURE);
             }
 
-          equations[eqn]->get_arg1()->collectDynamicVariables(SymbolType::endogenous, lhs_set);
-          equations[eqn]->get_arg1()->collectDynamicVariables(SymbolType::exogenous, lhs_tmp_set);
-          equations[eqn]->get_arg1()->collectDynamicVariables(SymbolType::parameter, lhs_tmp_set);
+          equations[eqn]->arg1->collectDynamicVariables(SymbolType::endogenous, lhs_set);
+          equations[eqn]->arg1->collectDynamicVariables(SymbolType::exogenous, lhs_tmp_set);
+          equations[eqn]->arg1->collectDynamicVariables(SymbolType::parameter, lhs_tmp_set);
 
           if (lhs_set.size() != 1 || !lhs_tmp_set.empty())
             {
@@ -3981,10 +3981,10 @@ DynamicModel::fillTrendComponentModelTable() const
           lhs.push_back(itlhs->first);
           lhs_set.clear();
           set<expr_t> lhs_expr_t_set;
-          equations[eqn]->get_arg1()->collectVARLHSVariable(lhs_expr_t_set);
+          equations[eqn]->arg1->collectVARLHSVariable(lhs_expr_t_set);
           lhs_expr_t.push_back(*(lhs_expr_t_set.begin()));
 
-          equations[eqn]->get_arg2()->collectDynamicVariables(SymbolType::endogenous, rhs_set);
+          equations[eqn]->arg2->collectDynamicVariables(SymbolType::endogenous, rhs_set);
           for (const auto & itrhs : rhs_set)
             if (itrhs.second > 0)
               {
@@ -4026,7 +4026,7 @@ DynamicModel::fillErrorComponentMatrix(map<string, map<tuple<int, int, int>, exp
       i = 0;
       for (auto eqn : it.second)
         if (find(nontrend_eqnums.begin(), nontrend_eqnums.end(), eqn) != nontrend_eqnums.end())
-          equations[eqn]->get_arg2()->fillErrorCorrectionRow(i++, parsed_undiff_nontrend_lhs, trend_lhs, EC);
+          equations[eqn]->arg2->fillErrorCorrectionRow(i++, parsed_undiff_nontrend_lhs, trend_lhs, EC);
       ECr[it.first] = EC;
     }
 }
@@ -4044,7 +4044,7 @@ DynamicModel::fillTrendComponentModelTableFromOrigModel(StaticModel &static_mode
       for (auto eqn : it.second)
         {
           // ensure no leads in equations
-          if (equations[eqn]->get_arg2()->VarMinLag() <= 0)
+          if (equations[eqn]->arg2->VarMinLag() <= 0)
             {
               cerr << "ERROR in trend component model Equation (#" << eqn << "). "
                    << "Leaded exogenous variables "
@@ -4054,14 +4054,14 @@ DynamicModel::fillTrendComponentModelTableFromOrigModel(StaticModel &static_mode
             }
 
           // save lhs variables
-          equations[eqn]->get_arg1()->collectVARLHSVariable(lhs);
+          equations[eqn]->arg1->collectVARLHSVariable(lhs);
 
-          equations[eqn]->get_arg1()->countDiffs() > 0 ?
+          equations[eqn]->arg1->countDiffs() > 0 ?
             diff_vec.push_back(true) : diff_vec.push_back(false);
           if (diff_vec.back())
             {
               set<pair<int, int>> diff_set;
-              equations[eqn]->get_arg1()->collectDynamicVariables(SymbolType::endogenous, diff_set);
+              equations[eqn]->arg1->collectDynamicVariables(SymbolType::endogenous, diff_set);
 
               if (diff_set.size() != 1)
                 {
@@ -4088,7 +4088,7 @@ DynamicModel::fillTrendComponentModelTableFromOrigModel(StaticModel &static_mode
 
       vector<int> max_lag;
       for (auto eqn : it.second)
-        max_lag.push_back(equations[eqn]->get_arg2()->VarMaxLag(static_model, lhs_static));
+        max_lag.push_back(equations[eqn]->arg2->VarMaxLag(static_model, lhs_static));
       lags[it.first] = max_lag;
       diff[it.first] = diff_vec;
       orig_diff_var[it.first] = orig_diff_var_vec;
@@ -4224,12 +4224,12 @@ DynamicModel::getUndiffLHSForPac(const string &aux_model_name,
       if (printerr)
         { // we have undiffed something like diff(x), hence x is not in diff_subst_table
           lhs_expr_t.at(i) = node;
-          lhs.at(i) = dynamic_cast<VariableNode *>(node)->get_symb_id();
+          lhs.at(i) = dynamic_cast<VariableNode *>(node)->symb_id;
         }
       else
         {
           lhs_expr_t.at(i) = const_cast<expr_t>(it1->first);
-          lhs.at(i) = const_cast<VariableNode *>(it1->second)->get_symb_id();
+          lhs.at(i) = const_cast<VariableNode *>(it1->second)->symb_id;
         }
     }
   return lhs;
@@ -4262,11 +4262,11 @@ DynamicModel::walkPacParameters()
               {
               }
 
-          equation->get_arg2()->getPacOptimizingShareAndExprNodes(optim_share,
-                                                                  optim_part,
-                                                                  non_optim_part);
+          equation->arg2->getPacOptimizingShareAndExprNodes(optim_share,
+                                                            optim_part,
+                                                            non_optim_part);
           if (optim_part == nullptr)
-            equation->get_arg2()->getPacOptimizingPart(lhs_orig_symb_id, ec_params_and_vars, ar_params_and_vars);
+            equation->arg2->getPacOptimizingPart(lhs_orig_symb_id, ec_params_and_vars, ar_params_and_vars);
           else
             {
               optim_share_index = *(optim_share.begin());
@@ -4288,7 +4288,7 @@ DynamicModel::getPacMaxLag(const string &pac_model_name) const
     if (equation->containsPacExpectation(pac_model_name))
       {
         set<pair<int, int>> endogs;
-        equation->get_arg1()->collectDynamicVariables(SymbolType::endogenous, endogs);
+        equation->arg1->collectDynamicVariables(SymbolType::endogenous, endogs);
         if (endogs.size() != 1)
           {
             cerr << "The LHS of the PAC equation may only be comprised of one endogenous variable"
@@ -5296,8 +5296,8 @@ DynamicModel::testTrendDerivativesEqualToZero(const eval_context_t &eval_context
         || symbol_table.getType(it->first.first) == SymbolType::logTrend)
       for (int eq = 0; eq < (int) equations.size(); eq++)
         {
-          expr_t homogeneq = AddMinus(equations[eq]->get_arg1(),
-                                      equations[eq]->get_arg2());
+          expr_t homogeneq = AddMinus(equations[eq]->arg1,
+                                      equations[eq]->arg2);
 
           // Do not run the test if the term inside the log is zero
           if (fabs(homogeneq->eval(eval_context)) > zero_band)
@@ -6007,13 +6007,13 @@ DynamicModel::fillEvalContext(eval_context_t &eval_context) const
   // First, auxiliary variables
   for (auto aux_equation : aux_equations)
     {
-      assert(aux_equation->get_op_code() == BinaryOpcode::equal);
-      auto *auxvar = dynamic_cast<VariableNode *>(aux_equation->get_arg1());
+      assert(aux_equation->op_code == BinaryOpcode::equal);
+      auto *auxvar = dynamic_cast<VariableNode *>(aux_equation->arg1);
       assert(auxvar != nullptr);
       try
         {
-          double val = aux_equation->get_arg2()->eval(eval_context);
-          eval_context[auxvar->get_symb_id()] = val;
+          double val = aux_equation->arg2->eval(eval_context);
+          eval_context[auxvar->symb_id] = val;
         }
       catch (ExprNode::EvalException &e)
         {
@@ -6060,7 +6060,7 @@ void
 DynamicModel::addStaticOnlyEquation(expr_t eq, int lineno, const vector<pair<string, string>> &eq_tags)
 {
   auto *beq = dynamic_cast<BinaryOpNode *>(eq);
-  assert(beq != nullptr && beq->get_op_code() == BinaryOpcode::equal);
+  assert(beq != nullptr && beq->op_code == BinaryOpcode::equal);
 
   vector<pair<string, string>> soe_eq_tags;
   for (const auto & eq_tag : eq_tags)
@@ -6107,8 +6107,8 @@ DynamicModel::isChecksumMatching(const string &basename, bool block) const
   for (int eq = 0; eq < (int) equations.size(); eq++)
     {
       BinaryOpNode *eq_node = equations[eq];
-      expr_t lhs = eq_node->get_arg1();
-      expr_t rhs = eq_node->get_arg2();
+      expr_t lhs = eq_node->arg1;
+      expr_t rhs = eq_node->arg2;
 
       // Test if the right hand side of the equation is empty.
       double vrhs = 1.0;
diff --git a/src/ExprNode.cc b/src/ExprNode.cc
index 2ebdfa0d..f1ddd2c5 100644
--- a/src/ExprNode.cc
+++ b/src/ExprNode.cc
@@ -1863,22 +1863,22 @@ VariableNode::replaceTrendVar() const
 expr_t
 VariableNode::detrend(int symb_id, bool log_trend, expr_t trend) const
 {
-  if (get_symb_id() != symb_id)
+  if (this->symb_id != symb_id)
     return const_cast<VariableNode *>(this);
 
   if (log_trend)
     {
-      if (get_lag() == 0)
+      if (lag == 0)
         return datatree.AddPlus(const_cast<VariableNode *>(this), trend);
       else
-        return datatree.AddPlus(const_cast<VariableNode *>(this), trend->decreaseLeadsLags(-1*get_lag()));
+        return datatree.AddPlus(const_cast<VariableNode *>(this), trend->decreaseLeadsLags(-lag));
     }
   else
     {
-      if (get_lag() == 0)
+      if (lag == 0)
         return datatree.AddTimes(const_cast<VariableNode *>(this), trend);
       else
-        return datatree.AddTimes(const_cast<VariableNode *>(this), trend->decreaseLeadsLags(-1*get_lag()));
+        return datatree.AddTimes(const_cast<VariableNode *>(this), trend->decreaseLeadsLags(-lag));
     }
 }
 
@@ -1891,7 +1891,7 @@ VariableNode::countDiffs() const
 expr_t
 VariableNode::removeTrendLeadLag(map<int, expr_t> trend_symbols_map) const
 {
-  if ((get_type() != SymbolType::trend && get_type() != SymbolType::logTrend) || get_lag() == 0)
+  if ((get_type() != SymbolType::trend && get_type() != SymbolType::logTrend) || lag == 0)
     return const_cast<VariableNode *>(this);
 
   map<int, expr_t>::const_iterator it = trend_symbols_map.find(symb_id);
@@ -1899,18 +1899,18 @@ VariableNode::removeTrendLeadLag(map<int, expr_t> trend_symbols_map) const
   bool log_trend = get_type() == SymbolType::logTrend;
   expr_t trend = it->second;
 
-  if (get_lag() > 0)
+  if (lag > 0)
     {
       expr_t growthFactorSequence = trend->decreaseLeadsLags(-1);
       if (log_trend)
         {
-          for (int i = 1; i < get_lag(); i++)
+          for (int i = 1; i < lag; i++)
             growthFactorSequence = datatree.AddPlus(growthFactorSequence, trend->decreaseLeadsLags(-1*(i+1)));
           return datatree.AddPlus(noTrendLeadLagNode, growthFactorSequence);
         }
       else
         {
-          for (int i = 1; i < get_lag(); i++)
+          for (int i = 1; i < lag; i++)
             growthFactorSequence = datatree.AddTimes(growthFactorSequence, trend->decreaseLeadsLags(-1*(i+1)));
           return datatree.AddTimes(noTrendLeadLagNode, growthFactorSequence);
         }
@@ -1920,13 +1920,13 @@ VariableNode::removeTrendLeadLag(map<int, expr_t> trend_symbols_map) const
       expr_t growthFactorSequence = trend;
       if (log_trend)
         {
-          for (int i = 1; i < abs(get_lag()); i++)
+          for (int i = 1; i < abs(lag); i++)
             growthFactorSequence = datatree.AddPlus(growthFactorSequence, trend->decreaseLeadsLags(i));
           return datatree.AddMinus(noTrendLeadLagNode, growthFactorSequence);
         }
       else
         {
-          for (int i = 1; i < abs(get_lag()); i++)
+          for (int i = 1; i < abs(lag); i++)
             growthFactorSequence = datatree.AddTimes(growthFactorSequence, trend->decreaseLeadsLags(i));
           return datatree.AddDivide(noTrendLeadLagNode, growthFactorSequence);
         }
@@ -3411,12 +3411,12 @@ UnaryOpNode::substituteDiff(DataTree &static_datatree, diff_table_t &diff_table,
        rit != it->second.rend(); rit++)
     {
       expr_t argsubst = dynamic_cast<UnaryOpNode *>(rit->second)->
-          get_arg()->substituteDiff(static_datatree, diff_table, subst_table, neweqs);
+          arg->substituteDiff(static_datatree, diff_table, subst_table, neweqs);
       auto *vn = dynamic_cast<VariableNode *>(argsubst);
       if (rit == it->second.rbegin())
         {
           if (vn != nullptr)
-            symb_id = datatree.symbol_table.addDiffAuxiliaryVar(argsubst->idx, argsubst, vn->get_symb_id(), vn->get_lag());
+            symb_id = datatree.symbol_table.addDiffAuxiliaryVar(argsubst->idx, argsubst, vn->symb_id, vn->lag);
           else
             symb_id = datatree.symbol_table.addDiffAuxiliaryVar(argsubst->idx, argsubst);
 
@@ -3437,10 +3437,10 @@ UnaryOpNode::substituteDiff(DataTree &static_datatree, diff_table_t &diff_table,
             {
               if (i == last_arg_max_lag)
                 symb_id = datatree.symbol_table.addDiffLagAuxiliaryVar(argsubst->idx, argsubst,
-                                                                       last_aux_var->get_symb_id(), last_aux_var->get_lag());
+                                                                       last_aux_var->symb_id, last_aux_var->lag);
               else
                 symb_id = datatree.symbol_table.addDiffLagAuxiliaryVar(new_aux_var->idx, new_aux_var,
-                                                                       last_aux_var->get_symb_id(), last_aux_var->get_lag());
+                                                                       last_aux_var->symb_id, last_aux_var->lag);
 
               new_aux_var = datatree.AddVariable(symb_id, 0);
               neweqs.push_back(dynamic_cast<BinaryOpNode *>(datatree.AddEqual(new_aux_var,
@@ -3545,7 +3545,7 @@ UnaryOpNode::substituteUnaryOpNodes(DataTree &static_datatree, diff_table_t &nod
           symb_id = datatree.symbol_table.addUnaryOpAuxiliaryVar(this->idx, dynamic_cast<UnaryOpNode *>(rit->second), unary_op);
         else
           symb_id = datatree.symbol_table.addUnaryOpAuxiliaryVar(this->idx, dynamic_cast<UnaryOpNode *>(rit->second), unary_op,
-                                                                 vn->get_symb_id(), vn->get_lag());
+                                                                 vn->symb_id, vn->lag);
         aux_var = datatree.AddVariable(symb_id, 0);
         neweqs.push_back(dynamic_cast<BinaryOpNode *>(datatree.AddEqual(aux_var,
                                                                         dynamic_cast<UnaryOpNode *>(rit->second))));
@@ -5450,10 +5450,10 @@ BinaryOpNode::findTargetVariableHelper(const expr_t arg1, const expr_t arg2,
   if (endogs.size() == 2)
     {
       auto *testarg2 = dynamic_cast<BinaryOpNode *>(arg2);
-      if (testarg2 != nullptr && testarg2->get_op_code() == BinaryOpcode::minus)
+      if (testarg2 != nullptr && testarg2->op_code == BinaryOpcode::minus)
         {
-          auto *test_arg1 = dynamic_cast<VariableNode *>(testarg2->get_arg1());
-          auto *test_arg2 = dynamic_cast<VariableNode *>(testarg2->get_arg2());
+          auto *test_arg1 = dynamic_cast<VariableNode *>(testarg2->arg1);
+          auto *test_arg2 = dynamic_cast<VariableNode *>(testarg2->arg2);
           if (test_arg1 != nullptr && test_arg2 != nullptr )
             if (findTargetVariableHelper1(lhs_symb_id, endogs.begin()->first))
               return endogs.rbegin()->first;
@@ -5495,10 +5495,10 @@ BinaryOpNode::getPacOptimizingPartHelper(const expr_t arg1, const expr_t arg2,
   else if (endogs.size() >= 2)
     {
       auto *testarg2 = dynamic_cast<BinaryOpNode *>(arg2);
-      if (testarg2 != nullptr && testarg2->get_op_code() == BinaryOpcode::minus)
+      if (testarg2 != nullptr && testarg2->op_code == BinaryOpcode::minus)
         {
-          auto *test_arg1 = dynamic_cast<VariableNode *>(testarg2->get_arg1());
-          auto *test_arg2 = dynamic_cast<VariableNode *>(testarg2->get_arg2());
+          auto *test_arg1 = dynamic_cast<VariableNode *>(testarg2->arg1);
+          auto *test_arg2 = dynamic_cast<VariableNode *>(testarg2->arg2);
           if (test_arg1 != nullptr && test_arg2 != nullptr)
             {
               vector<int> endog_ids;
@@ -5712,7 +5712,7 @@ BinaryOpNode::fillErrorCorrectionRowHelper(expr_t arg1, expr_t arg2,
 
   BinaryOpNode *multiplicandr = dynamic_cast<BinaryOpNode *>(arg2);
   if (multiplicandr == nullptr
-      || multiplicandr->get_op_code() != BinaryOpcode::minus)
+      || multiplicandr->op_code != BinaryOpcode::minus)
     return;
 
   arg2->collectDynamicVariables(SymbolType::endogenous, endogs);
diff --git a/src/ExprNode.hh b/src/ExprNode.hh
index 62079b1e..5c541bf2 100644
--- a/src/ExprNode.hh
+++ b/src/ExprNode.hh
@@ -638,19 +638,15 @@ struct ExprNodeLess
 /*! The constant is necessarily non-negative (this is enforced at the NumericalConstants class level) */
 class NumConstNode : public ExprNode
 {
-private:
+public:
   //! Id from numerical constants table
   const int id;
+private:
   expr_t computeDerivative(int deriv_id) override;
 protected:
   void matchVTCTPHelper(int &var_id, int &lag, int &param_id, double &constant, bool at_denominator) const override;
 public:
   NumConstNode(DataTree &datatree_arg, int idx_arg, int id_arg);
-  int
-  get_id() const
-  {
-    return id;
-  };
   void prepareForDerivation() override;
   void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs, const deriv_node_temp_terms_t &tef_terms) const override;
   void writeJsonAST(ostream &output) const override;
@@ -721,11 +717,12 @@ public:
 class VariableNode : public ExprNode
 {
   friend class UnaryOpNode;
-private:
+public:
   //! Id from the symbol table
   const int symb_id;
   //! A positive value is a lead, a negative is a lag
   const int lag;
+private:
   expr_t computeDerivative(int deriv_id) override;
 protected:
   void matchVTCTPHelper(int &var_id, int &lag, int &param_id, double &constant, bool at_denominator) const override;
@@ -750,16 +747,6 @@ public:
   expr_t toStatic(DataTree &static_datatree) const override;
   void computeXrefs(EquationInfo &ei) const override;
   SymbolType get_type() const;
-  int
-  get_symb_id() const
-  {
-    return symb_id;
-  };
-  int
-  get_lag() const
-  {
-    return lag;
-  };
   pair<int, expr_t> normalizeEquation(int symb_id_endo, vector<pair<int, pair<expr_t, expr_t>>>  &List_of_Op_RHS) const override;
   expr_t getChainRuleDerivative(int deriv_id, const map<int, expr_t> &recursive_variables) override;
   int maxEndoLead() const override;
@@ -820,7 +807,7 @@ class UnaryOpNode : public ExprNode
 {
 protected:
   void matchVTCTPHelper(int &var_id, int &lag, int &param_id, double &constant, bool at_denominator) const override;
-private:
+public:
   const expr_t arg;
   //! Stores the information set. Only used for expectation operator
   const int expectation_information_set;
@@ -829,6 +816,7 @@ private:
   const UnaryOpcode op_code;
   const string adl_param_name;
   const vector<int> adl_lags;
+private:
   expr_t computeDerivative(int deriv_id) override;
   int cost(int cost, bool is_matlab) const override;
   int cost(const temporary_terms_t &temporary_terms, bool is_matlab) const override;
@@ -869,18 +857,6 @@ public:
   static double eval_opcode(UnaryOpcode op_code, double v) noexcept(false);
   double eval(const eval_context_t &eval_context) const noexcept(false) override;
   void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, const deriv_node_temp_terms_t &tef_terms) const override;
-  //! Returns operand
-  expr_t
-  get_arg() const
-  {
-    return (arg);
-  };
-  //! Returns op code
-  UnaryOpcode
-  get_op_code() const
-  {
-    return (op_code);
-  };
   expr_t toStatic(DataTree &static_datatree) const override;
   void computeXrefs(EquationInfo &ei) const override;
   pair<int, expr_t> normalizeEquation(int symb_id_endo, vector<pair<int, pair<expr_t, expr_t>>>  &List_of_Op_RHS) const override;
@@ -947,17 +923,18 @@ class BinaryOpNode : public ExprNode
 {
 protected:
   void matchVTCTPHelper(int &var_id, int &lag, int &param_id, double &constant, bool at_denominator) const override;
-private:
+public:
   const expr_t arg1, arg2;
   const BinaryOpcode op_code;
+  const int powerDerivOrder;
+  const string adlparam;
+private:
   expr_t computeDerivative(int deriv_id) override;
   int cost(int cost, bool is_matlab) const override;
   int cost(const temporary_terms_t &temporary_terms, bool is_matlab) const override;
   int cost(const map<NodeTreeReference, temporary_terms_t> &temp_terms_map, bool is_matlab) const override;
   //! Returns the derivative of this node if darg1 and darg2 are the derivatives of the arguments
   expr_t composeDerivatives(expr_t darg1, expr_t darg2);
-  const int powerDerivOrder;
-  const string adlparam;
 public:
   BinaryOpNode(DataTree &datatree_arg, int idx_arg, const expr_t arg1_arg,
                BinaryOpcode op_code_arg, const expr_t arg2_arg, int powerDerivOrder);
@@ -996,29 +973,6 @@ public:
   double eval(const eval_context_t &eval_context) const noexcept(false) override;
   void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, const deriv_node_temp_terms_t &tef_terms) const override;
   expr_t Compute_RHS(expr_t arg1, expr_t arg2, int op, int op_type) const;
-  //! Returns first operand
-  expr_t
-  get_arg1() const
-  {
-    return (arg1);
-  };
-  //! Returns second operand
-  expr_t
-  get_arg2() const
-  {
-    return (arg2);
-  };
-  //! Returns op code
-  BinaryOpcode
-  get_op_code() const
-  {
-    return (op_code);
-  };
-  int
-  get_power_deriv_order() const
-  {
-    return powerDerivOrder;
-  }
   void getPacOptimizingPartHelper(const expr_t arg1, const expr_t arg2,
                                   int lhs_orig_symb_id,
                                   pair<int, pair<vector<int>, vector<bool>>> &ec_params_and_vars,
@@ -1103,9 +1057,10 @@ public:
 class TrinaryOpNode : public ExprNode
 {
   friend class ModelTree;
-private:
+public:
   const expr_t arg1, arg2, arg3;
   const TrinaryOpcode op_code;
+private:
   expr_t computeDerivative(int deriv_id) override;
   int cost(int cost, bool is_matlab) const override;
   int cost(const temporary_terms_t &temporary_terms, bool is_matlab) const override;
@@ -1210,6 +1165,9 @@ public:
 //! External function node
 class AbstractExternalFunctionNode : public ExprNode
 {
+public:
+  const int symb_id;
+  const vector<expr_t> arguments;
 private:
   expr_t computeDerivative(int deriv_id) override;
   virtual expr_t composeDerivatives(const vector<expr_t> &dargs) = 0;
@@ -1218,8 +1176,6 @@ protected:
   class UnknownFunctionNameAndArgs
   {
   };
-  const int symb_id;
-  const vector<expr_t> arguments;
   //! Returns true if the given external function has been written as a temporary term
   bool alreadyWrittenAsTefTerm(int the_symb_id, const deriv_node_temp_terms_t &tef_terms) const;
   //! Returns the index in the tef_terms map of this external function
@@ -1371,8 +1327,9 @@ public:
 
 class FirstDerivExternalFunctionNode : public AbstractExternalFunctionNode
 {
-private:
+public:
   const int inputIndex;
+private:
   expr_t composeDerivatives(const vector<expr_t> &dargs) override;
 protected:
   function<bool (expr_t)> sameTefTermPredicate() const override;
@@ -1414,9 +1371,10 @@ public:
 
 class SecondDerivExternalFunctionNode : public AbstractExternalFunctionNode
 {
-private:
+public:
   const int inputIndex1;
   const int inputIndex2;
+private:
   expr_t composeDerivatives(const vector<expr_t> &dargs) override;
 protected:
   function<bool (expr_t)> sameTefTermPredicate() const override;
@@ -1459,9 +1417,8 @@ public:
 
 class VarExpectationNode : public ExprNode
 {
-private:
-  const string model_name;
 public:
+  const string model_name;
   VarExpectationNode(DataTree &datatree_arg, int idx_arg, string model_name_arg);
   void computeTemporaryTerms(map<expr_t, pair<int, NodeTreeReference>> &reference_count,
                                      map<NodeTreeReference, temporary_terms_t> &temp_terms_map,
@@ -1544,8 +1501,9 @@ public:
 
 class PacExpectationNode : public ExprNode
 {
-private:
+public:
   const string model_name;
+private:
   string var_model_name;
   int growth_symb_id;
   bool stationary_vars_present, nonstationary_vars_present;
diff --git a/src/ModelTree.cc b/src/ModelTree.cc
index 2bd75d68..02905b6f 100644
--- a/src/ModelTree.cc
+++ b/src/ModelTree.cc
@@ -358,16 +358,16 @@ ModelTree::computeNormalizedEquations(multimap<int, int> &endo2eqs) const
 {
   for (size_t i = 0; i < equations.size(); i++)
     {
-      auto *lhs = dynamic_cast<VariableNode *>(equations[i]->get_arg1());
+      auto *lhs = dynamic_cast<VariableNode *>(equations[i]->arg1);
       if (lhs == nullptr)
         continue;
 
-      int symb_id = lhs->get_symb_id();
+      int symb_id = lhs->symb_id;
       if (symbol_table.getType(symb_id) != SymbolType::endogenous)
         continue;
 
       set<pair<int, int>> endo;
-      equations[i]->get_arg2()->collectEndogenous(endo);
+      equations[i]->arg2->collectEndogenous(endo);
       if (endo.find({ symbol_table.getTypeSpecificID(symb_id), 0 }) != endo.end())
         continue;
 
@@ -521,7 +521,7 @@ ModelTree::computeNaturalNormalization()
     if (!is_equation_linear[eq])
       {
         BinaryOpNode *eq_node = equations[eq];
-        expr_t lhs = eq_node->get_arg1();
+        expr_t lhs = eq_node->arg1;
         result.clear();
         lhs->collectDynamicVariables(SymbolType::endogenous, result);
         if (result.size() == 1 && result.begin()->second == 0)
@@ -670,7 +670,7 @@ ModelTree::equationTypeDetermination(const map<tuple<int, int, int>, expr_t> &fi
       int eq = Index_Equ_IM[i];
       int var = Index_Var_IM[i];
       eq_node = equations[eq];
-      lhs = eq_node->get_arg1();
+      lhs = eq_node->arg1;
       Equation_Simulation_Type = E_SOLVE;
       auto derivative = first_order_endo_derivatives.find({ eq, var, 0 });
       pair<bool, expr_t> res;
@@ -1716,8 +1716,8 @@ ModelTree::writeModelEquations(ostream &output, ExprNodeOutputType output_type,
   for (int eq = 0; eq < (int) equations.size(); eq++)
     {
       BinaryOpNode *eq_node = equations[eq];
-      expr_t lhs = eq_node->get_arg1();
-      expr_t rhs = eq_node->get_arg2();
+      expr_t lhs = eq_node->arg1;
+      expr_t rhs = eq_node->arg2;
 
       // Test if the right hand side of the equation is empty.
       double vrhs = 1.0;
@@ -1774,8 +1774,8 @@ ModelTree::compileModelEquations(ostream &code_file, unsigned int &instruction_n
   for (int eq = 0; eq < (int) equations.size(); eq++)
     {
       BinaryOpNode *eq_node = equations[eq];
-      expr_t lhs = eq_node->get_arg1();
-      expr_t rhs = eq_node->get_arg2();
+      expr_t lhs = eq_node->arg1;
+      expr_t rhs = eq_node->arg2;
       FNUMEXPR_ fnumexpr(ModelEquation, eq);
       fnumexpr.write(code_file, instruction_number);
       // Test if the right hand side of the equation is empty.
@@ -1935,7 +1935,7 @@ void
 ModelTree::addEquation(expr_t eq, int lineno)
 {
   auto *beq = dynamic_cast<BinaryOpNode *>(eq);
-  assert(beq != nullptr && beq->get_op_code() == BinaryOpcode::equal);
+  assert(beq != nullptr && beq->op_code == BinaryOpcode::equal);
 
   equations.push_back(beq);
   equations_lineno.push_back(lineno);
@@ -1954,7 +1954,7 @@ void
 ModelTree::addAuxEquation(expr_t eq)
 {
   auto *beq = dynamic_cast<BinaryOpNode *>(eq);
-  assert(beq != nullptr && beq->get_op_code() == BinaryOpcode::equal);
+  assert(beq != nullptr && beq->op_code == BinaryOpcode::equal);
 
   aux_equations.push_back(beq);
 }
@@ -2162,8 +2162,8 @@ ModelTree::writeJsonModelEquations(ostream &output, bool residuals) const
         output << ", ";
 
       BinaryOpNode *eq_node = equations[eq];
-      expr_t lhs = eq_node->get_arg1();
-      expr_t rhs = eq_node->get_arg2();
+      expr_t lhs = eq_node->arg1;
+      expr_t rhs = eq_node->arg2;
 
       if (residuals)
         {
diff --git a/src/ParsingDriver.cc b/src/ParsingDriver.cc
index 09a45054..c5c4c56f 100644
--- a/src/ParsingDriver.cc
+++ b/src/ParsingDriver.cc
@@ -2944,7 +2944,7 @@ ParsingDriver::is_there_one_integer_argument() const
         }
     }
   else
-    if (unaryNode->get_op_code() != UnaryOpcode::uminus)
+    if (unaryNode->op_code != UnaryOpcode::uminus)
       return { false, 0 };
     else
       {
diff --git a/src/StaticModel.cc b/src/StaticModel.cc
index e9afe202..4081f33b 100644
--- a/src/StaticModel.cc
+++ b/src/StaticModel.cc
@@ -455,8 +455,8 @@ StaticModel::writeModelEquationsOrdered_M(const string &basename) const
           EquationType equ_type = getBlockEquationType(block, i);
           string sModel = symbol_table.getName(symbol_table.getID(SymbolType::endogenous, variable_ID));
           eq_node = (BinaryOpNode *) getBlockEquationExpr(block, i);
-          lhs = eq_node->get_arg1();
-          rhs = eq_node->get_arg2();
+          lhs = eq_node->arg1;
+          rhs = eq_node->arg2;
           tmp_output.str("");
           lhs->writeOutput(tmp_output, local_output_type, local_temporary_terms, {});
           switch (simulation_type)
@@ -483,8 +483,8 @@ StaticModel::writeModelEquationsOrdered_M(const string &basename) const
                       output << endl << "  ";
                       tmp_output.str("");
                       eq_node = (BinaryOpNode *) getBlockEquationRenormalizedExpr(block, i);
-                      lhs = eq_node->get_arg1();
-                      rhs = eq_node->get_arg2();
+                      lhs = eq_node->arg1;
+                      rhs = eq_node->arg2;
                       lhs->writeOutput(output, local_output_type, local_temporary_terms, {});
                       output << " = ";
                       rhs->writeOutput(output, local_output_type, local_temporary_terms, {});
@@ -830,16 +830,16 @@ StaticModel::writeModelEquationsCode_Block(const string &basename, map_idx_t map
               if (equ_type == E_EVALUATE)
                 {
                   eq_node = (BinaryOpNode *) getBlockEquationExpr(block, i);
-                  lhs = eq_node->get_arg1();
-                  rhs = eq_node->get_arg2();
+                  lhs = eq_node->arg1;
+                  rhs = eq_node->arg2;
                   rhs->compile(code_file, instruction_number, false, temporary_terms, map_idx, false, false);
                   lhs->compile(code_file, instruction_number, true, temporary_terms, map_idx, false, false);
                 }
               else if (equ_type == E_EVALUATE_S)
                 {
                   eq_node = (BinaryOpNode *) getBlockEquationRenormalizedExpr(block, i);
-                  lhs = eq_node->get_arg1();
-                  rhs = eq_node->get_arg2();
+                  lhs = eq_node->arg1;
+                  rhs = eq_node->arg2;
                   rhs->compile(code_file, instruction_number, false, temporary_terms, map_idx, false, false);
                   lhs->compile(code_file, instruction_number, true, temporary_terms, map_idx, false, false);
                 }
@@ -858,8 +858,8 @@ StaticModel::writeModelEquationsCode_Block(const string &basename, map_idx_t map
               FNUMEXPR_ fnumexpr(ModelEquation, getBlockEquationID(block, i));
               fnumexpr.write(code_file, instruction_number);
               eq_node = (BinaryOpNode *) getBlockEquationExpr(block, i);
-              lhs = eq_node->get_arg1();
-              rhs = eq_node->get_arg2();
+              lhs = eq_node->arg1;
+              rhs = eq_node->arg2;
               lhs->compile(code_file, instruction_number, false, temporary_terms, map_idx, false, false);
               rhs->compile(code_file, instruction_number, false, temporary_terms, map_idx, false, false);
 
@@ -1022,16 +1022,16 @@ StaticModel::writeModelEquationsCode_Block(const string &basename, map_idx_t map
               if (equ_type == E_EVALUATE)
                 {
                   eq_node = (BinaryOpNode *) getBlockEquationExpr(block, i);
-                  lhs = eq_node->get_arg1();
-                  rhs = eq_node->get_arg2();
+                  lhs = eq_node->arg1;
+                  rhs = eq_node->arg2;
                   rhs->compile(code_file, instruction_number, false, tt2, map_idx2[block], false, false);
                   lhs->compile(code_file, instruction_number, true, tt2, map_idx2[block], false, false);
                 }
               else if (equ_type == E_EVALUATE_S)
                 {
                   eq_node = (BinaryOpNode *) getBlockEquationRenormalizedExpr(block, i);
-                  lhs = eq_node->get_arg1();
-                  rhs = eq_node->get_arg2();
+                  lhs = eq_node->arg1;
+                  rhs = eq_node->arg2;
                   rhs->compile(code_file, instruction_number, false, tt2, map_idx2[block], false, false);
                   lhs->compile(code_file, instruction_number, true, tt2, map_idx2[block], false, false);
                 }
@@ -1050,8 +1050,8 @@ StaticModel::writeModelEquationsCode_Block(const string &basename, map_idx_t map
               FNUMEXPR_ fnumexpr(ModelEquation, getBlockEquationID(block, i));
               fnumexpr.write(code_file, instruction_number);
               eq_node = (BinaryOpNode *) getBlockEquationExpr(block, i);
-              lhs = eq_node->get_arg1();
-              rhs = eq_node->get_arg2();
+              lhs = eq_node->arg1;
+              rhs = eq_node->arg2;
               lhs->compile(code_file, instruction_number, false, tt2, map_idx2[block], false, false);
               rhs->compile(code_file, instruction_number, false, tt2, map_idx2[block], false, false);
 
@@ -2589,9 +2589,9 @@ StaticModel::writeJsonAuxVarRecursiveDefinitions(ostream &output) const
   for (auto aux_equation : aux_equations)
     {
       output << ", {\"lhs\": \"";
-      aux_equation->get_arg1()->writeJsonOutput(output, temporary_terms, tef_terms, false);
+      aux_equation->arg1->writeJsonOutput(output, temporary_terms, tef_terms, false);
       output << "\", \"rhs\": \"";
-      dynamic_cast<BinaryOpNode *>(aux_equation->substituteStaticAuxiliaryDefinition())->get_arg2()->writeJsonOutput(output, temporary_terms, tef_terms, false);
+      dynamic_cast<BinaryOpNode *>(aux_equation->substituteStaticAuxiliaryDefinition())->arg2->writeJsonOutput(output, temporary_terms, tef_terms, false);
       output << "\"}";
     }
 }
-- 
GitLab