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

namespace IACommService4CSharp
{
    public class ComplexBase_t : DataValue_t
    {
        public ComplexBase_t() : base(DType.Complex)
        {
        }
        //Internal use
        public ComplexBase_t(IDataValue4CSharp value) : base(value)
        {
        }
        public object GetFieldValue(string fieldName, Type valueType = null)
        {
            DataValue_t value = null;
            var status = GetValue(fieldName, ref value);
            if (status != ErrorCode.Good)
                return null;

            var retValue = value.Get(valueType);
            value.Dispose();
            return retValue;
        }
        public uint SetFieldValue(string fieldName, object fieldValue)
        {
            var value = new DataValue_t(fieldValue);
            var status = SetValue(fieldName, value);
            value.Dispose();
            return status;
        }
    }
}
