本文整理汇总了C++中Projection::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ Projection::clear方法的具体用法?C++ Projection::clear怎么用?C++ Projection::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Projection
的用法示例。
在下文中一共展示了Projection::clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run_query
/**
* Run a particular query
*/
string run_query( string query, int printlogicaltree, int printphysicaltree, int fromInsert, bool is_delete)
{
int status;
time_t start = time (NULL);
resetDIOs();
status = query2logical(query);
if ( status == -1) return "-1";
else if (status != 3) //all queries other than select return status 3
{
// THIS IS A SELECT QUERY.
if (printlogicaltree == 1) { cout << "I am printing the logical tree. " << endl;}
cout << endl;
if (logical2physical() == -1) return "-1";
if (printphysicaltree == 1) { cout << "I am printing the physical tree. " << endl;}
if (fromInsert)
return printresults (0,1);
else if (is_delete)
printresults(1,0);
else
printresults(0,0);
}
cout << endl << "Total number of disk I/Os: " << getDIOs() << endl << endl;
time_t end = time (NULL);
printf("%4.4f seconds taken to execute the query\n\n",(float)(end-start)/1000.0);
//Resetting global variables for next query
ConditionMap.clear();
conditions.clear();
P.clear();
T.clear();
Pr.clear();
return "";
}
示例2: 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)
{
//.........这里部分代码省略.........