mlpack 3.4.2
io_util.hpp
Go to the documentation of this file.
1
13#ifndef MLPACK_BINDINGS_GO_IO_UTIL_HPP
14#define MLPACK_BINDINGS_GO_IO_UTIL_HPP
15
18
19namespace mlpack {
20namespace util {
21
28template<typename T>
29inline void SetParam(const std::string& identifier, T& value)
30{
31 IO::GetParam<T>(identifier) = std::move(value);
32}
33
40template<typename T>
41inline void SetParamPtr(const std::string& identifier,
42 T* value)
43{
44 IO::GetParam<T*>(identifier) = value;
45}
46
51template<typename T>
52T* GetParamPtr(const std::string& paramName)
53{
54 return IO::GetParam<T*>(paramName);
55}
56
60inline void EnableVerbose()
61{
62 Log::Info.ignoreInput = false;
63}
64
68inline void DisableVerbose()
69{
71}
72
76inline void DisableBacktrace()
77{
78 Log::Fatal.backtrace = false;
79}
80
84inline void ResetTimers()
85{
86 // Just get a new object---removes all old timers.
88}
89
93inline void EnableTimers()
94{
96}
97
98} // namespace util
99} // namespace mlpack
100
101#endif
static IO & GetSingleton()
Retrieve the singleton.
Timers timer
Holds the timer objects.
Definition: io.hpp:315
static MLPACK_EXPORT util::PrefixedOutStream Fatal
Prints fatal messages prefixed with [FATAL], then terminates the program.
Definition: log.hpp:90
static MLPACK_EXPORT util::PrefixedOutStream Info
Prints informational messages if –verbose is specified, prefixed with [INFO ].
Definition: log.hpp:84
static void EnableTiming()
Enable timing of mlpack programs.
void Reset()
Reset the timers.
bool backtrace
If true, on a fatal error, a backtrace will be printed if HAS_BFD_DL is defined.
bool ignoreInput
Discards input, prints nothing if true.
void SetParam(const std::string &identifier, T &value)
Set the parameter to the given value.
Definition: io_util.hpp:29
void DisableVerbose()
Turn verbose output off.
Definition: io_util.hpp:68
void EnableTimers()
Enable timing.
Definition: io_util.hpp:93
void EnableVerbose()
Turn verbose output on.
Definition: io_util.hpp:60
void ResetTimers()
Reset the status of all timers.
Definition: io_util.hpp:84
void DisableBacktrace()
Disable backtraces.
Definition: io_util.hpp:76
T * GetParamPtr(const std::string &paramName)
Return a pointer.
Definition: io_util.hpp:52
void SetParamPtr(const std::string &identifier, T *value)
Set the parameter to the given value, given that the type is a pointer.
Definition: io_util.hpp:41
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1