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


C++ CodeGenerator::addMember方法代码示例

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


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

示例1: name

void petabricks::MatrixDef::allocateTemporary(CodeGenerator& o, RuleFlavor rf, bool setOnly, bool reallocAllowed){
  if(!setOnly)
    o.addMember(typeName(rf), name(), "");

  if(reallocAllowed)
    o.beginIf("!"+name()+".isSize("+_size.toString()+")");

  if (rf == RuleFlavor::DISTRIBUTED && numDimensions() > 0) {
    std::string distributionType = o.className() + "_" + name() + "_distribution_type";
    std::string distributionSize = o.className() + "_" + name() + "_distribution_size";
    std::string migrationType = o.className() + "_" + name() + "_migration_type";

    o.createTunable(true, "system.data.distribution.type", distributionType, 0, 0, 5);
    o.createTunable(true, "system.data.distribution.size", distributionSize, jalib::maxval<int>(), 2, jalib::maxval<int>());
    o.createTunable(true, "system.data.migration.type", migrationType, 0, 0, 1);

    o.write("{");
    o.incIndent();
    o.write("IndexT size[] = {"+_size.toString()+"};");
    o.write(name()+" = "+typeName(rf)+"::allocate(size, distributedcutoff, "+distributionType+", "+distributionSize+", "+migrationType+");");
    o.decIndent();
    o.write("}");
  } else {
    o.write(name()+" = "+allocateStr(rf)+";");

  }

  if(reallocAllowed)
    o.endIf();
}
开发者ID:AikidoGuy,项目名称:petabricks,代码行数:30,代码来源:matrixdef.cpp

示例2: FormulaEQ

void petabricks::MatrixDef::extractDefines(FreeVars& defined, CodeGenerator& o){
  int d=0;
  for(FormulaList::const_iterator i=_size.begin(); i!=_size.end(); ++i,++d){
    FreeVarsPtr fv = (*i)->getFreeVariables();
    if(fv->size()==1){
      std::string var = *fv->begin();
      FormulaPtr tmp = FormulaVariable::mktmp();
      if(!defined.contains(var)){
        defined.insert(var);
        FormulaList l;
        l.push_back(new FormulaEQ(tmp, *i));
        l = *MaximaWrapper::instance().solve(l, var);
        JASSERT(l.size()==1)(*i)(var).Text("Failed to solve");
        o.addMember("IndexT", var, "");
        o.write(var + " = "
                + (*l.begin())->rhs()->replace(tmp, new FormulaVariable(_name+".size("+jalib::XToString(d)+")"))->toString()
                + ";");
      }
    }
  }
}
开发者ID:AikidoGuy,项目名称:petabricks,代码行数:21,代码来源:matrixdef.cpp


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