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 namespace abacus {
38 
39 class Sub;
40 
41 template<class BaseType, class CoType> class Pool;
42 template<class BaseType, class CoType> class PoolSlotRef;
43 template<class BaseType, class CoType> class StandardPool;
44 template<class BaseType, class CoType> class NonDuplPool;
45 template<class BaseType, class CoType> class CutBuffer;
46 
47 
49 
77 template<class BaseType, class CoType> class OGDF_EXPORT PoolSlot : public AbacusRoot {
78 
79  friend class PoolSlotRef<BaseType,CoType>;
80  friend class Pool<BaseType,CoType>;
81  friend class StandardPool<BaseType,CoType>;
82  friend class CutBuffer<BaseType,CoType>;
83 
84  friend class Sub;
87  friend class Pool<Constraint, Variable>;
88  friend class Pool<Variable, Constraint>;
93  friend class CutBuffer<Constraint, Variable>;
94  friend class CutBuffer<Variable, Constraint>;
95 
96 public:
97 
99 
108  PoolSlot(Master *master,
110  BaseType *convar = 0);
111 
112  ~PoolSlot();
113 
115  BaseType *conVar() const { return conVar_; }
116 
117 
118 private:
119 
121 
126  void insert(BaseType *convar);
127 
129 
134  int softDelete() {
135  if (conVar_ == nullptr)
136  return 0;
137  if (conVar_->deletable() == false)
138  return 1;
139  hardDelete();
140  return 0;
141  }
142 
144 
147  void hardDelete() {
148  delete conVar_;
149  conVar_ = nullptr;
150  }
151 
154  pool_->removeConVar(this);
155  }
156 
158  unsigned long version() const { return version_; }
159 
161  Master *master() { return master_; }
162 
164  const Master *master() const { return master_; }
165 
167  BaseType *conVar_;
168  unsigned long version_;
170 
171 
174  &operator=(const PoolSlot<BaseType, CoType> &rhs);
175 
177 };
178 
179 }
180 
abacus::NonDuplPool
Standard pools without constraint duplication.
Definition: nonduplpool.h:58
abacus::PoolSlotRef
Stores a pointer to a pool slot with version number.
Definition: active.h:40
constraint.h
constraint.
abacusroot.h
poolslot.inc
abacus::CutBuffer
Cut buffers.
Definition: convar.h:45
abacus
Definition: abacusroot.h:48
abacus::PoolSlot::conVar_
BaseType * conVar_
A pointer to the constraint/variable.
Definition: poolslot.h:167
abacus::PoolSlot::conVar
BaseType * conVar() const
Returns a pointer to the constraint/variable in the pool slot.
Definition: poolslot.h:115
abacus::PoolSlot::hardDelete
void hardDelete()
Deletes the constraint/variable in the slot.
Definition: poolslot.h:147
abacus::PoolSlot::master
Master * master()
Returns a pointer to the corresponding master of the optimization.
Definition: poolslot.h:161
OGDF_NEW_DELETE
#define OGDF_NEW_DELETE
Makes the class use OGDF's memory allocator.
Definition: memory.h:84
abacus::Pool
Base class for constraint/variabe pools.
Definition: pool.h:62
abacus::PoolSlot::pool_
Pool< BaseType, CoType > * pool_
A pointer to the corresponding pool.
Definition: poolslot.h:169
abacus::StandardPool
Standard pools.
Definition: convar.h:44
abacus::PoolSlot::removeConVarFromPool
void removeConVarFromPool()
Removes the constraint contained in this slot from its pool.
Definition: poolslot.h:153
abacus::PoolSlot::softDelete
int softDelete()
Tries to remove the item from the slot.
Definition: poolslot.h:134
abacus::Variable
Forms the virtual base class for all possible variables given in pool format.
Definition: variable.h:59
variable.h
variable.
ogdf::AlgorithmFailureCode::Pool
@ Pool
abacus::PoolSlot::master_
Master * master_
A pointer to the corresponding master of the optimization.
Definition: poolslot.h:166
master.h
the master of the optimization.
abacus::PoolSlot::version
unsigned long version() const
Return the version number of the constraint/variable in the slot.
Definition: poolslot.h:158
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
abacus::Sub
The subproblem.
Definition: sub.h:68
abacus::Constraint
Forms the virtual base class for all possible constraints given in pool format.
Definition: constraint.h:56
abacus::PoolSlot
Stores constraints and variables.
Definition: active.h:39
abacus::PoolSlot::version_
unsigned long version_
The version of the constraint in the slot.
Definition: poolslot.h:168
ogdf::AlgorithmFailureCode::StandardPool
@ StandardPool
abacus::PoolSlot::master
const Master * master() const
Returns a const pointer to the corresponding master of the optimization.
Definition: poolslot.h:164
abacus::Master
The master of the optimization.
Definition: master.h:69