当前位置: 首页>>代码示例>>C++>>正文


C++ Locator::isValid方法代码示例

本文整理汇总了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;
	}
开发者ID:jrevote,项目名称:3DA-3DVisualizer,代码行数:88,代码来源:DataLocator.cpp

示例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;
	}
开发者ID:jrevote,项目名称:3DA-3DVisualizer,代码行数:81,代码来源:DataLocator.cpp


注:本文中的Locator::isValid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。