43template<
class BaseType,
class CoType>
46 for (
int i = 0; i < n_; i++) {
47 psRef_[i]->conVar()->unlock();
53template<
class BaseType,
class CoType>
61 psRef_[n_] =
new PoolSlotRef<BaseType, CoType>(slot);
64 slot->conVar()->lock();
71template<
class BaseType,
class CoType>
80 psRef_[n_] =
new PoolSlotRef<BaseType, CoType>(slot);
84 slot->conVar()->lock();
90template<
class BaseType,
class CoType>
93 PoolSlotRef<BaseType, CoType> *
psr;
95 const int nIndex = index.size();
97 for (
int i = 0; i <
nIndex; i++) {
98 psr = psRef_[index[i]];
99 psr->conVar()->unlock();
102 if (
ps->conVar()->deletable())
103 ps->removeConVarFromPool();
105 psRef_.leftShift(index);
106 keepInPool_.leftShift(index);
107 rank_.leftShift(index);
113template<
class BaseType,
class CoType>
117 if (n_ > threshold) {
131 for (
int i = 0; i < n_; i++) {
133 things[i].setPriority(-rank_[i]);
142 for (
int i = 0; i < n_; i++) {
147 for (
int i = 0; i < n_; i++) {
153 << -
things[threshold - 1].priority() <<
", rejected in "
154 << -
things[threshold].priority() <<
" ... " << -
things[n_ - 1].priority() << std::endl;
165template<
class BaseType,
class CoType>
171 for (
int i = 0; i < n_; i++)
172 psRef_[i]->conVar()->unlock();
192 for (
int i =
nExtract; i < n_; i++) {
193 if (!keepInPool_[i]) {
194 s = psRef_[i]->slot();
196 if (s->conVar()->deletable())
197 s->removeConVarFromPool();
199 else delete psRef_[i];
205 for (
int i = 0; i <
nExtract; i++) {
~CutBuffer()
The destructor.
void remove(ArrayBuffer< int > &index)
Removes the elements specified by index from the buffer.
int insert(PoolSlot< BaseType, CoType > *slot, bool keepInPool)
Adds a slot to the buffer.
void sort(int threshold)
Sorts the items according to their ranks.
void extract(int max, ArrayBuffer< PoolSlot< BaseType, CoType > * > &newSlots)
Takes the first max items from the buffer and clears the buffer.
static std::ostream & ilout(Level level=Level::Default)
Declarations for Comparer objects.
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()