Example #1
0
void MessageSendController::sendMessage(int outletIndex, PdMessage *message) {
  if (outletIndex == SYSTEM_NAME_INDEX) {
    context->receiveSystemMessage(message);
  } else {
    set<RemoteMessageReceiver *> receiverSet = sendStack[outletIndex].second;
    for (set<RemoteMessageReceiver *>::iterator it = receiverSet.begin(); it != receiverSet.end(); ++it) {
      RemoteMessageReceiver *receiver = *it;
      receiver->receiveMessage(0, message);
    }
  }
}
void MessageSendController::sendMessage(int outletIndex, PdMessage *message) {
    if (outletIndex < 0) {
        return; // outlet index does not exist
    } else if (outletIndex == SYSTEM_NAME_INDEX) {
        context->receiveSystemMessage(message);
    } else {
        ZGLinkedList *receiverList = (ZGLinkedList *) receiverLists->get(outletIndex);
        receiverList->resetIterator();
        RemoteMessageReceiver *receiver = NULL;
        while ((receiver = (RemoteMessageReceiver *) receiverList->getNext()) != NULL) {
            receiver->receiveMessage(0, message);
        }
    }
}