Stores a pointer to a pool slot with version number. More...
#include <ogdf/lib/abacus/poolslotref.h>
Public Member Functions | |
PoolSlotRef (const PoolSlotRef< BaseType, CoType > &rhs) | |
Copy constructor. | |
PoolSlotRef (Master *master) | |
Creates an object referencing no pool slot. | |
PoolSlotRef (PoolSlot< BaseType, CoType > *slot) | |
Creates an object referencing a pool slot slot. | |
~PoolSlotRef () | |
The destructor. | |
BaseType * | conVar () const |
Returns a pointer to the constraint/variable stored in the referenced slot. | |
PoolSlot< BaseType, CoType > * | slot () const |
Returns a pointer to the referenced slot. | |
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 time. | |
Public Member Functions inherited from abacus::AbacusRoot | |
virtual | ~AbacusRoot () |
The destructor. | |
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. | |
PoolSlot< BaseType, CoType > * | slot_ |
A pointer to the referenced pool slot. | |
unsigned long | version_ |
The version number of the slot at construction/initialization time of this reference. | |
Friends | |
std::ostream & | operator<< (std::ostream &out, const PoolSlotRef< BaseType, CoType > &slot) |
Output operator for pool slot references. | |
Additional Inherited Members | |
Static Public Member Functions inherited from abacus::AbacusRoot | |
static bool | ascii2bool (const string &str) |
Converts the string str to a boolean value. | |
static bool | endsWith (const string &str, const string &end) |
Returns true if str ends with end, false otherwise. | |
static double | fracPart (double x) |
Returns the absolute value of the fractional part of x. | |
static const char * | onOff (bool value) |
Converts a boolean variable to the strings "on" and "off". | |
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.
Definition at line 54 of file poolslotref.h.
|
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.
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 |
Returns a pointer to the referenced slot.
Definition at line 139 of file poolslotref.h.
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.
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.