本文整理汇总了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();
}
示例2: put_
void put_( value_type const& va)
{
if ( ! active_() )
throw task_rejected("queue is not active");
queue_.push( va);
fsem_.post();
}
示例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);
}
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例13: push
virtual void push(const message_type &msg_arg)
{
(void)my_queue.push(msg_arg);
}
示例14: enqueue_
void enqueue_( msg_type const& msg)
{ queue_.push( msg); }
示例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);
}