Gadget
printer.h
Go to the documentation of this file.
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 
20 
26 class Printer {
27 public:
32  Printer(PrinterType ptype) { type = ptype; };
36  virtual ~Printer() { delete[] filename; };
42  virtual void Print(const TimeClass* const TimeInfo, int printtime) = 0;
48  virtual void setStock(StockPtrVector& stockvec, const AreaClass* const Area) {};
55  virtual void setPredAndPrey(PredatorPtrVector& predatorvec, PreyPtrVector& preyvec, const AreaClass* const Area) {};
61  virtual void setPrey(PreyPtrVector& preyvec, const AreaClass* const Area) {};
67  virtual void setPredator(PredatorPtrVector& predatorvec, const AreaClass* const Area) {};
72  virtual void setLikelihood(LikelihoodPtrVector& likevec) {};
77  const char* getFileName() const { return filename; };
82  PrinterType getType() const { return type; };
83 protected:
91  char* filename;
95  ofstream outfile;
110  int width;
111 private:
115  PrinterType type;
116 };
117 
118 #endif
This is the class used to associate actions with specific timesteps within the model.
Definition: actionattimes.h:14
This is the class used to store information about the areas used for the current model.
Definition: areatime.h:18
This class implements a dynamic vector of Likelihood values.
Definition: likelihoodptrvector.h:10
This class implements a dynamic vector of Predator values.
Definition: predatorptrvector.h:10
This class implements a dynamic vector of Prey values.
Definition: preyptrvector.h:10
This is the base class used to print the modelled population during a model simulation.
Definition: printer.h:26
Printer(PrinterType ptype)
This is the default Printer constructor.
Definition: printer.h:32
const char * getFileName() const
This will return the name of the output file.
Definition: printer.h:77
virtual void Print(const TimeClass *const TimeInfo, int printtime)=0
This will print the requested information for the printer class to the ofstream specified.
char * filename
This is the name of the output file that all the model information will get sent to.
Definition: printer.h:91
ActionAtTimes AAT
This ActionAtTimes stores information about when the printer output is required in the model.
Definition: printer.h:82
virtual void setPrey(PreyPtrVector &preyvec, const AreaClass *const Area)
This will select the preys required for the printer class to print the requested information.
Definition: printer.h:61
virtual void setPredator(PredatorPtrVector &predatorvec, const AreaClass *const Area)
This will select the predators required for the printer class to print the requested information.
Definition: printer.h:67
ofstream outfile
This ofstream is the file that all the model information gets sent to.
Definition: printer.h:95
virtual void setLikelihood(LikelihoodPtrVector &likevec)
This will select the likelihood components required for the printer class to print the requested info...
Definition: printer.h:72
int width
This is width used when printing the information to the output file.
Definition: printer.h:110
PrinterType getType() const
This will return the type of printer class.
Definition: printer.h:82
int printtimeid
This is the flag used to denote whether the printing takes place at the start or the end of the times...
Definition: printer.h:100
int precision
This is precision which can be used to override the default values when printing the information to t...
Definition: printer.h:105
virtual ~Printer()
This is the default Printer destructor.
Definition: printer.h:36
virtual void setPredAndPrey(PredatorPtrVector &predatorvec, PreyPtrVector &preyvec, const AreaClass *const Area)
This will select the predators and preys required for the printer class to print the requested inform...
Definition: printer.h:55
virtual void setStock(StockPtrVector &stockvec, const AreaClass *const Area)
This will select the stocks required for the printer class to print the requested information.
Definition: printer.h:48
This class implements a dynamic vector of Stock values.
Definition: stockptrvector.h:10
This is the class used to store information about the timesteps used for the current model.
Definition: areatime.h:87
PrinterType
Definition: printer.h:17
@ PREDATOROVERPRINTER
Definition: printer.h:17
@ PREYOVERPRINTER
Definition: printer.h:18
@ STOCKPREYFULLPRINTER
Definition: printer.h:18
@ PREDATORPRINTER
Definition: printer.h:17
@ STOCKPRINTER
Definition: printer.h:17
@ LIKELIHOODSUMMARYPRINTER
Definition: printer.h:19
@ LIKELIHOODPRINTER
Definition: printer.h:19
@ STOCKPREYPRINTER
Definition: printer.h:19
@ STOCKSTDPRINTER
Definition: printer.h:18
@ PREDATORPREYPRINTER
Definition: printer.h:19
@ STOCKFULLPRINTER
Definition: printer.h:18