FRAMES NO FRAMES

Macro ILOCPTRACEWRAPPER0

Definition file: ilsolver/ilosolverint.h
ILOCPTRACEWRAPPER0(_this, solver)
ILOCPTRACEWRAPPER1(_this, solver, t1, a1)
ILOCPTRACEWRAPPER2(_this, solver, t1, a1, t2, a2)
ILOCPTRACEWRAPPER3(_this, solver, t1, a1, t2, a2, t3, a3)
ILOCPTRACEWRAPPER4(_this, solver, t1, a1, t2, a2, t3, a3, t4, a4)
ILOCPTRACEWRAPPER5(_this, solver, t1, a1, t2, a2, t3, a3, t4, a4, t5, a5)
ILOCPTRACEWRAPPER6(_this, solver, t1, a1, t2, a2, t3, a3, t4, a4, t5, a5, t6, a6)

This macro defines a trace class named _thisI with n data members. When n is greater than zero, the types and names of the data members must be supplied as arguments to the macro. Each data member is defined by its type ti and a name ai.

You can use the macro ILOCPTRACEWRAPPER to wrap an existing instance of IlcTrace when you want to use it within Concert Technology objects. In order to use an instance of IlcTrace in that way, you need to follow these steps:

  1. Use the macro to wrap the instance of IlcTrace in an instance of IloCPTrace.
  2. Use IloSolver::addTrace to add the trace to the model.

Example

Here is how to define a trace wrapper with no (zero) data members:

 ILOCPTRACEWRAPPER0(PrintConstraintTrace, solver) {
   solver.setTraceMode(IlcTrue);
   IlcPrintTrace trace(solver, IlcTraceConstraint);
   solver.setTrace(trace);
 }
 

That macro generates code similar to the following lines:

 class PrintConstraintTraceConcertI : public IloCPTraceI {
 public:
   PrintConstraintTraceConcertI();
   ~PrintConstraintTraceConcertI();
   virtual void execute(const IloSolver solver) const;
 };
 PrintConstraintTraceConcertI::PrintConstraintTraceConcertI() :
   IloCPTraceI() {}
 PrintConstraintTraceConcertI::~PrintConstraintTraceConcertI() {}
 IloCPTrace PrintConstraintTrace(IloEnv env) {
   return new (env) PrintConstraintTraceConcertI();
 }
 void PrintConstraintTraceConcertI::execute(const IloSolver solver) const
 {
   solver.setTraceMode(IlcTrue);
   IlcPrintTrace trace(solver, IlcTraceConstraint);
   solver.setTrace(trace);
 }
 

See Also: