Deprecate XML_Node::operator()

This commit is contained in:
Ray Speth 2014-09-15 18:04:57 +00:00
parent 4081d41841
commit 2fc09337c0
4 changed files with 16 additions and 12 deletions

View file

@ -225,6 +225,7 @@ public:
//! Overloaded parenthesis operator returns the value of the Node
/*!
* @return Returns the value of the node as a string.
* @deprecated Use value() instead.
*/
std::string operator()() const;

View file

@ -201,7 +201,7 @@ void getIntegers(const Cantera::XML_Node& node,
for (size_t i = 0; i < f.size(); i++) {
const XML_Node& fi = *f[i];
if (fi["min"] != "" && fi["max"] != "") {
v[fi["title"]] = intValue(fi());
v[fi["title"]] = fi.int_value();
}
}
}
@ -222,16 +222,16 @@ doublereal getFloatCurrent(const Cantera::XML_Node& node,
const std::string& type)
{
doublereal fctr = 1.0;
doublereal x = fpValue(node());
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()+" is below lower limit of "
writelog("\nWarning: value "+node.value()+" is below lower limit of "
+vmin+".\n");
}
if (node["max"] != "" && x > fpValue(vmax) + Tiny) {
writelog("\nWarning: value "+node()+" is above upper limit of "
writelog("\nWarning: value "+node.value()+" is above upper limit of "
+vmax+".\n");
}
// Note, most types of converters default to toSI() type atm.
@ -322,15 +322,15 @@ int getInteger(const Cantera::XML_Node& parent, const std::string& name)
"no child XML element named " + name);
}
const XML_Node& node = parent.child(name);
int x = intValue(node());
int x = node.int_value();
const string& vmin = node["min"];
const string& vmax = node["max"];
if (vmin != "" && x < intValue(vmin)) {
writelog("\nWarning: value "+node()+" is below lower limit of "
writelog("\nWarning: value "+node.value()+" is below lower limit of "
+vmin+".\n");
}
if (node["max"] != "" && x > intValue(vmax)) {
writelog("\nWarning: value "+node()+" is above upper limit of "
writelog("\nWarning: value "+node.value()+" is above upper limit of "
+vmax+".\n");
}
return x;

View file

@ -8,6 +8,7 @@
#include "cantera/base/xml.h"
#include "cantera/base/stringUtils.h"
#include "cantera/base/global.h"
#include <sstream>
@ -464,6 +465,8 @@ std::string XML_Node::value() const
std::string XML_Node::operator()() const
{
warn_deprecated("XML_Node::operator()",
"To be removed after Cantera 2.2. Use XML_Node::value().");
return m_value;
}

View file

@ -217,7 +217,7 @@ bool getReagents(const XML_Node& rxn, Kinetics& kin, int rp,
throw CanteraError("getReagents",
"reaction order specified for non-reactant: "
+sp);
forder = fpValue(oo());
forder = oo.fp_value();
if (forder < 0.0) {
throw CanteraError("getReagents",
"reaction order must be non-negative");
@ -311,7 +311,7 @@ bool getOrders(const XML_Node& rxnNode, Kinetics& kin,
doublereal forder;
for (size_t nn = 0; nn < ord.size(); nn++) {
const XML_Node& oo = *ord[nn];
forder = fpValue(oo());
forder = oo.fp_value();
std::string spName = oo["species"];
size_t k = kin.kineticsSpeciesIndex(spName);
if (k == npos) {
@ -483,11 +483,11 @@ bool getRxnFormulation(const XML_Node& rxnNode, Kinetics& kin,
if (rfNode.hasChild("affinityPower")) {
XML_Node& fNode = rxnNode.child("affinityPower");
affinityPower = fpValueCheck( fNode() );
affinityPower = fNode.fp_value();
}
if (rfNode.hasChild("equilibriumConstantPower")) {
XML_Node& eNode = rxnNode.child("equilibriumConstantPower");
equilibriumConstantPower = fpValueCheck( eNode() );
equilibriumConstantPower = eNode.fp_value();
}
}
return true;
@ -1003,7 +1003,7 @@ bool rxninfo::installReaction(int iRxn, const XML_Node& rxnNode, Kinetics& kin,
//
if (rxnNode.hasChild("filmResistivity")) {
XML_Node& fNode = rxnNode.child("filmResistivity");
rdata.filmResistivity = fpValueCheck( fNode() );
rdata.filmResistivity = fNode.fp_value();
}
}
//