Filter Library Camera Interface Physics

QAFDebug Namespace Reference


Functions

void SetModule (LPCTSTR szModuleName)
 This function allows setting the module name for additional logging options.
bool tryEnable (void)
 Try to enable the error log.
bool tryDisable (void)
 Try to disable the error log.
void OutputDebugStringEx (LPCTSTR szFilename, const int iLine, LPCTSTR szExpression, LPCTSTR szErrorMessage, const LPDWORD pdwLastError=NULL)
 Reports about critical errors.
HRESULT qafReportComError (const HRESULT hrStatus, LPCTSTR szFile, const int iLine)
 Reports about critical errors if HRESULT is failed.
DWORD ReportWinError (const DWORD dwError, LPCTSTR szFile, const int iLine)
 Reports about critical errors if dwError != ERROR_SUCCESS.
DWORD GetLogDir (LPTSTR lpszDirBuf, const DWORD dwMaxLen)
 Return an accessible directory name for all log files.
HRESULT ReportComError (const HRESULT hrStatus, LPCTSTR szFile, const int iLine)
 Reports about critical errors if HRESULT is failed.
bool ReportCheckError (const unsigned long ulConstExpr, const unsigned long ulCheckExpr, LPCTSTR szExpr, LPCTSTR szFile, const int iLine)
 Reports about critical errors if ulConstExpr != ulCheckExpr.


Function Documentation

DWORD QAFDebug::GetLogDir ( LPTSTR  lpszDirBuf,
const DWORD  dwMaxLen 
)

Parameters:
lpszDirBuf LPTSTR buffer for the directory name
dwMaxLen DWORD size of the buffer in characters (including the trailing zero)
Returns:
DWORD length of the returned string or 0 in case of error
Author:
Andrew Schetinin
Date:
February 6, 2003
Get the buffer and the buffer length in TCHAR characters including tailing 0x00(00). Returns the length of the written string or 0 if the directory name cannot be generated. The directory name is constructed from the:

1. Try get the folder path from the environment variable QAFDEBUG_LOG_ENV_VAR

2. Try CSIDL_APPDATA (C: and Settings Data) + QAFDEBUG_LOG_SUBFOLDER

3. Try CSIDL_COMMON_APPDATA (C: and Settings Users Data) + QAFDEBUG_LOG_SUBFOLDER

4. Return 0

If the folders are missing on the disk, they are created.

Definition at line 949 of file QAFDebug.cpp.

References CreateSubFolders0(), CSIDL_COMMON_APPDATA, CSIDL_FLAG_CREATE, Q_SHGFP_TYPE_CURRENT, QAFDEBUG_LOG_ENV_VAR, QAFDEBUG_LOG_SUBFOLDER, and SHGetSpecialFolderPathCustom().

Referenced by CQAFDebug::qafGetLogFileName().

void QAFDebug::OutputDebugStringEx ( LPCTSTR  szFilename,
const int  iLine,
LPCTSTR  szExpression,
LPCTSTR  szErrorMessage,
const LPDWORD  pdwLastError = NULL 
)

Parameters:
szFilename LPCTSTR - the file name returned by _FILE_
iLine const int - the line number returned by _LINE_
szExpression LPCTSTR - the expression where the error was detected
szErrorMessage LPCTSTR - the error message generated
pdwLastError LPDWORD - the last error code must be restored
Author:
Andrew Schetinin
Date:
November 20, 2002
Reports critical errors. This function is used by debug macroses. Do not use it in your code!

Definition at line 731 of file QAFDebug.cpp.

References CQAFDebug::GetApplication(), CPreserveLastError::GetSavedLastError(), CQAFDebug::isEnabled(), isRN(), MAX_BUF_SIZE, ODS(), QAFDEBUG_ERROR_ALLOCATE_BUFFER, QAFDEBUG_ERROR_FORMAT, QAFDEBUG_STD_FORMAT, and CQAFDebug::tryOpenLogFile().

Referenced by qafReportComError(), ReportCheckError(), and ReportWinError().

HRESULT QAFDebug::qafReportComError ( const HRESULT  hrStatus,
LPCTSTR  szFile,
const int  iLine 
)

Parameters:
hrStatus HRESULT - tested on failure
szFile LPCTSTR - the file name returned by _FILE_
iLine const int - the line number returned by _LINE_
Returns:
HRESULT the same hrStatus that it received
Author:
Andrew Schetinin
Date:
November 20, 2002
Reports critical errors if HRESULT is failed. This function is used by debug macroses. Do not use it in your code!

Definition at line 896 of file QAFDebug.cpp.

References OutputDebugStringEx(), QAFDEBUG_ERROR_NO_MESSAGE, QAFDEBUG_FMT_HRESULT, and QAFDEBUG_FMT_HRESULT_LEN.

Referenced by ReportComError().

bool QAFDebug::ReportCheckError ( const unsigned long  ulConstExpr,
const unsigned long  ulCheckExpr,
LPCTSTR  szExpr,
LPCTSTR  szFile,
const int  iLine 
) [inline]

Parameters:
ulConstExpr unsigned long - the expected expression
ulCheckExpr unsigned long - the returned expression
szExpr LPCTSTR - the expression of ulCheckExpr
szFile LPCTSTR - the file name returned by _FILE_
iLine const int - the line number returned by _LINE_
Returns:
bool the same as (ulConstExpr == ulCheckExpr)
Author:
Andrew Schetinin
Date:
July 2, 2003
Reports critical errors if ulConstExpr != ulCheckExpr. This function is used by debug macroses. Do not use it in your code!

Definition at line 891 of file QAFDebug.h.

References OutputDebugStringEx().

HRESULT QAFDebug::ReportComError ( const HRESULT  hrStatus,
LPCTSTR  szFile,
const int  iLine 
) [inline]

Parameters:
hrStatus HRESULT - tested on failure
szFile LPCTSTR - the file name returned by _FILE_
iLine const int - the line number returned by _LINE_
Returns:
HRESULT the same hrStatus that it received
Author:
Andrew Schetinin
Date:
November 20, 2002
Reports critical errors if HRESULT is failed. This function is used by debug macroses. Do not use it in your code!

Definition at line 870 of file QAFDebug.h.

References qafReportComError().

DWORD QAFDebug::ReportWinError ( const DWORD  dwError,
LPCTSTR  szFile,
const int  iLine 
)

Parameters:
dwError DWORD - tested on failure
szFile LPCTSTR - the file name returned by _FILE_
iLine const int - the line number returned by _LINE_
Returns:
DWORD the same as dwError
Author:
Andrew Schetinin
Date:
March 19, 2003
Reports critical errors if dwError != ERROR_SUCCESS. This function is used by debug macroses. Do not use it in your code!

Definition at line 924 of file QAFDebug.cpp.

References OutputDebugStringEx(), QAFDEBUG_ERROR_NO_MESSAGE, QAFDEBUG_FMT_ERROR_SUCCESS, and QAFDEBUG_FMT_ERROR_SUCCESS_LEN.

void QAFDebug::SetModule ( LPCTSTR  szModuleName  ) 

Parameters:
LPCTSTR,name of the DLL or EXE, 0-terminated, not longer than MAX_PATH characters.
Returns:
void
Author:
Andrew Schetinin
Date:
December 7, 2003
This will switch on logging of the file name and version number of the current EXE or DLL. It will be logged after the file name and path of the hosting process, only the module file name without path is logged: FILENAME.DLL(1.0.0.1)

Definition at line 700 of file QAFDebug.cpp.

References CQAFDebug::SetLogModule().

bool QAFDebug::tryDisable ( void   ) 

Returns:
bool true if the log is disabled successfully
Author:
Andrew Schetinin
Date:
November 20, 2002
Try to disable the error log. This function is used only in unit tests. Do not use it in your code!

Definition at line 717 of file QAFDebug.cpp.

References CQAFDebug::tryDisable().

bool QAFDebug::tryEnable ( void   ) 

Returns:
bool true if the log is enabled successfully
Author:
Andrew Schetinin
Date:
November 20, 2002
Try to enable the error log. This function is used only in unit tests. Do not use it in your code!

Definition at line 712 of file QAFDebug.cpp.

References CQAFDebug::tryEnable().


Camera Filter Library documentation © 2004-2007 by Leiden Probe Microscopy