OPERA  1.0
Open source echelle spectrograph reduction pipeline
operaException.h
Go to the documentation of this file.
00001 /*******************************************************************
00002  ****                LIBRARY FOR OPERA v1.0                     ****
00003  *******************************************************************
00004  Library name: operaException
00005  Version: 1.0
00006  Description: class implements opera exceptions..
00007  Author(s): CFHT OPERA team
00008  Affiliation: Canada France Hawaii Telescope 
00009  Location: Hawaii USA
00010  Date: Aug/2011
00011  Contact: teeple@cfht.hawaii.edu
00012  
00013  Copyright (C) 2011  Opera Pipeline team, Canada France Hawaii Telescope
00014  
00015  This program is free software: you can redistribute it and/or modify
00016  it under the terms of the GNU General Public License as published by
00017  the Free Software Foundation, either version 3 of the License, or
00018  (at your option) any later version.
00019  
00020  This program is distributed in the hope that it will be useful,
00021  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023  GNU General Public License for more details.
00024  
00025  You should have received a copy of the GNU General Public License
00026  along with this program.  If not, see:
00027  http://software.cfht.hawaii.edu/licenses
00028  -or-
00029  http://www.gnu.org/licenses/gpl-3.0.html
00030  ********************************************************************/
00031 
00032 // $Date$
00033 // $Id$
00034 // $Revision$
00035 // $Locker$
00036 // $Log$
00037 
00038 /*
00039  * This class defines an opera Exception.
00040  *
00041  */
00042 #ifndef OPERAEXCEPTION_H_
00043 #define OPERAEXCEPTION_H_
00044 
00045 #include <iostream>
00046 #include <exception>
00047 #include <string>
00048 #include <sstream>
00049 
00050 #include "fitsio.h"
00051 #include "operaError.h"
00052 
00053 using namespace std;
00054 
00060 class operaException: public exception {
00061 
00062 private:
00063 
00064         operaErrorCode errorcode;                       // the error code itself
00065         string file;                                            // optional file of originating exception
00066         int line;                                                       // optional linr number of originating exception
00067         string function;                                        // optional function name of originating exception
00068         string message;                                         // optional message
00069         
00070 public:
00071 
00077         operaException();
00085         operaException(operaErrorCode Errorcode);
00094         operaException(string Message, operaErrorCode Errorcode);
00106         operaException(string Message, operaErrorCode Errorcode, string Filename, string Function, int Line);
00107         ~operaException() throw() {}
00108 
00109         /*
00110          * getters and setters
00111          */
00112         
00118         string getFormattedMessage();
00119         
00125         void setErrorCode(const operaErrorCode errcode);
00132         operaErrorCode getErrorCode();
00133         
00140         void setMessage(string m);
00146         string getMessage();
00147         
00154         void setLine(int l);
00160         int getLine();
00161         
00168         void setFunction(string func);
00174         string getFunction();
00175         
00182         void setFile(string f);
00188         string getFile();
00189         
00190 };
00191 
00192 
00193 
00194 #endif /* OPERAEXCEPTION_H_ */