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


C++ ASTNode::insertChild方法代码示例

本文整理汇总了C++中ASTNode::insertChild方法的典型用法代码示例。如果您正苦于以下问题:C++ ASTNode::insertChild方法的具体用法?C++ ASTNode::insertChild怎么用?C++ ASTNode::insertChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ASTNode的用法示例。


在下文中一共展示了ASTNode::insertChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: convertCSymbols

void Submodel::convertCSymbols(ASTNode*& math, const ASTNode* tcfdiv, const ASTNode* tcftimes)
{
  if (tcfdiv==NULL) return;
  if (math->getType()==AST_NAME_TIME) {
    ASTNode* div = tcfdiv->deepCopy();
    div->insertChild(0, math);
    math = div;
    return;
  }
  for (unsigned int ch=0; ch<math->getNumChildren(); ch++) {
    ASTNode* child = math->getChild(ch);
    convertCSymbols(child, tcfdiv, tcftimes);
    if (child != math->getChild(ch)) {
      math->removeChild(ch);
      math->insertChild(ch, child);
    }
  }
  if (math->getType()==AST_FUNCTION_DELAY) {
    if (math->getNumChildren() != 2) return;
    ASTNode* timechild = math->getChild(1);
    ASTNode* newtime = tcftimes->deepCopy();
    newtime->addChild(timechild);
    math->removeChild(1);
    math->addChild(newtime);
  }
}
开发者ID:copasi,项目名称:copasi-dependencies,代码行数:26,代码来源:Submodel.cpp

示例2: convertTimeAndExtentWith


//.........这里部分代码省略.........
        ast1 = kl->getMath()->deepCopy();
        convertCSymbols(ast1, tcfdiv, tcftimes);
        if (klmod !=NULL) {
          kl = static_cast<KineticLaw*>(element);
          if (kl->isSetMath()) {
            ast2 = new ASTNode(AST_TIMES);
            ast2->addChild(klmod->deepCopy());
            ast2->addChild(ast1);
            kl->setMath(ast2);
            delete ast2;
          }
        }
        else {
          kl->setMath(ast1);
          delete ast1;
        }
        break;
      case SBML_DELAY:
        //Delays are multiplied by the time conversion factor.
        delay = static_cast<Delay*>(element);
        if (delay->isSetMath()) {
          ast1 = delay->getMath()->deepCopy();
          convertCSymbols(ast1, tcfdiv, tcftimes);
          tcftimes->addChild(ast1);
          delay->setMath(tcftimes);
          tcftimes->removeChild(1);
        }
        break;
      case SBML_RATE_RULE:
        //Rate rules are divided by the time conversion factor.
        rrule = static_cast<RateRule*>(element);
        if (rrule->isSetMath()) {
          ast1 = rrule->getMath()->deepCopy();
          tcfdiv->insertChild(0, rrule->getMath()->deepCopy());
          rrule->setMath(tcfdiv);
          tcfdiv->removeChild(0);
        }
        //Fall through to:
      case SBML_ASSIGNMENT_RULE:
      case SBML_ALGEBRAIC_RULE:
        //Rules in general need csymbols converted.
        rule = static_cast<Rule*>(element);
        if (rule->isSetMath()) {
          ast1 = rule->getMath()->deepCopy();
          convertCSymbols(ast1, tcfdiv, tcftimes);
          rule->setMath(ast1);
          delete ast1;
        }
        break;
      case SBML_EVENT_ASSIGNMENT:
        //Event assignments need csymbols converted.
        ea = static_cast<EventAssignment*>(element);
        if (ea->isSetMath()) {
          ast1 = ea->getMath()->deepCopy();
          convertCSymbols(ast1, tcfdiv, tcftimes);
          ea->setMath(ast1);
          delete ast1;
        }
        break;
      case SBML_INITIAL_ASSIGNMENT:
        //Initial assignments need csymbols converted.
        ia = static_cast<InitialAssignment*>(element);
        if (ia->isSetMath()) {
          ast1 = ia->getMath()->deepCopy();
          convertCSymbols(ast1, tcfdiv, tcftimes);
          ia->setMath(ast1);
开发者ID:0u812,项目名称:roadrunner-backup,代码行数:67,代码来源:Submodel.cpp


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