The ONX_ErrorCounter is useful for counting errors that occur in a section of code. More...

#include <opennurbs_extensions.h>

Public Member Functions

 ONX_ErrorCounter ()=default
 
 ONX_ErrorCounter (const ONX_ErrorCounter &)=default
 
 ~ONX_ErrorCounter ()=default
 
unsigned int AddLibraryErrors ()
 Adds the number of calls to ON_ERROR since the last call to ClearLibraryErrors(), AddLibraryErrors(), ClearLibraryErrorsAndWarnings, or AddLibraryErrorsAndWarnings(). More...
 
unsigned int AddLibraryErrorsAndWarnings ()
 Calls AddLibraryErrors() and AddLibraryWarnings(). More...
 
unsigned int AddLibraryWarnings ()
 Adds the number of calls to ON_WARNING since the last call to ClearLibraryWarnings(), AddLibraryWarnings(), ClearLibraryErrorsAndWarnings(), or AddLibraryErrorsAndWarnings(). More...
 
void ClearLibraryErrors ()
 Saves the current value of ON_GetErrorCount() so future calls to ON_ERROR can be counted. More...
 
void ClearLibraryErrorsAndWarnings ()
 Calls ClearLibraryErrors() and ClearLibraryWarnings(). More...
 
void ClearLibraryWarnings ()
 Saves the current value of ON_GetWarningCount() so future calls to ON_WARNING can be counted. More...
 
void Dump (ON_TextLog &text_log) const
 
unsigned int ErrorCount () const
 
unsigned int FailureCount () const
 
unsigned int IncrementErrorCount ()
 Adds one to the error count. More...
 
unsigned int IncrementFailureCount ()
 Adds one to the failure count. More...
 
unsigned int IncrementWarningCount ()
 Adds one to the warning count. More...
 
const ONX_ErrorCounter operator+ (const ONX_ErrorCounter &rhs)
 
const ONX_ErrorCounter operator+= (const ONX_ErrorCounter &rhs)
 
ONX_ErrorCounteroperator= (const ONX_ErrorCounter &)=default
 
unsigned int TotalCount () const
 
unsigned int WarningCount () const
 

Static Public Attributes

static const ONX_ErrorCounter Zero
 

Detailed Description

The ONX_ErrorCounter is useful for counting errors that occur in a section of code.

Constructor & Destructor Documentation

◆ ONX_ErrorCounter() [1/2]

ONX_ErrorCounter::ONX_ErrorCounter ( )
default

◆ ~ONX_ErrorCounter()

ONX_ErrorCounter::~ONX_ErrorCounter ( )
default

◆ ONX_ErrorCounter() [2/2]

ONX_ErrorCounter::ONX_ErrorCounter ( const ONX_ErrorCounter )
default

Member Function Documentation

◆ AddLibraryErrors()

unsigned int ONX_ErrorCounter::AddLibraryErrors ( )

Adds the number of calls to ON_ERROR since the last call to ClearLibraryErrors(), AddLibraryErrors(), ClearLibraryErrorsAndWarnings, or AddLibraryErrorsAndWarnings().

Returns
The number of errors added.

◆ AddLibraryErrorsAndWarnings()

unsigned int ONX_ErrorCounter::AddLibraryErrorsAndWarnings ( )

Calls AddLibraryErrors() and AddLibraryWarnings().

Returns
The number of errors and warnings added.

◆ AddLibraryWarnings()

unsigned int ONX_ErrorCounter::AddLibraryWarnings ( )

Adds the number of calls to ON_WARNING since the last call to ClearLibraryWarnings(), AddLibraryWarnings(), ClearLibraryErrorsAndWarnings(), or AddLibraryErrorsAndWarnings().

Returns
The number of warnings added.

◆ ClearLibraryErrors()

void ONX_ErrorCounter::ClearLibraryErrors ( )

Saves the current value of ON_GetErrorCount() so future calls to ON_ERROR can be counted.

◆ ClearLibraryErrorsAndWarnings()

void ONX_ErrorCounter::ClearLibraryErrorsAndWarnings ( )

◆ ClearLibraryWarnings()

void ONX_ErrorCounter::ClearLibraryWarnings ( )

Saves the current value of ON_GetWarningCount() so future calls to ON_WARNING can be counted.

◆ Dump()

void ONX_ErrorCounter::Dump ( ON_TextLog text_log) const

◆ ErrorCount()

unsigned int ONX_ErrorCounter::ErrorCount ( ) const
Returns
Number of errors.

◆ FailureCount()

unsigned int ONX_ErrorCounter::FailureCount ( ) const
Returns
Number of failures.

◆ IncrementErrorCount()

unsigned int ONX_ErrorCounter::IncrementErrorCount ( )

Adds one to the error count.

Returns
Number of errors including this one.

◆ IncrementFailureCount()

unsigned int ONX_ErrorCounter::IncrementFailureCount ( )

Adds one to the failure count.

Returns
Number of failures including this one.

◆ IncrementWarningCount()

unsigned int ONX_ErrorCounter::IncrementWarningCount ( )

Adds one to the warning count.

Returns
Number of warnings including this one.

◆ operator+()

const ONX_ErrorCounter ONX_ErrorCounter::operator+ ( const ONX_ErrorCounter rhs)

◆ operator+=()

const ONX_ErrorCounter ONX_ErrorCounter::operator+= ( const ONX_ErrorCounter rhs)

◆ operator=()

ONX_ErrorCounter& ONX_ErrorCounter::operator= ( const ONX_ErrorCounter )
default

◆ TotalCount()

unsigned int ONX_ErrorCounter::TotalCount ( ) const
Returns
Number of failures, erros, and warnings.

◆ WarningCount()

unsigned int ONX_ErrorCounter::WarningCount ( ) const
Returns
Number of warnings.

Member Data Documentation

◆ Zero

const ONX_ErrorCounter ONX_ErrorCounter::Zero
static