本文整理汇总了C++中CDiskObjectPtr::GetParent方法的典型用法代码示例。如果您正苦于以下问题:C++ CDiskObjectPtr::GetParent方法的具体用法?C++ CDiskObjectPtr::GetParent怎么用?C++ CDiskObjectPtr::GetParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDiskObjectPtr
的用法示例。
在下文中一共展示了CDiskObjectPtr::GetParent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RebindMirror
void CMirrorWorkThread::RebindMirror()
{
// Get list of disks involved in the previous mirroring.
// NOTE : Because disks aggregated can also be mirrored,
// there can be more than two disks involved in the mirroring.
CDiskObjectPtr aggregationRoot;
aggregationRoot = m_pSource->GetParent();
while ( !aggregationRoot->GetParent()->IsRoot() )
{
aggregationRoot = aggregationRoot->GetParent();
}
// Mark all the bitmaps dirty.
m_pSource->OpenExclusive();
m_pDest->OpenExclusive();
m_pSource->MarkAllBitmap();
CUnitDiskInfoHandlerPtr pHandler = m_pSource->GetInfoHandler();
aggregationRoot->Rebind(
m_pDest,
pHandler->GetPosInBind() ^ 0x01
);
aggregationRoot->CommitDiskInfo(TRUE);
// Write binding information to the destination disk
m_pDest->Mirror(m_pSource);
m_pDest->CommitDiskInfo(TRUE);
m_bRebound = TRUE;
m_pSource->Close();
m_pDest->Close();
}
示例2: OnCommand
BOOL CUnitDiskUIHandler::OnCommand(CDiskObjectPtr obj, UINT nCommandID) const
{
ATLASSERT( dynamic_cast<CUnitDiskObject*>(obj.get()) != NULL);
switch( nCommandID )
{
case IDM_TOOL_SYNCHRONIZE:
{
// Delegate command to parent
const CObjectUIHandler *phandler =
CObjectUIHandler::GetUIHandler( obj->GetParent() );
return phandler->OnCommand( obj->GetParent(), nCommandID );
}
case IDM_TOOL_PROPERTY:
return OnProperty( obj );
}
return FALSE;
}
示例3: GetCommandSet
CCommandSet CUnitDiskUIHandler::GetCommandSet(CDiskObjectPtr obj) const
{
ATLASSERT( dynamic_cast<CUnitDiskObject*>(obj.get()) != NULL);
CCommandSet setCommand;
CUnitDiskObjectPtr unitDisk =
boost::dynamic_pointer_cast<CUnitDiskObject>(obj);
CUnitDiskInfoHandlerPtr handler = unitDisk->GetInfoHandler();
BOOL bCanWrite;
if ( handler->IsBound() )
{
CDiskObjectPtr aggrRoot = unitDisk->GetParent();
if ( aggrRoot->IsRoot() )
{
// This can occur when the tree is updated just after
// the disk is bound.
// This additional if code prevents error.
setCommand.push_back( CCommand(IDM_TOOL_UNBIND) );
}
else
{
while ( !aggrRoot->GetParent()->IsRoot() )
aggrRoot = aggrRoot->GetParent();
// To Unbind, we should have write privilege to all the disks in bind
setCommand.push_back( CCommand(IDM_TOOL_UNBIND,
aggrRoot->GetAccessMask() & GENERIC_WRITE) );
}
}
else
{
bCanWrite = unitDisk->GetAccessMask() & GENERIC_WRITE;
setCommand.push_back( CCommand(IDM_TOOL_ADDMIRROR, bCanWrite) );
}
if ( handler->IsMirrored() )
{
CMirDiskObjectPtr parent =
boost::dynamic_pointer_cast<CMirDiskObject>(unitDisk->GetParent());
if ( parent.get() != NULL )
{
// To synchronize, we have write privilege to the two disks in mirroring
setCommand.push_back( CCommand(IDM_TOOL_SYNCHRONIZE,
(parent->GetAccessMask() & GENERIC_WRITE) &&
parent->IsDirty() && !parent->IsBroken() &&
parent->HasWriteAccess()
)
);
}
CDiskObjectPtr aggrRoot = unitDisk->GetParent();
if ( aggrRoot->IsRoot() )
{
// This can occur when the tree is updated just after
// the disk is bound.
// This additional if code prevents error.
setCommand.push_back( CCommand(IDM_TOOL_UNBIND) );
}
else
{
while ( !aggrRoot->GetParent()->IsRoot() )
aggrRoot = aggrRoot->GetParent();
}
}
else if(NMT_RAID4 == handler->GetNDASMediaType())
{
CRAID4DiskObjectPtr parent =
boost::dynamic_pointer_cast<CRAID4DiskObject>(unitDisk->GetParent());
if ( parent.get() != NULL )
{
// To synchronize, we have write privilege to the two disks in mirroring
setCommand.push_back( CCommand(IDM_TOOL_SYNCHRONIZE,
(parent->GetAccessMask() & GENERIC_WRITE)
&& parent->IsDirty() && !parent->IsBroken()
)
);
}
}
if(unitDisk->IsUnitDisk())
{
setCommand.push_back( CCommand(IDM_TOOL_SINGLE) );
}
return setCommand;
}
示例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;
}