public SubDaIBase(string key,
                   DICnvtrBase cnvtr0,
                   DICnvtrBase cnvtr1)
     : base(key, key, cnvtr0, cnvtr1)
 {
     _key = key;
 }
 public SubDaIBase(string key,
                   string longname,
                   string shortname,
                   DICnvtrBase cnvtr0,
                   DICnvtrBase cnvtr1)
     : base(longname, shortname, cnvtr0, cnvtr1)
 {
     _key = key;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Use current measurement system and get the convertor for it.
        /// </summary>
        public DICnvtrBase GetCv()
        {
            DICnvtrBase cv = null;

            _cnvtrStore.TryGetValue(_measSys, out cv);
            if (cv == null)
            {
                _cnvtrStore.TryGetValue('X', out cv);
            }
            return(cv);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Set the value from a string or raw data.  Does not send it to ElectroCraft drive!
        /// Note the default on raw data is to store it without modification.
        /// </summary>
        /// <returns>
        /// true - string/raw data valid, value set
        /// false - string/raw data screwed up somehow, value unchanged
        /// </returns>
        public bool SetIn(string val)
        {
            bool        r  = false;
            DICnvtrBase cv = GetCv();

            if (cv != null)
            {
                r = cv.ConvertIn(val, ref _rd);
            }
            // implied else is do nothing
            return(r);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Current value as represented by measurement system and units;
        /// does not include the unit string itself.
        /// Raw data version is just that.
        /// Note the default on raw data is to serve it without modification.
        /// </summary>
        public void GetOut(out string o)
        {
            DICnvtrBase cv = GetCv();

            if (cv != null)
            {
                o = cv.ConvertOut(_rd);
            }
            else
            {
                o = "";
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Recommended background color for the present data.
        /// </summary>
        public string BackGColor()
        {
            DICnvtrBase cv = GetCv();

            if (cv != null)
            {
                return(cv.BackGColor(_rd));
            }
            else
            {
                return(null);  // doesn't override existing color
            }
        }
        public void GetOut(out string o, DaIBase src)
        {
            DICnvtrBase cv = GetCv();

            if (cv != null)
            {
                uint myrd;
                src.GetOut(out myrd);
                o = cv.ConvertOut(myrd);
            }
            else
            {
                o = "";
            }
        }
        public bool SetIn(string val, DaIBase src)
        {
            bool        r  = false;
            DICnvtrBase cv = GetCv();

            if (cv != null)
            {
                uint myrd;
                src.GetOut(out myrd);
                r = cv.ConvertIn(val, ref myrd);
                src.SetIn(myrd);
            }
            // implied else is do nothing
            return(r);
        }
        public string BackGColor(DaIBase src)
        {
            DICnvtrBase cv = GetCv();

            if (cv != null)
            {
                uint myrd;
                src.GetOut(out myrd);
                return(cv.BackGColor(myrd));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 10
0
 /// <summary>
 /// Unique key is deferred.
 /// May have long/short names;
 /// conversions may be null or X.
 /// </summary>
 public AbstDaI(
     string longname,
     string shortname,
     DICnvtrBase cnvtr0,
     DICnvtrBase cnvtr1)
 {
     _longName  = longname;
     _shortName = shortname;
     if (cnvtr0 != null)
     {
         AddCv(cnvtr0);
     }
     if (cnvtr1 != null)
     {
         AddCv(cnvtr1);
     }
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Remove convertor.
 /// </summary>
 public void RemCv(DICnvtrBase cv)
 {
     _cnvtrStore.Remove(cv.MeasSys);
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Add another convertor.
 /// </summary>
 public void AddCv(DICnvtrBase cv)
 {
     _cnvtrStore.Add(cv.MeasSys, cv);
 }