00001 // Dear emacs, this is -*- c++ -*- 00002 // $Id: TReturnCode.h 598368 2014-05-22 10:23:54Z krasznaa $ 00003 #ifndef XAODROOTACCESS_TOOLS_TRETURNCODE_H 00004 #define XAODROOTACCESS_TOOLS_TRETURNCODE_H 00005 00006 namespace xAOD { 00007 00024 class TReturnCode { 00025 00026 public: 00028 enum EReturnCode { 00029 kFailure = 0, 00030 kSuccess = 1, 00031 00032 00033 kRecoverable = 2 00034 }; 00035 00037 TReturnCode( EReturnCode code ); 00039 TReturnCode( const TReturnCode& parent ); 00041 ~TReturnCode(); 00042 00044 TReturnCode& operator= ( const TReturnCode& rhs ); 00045 00047 EReturnCode code() const; 00048 00050 bool isSuccess() const; 00052 bool isFailure() const; 00054 bool isRecoverable() const; 00055 00057 operator bool() const { return isSuccess(); } 00058 00060 void setChecked() const { m_checked = true; } 00062 void ignore() const { setChecked(); } 00063 00065 static void enableFailure(); 00067 static void disableFailure(); 00068 00069 private: 00071 EReturnCode m_code; 00073 mutable bool m_checked; 00074 00075 }; // class TReturnCode 00076 00077 } // namespace xAOD 00078 00079 #endif // XAODROOTACCESS_TOOLS_TRETURNCODE_H