mlpack
3.4.2
mlpack-3.4.2
src
mlpack
bindings
R
print_serialize_util.hpp
Go to the documentation of this file.
1
13
#ifndef MLPACK_BINDINGS_R_PRINT_SERIALIZE_UTIL_HPP
14
#define MLPACK_BINDINGS_R_PRINT_SERIALIZE_UTIL_HPP
15
16
#include <
mlpack/bindings/util/strip_type.hpp
>
17
18
namespace
mlpack
{
19
namespace
bindings {
20
namespace
r {
21
25
template
<
typename
T>
26
void
PrintSerializeUtil
(
27
util::ParamData
&
/* d */
,
28
const
typename
std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
29
const
typename
std::enable_if<!
data::HasSerialize<T>::value
>::type* = 0)
30
{
31
// Do Nothing.
32
}
33
37
template
<
typename
T>
38
void
PrintSerializeUtil
(
39
util::ParamData
&
/* d */
,
40
const
typename
std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
41
{
42
// Do Nothing.
43
}
44
48
template
<
typename
T>
49
void
PrintSerializeUtil
(
50
util::ParamData
& d,
51
const
typename
std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
52
const
typename
std::enable_if<
data::HasSerialize<T>::value
>::type* = 0)
53
{
61
MLPACK_COUT_STREAM
<<
" "
<< d.
name
<<
" <- IO_GetParam"
62
<<
util::StripType
(d.
cppType
) <<
"Ptr(\""
<< d.
name
<<
"\")"
;
63
MLPACK_COUT_STREAM
<< std::endl;
64
MLPACK_COUT_STREAM
<<
" attr("
<< d.
name
<<
", \"type\") <- \""
65
<<
util::StripType
(d.
cppType
) <<
"\""
;
66
MLPACK_COUT_STREAM
<< std::endl;
67
}
68
74
template
<
typename
T>
75
void
PrintSerializeUtil
(
util::ParamData
& d,
76
const
void
*
/*input*/
,
77
void
*
/* output */
)
78
{
79
PrintSerializeUtil<typename std::remove_pointer<T>::type>(d);
80
}
81
82
}
// namespace r
83
}
// namespace bindings
84
}
// namespace mlpack
85
86
#endif
mlpack::util::ParamData::cppType
std::string cppType
The true name of the type, as it would be written in C++.
Definition:
param_data.hpp:84
mlpack::bindings::r::PrintSerializeUtil
void PrintSerializeUtil(util::ParamData &, const typename std::enable_if<!arma::is_arma_type< T >::value >::type *=0, const typename std::enable_if<!data::HasSerialize< T >::value >::type *=0)
If the type is not serializable, print nothing.
Definition:
print_serialize_util.hpp:26
mlpack::util::ParamData
This structure holds all of the information about a single parameter, including its value (which is s...
Definition:
param_data.hpp:53
mlpack
Linear algebra utility functions, generally performed on matrices or vectors.
Definition:
add_to_cli11.hpp:21
strip_type.hpp
MLPACK_COUT_STREAM
#define MLPACK_COUT_STREAM
Definition:
prereqs.hpp:45
mlpack::util::ParamData::name
std::string name
Name of this parameter.
Definition:
param_data.hpp:56
mlpack::util::StripType
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...
Definition:
strip_type.hpp:27
mlpack::data::HasSerialize
Definition:
has_serialize.hpp:46
Generated by
1.8.20