本文整理汇总了C++中XML_Node::fp_value方法的典型用法代码示例。如果您正苦于以下问题:C++ XML_Node::fp_value方法的具体用法?C++ XML_Node::fp_value怎么用?C++ XML_Node::fp_value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XML_Node
的用法示例。
在下文中一共展示了XML_Node::fp_value方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getFloatCurrent
doublereal getFloatCurrent(const XML_Node& node, const std::string& type)
{
doublereal fctr = 1.0;
doublereal x = node.fp_value();
const string& units = node["units"];
const string& vmin = node["min"];
const string& vmax = node["max"];
if (vmin != "" && x < fpValue(vmin) - Tiny) {
writelog("\nWarning: value "+node.value()+" is below lower limit of "
+vmin+".\n");
}
if (node["max"] != "" && x > fpValue(vmax) + Tiny) {
writelog("\nWarning: value "+node.value()+" is above upper limit of "
+vmax+".\n");
}
// Note, most types of converters default to toSI() type atm.
// This may change and become more specific in the future.
if (type == "actEnergy" && units != "") {
fctr = actEnergyToSI(units);
} else if (type == "toSI" && units != "") {
fctr = toSI(units);
} else if (type == "temperature" && units != "") {
fctr = toSI(units);
} else if (type == "density" && units != "") {
fctr = toSI(units);
} else if (type == "pressure" && units != "") {
fctr = toSI(units);
} else if (type != "" && units != "") {
fctr = toSI(units);
#ifdef DEBUG_MODE
writelog("\nWarning: conversion toSI() was done on node value " + node.name() +
"but wasn't explicitly requested. Type was \"" + type + "\"\n");
#endif
}
// Note, below currently produces a lot of output due to transport blocks.
// This needs to be addressed.
#ifdef DEBUG_MODE_MORE
else if (type == "" && units != "") {
writelog("\nWarning: XML node " + node.name() +
"has a units attribute, \"" + units + "\","
"but no conversion was done because the getFloat() command didn't have a type\n");
}
#endif
return fctr*x;
}