很牛的宏定义

class CEquipDiagLibAdapter
    {
public:
        inline CEquipDiagLibAdapter();
        inline ~CEquipDiagLibAdapter();

public:
        inline BOOL    CreateDiagLib( const CString &strDiagLibDllPath );

}

 

1.
DIAG_LIB_ADAPTER_FUNC_IMPL_1(SetData2DiagSearch, unsigned char);1.1

1.1
#define DIAG_LIB_ADAPTER_FUNC_IMPL_1( FuncName, PARAMTYPE1 ) /
    inline BOOL CEquipDiagLibAdapter:: ## FuncName( PARAMTYPE1 para ) /
    { /
        GET_DIAG_LIB_FUNC(FuncName); /    1.1.1
        DiagLibAdapterImpl_1(Dll ## FuncName, para); /  1.1.2
    }

1.1.1
#define GET_DIAG_LIB_FUNC( FuncName ) /
    T ## FuncName Dll ## FuncName = (T ## FuncName)GetProcAddress(m_hDll, # FuncName); /
    if (NULL == Dll ## FuncName) /
    { /
        return FALSE; /
    }

1.1.2
#define DiagLibAdapterImpl_1(func, param) /
    CALL_DIAG_LIB_IMPL_FUNC( func(m_hDiagLib, param));   1.1.1.2.1

1.1.1.2.1
#define CALL_DIAG_LIB_IMPL_FUNC(FuncCallExpr) /
    do /
    { /
        m_hLastFuncCallResult = FuncCallExpr; /
        if (m_hLastFuncCallResult != DIAG_LIB_SUCCESS) /
        { /
            return FALSE; /
        } /
        return TRUE; /
    } while (0)

你可能感兴趣的:(很牛的宏定义)