1 | // -*- C++ -*- |
---|
2 | /////////////////////////////////////////////////////////////////////////////// |
---|
3 | // File: siscone_error.h // |
---|
4 | // Description: header file for SISCone error messages (Csiscone_error) // |
---|
5 | // This file is part of the SISCone project. // |
---|
6 | // For more details, see http://projects.hepforge.org/siscone // |
---|
7 | // // |
---|
8 | // Copyright (c) 2006 Gavin Salam and Gregory Soyez // |
---|
9 | // // |
---|
10 | // This program is free software; you can redistribute it and/or modify // |
---|
11 | // it under the terms of the GNU General Public License as published by // |
---|
12 | // the Free Software Foundation; either version 2 of the License, or // |
---|
13 | // (at your option) any later version. // |
---|
14 | // // |
---|
15 | // This program is distributed in the hope that it will be useful, // |
---|
16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of // |
---|
17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
---|
18 | // GNU General Public License for more details. // |
---|
19 | // // |
---|
20 | // You should have received a copy of the GNU General Public License // |
---|
21 | // along with this program; if not, write to the Free Software // |
---|
22 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // |
---|
23 | // // |
---|
24 | // $Revision:: 859 $// |
---|
25 | // $Date:: 2012-11-28 02:49:23 +0100 (Wed, 28 Nov 2012) $// |
---|
26 | /////////////////////////////////////////////////////////////////////////////// |
---|
27 | |
---|
28 | #ifndef __SISCONE_ERROR_H__ |
---|
29 | #define __SISCONE_ERROR_H__ |
---|
30 | |
---|
31 | #include<iostream> |
---|
32 | #include<string> |
---|
33 | |
---|
34 | namespace siscone{ |
---|
35 | |
---|
36 | /// \class Csiscone_error |
---|
37 | /// class corresponding to errors that will be thrown by siscone |
---|
38 | class Csiscone_error { |
---|
39 | public: |
---|
40 | /// default ctor |
---|
41 | Csiscone_error() {;}; |
---|
42 | |
---|
43 | /// ctor with a given error message |
---|
44 | /// \param message_in the error message to be printed |
---|
45 | Csiscone_error(const std::string & message_in) { |
---|
46 | m_message = message_in; |
---|
47 | if (m_print_errors) std::cerr << "siscone::Csiscone_error: "<< message_in << std::endl; |
---|
48 | }; |
---|
49 | |
---|
50 | /// access to the error message |
---|
51 | std::string message() const {return m_message;}; |
---|
52 | |
---|
53 | /// switch on/off the error message printing |
---|
54 | /// \param print_errors errors will be printed when true |
---|
55 | static void setm_print_errors(bool print_errors) { |
---|
56 | m_print_errors = print_errors;}; |
---|
57 | |
---|
58 | private: |
---|
59 | std::string m_message; ///< the error message |
---|
60 | static bool m_print_errors; ///< do we print error messages? |
---|
61 | }; |
---|
62 | |
---|
63 | } |
---|
64 | #endif |
---|