本文整理汇总了C++中magnet::xml::Node::fastGetNode方法的典型用法代码示例。如果您正苦于以下问题:C++ Node::fastGetNode方法的具体用法?C++ Node::fastGetNode怎么用?C++ Node::fastGetNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类magnet::xml::Node
的用法示例。
在下文中一共展示了Node::fastGetNode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: catch
void
IStepped::operator<<(const magnet::xml::Node& XML)
{
if (strcmp(XML.getAttribute("Type"),"Stepped"))
M_throw() << "Attempting to load Stepped from non Stepped entry";
range.set_ptr(C2Range::getClass(XML,Sim));
try {
intName = XML.getAttribute("Name");
if (!XML.hasNode("Step"))
M_throw() << "No steppings defined for stepped potential "
<< intName;
for (magnet::xml::Node node = XML.fastGetNode("Step"); node.valid(); ++node)
steps.push_back(steppair(node.getAttribute("R").as<double>(),
node.getAttribute("E").as<double>()));
std::sort(steps.rbegin(), steps.rend());
IMultiCapture::loadCaptureMap(XML);
}
catch (boost::bad_lexical_cast &)
{
M_throw() << "Failed a lexical cast in CIStepped";
}
if (steps.empty())
M_throw() << "No steps defined in SteppedPotential Interaction with name "
<< getName();
}
示例2: catch
void
Topology::operator<<(const magnet::xml::Node& XML)
{
try { spName = XML.getAttribute("Name"); }
catch (boost::bad_lexical_cast &)
{
M_throw() << "Failed a lexical cast in CTopology";
}
for (magnet::xml::Node node = XML.fastGetNode("Molecule"); node.valid(); ++node)
ranges.push_back(shared_ptr<Range>(Range::getClass(node, Sim)));
}
示例3: catch
void
Topology::operator<<(const magnet::xml::Node& XML)
{
try { spName = XML.getAttribute("Name"); }
catch (boost::bad_lexical_cast &)
{
M_throw() << "Failed a lexical cast in CTopology";
}
if (!XML.hasNode("Molecule"))
M_throw() << "Cannot load a Topology which has no molecules!";
for (magnet::xml::Node node = XML.fastGetNode("Molecule"); node.valid(); ++node)
ranges.push_back(shared_ptr<IDRange>(IDRange::getClass(node.getNode("IDRange"), Sim)));
}
示例4: catch
void
C2RRangeList::operator<<(const magnet::xml::Node& XML)
{
if (strcmp(XML.getAttribute("Range"),"RangeList"))
M_throw() << "Attempting to load a List from a non List";
try
{
for (magnet::xml::Node node = XML.fastGetNode("RangeListItem"); node.valid(); ++node)
ranges.push_back(magnet::ClonePtr<C2Range>(C2Range::getClass(node, Sim)));
}
catch (boost::bad_lexical_cast &)
{
M_throw() << "Failed a lexical cast in C2RRangeList";
}
}
示例5: if
void
PotentialStepped::operator<<(const magnet::xml::Node& XML) {
if (XML.getAttribute("Direction").as<std::string>() == "Left")
_direction = false;
else if (XML.getAttribute("Direction").as<std::string>() == "Right")
_direction = true;
else
M_throw() << "Could not parse Direction, should be either \"Left\" or \"Right\"\nXML path:"
<< XML.getPath();
std::vector<std::pair<double, double> > steps;
for (magnet::xml::Node node = XML.fastGetNode("Step"); node.valid(); ++node)
steps.push_back(std::pair<double, double>(node.getAttribute("R").as<double>(),
node.getAttribute("E").as<double>()));
if (steps.empty())
M_throw() << "You cannot load a stepped potential with no steps.\nXML path: " << XML.getPath();
*this = PotentialStepped(steps, _direction);
}