/******************************************************************************
 *                                                                         
 *               (C) COPYRIGHT Pacific MindWorks, Inc. 2001-2005
 *                          All rights reserved.
 *
 *****************************************************************************/

#ifndef __NTL_DRIVERWRAPPER_INCLUDED
#define __NTL_DRIVERWRAPPER_INCLUDED

class CDriverWrapper
{
public:
	CDriverWrapper(CErrorManagerBase* pErrorManager);
	virtual ~CDriverWrapper();

protected:
	UINT m_nVisaSession;
	CErrorManagerBase* m_pErrorManager;

public:
	UINT GetVisaSession();
	void SetVisaSession(UINT nVisaSession);

	HRESULT TranslateViStatusIntoHRESULT(long nStatus);
};

inline CDriverWrapper::CDriverWrapper(CErrorManagerBase* pErrorManager)
{
	m_nVisaSession = 0;
	m_pErrorManager = pErrorManager;
}

inline CDriverWrapper::~CDriverWrapper()
{
}

inline UINT CDriverWrapper::GetVisaSession()
{
	return m_nVisaSession;
}

inline void CDriverWrapper::SetVisaSession(UINT nVisaSession)
{
	m_nVisaSession = nVisaSession;
}

inline HRESULT CDriverWrapper::TranslateViStatusIntoHRESULT(long nStatus)
{
	HRESULT hr = S_OK;

	if (nStatus < 0)
	{
		CString strVal;
		strVal.Format(_T("%d"), nStatus);
		hr = m_pErrorManager->ReportError(GetDriverErrorResourceId(NTL_IDS_WRAPPED_DRIVER_ERROR), LPCTSTR(strVal));
	}

	return hr;
}

#endif // __NTL_DRIVERWRAPPER_INCLUDED