FRAMES NO FRAMES

Macro ILOVISITOR0

Definition file: ilsolver/iloselector.h
ILOVISITOR0(name, tx, tc, nc)
ILOVISITOR1(name, tx, tc, nc, td, nd)
ILOVISITOR2(name, tx, tc, nc, td1, nd1, td2, nd2)
ILOVISITOR3(name, tx, tc, nc, td1, nd1, td2, nd2, td3, nd3)
ILOVISITOR4(name, tx, tc, nc, td1, nd1, td2, nd2, td3, nd3, td4, nd4)
ILOVISITOR5(name, tx, tc, nc, td1, nd1, td2, nd2, td3, nd3, td4, nd4, td5, nd5)
ILOVISITOR6(name, tx, tc, nc, td1, nd1, td2, nd2, td3, nd3, td4, nd4, td5, nd5, td6, nd6)
ILOVISITOR7(name, tx, tc, nc, td1, nd1, td2, nd2, td3, nd3, td4, nd4, td5, nd5, td6, nd6, td7, nd7)

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: