本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
}
示例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();
}