1 #ifndef __FASTJET_LIMITEDWARNING_HH__
2 #define __FASTJET_LIMITEDWARNING_HH__
35 #include "fastjet/internal/base.hh"
40 FASTJET_BEGIN_NAMESPACE
51 LimitedWarning() : _max_warn(_max_warn_default), _n_warn_so_far(0), _this_warning_summary(0) {}
54 LimitedWarning(
int max_warn_in) : _max_warn(max_warn_in), _n_warn_so_far(0), _this_warning_summary(0) {}
58 void warn(
const char * warning) {
warn(warning, _default_ostr);}
62 void warn(
const std::string & warning) {
warn(warning.c_str(), _default_ostr);}
65 void warn(
const char * warning, std::ostream * ostr);
68 void warn(
const std::string & warning, std::ostream * ostr) {
warn(warning.c_str(), ostr);}
79 _max_warn_default = max_warn;
92 static std::string summary();
95 int _max_warn, _n_warn_so_far;
96 static int _max_warn_default;
97 static std::ostream * _default_ostr;
98 typedef std::pair<std::string, unsigned int> Summary;
99 static std::list< Summary > _global_warnings_summary;
100 Summary * _this_warning_summary;
104 FASTJET_END_NAMESPACE
106 #endif // __FASTJET_LIMITEDWARNING_HH__
int max_warn() const
the maximum number of warning messages that will be printed by this instance of the class ...
int n_warn_so_far() const
the number of times so far that a warning has been registered with this instance of the class...
void warn(const std::string &warning)
outputs a warning to standard error (or the user's default warning stream if set) ...
static void set_default_stream(std::ostream *ostr)
sets the default output stream for all warnings (by default cerr; passing a null pointer prevents war...
LimitedWarning(int max_warn_in)
constructor that provides a user-set max number of warnings
void warn(const char *warning)
outputs a warning to standard error (or the user's default warning stream if set) ...
class to provide facilities for giving warnings up to some maximum number of times and to provide glo...
static void set_default_max_warn(int max_warn)
sets the default maximum number of warnings of a given kind before warning messages are silenced...
void warn(const std::string &warning, std::ostream *ostr)
outputs a warning to the specified stream
LimitedWarning()
constructor that provides a default maximum number of warnings