本文整理汇总了C++中CDiskObjectPtr::IsRoot方法的典型用法代码示例。如果您正苦于以下问题:C++ CDiskObjectPtr::IsRoot方法的具体用法?C++ CDiskObjectPtr::IsRoot怎么用?C++ CDiskObjectPtr::IsRoot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDiskObjectPtr
的用法示例。
在下文中一共展示了CDiskObjectPtr::IsRoot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}