geopm  3.1.1.dev272+gdfb40a8d
GEOPM - Global Extensible Open Power Manager
Public Member Functions | List of all members
geopm::CSV Class Referenceabstract

CSV class provides the GEOPM interface for creation of character separated value tabular data files. These CSV formatted files are created with a header containing some meta-data prefixed by the '#' character and then one line that defines the field name for the column. The separation character is a '|' not a comma. More...

#include <CSV.hpp>

Inheritance diagram for geopm::CSV:
Inheritance graph
[legend]

Public Member Functions

 CSV ()=default
 
virtual ~CSV ()=default
 
virtual void add_column (const std::string &name)=0
 Add a column with the given field name. The formatting of the column values will default to geopm::string_format_double(). More...
 
virtual void add_column (const std::string &name, const std::string &format)=0
 Add a column with the given field name. The formatting of the column values chosen based on the format string. More...
 
virtual void add_column (const std::string &name, std::function< std::string(double)> format)=0
 Add a column with the given field name. The formatting of the column values is implemented with the format function provided. More...
 
virtual void activate (void)=0
 Calling activate indicates that all columns have been added to the object and calls to update() are enabled. More...
 
virtual void update (const std::vector< double > &sample)=0
 Add a row to the CSV file. More...
 
virtual void flush (void)=0
 Flush all output to the CSV file. More...
 

Detailed Description

CSV class provides the GEOPM interface for creation of character separated value tabular data files. These CSV formatted files are created with a header containing some meta-data prefixed by the '#' character and then one line that defines the field name for the column. The separation character is a '|' not a comma.

Constructor & Destructor Documentation

◆ CSV()

geopm::CSV::CSV ( )
default

◆ ~CSV()

virtual geopm::CSV::~CSV ( )
virtualdefault

Member Function Documentation

◆ activate()

virtual void geopm::CSV::activate ( void  )
pure virtual

Calling activate indicates that all columns have been added to the object and calls to update() are enabled.

Implemented in geopm::CSVImp.

◆ add_column() [1/3]

virtual void geopm::CSV::add_column ( const std::string &  name)
pure virtual

Add a column with the given field name. The formatting of the column values will default to geopm::string_format_double().

Parameters
[in]nameThe field name for the column as it will be printed in the file header.

Implemented in geopm::CSVImp.

◆ add_column() [2/3]

virtual void geopm::CSV::add_column ( const std::string &  name,
const std::string &  format 
)
pure virtual

Add a column with the given field name. The formatting of the column values chosen based on the format string.

Parameters
[in]nameThe field name for the column as it will be printed in the file header.
[in]formatOne of five format strings:
  • "double": Floating point number with up to 16 significant decimal digits.
  • "float": Floating point number with up to 6 significant decimal digits.
  • "integer": Whole number printed in decimal.
  • "hex": Whole number printed in hexadecimal digits with 16 digits of zero padding.
  • "raw64": View of raw memory contained in signal printed as a 16 hexadecimal digit number.

Implemented in geopm::CSVImp.

◆ add_column() [3/3]

virtual void geopm::CSV::add_column ( const std::string &  name,
std::function< std::string(double)>  format 
)
pure virtual

Add a column with the given field name. The formatting of the column values is implemented with the format function provided.

Parameters
[in]nameThe field name for the column as it will be printed in the file header.
[in]formatFunction that converts a double precision signal into the printed string for this column in the CSV file.

Implemented in geopm::CSVImp.

◆ flush()

virtual void geopm::CSV::flush ( void  )
pure virtual

Flush all output to the CSV file.

Implemented in geopm::CSVImp.

◆ update()

virtual void geopm::CSV::update ( const std::vector< double > &  sample)
pure virtual

Add a row to the CSV file.

Parameters
[in]sampleValues for each column of the table in the order that the columns were added prior to calling activate().

Implemented in geopm::CSVImp.


The documentation for this class was generated from the following file: