Fork me on GitHub

source: git/external/fastjet/Error.hh@ cd616b9

ImprovedOutputFile Timing dual_readout llp
Last change on this file since cd616b9 was 273e668, checked in by Pavel Demin <pavel.demin@…>, 10 years ago

upgrade FastJet to version 3.1.0

  • Property mode set to 100644
File size: 3.5 KB
Line 
1#ifndef __FASTJET_ERROR_HH__
2#define __FASTJET_ERROR_HH__
3
4//FJSTARTHEADER
5// $Id: Error.hh 3694 2014-09-18 13:21:54Z soyez $
6//
7// Copyright (c) 2005-2014, 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. They are described in the original FastJet paper,
19// hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use
20// FastJet as part of work towards a scientific publication, please
21// quote the version you use and include a citation to the manual and
22// optionally also to hep-ph/0512210.
23//
24// FastJet is distributed in the hope that it will be useful,
25// but WITHOUT ANY WARRANTY; without even the implied warranty of
26// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27// GNU General Public License for more details.
28//
29// You should have received a copy of the GNU General Public License
30// along with FastJet. If not, see <http://www.gnu.org/licenses/>.
31//----------------------------------------------------------------------
32//FJENDHEADER
33
34#include<iostream>
35#include<string>
36#include "fastjet/internal/base.hh"
37#include "fastjet/config.h"
38#if (!defined(FASTJET_HAVE_EXECINFO_H)) || defined(__FJCORE__)
39#include "fastjet/LimitedWarning.hh"
40#endif
41
42FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
43
44/// @ingroup error_handling
45/// \class Error
46/// base class corresponding to errors that can be thrown by FastJet
47class Error {
48public:
49 /// default constructors
50 Error() {}
51
52 /// ctor from an error message
53 /// \param message to be printed
54 /// Note: in addition to the error message, one can choose to print the
55 /// backtrace (showing the last few calls before the error) by
56 /// using set_print_backtrace(true). The default is "false".
57 Error(const std::string & message);
58
59 /// virtual dummy dtor
60 virtual ~Error() {}
61
62 /// the error message
63 std::string message() const {return _message;}
64
65 /// controls whether the error message (and the backtrace, if its printing is enabled)
66 /// is printed out or not
67 static void set_print_errors(bool print_errors) {_print_errors = print_errors;}
68
69 /// controls whether the backtrace is printed out with the error message or not.
70 /// The default is "false".
71 static void set_print_backtrace(bool enabled);
72
73 /// sets the default output stream for all errors; by default
74 /// cerr; if it's null then error output is suppressed.
75 static void set_default_stream(std::ostream * ostr) {
76 _default_ostr = ostr;
77 }
78
79private:
80
81#ifndef __FJCORE__
82#if defined(FASTJET_HAVE_EXECINFO_H) && defined(FASTJET_HAVE_DEMANGLING_SUPPORT)
83 /// demangle a given backtrace symbol
84 std::string _demangle(const char* symbol);
85#endif
86#endif
87
88 std::string _message; ///< error message
89 static bool _print_errors; ///< do we print anything?
90 static bool _print_backtrace; ///< do we print the backtrace?
91 static std::ostream * _default_ostr; ///< the output stream (cerr if not set)
92#if (!defined(FASTJET_HAVE_EXECINFO_H)) || defined(__FJCORE__)
93 static LimitedWarning _execinfo_undefined;
94#endif
95};
96
97
98FASTJET_END_NAMESPACE
99
100#endif // __FASTJET_ERROR_HH__
Note: See TracBrowser for help on using the repository browser.