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


C++ queue_type::push方法代码示例

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


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

示例1: enqueue_unlocked

 //! Enqueues a log record
 void enqueue_unlocked(record_view const& rec)
 {
     const bool was_empty = m_queue.empty();
     m_queue.push(enqueued_record(rec));
     if (was_empty)
         m_cond.notify_one();
 }
开发者ID:CasparCG,项目名称:Client,代码行数:8,代码来源:unbounded_ordering_queue.hpp

示例2: put_

	void put_( value_type const& va)
	{
		if ( ! active_() )
			throw task_rejected("queue is not active");
		queue_.push( va);
		fsem_.post();
	}
开发者ID:kotbegemot,项目名称:tasks,代码行数:7,代码来源:unbounded_prio_queue.hpp

示例3:

 /*!
  * \param cst	Pointer to the compressed suffix tree.
  * \param node  Root node of the traversal.
  * \param valid State of the iterator.
  * \param end   If valid=true and end=true, we get the end() iterator otherwise ``end'' has no effect.
  */
 cst_bfs_iterator(const Cst* cst, const value_type node, bool valid=true, bool end_it=false) {
     m_cst = cst;
     m_valid = valid;
     if (m_cst != nullptr and !end_it) {
         m_queue.push(node);
     }
 }
开发者ID:Alienfeel,项目名称:sdsl-lite,代码行数:13,代码来源:cst_iterators.hpp

示例4: test_next_priority

 void test_next_priority()
 {
     size_t next_prio = m_max_priority / 2;
     m_queue.push(next_prio, 10);
     ASSERT_EQ(next_prio, m_queue.priority_next());
     clear();
 }
开发者ID:hundeboll,项目名称:rlncd,代码行数:7,代码来源:test_queue.cpp

示例5: push

		bool push(T instance, unsigned int timeout = 5) {
			boost::unique_lock<boost::shared_mutex> lock(mutex_, boost::get_system_time() + boost::posix_time::seconds(timeout));
			if (!lock) {
				return false;
			}
			queue_.push(instance);
			return true;
		}
开发者ID:mickem,项目名称:nscp,代码行数:8,代码来源:queue.hpp

示例6: send

 /// Place a packet into the outgoing queue
 bool send( packet_type const &outpkt )
 {
     bool r=false;
     if( outgoing_not_empty())
     {
         m_outgoing_queue.incoming() = outpkt;
         m_outgoing_queue.push();
         r=true;
     }
     return r;
 }
开发者ID:ThomasSchaeferMS,项目名称:Obbligato,代码行数:12,代码来源:Net_QueuedSocket.hpp

示例7: enqueue

    bool enqueue(T const& data, bool notify = true) {
        if (!m_queue.push(data))
            return false;

        if (!notify) return true;

        boost::system::error_code ec;
        m_timer.cancel(ec);

        return true;
    }
开发者ID:erlanger,项目名称:eixx,代码行数:11,代码来源:async_queue.hpp

示例8: test_mixed

    void test_mixed()
    {
        std::array<int, 10> priorities = {0,1,2,3,2,1,0,1,2,0};

        for (auto i : priorities)
            m_queue.push(i, i);

        for (auto it : m_queue) {
            ASSERT_LE(it, m_last_priority);
            m_last_priority = it;
        }
        clear();
        m_last_priority = m_max_priority;
    }
开发者ID:hundeboll,项目名称:rlncd,代码行数:14,代码来源:test_queue.cpp

示例9: enqueue

    //! Enqueues log record to the queue
    void enqueue(record_view const& rec)
    {
        unique_lock< mutex_type > lock(m_mutex);
        std::size_t size = m_queue.size();
        for (; size >= MaxQueueSizeV; size = m_queue.size())
        {
            if (!overflow_strategy::on_overflow(rec, lock))
                return;
        }

        m_queue.push(rec);
        if (size == 0)
            m_cond.notify_one();
    }
开发者ID:Icenium,项目名称:BoostSharp,代码行数:15,代码来源:bounded_fifo_queue.hpp

示例10: test_top

    void test_top()
    {
        std::array<int, 10> priorities = {0,1,2,3,2,1,0,1,2,0};

        for (auto i : priorities)
            m_queue.push(i, i);

        for (size_t i = 0; i < priorities.size(); ++i) {
            ASSERT_LE(m_queue.top(), m_last_priority);
            m_last_priority = m_queue.top();
            m_queue.pop();
        }
        clear();
        m_last_priority = m_max_priority;
    }
开发者ID:hundeboll,项目名称:rlncd,代码行数:15,代码来源:test_queue.cpp

示例11:

	//! Prefix increment of the iterator.
	iterator& operator++()
	{
		if (!m_valid) return *this;
		if (m_queue.empty()) {
			m_valid = false;
			return *this;
		}
		value_type v = m_queue.front();
		m_queue.pop();
		value_type child = m_cst->select_child(v, 1);
		while (m_cst->root() != child) {
			m_queue.push(child);
			child = m_cst->sibling(child);
		}
		return *this;
	}
开发者ID:olydis,项目名称:sdsl-lite,代码行数:17,代码来源:cst_iterators.hpp

示例12: try_enqueue

    //! Attempts to enqueue log record to the queue
    bool try_enqueue(record_view const& rec)
    {
        unique_lock< mutex_type > lock(m_mutex, try_to_lock);
        if (lock.owns_lock())
        {
            const std::size_t size = m_queue.size();

            // Do not invoke the bounding strategy in case of overflow as it may block
            if (size < MaxQueueSizeV)
            {
                m_queue.push(rec);
                if (size == 0)
                    m_cond.notify_one();
                return true;
            }
        }

        return false;
    }
开发者ID:Icenium,项目名称:BoostSharp,代码行数:20,代码来源:bounded_fifo_queue.hpp

示例13: push

	virtual void push(const message_type &msg_arg)
	{
	   (void)my_queue.push(msg_arg);
	}
开发者ID:fmrl,项目名称:blanchett,代码行数:4,代码来源:simple_reactor.hpp

示例14: enqueue_

 void enqueue_( msg_type const& msg)
 { queue_.push( msg); }
开发者ID:maoy,项目名称:mosaic,代码行数:2,代码来源:queue.hpp

示例15: fill

 void fill(size_t num)
 {
     for (size_t i = 0; i < m_max_priority; ++i)
         for (size_t j = 0; j < num; ++j)
             m_queue.push(i, j);
 }
开发者ID:hundeboll,项目名称:rlncd,代码行数:6,代码来源:test_queue.cpp


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