default_param.hpp
Go to the documentation of this file.
1 
14 #ifndef MLPACK_BINDINGS_MARKDOWN_DEFAULT_PARAM_HPP
15 #define MLPACK_BINDINGS_MARKDOWN_DEFAULT_PARAM_HPP
16 
17 #include "binding_info.hpp"
18 
23 
24 namespace mlpack {
25 namespace bindings {
26 namespace markdown {
27 
32 template<typename T>
33 void DefaultParam(const util::ParamData& data,
34  const void* /* input */,
35  void* output)
36 {
37  if (BindingInfo::Language() == "cli")
38  {
39  *((std::string*) output) =
40  cli::DefaultParamImpl<typename std::remove_pointer<T>::type>(data);
41  }
42  else if (BindingInfo::Language() == "python")
43  {
44  *((std::string*) output) =
45  python::DefaultParamImpl<typename std::remove_pointer<T>::type>(data);
46  }
47  else if (BindingInfo::Language() == "julia")
48  {
49  *((std::string*) output) =
50  julia::DefaultParamImpl<typename std::remove_pointer<T>::type>(data);
51  }
52  else if (BindingInfo::Language() == "go")
53  {
54  *((std::string*) output) =
55  go::DefaultParamImpl<typename std::remove_pointer<T>::type>(data);
56  }
57  else
58  {
59  throw std::invalid_argument("DefaultParam(): unknown "
60  "BindingInfo::Language() " + BindingInfo::Language() + "!");
61  }
62 }
63 
64 } // namespace markdown
65 } // namespace bindings
66 } // namespace mlpack
67 
68 #endif
strip_type.hpp
Definition: add_to_po.hpp:21
This structure holds all of the information about a single parameter, including its value (which is s...
Definition: param_data.hpp:52
void DefaultParam(const util::ParamData &data, const void *, void *output)
Print the default value of a parameter into the output string.
static std::string & Language()
Get or modify the current language (don&#39;t set it to something invalid!).