aboutsummaryrefslogtreecommitdiff
path: root/contrib/otshell_utils/runoptions.hpp
diff options
context:
space:
mode:
authorrfree2monero <rfreemonero@op.pl>2015-01-05 20:30:17 +0100
committerrfree2monero <rfreemonero@op.pl>2015-02-20 22:13:00 +0100
commiteabb519605cab00dbaa5a1868d229f09c74570a6 (patch)
tree42f909d8e94e8cf67836d57cef4053ac572e3f8c /contrib/otshell_utils/runoptions.hpp
parentMerge pull request #229 (diff)
downloadmonero-eabb519605cab00dbaa5a1868d229f09c74570a6.tar.xz
2014 network limit 1.0a +utils +toc -doc -drmonero
commands and options for network limiting works very well e.g. for 50 KiB/sec up and down ToS (QoS) flag peer number limit TODO some spikes in ingress/download TODO problems when other up and down limit added "otshell utils" - simple logging (with colors, text files channels)
Diffstat (limited to 'contrib/otshell_utils/runoptions.hpp')
-rw-r--r--contrib/otshell_utils/runoptions.hpp58
1 files changed, 58 insertions, 0 deletions
diff --git a/contrib/otshell_utils/runoptions.hpp b/contrib/otshell_utils/runoptions.hpp
new file mode 100644
index 000000000..f3306283a
--- /dev/null
+++ b/contrib/otshell_utils/runoptions.hpp
@@ -0,0 +1,58 @@
+/* See other files here for the LICENCE that applies here. */
+/*
+Template for new files, replace word "template" and later delete this line here.
+*/
+
+#ifndef INCLUDE_OT_NEWCLI_runoptions_hpp
+#define INCLUDE_OT_NEWCLI_runoptions_hpp
+
+#include "lib_common1.hpp"
+
+namespace nOT {
+
+INJECT_OT_COMMON_USING_NAMESPACE_COMMON_1; // <=== namespaces
+
+/** Global options to run this program main() Eg used for developer's special options like +setdemo +setdebug.
+This is NOT for all the other options that are parsed and executed by program. */
+class cRunOptions {
+ public:
+ enum tRunMode { ///< Type of run mode - is this normal, or demonstration etc.
+ eRunModeCurrent=1, ///< currently developed version
+ eRunModeDemo, ///< best currently available Demo of something nice
+ eRunModeNormal, ///< do the normal things that the program should do
+ };
+
+ private:
+ tRunMode mRunMode; ///< selected run mode
+
+ bool mDebug; // turn debug on, Eg: +debug without it probably nothing will be written to debug (maybe just error etc)
+ bool mDebugSendToFile; // send to file, Eg: for +debugfile ; also turns on debug
+ bool mDebugSendToCerr; // send to cerr, Eg: for +debugcerr ; also turns on debug
+ // if debug is set but not any other DebugSend* then we will default to sending to debugcerr
+
+ bool mDoRunDebugshow;
+
+ public:
+ tRunMode getTRunMode() const { return mRunMode; }
+ bool getDebug() const { return mDebug; }
+ bool getDebugSendToFile() const { return mDebugSendToFile; }
+ bool getDebugSendToCerr() const { return mDebugSendToCerr; }
+ bool getDoRunDebugshow() const { return mDoRunDebugshow; }
+
+ cRunOptions();
+
+ vector<string> ExecuteRunoptionsAndRemoveThem(const vector<string> & args);
+ void Exec(const string & runoption); // eg: Exec("+debug");
+
+ void Normalize();
+};
+
+extern cRunOptions gRunOptions;
+
+
+}; // namespace nOT
+
+
+
+#endif
+