fastjet 2.4.3
|
class to provide facilities for giving warnings up to some maximum number of times More...
#include <LimitedWarning.hh>
Public Member Functions | |
LimitedWarning () | |
constructor that provides a default maximum number of warnings | |
LimitedWarning (int max_warn) | |
constructor that provides a used-set max number of warnings | |
void | warn (const std::string &warning, std::ostream &ostr=std::cerr) |
output a warning to ostr | |
Private Attributes | |
int | _max_warn |
int | _n_warn_so_far |
Static Private Attributes | |
static const int | _max_warn_default = 5 |
class to provide facilities for giving warnings up to some maximum number of times
Definition at line 40 of file LimitedWarning.hh.
LimitedWarning::LimitedWarning | ( | ) | [inline] |
constructor that provides a default maximum number of warnings
Definition at line 44 of file LimitedWarning.hh.
: _max_warn(_max_warn_default), _n_warn_so_far(0) {}
LimitedWarning::LimitedWarning | ( | int | max_warn | ) | [inline] |
constructor that provides a used-set max number of warnings
Definition at line 47 of file LimitedWarning.hh.
: _max_warn(max_warn), _n_warn_so_far(0) {}
void LimitedWarning::warn | ( | const std::string & | warning, |
std::ostream & | ostr = std::cerr |
||
) | [inline] |
output a warning to ostr
Definition at line 50 of file LimitedWarning.hh.
References _max_warn, and _n_warn_so_far.
Referenced by ClusterSequenceArea::_warn_if_range_unsuitable(), and ClusterSequenceArea::initialize_and_run_cswa().
{ if (_n_warn_so_far < _max_warn) { ostr << "WARNING: "; ostr << warning; _n_warn_so_far++; if (_n_warn_so_far == _max_warn) ostr << " (LAST SUCH WARNING)"; ostr << std::endl; } }
int LimitedWarning::_max_warn [private] |
Definition at line 61 of file LimitedWarning.hh.
Referenced by warn().
const int LimitedWarning::_max_warn_default = 5 [static, private] |
Definition at line 62 of file LimitedWarning.hh.
int LimitedWarning::_n_warn_so_far [private] |
Definition at line 61 of file LimitedWarning.hh.
Referenced by warn().