Fork me on GitHub

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

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

update FastJet library to 3.1.2

  • Property mode set to 100644
File size: 4.2 KB
Line 
1#ifndef __FASTJET_ERROR_HH__
2#define __FASTJET_ERROR_HH__
3
4//FJSTARTHEADER
5// $Id: Error.hh 3809 2015-02-20 13:05:13Z 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
98/// @ingroup error_handling
99/// \class InternalError
100/// class corresponding to critical internal errors
101///
102/// This is an error class (derived from Error) meant for serious,
103/// critical, internal errors that we still want to be catchable by an
104/// end-user [e.g. a serious issue in clustering where the end-user
105/// can catch it and retry with a different strategy]
106///
107/// Please directly contact the FastJet authors if you see such an
108/// error.
109class InternalError : public Error{
110public:
111 /// ctor with error message:
112 /// just add a bit of info to the message and pass it to the base class
113 InternalError(const std::string & message_in) : Error(std::string("*** CRITICAL INTERNAL FASTJET ERROR *** CONTACT THE AUTHORS *** ") + message_in){ }
114};
115
116
117FASTJET_END_NAMESPACE
118
119#endif // __FASTJET_ERROR_HH__
Note: See TracBrowser for help on using the repository browser.