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


C++ ArrayQueue::size方法代码示例

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


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

示例1: main

int main(int argc, char** argv) {
    ArrayQueue MevaCua; 
    cout<< "Mida actual de la cua: " << MevaCua.size() << endl; 
    cout<< "Encuem 3 elements a la cua... " << endl; 
    
    MevaCua.enqueue('1');
    MevaCua.enqueue('2'); 
    try{
    MevaCua.enqueue('3'); 
    }
    catch(CuaPlena& e){
            cout << e.what() << endl;
    }
    
    MevaCua.print(); 
    cout << "Cua plena (0:no, 1:si): " << MevaCua.full()<<endl; 
    cout<< "Treiem 1er element de la cua: "<<endl;
    try{
    MevaCua.dequeue();
    }
    catch(CuaBuida& e){
            cout << e.what() << endl;
        }
    MevaCua.print(); 
    cout<< "Treiem 2on element de la cua: " <<endl; 
    MevaCua.dequeue();  
    cout<< "Encuem 2 elements a la cua... " << endl; 
    MevaCua.enqueue('4'); 
    MevaCua.enqueue('5');  
    cout<< "Treiem 3er element de la cua: " <<endl; 
    MevaCua.dequeue(); 
    MevaCua.print(); 
    cout<<"Mida actual de la cua: " << MevaCua.size() << endl; 
    cout<<"Cua buida (0:no, 1:si): " << MevaCua.empty()<<endl;
}
开发者ID:adria88,项目名称:ED-C-,代码行数:35,代码来源:main.cpp

示例2: print

void print(const ArrayQueue<T> & q)
{
  cout << "capacity = " << q.capacity() << endl
       << "size     = " << q.size() << endl;

  for (int i = 0; i < q.size(); ++i)
    cout << (T) q.front(i) << " ";
  cout << endl ;

  for (int i = 0; i < q.size(); ++i)
    cout << (T) q.rear(i) << " ";
  cout << endl
       << endl;
}
开发者ID:AlbertDenn,项目名称:Aleph-AutoInstall,代码行数:14,代码来源:testQueue.C

示例3: countEvents

 /**
  * Obtain the current number of active events. This method is
  * intended for testing and debugging.
  *
  * @return number of active events
  **/
 uint32_t countEvents() const {
     uint32_t cnt = _count;
     for (uint32_t i = 0; i < _queue.size(); ++i) {
         cnt += _queue.peek(i).first;
     }
     return cnt;
 }
开发者ID:songhtdo,项目名称:vespa,代码行数:13,代码来源:eventbarrier.hpp

示例4: main

/*
 * Sequence of instructions that the queue object can run.
 */
int main(int argc, char** argv) {
    ArrayQueue mevaCua (MAX_QUEUE);
    cout << "Mida actual de la cua: " << mevaCua.size() << endl;
    cout << "Encuem 3 elements a la cua..." << endl;
    mevaCua.enqueue(1); mevaCua.enqueue(2); mevaCua.enqueue(3);
    mevaCua.print();
    cout << "Cua plena (0: no, 1: si): " << mevaCua.full() << endl;
    cout << "Traiem 1er element de la cua: " << mevaCua.dequeue() << endl;
    mevaCua.print();
    cout << "Traiem 2on element de la cua: " << mevaCua.dequeue() << endl;
    cout << "Encuem 2 elements a la cua... " << endl;
    mevaCua.enqueue(4); mevaCua.enqueue(5);
    cout << "Traiem 3er element de la cua: " << mevaCua.dequeue() << endl;
    cout << "Mida actual de la cua: " << mevaCua.size() << endl;
    mevaCua.print();
    cout << "Cua buida (0:no, 1:si): " << mevaCua.empty() << endl;
    return 0;
}
开发者ID:rballeba,项目名称:EstructuraDeDadesUB,代码行数:21,代码来源:main.cpp

示例5: completeEvent

 /**
  * Signal the completion of an event. The value passed to this
  * method must be the same as the return value previously obtained
  * from the startEvent method. This method will signal the
  * completion of all pending barriers that were completed by the
  * completion of this event.
  *
  * @param token opaque token identifying the completed event
  **/
 void completeEvent(uint32_t token) {
     if (token == _token) {
         --_count;
         return;
     }
     --_queue.access(_queue.size() - (_token - token)).first;
     while (!_queue.empty() && _queue.front().first == 0) {
         _queue.front().second->completeBarrier();
         _queue.pop();
     }
 }
开发者ID:songhtdo,项目名称:vespa,代码行数:20,代码来源:eventbarrier.hpp

示例6: countBarriers

 /**
  * Obtain the current number of pending barriers. This method is
  * intended for testing and debugging.
  *
  * @return number of pending barriers
  **/
 uint32_t countBarriers() const {
     return _queue.size();
 }
开发者ID:songhtdo,项目名称:vespa,代码行数:9,代码来源:eventbarrier.hpp


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