当前位置: 首页>>代码示例>>C++>>正文


C++ NBUnitDevicePtrList::push_back方法代码示例

本文整理汇总了C++中NBUnitDevicePtrList::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ NBUnitDevicePtrList::push_back方法的具体用法?C++ NBUnitDevicePtrList::push_back怎么用?C++ NBUnitDevicePtrList::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NBUnitDevicePtrList的用法示例。


在下文中一共展示了NBUnitDevicePtrList::push_back方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnSpareRemove

void CMainFrame::OnSpareRemove(UINT wNotifyCode, int wID, HWND hwndCtl)
{
	CNBDevice *pDevice = m_viewTreeList.GetSelectedDevice();

	if(!pDevice)
		return;

	if(!pDevice->GetCommandAbility(wID))
		return;

	CNBUnitDevice *pUnitDevice = dynamic_cast<CNBUnitDevice *>(pDevice);
	if(!pUnitDevice || !pUnitDevice->GetLogicalDevice()->IsOperatableAll())
		return;

	NBUnitDevicePtrList listUnitDevices;
	listUnitDevices.push_back(pUnitDevice);

	CNBSelectDeviceDlg dlgSelectDevice(
		IDD_DEVICE_LIST, 
		IDS_SPARE_REMOVE_DLG_CAPTION, 
		IDS_SPARE_REMOVE_DLG_MESSAGE, 
		listUnitDevices, 
		0, 
		NULL, 
		NULL);

	if(dlgSelectDevice.DoModal() != IDOK)
		return;

	NDASCOMM_CONNECTION_INFO ci;
	pUnitDevice->InitConnectionInfo(&ci, TRUE);

	AutoCursor l_auto_cursor(IDC_WAIT);
	BOOL bResults = NdasOpSpareRemove(&ci);
	l_auto_cursor.Release();

	pUnitDevice->GetLogicalDevice()->HixChangeNotify(pGetNdasHostGuid());

	if(!bResults)
	{
		CString strMsg;

		DWORD dwLastError = ::GetLastError();

		strMsg.LoadString(IDS_OPERATION_FAIL);

		ShowErrorMessageBox(strMsg);

		return;
	}

	OnRefreshStatus(NULL, NULL, NULL);
}
开发者ID:tigtigtig,项目名称:ndas4windows,代码行数:53,代码来源:nbmainfrm.cpp

示例2: GetOperatableDevices

NBUnitDevicePtrList CNBLogicalDevice::GetOperatableDevices()
{
	NBUnitDevicePtrList listUnitDevices;

	for(UINT32 i = 0; i < DevicesTotal(); i++)
	{
		if(!m_mapUnitDevices.count(i))
			continue;

		listUnitDevices.push_back(m_mapUnitDevices[i]);
	}

	return listUnitDevices;
}
开发者ID:yzx65,项目名称:ndas4windows,代码行数:14,代码来源:nbdev.cpp

示例3: GetOperatableDevices

NBUnitDevicePtrList CNBLogicalDevice::GetOperatableDevices()
{
	NBUnitDevicePtrList listUnitDevices;

	for(UINT32 i = 0; i < DevicesTotal(); i++)
	{
		if(!m_mapUnitDevices.count(i))
			continue;
		if (m_mapUnitDevices[i]->IsMissingMember()) {
			// Cannot touch missing device.
			continue;
		}
		listUnitDevices.push_back(m_mapUnitDevices[i]);
	}

	return listUnitDevices;
}
开发者ID:tigtigtig,项目名称:ndas4windows,代码行数:17,代码来源:nbdev.cpp

示例4: GetOperatableSingleDevices

NBUnitDevicePtrList CMainFrame::GetOperatableSingleDevices()
{
	NBUnitDevicePtrList listUnitDevicesSingle;
	CNBLogicalDevice *pLogicalDevice;

	for(NBLogicalDevicePtrList::iterator itLogicalDevice = m_listLogicalDevices.begin();
		itLogicalDevice != m_listLogicalDevices.end(); itLogicalDevice++)
	{
		pLogicalDevice = *itLogicalDevice;
		if( pLogicalDevice->IsOperatable() &&
			pLogicalDevice->IsHDD() &&
			!pLogicalDevice->IsGroup())
		{
			listUnitDevicesSingle.push_back((*pLogicalDevice)[0]);
		}
	}

	return listUnitDevicesSingle;
}
开发者ID:tigtigtig,项目名称:ndas4windows,代码行数:19,代码来源:nbmainfrm.cpp

示例5: OnSingle

void CMainFrame::OnSingle(UINT wNotifyCode, int wID, HWND hwndCtl)
{
	CString strMsg;

	CNBDevice *pDevice = m_viewTreeList.GetSelectedDevice();

	if(!pDevice)
		return;

	if(!pDevice->GetCommandAbility(wID))
		return;

	CNBUnitDevice *pUnitDevice;
	if(dynamic_cast<CNBLogicalDevice *>(pDevice))
	{
		CNBLogicalDevice *pLogicalDevice = dynamic_cast<CNBLogicalDevice *>(pDevice);
		if(!pLogicalDevice || !pLogicalDevice->IsOperatableAll())
			return;

		pUnitDevice = (*pLogicalDevice)[0];
	}
	else
	{
		pUnitDevice = dynamic_cast<CNBUnitDevice *>(pDevice);
		if(!pUnitDevice || !pUnitDevice->IsOperatable())
			return;
	}

	if(!pUnitDevice)
		return;

	NBUnitDevicePtrList listUnitDevices;
	listUnitDevices.push_back(pUnitDevice);

	CNBSelectDeviceDlg dlgSelectDevice(
		IDD_DEVICE_LIST, 
		IDS_SINGLE_DLG_CAPTION, 
		IDS_SINGLE_DLG_MESSAGE, 
		listUnitDevices, 
		0, 
		NULL, 
		NULL);

	if(dlgSelectDevice.DoModal() != IDOK)
		return;


	NDASCOMM_CONNECTION_INFO ConnectionInfo;
	if(!pUnitDevice->InitConnectionInfo(&ConnectionInfo, TRUE))
	{
		
		// "%1!s! does not have a write access privilege. You need to set write key to this NDAS device before this action."
		strMsg.FormatMessage(IDS_ERROR_NOT_REGISTERD_WRITE_FMT,
			pUnitDevice->GetName()
			);
		CString strTitle;
		strTitle.LoadString(IDS_APPLICATION);
		MessageBox(
			strMsg,
			strTitle,
			MB_OK|MB_ICONERROR
			);

		return;
	}

	AutoCursor l_auto_cursor(IDC_WAIT);
	UINT32 BindResult = NdasOpBind(
		1,
		&ConnectionInfo,
		NMT_SINGLE,
		0);
	l_auto_cursor.Release();

	if(1 != BindResult)
	{
		DWORD dwLastError = ::GetLastError();

		switch(dwLastError)
		{
		case NDASCOMM_ERROR_RW_USER_EXIST:
		case NDASOP_ERROR_ALREADY_USED:
		case NDASOP_ERROR_DEVICE_FAIL:
		case NDASOP_ERROR_NOT_SINGLE_DISK:
		case NDASOP_ERROR_DEVICE_UNSUPPORTED:
		case NDASOP_ERROR_NOT_BOUND_DISK: // does not return this error
			strMsg.FormatMessage(IDS_BIND_FAIL_AT_SINGLE_NDAS_FMT, pUnitDevice->GetName());
			break;
		default:
			strMsg.LoadString(IDS_BIND_FAIL);
			break;
		}

		ShowErrorMessageBox(strMsg);
	}

	pUnitDevice->HixChangeNotify(pGetNdasHostGuid());

	OnRefreshStatus(NULL, NULL, NULL);
}
开发者ID:tigtigtig,项目名称:ndas4windows,代码行数:100,代码来源:nbmainfrm.cpp

示例6: OnReplaceUnitDevice

void CMainFrame::OnReplaceUnitDevice(UINT wNotifyCode, int wID, HWND hwndCtl)
{
	CNBDevice *pDevice = m_viewTreeList.GetSelectedDevice();

	if(!pDevice)
		return;

	if(!pDevice->GetCommandAbility(wID))
		return;

	CNBLogicalDevice *pLogicalDevice = dynamic_cast<CNBLogicalDevice *>(pDevice);
	if(!pLogicalDevice)
		return;

	// find the missing device

	CNBLogicalDevice *pLogicalDeviceReplace = NULL;
	CNBUnitDevice *pUnitDeviceReplace = NULL;
	NBUnitDevicePtrList listUnitDevicesReplace;
	NBLogicalDevicePtrList::iterator itLogicalDevice;
	for(UINT32 i = 0; i < pLogicalDevice->DevicesTotal(); i++)
	{
		if(!(*pLogicalDevice)[i])
		{
			for(itLogicalDevice = m_listLogicalDevices.begin(); 
				itLogicalDevice != m_listLogicalDevices.end(); 
				++itLogicalDevice)
			{
				pLogicalDeviceReplace = *itLogicalDevice;
				if(pLogicalDeviceReplace)
				{
					if (pLogicalDeviceReplace->IsHDD() &&
						!pLogicalDeviceReplace->IsGroup() &&
						pLogicalDeviceReplace->IsOperatable())
					{
						pUnitDeviceReplace = (*pLogicalDeviceReplace)[0];
						if (pUnitDeviceReplace->IsThis(
							pLogicalDevice->DIB()->UnitDisks[i].MACAddr,
							pLogicalDevice->DIB()->UnitDisks[i].UnitNumber))
						{
							// ok we found replacable HDD
							listUnitDevicesReplace.push_back(pUnitDeviceReplace);

						}
					}
				}
			}
		}
	}

	if(!listUnitDevicesReplace.size())
		return;

	CNBSelectDeviceDlg dlgSelectDevice(
		IDD_DEVICE_LIST, 
		IDS_REPLACE_UNIT_DEVICE_DLG_CAPTION, 
		IDS_REPLACE_UNIT_DEVICE_DLG_MESSAGE, 
		listUnitDevicesReplace, 
		0, 
		CheckCapacityForSpare, 
		pLogicalDevice);

	if(dlgSelectDevice.DoModal() != IDOK)
		return;

	// dlgSelectDevice is not selective dialog. get unit device from listUnitDevicesReplace
	CNBUnitDevice *pUnitDevice = *(listUnitDevicesReplace.begin());

	// Bind & Synchronize 
	NDASCOMM_CONNECTION_INFO ci, ci_replace;
	pLogicalDevice->InitConnectionInfo(&ci, TRUE); // use write access. this function does not support run time replace yet.
	pUnitDevice->InitConnectionInfo(&ci_replace, TRUE);

	for(UINT32 i = 0; i < pLogicalDevice->DevicesTotal(); i++)
	{
		if (!(*pLogicalDevice)[i])
		{
			break;
		}
	}

	if(pLogicalDevice->DevicesTotal() == i)
	{
		// failed to find missing device
		return;
	}

	AutoCursor l_auto_cursor(IDC_WAIT);

	BOOL bResults = NdasOpReplaceUnitDevice(
		&ci, &ci_replace, i);
	l_auto_cursor.Release();

	pLogicalDevice->HixChangeNotify(pGetNdasHostGuid());
	pUnitDevice->HixChangeNotify(pGetNdasHostGuid());

	if(!bResults)
	{
		CString strMsg;

//.........这里部分代码省略.........
开发者ID:tigtigtig,项目名称:ndas4windows,代码行数:101,代码来源:nbmainfrm.cpp


注:本文中的NBUnitDevicePtrList::push_back方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。