14 mLastWaypoint[
g] =
nullptr;
22 for (
Gate* origin : mQueue)
26 if (mLastWaypoint.contains(
g))
continue;
27 mLastWaypoint[
g] = origin;
41 g = mLastWaypoint.value(
g);
47 : mForward(forw), mMaskAll(0)
49 if (gateIds.
size() > 31)
51 log_warning(
"gui",
"Cannot find common {} for more than 31 gates", (forw?
"successor":
"predecessor"));
55 for (
u32 id : gateIds)
60 int msk = cspgq.
mask();
63 mQueues.append(cspgq);
66 for (
int iRound = 0; iRound<maxRound; iRound++)
68 for (
auto it = mQueues.begin(); it!=mQueues.end(); ++it)
70 QList nextGates = it->getNext(mForward);
71 for (
Gate*
g: nextGates)
72 if ((mFoundBit[
g] |= it->mask()) == mMaskAll)
75 it->setQueue(nextGates);
77 if (!mFoundSet.isEmpty())
break;
80 if (mFoundSet.isEmpty())
81 log_info(
"gui",
"No common {} found.", (forw?
"successor":
"predecessor"));
87 for (
Gate*
g : mFoundSet)
90 for (
Gate* wayp : cspgq.waypoints(
g))
CommonSuccessorPredecessorGateQueue(int i, Gate *g)
QList< Gate * > getNext(bool forward)
QList< Gate * > waypoints(Gate *g) const
QSet< Gate * > result() const
CommonSuccessorPredecessor(const QList< u32 > &gateIds, bool forw, int maxRound)
Gate * get_gate_by_id(const u32 gate_id) const
#define log_info(channel,...)
#define log_warning(channel,...)
std::vector< Gate * > get_next_gates(const Gate *gate, bool get_successors, int depth, const std::function< bool(const Gate *)> &filter)
void append(const T &value)
QSet::iterator insert(const T &value)