LDMX Software
|
Class which parses a CSV file and provides the rows one at a time to a user The parser ignores any line which begins with a '#' character The parser uses the first non-comment row to determine column names The parser handles quotation marks in a standard manner. More...
#include <GeneralCSVLoader.h>
Public Member Functions | |
virtual | ~GeneralCSVLoader () |
Destructor. | |
std::vector< std::string > | columnNames () const |
Get the column names. | |
bool | nextRow () |
Advance to next row if possible. | |
const std::string & | get (const std::string &colname, bool ignore_case=true) const |
Get the value for the given column in the current row. | |
int | getInteger (const std::string &colname, bool ignore_case=true) const |
Get the value for the given column in the current row as an integer. | |
Protected Member Functions | |
virtual std::string | getNextLine ()=0 |
Get the next line, returning an empty string when there is no further data. | |
Private Attributes | |
std::vector< std::string > | colNames_ |
The column names. | |
std::vector< std::string > | rowData_ |
The row data. | |
Class which parses a CSV file and provides the rows one at a time to a user The parser ignores any line which begins with a '#' character The parser uses the first non-comment row to determine column names The parser handles quotation marks in a standard manner.
Definition at line 19 of file GeneralCSVLoader.h.
|
inlinevirtual |
|
inlineprotected |
Definition at line 38 of file GeneralCSVLoader.h.
|
inline |
Get the column names.
Definition at line 25 of file GeneralCSVLoader.h.
References colNames_.
const std::string & conditions::GeneralCSVLoader::get | ( | const std::string & | colname, |
bool | ignore_case = true |
||
) | const |
Get the value for the given column in the current row.
Definition at line 14 of file GeneralCSVLoader.cxx.
References colNames_, and rowData_.
Referenced by getInteger().
int conditions::GeneralCSVLoader::getInteger | ( | const std::string & | colname, |
bool | ignore_case = true |
||
) | const |
Get the value for the given column in the current row as an integer.
Definition at line 29 of file GeneralCSVLoader.cxx.
References get().
Referenced by hcal::HcalDetectorMap::HcalDetectorMap(), ecal::EcalDetectorMap::loadCellMap(), ecal::EcalDetectorMap::loadLayerMap(), and ecal::EcalDetectorMap::loadMotherboardMap().
|
protectedpure virtual |
Get the next line, returning an empty string when there is no further data.
Implemented in conditions::StringCSVLoader, and conditions::StreamCSVLoader.
Referenced by nextRow().
bool conditions::GeneralCSVLoader::nextRow | ( | ) |
Advance to next row if possible.
Definition at line 34 of file GeneralCSVLoader.cxx.
References colNames_, getNextLine(), and rowData_.
Referenced by hcal::HcalDetectorMap::HcalDetectorMap(), ecal::EcalDetectorMap::loadCellMap(), ecal::EcalDetectorMap::loadLayerMap(), and ecal::EcalDetectorMap::loadMotherboardMap().
|
private |
The column names.
Definition at line 48 of file GeneralCSVLoader.h.
Referenced by columnNames(), get(), and nextRow().
|
private |