2.5 The class OZ_CtVar

The constraint system dependent part of a class derived from OZ_CtVar stores typically

The constraint C is used to handle constraints of global variables. The constraint EC is used to handle encapsulate propagation typically occurring in reified constraints. The reference to a constraint CR is used to access the actual constraint and thus to be able to modify it. It either points to C, EC, or directly to the constraint associated with a constrained variable.

2.5.1 Members to be Defined

ctSetValue

virtual void ctSetValue(OZ_Term t) = 0;

Initializes C to the value denoted by t and makes CR pointing to C.

ctRefConstraint

virtual OZ_Ct * ctRefConstraint(OZ_Ct * c) = 0;

Sets CR to c and returns CR.

ctSaveConstraint

virtual OZ_Ct * ctSaveConstraint(OZ_Ct * c) = 0;

Stores c in C and returns a reference to C.

ctSaveEncapConstraint

virtual OZ_Ct * ctSaveEncapConstraint(OZ_Ct * c) = 0;

Stores c in EC and returns a reference to EC.

ctRestoreConstraint

virtual void ctRestoreConstraint(void) = 0;

Stores C at *CR.

ctSetConstraintProfile

virtual void ctSetConstraintProfile(void) = 0;

Initializes CP with the profile of CR.

ctGetConstraintProfile

virtual OZ_CtProfile * ctGetConstraintProfile(void) = 0;

Returns CP.

ctGetConstraint

virtual OZ_Ct * ctGetConstraint(void) = 0;

Returns CR.

isTouched

virtual OZ_Boolean isTouched(voidconst = 0;

Returns OZ_True if current constraint is not implied anymore by the constraint that was present upon calling read() or readEncap().

2.5.2 Provided Members

OZ_CtVar

OZ_CtVar(void);

Initializes an instance of this class.

operator new

static void * operator new(size_t);

Allocates memory for an instance of a class derived from OZ_CtVar on the propagator heap of the Oz runtime system.

operator delete

static void operator delete(void *, size_t);

Deallocates memory of an instance of a class derived from OZ_CtVar from the propagator heap of the Oz runtime system.

operator new[]

static void * operator new[](size_t);

Allocates memory for an array of instances of a class derived from OZ_CtVar on the propagator heap of the Oz runtime system.

operator delete[]

static void operator delete[](void *, size_t);

Deallocates memory of an array of instances of a class derived from OZ_CtVar from the propagator heap of the Oz runtime system.

ask

void ask(OZ_Term);

Initializes an instance of a derived class of OZ_CtVar for reading the constraint of the corresponding variable. The members leave() and fail() must not be called.

read

void read(OZ_Term);

Initializes an instance of a derived class of OZ_CtVar for accessing the corresponding variable in the constraint store for constraint propagation. Modifying the constraint is visible in the store. The members leave() and fail() must be called.

readEncap

void readEncap(OZ_Term);

Initializes an instance of a derived class of OZ_CtVar for accessing the corresponding variable in the constraint store for encapsulated constraint propagation (typically used for reified constraints). Modifying the constraint is not visible in the store. The members leave() and fail() must be called.

leave

OZ_Boolean leave(void);

This member function has to be called if the instance of a derived class of OZ_CtVar has been initialized by read() resp. readEncap() and the constraint represented by the propagator is consistent with the constraint store. It returns OZ_False if the corresponding variable denotes a value. Otherwise it returns OZ_True. Further, this member function causes suspending computation to be woken up.

fail

void fail(void);

This member function has to be called if the instance of a derived class of OZ_CtVar has been initialized by read()resp. readEncap() and the constraint represented by the propagator is inconsistent with the constraint store.

dropParameter

void dropParameter(void);

This member function removes the parameter associated with *this from the parameter set of the current propagator. This function takes care of multiple occurrences of a single variable as parameter, i.e., a parameter is removed if there is only one occurrence of the corresponding variable in the set of parameter left.


Tobias Müller
Version 1.4.0 (20080702)