Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

poolslot.h
Go to the documentation of this file.
1 
30 #pragma once
31 
33 #include <ogdf/lib/abacus/master.h>
36 
37 #pragma GCC visibility push(default)
38 namespace abacus {
39 
40 class Sub;
41 
42 template<class BaseType, class CoType> class Pool;
43 template<class BaseType, class CoType> class PoolSlotRef;
44 template<class BaseType, class CoType> class StandardPool;
45 template<class BaseType, class CoType> class NonDuplPool;
46 template<class BaseType, class CoType> class CutBuffer;
47 
48 
50 
78 template<class BaseType, class CoType> class PoolSlot : public AbacusRoot {
79 
80  friend class PoolSlotRef<BaseType,CoType>;
81  friend class Pool<BaseType,CoType>;
82  friend class StandardPool<BaseType,CoType>;
83  friend class CutBuffer<BaseType,CoType>;
84 
85  friend class Sub;
88  friend class Pool<Constraint, Variable>;
89  friend class Pool<Variable, Constraint>;
94  friend class CutBuffer<Constraint, Variable>;
95  friend class CutBuffer<Variable, Constraint>;
96 
97 public:
98 
100 
111  BaseType *convar = 0);
112 
113  ~PoolSlot();
114 
116  BaseType *conVar() const { return conVar_; }
117 
118 
119 private:
120 
122 
127  void insert(BaseType *convar);
128 
130 
135  int softDelete() {
136  if (conVar_ == nullptr)
137  return 0;
138  if (conVar_->deletable() == false)
139  return 1;
140  hardDelete();
141  return 0;
142  }
143 
145 
148  void hardDelete() {
149  delete conVar_;
150  conVar_ = nullptr;
151  }
152 
155  pool_->removeConVar(this);
156  }
157 
159  unsigned long version() const { return version_; }
160 
162  Master *master() { return master_; }
163 
165  const Master *master() const { return master_; }
166 
168  BaseType *conVar_;
169  unsigned long version_;
171 
172 
176 
178 };
179 
180 }
181 
183 #pragma GCC visibility pop
abacus::NonDuplPool
Standard pools without constraint duplication.
Definition: nonduplpool.h:59
abacus::PoolSlotRef
Stores a pointer to a pool slot with version number.
Definition: active.h:41
constraint.h
constraint.
abacusroot.h
poolslot.inc
abacus::CutBuffer
Cut buffers.
Definition: convar.h:46
abacus
Definition: ILPClusterPlanarity.h:50
abacus::PoolSlot::conVar_
BaseType * conVar_
A pointer to the constraint/variable.
Definition: poolslot.h:168
abacus::PoolSlot::PoolSlot
PoolSlot(Master *master, Pool< BaseType, CoType > *pool, BaseType *convar=0)
Creates a pool slot and inserts convar.
abacus::PoolSlot::conVar
BaseType * conVar() const
Returns a pointer to the constraint/variable in the pool slot.
Definition: poolslot.h:116
abacus::PoolSlot::hardDelete
void hardDelete()
Deletes the constraint/variable in the slot.
Definition: poolslot.h:148
abacus::PoolSlot::master
Master * master()
Returns a pointer to the corresponding master of the optimization.
Definition: poolslot.h:162
OGDF_NEW_DELETE
#define OGDF_NEW_DELETE
Makes the class use OGDF's memory allocator.
Definition: memory.h:85
abacus::Pool
Base class for constraint/variabe pools.
Definition: pool.h:63
abacus::PoolSlot::pool_
Pool< BaseType, CoType > * pool_
A pointer to the corresponding pool.
Definition: poolslot.h:170
abacus::StandardPool
Standard pools.
Definition: ILPClusterPlanarity.h:52
abacus::PoolSlot::removeConVarFromPool
void removeConVarFromPool()
Removes the constraint contained in this slot from its pool.
Definition: poolslot.h:154
abacus::PoolSlot::softDelete
int softDelete()
Tries to remove the item from the slot.
Definition: poolslot.h:135
abacus::Variable
Forms the virtual base class for all possible variables given in pool format.
Definition: variable.h:60
variable.h
variable.
ogdf::AlgorithmFailureCode::Pool
@ Pool
abacus::PoolSlot::master_
Master * master_
A pointer to the corresponding master of the optimization.
Definition: poolslot.h:167
master.h
the master of the optimization.
abacus::PoolSlot::~PoolSlot
~PoolSlot()
abacus::PoolSlot::version
unsigned long version() const
Return the version number of the constraint/variable in the slot.
Definition: poolslot.h:159
abacus::Sub
The subproblem.
Definition: sub.h:69
abacus::Constraint
Forms the virtual base class for all possible constraints given in pool format.
Definition: constraint.h:57
abacus::PoolSlot
Stores constraints and variables.
Definition: active.h:40
abacus::PoolSlot::version_
unsigned long version_
The version of the constraint in the slot.
Definition: poolslot.h:169
ogdf::AlgorithmFailureCode::StandardPool
@ StandardPool
abacus::PoolSlot::insert
void insert(BaseType *convar)
Inserts a constraint/variable in the slot and updates the version number.
abacus::PoolSlot::operator=
const PoolSlot< BaseType, CoType > & operator=(const PoolSlot< BaseType, CoType > &rhs)
abacus::PoolSlot::master
const Master * master() const
Returns a const pointer to the corresponding master of the optimization.
Definition: poolslot.h:165
abacus::Master
The master of the optimization.
Definition: master.h:70