casacore
Loading...
Searching...
No Matches
FITSError.h
Go to the documentation of this file.
1//# FITSError.h: default FITS error handling function, typdef, and enumeration
2//# Copyright (C) 1999
3//# Associated Universities, Inc. Washington DC, USA.
4//#
5//# This library is free software; you can redistribute it and/or modify it
6//# under the terms of the GNU Library General Public License as published by
7//# the Free Software Foundation; either version 2 of the License, or (at your
8//# option) any later version.
9//#
10//# This library is distributed in the hope that it will be useful, but WITHOUT
11//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13//# License for more details.
14//#
15//# You should have received a copy of the GNU Library General Public License
16//# along with this library; if not, write to the Free Software Foundation,
17//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18//#
19//# Correspondence concerning AIPS++ should be addressed as follows:
20//# Internet email: casa-feedback@nrao.edu.
21//# Postal address: AIPS++ Project Office
22//# National Radio Astronomy Observatory
23//# 520 Edgemont Road
24//# Charlottesville, VA 22903-2475 USA
25
26#ifndef FITS_FITSERROR_H
27#define FITS_FITSERROR_H
28
29//#! Includes go here
30#include <casacore/casa/aips.h>
31
32namespace casacore { //# NAMESPACE CASACORE - BEGIN
33
34// <summary>
35// default FITS error handling function, typdef, and enumeration
36// </summary>
37
38// <use visibility=export>
39
40// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
41// </reviewed>
42
43// <synopsis>
44// FITSError contains the enumeration specifying the possible error
45// message levels. It also contains the default error handling function
46// for the FITS classes.
47// </synopsis>
48//
49// <example>
50// This example shows how one could set up an error handler
51// which does what the FITS classes originally did - just
52// send the error message to cout without any indication as
53// to the severity of the error message.
54// <srcblock>
55// void coutErrHandler(const char *errMessage, FITSError::ErrorLevel)
56// { cout << errMessage << endl; }
57//
58// FitsInput fin("myFile", FITS::Disk, 10, coutErrHandler);
59// </srcblock>
60// Any error messages generated by fin will be sent to cout.
61// Error handlers for the HDUs would need to be indicated in
62// their constructors. For example:
63// <srcblock>
64// PrimaryArray<Float> pa(fin, coutErrHandler);
65// </srcblock>
66// The default error handler is FITSError::defaultHandler which
67// sends the error message to the global log sink at the
68// severity implied by ErrorLevel.
69//
70// The error handler only handles the error messages. It is up to
71// the programmer to check for the error status of classes like
72// FitsInput.
73// </example>
74//
75// <motivation>
76// Originally, FITS error message were simply sent to an ostream. In
77// order to have these error messages go to the Casacore logger by default,
78// this class was added. This was made a separate class because both
79// BlockIo and FITS need to use this class. The anticipated replacements
80// for the current FITS classes use a somewhat similar scheme.
81// </motivation>
82
84{
85public:
86
87 // WARN means that the FITS file is still usable - this generally
88 // happens when parsing the HDU and some minor, recoverable
89 // violation of the FITS rules is detected.
90 // SEVERE means that a fatal error has occurred and the FITS file
91 // can not be properly processed.
93
94 // The default error handler. The errMessage is posted to
95 // the global log sink at the severity implied by ErrorLevel.
96 // It is assumed that errMessage is null terminated.
97 static void defaultHandler(const char *errMessage, ErrorLevel severity);
98};
99
100// <summary>
101// Define a typedef for the handler function signature for convenience.
102// </summary>
103
104// <use visibility=export>
105// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
106// </reviewed>
107
108typedef void (*FITSErrorHandler) (const char* errMessage,
109 FITSError::ErrorLevel severity);
110
111
112
113} //# NAMESPACE CASACORE - END
114
115#endif
116
117
ErrorLevel
WARN means that the FITS file is still usable - this generally happens when parsing the HDU and some ...
Definition FITSError.h:92
static void defaultHandler(const char *errMessage, ErrorLevel severity)
The default error handler.
void(* FITSErrorHandler)(const char *errMessage, FITSError::ErrorLevel severity)
Define a typedef for the handler function signature for convenience.
Definition FITSError.h:108
this file contains all the compiler specific defines
Definition mainpage.dox:28