Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
Report Class Referenceabstract

#include <ored/report/report.hpp>

+ Inheritance diagram for Report:
+ Collaboration diagram for Report:

Public Types

typedef boost::variant< Size, Real, string, Date, Period > ReportType
 

Public Member Functions

virtual ~Report ()
 
virtual ReportaddColumn (const string &name, const ReportType &, Size precision=0)=0
 
virtual Reportnext ()=0
 
virtual Reportadd (const ReportType &rt)=0
 
virtual void end ()=0
 
virtual void flush ()
 

Detailed Description

Abstract Report interface class

A Report can be thought of as a CSV file or SQL table, it has columns (each with a name and type) which are set before we add any data, then each row of data is added with calls to add().

ReportType is a boost::variant which covers all the allowable types for a report.

Usage of the report API is as follows

   Report npv_report = makeReport();

   // create headers
   npv_report.addColumn("Id", string())
             .addColumn("NPV", double(), 2)
             .addColumn("CP", string());

   // add rows
   npv_report.next().add("t1").add(123.45).add("cp");
   npv_report.next().add("t2").add(3.14).add("cp");
   npv_report.next().add("t3").add(100.0).add("cp2");
   npv_report.end();
   

Definition at line 64 of file report.hpp.

Member Typedef Documentation

◆ ReportType

typedef boost::variant<Size, Real, string, Date, Period> ReportType

Definition at line 66 of file report.hpp.

Constructor & Destructor Documentation

◆ ~Report()

virtual ~Report ( )
virtual

Definition at line 68 of file report.hpp.

68{}

Member Function Documentation

◆ addColumn()

virtual Report & addColumn ( const string &  name,
const ReportType ,
Size  precision = 0 
)
pure virtual

Implemented in CSVFileReport, and InMemoryReport.

◆ next()

virtual Report & next ( )
pure virtual

Implemented in CSVFileReport, and InMemoryReport.

◆ add()

virtual Report & add ( const ReportType rt)
pure virtual

Implemented in CSVFileReport, and InMemoryReport.

◆ end()

virtual void end ( )
pure virtual

Implemented in CSVFileReport, and InMemoryReport.

◆ flush()

virtual void flush ( )
virtual

Reimplemented in CSVFileReport.

Definition at line 74 of file report.hpp.

74{}