gempyre 1.8.1
Loading...
Searching...
No Matches
gempyre_utils.h File Reference
#include <ctime>
#include <chrono>
#include <vector>
#include <map>
#include <sstream>
#include <fstream>
#include <optional>
#include <variant>
#include <functional>
#include <algorithm>
#include <future>
#include <limits>
#include <iomanip>
#include <any>
#include <string_view>
Include dependency graph for gempyre_utils.h:

Go to the source code of this file.

Classes

class  GempyreUtils::LogWriter
 Parent class for LogWriters. More...
 

Macros

#define gempyre_utils_assert(b)   (b || GempyreUtils::do_fatal("Panic!", nullptr, __FILE__, __LINE__))
 Release build assert.
 
#define gempyre_utils_assert_x(b, x)   (b || GempyreUtils::do_fatal(x, nullptr, __FILE__, __LINE__))
 Release build assert with a message.
 
#define gempyre_utils_assert_x_f(b, x, f)   (b || GempyreUtils::do_fatal(x, f, __FILE__, __LINE__))
 Release build assert with a message and a function executed before forced exit.
 
#define gempyre_utils_fatal(x)   GempyreUtils::do_fatal(x, nullptr, __FILE__, __LINE__)
 Forced exit with a message.
 
#define gempyre_utils_fatal_f(x, f)   GempyreUtils::do_fatal(x, f, __FILE__, __LINE__)
 Forced exit with a message and a function executed before forced exit.
 
#define gempyre_utils_auto_clean(p, f)   std::unique_ptr<std::remove_pointer<decltype(p)>::type, decltype(&f)> _ ## p (p, &f)
 RAII helper for pointer.
 
#define gempyre_utils_auto_close(p, f)   GempyreUtils::_Close<std::decay_t<decltype(p)>, decltype(&f)> _ ## p (p, &f)
 RAII helper for non-pointer.
 

Enumerations

enum class  GempyreUtils::LogLevel : int {
  None , Fatal , Error , Warning ,
  Info , Debug , Debug_Trace
}
 The LogLevel enum. More...
 

Functions

UTILS_EX void GempyreUtils::set_log_level (LogLevel level)
 Set current log level.
 
UTILS_EX LogLevel GempyreUtils::log_level ()
 Get current log level.
 
UTILS_EX std::string GempyreUtils::to_str (LogLevel log_level)
 Log Level to string.
 
template<typename T , typename ... Args>
void GempyreUtils::log (LogLevel level, const T &e, Args... args)
 Write a log line.
 
template<typename T , typename ... Args>
void GempyreUtils::log_debug (const T &e, Args... args)
 Write a debug log.
 

Detailed Description

wqe

gempyre_utils.h contains a collection utility functions used internally within Gempyre implementation and test applications. The are in API as they may be useful for any developer. Gempyre-Python do not wrap these as Python asset have similar functions in internal or pip packages.

Enumeration Type Documentation

◆ LogLevel

enum class GempyreUtils::LogLevel : int
strong

The LogLevel enum.

Enumerator
Fatal 

All logs disabled.

Error 

Execution ends here.

Warning 

Something is wrong, Default.

Info 

At least developer should be worried.

Debug 

Something developer should know.

Debug_Trace 

What is going on.

What is going on, and telling it floods output and impacts performance

Function Documentation

◆ log()

template<typename T , typename ... Args>
void GempyreUtils::log ( LogLevel  level,
const T &  e,
Args...  args 
)
inline

Write a log line.

Parameters
levellog level of this message.
eparam to print.
argsoptional more parameters to print.

◆ log_level()

UTILS_EX LogLevel GempyreUtils::log_level ( )

Get current log level.

Returns
current log level.

◆ set_log_level()

UTILS_EX void GempyreUtils::set_log_level ( LogLevel  level)

Set current log level.

Parameters
level

◆ to_str()

UTILS_EX std::string GempyreUtils::to_str ( LogLevel  log_level)

Log Level to string.

Parameters
log_levelthat is converted to string.
Returns
std::string