本文整理汇总了C++中Child::isValid方法的典型用法代码示例。如果您正苦于以下问题:C++ Child::isValid方法的具体用法?C++ Child::isValid怎么用?C++ Child::isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Child
的用法示例。
在下文中一共展示了Child::isValid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2:
Void testhash::Parent::cascadeRemoveTableListChild() const {
Child prev;
for ( Child current = getFirstTableListChild(); current.isValid(); current = current.getNextParentTableListChild())
{
if (prev.isValid())
{
prev.removeTableListParentHandler();
prev.destroy();
}
prev = current;
}
if (prev.isValid())
{
prev.removeTableListParentHandler();
prev.destroy();
}
}
示例3: getFirstTableListChild
testhash::Child testhash::Parent::popFrontTableListChild() const {
Child result = getFirstTableListChild();
if(result.isValid())
{
result.removeTableListParentHandler();
Child next = result.getNextParentTableListChild();
result.setNextParentTableListChild(Child());
result.setPrevParentTableListChild(Child());
setFirstTableListChild(next);
if(!next.isValid())
setLastTableListChild(Child());
else
next.setPrevParentTableListChild(Child());
setNumTableListChilds(getNumTableListChilds() - 1);
}
return result;
}
示例4: getLastTableListChild
testhash::Child testhash::Parent::popBackTableListChild() const {
Child result = getLastTableListChild();
if(result.isValid())
{
result.removeTableListParentHandler();
Child prev = result.getPrevParentTableListChild();
result.setPrevParentTableListChild(Child());
result.setNextParentTableListChild(Child());
setLastTableListChild(prev);
if(!prev.isValid())
setFirstTableListChild(Child());
else
prev.setNextParentTableListChild(Child());
setNumTableListChilds(getNumTableListChilds() - 1);
}
return result;
}
示例5:
Void testlist::Parent::cascadeRemoveChild() const {
Child prev;
for ( Child current = getFirstChild(); current.isValid(); current = current.getNextParentChild())
{
if (prev.isValid())
{
prev.removeParentHandler();
prev.setParent(Parent());
prev.destroy();
}
prev = current;
}
if (prev.isValid())
{
prev.removeParentHandler();
prev.destroy();
}
}
示例6: setFirstFreeChild
Bool testlist::Child::removeFreeChild(const Child & child) {
if( !child.isExists() )
return false;
Child prev;
Child current;
for(current = getFirstFreeChild(); current.isValid() && current != child; current = current.getNextChildFreeChild())
prev = current;
if(!current.isValid())
{
return false; //! data corrupted
}
current.removeFreeChildHandler();
if(prev.isValid())
prev.setNextChildFreeChild(current.getNextChildFreeChild());
else
setFirstFreeChild(current.getNextChildFreeChild());
current.setNextChildFreeChild(Child());
setNumFreeChilds(getNumFreeChilds() - 1);
return true;
}
示例7: getFirstFreeChild
testlist::Child testlist::Child::popFreeChild() {
Child result = getFirstFreeChild();
if(result.isValid())
{
result.removeFreeChildHandler();
setFirstFreeChild(result.getNextChildFreeChild());
result.setNextChildFreeChild(Child());
setNumFreeChilds(getNumFreeChilds() - 1);
}
return result;
}
示例8: Child
testlist::Child testlist::Child::create() {
if(instanceCount() == 0)
return Child();
Child result = popFreeChild();
if(!result.isValid())
{
if(getUsed() >= instanceCount())
reallocInstances(instanceCount() << 1);
result = Child(getUsed());
setUsed(getUsed() + 1);
}
result.reset();
result.onCreate();
return result;
}
示例9: setLastTableListChild
Bool testhash::Parent::insertAfterTableListChild(const Child & child, const Child & prev) const {
if( !child.isExists() || !prev.isExists())
return false;
Child next = prev.getNextParentTableListChild();
prev.setNextParentTableListChild(child);
child.setPrevParentTableListChild(prev);
child.setNextParentTableListChild(next);
if(next.isValid())
next.setPrevParentTableListChild(child);
else
setLastTableListChild(child);
setNumTableListChilds(getNumTableListChilds() + 1);
child.setupTableListParentHandler();
return true;
}
示例10: setFirstTableListChild
Bool testhash::Parent::insertBeforeTableListChild(const Child & child, const Child & next) const {
if(!child.isExists() || !next.isExists())
return false;
Child prev = next.getPrevParentTableListChild();
next.setPrevParentTableListChild(child);
child.setNextParentTableListChild(next);
child.setPrevParentTableListChild(prev);
if(prev.isValid())
prev.setNextParentTableListChild(child);
else
setFirstTableListChild(child);
setNumTableListChilds(getNumTableListChilds() + 1);
child.setupTableListParentHandler();
return true;
}
示例11: 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;
}
示例12: setLastChild
Bool testlist::Parent::insertAfterChild(const Child & child, const Child & prev) const {
if(!child.isExists() ||
!prev.isExists() ||
prev.getParent() != *this ||
child.getParent().isValid())
return false;
Child next = prev.getNextParentChild();
prev.setNextParentChild(child);
child.setPrevParentChild(prev);
child.setNextParentChild(next);
if(next.isValid())
next.setPrevParentChild(child);
else
setLastChild(child);
child.setParent(*this);
setNumChilds(getNumChilds() + 1);
child.setupParentHandler();
return true;
}
示例13: setFirstChild
Bool testlist::Parent::insertBeforeChild(const Child & child, const Child & next) const {
if(!child.isExists() ||
!next.isExists() ||
next.getParent() != *this ||
child.getParent().isValid())
return false;
Child prev = next.getPrevParentChild();
next.setPrevParentChild(child);
child.setNextParentChild(next);
child.setPrevParentChild(prev);
if(prev.isValid())
prev.setNextParentChild(child);
else
setFirstChild(child);
child.setParent(*this);
setNumChilds(getNumChilds() + 1);
child.setupParentHandler();
return true;
}
示例14: if
Bool testhash::Parent::removeTableListChild(const Child & child) const {
if( !child.isExists())
return false;
child.removeTableListParentHandler();
Child next = child.getNextParentTableListChild(), prev = child.getPrevParentTableListChild();
if(next.isValid())
next.setPrevParentTableListChild(prev);
else if (getLastTableListChild() == child)
setLastTableListChild(prev);
else
return false;
if(prev.isValid())
prev.setNextParentTableListChild(next);
else if (getFirstTableListChild() == child)
setFirstTableListChild(next);
else
return false;
child.setNextParentTableListChild(Child());
child.setPrevParentTableListChild(Child());
setNumTableListChilds(getNumTableListChilds() - 1);
return true;
}
示例15: if
Bool testlist::Parent::removeChild(const Child & child) const {
if( !child.isExists() || child.getParent() != *this)
return false;
child.removeParentHandler();
Child next = child.getNextParentChild(), prev = child.getPrevParentChild();
if(next.isValid())
next.setPrevParentChild(prev);
else if (getLastChild() == child)
setLastChild(prev);
else
return false;
if(prev.isValid())
prev.setNextParentChild(next);
else if (getFirstChild() == child)
setFirstChild(next);
else
return false;
child.setNextParentChild(Child());
child.setPrevParentChild(Child());
child.setParent(Parent());
setNumChilds(getNumChilds() - 1);
return true;
}