FRAMES NO FRAMES

Macro ILCUSERSHIFTOBJECT

Definition file: ilsched/shifts.h
ILCUSERSHIFTOBJECT(name, start, end, ilcAct, isMin)

This macro defines a user shift object, subclass of IlcUserShiftObject), named name. The referenced arguments start and end define the interval [start, end) to be propagated. This time interval corresponds to a possible position for the activity ilcAct. When the argument isMin is true, the interval [start, end) is the first possible position of the activity, that is, [startMin, endMin). Otherwise, the interval is the last possible position, that is, [startMax, endMax). Then the body of the macro has to affect valid values to start and end arguments.

Notice that the written code must return IlcTrue when the computed interval [start, end) is valid, and returns IlcFalse in case of fail.

For example, the following code defines a shift object that forbide beginning or ending during a week-end:

   ILCUSERSHIFTOBJECT(userWeekEndShift, start, end, ilcAct, isMin) {
     const IlcInt delta = (isMin) ? 7 : 4;
     if (start % 7 > 4) then start = (start / 7) *7 + delta;
     if (end   % 7 > 4) then end   = (end   / 7) *7 + delta;
     return IlcTrue;
   }
 

The use of this macro is the only way to define a new subclass of IlcShiftObject.

Since the argument nameI (name followed by "I") is used to name the use shift object class, it is not possible to use the same nameI for other classes.

See Also: