Minotaur 0.4.1
Docs for developers
Environment.h
Go to the documentation of this file.
1//
2// Minotaur -- It's only 1/2 bull!
3//
4// (C)opyright 2009 - 2025 The Minotaur Team.
5//
6
13#ifndef ENVIRONMENT_H
14#define ENVIRONMENT_H
15
16#include "Types.h"
17#include "Logger.h"
18#include "Option.h"
19#include "Timer.h"
20
21namespace Minotaur {
22
29 public:
32
35
37 LoggerPtr getLogger() const;
38
40 LogLevel getLogLevel() const;
41
44
47
55 double getTime();
56
63 const Timer* getTimer();
64
65
66 // code for wall time
67 double getWTime();
74 const Timer* getWTimer();
75
76 double timeLimit();
77
79 std::string getVersion();
80
85 void initRand();
86
88 void readOptions(int argc, char **argv);
89
91 void readOptions(const std::string &str);
92
94 void setLogLevel(LogLevel l);
95
96 private:
98 LoggerPtr logger_;
99
101 static const std::string me_;
102
104 OptionDBPtr options_;
105
107 Timer *timer_;
108
110 TimerFactory *timerFac_;
111
113 void convertAndAddOneOption_(BoolOptionPtr &b_option,
114 IntOptionPtr &i_option,
115 DoubleOptionPtr &d_option,
116 StringOptionPtr &s_option,
117 FlagOptionPtr &f_option,
118 std::string &name,
119 std::string &value,
120 std::ostringstream &logstr);
121
123 void createDefaultOptions_();
124
125 /*
126 * Find an option with the provided name. The option is option of that
127 * type is returned and all others are NULLed.
128 */
129 void findOption_(const std::string &name, BoolOptionPtr &b_option,
130 IntOptionPtr &i_option, DoubleOptionPtr &d_option,
131 StringOptionPtr &s_option, FlagOptionPtr &f_option);
132
138 bool getBoolValue_(const std::string & str);
139
144 void readConfigFile_(std::string fname, UInt &num_p);
145
150 UInt removeDashes_(std::string &name);
151
153 void removeMinotaurPrepend_(std::string & fullname);
154
159 std::string separateEqualToArg_(std::string &name);
160 };
161}
162#endif
163
Declare class for creating logs.
Declare the Option class for managing options for Minotaur.
Define the TimerFactory and varios Timer classes.
Declare important 'types' used in Minotaur.
Definition: Environment.h:28
double getTime()
Definition: Environment.cpp:814
Timer * getNewTimer()
Get a new timer. The calling function has to free this timer.
Definition: Environment.cpp:804
void readOptions(int argc, char **argv)
Read the options using a char array that has 'argc' words in it.
Definition: Environment.cpp:920
void setLogLevel(LogLevel l)
Set the log level of the default logger.
Definition: Environment.cpp:1083
std::string getVersion()
Get the version string.
Definition: Environment.cpp:841
LoggerPtr getLogger() const
Get the logger that is setup for the whole environment.
Definition: Environment.cpp:794
LogLevel getLogLevel() const
Get the current log level.
Definition: Environment.cpp:799
Environment()
Default constructor.
Definition: Environment.cpp:32
~Environment()
Destroy.
Definition: Environment.cpp:42
const Timer * getTimer()
Get the global timer.
Definition: Environment.cpp:819
const Timer * getWTimer()
Get the global timer.
Definition: Environment.cpp:836
OptionDBPtr getOptions()
Get the options database.
Definition: Environment.cpp:809
void initRand()
Initialize random number generator. It reads the option value of rand_seed provided by the user,...
Definition: Environment.cpp:850
void readOptions(const std::string &str)
Read options from a string.
Definition: Logger.h:37
Definition: Option.h:141
Definition: Option.h:53
The TimerFactory should be used to get the approrpriate Timer.
Definition: Timer.h:172
Definition: Timer.h:40
Definition: ActiveNodeStore.h:20
LogLevel
Levels of verbosity.
Definition: Types.h:226
unsigned int UInt
Unsigned integer.
Definition: Types.h:30

Minotaur source code documented by Doxygen 1.9.4 on Thu Apr 24 2025