本文整理汇总了C++中Child::getParentKey方法的典型用法代码示例。如果您正苦于以下问题:C++ Child::getParentKey方法的具体用法?C++ Child::getParentKey怎么用?C++ Child::getParentKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Child
的用法示例。
在下文中一共展示了Child::getParentKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeChild
Bool testhash::Parent::removeChild(Sym key) const {
if(getChildTableLen() == 0)
return false;
StdUInt hash_value = getChildHash(key);
Child first_table_child = getiChildTable(hash_value);
if(!first_table_child.isValid())
return false;
for (Child it = first_table_child; it.isValid(); it = it.getNextParentTableListChild())
{
if (getChildHash(it.getParentKey()) != hash_value)
break;
if (it.getParentKey() == key)
return removeChild(it);
}
return false;
}
示例2: getChildHash
Bool testhash::Parent::removeChild(const Child & child) const {
if(!child.isExists() || child.getParent() != *this )
return false;
StdUInt hash_value = getChildHash(child.getParentKey());
Child next = child.getNextParentTableListChild();
Child prev = child.getPrevParentTableListChild();
if (prev.isValid()) //! Previous exists
{
if (getChildHash(prev.getParentKey()) != hash_value) //! Previous has different hash
{
if (next.isValid()) //! And next exists
{
if (getChildHash(next.getParentKey()) != hash_value) //! But next has different hash
setiChildTable(hash_value, Child());
else //! Next has the same hash
setiChildTable(hash_value, next);
}
else //! Next is absent
{
setiChildTable(hash_value, Child());
setChildTableMax(getChildHash(prev.getParentKey()));
}
}
}
else //! Previous absent
{
if (next.isValid()) //! Next exists
{
if (getChildHash(next.getParentKey()) != hash_value) //! Next has different hash
{
setiChildTable(hash_value, Child());
setChildTableMin(getChildHash(next.getParentKey()));
}
else //! Next has the same hash
setiChildTable(hash_value, next);
}
else //! Next is absent
{
setiChildTable(hash_value, Child());
setChildTableMax(0);
setChildTableMin(0);
}
}
removeTableListChild(child);
child.setParent(Parent());
child.removeParentHandler();
setNumChilds(getNumChilds() - 1);
return true;
}