本文整理汇总了C++中Split::size方法的典型用法代码示例。如果您正苦于以下问题:C++ Split::size方法的具体用法?C++ Split::size怎么用?C++ Split::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Split
的用法示例。
在下文中一共展示了Split::size方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: selectObjectQuery
SelectQuery selectObjectQuery(const std::vector<FieldType>& fdatas,
const Expr& e) {
SelectQuery sel;
Split tables;
std::set<LITESQL_String> tableSet;
for (size_t i = 0; i < fdatas.size(); i++)
if (tableSet.find(fdatas[i].table()) == tableSet.end()) {
tables.push_back(fdatas[i].table());
tableSet.insert(fdatas[i].table());
}
Split tableFilters;
tableFilters.resize(tables.size()-1);
for (size_t i = 1; i < tables.size(); i++)
tableFilters[i-1] = tables[i-1] + LITESQL_L(".id_ = ") + tables[i] + LITESQL_L(".id_");
tableSet.clear();
for (size_t i = 0; i < tables.size(); i++) {
sel.source(tables[i]);
tableSet.insert(tables[i]);
}
if (tables.size() > 1)
sel.where((e && RawExpr(tableFilters.join(LITESQL_L(" AND ")))).asString());
else
sel.where(e.asString());
for (size_t i = 0; i < fdatas.size(); i++)
sel.result(fdatas[i].table() + LITESQL_L(".") + fdatas[i].name());
return sel;
}
示例2: ostr
void
Date::addTime(std::string time, std::string unit)
{
Split splt;
// default for units: inherent units
if( unit.size() == 0 )
unit = unitStr;
// It is save to append units (even if empty) to time
// Note: time-unit overrules parameter unit.
time += unit;
// Split string at positions where digits and characters alternate.
splt.setSeparator(":alnum:");
splt = time ;
// If there is a mix of digits and non-digits, splt.size() >= 2:
// isNonDigit && size == 1 is an error.
// size == 0 is an error.
// But, for !isNonDigit && size == 1 we got the default
bool isNon = ! hdhC::isDigit(time);
if( (splt.size() == 1 && isNon) || (splt.size() == 0) )
{
std::ostringstream ostr(std::ios::app);
ostr << "Date::addTime()"
<< "\nerror in 2nd parameter (time=" << time << ")" ;
exceptionError( ostr.str() );
}
// unitStr and int strings are empty.
// Pure digits are always converted to days.
if( splt.size() == 1 )
{
addDays( splt.toDouble(0) ) ;
return;
}
std::string str(splt[1]);
if( str[0] == 'y' )
addYears( splt.toDouble(0) );
else if( str.substr(0,2) == "mo" )
addMonths( splt.toDouble(0) );
else if( str[0] == 'd' )
addDays( splt.toDouble(0) );
else if( str[0] == 'h' )
addHours( splt.toDouble(0) );
else if( str.substr(0,2) == "mi" )
addMinutes( splt.toDouble(0) );
else if( str[0] == 's' )
addSeconds( splt.toDouble(0) );
return;
}
示例3: preserved
/**
@param taxa_set set of taxa
@return true if this split is preserved in the set taxa_set
*/
bool Split::preserved(Split &taxa_set)
{
// be sure that the two split has the same size
assert(taxa_set.size() == size() && taxa_set.ntaxa == ntaxa);
int time_zero = 0, time_notzero = 0;
for (iterator it = begin(), sit = taxa_set.begin(); it != end(); it++, sit++)
{
UINT res = (*it) & (*sit);
if (res != 0 && res != (*sit))
return true;
if (*sit != 0) {
if (res == 0) time_zero++; else time_notzero++;
if (res == 0 && time_notzero > 0) return true;
if (res != 0 && time_zero > 0) return true;
}
}
return false;
}
示例4: compatible
/**
@param sp the other split
@return true if this split is compatible with sp
*/
bool Split::compatible(Split &sp)
{
// be sure that the two split has the same size
assert(sp.size() == size() && sp.ntaxa == ntaxa);
UINT res = 0, res2 = 0, res3 = 0, res4 = 0;
for (iterator it = begin(), sit = sp.begin(); it != end(); it++, sit++)
{
int num_bits = (it+1 == end()) ? ntaxa % UINT_BITS : UINT_BITS;
UINT it2 = (1 << (num_bits-1)) - 1 + (1 << (num_bits-1)) - (*it);
UINT sit2 = (1 << (num_bits-1)) - 1 + (1 << (num_bits-1)) - (*sit);
res |= (*it) & (*sit);
res2 |= (it2) & (sit2);
res3 |= (*it) & (sit2);
res4 |= (it2) & (*sit);
if (res != 0 && res2 != 0 && res3 != 0 && res4 != 0)
return false;
//if (res != 0 && res != (*it) && res != (*sit) && res2 != 0)
//return false;
}
return true;
//return (res == 0) || (res2 == 0) || (res3 == 0) || (res4 == 0);
}
示例5: split
void
QA::applyOptions(bool isPost)
{
enablePostProc=isPost;
// the first loop for items with higher precedence
for( size_t i=0 ; i < optStr.size() ; ++i)
{
Split split(optStr[i], "=");
if( split[0] == "pP" || split[0] == "postProc"
|| split[0] == "post_proc")
{
enablePostProc=true;
break;
}
}
for( size_t i=0 ; i < optStr.size() ; ++i)
{
Split split(optStr[i], "=");
if( split[0] == "cM"
|| split[0] == "checkMode"
|| split[0] == "check_mode" )
{
if( split.size() == 2 )
setCheckMode(split[1]);
continue;
}
if( split[0] == "dIP"
|| split[0] == "dataInProduction"
|| split[0] == "data_in_production" )
{
// effects completeness test in testPeriod()
isFileComplete=false;
continue;
}
if( split[0] == "dP"
|| split[0] == "dataPath" || split[0] == "data_path" )
{
if( split.size() == 2 )
// path to the directory where the execution takes place
qaFile.setPath(split[1]);
continue;
}
if( split[0] == "f" )
{
if( split.size() == 2 )
qaFile.setFile(split[1]);
continue;
}
if( split[0] == "fS" || split[0] == "FileSequence"
|| split[0] == "file_sequence" )
{
if( split.size() == 2 )
fileSequenceState=split[1][0];
continue;
}
if( split[0] == "oT"
|| split[0] == "outlierTest"
|| split[0] == "outlier_test" )
{
if( enablePostProc && split.size() == 2 )
outlierOpts.push_back(split[1]);
continue;
}
if( split[0] == "qNF" || split[0] == "qaNcfileFlags"
|| split[0] == "qa_ncfile_flags" )
{
if( split.size() == 2 )
qaNcfileFlags=split[1];
continue;
}
if( split[0] == "rR"
|| split[0] == "replicatedRecord"
|| split[0] == "replicated_record" )
{
if( split.size() > 1 )
{
// input could be: ..., only_groups=num
// then num would be in split[2]
std::string tmp( split[1] );
if( split.size() == 3 )
{
tmp += '=' ;
tmp += split[2] ;
}
Split csv ;
//.........这里部分代码省略.........
示例6: list
void
Base::applyOptions()
{
// options only applicable to Base properties
Split split;
split.setSeparator("=");
// now we apply to the varNames found
for( size_t j=0 ; j < optStr.size() ; ++j)
{
split = optStr[j];
if( split.size() == 2 )
{
if( isVarname( split[0] ) )
{
if( getObjName() == "IN" )
continue;
else
{
Split list(split[1], ",");
for( size_t i=0 ; i < list.size() ; i++)
varName.push_back( list[i] );
}
}
if( split[0][0] == 'f' )
{
setFilename( split[1] );
continue;
}
if( split[0] == "filling_value" ||
split[0] == "fillingValue" || split[0] == "fV"
|| split[0] == "_FillValue" )
{
isMissValSet=true;
Split spltFV(split[1],",");
for( size_t i=0 ; i < spltFV.size() ; ++i)
fillingValue.push_back( spltFV.toDouble(i) ) ;
continue;
}
}
// skip ident number
if( split.isNumber(0) )
continue;
// these are applied to each GD obj
// for( size_t i=0 ; i < pGM.size() ; ++i)
/*
{
if( split[0] == "back_rotation"
|| split[0] == "backRotation")
{
isBackRotation=true;
pGM[i]->setBackRotation();
continue;
}
*/
/*
if( split[0] == "gmt_multi_segment"
|| split[0] == "gmtMultiSegment" )
{
pGM[i]->setOutputGMT_MultiSegment();
continue;
}
if( split[0] == "oF" )
{
pGM[i]->setPrintFilename(split[1]);
continue;
}
if( split[0] == "print_cells" || split[0] == "printCells" )
{
pGM[i]->setPrintWithGeoCoord();
continue;
}
if( split[0].substr(0,3) == "reg"
|| split[0].substr(0,3) == "Reg" )
{
regionFile = split[1];
continue;
}
*/
// }
}
return;
}
示例7: enablePrintOnlyMarked
int
Ensemble::testAmbiguity( std::string &str,
bool is_only_marked,
bool isModificationTest,
bool isMixingRefused )
{
// this function operates on the time-sorted files
//detect a renewed data set testing internal time values
if( isWithTarget )
{
// Note that last points to the target
if( member[last]->end > member[sz-1]->end )
{
startIndex = sz-1;
sz = member.size();
enablePrintOnlyMarked();
str = getOutput();
return 32;
}
}
// may have added 10 eventually, depending on the type of error
int returnVal=0;
// test modification time against the target
if( isModificationTest && isWithTarget )
{
int rV=0;
for( size_t i=0 ; i < sz ; ++i)
{
// note: 'later than' is equivalent to 'greater than'
if( member[last]->modTime < member[i]->modTime )
{
enablePrintEnsemble();
member[i]->enableModTimeNote();
member[i]->putState("modification time") ;
if(!rV)
{
rV=2;
returnVal += rV;
}
}
}
}
// check the correct sequence of dates in the filename
std::string t;
std::string t0_b;
std::string t0_e;
std::string t1_b;
std::string t1_e;
Split splt;
splt.setSeparator('-');
bool isRange=false;
bool isSingular=false;
// check ascending begin and end dates from filenames, respectively.
for( size_t i=0 ; i < sz ; ++i)
{
t1_b.clear();
t1_e.clear();
size_t pos=member[i]->filename.rfind('_') + 1 ;
t=member[i]->filename.substr( pos ) ;
if( (pos=t.rfind(".nc")) < std::string::npos )
t=t.substr(0,pos);
splt=t; // separate the dates
// ensures that filenames without dates work
t1_b='X';
t1_e='X';
if( splt.size() > 0 )
{
if( hdhC::isDigit( splt[0] ) )
t1_b = splt[0] ;
if( splt.size() == 2 )
{
if( hdhC::isDigit( splt[1] ) )
t1_e = splt[1] ;
isRange=true;
}
else // singular date
{
t1_e = t1_b;
isSingular=true;
}
}
if( i > 0 && t0_e > t1_b )
{
member[i-1]->putState("misaligned filename dates");
member[i]->putState("misaligned filename dates");
//.........这里部分代码省略.........