summaryrefslogtreecommitdiff
path: root/inc/Standard_Failure.hxx
blob: 9b1cfffedf1ea479ca14028b2245ad94d81d1a72 (plain)
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
// This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to 
// this header file considered to be the "object code" form of the original source.

#ifndef _Standard_Failure_HeaderFile
#define _Standard_Failure_HeaderFile

#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_DefineHandle_HeaderFile
#include <Standard_DefineHandle.hxx>
#endif
#ifndef _Handle_Standard_Failure_HeaderFile
#include <Handle_Standard_Failure.hxx>
#endif

#ifndef _Standard_CString_HeaderFile
#include <Standard_CString.hxx>
#endif
#ifndef _Standard_Transient_HeaderFile
#include <Standard_Transient.hxx>
#endif
#ifndef _Standard_OStream_HeaderFile
#include <Standard_OStream.hxx>
#endif
#ifndef _Standard_SStream_HeaderFile
#include <Standard_SStream.hxx>
#endif
class Standard_NoSuchObject;



//!   Forms the root of the entire exception hierarchy. <br>
class Standard_Failure : public Standard_Transient {

public:

  
//!   Creates a status object of type "Failure". <br>
  Standard_EXPORT   Standard_Failure();
Standard_EXPORT Standard_Failure (const Standard_Failure& f);
  
//!   Creates a status object of type "Failure". <br>
  Standard_EXPORT   Standard_Failure(const Standard_CString aString);
Standard_EXPORT Standard_Failure& operator= (const Standard_Failure& f);
  
  Standard_EXPORT     void Destroy() ;
~Standard_Failure()
{
  Destroy();
}
  
//!   Prints on the stream <s> the exception name followed by <br>
//!   the error message. <br>
//!  Level: Advanced <br>
//!  Warning: <br>
//!   The operator "OStream& operator<< (Standard_OStream&, <br>
//!                                      Handle(Standard_Failure)&)" <br>
//!   is implemented. (This operator uses the method Print) <br>
//! <br>
  Standard_EXPORT     void Print(Standard_OStream& s) const;
    void operator<<(Standard_OStream& s) const
{
  Print(s);
}
  //! Returns error message <br>
        Standard_CString GetMessageString() const;
  //! Sets error message <br>
  Standard_EXPORT     void SetMessageString(const Standard_CString aMessage) ;
  
  Standard_EXPORT     void Reraise() ;
  
  Standard_EXPORT     void Reraise(const Standard_CString aMessage) ;
  //! Reraises a caught exception and changes its error message. <br>
  Standard_EXPORT     void Reraise(const Standard_SStream& aReason) ;
  //! Raises an exception of type "Failure" and associates <br>
//!          an error message to it. The message can be printed <br>
//!          in an exception handler. <br>
  Standard_EXPORT   static  void Raise(const Standard_CString aMessage = "") ;
  //! Raises an exception of type "Failure" and associates <br>
//!          an error message to it. The message can be constructed <br>
//!          at run-time. <br>
  Standard_EXPORT   static  void Raise(const Standard_SStream& aReason) ;
  //! Used to construct an instance of the exception object <br>
//!          as a handle. Shall be used to protect against possible <br>
//!          construction of exception object in C stack -- that is <br>
//!          dangerous since some of methods require that object <br>
//!          was allocated dynamically. <br>
  Standard_EXPORT   static  Handle_Standard_Failure NewInstance(const Standard_CString aMessage) ;
  //! Used to throw CASCADE exception from C signal handler. <br>
//!          On platforms that do not allow throwing C++ exceptions <br>
//!          from this handler (e.g. Linux), uses longjump to get to <br>
//!          the current active signal handler, and only then is <br>
//!          converted to C++ exception. <br>
  Standard_EXPORT     void Jump() const;
  //! Returns the last caught exception. <br>
//!          Needed when exceptions are emulated by C longjumps, <br>
//!          in other cases is also provided for compatibility. <br>
  Standard_EXPORT   static  Handle_Standard_Failure Caught() ;



  DEFINE_STANDARD_RTTI(Standard_Failure)

protected:

  //! Used only if standard C++ exceptions are used. <br>
//!          Throws exception of the same type as this by C++ throw, <br>
//!          and stores current object as last thrown exception, <br>
//!          to be accessible by method Caught() <br>
  Standard_EXPORT   virtual  void Throw() const;



private: 


Standard_CString myMessage;


};


#include <Standard_Failure.lxx>



// other Inline functions and methods (like "C++: function call" methods)


#endif