I need to know if Signal is an integer or a float/double, because it needs to be used to generate C code:
public static class SignalExtensions
{
public static string GetCppType(this Signal signal)
{
string su = string.Empty;
string type=string.Empty;
if(signal.IsInteger==true)
{
if (signal.IsSigned == 0)
{
su = "u";
}
if (signal.Length <= 8)
{
type = "int8_t";
}
else if (signal.Length <= 16)
{
type = "int16_t";
}
else if (signal.Length <= 32)
{
type = "int32_t";
}
else if (signal.Length <= 64)
{
type = "int64_t";
}
else
{
throw new Exception("不支持的类型");
}
return su + type;
}
else
{
if (signal.Length <= 32)
{
type = "float";
}
else if (signal.Length <= 64)
{
type = "double";
}
return type;
}
}
}
I need to know if Signal is an integer or a float/double, because it needs to be used to generate C code: