| Overview | Group | Tree | Graph | Index | Concepts |
The ILOVISITORi macros allow you to define a new
visitor of name name for a given object class
tx and a given container class tc with i
data members of type td1...tdi.
This function's signature returns a visitor allocated on an environment or on a solver heap:
IloVisitor<tx,tc> name(IloEnv, td1, ..., tdi); IloVisitor<tx,tc> name(IloSolver, td1, ..., tdi);
Within the code of this macro, the function void visit(tx
object) allows you to specify each visited object whereas the
function IloBool keepVisiting() returns
IloFalse if it is not necessary to visit objects
anymore.
Here is an example that defines a new visitor
IntVarArrayBackwardVisitor, an instance of
IloVisitor<IloIntVar,IloIntVarArray> that visits
all the variables of an integer variable array in backward
order:
ILOVISITOR0(IntVarArrayBackwardVisitor,IloIntVar,IloIntVarArray,array) {
for (IloInt i=array.getSize()-1; i>=0; --i)
visit(array[i]);
}
For more information, see Selectors.
See Also: