Beispiel #1
0
        // return the current value for a given output

        /*-------------------------------------------------
        *   output_get_value - return the value of an
        *   output
        *  -------------------------------------------------*/
        public int get_value(string outname)
        {
            output_item item = find_item(outname);

            // if no item, value is 0
            return(item != null?item.get() : 0);
        }
Beispiel #2
0
        /*-------------------------------------------------
        *   create_new_item - create a new item
        *  -------------------------------------------------*/
        output_item create_new_item(string outname, int value)
        {
            var output_item = new output_item(this, outname, m_uniqueid++, value);
            var ins         = m_itemtable.emplace(
                //std::piecewise_construct,
                outname,         //std::forward_as_tuple(outname),
                output_item);    // std::forward_as_tuple(this, outname, m_uniqueid++, value));

            assert(ins);         //ins.second);
            return(output_item); //ins.first.second;
        }
Beispiel #3
0
        // set the value for a given output

        /*-------------------------------------------------
        *   output_set_value - set the value of an output
        *  -------------------------------------------------*/
        void set_value(string outname, int value)
        {
            output_item item = find_item(outname);

            // if no item of that name, create a new one and force notification
            if (item == null)
            {
                create_new_item(outname, value).notify(value);
            }
            else
            {
                item.set(value); // set the new value (notifies on change)
            }
        }
Beispiel #4
0
        /*-------------------------------------------------
        *   create_new_item - create a new item
        *  -------------------------------------------------*/
        output_item create_new_item(string outname, int value)
        {
            if (OUTPUT_VERBOSE)
            {
                osd_printf_verbose("Creating output {0} = {1}{2}\n", outname, value, m_save_data != null ? " (will not be saved)" : "");
            }

            var output_item = new output_item(this, outname, m_uniqueid++, value);
            var ins         = m_itemtable.emplace(
                //std::piecewise_construct,
                outname,         //std::forward_as_tuple(outname),
                output_item);    // std::forward_as_tuple(this, outname, m_uniqueid++, value));

            assert(ins);         //ins.second);
            return(output_item); //ins.first.second;
        }
Beispiel #5
0
        // set a notifier on a particular output, or globally if nullptr

        /*-------------------------------------------------
        *   output_set_notifier - sets a notifier callback
        *   for a particular output, or for all outputs
        *   if nullptr is specified
        *  -------------------------------------------------*/
        public void set_notifier(string outname, output_notifier_func callback, object param)  //void *param)
        {
            // if an item is specified, find/create it
            if (outname != null)
            {
                output_item item = find_item(outname);
                if (item != null)
                {
                    item.set_notifier(callback, param);
                }
                else
                {
                    create_new_item(outname, 0).set_notifier(callback, param);                                                         // (item ? *item : create_new_item(outname, 0)).set_notifier(callback, param);
                }
            }
            else
            {
                m_global_notifylist.emplace_back(new output_notify(callback, param));
            }
        }
Beispiel #6
0
        public output_item find_or_create_item(string outname, s32 value)
        {
            output_item item = find_item(outname);

            return(item != null ? item : create_new_item(outname, value));
        }
Beispiel #7
0
        // set a notifier on a particular output
        //-------------------------------------------------
        //  set_notifier - sets a notifier callback for a
        //  particular output
        //-------------------------------------------------
        public void set_notifier(string outname, notifier_func callback, object param)  //void set_notifier(std::string_view outname, notifier_func callback, void *param);
        {
            output_item item = find_item(outname);

            (item != null ? item : create_new_item(outname, 0)).set_notifier(callback, param);
        }
Beispiel #8
0
            //item_proxy() = default;

            //**************************************************************************
            //  OUTPUT ITEM PROXY
            //**************************************************************************
            public void resolve(device_t device, string name)
            {
                assert(m_item == null);
                m_item = device.machine().output().find_or_create_item(name, 0);
            }