CbmRoot
CbmReport.h
Go to the documentation of this file.
1 
8 #ifndef CBMREPORT_H_
9 #define CBMREPORT_H_
10 
11 #include <Rtypes.h> // for THashConsistencyHolder, ClassDef
12 #include <RtypesCore.h> // for Int_t, Option_t
13 #include <TObject.h> // for TObject
14 
15 #include <iostream> // for string, ostream
16 #include <vector> // for vector
17 
18 class CbmReportElement;
19 class TCanvas;
20 
28 
35 class CbmReport : public TObject {
36 public:
40  CbmReport();
41 
45  virtual ~CbmReport();
46 
51  const CbmReportElement* R() const { return fR; }
52 
56  std::ostream& Out() const { return *fOut; }
57 
58  /* Setters */
59  void SetReportName(const std::string& name) { fReportName = name; }
60  void SetReportTitle(const std::string& title) { fReportTitle = title; }
61  void SetOutputDir(const std::string& outputDir) { fOutputDir = outputDir; }
62 
63  /* Accessors */
64  const std::string& GetReportName() const { return fReportName; }
65  const std::string& GetReportTitle() const { return fReportTitle; }
66  const std::string& GetOutputDir() const { return fOutputDir; }
67 
68 protected:
74  virtual void Create() = 0;
75 
81  virtual void Draw() = 0;
82 
87  void Draw(Option_t*) { ; }
88 
89 
93  void CreateReports();
94 
100  TCanvas*
101  CreateCanvas(const char* name, const char* title, Int_t ww, Int_t wh);
102 
106  void SaveCanvasesAsImages() const;
107 
111  void WriteCanvases() const;
112 
116  void PrintCanvases() const;
117 
118 private:
123  void CreateReportElement(ReportType reportType);
124 
128  void DeleteReportElement();
129 
130  std::string fReportName; // Name of report
131  std::string fReportTitle; // Title of report
132  std::string fOutputDir; // Output directory for the report files
133  ReportType fReportType; // Current report type
134  CbmReportElement* fR; // Report element tool
135  mutable std::ostream* fOut; // Output stream
136 
137  // Storage for TCanvas. All Canvases in this vector will be automatically saved
138  // to image and printed in the report.
139  // User can use CreateCanvas function which automatically push created canvas in this vector.
140  std::vector<TCanvas*> fCanvases;
141 
142  //private:
143 
146 
147  ClassDef(CbmReport, 1)
148 };
149 
150 #endif /* CBMREPORT_H_ */
CbmReport::CreateCanvas
TCanvas * CreateCanvas(const char *name, const char *title, Int_t ww, Int_t wh)
Create canvas and put it to vector of TCanvases. Canvases created with this function will be automati...
Definition: CbmReport.cxx:82
CbmReport::~CbmReport
virtual ~CbmReport()
Destructor.
Definition: CbmReport.cxx:34
kLatexReport
@ kLatexReport
Definition: CbmReport.h:27
CbmReport::GetReportTitle
const std::string & GetReportTitle() const
Definition: CbmReport.h:65
kHtmlReport
@ kHtmlReport
Definition: CbmReport.h:27
CbmReport::CbmReport
CbmReport(const CbmReport &)
CbmReport::fR
CbmReportElement * fR
Definition: CbmReport.h:134
CbmReport::fOutputDir
std::string fOutputDir
Definition: CbmReport.h:132
kCoutReport
@ kCoutReport
Definition: CbmReport.h:27
CbmReport::DeleteReportElement
void DeleteReportElement()
Delete report element. Normally should be called at the end of Create function.
Definition: CbmReport.cxx:55
CbmReport::GetReportName
const std::string & GetReportName() const
Definition: CbmReport.h:64
CbmReport::R
const CbmReportElement * R() const
Accessor to CbmReportElement object. User has to write the report using available tags from CbmReport...
Definition: CbmReport.h:51
ReportType
ReportType
Enumeration defines different report types.
Definition: CbmReport.h:27
kTextReport
@ kTextReport
Definition: CbmReport.h:27
CbmReport::SetReportName
void SetReportName(const std::string &name)
Definition: CbmReport.h:59
CbmReport::operator=
CbmReport & operator=(const CbmReport &)
CbmReport::fOut
std::ostream * fOut
Definition: CbmReport.h:135
CbmReport::PrintCanvases
void PrintCanvases() const
Print images created from canvases in the report.
Definition: CbmReport.cxx:109
CbmReport::WriteCanvases
void WriteCanvases() const
Write canvases to file.
Definition: CbmReport.cxx:101
CbmReport::fCanvases
std::vector< TCanvas * > fCanvases
Definition: CbmReport.h:140
CbmReport::Draw
virtual void Draw()=0
Pure abstract function which is called from public Create() function. This function has to draw all n...
CbmReport::SaveCanvasesAsImages
void SaveCanvasesAsImages() const
Save all canvases to images.
Definition: CbmReport.cxx:91
CbmReport::CreateReportElement
void CreateReportElement(ReportType reportType)
Create concrete CbmReportElement instance based on report type.
Definition: CbmReport.cxx:36
CbmReport::Draw
void Draw(Option_t *)
Inherited from TObject. This method is implemented in order to avoid warnings.
Definition: CbmReport.h:87
CbmReport::GetOutputDir
const std::string & GetOutputDir() const
Definition: CbmReport.h:66
CbmReport::Out
std::ostream & Out() const
All text output goes to this stream.
Definition: CbmReport.h:56
CbmReport::fReportType
ReportType fReportType
Definition: CbmReport.h:133
CbmReport::CbmReport
CbmReport()
Constructor.
Definition: CbmReport.cxx:24
CbmReport
Base class for reports.
Definition: CbmReport.h:35
CbmReport::Create
virtual void Create()=0
Pure abstract function which is called from public Create() function. This function has to write repo...
CbmReport::fReportTitle
std::string fReportTitle
Definition: CbmReport.h:131
CbmReportElement
Abstract class for basic report elements (headers, tables, images etc.).
Definition: CbmReportElement.h:32
CbmReport::CreateReports
void CreateReports()
Create all available report types.
Definition: CbmReport.cxx:60
CbmReport::fReportName
std::string fReportName
Definition: CbmReport.h:130
CbmReport::SetReportTitle
void SetReportTitle(const std::string &title)
Definition: CbmReport.h:60
CbmReport::SetOutputDir
void SetOutputDir(const std::string &outputDir)
Definition: CbmReport.h:61