Example #1
0
/**
 * Associate an action with a set of values on a particular slot.
 * @param slot the slot offset
 * @param slot_values a vector of ValueIntervals to trigger this action
 * @param action the Action object to use
 */
void SetSlotAction(unsigned int slot,
                   IntervalList *slot_intervals,
                   Action *rising_action,
                   Action *falling_action) {
  CheckSlotOffset(slot);
  slot--;  // convert from 1 to 0 indexed slots
  Slot *slots = LookupSlot(slot);

  IntervalList::iterator iter = slot_intervals->begin();
  for (; iter != slot_intervals->end(); iter++) {
    if (!slots->AddAction(**iter, rising_action, falling_action)) {
      OLA_FATAL << "Line " << yylineno << ": value " << **iter <<
         " collides with existing values.";
      exit(ola::EXIT_DATAERR);
    }
    delete  *iter;
  }
  delete slot_intervals;
}