NeoPZ
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
CSVTable< Tvar > Class Template Reference

#include <csvtable.h>

Public Member Functions

 CSVTable ()
 
unsigned addRows (unsigned n=1)
 
int getColIdx (const string &column_name)
 
unsigned addColumn (const string &col_name)
 
int setCell (unsigned row_idx, string col_name, string value, bool createNewCol=false)
 
int setCell (unsigned row_idx, string col_name, int value, bool createNewCol=false)
 
int setCell (unsigned row_idx, string col_name, long value, bool createNewCol=false)
 
int setCell (unsigned row_idx, string col_name, bool value, bool createNewCol=false)
 
int setCell (unsigned row_idx, string col_name, unsigned value, bool createNewCol=false)
 
int setCell (unsigned row_idx, string col_name, double value, bool createNewCol=false)
 
int setCell (unsigned row_idx, string col_name, float value, bool createNewCol=false)
 
unsigned nRows () const
 
void write (ostream &os) const
 
int read (istream &is)
 

Protected Member Functions

void split (vector< string > &theStringVector, const string &theString, const string &theDelimiter)
 

Static Protected Member Functions

static string & trim (string &s)
 

Protected Attributes

vector< CSVTableColumn< Tvar > > columns
 
unsigned nrows
 

Detailed Description

template<class Tvar>
class CSVTable< Tvar >

Definition at line 89 of file csvtable.h.

Constructor & Destructor Documentation

◆ CSVTable()

template<class Tvar >
CSVTable< Tvar >::CSVTable ( )
inline

Definition at line 92 of file csvtable.h.

Member Function Documentation

◆ addColumn()

template<class Tvar >
unsigned CSVTable< Tvar >::addColumn ( const string &  col_name)
inline

Definition at line 122 of file csvtable.h.

◆ addRows()

template<class Tvar >
unsigned CSVTable< Tvar >::addRows ( unsigned  n = 1)
inline

Adds a new row. Returns the new row index (idx). Do not add rows if there are no columns.

Definition at line 98 of file csvtable.h.

References CSVTableColumn< T >::addRows().

Referenced by RunStatsRecorder::append_to().

◆ getColIdx()

template<class Tvar >
int CSVTable< Tvar >::getColIdx ( const string &  column_name)
inline

Returns the index of the column named "column_name".

Definition at line 111 of file csvtable.h.

◆ nRows()

template<class Tvar >
unsigned CSVTable< Tvar >::nRows ( ) const
inline

◆ read()

template<class Tvar >
int CSVTable< Tvar >::read ( istream &  is)
inline

Reads the table from the input stream. Returns: 0 if ok -1 if could not read headers. 1 if number of cells in one or more rows does not match the number of column headers

Definition at line 214 of file csvtable.h.

References CSVTableColumn< T >::addRows().

Referenced by RunStatsTable::read_from_file().

◆ setCell() [1/7]

template<class Tvar >
int CSVTable< Tvar >::setCell ( unsigned  row_idx,
string  col_name,
string  value,
bool  createNewCol = false 
)
inline

Sets the value of the cell at column col_id and row row_id. Return 0 if ok, != 0 if error. Error code: -1 : Invalid row -2 : Invalid column and createNewCol == false

Definition at line 136 of file csvtable.h.

Referenced by ElapsedTimeRunStat::setCellValues(), and RunStat::~RunStat().

◆ setCell() [2/7]

template<class Tvar >
int CSVTable< Tvar >::setCell ( unsigned  row_idx,
string  col_name,
int  value,
bool  createNewCol = false 
)
inline

Definition at line 153 of file csvtable.h.

◆ setCell() [3/7]

template<class Tvar >
int CSVTable< Tvar >::setCell ( unsigned  row_idx,
string  col_name,
long  value,
bool  createNewCol = false 
)
inline

Definition at line 158 of file csvtable.h.

◆ setCell() [4/7]

template<class Tvar >
int CSVTable< Tvar >::setCell ( unsigned  row_idx,
string  col_name,
bool  value,
bool  createNewCol = false 
)
inline

Definition at line 163 of file csvtable.h.

◆ setCell() [5/7]

template<class Tvar >
int CSVTable< Tvar >::setCell ( unsigned  row_idx,
string  col_name,
unsigned  value,
bool  createNewCol = false 
)
inline

Definition at line 168 of file csvtable.h.

◆ setCell() [6/7]

template<class Tvar >
int CSVTable< Tvar >::setCell ( unsigned  row_idx,
string  col_name,
double  value,
bool  createNewCol = false 
)
inline

Definition at line 173 of file csvtable.h.

◆ setCell() [7/7]

template<class Tvar >
int CSVTable< Tvar >::setCell ( unsigned  row_idx,
string  col_name,
float  value,
bool  createNewCol = false 
)
inline

Definition at line 178 of file csvtable.h.

◆ split()

template<class Tvar >
void CSVTable< Tvar >::split ( vector< string > &  theStringVector,
const string &  theString,
const string &  theDelimiter 
)
inlineprotected

Definition at line 271 of file csvtable.h.

◆ trim()

template<class Tvar >
static string& CSVTable< Tvar >::trim ( string &  s)
inlinestaticprotected

Definition at line 289 of file csvtable.h.

References substruct_tst15.test::first.

◆ write()

template<class Tvar >
void CSVTable< Tvar >::write ( ostream &  os) const
inline

Definition at line 189 of file csvtable.h.

Referenced by RunStatsTable::write_to_file().

Member Data Documentation

◆ columns

template<class Tvar >
vector<CSVTableColumn<Tvar> > CSVTable< Tvar >::columns
protected

Array of columns.

Definition at line 309 of file csvtable.h.

◆ nrows

template<class Tvar >
unsigned CSVTable< Tvar >::nrows
protected

Definition at line 311 of file csvtable.h.


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