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


C++ CDiskObjectPtr::IsUnitDisk方法代码示例

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


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

示例1: GetType

WTL::CString CObjectUIHandler::GetType(CDiskObjectPtr obj) const
{
	WTL::CString strTitle;

	if(obj->IsUnitDisk())
	{
		if(dynamic_cast<CEmptyDiskObject*>(obj.get()) != NULL)
		{
			strTitle.LoadString(IDS_UNIDEV_TYPE_DISK_EMPTY);
		}
		else
		{
			strTitle.LoadString(IDS_LOGDEV_TYPE_SINGLE_DISK);
		}
	}
	else
	{
		CDiskObjectCompositePtr pDiskObjectComposite = 
			boost::dynamic_pointer_cast<CDiskObjectComposite>(obj);


		switch(pDiskObjectComposite->GetNDASMediaType())
		{
		case NMT_SINGLE: strTitle.LoadString(IDS_LOGDEV_TYPE_SINGLE_DISK); break;
		case NMT_AGGREGATE: strTitle.LoadString(IDS_LOGDEV_TYPE_AGGREGATED_DISK); break;
		case NMT_MIRROR: strTitle.LoadString(IDS_LOGDEV_TYPE_MIRRORED_DISK); break;
		case NMT_RAID0: strTitle.LoadString(IDS_LOGDEV_TYPE_DISK_RAID0); break;
		case NMT_RAID1: strTitle.LoadString(IDS_LOGDEV_TYPE_DISK_RAID1); break;
		case NMT_RAID4: strTitle.LoadString(IDS_LOGDEV_TYPE_DISK_RAID4); break;
		case NMT_CDROM: strTitle.LoadString(IDS_LOGDEV_TYPE_DVD_DRIVE); break;
		case NMT_OPMEM: strTitle.LoadString(IDS_LOGDEV_TYPE_MO_DRIVE); break;
		case NMT_FLASH: strTitle.LoadString(IDS_LOGDEV_TYPE_CF_DRIVE); break;
		default:
			strTitle.FormatMessage(IDS_LOGDEV_TYPE_UNKNOWN_FMT, 
				pDiskObjectComposite->GetNDASMediaType());
		}
	}

	return strTitle;
}
开发者ID:yzx65,项目名称:ndas4windows,代码行数:40,代码来源:nbuihandler.cpp

示例2: GetTitle

WTL::CString CObjectUIHandler::GetTitle(CDiskObjectPtr obj) const
{
	WTL::CString strTitle;

	if(obj->IsUnitDisk())
	{
		if(dynamic_cast<CEmptyDiskObject*>(obj.get()) != NULL)
		{
			strTitle.LoadString(IDS_UNIDEV_TYPE_DISK_EMPTY);
		}
		else
		{
			strTitle = obj->GetTitle();
		}
	}
	else
	{
		strTitle = GetType(obj);
	}

	return strTitle;
}
开发者ID:yzx65,项目名称:ndas4windows,代码行数:22,代码来源:nbuihandler.cpp

示例3: GetFaultTolerance

WTL::CString CObjectUIHandler::GetFaultTolerance(CDiskObjectPtr obj) const
{
	WTL::CString strTitle;
	strTitle = _T("");

	if(obj->IsUnitDisk())
	{
		if((dynamic_cast<CEmptyDiskObject*>(obj.get()) == NULL))
		{
			CDiskObjectPtr parent;
			CUnitDiskObjectPtr pUnitDiskObject = 
				boost::dynamic_pointer_cast<CUnitDiskObject>(obj);
			if(!(parent = pUnitDiskObject->GetParent())->IsRoot())
			{
				CDiskObjectCompositePtr pDiskObjectComposite = 
					boost::dynamic_pointer_cast<CDiskObjectComposite>(parent);
				if (NMT_RAID4 == pDiskObjectComposite->GetNDASMediaType())				
				{
					UINT8 child_status =
						pDiskObjectComposite->RMDUnitStatus(pUnitDiskObject->GetLocation()->GetUnitDiskLocation());
					if(NDAS_UNIT_META_BIND_STATUS_FAULT & child_status)
					{
						strTitle.LoadString(IDS_FT_FAULT_CHILD);
					}
					else if(NDAS_UNIT_META_BIND_STATUS_SPARE & child_status)
					{
						strTitle.LoadString(IDS_FT_FAULT_SPARE);
					}
				}
			}
			else
			{
				strTitle.LoadString(IDS_FT_UNIT);
			}
		}		
	}
	else
	{
		CDiskObjectCompositePtr pDiskObjectComposite = 
			boost::dynamic_pointer_cast<CDiskObjectComposite>(obj);

		// check missing member
		if(pDiskObjectComposite->IsBroken())
		{
			strTitle.LoadString(IDS_FT_MISSING);
		}
		else
		{
			switch(pDiskObjectComposite->GetNDASMediaType())
			{
			case NMT_AGGREGATE:
			case NMT_RAID0:
			case NMT_MIRROR:
				if(pDiskObjectComposite->IsBroken())
					strTitle.LoadString(IDS_FT_MISSING);
				else
					strTitle.LoadString(IDS_FT_NOT_FAULT_TOLERANT);
				break;
			case NMT_RAID1:
				{
					CMirDiskObjectPtr pMirDiskObject = 
						boost::dynamic_pointer_cast<CMirDiskObject>(pDiskObjectComposite);
					if(pMirDiskObject->IsBroken())
						strTitle.LoadString(IDS_FT_NEED_REPAIR);
					else if(pMirDiskObject->IsDirty())
						strTitle.LoadString(IDS_FT_DIRTY);
					else
						strTitle.LoadString(IDS_FT_FAULT_TOLERANT);
				}
				break;
			case NMT_RAID4:
				{
					CRAID4DiskObjectPtr pRAID4DiskObject = 
						boost::dynamic_pointer_cast<CRAID4DiskObject>(pDiskObjectComposite);

					if(pRAID4DiskObject->IsBroken())
					{
						strTitle.LoadString(IDS_FT_NEED_REPAIR);
					}
					else
					{
						switch(pDiskObjectComposite->RMDStatus())
						{
						case 0:
							strTitle.LoadString(IDS_FT_FAULT_TOLERANT);
							break;
						case 1:
							strTitle.LoadString(IDS_FT_DIRTY);
							break;
						case 2:
							strTitle.LoadString(IDS_FT_FAULT);
							break;
						case 3:
							strTitle.LoadString(IDS_FT_IN_SYNC);
							break;
						default:
							break;
						}
					}					
				}
//.........这里部分代码省略.........
开发者ID:yzx65,项目名称:ndas4windows,代码行数:101,代码来源:nbuihandler.cpp

示例4: GetParentSheet

//////////////////////////////////////////////////////////////////////////
// Page 1
//////////////////////////////////////////////////////////////////////////
LRESULT CDiskPropertyPage1::OnInitDialog(HWND /*hWndFocus*/, LPARAM /*lParam*/)
{
	WTL::CString strCaption;
	strCaption.LoadString(IDS_DISKPROPERTYPAGE_CAPTION);
	GetParent().SetWindowText(strCaption);

	CDiskObjectPtr disk = GetParentSheet()->GetDiskObject();
	const CObjectUIHandler *phandler = CObjectUIHandler::GetUIHandler( disk );
	WTL::CString strText;

	if(disk->IsUnitDisk())
	{
		GetDlgItem(IDC_EDIT_NAME).SetWindowText( disk->GetTitle() );
		GetDlgItem(IDC_EDIT_ID).SetWindowText( 
			phandler->GetStringID(disk) );
	}
	else
	{
		GetDlgItem(IDC_EDIT_NAME).SetWindowText(phandler->GetTitle(disk));
		GetDlgItem(IDC_DEVICE_ID).ShowWindow(SW_HIDE);
		GetDlgItem(IDC_EDIT_ID).ShowWindow(SW_HIDE);
	}

	if ( (disk->GetAccessMask() & GENERIC_WRITE) != 0 )
	{
		strText.LoadString( IDS_DISKPROPERTYPAGE_WRITEKEY_PRESENT );
		GetDlgItem(IDC_EDIT_WRITEKEY).SetWindowText( strText );
	}
	else
	{
		strText.LoadString( IDS_DISKPROPERTYPAGE_WRITEKEY_NOT_PRESENT );
		GetDlgItem(IDC_EDIT_WRITEKEY).SetWindowText( strText );
	}
	WTL::CString strCapacity;
	strCapacity.FormatMessage( 
			IDS_DISKPROPERTYPAGE_SIZE_IN_GB,
			phandler->GetSizeInMB( disk ) / 1024,
			(phandler->GetSizeInMB( disk ) % 1024) / 10 
			);
	GetDlgItem(IDC_EDIT_CAPACITY).SetWindowText( strCapacity );

	//
	// If the object is composite disk with 2 mirrored disk of DIB V1,
	// display 'Migrate' button and message.
	//
	if(!disk->IsUnitDisk() && // bound disk
		disk->GetParent()->IsRoot() && // top disk
		2 == disk->GetDiskCount()) // 2 disks only
	{
		CDiskObjectCompositePtr pDiskObjectComposite = 
            boost::dynamic_pointer_cast<CDiskObjectComposite>(disk);
		if(NMT_MIRROR == pDiskObjectComposite->GetNDASMediaType())
		{
			GetDlgItem(IDC_TEXT_MIGRATE).ShowWindow( SW_SHOW );
			GetDlgItem(IDC_BTN_MIGRATE).ShowWindow( SW_SHOW );
			GetDlgItem(IDC_ST_MIGRATE).ShowWindow( SW_SHOW );
		}
	}

	return 0;
}
开发者ID:yzx65,项目名称:ndas4windows,代码行数:64,代码来源:nbpropertypages.cpp


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