map_parameter_name.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_BINDINGS_CLI_MAP_PARAMETER_NAME_HPP
14 #define MLPACK_BINDINGS_CLI_MAP_PARAMETER_NAME_HPP
15 
17 
18 namespace mlpack {
19 namespace bindings {
20 namespace cli {
21 
27 template<typename T>
28 std::string MapParameterName(
29  const std::string& identifier,
30  const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
31  const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
32  const typename std::enable_if<!std::is_same<T,
33  std::tuple<mlpack::data::DatasetInfo, arma::mat>>::value>::type* = 0)
34 {
35  return identifier;
36 }
37 
43 template<typename T>
44 std::string MapParameterName(
45  const std::string& identifier,
46  const typename std::enable_if<
47  arma::is_arma_type<T>::value ||
48  std::is_same<T, std::tuple<mlpack::data::DatasetInfo,
49  arma::mat>>::value ||
50  data::HasSerialize<T>::value>::type* /* junk */ = 0)
51 {
52  return identifier + "_file";
53 }
54 
62 template<typename T>
64  const void* /* input */,
65  void* output)
66 {
67  // Store the mapped name in the output pointer, which is actually a string
68  // pointer.
69  *((std::string*) output) =
70  MapParameterName<typename std::remove_pointer<T>::type>(d.name);
71 }
72 
73 } // namespace cli
74 } // namespace bindings
75 } // namespace mlpack
76 
77 #endif
Auxiliary information for a dataset, including mappings to/from strings (or other types) and the data...
Linear algebra utility functions, generally performed on matrices or vectors.
This structure holds all of the information about a single parameter, including its value (which is s...
Definition: param_data.hpp:52
std::string MapParameterName(const std::string &identifier, 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)
If needed, map the parameter name to the name that is used by CLI11.
std::string name
Name of this parameter.
Definition: param_data.hpp:56