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