Stores a pointer to a pool slot with version number. More...
#include <ogdf/lib/abacus/active.h>
Public Member Functions | |
PoolSlotRef (const PoolSlotRef< BaseType, CoType > &rhs) | |
Copy constructor. More... | |
PoolSlotRef (Master *master) | |
Creates an object referencing no pool slot. More... | |
PoolSlotRef (PoolSlot< BaseType, CoType > *slot) | |
Creates an object referencing a pool slot slot. More... | |
~PoolSlotRef () | |
The destructor. More... | |
BaseType * | conVar () const |
Returns a pointer to the constraint/variable stored in the referenced slot. More... | |
PoolSlot< BaseType, CoType > * | slot () const |
Returns a pointer to the referenced slot. More... | |
void | slot (PoolSlot< BaseType, CoType > *s) |
Initializes the referenced pool slot with s. More... | |
unsigned long | version () const |
Returns the version number of the constraint/variable stored in the referenced slot at construction time. More... | |
Private Member Functions | |
const PoolSlotRef< BaseType, CoType > & | operator= (const PoolSlotRef< BaseType, CoType > &rhs) |
void | printDifferentVersionError () const |
Private Attributes | |
Master * | master_ |
A pointer to the corresponding master of the optimization. More... | |
PoolSlot< BaseType, CoType > * | slot_ |
A pointer to the referenced pool slot. More... | |
unsigned long | version_ |
The version number of the slot at construction/initialization time of this reference. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &out, const PoolSlotRef< BaseType, CoType > &slot) |
Output operator for pool slot references. More... | |
Stores a pointer to a pool slot with version number.
As already explained in the class PoolSlot we do not refer directly to constraints/variables but store a pointer to a pool slot and memorize the version number of the slot at initialization time of the class PoolSlotRef.
|
inline |
Creates an object referencing no pool slot.
master | A pointer to the corresponding master of the optimization. |
Definition at line 61 of file poolslotref.h.
|
inline |
Creates an object referencing a pool slot slot.
Also the constraint/variable contained in this slot receives a message that a new references to it is created.
slot | The pool slot that is referenced now. |
Definition at line 70 of file poolslotref.h.
|
inline |
Copy constructor.
May increment the reference counter of the constraint/variable only if version number of the slot and version number of the reference are equal, since otherwise this is not a correct reference to slot_->conVar().
rhs | The pool slot that is copied in the initialization process. |
Definition at line 85 of file poolslotref.h.
|
inline |
The destructor.
Sends a message to the constraint that it will no longer be referred from this place in the program.
If the version number of the reference and the version number of the slot do not equal, we must not decrement the reference counter of slot_->conVar() because this is not a correct reference to this constraint/variable.
Definition at line 102 of file poolslotref.h.
|
inline |
Returns a pointer to the constraint/variable stored in the referenced slot.
If the version number of the slot differs from the version number at construction/initialization time of this slot 0 is returned.
Definition at line 127 of file poolslotref.h.
|
private |
|
private |
|
inline |
Returns a pointer to the referenced slot.
Definition at line 139 of file poolslotref.h.
void abacus::PoolSlotRef< BaseType, CoType >::slot | ( | PoolSlot< BaseType, CoType > * | s | ) |
Initializes the referenced pool slot with s.
The function slot() may decrement the reference counter of slot_->conVar() only if the version number of the reference and the version number of the slot are equal since otherwise this is not a valid reference.
s | The new slot that is referenced. This must not be a 0-pointer. |
|
inline |
Returns the version number of the constraint/variable stored in the referenced slot at construction time.
Definition at line 136 of file poolslotref.h.
|
friend |
Output operator for pool slot references.
The output operator writes the constraint/variable stored in the referenced slot to an output stream.
out | The output stream. |
slot | The reference to a pool slot being output. |
|
private |
A pointer to the corresponding master of the optimization.
Definition at line 155 of file poolslotref.h.
|
private |
A pointer to the referenced pool slot.
Definition at line 157 of file poolslotref.h.
|
private |
The version number of the slot at construction/initialization time of this reference.
Definition at line 160 of file poolslotref.h.