PRISM
 v0.0.0
Loading...
Searching...
No Matches
TableWriterBase.h
1#pragma once
2
3#include <sstream>
4#include <string>
5#include <vector>
6#include <map>
7#include <memory>
8namespace prism
9{
10class Reaction;
12{
13public:
20 TableWriterBase(unsigned int max_rows = 32)
22 {
23 }
24
28 void clear()
29 {
30 _rxn_count = 0;
31 _note_count = 0;
32 _table_str.str("");
33 _table_str.clear();
34 }
35
40 unsigned int maxRows() { return _max_rows_per_table; }
44 std::stringstream & tableString() { return _table_str; }
48 virtual void beginDocument(const std::vector<std::string> & bib_files) = 0;
52 virtual void endDocument() = 0;
57 virtual void beginRateBasedSection() = 0;
62 virtual void beginXSecBasedSection() = 0;
66 virtual void beginFunctionalTable() = 0;
70 virtual void endFunctionalTable() = 0;
75 virtual void beginTabulatedTable() = 0;
80 virtual void endTabulatedTable() = 0;
85 virtual void addFunctionalReaction(const std::shared_ptr<const Reaction> & r) = 0;
90 virtual void addTabulatedReaction(const std::shared_ptr<const Reaction> & r) = 0;
96 virtual void addNotes(const std::vector<std::string> & notes) = 0;
97
98protected:
100 const unsigned int _max_rows_per_table;
102 unsigned int _rxn_count;
104 unsigned int _note_count;
106 std::stringstream _table_str;
109 std::map<std::string, unsigned int> _note_numbers;
110 std::map<unsigned int, std::string> _inverse_note_numbers;
112};
113}
Definition TableWriterBase.h:12
const unsigned int _max_rows_per_table
the maximum number of reactions allowed per table
Definition TableWriterBase.h:100
unsigned int _note_count
a counter for all of the notes that have been added to the table
Definition TableWriterBase.h:104
virtual void endTabulatedTable()=0
Adds the end of the table for reactions which have data that is collected from a file.
void clear()
clears the state of the writer before a new writing
Definition TableWriterBase.h:28
std::map< std::string, unsigned int > _note_numbers
helper mappings between notes and their corrisponding numbering
Definition TableWriterBase.h:109
TableWriterBase(unsigned int max_rows=32)
Helper for generating a latex table based on the reaction mechanism.
Definition TableWriterBase.h:20
virtual void beginTabulatedTable()=0
Adds the beginning of the table for reactions which have data that is collected from a file.
virtual void beginFunctionalTable()=0
Adds the beginning of the table for reactions which have functional data.
virtual void endDocument()=0
Adds the end of the document.
std::stringstream & tableString()
Getter method for the stream to actually write the summary to file.
Definition TableWriterBase.h:44
virtual void addFunctionalReaction(const std::shared_ptr< const Reaction > &r)=0
Specification for how to format a row for a single reaction which has data that can be sampled via a ...
unsigned int maxRows()
Getter method for the maximum number of reactions allowed in a single table.
Definition TableWriterBase.h:40
virtual void beginDocument(const std::vector< std::string > &bib_files)=0
Adds the document preamble to start of the latex doc.
unsigned int _rxn_count
a counter for reactions in the network
Definition TableWriterBase.h:102
virtual void beginRateBasedSection()=0
Adds a section header before the rate based reactions are put in the table.
virtual void addNotes(const std::vector< std::string > &notes)=0
Method for adding notes to the end of a single reaction additionally this method should be used to he...
virtual void endFunctionalTable()=0
Adds the end of the table for reactions which have functional data.
virtual void addTabulatedReaction(const std::shared_ptr< const Reaction > &r)=0
Specification for how to format a row for a single reaction which has data that is collected from a f...
std::stringstream _table_str
the string stream that is used to created the summary
Definition TableWriterBase.h:106
virtual void beginXSecBasedSection()=0
Adds a section header before the cross section based reactions are put in the table.