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)
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)
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)
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)
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)
171 [¶m](
const T& value)
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);
char alias
Alias for this parameter.
Definition: param_data.hpp:63
Auxiliary information for a dataset, including mappings to/from strings (or other types) and the data...
Definition: dataset_mapper.hpp:41
Definition: has_serialize.hpp:47
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
std::string desc
Description of this parameter, if any.
Definition: param_data.hpp:58
Option * add_flag_function(std::string flag_name, std::function< void(std::int64_t)> function, std::string flag_description="")
Add option for callback with an integer value.
Definition: CLI11.hpp:6033
This structure holds all of the information about a single parameter, including its value (which is s...
Definition: param_data.hpp:52
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.
Definition: add_to_cli11.hpp:33
boost::any value
The actual value that is held.
Definition: param_data.hpp:82
Option * add_option_function(std::string option_name, const std::function< void(const ArgType &)> &func, std::string option_description="")
Add option for a callback of a specific type.
Definition: CLI11.hpp:5812
std::string name
Name of this parameter.
Definition: param_data.hpp:56
Creates a command line program, with very few defaults.
Definition: CLI11.hpp:5213
bool wasPassed
True if the option was passed to the program.
Definition: param_data.hpp:66