LDMX Software
|
Specialization of the GeneralCSVLoader for loading from a file/stream. More...
#include <GeneralCSVLoader.h>
Public Member Functions | |
StreamCSVLoader (const std::string &filename) | |
Constructor a loader from the provided file name. | |
StreamCSVLoader (std::istream &stream) | |
Construct a loader from the provided input stream. | |
virtual | ~StreamCSVLoader () |
Clean-up the stream if we own it. | |
Public Member Functions inherited from conditions::GeneralCSVLoader | |
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 () |
Get the next line, returning an empty string when there is no further data. | |
Private Attributes | |
std::istream * | source_ |
The stream. | |
bool | ownStream_ |
Own stream? | |
std::string | line_ |
Line buffer. | |
Specialization of the GeneralCSVLoader for loading from a file/stream.
Definition at line 85 of file GeneralCSVLoader.h.
conditions::StreamCSVLoader::StreamCSVLoader | ( | const std::string & | filename | ) |
Constructor a loader from the provided file name.
We expand the file-name using wordexp and then open an input file stream to it. We own the stream in this case.
Definition at line 94 of file GeneralCSVLoader.cxx.
References source_.
conditions::StreamCSVLoader::StreamCSVLoader | ( | std::istream & | stream | ) |
Construct a loader from the provided input stream.
We are given an already-created stream, so we do not own the stream in this case.
Definition at line 127 of file GeneralCSVLoader.cxx.
|
virtual |
Clean-up the stream if we own it.
Definition at line 130 of file GeneralCSVLoader.cxx.
References ownStream_, and source_.
|
protectedvirtual |
Get the next line, returning an empty string when there is no further data.
Implements conditions::GeneralCSVLoader.
Definition at line 135 of file GeneralCSVLoader.cxx.
|
private |
|
private |
|
private |
The stream.
Definition at line 114 of file GeneralCSVLoader.h.
Referenced by getNextLine(), StreamCSVLoader(), and ~StreamCSVLoader().