ModFile.hh 2.41 KB
Newer Older
1
/*
sebastien's avatar
trunk:    
sebastien committed
2
 * Copyright (C) 2006-2009 Dynare Team
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 *
 * 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/>.
 */

#ifndef _MOD_FILE_HH
#define _MOD_FILE_HH

using namespace std;

#include <ostream>
26
27
#include <ctime>

28
29
#include "SymbolTable.hh"
#include "NumericalConstants.hh"
30
#include "NumericalInitialization.hh"
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "ModelTree.hh"
#include "VariableTable.hh"
#include "Statement.hh"

//! The abstract representation of a "mod" file
class ModFile
{
public:
  ModFile();
  ~ModFile();
  //! Symbol table
  SymbolTable symbol_table;
  //! Numerical constants table
  NumericalConstants num_constants;
  //! Expressions outside model block
  DataTree expressions_tree;
  //! Model equations and their derivatives
  ModelTree model_tree;
  //! Option linear
  bool linear;
  //! Global evaluation context
  /*! Filled using initval blocks and parameters initializations */
  eval_context_type global_eval_context;

private:
  //! List of statements
  vector<Statement *> statements;
  //! Structure of the mod file
  ModFileStructure mod_file_struct;

public:
  //! Add a statement
  void addStatement(Statement *st);
64
65
  //! Evaluate all the statements
  void evalAllExpressions();
66
  //! Do some checking and fills mod_file_struct
sebastien's avatar
sebastien committed
67
  /*! \todo add check for number of equations and endogenous if ramsey_policy is present */
68
69
  void checkPass();
  //! Execute computations
70
71
  /*! \param no_tmp_terms if true, no temporary terms will be computed in the static and dynamic files */
  void computingPass(bool no_tmp_terms);
72
73
74
75
76
77
78
79
80
  //! Writes Matlab/Scilab output files
  /*!
    \param basename The base name used for writing output files. Should be the name of the mod file without its extension
    \param clear_all Should a "clear all" instruction be written to output ?
  */
  void writeOutputFiles(const string &basename, bool clear_all) const;
};

#endif // ! MOD_FILE_HH