mlpack
string_type_param_impl.hpp
Go to the documentation of this file.
1 
12 #ifndef MLPACK_BINDINGS_CLI_STRING_TYPE_PARAM_IMPL_HPP
13 #define MLPACK_BINDINGS_CLI_STRING_TYPE_PARAM_IMPL_HPP
14 
15 #include "string_type_param.hpp"
16 
17 namespace mlpack {
18 namespace bindings {
19 namespace cli {
20 
24 template<typename T>
25 std::string StringTypeParamImpl(
26  const typename std::enable_if<!util::IsStdVector<T>::value>::type* /* junk */,
27  const typename std::enable_if<!data::HasSerialize<T>::value>::type* /* junk */)
28 {
29  // Don't know what type this is.
30  return "unknown";
31 }
32 
36 template<typename T>
37 std::string StringTypeParamImpl(
38  const typename std::enable_if<util::IsStdVector<T>::value>::type* /* junk */)
39 {
40  return "vector";
41 }
42 
46 template<typename T>
47 std::string StringTypeParamImpl(
48  const typename std::enable_if<data::HasSerialize<T>::value>::type* /* junk */)
49 {
50  return "string";
51 }
52 
54 template<>
55 inline void StringTypeParam<int>(util::ParamData& /* data */,
56  const void* /* input */,
57  void* output)
58 {
59  std::string* outstr = (std::string*) output;
60  *outstr = "int";
61 }
62 
64 template<>
65 inline void StringTypeParam<bool>(util::ParamData& /* data */,
66  const void* /* input */,
67  void* output)
68 {
69  std::string* outstr = (std::string*) output;
70  *outstr = "bool";
71 }
72 
74 template<>
75 inline void StringTypeParam<std::string>(util::ParamData& /* data */,
76  const void* /* input */,
77  void* output)
78 {
79  std::string* outstr = (std::string*) output;
80  *outstr = "string";
81 }
82 
84 template<>
85 inline void StringTypeParam<double>(util::ParamData& /* data */,
86  const void* /* input */,
87  void* output)
88 {
89  std::string* outstr = (std::string*) output;
90  *outstr = "double";
91 }
92 
94 template<>
95 inline void StringTypeParam<std::tuple<mlpack::data::DatasetInfo, arma::mat>>(
96  util::ParamData& /* data */,
97  const void* /* input */,
98  void* output)
99 {
100  std::string* outstr = (std::string*) output;
101  *outstr = "string";
102 }
103 
104 } // namespace cli
105 } // namespace bindings
106 } // namespace mlpack
107 
108 #endif
Definition: has_serialize.hpp:47
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
std::string StringTypeParamImpl(const typename std::enable_if<!util::IsStdVector< T >::value >::type *=0, const typename std::enable_if<!data::HasSerialize< T >::value >::type *=0)
Return a string containing the type of the parameter.
Definition: string_type_param_impl.hpp:25
This structure holds all of the information about a single parameter, including its value (which is s...
Definition: param_data.hpp:52
Metaprogramming structure for vector detection.
Definition: is_std_vector.hpp:23