本文整理汇总了C++中Split类的典型用法代码示例。如果您正苦于以下问题:C++ Split类的具体用法?C++ Split怎么用?C++ Split使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Split类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LITESQL_String
UpdateQuery::operator LITESQL_String() const {
LITESQL_String q = LITESQL_L("UPDATE ") + table + LITESQL_L(" SET ");
Split sets;
for (size_t i = 0; i < fields.size(); i++)
sets.push_back(fields[i] + LITESQL_L("=") + values[i]);
q += sets.join(LITESQL_L(","));
if (_where.size())
q += LITESQL_L(" WHERE ") + _where;
return q;
}
示例2: link
void ActivityInTTS::link(const litesql::Database& db, const pomotuxdatabase::Activity& o0, const pomotuxdatabase::TodoTodaySheet& o1)
{
Record values;
Split fields;
fields.push_back(Activity.name());
values.push_back(o0.id);
fields.push_back(TodoTodaySheet.name());
values.push_back(o1.id);
db.insert(table__, values, fields);
}
示例3: 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;
}
示例4: error
bool
QuasarDB::validate(const Split& split)
{
for (unsigned int i = 0; i < split.allocations().size(); ++i) {
const AllocLine& line = split.allocations()[i];
Store store;
if (!lookup(line.store_id, store))
return error("Store doesn't exist");
}
return validate((Gltx&)split);
}
示例5: assert
Split *Split::extractSubSplit(Split &taxa_mask) {
assert(taxa_mask.getNTaxa() == getNTaxa());
Split *sp = new Split(taxa_mask.countTaxa());
int id = 0;
for (int tax = 0; tax < ntaxa; tax++)
if (taxa_mask.containTaxon(tax)) {
if (containTaxon(tax))
sp->addTaxon(id);
id++;
}
assert(id == sp->getNTaxa());
return sp;
}
示例6: rightmost_location
int rightmost_location(Split in)
{
string S = in.get_read_string();
char t = in.get_rightmost_val();
for (int i = (S.size() - 1); i >= 0; i--)
{
if (S[i] == t)
{
return i;
}
}
return -1; // return -1 if not in the string
}
示例7: subsetOf
bool Split::subsetOf (Split &sp) {
assert(ntaxa == sp.ntaxa);
for (iterator it = begin(), it2 = sp.begin(); it != end(); it++, it2++)
if ( ((*it) & (*it2)) != (*it) )
return false;
return true;
}
示例8:
bool Split::operator==(const Split &sp) const{
if (ntaxa != sp.ntaxa) return false;
for (const_iterator it = begin(), it2 = sp.begin(); it != end(); it++, it2++)
if ((*it) != (*it2))
return false;
return true;
}
示例9: lheuristic
void Splitter<Heuristic>::split_spatial(const TaskScheduler::ThreadInfo& thread, PrimRefAlloc* alloc, const BuildTriangle* triangles, const Vec3fa* vertices,
atomic_set<PrimRefBlock>& prims, const PrimInfo& pinfo, const Split& split)
{
Heuristic lheuristic(split.linfo,triangles,vertices);
Heuristic rheuristic(split.rinfo,triangles,vertices);
atomic_set<PrimRefBlock>::item* lblock = lprims.insert(alloc->malloc(thread));
atomic_set<PrimRefBlock>::item* rblock = rprims.insert(alloc->malloc(thread));
while (atomic_set<PrimRefBlock>::item* block = prims.take())
{
for (size_t i=0; i<block->size(); i++)
{
const PrimRef& prim = block->at(i);
PrimRef lprim, rprim; split.split(prim,lprim,rprim);
if (lprim.id() != size_t(-1) && !lblock->insert(lprim))
{
lheuristic.bin(lblock->base(),lblock->size());
lblock = lprims.insert(alloc->malloc(thread));
lblock->insert(lprim);
}
if (rprim.id() != size_t(-1) && !rblock->insert(rprim))
{
rheuristic.bin(rblock->base(),rblock->size());
rblock = rprims.insert(alloc->malloc(thread));
rblock->insert(rprim);
}
}
alloc->free(thread,block);
}
lheuristic.bin(lblock->base(),lblock->size()); linfo = split.linfo; lheuristic.best(lsplit);
rheuristic.bin(rblock->base(),rblock->size()); rinfo = split.rinfo; rheuristic.best(rsplit);
}
示例10: alloc
MultiThreadedSplitter<Heuristic,PrimRefBlockList>::MultiThreadedSplitter(size_t threadIndex, size_t threadCount, TaskScheduler::Event* event,
PrimRefAlloc* alloc, const RTCGeometry* geom,
PrimRefBlockList& prims_i, const PrimInfo& pinfo, const Split& split,
TaskScheduler::completeFunction cfun, void* cptr)
: alloc(alloc), prims(prims_i), pinfo(pinfo), split(split), geom(geom), cfun(cfun), cptr(cptr)
{
/* if split was not successfull enforce some split */
if (unlikely(split.linfo.size() == 0 || split.rinfo.size() == 0)) {
FallBackSplitter<Heuristic,PrimRefBlockList>::split(threadIndex,alloc,geom,prims,pinfo,lprims,linfo,lsplit,rprims,rinfo,rsplit);
cfun(cptr,threadIndex,threadCount,event);
}
/* perform spatial split */
else if (unlikely(split.spatial()))
{
new (&task) TaskScheduler::Task(event,
_task_split_parallel_spatial,this,numTasks,
_task_split_parallel_reduce,this,
"build::parsplit");
TaskScheduler::addTask(threadIndex,TaskScheduler::GLOBAL_FRONT,&task);
}
/* otherwise perform normal split */
else {
new (&task) TaskScheduler::Task(event,
_task_split_parallel, this,numTasks,
_task_split_parallel_reduce,this,
"build::parsplit");
TaskScheduler::addTask(threadIndex,TaskScheduler::GLOBAL_FRONT,&task);
}
}
示例11: lheuristic
void Splitter<Heuristic>::split(size_t thread, PrimRefAlloc* alloc, const RTCGeometry* geom,
atomic_set<PrimRefBlock>& prims, const PrimInfo& pinfo, const Split& split)
{
Heuristic lheuristic(split.linfo,geom);
Heuristic rheuristic(split.rinfo,geom);
atomic_set<PrimRefBlock>::item* lblock = lprims.insert(alloc->malloc(thread));
atomic_set<PrimRefBlock>::item* rblock = rprims.insert(alloc->malloc(thread));
while (atomic_set<PrimRefBlock>::item* block = prims.take())
{
for (size_t i=0; i<block->size(); i++)
{
const PrimRef& prim = block->at(i);
if (split.left(prim))
{
if (likely(lblock->insert(prim))) continue;
lheuristic.bin(lblock->base(),lblock->size());
lblock = lprims.insert(alloc->malloc(thread));
lblock->insert(prim);
}
else
{
if (likely(rblock->insert(prim))) continue;
rheuristic.bin(rblock->base(),rblock->size());
rblock = rprims.insert(alloc->malloc(thread));
rblock->insert(prim);
}
}
alloc->free(thread,block);
}
lheuristic.bin(lblock->base(),lblock->size()); linfo = split.linfo; lheuristic.best(lsplit);
rheuristic.bin(rblock->base(),rblock->size()); rinfo = split.rinfo; rheuristic.best(rsplit);
}
示例12: overlap
bool Split::overlap(Split &sp) {
assert(ntaxa == sp.ntaxa);
iterator it, it2;
for (it = begin(), it2 = sp.begin(); it != end(); it++, it2++)
if ((*it) & (*it2)) return true;
return false;
}
示例13: tree
void CandidateSet::addCandidateSplits(string treeString) {
vector<string> taxaNames = aln->getSeqNames();
MTree tree(treeString, taxaNames, Params::getInstance().is_rooted);
SplitGraph allSplits;
tree.convertSplits(allSplits);
for (SplitGraph::iterator splitIt = allSplits.begin(); splitIt != allSplits.end(); splitIt++) {
int value;
Split *sp = candSplits.findSplit(*splitIt, value);
if (sp != NULL) {
sp->setWeight(value + 1);
candSplits.setValue(sp, value + 1);
} else {
sp = new Split(*(*splitIt));
sp->setWeight(1);
candSplits.insertSplit(sp, 1);
}
}
candSplits.setNumTree(candSplits.getNumTree() + 1);
}
示例14: gltxCmd
// Returns a vector of Splits.
bool
QuasarDB::select(vector<Split>& splits, const SplitSelect& conditions)
{
splits.clear();
QString cmd = gltxCmd("split", "split_id", "account_id,"
"split.amount,transfer_id", conditions);
Statement stmt(connection(), cmd);
if (!execute(stmt)) return false;
while (stmt.next()) {
Split split;
int next = 1;
selectData(split, stmt, next);
selectGltx(split, stmt, next);
split.setAccountId(stmtGetId(stmt, next++));
split.setAmount(stmtGetFixed(stmt, next++));
split.setTransferAccount(stmtGetId(stmt, next++));
splits.push_back(split);
}
QString cmd1 = "select store_id,amount from split_alloc where "
"split_id = ? order by seq_num";
Statement stmt1(connection(), cmd1);
for (unsigned int i = 0; i < splits.size(); ++i) {
Id gltx_id = splits[i].id();
GLTX_ACCOUNTS(splits);
stmtSetId(stmt1, gltx_id);
if (!execute(stmt1)) return false;
while (stmt1.next()) {
AllocLine line;
line.store_id = stmtGetId(stmt1, 1);
line.amount = stmtGetFixed(stmt1, 2);
splits[i].allocations().push_back(line);
}
}
commit();
return true;
}
示例15: 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;
}