1 #include "mpmo.h"
2 
3 namespace MpMO
4 {
5 
6 bool silentMode = false;
7 bool warningsEnabled = true;
8 bool verbose = false;
9 bool pedantic = false;
10 bool exitOnError = true;
11 int DebugLevel = 0;
12 
13 void
Debug_(const char * p_func,const char * context,int p_debugScope,std::function<void ()> p_function)14 Debug_(const char *p_func, const char *context, int p_debugScope, std::function<void()> p_function)
15 {
16   (void) p_func;
17   if (p_debugScope) p_function();
18 }
19 
20 void
Debug_(const char * p_func,const char * context,std::function<void ()> p_function)21 Debug_(const char *p_func, const char *context, std::function<void()> p_function)
22 {
23   (void) p_func;
24   if (DebugLevel > 0) p_function();
25 }
26 
27 void
Verbose_(bool p_verbose,std::function<void ()> p_function)28 Verbose_(bool p_verbose, std::function<void()> p_function) noexcept
29 {
30   if (p_verbose) p_function();
31 }
32 
33 void
enable_silent_mode(bool enable)34 enable_silent_mode(bool enable)
35 {
36   silentMode = enable;
37 }
38 
39 void
enable_warnings(bool enable)40 enable_warnings(bool enable)
41 {
42   warningsEnabled = enable;
43 }
44 
45 void
enable_pedantic(bool enable)46 enable_pedantic(bool enable)
47 {
48   pedantic = enable;
49 }
50 
51 void
enable_verbose(bool enable)52 enable_verbose(bool enable)
53 {
54   verbose = enable;
55 }
56 }  // namespace MpMO
57 
58 std::string
argv_to_string(int argc,const char ** argv)59 argv_to_string(int argc, const char **argv)
60 {
61   std::string input_string = "";
62   for (int i = 0; i < argc; i++)
63     {
64       input_string += argv[i];
65       input_string += " ";
66     }
67   return input_string;
68 }
69 
70 std::string
argv_to_string(std::vector<std::string> argv)71 argv_to_string(std::vector<std::string> argv)
72 {
73   std::string input_string = "";
74   int argc = (int) argv.size();
75   for (int i = 0; i < argc; i++)
76     {
77       input_string += argv[i];
78       input_string += " ";
79     }
80   return input_string;
81 }
82