1 : |
agomez |
1 |
#ifndef printer_h
|
2 : |
|
|
#define printer_h
|
3 : |
|
|
|
4 : |
|
|
#include "actionattimes.h" |
5 : |
|
|
#include "areatime.h" |
6 : |
|
|
#include "lengthgroup.h" |
7 : |
|
|
#include "commentstream.h" |
8 : |
|
|
#include "predatorptrvector.h" |
9 : |
|
|
#include "preyptrvector.h" |
10 : |
|
|
#include "stockptrvector.h" |
11 : |
|
|
#include "fleetptrvector.h" |
12 : |
|
|
#include "likelihoodptrvector.h" |
13 : |
|
|
#include "charptrvector.h" |
14 : |
|
|
#include "intmatrix.h" |
15 : |
|
|
#include "gadget.h" |
16 : |
|
|
|
17 : |
|
|
enum PrinterType { STOCKPRINTER = 1, PREDATORPRINTER, PREDATOROVERPRINTER,
|
18 : |
|
|
PREYOVERPRINTER, STOCKSTDPRINTER, STOCKPREYFULLPRINTER, STOCKFULLPRINTER,
|
19 : |
|
|
LIKELIHOODPRINTER, LIKELIHOODSUMMARYPRINTER, STOCKPREYPRINTER, PREDATORPREYPRINTER };
|
20 : |
|
|
|
21 : |
|
|
/**
|
22 : |
|
|
* \class Printer
|
23 : |
|
|
* \brief This is the base class used to print the modelled population during a model simulation
|
24 : |
|
|
* \note This will always be overridden by the derived classes that actually print the required information
|
25 : |
|
|
*/
|
26 : |
|
|
class Printer {
|
27 : |
|
|
public:
|
28 : |
|
|
/**
|
29 : |
|
|
* \brief This is the default Printer constructor
|
30 : |
|
|
* \param ptype is the PrinterType of the printer
|
31 : |
|
|
*/
|
32 : |
|
|
Printer(PrinterType ptype) { type = ptype; };
|
33 : |
|
|
/**
|
34 : |
|
|
* \brief This is the default Printer destructor
|
35 : |
|
|
*/
|
36 : |
|
|
virtual ~Printer() { delete[] filename; };
|
37 : |
|
|
/**
|
38 : |
|
|
* \brief This will print the requested information for the printer class to the ofstream specified
|
39 : |
|
|
* \param TimeInfo is the TimeClass for the current model
|
40 : |
|
|
* \param printtime is the flag to denote when the printing is taking place
|
41 : |
|
|
*/
|
42 : |
|
|
virtual void Print(const TimeClass* const TimeInfo, int printtime) = 0;
|
43 : |
|
|
/**
|
44 : |
|
|
* \brief This will select the stocks required for the printer class to print the requested information
|
45 : |
|
|
* \param stockvec is the StockPtrVector of all the available stocks
|
46 : |
|
|
* \param Area is the AreaClass for the current model
|
47 : |
|
|
*/
|
48 : |
|
|
virtual void setStock(StockPtrVector& stockvec, const AreaClass* const Area) {};
|
49 : |
|
|
/**
|
50 : |
|
|
* \brief This will select the predators and preys required for the printer class to print the requested information
|
51 : |
|
|
* \param predatorvec is the PredatorPtrVector of all the available predators
|
52 : |
|
|
* \param preyvec is the PreyPtrVector of all the available preys
|
53 : |
|
|
* \param Area is the AreaClass for the current model
|
54 : |
|
|
*/
|
55 : |
|
|
virtual void setPredAndPrey(PredatorPtrVector& predatorvec, PreyPtrVector& preyvec, const AreaClass* const Area) {};
|
56 : |
|
|
/**
|
57 : |
|
|
* \brief This will select the preys required for the printer class to print the requested information
|
58 : |
|
|
* \param preyvec is the PreyPtrVector of all the available preys
|
59 : |
|
|
* \param Area is the AreaClass for the current model
|
60 : |
|
|
*/
|
61 : |
|
|
virtual void setPrey(PreyPtrVector& preyvec, const AreaClass* const Area) {};
|
62 : |
|
|
/**
|
63 : |
|
|
* \brief This will select the predators required for the printer class to print the requested information
|
64 : |
|
|
* \param predatorvec is the PredatorPtrVector of all the available predators
|
65 : |
|
|
* \param Area is the AreaClass for the current model
|
66 : |
|
|
*/
|
67 : |
|
|
virtual void setPredator(PredatorPtrVector& predatorvec, const AreaClass* const Area) {};
|
68 : |
|
|
/**
|
69 : |
|
|
* \brief This will select the likelihood components required for the printer class to print the requested information
|
70 : |
|
|
* \param likevec is the LikelihoodPtrVector of all the available likelihood components
|
71 : |
|
|
*/
|
72 : |
|
|
virtual void setLikelihood(LikelihoodPtrVector& likevec) {};
|
73 : |
|
|
/**
|
74 : |
|
|
* \brief This will return the name of the output file
|
75 : |
|
|
* \return name
|
76 : |
|
|
*/
|
77 : |
|
|
const char* getFileName() const { return filename; };
|
78 : |
|
|
/**
|
79 : |
|
|
* \brief This will return the type of printer class
|
80 : |
|
|
* \return type
|
81 : |
|
|
*/
|
82 : |
|
|
PrinterType getType() const { return type; };
|
83 : |
|
|
protected:
|
84 : |
|
|
/**
|
85 : |
|
|
* \brief This ActionAtTimes stores information about when the printer output is required in the model
|
86 : |
|
|
*/
|
87 : |
|
|
ActionAtTimes AAT;
|
88 : |
|
|
/**
|
89 : |
|
|
* \brief This is the name of the output file that all the model information will get sent to
|
90 : |
|
|
*/
|
91 : |
|
|
char* filename;
|
92 : |
|
|
/**
|
93 : |
|
|
* \brief This ofstream is the file that all the model information gets sent to
|
94 : |
|
|
*/
|
95 : |
|
|
ofstream outfile;
|
96 : |
|
|
/**
|
97 : |
|
|
* \brief This is the flag used to denote whether the printing takes place at the start or the end of the timestep
|
98 : |
|
|
* \note The default value is 0, which corresponds to printing at the end of the timestep
|
99 : |
|
|
*/
|
100 : |
|
|
int printtimeid;
|
101 : |
|
|
/**
|
102 : |
|
|
* \brief This is precision which can be used to override the default values when printing the information to the output file
|
103 : |
|
|
* \note The default value is 0, which corresponds to using values specified in gadget.h
|
104 : |
|
|
*/
|
105 : |
|
|
int precision;
|
106 : |
|
|
/**
|
107 : |
|
|
* \brief This is width used when printing the information to the output file
|
108 : |
|
|
* \note This value is set to precision + 4
|
109 : |
|
|
*/
|
110 : |
|
|
int width;
|
111 : |
|
|
private:
|
112 : |
|
|
/**
|
113 : |
|
|
* \brief This denotes what type of printer class has been created
|
114 : |
|
|
*/
|
115 : |
|
|
PrinterType type;
|
116 : |
|
|
};
|
117 : |
|
|
|
118 : |
|
|
#endif
|