本文整理汇总了C++中TopSegmentIteratorPtr::getEndOffset方法的典型用法代码示例。如果您正苦于以下问题:C++ TopSegmentIteratorPtr::getEndOffset方法的具体用法?C++ TopSegmentIteratorPtr::getEndOffset怎么用?C++ TopSegmentIteratorPtr::getEndOffset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TopSegmentIteratorPtr
的用法示例。
在下文中一共展示了TopSegmentIteratorPtr::getEndOffset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mapDown
// note: takes smart pointer as it maybe added to the results
static hal_size_t mapDown(MappedSegmentPtr mappedSeg, hal_size_t childIndex, list<MappedSegmentPtr> &results,
hal_size_t minLength) {
const Genome *child = mappedSeg->getGenome()->getChild(childIndex);
assert(child != NULL);
hal_size_t added = 0;
if (mappedSeg->isTop() == false) {
TopSegmentIteratorPtr topSegIt = child->getTopSegmentIterator();
SegmentIteratorPtr targetSegIt = mappedSeg->getTargetIteratorPtr();
BottomSegmentIteratorPtr botSegIt = std::dynamic_pointer_cast<BottomSegmentIterator>(targetSegIt);
if (botSegIt->bseg()->hasChild(childIndex) == true && botSegIt->getLength() >= minLength) {
topSegIt->toChild(botSegIt, childIndex);
mappedSeg->setTarget(std::dynamic_pointer_cast<SegmentIterator>(topSegIt));
results.push_back(MappedSegmentPtr(mappedSeg));
++added;
}
} else {
hal_index_t rightCutoff = mappedSeg->getEndPosition();
TopSegmentIteratorPtr topSegIt = mappedSeg->targetAsTop();
hal_index_t startOffset = (hal_index_t)topSegIt->getStartOffset();
hal_index_t endOffset = (hal_index_t)topSegIt->getEndOffset();
BottomSegmentIteratorPtr botSegIt = mappedSeg->getGenome()->getBottomSegmentIterator();
botSegIt->toParseDown(topSegIt);
do {
BottomSegmentIteratorPtr newBotSegIt = botSegIt->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
TopSegmentIteratorPtr backTopSegIt = topSegIt->clone();
backTopSegIt->toParseUp(newBotSegIt);
hal_index_t startBack = (hal_index_t)backTopSegIt->getStartOffset();
hal_index_t endBack = (hal_index_t)backTopSegIt->getEndOffset();
assert(startBack >= startOffset);
assert(endBack >= endOffset);
SegmentIteratorPtr newSourceSegIt = mappedSeg->sourceClone();
hal_index_t startDelta = startBack - startOffset;
hal_index_t endDelta = endBack - endOffset;
assert((hal_index_t)newSourceSegIt->getLength() > startDelta + endDelta);
newSourceSegIt->slice(newSourceSegIt->getStartOffset() + startDelta, newSourceSegIt->getEndOffset() + endDelta);
MappedSegmentPtr newMappedSeg(new MappedSegment(newSourceSegIt, newBotSegIt));
assert(newMappedSeg->isTop() == false);
assert(newMappedSeg->getSource()->getGenome() == mappedSeg->getSource()->getGenome());
added += mapDown(newMappedSeg, childIndex, results, minLength);
// stupid that we have to make this check but odn't want to
// make fundamental api change now
if (botSegIt->getEndPosition() != rightCutoff) {
botSegIt->toRight(rightCutoff);
} else {
break;
}
} while (true);
}
return added;
}