FDCL Param Class
Public Member Functions | Public Attributes | List of all members
fdcl::param Class Reference

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
 

Detailed Description

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:

Member Function Documentation

void fdcl::param::close ( )

Closes the config files

void fdcl::param::open ( std::string  fname)

Open the config files for reading/ writing

Parameters
fnamePath to the file
void fdcl::param::read ( const std::string  param_name,
bool &  value 
)

Reads a boolean type parameter from the config file

Parameters
param_namename of the parameter
valuevaraiable 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

Parameters
param_namename of the parameter
valuevaraiable 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

Parameters
param_namename of the parameter
valuevaraiable 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

Parameters
param_namename of the parameter
valuevaraiable to save the read parameter value
template<typename Derived >
void fdcl::param::read ( const std::string  param_name,
Eigen::MatrixBase< Derived > &  value 
)

Reads a any Eigen vector type parameter from the config file

Parameters
param_namename of the parameter
valuevaraiable 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

Parameters
param_namename of the parameter
valuevaraiable 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

Parameters
param_namename of the parameter
valuevaraiable 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

Parameters
param_namename of the parameter
valuevaraiable 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

Parameters
param_namename of the parameter
valuevaraiable 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

Parameters
param_namename of the parameter
valuevaraiable to save the read parameter value
template<typename Derived >
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

Parameters
param_namename of the parameter
valuevaraiable to save the read parameter value

Member Data Documentation

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


The documentation for this class was generated from the following file: