Salome HOME
Merging with the MAN_SALOME2 branch
[modules/med.git] / src / MEDMEM / MEDMEM_Exception.hxx
1 /*
2  File MedException.hxx
3  $Header$
4 */
5
6 #ifndef MEDEXCEPTION_HXX
7 #define MEDEXCEPTION_HXX
8
9 using namespace std;
10
11 #include <exception>
12 #include <iostream>
13
14 #ifndef LOCALIZED
15 #define LOCALIZED(message) message , __FILE__ , __LINE__
16 #endif
17
18 #define MED_EXCEPTION MEDEXCEPTION
19
20 /*!
21   Class used to throws exception.\n
22   Inherits from public exception.
23 */
24 namespace MEDMEM {
25 //--------------------------------------//
26   class MEDEXCEPTION : public exception
27 //--------------------------------------//
28 {
29 private :
30   MEDEXCEPTION(void);
31
32 protected :
33   const char* _text ;
34
35 public :
36   MEDEXCEPTION(const char *text, const char *fileName=0, 
37                const unsigned int lineNumber=0 );
38   MEDEXCEPTION(const MEDEXCEPTION &ex );
39   ~MEDEXCEPTION() throw ();
40   friend ostream & operator<< (ostream &os, const MEDEXCEPTION &ex );
41   virtual const char *what(void) const throw () ;
42 } ;
43
44
45 //---------------------------------------------------------//
46 class MED_DRIVER_NOT_FOUND_EXCEPTION : public MEDEXCEPTION
47 //---------------------------------------------------------//
48 {
49 private :
50   MED_DRIVER_NOT_FOUND_EXCEPTION(void);
51
52 public :
53   MED_DRIVER_NOT_FOUND_EXCEPTION(const char *text, const char *fileName=0, 
54                                  const unsigned int lineNumber=0 );
55   MED_DRIVER_NOT_FOUND_EXCEPTION(const MED_DRIVER_NOT_FOUND_EXCEPTION &ex );
56   ~MED_DRIVER_NOT_FOUND_EXCEPTION() throw();
57
58 };
59 };
60
61 #endif  /* MEDEXCEPTION_HXX */