本文整理汇总了C++中ObjectSet::intersect方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectSet::intersect方法的具体用法?C++ ObjectSet::intersect怎么用?C++ ObjectSet::intersect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectSet
的用法示例。
在下文中一共展示了ObjectSet::intersect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadIds
MojErr MojDbSearchCursor::loadIds(ObjectSet& idsOut)
{
LOG_TRACE("Entering function %s", __FUNCTION__);
MojUInt32 groupNum = 0;
bool found = false;
MojSharedPtr<ObjectSet> group;
GroupMap groupMap;
for(;;) {
// get current id
MojObject id;
MojUInt32 idGroupNum = 0;
MojErr err = m_storageQuery->getId(id, idGroupNum, found);
MojErrCheck(err);
if (!found)
break;
// if it is in a new group, create a new set
if (!group.get() || idGroupNum != groupNum) {
// find/create new group
GroupMap::Iterator iter;
err = groupMap.find(idGroupNum, iter);
MojErrCheck(err);
if (iter != groupMap.end()) {
group = iter.value();
} else {
err = group.resetChecked(new ObjectSet);
MojErrCheck(err);
err = groupMap.put(idGroupNum, group);
MojErrCheck(err);
}
groupNum = idGroupNum;
}
// add id to current set
err = group->put(id);
MojErrCheck(err);
}
// no matches unless all groups are accounted for
MojUInt32 groupCount = m_storageQuery->groupCount();
for (MojUInt32 i = 0; i < groupCount; ++i) {
if (!groupMap.contains(i))
return MojErrNone;
}
// find intersection of all groups
GroupMap::ConstIterator begin = groupMap.begin();
for (GroupMap::ConstIterator i = begin; i != groupMap.end(); ++i) {
if (i == begin) {
// special handling for first group
idsOut = *(i.value());
} else {
MojErr err = idsOut.intersect(*(i.value()));
MojErrCheck(err);
}
}
return MojErrNone;
}