Overview | Group | Tree | Graph | Index | Concepts |
This class makes it possible for you to define predicates operating on
arbitrary objects. A predicate is an object with a method (IlcAnyPredicate::isTrue
) that checks whether or not a
property is satisfied by an ordered set of (pointers to) objects. The
ordered set is conventionally represented in Solver by an instance of
IlcAnyArray
.
Defining a New Class of Predicates
Predicates, like other Solver objects, depend on two classes: a handle
class, IlcAnyPredicate
, and an implementation class,
IlcAnyPredicateI
, where an object of the
handle class contains a data member (the handle pointer) that points to an
object (its implementation object) of an instance of
IlcAnyPredicateI
allocated on the Solver heap. As a Solver
user, you will be working primarily with handles.
If you define a new class of predicates yourself, you must define its
implementation class together with the corresponding virtual member function
isTrue
, as well as a member function that returns an instance
of the handle class IlcAnyPredicate
.
Arity
As a developer, you can use predicates in Solver applications to define
your own constraints that have not already been predefined in Solver. In
that case, the arity of the predicate (that is, the number of
constrained variables involved in the predicate, and thus the size of the
array that the member function IlcAnyPredicate::isTrue
must check) must be less than or
equal to three.
See Also:
IlcAnyArray, ILCANYPREDICATE0, IlcIntPredicate, IlcTableConstraint
Constructor Summary | |
---|---|
public | IlcAnyPredicate() |
public | IlcAnyPredicate(IlcAnyPredicateI * impl) |
Method Summary | |
---|---|
public IlcAnyPredicateI * | getImpl() const |
public IlcBool | isTrue(IlcAnyArray val) |
public void | operator=(const IlcAnyPredicate & h) |
Constructor Detail |
---|
This constructor creates an empty handle. You must initialize it before you use it.
This constructor creates a handle object from a pointer to an implementation object.
Method Detail |
---|
This member function returns a pointer to the implementation object of the invoking handle.
This member function calls the member function IlcAnyPredicateI::isTrue
.
This operator assigns an address to the handle pointer of the invoking object. That address is the location of the implementation object of the provided argument.