| 625 | } |
| 626 | |
| 627 | virtual void do_init () |
| 628 | { |
| 629 | if (m_pattern.is_catchall () || m_pattern.needs_eval ()) { |
| 630 | |
| 631 | if (! objectives ().wants_all_cells ()) { |
| 632 | |
| 633 | // wildcard or unknown filter: include the parent cells if specific child cells are looked for |
| 634 | |
| 635 | int levels = 1; |
| 636 | for (size_t i = 0; i < followers ().size (); ++i) { |
| 637 | if (followers ()[i] == 0) { |
| 638 | // this is a sign of recursion - collect caller cells from all levels. |
| 639 | levels = -1; |
| 640 | } |
| 641 | } |
| 642 | |
| 643 | // this means, one follower wants only certain cells. We can optimize by only checking for potential parents |
| 644 | std::set<db::cell_index_type> callers; |
| 645 | for (FilterStateObjectives::cell_iterator c = objectives ().begin_cells (); c != objectives ().end_cells (); ++c) { |
| 646 | layout ()->cell (*c).collect_caller_cells (callers, levels); |
| 647 | } |
| 648 | |
| 649 | for (std::set<db::cell_index_type>::const_iterator c = callers.begin (); c != callers.end (); ++c) { |
| 650 | objectives ().request_cell (*c); |
| 651 | } |
| 652 | |
| 653 | } |
| 654 | |
| 655 | } else { |
| 656 | |
| 657 | objectives ().set_wants_all_cells (false); |
| 658 | |
| 659 | // include all matching cells into the objectives |
| 660 | for (db::Layout::const_iterator c = layout ()->begin (); c != layout ()->end(); ++c) { |
| 661 | if (m_pattern.match (c->get_qualified_name ())) { |
| 662 | objectives ().request_cell (c->cell_index ()); |
| 663 | } |
| 664 | } |
| 665 | |
| 666 | } |
| 667 | } |
| 668 | |
| 669 | db::Instance instance () const |
| 670 | { |
no test coverage detected