ComputingTasks.hh 29.2 KB
Newer Older
1
/*
2
 * Copyright (C) 2003-2012 Dynare Team
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 *
 * 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 _COMPUTINGTASKS_HH
#define _COMPUTINGTASKS_HH

#include <ostream>

sebastien's avatar
sebastien committed
25
#include "SymbolList.hh"
26
27
#include "SymbolTable.hh"
#include "Statement.hh"
sebastien's avatar
sebastien committed
28
#include "StaticModel.hh"
29
#include "DynamicModel.hh"
30
31
32
33
34
35

class SteadyStatement : public Statement
{
private:
  const OptionsList options_list;
public:
36
  SteadyStatement(const OptionsList &options_list_arg);
37
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
38
39
40
41
42
43
44
45
46
  virtual void writeOutput(ostream &output, const string &basename) const;
};

class CheckStatement : public Statement
{
private:
  const OptionsList options_list;
public:
  CheckStatement(const OptionsList &options_list_arg);
47
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
48
49
50
51
52
53
54
55
  virtual void writeOutput(ostream &output, const string &basename) const;
};

class SimulStatement : public Statement
{
private:
  const OptionsList options_list;
public:
56
  SimulStatement(const OptionsList &options_list_arg);
57
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
58
59
60
  virtual void writeOutput(ostream &output, const string &basename) const;
};

ferhat's avatar
ferhat committed
61
class ModelInfoStatement : public Statement
62
63
64
65
{
private:
  const OptionsList options_list;
public:
ferhat's avatar
ferhat committed
66
  ModelInfoStatement(const OptionsList &options_list_arg);
67
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
68
69
70
  virtual void writeOutput(ostream &output, const string &basename) const;
};

71
72
73
class StochSimulStatement : public Statement
{
private:
sebastien's avatar
sebastien committed
74
  const SymbolList symbol_list;
75
76
  const OptionsList options_list;
public:
sebastien's avatar
sebastien committed
77
  StochSimulStatement(const SymbolList &symbol_list_arg,
78
                      const OptionsList &options_list_arg);
79
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
80
81
82
  virtual void writeOutput(ostream &output, const string &basename) const;
};

83
84
85
86
87
88
89
class ForecastStatement : public Statement
{
private:
  const SymbolList symbol_list;
  const OptionsList options_list;
public:
  ForecastStatement(const SymbolList &symbol_list_arg,
90
                    const OptionsList &options_list_arg);
91
  virtual void writeOutput(ostream &output, const string &basename) const;
92
93
94
95
96
97
98
99
100
101
102
103
};

class RamseyModelStatement : public Statement
{
private:
  const SymbolList symbol_list;
  const OptionsList options_list;
public:
  RamseyModelStatement(const SymbolList &symbol_list_arg,
                        const OptionsList &options_list_arg);
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
  virtual void writeOutput(ostream &output, const string &basename) const;
104
105
};

106
107
108
class RamseyPolicyStatement : public Statement
{
private:
sebastien's avatar
sebastien committed
109
  const SymbolList symbol_list;
110
111
  const OptionsList options_list;
public:
sebastien's avatar
sebastien committed
112
  RamseyPolicyStatement(const SymbolList &symbol_list_arg,
113
                        const OptionsList &options_list_arg);
114
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
115
116
117
  virtual void writeOutput(ostream &output, const string &basename) const;
};

118
119
120
121
122
123
124
125
class DiscretionaryPolicyStatement : public Statement
{
private:
  const SymbolList symbol_list;
  const OptionsList options_list;
public:
  DiscretionaryPolicyStatement(const SymbolList &symbol_list_arg,
			       const OptionsList &options_list_arg);
126
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
127
128
129
  virtual void writeOutput(ostream &output, const string &basename) const;
};

130
131
132
class RplotStatement : public Statement
{
private:
sebastien's avatar
sebastien committed
133
  const SymbolList symbol_list;
134
135
  const OptionsList options_list;
public:
sebastien's avatar
sebastien committed
136
  RplotStatement(const SymbolList &symbol_list_arg,
137
138
                 const OptionsList &options_list_arg);
  virtual void writeOutput(ostream &output, const string &basename) const;
139
140
141
142
143
144
145
};

class UnitRootVarsStatement : public Statement
{
public:
  UnitRootVarsStatement(void);
  virtual void writeOutput(ostream &output, const string &basename) const;
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
};

class PeriodsStatement : public Statement
{
private:
  const int periods;
public:
  PeriodsStatement(int periods_arg);
  virtual void writeOutput(ostream &output, const string &basename) const;
};

class DsampleStatement : public Statement
{
private:
  const int val1, val2;
public:
  DsampleStatement(int val1_arg);
  DsampleStatement(int val1_arg, int val2_arg);
  virtual void writeOutput(ostream &output, const string &basename) const;
};

class EstimationStatement : public Statement
{
private:
sebastien's avatar
sebastien committed
170
  const SymbolList symbol_list;
171
172
  const OptionsList options_list;
public:
sebastien's avatar
sebastien committed
173
  EstimationStatement(const SymbolList &symbol_list_arg,
174
                      const OptionsList &options_list_arg);
175
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
176
177
178
179
180
181
182
183
184
  virtual void writeOutput(ostream &output, const string &basename) const;
};

class DynareSensitivityStatement : public Statement
{
private:
  const OptionsList options_list;
public:
  DynareSensitivityStatement(const OptionsList &options_list_arg);
185
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
186
187
188
189
190
191
  virtual void writeOutput(ostream &output, const string &basename) const;
};

class ObservationTrendsStatement : public Statement
{
public:
192
  typedef map<string, expr_t> trend_elements_t;
193
private:
194
  const trend_elements_t trend_elements;
195
196
  const SymbolTable &symbol_table;
public:
197
  ObservationTrendsStatement(const trend_elements_t &trend_elements_arg,
198
199
200
201
202
203
204
                             const SymbolTable &symbol_table_arg);
  virtual void writeOutput(ostream &output, const string &basename) const;
};

class OsrParamsStatement : public Statement
{
private:
sebastien's avatar
sebastien committed
205
  const SymbolList symbol_list;
206
public:
sebastien's avatar
sebastien committed
207
  OsrParamsStatement(const SymbolList &symbol_list_arg);
208
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
209
210
211
212
213
214
  virtual void writeOutput(ostream &output, const string &basename) const;
};

class OsrStatement : public Statement
{
private:
sebastien's avatar
sebastien committed
215
  const SymbolList symbol_list;
216
217
  const OptionsList options_list;
public:
sebastien's avatar
sebastien committed
218
  OsrStatement(const SymbolList &symbol_list_arg,
219
               const OptionsList &options_list_arg);
220
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
221
222
223
224
225
226
  virtual void writeOutput(ostream &output, const string &basename) const;
};

class DynaTypeStatement : public Statement
{
private:
sebastien's avatar
sebastien committed
227
  const SymbolList symbol_list;
228
229
  const string filename;
public:
sebastien's avatar
sebastien committed
230
  DynaTypeStatement(const SymbolList &symbol_list_arg,
sebastien's avatar
trunk:    
sebastien committed
231
                    const string &filename_arg);
232
233
234
235
236
237
  virtual void writeOutput(ostream &output, const string &basename) const;
};

class DynaSaveStatement : public Statement
{
private:
sebastien's avatar
sebastien committed
238
  const SymbolList symbol_list;
239
240
  const string filename;
public:
sebastien's avatar
sebastien committed
241
  DynaSaveStatement(const SymbolList &symbol_list_arg,
sebastien's avatar
trunk:    
sebastien committed
242
                    const string &filename_arg);
243
244
245
246
247
248
  virtual void writeOutput(ostream &output, const string &basename) const;
};

class ModelComparisonStatement : public Statement
{
public:
249
  typedef vector<pair<string, string> > filename_list_t;
250
private:
251
  filename_list_t filename_list;
252
253
  OptionsList options_list;
public:
254
  ModelComparisonStatement(const filename_list_t &filename_list_arg,
255
256
257
258
                           const OptionsList &options_list_arg);
  virtual void writeOutput(ostream &output, const string &basename) const;
};

259
260
//! Temporary structure used when parsing estimation_params* statements
class EstimationParams
261
{
262
public:
263
  int type;
264
265
  string name, name2;
  PriorDistributions prior;
266
  expr_t init_val, low_bound, up_bound, mean, std, p3, p4, jscale;
267

268
269
  void
  init(const DataTree &datatree)
270
271
272
273
  {
    type = 0;
    name = "";
    name2 = "";
274
    prior = eNoShape;
275
276
277
278
279
280
281
282
    init_val = datatree.NaN;
    low_bound = datatree.MinusInfinity;
    up_bound = datatree.Infinity;
    mean = datatree.NaN;
    std = datatree.NaN;
    p3 = datatree.NaN;
    p4 = datatree.NaN;
    jscale = datatree.NaN;
283
284
285
286
287
288
289
290
291
292
293
  }
};

class EstimatedParamsStatement : public Statement
{
private:
  const vector<EstimationParams> estim_params_list;
  const SymbolTable &symbol_table;
public:
  EstimatedParamsStatement(const vector<EstimationParams> &estim_params_list_arg,
                           const SymbolTable &symbol_table_arg);
294
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
295
296
297
298
299
300
301
302
  virtual void writeOutput(ostream &output, const string &basename) const;
};

class EstimatedParamsInitStatement : public Statement
{
private:
  const vector<EstimationParams> estim_params_list;
  const SymbolTable &symbol_table;
303
  const bool use_calibration;
304
305
public:
  EstimatedParamsInitStatement(const vector<EstimationParams> &estim_params_list_arg,
306
307
                               const SymbolTable &symbol_table_arg,
                               const bool use_calibration_arg);
308
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
  virtual void writeOutput(ostream &output, const string &basename) const;
};

class EstimatedParamsBoundsStatement : public Statement
{
private:
  const vector<EstimationParams> estim_params_list;
  const SymbolTable &symbol_table;
public:
  EstimatedParamsBoundsStatement(const vector<EstimationParams> &estim_params_list_arg,
                                 const SymbolTable &symbol_table_arg);
  virtual void writeOutput(ostream &output, const string &basename) const;
};

class OptimWeightsStatement : public Statement
{
public:
326
327
  typedef map<string, expr_t> var_weights_t;
  typedef map<pair<string, string>, expr_t> covar_weights_t;
328
private:
329
330
  const var_weights_t var_weights;
  const covar_weights_t covar_weights;
331
332
  const SymbolTable &symbol_table;
public:
333
334
  OptimWeightsStatement(const var_weights_t &var_weights_arg,
                        const covar_weights_t &covar_weights_arg,
335
                        const SymbolTable &symbol_table_arg);
336
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
337
338
339
340
341
342
343
  virtual void writeOutput(ostream &output, const string &basename) const;
};

/*! \todo Make model_tree a member instead of a pointer */
class PlannerObjectiveStatement : public Statement
{
private:
sebastien's avatar
sebastien committed
344
  StaticModel *model_tree;
345
346
347
348
public:
  //! Constructor
  /*! \param model_tree_arg the model tree used to store the objective function.
    It is owned by the PlannerObjectiveStatement, and will be deleted by its destructor */
sebastien's avatar
sebastien committed
349
  PlannerObjectiveStatement(StaticModel *model_tree_arg);
350
351
352
  virtual ~PlannerObjectiveStatement();
  /*! \todo check there are only endogenous variables at the current period in the objective
    (no exogenous, no lead/lag) */
353
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
354
  /*! \todo allow for the possibility of disabling temporary terms */
355
356
  virtual void computingPass();
  virtual void writeOutput(ostream &output, const string &basename) const;
357
358
  //! Return the Planner Objective
  StaticModel *getPlannerObjective() const;
359
360
361
362
363
364
365
366
367
};

class BVARDensityStatement : public Statement
{
private:
  const int maxnlags;
  const OptionsList options_list;
public:
  BVARDensityStatement(int maxnlags_arg, const OptionsList &options_list_arg);
368
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
369
370
371
372
373
374
375
376
377
378
  virtual void writeOutput(ostream &output, const string &basename) const;
};

class BVARForecastStatement : public Statement
{
private:
  const int nlags;
  const OptionsList options_list;
public:
  BVARForecastStatement(int nlags_arg, const OptionsList &options_list_arg);
379
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
380
381
382
  virtual void writeOutput(ostream &output, const string &basename) const;
};

383
384
385
386
387
388
class SBVARStatement : public Statement
{
private:
  const OptionsList options_list;
public:
  SBVARStatement(const OptionsList &options_list_arg);
389
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
390
391
392
  virtual void writeOutput(ostream &output, const string &basename) const;
};

Houtan Bastani's avatar
Houtan Bastani committed
393
class MSSBVAREstimationStatement : public Statement
394
395
396
397
{
private:
  const OptionsList options_list;
public:
Houtan Bastani's avatar
Houtan Bastani committed
398
  MSSBVAREstimationStatement(const OptionsList &options_list_arg);
399
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
Houtan Bastani's avatar
Houtan Bastani committed
400
401
402
403
404
405
406
407
408
  virtual void writeOutput(ostream &output, const string &basename) const;
};

class MSSBVARSimulationStatement : public Statement
{
private:
  const OptionsList options_list;
public:
  MSSBVARSimulationStatement(const OptionsList &options_list_arg);
409
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
Houtan Bastani's avatar
Houtan Bastani committed
410
411
412
413
414
415
416
417
418
  virtual void writeOutput(ostream &output, const string &basename) const;
};

class MSSBVARComputeMDDStatement : public Statement
{
private:
  const OptionsList options_list;
public:
  MSSBVARComputeMDDStatement(const OptionsList &options_list_arg);
419
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
Houtan Bastani's avatar
Houtan Bastani committed
420
421
422
423
424
425
426
427
428
  virtual void writeOutput(ostream &output, const string &basename) const;
};

class MSSBVARComputeProbabilitiesStatement : public Statement
{
private:
  const OptionsList options_list;
public:
  MSSBVARComputeProbabilitiesStatement(const OptionsList &options_list_arg);
429
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
Houtan Bastani's avatar
Houtan Bastani committed
430
431
432
433
434
435
  virtual void writeOutput(ostream &output, const string &basename) const;
};

class MSSBVARIrfStatement : public Statement
{
private:
436
  const SymbolList symbol_list;
Houtan Bastani's avatar
Houtan Bastani committed
437
438
  const OptionsList options_list;
public:
439
440
  MSSBVARIrfStatement(const SymbolList &symbol_list_arg,
		      const OptionsList &options_list_arg);
441
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
Houtan Bastani's avatar
Houtan Bastani committed
442
443
444
445
446
447
448
449
450
  virtual void writeOutput(ostream &output, const string &basename) const;
};

class MSSBVARForecastStatement : public Statement
{
private:
  const OptionsList options_list;
public:
  MSSBVARForecastStatement(const OptionsList &options_list_arg);
451
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
Houtan Bastani's avatar
Houtan Bastani committed
452
453
454
455
456
457
458
459
460
  virtual void writeOutput(ostream &output, const string &basename) const;
};

class MSSBVARVarianceDecompositionStatement : public Statement
{
private:
  const OptionsList options_list;
public:
  MSSBVARVarianceDecompositionStatement(const OptionsList &options_list_arg);
461
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
462
463
464
  virtual void writeOutput(ostream &output, const string &basename) const;
};

sebastien's avatar
sebastien committed
465
466
class IdentificationStatement : public Statement
{
sebastien's avatar
sebastien committed
467
private:
468
  OptionsList options_list;
sebastien's avatar
sebastien committed
469
public:
sebastien's avatar
sebastien committed
470
  IdentificationStatement(const OptionsList &options_list_arg);
471
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
sebastien's avatar
sebastien committed
472
473
474
  virtual void writeOutput(ostream &output, const string &basename) const;
};

475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
class WriteLatexDynamicModelStatement : public Statement
{
private:
  const DynamicModel &dynamic_model;
public:
  WriteLatexDynamicModelStatement(const DynamicModel &dynamic_model_arg);
  virtual void writeOutput(ostream &output, const string &basename) const;
};

class WriteLatexStaticModelStatement : public Statement
{
private:
  const StaticModel &static_model;
public:
  WriteLatexStaticModelStatement(const StaticModel &static_model_arg);
  virtual void writeOutput(ostream &output, const string &basename) const;
};

493
494
495
496
497
498
499
class ShockDecompositionStatement : public Statement
{
private:
  const SymbolList symbol_list;
  const OptionsList options_list;
public:
  ShockDecompositionStatement(const SymbolList &symbol_list_arg,
500
                              const OptionsList &options_list_arg);
501
502
503
  virtual void writeOutput(ostream &output, const string &basename) const;
};

504
505
506
507
508
509
510
511
512
513
514
515
class ConditionalForecastStatement : public Statement
{
private:
  const OptionsList options_list;
public:
  ConditionalForecastStatement(const OptionsList &options_list_arg);
  virtual void writeOutput(ostream &output, const string &basename) const;
};

class PlotConditionalForecastStatement : public Statement
{
private:
516
  //! A value of -1 indicates that the user didn't specify a value
517
518
519
520
521
522
523
  const int periods;
  const SymbolList symbol_list;
public:
  PlotConditionalForecastStatement(int periods_arg, const SymbolList &symbol_list_arg);
  virtual void writeOutput(ostream &output, const string &basename) const;
};

524
525
526
527
528
529
530
531
class CalibSmootherStatement : public Statement
{
private:
  const SymbolList symbol_list;
  const OptionsList options_list;
public:
  CalibSmootherStatement(const SymbolList &symbol_list_arg,
                         const OptionsList &options_list_arg);
532
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
533
534
535
  virtual void writeOutput(ostream &output, const string &basename) const;
};

536
537
538
539
540
541
542
543
544
545
class ExtendedPathStatement : public Statement
{
private:
  const OptionsList options_list;
public:
  ExtendedPathStatement(const OptionsList &options_list_arg);
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
  virtual void writeOutput(ostream &output, const string &basename) const;
};

houtanb's avatar
houtanb committed
546
547
548
class SvarIdentificationStatement : public Statement
{
public:
549
550
551
552
553
554
555
556
557
558
559
  //  typedef map<pair<int, int>, vector<int> > svar_identification_exclusion_t;
  struct svar_identification_restriction
  {
    int equation;
    int restriction_nbr;
    int lag;
    int variable;
    expr_t value;
  };    

  typedef vector< svar_identification_restriction > svar_identification_restrictions_t;
houtanb's avatar
houtanb committed
560
private:
561
  const svar_identification_restrictions_t restrictions;
houtanb's avatar
houtanb committed
562
563
  const bool upper_cholesky_present;
  const bool lower_cholesky_present;
564
  const bool constants_exclusion_present;
houtanb's avatar
houtanb committed
565
566
567
  const SymbolTable &symbol_table;
  int getMaxLag() const;
public:
568
  SvarIdentificationStatement(const svar_identification_restrictions_t &restrictions_arg,
houtanb's avatar
houtanb committed
569
570
                              const bool &upper_cholesky_present_arg,
                              const bool &lower_cholesky_present_arg,
571
			      const bool &constants_exclusion_present_arg,
houtanb's avatar
houtanb committed
572
                              const SymbolTable &symbol_table_arg);
573
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
houtanb's avatar
houtanb committed
574
575
576
  virtual void writeOutput(ostream &output, const string &basename) const;
};

houtanb's avatar
houtanb committed
577
578
579
580
class MarkovSwitchingStatement : public Statement
{
private:
  const OptionsList options_list;
581
  map <pair<int, int >, double > restriction_map;
houtanb's avatar
houtanb committed
582
583
public:
  MarkovSwitchingStatement(const OptionsList &options_list_arg);
584
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
houtanb's avatar
houtanb committed
585
  virtual void writeOutput(ostream &output, const string &basename) const;
Houtan Bastani's avatar
Houtan Bastani committed
586
  virtual void writeCOutput(ostream &output, const string &basename);
houtanb's avatar
houtanb committed
587
588
};

houtanb's avatar
houtanb committed
589
590
591
592
593
594
class SvarStatement : public Statement
{
private:
  const OptionsList options_list;
public:
  SvarStatement(const OptionsList &options_list_arg);
595
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
houtanb's avatar
houtanb committed
596
597
598
  virtual void writeOutput(ostream &output, const string &basename) const;
};

599
600
601
602
603
604
605
606
607
class SetTimeStatement : public Statement
{
private:
  const OptionsList options_list;
public:
  SetTimeStatement(const OptionsList &options_list_arg);
  virtual void writeOutput(ostream &output, const string &basename) const;
};

608
609
610
611
612
613
class EstimationDataStatement : public Statement
{
private:
  const OptionsList options_list;
public:
  EstimationDataStatement(const OptionsList &options_list_arg);
614
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
615
616
617
  virtual void writeOutput(ostream &output, const string &basename) const;
};

618
619
620
621
622
623
624
625
626
class SubsamplesStatement : public Statement
{
public:
  //! Storage for declaring subsamples: map<subsample_name, <date1, date2 >
  typedef map<string, pair<string, string> > subsample_declaration_map_t;
private:
  const string name1;
  const string name2;
  const subsample_declaration_map_t subsample_declaration_map;
627
  const SymbolTable symbol_table;
628
629
630
public:
  SubsamplesStatement(const string &name1_arg,
                      const string &name2_arg,
631
632
                      const subsample_declaration_map_t subsample_declaration_map_arg,
                      const SymbolTable &symbol_table_arg);
633
634
635
636
637
638
639
640
641
642
643
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
  virtual void writeOutput(ostream &output, const string &basename) const;
};

class SubsamplesEqualStatement : public Statement
{
private:
  const string to_name1;
  const string to_name2;
  const string from_name1;
  const string from_name2;
644
  const SymbolTable symbol_table;
645
646
647
648
public:
  SubsamplesEqualStatement(const string &to_name1_arg,
                           const string &to_name2_arg,
                           const string &from_name1_arg,
649
650
                           const string &from_name2_arg,
                           const SymbolTable &symbol_table_arg);
651
652
653
  virtual void writeOutput(ostream &output, const string &basename) const;
};

654
655
656
657
658
659
class BasicPriorStatement : public Statement
{
public:
  virtual ~BasicPriorStatement();
protected:
  const string name;
660
  const string subsample_name;
661
  const PriorDistributions prior_shape;
662
663
664
  const expr_t variance;
  const OptionsList options_list;
  BasicPriorStatement(const string &name_arg,
665
                      const string &subsample_name_arg,
666
                      const PriorDistributions &prior_shape_arg,
667
668
                      const expr_t &variance_arg,
                      const OptionsList &options_list_arg);
669
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
670
  void get_base_name(const SymbolType symb_type, string &lhs_field) const;
671
672
  void writeCommonOutput(ostream &output, const string &lhs_field) const;
  void writeCommonOutputHelper(ostream &output, const string &field, const string &lhs_field) const;
673
  void writePriorOutput(ostream &output, string &lhs_field, const string &name2) const;
Houtan Bastani's avatar
Houtan Bastani committed
674
675
676
677
678
679
680
681
682
  bool is_structural_innovation(const SymbolType symb_type) const;
  void writePriorIndex(ostream &output, const string &lhs_field) const;
  void writeVarianceOption(ostream &output, const string &lhs_field) const;
  void writeOutputHelper(ostream &output, const string &field, const string &lhs_field) const;
  void writeShape(ostream &output, const string &lhs_field) const;
  void writeCOutputHelper(ostream &output, const string &field) const;
  void writeCShape(ostream &output) const;
  void writeCVarianceOption(ostream &output) const;
  void writeCDomain(ostream &output) const;
683
684
685
686
687
688
};

class PriorStatement : public BasicPriorStatement
{
public:
  PriorStatement(const string &name_arg,
689
                 const string &subsample_name_arg,
690
                 const PriorDistributions &prior_shape_arg,
691
692
693
                 const expr_t &variance_arg,
                 const OptionsList &options_list_arg);
  virtual void writeOutput(ostream &output, const string &basename) const;
Houtan Bastani's avatar
Houtan Bastani committed
694
  virtual void writeCOutput(ostream &output, const string &basename);
695
696
697
698
699
700
701
702
};

class StdPriorStatement : public BasicPriorStatement
{
private:
  const SymbolTable symbol_table;
public:
  StdPriorStatement(const string &name_arg,
703
                    const string &subsample_name_arg,
704
                    const PriorDistributions &prior_shape_arg,
705
706
707
708
                    const expr_t &variance_arg,
                    const OptionsList &options_list_arg,
                    const SymbolTable &symbol_table_arg);
  virtual void writeOutput(ostream &output, const string &basename) const;
Houtan Bastani's avatar
Houtan Bastani committed
709
  virtual void writeCOutput(ostream &output, const string &basename);
710
711
712
713
714
715
716
717
718
719
};

class CorrPriorStatement : public BasicPriorStatement
{
private:
  const string name1;
  const SymbolTable symbol_table;
public:
  CorrPriorStatement(const string &name_arg1,
                     const string &name_arg2,
720
                     const string &subsample_name_arg,
721
                     const PriorDistributions &prior_shape_arg,
722
723
724
                     const expr_t &variance_arg,
                     const OptionsList &options_list_arg,
                     const SymbolTable &symbol_table_arg);
725
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
726
  virtual void writeOutput(ostream &output, const string &basename) const;
Houtan Bastani's avatar
Houtan Bastani committed
727
  virtual void writeCOutput(ostream &output, const string &basename);
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
};

class PriorEqualStatement : public Statement
{
private:
  const string to_declaration_type;
  const string to_name1;
  const string to_name2;
  const string to_subsample_name;
  const string from_declaration_type;
  const string from_name1;
  const string from_name2;
  const string from_subsample_name;
  const SymbolTable symbol_table;
public:
  PriorEqualStatement(const string &to_declaration_type_arg,
                      const string &to_name1_arg,
                      const string &to_name2_arg,
                      const string &to_subsample_name_arg,
                      const string &from_declaration_type_arg,
                      const string &from_name1_arg,
                      const string &from_name2_arg,
                      const string &from_subsample_name_arg,
                      const SymbolTable &symbol_table_arg);
  void get_base_name(const SymbolType symb_type, string &lhs_field) const;
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
  virtual void writeOutput(ostream &output, const string &basename) const;
755
};
756

757
758
759
760
761
762
class BasicOptionsStatement : public Statement
{
public:
  virtual ~BasicOptionsStatement();
protected:
  const string name;
763
  const string subsample_name;
764
765
  const OptionsList options_list;
  BasicOptionsStatement(const string &name_arg,
766
767
                        const string &subsample_name_arg,
                        const OptionsList &options_list_arg);
768
  void get_base_name(const SymbolType symb_type, string &lhs_field) const;
769
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
770
  void writeOptionsOutput(ostream &output, string &lhs_field, const string &name2) const;
771
772
  void writeCommonOutput(ostream &output, const string &lhs_field) const;
  void writeCommonOutputHelper(ostream &output, const string &field, const string &lhs_field) const;
773
774
775
776
  bool is_structural_innovation(const SymbolType symb_type) const;
  void writeOptionsIndex(ostream &output, const string &lhs_field) const;
  void writeOutputHelper(ostream &output, const string &field, const string &lhs_field) const;
  void writeCOutputHelper(ostream &output, const string &field) const;
777
778
779
780
781
};

class OptionsStatement : public BasicOptionsStatement
{
public:
782
  OptionsStatement(const string &name_arg, const string &subsample_name_arg, const OptionsList &options_list_arg);
783
  virtual void writeOutput(ostream &output, const string &basename) const;
784
  virtual void writeCOutput(ostream &output, const string &basename);
785
786
787
788
789
790
791
};

class StdOptionsStatement : public BasicOptionsStatement
{
private:
  const SymbolTable symbol_table;
public:
792
793
794
795
  StdOptionsStatement(const string &name_arg,
                      const string &subsample_name_arg,
                      const OptionsList &options_list_arg,
                      const SymbolTable &symbol_table_arg);
796
  virtual void writeOutput(ostream &output, const string &basename) const;
797
  virtual void writeCOutput(ostream &output, const string &basename);
798
799
800
801
802
803
804
805
806
};

class CorrOptionsStatement : public BasicOptionsStatement
{
private:
  const string name1;
  const SymbolTable symbol_table;
public:
  CorrOptionsStatement(const string &name_arg1, const string &name_arg2,
807
808
809
                       const string &subsample_name_arg,
                       const OptionsList &options_list_arg,
                       const SymbolTable &symbol_table_arg);
810
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
811
  virtual void writeOutput(ostream &output, const string &basename) const;
Houtan Bastani's avatar
Houtan Bastani committed
812
  virtual void writeCOutput(ostream &output, const string &basename);
813
814
};

815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
class OptionsEqualStatement : public Statement
{
private:
  const string to_declaration_type;
  const string to_name1;
  const string to_name2;
  const string to_subsample_name;
  const string from_declaration_type;
  const string from_name1;
  const string from_name2;
  const string from_subsample_name;
  const SymbolTable symbol_table;
public:
  OptionsEqualStatement(const string &to_declaration_type_arg,
                        const string &to_name1_arg,
                        const string &to_name2_arg,
                        const string &to_subsample_name_arg,
                        const string &from_declaration_type_arg,
                        const string &from_name1_arg,
                        const string &from_name2_arg,
                        const string &from_subsample_name_arg,
                        const SymbolTable &symbol_table_arg);
  void get_base_name(const SymbolType symb_type, string &lhs_field) const;
  virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
  virtual void writeOutput(ostream &output, const string &basename) const;
};

842
843
844
845
846
847
848
class ModelDiagnosticsStatement : public Statement
{
public:
  ModelDiagnosticsStatement();
  virtual void writeOutput(ostream &output, const string &basename) const;
};

849
#endif