print_defn_output.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_BINDINGS_GO_PRINT_DEFN_OUTPUT_HPP
14 #define MLPACK_BINDINGS_GO_PRINT_DEFN_OUTPUT_HPP
15 
16 #include <mlpack/prereqs.hpp>
17 #include "get_go_type.hpp"
18 #include "strip_type.hpp"
19 
20 namespace mlpack {
21 namespace bindings {
22 namespace go {
23 
27 template<typename T>
29  util::ParamData& d,
30  const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
31  const typename boost::disable_if<data::HasSerialize<T>>::type* = 0,
32  const typename boost::disable_if<std::is_same<T,
33  std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
34 {
35  std::cout << GetGoType<T>(d);
36 }
37 
41 template<typename T>
43  util::ParamData& d,
44  const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
45 {
46  // *mat.Dense
47  std::cout << "*" << GetGoType<T>(d);
48 }
49 
53 template<typename T>
55  util::ParamData& d,
56  const typename boost::enable_if<std::is_same<T,
57  std::tuple<data::DatasetInfo, arma::mat>>>::type* = 0)
58 {
59  // *mat.Dense
60  std::cout << "*" << GetGoType<T>(d);
61 }
62 
66 template<typename T>
68  util::ParamData& d,
69  const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
70  const typename boost::enable_if<data::HasSerialize<T>>::type* = 0)
71 {
72  // Get the type names we need to use.
73  std::string goStrippedType, strippedType, printedType, defaultsType;
74  StripType(d.cppType, goStrippedType, strippedType, printedType, defaultsType);
75  std::cout << goStrippedType;
76 }
77 
92 template<typename T>
94  const void* /* input */,
95  void* /* output */)
96 {
97  PrintDefnOutput<typename std::remove_pointer<T>::type>(d);
98 }
99 
100 } // namespace go
101 } // namespace bindings
102 } // namespace mlpack
103 
104 #endif
void PrintDefnOutput(util::ParamData &d, const typename boost::disable_if< arma::is_arma_type< T >>::type *=0, const typename boost::disable_if< data::HasSerialize< T >>::type *=0, const typename boost::disable_if< std::is_same< T, std::tuple< data::DatasetInfo, arma::mat >>>::type *=0)
Print output for a regular parameter type.
void StripType(const std::string &inputType, std::string &goStrippedType, std::string &strippedType, std::string &printedType, std::string &defaultsType)
Given an input type like, e.g., "LogisticRegression<>", return four types that can be used in Go code...
Definition: strip_type.hpp:30
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.
go
Definition: CMakeLists.txt:6
This structure holds all of the information about a single parameter, including its value (which is s...
Definition: param_data.hpp:52
std::string cppType
The true name of the type, as it would be written in C++.
Definition: param_data.hpp:84