本文整理汇总了C++中QQueue::at方法的典型用法代码示例。如果您正苦于以下问题:C++ QQueue::at方法的具体用法?C++ QQueue::at怎么用?C++ QQueue::at使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QQueue
的用法示例。
在下文中一共展示了QQueue::at方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: indexElementoMenor
int Grafo::indexElementoMenor(QQueue<vertice*> cola)
{
int indexMin = 0;
for(int i = 0; i < cola.size(); i++)
{
if(cola.at(i)->costoHastaAhora < cola.at(indexMin)->costoHastaAhora)
indexMin = i;
}
return indexMin;
}
示例2: initializeAnimation
void BFS::initializeAnimation(){
setMenu(false);
int r=255, g=255, b=0;
int color_step= 25;
m_operations.push_back([=,this](){ getNode(_currentNode)->setColor(QColor(r, g, b));colorNode(_currentNode); });
r-=color_step;
g-=color_step;
QQueue<int> queue;
queue.append(_currentNode);
getNode(_currentNode)->setVisited(true);
while(!queue.empty()){
int curr = queue.at(0);
queue.pop_front();
NodeList list = getNeighbours(curr);
for (auto iter : list){
if(!getNode(iter)->visited()){
getNode(iter)->setVisited(true);
m_operations.push_back([=,this](){getEdge(curr, iter)->setColor(QColor(r,g,b)); colorEdge(curr, iter); emit highlightLine(10);});
m_operations.push_back([=,this](){getNode(iter)->setColor(QColor(r,g,b)); colorNode(iter);});
queue.append(iter);
}
}
r-=color_step;
g-=color_step;
}
m_animationInitialized= true;
m_currentStepInAnimation= 0;
m_numberOfStepsInAnimation= m_operations.size();
}
示例3: service
int BleRtmpSendThread::service(BleRtmpMuxer & muxer)
{
int ret = BLE_SUCESS;
if ((ret = sendVideoSh(muxer)) != BLE_SUCESS) {
return ret;
}
if ((ret = sendAudioSh(muxer)) != BLE_SUCESS) {
return ret;
}
while (!m_stop) {
QQueue<BleAVPacket *> pkts = BleAVQueue::instance()->dequeue();
if (pkts.isEmpty()) {
msleep(50);
continue;
}
BleAutoLocker(m_mutex);
while (!pkts.empty()) {
BleAVPacket *pkt = pkts.dequeue();
BleAutoFree(BleAVPacket, pkt);
MStream &data = pkt->data;
if (pkt->pktType == Packet_Type_Video) {
if (muxer.addH264(data, pkt->dts) != TRUE ) {
ret = BLE_RTMPSEND_ERROR;
break;
}
m_videoKbps += (data.size() + 11);
m_fps += 1;
} else if (pkt->pktType == Packet_Type_Audio) {
if (muxer.addAAC(data, pkt->dts) != TRUE ) {
ret = BLE_RTMPSEND_ERROR;
break;
}
m_audioKbps += (data.size() + 11);
}
m_sendDataCount += (data.size() + 11);
}
// if send failed, then pkts may has some pkt
// we should delete it.
for (int i = 0; i < pkts.size(); ++i) {
BleAVPacket *pkt = pkts.at(i);
BleFree(pkt);
}
}
return ret;
}
示例4: addFramesToDeinterlace
void DeintFilter::addFramesToDeinterlace(QQueue<FrameBuffer> &framesQueue, bool checkSize)
{
while (!framesQueue.isEmpty())
{
const VideoFrame &videoFrame = framesQueue.at(0).frame;
if (((deintFlags & AutoDeinterlace) && !videoFrame.interlaced) || (checkSize && videoFrame.hasNoData()))
break;
internalQueue.enqueue(framesQueue.dequeue());
}
}
示例5: while
QList<vertice> Grafo::Dijkstra(vertice *ini, vertice* fin)
{
for(int i = 0; i < this->vertices.size();i++)
{
this->vertices.at(i)->costoHastaAhora = INT_MAX;
this->vertices.at(i)->predecesor = NULL;
}
int indexOrigen = this->EncontrarIndexVertice(ini);
int indexMeta = this->EncontrarIndexVertice(fin);
int indexMinimoCola, indexMinimoVertices;
this->vertices.at(indexOrigen)->costoHastaAhora = 0;
QQueue<vertice*> cola;
vertice *u;
float peso;
cola.append(this->vertices.at(indexOrigen));
while(!cola.empty())
{
indexMinimoCola = this->indexElementoMenor(cola);
u = cola.at(indexMinimoCola);
indexMinimoVertices = this->EncontrarIndexVertice(u);
cola.removeAll(u);
this->vertices.at(indexMinimoVertices)->visitado = true;
for(int j = 0; j < this->vertices.at(indexMinimoVertices)->adyacentes.size(); j++)
{
if(!this->vertices.at(indexMinimoVertices)->adyacentes.at(j)->visitado)
{
peso = this->vertices.at(indexMinimoVertices)->configuracion.Distanica(&this->vertices.at(indexMinimoVertices)->adyacentes.at(j)->configuracion);
if(this->vertices.at(indexMinimoVertices)->adyacentes.at(j)->costoHastaAhora >
this->vertices.at(indexMinimoVertices)->costoHastaAhora + peso)
{
this->vertices.at(indexMinimoVertices)->adyacentes.at(j)->costoHastaAhora = this->vertices.at(indexMinimoVertices)->costoHastaAhora + peso;
this->vertices.at(indexMinimoVertices)->adyacentes.at(j)->predecesor = this->vertices.at(indexMinimoVertices);
cola.append(this->vertices.at(indexMinimoVertices)->adyacentes.at(j));
}
}
}
//SE debe remover de la cola el elemento
}
QList<vertice> ruta;
vertice *actual = this->vertices.at(indexMeta);
while(actual != NULL)
{
ruta.push_front(*actual);
actual = actual->predecesor;
}
return ruta;
}
示例6: paintPath
void TrafficGraphWidget::paintPath(QPainterPath &path, QQueue<float> &samples)
{
int h = height() - YMARGIN * 2, w = width() - XMARGIN * 2;
int sampleCount = samples.size(), x = XMARGIN + w, y;
if(sampleCount > 0) {
path.moveTo(x, YMARGIN + h);
for(int i = 0; i < sampleCount; ++i) {
x = XMARGIN + w - w * i / DESIRED_SAMPLES;
y = YMARGIN + h - (int)(h * samples.at(i) / fMax);
path.lineTo(x, y);
}
path.lineTo(x, YMARGIN + h);
}
}
示例7: isBusy
bool SBusController::isBusy( const QString & bus )
{
const QStringList & keys = active_buses->keys();
if( keys.contains(bus) )
return true;
if( !queued_buses->contains(bus) )
return false;
QQueue<SBusController*> *list = queued_buses->value(bus);
for( int i=0 ; i<list->count() ; i++ )
if( !list->at(i)->passUpAndWait() )
return true;
return false;
}
示例8: finish
void SBusController::finish( const QString & bus )
{
if( bus.isEmpty() )
return;
SBusController *core = (*active_buses)[bus];
if( core != this )
{
qCritical() << QString("SBusController::finish : This SBusController Object can't remove \"%1\" from SBusController.").arg(bus);
return ;
}
active_buses->remove(bus);
/*! ---------- Dequeue first not pass up process ------------ */
SBusController *item = 0;
if( !queued_buses->contains(bus) )
return;
QQueue<SBusController*> *queue = queued_buses->value(bus);
if( queue == 0 )
return;
for( int i=0 ; i<queue->count() ; i++ )
{
if( !queue->at(i)->passUpAndWait() )
{
item = queue->takeAt( i );
break;
}
}
if( item == 0 )
return;
/*! --------------------------------------------------------- */
if( queued_buses->value(bus)->isEmpty() )
delete queued_buses->take( bus );
active_buses->insert( bus , item );
emit item->go();
}
示例9: run
void BleEncoderThread::run()
{
BleImageProcessThread * imageProcessThread = dynamic_cast<BleImageProcessThread *> (m_imageProcessThread);
BleAssert(imageProcessThread);
while (!m_stop) {
QQueue<BleImage*> images = BleAVContext::instance()->captureThread->getQueue();
// if can't get image, then sleep 50 ms.
if (images.isEmpty()) {
msleep(5);
continue;
}
while (!images.empty()) {
BleImage * image = images.dequeue();
BleAutoFree(BleImage, image);
if (image->dataSize <= 0) continue;
IplImage* imgYUV = cvCreateImage(cvSize(image->width, image->height * 3 / 2), IPL_DEPTH_8U, 1);
IplImage *cvImage = cvCreateImageHeader(cvSize(image->width, image->height), IPL_DEPTH_8U, 3);
cvImage->imageData = image->data;
cvImage->imageDataOrigin = image->data;
cvCvtColor(cvImage, imgYUV, CV_BGR2YUV_I420);
m_x264Encoder->encode((uchar*)imgYUV->imageData, image->pts, image->opaque);
cvReleaseImageHeader(&cvImage);
cvReleaseImage(&imgYUV);
if (m_stop) break;
}
// do clean
for (int i = 0; i > images.size(); ++i) {
BleImage *img = images.at(i);
BleFree(img);
}
}
log_trace("BleEncoderThread exit normally.");
}
示例10: ffmpegGraphPlot
void MainWindow::ffmpegGraphPlot(QQueue<int> LL, QQueue<int> RR) {
qLL = LL;
qRR = RR;
widget.PlotView0->addGraph();
widget.PlotView0->graph()->setPen(QPen(Qt::blue));
widget.PlotView0->graph()->setBrush(QBrush(QColor(0, 0, 255, 20)));
widget.PlotView0->graph()->setPen(QPen(Qt::red));
widget.PlotView1->addGraph();
widget.PlotView1->graph()->setPen(QPen(Qt::blue));
widget.PlotView1->graph()->setBrush(QBrush(QColor(0, 0, 255, 20)));
widget.PlotView1->graph()->setPen(QPen(Qt::red));
//int size = qLL.size();
int size = LL.size() / 5;
QVector<double> x0(size), y0(size); // initialize with entries 0..100
QVector<double> x1(size), y1(size); // initialize with entries 0..100
for (int i = 0; i < size; i += 1) {
x0[i] = i; // x goes from -1 to 1
y0[i] = LL.at(i); // let's plot a quadratic function
// y1[i] = LL.at(i+1); // let's plot a quadratic function
// y0[i] = rand()*1000;
// cout<<LL.at(i)<<endl;
// y1[i] = Samples[100000 + i + 1] / 20; // let's plot a quadratic function
}
widget.PlotView0->addGraph();
widget.PlotView0->graph(0)->setData(x0, y0);
widget.PlotView0->xAxis->setRange(0, 1000);
widget.PlotView0->yAxis->setRange(-255, 255);
widget.PlotView0->replot();
widget.PlotView1->addGraph();
widget.PlotView1->graph(0)->setData(x0, y0);
widget.PlotView1->xAxis->setRange(0, 1000);
widget.PlotView1->yAxis->setRange(-255, 255);
widget.PlotView1->replot();
cout << size << endl;
}
示例11: setPassUpAndWait
void SBusController::setPassUpAndWait( bool state )
{
if( p->pass_up_and_wait == state )
return;
p->pass_up_and_wait = state;
if( state )
{
/*! ----------------- Find Active Buses ---------------- */
QStringList keys = active_buses->keys();
for( int i=0 ; i<keys.count() ; i++ )
{
const QString & bus = keys.at(i);
if( !active_buses->contains(bus) )
continue;
SBusController *controller = active_buses->value( bus );
if( controller == this )
{
finish( bus );
getAccess( bus );
}
}
}
else
{
/*! ----------------- Find Disabled Buses ---------------- */
QStringList keys = queued_buses->keys();
for( int i=0 ; i<keys.count() ; i++ )
{
const QString & bus = keys.at(i);
if( active_buses->contains(bus) )
continue;
/*! ---------- Find First Deactived Processes to Active --------- */
if( !queued_buses->contains(bus) )
continue;
QQueue<SBusController*> *queue = queued_buses->value(bus);
if( queue == 0 )
continue;
for( int j=0 ; j<queue->count() ; j++ )
{
if( queue->at(j) != this )
continue;
queue->removeAt( j );
if( queue->isEmpty() )
delete queued_buses->take( bus );
active_buses->insert( bus , this );
emit go();
break;
}
}
}
}
示例12: range
void RefInterface::range()
{
if(radioNum == 0)
{
radioFd = radioCom;
if(antennaNum == 0)
{
buffer.reqNode = "101A";
//range to the controller using radio A
if (rcmRangeTo(destNode, ANTENNAMODE_A, 0, NULL,
&RangeInfo, &dataInfo, &scanInfo, &fullScanInfo) == 0)
{
//This gets the precision range measurement
if (RangeInfo.rangeMeasurementType & RCM_RANGE_TYPE_PRECISION)
{
////qDebug()<<"Precision range: "<< RangeInfo.precisionRangeMm;
r0 = RangeInfo.precisionRangeMm;
}
//if the status comes back as 0, the radio ranged correctly
if (RangeInfo.rangeStatus == 0)
{
// add range to buffer structure
r0 = r0/1000;
buffer.R0 = r0;
buffer.mError = RangeInfo.precisionRangeErrEst;
buffer.status = RangeInfo.rangeStatus;
////qDebug()<<"Range Successful";
}
else if(RangeInfo.precisionRangeErrEst > 60)
{
if(!msg.isEmpty())
{
buffer.mError = RangeInfo.precisionRangeErrEst;
buffer.status = RangeInfo.rangeStatus;
thresholdErrorCountR0++;
emit sendThresholdCount(thresholdErrorCountR0, thresholdErrorCountR1, thresholdErrorCountR2, thresholdErrorCountR3);
emit display(buffer.x, buffer.y, buffer.z, RangeInfo.precisionRangeMm, buffer.R1, buffer.R2,
buffer.R3,buffer.roll, buffer.pitch,buffer.yaw, buffer.mError,buffer.status);
r0 = msg.at(0).R0;
buffer.R0 = r0;
}
}
else
{
r0 = msg.at(0).R0;
buffer.R0 = r0;
buffer.mError = RangeInfo.precisionRangeErrEst;
buffer.status = RangeInfo.rangeStatus;
errorCountR0++;
emit sendErrorCount(errorCountR0, errorCountR1, errorCountR2, errorCountR3);
}
} //end if
antennaNum = 1;
return;
}
if(antennaNum == 1)
{
buffer.reqNode = "101B";
//range to controller using radio B
if (rcmRangeTo(destNode, ANTENNAMODE_B, 0, NULL,
&RangeInfo, &dataInfo, &scanInfo, &fullScanInfo) == 0)
{
// Get precision range measurement from msg received
if (RangeInfo.rangeMeasurementType & RCM_RANGE_TYPE_PRECISION)
{
////qDebug()<<"Precision range: "<< RangeInfo.precisionRangeMm;
r1 = RangeInfo.precisionRangeMm;
}
//if the status is 0, range was successful
if (RangeInfo.rangeStatus == 0)
{
////qDebug()<<"Range Successful";
//add range to buffer struct
r1 = r1/1000;
buffer.R1 = r1;
buffer.mError = RangeInfo.precisionRangeErrEst;
buffer.status = RangeInfo.rangeStatus;
}
else if(RangeInfo.precisionRangeErrEst >60)
{
if(!msg.isEmpty())
{
buffer.mError = RangeInfo.precisionRangeErrEst;
buffer.status = RangeInfo.rangeStatus;
thresholdErrorCountR1++;
emit sendThresholdCount(thresholdErrorCountR0, thresholdErrorCountR1, thresholdErrorCountR2, thresholdErrorCountR3);
emit display(buffer.x, buffer.y, buffer.z, buffer.R0, RangeInfo.precisionRangeMm, buffer.R2,
buffer.R3,buffer.roll, buffer.pitch,buffer.yaw, buffer.mError,buffer.status);
r1 = msg.at(0).R1;
buffer.R1 = r1;
}
}
else
//.........这里部分代码省略.........