#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 |
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.
00044 : _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.
00047 : _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 fastjet::ClusterSequenceAreaBase::_check_jet_alg_good_for_median(), fastjet::ClusterSequenceActiveAreaExplicitGhosts::_post_process(), and fastjet::ClusterSequenceArea::_warn_if_range_unsuitable().
00050 { 00051 if (_n_warn_so_far < _max_warn) { 00052 ostr << "WARNING: "; 00053 ostr << warning; 00054 _n_warn_so_far++; 00055 if (_n_warn_so_far == _max_warn) ostr << " (LAST SUCH WARNING)"; 00056 ostr << std::endl; 00057 } 00058 }
int LimitedWarning::_max_warn [private] |
int LimitedWarning::_n_warn_so_far [private] |
const int LimitedWarning::_max_warn_default = 5 [static, private] |
Definition at line 62 of file LimitedWarning.hh.