Ensure that all statements produce an output in JSON mode
parent
a99ca9f450
commit
638b4c7ac5
|
@ -593,6 +593,25 @@ DetCondForecastStatement::writeOutput(ostream &output, const string &basename, b
|
|||
output << ");" << endl;
|
||||
}
|
||||
|
||||
void
|
||||
DetCondForecastStatement::writeJsonOutput(ostream &output) const
|
||||
{
|
||||
output << R"({"statementName": "det_cond_forecast")";
|
||||
if (options_list.getNumberOfOptions())
|
||||
{
|
||||
output << ", ";
|
||||
options_list.writeJsonOutput(output);
|
||||
}
|
||||
if (!symbol_list.empty())
|
||||
{
|
||||
output << ", ";
|
||||
symbol_list.writeJsonOutput(output);
|
||||
}
|
||||
output << R"(, "linear_decomposition": )"
|
||||
<< (linear_decomposition ? "true" : "false")
|
||||
<< "}";
|
||||
}
|
||||
|
||||
RamseyModelStatement::RamseyModelStatement(OptionsList options_list_arg) :
|
||||
options_list{move(options_list_arg)}
|
||||
{
|
||||
|
|
|
@ -106,6 +106,7 @@ public:
|
|||
OptionsList options_list_arg,
|
||||
const bool linear_decompositiontion_arg);
|
||||
void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const override;
|
||||
void writeJsonOutput(ostream &output) const override;
|
||||
};
|
||||
|
||||
class ModelInfoStatement : public Statement
|
||||
|
|
|
@ -151,11 +151,7 @@ void
|
|||
ShocksStatement::writeJsonOutput(ostream &output) const
|
||||
{
|
||||
output << R"({"statementName": "shocks")"
|
||||
<< R"(, "overwrite": )";
|
||||
if (overwrite)
|
||||
output << "true";
|
||||
else
|
||||
output << "false";
|
||||
<< R"(, "overwrite": )" << (overwrite ? "true" : "false");
|
||||
if (!det_shocks.empty())
|
||||
{
|
||||
output << ", ";
|
||||
|
@ -422,6 +418,19 @@ MShocksStatement::writeOutput(ostream &output, const string &basename, bool mini
|
|||
writeDetShocks(output);
|
||||
}
|
||||
|
||||
void
|
||||
MShocksStatement::writeJsonOutput(ostream &output) const
|
||||
{
|
||||
output << R"({"statementName": "mshocks")"
|
||||
<< R"(, "overwrite": )" << (overwrite ? "true" : "false");
|
||||
if (!det_shocks.empty())
|
||||
{
|
||||
output << ", ";
|
||||
writeJsonDetShocks(output);
|
||||
}
|
||||
output << "}";
|
||||
}
|
||||
|
||||
ConditionalForecastPathsStatement::ConditionalForecastPathsStatement(AbstractShocksStatement::det_shocks_t paths_arg,
|
||||
const SymbolTable &symbol_table_arg) :
|
||||
paths{move(paths_arg)},
|
||||
|
|
|
@ -90,6 +90,7 @@ public:
|
|||
const det_shocks_t &det_shocks_arg,
|
||||
const SymbolTable &symbol_table_arg);
|
||||
void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const override;
|
||||
void writeJsonOutput(ostream &output) const override;
|
||||
};
|
||||
|
||||
class ConditionalForecastPathsStatement : public Statement
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright © 2003-2019 Dynare Team
|
||||
* Copyright © 2003-2020 Dynare Team
|
||||
*
|
||||
* This file is part of Dynare.
|
||||
*
|
||||
|
@ -83,7 +83,7 @@ SigmaeStatement::writeOutput(ostream &output, const string &basename, bool minim
|
|||
ic1 = ir;
|
||||
ir1 = ic;
|
||||
}
|
||||
else // ic <= ir && matrix_form == eLower
|
||||
else // ic <= ir && matrix_form == MatrixForm::lower
|
||||
{
|
||||
ic1 = ic;
|
||||
ir1 = ir;
|
||||
|
@ -96,3 +96,25 @@ SigmaeStatement::writeOutput(ostream &output, const string &basename, bool minim
|
|||
}
|
||||
output << "];" << endl;
|
||||
}
|
||||
|
||||
void
|
||||
SigmaeStatement::writeJsonOutput(ostream &output) const
|
||||
{
|
||||
output << R"({"statementName": "Sigma_e", "value": [)";
|
||||
for (auto it = matrix.begin(); it != matrix.end(); ++it)
|
||||
{
|
||||
if (it != matrix.begin())
|
||||
output << ", ";
|
||||
output << "[";
|
||||
for (auto it2 = it->begin(); it2 != it->end(); ++it2)
|
||||
{
|
||||
if (it2 != it->begin())
|
||||
output << ", ";
|
||||
output << '"';
|
||||
(*it2)->writeJsonOutput(output, {}, {});
|
||||
output << '"';
|
||||
}
|
||||
output << "]";
|
||||
}
|
||||
output << "] }";
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright © 2003-2015 Dynare Team
|
||||
* Copyright © 2003-2020 Dynare Team
|
||||
*
|
||||
* This file is part of Dynare.
|
||||
*
|
||||
|
@ -58,6 +58,7 @@ private:
|
|||
public:
|
||||
explicit SigmaeStatement(matrix_t matrix_arg) noexcept(false);
|
||||
void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const override;
|
||||
void writeJsonOutput(ostream &output) const override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -34,11 +34,6 @@ Statement::writeJuliaOutput(ostream &output, const string &basename)
|
|||
{
|
||||
}
|
||||
|
||||
void
|
||||
Statement::writeJsonOutput(ostream &output) const
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Statement::computingPass()
|
||||
{
|
||||
|
|
|
@ -166,7 +166,7 @@ public:
|
|||
*/
|
||||
virtual void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const = 0;
|
||||
virtual void writeJuliaOutput(ostream &output, const string &basename);
|
||||
virtual void writeJsonOutput(ostream &output) const;
|
||||
virtual void writeJsonOutput(ostream &output) const = 0;
|
||||
};
|
||||
|
||||
class NativeStatement : public Statement
|
||||
|
|
Loading…
Reference in New Issue