2008-01-11 14:42:14 +01:00
/*
2013-04-25 18:07:32 +02:00
* Copyright ( C ) 2006 - 2013 Dynare Team
2008-01-11 14:42:14 +01:00
*
* 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 < http : //www.gnu.org/licenses/>.
*/
2006-12-12 12:54:30 +01:00
# ifndef _STATEMENT_HH
# define _STATEMENT_HH
# include <ostream>
# include <string>
# include <map>
2008-04-07 15:14:40 +02:00
# include "SymbolList.hh"
2012-01-23 16:52:27 +01:00
# include "WarningConsolidation.hh"
2008-04-07 15:14:40 +02:00
2006-12-15 12:44:58 +01:00
class ModFileStructure
{
public :
ModFileStructure ( ) ;
2010-06-11 10:31:13 +02:00
//! Whether check is present
2006-12-17 15:59:39 +01:00
bool check_present ;
2010-06-11 10:31:13 +02:00
//! Whether steady is present
2010-01-08 12:06:25 +01:00
bool steady_present ;
2006-12-15 12:44:58 +01:00
//! Whether a simul statement is present
bool simul_present ;
2008-09-29 12:16:13 +02:00
//! Whether a stoch_simul statement is present
bool stoch_simul_present ;
//! Whether an estimation statement is present
bool estimation_present ;
//! Whether an osr statement is present
bool osr_present ;
2011-03-03 16:30:53 +01:00
//! Whether an osr params statement is present
bool osr_params_present ;
//! Whether an optim weight statement is present
bool optim_weights_present ;
2008-09-29 12:16:13 +02:00
//! Whether a ramsey_policy statement is present
bool ramsey_policy_present ;
2011-03-13 21:19:55 +01:00
//! Whether a discretionary_objective statement is present
bool discretionary_policy_present ;
2011-03-03 16:03:21 +01:00
//! Whether a planner_objective statement is present
bool planner_objective_present ;
2013-04-25 18:07:32 +02:00
//! Whether an extended_path statement is present
bool extended_path_present ;
2009-10-20 18:17:27 +02:00
//! The value of the "order" option of stoch_simul, estimation, osr, ramsey_policy
2008-04-24 12:55:26 +02:00
//! Derivation order
/*! First initialized to zero. If user sets order option somewhere in the MOD file, it will be equal to the maximum of order options. Otherwise will default to 2 */
2007-02-08 12:56:46 +01:00
int order_option ;
2009-11-26 18:25:04 +01:00
//! Whether a bvar_density, bvar_forecast, sbvar, ms_sbvar statement is present
bool bvar_present ;
2009-12-04 22:32:19 +01:00
//! Whether an svar_identification statement is present
bool svar_identification_present ;
2009-10-14 18:16:43 +02:00
//! Whether an identification statement is present or the identification option of dynare_sensitivity statement is equal to one
2009-04-20 15:58:15 +02:00
bool identification_present ;
2012-06-07 15:26:49 +02:00
//! Whether the option analytic_derivation is given to estimation
bool estimation_analytic_derivation ;
2009-10-20 18:55:31 +02:00
//! Whether the option partial_information is given to stoch_simul/estimation/osr/ramsey_policy
bool partial_information ;
2012-07-30 17:01:20 +02:00
//! Whether a shocks or mshocks block has been parsed and no simul command yet run
/*! Used for the workaround for trac ticket #35. When a simul command is
seen , this flag is cleared in order to allow a sequence
shocks + endval + simul in a loop */
bool shocks_present_but_simul_not_yet ;
2011-02-04 12:38:12 +01:00
//! Whether a histval bloc is present
/*! Used for the workaround for trac ticket #157 */
bool histval_present ;
2009-12-09 12:50:58 +01:00
//! Whether the "k_order_solver" option is used (explictly, or implicitly if order >= 3)
bool k_order_solver ;
2010-04-14 15:03:41 +02:00
//! Whether there is a calibrated measurement error
bool calibrated_measurement_errors ;
2010-06-21 18:40:36 +02:00
//! Whether dsge_prior_weight was initialized as a parameter
bool dsge_prior_weight_initialized ;
2010-06-11 21:19:30 +02:00
//! Whether dsge_prior_weight is in the estimated_params block
bool dsge_prior_weight_in_estimated_params ;
//! Whether there is a dsge_var, with calibrated prior weight
string dsge_var_calibrated ;
//! Whether there is a dsge_var, with prior weight that must be estimated
bool dsge_var_estimated ;
//! Whether there is a bayesian_irf option passed to the estimation statement
bool bayesian_irf_present ;
2011-12-06 15:42:57 +01:00
//! Whether there is a data statement present
bool estimation_data_statement_present ;
2012-01-03 16:51:52 +01:00
//! Last chain number for Markov Switching statement
int last_markov_switching_chain ;
2013-10-29 12:47:40 +01:00
//! Whether a calib_smoother statement is present
bool calib_smoother_present ;
2006-12-15 12:44:58 +01:00
} ;
2006-12-12 12:54:30 +01:00
class Statement
{
public :
virtual ~ Statement ( ) ;
2006-12-15 12:44:58 +01:00
//! Do some internal check, and fill the ModFileStructure class
2012-02-06 12:16:38 +01:00
/*! Don't forget to update ComputingTasks.hh, Shocks.hh and
NumericalInitialization . hh if you modify the signature of this
method . Otherwise the default implementation ( i . e . a no - op ) will apply and
some checks won ' t be run . */
2012-01-23 16:52:27 +01:00
virtual void checkPass ( ModFileStructure & mod_file_struct , WarningConsolidation & warnings ) ;
2006-12-19 00:28:52 +01:00
virtual void computingPass ( ) ;
2009-03-24 17:29:58 +01:00
//! Write Matlab output code
2006-12-19 00:28:52 +01:00
/*!
\ param output is the output stream of the main matlab file
\ param basename is the name of the modfile ( without extension ) which can be used to build auxiliary files
*/
virtual void writeOutput ( ostream & output , const string & basename ) const = 0 ;
2006-12-12 12:54:30 +01:00
} ;
class NativeStatement : public Statement
{
private :
2013-10-10 11:04:56 +02:00
const string native_statement ;
2006-12-12 12:54:30 +01:00
public :
2013-10-10 11:04:56 +02:00
NativeStatement ( const string & native_statement_arg ) ;
2006-12-19 00:28:52 +01:00
virtual void writeOutput ( ostream & output , const string & basename ) const ;
2006-12-12 12:54:30 +01:00
} ;
class OptionsList
{
public :
2010-09-16 19:00:48 +02:00
typedef map < string , string > num_options_t ;
typedef map < string , pair < string , string > > paired_num_options_t ;
typedef map < string , string > string_options_t ;
2011-11-29 17:14:26 +01:00
typedef map < string , string > date_options_t ;
2010-09-16 19:00:48 +02:00
typedef map < string , SymbolList > symbol_list_options_t ;
typedef map < string , vector < int > > vec_int_options_t ;
num_options_t num_options ;
paired_num_options_t paired_num_options ;
string_options_t string_options ;
2011-11-29 17:14:26 +01:00
date_options_t date_options ;
2010-09-16 19:00:48 +02:00
symbol_list_options_t symbol_list_options ;
vec_int_options_t vector_int_options ;
2006-12-12 12:54:30 +01:00
void writeOutput ( ostream & output ) const ;
2008-04-05 12:52:58 +02:00
void writeOutput ( ostream & output , const string & option_group ) const ;
2006-12-12 12:54:30 +01:00
void clear ( ) ;
} ;
# endif // ! _STATEMENT_HH