40 #pragma GCC visibility push(default)
44 template<
class BaseType,
class CoType>
47 for (
int i = 0; i < n_; i++) {
48 psRef_[i]->conVar()->unlock();
54 template<
class BaseType,
class CoType>
56 PoolSlot<BaseType, CoType> *slot,
62 psRef_[n_] =
new PoolSlotRef<BaseType, CoType>(slot);
63 keepInPool_[n_] = keepInPool;
65 slot->conVar()->lock();
72 template<
class BaseType,
class CoType>
74 PoolSlot<BaseType, CoType> *slot,
81 psRef_[n_] =
new PoolSlotRef<BaseType, CoType>(slot);
82 keepInPool_[n_] = keepInPool;
85 slot->conVar()->lock();
91 template<
class BaseType,
class CoType>
94 PoolSlotRef<BaseType, CoType> *psr;
96 const int nIndex = index.size();
98 for (
int i = 0; i < nIndex; i++) {
99 psr = psRef_[index[i]];
100 psr->conVar()->unlock();
101 PoolSlot<BaseType, CoType> *ps = psr->slot();
103 if (ps->conVar()->deletable())
104 ps->removeConVarFromPool();
106 psRef_.leftShift(index);
107 keepInPool_.leftShift(index);
108 rank_.leftShift(index);
114 template<
class BaseType,
class CoType>
118 if (n_ > threshold) {
131 Array< ogdf::Prioritized<int> > things(n_);
132 for (
int i = 0; i < n_; i++) {
133 things[i].setItem(i);
134 things[i].setPriority(-rank_[i]);
140 Array<PoolSlotRef<BaseType, CoType>*> psRefSorted(n_);
141 Array<bool> keepInPoolSorted(n_);
143 for (
int i = 0; i < n_; i++) {
144 psRefSorted[i] = psRef_[things[i].item()];
145 keepInPoolSorted[i] = keepInPool_[things[i].item()];
148 for (
int i = 0; i < n_; i++) {
149 psRef_[i] = psRefSorted[i];
150 keepInPool_[i] = keepInPoolSorted[i];
154 << -things[threshold - 1].priority() <<
", rejected in "
155 << -things[threshold].priority() <<
" ... " << -things[n_ - 1].priority() << std::endl;
166 template<
class BaseType,
class CoType>
169 ArrayBuffer<PoolSlot<BaseType, CoType>*> &newSlots)
172 for (
int i = 0; i < n_; i++)
173 psRef_[i]->conVar()->unlock();
178 if (n_ < max) nExtract = n_;
191 PoolSlot<BaseType, CoType> *s;
193 for (
int i = nExtract; i < n_; i++) {
194 if (!keepInPool_[i]) {
195 s = psRef_[i]->slot();
197 if (s->conVar()->deletable())
198 s->removeConVarFromPool();
200 else delete psRef_[i];
206 for (
int i = 0; i < nExtract; i++) {
207 newSlots.push(psRef_[i]->slot());
216 #pragma GCC visibility pop