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


C++ circular_buffer::empty方法代码示例

本文整理汇总了C++中boost::circular_buffer::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ circular_buffer::empty方法的具体用法?C++ circular_buffer::empty怎么用?C++ circular_buffer::empty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在boost::circular_buffer的用法示例。


在下文中一共展示了circular_buffer::empty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: take

void take() {
    while(flag) {
        unique_lock<mutex> locker(m_mutex);
        while(Q.empty())
            full.wait(locker);
        if(flag) {
            assert(!Q.empty());
            cout << "# " << Q.front() <<endl;
            Q.pop_front();
            empty.notify_all();
        }
    }
}
开发者ID:evely211,项目名称:Norman,代码行数:13,代码来源:NBoostQueue.cpp

示例2: while

boost::shared_ptr< const MapsBuffer::MapsRgb > 
MapsBuffer::getFront(bool print)
{
  boost::shared_ptr< const MapsBuffer::MapsRgb > depth_rgb;
  {
    boost::mutex::scoped_lock buff_lock (bmutex_);
    while (buffer_.empty ())
    {
      if (is_done)
        break;
      {
        boost::mutex::scoped_lock io_lock (io_mutex);
              //std::cout << "No data in buffer_ yet or buffer is empty." << std::endl;
      }
      buff_empty_.wait (buff_lock);
    }
    depth_rgb = buffer_.front ();
    buffer_.pop_front ();
  }
  
  if(print)
    PCL_INFO("%d maps left in the buffer...\n", buffer_.size ());
  
  return (depth_rgb);
}
开发者ID:hobu,项目名称:pcl,代码行数:25,代码来源:record_maps_rgb.cpp

示例3: downOne

 QList<QConsoleWidgetCommand> downOne(){
     if(commandBuffers.empty()){return QList<QConsoleWidgetCommand>();}
     --currentIndex;
     if( currentIndex<size() && currentIndex>=0){
         return commandBuffers[currentIndex  ];
     }else{
         currentIndex=0;
     }
     return commandBuffers[0];
 }
开发者ID:ngzHappy,项目名称:OpenGL45Book,代码行数:10,代码来源:QConsoleWidgetPrivate.hpp

示例4: upOne

 QList<QConsoleWidgetCommand> upOne(){
     if(commandBuffers.empty()){return QList<QConsoleWidgetCommand>();}
     ++currentIndex;
     if( currentIndex< size() && currentIndex>=0){
         return commandBuffers[currentIndex  ];
     }else{
         currentIndex= size();
     }
     return *(commandBuffers.rbegin());
 }
开发者ID:ngzHappy,项目名称:OpenGL45Book,代码行数:10,代码来源:QConsoleWidgetPrivate.hpp

示例5: longClick

/*! @brief Returns true if the last press was a long one
     @param times a circular buffer of the click times
     @param durations a circular buffer of the click durations
     @param previoustime the previous time that this event has occured
 */
bool BehaviourProvider::longClick(const boost::circular_buffer<float>& times, const boost::circular_buffer<float>& durations, float& previoustime)
{
    if (times.empty())
        return false;
    else if (previoustime == times.back())
        return false;
    else if (durations.back() <= 800)
        return false;
    else
    {
        previoustime = m_current_time;
        return true;
    }
}
开发者ID:NUbots,项目名称:robocup,代码行数:19,代码来源:BehaviourProvider.cpp

示例6:

pcl::PointCloud<pcl::PointXYZRGBA>::ConstPtr 
PCDBuffer::getFront ()
{
	pcl::PointCloud<pcl::PointXYZRGBA>::ConstPtr cloud;
	{
		boost::mutex::scoped_lock buff_lock (bmutex_);
		while (buffer_.empty ())
		{
			if (is_done)
				break;
			{
				boost::mutex::scoped_lock io_lock (io_mutex);
				//std::cout << "No data in buffer_ yet or buffer is empty." << std::endl;
			}
			buff_empty_.wait (buff_lock);
		}
		cloud = buffer_.front ();
		buffer_.pop_front ();
	}
	return (cloud);
}
开发者ID:hitsjt,项目名称:StanfordPCL,代码行数:21,代码来源:openni_recorder.cpp


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