本文整理汇总了C#中G25.UsesAllFloatTypes方法的典型用法代码示例。如果您正苦于以下问题:C# G25.UsesAllFloatTypes方法的具体用法?C# G25.UsesAllFloatTypes怎么用?C# G25.UsesAllFloatTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类G25
的用法示例。
在下文中一共展示了G25.UsesAllFloatTypes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FunctionToXmlString
/// <summary>
/// Converts a G25.fgs to an XML string representation.
/// </summary>
/// <param name="S"></param>
/// <param name="F"></param>
/// <returns>XML string representation of 'F'.</returns>
public static string FunctionToXmlString(Specification S, G25.fgs F)
{
StringBuilder SB = new StringBuilder();
SB.Append("<" + XML_FUNCTION);
// name
SB.Append(" " + XML_NAME + "=\"" + F.Name + "\"");
// output name, if different
if (F.Name != F.OutputName)
SB.Append(" " + XML_OUTPUT_NAME + "=\"" + F.OutputName + "\"");
// return type, if set
if (F.ReturnTypeName.Length > 0)
SB.Append(" " + XML_RETURN_TYPE + "=\"" + F.ReturnTypeName + "\"");
// argument types, names
for (int a = 0; a < F.NbArguments; a++)
{
string argTypeName = F.ArgumentTypeNames[a];
if (argTypeName.EndsWith(Specification.CONSTANT_TYPE_SUFFIX)) // check if it is a constant
{
G25.SMV smv = S.GetType(argTypeName) as G25.SMV;
if ((smv != null) && smv.IsConstant())
{ // if constant, remove the "_t" from the typename
argTypeName = argTypeName.Substring(0, argTypeName.Length - Specification.CONSTANT_TYPE_SUFFIX.Length);
}
}
SB.Append(" " + XML_ARG + (a + 1).ToString() + "=\"" + F.ArgumentTypeNames[a] + "\"");
if (F.ArgumentVariableNames[a] != fgs.DefaultArgumentName(a))
SB.Append(" " + XML_ARGNAME + (a + 1).ToString() + "=\"" + F.ArgumentVariableNames[a] + "\"");
}
// options
{
foreach (KeyValuePair<String, String> KVP in F.Options)
{
SB.Append(" " + XML_OPTION + KVP.Key + "=\"" + KVP.Value + "\"");
}
}
// float names, if not all float names of algebra are used:
if (!F.UsesAllFloatTypes(S.m_floatTypes))
{
for (int f = 0; f < F.NbFloatNames; f++)
{
SB.Append(" " + XML_FLOAT_TYPE + "=\"" + F.FloatNames[f] + "\"");
}
}
// metric name, if not default
if (F.MetricName != "default")
SB.Append(" " + XML_METRIC + "=\"" + F.MetricName + "\"");
// metric name, if not default
if (F.Comment.Length > 0)
SB.Append(" " + XML_COMMENT + "=\"" + F.Comment + "\"");
SB.Append("/>");
return SB.ToString();
}