void output_manager::set_value(const char *outname, INT32 value) { output_item *item = find_item(outname); INT32 oldval; /* if no item of that name, create a new one and send the item's state */ if (item == nullptr) { item = create_new_item(outname, value); oldval = value + 1; } else { /* set the new value */ oldval = item->value; item->value = value; } /* if the value is different, signal the notifier */ if (oldval != value) { /* call the local notifiers first */ for (auto notify : item->notifylist) (*notify.m_notifier)(outname, value, notify.m_param); /* call the global notifiers next */ for (auto notify : m_global_notifylist) (*notify.m_notifier)(outname, value, notify.m_param); } }
void output_manager::set_value(const char *outname, int32_t value) { output_item *item = find_item(outname); int32_t oldval; /* if no item of that name, create a new one and send the item's state */ if (item == nullptr) { item = create_new_item(outname, value); oldval = value + 1; } else { /* set the new value */ oldval = item->value; item->value = value; } /* if the value is different, signal the notifier */ if (oldval != value) { if (OUTPUT_VERBOSE) machine().logerror("Output %s = %d (was %d)\n", outname, value, oldval); /* call the local notifiers first */ for (auto notify : item->notifylist) (*notify.m_notifier)(outname, value, notify.m_param); /* call the global notifiers next */ for (auto notify : m_global_notifylist) (*notify.m_notifier)(outname, value, notify.m_param); } }
void output_set_value(const char *outname, INT32 value) { output_item *item = find_item(outname); INT32 oldval; /* if no item of that name, create a new one and send the item's state */ if (item == NULL) { item = create_new_item(outname, value); oldval = value + 1; } else { /* set the new value */ oldval = item->value; item->value = value; } /* if the value is different, signal the notifier */ if (oldval != value) { /* call the local notifiers first */ for (output_notify *notify = item->notifylist.first(); notify != NULL; notify = notify->next()) (*notify->m_notifier)(outname, value, notify->m_param); /* call the global notifiers next */ for (output_notify *notify = global_notifylist.first(); notify != NULL; notify = notify->next()) (*notify->m_notifier)(outname, value, notify->m_param); } }
void output_set_notifier(const char *outname, output_notifier_func callback, void *param) { /* if an item is specified, find it */ if (outname != nullptr) { output_item *item = find_item(outname); /* if no item of that name, create a new one */ if (item == nullptr) item = create_new_item(outname, 0); item->notifylist.append(*global_alloc(output_notify(callback, param))); } else global_notifylist.append(*global_alloc(output_notify(callback, param))); }
void output_manager::set_notifier(const char *outname, output_notifier_func callback, void *param) { output_notify notify(callback, param); /* if an item is specified, find it */ if (outname != nullptr) { output_item *item = find_item(outname); /* if no item of that name, create a new one */ if (item == nullptr) item = create_new_item(outname, 0); item->notifylist.push_back(notify); } else m_global_notifylist.push_back(notify); }