From e73ebc7033ed34e46b9eb99b01fd9ded9845ef1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org> Date: Mon, 4 Jun 2018 12:50:53 +0200 Subject: [PATCH] Port to C++11 noexcept keyword Performed using modernize-use-noexcept from clang-tidy. https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-noexcept.html --- src/DataTree.cc | 14 ++-- src/DataTree.hh | 14 ++-- src/DynamicModel.cc | 10 +-- src/DynamicModel.hh | 10 +-- src/ExprNode.cc | 24 +++---- src/ExprNode.hh | 26 ++++---- src/ExternalFunctionsTable.hh | 12 ++-- src/ModelTree.cc | 4 +- src/ModelTree.hh | 4 +- src/SigmaeInitialization.cc | 4 +- src/SigmaeInitialization.hh | 4 +- src/StaticModel.cc | 8 +-- src/StaticModel.hh | 8 +-- src/SymbolTable.cc | 62 +++++++++--------- src/SymbolTable.hh | 120 +++++++++++++++++----------------- src/macro/MacroDriver.cc | 10 +-- src/macro/MacroDriver.hh | 10 +-- src/macro/MacroValue.cc | 80 +++++++++++------------ src/macro/MacroValue.hh | 110 +++++++++++++++---------------- 19 files changed, 267 insertions(+), 267 deletions(-) diff --git a/src/DataTree.cc b/src/DataTree.cc index 694f37da..a0e429f9 100644 --- a/src/DataTree.cc +++ b/src/DataTree.cc @@ -177,7 +177,7 @@ DataTree::AddTimes(expr_t iArg1, expr_t iArg2) } expr_t -DataTree::AddDivide(expr_t iArg1, expr_t iArg2) throw (DivisionByZeroException) +DataTree::AddDivide(expr_t iArg1, expr_t iArg2) noexcept(false) { if (iArg2 == One) return iArg1; @@ -530,7 +530,7 @@ DataTree::AddEqual(expr_t iArg1, expr_t iArg2) } void -DataTree::AddLocalVariable(int symb_id, expr_t value) throw (LocalVariableException) +DataTree::AddLocalVariable(int symb_id, expr_t value) noexcept(false) { assert(symbol_table.getType(symb_id) == eModelLocalVariable); @@ -598,25 +598,25 @@ DataTree::isSymbolUsed(int symb_id) const } int -DataTree::getDerivID(int symb_id, int lag) const throw (UnknownDerivIDException) +DataTree::getDerivID(int symb_id, int lag) const noexcept(false) { throw UnknownDerivIDException(); } SymbolType -DataTree::getTypeByDerivID(int deriv_id) const throw (UnknownDerivIDException) +DataTree::getTypeByDerivID(int deriv_id) const noexcept(false) { throw UnknownDerivIDException(); } int -DataTree::getLagByDerivID(int deriv_id) const throw (UnknownDerivIDException) +DataTree::getLagByDerivID(int deriv_id) const noexcept(false) { throw UnknownDerivIDException(); } int -DataTree::getSymbIDByDerivID(int deriv_id) const throw (UnknownDerivIDException) +DataTree::getSymbIDByDerivID(int deriv_id) const noexcept(false) { throw UnknownDerivIDException(); } @@ -627,7 +627,7 @@ DataTree::addAllParamDerivId(set<int> &deriv_id_set) } int -DataTree::getDynJacobianCol(int deriv_id) const throw (UnknownDerivIDException) +DataTree::getDynJacobianCol(int deriv_id) const noexcept(false) { throw UnknownDerivIDException(); } diff --git a/src/DataTree.hh b/src/DataTree.hh index ad2b3a3c..b723f31c 100644 --- a/src/DataTree.hh +++ b/src/DataTree.hh @@ -152,7 +152,7 @@ public: //! Adds "arg1*arg2" to model tree expr_t AddTimes(expr_t iArg1, expr_t iArg2); //! Adds "arg1/arg2" to model tree - expr_t AddDivide(expr_t iArg1, expr_t iArg2) throw (DivisionByZeroException); + expr_t AddDivide(expr_t iArg1, expr_t iArg2) noexcept(false); //! Adds "arg1<arg2" to model tree expr_t AddLess(expr_t iArg1, expr_t iArg2); //! Adds "arg1>arg2" to model tree @@ -234,7 +234,7 @@ public: //! Adds pac_expectation command to model tree expr_t AddPacExpectation(const string &model_name); //! Adds a model local variable with its value - void AddLocalVariable(int symb_id, expr_t value) throw (LocalVariableException); + void AddLocalVariable(int symb_id, expr_t value) noexcept(false); //! Adds an external function node expr_t AddExternalFunction(int symb_id, const vector<expr_t> &arguments); //! Adds an external function node for the first derivative of an external function @@ -282,12 +282,12 @@ public: }; //! Returns the derivation ID, or throws an exception if the derivation ID does not exist - virtual int getDerivID(int symb_id, int lag) const throw (UnknownDerivIDException); - virtual SymbolType getTypeByDerivID(int deriv_id) const throw (UnknownDerivIDException); - virtual int getLagByDerivID(int deriv_id) const throw (UnknownDerivIDException); - virtual int getSymbIDByDerivID(int deriv_id) const throw (UnknownDerivIDException); + virtual int getDerivID(int symb_id, int lag) const noexcept(false); + virtual SymbolType getTypeByDerivID(int deriv_id) const noexcept(false); + virtual int getLagByDerivID(int deriv_id) const noexcept(false); + virtual int getSymbIDByDerivID(int deriv_id) const noexcept(false); //! Returns the column of the dynamic Jacobian associated to a derivation ID - virtual int getDynJacobianCol(int deriv_id) const throw (UnknownDerivIDException); + virtual int getDynJacobianCol(int deriv_id) const noexcept(false); //! Adds to the set all the deriv IDs corresponding to parameters virtual void addAllParamDerivId(set<int> &deriv_id_set); diff --git a/src/DynamicModel.cc b/src/DynamicModel.cc index bc3d030a..ab5ed672 100644 --- a/src/DynamicModel.cc +++ b/src/DynamicModel.cc @@ -4776,13 +4776,13 @@ DynamicModel::computeDerivIDs() } SymbolType -DynamicModel::getTypeByDerivID(int deriv_id) const throw (UnknownDerivIDException) +DynamicModel::getTypeByDerivID(int deriv_id) const noexcept(false) { return symbol_table.getType(getSymbIDByDerivID(deriv_id)); } int -DynamicModel::getLagByDerivID(int deriv_id) const throw (UnknownDerivIDException) +DynamicModel::getLagByDerivID(int deriv_id) const noexcept(false) { if (deriv_id < 0 || deriv_id >= (int) inv_deriv_id_table.size()) throw UnknownDerivIDException(); @@ -4791,7 +4791,7 @@ DynamicModel::getLagByDerivID(int deriv_id) const throw (UnknownDerivIDException } int -DynamicModel::getSymbIDByDerivID(int deriv_id) const throw (UnknownDerivIDException) +DynamicModel::getSymbIDByDerivID(int deriv_id) const noexcept(false) { if (deriv_id < 0 || deriv_id >= (int) inv_deriv_id_table.size()) throw UnknownDerivIDException(); @@ -4800,7 +4800,7 @@ DynamicModel::getSymbIDByDerivID(int deriv_id) const throw (UnknownDerivIDExcept } int -DynamicModel::getDerivID(int symb_id, int lag) const throw (UnknownDerivIDException) +DynamicModel::getDerivID(int symb_id, int lag) const noexcept(false) { auto it = deriv_id_table.find(make_pair(symb_id, lag)); if (it == deriv_id_table.end()) @@ -4872,7 +4872,7 @@ DynamicModel::computeDynJacobianCols(bool jacobianExo) } int -DynamicModel::getDynJacobianCol(int deriv_id) const throw (UnknownDerivIDException) +DynamicModel::getDynJacobianCol(int deriv_id) const noexcept(false) { auto it = dyn_jacobian_cols_table.find(deriv_id); if (it == dyn_jacobian_cols_table.end()) diff --git a/src/DynamicModel.hh b/src/DynamicModel.hh index 0b9c2eca..3719cb98 100644 --- a/src/DynamicModel.hh +++ b/src/DynamicModel.hh @@ -147,11 +147,11 @@ private: void compileChainRuleDerivative(ofstream &code_file, unsigned int &instruction_number, int eq, int var, int lag, const map_idx_t &map_idx) const; //! Get the type corresponding to a derivation ID - virtual SymbolType getTypeByDerivID(int deriv_id) const throw (UnknownDerivIDException); + virtual SymbolType getTypeByDerivID(int deriv_id) const noexcept(false); //! Get the lag corresponding to a derivation ID - virtual int getLagByDerivID(int deriv_id) const throw (UnknownDerivIDException); + virtual int getLagByDerivID(int deriv_id) const noexcept(false); //! Get the symbol ID corresponding to a derivation ID - virtual int getSymbIDByDerivID(int deriv_id) const throw (UnknownDerivIDException); + virtual int getSymbIDByDerivID(int deriv_id) const noexcept(false); //! Compute the column indices of the dynamic Jacobian void computeDynJacobianCols(bool jacobianExo); //! Computes derivatives of the Jacobian w.r. to trend vars and tests that they are equal to zero @@ -379,8 +379,8 @@ public: //! Writes LaTeX file with the equations of the dynamic model (for the original model) void writeLatexOriginalFile(const string &basename, const bool write_equation_tags) const; - virtual int getDerivID(int symb_id, int lag) const throw (UnknownDerivIDException); - virtual int getDynJacobianCol(int deriv_id) const throw (UnknownDerivIDException); + virtual int getDerivID(int symb_id, int lag) const noexcept(false); + virtual int getDynJacobianCol(int deriv_id) const noexcept(false); virtual void addAllParamDerivId(set<int> &deriv_id_set); //! Returns true indicating that this is a dynamic model diff --git a/src/ExprNode.cc b/src/ExprNode.cc index 885256e6..05e4dff7 100644 --- a/src/ExprNode.cc +++ b/src/ExprNode.cc @@ -383,7 +383,7 @@ NumConstNode::containsExternalFunction() const } double -NumConstNode::eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException) +NumConstNode::eval(const eval_context_t &eval_context) const noexcept(false) { return (datatree.num_constants.getDouble(id)); } @@ -1049,7 +1049,7 @@ VariableNode::substituteStaticAuxiliaryVariable() const } double -VariableNode::eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException) +VariableNode::eval(const eval_context_t &eval_context) const noexcept(false) { auto it = eval_context.find(symb_id); if (it == eval_context.end()) @@ -2570,7 +2570,7 @@ UnaryOpNode::compileExternalFunctionOutput(ostream &CompileCode, unsigned int &i } double -UnaryOpNode::eval_opcode(UnaryOpcode op_code, double v) throw (EvalException, EvalExternalFunctionException) +UnaryOpNode::eval_opcode(UnaryOpcode op_code, double v) noexcept(false) { switch (op_code) { @@ -2631,7 +2631,7 @@ UnaryOpNode::eval_opcode(UnaryOpcode op_code, double v) throw (EvalException, Ev } double -UnaryOpNode::eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException) +UnaryOpNode::eval(const eval_context_t &eval_context) const noexcept(false) { double v = arg->eval(eval_context); @@ -3852,7 +3852,7 @@ BinaryOpNode::computeTemporaryTerms(map<expr_t, int> &reference_count, } double -BinaryOpNode::eval_opcode(double v1, BinaryOpcode op_code, double v2, int derivOrder) throw (EvalException, EvalExternalFunctionException) +BinaryOpNode::eval_opcode(double v1, BinaryOpcode op_code, double v2, int derivOrder) noexcept(false) { switch (op_code) { @@ -3908,7 +3908,7 @@ BinaryOpNode::eval_opcode(double v1, BinaryOpcode op_code, double v2, int derivO } double -BinaryOpNode::eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException) +BinaryOpNode::eval(const eval_context_t &eval_context) const noexcept(false) { double v1 = arg1->eval(eval_context); double v2 = arg2->eval(eval_context); @@ -5354,7 +5354,7 @@ TrinaryOpNode::computeTemporaryTerms(map<expr_t, int> &reference_count, } double -TrinaryOpNode::eval_opcode(double v1, TrinaryOpcode op_code, double v2, double v3) throw (EvalException, EvalExternalFunctionException) +TrinaryOpNode::eval_opcode(double v1, TrinaryOpcode op_code, double v2, double v3) noexcept(false) { switch (op_code) { @@ -5368,7 +5368,7 @@ TrinaryOpNode::eval_opcode(double v1, TrinaryOpcode op_code, double v2, double v } double -TrinaryOpNode::eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException) +TrinaryOpNode::eval(const eval_context_t &eval_context) const noexcept(false) { double v1 = arg1->eval(eval_context); double v2 = arg2->eval(eval_context); @@ -6055,7 +6055,7 @@ AbstractExternalFunctionNode::collectTemporary_terms(const temporary_terms_t &te } double -AbstractExternalFunctionNode::eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException) +AbstractExternalFunctionNode::eval(const eval_context_t &eval_context) const noexcept(false) { throw EvalExternalFunctionException(); } @@ -6290,7 +6290,7 @@ AbstractExternalFunctionNode::alreadyWrittenAsTefTerm(int the_symb_id, const der } int -AbstractExternalFunctionNode::getIndxInTefTerms(int the_symb_id, const deriv_node_temp_terms_t &tef_terms) const throw (UnknownFunctionNameAndArgs) +AbstractExternalFunctionNode::getIndxInTefTerms(int the_symb_id, const deriv_node_temp_terms_t &tef_terms) const noexcept(false) { auto it = tef_terms.find(make_pair(the_symb_id, arguments)); if (it != tef_terms.end()) @@ -7719,7 +7719,7 @@ VarExpectationNode::containsExternalFunction() const } double -VarExpectationNode::eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException) +VarExpectationNode::eval(const eval_context_t &eval_context) const noexcept(false) { auto it = eval_context.find(symb_id); if (it == eval_context.end()) @@ -8170,7 +8170,7 @@ PacExpectationNode::containsExternalFunction() const } double -PacExpectationNode::eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException) +PacExpectationNode::eval(const eval_context_t &eval_context) const noexcept(false) { throw EvalException(); } diff --git a/src/ExprNode.hh b/src/ExprNode.hh index 548ccdfe..716e2213 100644 --- a/src/ExprNode.hh +++ b/src/ExprNode.hh @@ -331,7 +331,7 @@ class ExprNode { }; - virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException) = 0; + virtual double eval(const eval_context_t &eval_context) const noexcept(false) = 0; virtual 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 = 0; 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; //! Creates a static version of this node @@ -579,7 +579,7 @@ public: virtual void collectVARLHSVariable(set<expr_t> &result) const; virtual void collectDynamicVariables(SymbolType type_arg, set<pair<int, int> > &result) const; virtual void collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const; - virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException); + virtual double eval(const eval_context_t &eval_context) const noexcept(false); virtual 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; virtual expr_t toStatic(DataTree &static_datatree) const; virtual void computeXrefs(EquationInfo &ei) const; @@ -654,7 +654,7 @@ public: vector< vector<temporary_terms_t> > &v_temporary_terms, int equation) const; virtual void collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const; - virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException); + virtual double eval(const eval_context_t &eval_context) const noexcept(false); virtual 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; virtual expr_t toStatic(DataTree &static_datatree) const; virtual void computeXrefs(EquationInfo &ei) const; @@ -767,8 +767,8 @@ public: virtual void collectVARLHSVariable(set<expr_t> &result) const; virtual void collectDynamicVariables(SymbolType type_arg, set<pair<int, int> > &result) const; virtual void collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const; - static double eval_opcode(UnaryOpcode op_code, double v) throw (EvalException, EvalExternalFunctionException); - virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException); + static double eval_opcode(UnaryOpcode op_code, double v) noexcept(false); + virtual double eval(const eval_context_t &eval_context) const noexcept(false); virtual 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; //! Returns operand expr_t @@ -882,8 +882,8 @@ public: virtual void collectVARLHSVariable(set<expr_t> &result) const; virtual void collectDynamicVariables(SymbolType type_arg, set<pair<int, int> > &result) const; virtual void collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const; - static double eval_opcode(double v1, BinaryOpcode op_code, double v2, int derivOrder) throw (EvalException, EvalExternalFunctionException); - virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException); + static double eval_opcode(double v1, BinaryOpcode op_code, double v2, int derivOrder) noexcept(false); + virtual double eval(const eval_context_t &eval_context) const noexcept(false); virtual 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; virtual expr_t Compute_RHS(expr_t arg1, expr_t arg2, int op, int op_type) const; //! Returns first operand @@ -1016,8 +1016,8 @@ public: virtual void collectVARLHSVariable(set<expr_t> &result) const; virtual void collectDynamicVariables(SymbolType type_arg, set<pair<int, int> > &result) const; virtual void collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const; - static double eval_opcode(double v1, TrinaryOpcode op_code, double v2, double v3) throw (EvalException, EvalExternalFunctionException); - virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException); + static double eval_opcode(double v1, TrinaryOpcode op_code, double v2, double v3) noexcept(false); + virtual double eval(const eval_context_t &eval_context) const noexcept(false); virtual 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; virtual expr_t toStatic(DataTree &static_datatree) const; virtual void computeXrefs(EquationInfo &ei) const; @@ -1085,7 +1085,7 @@ protected: //! 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 - int getIndxInTefTerms(int the_symb_id, const deriv_node_temp_terms_t &tef_terms) const throw (UnknownFunctionNameAndArgs); + int getIndxInTefTerms(int the_symb_id, const deriv_node_temp_terms_t &tef_terms) const noexcept(false); //! Helper function to write output arguments of any given external function void writeExternalFunctionArguments(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; void writeJsonExternalFunctionArguments(ostream &output, const temporary_terms_t &temporary_terms, const deriv_node_temp_terms_t &tef_terms, const bool isdynamic) const; @@ -1124,7 +1124,7 @@ public: virtual void collectVARLHSVariable(set<expr_t> &result) const; virtual void collectDynamicVariables(SymbolType type_arg, set<pair<int, int> > &result) const; virtual void collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const; - virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException); + virtual double eval(const eval_context_t &eval_context) const noexcept(false); unsigned int compileExternalFunctionArguments(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, @@ -1341,7 +1341,7 @@ public: virtual expr_t computeDerivative(int deriv_id); virtual expr_t getChainRuleDerivative(int deriv_id, const map<int, expr_t> &recursive_variables); virtual bool containsExternalFunction() const; - virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException); + virtual double eval(const eval_context_t &eval_context) const noexcept(false); virtual void computeXrefs(EquationInfo &ei) const; virtual expr_t substituteEndoLeadGreaterThanTwo(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs, bool deterministic_model) const; virtual expr_t substituteEndoLagGreaterThanTwo(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const; @@ -1426,7 +1426,7 @@ public: virtual expr_t computeDerivative(int deriv_id); virtual expr_t getChainRuleDerivative(int deriv_id, const map<int, expr_t> &recursive_variables); virtual bool containsExternalFunction() const; - virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException); + virtual double eval(const eval_context_t &eval_context) const noexcept(false); virtual void computeXrefs(EquationInfo &ei) const; virtual expr_t substituteEndoLeadGreaterThanTwo(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs, bool deterministic_model) const; virtual expr_t substituteEndoLagGreaterThanTwo(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const; diff --git a/src/ExternalFunctionsTable.hh b/src/ExternalFunctionsTable.hh index 4adaaf01..cc074589 100644 --- a/src/ExternalFunctionsTable.hh +++ b/src/ExternalFunctionsTable.hh @@ -69,11 +69,11 @@ public: //! See if the function exists in the External Functions Table inline bool exists(int symb_id) const; //! Get the number of arguments for a given external function - inline int getNargs(int symb_id) const throw (UnknownExternalFunctionSymbolIDException); + inline int getNargs(int symb_id) const noexcept(false); //! Get the symbol_id of the first derivative function - inline int getFirstDerivSymbID(int symb_id) const throw (UnknownExternalFunctionSymbolIDException); + inline int getFirstDerivSymbID(int symb_id) const noexcept(false); //! Get the symbol_id of the second derivative function - inline int getSecondDerivSymbID(int symb_id) const throw (UnknownExternalFunctionSymbolIDException); + inline int getSecondDerivSymbID(int symb_id) const noexcept(false); //! Returns the total number of unique external functions declared or used in the .mod file inline int get_total_number_of_unique_model_block_external_functions() const; }; @@ -86,7 +86,7 @@ ExternalFunctionsTable::exists(int symb_id) const } inline int -ExternalFunctionsTable::getNargs(int symb_id) const throw (UnknownExternalFunctionSymbolIDException) +ExternalFunctionsTable::getNargs(int symb_id) const noexcept(false) { if (exists(symb_id)) return externalFunctionTable.find(symb_id)->second.nargs; @@ -95,7 +95,7 @@ ExternalFunctionsTable::getNargs(int symb_id) const throw (UnknownExternalFuncti } inline int -ExternalFunctionsTable::getFirstDerivSymbID(int symb_id) const throw (UnknownExternalFunctionSymbolIDException) +ExternalFunctionsTable::getFirstDerivSymbID(int symb_id) const noexcept(false) { if (exists(symb_id)) return externalFunctionTable.find(symb_id)->second.firstDerivSymbID; @@ -104,7 +104,7 @@ ExternalFunctionsTable::getFirstDerivSymbID(int symb_id) const throw (UnknownExt } inline int -ExternalFunctionsTable::getSecondDerivSymbID(int symb_id) const throw (UnknownExternalFunctionSymbolIDException) +ExternalFunctionsTable::getSecondDerivSymbID(int symb_id) const noexcept(false) { if (exists(symb_id)) return externalFunctionTable.find(symb_id)->second.secondDerivSymbID; diff --git a/src/ModelTree.cc b/src/ModelTree.cc index 18468d0c..a00e611b 100644 --- a/src/ModelTree.cc +++ b/src/ModelTree.cc @@ -1759,7 +1759,7 @@ ModelTree::addAuxEquation(expr_t eq) } void -ModelTree::addTrendVariables(vector<int> trend_vars, expr_t growth_factor) throw (TrendException) +ModelTree::addTrendVariables(vector<int> trend_vars, expr_t growth_factor) noexcept(false) { while (!trend_vars.empty()) if (trend_symbols_map.find(trend_vars.back()) != trend_symbols_map.end()) @@ -1772,7 +1772,7 @@ ModelTree::addTrendVariables(vector<int> trend_vars, expr_t growth_factor) throw } void -ModelTree::addNonstationaryVariables(vector<int> nonstationary_vars, bool log_deflator, expr_t deflator) throw (TrendException) +ModelTree::addNonstationaryVariables(vector<int> nonstationary_vars, bool log_deflator, expr_t deflator) noexcept(false) { while (!nonstationary_vars.empty()) if (nonstationary_symbols_map.find(nonstationary_vars.back()) != nonstationary_symbols_map.end()) diff --git a/src/ModelTree.hh b/src/ModelTree.hh index 7e914aaa..8c5683a1 100644 --- a/src/ModelTree.hh +++ b/src/ModelTree.hh @@ -337,9 +337,9 @@ public: //! Returns the number of equations in the model int equation_number() const; //! Adds a trend variable with its growth factor - void addTrendVariables(vector<int> trend_vars, expr_t growth_factor) throw (TrendException); + void addTrendVariables(vector<int> trend_vars, expr_t growth_factor) noexcept(false); //! Adds a nonstationary variables with their (common) deflator - void addNonstationaryVariables(vector<int> nonstationary_vars, bool log_deflator, expr_t deflator) throw (TrendException); + void addNonstationaryVariables(vector<int> nonstationary_vars, bool log_deflator, expr_t deflator) noexcept(false); //! Is a given variable non-stationary? bool isNonstationary(int symb_id) const; void set_cutoff_to_zero(); diff --git a/src/SigmaeInitialization.cc b/src/SigmaeInitialization.cc index b1ab3aae..8e00048f 100644 --- a/src/SigmaeInitialization.cc +++ b/src/SigmaeInitialization.cc @@ -21,14 +21,14 @@ #include "SigmaeInitialization.hh" -SigmaeStatement::SigmaeStatement(matrix_t matrix_arg) throw (MatrixFormException) : +SigmaeStatement::SigmaeStatement(matrix_t matrix_arg) noexcept(false) : matrix(move(matrix_arg)), matrix_form(determineMatrixForm(matrix)) { } SigmaeStatement::matrix_form_t -SigmaeStatement::determineMatrixForm(const matrix_t &matrix) throw (MatrixFormException) +SigmaeStatement::determineMatrixForm(const matrix_t &matrix) noexcept(false) { size_t nbe; int inc; diff --git a/src/SigmaeInitialization.hh b/src/SigmaeInitialization.hh index 981026ad..8b135dad 100644 --- a/src/SigmaeInitialization.hh +++ b/src/SigmaeInitialization.hh @@ -53,10 +53,10 @@ private: //! Returns the type (upper or lower triangular) of a given matrix /*! Throws an exception if it is neither upper triangular nor lower triangular */ - static matrix_form_t determineMatrixForm(const matrix_t &matrix) throw (MatrixFormException); + static matrix_form_t determineMatrixForm(const matrix_t &matrix) noexcept(false); public: - SigmaeStatement(matrix_t matrix_arg) throw (MatrixFormException); + SigmaeStatement(matrix_t matrix_arg) noexcept(false); virtual void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const; }; diff --git a/src/StaticModel.cc b/src/StaticModel.cc index 4d8fd4d2..1484c68c 100644 --- a/src/StaticModel.cc +++ b/src/StaticModel.cc @@ -2152,7 +2152,7 @@ StaticModel::writeOutput(ostream &output, bool block) const } SymbolType -StaticModel::getTypeByDerivID(int deriv_id) const throw (UnknownDerivIDException) +StaticModel::getTypeByDerivID(int deriv_id) const noexcept(false) { if (deriv_id < symbol_table.endo_nbr()) return eEndogenous; @@ -2163,13 +2163,13 @@ StaticModel::getTypeByDerivID(int deriv_id) const throw (UnknownDerivIDException } int -StaticModel::getLagByDerivID(int deriv_id) const throw (UnknownDerivIDException) +StaticModel::getLagByDerivID(int deriv_id) const noexcept(false) { return 0; } int -StaticModel::getSymbIDByDerivID(int deriv_id) const throw (UnknownDerivIDException) +StaticModel::getSymbIDByDerivID(int deriv_id) const noexcept(false) { if (deriv_id < symbol_table.endo_nbr()) return symbol_table.getID(eEndogenous, deriv_id); @@ -2180,7 +2180,7 @@ StaticModel::getSymbIDByDerivID(int deriv_id) const throw (UnknownDerivIDExcepti } int -StaticModel::getDerivID(int symb_id, int lag) const throw (UnknownDerivIDException) +StaticModel::getDerivID(int symb_id, int lag) const noexcept(false) { if (symbol_table.getType(symb_id) == eEndogenous) return symbol_table.getTypeSpecificID(symb_id); diff --git a/src/StaticModel.hh b/src/StaticModel.hh index 61ea06cd..fd1230de 100644 --- a/src/StaticModel.hh +++ b/src/StaticModel.hh @@ -87,11 +87,11 @@ private: void compileChainRuleDerivative(ofstream &code_file, unsigned int &instruction_number, int eq, int var, int lag, map_idx_t &map_idx, temporary_terms_t temporary_terms) const; //! Get the type corresponding to a derivation ID - virtual SymbolType getTypeByDerivID(int deriv_id) const throw (UnknownDerivIDException); + virtual SymbolType getTypeByDerivID(int deriv_id) const noexcept(false); //! Get the lag corresponding to a derivation ID - virtual int getLagByDerivID(int deriv_id) const throw (UnknownDerivIDException); + virtual int getLagByDerivID(int deriv_id) const noexcept(false); //! Get the symbol ID corresponding to a derivation ID - virtual int getSymbIDByDerivID(int deriv_id) const throw (UnknownDerivIDException); + virtual int getSymbIDByDerivID(int deriv_id) const noexcept(false); //! Compute the column indices of the static Jacobian void computeStatJacobianCols(); //! return a map on the block jacobian @@ -208,7 +208,7 @@ public: //! See #1264 bool exoPresentInEqs() const; - virtual int getDerivID(int symb_id, int lag) const throw (UnknownDerivIDException); + virtual int getDerivID(int symb_id, int lag) const noexcept(false); virtual void addAllParamDerivId(set<int> &deriv_id_set); //! Return the number of blocks diff --git a/src/SymbolTable.cc b/src/SymbolTable.cc index baf61241..f927657d 100644 --- a/src/SymbolTable.cc +++ b/src/SymbolTable.cc @@ -42,7 +42,7 @@ SymbolTable::SymbolTable() = default; int -SymbolTable::addSymbol(const string &name, SymbolType type, const string &tex_name, const vector<pair<string *, string *> *> *partition_value) throw (AlreadyDeclaredException, FrozenException) +SymbolTable::addSymbol(const string &name, SymbolType type, const string &tex_name, const vector<pair<string *, string *> *> *partition_value) noexcept(false) { if (frozen) throw FrozenException(); @@ -94,13 +94,13 @@ SymbolTable::addSymbol(const string &name, SymbolType type, const string &tex_na } int -SymbolTable::addSymbol(const string &name, SymbolType type) throw (AlreadyDeclaredException, FrozenException) +SymbolTable::addSymbol(const string &name, SymbolType type) noexcept(false) { return addSymbol(name, type, "", NULL); } void -SymbolTable::freeze() throw (FrozenException) +SymbolTable::freeze() noexcept(false) { if (frozen) throw FrozenException(); @@ -148,7 +148,7 @@ SymbolTable::unfreeze() } void -SymbolTable::changeType(int id, SymbolType newtype) throw (UnknownSymbolIDException, FrozenException) +SymbolTable::changeType(int id, SymbolType newtype) noexcept(false) { if (frozen) throw FrozenException(); @@ -159,7 +159,7 @@ SymbolTable::changeType(int id, SymbolType newtype) throw (UnknownSymbolIDExcept } int -SymbolTable::getID(SymbolType type, int tsid) const throw (UnknownTypeSpecificIDException, NotYetFrozenException) +SymbolTable::getID(SymbolType type, int tsid) const noexcept(false) { if (!frozen) throw NotYetFrozenException(); @@ -192,7 +192,7 @@ SymbolTable::getID(SymbolType type, int tsid) const throw (UnknownTypeSpecificID } map<string, map<int, string> > -SymbolTable::getPartitionsForType(enum SymbolType st) const throw (UnknownSymbolIDException) +SymbolTable::getPartitionsForType(enum SymbolType st) const noexcept(false) { map<string, map<int, string> > partitions; for (const auto & it : partition_value_map) @@ -208,7 +208,7 @@ SymbolTable::getPartitionsForType(enum SymbolType st) const throw (UnknownSymbol } void -SymbolTable::writeOutput(ostream &output) const throw (NotYetFrozenException) +SymbolTable::writeOutput(ostream &output) const noexcept(false) { if (!frozen) throw NotYetFrozenException(); @@ -418,7 +418,7 @@ SymbolTable::writeOutput(ostream &output) const throw (NotYetFrozenException) } void -SymbolTable::writeCOutput(ostream &output) const throw (NotYetFrozenException) +SymbolTable::writeCOutput(ostream &output) const noexcept(false) { if (!frozen) throw NotYetFrozenException(); @@ -537,7 +537,7 @@ SymbolTable::writeCOutput(ostream &output) const throw (NotYetFrozenException) } void -SymbolTable::writeCCOutput(ostream &output) const throw (NotYetFrozenException) +SymbolTable::writeCCOutput(ostream &output) const noexcept(false) { if (!frozen) throw NotYetFrozenException(); @@ -604,7 +604,7 @@ SymbolTable::writeCCOutput(ostream &output) const throw (NotYetFrozenException) } int -SymbolTable::addLeadAuxiliaryVarInternal(bool endo, int index, expr_t expr_arg) throw (FrozenException) +SymbolTable::addLeadAuxiliaryVarInternal(bool endo, int index, expr_t expr_arg) noexcept(false) { ostringstream varname; if (endo) @@ -629,7 +629,7 @@ SymbolTable::addLeadAuxiliaryVarInternal(bool endo, int index, expr_t expr_arg) } int -SymbolTable::addLagAuxiliaryVarInternal(bool endo, int orig_symb_id, int orig_lead_lag, expr_t expr_arg) throw (FrozenException) +SymbolTable::addLagAuxiliaryVarInternal(bool endo, int orig_symb_id, int orig_lead_lag, expr_t expr_arg) noexcept(false) { ostringstream varname; if (endo) @@ -655,31 +655,31 @@ SymbolTable::addLagAuxiliaryVarInternal(bool endo, int orig_symb_id, int orig_le } int -SymbolTable::addEndoLeadAuxiliaryVar(int index, expr_t expr_arg) throw (FrozenException) +SymbolTable::addEndoLeadAuxiliaryVar(int index, expr_t expr_arg) noexcept(false) { return addLeadAuxiliaryVarInternal(true, index, expr_arg); } int -SymbolTable::addEndoLagAuxiliaryVar(int orig_symb_id, int orig_lead_lag, expr_t expr_arg) throw (FrozenException) +SymbolTable::addEndoLagAuxiliaryVar(int orig_symb_id, int orig_lead_lag, expr_t expr_arg) noexcept(false) { return addLagAuxiliaryVarInternal(true, orig_symb_id, orig_lead_lag, expr_arg); } int -SymbolTable::addExoLeadAuxiliaryVar(int index, expr_t expr_arg) throw (FrozenException) +SymbolTable::addExoLeadAuxiliaryVar(int index, expr_t expr_arg) noexcept(false) { return addLeadAuxiliaryVarInternal(false, index, expr_arg); } int -SymbolTable::addExoLagAuxiliaryVar(int orig_symb_id, int orig_lead_lag, expr_t expr_arg) throw (FrozenException) +SymbolTable::addExoLagAuxiliaryVar(int orig_symb_id, int orig_lead_lag, expr_t expr_arg) noexcept(false) { return addLagAuxiliaryVarInternal(false, orig_symb_id, orig_lead_lag, expr_arg); } int -SymbolTable::addExpectationAuxiliaryVar(int information_set, int index, expr_t expr_arg) throw (FrozenException) +SymbolTable::addExpectationAuxiliaryVar(int information_set, int index, expr_t expr_arg) noexcept(false) { ostringstream varname; int symb_id; @@ -703,7 +703,7 @@ SymbolTable::addExpectationAuxiliaryVar(int information_set, int index, expr_t e } int -SymbolTable::addDiffLagAuxiliaryVar(int index, expr_t expr_arg, int orig_symb_id, int orig_lag) throw (FrozenException) +SymbolTable::addDiffLagAuxiliaryVar(int index, expr_t expr_arg, int orig_symb_id, int orig_lag) noexcept(false) { ostringstream varname; int symb_id; @@ -726,7 +726,7 @@ SymbolTable::addDiffLagAuxiliaryVar(int index, expr_t expr_arg, int orig_symb_id } int -SymbolTable::addDiffAuxiliaryVar(int index, expr_t expr_arg, int orig_symb_id, int orig_lag) throw (FrozenException) +SymbolTable::addDiffAuxiliaryVar(int index, expr_t expr_arg, int orig_symb_id, int orig_lag) noexcept(false) { ostringstream varname; int symb_id; @@ -749,13 +749,13 @@ SymbolTable::addDiffAuxiliaryVar(int index, expr_t expr_arg, int orig_symb_id, i } int -SymbolTable::addDiffAuxiliaryVar(int index, expr_t expr_arg) throw (FrozenException) +SymbolTable::addDiffAuxiliaryVar(int index, expr_t expr_arg) noexcept(false) { return addDiffAuxiliaryVar(index, expr_arg, -1, 0); } int -SymbolTable::addUnaryOpAuxiliaryVar(int index, expr_t expr_arg, int orig_symb_id, int orig_lag) throw (FrozenException) +SymbolTable::addUnaryOpAuxiliaryVar(int index, expr_t expr_arg, int orig_symb_id, int orig_lag) noexcept(false) { ostringstream varname; int symb_id; @@ -777,7 +777,7 @@ SymbolTable::addUnaryOpAuxiliaryVar(int index, expr_t expr_arg, int orig_symb_id } int -SymbolTable::addVarModelEndoLagAuxiliaryVar(int orig_symb_id, int orig_lead_lag, expr_t expr_arg) throw (AlreadyDeclaredException, FrozenException) +SymbolTable::addVarModelEndoLagAuxiliaryVar(int orig_symb_id, int orig_lead_lag, expr_t expr_arg) noexcept(false) { int symb_id; ostringstream varname; @@ -799,7 +799,7 @@ SymbolTable::addVarModelEndoLagAuxiliaryVar(int orig_symb_id, int orig_lead_lag, } int -SymbolTable::addMultiplierAuxiliaryVar(int index) throw (FrozenException) +SymbolTable::addMultiplierAuxiliaryVar(int index) noexcept(false) { ostringstream varname; int symb_id; @@ -820,7 +820,7 @@ SymbolTable::addMultiplierAuxiliaryVar(int index) throw (FrozenException) } int -SymbolTable::addDiffForwardAuxiliaryVar(int orig_symb_id, expr_t expr_arg) throw (FrozenException) +SymbolTable::addDiffForwardAuxiliaryVar(int orig_symb_id, expr_t expr_arg) noexcept(false) { ostringstream varname; int symb_id; @@ -841,7 +841,7 @@ SymbolTable::addDiffForwardAuxiliaryVar(int orig_symb_id, expr_t expr_arg) throw } int -SymbolTable::searchAuxiliaryVars(int orig_symb_id, int orig_lead_lag) const throw (SearchFailedException) +SymbolTable::searchAuxiliaryVars(int orig_symb_id, int orig_lead_lag) const noexcept(false) { for (const auto & aux_var : aux_vars) if ((aux_var.get_type() == avEndoLag || aux_var.get_type() == avExoLag) @@ -851,7 +851,7 @@ SymbolTable::searchAuxiliaryVars(int orig_symb_id, int orig_lead_lag) const thro } int -SymbolTable::getOrigSymbIdForAuxVar(int aux_var_symb_id) const throw (UnknownSymbolIDException) +SymbolTable::getOrigSymbIdForAuxVar(int aux_var_symb_id) const noexcept(false) { for (const auto & aux_var : aux_vars) if ((aux_var.get_type() == avEndoLag || aux_var.get_type() == avExoLag || aux_var.get_type() == avDiff) @@ -861,7 +861,7 @@ SymbolTable::getOrigSymbIdForAuxVar(int aux_var_symb_id) const throw (UnknownSym } expr_t -SymbolTable::getAuxiliaryVarsExprNode(int symb_id) const throw (SearchFailedException) +SymbolTable::getAuxiliaryVarsExprNode(int symb_id) const noexcept(false) // throw exception if it is a Lagrange multiplier { for (const auto & aux_var : aux_vars) @@ -877,7 +877,7 @@ SymbolTable::getAuxiliaryVarsExprNode(int symb_id) const throw (SearchFailedExce } void -SymbolTable::markPredetermined(int symb_id) throw (UnknownSymbolIDException, FrozenException) +SymbolTable::markPredetermined(int symb_id) noexcept(false) { validateSymbID(symb_id); @@ -890,7 +890,7 @@ SymbolTable::markPredetermined(int symb_id) throw (UnknownSymbolIDException, Fro } bool -SymbolTable::isPredetermined(int symb_id) const throw (UnknownSymbolIDException) +SymbolTable::isPredetermined(int symb_id) const noexcept(false) { validateSymbID(symb_id); return (predetermined_variables.find(symb_id) != predetermined_variables.end()); @@ -903,7 +903,7 @@ SymbolTable::predeterminedNbr() const } void -SymbolTable::addObservedVariable(int symb_id) throw (UnknownSymbolIDException) +SymbolTable::addObservedVariable(int symb_id) noexcept(false) { validateSymbID(symb_id); assert(getType(symb_id) == eEndogenous); @@ -931,7 +931,7 @@ SymbolTable::getObservedVariableIndex(int symb_id) const } void -SymbolTable::addObservedExogenousVariable(int symb_id) throw (UnknownSymbolIDException) +SymbolTable::addObservedExogenousVariable(int symb_id) noexcept(false) { validateSymbID(symb_id); assert(getType(symb_id) != eEndogenous); @@ -1028,7 +1028,7 @@ SymbolTable::getOrigEndogenous() const } void -SymbolTable::writeJuliaOutput(ostream &output) const throw (NotYetFrozenException) +SymbolTable::writeJuliaOutput(ostream &output) const noexcept(false) { if (!frozen) throw NotYetFrozenException(); diff --git a/src/SymbolTable.hh b/src/SymbolTable.hh index 05e838ec..f2bee241 100644 --- a/src/SymbolTable.hh +++ b/src/SymbolTable.hh @@ -222,80 +222,80 @@ public: private: //! Factorized code for adding aux lag variables - int addLagAuxiliaryVarInternal(bool endo, int orig_symb_id, int orig_lead_lag, expr_t arg) throw (FrozenException); + int addLagAuxiliaryVarInternal(bool endo, int orig_symb_id, int orig_lead_lag, expr_t arg) noexcept(false); //! Factorized code for adding aux lead variables - int addLeadAuxiliaryVarInternal(bool endo, int index, expr_t arg) throw (FrozenException); + int addLeadAuxiliaryVarInternal(bool endo, int index, expr_t arg) noexcept(false); //! Factorized code for Json writing void writeJsonVarVector(ostream &output, const vector<int> &varvec) const; //! Factorized code for asserting that 0 <= symb_id <= symbol_table.size() - inline void validateSymbID(int symb_id) const throw (UnknownSymbolIDException); + inline void validateSymbID(int symb_id) const noexcept(false); public: //! Add a symbol /*! Returns the symbol ID */ - int addSymbol(const string &name, SymbolType type, const string &tex_name, const vector<pair<string *, string *> *> *partition_value) throw (AlreadyDeclaredException, FrozenException); + int addSymbol(const string &name, SymbolType type, const string &tex_name, const vector<pair<string *, string *> *> *partition_value) noexcept(false); //! Add a symbol without its TeX name (will be equal to its name) /*! Returns the symbol ID */ - int addSymbol(const string &name, SymbolType type) throw (AlreadyDeclaredException, FrozenException); + int addSymbol(const string &name, SymbolType type) noexcept(false); //! Adds an auxiliary variable for endogenous with lead >= 2 /*! \param[in] index Used to construct the variable name \return the symbol ID of the new symbol */ - int addEndoLeadAuxiliaryVar(int index, expr_t arg) throw (FrozenException); + int addEndoLeadAuxiliaryVar(int index, expr_t arg) noexcept(false); //! Adds an auxiliary variable for endogenous with lag >= 2 /*! \param[in] orig_symb_id symbol ID of the endogenous declared by the user that this new variable will represent \param[in] orig_lead_lag lag value such that this new variable will be equivalent to orig_symb_id(orig_lead_lag) \return the symbol ID of the new symbol */ - int addEndoLagAuxiliaryVar(int orig_symb_id, int orig_lead_lag, expr_t arg) throw (FrozenException); + int addEndoLagAuxiliaryVar(int orig_symb_id, int orig_lead_lag, expr_t arg) noexcept(false); //! Adds an auxiliary variable for endogenous with lead >= 1 /*! \param[in] index Used to construct the variable name \return the symbol ID of the new symbol */ - int addExoLeadAuxiliaryVar(int index, expr_t arg) throw (FrozenException); + int addExoLeadAuxiliaryVar(int index, expr_t arg) noexcept(false); //! Adds an auxiliary variable for exogenous with lag >= 1 /*! \param[in] orig_symb_id symbol ID of the exogenous declared by the user that this new variable will represent \param[in] orig_lead_lag lag value such that this new variable will be equivalent to orig_symb_id(orig_lead_lag) \return the symbol ID of the new symbol */ - int addExoLagAuxiliaryVar(int orig_symb_id, int orig_lead_lag, expr_t arg) throw (FrozenException); + int addExoLagAuxiliaryVar(int orig_symb_id, int orig_lead_lag, expr_t arg) noexcept(false); //! Adds an auxiliary variable for the expectation operator /*! \param[in] information_set information set (possibly negative) of the expectation operator \param[in] index Used to construct the variable name \return the symbol ID of the new symbol */ - int addExpectationAuxiliaryVar(int information_set, int index, expr_t arg) throw (FrozenException); + int addExpectationAuxiliaryVar(int information_set, int index, expr_t arg) noexcept(false); //! Adds an auxiliary variable for the multiplier for the FOCs of the Ramsey Problem /*! \param[in] index Used to construct the variable name \return the symbol ID of the new symbol */ - int addMultiplierAuxiliaryVar(int index) throw (FrozenException); + int addMultiplierAuxiliaryVar(int index) noexcept(false); //! Adds an auxiliary variable for the (time) differentiate of a forward var /*! \param[in] orig_symb_id The symb_id of the forward variable \return the symbol ID of the new symbol */ - int addDiffForwardAuxiliaryVar(int orig_symb_id, expr_t arg) throw (FrozenException); + int addDiffForwardAuxiliaryVar(int orig_symb_id, expr_t arg) noexcept(false); //! Searches auxiliary variables which are substitutes for a given symbol_id and lead/lag /*! The search is only performed among auxiliary variables of endo/exo lag. \return the symbol ID of the auxiliary variable Throws an exception if match not found. */ - int searchAuxiliaryVars(int orig_symb_id, int orig_lead_lag) const throw (SearchFailedException); + int searchAuxiliaryVars(int orig_symb_id, int orig_lead_lag) const noexcept(false); //! Serches aux_vars for the aux var represented by aux_var_symb_id and returns its associated orig_symb_id - int getOrigSymbIdForAuxVar(int aux_var_symb_id) const throw (UnknownSymbolIDException); + int getOrigSymbIdForAuxVar(int aux_var_symb_id) const noexcept(false); //! Adds an auxiliary variable when var_model is used with an order that is greater in absolute value //! than the largest lag present in the model. - int addVarModelEndoLagAuxiliaryVar(int orig_symb_id, int orig_lead_lag, expr_t expr_arg) throw (AlreadyDeclaredException, FrozenException); + int addVarModelEndoLagAuxiliaryVar(int orig_symb_id, int orig_lead_lag, expr_t expr_arg) noexcept(false); //! Adds an auxiliary variable when the diff operator is encountered - int addDiffAuxiliaryVar(int index, expr_t expr_arg) throw (FrozenException); - int addDiffAuxiliaryVar(int index, expr_t expr_arg, int orig_symb_id, int orig_lag) throw (FrozenException); + int addDiffAuxiliaryVar(int index, expr_t expr_arg) noexcept(false); + int addDiffAuxiliaryVar(int index, expr_t expr_arg, int orig_symb_id, int orig_lag) noexcept(false); //! Takes care of timing between diff statements - int addDiffLagAuxiliaryVar(int index, expr_t expr_arg, int orig_symb_id, int orig_lag) throw (FrozenException); + int addDiffLagAuxiliaryVar(int index, expr_t expr_arg, int orig_symb_id, int orig_lag) noexcept(false); //! An Auxiliary variable for a unary op - int addUnaryOpAuxiliaryVar(int index, expr_t expr_arg, int orig_symb_id, int orig_lag) throw (FrozenException); + int addUnaryOpAuxiliaryVar(int index, expr_t expr_arg, int orig_symb_id, int orig_lag) noexcept(false); //! Returns the number of auxiliary variables int AuxVarsSize() const @@ -303,68 +303,68 @@ public: return aux_vars.size(); }; //! Retruns expr_node for an auxiliary variable - expr_t getAuxiliaryVarsExprNode(int symb_id) const throw (SearchFailedException); + expr_t getAuxiliaryVarsExprNode(int symb_id) const noexcept(false); //! Tests if symbol already exists inline bool exists(const string &name) const; //! Get symbol name (by ID) - inline string getName(int id) const throw (UnknownSymbolIDException); + inline string getName(int id) const noexcept(false); //! Get TeX name - inline string getTeXName(int id) const throw (UnknownSymbolIDException); + inline string getTeXName(int id) const noexcept(false); //! Get long name - inline string getLongName(int id) const throw (UnknownSymbolIDException); + inline string getLongName(int id) const noexcept(false); //! Returns true if the partition name is the first encountered for the type of variable represented by id - bool isFirstOfPartitionForType(int id) const throw (UnknownSymbolIDException); + bool isFirstOfPartitionForType(int id) const noexcept(false); //! Returns a list of partitions and symbols that belong to that partition - map<string, map<int, string> > getPartitionsForType(enum SymbolType st) const throw (UnknownSymbolIDException); + map<string, map<int, string> > getPartitionsForType(enum SymbolType st) const noexcept(false); //! Get type (by ID) - inline SymbolType getType(int id) const throw (UnknownSymbolIDException); + inline SymbolType getType(int id) const noexcept(false); //! Get type (by name) - inline SymbolType getType(const string &name) const throw (UnknownSymbolNameException); + inline SymbolType getType(const string &name) const noexcept(false); //! Get ID (by name) - inline int getID(const string &name) const throw (UnknownSymbolNameException); + inline int getID(const string &name) const noexcept(false); //! Get ID (by type specific ID) - int getID(SymbolType type, int tsid) const throw (UnknownTypeSpecificIDException, NotYetFrozenException); + int getID(SymbolType type, int tsid) const noexcept(false); //! Freeze symbol table - void freeze() throw (FrozenException); + void freeze() noexcept(false); //! unreeze symbol table //! Used after having written JSON files void unfreeze(); //! Change the type of a symbol - void changeType(int id, SymbolType newtype) throw (UnknownSymbolIDException, FrozenException); + void changeType(int id, SymbolType newtype) noexcept(false); //! Get type specific ID (by symbol ID) - inline int getTypeSpecificID(int id) const throw (UnknownSymbolIDException, NotYetFrozenException); + inline int getTypeSpecificID(int id) const noexcept(false); //! Get type specific ID (by symbol name) - inline int getTypeSpecificID(const string &name) const throw (UnknownSymbolNameException, NotYetFrozenException); + inline int getTypeSpecificID(const string &name) const noexcept(false); //! Get number of endogenous variables - inline int endo_nbr() const throw (NotYetFrozenException); + inline int endo_nbr() const noexcept(false); //! Get number of exogenous variables - inline int exo_nbr() const throw (NotYetFrozenException); + inline int exo_nbr() const noexcept(false); //! Get number of exogenous deterministic variables - inline int exo_det_nbr() const throw (NotYetFrozenException); + inline int exo_det_nbr() const noexcept(false); //! Get number of parameters - inline int param_nbr() const throw (NotYetFrozenException); + inline int param_nbr() const noexcept(false); //! Returns the greatest symbol ID (the smallest is zero) inline int maxID(); //! Get number of user-declared endogenous variables (without the auxiliary variables) - inline int orig_endo_nbr() const throw (NotYetFrozenException); + inline int orig_endo_nbr() const noexcept(false); //! Write output of this class - void writeOutput(ostream &output) const throw (NotYetFrozenException); + void writeOutput(ostream &output) const noexcept(false); //! Write JSON Output void writeJsonOutput(ostream &output) const; //! Write Julia output of this class - void writeJuliaOutput(ostream &output) const throw (NotYetFrozenException); + void writeJuliaOutput(ostream &output) const noexcept(false); //! Write C output of this class - void writeCOutput(ostream &output) const throw (NotYetFrozenException); + void writeCOutput(ostream &output) const noexcept(false); //! Write CC output of this class - void writeCCOutput(ostream &output) const throw (NotYetFrozenException); + void writeCCOutput(ostream &output) const noexcept(false); //! Mark a symbol as predetermined variable - void markPredetermined(int symb_id) throw (UnknownSymbolIDException, FrozenException); + void markPredetermined(int symb_id) noexcept(false); //! Test if a given symbol is a predetermined variable - bool isPredetermined(int symb_id) const throw (UnknownSymbolIDException); + bool isPredetermined(int symb_id) const noexcept(false); //! Return the number of predetermined variables int predeterminedNbr() const; //! Add an observed variable - void addObservedVariable(int symb_id) throw (UnknownSymbolIDException); + void addObservedVariable(int symb_id) noexcept(false); //! Return the number of observed variables int observedVariablesNbr() const; //! Is a given symbol in the set of observed variables @@ -372,7 +372,7 @@ public: //! Return the index of a given observed variable in the vector of all observed variables int getObservedVariableIndex(int symb_id) const; //! Add an observed exogenous variable - void addObservedExogenousVariable(int symb_id) throw (UnknownSymbolIDException); + void addObservedExogenousVariable(int symb_id) noexcept(false); //! Return the number of observed exogenous variables int observedExogenousVariablesNbr() const; //! Is a given symbol in the set of observed exogenous variables @@ -395,7 +395,7 @@ public: }; inline void -SymbolTable::validateSymbID(int symb_id) const throw (UnknownSymbolIDException) +SymbolTable::validateSymbID(int symb_id) const noexcept(false) { if (symb_id < 0 || symb_id > (int) symbol_table.size()) throw UnknownSymbolIDException(symb_id); @@ -409,41 +409,41 @@ SymbolTable::exists(const string &name) const } inline string -SymbolTable::getName(int id) const throw (UnknownSymbolIDException) +SymbolTable::getName(int id) const noexcept(false) { validateSymbID(id); return name_table[id]; } inline string -SymbolTable::getTeXName(int id) const throw (UnknownSymbolIDException) +SymbolTable::getTeXName(int id) const noexcept(false) { validateSymbID(id); return tex_name_table[id]; } inline string -SymbolTable::getLongName(int id) const throw (UnknownSymbolIDException) +SymbolTable::getLongName(int id) const noexcept(false) { validateSymbID(id); return long_name_table[id]; } inline SymbolType -SymbolTable::getType(int id) const throw (UnknownSymbolIDException) +SymbolTable::getType(int id) const noexcept(false) { validateSymbID(id); return type_table[id]; } inline SymbolType -SymbolTable::getType(const string &name) const throw (UnknownSymbolNameException) +SymbolTable::getType(const string &name) const noexcept(false) { return getType(getID(name)); } inline int -SymbolTable::getID(const string &name) const throw (UnknownSymbolNameException) +SymbolTable::getID(const string &name) const noexcept(false) { auto iter = symbol_table.find(name); if (iter != symbol_table.end()) @@ -453,7 +453,7 @@ SymbolTable::getID(const string &name) const throw (UnknownSymbolNameException) } inline int -SymbolTable::getTypeSpecificID(int id) const throw (UnknownSymbolIDException, NotYetFrozenException) +SymbolTable::getTypeSpecificID(int id) const noexcept(false) { if (!frozen) throw NotYetFrozenException(); @@ -464,13 +464,13 @@ SymbolTable::getTypeSpecificID(int id) const throw (UnknownSymbolIDException, No } inline int -SymbolTable::getTypeSpecificID(const string &name) const throw (UnknownSymbolNameException, NotYetFrozenException) +SymbolTable::getTypeSpecificID(const string &name) const noexcept(false) { return getTypeSpecificID(getID(name)); } inline int -SymbolTable::endo_nbr() const throw (NotYetFrozenException) +SymbolTable::endo_nbr() const noexcept(false) { if (!frozen) throw NotYetFrozenException(); @@ -479,7 +479,7 @@ SymbolTable::endo_nbr() const throw (NotYetFrozenException) } inline int -SymbolTable::exo_nbr() const throw (NotYetFrozenException) +SymbolTable::exo_nbr() const noexcept(false) { if (!frozen) throw NotYetFrozenException(); @@ -488,7 +488,7 @@ SymbolTable::exo_nbr() const throw (NotYetFrozenException) } inline int -SymbolTable::exo_det_nbr() const throw (NotYetFrozenException) +SymbolTable::exo_det_nbr() const noexcept(false) { if (!frozen) throw NotYetFrozenException(); @@ -497,7 +497,7 @@ SymbolTable::exo_det_nbr() const throw (NotYetFrozenException) } inline int -SymbolTable::param_nbr() const throw (NotYetFrozenException) +SymbolTable::param_nbr() const noexcept(false) { if (!frozen) throw NotYetFrozenException(); @@ -512,7 +512,7 @@ SymbolTable::maxID() } inline int -SymbolTable::orig_endo_nbr() const throw (NotYetFrozenException) +SymbolTable::orig_endo_nbr() const noexcept(false) { return (endo_nbr() - aux_vars.size()); } diff --git a/src/macro/MacroDriver.cc b/src/macro/MacroDriver.cc index c95731ad..d490c7f1 100644 --- a/src/macro/MacroDriver.cc +++ b/src/macro/MacroDriver.cc @@ -95,7 +95,7 @@ MacroDriver::set_variable(const string &name, const MacroValue *value) } const MacroValue * -MacroDriver::get_variable(const string &name) const throw (UnknownVariable) +MacroDriver::get_variable(const string &name) const noexcept(false) { auto it = env.find(name); if (it == env.end()) @@ -104,7 +104,7 @@ MacroDriver::get_variable(const string &name) const throw (UnknownVariable) } void -MacroDriver::init_loop(const string &name, const MacroValue *value) throw (MacroValue::TypeError) +MacroDriver::init_loop(const string &name, const MacroValue *value) noexcept(false) { const auto *mv1 = dynamic_cast<const ArrayMV<int> *>(value); const auto *mv2 = dynamic_cast<const ArrayMV<string> *>(value); @@ -154,7 +154,7 @@ MacroDriver::iter_loop() } void -MacroDriver::begin_if(const MacroValue *value) throw (MacroValue::TypeError) +MacroDriver::begin_if(const MacroValue *value) noexcept(false) { const auto *ival = dynamic_cast<const IntMV *>(value); if (!ival) @@ -191,7 +191,7 @@ MacroDriver::begin_ifndef(const string &name) } void -MacroDriver::echo(const Macro::parser::location_type &l, const MacroValue *value) const throw (MacroValue::TypeError) +MacroDriver::echo(const Macro::parser::location_type &l, const MacroValue *value) const noexcept(false) { const auto *sval = dynamic_cast<const StringMV *>(value); if (!sval) @@ -201,7 +201,7 @@ MacroDriver::echo(const Macro::parser::location_type &l, const MacroValue *value } void -MacroDriver::error(const Macro::parser::location_type &l, const MacroValue *value) const throw (MacroValue::TypeError) +MacroDriver::error(const Macro::parser::location_type &l, const MacroValue *value) const noexcept(false) { const auto *sval = dynamic_cast<const StringMV *>(value); if (!sval) diff --git a/src/macro/MacroDriver.hh b/src/macro/MacroDriver.hh index 08e80ae5..9becac35 100644 --- a/src/macro/MacroDriver.hh +++ b/src/macro/MacroDriver.hh @@ -212,18 +212,18 @@ public: //! Get a variable /*! Returns a newly allocated value (clone of the value stored in environment). */ - const MacroValue *get_variable(const string &name) const throw (UnknownVariable); + const MacroValue *get_variable(const string &name) const noexcept(false); //! Initiate a for loop /*! Does not set name = value[1]. You must call iter_loop() for that. */ - void init_loop(const string &name, const MacroValue *value) throw (MacroValue::TypeError); + void init_loop(const string &name, const MacroValue *value) noexcept(false); //! Iterate innermost loop /*! Returns false if iteration is no more possible (end of loop); in that case it destroys the pointer given to init_loop() */ bool iter_loop(); //! Begins an @#if statement - void begin_if(const MacroValue *value) throw (MacroValue::TypeError); + void begin_if(const MacroValue *value) noexcept(false); //! Begins an @#ifdef statement void begin_ifdef(const string &name); @@ -232,10 +232,10 @@ public: void begin_ifndef(const string &name); //! Executes @#echo directive - void echo(const Macro::parser::location_type &l, const MacroValue *value) const throw (MacroValue::TypeError); + void echo(const Macro::parser::location_type &l, const MacroValue *value) const noexcept(false); //! Executes @#error directive - void error(const Macro::parser::location_type &l, const MacroValue *value) const throw (MacroValue::TypeError); + void error(const Macro::parser::location_type &l, const MacroValue *value) const noexcept(false); }; #endif // ! MACRO_DRIVER_HH diff --git a/src/macro/MacroValue.cc b/src/macro/MacroValue.cc index 21c69e03..666f3229 100644 --- a/src/macro/MacroValue.cc +++ b/src/macro/MacroValue.cc @@ -30,97 +30,97 @@ MacroValue::~MacroValue() = default; const MacroValue * -MacroValue::operator+() const throw (TypeError) +MacroValue::operator+() const noexcept(false) { throw TypeError("Unary operator + does not exist for this type"); } const MacroValue * -MacroValue::operator-(const MacroValue &mv) const throw (TypeError) +MacroValue::operator-(const MacroValue &mv) const noexcept(false) { throw TypeError("Operator - does not exist for this type"); } const MacroValue * -MacroValue::operator-() const throw (TypeError) +MacroValue::operator-() const noexcept(false) { throw TypeError("Unary operator - does not exist for this type"); } const MacroValue * -MacroValue::operator*(const MacroValue &mv) const throw (TypeError) +MacroValue::operator*(const MacroValue &mv) const noexcept(false) { throw TypeError("Operator * does not exist for this type"); } const MacroValue * -MacroValue::operator/(const MacroValue &mv) const throw (TypeError) +MacroValue::operator/(const MacroValue &mv) const noexcept(false) { throw TypeError("Operator / does not exist for this type"); } const MacroValue * -MacroValue::operator<(const MacroValue &mv) const throw (TypeError) +MacroValue::operator<(const MacroValue &mv) const noexcept(false) { throw TypeError("Operator < does not exist for this type"); } const MacroValue * -MacroValue::operator>(const MacroValue &mv) const throw (TypeError) +MacroValue::operator>(const MacroValue &mv) const noexcept(false) { throw TypeError("Operator > does not exist for this type"); } const MacroValue * -MacroValue::operator<=(const MacroValue &mv) const throw (TypeError) +MacroValue::operator<=(const MacroValue &mv) const noexcept(false) { throw TypeError("Operator <= does not exist for this type"); } const MacroValue * -MacroValue::operator>=(const MacroValue &mv) const throw (TypeError) +MacroValue::operator>=(const MacroValue &mv) const noexcept(false) { throw TypeError("Operator >= does not exist for this type"); } const MacroValue * -MacroValue::operator&&(const MacroValue &mv) const throw (TypeError) +MacroValue::operator&&(const MacroValue &mv) const noexcept(false) { throw TypeError("Operator && does not exist for this type"); } const MacroValue * -MacroValue::operator||(const MacroValue &mv) const throw (TypeError) +MacroValue::operator||(const MacroValue &mv) const noexcept(false) { throw TypeError("Operator || does not exist for this type"); } const MacroValue * -MacroValue::operator!() const throw (TypeError) +MacroValue::operator!() const noexcept(false) { throw TypeError("Operator ! does not exist for this type"); } const MacroValue * -MacroValue::operator[](const MacroValue &mv) const throw (TypeError, OutOfBoundsError) +MacroValue::operator[](const MacroValue &mv) const noexcept(false) { throw TypeError("Operator [] does not exist for this type"); } const MacroValue * -MacroValue::length() const throw (TypeError) +MacroValue::length() const noexcept(false) { throw TypeError("Length not supported for this type"); } const MacroValue * -MacroValue::append(const MacroValue *mv) const throw (TypeError) +MacroValue::append(const MacroValue *mv) const noexcept(false) { throw TypeError("Cannot append an array at the end of another one. Should use concatenation."); } const MacroValue * -MacroValue::in(const MacroValue *array) const throw (TypeError) +MacroValue::in(const MacroValue *array) const noexcept(false) { throw TypeError("First argument of 'in' operator cannot be an array"); } @@ -145,7 +145,7 @@ IntMV::~IntMV() = default; const MacroValue * -IntMV::operator+(const MacroValue &mv) const throw (TypeError) +IntMV::operator+(const MacroValue &mv) const noexcept(false) { const auto *mv2 = dynamic_cast<const IntMV *>(&mv); if (mv2 == NULL) @@ -154,13 +154,13 @@ IntMV::operator+(const MacroValue &mv) const throw (TypeError) } const MacroValue * -IntMV::operator+() const throw (TypeError) +IntMV::operator+() const noexcept(false) { return this; } const MacroValue * -IntMV::operator-(const MacroValue &mv) const throw (TypeError) +IntMV::operator-(const MacroValue &mv) const noexcept(false) { const auto *mv2 = dynamic_cast<const IntMV *>(&mv); if (mv2 == NULL) @@ -169,13 +169,13 @@ IntMV::operator-(const MacroValue &mv) const throw (TypeError) } const MacroValue * -IntMV::operator-() const throw (TypeError) +IntMV::operator-() const noexcept(false) { return new IntMV(driver, -value); } const MacroValue * -IntMV::operator*(const MacroValue &mv) const throw (TypeError) +IntMV::operator*(const MacroValue &mv) const noexcept(false) { const auto *mv2 = dynamic_cast<const IntMV *>(&mv); if (mv2 == NULL) @@ -184,7 +184,7 @@ IntMV::operator*(const MacroValue &mv) const throw (TypeError) } const MacroValue * -IntMV::operator/(const MacroValue &mv) const throw (TypeError) +IntMV::operator/(const MacroValue &mv) const noexcept(false) { const auto *mv2 = dynamic_cast<const IntMV *>(&mv); if (mv2 == NULL) @@ -193,7 +193,7 @@ IntMV::operator/(const MacroValue &mv) const throw (TypeError) } const MacroValue * -IntMV::operator<(const MacroValue &mv) const throw (TypeError) +IntMV::operator<(const MacroValue &mv) const noexcept(false) { const auto *mv2 = dynamic_cast<const IntMV *>(&mv); if (mv2 == NULL) @@ -202,7 +202,7 @@ IntMV::operator<(const MacroValue &mv) const throw (TypeError) } const MacroValue * -IntMV::operator>(const MacroValue &mv) const throw (TypeError) +IntMV::operator>(const MacroValue &mv) const noexcept(false) { const auto *mv2 = dynamic_cast<const IntMV *>(&mv); if (mv2 == NULL) @@ -211,7 +211,7 @@ IntMV::operator>(const MacroValue &mv) const throw (TypeError) } const MacroValue * -IntMV::operator<=(const MacroValue &mv) const throw (TypeError) +IntMV::operator<=(const MacroValue &mv) const noexcept(false) { const auto *mv2 = dynamic_cast<const IntMV *>(&mv); if (mv2 == NULL) @@ -220,7 +220,7 @@ IntMV::operator<=(const MacroValue &mv) const throw (TypeError) } const MacroValue * -IntMV::operator>=(const MacroValue &mv) const throw (TypeError) +IntMV::operator>=(const MacroValue &mv) const noexcept(false) { const auto *mv2 = dynamic_cast<const IntMV *>(&mv); if (mv2 == NULL) @@ -229,7 +229,7 @@ IntMV::operator>=(const MacroValue &mv) const throw (TypeError) } const MacroValue * -IntMV::operator==(const MacroValue &mv) const throw (TypeError) +IntMV::operator==(const MacroValue &mv) const noexcept(false) { const auto *mv2 = dynamic_cast<const IntMV *>(&mv); if (mv2 == NULL) @@ -239,7 +239,7 @@ IntMV::operator==(const MacroValue &mv) const throw (TypeError) } const MacroValue * -IntMV::operator!=(const MacroValue &mv) const throw (TypeError) +IntMV::operator!=(const MacroValue &mv) const noexcept(false) { const auto *mv2 = dynamic_cast<const IntMV *>(&mv); if (mv2 == NULL) @@ -249,7 +249,7 @@ IntMV::operator!=(const MacroValue &mv) const throw (TypeError) } const MacroValue * -IntMV::operator&&(const MacroValue &mv) const throw (TypeError) +IntMV::operator&&(const MacroValue &mv) const noexcept(false) { const auto *mv2 = dynamic_cast<const IntMV *>(&mv); if (mv2 == NULL) @@ -258,7 +258,7 @@ IntMV::operator&&(const MacroValue &mv) const throw (TypeError) } const MacroValue * -IntMV::operator||(const MacroValue &mv) const throw (TypeError) +IntMV::operator||(const MacroValue &mv) const noexcept(false) { const auto *mv2 = dynamic_cast<const IntMV *>(&mv); if (mv2 == NULL) @@ -267,7 +267,7 @@ IntMV::operator||(const MacroValue &mv) const throw (TypeError) } const MacroValue * -IntMV::operator!() const throw (TypeError) +IntMV::operator!() const noexcept(false) { return new IntMV(driver, !value); } @@ -295,7 +295,7 @@ IntMV::toArray() const } const MacroValue * -IntMV::append(const MacroValue *array) const throw (TypeError) +IntMV::append(const MacroValue *array) const noexcept(false) { const auto *array2 = dynamic_cast<const ArrayMV<int> *>(array); if (array2 == NULL) @@ -307,7 +307,7 @@ IntMV::append(const MacroValue *array) const throw (TypeError) } const MacroValue * -IntMV::in(const MacroValue *array) const throw (TypeError) +IntMV::in(const MacroValue *array) const noexcept(false) { const auto *array2 = dynamic_cast<const ArrayMV<int> *>(array); if (array2 == NULL) @@ -325,7 +325,7 @@ IntMV::in(const MacroValue *array) const throw (TypeError) } const MacroValue * -IntMV::new_range(MacroDriver &driver, const MacroValue *mv1, const MacroValue *mv2) throw (TypeError) +IntMV::new_range(MacroDriver &driver, const MacroValue *mv1, const MacroValue *mv2) noexcept(false) { const auto *mv1i = dynamic_cast<const IntMV *>(mv1); const auto *mv2i = dynamic_cast<const IntMV *>(mv2); @@ -350,7 +350,7 @@ StringMV::~StringMV() = default; const MacroValue * -StringMV::operator+(const MacroValue &mv) const throw (TypeError) +StringMV::operator+(const MacroValue &mv) const noexcept(false) { const auto *mv2 = dynamic_cast<const StringMV *>(&mv); if (mv2 == NULL) @@ -359,7 +359,7 @@ StringMV::operator+(const MacroValue &mv) const throw (TypeError) } const MacroValue * -StringMV::operator==(const MacroValue &mv) const throw (TypeError) +StringMV::operator==(const MacroValue &mv) const noexcept(false) { const auto *mv2 = dynamic_cast<const StringMV *>(&mv); if (mv2 == NULL) @@ -369,7 +369,7 @@ StringMV::operator==(const MacroValue &mv) const throw (TypeError) } const MacroValue * -StringMV::operator!=(const MacroValue &mv) const throw (TypeError) +StringMV::operator!=(const MacroValue &mv) const noexcept(false) { const auto *mv2 = dynamic_cast<const StringMV *>(&mv); if (mv2 == NULL) @@ -379,7 +379,7 @@ StringMV::operator!=(const MacroValue &mv) const throw (TypeError) } const MacroValue * -StringMV::operator[](const MacroValue &mv) const throw (TypeError, OutOfBoundsError) +StringMV::operator[](const MacroValue &mv) const noexcept(false) { const auto *mv2 = dynamic_cast<const ArrayMV<int> *>(&mv); if (mv2 == NULL) @@ -416,7 +416,7 @@ StringMV::toArray() const } const MacroValue * -StringMV::append(const MacroValue *array) const throw (TypeError) +StringMV::append(const MacroValue *array) const noexcept(false) { const auto *array2 = dynamic_cast<const ArrayMV<string> *>(array); if (array2 == NULL) @@ -428,7 +428,7 @@ StringMV::append(const MacroValue *array) const throw (TypeError) } const MacroValue * -StringMV::in(const MacroValue *array) const throw (TypeError) +StringMV::in(const MacroValue *array) const noexcept(false) { const auto *array2 = dynamic_cast<const ArrayMV<string> *>(array); if (array2 == NULL) diff --git a/src/macro/MacroValue.hh b/src/macro/MacroValue.hh index b450d288..2b142d04 100644 --- a/src/macro/MacroValue.hh +++ b/src/macro/MacroValue.hh @@ -54,43 +54,43 @@ public: virtual ~MacroValue(); //! Applies + operator - virtual const MacroValue *operator+(const MacroValue &mv) const throw (TypeError) = 0; + virtual const MacroValue *operator+(const MacroValue &mv) const noexcept(false) = 0; //! Applies unary + operator - virtual const MacroValue *operator+() const throw (TypeError); + virtual const MacroValue *operator+() const noexcept(false); //! Applies - operator - virtual const MacroValue *operator-(const MacroValue &mv) const throw (TypeError); + virtual const MacroValue *operator-(const MacroValue &mv) const noexcept(false); //! Applies unary - operator - virtual const MacroValue *operator-() const throw (TypeError); + virtual const MacroValue *operator-() const noexcept(false); //! Applies * operator - virtual const MacroValue *operator*(const MacroValue &mv) const throw (TypeError); + virtual const MacroValue *operator*(const MacroValue &mv) const noexcept(false); //! Applies / operator - virtual const MacroValue *operator/(const MacroValue &mv) const throw (TypeError); + virtual const MacroValue *operator/(const MacroValue &mv) const noexcept(false); //! Less comparison /*! Returns an IntMV, equal to 0 or 1 */ - virtual const MacroValue *operator<(const MacroValue &mv) const throw (TypeError); + virtual const MacroValue *operator<(const MacroValue &mv) const noexcept(false); //! Greater comparision /*! Returns an IntMV, equal to 0 or 1 */ - virtual const MacroValue *operator>(const MacroValue &mv) const throw (TypeError); + virtual const MacroValue *operator>(const MacroValue &mv) const noexcept(false); //! Less or equal comparison /*! Returns an IntMV, equal to 0 or 1 */ - virtual const MacroValue *operator<=(const MacroValue &mv) const throw (TypeError); + virtual const MacroValue *operator<=(const MacroValue &mv) const noexcept(false); //! Greater or equal comparison /*! Returns an IntMV, equal to 0 or 1 */ - virtual const MacroValue *operator>=(const MacroValue &mv) const throw (TypeError); + virtual const MacroValue *operator>=(const MacroValue &mv) const noexcept(false); //! Equal comparison /*! Returns an IntMV, equal to 0 or 1 */ - virtual const MacroValue *operator==(const MacroValue &mv) const throw (TypeError) = 0; + virtual const MacroValue *operator==(const MacroValue &mv) const noexcept(false) = 0; //! Not equal comparison /*! Returns an IntMV, equal to 0 or 1 */ - virtual const MacroValue *operator!=(const MacroValue &mv) const throw (TypeError) = 0; + virtual const MacroValue *operator!=(const MacroValue &mv) const noexcept(false) = 0; //! Applies && operator - virtual const MacroValue *operator&&(const MacroValue &mv) const throw (TypeError); + virtual const MacroValue *operator&&(const MacroValue &mv) const noexcept(false); //! Applies || operator - virtual const MacroValue *operator||(const MacroValue &mv) const throw (TypeError); + virtual const MacroValue *operator||(const MacroValue &mv) const noexcept(false); //! Applies unary ! operator - virtual const MacroValue *operator!() const throw (TypeError); + virtual const MacroValue *operator!() const noexcept(false); //! Applies [] operator - virtual const MacroValue *operator[](const MacroValue &mv) const throw (TypeError, OutOfBoundsError); + virtual const MacroValue *operator[](const MacroValue &mv) const noexcept(false); //! Converts value to string virtual string toString() const = 0; //! Converts value to be printed @@ -98,13 +98,13 @@ public: //! Converts value to array form virtual const MacroValue *toArray() const = 0; //! Gets length - virtual const MacroValue *length() const throw (TypeError); + virtual const MacroValue *length() const noexcept(false); //! Appends value at the end of an array /*! The argument must be an array. */ - virtual const MacroValue *append(const MacroValue *array) const throw (TypeError); + virtual const MacroValue *append(const MacroValue *array) const noexcept(false); //! Applies "in" operator /*! The argument must be an array. Returns an IntMV, equal to 0 or 1 */ - virtual const MacroValue *in(const MacroValue *array) const throw (TypeError); + virtual const MacroValue *in(const MacroValue *array) const noexcept(false); //! Returns a new IntMV /*! Necessary for ArrayMV::operator[] (template issue) */ static const MacroValue *new_base_value(MacroDriver &driver, int i); @@ -126,30 +126,30 @@ public: virtual ~IntMV(); //! Computes arithmetic addition - virtual const MacroValue *operator+(const MacroValue &mv) const throw (TypeError); + virtual const MacroValue *operator+(const MacroValue &mv) const noexcept(false); //! Unary plus /*! Returns itself */ - virtual const MacroValue *operator+() const throw (TypeError); + virtual const MacroValue *operator+() const noexcept(false); //! Computes arithmetic substraction - virtual const MacroValue *operator-(const MacroValue &mv) const throw (TypeError); + virtual const MacroValue *operator-(const MacroValue &mv) const noexcept(false); //! Computes opposite - virtual const MacroValue *operator-() const throw (TypeError); + virtual const MacroValue *operator-() const noexcept(false); //! Computes arithmetic multiplication - virtual const MacroValue *operator*(const MacroValue &mv) const throw (TypeError); + virtual const MacroValue *operator*(const MacroValue &mv) const noexcept(false); //! Computes arithmetic division - virtual const MacroValue *operator/(const MacroValue &mv) const throw (TypeError); - virtual const MacroValue *operator<(const MacroValue &mv) const throw (TypeError); - virtual const MacroValue *operator>(const MacroValue &mv) const throw (TypeError); - virtual const MacroValue *operator<=(const MacroValue &mv) const throw (TypeError); - virtual const MacroValue *operator>=(const MacroValue &mv) const throw (TypeError); - virtual const MacroValue *operator==(const MacroValue &mv) const throw (TypeError); - virtual const MacroValue *operator!=(const MacroValue &mv) const throw (TypeError); + virtual const MacroValue *operator/(const MacroValue &mv) const noexcept(false); + virtual const MacroValue *operator<(const MacroValue &mv) const noexcept(false); + virtual const MacroValue *operator>(const MacroValue &mv) const noexcept(false); + virtual const MacroValue *operator<=(const MacroValue &mv) const noexcept(false); + virtual const MacroValue *operator>=(const MacroValue &mv) const noexcept(false); + virtual const MacroValue *operator==(const MacroValue &mv) const noexcept(false); + virtual const MacroValue *operator!=(const MacroValue &mv) const noexcept(false); //! Computes logical and - virtual const MacroValue *operator&&(const MacroValue &mv) const throw (TypeError); + virtual const MacroValue *operator&&(const MacroValue &mv) const noexcept(false); //! Computes logical or - virtual const MacroValue *operator||(const MacroValue &mv) const throw (TypeError); + virtual const MacroValue *operator||(const MacroValue &mv) const noexcept(false); //! Computes logical negation - virtual const MacroValue *operator!() const throw (TypeError); + virtual const MacroValue *operator!() const noexcept(false); virtual string toString() const; virtual string print() const; //! Converts value to array form @@ -157,14 +157,14 @@ public: virtual const MacroValue *toArray() const; //! Appends value at the end of an array /*! The first argument must be an integer array. */ - virtual const MacroValue *append(const MacroValue *array) const throw (TypeError); - virtual const MacroValue *in(const MacroValue *array) const throw (TypeError); + virtual const MacroValue *append(const MacroValue *array) const noexcept(false); + virtual const MacroValue *in(const MacroValue *array) const noexcept(false); //! Creates a integer range /*! Arguments must be of type IntMV. Returns an integer array containing all integers between mv1 and mv2. If mv2 < mv1, returns an empty range (for consistency with MATLAB). */ - static const MacroValue *new_range(MacroDriver &driver, const MacroValue *mv1, const MacroValue *mv2) throw (TypeError); + static const MacroValue *new_range(MacroDriver &driver, const MacroValue *mv1, const MacroValue *mv2) noexcept(false); inline int get_int_value() const { @@ -184,12 +184,12 @@ public: virtual ~StringMV(); //! Computes string concatenation - virtual const MacroValue *operator+(const MacroValue &mv) const throw (TypeError); - virtual const MacroValue *operator==(const MacroValue &mv) const throw (TypeError); - virtual const MacroValue *operator!=(const MacroValue &mv) const throw (TypeError); + virtual const MacroValue *operator+(const MacroValue &mv) const noexcept(false); + virtual const MacroValue *operator==(const MacroValue &mv) const noexcept(false); + virtual const MacroValue *operator!=(const MacroValue &mv) const noexcept(false); //! Subscripting operator /*! Argument must be an ArrayMV<int>. Indexes begin at 1. Returns a StringMV. */ - virtual const MacroValue *operator[](const MacroValue &mv) const throw (TypeError, OutOfBoundsError); + virtual const MacroValue *operator[](const MacroValue &mv) const noexcept(false); //! Returns underlying string value virtual string toString() const; virtual string print() const; @@ -198,8 +198,8 @@ public: virtual const MacroValue *toArray() const; //! Appends value at the end of an array /*! The first argument must be a string array. Returns a string array. */ - virtual const MacroValue *append(const MacroValue *array) const throw (TypeError); - virtual const MacroValue *in(const MacroValue *array) const throw (TypeError); + virtual const MacroValue *append(const MacroValue *array) const noexcept(false); + virtual const MacroValue *in(const MacroValue *array) const noexcept(false); }; //! Represents an array in macro language @@ -219,24 +219,24 @@ public: ~ArrayMV(); //! Computes array concatenation /*! Both array must be of same type */ - virtual const MacroValue *operator+(const MacroValue &mv) const throw (TypeError); + virtual const MacroValue *operator+(const MacroValue &mv) const noexcept(false); //! Returns an array in which the elements of the second array have been removed from the first /*! It is close to a set difference operation, except that if an element appears two times in the first array, it will also be in the returned value (provided it is not in the second array) */ - virtual const MacroValue *operator-(const MacroValue &mv) const throw (TypeError); - virtual const MacroValue *operator==(const MacroValue &mv) const throw (TypeError); - virtual const MacroValue *operator!=(const MacroValue &mv) const throw (TypeError); + virtual const MacroValue *operator-(const MacroValue &mv) const noexcept(false); + virtual const MacroValue *operator==(const MacroValue &mv) const noexcept(false); + virtual const MacroValue *operator!=(const MacroValue &mv) const noexcept(false); //! Subscripting operator /*! Argument must be an ArrayMV<int>. Indexes begin at 1. If argument is a one-element array, returns an IntMV or StringMV. Otherwise returns an array. */ - virtual const MacroValue *operator[](const MacroValue &mv) const throw (TypeError, OutOfBoundsError); + virtual const MacroValue *operator[](const MacroValue &mv) const noexcept(false); //! Returns a string containing the concatenation of string representations of elements virtual string toString() const; virtual string print() const; //! Returns itself virtual const MacroValue *toArray() const; //! Gets length - virtual const MacroValue *length() const throw (TypeError); + virtual const MacroValue *length() const noexcept(false); }; template<typename T> @@ -250,7 +250,7 @@ ArrayMV<T>::~ArrayMV() template<typename T> const MacroValue * -ArrayMV<T>::operator+(const MacroValue &mv) const throw (TypeError) +ArrayMV<T>::operator+(const MacroValue &mv) const noexcept(false) { const auto *mv2 = dynamic_cast<const ArrayMV<T> *>(&mv); if (mv2 == NULL) @@ -263,7 +263,7 @@ ArrayMV<T>::operator+(const MacroValue &mv) const throw (TypeError) template<typename T> const MacroValue * -ArrayMV<T>::operator-(const MacroValue &mv) const throw (TypeError) +ArrayMV<T>::operator-(const MacroValue &mv) const noexcept(false) { const auto *mv2 = dynamic_cast<const ArrayMV<T> *>(&mv); if (mv2 == NULL) @@ -288,7 +288,7 @@ ArrayMV<T>::operator-(const MacroValue &mv) const throw (TypeError) template<typename T> const MacroValue * -ArrayMV<T>::operator==(const MacroValue &mv) const throw (TypeError) +ArrayMV<T>::operator==(const MacroValue &mv) const noexcept(false) { const auto *mv2 = dynamic_cast<const ArrayMV<T> *>(&mv); if (mv2 == NULL) @@ -299,7 +299,7 @@ ArrayMV<T>::operator==(const MacroValue &mv) const throw (TypeError) template<typename T> const MacroValue * -ArrayMV<T>::operator!=(const MacroValue &mv) const throw (TypeError) +ArrayMV<T>::operator!=(const MacroValue &mv) const noexcept(false) { const auto *mv2 = dynamic_cast<const ArrayMV<T> *>(&mv); if (mv2 == NULL) @@ -310,7 +310,7 @@ ArrayMV<T>::operator!=(const MacroValue &mv) const throw (TypeError) template<typename T> const MacroValue * -ArrayMV<T>::operator[](const MacroValue &mv) const throw (TypeError, OutOfBoundsError) +ArrayMV<T>::operator[](const MacroValue &mv) const noexcept(false) { const auto *mv2 = dynamic_cast<const ArrayMV<int> *>(&mv); if (mv2 == NULL) @@ -386,7 +386,7 @@ ArrayMV<T>::toArray() const template<typename T> const MacroValue * -ArrayMV<T>::length() const throw (TypeError) +ArrayMV<T>::length() const noexcept(false) { return new IntMV(driver, values.size()); } -- GitLab