本文整理汇总了C++中TopSegmentIteratorPtr::toNextParalogy方法的典型用法代码示例。如果您正苦于以下问题:C++ TopSegmentIteratorPtr::toNextParalogy方法的具体用法?C++ TopSegmentIteratorPtr::toNextParalogy怎么用?C++ TopSegmentIteratorPtr::toNextParalogy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TopSegmentIteratorPtr
的用法示例。
在下文中一共展示了TopSegmentIteratorPtr::toNextParalogy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mapSelf
// note: takes smart pointer as it maybe added to the results
static hal_size_t mapSelf(MappedSegmentPtr mappedSeg, list<MappedSegmentPtr> &results, hal_size_t minLength) {
hal_size_t added = 0;
if (mappedSeg->isTop() == true) {
SegmentIteratorPtr target = mappedSeg->getTargetIteratorPtr();
SegmentIteratorPtr source = mappedSeg->getSourceIteratorPtr();
TopSegmentIteratorPtr top = std::dynamic_pointer_cast<TopSegmentIterator>(target);
TopSegmentIteratorPtr topCopy = top->clone();
do {
// FIXME: why isn't clone() polymorphic?
SegmentIteratorPtr newSource;
if (source->isTop()) {
newSource = std::dynamic_pointer_cast<TopSegmentIterator>(source)->clone();
} else {
newSource = std::dynamic_pointer_cast<BottomSegmentIterator>(source)->clone();
}
TopSegmentIteratorPtr newTop = topCopy->clone();
MappedSegmentPtr newMappedSeg(new MappedSegment(newSource, newTop));
assert(newMappedSeg->getGenome() == mappedSeg->getGenome());
assert(newMappedSeg->getSource()->getGenome() == mappedSeg->getSource()->getGenome());
results.push_back(newMappedSeg);
++added;
if (topCopy->tseg()->hasNextParalogy()) {
topCopy->toNextParalogy();
}
} while (topCopy->tseg()->hasNextParalogy() == true && topCopy->getLength() >= minLength &&
topCopy->getArrayIndex() != top->getArrayIndex());
} else if (mappedSeg->getGenome()->getParent() != NULL) {
hal_index_t rightCutoff = mappedSeg->getEndPosition();
BottomSegmentIteratorPtr bottom = mappedSeg->targetAsBottom();
hal_index_t startOffset = (hal_index_t)bottom->getStartOffset();
hal_index_t endOffset = (hal_index_t)bottom->getEndOffset();
TopSegmentIteratorPtr top = mappedSeg->getGenome()->getTopSegmentIterator();
top->toParseUp(bottom);
do {
TopSegmentIteratorPtr topNew = top->clone();
// we map the new target back to see how the offsets have
// changed. these changes are then applied to the source segment
// as deltas
BottomSegmentIteratorPtr bottomBack = bottom->clone();
bottomBack->toParseDown(topNew);
hal_index_t startBack = (hal_index_t)bottomBack->getStartOffset();
hal_index_t endBack = (hal_index_t)bottomBack->getEndOffset();
assert(startBack >= startOffset);
assert(endBack >= endOffset);
SegmentIteratorPtr newSource = mappedSeg->sourceClone();
hal_index_t startDelta = startBack - startOffset;
hal_index_t endDelta = endBack - endOffset;
assert((hal_index_t)newSource->getLength() > startDelta + endDelta);
newSource->slice(newSource->getStartOffset() + startDelta, newSource->getEndOffset() + endDelta);
MappedSegmentPtr newMappedSeg(new MappedSegment(newSource, topNew));
assert(newMappedSeg->isTop() == true);
assert(newMappedSeg->getSource()->getGenome() == mappedSeg->getSource()->getGenome());
added += mapSelf(newMappedSeg, results, minLength);
// stupid that we have to make this check but odn't want to
// make fundamental api change now
if (top->getEndPosition() != rightCutoff) {
top->toRight(rightCutoff);
} else {
break;
}
} while (true);
}
return added;
}