当前位置: 首页>>代码示例>>C#>>正文


C# FloatType类代码示例

本文整理汇总了C#中FloatType的典型用法代码示例。如果您正苦于以下问题:C# FloatType类的具体用法?C# FloatType怎么用?C# FloatType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FloatType类属于命名空间,在下文中一共展示了FloatType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateSyntheticSMVtype

        public static G25.VariableType CreateSyntheticSMVtype(Specification S, CGdata cgd, FloatType FT, RefGA.Multivector value)
        {
            // make up list of basis blades
            rsbbp.BasisBlade[] L = new rsbbp.BasisBlade[value.BasisBlades.Length];
            for (int i = 0 ; i < value.BasisBlades.Length; i++)
            {
                RefGA.BasisBlade B = value.BasisBlades[i];
                if (B.symScale == null) L[i] = new rsbbp.BasisBlade(new RefGA.BasisBlade(B.bitmap), B.scale); // constant value
                else L[i] = new rsbbp.BasisBlade(new RefGA.BasisBlade(B.bitmap)); // non-const value
            }

            // get other required info
            String name = "nameOfType";
            SMV.MULTIVECTOR_TYPE mvType = SMV.MULTIVECTOR_TYPE.MULTIVECTOR;
            String comment = "MISSING; PLEASE ADD TO SPECIFICATION";
            //String constantName = null;

            // create the type
            G25.SMV synSMV = new G25.SMV(name, L, mvType, comment);

            // throw exception
            throw new G25.UserException("Missing specialized multivector type.\n" +
                "Please add the following XML to the specification to fix the dependency:\n" +
                XML.SMVtoXmlString(S, synSMV));
        }
开发者ID:Sciumo,项目名称:gaigen,代码行数:25,代码来源:specializedreturntype.cs

示例2: WriteDefinition

        private static void WriteDefinition(StringBuilder SB, Specification S, G25.CG.Shared.CGdata cgd, FloatType FT, G25.Constant C)
        {
            // assume only SMV constants for now
            G25.SMV smv = C.Type as G25.SMV;
            ConstantSMV Csmv = C as ConstantSMV;

            // MANGLED_TYPENAME MANGLED_CONSTANT_NAME = {...}
            SB.Append(FT.GetMangledName(S, C.Type.GetName()));
            SB.Append(" ");
            SB.Append(FT.GetMangledName(S, C.Name));
            SB.Append(" = {");

            if (smv.NbNonConstBasisBlade == 0)
            {
                // 'C' does not allow empty structs, so there is a filler that must be initialized
                SB.Append("0");
            }
            else
            {
                if (S.m_coordStorage == COORD_STORAGE.ARRAY)
                    SB.Append("{");

                for (int c = 0; c < smv.NbNonConstBasisBlade; c++)
                {
                    if (c > 0) SB.Append(", ");
                    SB.Append(FT.DoubleToString(S, Csmv.Value[c]));
                }

                if (S.m_coordStorage == COORD_STORAGE.ARRAY)
                    SB.Append("}");
            }

            SB.AppendLine("};");
        }
开发者ID:Sciumo,项目名称:gaigen,代码行数:34,代码来源:constants.cs

示例3: WriteDefinition

        private static void WriteDefinition(StringBuilder SB, Specification S, G25.CG.Shared.CGdata cgd, FloatType FT, G25.Constant C)
        {
            // assume only SMV constants for now
            G25.SMV smv = C.Type as G25.SMV;
            ConstantSMV Csmv = C as ConstantSMV;

            string className = FT.GetMangledName(S, smv.Name);

            // MANGLED_TYPENAME MANGLED_CONSTANT_NAME = {...}
            SB.Append(className);
            SB.Append(" ");
            SB.Append(FT.GetMangledName(S, C.Name));

            if (smv.NbNonConstBasisBlade > 0) {
                // MANGLED_TYPENAME MANGLED_CONSTANT_NAME(...)
                SB.Append("(" + className + "::" + G25.CG.Shared.SmvUtil.GetCoordinateOrderConstant(S, smv));

                for (int c = 0; c < smv.NbNonConstBasisBlade; c++)
                {
                    SB.Append(", ");
                    SB.Append(FT.DoubleToString(S, Csmv.Value[c]));
                }

                SB.Append(")");
            }

            SB.AppendLine(";");
        }
开发者ID:Sciumo,项目名称:gaigen,代码行数:28,代码来源:constants.cs

示例4: WriteFunctionShortcut

        /// <summary>
        /// Writes a shortcut for 'type', 'fgs'.
        /// </summary>
        /// <param name="SB">Where the code goes.</param>
        /// <param name="S">Used for basis vector names and output language.</param>
        /// <param name="cgd">Not used yet.</param>
        /// <param name="FT">Float point type of 'type'.</param>
        /// <param name="type">The type for which shortcuts should be written.</param>
        /// <param name="fgs"></param>
        /// <param name="FAI"></param>
        public static void WriteFunctionShortcut(StringBuilder SB, Specification S, G25.CG.Shared.CGdata cgd, FloatType FT, G25.VariableType type,
            G25.fgs fgs, FuncArgInfo[] FAI)
        {
            int nbTabs = 1;

            FuncArgInfo[] tailFAI = getTail(FAI);

            string shortcutCall = getShortcutCall(S, fgs, tailFAI);

            SB.AppendLine("");

            // output comment
            new Comment("shortcut to " + shortcutCall).Write(SB, S, nbTabs);

            bool inline = false;
            bool staticFunc = false;
            string returnType = FT.GetMangledName(S, fgs.ReturnTypeName);
            FuncArgInfo returnArgument = null;

            SB.Append('\t', nbTabs);
            Functions.WriteDeclaration(SB, S, cgd,
                inline, staticFunc, returnType, fgs.OutputName,
                returnArgument, tailFAI);
            SB.AppendLine(" {");

            SB.Append('\t', nbTabs+1);
            SB.Append("return ");
            SB.Append(shortcutCall);
            SB.AppendLine(";");

            SB.Append('\t', nbTabs);
            SB.AppendLine("}");
        }
开发者ID:Sciumo,项目名称:gaigen,代码行数:43,代码来源:shortcut.cs

示例5: GenerateCode

        /// <summary>
        /// Generates a source file with the GOM class definition.
        /// </summary>
        /// <param name="S"></param>
        /// <param name="cgd"></param>
        /// <param name="FT"></param>
        /// <returns></returns>
        public static string GenerateCode(Specification S, G25.CG.Shared.CGdata cgd, FloatType FT)
        {
            G25.GOM gom = S.m_GOM;
            string className = FT.GetMangledName(S, gom.Name);

            // get range vector type
            G25.SMV rangeVectorType = G25.CG.Shared.OMinit.GetRangeVectorType(S, FT, cgd, gom);
            string rangeVectorSMVname = FT.GetMangledName(S, rangeVectorType.Name);

            // get filename, list of generated filenames
            List<string> generatedFiles = new List<string>();
            string sourceFilename = MainGenerator.GetClassOutputPath(S, className);
            generatedFiles.Add(sourceFilename);

            // get StringBuilder where all generated code goes
            StringBuilder SB = new StringBuilder();

            // get a new 'cgd' where all ouput goes to the one StringBuilder SB
            cgd = new G25.CG.Shared.CGdata(cgd, SB, SB, SB);

            // output license, copyright
            G25.CG.Shared.Util.WriteCopyright(SB, S);
            G25.CG.Shared.Util.WriteLicense(SB, S);

            // open namespace
            G25.CG.Shared.Util.WriteOpenNamespace(SB, S);

            // write class comment
            G25.CG.CSJ.GOM.WriteComment(SB, S, cgd, FT, gom);

            // open class
            G25.CG.Shared.Util.WriteOpenClass(SB, S, G25.CG.Shared.AccessModifier.AM_public, className, null, null);

            // write member variables
            G25.CG.CSJ.GOM.WriteMemberVariables(SB, S, cgd, FT, gom);

            // write constructors
            G25.CG.CSJ.GOM.WriteConstructors(SB, S, cgd, FT, gom, className, rangeVectorSMVname);

            // write set functions
            G25.CG.CSJ.GOM.WriteSetIdentity(SB, S, cgd, FT);
            G25.CG.CSJ.GOM.WriteSetCopy(SB, S, cgd, FT);
            G25.CG.CSJ.GOM.WriteSetVectorImages(S, cgd, FT, false, false); // false, false = matrixMode, transpose
            G25.CG.CSJ.GOM.WriteSetVectorImages(S, cgd, FT, true, false); // true, false = matrixMode, transpose
            G25.CG.CSJ.GOM.WriteSOMtoGOMcopy(S, cgd, FT);

            // write shortcuts for functions
            G25.CG.Shared.Shortcut.WriteFunctionShortcuts(SB, S, cgd, FT, gom);

            // close class
            G25.CG.Shared.Util.WriteCloseClass(SB, S, className);

            // close namespace
            G25.CG.Shared.Util.WriteCloseNamespace(SB, S);

            // write all to file
            G25.CG.Shared.Util.WriteFile(sourceFilename, SB.ToString());

            return sourceFilename;
        }
开发者ID:Sciumo,项目名称:gaigen,代码行数:67,代码来源:gom.cs

示例6: WriteAddSubHpFunction

        /// <summary>
        /// Writes any addition or subtraction function for general multivectors,
        /// based on CASN parts code.
        /// </summary>
        /// <param name="S"></param>
        /// <param name="cgd"></param>
        /// <param name="FT"></param>
        /// <param name="FAI"></param>
        /// <param name="F"></param>
        /// <param name="comment"></param>
        /// <param name="funcType">ADD, SUB or HP</param>
        /// <returns>Full name of generated function.</returns>
        public static string WriteAddSubHpFunction(Specification S, G25.CG.Shared.CGdata cgd, FloatType FT,
            G25.CG.Shared.FuncArgInfo[] FAI, G25.fgs F,
            Comment comment, G25.CG.Shared.CANSparts.ADD_SUB_HP_TYPE funcType)
        {
            // setup instructions
            System.Collections.Generic.List<G25.CG.Shared.Instruction> I = new System.Collections.Generic.List<G25.CG.Shared.Instruction>();
            int nbTabs = 1;

            // write this function:
            string code = G25.CG.Shared.CANSparts.GetAddSubtractHpCode(S, cgd, FT, funcType, FAI, fgs.RETURN_ARG_NAME);

            // add one instruction (verbatim code)
            I.Add(new G25.CG.Shared.VerbatimCodeInstruction(nbTabs, code));

            // because of lack of overloading, function names include names of argument types
            G25.fgs CF = G25.CG.Shared.Util.AppendTypenameToFuncName(S, FT, F, FAI);

            // setup return type and argument:
            string returnTypeName = FT.GetMangledName(S, S.m_GMV.Name);
            G25.CG.Shared.FuncArgInfo returnArgument = null;
            if (S.OutputC())
                returnArgument = new G25.CG.Shared.FuncArgInfo(S, CF, -1, FT, S.m_GMV.Name, false); // false = compute value

            string funcName = CF.OutputName;
            //if (S.OutputC())
              //  funcName = FT.GetMangledName(S, funcName);

            // write function
            bool inline = false; // never inline GMV functions
            bool staticFunc = Functions.OutputStaticFunctions(S);
            G25.CG.Shared.Functions.WriteFunction(S, cgd, F, inline, staticFunc, returnTypeName, funcName, returnArgument, FAI, I, comment);

            return funcName;
        }
开发者ID:Sciumo,项目名称:gaigen,代码行数:46,代码来源:gmv_casn_parts.cs

示例7: WriteConstructors

 /// <summary>
 /// Writes constructors.
 /// </summary>
 /// <param name="SB">Where the code goes.</param>
 /// <param name="S">Used for basis vector names and output language.</param>
 /// <param name="cgd">Not used yet.</param>
 /// <param name="FT">Float point type of 'SMV'.</param>
 /// <param name="smv">The specialized multivector for which the struct should be written.</param>
 public static void WriteConstructors(StringBuilder SB, Specification S, G25.CG.Shared.CGdata cgd, FloatType FT, G25.SMV smv)
 {
     cgd.m_cog.EmitTemplate(SB, "SMVconstructors",
         "S=", S,
         "smv=", smv,
         "className=", FT.GetMangledName(S, smv.Name),
         "gmvClassName=", FT.GetMangledName(S, S.m_GMV.Name),
         "FT=", FT);
 }
开发者ID:Sciumo,项目名称:gaigen,代码行数:17,代码来源:smv.cs

示例8: WriteFloatType_WritesAtLeastOneDecimalPoint

        public void WriteFloatType_WritesAtLeastOneDecimalPoint()
        {
            // Arrange
            var ft = new FloatType() { F = 123 };

            // Act
            var s = Toml.WriteString(ft);

            // Assert
            s.Trim().Should().Be("F = 123.0");
        }
开发者ID:paiden,项目名称:Nett,代码行数:11,代码来源:WriteTomlTypesTests.cs

示例9: Parse

 public override void Parse(GameBitBuffer buffer)
 {
     Place = new WorldPlace();
     Place.Parse(buffer);
     Amount = buffer.ReadInt(32);
     if (buffer.ReadBool())
     {
         OptionalGoldAmount = buffer.ReadInt(32);
     }
     Type = (FloatType)buffer.ReadInt(6);
 }
开发者ID:wow4all,项目名称:mooege,代码行数:11,代码来源:FloatingAmountMessage.cs

示例10: WriteDeclaration

 private static void WriteDeclaration(StringBuilder SB, Specification S, G25.CG.Shared.CGdata cgd, FloatType FT, G25.Constant C)
 {
     // extern MANGLED_TYPENAME MANGLED_CONSTANT_NAME;
     if (C.Comment.Length > 0)
         SB.AppendLine("/** " + C.Comment + " */");
     SB.Append("extern ");
     SB.Append(FT.GetMangledName(S, C.Type.GetName()));
     SB.Append(" ");
     SB.Append(FT.GetMangledName(S, C.Name));
     SB.AppendLine(";");
 }
开发者ID:Sciumo,项目名称:gaigen,代码行数:11,代码来源:constants.cs

示例11: WriteMemberVariables

        /// <summary>
        /// Writes members variables of a GOM class to 'SB'.
        /// </summary>
        /// <param name="SB">Where the comment goes.</param>
        /// <param name="S">Used for basis vector names and output language.</param>
        /// <param name="cgd">Intermediate data for code generation. Also contains plugins and cog.</param>
        /// <param name="FT">Float point type of 'GOM'.</param>
        /// <param name="gom">The general outermorphism for which the class should be written.</param>
        public static void WriteMemberVariables(StringBuilder SB, Specification S, G25.CG.Shared.CGdata cgd, FloatType FT, G25.GOM gom)
        {
            int nbTabs = 1;
            for (int g = 1; g < gom.Domain.Length; g++) // start at '1' in order to skip scalar grade
            {
                string comment = "Matrix for grade " + g + "; the size is " + gom.DomainForGrade(g).Length + " x " + gom.RangeForGrade(g).Length;
                new G25.CG.Shared.Comment(comment).Write(SB, S, nbTabs);

                SB.AppendLine(new string('\t', nbTabs) + Keywords.PackageProtectedAccessModifier(S) + " " + FT.type + "[] m_m" + g + " = new " +
                    FT.type + "[" + gom.DomainForGrade(g).Length * gom.RangeForGrade(g).Length + "];");
            }
        }
开发者ID:Sciumo,项目名称:gaigen,代码行数:20,代码来源:gom.cs

示例12: WriteCoordinateOrder

        /// <summary>
        /// Writes the <c>defines</c> for indices of the smv struct to 'SB'. For example,  <c>define VECTOR_E1 0</c>.
        /// </summary>
        /// <param name="SB">Where the code goes.</param>
        /// <param name="S">Used for basis vector names.</param>
        /// <param name="FT"></param>
        /// <param name="smv">The specialized multivector for which the coordinate indices should be written.</param>
        public static void WriteCoordinateOrder(StringBuilder SB, Specification S, FloatType FT, G25.SMV smv)
        {
            string AccessModifier = Keywords.ConstAccessModifier(S);
            string typeName = G25.CG.Shared.SmvUtil.COORDINATE_ORDER_ENUM;
            string constantName = G25.CG.Shared.SmvUtil.GetCoordinateOrderConstant(S, smv);

            SB.AppendLine();

            int nbTabs = 1;
            new G25.CG.Shared.Comment("The order of coordinates (this is the type of the first argument of coordinate-handling functions.").Write(SB, S, nbTabs);

            string enumAccessModifier = (S.OutputCSharp()) ? "public" : "private";

            SB.AppendLine("\t" + enumAccessModifier + " enum " + typeName + " {");
            SB.AppendLine("\t\t" + constantName);
            SB.AppendLine("\t};");
            SB.AppendLine("\tpublic " + AccessModifier + " " + typeName + " " + constantName + " = " + typeName + "." + constantName + ";");
        }
开发者ID:Sciumo,项目名称:gaigen,代码行数:25,代码来源:smv.cs

示例13: GetGmvComment

        /// <summary>
        /// Returns the comment for a GMV class.
        /// </summary>
        /// <param name="S">Used for basis vector names and output language.</param>
        /// <param name="cgd">Intermediate data for code generation. Also contains plugins and cog.</param>
        /// <param name="FT">Float point type of 'GMV'.</param>
        /// <param name="gmv">The general multivector for which the class should be written.</param>
        public static Comment GetGmvComment(Specification S, G25.CG.Shared.CGdata cgd, FloatType FT, G25.GMV gmv)
        {
            StringBuilder SB = new StringBuilder();

            SB.AppendLine("This class can hold a general multivector.");
            SB.AppendLine("");

            SB.AppendLine("The coordinates are stored in type " + FT.type + ".");
            SB.AppendLine("");

            SB.AppendLine("There are " + gmv.NbGroups + " coordinate groups:");
            for (int g = 0; g < gmv.NbGroups; g++)
            {
                SB.Append("group " + g + ":");
                for (int i = 0; i < gmv.Group(g).Length; i++)
                {
                    if (i > 0) SB.Append(", ");
                    SB.Append(gmv.Group(g)[i].ToString(S.m_basisVectorNames));

                }
                if (gmv.Group(g).Length > 0)
                    SB.Append("  (grade " + gmv.Group(g)[0].Grade() + ")");

                SB.AppendLine(".");
            }
            SB.AppendLine("");

            switch (S.m_GMV.MemoryAllocationMethod)
            {
                case G25.GMV.MEM_ALLOC_METHOD.PARITY_PURE:
                    SB.AppendLine("" + (gmv.NbCoordinates / 2) + " " + FT.type + "s are allocated inside the struct ('parity pure').");
                    SB.AppendLine("Hence creating a multivector which needs more than that number of coordinates ");
                    SB.AppendLine("will result in unpredictable behaviour (buffer overflow).");
                    break;
                case G25.GMV.MEM_ALLOC_METHOD.FULL:
                    SB.AppendLine("" + gmv.NbCoordinates + " " + FT.type + "s are allocated inside the struct.");
                    break;
            }

            return new Comment(SB.ToString());
        }
开发者ID:Sciumo,项目名称:gaigen,代码行数:48,代码来源:class_comments.cs

示例14: BuiltinType

        static BuiltinType()
        {
            i8  = new IntegerType { Name = "i8",  FullyQualifiedName = "i8",  SymbolName = "int8_t",  Size = 1, Alignment = 1, Signed = true/*, Context = BindingContext.EmptyContext */};
            i16 = new IntegerType { Name = "i16", FullyQualifiedName = "i16", SymbolName = "int16_t", Size = 2, Alignment = 2, Signed = true/*, Context = BindingContext.EmptyContext */};
            i32 = new IntegerType { Name = "i32", FullyQualifiedName = "i32", SymbolName = "int32_t", Size = 4, Alignment = 4, Signed = true/*, Context = BindingContext.EmptyContext */};
            i64 = new IntegerType { Name = "i64", FullyQualifiedName = "i64", SymbolName = "int64_t", Size = 8, Alignment = 8, Signed = true/*, Context = BindingContext.EmptyContext */};

            u8  = new IntegerType { Name = "u8",  FullyQualifiedName = "u8",  SymbolName = "uint8_t",  Size = 1, Alignment = 1, Signed = false/*, Context = BindingContext.EmptyContext */};
            u16 = new IntegerType { Name = "u16", FullyQualifiedName = "u16", SymbolName = "uint16_t", Size = 2, Alignment = 2, Signed = false/*, Context = BindingContext.EmptyContext */};
            u32 = new IntegerType { Name = "u32", FullyQualifiedName = "u32", SymbolName = "uint32_t", Size = 4, Alignment = 4, Signed = false/*, Context = BindingContext.EmptyContext */};
            u64 = new IntegerType { Name = "u64", FullyQualifiedName = "u64", SymbolName = "uint64_t", Size = 8, Alignment = 8, Signed = false/*, Context = BindingContext.EmptyContext */};

            f32 = new FloatType { Name = "f32", FullyQualifiedName = "f32", SymbolName = "float",  Size = 4, Alignment = 4 /*, Context = BindingContext.EmptyContext */};
            f64 = new FloatType { Name = "f64", FullyQualifiedName = "f64", SymbolName = "double", Size = 8, Alignment = 8 /*, Context = BindingContext.EmptyContext */};

            Void = new VoidType { Name = "void", FullyQualifiedName = "void", SymbolName = "void" /*, Context = BindingContext.EmptyContext */};
            Auto = new AutoType();

            VoidPtr = new PointerType { PointsTo = Void };
            CharPtr = new PointerType { PointsTo = i8 };
        }
开发者ID:ben-eirich,项目名称:September,代码行数:21,代码来源:Type.cs

示例15: CssStyle

 public CssStyle()
 {
     color=	new Color(0, 0, 0);
     background=	new Background();
     border=	new Border();
     clear=	FloatType.none;
     display=	Display.inline;
     _float=	FloatType.none;
     height=	new FlexibleFloat(0f, FlexFloatType.px);
     margin=	new Margin(0f, 0f, 0f, 0f);
     padding=	new Padding(0f, 0f, 0f, 0f);
     width=	new FlexibleFloat(100f, FlexFloatType.percentage);
     letterSpacing=	new FlexibleFloat(FlexibleFloat.letterSpacingNormal, FlexFloatType.px);
     lineHeight=	new FlexibleFloat(FlexibleFloat.lineHeightNormal, FlexFloatType.px);
     textAlign=	TextAlignment.left;
     textIndex=	new FlexibleFloat(0f, FlexFloatType.px);
     textTransform=	TextTransform.none;
     whiteSpace=	WhiteSpace.normal;
     wordSpacing=	new FlexibleFloat(FlexibleFloat.wordSpacingNormal, FlexFloatType.px);
     textDecoration=	TextDecoration.none;
     font=	new Sdx.Font("arial", 14);
     listStyle=	new ListStyle();
 }
开发者ID:pgonzbecer,项目名称:apis-bundle,代码行数:23,代码来源:CssStyle.cs


注:本文中的FloatType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。