コード例 #1
0
ファイル: NBoostQueue.cpp プロジェクト: evely211/Norman
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();
        }
    }
}
コード例 #2
0
ファイル: record_maps_rgb.cpp プロジェクト: hobu/pcl
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);
}
コード例 #3
0
 QList<QConsoleWidgetCommand> downOne(){
     if(commandBuffers.empty()){return QList<QConsoleWidgetCommand>();}
     --currentIndex;
     if( currentIndex<size() && currentIndex>=0){
         return commandBuffers[currentIndex  ];
     }else{
         currentIndex=0;
     }
     return commandBuffers[0];
 }
コード例 #4
0
 QList<QConsoleWidgetCommand> upOne(){
     if(commandBuffers.empty()){return QList<QConsoleWidgetCommand>();}
     ++currentIndex;
     if( currentIndex< size() && currentIndex>=0){
         return commandBuffers[currentIndex  ];
     }else{
         currentIndex= size();
     }
     return *(commandBuffers.rbegin());
 }
コード例 #5
0
ファイル: BehaviourProvider.cpp プロジェクト: NUbots/robocup
/*! @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;
    }
}
コード例 #6
0
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);
}