DUNE-FEM (unstable)

Dune::Fem::DebugCounter< CounterImp > Class Template Reference

A counter only present if NDEBUG is not defined. More...

#include <dune/fem/misc/debug.hh>

Public Types

typedef CounterImp CounterType
 integral type for the actual counting
 

Public Member Functions

 DebugCounter (const CounterType count=0)
 constructor More...
 
 DebugCounter (const ThisType &other)
 copy constructor
 
ThisTypeoperator++ ()
 increment operator More...
 
ThisTypeoperator-- ()
 decrement operator More...
 
bool operator== (const ThisType &other)
 comparison for equality More...
 
bool operator!= (const ThisType &other)
 comparison for inequality More...
 

Detailed Description

template<class CounterImp = unsigned int>
class Dune::Fem::DebugCounter< CounterImp >

A counter only present if NDEBUG is not defined.

There are several cases, where we need a counter for debugging purposes that should only be present, if NDEBUG is not defined.

In debug mode, this counter wraps a standard integer type, otherwise its size is zero.

Note
The comparison operators always return true, if NDEBUG is defined!

Constructor & Destructor Documentation

◆ DebugCounter()

template<class CounterImp = unsigned int>
Dune::Fem::DebugCounter< CounterImp >::DebugCounter ( const CounterType  count = 0)
inline

constructor

Note
This constructor implicitly defines a conversion from CounterType to DebugCounter. This is very useful in comparison statements.
Parameters
[in]countvalue to initialize the counter with (defaults to 0)

Member Function Documentation

◆ operator!=()

template<class CounterImp = unsigned int>
bool Dune::Fem::DebugCounter< CounterImp >::operator!= ( const ThisType other)
inline

comparison for inequality

Compares to DebugCounters for inequality. If USE_DEBUG_CNT is defined, the result will be true.

Note
Due to the implicit conversion, the second argument may also be of CounterType.
Parameters
[in]otherDebugCounter to compare this one to
Returns
true, if the counters differ or USE_DEBUG_CNT is defined

◆ operator++()

template<class CounterImp = unsigned int>
ThisType & Dune::Fem::DebugCounter< CounterImp >::operator++ ( )
inline

increment operator

If USE_DEBUG_CNT is not defined, the counter is incremented by 1. Otherwise nothing happens (and the entire call will be removed during oprimization).

◆ operator--()

template<class CounterImp = unsigned int>
ThisType & Dune::Fem::DebugCounter< CounterImp >::operator-- ( )
inline

decrement operator

If USE_DEBUG_CNT is not defined, the counter is decremented by 1. Otherwise nothing happens (and the entire call will be removed during oprimization).

◆ operator==()

template<class CounterImp = unsigned int>
bool Dune::Fem::DebugCounter< CounterImp >::operator== ( const ThisType other)
inline

comparison for equality

Compares to DebugCounters for equality. If USE_DEBUG_CNT is defined, the result will be true.

Note
Due to the implicit conversion, the second argument may also be of CounterType.
Parameters
[in]otherDebugCounter to compare this one to
Returns
true, if the counters equal or USE_DEBUG_CNT is defined

The documentation for this class was generated from the following file:
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 27, 22:29, 2024)