本文整理汇总了C++中CIMValue::toReal64方法的典型用法代码示例。如果您正苦于以下问题:C++ CIMValue::toReal64方法的具体用法?C++ CIMValue::toReal64怎么用?C++ CIMValue::toReal64使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIMValue
的用法示例。
在下文中一共展示了CIMValue::toReal64方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CIMtoXML
//.........这里部分代码省略.........
if (a.getFullNameSpace().isLocal())
{
if (a.getNameSpace().empty())
{
CIMInstanceNametoXML(a, out);
}
else
{
CIMLocalInstancePathtoXML(a, out);
}
}
else
{
CIMInstancePathtoXML(a, out);
}
out << "</VALUE.REFERENCE>";
}
else
{
out << "<VALUE>";
switch (cv.getType())
{
case CIMDataType::BOOLEAN:
case CIMDataType::UINT8:
case CIMDataType::SINT8:
case CIMDataType::UINT16:
case CIMDataType::SINT16:
case CIMDataType::UINT32:
case CIMDataType::SINT32:
case CIMDataType::UINT64:
case CIMDataType::SINT64:
case CIMDataType::DATETIME:
{
out << cv.toString();
break;
}
case CIMDataType::REAL32:
{
char tmpbuf[128];
#if FLT_RADIX == 2
#if defined(OW_REAL32_IS_FLOAT)
::SNPRINTF(tmpbuf, sizeof(tmpbuf), "%.*e", FLT_MANT_DIG * 3 / 10 + 1, static_cast<double>(cv.toReal32()));
#elif defined(OW_REAL32_IS_DOUBLE)
::SNPRINTF(tmpbuf, sizeof(tmpbuf), "%.*e", DBL_MANT_DIG * 3 / 10 + 1, cv.toReal32());
#endif
#else
#error "The formula for computing the number of digits of precision for a floating point needs to be implmented. It's ceiling(bits * log(FLT_RADIX) / log(10))"
#endif
out << tmpbuf;
break;
}
case CIMDataType::REAL64:
{
char tmpbuf[128];
#if FLT_RADIX == 2
#if defined(OW_REAL64_IS_DOUBLE)
::SNPRINTF(tmpbuf, sizeof(tmpbuf), "%.*e", DBL_MANT_DIG * 3 / 10 + 1, cv.toReal64());
#elif defined(OW_REAL64_IS_LONG_DOUBLE)
::SNPRINTF(tmpbuf, sizeof(tmpbuf), "%.*Le", LDBL_MANT_DIG * 3 / 10 + 1, cv.toReal64());
#endif
#else
#error "The formula for computing the number of digits of precision for a floating point needs to be implmented. It's ceiling(bits * log(FLT_RADIX) / log(10))"
#endif
out << tmpbuf;
break;
}
case CIMDataType::CHAR16:
case CIMDataType::STRING:
{
out << XMLEscape(cv.toString());
break;
}
case CIMDataType::EMBEDDEDCLASS:
{
CIMClass cc(CIMNULL);
cv.get(cc);
String s;
OStringStream ss;
CIMtoXML(cc, ss);
out << XMLEscape(ss.toString());
break;
}
case CIMDataType::EMBEDDEDINSTANCE:
{
CIMInstance i(CIMNULL);
cv.get(i);
String s;
OStringStream ss;
CIMInstancetoXML(i,ss);
out << XMLEscape(ss.toString());
break;
}
default:
OW_ASSERT(0);
}
out << "</VALUE>";
}
}