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 
24 
25 namespace mlpack {
26 namespace bindings {
27 namespace markdown {
28 
33 template<typename T>
35  const void* /* input */,
36  void* output)
37 {
38  if (BindingInfo::Language() == "cli")
39  {
40  *((std::string*) output) =
41  cli::DefaultParamImpl<typename std::remove_pointer<T>::type>(data);
42  }
43  else if (BindingInfo::Language() == "python")
44  {
45  *((std::string*) output) =
46  python::DefaultParamImpl<typename std::remove_pointer<T>::type>(data);
47  }
48  else if (BindingInfo::Language() == "julia")
49  {
50  *((std::string*) output) =
51  julia::DefaultParamImpl<typename std::remove_pointer<T>::type>(data);
52  }
53  else if (BindingInfo::Language() == "go")
54  {
55  *((std::string*) output) =
56  go::DefaultParamImpl<typename std::remove_pointer<T>::type>(data);
57  }
58  else if (BindingInfo::Language() == "r")
59  {
60  *((std::string*) output) =
61  r::DefaultParamImpl<typename std::remove_pointer<T>::type>(data);
62  }
63  else
64  {
65  throw std::invalid_argument("DefaultParam(): unknown "
66  "BindingInfo::Language() " + BindingInfo::Language() + "!");
67  }
68 }
69 
70 } // namespace markdown
71 } // namespace bindings
72 } // namespace mlpack
73 
74 #endif
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:51
constexpr auto data(Container const &container) noexcept -> decltype(container.data())
Definition: iterator.hpp:79
static std::string & Language()
Get or modify the current language (don&#39;t set it to something invalid!).
void DefaultParam(util::ParamData &data, const void *, void *output)
Print the default value of a parameter into the output string.