Filter Library Camera Interface Physics

QAFDebug.h File Reference


Detailed Description

Definition in file QAFDebug.h.

#include <windows.h>
#include <winerror.h>
#include <tchar.h>
#include <stdio.h>

Go to the source code of this file.

Namespaces

namespace  QAFDebug

Defines

#define QAF_UNITTEST_DISABLED
 Disable unit tests related staff, I recommend you to define it for release builds and disable unit tests too.
#define Q_ASSERT(bCondition)
 This macro reports about critical error if bCondition evaluates to false.
#define Q_CHECK(exprConst, exprCheck)
 This macro reports about critical error if exprConst != exprCheck.
#define Q_INVALID(bCondition)
 This macro reports about critical error if bCondition evaluates to true.
#define Q_SUCCEEDED(hResultExpr)   SUCCEEDED(Q_ERROR(hResultExpr))
 Add reporting critical errors to the standard SUCCEEDED macro.
#define Q_FAILED(hResultExpr)   FAILED(Q_ERROR(hResultExpr))
 Add reporting critical errors to the standard FAILED macro.
#define Q_ERROR(hResultExpr)   (QAFDebug::ReportComError( hResultExpr, _T(__FILE__), __LINE__ ))
 Reports critical errors returned from your function before returning.
#define Q_ERROR_SUCCESS(dwErrorExpr)   (ERROR_SUCCESS == QAFDebug::ReportWinError( dwErrorExpr, _T(__FILE__), __LINE__ ))
 Reports critical errors from ERROR_SUCCESS group.
#define Q_LOG(lpszMessage)   (QAFDebug::OutputDebugStringEx( _T(__FILE__), __LINE__, QAFDEBUG_ERROR_LOG, lpszMessage ))
 Reports critical errors with a string message.
#define Q_MFC_EXCEPTION(e)
 Reports critical exceptions.
#define Q_EXCEPTION(e)   Q_MFC_EXCEPTION(e)
 Synonim for Q_MFC_EXCEPTION macro - left for backward compatibility.
#define Q_STD_EXCEPTION(e)   QAFDebug::OutputDebugStringEx( _T(__FILE__), __LINE__, QAF_EXPR(_T(#e)), e.what() )
 Reports critical exceptions.
#define Q_MAPI_ERROR(hresult, piObjectMAPI)
 Reports critical exceptions.
#define Q_RETURN(hr)   do { HRESULT hrtmp83457 = hr; if( Q_SUCCEEDED(hrtmp83457) ) ; else return hrtmp83457; } while( false )
 If input HRESULT failed, then macro returns it.
#define Q_ENABLE_DEBUG_LOG   ;
 Enable the error log in case if it was disabled because of the previous unit test failure.
#define Q_SILENT(expr)   expr;
 Temporary disable the error log and evaluate the expression.
#define Q_SET_MODULE(szModuleName)   QAFDebug::SetModule( szModuleName )
 This macro allows setting the module name for additional logging options.
#define QAFDEBUG_ERROR_PREFIX   _T("Debug System Error --> ")
 Errors in the reporting engine.
#define QAFDEBUG_ERROR_ASSERTION   _T("Assertion raised\r\n")
 Fixed error message for assertion raised.
#define QAFDEBUG_ERROR_INVALID_ASSUMPTION   _T("Invalid assumption is raised\r\n")
 Fixed error message for invalid assumption raised.
#define QAFDEBUG_ERROR_NO_MESSAGE   _T("[Could not find any description for the error]\r\n")
 Fixed error message for unknown error.
#define QAFDEBUG_ERROR_LOG   _T("Error Message")
 Fixed expression for the custom error message.
#define QAF_EXPR(expression)   (NULL)
 The Expression string is printed to the error log only in DEBUG builds.

Functions

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

Variables

const LPCTSTR QAFDEBUG_SILENCE_MUTEX = _T("QAFDebugMutex001A")
 The name of the mutex for synchronizing the unit test support staff.
const LPCTSTR QAFDEBUG_LOG_SUBFOLDER = _T("Camera\\Log\\")
 Subfolder in the application data folder.
const LPCTSTR QAFDEBUG_LOG_ENV_VAR = _T("LPMCAMERALOGDIR")
 Name of the environment variable that may set the output debug log folder.
const DWORD QAFDEBUG_LOG_FILE_MAX_SIZE = (1024 * 1024)
 Maximum log file size.
const LPCTSTR QAFDEBUG_LOG_FILE_NAME = _T("error.log")
 The current error log file name.
const LPCTSTR QAFDEBUG_LOG_OLD_FILE_NAME = _T("error.old.log")
 The previous error log file name.
const LPCTSTR QDEBUG_SHMEMFILE = _T("QAFDbgMemFile01")
 The name of the memory-mapped-file that stores the shared flags.


Define Documentation

#define Q_ASSERT ( bCondition   ) 

Value:

((bCondition) ? true : (QAFDebug::OutputDebugStringEx( \
                _T(__FILE__), __LINE__, QAF_EXPR(_T(#bCondition)), QAFDEBUG_ERROR_ASSERTION ), false) )
Parameters:
bCondition Any expression that evaluates to bool or int
Returns:
bool (same as bCondition)
Author:
Andrew Schetinin
Date:
September 26, 2002
This macro output a error report string to the error log (file and/or debug console). The string looks like that:
 c:\SharedUnits\Dev\QMSOColl\QMSOColl.cpp(56) : Assertion raised  
        time:        2003-12-08 16:11:34:003
        process:     0x000006F4
        thread:      0x00000148
        application: c:\ErrorLog_demo\Debug\ErrorLog.exe <1.0.0.3>
        module:      c:\SharedUnits\Dev\QMSOColl\Debug\QMSOColl.dll <1.0.0.10>
        last error:  2, The system cannot find the file specified.
        expression:  false
It is recommended to use this macro in all places where any error means program crash or non-predictable behavior of dependent code. It will help to detect where first the error appeared. Recommended for IFs without ELSE or testing return values of functions.
        if( Q_ASSERT( TRUE == bVarShouldAlwaysBeTRUE ) ) // here it will write to the error log
                do_something();

Definition at line 163 of file QAFDebug.h.

Referenced by CScanBaseBuffer::AllocateDataBuffer(), CScanFilterBGS_MCN::Apply(), CScanFilter::Apply(), CScanFilterBGS_Planar::ApplyCore(), CFilterDlg_LowPass::ApplyFilter(), CFilterDlg_LinearRegression::ApplyFilter(), CFilterDlg_HighPass::ApplyFilter(), CScanBaseBuffer::ClearDataBuffer(), CFilterDlg_CrossCorrelateF::ComputeHash(), CFilterDlg_CrossCorrelate2::ComputeHash(), CFilterDlg_CrossCorrelate::ComputeHash(), CScanFilterNCCFFTOld::GetInputBuffer(), CScanFilterNCCFFT::GetInputBuffer(), CScanFilterMath::GetInputBuffer(), CScanFilterDZ::GetInputBuffer(), CScanFilterCrossCorrelateF::GetInputBuffer(), CScanFilterCrossCorrelate2::GetInputBuffer(), CScanFilterCrossCorrelate::GetInputBuffer(), CScanFilter::GetInputBuffer(), CScanFilter::GetParameters(), CFilterDlg_NCCFFTOld::OnBufferselect(), CFilterDlg_NCCFFT::OnBufferselect(), CFilterDlg_Math::OnBufferselect(), CFilterDlg_DZ::OnBufferselect(), CFilterDlg::OnCancel(), CFilterDlg_Null::OnChangeEditFactor(), CFilterDlg_Null::OnChangeEditOffset(), CFilterDlg_LinearRegression::OnChangeFactor(), CFilterDlg_DZ::OnChangeFactor(), CFilterDlg_Custom::OnChangeFilterType(), CFilterDlg_Threshold::OnChangeMode(), CFilterDlg_NCCFFTOld::OnChangeNormalization(), CFilterDlg_NCCFFT::OnChangeNormalization(), CFilterDlg_DZ::OnChangeOffset(), CFilterDlg_Shift::OnChangeShiftX(), CFilterDlg_Shift::OnChangeShiftY(), CFilterDlg_LinearRegression::OnChangeSizeX(), CFilterDlg_Clad::OnChangeSizeX(), CFilterDlg_Minimum::OnChangeSizeXY(), CFilterDlg_Median::OnChangeSizeXY(), CFilterDlg_Mean::OnChangeSizeXY(), CFilterDlg_Maximum::OnChangeSizeXY(), CFilterDlg_LinearRegression::OnChangeSizeY(), CFilterDlg_Clad::OnChangeSizeY(), CFilterDlg_LinearRegression::OnChangeTheta(), CFilterDlg_Threshold::OnChangeValue(), CFilterDlg_NCCFFTOld::OnChangeValue(), CFilterDlg_NCCFFT::OnChangeValue(), CFilterDlg_BinaryThreshold::OnChangeValue(), CFilterDlg_BGS_MCN::OnChangeValue(), CFilterDlg_LinearRegression::OnHScroll(), CFilterDlg::OnOK(), CFilterDlg_Math::OnRadioModeAMinB(), CFilterDlg_Math::OnRadioModeAPlusB(), CFilterDlg_Math::OnRadioModeATimesB(), CFilterDlg_Math::OnRadioModeBMinA(), CFilterDlg_Threshold::OnScroll(), CFilterDlg_BinaryThreshold::OnScroll(), CFilterDlg_LinearRegression::OnSelchangeParam(), CFilterDlg_BGS_Planar::OnSelectPlane(), CScanFilterShift::SetDragInput(), CScanFilterClad::SetDragInput(), CScanFilterBGS_Planar::SetDragInput(), CFilterDlg_Custom::SetFilterType(), CScanFilterNCCFFTOld::SetInputBuffer(), CScanFilterNCCFFT::SetInputBuffer(), CScanFilterMath::SetInputBuffer(), CScanFilterDZ::SetInputBuffer(), CScanFilterCrossCorrelateF::SetInputBuffer(), CScanFilterCrossCorrelate2::SetInputBuffer(), CScanFilterCrossCorrelate::SetInputBuffer(), CScanFilter::SetInputBuffer(), CScanFilter::SetOutputBuffer(), CScanFilter::SetParameters(), and CFilterDlg::UpdateView().

#define Q_CHECK ( exprConst,
exprCheck   ) 

Value:

QAFDebug::ReportCheckError( (exprConst), \
                (exprCheck), QAF_EXPR( _T(#exprConst) _T(" == ") _T(#exprCheck) ), _T(__FILE__), __LINE__ )
Parameters:
exprConst Any expression that evaluates to bool or int
exprCheck Any expression that evaluates to bool or int
Returns:
bool (same as (exprConst == exprCheck))
Author:
Andrew Schetinin
Date:
April 10, 2003
This macro output a error report string to the error log (file and/or debug console). The important thing about this macro is that it outputs also the actual compared values (error codes, handles, etc.) The string looks like that:
 c:\SharedUnits\Dev\QMSOColl\QMSOColl.cpp(56) : Check error: got 10 (0xA) while expected 0 (0x0)  
        time:        2003-12-08 16:11:34:003
        process:     0x000006F4
        thread:      0x00000148
        application: c:\ErrorLog_demo\Debug\ErrorLog.exe <1.0.0.3>
        module:      c:\SharedUnits\Dev\QMSOColl\Debug\QMSOColl.dll <1.0.0.10>
        last error:  2, The system cannot find the file specified.
        expression:  ERROR_SUCCESS == ret
It is recommended to use this macro in all places where any error means program crash or non-predictable behavior of dependent code. It will help to detect where first the error appeared. Recommended for IFs without ELSE or testing return values of functions.
        if( Q_CHECK( ERROR_SUCCESS, ret ) ) // here it will write to the error log
                do_something();

Definition at line 203 of file QAFDebug.h.

#define Q_ENABLE_DEBUG_LOG   ;

Returns:
void
Author:
Andrew Schetinin
Date:
November 18, 2002
This is a special macro for unit test functions. This macro ensures that the reporting is switched on. It is recommended to put it at the beginning of a single tests case (at the beginning of the function).
        void CUnitTest::testCase01( void ) 
        {
                Q_ENABLE_DEBUG_LOG; // switch the error log on
                CPPUNIT_ASSERT( Q_SUCCEEDED( QAFGetRegKey( HKCU_C_END, &str ) ) ); // write to the log if it fails
                ...
        }

Definition at line 653 of file QAFDebug.h.

#define Q_ERROR ( hResultExpr   )     (QAFDebug::ReportComError( hResultExpr, _T(__FILE__), __LINE__ ))

Parameters:
Status HRESULT result code
Returns:
HRESULT (same as Status)
Author:
Andrew Schetinin
Date:
September 26, 2002
Generic test for failure on any status value.

This macro output a error report string to the error log (file and/or debug console). The string looks like that:

 c:\SharedUnits\Dev\QMSOColl\QMSOColl.cpp(56) : The component's CLSID is missing or corrupt.  
        time:        2003-12-08 16:11:34:003
        process:     0x000006F4
        thread:      0x00000148
        application: c:\ErrorLog_demo\Debug\ErrorLog.exe <1.0.0.3>
        module:      c:\SharedUnits\Dev\QMSOColl\Debug\QMSOColl.dll <1.0.0.10>
        last error:  0
        expression:  Q_FAILED(0x800401F3)
It is recommended to use this macro in all places where any error means program crash or non-predictable behavior of dependent code. It will help to detect where first the error appeared. Recommended for testing return HRESULTs that usually always should return S_OK or S_FALSE. Another use for this macro is to test return values of generic functions that usually never fail.
        // This will report about the error in the exact place where it first happened.
        return Q_ERROR( CoCreateInstance( clsid, NULL, dwCtx, IID_IDispatch, (void**)(&this->p) ) );

Definition at line 361 of file QAFDebug.h.

#define Q_ERROR_SUCCESS ( dwErrorExpr   )     (ERROR_SUCCESS == QAFDebug::ReportWinError( dwErrorExpr, _T(__FILE__), __LINE__ ))

Parameters:
dwError Error result code.
Returns:
bool (dwError == ERROR_SUCCESS)
Author:
Andrew Schetinin
Date:
March 19, 2003
Generic test for failure on error code.

This macro output a error report string to the error log (file and/or debug console). The string looks like that:

 c:\SharedUnits\Dev\QMSOColl\QMSOColl.cpp(56) : More data is available.  
        time:        2003-12-08 16:11:34:003
        process:     0x000006F4
        thread:      0x00000148
        application: c:\ErrorLog_demo\Debug\ErrorLog.exe <1.0.0.3>
        module:      c:\SharedUnits\Dev\QMSOColl\Debug\QMSOColl.dll <1.0.0.10>
        last error:  123, More data is available. 
        expression:  ERROR_SUCCESS != 123
It is recommended to use this macro in all places where any error means program crash or non-predictable behavior of dependent code. It will help to detect where first the error appeared. Recommended for testing return error codes that usually always should return ERROR_SUCCESS. Another use for this macro is to test return values of generic functions that usually never fail.
        // This will report about the error in the exact place where it first happened.
        DWORD dwRes = RegQueryValueEx( hKey, _T("Value"), NULL, &dwType, (LPBYTE)szBuf, &dwSize );
        if( Q_ERROR_SUCCESS(dwRes) ) 
                /*do something*/;

Definition at line 403 of file QAFDebug.h.

#define Q_FAILED ( hResultExpr   )     FAILED(Q_ERROR(hResultExpr))

Parameters:
Status HRESULT result code
Returns:
bool. true means "there is an error!"
Author:
Andrew Schetinin
Date:
September 26, 2002
Generic test for failure on any status value.

This macro output a error report string to the error log (file and/or debug console). The string looks like that:

 c:\SharedUnits\Dev\QMSOColl\QMSOColl.cpp(56) : The component's CLSID is missing or corrupt.  
        time:        2003-12-08 16:11:34:003
        process:     0x000006F4
        thread:      0x00000148
        application: c:\ErrorLog_demo\Debug\ErrorLog.exe <1.0.0.3>
        module:      c:\SharedUnits\Dev\QMSOColl\Debug\QMSOColl.dll <1.0.0.10>
        last error:  0
        expression:  Q_FAILED(0x800401F3)
It is recommended to use this macro in all places where any error means program crash or non-predictable behavior of dependent code. It will help to detect where first the error appeared. Recommended for testing return HRESULTs that usually always should return S_OK or S_FALSE. Another use for this macro is to report about the error before returning from your function.
        if( Q_FAILED(hr) ) // here it will write to the error log
                return hr;

Definition at line 321 of file QAFDebug.h.

Referenced by CScanFilterShift::SetDragInput(), CScanFilterClad::SetDragInput(), and CScanFilterBGS_Planar::SetDragInput().

#define Q_INVALID ( bCondition   ) 

Value:

((bCondition) ? (QAFDebug::OutputDebugStringEx( \
                _T(__FILE__), __LINE__, QAF_EXPR(_T(#bCondition)), QAFDEBUG_ERROR_INVALID_ASSUMPTION ), true) : false )
Parameters:
bCondition Any expression that evaluates to bool or int
Returns:
bool (same as bCondition)
Author:
Andrew Schetinin
Date:
December 11, 2002
This macro output a error report string to the error log (file and/or debug console). The string looks like that:
 c:\SharedUnits\Dev\QMSOColl\QMSOColl.cpp(56) : Assumption failed  
        time:        2003-12-08 16:11:34:003
        process:     0x000006F4
        thread:      0x00000148
        application: c:\ErrorLog_demo\Debug\ErrorLog.exe <1.0.0.3>
        module:      c:\SharedUnits\Dev\QMSOColl\Debug\QMSOColl.dll <1.0.0.10>
        last error:  2, The system cannot find the file specified.
        expression:  NULL == lpszStringParam
It is recommended to use this macro in all places where any error means program crash or non-predictable behavior of dependent code. It will help to detect where first the error appeared. Recommended for testing input parameters or error conditions.
        if( Q_INVALID( NULL == lpszStringParam ) ) // here it will write to the error log
                return E_INVALIDARG;

Definition at line 240 of file QAFDebug.h.

Referenced by CScanFilterThreshold::Apply(), CScanFilterTest::Apply(), CScanFilterSwapQuadrants::Apply(), CScanFilterShift::Apply(), CScanFilterNCCFFTOld::Apply(), CScanFilterNCCFFT::Apply(), CScanFilterMinimum::Apply(), CScanFilterMedian::Apply(), CScanFilterMean::Apply(), CScanFilterMaximum::Apply(), CScanFilterMath::Apply(), CScanFilterLowPass::Apply(), CScanFilterHighPass::Apply(), CScanFilterFFTInverse::Apply(), CScanFilterFFT::Apply(), CScanFilterDZ::Apply(), CScanFilterDifferential_LbL::Apply(), CScanFilterDifferential::Apply(), CScanFilterCustom::Apply(), CScanFilterClad::Apply(), CScanFilterBinaryThreshold::Apply(), CScanFilterBgsDiff_LbL::Apply(), CScanFilterBgsDiff::Apply(), CScanFilterBGS_MCN::Apply(), CScanFilterAutoCorrelate::Apply(), CCalculatorImageShift::Apply(), CScanFilterNull::ApplyCore(), CScanFilterBGS_Planar::ApplyCore(), CFilterDlg_LowPass::ApplyFilter(), CFilterDlg_LinearRegression::ApplyFilter(), CFilterDlg_HighPass::ApplyFilter(), CScanFilterDZ::EditModeless(), CScanFilterDifferential_LbL::EditModeless(), CScanFilterDifferential::EditModeless(), CScanFilterBGS_MCN::EditModeless(), CScanFilterBGS_Planar::EditModeless(), CScanFilterTest::GetParameters(), CNumSpinCtrl::GetPos(), CScanFilterCustom::GetWeight(), CNumSpinCtrl::InitSpinCtrl(), CFilterDlg_Custom::OnApply(), CFilterDlg_CrossCorrelateF::OnApplyFilter(), CFilterDlg_CrossCorrelate2::OnApplyFilter(), CFilterDlg_CrossCorrelate::OnApplyFilter(), CFilterDlg_NCCFFTOld::OnBufferselect(), CFilterDlg_NCCFFT::OnBufferselect(), CFilterDlg_Math::OnBufferselect(), CFilterDlg_DZ::OnBufferselect(), CFilterDlg_CrossCorrelateF::OnBufferselect(), CFilterDlg_CrossCorrelate2::OnBufferselect(), CFilterDlg_CrossCorrelate::OnBufferselect(), CFilterDlg_LowPass::OnChange(), CFilterDlg_HighPass::OnChange(), CFilterDlg_CrossCorrelate2::OnChange(), CFilterDlg_CrossCorrelate::OnChange(), CFilterDlg_Differential::OnChangeAngle(), CFilterDlg_Custom::OnChangeEdit(), CFilterDlg_Null::OnChangeEditFactor(), CFilterDlg_Null::OnChangeEditOffset(), CFilterDlg_LinearRegression::OnChangeFactor(), CFilterDlg_DZ::OnChangeFactor(), CFilterDlg_Differential_LbL::OnChangeFactor(), CFilterDlg_Threshold::OnChangeMode(), CFilterDlg_NCCFFTOld::OnChangeNormalization(), CFilterDlg_NCCFFT::OnChangeNormalization(), CFilterDlg_DZ::OnChangeOffset(), CFilterDlg_Shift::OnChangeShiftX(), CFilterDlg_Shift::OnChangeShiftY(), CFilterDlg_LinearRegression::OnChangeSizeX(), CFilterDlg_Clad::OnChangeSizeX(), CFilterDlg_Minimum::OnChangeSizeXY(), CFilterDlg_Median::OnChangeSizeXY(), CFilterDlg_Mean::OnChangeSizeXY(), CFilterDlg_Maximum::OnChangeSizeXY(), CFilterDlg_LinearRegression::OnChangeSizeY(), CFilterDlg_Clad::OnChangeSizeY(), CFilterDlg_LinearRegression::OnChangeTheta(), CFilterDlg_Threshold::OnChangeValue(), CFilterDlg_NCCFFTOld::OnChangeValue(), CFilterDlg_NCCFFT::OnChangeValue(), CFilterDlg_BinaryThreshold::OnChangeValue(), CFilterDlg_BGS_MCN::OnChangeValue(), CFilterDlg_Null::OnCheckAlgorithm(), CFilterDlg_LinearRegression::OnCheckAlgorithm(), CFilterDlg_BGS_Planar::OnCheckAlgorithm(), CFilterDlg_Custom::OnClear(), CFilterDlg_LinearRegression::OnDeltaposSpinfactor(), CFilterDlg_LinearRegression::OnFilterDirect(), CFilterDlg_LinearRegression::OnHScroll(), CFilterDlg_Differential_LbL::OnHScroll(), CFilterDlg_Differential::OnHScroll(), CFilterDlg_Test::OnInitDialog(), CFilterDlg_Shift::OnInitDialog(), CFilterDlg_Null::OnInitDialog(), CFilterDlg_NCCFFTOld::OnInitDialog(), CFilterDlg_NCCFFT::OnInitDialog(), CFilterDlg_Minimum::OnInitDialog(), CFilterDlg_Median::OnInitDialog(), CFilterDlg_Mean::OnInitDialog(), CFilterDlg_Maximum::OnInitDialog(), CFilterDlg_Math::OnInitDialog(), CFilterDlg_LowPass::OnInitDialog(), CFilterDlg_LinearRegression::OnInitDialog(), CFilterDlg_HighPass::OnInitDialog(), CFilterDlg_DZ::OnInitDialog(), CFilterDlg_Differential_LbL::OnInitDialog(), CFilterDlg_Differential::OnInitDialog(), CFilterDlg_Custom::OnInitDialog(), CFilterDlg_CrossCorrelateF::OnInitDialog(), CFilterDlg_CrossCorrelate2::OnInitDialog(), CFilterDlg_CrossCorrelate::OnInitDialog(), CFilterDlg_Clad::OnInitDialog(), CFilterDlg_BGS_Planar::OnInitDialog(), CFilterDlg_BGS_MCN::OnInitDialog(), CFilterDlg_Math::OnRadioModeAMinB(), CFilterDlg_Math::OnRadioModeAPlusB(), CFilterDlg_Math::OnRadioModeATimesB(), CFilterDlg_Math::OnRadioModeBMinA(), CFilterDlg_Threshold::OnScroll(), CFilterDlg_NCCFFTOld::OnScroll(), CFilterDlg_BinaryThreshold::OnScroll(), CFilterDlg_LinearRegression::OnSelchangeParam(), CFilterDlg_BGS_Planar::OnSelectPlane(), CFilterDlg_Null::OnTimeAlgorithm(), CFilterDlg_LinearRegression::OnTimeAlgorithm(), CFilterDlg_BGS_Planar::OnTimeAlgorithm(), CScanFilterCrossCorrelateF::PreApply(), CScanFilterCrossCorrelate2::PreApply(), CScanFilterCrossCorrelate::PreApply(), CScanFilterLinearRegression::PreApplyCore(), CScanFilterThreshold::ReadFilterSettings(), CScanFilterTest::ReadFilterSettings(), CScanFilterShift::ReadFilterSettings(), CScanFilterRank::ReadFilterSettings(), CScanFilterNull::ReadFilterSettings(), CScanFilterNCCFFTOld::ReadFilterSettings(), CScanFilterNCCFFT::ReadFilterSettings(), CScanFilterMath::ReadFilterSettings(), CScanFilterLowPass::ReadFilterSettings(), CScanFilterLinearRegression::ReadFilterSettings(), CScanFilterHighPass::ReadFilterSettings(), CScanFilterDZ::ReadFilterSettings(), CScanFilterDifferential_LbL::ReadFilterSettings(), CScanFilterDifferential::ReadFilterSettings(), CScanFilterCustom::ReadFilterSettings(), CScanFilterCrossCorrelate2::ReadFilterSettings(), CScanFilterCrossCorrelate::ReadFilterSettings(), CScanFilterClad::ReadFilterSettings(), CScanFilterBinaryThreshold::ReadFilterSettings(), CScanFilterBGS_MCN::ReadFilterSettings(), CScanFilterBGS_Planar::ReadFilterSettings(), CScanFilterThreshold::RunModeless(), CScanFilterTest::RunModeless(), CScanFilterShift::RunModeless(), CScanFilterNull::RunModeless(), CScanFilterNCCFFTOld::RunModeless(), CScanFilterNCCFFT::RunModeless(), CScanFilterMinimum::RunModeless(), CScanFilterMedian::RunModeless(), CScanFilterMean::RunModeless(), CScanFilterMaximum::RunModeless(), CScanFilterMath::RunModeless(), CScanFilterLowPass::RunModeless(), CScanFilterLinearRegression::RunModeless(), CScanFilterHighPass::RunModeless(), CScanFilterDZ::RunModeless(), CScanFilterDifferential_LbL::RunModeless(), CScanFilterDifferential::RunModeless(), CScanFilterCustom::RunModeless(), CScanFilterCrossCorrelateF::RunModeless(), CScanFilterCrossCorrelate2::RunModeless(), CScanFilterCrossCorrelate::RunModeless(), CScanFilterClad::RunModeless(), CScanFilterBinaryThreshold::RunModeless(), CScanFilterBGS_MCN::RunModeless(), CScanFilterBGS_Planar::RunModeless(), CNumSpinCtrl::Select(), CScanFilterCustom::SetFilterType(), CFilterDlg_Custom::SetFilterType(), CScanFilterThreshold::SetParameters(), CScanFilterTest::SetParameters(), CScanFilterShift::SetParameters(), CScanFilterRank::SetParameters(), CScanFilterNull::SetParameters(), CScanFilterNCCFFTOld::SetParameters(), CScanFilterNCCFFT::SetParameters(), CScanFilterMath::SetParameters(), CScanFilterLowPass::SetParameters(), CScanFilterLinearRegression::SetParameters(), CScanFilterKuwahara::SetParameters(), CScanFilterHighPass::SetParameters(), CScanFilterErosion::SetParameters(), CScanFilterDZ::SetParameters(), CScanFilterDilation::SetParameters(), CScanFilterDifferential_LbL::SetParameters(), CScanFilterDifferential::SetParameters(), CScanFilterCustom::SetParameters(), CScanFilterCrossCorrelate2::SetParameters(), CScanFilterCrossCorrelate::SetParameters(), CScanFilterClip::SetParameters(), CScanFilterClad::SetParameters(), CScanFilterBinaryThreshold::SetParameters(), CScanFilterBGS_MCN::SetParameters(), CScanFilterBGS_Planar::SetParameters(), CScanFilterBGS_LbL::SetParameters(), CScanFilterAutoCorrelate::SetParameters(), CNumSpinCtrl::SetRangeAndDelta(), CNumSpinCtrl::SetValueForBuddy(), CScanFilterCustom::SetWeight(), CFilterDlg_Custom::ShowWeights(), CFilterDlg_BGS_MCN::UpdateControls(), CFilterDlg_BGS_Planar::UpdateParameters(), CFilterDlg_BGS_MCN::UpdateParameters(), CScanFilterThreshold::WriteFilterSettings(), CScanFilterTest::WriteFilterSettings(), CScanFilterShift::WriteFilterSettings(), CScanFilterRank::WriteFilterSettings(), CScanFilterNull::WriteFilterSettings(), CScanFilterNCCFFTOld::WriteFilterSettings(), CScanFilterNCCFFT::WriteFilterSettings(), CScanFilterMath::WriteFilterSettings(), CScanFilterLowPass::WriteFilterSettings(), CScanFilterLinearRegression::WriteFilterSettings(), CScanFilterHighPass::WriteFilterSettings(), CScanFilterDZ::WriteFilterSettings(), CScanFilterDifferential_LbL::WriteFilterSettings(), CScanFilterDifferential::WriteFilterSettings(), CScanFilterCustom::WriteFilterSettings(), CScanFilterCrossCorrelate2::WriteFilterSettings(), CScanFilterCrossCorrelate::WriteFilterSettings(), CScanFilterClad::WriteFilterSettings(), CScanFilterBinaryThreshold::WriteFilterSettings(), CScanFilterBGS_MCN::WriteFilterSettings(), and CScanFilterBGS_Planar::WriteFilterSettings().

#define Q_LOG ( lpszMessage   )     (QAFDebug::OutputDebugStringEx( _T(__FILE__), __LINE__, QAFDEBUG_ERROR_LOG, lpszMessage ))

Parameters:
lpszMessage LPCTSTR message string
Returns:
void
Author:
Andrew Schetinin
Date:
January 28, 2003
This is a macro for reporting about critical errors in a user-understandable format. Generally it is preferable to Q_ASSERT(false).

This macro output a error report string to the error log (file and/or debug console). The string looks like that:

 c:\SharedUnits\Dev\QMSOColl\QMSOColl.cpp(56) : My custom error message.  
        time:        2003-12-08 16:11:34:003
        process:     0x000006F4
        thread:      0x00000148
        application: c:\ErrorLog_demo\Debug\ErrorLog.exe <1.0.0.3>
        module:      c:\SharedUnits\Dev\QMSOColl\Debug\QMSOColl.dll <1.0.0.10>
        last error:  0 
        expression:  Error message
It is recommended to use this macro in all places where any error means program crash or non-predictable behavior of dependent code. It will help to detect where first the error appeared. Recommended for IFs without ELSE or testing return values of functions.
        catch( ... )
        {
                Q_LOG( _T("Unknown exception catched") ); // here it will report about all exceptions
        }

Definition at line 444 of file QAFDebug.h.

Referenced by CScanBaseBuffer::IsCompleteFrame(), CProgressDlg::ResumeComputationThread(), CScanFilterTest::SetParameters(), and CScanFilterNull::SetParameters().

#define Q_MAPI_ERROR ( hresult,
piObjectMAPI   ) 

Value:

do { \
                HRESULT hrtemp39472 = hresult; \
                LPMAPIERROR pErr = NULL; \
                if( Q_ASSERT( NULL != piObjectMAPI ) \
                        && Q_ASSERT( S_OK == piObjectMAPI->GetLastError( hrtemp39472, 0, &pErr ) ) \
                        && Q_ASSERT( NULL != pErr ) ) \
                { \
                        int BUF_SIZE = 128 + _tcslen(pErr->lpszError) + _tcslen(pErr->lpszComponent); \
                        LPTSTR szBuf = (LPTSTR)malloc( BUF_SIZE * sizeof(TCHAR) ); \
                        if( Q_ASSERT( NULL != szBuf ) ) \
                        { \
                                _stprintf( szBuf, _T("MAPI Error: %s. Component: %s. Version: %08X. ") \
                                        _T("LowLevelError: %08X. Context: %08X."), \
                                        ((NULL != pErr->lpszError) ? pErr->lpszError : _T("")), \
                                        ((NULL != pErr->lpszComponent) ? pErr->lpszComponent : _T("")), \
                                        pErr->ulVersion, pErr->ulLowLevelError, pErr->ulContext ); \
                                TCHAR szHRBuf[20] = { 0 }; \
                                _stprintf( szHRBuf, _T("Q_FAILED(%08X)"), hrtemp39472 ); \
                                QAFDebug::OutputDebugStringEx( _T(__FILE__), __LINE__, szHRBuf, szBuf ); \
                                free( szBuf ); \
                        } \
                } \
        } while( false )
Parameters:
hresult (HRESULT) - MAPI error code
piObjectMAPI (any of MAPI interfaces)
Returns:
void
Author:
Andrew Schetinin
Date:
November 18, 2002
This is a special macro to report about an MAPI error.

This macro output a error report string to the error log (file and/or debug console). The string looks like that:

 c:\SharedUnits\Dev\QMSOColl\QMSOColl.cpp(56) : Cannot login to MAPI storage  
        time:        2003-12-08 16:11:34:003
        process:     0x000006F4
        thread:      0x00000148
        application: c:\ErrorLog_demo\Debug\ErrorLog.exe <1.0.0.3>
        module:      c:\SharedUnits\Dev\QMSOColl\Debug\QMSOColl.dll <1.0.0.10>
        last error:  0 
        expression:  hr
It is recommended to use this macro in all places where any error means program crash or non-predictable behavior of dependent code. It will help to detect where first the error appeared. Recommended for reporting about critical MAPI errors.
        Q_MAPI_ERROR( hresult, piObjectMAPI );

Definition at line 582 of file QAFDebug.h.

#define Q_MFC_EXCEPTION (  ) 

Value:

do { \
                TCHAR szBuf[251] = { 0 }; \
                if( (NULL == e) || (! e->GetErrorMessage( szBuf, 250, NULL )) ) \
                        strcpy( szBuf, QAFDEBUG_ERROR_NO_MESSAGE ); \
                QAFDebug::OutputDebugStringEx( _T(__FILE__), __LINE__, QAF_EXPR(_T(#e)), szBuf ); \
        } while( false )
Parameters:
e CException object instance (MFC-style)
Returns:
void
Author:
Andrew Schetinin
Date:
November 18, 2002
This is a special macro to report about an MFC-style exception.

This macro output a error report string to the error log (file and/or debug console). The string looks like that:

 c:\SharedUnits\Dev\QMSOColl\QMSOColl.cpp(56) : Cannot open file  
        time:        2003-12-08 16:11:34:003
        process:     0x000006F4
        thread:      0x00000148
        application: c:\ErrorLog_demo\Debug\ErrorLog.exe <1.0.0.3>
        module:      c:\SharedUnits\Dev\QMSOColl\Debug\QMSOColl.dll <1.0.0.10>
        last error:  0 
        expression:  e
It is recommended to use this macro in all places where any error means program crash or non-predictable behavior of dependent code. It will help to detect where first the error appeared. Recommended for reporting about exceptions in CATCH clauses. You may define your own exception classes (without MFC support), just define the GetErrorMessage() method and this macro will work.
        catch( CMyException & e ) 
        {
                Q_MFC_EXCEPTION(e); // here it will write to the error log with the error message
        }
        catch( ... )
        {
                Q_LOG( _T("Unknown exception catched") ); // here it will report about any other exception
        }

Definition at line 490 of file QAFDebug.h.

Referenced by CScanFilterNull::Apply(), CScanFilterLinearRegression::Apply(), CScanFilterBGS_Planar::Apply(), and CScanFilterLinearRegression::PreApply().

#define Q_RETURN ( hr   )     do { HRESULT hrtmp83457 = hr; if( Q_SUCCEEDED(hrtmp83457) ) ; else return hrtmp83457; } while( false )

Parameters:
hr HRESULT
Returns:
hr, if
Author:
Andrey Krasnopolsky
Date:
August 05, 2003
This macro is for testing HRESULTs. It gets HRESULT as input, tests it and returns the same HRESULT in case of error. Very useful if you need to break function execution in case of error.
 // if the method returns E_XXX, it will exit and return the error code
        Q_RETURN( CallSomeMethod() ); 

Definition at line 627 of file QAFDebug.h.

Referenced by CScanFilterThreshold::Apply(), CScanFilterTest::Apply(), CScanFilterSwapQuadrants::Apply(), CScanFilterShift::Apply(), CScanFilterNCCFFTOld::Apply(), CScanFilterNCCFFT::Apply(), CScanFilterMinimum::Apply(), CScanFilterMedian::Apply(), CScanFilterMean::Apply(), CScanFilterMaximum::Apply(), CScanFilterMath::Apply(), CScanFilterLowPass::Apply(), CScanFilterKuwahara::Apply(), CScanFilterHighPass::Apply(), CScanFilterFFTInverse::Apply(), CScanFilterFFT::Apply(), CScanFilterErosion::Apply(), CScanFilterDZ::Apply(), CScanFilterDilation::Apply(), CScanFilterDifferential_LbL::Apply(), CScanFilterDifferential::Apply(), CScanFilterCustom::Apply(), CScanFilterClip::Apply(), CScanFilterClad::Apply(), CScanFilterBinaryThreshold::Apply(), CScanFilterBgsDiff_LbL::Apply(), CScanFilterBgsDiff::Apply(), CScanFilterBGS_MCN::Apply(), CScanFilterBGS_LbL::Apply(), CScanFilterAutoCorrelate::Apply(), CScanFilterNull::ApplyCore(), CScanFilterBGS_Planar::ApplyCore(), CScanFilterLowPass::Compute(), CScanFilterHighPass::Compute(), CScanFilterFFTInverse::Compute(), CScanFilterFFT::Compute(), CScanFilterCrossCorrelateF::Compute(), CScanFilterAutoCorrelate::Compute(), CScanFilterCrossCorrelateF::PreApply(), CScanFilterCrossCorrelate2::PreApply(), CScanFilterCrossCorrelate::PreApply(), and CScanFilterLinearRegression::PreApplyCore().

#define Q_SET_MODULE ( szModuleName   )     QAFDebug::SetModule( 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 714 of file QAFDebug.h.

Referenced by DllMain().

#define Q_SILENT ( expr   )     expr;

Parameters:
expr Any expression
Returns:
void
Author:
Andrew Schetinin
Date:
November 18, 2002
This is a special macro for unit test functions. It is useful for testing the wrong cases (for example, passing wrong parameters and checking that the function fails). For wrong test cases we do not want to report about errors because we want them to happen.
        void CUnitTest::testCase01( void ) 
        {
                Q_ENABLE_DEBUG_LOG; // switch the error log on
                CPPUNIT_ASSERT( Q_SUCCEEDED( QAFGetRegKey( HKCU_C_END, &str ) ) ); // write to the log if it fails
                Q_SILENT( CPPUNIT_ASSERT( Q_FAILED( QAFGetRegKey( NULL, NULL ) ) ) ); // do not write to log 
                ...
        }

Definition at line 683 of file QAFDebug.h.

#define Q_STD_EXCEPTION (  )     QAFDebug::OutputDebugStringEx( _T(__FILE__), __LINE__, QAF_EXPR(_T(#e)), e.what() )

Parameters:
e std::exception object instance (STL-style)
Returns:
void
Author:
Andrew Schetinin
Date:
December 11, 2003
This is a special macro to report about an STL exception.

This macro output a error report string to the error log (file and/or debug console). The string looks like that:

 c:\SharedUnits\Dev\QMSOColl\QMSOColl.cpp(56) : Cannot open file  
        time:        2003-12-08 16:11:34:003
        process:     0x000006F4
        thread:      0x00000148
        application: c:\ErrorLog_demo\Debug\ErrorLog.exe <1.0.0.3>
        module:      c:\SharedUnits\Dev\QMSOColl\Debug\QMSOColl.dll <1.0.0.10>
        last error:  0 
        expression:  e
It is recommended to use this macro in all places where any error means program crash or non-predictable behavior of dependent code. It will help to detect where first the error appeared. Recommended for reporting about exceptions in CATCH clauses.
        catch( std::exception & e ) 
        {
                Q_STD_EXCEPTION(e); // here it will write to the error log with the error message
        }
        catch( ... )
        {
                Q_LOG( _T("Unknown exception catched") ); // here it will report about any other exception
        }

Definition at line 543 of file QAFDebug.h.

Referenced by CScanFilterNull::Apply(), CScanFilterLinearRegression::Apply(), CScanFilterBGS_Planar::Apply(), and CScanFilterLinearRegression::PreApply().

#define Q_SUCCEEDED ( hResultExpr   )     SUCCEEDED(Q_ERROR(hResultExpr))

Parameters:
Status HRESULT result code
Returns:
bool. true means "no error"
Author:
Andrew Schetinin
Date:
September 26, 2002
Generic test for success on any status value (non-negative numbers indicate success).

This macro output a error report string to the error log (file and/or debug console). The string looks like that:

 c:\SharedUnits\Dev\QMSOColl\QMSOColl.cpp(56) : The component's CLSID is missing or corrupt.  
        time:        2003-12-08 16:11:34:003
        process:     0x000006F4
        thread:      0x00000148
        application: c:\ErrorLog_demo\Debug\ErrorLog.exe <1.0.0.3>
        module:      c:\SharedUnits\Dev\QMSOColl\Debug\QMSOColl.dll <1.0.0.10>
        last error:  0
        expression:  Q_FAILED(0x800401F3)
It is recommended to use this macro in all places where any error means program crash or non-predictable behavior of dependent code. It will help to detect where first the error appeared. Recommended for testing return HRESULTs that usually always should return S_OK or S_FALSE. Another use for this macro is to report about a critical error in your function that is returned to the calling function.
        if( Q_SUCCEEDED(hr) ) // here it will write to the error log
                do_something();

Definition at line 282 of file QAFDebug.h.

#define QAF_EXPR ( expression   )     (NULL)

It makes the binary a bit smaller for the release build.

Definition at line 775 of file QAFDebug.h.

#define QAF_UNITTEST_DISABLED

I DISABLE part of the functionality related to the unit tests in RELEASE build to optimize the code. Defining this directive removes all the synchronization and memory mapped file staff from the code.

Definition at line 105 of file QAFDebug.h.


Variable Documentation

const DWORD QAFDEBUG_LOG_FILE_MAX_SIZE = (1024 * 1024)

Maximum log file size (there are two log files - one current and second previous). When the log file size exceeds half of this limit, it is renamed to the second name (thus both files together cannot take more than this maximum size). The size is in bytes. Usually 1 record takes about 500 characters, so I reserve space for about 2,000 records with 1 Mb limit.

Definition at line 740 of file QAFDebug.h.

Referenced by CQAFDebug::tryOpenLogFile().


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