/******************************************************************************
 *                                                                         
 *               Nimbus auto-generated file
 *               !!! WARNING !!! -- DO NOT DIRECTLY EDIT THE CONTENTS OF THIS FILE.
 *				 Changes will be OVERWRITTEN by NIMBUS.
 *
 *****************************************************************************/

#include "stdafx.h"
#include "CoAgilent34945A.h"


///////////////////////////////////////////////////////////////
//
//   Repeated capability support
//

HRESULT CObjectModelNode<Agilent34945A, Agilent34945A, Agilent34945A>::InitNode(Agilent34945A* pRoot, Agilent34945A* pParent)
{
	HRESULT hr = S_OK;

	ResetObjectState();
	
	SetClassName(_T("Agilent34945A"));
	SetRoot(pRoot);
	SetParent(pParent);

	return hr;
}

HRESULT CObjectModelNode<Agilent34945A, Agilent34945A, Agilent34945A>::CloseNode()			
{
	HRESULT hr = S_OK;

	SetRoot(NULL);
	SetParent(NULL);
	
	return hr;
}



///////////////////////////////////////////////////////////////////////////////
//
//	Instrument models support
//

const CInstrumentModelMap* CInstrumentModelManager::GetInstrumentModelMap()
{
	static CInstrumentModelMap _instrModelMap(
		new CInstrumentModel(_T("34980A"), _T("Default")),
		NULL);

	return &_instrModelMap;
}



///////////////////////////////////////////////////////////////
//
//   Boolean support
//

const CString& GetBooleanTrueCommand()
{
	static CString _strCommand(_T("1"));

	return _strCommand;
}

const CString& GetBooleanFalseCommand()
{
	static CString _strCommand(_T("0"));

	return _strCommand;
}



///////////////////////////////////////////////////////////////
//
//   Enum support
//

template <>
const CEnumSupportedModelMap<Agilent34945APolarityEnum>* GetEnumSupportedModelMap<Agilent34945APolarityEnum>()
{
	static CEnumSupportedModelMap<Agilent34945APolarityEnum> _enumSupportedModelMap(
		NULL);

	return &_enumSupportedModelMap;
}

template <>
const CEnumCommandMap<Agilent34945APolarityEnum>* GetEnumCommandMap<Agilent34945APolarityEnum>()
{
	static CEnumCommandMap<Agilent34945APolarityEnum> _enumCommandMap(
		new CEnumCommand(Agilent34945APolarityNormal, _T("NORM"), _T("")),
		new CEnumCommand(Agilent34945APolarityInverted, _T("INV"), _T("")),
		NULL);

	return &_enumCommandMap;
}

template <>
const CEnumSupportedModelMap<Agilent34945ADriveTypeEnum>* GetEnumSupportedModelMap<Agilent34945ADriveTypeEnum>()
{
	static CEnumSupportedModelMap<Agilent34945ADriveTypeEnum> _enumSupportedModelMap(
		NULL);

	return &_enumSupportedModelMap;
}

template <>
const CEnumCommandMap<Agilent34945ADriveTypeEnum>* GetEnumCommandMap<Agilent34945ADriveTypeEnum>()
{
	static CEnumCommandMap<Agilent34945ADriveTypeEnum> _enumCommandMap(
		new CEnumCommand(Agilent34945ADriveTypeOpenCollector, _T("OCOL"), _T("")),
		new CEnumCommand(Agilent34945ADriveTypeTTL, _T("TTL"), _T("")),
		NULL);

	return &_enumCommandMap;
}

template <>
const CEnumSupportedModelMap<Agilent34945ADriveSourceEnum>* GetEnumSupportedModelMap<Agilent34945ADriveSourceEnum>()
{
	static CEnumSupportedModelMap<Agilent34945ADriveSourceEnum> _enumSupportedModelMap(
		NULL);

	return &_enumSupportedModelMap;
}

template <>
const CEnumCommandMap<Agilent34945ADriveSourceEnum>* GetEnumCommandMap<Agilent34945ADriveSourceEnum>()
{
	static CEnumCommandMap<Agilent34945ADriveSourceEnum> _enumCommandMap(
		new CEnumCommand(Agilent34945ADriveSourceInternal, _T("INT"), _T("")),
		new CEnumCommand(Agilent34945ADriveSourceExternal, _T("EXT"), _T("")),
		new CEnumCommand(Agilent34945ADriveSourceOff, _T("OFF"), _T("")),
		NULL);

	return &_enumCommandMap;
}



///////////////////////////////////////////////////////////////////////////////
//
//	State caching support
//

const CComparePolicyManagerBase* GetComparePolicyManager(const CString& strPath)
{
	static const CComparePolicyManagerMap _comparePolicyManagerMap(
		NULL);

	return _comparePolicyManagerMap.LookupComparePolicyManager(strPath);
}

///////////////////////////////////////////////////////////////////////////////
//
//	Coercion support
//

long GetCoercionLogSize()
{
	return 1000;
}


///////////////////////////////////////////////////////////////////////////////
//
//	COM rich error support
//

STDMETHODIMP Agilent34945A::InterfaceSupportsErrorInfo(REFIID riid)
{
	static const IID* arr[] = 
	{
		&__uuidof(IAgilent34945A),
		&__uuidof(IAgilent34945AChannel),
		&__uuidof(IAgilent34945AModule),
		&__uuidof(IAgilent34945ASystem)
	};

	for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
	{
		if (InlineIsEqualGUID(*arr[i],riid))
			return S_OK;
	}
	return S_FALSE;
}

///////////////////////////////////////////////////////////////////////////////
//
//	Error map support
//

const CString& GetHelpFileName()
{
	static CString _strFileName(_T("Agilent34980A.chm"));

	return _strFileName;
}


UINT GetDriverErrorResourceId(UINT uNtlResid)
{
	UINT uResId = 0;

	switch (uNtlResid)
	{
			case NTL_IDS_PERSONALITY_NOT_ACTIVE: 
				uResId = IDS_E_AGILENT34945A_PERSONALITY_NOT_ACTIVE; 
				break;
			case NTL_IDS_PERSONALITY_NOT_INSTALLED: 
				uResId = IDS_E_AGILENT34945A_PERSONALITY_NOT_INSTALLED; 
				break;
			case NTL_IDS_PERSONALITY_NOT_LICENSED: 
				uResId = IDS_E_AGILENT34945A_PERSONALITY_NOT_LICENSED; 
				break;
			case NTL_IDS_IO_GENERAL: 
				uResId = IDS_E_AGILENT34945A_IO_GENERAL; 
				break;
			case NTL_IDS_IO_TIMEOUT: 
				uResId = IDS_E_AGILENT34945A_IO_TIMEOUT; 
				break;
			case NTL_IDS_MODEL_NOT_SUPPORTED: 
				uResId = IDS_E_AGILENT34945A_MODEL_NOT_SUPPORTED; 
				break;
			case NTL_IDS_WRAPPED_DRIVER_ERROR: 
				uResId = IDS_E_AGILENT34945A_WRAPPED_DRIVER_ERROR; 
				break;

	}

	return uResId;
}

const CErrorMap* GetDriverErrorMap()
{
	static const CErrorMap _errorMap(
		new CDriverErrorInfo(IDS_E_AGILENT34945A_UNEXPECTED, E_AGILENT34945A_UNEXPECTED, 0),
		new CDriverErrorInfo(IDS_E_AGILENT34945A_PERSONALITY_NOT_ACTIVE, E_AGILENT34945A_PERSONALITY_NOT_ACTIVE, 0),
		new CDriverErrorInfo(IDS_E_AGILENT34945A_PERSONALITY_NOT_INSTALLED, E_AGILENT34945A_PERSONALITY_NOT_INSTALLED, 0),
		new CDriverErrorInfo(IDS_E_AGILENT34945A_PERSONALITY_NOT_LICENSED, E_AGILENT34945A_PERSONALITY_NOT_LICENSED, 0),
		new CDriverErrorInfo(IDS_E_AGILENT34945A_IO_GENERAL, E_AGILENT34945A_IO_GENERAL, 0),
		new CDriverErrorInfo(IDS_E_AGILENT34945A_IO_TIMEOUT, E_AGILENT34945A_IO_TIMEOUT, 0),
		new CDriverErrorInfo(IDS_E_AGILENT34945A_MODEL_NOT_SUPPORTED, E_AGILENT34945A_MODEL_NOT_SUPPORTED, 0),
		new CDriverErrorInfo(IDS_E_AGILENT34945A_VALUE_OUT_OF_RANGE, E_AGILENT34945A_VALUE_OUT_OF_RANGE, 0),
		new CDriverErrorInfo(IDS_E_AGILENT34945A_WRAPPED_DRIVER_ERROR, E_AGILENT34945A_WRAPPED_DRIVER_ERROR, 0),
		new CDriverErrorInfo(IDS_E_AGILENT34945A_MULTIPLE_CHANNELS_IN_GET, E_AGILENT34945A_MULTIPLE_CHANNELS_IN_GET, 0),
		new CDriverErrorInfo(IDS_S_IVI_SUCCESS, S_IVI_SUCCESS, 0),
		new CDriverErrorInfo(IDS_S_IVI_NSUP_ID_QUERY, S_IVI_NSUP_ID_QUERY, 0),
		new CDriverErrorInfo(IDS_S_IVI_NSUP_RESET, S_IVI_NSUP_RESET, 0),
		new CDriverErrorInfo(IDS_S_IVI_NSUP_SELF_TEST, S_IVI_NSUP_SELF_TEST, 0),
		new CDriverErrorInfo(IDS_S_IVI_NSUP_ERROR_QUERY, S_IVI_NSUP_ERROR_QUERY, 0),
		new CDriverErrorInfo(IDS_S_IVI_NSUP_REV_QUERY, S_IVI_NSUP_REV_QUERY, 0),
		new CDriverErrorInfo(IDS_E_IVI_CANNOT_RECOVER, E_IVI_CANNOT_RECOVER, 0),
		new CDriverErrorInfo(IDS_E_IVI_INSTRUMENT_STATUS, E_IVI_INSTRUMENT_STATUS, 0),
		new CDriverErrorInfo(IDS_E_IVI_CANNOT_OPEN_FILE, E_IVI_CANNOT_OPEN_FILE, 0),
		new CDriverErrorInfo(IDS_E_IVI_READING_FILE, E_IVI_READING_FILE, 0),
		new CDriverErrorInfo(IDS_E_IVI_WRITING_FILE, E_IVI_WRITING_FILE, 0),
		new CDriverErrorInfo(IDS_E_IVI_INVALID_PATHNAME, E_IVI_INVALID_PATHNAME, 0),
		new CDriverErrorInfo(IDS_E_IVI_INVALID_VALUE, E_IVI_INVALID_VALUE, 0),
		new CDriverErrorInfo(IDS_E_IVI_METHOD_NOT_SUPPORTED, E_IVI_METHOD_NOT_SUPPORTED, 0),
		new CDriverErrorInfo(IDS_E_IVI_PROPERTY_NOT_SUPPORTED, E_IVI_PROPERTY_NOT_SUPPORTED, 0),
		new CDriverErrorInfo(IDS_E_IVI_VALUE_NOT_SUPPORTED, E_IVI_VALUE_NOT_SUPPORTED, 0),
		new CDriverErrorInfo(IDS_E_IVI_NOT_INITIALIZED, E_IVI_NOT_INITIALIZED, 0),
		new CDriverErrorInfo(IDS_E_IVI_UNKNOWN_CHANNEL_NAME, E_IVI_UNKNOWN_CHANNEL_NAME, 0),
		new CDriverErrorInfo(IDS_E_IVI_TOO_MANY_OPEN_FILES, E_IVI_TOO_MANY_OPEN_FILES, 0),
		new CDriverErrorInfo(IDS_E_IVI_CHANNEL_NAME_REQUIRED, E_IVI_CHANNEL_NAME_REQUIRED, 0),
		new CDriverErrorInfo(IDS_E_IVI_MISSING_OPTION_NAME, E_IVI_MISSING_OPTION_NAME, 0),
		new CDriverErrorInfo(IDS_E_IVI_MISSING_OPTION_VALUE, E_IVI_MISSING_OPTION_VALUE, 0),
		new CDriverErrorInfo(IDS_E_IVI_BAD_OPTION_NAME, E_IVI_BAD_OPTION_NAME, 0),
		new CDriverErrorInfo(IDS_E_IVI_BAD_OPTION_VALUE, E_IVI_BAD_OPTION_VALUE, 0),
		new CDriverErrorInfo(IDS_E_IVI_OUT_OF_MEMORY, E_IVI_OUT_OF_MEMORY, 0),
		new CDriverErrorInfo(IDS_E_IVI_OPERATION_PENDING, E_IVI_OPERATION_PENDING, 0),
		new CDriverErrorInfo(IDS_E_IVI_NULL_POINTER, E_IVI_NULL_POINTER, 0),
		new CDriverErrorInfo(IDS_E_IVI_UNEXPECTED_RESPONSE, E_IVI_UNEXPECTED_RESPONSE, 0),
		new CDriverErrorInfo(IDS_E_IVI_FILE_NOT_FOUND, E_IVI_FILE_NOT_FOUND, 0),
		new CDriverErrorInfo(IDS_E_IVI_INVALID_FILE_FORMAT, E_IVI_INVALID_FILE_FORMAT, 0),
		new CDriverErrorInfo(IDS_E_IVI_STATUS_NOT_AVAILABLE, E_IVI_STATUS_NOT_AVAILABLE, 0),
		new CDriverErrorInfo(IDS_E_IVI_ID_QUERY_FAILED, E_IVI_ID_QUERY_FAILED, 0),
		new CDriverErrorInfo(IDS_E_IVI_RESET_FAILED, E_IVI_RESET_FAILED, 0),
		new CDriverErrorInfo(IDS_E_IVI_RESOURCE_UNKNOWN, E_IVI_RESOURCE_UNKNOWN, 0),
		new CDriverErrorInfo(IDS_E_IVI_ALREADY_INITIALIZED, E_IVI_ALREADY_INITIALIZED, 0),
		new CDriverErrorInfo(IDS_E_IVI_CANNOT_CHANGE_SIMULATION_STATE, E_IVI_CANNOT_CHANGE_SIMULATION_STATE, 0),
		new CDriverErrorInfo(IDS_E_IVI_INVALID_NUMBER_OF_LEVELS_IN_SELECTOR, E_IVI_INVALID_NUMBER_OF_LEVELS_IN_SELECTOR, 0),
		new CDriverErrorInfo(IDS_E_IVI_INVALID_RANGE_IN_SELECTOR, E_IVI_INVALID_RANGE_IN_SELECTOR, 0),
		new CDriverErrorInfo(IDS_E_IVI_UNKNOWN_NAME_IN_SELECTOR, E_IVI_UNKNOWN_NAME_IN_SELECTOR, 0),
		new CDriverErrorInfo(IDS_E_IVI_BADLY_FORMED_SELECTOR, E_IVI_BADLY_FORMED_SELECTOR, 0),
		new CDriverErrorInfo(IDS_E_IVI_UNKNOWN_PHYSICAL_IDENTIFIER, E_IVI_UNKNOWN_PHYSICAL_IDENTIFIER, 0),
		NULL);

	return &_errorMap;
}


