12 #ifndef MLPACK_BINDINGS_CLI_ADD_TO_CLI11_HPP 13 #define MLPACK_BINDINGS_CLI_ADD_TO_CLI11_HPP 19 #include "third_party/CLI/CLI11.hpp" 36 const typename std::enable_if<!std::is_same<T,
37 bool>::value>::type* = 0,
38 const typename std::enable_if<!
39 arma::is_arma_type<T>::value>::type* = 0,
40 const typename std::enable_if<!
42 const typename std::enable_if<std::is_same<T,
44 arma::mat>>::value>::type* = 0)
46 app.add_option_function<std::string>(cliName.c_str(),
47 [¶m](
const std::string& value)
49 using TupleType = std::tuple<T, typename ParameterType<T>::type>;
50 TupleType& tuple = *boost::any_cast<TupleType>(¶m.
value);
51 std::get<0>(std::get<1>(tuple)) = boost::any_cast<std::string>(value);
68 const typename std::enable_if<!std::is_same<T,
69 bool>::value>::type* = 0,
70 const typename std::enable_if<!
71 arma::is_arma_type<T>::value>::type* = 0,
72 const typename std::enable_if<
74 const typename std::enable_if<!std::is_same<T,
76 arma::mat>>::value>::type* = 0)
78 app.add_option_function<std::string>(cliName.c_str(),
79 [¶m](
const std::string& value)
81 using TupleType = std::tuple<T*, typename ParameterType<T>::type>;
82 TupleType& tuple = *boost::any_cast<TupleType>(¶m.
value);
83 std::get<1>(tuple) = boost::any_cast<std::string>(value);
100 const typename std::enable_if<!
101 std::is_same<T, bool>::value>::type* = 0,
102 const typename std::enable_if<
103 arma::is_arma_type<T>::value>::type* = 0,
104 const typename std::enable_if<!std::is_same<T,
106 arma::mat>>::value>::type* = 0)
108 app.add_option_function<std::string>(cliName.c_str(),
109 [¶m](
const std::string& value)
111 using TupleType = std::tuple<T, typename ParameterType<T>::type>;
112 TupleType& tuple = *boost::any_cast<TupleType>(¶m.
value);
113 std::get<0>(std::get<1>(tuple)) = boost::any_cast<std::string>(value);
130 const typename std::enable_if<!
131 std::is_same<T, bool>::value>::type* = 0,
132 const typename std::enable_if<!
133 arma::is_arma_type<T>::value>::type* = 0,
134 const typename std::enable_if<!
136 const typename std::enable_if<!std::is_same<T,
138 arma::mat>>::value>::type* = 0)
140 app.add_option_function<T>(cliName.c_str(),
141 [¶m](
const T& value)
160 const typename std::enable_if<
161 std::is_same<T, bool>::value>::type* = 0,
162 const typename std::enable_if<!
163 arma::is_arma_type<T>::value>::type* = 0,
164 const typename std::enable_if<!
166 const typename std::enable_if<!std::is_same<T,
168 arma::mat>>::value>::type* = 0)
170 app.add_flag_function(cliName.c_str(),
171 [¶m](
const T& value)
193 CLI::App* app = (CLI::App*) output;
196 const std::string mappedName =
197 MapParameterName<typename std::remove_pointer<T>::type>(param.
name);
198 std::string cliName = (param.
alias !=
'\0') ?
199 "-" + std::string(1, param.
alias) +
",--" + mappedName :
204 AddToCLI11<typename std::remove_pointer<T>::type>(
205 cliName, param, *app);
void AddToCLI11(const std::string &cliName, util::ParamData ¶m, CLI::App &app, const typename std::enable_if<!std::is_same< T, bool >::value >::type *=0, const typename std::enable_if<! arma::is_arma_type< T >::value >::type *=0, const typename std::enable_if<! data::HasSerialize< T >::value >::type *=0, const typename std::enable_if< std::is_same< T, std::tuple< mlpack::data::DatasetInfo, arma::mat >>::value >::type *=0)
Add a tuple option to CLI11.
Auxiliary information for a dataset, including mappings to/from strings (or other types) and the data...
boost::any value
The actual value that is held.
Linear algebra utility functions, generally performed on matrices or vectors.
bool wasPassed
True if the option was passed to the program.
std::string desc
Description of this parameter, if any.
This structure holds all of the information about a single parameter, including its value (which is s...
char alias
Alias for this parameter.
std::string name
Name of this parameter.