Src/mlpack/core/util/cli.hpp -
class mlpack::CLI
Parses the command line for parameters and holds user-specified parameters. struct mlpack::ParamData
Aids in the extensibility of CLI by focusing potential changes into one structure.
mlpack
Linear algebra utility functions, generally performed on matrices or vectors. mlpack::util
#define PARAM(T, ID, DESC, ALIAS, DEF, REQ)
Define an input parameter. #define PARAM_DOUBLE(ID, DESC, ALIAS, DEF) PARAM(double, ID, DESC, ALIAS, DEF, false)
Define a double parameter. #define PARAM_DOUBLE_REQ(ID, DESC, ALIAS)
Define a required double parameter. #define PARAM_FLAG(ID, DESC, ALIAS) PARAM_FLAG_INTERNAL(ID, DESC, ALIAS);
Define a flag parameter. #define PARAM_FLOAT(ID, DESC, ALIAS, DEF) PARAM(float, ID, DESC, ALIAS, DEF, false)
Define a floating-point parameter. #define PARAM_FLOAT_REQ(ID, DESC, ALIAS)
Define a required floating-point parameter. #define PARAM_INT(ID, DESC, ALIAS, DEF) PARAM(int, ID, DESC, ALIAS, DEF, false)
Define an integer parameter. #define PARAM_INT_REQ(ID, DESC, ALIAS) PARAM(int, ID, DESC, ALIAS, 0, true)
Define a required integer parameter. #define PARAM_STRING(ID, DESC, ALIAS, DEF) PARAM(std::string, ID, DESC, ALIAS, DEF, false)
Define a string parameter. #define PARAM_STRING_REQ(ID, DESC, ALIAS)
Define a required string parameter. #define PARAM_VECTOR(T, ID, DESC, ALIAS) PARAM(std::vector<T>, ID, DESC, ALIAS, std::vector<T>(), false)
Define a vector parameter. #define PARAM_VECTOR_REQ(T, ID, DESC, ALIAS)
Define a required vector parameter. #define PROGRAM_INFO(NAME, DESC)
Document an executable. #define TYPENAME(x) (std::string(typeid(x).name()))
The TYPENAME macro is used internally to convert a type into a string.
Author:
Matthew Amidon
This file implements the CLI subsystem which is intended to replace FX. This can be used more or less regardless of context. In the future, it might be expanded to include file I/O.
This file is part of MLPACK 1.0.10.
MLPACK is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
MLPACK is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details (LICENSE.txt).
You should have received a copy of the GNU General Public License along with MLPACK. If not, see http://www.gnu.org/licenses/.
Definition in file cli.hpp.
Value:
static mlpack::util::Option<T> \ JOIN(JOIN(io_option_dummy_object_, __LINE__), opt) (false, DEF, ID, DESC, ALIAS, REQ);
Define an input parameter. Don't use this function; use the other ones above that call it. Note that we are using the LINE macro for naming these actual parameters when COUNTER does not exist, which is a bit of an ugly hack... but this is the preprocessor, after all. We don't have much choice other than ugliness.
Parameters:
T Type of the parameter.
ID Name of the parameter.
DESC Description of the parameter (1-2 sentences).
ALIAS Alias for this parameter (one letter).
DEF Default value of the parameter.
REQ Whether or not parameter is required (boolean value).
Definition at line 357 of file cli.hpp.
Define a double parameter. The parameter can then be specified on the command line with --ID=value.
Parameters:
ID Name of the parameter.
DESC Quick description of the parameter (1-2 sentences).
ALIAS An alias for the parameter (one letter).
DEF Default value of the parameter.
See also:
mlpack::CLI, PROGRAM_INFO()
Bug
The COUNTER variable is used in most cases to guarantee a unique global identifier for options declared using the PARAM_*() macros. However, not all compilers have this support--most notably, gcc < 4.3. In that case, the LINE macro is used as an attempt to get a unique global identifier, but collisions are still possible, and they produce bizarre error messages. See http://mlpack.org/trac/ticket/74 for more information.
Definition at line 146 of file cli.hpp.
Value:
PARAM(double, ID, DESC, ALIAS, 0.0f, true)
Define a required double parameter. The parameter must then be specified on the command line with --ID=value.
Parameters:
ID Name of the parameter.
DESC Quick description of the parameter (1-2 sentences).
ALIAS An alias for the parameter (one letter).
See also:
mlpack::CLI, PROGRAM_INFO()
Bug
The COUNTER variable is used in most cases to guarantee a unique global identifier for options declared using the PARAM_*() macros. However, not all compilers have this support--most notably, gcc < 4.3. In that case, the LINE macro is used as an attempt to get a unique global identifier, but collisions are still possible, and they produce bizarre error messages. See http://mlpack.org/trac/ticket/74 for more information.
Definition at line 267 of file cli.hpp.
Define a flag parameter.
Parameters:
ID Name of the parameter.
DESC Quick description of the parameter (1-2 sentences).
ALIAS An alias for the parameter (one letter).
See also:
mlpack::CLI, PROGRAM_INFO()
Bug
The COUNTER variable is used in most cases to guarantee a unique global identifier for options declared using the PARAM_*() macros. However, not all compilers have this support--most notably, gcc < 4.3. In that case, the LINE macro is used as an attempt to get a unique global identifier, but collisions are still possible, and they produce bizarre error messages. See http://mlpack.org/trac/ticket/74 for more information.
Definition at line 74 of file cli.hpp.
Define a floating-point parameter. You should use PARAM_DOUBLE instead.
The parameter can then be specified on the command line with --ID=value.
Parameters:
ID Name of the parameter.
DESC Quick description of the parameter (1-2 sentences).
ALIAS An alias for the parameter (one letter).
DEF Default value of the parameter.
See also:
mlpack::CLI, PROGRAM_INFO()
Bug
The COUNTER variable is used in most cases to guarantee a unique global identifier for options declared using the PARAM_*() macros. However, not all compilers have this support--most notably, gcc < 4.3. In that case, the LINE macro is used as an attempt to get a unique global identifier, but collisions are still possible, and they produce bizarre error messages. See http://mlpack.org/trac/ticket/74 for more information.
Definition at line 122 of file cli.hpp.
Value:
PARAM(float, ID, DESC, ALIAS, 0.0f, true)
Define a required floating-point parameter. You should probably use a double instead.
The parameter must then be specified on the command line with --ID=value. If ALIAS is equal to DEF_MOD (which is set using the PROGRAM_INFO() macro), the parameter can be specified with just --ID=value.
Parameters:
ID Name of the parameter.
DESC Quick description of the parameter (1-2 sentences).
ALIAS An alias for the parameter (one letter).
See also:
mlpack::CLI, PROGRAM_INFO()
Bug
The COUNTER variable is used in most cases to guarantee a unique global identifier for options declared using the PARAM_*() macros. However, not all compilers have this support--most notably, gcc < 4.3. In that case, the LINE macro is used as an attempt to get a unique global identifier, but collisions are still possible, and they produce bizarre error messages. See http://mlpack.org/trac/ticket/74 for more information.
Definition at line 244 of file cli.hpp.
Define an integer parameter. The parameter can then be specified on the command line with --ID=value.
Parameters:
ID Name of the parameter.
DESC Quick description of the parameter (1-2 sentences).
ALIAS An alias for the parameter (one letter).
DEF Default value of the parameter.
See also:
mlpack::CLI, PROGRAM_INFO()
Bug
The COUNTER variable is used in most cases to guarantee a unique global identifier for options declared using the PARAM_*() macros. However, not all compilers have this support--most notably, gcc < 4.3. In that case, the LINE macro is used as an attempt to get a unique global identifier, but collisions are still possible, and they produce bizarre error messages. See http://mlpack.org/trac/ticket/74 for more information.
Definition at line 98 of file cli.hpp.
Define a required integer parameter. The parameter must then be specified on the command line with --ID=value.
Parameters:
ID Name of the parameter.
DESC Quick description of the parameter (1-2 sentences).
ALIAS An alias for the parameter (one letter).
See also:
mlpack::CLI, PROGRAM_INFO()
Bug
The COUNTER variable is used in most cases to guarantee a unique global identifier for options declared using the PARAM_*() macros. However, not all compilers have this support--most notably, gcc < 4.3. In that case, the LINE macro is used as an attempt to get a unique global identifier, but collisions are still possible, and they produce bizarre error messages. See http://mlpack.org/trac/ticket/74 for more information.
Definition at line 220 of file cli.hpp.
Define a string parameter. The parameter can then be specified on the command line with --ID=value. If ALIAS is equal to DEF_MOD (which is set using the PROGRAM_INFO() macro), the parameter can be specified with just --ID=value.
Parameters:
ID Name of the parameter.
DESC Quick description of the parameter (1-2 sentences).
ALIAS An alias for the parameter (one letter).
DEF Default value of the parameter.
See also:
mlpack::CLI, PROGRAM_INFO()
Bug
The COUNTER variable is used in most cases to guarantee a unique global identifier for options declared using the PARAM_*() macros. However, not all compilers have this support--most notably, gcc < 4.3. In that case, the LINE macro is used as an attempt to get a unique global identifier, but collisions are still possible, and they produce bizarre error messages. See http://mlpack.org/trac/ticket/74 for more information.
Definition at line 171 of file cli.hpp.
Value:
PARAM(std::string, ID, DESC, ALIAS, "", true);
Define a required string parameter. The parameter must then be specified on the command line with --ID=value.
Parameters:
ID Name of the parameter.
DESC Quick description of the parameter (1-2 sentences).
ALIAS An alias for the parameter (one letter).
See also:
mlpack::CLI, PROGRAM_INFO()
Bug
The COUNTER variable is used in most cases to guarantee a unique global identifier for options declared using the PARAM_*() macros. However, not all compilers have this support--most notably, gcc < 4.3. In that case, the LINE macro is used as an attempt to get a unique global identifier, but collisions are still possible, and they produce bizarre error messages. See http://mlpack.org/trac/ticket/74 for more information.
Definition at line 290 of file cli.hpp.
Define a vector parameter. The parameter can then be specified on the command line with --ID=value.
Parameters:
ID Name of the parameter.
DESC Quick description of the parameter (1-2 sentences).
ALIAS An alias for the parameter (one letter).
DEF Default value of the parameter.
See also:
mlpack::CLI, PROGRAM_INFO()
Bug
The COUNTER variable is used in most cases to guarantee a unique global identifier for options declared using the PARAM_*() macros. However, not all compilers have this support--most notably, gcc < 4.3. In that case, the LINE macro is used as an attempt to get a unique global identifier, but collisions are still possible, and they produce bizarre error messages. See http://mlpack.org/trac/ticket/74 for more information.
Definition at line 195 of file cli.hpp.
Value:
PARAM(std::vector<T>, ID, DESC, ALIAS, std::vector<T>(), true);
Define a required vector parameter. The parameter must then be specified on the command line with --ID=value.
Parameters:
ID Name of the parameter.
DESC Quick description of the parameter (1-2 sentences).
ALIAS An alias for the parameter (one letter).
See also:
mlpack::CLI, PROGRAM_INFO()
Bug
The COUNTER variable is used in most cases to guarantee a unique global identifier for options declared using the PARAM_*() macros. However, not all compilers have this support--most notably, gcc < 4.3. In that case, the LINE macro is used as an attempt to get a unique global identifier, but collisions are still possible, and they produce bizarre error messages. See http://mlpack.org/trac/ticket/74 for more information.
Definition at line 313 of file cli.hpp.
Value:
static mlpack::util::ProgramDoc io_programdoc_dummy_object = mlpack::util::ProgramDoc(NAME, DESC);
Document an executable. Only one instance of this macro should be present in your program! Therefore, use it in the main.cpp (or corresponding executable) in your program.
See also:
mlpack::CLI, PARAM_FLAG(), PARAM_INT(), PARAM_DOUBLE(), PARAM_STRING(), PARAM_VECTOR(), PARAM_INT_REQ(), PARAM_DOUBLE_REQ(), PARAM_STRING_REQ(), PARAM_VECTOR_REQ().
Parameters:
NAME Short string representing the name of the program.
DESC Long string describing what the program does and possibly a simple usage example. Newlines should not be used here; this is taken care of by CLI (however, you can explicitly specify newlines to denote new paragraphs).
Definition at line 54 of file cli.hpp.
The TYPENAME macro is used internally to convert a type into a string.
Definition at line 372 of file cli.hpp.
Generated automatically by Doxygen for MLPACK from the source code.