/* * Copyright (C) 2018 Dynare Team * * This file is part of Dynare. * * Dynare is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Dynare is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Dynare. If not, see . */ #ifndef _SUBMODEL_HH #define _SUBMODEL_HH #include #include #include #include #include "ExprNode.hh" #include "SymbolTable.hh" using namespace std; //! A table with all Trend Component Models in the .mod file /*! The unique name of the trend component model is the identifier */ class TrendComponentModelTable { private: SymbolTable &symbol_table; set names; map> eqtags, trend_eqtags; map> eqnums, trend_eqnums, nontrend_eqnums, max_lags, lhs, orig_diff_var; map>>> rhs; map> diff, nonstationary; map> lhs_expr_t; public: TrendComponentModelTable(SymbolTable &symbol_table_arg); //! Add a trend component model void addTrendComponentModel(string name_arg, vector eqtags_arg, vector trend_eqtags_arg); inline bool isExistingTrendComponentModelName(const string &name_arg) const; inline bool empty() const; map> getEqTags() const; vector getEqTags(const string &name_arg) const; map> getTrendEqTags() const; map> getEqNums() const; vector getEqNums(const string &name_arg) const; vector getMaxLags(const string &name_arg) const; int getMaxLag(const string &name_arg) const; vector getLhs(const string &name_arg) const; vector getLhsExprT(const string &name_arg) const; vector getDiff(const string &name_arg) const; vector getOrigDiffVar(const string &name_arg) const; vector getNonTrendEqNums(const string &name_arg) const; vector getNonstationary(const string &name_arg) const; void setEqNums(map> eqnums_arg); void setTrendEqNums(map> trend_eqnums_arg); void setLhs(map> lhs_arg); void setRhs(map>>> rhs_arg); void setLhsExprT(map> lhs_expr_t_arg); void setMaxLags(map> max_lags_arg); void setDiff(map> diff_arg); void setOrigDiffVar(map> orig_diff_var_arg); void setNonstationary(map> nonstationary_arg); //! Write output of this class void writeOutput(ostream &output) const; //! Write JSON Output void writeJsonOutput(ostream &output) const; private: void checkModelName(const string &name_arg) const; void setUndiffEqnums(); }; inline bool TrendComponentModelTable::isExistingTrendComponentModelName(const string &name_arg) const { return names.find(name_arg) == names.end() ? false : true; } inline bool TrendComponentModelTable::empty() const { return names.empty(); } #endif