14 #ifndef MLPACK_CORE_UTIL_CLI_HPP
15 #define MLPACK_CORE_UTIL_CLI_HPP
22 #include <boost/any.hpp>
182 static bool HasParam(
const std::string& identifier);
191 static T&
GetParam(
const std::string& identifier);
214 static T&
GetRawParam(
const std::string& identifier);
239 static std::map<std::string, util::ParamData>&
Parameters();
241 static std::map<char, std::string>&
Aliases();
251 static void SetPassed(
const std::string& name);
272 static void RestoreSettings(
const std::string& name,
const bool fatal =
true);
281 std::map<char, std::string> aliases;
283 std::map<std::string, util::ParamData> parameters;
288 typedef std::map<std::string, std::map<std::string,
294 std::map<std::string, std::tuple<std::map<std::string, util::ParamData>,
323 CLI& operator=(
const CLI& other);
329 #include "cli_impl.hpp"
static void SetPassed(const std::string &name)
Mark a particular parameter as passed.
bool didParse
True, if CLI was used to parse command line options.
static CLI & GetSingleton()
Retrieve the singleton.
static void RegisterProgramDoc(util::ProgramDoc *doc)
Registers a ProgramDoc object, which contains documentation about the program.
static void StoreSettings(const std::string &name)
Take all parameters and function mappings and store them, under the given name.
The core includes that mlpack expects; standard C++ includes and Armadillo.
static T & GetRawParam(const std::string &identifier)
Get the raw value of the parameter before any processing that GetParam() might normally do...
static std::string GetPrintableParam(const std::string &identifier)
Cast the given parameter of the given type to a short, printable std::string, for use in status messa...
Timers timer
Holds the timer objects.
std::string programName
Holds the name of the program for –version.
static std::string ProgramName()
Get the program name as set by the PROGRAM_INFO() macro.
static std::map< std::string, util::ParamData > & Parameters()
Return a modifiable list of parameters that CLI knows about.
This structure holds all of the information about a single parameter, including its value (which is s...
The timer class provides a way for mlpack methods to be timed.
util::ProgramDoc * doc
Pointer to the ProgramDoc object.
static void ClearSettings()
Clear all of the settings, removing all parameters and function mappings.
static T & GetParam(const std::string &identifier)
Get the value of type T found while parsing.
std::map< std::string, std::map< std::string, void(*)(const util::ParamData &, const void *, void *)> > FunctionMapType
Map for functions and types.
static void Add(util::ParamData &&d)
Adds a parameter to the hierarchy; use the PARAM_*() macros instead of this (i.e. ...
static std::map< char, std::string > & Aliases()
Return a modifiable list of aliases that CLI knows about.
A static object whose constructor registers program documentation with the CLI class.
Parses the command line for parameters and holds user-specified parameters.
static void RestoreSettings(const std::string &name, const bool fatal=true)
Restore all of the parameters and function mappings of the given name, if they exist.
static bool HasParam(const std::string &identifier)
See if the specified flag was found while parsing.
FunctionMapType functionMap