Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Dynare
preprocessor
Commits
7b6f23c5
Verified
Commit
7b6f23c5
authored
Mar 29, 2019
by
Houtan Bastani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conditional_forecast_paths: add support to write JSON output
parent
8dad9396
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
2 deletions
+29
-2
src/Shocks.cc
src/Shocks.cc
+27
-1
src/Shocks.hh
src/Shocks.hh
+2
-1
No files found.
src/Shocks.cc
View file @
7b6f23c5
/*
* Copyright (C) 2003-201
7
Dynare Team
* Copyright (C) 2003-201
9
Dynare Team
*
* This file is part of Dynare.
*
...
...
@@ -484,6 +484,32 @@ ConditionalForecastPathsStatement::writeOutput(ostream &output, const string &ba
}
}
void
ConditionalForecastPathsStatement
::
writeJsonOutput
(
ostream
&
output
)
const
{
output
<<
"{
\"
statementName
\"
:
\"
conditional_forecast_paths
\"
"
<<
",
\"
paths
\"
: ["
;
for
(
auto
it
=
paths
.
begin
();
it
!=
paths
.
end
();
it
++
)
{
if
(
it
!=
paths
.
begin
())
output
<<
", "
;
output
<<
"{
\"
var
\"
:
\"
"
<<
symbol_table
.
getName
(
it
->
first
)
<<
"
\"
, "
<<
"
\"
values
\"
: ["
;
for
(
auto
it1
=
it
->
second
.
begin
();
it1
!=
it
->
second
.
end
();
it1
++
)
{
if
(
it1
!=
it
->
second
.
begin
())
output
<<
", "
;
output
<<
"{
\"
period1
\"
: "
<<
it1
->
period1
<<
", "
<<
"
\"
period2
\"
: "
<<
it1
->
period2
<<
", "
<<
"
\"
value
\"
:
\"
"
;
it1
->
value
->
writeJsonOutput
(
output
,
{},
{});
output
<<
"
\"
}"
;
}
output
<<
"]}"
;
}
output
<<
"]}"
;
}
MomentCalibration
::
MomentCalibration
(
constraints_t
constraints_arg
,
const
SymbolTable
&
symbol_table_arg
)
:
constraints
{
move
(
constraints_arg
)},
symbol_table
{
symbol_table_arg
}
...
...
src/Shocks.hh
View file @
7b6f23c5
/*
* Copyright (C) 2003-201
7
Dynare Team
* Copyright (C) 2003-201
9
Dynare Team
*
* This file is part of Dynare.
*
...
...
@@ -103,6 +103,7 @@ public:
const
SymbolTable
&
symbol_table_arg
);
void
checkPass
(
ModFileStructure
&
mod_file_struct
,
WarningConsolidation
&
warnings
)
override
;
void
writeOutput
(
ostream
&
output
,
const
string
&
basename
,
bool
minimal_workspace
)
const
override
;
void
writeJsonOutput
(
ostream
&
output
)
const
override
;
};
class
MomentCalibration
:
public
Statement
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment