Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

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 } //namespace abacus
180 
unsigned long version_
The version of the constraint in the slot.
Definition: poolslot.h:168
unsigned long version() const
Return the version number of the constraint/variable in the slot.
Definition: poolslot.h:158
Standard pools without constraint duplication.
Definition: nonduplpool.h:58
The master of the optimization.
Definition: master.h:69
BaseType * conVar_
A pointer to the constraint/variable.
Definition: poolslot.h:167
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:99
The subproblem.
Definition: sub.h:68
the master of the optimization.
Forms the virtual base class for all possible constraints given in pool format.
Definition: constraint.h:56
Master * master()
Returns a pointer to the corresponding master of the optimization.
Definition: poolslot.h:161
int softDelete()
Tries to remove the item from the slot.
Definition: poolslot.h:134
Cut buffers.
Definition: convar.h:45
BaseType * conVar() const
Returns a pointer to the constraint/variable in the pool slot.
Definition: poolslot.h:115
void removeConVarFromPool()
Removes the constraint contained in this slot from its pool.
Definition: poolslot.h:153
Master * master_
A pointer to the corresponding master of the optimization.
Definition: poolslot.h:166
constraint.
Pool< BaseType, CoType > * pool_
A pointer to the corresponding pool.
Definition: poolslot.h:169
Base class for constraint/variabe pools.
Definition: pool.h:62
#define OGDF_NEW_DELETE
Makes the class use OGDF&#39;s memory allocator.
Definition: memory.h:84
Forms the virtual base class for all possible variables given in pool format.
Definition: variable.h:59
Stores a pointer to a pool slot with version number.
Definition: active.h:40
Stores constraints and variables.
Definition: active.h:39
variable.
const Master * master() const
Returns a const pointer to the corresponding master of the optimization.
Definition: poolslot.h:164
Standard pools.
Definition: convar.h:44
void hardDelete()
Deletes the constraint/variable in the slot.
Definition: poolslot.h:147