1.6 The class OZ_FSetVar

## 1.6 The class `OZ_FSetVar`

An instance of this class is a mapping of a finite set constraint variable on the heap of the emulator to a C/C++ data structure. The provided functionality allows to directly manipulate the domain (constraint) of the heap variable.

### 1.6.1 Constructor Member Functions

`OZ_FSetVar` [constructor]

  > `OZ_FSetVar(void);`

  This constructor creates an uninitialised instance of the class `OZ_FSetVar`, which can be initialised later by the member functions `ask()`, `read()`, or `readEncap()`.

`OZ_FSetVar` [overloaded constructor]

  > `OZ_FSetVar(OZ_Term v);`

  This constructor creates an instance of the class `OZ_FSetVar` and initialises it using `read()`.

### 1.6.2 Operator Member Functions

`new` [static operator member function]

  > `static void * operator new(size_t);`

  This operator allocates memory for a single instance of class `OZ_FSetVar`. This operator must only be used inside the member function `propagate()` of the class `OZ_Propagator`. The allocated memory is automatically reclaimed when `propagate()` is left.

`new[]` [static operator member function]

  > `static void * operator new[](size_t);`

  This operator allocates memory for an array of instances of `OZ_FSetVar`. This operator must only be used inside the member function `propagate()` of the class `OZ_Propagator`. The allocated memory is automatically reclaimed when `propagate()` is left.

`delete` [static operator member function]

  > `static void operator delete(void *, size_t);`

  This operator is a dummy since reclaiming memory happens automatically.

`delete[]` [static operator member function]

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

  This operator is a dummy since reclaiming memory happens automatically.

`operator *` [operator member function]

  > `OZ_FSetConstraint &operator * (void);`

  This operator returns a finite set constraint representing the constraint of this variable.

`operator ->` [operator member function]

  > `OZ_FSetConstraint * operator -> (void);`

  This operator returns a pointer to a finite set constraint representing the constraint of this variable.

### 1.6.3 Member Functions

`isTouched` [constant member function]

  > `OZ_Boolean isTouched(void) const;`

  This function returns `OZ_TRUE` if at least one element has been removed from or added to the set and otherwise `OZ_FALSE`.

`ask` [member function]

  > `void ask(OZ_Term);`

  This member function initialises an instance of `OZ_FSetVar` for only reading constraints from the store and it does not require a call of `leave()` or `fail()`.

`read` [member function]

  > `void read(OZ_Term);`

  This member function initialises an instance of `OZ_FSetVar` for constraints to be read from and to be written to the constraint store. Using this function requires to call either `leave()` or `fail()` when leaving the member function `propagate()` of class `OZ_Propagator`.

`readEncap` [member function]

  > `void readEncap(OZ_Term);`

  This member function initialises an instance of `OZ_FSetVar` for constraints to be read from the constraint store and to perform encapsulated constraint propagation as required by reified constraint propagators. Using this function requires to call either `leave()` or `fail()` when leaving the member function `OZ_Propagator::propagate()`. For further details see Section 1.7.3 of ``The Mozart Constraint Extensions Tutorial''.

`leave` [member function]

  > `OZ_Boolean leave(void);`

  This member function has to be applied to each object of type `OZ_FSetVar` when leaving the function `propagate()` of class `OZ_Propagator` and no inconsistency was detected (except it was initialised with `ask()`). If the set constraint denotes a set value this member function returns `OZ_FALSE` and else it returns `OZ_TRUE`.

`fail` [member function]

  > `void fail(void);`

  This member function has to be applied to each object of type `OZ_FSetVar` when leaving the function `propagate()` of class `OZ_Propagator` and inconsistency was detected (except it was initialised with `ask()`).

`dropParameter` [member function]

  > `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.