13 #ifndef MLPACK_BINDINGS_JULIA_PRINT_PARAM_DEFN_HPP 14 #define MLPACK_BINDINGS_JULIA_PRINT_PARAM_DEFN_HPP 29 const typename std::enable_if::value>::type* = 0,
30 const typename std::enable_ifdata::HasSerialize
::value>::type* = 0) 42 const typename std::enable_if
::value>::type* = 0) 54 const typename std::enable_if::value>::type* = 0,
89 std::cout <<
"import ..." << type << std::endl;
90 std::cout << std::endl;
93 std::cout <<
"# Get the value of a model pointer parameter of type " << type
95 std::cout <<
"function IOGetParam" << type <<
"(paramName::String)::" 97 std::cout <<
" " << type <<
"(ccall((:IO_GetParam" << type
98 <<
"Ptr, " << programName <<
"Library), Ptr{Nothing}, (Cstring,), " 99 <<
"paramName))" << std::endl;
100 std::cout <<
"end" << std::endl;
101 std::cout << std::endl;
104 std::cout <<
"# Set the value of a model pointer parameter of type " << type
106 std::cout <<
"function IOSetParam" << type <<
"(paramName::String, " 107 <<
"model::" << type <<
")" << std::endl;
108 std::cout <<
" ccall((:IO_SetParam" << type <<
"Ptr, " 109 << programName <<
"Library), Nothing, (Cstring, " 110 <<
"Ptr{Nothing}), paramName, model.ptr)" << std::endl;
111 std::cout <<
"end" << std::endl;
112 std::cout << std::endl;
115 std::cout <<
"# Serialize a model to the given stream." << std::endl;
116 std::cout <<
"function serialize" << type <<
"(stream::IO, model::" << type
118 std::cout <<
" buf_len = UInt[0]" << std::endl;
119 std::cout <<
" buf_ptr = ccall((:Serialize" << type <<
"Ptr, " << programName
120 <<
"Library), Ptr{UInt8}, (Ptr{Nothing}, Ptr{UInt}), model.ptr, " 121 <<
"Base.pointer(buf_len))" << std::endl;
122 std::cout <<
" buf = Base.unsafe_wrap(Vector{UInt8}, buf_ptr, buf_len[1]; " 123 <<
"own=true)" << std::endl;
124 std::cout <<
" write(stream, buf)" << std::endl;
125 std::cout <<
"end" << std::endl;
128 std::cout <<
"# Deserialize a model from the given stream." << std::endl;
129 std::cout <<
"function deserialize" << type <<
"(stream::IO)::" << type
131 std::cout <<
" buffer = read(stream)" << std::endl;
132 std::cout <<
" " << type <<
"(ccall((:Deserialize" << type <<
"Ptr, " 133 << programName <<
"Library), Ptr{Nothing}, (Ptr{UInt8}, UInt), " 134 <<
"Base.pointer(buffer), length(buffer)))" << std::endl;
135 std::cout <<
"end" << std::endl;
147 PrintParamDefn
::type>(d, 148 *(std::string*) input);
Linear algebra utility functions, generally performed on matrices or vectors.
void PrintParamDefn(util::ParamData &, const std::string &, const typename std::enable_if::value >::type *=0, const typename std::enable_if::value >::type *=0)
If the type is not serializable, print nothing.
This structure holds all of the information about a single parameter, including its value (which is s...
std::string StripType(std::string cppType)
Given a C++ type name, turn it into something that has no special characters that can simply be print...
std::string cppType
The true name of the type, as it would be written in C++.