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


C++ ACE_Unbounded_Queue::dequeue_head方法代码示例

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


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

示例1: saveFile

    bool saveFile(const char *name) {
        mutex.wait();
        saving = false;

        Sound total;
        total.resize(samples,channels);
        long int at = 0;
        while (!sounds.is_empty()) {
            Sound tmp;
            sounds.dequeue_head(tmp);
            for (int i=0; i<channels; i++) {
                for (int j=0; j<tmp.getSamples(); j++) {
                    total.set(tmp.get(j,i),at+j,i);
                }
            }
            total.setFrequency(tmp.getFrequency());
            at += tmp.getSamples();
        }
        mutex.post();
        bool ok = write(total,name);
        if (ok) {
            printf("Wrote audio to %s\n", name);
        }
        samples = 0;
        channels = 0;
        return ok;
    }
开发者ID:andreadelprete,项目名称:yarp,代码行数:27,代码来源:yarphear.cpp

示例2: remove_from_owner

void Gadget_Part_Impl::remove_from_owner (void)
{
  // Need to guarantee the existence of the owner for the duration of this call.
  Gadget_var owner = owner_;

  // Weak pointers are automatically set to NULL if the object they refer to
  // is deleted. We can use this fact to check that our owner still exists.
  if (owner == 0)
    return;

  // Take all existing parts from the owner and build up a temporary list. If
  // we find ourselves then we won't add ourselves to the list.
  ACE_Unbounded_Queue<Gadget_Part_var> parts;
  for (;;)
    {
      Gadget_Part_var part = owner->remove_part ();
      if (part == 0)
        break;
      if (part != this)
        parts.enqueue_tail (part);
    }

  // Add the remaining parts back to the gadget.
  while (!parts.is_empty ())
    {
      Gadget_Part_var part;
      parts.dequeue_head (part);
      owner->add_part (part);
    }
}
开发者ID:arun11299,项目名称:ACE-Code-Examples-Cpp,代码行数:30,代码来源:Gadget_Part_Impl.cpp

示例3: while

void
be_visitor_typecode_defn::
queue_reset (ACE_Unbounded_Queue <be_visitor_typecode_defn::QNode *> & queue)
{
  while (!queue.is_empty ())
    {
      be_visitor_typecode_defn::QNode * qnode = 0;
      (void) queue.dequeue_head (qnode);
      delete qnode;
    }
}
开发者ID:CCJY,项目名称:ATCD,代码行数:11,代码来源:typecode_defn.cpp

示例4: l

  ssize_t Socket_Impl::
    size_ (ACE_Time_Value const* timeout)
    {
      ACE_Time_Value abs_time;

      if (timeout)
        abs_time = ACE_OS::gettimeofday () + *timeout;

      Lock l (mutex_);

      while (queue_.is_empty ())
        {
          if (timeout)
            {
              if (cond_.wait (&abs_time) != -1)
                break;
            }
          else
            {
              if (cond_.wait () != -1)
                break;
            }

          return -1; // errno is already set
        }

      // I can't get the head of the queue without actually dequeuing
      // the element.
      //
      Message_ptr m;

      if (queue_.dequeue_head (m) == -1)
        ACE_OS::abort ();

      if (queue_.enqueue_head (m) == -1)
        ACE_OS::abort ();

      if (m->find (NoData::id) != 0)
        {
          errno = ENOENT;
          return -1;
        }

      Data const* d = static_cast<Data const*>(m->find (Data::id));

      return static_cast<ssize_t> (d->size ());
    }
开发者ID:asdlei00,项目名称:ACE,代码行数:47,代码来源:Socket.cpp


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