| 362 | } |
| 363 | |
| 364 | bool Engine::process() { |
| 365 | #ifdef WITH_TIMERS |
| 366 | static Timer* gt = Timer::get_timer("processing"); |
| 367 | gt->start(); |
| 368 | #endif |
| 369 | |
| 370 | // process data |
| 371 | ProcessFlow::NodeList toProcess = m_startNodes; |
| 372 | bool doneSomething = false; |
| 373 | while (toProcess.size()>0) |
| 374 | { |
| 375 | ProcessFlow::Node* n = toProcess.back(); |
| 376 | toProcess.pop_back(); |
| 377 | ProcessingStep& step = n->v; |
| 378 | #ifdef DEBUG |
| 379 | if (verboseFlag) |
| 380 | cerr << "process step " << step.m_id << " ( " << toProcess.size() << " in queue)" << endl; |
| 381 | #endif |
| 382 | bool b = true; |
| 383 | if (step.m_component!=NULL) |
| 384 | { |
| 385 | #ifdef WITH_TIMERS |
| 386 | Timer* t = Timer::get_timer(step.m_id); |
| 387 | t->start(); |
| 388 | #endif |
| 389 | b = step.m_component->process(step.m_input,step.m_output); |
| 390 | #ifdef WITH_TIMERS |
| 391 | t->stop(); |
| 392 | #endif |
| 393 | } |
| 394 | if (b) |
| 395 | { |
| 396 | if (step.m_component!=NULL) |
| 397 | doneSomething = true; |
| 398 | for (int i=0;i<n->v.m_output.size();i++) { |
| 399 | // n->v.m_output[i].data->debug(); |
| 400 | n->v.m_output[i].data->dispatch(); |
| 401 | } |
| 402 | for (ProcessFlow::LinkListCIt it=n->targets().begin(); it!=n->targets().end(); it++) |
| 403 | if ((*it)->target->v.hasInputAvailable()) |
| 404 | toProcess.push_back((*it)->target); |
| 405 | } |
| 406 | } |
| 407 | #ifdef WITH_TIMERS |
| 408 | gt->stop(); |
| 409 | #endif |
| 410 | |
| 411 | return doneSomething; |
| 412 | } |
| 413 | |
| 414 | void Engine::flush() { |
| 415 | m_graph->visitAll<Engine::flushStep> (); |
no test coverage detected