mlpack  3.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
print_doc.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_BINDINGS_GO_PRINT_DOC_HPP
14 #define MLPACK_BINDINGS_GO_PRINT_DOC_HPP
15 
16 #include <mlpack/prereqs.hpp>
18 #include "get_go_type.hpp"
20 
21 namespace mlpack {
22 namespace bindings {
23 namespace go {
24 
38 template<typename T>
40  const void* input,
41  void* isLower)
42 {
43  const size_t indent = *((size_t*) input);
44  bool Lower = *((bool*) isLower);
45  std::ostringstream oss;
46  oss << " - ";
47  oss << util::CamelCase(d.name, Lower) << " (";
48  oss << GetGoType<typename std::remove_pointer<T>::type>(d) << "): "
49  << d.desc;
50 
51  // Print a default, if possible.
52  if (!d.required)
53  {
54  if (d.cppType == "std::string")
55  {
56  oss << " Default value '" << boost::any_cast<std::string>(d.value)
57  << "'.";
58  }
59  else if (d.cppType == "double")
60  {
61  oss << " Default value " << boost::any_cast<double>(d.value) << ".";
62  }
63  else if (d.cppType == "int")
64  {
65  oss << " Default value " << boost::any_cast<int>(d.value) << ".";
66  }
67  }
68 
69  std::cout << util::HyphenateString(oss.str(), indent + 4);
70 }
71 
72 } // namespace go
73 } // namespace bindings
74 } // namespace mlpack
75 
76 #endif
boost::any value
The actual value that is held.
Definition: param_data.hpp:82
The core includes that mlpack expects; standard C++ includes and Armadillo.
go
Definition: CMakeLists.txt:61
std::string desc
Description of this parameter, if any.
Definition: param_data.hpp:58
This structure holds all of the information about a single parameter, including its value (which is s...
Definition: param_data.hpp:52
std::string CamelCase(std::string s, bool lower)
Given an snake_case like, e.g., &quot;logistic_regression&quot;, return CamelCase(e.g.
Definition: camel_case.hpp:26
if(NOT PYTHON_EXECUTABLE OR NOT PY_DISTUTILS OR NOT PY_CYTHON OR NOT PY_NUMPY OR NOT PY_PANDAS) if(NOT PYTHON_EXECUTABLE OR NOT PY_DISTUTILS OR NOT PY_CYTHON OR NOT PY_NUMPY OR NOT PY_PANDAS) set(BINDING_SOURCES default_param.hpp default_param_impl.hpp generate_pyx.hpp generate_pyx.cpp get_arma_type.hpp get_cython_type.hpp get_numpy_type.hpp get_numpy_type_char.hpp get_param.hpp get_printable_param.hpp get_python_type.hpp import_decl.hpp print_class_defn.hpp print_defn.hpp print_doc.hpp print_doc_functions.hpp print_doc_functions_impl.hpp print_input_processing.hpp print_output_processing.hpp print_pyx.hpp print_pyx.cpp print_type_doc.hpp print_type_doc_impl.hpp py_option.hpp strip_type.hpp mlpack/arma_util.hpp setup.cfg copy_artifacts.py) set(CYTHON_SOURCES mlpack/arma_numpy.pxd mlpack/arma_numpy.pyx mlpack/arma.pxd mlpack/arma_util.hpp mlpack/io.pxd mlpack/io_util.hpp mlpack/matrix_utils.py mlpack/serialization.hpp mlpack/serialization.pxd) set(TEST_SOURCES tests/dataset_info_test.py tests/test_python_binding.py) get_property(CYTHON_INCLUDE_DIRECTORIES DIRECTORY $
Definition: CMakeLists.txt:43
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 HyphenateString(const std::string &str, const std::string &prefix, const bool force=false)
Hyphenate a string or split it onto multiple 80-character lines, with some amount of padding on each ...
std::string cppType
The true name of the type, as it would be written in C++.
Definition: param_data.hpp:84
void PrintDoc(util::ParamData &d, const void *input, void *isLower)
Print the docstring documentation for a given parameter.
Definition: print_doc.hpp:39
string(REGEX REPLACE".*#define MLPACK_VERSION_MINOR ([0-9]+).*""\\1"MLPACK_VERSION_MINOR"${VERSION_HPP_CONTENTS}") string(REGEX REPLACE".* "\\1" MLPACK_VERSION_PATCH "$
Definition: CMakeLists.txt:56