cli_util.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_BINDINGS_GO_CLI_UTIL_HPP
14 #define MLPACK_BINDINGS_GO_CLI_UTIL_HPP
15 
16 #include <mlpack/core/util/cli.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  CLI::GetParam<T>(identifier) = std::move(value);
32 }
33 
41 template<typename T>
42 inline void SetParamPtr(const std::string& identifier,
43  T* value)
44 {
45  CLI::GetParam<T*>(identifier) = value;
46 }
47 
52 template<typename T>
53 T* GetParamPtr(const std::string& paramName)
54 {
55  return CLI::GetParam<T*>(paramName);
56 }
57 
61 inline void EnableVerbose()
62 {
63  Log::Info.ignoreInput = false;
64 }
65 
69 inline void DisableVerbose()
70 {
71  Log::Info.ignoreInput = true;
72 }
73 
77 inline void DisableBacktrace()
78 {
79  Log::Fatal.backtrace = false;
80 }
81 
85 inline void ResetTimers()
86 {
87  // Just get a new object---removes all old timers.
89 }
90 
94 inline void EnableTimers()
95 {
97 }
98 
99 } // namespace util
100 } // namespace mlpack
101 
102 #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: cli_util.hpp:85
strip_type.hpp
Definition: add_to_po.hpp:21
static CLI & GetSingleton()
Retrieve the singleton.
void SetParamPtr(const std::string &identifier, T *value)
Set the parameter to the given value, given that the type is a pointer.
Definition: cli_util.hpp:42
void DisableVerbose()
Turn verbose output off.
Definition: cli_util.hpp:69
Timers timer
Holds the timer objects.
Definition: cli.hpp:306
bool ignoreInput
Discards input, prints nothing if true.
void DisableBacktrace()
Disable backtraces.
Definition: cli_util.hpp:77
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: cli_util.hpp:94
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 &paramName)
Return a pointer.
Definition: cli_util.hpp:53
void SetParam(const std::string &identifier, T &value)
Set the parameter to the given value.
Definition: cli_util.hpp:29
static void EnableTiming()
Enable timing of mlpack programs.
void EnableVerbose()
Turn verbose output on.
Definition: cli_util.hpp:61
void Reset()
Reset the timers.