16#ifndef ROOT_WRITER_DEF_HPP
17#define ROOT_WRITER_DEF_HPP
110 PrinterFile(
const std::string& fname,
bool ow_mode);
122 PrinterDAT(
const std::string& fname,
bool ow_mode);
143 PrinterCSV(
const std::string& fname,
char sep,
bool ow_mode);
Abstract Printer class.
Definition writer_def.hpp:69
virtual ~PrinterBase()=default
Virtual destructor for the PrinterBase class.
PrinterBase()=default
Default constructor for the PrinterBase class.
virtual void write_values(const V &value)=0
Pure virtual method to write a given value.
The class to print out the values in the CLI.
Definition writer_def.hpp:84
void write_values(const V &value) override
Method to actually print a given value in the output.
PrinterCLI()
Constructor for the PrinterCLI class - just prints out a string.
Definition writer.hpp:68
Class to write on .csv the result.
Definition writer_def.hpp:132
void write_values(const V &value) override
Writes a given result into the .csv file with the sotred separator.
char separator
Separator for the .csv output file, given at construction time.
Definition writer_def.hpp:134
Class to write on .dat the result - daughter of FilePrinter and Mother of GnuPlotPrinter.
Definition writer_def.hpp:115
void write_values(const V &value) override
Writes a given result into the .dat file.
Mother class for all the Printers which print in a file.
Definition writer_def.hpp:97
bool append
Definition writer_def.hpp:100
std::ofstream file
The actual file, saved in order not to access it at each printing iteration.
Definition writer_def.hpp:102
std::string filename
The name of output file, without the extension.
Definition writer_def.hpp:99
Class Daughter of PrinterDAT to write on .dat (inherited) and produce a gnu plot for the results.
Definition writer_def.hpp:155
void generate_gnuplot_script() const
Calls the generation of the .png output plot.
Tester class for Writer class unit tests.
Definition writer_tester.hpp:22
Class to store required arguments and handle the printing flow.
Definition writer_def.hpp:33
Writer(const T &vals_to_write, WritingMethod write_method, std::string filename="output", char separator=',', bool overwrite=true)
Constructor for a Writer object.
char separator
Separator for .csv files.
Definition writer_def.hpp:46
void build_printer(std::unique_ptr< PrinterBase< V > > &printer)
Method to convert the generic Printer into a typed one for a specific output destination.
Definition writer.hpp:47
bool overwrite
Option to overwrite or append the output file.
Definition writer_def.hpp:47
void write()
Method to run the printing loop and correctly initialize the Printer.
WritingMethod method
Method to write with - defined thanks to.
Definition writer_def.hpp:45
std::string filename
Name of the output file.
Definition writer_def.hpp:48
T values
Templated values to write to allow different usage of the class.
Definition writer_def.hpp:44
WritingMethod
Definition writer_def.hpp:24
@ CONSOLE
Definition writer_def.hpp:24
@ CSV
Definition writer_def.hpp:24
@ DAT
Definition writer_def.hpp:24
@ GNUPLOT
Definition writer_def.hpp:24