本文整理汇总了C++中Projection::isInterrupted方法的典型用法代码示例。如果您正苦于以下问题:C++ Projection::isInterrupted方法的具体用法?C++ Projection::isInterrupted怎么用?C++ Projection::isInterrupted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Projection
的用法示例。
在下文中一共展示了Projection::isInterrupted方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createAllProjections
void FileProjections::createAllProjections()
{
if (graph->isEmpty())
{
return;
}
if(isMemoryUsed())
{
Projections::createAllProjections();
return;
}
// Prepare nodes
NodeMap* nodeList = graph->getNodeMap();
unsigned count = nodeList->size();
if (!count)
return;
ProjectionsWriter writer(*this);
setWorker(&writer, true);
startProcess(0u, count - 1);
unsigned oldSize = projectionsList->size();
bool isWasEmpty = !oldSize;
projectionsList->resize(count, nullptr);
projectionsList->shrink_to_fit();
auto oldStart = projectionsList->begin();
auto oldEnd = projectionsList->begin() + oldSize;
auto it = nodeList->begin();
Projection* pr;
std::string saveName(graphFileName);
unsigned nameSize = saveName.size();
unsigned currentId;
unsigned pos = oldSize;
for(unsigned i = 0u; i < count; ++i, ++it)
{
if (isInterrupted())
{
projectionStatus = Status::PARTIAL;
// if interrupted on null filled projections, shrink list
projectionsList->resize(pos);
break;
}
updateProgress(i);
currentId = it->first;
pr = nullptr;
// Projection exist - skip
if (!isWasEmpty)
{
auto e = std::lower_bound(oldStart, oldEnd, currentId,
Projection::lessById);
if (e != oldEnd && (*e)->getId() == currentId)
{
pr = *e;
if (pr->fileExist())
continue;
}
}
if (!pr)
{
pr = new Projection(currentId);
(*projectionsList)[pos] = pr;
++pos;
}
pr->createProjection(*graph);
if (pr->isInterrupted())
{
continue;
}
ProjectionsReader::projectionFileName(saveName, nameSize, currentId);
bool result = writer.saveProjection(saveName.data(), pr);
if (result)
{
pr->setFileExist(true);
}
// stay loaded last projection
if (count - i > 1)
{
pr->clear();
}
else
{
loadedProjection = pr;
}
}
if (!isWasEmpty)
{
//.........这里部分代码省略.........