3 * Copyright 2005 Free Software Foundation, Inc.
5 * This file is part of GNU Radio
7 * GNU Radio is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
12 * GNU Radio is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Radio; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
23 %rename(error_handler) gr_error_handler;
24 %rename(file_error_handler) gr_file_error_handler;
26 class gr_error_handler {
29 ERR_DEBUG = 0x00000000,
30 ERR_MESSAGE = 0x00010000,
31 ERR_WARNING = 0x00020000,
32 ERR_ERROR = 0x00030000,
33 ERR_FATAL = 0x00040000
37 virtual ~gr_error_handler();
39 static gr_error_handler *default_handler();
40 static gr_error_handler *silent_handler();
42 static bool has_default_handler();
43 static void set_default_handler(gr_error_handler *errh);
45 virtual int nwarnings() const = 0;
46 virtual int nerrors() const = 0;
47 virtual void reset_counts() = 0;
49 void verror_text(seriousness s, const std::string &text);
52 %ignore gr_base_error_handler;
53 class gr_base_error_handler : public gr_error_handler {
58 gr_base_error_handler() : d_nwarnings(0), d_nerrors(0) {}
59 int nwarnings() const { return d_nwarnings; }
60 int nerrors() const { return d_nerrors; }
61 void reset_counts() { d_nwarnings = d_nerrors = 0; }
62 void count_error(seriousness s);
65 class gr_file_error_handler : public gr_base_error_handler {
67 gr_file_error_handler(int file_descriptor);
68 ~gr_file_error_handler();