1.3.64
 
Loading...
Searching...
No Matches
helios::WarningAggregator Class Reference

Warning message aggregator for reducing console flooding. More...

#include <global.h>

Public Member Functions

 WarningAggregator ()=default
 Constructor.
 
void addWarning (const std::string &category, const std::string &message)
 Add a warning to be aggregated.
 
void report (std::ostream &stream=std::cerr, bool compact=false)
 Report all accumulated warnings and clear.
 
size_t getCount (const std::string &category) const
 Get the count of warnings for a specific category.
 
void clear ()
 Clear all accumulated warnings.
 
void setEnabled (bool enabled)
 Enable or disable warning accumulation.
 
bool isEnabled () const
 Check if warning accumulation is enabled.
 

Detailed Description

Warning message aggregator for reducing console flooding.

Accumulates warning messages during loops/iterations and reports aggregated summaries.

This class helps prevent console flooding when processing millions of primitives/objects by collecting warnings and reporting counts with example messages instead of printing each warning individually. Thread-safe for use in OpenMP parallel regions.

Example usage:

for(uint UUID : UUIDs) {
if(someCondition) {
warnings.addWarning("category_name", "Warning message here");
}
}
warnings.report(std::cerr); // Prints aggregated summary

Definition at line 1546 of file global.h.

Member Function Documentation

◆ addWarning()

void helios::WarningAggregator::addWarning ( const std::string &  category,
const std::string &  message 
)

Add a warning to be aggregated.

Parameters
[in]categoryCategory identifier for this warning type (e.g., "fzero_convergence_failure")
[in]messageThe warning message text
Note
Thread-safe: can be called from OpenMP parallel regions

Definition at line 3026 of file global.cpp.

◆ clear()

void helios::WarningAggregator::clear ( )

Clear all accumulated warnings.

Definition at line 3094 of file global.cpp.

◆ getCount()

size_t helios::WarningAggregator::getCount ( const std::string &  category) const

Get the count of warnings for a specific category.

Parameters
[in]categoryCategory identifier
Returns
Number of warnings accumulated for this category

Definition at line 3084 of file global.cpp.

◆ isEnabled()

bool helios::WarningAggregator::isEnabled ( ) const

Check if warning accumulation is enabled.

Returns
True if enabled, false otherwise

Definition at line 3104 of file global.cpp.

◆ report()

void helios::WarningAggregator::report ( std::ostream &  stream = std::cerr,
bool  compact = false 
)

Report all accumulated warnings and clear.

Parameters
[in]streamOutput stream to write warnings to (default: std::cerr)
[in]compactIf true, output single line per category with count only (default: false)
Note
Standard format: "WARNING: N instances of 'category' (showing first 3):"
Compact format: "WARNING: N instances of 'category'"

Definition at line 3043 of file global.cpp.

◆ setEnabled()

void helios::WarningAggregator::setEnabled ( bool  enabled)

Enable or disable warning accumulation.

Parameters
[in]enabledTrue to enable, false to disable
Note
When disabled, calls to addWarning() are ignored

Definition at line 3100 of file global.cpp.


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