这篇教程C++ start函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中start函数的典型用法代码示例。如果您正苦于以下问题:C++ start函数的具体用法?C++ start怎么用?C++ start使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了start函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: fontvoid KCategoryDrawer::drawCategory(const QModelIndex &index, int /*sortRole*/, const QStyleOption &option, QPainter *painter) const{ painter->setRenderHint(QPainter::Antialiasing); const QString category = index.model()->data(index, KCategorizedSortFilterProxyModel::CategoryDisplayRole).toString(); const QRect optRect = option.rect; QFont font(QApplication::font()); font.setBold(true); const QFontMetrics fontMetrics = QFontMetrics(font); QColor outlineColor = option.palette.text().color(); outlineColor.setAlphaF(0.35); //BEGIN: top left corner { painter->save(); painter->setPen(outlineColor); const QPointF topLeft(optRect.topLeft()); QRectF arc(topLeft, QSizeF(4, 4)); arc.translate(0.5, 0.5); painter->drawArc(arc, 1440, 1440); painter->restore(); } //END: top left corner //BEGIN: left vertical line { QPoint start(optRect.topLeft()); start.ry() += 3; QPoint verticalGradBottom(optRect.topLeft()); verticalGradBottom.ry() += fontMetrics.height() + 5; QLinearGradient gradient(start, verticalGradBottom); gradient.setColorAt(0, outlineColor); gradient.setColorAt(1, Qt::transparent); painter->fillRect(QRect(start, QSize(1, fontMetrics.height() + 5)), gradient); } //END: left vertical line //BEGIN: horizontal line { QPoint start(optRect.topLeft()); start.rx() += 3; QPoint horizontalGradTop(optRect.topLeft()); horizontalGradTop.rx() += optRect.width() - 6; painter->fillRect(QRect(start, QSize(optRect.width() - 6, 1)), outlineColor); } //END: horizontal line //BEGIN: top right corner { painter->save(); painter->setPen(outlineColor); QPointF topRight(optRect.topRight()); topRight.rx() -= 4; QRectF arc(topRight, QSizeF(4, 4)); arc.translate(0.5, 0.5); painter->drawArc(arc, 0, 1440); painter->restore(); } //END: top right corner //BEGIN: right vertical line { QPoint start(optRect.topRight()); start.ry() += 3; QPoint verticalGradBottom(optRect.topRight()); verticalGradBottom.ry() += fontMetrics.height() + 5; QLinearGradient gradient(start, verticalGradBottom); gradient.setColorAt(0, outlineColor); gradient.setColorAt(1, Qt::transparent); painter->fillRect(QRect(start, QSize(1, fontMetrics.height() + 5)), gradient); } //END: right vertical line //BEGIN: text { QRect textRect(option.rect); textRect.setTop(textRect.top() + 7); textRect.setLeft(textRect.left() + 7); textRect.setHeight(fontMetrics.height()); textRect.setRight(textRect.right() - 7); painter->save(); painter->setFont(font); QColor penColor(option.palette.text().color()); penColor.setAlphaF(0.6); painter->setPen(penColor); painter->drawText(textRect, Qt::AlignLeft | Qt::AlignVCenter, category); painter->restore(); } //END: text}
开发者ID:fluxer,项目名称:kdelibs,代码行数:95,
示例2: Server Server() : IPC::PipeServer("ServiceCore", 1, true) { start(); }
开发者ID:boskee,项目名称:Desurium-1,代码行数:4,
示例3: startbool RegionDesc::Block::contains(SrcKey sk) const { return sk >= start() && sk <= last();}
开发者ID:bsmr-misc-forks,项目名称:hhvm,代码行数:3,
示例4: switch//.........这里部分代码省略......... // Key on pixel format switch (value) { case PixelFormat::PIXEL_FORMAT_411YUV8: mSurfaceChannelOrder = SurfaceChannelOrder::RGB; mChannelCount = 3; break; case PixelFormat::PIXEL_FORMAT_422YUV8: mSurfaceChannelOrder = SurfaceChannelOrder::RGB; mChannelCount = 3; break; case PixelFormat::PIXEL_FORMAT_444YUV8: mSurfaceChannelOrder = SurfaceChannelOrder::BGR; mChannelCount = 3; break; case PixelFormat::PIXEL_FORMAT_BGR: mSurfaceChannelOrder = SurfaceChannelOrder::BGR; mChannelCount = 3; break; case PixelFormat::PIXEL_FORMAT_BGRU: mSurfaceChannelOrder = SurfaceChannelOrder::BGRA; mChannelCount = 4; break; case PixelFormat::PIXEL_FORMAT_MONO12: mSurfaceChannelOrder = SurfaceChannelOrder::CHAN_RED; mChannelCount = 1; break; case PixelFormat::PIXEL_FORMAT_MONO16: mSurfaceChannelOrder = SurfaceChannelOrder::CHAN_RED; mChannelCount = 1; break; case PixelFormat::PIXEL_FORMAT_MONO8: mSurfaceChannelOrder = SurfaceChannelOrder::CHAN_RED; mChannelCount = 1; break; case PixelFormat::PIXEL_FORMAT_RAW12: mSurfaceChannelOrder = SurfaceChannelOrder::RGB; mChannelCount = 3; break; case PixelFormat::PIXEL_FORMAT_RAW16: mSurfaceChannelOrder = SurfaceChannelOrder::RGB; mChannelCount = 3; break; case PixelFormat::PIXEL_FORMAT_RAW8: mSurfaceChannelOrder = SurfaceChannelOrder::RGB; mChannelCount = 3; break; case PixelFormat::PIXEL_FORMAT_RGB16: mSurfaceChannelOrder = SurfaceChannelOrder::RGB; mChannelCount = 3; break; case PixelFormat::PIXEL_FORMAT_RGB8: mSurfaceChannelOrder = SurfaceChannelOrder::RGB; mChannelCount = 3; break; case PixelFormat::PIXEL_FORMAT_RGBU: mSurfaceChannelOrder = SurfaceChannelOrder::RGBA; mChannelCount = 3; break; case PixelFormat::PIXEL_FORMAT_S_MONO16: mSurfaceChannelOrder = SurfaceChannelOrder::CHAN_RED; mChannelCount = 1; break; case PixelFormat::PIXEL_FORMAT_S_RGB16: mSurfaceChannelOrder = SurfaceChannelOrder::RGB; mChannelCount = 3; break; case PixelFormat::UNSPECIFIED_PIXEL_FORMAT: mSurfaceChannelOrder = SurfaceChannelOrder::UNSPECIFIED; mChannelCount = -1; break; } // If input value format is unspecifed, restore values and bail if (mChannelCount < 0) { mChannelCount = mPrevChannelCount; mSurfaceChannelOrder = mPrevSurfaceChannelOrder; return false; } // Update dimensions mErr = mRawImage.SetDimensions(mRawImage.GetRows(), mRawImage.GetCols(), mRawImage.GetStride(), value, mRawImage.GetBayerTileFormat()); if (mErr != PGRERROR_OK) { showError(); return false; } // Re-start input if we're previously capturing if (mCapturing) { stop(); return start(); } // Just return if we weren't already capturing return true;}
开发者ID:afrancois,项目名称:BanTheRewind,代码行数:101,
示例5: startTimer::Timer(){ start();}
开发者ID:SaintDubious,项目名称:DubiousEngine,代码行数:4,
示例6: collectvoidSF0X::cycle(){ /* fds initialized? */ if (_fd < 0) { /* open fd */ _fd = ::open(_port, O_RDWR | O_NOCTTY | O_NONBLOCK); } /* collection phase? */ if (_collect_phase) { /* perform collection */ int collect_ret = collect(); if (collect_ret == -EAGAIN) { /* reschedule to grab the missing bits, time to transmit 8 bytes @ 9600 bps */ work_queue(HPWORK, &_work, (worker_t)&SF0X::cycle_trampoline, this, USEC2TICK(1042 * 8)); return; } if (OK != collect_ret) { /* we know the sensor needs about four seconds to initialize */ if (hrt_absolute_time() > 5 * 1000 * 1000LL && _consecutive_fail_count < 5) { DEVICE_LOG("collection error #%u", _consecutive_fail_count); } _consecutive_fail_count++; /* restart the measurement state machine */ start(); return; } else { /* apparently success */ _consecutive_fail_count = 0; } /* next phase is measurement */ _collect_phase = false; /* * Is there a collect->measure gap? */ if (_measure_ticks > USEC2TICK(SF0X_CONVERSION_INTERVAL)) { /* schedule a fresh cycle call when we are ready to measure again */ work_queue(HPWORK, &_work, (worker_t)&SF0X::cycle_trampoline, this, _measure_ticks - USEC2TICK(SF0X_CONVERSION_INTERVAL)); return; } } /* measurement phase */ if (OK != measure()) { DEVICE_LOG("measure error"); } /* next phase is collection */ _collect_phase = true; /* schedule a fresh cycle call when the measurement is done */ work_queue(HPWORK, &_work, (worker_t)&SF0X::cycle_trampoline, this, USEC2TICK(SF0X_CONVERSION_INTERVAL));}
开发者ID:JW-CHOI,项目名称:Firmware,代码行数:75,
示例7: Q_UNUSEDvoid GridWidget::paintEvent(QPaintEvent *event){ Q_UNUSED(event); QPainter painter(this); qreal wantedHeight = CELL_HEIGHT * (ROW_COUNT + 1); qreal wantedWidth = FIRST_COL_WIDTH + CELL_WIDTH * COL_COUNT; qreal scaleWidth = width()/wantedWidth; qreal scaleHeight = height()/ wantedHeight; qreal minScale = qMin(scaleWidth, scaleHeight); painter.setRenderHint(QPainter::Antialiasing, true); painter.translate((width()-minScale*wantedWidth) /2,0); painter.scale(minScale,minScale); painter.fillRect(QRectF(0,0, wantedWidth, wantedHeight), QBrush(QColor("#FFF"))); painter.setPen(textColor); painter.setFont(QFont("Segoe UI", 8)); for(int row=1; row<ROW_COUNT+1; row++) { QRect textRect(0, row*CELL_HEIGHT, FIRST_COL_WIDTH, CELL_HEIGHT); QString rowLabel = QString("%1 - %2") .arg(1+(row-1)*32) .arg((row)*32); painter.drawText(textRect, rowLabel, QTextOption(Qt::AlignHCenter | Qt::AlignVCenter)); } for(int col=0; col<COL_COUNT; col++) { QRect textRect(FIRST_COL_WIDTH + col*CELL_WIDTH, 0, CELL_WIDTH, CELL_HEIGHT); QString rowLabel = QString("%1") .arg(col+1); painter.drawText(textRect, rowLabel, QTextOption(Qt::AlignHCenter | Qt::AlignVCenter)); } for(int row=0; row<ROW_COUNT; row++) for(int col=0; col<COL_COUNT; col++) { int address = row*COL_COUNT + col; QRect textRect(FIRST_COL_WIDTH + col*CELL_WIDTH, (row+1)*CELL_HEIGHT, CELL_WIDTH, CELL_HEIGHT); QString value = m_values[address]; if(!value.isEmpty()) { QColor fillColor = m_colors[address]; QString rowLabel = value; painter.fillRect(textRect, fillColor); painter.drawText(textRect, rowLabel, QTextOption(Qt::AlignHCenter | Qt::AlignVCenter)); } } painter.setPen(gridLineColor); for(int row=0; row<ROW_COUNT + 1; row++) { QPoint start(0, row*CELL_HEIGHT); QPoint end(wantedWidth, row*CELL_HEIGHT); painter.drawLine(start, end); } for(int col=0; col<COL_COUNT + 1; col++) { QPoint start(FIRST_COL_WIDTH + col*CELL_WIDTH, 0); QPoint end(FIRST_COL_WIDTH + col*CELL_WIDTH, wantedHeight); painter.drawLine(start, end); } // Draw the highlight for the selected one if(m_selectedAddress>-1) { int col = m_selectedAddress % 32; int row = m_selectedAddress / 32; QRect textRect(FIRST_COL_WIDTH + col*CELL_WIDTH, (row+1)*CELL_HEIGHT, CELL_WIDTH, CELL_HEIGHT); painter.setPen(QColor(Qt::black)); painter.drawRect(textRect); }}
开发者ID:docsteer,项目名称:sacnview,代码行数:78,
示例8: mainint main(int argc, char* argv[]){ int rank, p; MPI_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Comm_size(MPI_COMM_WORLD, &p); if (argc != 6) { printf("ERROR: Incorrect number of args/n"); printf("A = Constant/n"); printf("B = Constant/n"); printf("P = Prime Constant/n"); printf("seed = seed for generation (x)/n"); printf("itt = number of itterations/n"); return -1; } struct context* ctx = malloc(sizeof(struct context)); struct timer tParallel; struct timer tSerial; ctx->rank = rank; ctx->numprocs = p; ctx->A = atoi(argv[1]); ctx->B = atoi(argv[2]); ctx->P = atoi(argv[3]); ctx->seed = atoi(argv[4]); ctx->itt = atoi(argv[5]); ctx->size = ctx->itt/ctx->numprocs; //printf("ctx->size: %" PRIu64 "/n", ctx->size); if(rank == 0) { printf("Number procs: %d/n", ctx->numprocs); } int n = (int)log2(ctx->numprocs); if (1 << n != ctx->numprocs) { printf("number of procs must be power of 2/n"); exit(1); } uint64_t* parallelresults = malloc(sizeof(uint64_t*)* ctx->itt); uint64_t* serialresults = malloc(sizeof(uint64_t*)* ctx->itt); if (rank == 0) { start(&tSerial); serialresults = SerialGen(ctx); stop(&tSerial); } start(&tParallel); parallelresults = ParallelGen(ctx); stop(&tParallel); if (rank == 0) { int pass = memcmp(parallelresults, serialresults, sizeof(parallelresults)); printf("PASS: %d/n", pass); printf("Parallel Time: %dms/n", get_ms(&tParallel)); printf("Serial Time: %dms/n",get_ms(&tSerial)); } MPI_Finalize(); return 0;}
开发者ID:ForrestWeston,项目名称:cs483-pa4,代码行数:67,
示例9: switchintBMI055_gyro::ioctl(struct file *filp, int cmd, unsigned long arg){ switch (cmd) { case SENSORIOCSPOLLRATE: { switch (arg) { /* switching to manual polling */ case SENSOR_POLLRATE_MANUAL: stop(); _call_interval = 0; return OK; /* external signalling not supported */ case SENSOR_POLLRATE_EXTERNAL: /* zero would be bad */ case 0: return -EINVAL; /* set default/max polling rate */ case SENSOR_POLLRATE_MAX: return ioctl(filp, SENSORIOCSPOLLRATE, BMI055_GYRO_MAX_RATE); case SENSOR_POLLRATE_DEFAULT: return ioctl(filp, SENSORIOCSPOLLRATE, BMI055_GYRO_DEFAULT_RATE); /* adjust to a legal polling interval in Hz */ default: { /* do we need to start internal polling? */ bool want_start = (_call_interval == 0); /* convert hz to hrt interval via microseconds */ unsigned ticks = 1000000 / arg; /* check against maximum rate */ if (ticks < 1000) { return -EINVAL; } float cutoff_freq_hz_gyro = _gyro_filter_x.get_cutoff_freq(); float sample_rate = 1.0e6f / ticks; _gyro_filter_x.set_cutoff_frequency(sample_rate, cutoff_freq_hz_gyro); _gyro_filter_y.set_cutoff_frequency(sample_rate, cutoff_freq_hz_gyro); _gyro_filter_z.set_cutoff_frequency(sample_rate, cutoff_freq_hz_gyro); /* update interval for next measurement */ _call_interval = ticks; /* set call interval faster than the sample time. We then detect when we have duplicate samples and reject them. This prevents aliasing due to a beat between the stm32 clock and the bmi055 clock */ _call.period = _call_interval - BMI055_TIMER_REDUCTION; /* if we need to start the poll state machine, do it */ if (want_start) { start(); } return OK; } } } case SENSORIOCGPOLLRATE: if (_call_interval == 0) { return SENSOR_POLLRATE_MANUAL; } return 1000000 / _call_interval; case SENSORIOCRESET: return reset(); case SENSORIOCSQUEUEDEPTH: { /* lower bound is mandatory, upper bound is a sanity check */ if ((arg < 1) || (arg > 100)) { return -EINVAL; } irqstate_t flags = px4_enter_critical_section(); if (!_gyro_reports->resize(arg)) { px4_leave_critical_section(flags); return -ENOMEM; } px4_leave_critical_section(flags); return OK; } case GYROIOCGSAMPLERATE: return _gyro_sample_rate; case GYROIOCSSAMPLERATE://.........这里部分代码省略.........
开发者ID:alsaibie,项目名称:Firmware_Dolphin,代码行数:101,
示例10: mainint main(int argc, char *argv[]){ if(argc != 2){ printf("[Error] You should specify path to the configuration file./n"); printf(" ./triplematches /path/to/the/configuration/file/n"); exit(EXIT_FAILURE); } mh_history_params *p = load_params(argv[1]); // Loading Cross Runs Matching Halos clock_t _l_m_h_ = start("Loading cross runs matching halos"); avltree *matches_512_256 = load_mh(p->matches_512_256); avltree *matches_1024_512 = load_mh(p->matches_1024_512); done(_l_m_h_); // Loading Internal Matching halos clock_t _l_i_m_ = start("Loading internal matches"); avltree **matches_256 = allocate(p->num_match_files, sizeof(avltree*)); avltree **matches_512 = allocate(p->num_match_files, sizeof(avltree*)); avltree **matches_1024 = allocate(p->num_match_files, sizeof(avltree*)); int i; for(i = 0; i < p->num_match_files; i++){ matches_256[i] = load_mh(p->matches_256[i]); matches_512[i] = load_mh(p->matches_512[i]); matches_1024[i] = load_mh(p->matches_1024[i]); } done(_l_i_m_); // Loading halo files clock_t _l_h_ = start("Loading halo files/n"); halofinder **rockstar[3]; for(i = 0; i < 3; i++) rockstar[i] = allocate(p->num_halo_files, sizeof(*rockstar[i])); int progress = -1; for(i = 0; i < p->num_halo_files; i ++){ rockstar[0][i] = load_rockstar_bin(p->halos_256[i]); rockstar[1][i] = load_rockstar_bin(p->halos_512[i]); rockstar[2][i] = load_rockstar_bin(p->halos_1024[i]); progress = simple_loading(progress, i, p->num_halo_files - 1); } done(_l_h_); // Generating triple cascade clock_t _g_t_c_ = start("Generating triple cascade of matching halos"); vector **cascades = triplecascade(matches_512_256, matches_1024_512, rockstar[0][p->num_halo_files - 1]->header->num_halos, matches_256, matches_512, matches_1024, p->num_match_files); done(_g_t_c_); // Add modules here to study the evolution of the halo properties along the // history of the simulations clock_t _a_h_ = start("Generating accretion history"); accretion_history(rockstar, cascades, p); done(_a_h_); // Cleaning up... clock_t _c_u_ = start("Cleaning Up..."); dispose_triplecascade(&cascades); for(i = 0; i < p->num_halo_files; i++){ dispose_halofinder(&rockstar[0][i]); dispose_halofinder(&rockstar[1][i]); dispose_halofinder(&rockstar[2][i]); } free(rockstar[0]); free(rockstar[1]); free(rockstar[2]); for(i = 0; i < p->num_match_files; i++){ dispose_avltree(&matches_256[i]); dispose_avltree(&matches_512[i]); dispose_avltree(&matches_1024[i]); } free(matches_256); free(matches_512); free(matches_1024); dispose_avltree(&matches_512_256); dispose_avltree(&matches_1024_512); dispose_params(&p); done(_c_u_); return 0;}
开发者ID:saeedSarpas,项目名称:mytools,代码行数:96,
示例11: ompi_coll_base_alltoall_intra_basic_linearint ompi_coll_base_alltoall_intra_basic_linear(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, void* rbuf, int rcount, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, mca_coll_base_module_t *module){ int i, rank, size, err, nreqs, line; char *psnd, *prcv; MPI_Aint lb, sndinc, rcvinc; ompi_request_t **req, **sreq, **rreq; mca_coll_base_module_t *base_module = (mca_coll_base_module_t*) module; mca_coll_base_comm_t *data = base_module->base_data; if (MPI_IN_PLACE == sbuf) { return mca_coll_base_alltoall_intra_basic_inplace (rbuf, rcount, rdtype, comm, module); } /* Initialize. */ size = ompi_comm_size(comm); rank = ompi_comm_rank(comm); OPAL_OUTPUT((ompi_coll_base_framework.framework_output, "ompi_coll_base_alltoall_intra_basic_linear rank %d", rank)); err = ompi_datatype_get_extent(sdtype, &lb, &sndinc); if (OMPI_SUCCESS != err) { return err; } sndinc *= scount; err = ompi_datatype_get_extent(rdtype, &lb, &rcvinc); if (OMPI_SUCCESS != err) { return err; } rcvinc *= rcount; /* simple optimization */ psnd = ((char *) sbuf) + (ptrdiff_t)rank * sndinc; prcv = ((char *) rbuf) + (ptrdiff_t)rank * rcvinc; err = ompi_datatype_sndrcv(psnd, scount, sdtype, prcv, rcount, rdtype); if (MPI_SUCCESS != err) { return err; } /* If only one process, we're done. */ if (1 == size) { return MPI_SUCCESS; } /* Initiate all send/recv to/from others. */ req = rreq = coll_base_comm_get_reqs(data, (size - 1) * 2); prcv = (char *) rbuf; psnd = (char *) sbuf; /* Post all receives first -- a simple optimization */ for (nreqs = 0, i = (rank + 1) % size; i != rank; i = (i + 1) % size, ++rreq, ++nreqs) { err = MCA_PML_CALL(irecv_init (prcv + (ptrdiff_t)i * rcvinc, rcount, rdtype, i, MCA_COLL_BASE_TAG_ALLTOALL, comm, rreq)); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } } /* Now post all sends in reverse order - We would like to minimize the search time through message queue when messages actually arrive in the order in which they were posted. */ sreq = rreq; for (i = (rank + size - 1) % size; i != rank; i = (i + size - 1) % size, ++sreq, ++nreqs) { err = MCA_PML_CALL(isend_init (psnd + (ptrdiff_t)i * sndinc, scount, sdtype, i, MCA_COLL_BASE_TAG_ALLTOALL, MCA_PML_BASE_SEND_STANDARD, comm, sreq)); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } } /* Start your engines. This will never return an error. */ MCA_PML_CALL(start(nreqs, req)); /* Wait for them all. If there's an error, note that we don't * care what the error was -- just that there *was* an error. The * PML will finish all requests, even if one or more of them fail. * i.e., by the end of this call, all the requests are free-able. * So free them anyway -- even if there was an error, and return * the error after we free everything. */ err = ompi_request_wait_all(nreqs, req, MPI_STATUSES_IGNORE); err_hndl://.........这里部分代码省略.........
开发者ID:jsharpe,项目名称:ompi,代码行数:101,
示例12: startvoid AutoMateUi::applySelected() { emit start();}
开发者ID:Jellofishi,项目名称:Desktop,代码行数:3,
示例13: switchintLIS3MDL::ioctl(struct file *file_pointer, int cmd, unsigned long arg){ unsigned dummy = 0; switch (cmd) { case SENSORIOCSPOLLRATE: { switch (arg) { /* zero would be bad */ case 0: return -EINVAL; case SENSOR_POLLRATE_DEFAULT: { /* do we need to start internal polling? */ bool not_started = (_measure_ticks == 0); /* set interval for next measurement to minimum legal value */ _measure_ticks = USEC2TICK(LIS3MDL_CONVERSION_INTERVAL); /* if we need to start the poll state machine, do it */ if (not_started) { start(); } return PX4_OK; } /* Uses arg (hz) for a custom poll rate */ default: { /* do we need to start internal polling? */ bool not_started = (_measure_ticks == 0); /* convert hz to tick interval via microseconds */ unsigned ticks = USEC2TICK(1000000 / arg); /* update interval for next measurement */ _measure_ticks = ticks; /* if we need to start the poll state machine, do it */ if (not_started) { start(); } return PX4_OK; } } } case SENSORIOCRESET: return reset(); case MAGIOCSRANGE: return set_range(arg); case MAGIOCSSCALE: /* set new scale factors */ memcpy(&_scale, (struct mag_calibration_s *)arg, sizeof(_scale)); return 0; case MAGIOCGSCALE: /* copy out scale factors */ memcpy((struct mag_calibration_s *)arg, &_scale, sizeof(_scale)); return 0; case MAGIOCCALIBRATE: return calibrate(file_pointer, arg); case MAGIOCEXSTRAP: return set_excitement(arg); case MAGIOCGEXTERNAL: DEVICE_DEBUG("MAGIOCGEXTERNAL in main driver"); return _interface->ioctl(cmd, dummy); case DEVIOCGDEVICEID: return _interface->ioctl(cmd, dummy); default: /* give it to the superclass */ return CDev::ioctl(file_pointer, cmd, arg); }}
开发者ID:LiYuanxing,项目名称:Firmware,代码行数:83,
示例14: QMainWindow/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * MainWindow Class Constructor * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Main window layout including creation / allocation of data viewers * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ reorderBufferViewer = new ReorderBufferViewer; reservationStationViewer = new ReservationStationsViewer; registerFileViewer = new RegisterFileViewer; memoryViewer = new MemoryViewer; setCentralWidget(reorderBufferViewer); // ROB Viewer is the central table QDockWidget *rsvWidget = new QDockWidget; rsvWidget->setWidget(reservationStationViewer); // Reservation stations viewer is a docking table rsvWidget->setWindowTitle(QString("Reservation Stations")); QDockWidget *rfvWidget = new QDockWidget; rfvWidget->setWidget(registerFileViewer); // Register array viewer is a docking table rfvWidget->setWindowTitle(QString("Register File")); rfvWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Maximum); QDockWidget *mvWidget = new QDockWidget; mvWidget->setWidget(memoryViewer); // Memory viewer is a docking table mvWidget->setWindowTitle(QString("Memory")); addDockWidget(Qt::BottomDockWidgetArea, rsvWidget); // Reservation stations monitor is at the bottom addDockWidget(Qt::LeftDockWidgetArea, rfvWidget); // Register array monitor is at the left addDockWidget(Qt::RightDockWidgetArea, mvWidget); // Memory monitor is at the right /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Main menu description * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ openAction = new QAction(tr("&Open"), this); // Option not implemented yet: intended to open assembler code // text and run parser startAction = new QAction(tr("&Start"), this); // Start processing: it basically enables the timer stopAction = new QAction(tr("&Stop"), this); // Stop processing: disables the timer fileMenu = menuBar()->addMenu(tr("&File")); // File menu only contains the Open command so far fileMenu->addAction(openAction); processingMenu = menuBar()->addMenu(tr("&Processing")); // Processing menu contains Start and Stop commands processingMenu->addAction(startAction); processingMenu->addAction(stopAction); mainTimer = new QTimer; // Timer instantiation for 1-Hz operation mainTimer->setInterval(1000); mainTimer->setSingleShot(false); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Signal-slot bindings * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ connect(openAction, SIGNAL(triggered()), this, SLOT(openFile())); // Open commands shows Open File dialog connect(startAction, SIGNAL(triggered()), mainTimer, SLOT(start())); // Start command triggers timer operation connect(stopAction, SIGNAL(triggered()), mainTimer, SLOT(stop())); // Stop command stops timer connect(mainTimer, SIGNAL(timeout()), this, SLOT(cycleProcess())); // Timer periodically triggers cycleProcess method /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Database initialization example * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ memoryData = (MemoryData *)malloc(10000); // Memory data structure registerFileData = (RegisterFileData *)malloc(10000); // Register array data structure reorderBufferData = (ReorderBufferData *)malloc(10000); // ROB data structure reservationStationsData = (ReservationStationsData *)malloc(10000); // Reservation stations data structure srand(time(NULL)); // Random generator initializer for databse management example below}
开发者ID:danielmux,项目名称:sgdr_tsim,代码行数:72,
示例15: SyncImageTransportHandler/*** Constructor.* @see SyncImageHandler*/SyncImageRig::SyncImageRig() : SyncImageTransportHandler() // don't forget to call base constructor first{ if (!start()) _nh.shutdown();}
开发者ID:artivis,项目名称:ros_camera_rig,代码行数:10,
示例16: elapsedint64_t Timer::restart(){ int64_t milli = elapsed(); start(); return milli;}
开发者ID:SaintDubious,项目名称:DubiousEngine,代码行数:6,
示例17: whilevoid MobileSimulator::MouseUpEvent(Vec2i screenCoordinates, MouseButtonInput button){ _multiGestureOngoing = false; _gestureType = NONE; _mouseDown = false; TouchList* tl = &TouchListener::GetTouchList(); if (theInput.IsKeyDown(ANGEL_KEY_LEFTCONTROL) || theInput.IsKeyDown(ANGEL_KEY_RIGHTCONTROL)) { TouchList::iterator it = tl->begin(); while (it != tl->end()) { SendTouchNotifiers((*it), TOUCH_END); delete (*it); it = tl->erase(it); } } else { // just a single touch, but we'll iterate anyway TouchList::iterator it = tl->begin(); while (it != tl->end()) { if ( (theWorld.GetCurrentTimeSeconds() - (*it)->MotionStartTime) < SWIPE_MAX_DURATION) { Vector2 start((*it)->StartingPoint); Vector2 end((*it)->CurrentPoint); Vector2 motion = end - start; if (motion.LengthSquared() >= (SWIPE_MIN_DISTANCE * SWIPE_MIN_DISTANCE)) { float angle = MathUtil::ToDegrees(acos(Vector2::Dot(Vector2::UnitX, Vector2::Normalize(motion)))); if (motion.Y > 0.0f) { angle = 360.0f - angle; } if ( (angle > 45.0f) && (angle <= 135.0f) ) { // swipe up theSwitchboard.Broadcast(new Message("MultiTouchSwipeUp")); } else if ( (angle > 135.0f) && (angle <= 225.0f) ) { // swipe left theSwitchboard.Broadcast(new Message("MultiTouchSwipeLeft")); } else if ( (angle > 225.0f) && (angle <= 315.0f) ) { // swipe down theSwitchboard.Broadcast(new Message("MultiTouchSwipeDown")); } else { // swipe right theSwitchboard.Broadcast(new Message("MultiTouchSwipeRight")); } } } SendTouchNotifiers((*it), TOUCH_END); delete (*it); it = tl->erase(it); } }}
开发者ID:MrSnowman,项目名称:angel2d,代码行数:65,
示例18: switchintSF0X::ioctl(struct file *filp, int cmd, unsigned long arg){ switch (cmd) { case SENSORIOCSPOLLRATE: { switch (arg) { /* switching to manual polling */ case SENSOR_POLLRATE_MANUAL: stop(); _measure_ticks = 0; return OK; /* external signalling (DRDY) not supported */ case SENSOR_POLLRATE_EXTERNAL: /* zero would be bad */ case 0: return -EINVAL; /* set default/max polling rate */ case SENSOR_POLLRATE_MAX: case SENSOR_POLLRATE_DEFAULT: { /* do we need to start internal polling? */ bool want_start = (_measure_ticks == 0); /* set interval for next measurement to minimum legal value */ _measure_ticks = USEC2TICK(SF0X_CONVERSION_INTERVAL); /* if we need to start the poll state machine, do it */ if (want_start) { start(); } return OK; } /* adjust to a legal polling interval in Hz */ default: { /* do we need to start internal polling? */ bool want_start = (_measure_ticks == 0); /* convert hz to tick interval via microseconds */ unsigned ticks = USEC2TICK(1000000 / arg); /* check against maximum rate */ if (ticks < USEC2TICK(SF0X_CONVERSION_INTERVAL)) { return -EINVAL; } /* update interval for next measurement */ _measure_ticks = ticks; /* if we need to start the poll state machine, do it */ if (want_start) { start(); } return OK; } } } case SENSORIOCGPOLLRATE: if (_measure_ticks == 0) { return SENSOR_POLLRATE_MANUAL; } return (1000 / _measure_ticks); case SENSORIOCSQUEUEDEPTH: { /* lower bound is mandatory, upper bound is a sanity check */ if ((arg < 1) || (arg > 100)) { return -EINVAL; } irqstate_t flags = irqsave(); if (!_reports->resize(arg)) { irqrestore(flags); return -ENOMEM; } irqrestore(flags); return OK; } case SENSORIOCGQUEUEDEPTH: return _reports->size(); case SENSORIOCRESET: /* XXX implement this */ return -EINVAL; case RANGEFINDERIOCSETMINIUMDISTANCE: { set_minimum_distance(*(float *)arg); return 0;//.........这里部分代码省略.........
开发者ID:JW-CHOI,项目名称:Firmware,代码行数:101,
示例19: print//.........这里部分代码省略......... } else { auto func = newMarker.func(); if (!curMarker.hasFunc() || func != curMarker.func()) { func->prettyPrint(mStr, Func::PrintOpts().noFpi()); } mStr << std::string(kIndent, ' ') << newMarker.show() << '/n'; auto bcOffset = newMarker.bcOff(); func->unit()->prettyPrint( mStr, Unit::PrintOpts() .range(bcOffset, bcOffset+1) .noLineNumbers() .noFuncs() .indent(0)); std::vector<std::string> vec; folly::split('/n', mStr.str(), vec); os << markerEndl; markerEndl = "/n"; for (auto& s : vec) { if (s.empty()) continue; os << color(ANSI_COLOR_BLUE) << s << color(ANSI_COLOR_END) << '/n'; } } curMarker = newMarker; } if (inst.op() == DefLabel) { // print phi pseudo-instructions for (unsigned i = 0, n = inst.numDsts(); i < n; ++i) { os << std::string(kIndent + folly::format("({}) ", inst.id()).str().size(), ' '); auto dst = inst.dst(i); JIT::print(os, dst, dstLoc(regs, &inst, i)); os << punc(" = ") << color(ANSI_COLOR_CYAN) << "phi " << color(ANSI_COLOR_END); bool first = true; inst.block()->forEachSrc(i, [&](IRInstruction* jmp, SSATmp*) { if (!first) os << punc(", "); first = false; printSrc(os, jmp, i, regs); os << punc("@"); printLabel(os, jmp->block()); }); os << '/n'; } } os << std::string(kIndent, ' '); JIT::print(os, &inst, regs, guards); os << '/n'; if (asmInfo) { TcaRange instRange = asmInfo->instRanges[inst]; if (!instRange.empty()) { disasmRange(os, instRange.begin(), instRange.end()); os << '/n'; assert(instRange.end() >= blockRange.start() && instRange.end() <= blockRange.end()); blockRange = TcaRange(instRange.end(), blockRange.end()); } } } if (asmInfo) { // print code associated with this block that isn't tied to any // instruction. This includes code after the last isntruction (e.g. // jmp to next block), and ACold or AFrozen code. if (!blockRange.empty()) { os << std::string(kIndent, ' ') << punc("A:") << "/n"; disasmRange(os, blockRange.start(), blockRange.end()); } auto acoldRange = asmInfo->acoldRanges[block]; if (!acoldRange.empty()) { os << std::string(kIndent, ' ') << punc("ACold:") << "/n"; disasmRange(os, acoldRange.start(), acoldRange.end()); } auto afrozenRange = asmInfo->afrozenRanges[block]; if (!afrozenRange.empty()) { os << std::string(kIndent, ' ') << punc("AFrozen:") << "/n"; disasmRange(os, afrozenRange.start(), afrozenRange.end()); } if (!blockRange.empty() || !acoldRange.empty() || !afrozenRange.empty()) { os << '/n'; } } os << std::string(kIndent - 2, ' '); auto next = block->empty() ? nullptr : block->next(); if (next) { os << punc("-> "); printLabel(os, next); os << '/n'; } else { os << "no fallthrough/n"; }}
开发者ID:andrewDDC,项目名称:hhvm,代码行数:101,
示例20: start/** * init * * Initialize repeater * * 'maxHop': maximum hop count */void REPEATER::init(byte maxHop){ maxHopCount = maxHop; start();}
开发者ID:Pepe74,项目名称:panstamp,代码行数:12,
示例21: destroyvoid PlayActionEffectComboInstance::restart(){ destroy(false); start();}
开发者ID:korman,项目名称:Temp,代码行数:5,
示例22: start ~TaskThread() { mStopping = true; start(); }
开发者ID:CreativeInquiry,项目名称:RTcmix,代码行数:1,
示例23: mainint main(int argc, char** argv){ astra::initialize(); set_key_handler();#ifdef _WIN32 auto fullscreenStyle = sf::Style::None;#else auto fullscreenStyle = sf::Style::Fullscreen;#endif const sf::VideoMode fullScreenMode = sf::VideoMode::getFullscreenModes()[0]; const sf::VideoMode windowedMode(1800, 1350); bool isFullScreen = false; sf::RenderWindow window(windowedMode, "Multi Sensor Viewer"); astra::StreamSet streamSet1("device/sensor0"); astra::StreamSet streamSet2("device/sensor1"); astra::StreamReader reader1 = streamSet1.create_reader(); astra::StreamReader reader2 = streamSet2.create_reader(); reader1.stream<astra::PointStream>().start(); reader2.stream<astra::PointStream>().start(); auto depthStream1 = configure_depth(reader1); depthStream1.start(); auto colorStream1 = configure_color(reader1); colorStream1.start(); auto irStream1 = configure_ir(reader1, false); auto depthStream2 = configure_depth(reader2); depthStream2.start(); auto colorStream2 = configure_color(reader2); colorStream2.start(); auto irStream2 = configure_ir(reader2, false); MultiFrameListener listener1; listener1.set_mode(MODE_COLOR); MultiFrameListener listener2; listener2.set_mode(MODE_COLOR); reader1.add_listener(listener1); reader2.add_listener(listener2); while (window.isOpen()) { astra_temp_update(); sf::Event event; while (window.pollEvent(event)) { switch (event.type) { case sf::Event::Closed: window.close(); break; case sf::Event::KeyPressed: { switch (event.key.code) { case sf::Keyboard::Escape: window.close(); break; case sf::Keyboard::F: if (isFullScreen) { isFullScreen = false; window.create(windowedMode, "Multi Sensor Viewer", sf::Style::Default); } else { isFullScreen = true; window.create(fullScreenMode, "Multi Sensor Viewer", fullscreenStyle); } break; case sf::Keyboard::R: depthStream1.enable_registration(!depthStream1.registration_enabled()); depthStream2.enable_registration(!depthStream2.registration_enabled()); break; case sf::Keyboard::M: { const bool newMirroring1 = !depthStream1.mirroring_enabled(); depthStream1.enable_mirroring(newMirroring1); colorStream1.enable_mirroring(newMirroring1); irStream1.enable_mirroring(newMirroring1); const bool newMirroring2 = !depthStream2.mirroring_enabled(); depthStream2.enable_mirroring(newMirroring2); colorStream2.enable_mirroring(newMirroring2); irStream2.enable_mirroring(newMirroring2); } break; case sf::Keyboard::G://.........这里部分代码省略.........
开发者ID:gaocan1992,项目名称:astra,代码行数:101,
示例24: play void play(const QString& file) { filename = file; start(); }
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:5,
示例25: setAddressvoid Horus::Commons::Network::StreamServer::start(const QString &address){ if (m_running) return; setAddress(address); start();}
开发者ID:IL2HorusTeam,项目名称:desktop-commons-network,代码行数:6,
示例26: mainint main(int argc, char *argv[]){ start(); return EXIT_SUCCESS;}
开发者ID:pombredanne,项目名称:anacrolix,代码行数:5,
示例27: setPortvoid Horus::Commons::Network::StreamServer::start(const QString &address, const QString &port){ if (m_running) return; setPort(port); start(address);}
开发者ID:IL2HorusTeam,项目名称:desktop-commons-network,代码行数:6,
示例28: closePortint SerialPort::openPort( const QString& port, int baudrate, SerialDataBits dataBits, SerialStopBits stopBits, SerialParity parity){ if (mIsOpen) { closePort(); } mFd = open(port.toLocal8Bit().data(), O_RDWR | O_NOCTTY | O_NDELAY); if (mFd == -1) { qCritical() << "Opening serial port failed."; return -1; } mIsOpen = true; // No-blocking reads fcntl(mFd, F_SETFL, FNDELAY); struct termios options; if (0 != tcgetattr(mFd, &options)) { qCritical() << "Reading serial port options failed."; return -2; } // Enable the receiver and set local mode... options.c_cflag |= CLOCAL | CREAD; // Raw input options.c_lflag &= ~(ICANON|ECHO|ECHOE|ECHOK|ECHONL|ISIG); // Disable flow control options.c_cflag &= ~CRTSCTS; options.c_iflag &= ~(IXON|IXOFF|IXANY); // ??? /*set up other port settings*/ options.c_cflag |= CREAD|CLOCAL; options.c_lflag &= (~(ICANON|ECHO|ECHOE|ECHOK|ECHONL|ISIG)); options.c_iflag &= (~(INPCK|IGNPAR|PARMRK|ISTRIP|ICRNL|IXANY)); options.c_oflag &= (~OPOST); options.c_cc[VMIN] = 0;#ifdef _POSIX_VDISABLE // Is a disable character available on this system? // Some systems allow for per-device disable-characters, so get the // proper value for the configured device const long vdisable = ::fpathconf(mFd, _PC_VDISABLE); options.c_cc[VINTR] = vdisable; options.c_cc[VQUIT] = vdisable; options.c_cc[VSTART] = vdisable; options.c_cc[VSTOP] = vdisable; options.c_cc[VSUSP] = vdisable;#endif //_POSIX_VDISABLE //Set the new options for the port... if (0 != tcsetattr(mFd, TCSANOW, &options)) { qCritical() << "Writing serial port options failed."; closePort(); return -3; } if (false == setDataBits(dataBits)) { qCritical() << "Setting data bits failed."; closePort(); return -4; } if (false == setStopBits(stopBits)) { qCritical() << "Setting stopbits failed."; closePort(); return -5; } if (false == setParity(parity)) { qCritical() << "Setting parity faield."; closePort(); return -6; } if (false == setBaudrate(baudrate)) { qCritical() << "Setting baudrate failed."; closePort(); return -7; } mAbort = false; start(LowPriority); return 0;}
开发者ID:1ee7,项目名称:bldc-logger,代码行数:91,
示例29: resetvoid StopWatch::restart(){ reset(); start();}
开发者ID:Psykoangel,项目名称:cpp_projects_repo,代码行数:5,
注:本文中的start函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ startAnimation函数代码示例 C++ star函数代码示例 |