File: FitsError.h

package info (click to toggle)
ccfits 2.5%2Bdfsg-1
  • links: PTS
  • area: main
  • in suites: buster, stretch
  • size: 3,528 kB
  • sloc: cpp: 15,148; sh: 10,115; makefile: 91
file content (150 lines) | stat: -rw-r--r-- 3,794 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
//	Astrophysics Science Division,
//	NASA/ Goddard Space Flight Center
//	HEASARC
//	http://heasarc.gsfc.nasa.gov
//	e-mail: ccfits@legacy.gsfc.nasa.gov
//
//	Original author: Ben Dorman

#ifndef FITSERROR_H
#define FITSERROR_H 1
#include <exception>
#include <iostream>
//#include <exception>
//#include <iostream>
//#include <stl.h>
#include <string>
using std::string;


namespace CCfits {

  /*! \class FitsException

        @ingroup FITSexcept
        @brief FitsException is the base class for all exceptions thrown by this library.

        All exceptions derived from this class can be caught by a single 'catch' clause
        catching FitsException by reference (which is the point of this base class design).


        A static "verboseMode" parameter is provided by the FITS class to 
        control diagnostics - if FITS::verboseMode() is true, all diagnostics
        are printed (for debugging purposes). If not, then a boolean <I>silent</I>
        determines printing of messages. Each exception derived from FitsException
        must define a default value for the <I>silent</I> parameter.

  */

  /*! \fn  FitsException::FitsException(const string& diag, bool& silent)

        \param diag A diagnostic string to be printed optionally.
        \param silent A boolean controlling the printing of messages
  */      

  /*! \fn const string& FitsException::message () const

       \brief returns the error message

       This returns the diagnostic error message associated with the
       exception object, and which is accessible regardless of the verboseMode
       and silent flag settings.  
  */     

    /*! \class FitsError

        @ingroup FITSexcept
        @brief FitsError is the exception thrown by non-zero cfitsio status codes.


  */

  /*! \fn  FitsError::FitsError(int errornum, bool silent)

        \brief ctor for cfitsio exception: translates status code into cfitsio error message

        The exception prefixes the string "Fits Error: " to the message printed by cfitsio.

        \param errornum The cfitsio status code produced by the error.
        \param silent A boolean controlling the printing of messages
  */      

  /*! \class FitsFatal

        @ingroup FITSexcept
        @brief [potential] base class for exceptions to be thrown on internal library error.

        As of this version there are no subclasses. This error requests that the
        user reports this circumstance to HEASARC.

  */

  /*! \fn  FitsFatal::FitsFatal(const string& diag)

        \brief Prints a message starting "*** CCfits Fatal Error: ..." and calls <i>terminate()</i>

        \param diag A diagnostic string to be printed identifying the context of the error.
  */ 
  //	Base class for exceptions generated by CCfits that don't
  //	return FITS error codes (for example, array errors or seek errors).



  class FitsException 
  {
    public:
        FitsException (const string& msg, bool& silent);

        const string& message () const;

    protected:
        void addToMessage (const string& msgQual);

    private:
    private: //## implementation
      // Data Members for Class Attributes
        string m_message;

  };



  class FitsError : public FitsException  //## Inherits: <unnamed>%399170BD017D
  {
    public:
        FitsError (int errornum, bool silent = true);

    protected:
    private:
        void printMsg (int error);

    private: //## implementation
  };



  class FitsFatal 
  {
    public:
        FitsFatal (const string& diag);

    protected:
    private:
    private: //## implementation
  };

  // Class CCfits::FitsException 

  inline const string& FitsException::message () const
  {
     return m_message;
  }

  // Class CCfits::FitsError 

  // Class CCfits::FitsFatal 

} // namespace CCfits


#endif