LimitedWarning Class Reference

class to provide facilities for giving warnings up to some maximum number of times More...

#include <LimitedWarning.hh>

List of all members.

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


Detailed Description

class to provide facilities for giving warnings up to some maximum number of times

Definition at line 40 of file LimitedWarning.hh.


Constructor & Destructor Documentation

LimitedWarning::LimitedWarning (  )  [inline]

constructor that provides a default maximum number of warnings

Definition at line 44 of file LimitedWarning.hh.

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) {}


Member Function Documentation

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   }


Member Data Documentation

int LimitedWarning::_max_warn [private]

Definition at line 61 of file LimitedWarning.hh.

Referenced by warn().

int LimitedWarning::_n_warn_so_far [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.


The documentation for this class was generated from the following file:
Generated on Tue Dec 18 17:05:43 2007 for fastjet by  doxygen 1.5.2