FDCL Param Class
|
Saving and loading parameters. More...
#include <param.hpp>
Public Member Functions | |
param (std::string file_name) | |
void | open (std::string fname) |
void | close () |
void | read (const std::string param_name, bool &value) |
void | read (const std::string param_name, double &value) |
void | read (const std::string param_name, int &value) |
void | read (const std::string param_name, std::string &value) |
void | read (const std::string param_name, Eigen::Matrix< double, 3, 3 > &value) |
void | read (const std::string param_name, Eigen::Matrix< double, 4, 1 > &value) |
void | read (const std::string param_name, Eigen::Matrix< double, 3, 1 > &value) |
template<typename Derived > | |
void | read (const std::string param_name, Eigen::MatrixBase< Derived > &value) |
void | save (const std::string param_name, bool value) |
void | save (const std::string param_name, double value) |
void | save (const std::string param_name, int value) |
void | save (const std::string param_name, const std::string value) |
void | save (const std::string param_name, Eigen::Matrix< double, 3, 3 > &value) |
template<typename Derived > | |
void | save (const std::string param_name, Eigen::MatrixBase< Derived > &value) |
Public Attributes | |
std::string | file_name |
std::fstream | file_stream |
Saving and loading parameters.
This class reads parameters from and to external files. This makes easier to update parameters in the code, without compiling the code again when a single parameter is changed. Please follow the below guidelines for making the config files:
void fdcl::param::close | ( | ) |
Closes the config files
void fdcl::param::open | ( | std::string | fname | ) |
Open the config files for reading/ writing
fname | Path to the file |
void fdcl::param::read | ( | const std::string | param_name, |
bool & | value | ||
) |
Reads a boolean type parameter from the config file
param_name | name of the parameter |
value | varaiable to save the read parameter value |
void fdcl::param::read | ( | const std::string | param_name, |
double & | value | ||
) |
Reads a double type parameter from the config file
param_name | name of the parameter |
value | varaiable to save the read parameter value |
void fdcl::param::read | ( | const std::string | param_name, |
int & | value | ||
) |
Reads a int type parameter from the config file
param_name | name of the parameter |
value | varaiable to save the read parameter value |
void fdcl::param::read | ( | const std::string | param_name, |
std::string & | value | ||
) |
Reads a string type parameter from the config file
param_name | name of the parameter |
value | varaiable to save the read parameter value |
void fdcl::param::read | ( | const std::string | param_name, |
Eigen::MatrixBase< Derived > & | value | ||
) |
Reads a any Eigen vector type parameter from the config file
param_name | name of the parameter |
value | varaiable to save the read parameter value |
void fdcl::param::save | ( | const std::string | param_name, |
bool | value | ||
) |
void save(const std::string param_name, bool value) Saves a given bool type parameter to the config files
param_name | name of the parameter |
value | varaiable to save the read parameter value |
void fdcl::param::save | ( | const std::string | param_name, |
double | value | ||
) |
void save(const std::string param_name, double value) Saves a given double type parameter to the config files
param_name | name of the parameter |
value | varaiable to save the read parameter value |
void fdcl::param::save | ( | const std::string | param_name, |
int | value | ||
) |
void save(const std::string param_name, int value) Saves a given int type parameter to the config files
param_name | name of the parameter |
value | varaiable to save the read parameter value |
void fdcl::param::save | ( | const std::string | param_name, |
const std::string | value | ||
) |
void save(const std::string param_name, std::string value) Saves a given string type parameter to the config files
param_name | name of the parameter |
value | varaiable to save the read parameter value |
void fdcl::param::save | ( | const std::string | param_name, |
Eigen::Matrix< double, 3, 3 > & | value | ||
) |
void save(const std::string param_name, Matrix3 value) Saves a given Matrix3 type parameter to the config files
param_name | name of the parameter |
value | varaiable to save the read parameter value |
void fdcl::param::save | ( | const std::string | param_name, |
Eigen::MatrixBase< Derived > & | value | ||
) |
void save(const std::string param_name, Eigen::MatrixBase<Derived> value)
Saves a given Eigen type parameter to the config files
param_name | name of the parameter |
value | varaiable to save the read parameter value |
std::string fdcl::param::file_name |
name of the config file where the data is is saved or read from
std::fstream fdcl::param::file_stream |
fstream object for the config file