| Overview | Group | Tree | Graph | Deprecated | Index | Concepts |

IlcRevFloat is a reversible version of the basic predefined
type, IlcFloat. The reversible version makes it easier
to restore a previous state. This class has a value data member
corresponding to IlcFloat. This value data member is
automatically restored when CP Optimizer backtracks.
This class is not a handle class. Objects of this class should
be used directly, that is, not through pointers to them. Do not
create instances of IlcRevFloat as automatic objects (that is,
as objects allocated on the C++ stack). Do not pass them by
value.
An object of the class IlcRevFloat is automatically cast to
the basic type IlcFloat, if needed. Instances of this
reversible class can be used as data members. However, do not use them
as types for automatic variables, where “automatic” has its
usual C++ meaning, as this practice would create memory-access errors. Do
not pass them as arguments.
An instance of IlcRevFloat behaves very much like an
instance of IlcFloat; the difference in their behavior has to
do with assignments. Indeed, all reversible assignments are undone when
CP Optimizer backtracks.
For more information, see the concepts State in CP Optimizer and Reversibility in CP Optimizer.
See Also:
IlcRevAny, IlcRevBool, IlcRevInt
| Method Summary | |
|---|---|
public IlcFloat | getValue() const |
public | IlcRevFloat(IlcCPEngine solver, IlcFloat initValue=0.) |
public | operator IlcFloat() const |
public void | setValue(IlcCPEngine solver, IlcFloat value) |
| Method Detail |
|---|
The constructor creates a new object,
an instance of IlcRevFloat.
This member function accesses the value of the instance of IlcRevFloat.
This operator returns the value of the instance of IlcRevFloat.
In other words, this operator automatically casts an instance of IlcRevFloat
into an instance of IlcFloat.
This member function modifies the value of the invoking object by reversibly
assigning value to it. When CP Optimizer backtracks, this reversible modification will be undone.