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


C++ ListOf类代码示例

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


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

示例1: makeVectorOf

VectorOf<Word>
PresentationParser::parseWordList( const VectorOf<Chars>& names, Chars& errMesg )
{
  genNames = names;

  if ( curToken == INIT ) getToken();

  ListOf<Word> result;

  if ( curToken == INIT ) getToken();

  while ( atStartOfWord() ) {
    Word w = parseWord( names, errMesg );
    if ( errMesg.length() > 0 ) {
      return makeVectorOf(result);
    }
    result.append( w );

    if ( curToken == COMMA ) {
      getToken();
      if ( !atStartOfWord() ) {
	parseError("Expected a word here");
	errMesg = parseErrorMessage;
	return makeVectorOf(result);
      }
    }
  }

  return makeVectorOf(result);
}
开发者ID:koudonojinchuu,项目名称:magnus,代码行数:30,代码来源:PresentationParser.C

示例2: START_TEST

END_TEST


START_TEST ( test_InitialAssignment_parent_create )
{
    Model *m = new Model(2, 4);
    InitialAssignment *ia = m->createInitialAssignment();

    ListOf *lo = m->getListOfInitialAssignments();

    fail_unless(lo == m->getInitialAssignment(0)->getParentSBMLObject());
    fail_unless(lo == ia->getParentSBMLObject());
    fail_unless(m == lo->getParentSBMLObject());
}
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:14,代码来源:TestSBMLParentObject.cpp

示例3: containsOnlyGivenUnits

/*
 * The functions determins wether the given UnitDefinition contains only
 * units from the list given as the second argument.
 * @param const UnitDefinition& uDef
 * @param const ListOf& unitList
 * @return bool containsOnlyGivenUnits
 */
LIBSBML_EXTERN
bool UnitConversionFactory::containsOnlyGivenUnits(const UnitDefinition& uDef, const ListOf& unitList)
{
    bool result = true;
    UnitDefinition* pTmpUdef = UnitConversionFactory::convertToSI(uDef);

    if (pTmpUdef)
    {
        unsigned int i;
        unsigned int maxUnits = pTmpUdef->getNumUnits();

        for (i = 0; i < maxUnits; ++i)
        {
            Unit* pU = pTmpUdef->getUnit(i);
            UnitKind_t kind = pU->getKind();
            unsigned int j;
            unsigned int maxUnits2 = unitList.size();
            bool found = false;

            for (j = 0; j < maxUnits2; ++j)
            {
                const Unit* pU2 = dynamic_cast<const Unit*>(unitList.get(j));

                if (!pU2) break;

                if (pU2->getKind() == kind)
                {
                    found = true;
                    break;
                }
            }

            if (!found)
            {
                result = false;
                break;
            }
        }

        delete pTmpUdef;
    }
    else
    {
        result = false;
    }

    return result;
}
开发者ID:jonasfoe,项目名称:COPASI,代码行数:55,代码来源:UnitConversionFactory.cpp

示例4: ungroupNA

// Convert a list of numeric vectors into a single numeric vector where
// each original vector is followed by an NA
// [[Rcpp::export]]
NumericVector ungroupNA(ListOf<NumericVector> x) {
  int n = x.size();

  // Figure out total size needed
  int n_total = 0;
  for (int i = 0; i < n; ++i) {
    n_total += x[i].size();
  }
  n_total += n;

  NumericVector out(n_total);
  int k = 0;
  for (int i = 0; i < n; ++i) {
    NumericVector xi = x[i];
    int ni = xi.size();

    for (int j = 0; j < ni; ++j, ++k) {
      out[k] = xi[j];
    }

    out[k++] = NA_REAL;
  }

  return out;
}
开发者ID:lexqbit,项目名称:gggeom,代码行数:28,代码来源:ungroup.cpp


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