FRAMES NO FRAMES

Macro ILOTRANSLATOR

Definition file: ilsolver/iloselector.h
ILOTRANSLATOR(name, IloObjectOut, IloObjectIn, nx)

This macro defines a translator class that translates objects of type IloObjectIn into objects of type IloObjectOut. This macro defines a class name which is a subclass of template class IloTranslator<IloObjectOut,IloObjectIn>. The use of this macro is the only way to define a new subclass of translator.

Example

This example shows how to define a translator that translates an instance of IlcIntSetVar into an IlcIntSet that represents the required set of the IlcIntSetVar:

 ILOTRANSLATOR(RequiredSetTranslator,
               IlcIntSet,
               IlcIntSetVar, v) {
  return v.getRequiredSet();
 }
 

This macro defines a class RequiredSetTranslator which is a subclass of IloTranslator<IlcIntSet,IlcIntSetVar> that can be used to transform a predicate or evaluator on IlcIntSet into the corresponding predicate or evaluator on IlcIntSetVar using operator<< as illustrated in the following code:

 IloTranslator<IlcIntSet,IlcIntSetVar> tr = RequiredSetTranslator(solver);
 IloEvaluator<IlcIntSet> setSizeEvaluator = ...;
 IloEvaluator<IlcIntSetVar> requiredSetSizeEvaluator = setSizeEvaluator << tr;
 

For more information, see Selectors.

See Also: