using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IACommService4CSharp
{
    public abstract class IDataChangeCallback_t : IDataChangeCallback4CSharp
    {
        public IDataChangeCallback_t()
        {
        }
        ~IDataChangeCallback_t()
        {
        }
        //Internal use
        public override void DataChange(uint handler, string[] addresses, IDataItem4CSharp[] dataItems)
        {
            List<string> addressList = new List<string> { };
            List<DataItem_t> dataItemList = new List<DataItem_t> { };
            for (int index = 0; index < dataItems.Length; index++)
            {
                if (null == dataItems[index])
                    continue;

                addressList.Add(addresses[index]);
                dataItemList.Add(new DataItem_t(dataItems[index]));
            }

            DataChange(addressList.ToArray(), dataItemList.ToArray());
        }
        public abstract void DataChange(string[] addresses, DataItem_t[] dataItems);
    }
}
