• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

Error.h

Go to the documentation of this file.
00001 /** @file
00002 
00003   A brief file description
00004 
00005   @section license License
00006 
00007   Licensed to the Apache Software Foundation (ASF) under one
00008   or more contributor license agreements.  See the NOTICE file
00009   distributed with this work for additional information
00010   regarding copyright ownership.  The ASF licenses this file
00011   to you under the Apache License, Version 2.0 (the
00012   "License"); you may not use this file except in compliance
00013   with the License.  You may obtain a copy of the License at
00014 
00015       http://www.apache.org/licenses/LICENSE-2.0
00016 
00017   Unless required by applicable law or agreed to in writing, software
00018   distributed under the License is distributed on an "AS IS" BASIS,
00019   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00020   See the License for the specific language governing permissions and
00021   limitations under the License.
00022  */
00023 
00024 /****************************************************************************
00025 
00026   Error.h
00027 
00028   The objective of the error system is to enable graceful recovery
00029   from all errors.
00030 
00031 
00032  ****************************************************************************/
00033 
00034 #if !defined _Error_h_
00035 #define _Error_h_
00036 
00037 #include "libts.h"
00038 #include "Diags.h"
00039 
00040 //////////////////////////////////////////////////////////////////////////////
00041 //
00042 // Base Error class (abstract)
00043 //
00044 //////////////////////////////////////////////////////////////////////////////
00045 
00046 struct ErrorClass
00047 {
00048   const char *filename;
00049   int line_number;
00050   const char *function_name;
00051 
00052   const char *format_string;
00053 
00054     ErrorClass(const char *afile, int aline, const char *afunction)
00055   : filename(afile), line_number(aline), function_name(afunction), format_string(NULL)
00056   {
00057   }
00058 
00059   void operator() (const char *aformat_string ...);
00060 
00061   virtual ~ ErrorClass();
00062   virtual void raise(va_list ap, const char *prefix = NULL);
00063 };
00064 
00065 #if !defined (__GNUC__)
00066 #define __FUNCTION__ NULL
00067 #endif
00068 
00069 //////////////////////////////////////////////////////////////////////////////
00070 //
00071 // Fatal Messages (abstract)
00072 //
00073 //////////////////////////////////////////////////////////////////////////////
00074 
00075 struct FatalClass: public ErrorClass
00076 {
00077   FatalClass(const char *afile, int aline, const char *afunction)
00078   : ErrorClass(afile, aline, afunction)
00079   {
00080   }
00081 };
00082 
00083 
00084 //////////////////////////////////////////////////////////////////////////////
00085 //
00086 // RequestFatal Messages
00087 //
00088 //////////////////////////////////////////////////////////////////////////////
00089 
00090 struct RequestFatalClass: public FatalClass
00091 {
00092   virtual void raise(va_list ap, const char *prefix = NULL);
00093     RequestFatalClass(const char *afile, int aline, const char *afunction)
00094   : FatalClass(afile, aline, afunction)
00095   {
00096   }
00097 };
00098 
00099 #define RequestFatal (*(new RequestFatalClass(__FILE__,__LINE__,__FUNCTION__)))
00100 
00101 //////////////////////////////////////////////////////////////////////////////
00102 //
00103 // ThreadFatal Messages
00104 //
00105 //////////////////////////////////////////////////////////////////////////////
00106 
00107 struct ThreadFatalClass: public FatalClass
00108 {
00109   virtual void raise(va_list ap, const char *prefix = NULL);
00110     ThreadFatalClass(const char *afile, int aline, const char *afunction)
00111   : FatalClass(afile, aline, afunction)
00112   {
00113   }
00114 };
00115 
00116 #define ThreadFatal (*(new ThreadFatalClass(__FILE__,__LINE__,__FUNCTION__)))
00117 
00118 //////////////////////////////////////////////////////////////////////////////
00119 //
00120 // ProcessorFatal Messages
00121 //
00122 //////////////////////////////////////////////////////////////////////////////
00123 
00124 struct ProcessorFatalClass: public FatalClass
00125 {
00126   virtual void raise(va_list ap, const char *prefix = NULL);
00127     ProcessorFatalClass(const char *afile, int aline, const char *afunction)
00128   : FatalClass(afile, aline, afunction)
00129   {
00130   }
00131 };
00132 
00133 #define ProcessorFatal \
00134 (*(new ProcessorFatalClass(__FILE__,__LINE__,__FUNCTION__)))
00135 
00136 //////////////////////////////////////////////////////////////////////////////
00137 //
00138 // ProcessFatal Messages
00139 //
00140 //////////////////////////////////////////////////////////////////////////////
00141 
00142 struct ProcessFatalClass: public FatalClass
00143 {
00144   virtual void raise(va_list ap, const char *prefix = NULL);
00145     ProcessFatalClass(const char *afile, int aline, const char *afunction)
00146   : FatalClass(afile, aline, afunction)
00147   {
00148   }
00149 };
00150 
00151 #define ProcessFatal \
00152 (*(new ProcessFatalClass(__FILE__,__LINE__,__FUNCTION__)))
00153 
00154 
00155 //////////////////////////////////////////////////////////////////////////////
00156 //
00157 // MachineFatal Messages
00158 //
00159 //////////////////////////////////////////////////////////////////////////////
00160 
00161 struct MachineFatalClass: public FatalClass
00162 {
00163   virtual void raise(va_list ap, const char *prefix = NULL);
00164     MachineFatalClass(const char *afile, int aline, const char *afunction)
00165   : FatalClass(afile, aline, afunction)
00166   {
00167   }
00168 };
00169 
00170 #define MachineFatal \
00171 (*(new MachineFatalClass(__FILE__,__LINE__,__FUNCTION__)))
00172 
00173 #endif  /*_Error_h_*/

Generated by  doxygen 1.7.1