class in charge of reading data in a text file
More...
#include </home/runner/work/tfel/tfel/include/TFEL/Utilities/TextData.hxx>
|
| struct | Line |
| | helper class in charge of storing of line of data line starting with '#' ared considered comments and not stored. If the first line begins with a '#', the following words are intepreted as the title of each column More...
|
class in charge of reading data in a text file
◆ TextData()
| tfel::utilities::TextData::TextData |
( |
const std::string & | , |
|
|
const std::string & | = "" ) |
|
explicit |
constructor
- Parameters
-
| [in] | file | : file name |
| [in] | format | : file format Available file formats include:
- the default. If the first line is a comment, column legends are extracted out of it. If the next lines are comments, they are added to the preamble.
- gnuplot (also called alcyone). The first line is not a comment but column legends are extracted out of it. This is the behaviour of gnuplot when the following command is used: set key autotitle columnhead
|
◆ begin()
| std::vector< Line >::const_iterator tfel::utilities::TextData::begin |
( |
| ) |
const |
|
nodiscard |
- Returns
- an iterator to the first line
◆ end()
| std::vector< Line >::const_iterator tfel::utilities::TextData::end |
( |
| ) |
const |
|
nodiscard |
- Returns
- an iterator past the last line
◆ findColumn()
| size_type tfel::utilities::TextData::findColumn |
( |
const std::string & | | ) |
const |
|
nodiscard |
- Returns
- the column having the specified title
- Parameters
-
- Exceptions
-
| std::runtime_error | if no column with the specified title is found |
◆ getColumn() [1/2]
| std::vector< double > tfel::utilities::TextData::getColumn |
( |
const size_type | | ) |
const |
|
nodiscard |
- Parameters
-
- Returns
- the specified column, converting all values to double
- Exceptions
-
| std::runtime_error | if a line is shorter than the specified column number or if a value can't be converted to a double |
◆ getColumn() [2/2]
| void tfel::utilities::TextData::getColumn |
( |
std::vector< double > & | , |
|
|
const size_type | ) const |
extract the specified column, converting all values to double
- Parameters
-
| [out] | tab | : column values |
| [in] | i | : column number |
- Exceptions
-
| std::runtime_error | if a line is shorter than the specified column number or if a value can't be converted to a double |
◆ getLegend()
| std::string tfel::utilities::TextData::getLegend |
( |
const size_type | c | ) |
const |
|
nodiscard |
- Returns
- the title of the specified column
- Parameters
-
- Exceptions
-
| std::runtime_error | if no title is found |
◆ getLegends()
| const std::vector< std::string > & tfel::utilities::TextData::getLegends |
( |
| ) |
const |
|
nodiscard |
- Returns
- the legend associated to the curves
◆ getPreamble()
| const std::vector< std::string > & tfel::utilities::TextData::getPreamble |
( |
| ) |
const |
|
nodiscard |
get the first commented lines
◆ skipLines()
skip the first lines of the file
- Parameters
-
| [in] | n | : number of lines to be skipped |
The documentation for this struct was generated from the following file: