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


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

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


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

示例1: set_buffer_loader

	void set_buffer_loader(EASYRPG_SHARED_PTR<buffer_loader> const &l) {
		SET_CONTEXT(ctx_);
		alSourceStop(src_);
		alSourcei(src_, AL_BUFFER, AL_NONE);

		if (not l) {
			loader_.reset();
			return;
		}

		ALint unqueuing_count;
		alGetSourceiv(src_, AL_BUFFERS_QUEUED, &unqueuing_count);
		std::vector<ALuint> unqueued(unqueuing_count);
		alSourceUnqueueBuffers(src_, unqueuing_count, &unqueued.front());

		loader_ = l;
		int queuing_count = 0;
		BOOST_ASSERT(not l->is_end());
		ticks_.push_back(0);
		for (; queuing_count < BUFFER_NUMBER; ++queuing_count) {
			buf_sizes_.push_back(loader_->load_buffer(buffers_[queuing_count]));
			ticks_.push_back(loader_->midi_ticks());

			if (loader_->is_end()) {
				queuing_count++;
				break;
			}
		}
		alSourceQueueBuffers(src_, queuing_count, buffers_.data());
		alSourcePlay(src_);
	}
开发者ID:Ancurio,项目名称:Player,代码行数:31,代码来源:al_audio.cpp

示例2: controlCallback

void WaypointVelocityVisualizer::controlCallback(const geometry_msgs::PoseStamped::ConstPtr& current_pose_msg,
                                                 const geometry_msgs::TwistStamped::ConstPtr& current_twist_msg,
                                                 const geometry_msgs::TwistStamped::ConstPtr& command_twist_msg)
{
  // buffers are reset when time goes back, e.g. playback rosbag
  ros::Time current_time = ros::Time::now();
  if (previous_time_ > current_time)
  {
    ROS_WARN("Detected jump back in time of %.3fs. Clearing markers and buffers.",
             (previous_time_ - current_time).toSec());
    deleteMarkers();  // call 'DELETEALL'
    resetBuffers();   // clear circular buffers
  }
  previous_time_ = current_time;
  // if plot_metric_interval <= 0, velocity is plotted by each callback.
  if (plot_metric_interval_ > 0 && current_pose_buf_.size() > 0)
  {
    tf::Vector3 p1, p2;
    tf::pointMsgToTF(current_pose_buf_.back().pose.position, p1);
    tf::pointMsgToTF(current_pose_msg->pose.position, p2);
    if (!(p1.distance(p2) > plot_metric_interval_))
      return;  // skipping plot
  }
  current_pose_buf_.push_back(*current_pose_msg);
  current_twist_buf_.push_back(*current_twist_msg);
  command_twist_buf_.push_back(*command_twist_msg);
  current_twist_marker_array_.markers.clear();
  command_twist_marker_array_.markers.clear();
  createVelocityMarker(current_pose_buf_, current_twist_buf_, "current_velocity", current_twist_color_,
                       current_twist_marker_array_);
  createVelocityMarker(current_pose_buf_, command_twist_buf_, "twist_cmd", command_twist_color_,
                       command_twist_marker_array_);
  publishVelocityMarker();
}
开发者ID:hatem-darweesh,项目名称:Autoware,代码行数:34,代码来源:waypoint_velocity_visualizer.cpp

示例3: update

	void update() {
		ALint processed;
		alGetSourceiv(src_, AL_BUFFERS_PROCESSED, &processed);
		std::vector<ALuint> unqueued(processed);
		alSourceUnqueueBuffers(src_, processed, &unqueued.front());
		int queuing_count = 0;
		for (; queuing_count < processed; ++queuing_count) {
			if (not loop_play_ and loader_->is_end()) {
				loader_.reset();
				++queuing_count;
				break;
			}

			if (loader_->is_end()) {
				ticks_.push_back(0);
			}
			buf_sizes_.push_back(loader_->load_buffer(unqueued[queuing_count]));
			ticks_.push_back(loader_->midi_ticks());
		}
		alSourceQueueBuffers(src_, queuing_count, &unqueued.front());

		if (fade_milli_ != 0) {
			SET_CONTEXT(ctx_);
			loop_count_++;

			if (fade_ended()) {
				alSourceStop(src_);
			} else {
				alSourcef(src_, AL_GAIN, current_volume());
			}
		}
	}
开发者ID:Ancurio,项目名称:Player,代码行数:32,代码来源:al_audio.cpp

示例4: write

  /** Try to write a value to the pipe

      \param[in] value is what we want to write

      \param[in] blocking specify if the call wait for the operation
      to succeed

      \return true on success

      \todo provide a && version
  */
  bool write(const T &value, bool blocking = false) {
    // Lock the pipe to avoid being disturbed
    std::unique_lock<std::mutex> ul { cb_mutex };
    TRISYCL_DUMP_T("Write pipe full = " << full()
                   << " value = " << value);

    if (blocking)
      /* If in blocking mode, wait for the not full condition, that
         may be changed when a read is done */
      read_done.wait(ul, [&] { return !full(); });
    else if (full())
      return false;

    cb.push_back(value);
    TRISYCL_DUMP_T("Write pipe front = " << cb.front()
                   << " back = " << cb.back()
                   << " cb.begin() = " << (void *)&*cb.begin()
                   << " cb.size() = " << cb.size()
                   << " cb.end() = " << (void *)&*cb.end()
                   << " reserved_for_reading() = " << reserved_for_reading()
                   << " reserved_for_writing() = " << reserved_for_writing());
    // Notify the clients waiting to read something from the pipe
    write_done.notify_all();
    return true;
  }
开发者ID:loic-yvonnet,项目名称:triSYCL,代码行数:36,代码来源:pipe.hpp

示例5: LoadChatHistory

bool PythonServer::LoadChatHistory(boost::circular_buffer<ChatHistoryEntity>& chat_history) {
    boost::python::object chat_provider = m_python_module_chat.attr("__dict__")["chat_history_provider"];
    if (!chat_provider) {
        ErrorLogger() << "Unable to get Python object chat_history_provider";
        return false;
    }
    boost::python::object f = chat_provider.attr("load_history");
    if (!f) {
        ErrorLogger() << "Unable to call Python method load_history";
        return false;
    }
    boost::python::object r = f();
    boost::python::extract<list> py_history(r);
    if (py_history.check()) {
        boost::python::stl_input_iterator<boost::python::tuple> entity_begin(py_history), entity_end;
        for (auto& it = entity_begin; it != entity_end; ++ it) {
            ChatHistoryEntity e;
            e.m_timestamp = boost::posix_time::from_time_t(boost::python::extract<time_t>((*it)[0]));;
            e.m_player_name = boost::python::extract<std::string>((*it)[1]);
            e.m_text = boost::python::extract<std::string>((*it)[2]);
            e.m_text_color = boost::python::extract<GG::Clr>((*it)[3]);
            chat_history.push_back(e);
        }
    }

    return true;
}
开发者ID:Vezzra,项目名称:freeorion,代码行数:27,代码来源:ServerFramework.cpp

示例6: render

	void render(sf::RenderTarget& target)
	{
		float dx = 1.0f/static_cast<float>(line_data_.capacity());
		float x = static_cast<float>(line_data_.capacity()-line_data_.size())*dx;

		line_data_.push_back(std::make_pair(tick_data_, tick_tag_));		
		tick_tag_   = false;
				
		glBegin(GL_LINE_STRIP);
		auto c = color(color_);
		glColor4f(std::get<0>(c), std::get<1>(c), std::get<2>(c), 0.8f);		
		for(size_t n = 0; n < line_data_.size(); ++n)		
			if(line_data_[n].first > -0.5)
				glVertex3d(x+n*dx, std::max(0.05, std::min(0.95, (1.0f-line_data_[n].first)*0.8 + 0.1f)), 0.0);		
		glEnd();
				
		glEnable(GL_LINE_STIPPLE);
		glLineStipple(3, 0xAAAA);
		for(size_t n = 0; n < line_data_.size(); ++n)
		{
			if(line_data_[n].second)
			{
				glBegin(GL_LINE_STRIP);			
					glVertex3f(x+n*dx, 0.0f, 0.0f);				
					glVertex3f(x+n*dx, 1.0f, 0.0f);		
				glEnd();
			}
		}
		glDisable(GL_LINE_STIPPLE);
	}
开发者ID:zhouqilin,项目名称:casparLinux,代码行数:30,代码来源:graph.cpp

示例7: odomCallback

void odomCallback (nav_msgs::Odometry odomPoseMsg)
{
    pair<geometry_msgs::Pose, ros::Time> next;
    next.first = odomPoseMsg.pose.pose;
    next.second = odomPoseMsg.header.stamp;
    cb.push_back (next);
    current = next;
}
开发者ID:rsbGroup1,项目名称:frobo_rsd,代码行数:8,代码来源:GPSLocalisationNode.cpp

示例8:

	line(size_t res = 1200)
		: line_data_(res)
	{
		tick_data_	= -1.0f;
		color_		= 0xFFFFFFFF;
		tick_tag_	= false;

		line_data_.push_back(std::make_pair(-1.0f, false));
	}
开发者ID:zhouqilin,项目名称:casparLinux,代码行数:9,代码来源:graph.cpp

示例9: return

bool 
MapsBuffer::pushBack(boost::shared_ptr<const MapsRgb> maps_rgb )
{
  bool retVal = false;
  {
    boost::mutex::scoped_lock buff_lock (bmutex_);
    if (!buffer_.full ())
      retVal = true;
    buffer_.push_back (maps_rgb);
  }
  buff_empty_.notify_one ();
  return (retVal);
}
开发者ID:hobu,项目名称:pcl,代码行数:13,代码来源:record_maps_rgb.cpp

示例10: scan

    void scan(std::istream& stream, std::function<void (const std::string &, int, size_t)> fun) {
      auto line_number = 0;
      for (std::string line; std::getline(stream, line);) {
	line_number++;
	metrics.lines_scanned++;
	if (line.length() > 0) {
	  buffer.push_back(line);
	  if (buffer.full()) {
	    emit_block(line_number, fun);
	  }
	} 
      }
    }
开发者ID:grahambrooks,项目名称:dups,代码行数:13,代码来源:text_scanner.hpp

示例11: put

void put(int x) {
    for(auto i=0;i<x;i++) {
        unique_lock<mutex> locker(m_mutex);
        while(Q.full())
            empty.wait(locker);
        assert(!Q.full());

        Q.push_back(i);
        cout << "@ "<< i <<endl;
        full.notify_all();
    }
    flag = false;
}
开发者ID:evely211,项目名称:Norman,代码行数:13,代码来源:NBoostQueue.cpp

示例12:

bool 
PCDBuffer::pushBack (pcl::PointCloud<pcl::PointXYZRGBA>::ConstPtr cloud)
{
	bool retVal = false;
	{
		boost::mutex::scoped_lock buff_lock (bmutex_);
		if (!buffer_.full ())
			retVal = true;
		buffer_.push_back (cloud);
	}
	buff_empty_.notify_one ();
	return (retVal);
}
开发者ID:hitsjt,项目名称:StanfordPCL,代码行数:13,代码来源:openni_recorder.cpp

示例13: fillOne

 bool fillOne()
 {
   int ch = super_t::read();
   if (ch<0) {
     // EOF reached --> cannot be filled
     //m_bReady = false;
     m_bEOF = true;
     return false;
   }
   if (!checkMatch(ch))
     return false;
   m_cbuf.push_back((unsigned char)ch);
   return true;
 }
开发者ID:biochem-fan,项目名称:cuemol2,代码行数:14,代码来源:ChunkDelimFilter.hpp

示例14: main

int main(int argc, char* argv[])
{
    v_circular_buffer_2.push_back(1);
    v_circular_buffer_2.push_back(4);

    MyClass tmp(x);
    v_intrusive_set_2.insert(tmp);

    MyClass_list tmp_list(x);
    v_intrusive_list_2.push_front(tmp_list);

    int r = done();  // break here
    r += argc + (char)argv[0][0];
    return r % 2;
}
开发者ID:Manicqin,项目名称:Boost-Pretty-Printer,代码行数:15,代码来源:test-other.cpp

示例15: updateGyroState

//TODO: change this a lot!
void updateGyroState(sensor_msgs::Imu& imuMsg, packet_t rxPkt, boost::circular_buffer<float>& calibration)
{
    uint8_t gyro_adc = rxPkt.payload[0];
    double current_time = ros::Time::now().toSec();
    double last_time = imuMsg.header.stamp.toSec();

    if (!isMoving) {
        calibration.push_back(float(gyro_adc));
        double total = 0;
        BOOST_FOREACH( float reading, calibration )
        {
            total += reading;
        }
        cal_offset = total / calibration.size(); 
    }
开发者ID:Limpinho0,项目名称:bilibot-ros-pkg,代码行数:16,代码来源:node2.cpp


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