mlpack 3.4.2
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
23
24namespace mlpack {
25namespace bindings {
26namespace markdown {
27
32template<typename T>
34 const void* /* input */,
35 void* output)
36{
37 if (BindingInfo::Language() == "cli")
38 {
39 *((std::string*) output) =
40 cli::GetPrintableType<typename std::remove_pointer<T>::type>(data);
41 }
42 else if (BindingInfo::Language() == "python")
43 {
44 *((std::string*) output) =
45 python::GetPrintableType<typename std::remove_pointer<T>::type>(data);
46 }
47 else if (BindingInfo::Language() == "julia")
48 {
49 *((std::string*) output) =
50 julia::GetPrintableType<typename std::remove_pointer<T>::type>(data);
51 }
52 else if (BindingInfo::Language() == "go")
53 {
54 *((std::string*) output) =
55 go::GetPrintableType<typename std::remove_pointer<T>::type>(data);
56 }
57 else if (BindingInfo::Language() == "r")
58 {
59 *((std::string*) output) =
60 r::GetPrintableType<typename std::remove_pointer<T>::type>(data);
61 }
62 else
63 {
64 throw std::invalid_argument("GetPrintableType(): unknown "
65 "BindingInfo::Language(): " + BindingInfo::Language() + "!");
66 }
67}
68
73template<typename T>
75{
76 std::string output;
77 GetPrintableType<T>(data, (void*) NULL, (void*) &output);
78 return output;
79}
80
81} // namespace markdown
82} // namespace bindings
83} // namespace mlpack
84
85#endif
static std::string & Language()
Get or modify the current language (don't set it to something invalid!).
void GetPrintableType(util::ParamData &data, const void *, void *output)
Print the type of a parameter into the output string.
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
This structure holds all of the information about a single parameter, including its value (which is s...
Definition: param_data.hpp:53