print_defn.hpp
Go to the documentation of this file.
1 
12 #ifndef MLPACK_BINDINGS_PYTHON_PRINT_DEFN_HPP
13 #define MLPACK_BINDINGS_PYTHON_PRINT_DEFN_HPP
14 
15 #include <mlpack/prereqs.hpp>
16 #include "wrapper_functions.hpp"
17 
18 namespace mlpack {
19 namespace bindings {
20 namespace python {
21 
26 template<typename T>
28  const void* /* input */,
29  void* /* output */)
30 {
31  // Make sure that we don't use names that are Python keywords.
32  std::string name = GetValidName(d.name);
33 
34  std::cout << name;
35  if (std::is_same<T, bool>::value)
36  std::cout << "=False";
37  else if (!d.required)
38  std::cout << "=None";
39 }
40 
41 } // namespace python
42 } // namespace bindings
43 } // namespace mlpack
44 
45 #endif
Linear algebra utility functions, generally performed on matrices or vectors.
void PrintDefn(util::ParamData &d, const void *, void *)
Print the definition for a Python binding parameter to stdout.
Definition: print_defn.hpp:27
The core includes that mlpack expects; standard C++ includes and Armadillo.
python
Definition: CMakeLists.txt:7
This structure holds all of the information about a single parameter, including its value (which is s...
Definition: param_data.hpp:52
std::string name
Name of this parameter.
Definition: param_data.hpp:56
bool required
True if this option is required.
Definition: param_data.hpp:71
std::string GetValidName(const std::string &paramName)