예제 #1
0
 /// <summary>
 /// Returns true if a cast must be performed when 'FT' is assigned to this floatType.
 /// For example, when assigning a float to a double, not cast needs to be performed because
 /// no precision is lost. The other way around, precision _is_ lost, and a should be performed
 /// to avoid compiler warnings.
 ///
 /// Always returns true when src/dst float type is unknown.
 /// </summary>
 /// <param name="S">Used for output language.</param>
 /// <param name="FT"></param>
 /// <returns>true if a cast must be performed when 'FT' is assigned to this floatType.</returns>
 public bool MustCastIfAssigned(Specification S, FloatType FT)
 {
     if ((type == "float") && (FT.type == "float"))
     {
         return(false);
     }
     else if ((type == "double") && ((FT.type == "float") || (FT.type == "double")))
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
예제 #2
0
        /// <summary>
        /// Determines whether this fgs is a converter for destination 'type'/'FT'.
        /// </summary>
        public bool IsConverterDestination(Specification S, G25.SMV smv, FloatType FT)
        {
            if (!IsConverter(S))
            {
                return(false);
            }

            if (!Name.Equals("_" + smv.GetName()))
            {
                return(false);
            }
            foreach (string floatName in FloatNames)
            {
                if (floatName.Equals(FT.type))
                {
                    return(true);
                }
            }
            return(false);
        }
예제 #3
0
        /// <summary>
        /// Determines whether this fgs is a converter with source 'type'/'FT'.
        /// </summary>
        public bool IsConverterSource(Specification S, G25.SMV smv, FloatType FT)
        {
            if (!IsConverter(S))
            {
                return(false);
            }

            if (!ArgumentTypeNames[0].Equals(smv.GetName()))
            {
                return(false);
            }
            foreach (string floatName in FloatNames)
            {
                if (floatName.Equals(FT.type))
                {
                    return(true);
                }
            }
            return(false);
        }
예제 #4
0
파일: fgs.cs 프로젝트: Sciumo/gaigen
        /// <summary>
        /// Determines whether this fgs is a converter with source 'type'/'FT'.
        /// </summary>
        public bool IsConverterSource(Specification S, G25.SMV smv, FloatType FT)
        {
            if (!IsConverter(S)) return false;

            if (!ArgumentTypeNames[0].Equals(smv.GetName())) return false;
            foreach (string floatName in FloatNames)
            {
                if (floatName.Equals(FT.type)) return true;
            }
            return false;
        }
예제 #5
0
파일: fgs.cs 프로젝트: Sciumo/gaigen
        /// <summary>
        /// Determines whether this fgs is a converter for destination 'type'/'FT'.
        /// </summary>
        public bool IsConverterDestination(Specification S, G25.SMV smv, FloatType FT)
        {
            if (!IsConverter(S)) return false;

            if (!Name.Equals("_" + smv.GetName())) return false;
            foreach (string floatName in FloatNames)
            {
                if (floatName.Equals(FT.type)) return true;
            }
            return false;
        }
예제 #6
0
파일: floattype.cs 프로젝트: Sciumo/gaigen
 /// <summary>
 /// Returns true if a cast must be performed when 'FT' is assigned to this floatType.
 /// For example, when assigning a float to a double, not cast needs to be performed because
 /// no precision is lost. The other way around, precision _is_ lost, and a should be performed
 /// to avoid compiler warnings.
 /// 
 /// Always returns true when src/dst float type is unknown.
 /// </summary>
 /// <param name="S">Used for output language.</param>
 /// <param name="FT"></param>
 /// <returns>true if a cast must be performed when 'FT' is assigned to this floatType.</returns>
 public bool MustCastIfAssigned(Specification S, FloatType FT)
 {
     if ((type == "float") && (FT.type == "float")) return false;
     else if ((type == "double") && ((FT.type == "float") || (FT.type == "double"))) return false;
     else return true;
 }