1.4 The class OZ_FDIntVar

## 1.4 The class `OZ_FDIntVar`

An instance of this class is a mapping of a finite domain integer 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.4.1 Constructor Member Functions

`OZ_FDIntVar` [constructor]

  > `OZ_FDIntVar(void);`

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

`OZ_FDIntVar` [constructor]

  > `OZ_FDIntVar(OZ_Term v);`

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

### 1.4.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_FDIntVar`. This operator must only be used inside the function `propagate()` of 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_FDIntVar`. This operator must only be used inside the function `propagate()` of 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_FiniteDomain &operator * (void);`

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

`operator ->` [operator member function]

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

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

### 1.4.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 the domain and otherwise `OZ_FALSE`.

`ask` [member function]

  > `void ask(OZ_Term);`

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

`read` [member function]

  > `int read(OZ_Term);`

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

`readEncap` [member function]

  > `int readEncap(OZ_Term);`

  This member function initialises an instance of `OZ_FDIntVar` for constraints to be read from the constraint store and to perform encapsulated constraint propagation as required by reified constraint propagators. It returns the size of the domain. 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_FDIntVar` when leaving the function `propagate()` of class `OZ_Propagator` and no inconsistency was detected (except it was initialised with `ask()`). This member function returns `OZ_FALSE` if the domain denotes a singleton. Otherwise it returns `OZ_TRUE`.

`fail` [member function]

  > `void fail(void);`

  This member function has to be applied to each object of type `OZ_FDIntVar` 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.