本文整理汇总了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);
}
示例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());
}
示例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;
}
示例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;
}