Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:33

0001 #ifndef ZMEXCEPTION_ICC
0002 #error "Exceptions/ZMexception.icc included without Exceptions/ZMexception.h"
0003 #endif
0004 
0005 
0006 // ----------------------------------------------------------------------
0007 //
0008 // ZMexception.icc
0009 //
0010 // Constructor ZMexception
0011 //  message()
0012 //  count()
0013 //  wasThrown()
0014 //  handlerUsed()
0015 //  severity()
0016 //  location(line, filename)
0017 //  fileName()
0018 //  line()
0019 //
0020 // Revision History:
0021 //      970912  MF  Initial version after separating .icc versus .cc
0022 //      970916  WEB Updated per code review
0023 //      970917  WEB Updated per code review 2
0024 //  971211  WEB Updated per code walkthrough
0025 //      980421  WEB     Moved name() and facility() from .icc to .cc
0026 //  980617  WEB Added namespace support
0027 //  990318  MF  Modified intializer list orders to avoid warnings
0028 //
0029 // ----------------------------------------------------------------------
0030 
0031 
0032 namespace zmex  {
0033 
0034 
0035 // ********************************
0036 //
0037 // Member functions in base class
0038 //
0039 // ********************************
0040 
0041 
0042 //**********************
0043 // Constructor
0044 //**********************
0045 
0046 inline ZMexception::ZMexception(
0047   const std::string  & mesg
0048 , const ZMexSeverity howBad
0049 , int                icount
0050 )  :
0051   message_(mesg)
0052 , line_( 0 )
0053 , sourceFileName_( "not ZMthrow'n as of yet" )
0054 , mySeverity_( howBad == ZMexSEVERITYenumLAST ? _classInfo.severity() : howBad )
0055 , myCount_( icount )
0056 , wasThrown_( false )
0057 { }
0058 
0059 //**********************
0060 // Information accessors
0061 //**********************
0062 
0063 // message()
0064 //----------
0065 
0066 inline std::string ZMexception::message() const {
0067   return  message_;
0068 }
0069 
0070 // count()
0071 //--------
0072 
0073 inline int ZMexception::count() const {
0074   return  myCount_;
0075 }
0076 
0077 // wasThrown()
0078 //------------
0079 
0080 inline bool ZMexception::wasThrown() const {
0081   return  wasThrown_;
0082 }
0083 
0084 inline void ZMexception::wasThrown( bool b ) const {
0085 #ifdef DEFECT_NO_MUTABLE
0086   ZMexception * localThis = const_cast<ZMexception * const>(this);
0087   localThis->wasThrown_ = b;
0088 #else
0089   wasThrown_ = b;
0090 #endif
0091 }
0092 
0093 
0094 //**************
0095 // handler names
0096 //**************
0097 
0098 // handlerUsed()
0099 //--------------
0100 
0101 inline std::string ZMexception::handlerUsed() const {
0102   return  handlerUsed_;
0103 }
0104 
0105 inline void ZMexception::handlerUsed( const std::string handlerName ) const {
0106 #ifdef DEFECT_NO_MUTABLE
0107   ZMexception * localThis = const_cast<ZMexception * const>(this);
0108   localThis->handlerUsed_ = handlerName;
0109 #else
0110   handlerUsed_ = handlerName;
0111 #endif
0112 }
0113 
0114 
0115 //***********
0116 // severity()
0117 //***********
0118 
0119 inline ZMexSeverity ZMexception::severity() const {
0120   return  mySeverity_;
0121 }
0122 
0123 
0124 
0125 //******************************
0126 // location setter and accessors
0127 //******************************
0128 
0129 // location(line, filename)
0130 // fileName()
0131 // line()
0132 //-------------------------
0133 
0134 inline void ZMexception::location( int iline, const std::string filename ) const  {
0135 #ifdef DEFECT_NO_MUTABLE
0136   ZMexception * localThis = const_cast<ZMexception * const>(this);
0137   localThis->line_ = iline;
0138   localThis->sourceFileName_ = filename;
0139 #else
0140   line_ = iline;
0141   sourceFileName_ = filename;
0142 #endif
0143 }
0144 
0145 inline std::string ZMexception::fileName() const {
0146   return  sourceFileName_;
0147 }
0148 
0149 inline int ZMexception::line() const {
0150   return  line_;
0151 }
0152 
0153 inline bool ZMexception::OKtoLog() const {
0154   return  classInfo().OKtoLog();
0155 }
0156 
0157 
0158 }  // namespace zmex