|
CPP-snippets 0.0.1
A silly C++ project to use for demonstrating code integration
|
#include <interface.hpp>
Public Member Functions | |
| IOInterface (int argc, char *argv[]) | |
| Construct a new Interface and load the TOML configuration file. | |
| template<typename Derived> | |
| void | write2csv (const std::string &filename, const Eigen::MatrixBase< Derived > &mat_data, const std::string &comment) const |
| Write a matrix to a CSV file in scientific notation. | |
| void | write2csv (const std::string &filename, Eigen::VectorXd &vector_data, const std::string &comment) const |
| template<typename VecT> | |
| VecT | load_vector (const std::string &toml_path) const |
| template<typename T> | |
| T | load_scalar (const std::string &toml_path) const |
| Load a scalar value from the TOML input file using a dotted path. | |
Data Fields | |
| toml::table | m_input |
| m_output_dir | Output directory based on toml input |
Definition at line 15 of file interface.hpp.
|
explicit |
Construct a new Interface and load the TOML configuration file.
Expects the first command-line argument (argv[1]) to be the path to the TOML configuration file.
| argc | Number of command-line arguments. |
| argv | Command-line argument array. |
Definition at line 6 of file interface.cpp.
| ~IOInterface | ( | ) |
Definition at line 56 of file interface.cpp.
|
inline |
Load a scalar value from the TOML input file using a dotted path.
This function loads a single scalar value (int, double, bool, string, …) from the TOML configuration. The path is resolved using toml::node::at_path().
| T | The C++ type to convert the TOML value into. |
| toml_path | Dotted path to the value in the TOML configuration. |
| std::runtime_error | if the path does not exist or cannot be converted. |
Definition at line 134 of file interface.hpp.
|
inline |
Definition at line 85 of file interface.hpp.
|
inline |
Write a matrix to a CSV file in scientific notation.
This method exports the content of an Eigen::MatrixXd to a CSV-formatted text file. Each row of the matrix is written as a line in the file, with values formatted using scientific notation. The output file will be overwritten if it already exists.
| filename | The path and name of the output CSV file. |
| matrix_data | The matrix whose contents will be written to the file. Each row is written sequentially as a separate line. |
std::scientific formatting.Definition at line 55 of file interface.hpp.
| void write2csv | ( | const std::string & | filename, |
| Eigen::VectorXd & | vector_data, | ||
| const std::string & | comment ) const |
Definition at line 42 of file interface.cpp.
| toml::table m_input |
Definition at line 17 of file interface.hpp.