Class CLoadableOptions
Defined in File CLoadableOptions.h
Class Documentation
-
class CLoadableOptions
This is a virtual base class for sets of options than can be loaded from and/or saved to configuration plain-text files.
Public Functions
-
CLoadableOptions() = default
-
virtual ~CLoadableOptions() = default
-
CLoadableOptions(const CLoadableOptions&) = default
-
CLoadableOptions &operator=(const CLoadableOptions&) = default
-
CLoadableOptions(CLoadableOptions&&) = default
-
CLoadableOptions &operator=(CLoadableOptions&&) = default
-
virtual void loadFromConfigFile(const mrpt::config::CConfigFileBase &source, const std::string §ion) = 0
This method load the options from a “.ini”-like file or memory-stored string list. Only those parameters found in the given “section” and having the same name that the variable are loaded. Those not found in the file will stay with their previous values (usually the default values loaded at initialization). An example of an “.ini” file:
[section] resolution = 0.10 // blah blah... modeSelection = 1 // 0=blah, 1=blah,...
See also
-
void loadFromConfigFileName(const std::string &config_file, const std::string §ion)
Behaves like loadFromConfigFile, but you can pass directly a file name and a temporary CConfigFile object will be created automatically to load the file.
See also
-
virtual void saveToConfigFile(mrpt::config::CConfigFileBase &target, const std::string §ion) const
This method saves the options to a “.ini”-like file or memory-stored string list.
See also
-
void saveToConfigFileName(const std::string &config_file, const std::string §ion) const
Behaves like saveToConfigFile, but you can pass directly a file name and a temporary CConfigFile object will be created automatically to save the file.
See also
-
void dumpToConsole() const
Just like dumpToTextStream() but sending the text to the console (std::cout)
-
virtual void dumpToTextStream(std::ostream &out) const
This method should clearly display all the contents of the structure in textual form, sending it to a std::ostream. The default implementation in this base class relies on saveToConfigFile() to generate a plain text representation of all the parameters.
Protected Static Functions
-
static void dumpVar_int(std::ostream &out, const char *varName, int v)
Used to print variable info from dumpToTextStream with the macro LOADABLEOPTS_DUMP_VAR
-
static void dumpVar_float(std::ostream &out, const char *varName, float v)
-
static void dumpVar_double(std::ostream &out, const char *varName, double v)
-
static void dumpVar_bool(std::ostream &out, const char *varName, bool v)
-
static void dumpVar_string(std::ostream &out, const char *varName, const std::string &v)
-
CLoadableOptions() = default