10 #ifndef mrpt_utils_parameters_H 11 #define mrpt_utils_parameters_H 20 #include <mrpt/config.h> 59 typedef std::map<std::string, T>
BASE;
71 val = va_arg(args, T);
77 nam = va_arg(args,
const char*);
80 val = va_arg(args, T);
98 throw std::logic_error(
135 size_t maxStrLen = 10;
138 maxStrLen = std::max(maxStrLen, it->first.size());
140 std::stringstream str;
143 str << it->first <<
std::string(maxStrLen - it->first.size(),
' ')
144 <<
" = " << it->second << std::endl;
std::map< std::string, T > BASE
For usage when passing a dynamic number of (numeric) arguments to a function, by name.
std::string getAsString() const
Returns a multi-line string representation of the parameters like : 'nam = val = val2...'.
TParameters< double > TParametersDouble
See the generic template mrpt::utils::TParameters.
EIGEN_STRONG_INLINE iterator begin()
const Scalar * const_iterator
const_iterator find(const KEY &key) const
VALUE & operator[](const KEY &key)
Write/read via [i] operator, that creates an element if it didn't exist already.
TParameters< std::string > TParametersString
See the generic template mrpt::utils::TParameters.
void dumpToConsole() const
Dumps to console the output from getAsString()
TParameters(const char *nam1,...)
Constructor with a list of initial values (see the description and use example in mrpt::utils::TParam...
T operator[](const std::string &s) const
A const version of the [] operator, for usage as read-only.
GLsizei const GLchar ** string
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
T & operator[](const std::string &s)
The write (non-const) version of the [] operator.
T getWithDefaultVal(const std::string &s, const T &defaultVal) const
A const version of the [] operator and with a default value in case the parameter is not set (for usa...
TParameters()
Default constructor (initializes empty)
bool has(const std::string &s) const
void getAsString(std::string &s) const
Returns a multi-line string representation of the parameters like : 'nam = val = val2...'.