Several utilities used in our C++ Codebase.
The timer class represents a simple single-shot timer with an interface
similar to the setTimeout()
function in javascript. Additionally it
supports pausing and resuming the timeout. There are two import things to
keep in mind: the function runs in a different thread than the caller,
this can lead to the usual multithreading issues. Secondly the class doesn't
support setting a new function while the timer is running, this will lead
to an std::runtime_error
.
The logging library wraps around any ostream
(for example std::cout
or ofstream
(output-file-stream)) and provides filtering
depending on the log level and coloring depending on the log level.
Furthermore it prepends every message with the current timestamp.
The following log levels are possible:
Log-Level | Color | Explanation |
---|---|---|
0 | - | No log messages |
1 | Red | Only error messages |
2 | Yellow | Error messages and warning |
3 | Blue | Error messages, warning and info messages |
4 | White | All messages (error, warning, info and debug) |
In the root directory of the project run cmake to generate a Makefile by running
cmake .
next compile the program by running
make
finally install the program by running
sudo make install
the library can now be included using
#include <SopraUtil/Filename>
with Filename
beeing one of the header files without their relative path.
and linked using
-lSopraUtil
Das Analyseergebniss von SonarQube ist hier auf SonarCloud zu finden.