📄 ncbidiag.inl
字号:
}inlineconst CNcbiDiag& Critical(const CNcbiDiag& diag) { diag << Endm; diag.m_Severity = eDiag_Critical; return diag;}inlineconst CNcbiDiag& Fatal(const CNcbiDiag& diag) { diag << Endm; diag.m_Severity = eDiag_Fatal; return diag;}inlineconst CNcbiDiag& Trace(const CNcbiDiag& diag) { diag << Endm; diag.m_Severity = eDiag_Trace; return diag;}///////////////////////////////////////////////////////// CDiagBuffer::inlinevoid CDiagBuffer::Reset(const CNcbiDiag& diag) { if (&diag == m_Diag) m_Stream->rdbuf()->SEEKOFF(0, IOS_BASE::beg, IOS_BASE::out);}inlinevoid CDiagBuffer::EndMess(const CNcbiDiag& diag) { if (&diag == m_Diag) Flush();}inlinevoid CDiagBuffer::Detach(const CNcbiDiag* diag) { if (diag == m_Diag) { Flush(); m_Diag = 0; }}inlinebool CDiagBuffer::GetTraceEnabled(void) { return (sm_TraceDefault == eDT_Default) ? GetTraceEnabledFirstTime() : sm_TraceEnabled;}///////////////////////////////////////////////////////// EDiagPostFlag::inlinebool IsSetDiagPostFlag(EDiagPostFlag flag, TDiagPostFlags flags) { if (flags & eDPF_Default) flags |= CDiagBuffer::sm_PostFlags; return (flags & flag) != 0;}///////////////////////////////////////////////////////// CDiagMessage::inlineSDiagMessage::SDiagMessage(EDiagSev severity, const char* buf, size_t len, const char* file, size_t line, TDiagPostFlags flags, const char* prefix, int err_code, int err_subcode, const char* err_text){ m_Severity = severity; m_Buffer = buf; m_BufferLen = len; m_File = file; m_Line = line; m_Flags = flags; m_Prefix = prefix; m_ErrCode = err_code; m_ErrSubCode = err_subcode; m_ErrText = err_text;}///////////////////////////////////////////////////////// CDiagErrCodeInfo::inlineCDiagErrCodeInfo::CDiagErrCodeInfo(void){ return;}inlineCDiagErrCodeInfo::CDiagErrCodeInfo(const string& file_name){ if ( !Read(file_name) ) { throw runtime_error ("CDiagErrCodeInfo:: failed to read error descriptions from file " + file_name); }}inlineCDiagErrCodeInfo::CDiagErrCodeInfo(CNcbiIstream& is){ if ( !Read(is) ) { throw runtime_error ("CDiagErrCodeInfo:: failed to read error descriptions"); }}inlineCDiagErrCodeInfo::~CDiagErrCodeInfo(void){ Clear();}inlinevoid CDiagErrCodeInfo::Clear(void){ m_Info.clear();}inlinevoid CDiagErrCodeInfo::SetDescription(const ErrCode& err_code, const SDiagErrCodeDescription& description){ m_Info[err_code] = description;}inlinebool CDiagErrCodeInfo::HaveDescription(const ErrCode& err_code) const{ return m_Info.find(err_code) != m_Info.end();}/* * =========================================================================== * $Log: ncbidiag.inl,v $ * Revision 1000.3 2004/06/01 19:08:00 gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.43 * * Revision 1.43 2004/04/26 19:28:24 ucko * Make previous change compiler-dependent due to MSVC bugginess. * * Revision 1.42 2004/04/26 14:35:48 ucko * Move CNcbiDiag::operator<< to ncbidiag.inl to make GCC 3.4 happy. * * Revision 1.41 2004/03/18 23:03:35 vakatov * Cosmetics * * Revision 1.40 2004/03/18 22:49:32 vakatov * SetDiagFixedPostLevel() -- get rid of extraneous and breaking 'const' in arg * * Revision 1.39 2004/03/10 19:54:12 gorelenk * Changed NCBI_XNCBI_EXPORT prefixes for class CDiagBuffer members. * * Revision 1.38 2003/11/12 20:30:25 ucko * Make extra flags for severity-trace messages tunable. * * Revision 1.37 2003/11/06 21:40:34 vakatov * A somewhat more natural handling of the 'eDPF_Default' flag -- replace * it by the current global flags, then merge these with other flags (if any) * * Revision 1.36 2003/04/25 20:53:16 lavr * Introduce draft version of IgnoreDiagDieLevel() * Clear error code/subcode from Endm() and Reset() manipulators * * Revision 1.35 2002/12/18 22:53:21 dicuccio * Added export specifier for building DLLs in windows. Added global list of * all such specifiers in mswin_exports.hpp, included through ncbistl.hpp * * Revision 1.34 2002/08/01 18:48:08 ivanov * Added stuff to store and output error verbose messages for error codes * * Revision 1.33 2002/07/10 16:18:43 ivanov * Added CNcbiDiag::StrToSeverityLevel(). * Rewrite and rename SetDiagFixedStrPostLevel() -> SetDiagFixedPostLevel() * * Revision 1.32 2002/07/09 16:38:00 ivanov * Added GetSeverityChangeEnabledFirstTime(). * Fix usage forced set severity post level from environment variable * to work without NcbiApplication::AppMain() * * Revision 1.31 2002/07/02 18:26:08 ivanov * Added CDiagBuffer::DisableDiagPostLevelChange() * * Revision 1.30 2002/06/26 18:36:37 gouriano * added CNcbiException class * * Revision 1.29 2002/04/23 19:57:26 vakatov * Made the whole CNcbiDiag class "mutable" -- it helps eliminate * numerous warnings issued by SUN Forte6U2 compiler. * Do not use #NO_INCLASS_TMPL anymore -- apparently all modern * compilers seem to be supporting in-class template methods. * * Revision 1.28 2002/04/11 20:39:17 ivanov * CVS log moved to end of the file * * Revision 1.27 2002/02/13 22:39:13 ucko * Support AIX. * * Revision 1.26 2002/02/07 19:45:53 ucko * Optionally transfer ownership in GetDiagHandler. * * Revision 1.25 2001/11/14 15:14:59 ucko * Revise diagnostic handling to be more object-oriented. * * Revision 1.24 2001/10/29 15:16:11 ucko * Preserve default CGI diagnostic settings, even if customized by app. * * Revision 1.23 2001/10/16 23:44:05 vakatov * + SetDiagPostAllFlags() * * Revision 1.22 2001/06/14 03:37:28 vakatov * For the ErrCode manipulator, use CNcbiDiag:: method rather than a friend * * Revision 1.21 2001/06/13 23:19:36 vakatov * Revamped previous revision (prefix and error codes) * * Revision 1.20 2001/06/13 20:51:52 ivanov * + PushDiagPostPrefix(),PopPushDiagPostPrefix() - stack post prefix messages. * + ERR_POST_EX, LOG_POST_EX - macros for posting with error codes. * + ErrCode(code[,subcode]) - CNcbiDiag error code manipulator. * + eDPF_ErrCode, eDPF_ErrSubCode - new post flags. * * Revision 1.19 2001/05/17 14:51:04 lavr * Typos corrected * * Revision 1.18 2000/04/04 22:31:57 vakatov * SetDiagTrace() -- auto-set basing on the application * environment and/or registry * * Revision 1.17 2000/02/18 16:54:04 vakatov * + eDiag_Critical * * Revision 1.16 2000/01/20 16:52:30 vakatov * SDiagMessage::Write() to replace SDiagMessage::Compose() * + operator<<(CNcbiOstream& os, const SDiagMessage& mess) * + IsSetDiagHandler(), IsDiagStream() * * Revision 1.15 1999/12/29 22:30:22 vakatov * Use "exit()" rather than "abort()" in non-#_DEBUG mode * * Revision 1.14 1999/12/28 18:55:24 vasilche * Reduced size of compiled object files: * 1. avoid inline or implicit virtual methods (especially destructors). * 2. avoid std::string's methods usage in inline methods. * 3. avoid string literals ("xxx") in inline methods. * * Revision 1.13 1999/09/27 16:23:20 vasilche * Changed implementation of debugging macros (_TRACE, _THROW*, _ASSERT etc), * so that they will be much easier for compilers to eat. * * Revision 1.12 1999/05/14 16:23:18 vakatov * CDiagBuffer::Reset: easy fix * * Revision 1.11 1999/05/12 21:11:42 vakatov * Minor fixes to compile by the Mac CodeWarrior C++ compiler * * Revision 1.10 1999/05/04 00:03:07 vakatov * Removed the redundant severity arg from macro ERR_POST() * * Revision 1.9 1999/04/30 19:20:58 vakatov * Added more details and more control on the diagnostics * See #ERR_POST, EDiagPostFlag, and ***DiagPostFlag() * * Revision 1.8 1998/12/30 21:52:17 vakatov * Fixed for the new SunPro 5.0 beta compiler that does not allow friend * templates and member(in-class) templates * * Revision 1.7 1998/11/05 00:00:42 vakatov * Fix in CDiagBuffer::Reset() to avoid "!=" ambiguity when using * new(templated) streams * * Revision 1.6 1998/11/04 23:46:36 vakatov * Fixed the "ncbidbg/diag" header circular dependencies * * Revision 1.5 1998/11/03 22:28:33 vakatov * Renamed Die/Post...Severity() to ...Level() * * Revision 1.4 1998/11/03 20:51:24 vakatov * Adaptation for the SunPro compiler glitchs(see conf. #NO_INCLASS_TMPL) * * Revision 1.3 1998/10/30 20:08:25 vakatov * Fixes to (first-time) compile and test-run on MSVS++ * ========================================================================== */#endif /* def CORELIB___NCBIDIAG__HPP && ndef CORELIB___NCBIDIAG__INL */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -