RAPIDO
Repeatable Analysis Programming for Interpretability, Durability, and Organization
Loading...
Searching...
No Matches
Utilities::CSVFile Class Reference

#include <utilities.h>

Public Member Functions

 CSVFile (std::ofstream &new_ofstream, std::string new_name, std::vector< std::string > new_headers)
 
virtual ~CSVFile ()
 
CSVFile clone (std::string new_name)
 
template<typename Type >
void pushCol (Type value)
 
void writeRow (bool append=true)
 

Public Attributes

std::ofstream & ofstream
 
std::string name
 
std::vector< std::string > headers
 
std::vector< std::string > buffer
 

Detailed Description

Object for handling CSV I/O

Constructor & Destructor Documentation

◆ CSVFile()

Utilities::CSVFile::CSVFile ( std::ofstream & new_ofstream,
std::string new_name,
std::vector< std::string > new_headers )

CSVFile object constructor

Parameters
new_ofstreamreference of an existing ofstream object
new_namename of new CSV file (e.g. output.csv)
new_headersheaders for new CSV file columns
Returns
none

◆ ~CSVFile()

virtual Utilities::CSVFile::~CSVFile ( )
virtual

CSVFile object destructor

Returns
none

Member Function Documentation

◆ clone()

CSVFile Utilities::CSVFile::clone ( std::string new_name)

Clone CSVFile object and copy the existing CSV file to a new file

Parameters
new_namename of new CSV file (e.g. output.csv)
Returns
new CSVFile object

◆ pushCol()

template<typename Type >
void Utilities::CSVFile::pushCol ( Type value)

Push a new column entry to buffer

Template Parameters
Typetype of column entry
Parameters
valuenew column entry
Returns
none

◆ writeRow()

void Utilities::CSVFile::writeRow ( bool append = true)

Write buffer to CSV file

Parameters
appendToggle "append" mode (optional)
Returns
none

Member Data Documentation

◆ buffer

std::vector<std::string> Utilities::CSVFile::buffer

Buffer for staging column values

◆ headers

std::vector<std::string> Utilities::CSVFile::headers

Headers for CSV columns

◆ name

std::string Utilities::CSVFile::name

Name (e.g. output.csv) of CSV file

◆ ofstream

std::ofstream& Utilities::CSVFile::ofstream

fstream object for writing files


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