12 #ifndef MLPACK_BINDINGS_PYTHON_PRINT_CLASS_DEFN_HPP
13 #define MLPACK_BINDINGS_PYTHON_PRINT_CLASS_DEFN_HPP
28 const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
40 const typename boost::enable_if<arma::is_arma_type<T>>::type* = 0)
51 const typename boost::disable_if<arma::is_arma_type<T>>::type* = 0,
56 std::string strippedType, printedType, defaultsType;
82 std::cout <<
"cdef class " << strippedType <<
"Type:" << std::endl;
83 std::cout <<
" cdef " << printedType <<
"* modelptr" << std::endl;
84 std::cout << std::endl;
85 std::cout <<
" def __cinit__(self):" << std::endl;
86 std::cout <<
" self.modelptr = new " << printedType <<
"()" << std::endl;
87 std::cout << std::endl;
88 std::cout <<
" def __dealloc__(self):" << std::endl;
89 std::cout <<
" del self.modelptr" << std::endl;
90 std::cout << std::endl;
91 std::cout <<
" def __getstate__(self):" << std::endl;
92 std::cout <<
" return SerializeOut(self.modelptr, \"" << printedType
93 <<
"\")" << std::endl;
94 std::cout << std::endl;
95 std::cout <<
" def __setstate__(self, state):" << std::endl;
96 std::cout <<
" SerializeIn(self.modelptr, state, \"" << printedType
97 <<
"\")" << std::endl;
98 std::cout << std::endl;
99 std::cout <<
" def __reduce_ex__(self, version):" << std::endl;
100 std::cout <<
" return (self.__class__, (), self.__getstate__())"
102 std::cout << std::endl;
118 PrintClassDefn<typename std::remove_pointer<T>::type>(d);