Пример #1
0
        /** @copydoc LayerParameterBase::Clone */
        public override LayerParameterBase Clone()
        {
            ExpParameter p = new ExpParameter();

            p.Copy(this);
            return(p);
        }
Пример #2
0
        /** @copydoc LayerParameterBase::Copy */
        public override void Copy(LayerParameterBase src)
        {
            ExpParameter p = (ExpParameter)src;

            m_dfBase  = p.m_dfBase;
            m_dfScale = p.m_dfScale;
            m_dfShift = p.m_dfShift;
        }
Пример #3
0
        /** @copydoc LayerParameterBase::Load */
        public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
        {
            RawProto     proto = RawProto.Parse(br.ReadString());
            ExpParameter p     = FromProto(proto);

            if (!bNewInstance)
            {
                Copy(p);
            }

            return(p);
        }
Пример #4
0
        /// <summary>
        /// Parses the parameter from a RawProto.
        /// </summary>
        /// <param name="rp">Specifies the RawProto to parse.</param>
        /// <returns>A new instance of the parameter is returned.</returns>
        public static ExpParameter FromProto(RawProto rp)
        {
            string       strVal;
            ExpParameter p = new ExpParameter();

            if ((strVal = rp.FindValue("base")) != null)
            {
                p.base_val = double.Parse(strVal);
            }

            if ((strVal = rp.FindValue("scale")) != null)
            {
                p.scale = double.Parse(strVal);
            }

            if ((strVal = rp.FindValue("shift")) != null)
            {
                p.shift = double.Parse(strVal);
            }

            return(p);
        }