void Worker:: loop_while_tasks() { while (!QThread::currentThread ()->isInterruptionRequested ()) { Task task; { DEBUGINFO TaskTimer tt(boost::format("worker: get task %s %s") % vartype(*schedule_.get ()) % (computing_engine_?vartype(*computing_engine_):"(null)") ); task = schedule_->getTask(computing_engine_); } if (task) { DEBUGINFO TaskTimer tt(boost::format("worker: running task %s") % task.expected_output()); task.run(); emit oneTaskDone(); } else { DEBUGINFO TaskInfo("worker: back to sleep"); // Wait for a new wakeup call break; } } }
void QtEventWorker:: loop_while_tasks() { // the only events sent to this thread are wakeup() or termination events, // in order to not pile up a never ending queue make sure to process events as they come while (!QCoreApplication::hasPendingEvents ()) { Timer work_timer; Signal::Processing::Task task; { DEBUGINFO TaskTimer tt(boost::format("worker: get task %s %s") % vartype(*schedule_.get ()) % (computing_engine_?vartype(*computing_engine_):"(null)") ); task = schedule_->getTask(computing_engine_); } if (task) { DEBUGINFO TaskTimer tt(boost::format("worker: running task %s") % task.expected_output()); task.run(); active_time_since_start_ += work_timer.elapsed (); ltf_tasks_.tick (); emit oneTaskDone(); } else { DEBUGINFO Log("worker: back to sleep"); // Wait for a new wakeup call break; } // run loop at least once to simplify testing when aborting a worker right away if (QThread::currentThread ()->isInterruptionRequested ()) break; } }
Foam::tmp<Foam::DecoupledCoeffField<Type> > Foam::DecoupledCoeffField<Type>::transpose() const { tmp<DecoupledCoeffField<Type> > tt ( new DecoupledCoeffField<Type>(this->size()) ); DecoupledCoeffField<Type>& t = tt(); if (scalarCoeffPtr_) { t.toScalar() = *scalarCoeffPtr_; } else if (linearCoeffPtr_) { t.toLinear() = *linearCoeffPtr_; } else { // Not allocated - do nothing } return tt; }
void FftClFft:: compute( Tfr::ChunkData::Ptr input, Tfr::ChunkData::Ptr output, FftDirection direction ) { TIME_STFT TaskTimer tt("Fft ClFft"); unsigned n = input->getNumberOfElements().width; unsigned N = output->getNumberOfElements().width; if (-1 != direction) EXCEPTION_ASSERT( n == N ); { TIME_STFT TaskTimer tt("Computing fft(N=%u, n=%u, direction=%d)", N, n, direction); OpenCLContext *opencl = &OpenCLContext::Singleton(); cl_int fft_error; clFFT_Plan plan = CLFFTKernelBuffer::Singleton().getPlan(opencl->getContext(), n, fft_error); if (fft_error != CL_SUCCESS) throw std::runtime_error("Could not create clFFT compute plan."); // Run the fft in OpenCL :) // fft kernel needs to have read/write access to output data fft_error |= clFFT_ExecuteInterleaved( opencl->getCommandQueue(), plan, 1, (clFFT_Direction)direction, OpenClMemoryStorage::ReadOnly<1>( input ).ptr(), OpenClMemoryStorage::ReadWrite<1>( output ).ptr(), 0, NULL, NULL ); if (fft_error != CL_SUCCESS) throw std::runtime_error("Bad stuff happened during FFT computation."); } }
void FftClFft:: compute( Tfr::ChunkData::Ptr input, Tfr::ChunkData::Ptr output, DataStorageSize n, FftDirection direction ) { TaskTimer tt("Stft::computeWithClFft( matrix[%d, %d], %s )", input->size().width, input->size().height, direction==FftDirection_Forward?"forward":"backward"); EXCEPTION_ASSERT( output->numberOfBytes() == input->numberOfBytes() ); const int batchSize = n.height; OpenCLContext *opencl = &OpenCLContext::Singleton(); cl_int fft_error; clFFT_Plan plan = CLFFTKernelBuffer::Singleton().getPlan(opencl->getContext(), n.width, fft_error); if(fft_error != CL_SUCCESS) throw std::runtime_error("Could not create clFFT compute plan."); { TaskTimer tt("Calculating batches"); // Run the fft in OpenCL :) fft_error |= clFFT_ExecuteInterleaved( opencl->getCommandQueue(), plan, batchSize, direction==FftDirection_Forward?clFFT_Forward:clFFT_Inverse, OpenClMemoryStorage::ReadOnly<1>( input ).ptr(), OpenClMemoryStorage::ReadWrite<1>( output ).ptr(), 0, NULL, NULL ); if(fft_error != CL_SUCCESS) throw std::runtime_error("Bad stuff happened during FFT computation."); } }
Hajjar2D::Hajjar2D( int tag, YS_Evolution &model, double D, double b, double t, double fc_, double fy_) :YieldSurface_BC2D(tag, HAJJAR_CLASS_TAG, 0, 0, model),//would blow up if not.. depth(D), width(b), thick(t), fc(fc_), fy(fy_) { double fr = 0.623*sqrt(fc); double Ast = D*b - (D - 2*t)*(b - 2*t); double Ac = (D - 2*t)*(b - 2*t); double x = D/t; double y = fc/fy; c1 = 1.08 - 0.00265*x + 0.000023*x*x - 1.13*1e-7*x*x*x + 0.374*y - 1.3*y*y - 0.0419*y*y*y - 0.0691*x*y + 0.000234*x*x*y + 0.0754*x*y*y; c2 = 0.628 + 0.0259*x - 0.000367*x*x + 1.99*1e-6*x*x*x + 4.5*y - 14.9*y*y + 22.4*y*y*y + 0.164*x*y + -0.000756*x*x*y - 0.126*x*y*y; c3 = 0.42 + 0.0892*x - 0.00122*x*x + 5.13*1e-6*x*x*x + 4.9*y - 16.5*y*y + 16.2*y*y*y - 0.165*x*y + 0.000713*x*x*y + 0.12*x*y*y; capY = Ast*fy + Ac*fc; double num = fc*(b*t - 2*t*t) + 0.5*fr*(D - t)*(b - 2*t) + fy*(2*D*t); double denom = fc*(b - 2*t) + 0.5*fr*(b - 2*t) + fy*(4*t); double xn = num/denom; capX = fc*(0.5*(b - 2*t)*(xn - t)*(xn - t)) + 0.5*fr*(0.5*(b - 2*t)*(D - xn - t)*(D - xn - t)) + fy*((2*t)*(D*D/2 + xn*xn + t*t - D*t - D*xn) + (b*t)*(D - t)); centroidY = (Ac*fc - Ac*fr)/2; centroidY = centroidY/capY; //!! translateY = translateY_hist = centroidY; Vector tt(2); tt(0) = 0; tt(1) = centroidY; hModel->setInitTranslation(tt); if (coefDebug) { opserr << " c1 = " << c1 << ", c2 = " << c2 << ", c3 = " << c3 << "\n"; opserr << " centroidY = " << centroidY << "\n"; opserr << " capX = " << capX << ", capY = " << capY << "\n"; } // bad: capX_orig = capX; capY_orig = capY; capXdim = capX; capYdim = capY; }
int maxneb_disc () { Rcpp::IntegerVector targs(targets); Rcpp::IntegerVector nebs(neighbors); Rcpp::IntegerVector plot(plots); Rcpp::CharacterVector status(stat); Rcpp::IntegerVector xx(bqudx); Rcpp::IntegerVector yy(bqudy); Rcpp::IntegerVector tt(time); int rad = Rcpp::as<int>(sr); Rcpp::IntegerVector counts(targs.size()); int max_neb = 0; for (int i = 0, n = targs.size(); i < n; i++) { int targ = index(targs[i], nebs); int num_nebs= 0; for (int neb = 0, n2 = nebs.size(); neb < n2; neb++) { if (targ != neb && plot[targ] == plot[neb] && (std::strcmp("ALIVE", status[neb]) == 0) && (xx[targ] + sr > xx[neb]) && (xx[targ] - sr < xx[neb]) && (yy[targ] + sr > yy[neb]) && (yy[targ] - sr < yy[neb]) && tt[targ] == tt[neb]) num_nebs++; } counts[i] = num_nebs; } return std::max_element(counts.begin(), counts.end(), myfn); }
bool GeneralName::matches_dn(const std::string& nam) const { std::stringstream ss(nam); std::stringstream tt(name()); X509_DN nam_dn, my_dn; ss >> nam_dn; tt >> my_dn; auto attr = nam_dn.get_attributes(); bool ret = true; int trys = 0; for(const std::pair<OID,std::string>& c: my_dn.get_attributes()) { auto i = attr.equal_range(c.first); if(i.first != i.second) { trys += 1; ret &= i.first->second == c.second; } } return trys > 0 && ret; }
int main(int argc, const char * argv[]) { if (argc < 3) { std::cout<<"Usage: "<<argv[0]<<"size decay_period input"<<std::endl; return 1; } int size = atoi(argv[1]); int decay = atoi(argv[2]); std::ifstream infile(argv[3]); tt_type tt(size); specified_timesource ts(0.0); int timestamp; int conv_id; int last_dump = 0; while(infile >> timestamp >> conv_id) { if (last_dump + decay < timestamp) { last_dump = timestamp; std::cout << "Dump "<<timestamp <<std::endl; top_talkers_print<int, counter>(tt); } ts.set(timestamp); counter dc(ts, 1.0, decay); tt.update(conv_id, dc); } return 0; }
//-----------------------------------------------------------------// void add(const void* src, bool bitmap = false) noexcept { if(size_ >= MAX) return; if(bitmap) { auto sz = rdr_.get_mobj_size(src); obj_[size_].w_ = sz.x; obj_[size_].h_ = sz.y; } else { auto sz = rdr_.at_font().get_text_size(static_cast<const char*>(src), false); obj_[size_].w_ = sz.x; obj_[size_].h_ = sz.y; } obj_[size_].src_ = src; ++size_; vtx::spos tt(0); for(auto i = 0; i < size_; ++i) { auto xx = obj_[i].w_ + space_.x * 2; if(tt.x < xx) tt.x = xx; tt.y += obj_[i].h_; tt.y += gap_; tt.y += space_.y * 2; } m_ = tt; }
BOOL tr_instr_jump(LmnTranslated f, LmnReactCxt *rc, LmnMembrane *thisisrootmembutnotused, LmnRule rule, int newid_num, const int *newid) { LmnRegister *v, *tmp; unsigned int org_use, org_size; BOOL ret; int i; org_use = warry_use_size(rc); org_size = warry_size(rc); v = lmn_register_make(org_size); for (i = 0; i < newid_num; i++){ v[i].wt = wt(rc, newid[i]); v[i].at = at(rc, newid[i]); v[i].tt = tt(rc, newid[i]); } tmp = rc_warry(rc); rc_warry_set(rc, v); ret = (*f)(rc, thisisrootmembutnotused, rule); lmn_register_free(rc_warry(rc)); rc_warry_set(rc, tmp); warry_size_set(rc, org_size); warry_use_size_set(rc, org_use); return ret; }
STR timeTrans(int sec) { time_t tt(sec); struct tm* ptm = localtime(&tt); char tmp[20]; sprintf(tmp, "%04d/%02d/%02d", 1900 + ptm->tm_year, 1 + ptm->tm_mon, ptm->tm_mday); return STR(tmp); }
BOOL CDialerChannel::PlayEnterVox(LPCTSTR xPhone, int nChan) { CString strQuery; strQuery.Format( "select a.*" " from xphonenum a inner join" " xphonenum_info b on a.enterprise_bh = b.enterprise_bh" " where department_phone = '%s'", xPhone ); TRACE( strQuery + "\n" ); _RecordsetPtr xRecordset; xRecordset = xExecute(theApp.m_pConnection, (_bstr_t)strQuery, adCmdText); if ( xRecordset->adoEOF ) return FALSE; _variant_t TheValue = xRecordset->GetCollect( "xdate_finish" ); if ( VT_NULL == TheValue.vt ) return FALSE; COleDateTime tt( TheValue ); tt.SetDateTime( tt.GetYear(), tt.GetMonth(), tt.GetDay(), 23, 59, 59 ); if ( COleDateTime::GetCurrentTime() > tt ) return FALSE; TheValue = xRecordset->GetCollect( "xfalse" ); if ( VT_NULL == TheValue.vt ) return FALSE; if ( _tcscmp((LPCTSTR)(_bstr_t)TheValue, "1") )return FALSE; FieldPtr xPlyBlob = xRecordset->GetFields()->GetItem("xentervoice"); return PlayBlob( nChan, xPlyBlob, FALSE ) == TRUE; }
int uniquePathsWithObstacles(vector<vector<int> > &o) { // Start typing your C/C++ solution below // DO NOT write int main() function int r=o.size(); if(r==0) return 0; int c=o[0].size(); vector<int> tt(c+1,0); vector<vector<int> > w(r+1,tt); for(int i=1;i<=r;i++) { for(int j=1;j<=c;j++) { if(o[i-1][j-1]==1) continue; if(i==1 && j==1) { w[i][j]=1; continue; } w[i][j]=w[i-1][j]+w[i][j-1]; } } return w[r][c]; }
void Tokenizer::timeChecker(sqlite3* db, FILE* fout) { if (strstr(buffer, "get-time")) { int sec = atoi(currentTime.c_str()); time_t tt(sec); struct tm* ptm = localtime(&tt); fprintf(fout, "get-time\tsuccessful\t%04d/%02d/%02d\n", 1900 + ptm->tm_year, 1 + ptm->tm_mon, ptm->tm_mday); } if (strstr(buffer, "set-time")) { firstToken; STR strtime(nextToken); int year = atoi(strtime.substr(0, 4).c_str()); int month = atoi(strtime.substr(5, 2).c_str()); int day = atoi(strtime.substr(8, 2).c_str()); struct tm curtm; curtm.tm_year = year - 1900; curtm.tm_mon = month - 1; curtm.tm_mday = day; curtm.tm_hour = curtm.tm_min = curtm.tm_sec = 0; curtm.tm_isdst = 0; int tmp = (int)mktime(&curtm); std::stringstream ss; ss << tmp; ss >> currentTime; fprintf(fout, "set-time\tsuccessful\t%04d/%02d/%02d\n", year, month, day); }
void SaweTestClass:: project(Sawe::pProject p) { if (!project_.expired()) { Sawe::pProject oldp = project(); if (oldp) { disconnect( oldp->tools().render_view(), SIGNAL(postPaint()), this, SLOT(postPaint())); disconnect( oldp->tools().render_view(), SIGNAL(finishedWorkSection()), this, SLOT(renderViewFinishedWorkSection())); } } else { // Close any other project currently open by the application // (application_cmd_options.cpp opens a project by default, but that // might not be the project we want to run in the current test) Sawe::Application* app = Sawe::Application::global_ptr (); std::set<boost::weak_ptr<Sawe::Project>> projects = app->projects (); for (boost::weak_ptr<Sawe::Project> wp : projects) { Sawe::pProject pl = wp.lock (); if (pl && pl != p) { TaskTimer tt("Closing previous project"); app->slotClosed_window( pl->mainWindow () ); } } } project_ = p; project_is_opened_ = false; QVERIFY( p.get() ); connect( p->tools().render_view(), SIGNAL(postPaint()), this, SLOT(postPaint()), Qt::QueuedConnection); }
wxSize NumericRenderer::GetBestSize(wxGrid &grid, wxGridCellAttr & WXUNUSED(attr), wxDC & WXUNUSED(dc), int row, int col) { wxGridTableBase *table = grid.GetTable(); NumericEditor *ne = static_cast<NumericEditor *>(grid.GetCellEditor(row, col)); wxSize sz; if (ne) { double value; table->GetValue(row, col).ToDouble(&value); NumericTextCtrl tt(mType, &grid, wxID_ANY, ne->GetFormat(), value, ne->GetRate(), wxPoint(10000, 10000), // create offscreen wxDefaultSize, true); sz = tt.GetSize(); ne->DecRef(); } return sz; }
void catchException(const std::exception& ex) { QString error = QString::fromUtf8(ex.what()); QString message = "<qt><b>qtfuzzylite</b> has experienced an internal error and will exit.<br><br>" "Please report this error to <a href='mailto:[email protected]'>" "[email protected]</a><br><br>" "Your report will help to make <b>fuzzylite</b> and <b>qtfuzzylite</b> a better " "free open source fuzzy logic library!<br><br>" "Many thanks in advance for your help!" "</qt>"; QMessageBox x(NULL); x.setText(message); x.setWindowTitle("Internal Error"); x.setIcon(QMessageBox::Critical); QLabel dummy; x.layout()->addWidget(&dummy); QLabel viewLabel("Error message:"); QPlainTextEdit viewError; viewError.setReadOnly(true); viewError.setPlainText(error); viewError.setLineWrapMode(QPlainTextEdit::NoWrap); QFont tt("?"); tt.setStyleHint(QFont::TypeWriter); tt.setPointSize(tt.pointSize() - 2); viewError.setFont(tt); QWidget* view = new QWidget; view->setLayout(new QVBoxLayout); view->layout()->addWidget(&viewLabel); view->layout()->addWidget(&viewError); x.layout()->addWidget(view); x.exec(); }
template<class T> void do_test_fluid() { std::cout << "Size\ttable (c/e)\ttable (s)\tvector (c/e)\tvector (s)\tG(c/e)\tG(s)\n"; for(int N=4;N<=2048;N*=2) //std::size_t N = 6; { std::cout.precision(3); std::cout << N*2*N << "\t"; Compute<T> tt(N,2*N,-.28319, .28319); nt2::unit::benchmark_result<nt2::details::cycles_t> dv; nt2::unit::perform_benchmark( tt, 1., dv); nt2::unit::benchmark_result<double> tv; nt2::unit::perform_benchmark( tt, 1., tv); std::cout << std::scientific << dv.median/(double)(N*2*N) << "\t"; std::cout << std::scientific << tv.median << "\t"; Compute_scalar<T> vv(N,2*N,-.28319, .28319); nt2::unit::benchmark_result<nt2::details::cycles_t> dw; nt2::unit::perform_benchmark( vv, 1., dw); nt2::unit::benchmark_result<double> tw; nt2::unit::perform_benchmark( vv, 1., tw); std::cout << std::scientific << dw.median/(double)(N*N) << "\t"; std::cout << std::scientific << tw.median << "\t"; std::cout << std::fixed << (double)dw.median/dv.median << "\t"; std::cout << std::fixed << (double)tw.median/tv.median << "\n"; } }
wxSize TimeRenderer::GetBestSize(wxGrid &grid, wxGridCellAttr & WXUNUSED(attr), wxDC & WXUNUSED(dc), int row, int col) { wxGridTableBase *table = grid.GetTable(); TimeEditor *te = (TimeEditor *) grid.GetCellEditor(row, col); wxSize sz; if (te) { double value; table->GetValue(row, col).ToDouble(&value); NumericTextCtrl tt(NumericConverter::TIME, &grid, wxID_ANY, te->GetFormat(), value, te->GetRate(), wxPoint(10000, 10000), // create offscreen wxDefaultSize, true); sz = tt.GetSize(); te->DecRef(); } return sz; }
void GraphicsScene:: mouseReleaseEvent(QGraphicsSceneMouseEvent *e) { DEBUG_EVENTS TaskTimer tt("GraphicsScene mouseReleaseEvent %s %d", vartype(*e).c_str(), e->isAccepted()); QGraphicsScene::mouseReleaseEvent(e); DEBUG_EVENTS TaskTimer("GraphicsScene mouseReleaseEvent %s info %d", vartype(*e).c_str(), e->isAccepted()).suppressTiming(); }
wxSize TimeRenderer::GetBestSize(wxGrid &grid, wxGridCellAttr &attr, wxDC &dc, int row, int col) { wxGridTableBase *table = grid.GetTable(); TimeEditor *te = (TimeEditor *) grid.GetCellEditor(row, col); wxSize sz; if (te) { double value; table->GetValue(row, col).ToDouble(&value); TimeTextCtrl tt(&grid, wxID_ANY, wxT(""), value, te->GetRate(), wxPoint(10000, 10000), // create offscreen wxDefaultSize, true); tt.SetFormatString(tt.GetBuiltinFormat(te->GetFormat())); sz = tt.GetSize(); te->DecRef(); } return sz; }
void Vbo:: init(size_t size, unsigned vbo_type, unsigned access_pattern, void* data) { TIME_VBO TaskTimer tt("Vbo::init(%s, %u, %u, %p)", DataStorageVoid::getMemorySizeText(_sz).c_str(), vbo_type, access_pattern, data); GlException_CHECK_ERROR(); clear(); GlException_CHECK_ERROR(); // create buffer object glGenBuffers(1, &_vbo); glBindBuffer(vbo_type, _vbo); glBufferData(vbo_type, size, data, access_pattern); glBindBuffer(vbo_type, 0); TIME_VBO TaskInfo("Got vbo %u", _vbo) ; GlException_CHECK_ERROR(); _sz = size; _vbo_type = vbo_type; }
template<class T> void do_test() { std::cout << "Size\ttable (c/e)\ttable (s)\tvector (c/e)\tvector (s)\tG(c/e)\tG(s)\n"; for(int N=1;N<=4096;N*=2) { std::cout.precision(3); std::cout << N << "^2\t"; table_test<T> tt(N,N,-.28319, .28319); nt2::unit::benchmark_result<nt2::details::cycles_t> dv; nt2::unit::perform_benchmark( tt, 1., dv); nt2::unit::benchmark_result<double> tv; nt2::unit::perform_benchmark( tt, 1., tv); std::cout << std::scientific << dv.median/(double)(N*N) << "\t"; std::cout << std::scientific << tv.median << "\t"; vector_test<T> vv(N,N,-.28319, .28319); nt2::unit::benchmark_result<nt2::details::cycles_t> dw; nt2::unit::perform_benchmark( vv, 1., dw); nt2::unit::benchmark_result<double> tw; nt2::unit::perform_benchmark( vv, 1., tw); std::cout << std::scientific << dw.median/(double)(N*N) << "\t"; std::cout << std::scientific << tw.median << "\t"; std::cout << std::fixed << (double)dw.median/dv.median << "\t"; std::cout << std::fixed << (double)tw.median/tv.median << "\n"; } }
ImportEnex::ImportEnex(QObject *parent) : QObject(parent) { importTags = false; importNotebooks = false; NotebookTable t(global.db); QString name = tr("Imported Notes"); qint32 lid=t.findByName(name); if (lid == 0) { // We have a new notebook to add Notebook book; book.name = name; bool isSynchronized = true; QUuid uuid; notebookGuid = uuid.createUuid().toString().replace("{","").replace("}",""); book.guid = notebookGuid; t.add(0,book,true, !isSynchronized); } else { t.getGuid(notebookGuid, lid); } TagTable tt(global.db); tt.getNameMap(tagList); progress = new QProgressDialog(); progress->setVisible(false); stopNow = false; }
int UnitTest:: test(bool rethrow_exceptions) { try { Timer(); // Init performance counting TaskTimer tt("Running tests"); RUNTEST(Tfr::FreqAxis); RUNTEST(Tfr::StftDesc); RUNTEST(Tfr::DummyTransform); RUNTEST(Tfr::DummyTransformDesc); RUNTEST(Tfr::TransformOperationDesc); } catch (const ExceptionAssert& x) { if (rethrow_exceptions) throw; char const * const * f = boost::get_error_info<boost::throw_file>(x); int const * l = boost::get_error_info<boost::throw_line>(x); char const * const * c = boost::get_error_info<ExceptionAssert::ExceptionAssert_condition>(x); std::string const * m = boost::get_error_info<ExceptionAssert::ExceptionAssert_message>(x); fflush(stdout); fprintf(stderr, "%s", str(boost::format("%s:%d: %s. %s\n" "%s\n" " FAILED in %s::test()\n\n") % (f?*f:0) % (l?*l:-1) % (c?*c:0) % (m?*m:0) % boost::diagnostic_information(x) % lastname ).c_str()); fflush(stderr); return 1; } catch (const exception& x) { if (rethrow_exceptions) throw; fflush(stdout); fprintf(stderr, "%s", str(boost::format("%s\n" "%s\n" " FAILED in %s::test()\n\n") % vartype(x) % boost::diagnostic_information(x) % lastname ).c_str()); fflush(stderr); return 1; } catch (...) { if (rethrow_exceptions) throw; fflush(stdout); fprintf(stderr, "%s", str(boost::format("Not an std::exception\n" "%s\n" " FAILED in %s::test()\n\n") % boost::current_exception_diagnostic_information () % lastname ).c_str()); fflush(stderr); return 1; } printf("\n OK\n\n"); return 0; }
void test_tuple() { auto t = tt(42, 3.14); static_assert(__stl2::models::Same<decltype(t), TT>); CHECK(__stl2::get<0>(t) == 42); CHECK(t.in() == 42); CHECK(__stl2::get<1>(t) == 3.14); CHECK(t.out() == 3.14); }
void examine_edge( Edge e, const Graph & g) const { if( !(*visited)[target(e, g)] ) { (*path)[target(e, g)] = tt( source(e, g) ); (*visited)[target(e, g)] = true; } }
bool GraphicsView:: event ( QEvent * e ) { DEBUG_EVENTS TaskTimer tt("GraphicsView event %s %d", vartype(*e).c_str(), e->isAccepted()); bool r = QGraphicsView::event(e); DEBUG_EVENTS TaskTimer("GraphicsView event %s info %d %d", vartype(*e).c_str(), r, e->isAccepted()).suppressTiming(); return r; }
bool GraphicsScene:: eventFilter(QObject* o, QEvent* e) { DEBUG_EVENTS TaskTimer tt("GraphicsScene eventFilter %s %s %d", vartype(*o).c_str(), vartype(*e).c_str(), e->isAccepted()); bool r = QGraphicsScene::eventFilter(o, e); DEBUG_EVENTS TaskTimer("GraphicsScene eventFilter %s %s info %d %d", vartype(*o).c_str(), vartype(*e).c_str(), r, e->isAccepted()).suppressTiming(); return r; }