Fork me on GitHub

source: git/external/fastjet/Error.hh@ 5babc8b

ImprovedOutputFile Timing dual_readout llp
Last change on this file since 5babc8b was d7d2da3, checked in by pavel <pavel@…>, 12 years ago

move branches/ModularDelphes to trunk

  • Property mode set to 100644
File size: 2.9 KB
Line 
1#ifndef __FASTJET_ERROR_HH__
2#define __FASTJET_ERROR_HH__
3
4//STARTHEADER
5// $Id: Error.hh 2577 2011-09-13 15:11:38Z salam $
6//
7// Copyright (c) 2005-2011, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
8//
9//----------------------------------------------------------------------
10// This file is part of FastJet.
11//
12// FastJet is free software; you can redistribute it and/or modify
13// it under the terms of the GNU General Public License as published by
14// the Free Software Foundation; either version 2 of the License, or
15// (at your option) any later version.
16//
17// The algorithms that underlie FastJet have required considerable
18// development and are described in hep-ph/0512210. If you use
19// FastJet as part of work towards a scientific publication, please
20// include a citation to the FastJet paper.
21//
22// FastJet is distributed in the hope that it will be useful,
23// but WITHOUT ANY WARRANTY; without even the implied warranty of
24// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25// GNU General Public License for more details.
26//
27// You should have received a copy of the GNU General Public License
28// along with FastJet. If not, see <http://www.gnu.org/licenses/>.
29//----------------------------------------------------------------------
30//ENDHEADER
31
32#include<iostream>
33#include<string>
34#include "fastjet/internal/base.hh"
35
36FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
37
38/// @ingroup error_handling
39/// \class Error
40/// base class corresponding to errors that can be thrown by FastJet
41class Error {
42public:
43 /// default constructors
44 Error() {}
45
46 /// ctor from an error message
47 /// \param message to be printed
48 /// Note: in addition to the error message, one can choose to print the
49 /// backtrace (showing the last few calls before the error) by
50 /// using set_print_backtrace(true). The default is "false".
51 Error(const std::string & message);
52
53 /// virtual dummy dtor
54 virtual ~Error() {}
55
56 /// the error message
57 std::string message() const {return _message;}
58
59 /// controls whether the error message (and the backtrace, if its printing is enabled)
60 /// is printed out or not
61 static void set_print_errors(bool print_errors) {_print_errors = print_errors;}
62
63 /// controls whether the backtrace is printed out with the error message or not.
64 /// The default is "false".
65 static void set_print_backtrace(bool enabled) {_print_backtrace = enabled;}
66
67 /// sets the default output stream for all errors; by default
68 /// cerr; if it's null then error output is suppressed.
69 static void set_default_stream(std::ostream * ostr) {
70 _default_ostr = ostr;
71 }
72
73private:
74 std::string _message; ///< error message
75 static bool _print_errors; ///< do we print anything?
76 static bool _print_backtrace; ///< do we print the backtrace?
77 static std::ostream * _default_ostr; ///< the output stream (cerr if not set)
78};
79
80
81FASTJET_END_NAMESPACE
82
83#endif // __FASTJET_ERROR_HH__
Note: See TracBrowser for help on using the repository browser.