mlpack  3.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
get_printable_type.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_BINDINGS_MARKDOWN_GET_PRINTABLE_TYPE_HPP
14 #define MLPACK_BINDINGS_MARKDOWN_GET_PRINTABLE_TYPE_HPP
15 
16 #include "binding_info.hpp"
17 
20 
21 namespace mlpack {
22 namespace bindings {
23 namespace markdown {
24 
29 template<typename T>
31  const void* /* input */,
32  void* output)
33 {
34  if (BindingInfo::Language() == "cli")
35  {
36  *((std::string*) output) =
37  cli::GetPrintableType<typename std::remove_pointer<T>::type>(data);
38  }
39  else if (BindingInfo::Language() == "python")
40  {
41  *((std::string*) output) =
42  python::GetPrintableType<typename std::remove_pointer<T>::type>(data);
43  }
44  else
45  {
46  throw std::invalid_argument("GetPrintableType(): unknown "
47  "BindingInfo::Language(): " + BindingInfo::Language() + "!");
48  }
49 }
50 
55 template<typename T>
56 std::string GetPrintableType(const util::ParamData& data)
57 {
58  std::string output;
59  GetPrintableType<T>(data, (void*) NULL, (void*) &output);
60  return output;
61 }
62 
63 } // namespace markdown
64 } // namespace bindings
65 } // namespace mlpack
66 
67 #endif
This structure holds all of the information about a single parameter, including its value (which is s...
Definition: param_data.hpp:52
static std::string & Language()
Get or modify the current language (don&#39;t set it to something invalid!).
void GetPrintableType(const util::ParamData &data, const void *, void *output)
Print the type of a parameter into the output string.