exception_ptr.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef _EXCEPTION_PTR_H
00032 #define _EXCEPTION_PTR_H
00033
00034 #pragma GCC visibility push(default)
00035
00036 #include <bits/c++config.h>
00037 #include <exception_defines.h>
00038
00039 #if !defined(_GLIBCXX_ATOMIC_BUILTINS_4)
00040 # error This platform does not support exception propagation.
00041 #endif
00042
00043 extern "C++" {
00044
00045 namespace std
00046 {
00047
00048
00049
00050
00051
00052
00053 namespace __exception_ptr
00054 {
00055
00056
00057
00058 class exception_ptr;
00059 }
00060
00061 using __exception_ptr::exception_ptr;
00062
00063
00064
00065
00066
00067 exception_ptr current_exception() throw();
00068
00069
00070 void rethrow_exception(exception_ptr) __attribute__ ((__noreturn__));
00071
00072
00073 template<typename _Ex>
00074 exception_ptr
00075 copy_exception(_Ex __ex) throw();
00076
00077 namespace __exception_ptr
00078 {
00079 bool
00080 operator==(const exception_ptr&, const exception_ptr&) throw();
00081
00082 bool
00083 operator!=(const exception_ptr&, const exception_ptr&) throw();
00084
00085 class exception_ptr
00086 {
00087 void* _M_exception_object;
00088
00089 explicit exception_ptr(void* __e) throw();
00090
00091 void _M_addref() throw();
00092 void _M_release() throw();
00093
00094 void *_M_get() const throw();
00095
00096 void _M_safe_bool_dummy();
00097
00098 friend exception_ptr std::current_exception() throw();
00099 friend void std::rethrow_exception(exception_ptr);
00100
00101 public:
00102 exception_ptr() throw();
00103
00104 typedef void (exception_ptr::*__safe_bool)();
00105
00106
00107 exception_ptr(__safe_bool) throw();
00108
00109 exception_ptr(const exception_ptr&) throw();
00110
00111 #ifdef __GXX_EXPERIMENTAL_CXX0X__
00112 exception_ptr(exception_ptr&& __o) throw()
00113 : _M_exception_object(__o._M_exception_object)
00114 { __o._M_exception_object = 0; }
00115 #endif
00116
00117 exception_ptr&
00118 operator=(const exception_ptr&) throw();
00119
00120 #ifdef __GXX_EXPERIMENTAL_CXX0X__
00121 exception_ptr&
00122 operator=(exception_ptr&& __o) throw()
00123 {
00124 exception_ptr(__o).swap(*this);
00125 return *this;
00126 }
00127 #endif
00128
00129 ~exception_ptr() throw();
00130
00131 void
00132 swap(exception_ptr&) throw();
00133
00134 #ifdef __GXX_EXPERIMENTAL_CXX0X__
00135 void
00136 swap(exception_ptr &&__o) throw()
00137 {
00138 void *__tmp = _M_exception_object;
00139 _M_exception_object = __o._M_exception_object;
00140 __o._M_exception_object = __tmp;
00141 }
00142 #endif
00143
00144 bool operator!() const throw();
00145 operator __safe_bool() const throw();
00146
00147 friend bool
00148 operator==(const exception_ptr&, const exception_ptr&) throw();
00149
00150 const type_info*
00151 __cxa_exception_type() const throw();
00152 };
00153
00154 }
00155
00156
00157 template<typename _Ex>
00158 exception_ptr
00159 copy_exception(_Ex __ex) throw()
00160 {
00161 __try
00162 {
00163 throw __ex;
00164 }
00165 __catch(...)
00166 {
00167 return current_exception ();
00168 }
00169 }
00170
00171
00172 }
00173
00174 }
00175
00176 #pragma GCC visibility pop
00177
00178 #endif