本文整理汇总了C++中Locator::isValid方法的典型用法代码示例。如果您正苦于以下问题:C++ Locator::isValid方法的具体用法?C++ Locator::isValid怎么用?C++ Locator::isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Locator
的用法示例。
在下文中一共展示了Locator::isValid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: expirationTime
void* Visualizer::DataLocator::incrementalExtractorThreadMethod(void)
{
/* Enable asynchronous cancellation of this thread: */
Threads::Thread::setCancelState(Threads::Thread::CANCEL_ENABLE);
Threads::Thread::setCancelType(Threads::Thread::CANCEL_ASYNCHRONOUS);
/* Handle extraction requests until interrupted: */
Realtime::AlarmTimer alarm;
Misc::Time expirationTime(0.1);
while(true)
{
/* Wait until there is a seed request: */
Locator* locator;
{
Threads::Mutex::Lock seedRequestLock(seedRequestMutex);
#ifdef __DARWIN__
while(seedLocator==0)
{
seedRequestCond.wait(seedRequestMutex);
if(terminate)
return 0;
}
#else
while(seedLocator==0)
seedRequestCond.wait(seedRequestMutex);
#endif
locator=seedLocator;
seedLocator=0;
extracting=true;
}
/* Start extracting a new visualization element: */
int nextIndex=(renderIndex+1)%3;
if(nextIndex==mostRecentIndex)
nextIndex=(nextIndex+1)%3;
if(locator->isValid())
{
if(extractor->getPipe()!=0)
{
/* Notify the slave nodes that a new visualization element is coming: */
extractor->getPipe()->write<int>(1);
}
trackedElements[nextIndex]=extractor->startElement(locator);
/* Continue extracting the visualization element until it is done: */
bool keepGrowing;
do
{
/* Grow the visualization element by a little bit: */
alarm.armTimer(expirationTime);
keepGrowing=!extractor->continueElement(alarm);
/* Set the most recently updated visualization element: */
mostRecentIndex=nextIndex;
Vrui::requestUpdate();
/* Check if the current element is still being tracked: */
{
Threads::Mutex::Lock seedRequestLock(seedRequestMutex);
if(seedTracking)
keepGrowing=false;
extracting=keepGrowing;
}
}
while(keepGrowing);
extractor->finishElement();
}
else
{
if(extractor->getPipe()!=0)
{
/* Notify the slave nodes that the currently tracked visualization element should be deleted: */
extractor->getPipe()->write<int>(0);
}
trackedElements[nextIndex]=0;
mostRecentIndex=nextIndex;
Vrui::requestUpdate();
}
delete locator;
if(extractor->getPipe()!=0)
{
extractor->getPipe()->barrier();
}
}
return 0;
}
示例2: if
void* Visualizer::DataLocator::immediateExtractorThreadMethod(void)
{
/* Enable asynchronous cancellation of this thread: */
Threads::Thread::setCancelState(Threads::Thread::CANCEL_ENABLE);
Threads::Thread::setCancelType(Threads::Thread::CANCEL_ASYNCHRONOUS);
/* Handle extraction requests until interrupted: */
while(true)
{
/* Wait until there is an extraction request: */
Locator* locator;
{
Threads::Mutex::Lock seedRequestLock(seedRequestMutex);
#ifdef __DARWIN__
do
{
seedRequestCond.wait(seedRequestMutex);
if(terminate)
return 0;
}
while(!extracting);
#else
do
{
seedRequestCond.wait(seedRequestMutex);
}
while(!extracting);
#endif
locator=seedLocator;
seedLocator=0;
}
/* Extract a new visualization element: */
int nextIndex=(renderIndex+1)%3;
if(nextIndex==mostRecentIndex)
nextIndex=(nextIndex+1)%3;
if(extractor->hasSeededCreator()&&locator!=0&&locator->isValid())
{
/* Extract a seeded element: */
if(extractor->getPipe()!=0)
{
/* Notify the slave nodes that a new visualization element is coming: */
extractor->getPipe()->write<int>(1);
}
trackedElements[nextIndex]=extractor->createElement(locator);
}
else if(!extractor->hasSeededCreator())
{
/* Extract a global element: */
if(extractor->getPipe()!=0)
{
/* Notify the slave nodes that a new visualization element is coming: */
extractor->getPipe()->write<int>(1);
}
trackedElements[nextIndex]=extractor->createElement();
}
else
{
if(extractor->getPipe()!=0)
{
/* Notify the slave nodes that the currently tracked visualization element should be deleted: */
extractor->getPipe()->write<int>(0);
}
trackedElements[nextIndex]=0;
}
delete locator;
if(extractor->getPipe()!=0)
{
/* Wait until the new visualization element has arrived at all slaves: */
extractor->getPipe()->barrier();
}
/* Hand the new visualization element to the application: */
mostRecentIndex=nextIndex;
Vrui::requestUpdate();
}
return 0;
}