Logo
Reference manual - version ored_version
Public Types | Public Member Functions | List of all members
Report Class Referenceabstract

#include <ored/report/report.hpp>

+ Inheritance diagram for Report:

Public Types

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

Public Member Functions

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();