Loading [MathJax]/extensions/tex2jax.js
slope 0.29.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
slope::WarningLogger Class Reference

Thread-safe warning logger for tracking runtime warnings. More...

#include <logger.h>

Static Public Member Functions

static void addWarning (WarningCode code, const std::string &message)
 Log a new warning.
 
static std::vector< WarninggetWarnings ()
 Retrieve all warnings from all threads.
 
static void clearWarnings ()
 Clear all warnings.
 
static bool hasWarnings ()
 Check if any warnings have been logged.
 
static std::vector< WarninggetThreadWarnings (int thread_id)
 Get warnings from a specific thread.
 

Detailed Description

Thread-safe warning logger for tracking runtime warnings.

WarningLogger provides facilities for logging, retrieving, and managing warnings that occur during computation. It is thread-safe and designed to work with OpenMP parallel regions.

Warnings are tracked per thread and can be accessed either individually by thread or aggregated across all threads.

Definition at line 73 of file logger.h.

Member Function Documentation

◆ addWarning()

void slope::WarningLogger::addWarning ( WarningCode  code,
const std::string &  message 
)
static

Log a new warning.

Stores a warning message associated with a specific warning code. Thread-safe and can be called from within OpenMP parallel regions. If a warning with the same code already exists for the current thread, the message will be replaced.

Parameters
codeThe warning code categorizing this warning
messageDescriptive message for the warning

Definition at line 31 of file logger.cpp.

◆ clearWarnings()

void slope::WarningLogger::clearWarnings ( )
static

Clear all warnings.

Removes all warnings across all threads.

Definition at line 56 of file logger.cpp.

◆ getThreadWarnings()

std::vector< Warning > slope::WarningLogger::getThreadWarnings ( int  thread_id)
static

Get warnings from a specific thread.

Retrieves all warnings that were logged by a particular thread.

Parameters
thread_idThe ID of the thread whose warnings should be retrieved
Returns
std::vector<Warning> Vector of warnings for the specified thread

Definition at line 75 of file logger.cpp.

◆ getWarnings()

std::vector< Warning > slope::WarningLogger::getWarnings ( )
static

Retrieve all warnings from all threads.

Combines warnings from all threads into a single collection.

Returns
std::vector<Warning> Vector of all warnings

Definition at line 43 of file logger.cpp.

◆ hasWarnings()

bool slope::WarningLogger::hasWarnings ( )
static

Check if any warnings have been logged.

Returns
bool True if any thread has logged a warning, false otherwise

Definition at line 63 of file logger.cpp.


The documentation for this class was generated from the following files: