Loading [MathJax]/extensions/tex2jax.js

Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
poolslotref.h
Go to the documentation of this file.
1
30#pragma once
31
36
37namespace abacus {
38
39template<class BaseType, class CoType>
40class PoolSlotRef;
41
42template<class BaseType, class CoType>
43std::ostream &operator<< (std::ostream &out, const PoolSlotRef<BaseType, CoType> &slot);
44
45
47
53template<class BaseType, class CoType>
54class PoolSlotRef : public AbacusRoot {
55public:
56
58
61 PoolSlotRef(Master *master) : master_(master), slot_(0), version_(0) { }
62
64
71 {
72 ConVar *cv = slot_->conVar();
73 if(cv) cv->addReference();
74 }
75
77
86 {
87 ConVar *cv = slot_->conVar();
88 if (version_ == slot_->version() && cv)
90 }
91
93
103 if(slot_) {
104 ConVar *cv = slot_->conVar();
105 if (cv && version_ == slot_->version())
107 }
108 }
109
111
120 friend std::ostream &operator<< <> (std::ostream &out, const PoolSlotRef<BaseType, CoType> &slot);
121
123
127 BaseType *conVar() const {
128 if(version_ == slot_->version())
129 return slot_->conVar();
131
132 return nullptr;
133 }
134
136 unsigned long version() const { return version_; }
137
140
141
143
152
153private:
154
156
158
160 unsigned long version_;
161
163
164
167
169};
170
171}
172
Base class of all other classes of ABACUS.
Definition abacusroot.h:68
Common base class for constraints (Constraint) and variables (Variable).
Definition convar.h:65
void addReference()
Indicates that there is a new reference to the pool slot storing this constraint/variable.
Definition convar.h:358
void removeReference()
Is the counterpart of the function addReference() and indicates the removal of a reference to this co...
Definition convar.h:419
The master of the optimization.
Definition master.h:69
Stores constraints and variables.
Definition poolslot.h:77
Stores a pointer to a pool slot with version number.
Definition poolslotref.h:54
BaseType * conVar() const
Returns a pointer to the constraint/variable stored in the referenced slot.
PoolSlotRef(Master *master)
Creates an object referencing no pool slot.
Definition poolslotref.h:61
Master * master_
A pointer to the corresponding master of the optimization.
~PoolSlotRef()
The destructor.
const PoolSlotRef< BaseType, CoType > & operator=(const PoolSlotRef< BaseType, CoType > &rhs)
unsigned long version_
The version number of the slot at construction/initialization time of this reference.
PoolSlotRef(const PoolSlotRef< BaseType, CoType > &rhs)
Copy constructor.
Definition poolslotref.h:85
void printDifferentVersionError() const
PoolSlot< BaseType, CoType > * slot_
A pointer to the referenced pool slot.
PoolSlot< BaseType, CoType > * slot() const
Returns a pointer to the referenced slot.
PoolSlotRef(PoolSlot< BaseType, CoType > *slot)
Creates an object referencing a pool slot slot.
Definition poolslotref.h:70
void slot(PoolSlot< BaseType, CoType > *s)
Initializes the referenced pool slot with s.
unsigned long version() const
Returns the version number of the constraint/variable stored in the referenced slot at construction t...
constraint.
#define OGDF_NEW_DELETE
Makes the class use OGDF's memory allocator.
Definition memory.h:84
the master of the optimization.
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
std::ostream & operator<<(std::ostream &out, const Active< BaseType, CoType > &rhs)
poolslot.
variable.