|
MGIS 3.1.0
|
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 |
| a simple alias listing the main way to report an error. | |
Public Member Functions | |
| Context () MGIS_NOEXCEPT | |
| default constructor | |
| Context (const ContextInitializer &) MGIS_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 MGIS_NOEXCEPT |
| void | setVerbosityLevel (const VerbosityLevel) MGIS_NOEXCEPT |
| change the level of verbosity | |
| void | enableProfiling (const bool) MGIS_NOEXCEPT |
| enable or disable profiling | |
| bool | isProfilingEnabled () const MGIS_NOEXCEPT |
| ProfilingSection | startNewProfiling (std::string, bool) MGIS_NOEXCEPT |
| start a new profiling section | |
| void | pushProfilingNode (std::string) MGIS_NOEXCEPT |
| push a new profiling node into the current execution stack | |
| void | popProfilingNode (double) MGIS_NOEXCEPT |
| pop the current profiling node from the execution stack and accumulate time | |
| const ProfilingData & | getProfilingResultTree () const MGIS_NOEXCEPT |
| template<FailureHandlerPolicy policy = FailureHandlerPolicy::RAISE> | |
| FailureHandler< policy > | getFailureHandler () |
| FailureHandler< FailureHandlerPolicy::RAISE > | getThrowingFailureHandler () MGIS_NOEXCEPT |
| FailureHandler< FailureHandlerPolicy::ABORT > | getFatalFailureHandler () MGIS_NOEXCEPT |
| void | setLogStream (std::ostream &) MGIS_NOEXCEPT |
| set the current log stream. | |
| void | setLogStream (std::shared_ptr< std::ostream >) MGIS_NOEXCEPT |
| set the current log stream. | |
| std::shared_ptr< std::ostream > | getLogStreamPointer () const MGIS_NOEXCEPT |
| void | resetLogStream () MGIS_NOEXCEPT |
| reset the default log stream | |
| void | disableLogStream () MGIS_NOEXCEPT |
| disable the default log stream | |
| std::ostream & | log () MGIS_NOEXCEPT |
| template<typename... Args> | |
| std::ostream & | log (const VerbosityLevel, Args &&...) MGIS_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 &&...) MGIS_NOEXCEPT |
| a simple wrapper around the log method to print a warning | |
| template<typename... Args> | |
| void | debug (Args &&...) MGIS_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) MGIS_NOEXCEPT |
| template<typename... Args> | |
| void | warning (Args &&...args) MGIS_NOEXCEPT |
| template<typename... Args> | |
| void | debug (Args &&...args) MGIS_NOEXCEPT |
| Public Member Functions inherited from mgis::ErrorBacktrace | |
| void | assertOrTerminate (const bool, const char *const) |
| assert that the given boolean is true. If false, terminate is called. | |
| void | assertOrTerminate (const bool, const ErrorReport) |
| assert that the given boolean is true. If false, terminate is called. | |
| void | terminate (const char *const) |
| terminate the excution after displaying the given error message | |
| void | terminate (const ErrorReport) |
| terminate the excution after displaying the given error message | |
| InvalidResult | registerErrorMessage (const char *const) final |
| register a new error message | |
| InvalidResult | registerErrorMessage (const ErrorReport) MGIS_NOEXCEPT |
| register a new error message | |
| template<typename ReturnType> requires (internal::InvalidValueTraits<ReturnType>::isSpecialized) | |
| ReturnType | registerErrorMessage (const char *const) |
| register a new error message | |
| template<typename ReturnType> requires (internal::InvalidValueTraits<ReturnType>::isSpecialized) | |
| ReturnType | registerErrorMessage (const ErrorReport) MGIS_NOEXCEPT |
| register a new error message | |
| InvalidResult | registerErrorMessageWithoutSourceLocation (const ErrorReport) MGIS_NOEXCEPT |
| register a new error message | |
| void | clearErrorMessages () MGIS_NOEXCEPT |
| remove the error messages | |
| std::string | getErrorMessage (const bool=true) MGIS_NOEXCEPT |
| std::string | getRawErrorMessage (const bool=true) MGIS_NOEXCEPT |
| bool | empty () const MGIS_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 () MGIS_NOEXCEPT |
| specify if error reporting shall be fatal | |
| static void | unsetErrorReportingAsFatal () MGIS_NOEXCEPT |
| specify if error reporting shall be fatal | |
| static void | abort (std::string_view) |
| call the terminate handler | |
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.
| mgis::Context::Context | ( | ) |
default constructor
The verbositiy level is initialized by calling the getDefaultVerbosityLevel function.
| mgis::Context::Context | ( | const ContextInitializer & | ) |
constructor for an initializer
| [in] | i | initializer |
| void mgis::Context::debug | ( | Args && | ... | ) |
a simple wrapper around the log method which sets the minimun verbosity level to verboseDebug
| Args | types of the arguments |
| [in] | args | streamed object |
| void mgis::Context::disableLogStream | ( | ) |
disable the default log stream
| void mgis::Context::enableProfiling | ( | const bool | ) |
enable or disable profiling
| [in] | b | a boolean value stating whether profiling shall be enabled |
|
inlinenodiscard |
| policy | policy used to treat a failure |
|
inlinenodiscard |
|
nodiscard |
|
nodiscard |
|
inlinenodiscard |
|
nodiscard |
|
nodiscard |
|
nodiscard |
| std::ostream & mgis::Context::log | ( | const VerbosityLevel | , |
| Args && | ... ) |
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 |
| void mgis::Context::popProfilingNode | ( | double | ) |
pop the current profiling node from the execution stack and accumulate time
| [in] | dt | execution time of the section in seconds |
| void mgis::Context::pushProfilingNode | ( | std::string | ) |
push a new profiling node into the current execution stack
| [in] | name | name of the profiling section |
| void mgis::Context::setLogStream | ( | std::ostream & | ) |
set the current log stream.
| [in] | s | log stream |
| void mgis::Context::setLogStream | ( | std::shared_ptr< std::ostream > | ) |
set the current log stream.
| [in] | s | log stream |
| void mgis::Context::setVerbosityLevel | ( | const VerbosityLevel | ) |
change the level of verbosity
| [in] | l | the new verbose level |
|
nodiscard |
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 |
| void mgis::Context::warning | ( | Args && | ... | ) |
a simple wrapper around the log method to print a warning
| Args | types of the arguments |
| [in] | args | streamed object |