当前位置: 首页>>代码示例>>C++>>正文


C++ Node::fastGetNode方法代码示例

本文整理汇总了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();
}
开发者ID:herbsolo,项目名称:DynamO,代码行数:32,代码来源:stepped.cpp

示例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)));
  }
开发者ID:pviswanathan,项目名称:DynamO,代码行数:12,代码来源:topology.cpp

示例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)));
  }
开发者ID:MarkRunWu,项目名称:DynamO,代码行数:15,代码来源:topology.cpp

示例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";
    }
}
开发者ID:herbsolo,项目名称:DynamO,代码行数:16,代码来源:2RRangeList.cpp

示例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);
  }
开发者ID:BigMacchia,项目名称:DynamO,代码行数:20,代码来源:potential.cpp


注:本文中的magnet::xml::Node::fastGetNode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。