Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
poolslot.h
Go to the documentation of this file.
30#pragma once
31
36
37#pragma GCC visibility push(default)
38namespace abacus {
39
40class Sub;
41
42template<class BaseType, class CoType> class Pool;
43template<class BaseType, class CoType> class PoolSlotRef;
44template<class BaseType, class CoType> class StandardPool;
45template<class BaseType, class CoType> class NonDuplPool;
46template<class BaseType, class CoType> class CutBuffer;
47
48
50
78template<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;
86 friend class PoolSlotRef<Constraint, Variable>;
87 friend class PoolSlotRef<Variable, Constraint>;
88 friend class Pool<Constraint, Variable>;
89 friend class Pool<Variable, Constraint>;
90 friend class StandardPool<Constraint, Variable>;
91 friend class StandardPool<Variable, Constraint>;
92 friend class NonDuplPool<Constraint, Variable>;
93 friend class NonDuplPool<Variable, Constraint>;
94 friend class CutBuffer<Constraint, Variable>;
95 friend class CutBuffer<Variable, Constraint>;
96
97public:
98
100
111 BaseType *convar = 0);
112
114
116 BaseType *conVar() const { return conVar_; }
117
118
119private:
120
122
127 void insert(BaseType *convar);
128
130
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
Base class of all other classes of ABACUS.
Definition abacusroot.h:69
Forms the virtual base class for all possible constraints given in pool format.
Definition constraint.h:57
Cut buffers.
Definition cutbuffer.h:53
The master of the optimization.
Definition master.h:70
Standard pools without constraint duplication.
Definition nonduplpool.h:59
Base class for constraint/variabe pools.
Definition pool.h:63
Stores constraints and variables.
Definition poolslot.h:78
Master * master()
Returns a pointer to the corresponding master of the optimization.
Definition poolslot.h:162
BaseType * conVar_
A pointer to the constraint/variable.
Definition poolslot.h:168
int softDelete()
Tries to remove the item from the slot.
Definition poolslot.h:135
const Master * master() const
Returns a const pointer to the corresponding master of the optimization.
Definition poolslot.h:165
void insert(BaseType *convar)
Inserts a constraint/variable in the slot and updates the version number.
void removeConVarFromPool()
Removes the constraint contained in this slot from its pool.
Definition poolslot.h:154
unsigned long version() const
Return the version number of the constraint/variable in the slot.
Definition poolslot.h:159
Pool< BaseType, CoType > * pool_
A pointer to the corresponding pool.
Definition poolslot.h:170
const PoolSlot< BaseType, CoType > & operator=(const PoolSlot< BaseType, CoType > &rhs)
PoolSlot(Master *master, Pool< BaseType, CoType > *pool, BaseType *convar=0)
Creates a pool slot and inserts convar.
void hardDelete()
Deletes the constraint/variable in the slot.
Definition poolslot.h:148
PoolSlot(const PoolSlot< BaseType, CoType > &rhs)
Master * master_
A pointer to the corresponding master of the optimization.
Definition poolslot.h:167
BaseType * conVar() const
Returns a pointer to the constraint/variable in the pool slot.
Definition poolslot.h:116
unsigned long version_
The version of the constraint in the slot.
Definition poolslot.h:169
Stores a pointer to a pool slot with version number.
Definition poolslotref.h:55
Standard pools.
The subproblem.
Definition sub.h:69
Forms the virtual base class for all possible variables given in pool format.
Definition variable.h:60
constraint.
#define OGDF_NEW_DELETE
Makes the class use OGDF's memory allocator.
Definition memory.h:85
the master of the optimization.
variable.