|
MGIS
|
a class used to pass an execution context to most methods of MGIS and gather information (error, logs, profiling).
More...
#include </home/runner/work/MFrontGenericInterfaceSupport/MFrontGenericInterfaceSupport/include/MGIS/Context.hxx>
Classes | |
| struct | FailureHandler |
Public Types | |
| enum | FailureHandlerPolicy { ABORT , RAISE } |
Public Types inherited from mgis::ErrorBacktrace | |
| using | ErrorReportFunction = std::string(*)(const int) |
| brief a simple alias | |
| using | ErrorReport = std::variant< const char *, std::pair< int, ErrorReportFunction >, std::string > |
| a simple alias listing the main way to report an error. | |
Public Member Functions | |
| Context () noexcept | |
| default constructor | |
| Context (const ContextInitializer &) noexcept | |
| constructor for an initializer | |
| Context (Context &&)=delete | |
| Context (const Context &)=delete | |
| Context & | operator= (Context &&)=delete |
| Context & | operator= (const Context &)=delete |
| const VerbosityLevel & | getVerbosityLevel () const noexcept |
| void | setVerbosityLevel (const VerbosityLevel) noexcept |
| change the level of verbosity | |
| void | enableProfiling (const bool) noexcept |
| enable or disable profiling | |
| bool | isProfilingEnabled () const noexcept |
| ProfilingSection | startNewProfiling (std::string, bool) noexcept |
| start a new profiling section | |
| void | pushProfilingNode (std::string) noexcept |
| push a new profiling node into the current execution stack | |
| void | popProfilingNode (double) noexcept |
| pop the current profiling node from the execution stack and accumulate time | |
| const ProfilingData & | getProfilingResultTree () const noexcept |
| template<FailureHandlerPolicy policy = FailureHandlerPolicy::RAISE> | |
| FailureHandler< policy > | getFailureHandler () |
| FailureHandler< FailureHandlerPolicy::RAISE > | getThrowingFailureHandler () noexcept |
| FailureHandler< FailureHandlerPolicy::ABORT > | getFatalFailureHandler () noexcept |
| void | setLogStream (std::ostream &) noexcept |
| set the current log stream. | |
| void | setLogStream (std::shared_ptr< std::ostream >) noexcept |
| set the current log stream. | |
| std::shared_ptr< std::ostream > | getLogStreamPointer () const noexcept |
| void | resetLogStream () noexcept |
| reset the default log stream | |
| void | disableLogStream () noexcept |
| disable the default log stream | |
| std::ostream & | log () noexcept |
| template<typename... Args> | |
| std::ostream & | log (const VerbosityLevel, Args &&...) noexcept |
display the given arguments in the log stream if the current verbosity level (as returned by the getVerbosityLevel method) is greater than a minimal one. | |
| template<typename... Args> | |
| void | warning (Args &&...) noexcept |
a simple wrapper around the log method to print a warning | |
| template<typename... Args> | |
| void | debug (Args &&...) noexcept |
a simple wrapper around the log method which sets the minimun verbosity level to verboseDebug | |
| ~Context () noexcept override | |
| destructor | |
| template<typename... Args> | |
| std::ostream & | log (const VerbosityLevel l, Args &&...args) noexcept |
| template<typename... Args> | |
| void | warning (Args &&...args) noexcept |
| template<typename... Args> | |
| void | debug (Args &&...args) noexcept |
Public Member Functions inherited from mgis::ErrorBacktrace | |
| InvalidResult | registerErrorMessage (const char *const) final |
| register a new error message | |
| InvalidResult | registerErrorMessage (const ErrorReport) noexcept |
| register a new error message | |
| InvalidResult | registerErrorMessageWithoutSourceLocation (const ErrorReport) noexcept |
| register a new error message | |
| void | clearErrorMessages () noexcept |
| remove the error messages | |
| std::string | getErrorMessage (const bool=true) noexcept |
| std::string | getRawErrorMessage (const bool=true) noexcept |
| bool | empty () const noexcept |
| ~ErrorBacktrace () noexcept override | |
| destructor | |
Public Member Functions inherited from mgis::AbstractErrorHandler | |
| virtual constexpr | ~AbstractErrorHandler ()=default |
| destructor | |
Additional Inherited Members | |
Static Public Member Functions inherited from mgis::ErrorBacktrace | |
| static void | setErrorReportingAsFatal () noexcept |
| specify if error reporting shall be fatal | |
| static void | unsetErrorReportingAsFatal () noexcept |
| specify if error reporting shall be fatal | |
a class used to pass an execution context to most methods of MGIS and gather information (error, logs, profiling).
The default logging stream is the one returned by the mgis::getDefaultLogStream free function.
|
noexcept |
default constructor
The verbositiy level is initialized by calling the getDefaultVerbosityLevel function.
|
noexcept |
constructor for an initializer
| [in] | i | initializer |
|
noexcept |
a simple wrapper around the log method which sets the minimun verbosity level to verboseDebug
| Args | types of the arguments |
| [in] | args | streamed object |
verboseDebug
|
noexcept |
disable the default log stream
|
noexcept |
enable or disable profiling
| [in] | b | a boolean value stating whether profiling shall be enabled |
|
inline |
| policy | policy used to treat a failure |
|
inlinenoexcept |
|
noexcept |
|
noexcept |
|
inlinenoexcept |
|
noexcept |
|
noexcept |
|
noexcept |
getDefaultLogStream for details.
|
noexcept |
display the given arguments in the log stream if the current verbosity level (as returned by the getVerbosityLevel method) is greater than a minimal one.
| Args | types of the arguments |
| [in] | l | minimal verbosity level |
| [in] | args | streamed object |
|
noexcept |
pop the current profiling node from the execution stack and accumulate time
| [in] | dt | execution time of the section in seconds |
Profiling class during its destruction.
|
noexcept |
push a new profiling node into the current execution stack
| [in] | name | name of the profiling section |
Profiling class during its construction.
|
noexcept |
set the current log stream.
| [in] | s | log stream |
|
noexcept |
set the current log stream.
| [in] | s | log stream |
mgis::getDefaultLogStream free function.
|
noexcept |
change the level of verbosity
| [in] | l | the new verbose level |
|
noexcept |
start a new profiling section
| [in] | name | name of the profiling section |
| [in] | enabled | boolean stating whether this profiling section shall effectively collect timing information |
|
noexcept |
a simple wrapper around the log method to print a warning
| Args | types of the arguments |
| [in] | args | streamed object |