static void groups(FIELD *start,int group) { FIELD *walk; TAG *scan; for (walk = start; walk; walk = walk->next) { if (walk->structure) { groups(walk->my_block,group); continue; } if (walk->value) switch (walk->value->type) { case vt_id: break; case vt_case: case vt_multi: for (scan = walk->value->tags; scan; scan = scan->next) { int start_field,length,offset; if (scan->block && scan->block->structure && scan->block->structure->instances < 0) { start_field = scan->block->structure->first_field; length = scan->block->structure->fields; offset = scan->block->my_block->field- scan->block->structure->first_field; } else { start_field = -1; length = offset = 0; } if (scan->id) to_test(" \"%s\",\n",scan->id); if (scan->block && scan->block->has_required) if (scan->block->id) to_c(" { %d, required_%d, %d, %d, %d }, " "/* %s */\n",group,scan->group,start_field, length,offset,scan->block->id); else to_c(" { %d, required_%d, %d, %d, %d },\n", group,scan->group,start_field,length,offset); else to_c(" { %d, NULL, %d, %d, %d },\n",group, start_field,length,offset); groups(scan->block,scan->group); } break; case vt_length: groups(walk->value->block,group); break; default: abort(); } } }
QVariant TimeSig::getProperty(P_ID propertyId) const { switch (propertyId) { case P_ID::SHOW_COURTESY: return int(showCourtesySig()); case P_ID::NUMERATOR_STRING: return numeratorString(); case P_ID::DENOMINATOR_STRING: return denominatorString(); case P_ID::GROUPS: return QVariant::fromValue(groups()); case P_ID::TIMESIG: return QVariant::fromValue(_sig); case P_ID::TIMESIG_GLOBAL: return QVariant::fromValue(globalSig()); case P_ID::TIMESIG_STRETCH: return QVariant::fromValue(stretch()); case P_ID::TIMESIG_TYPE: return int(_timeSigType); case P_ID::SCALE: return _scale; default: return Element::getProperty(propertyId); } }
const QList<Entry> & get() { static QList<Entry> profiles; static bool init=false; if(!init) { static const char * constProfileDir="/etc/ufw/applications.d/"; QStringList files(QDir(constProfileDir).entryList()); QStringList::ConstIterator it(files.constBegin()), end(files.constEnd()); for(; it!=end; ++it) if((*it)!="." && (*it)!="..") { KConfig cfg(constProfileDir+(*it), KConfig::SimpleConfig); QStringList groups(cfg.groupList()); QStringList::ConstIterator gIt(groups.constBegin()), gEnd(groups.constEnd()); for(; gIt!=gEnd; ++gIt) { QString ports(cfg.group(*gIt).readEntry("ports", QString())); if(!ports.isEmpty() && !profiles.contains(*gIt)) profiles.append(Entry(*gIt, ports)); } } qSort(profiles); } return profiles; }
int main() { int n, m, t; if(scanf("%d\n", &t)); for(int q = 0; q < t; ++q) { if(scanf("%d %d\n", &n, &m)); DEBUG(printf("N = %d M = %d\n", n, m)); union_find groups(n); for(int i = 0; i < m; ++i) { int i, j; if(scanf("%d %d", &i, &j)); DEBUG(printf("READ %d %d\n", i, j)); groups.unite(i-1, j-1); DEBUG(groups.dump()); } DEBUG(printf("DS %d\n", groups.distinct_sets())); size_t largest = 0; for(size_t i = 0; i < groups.size(); ++i) if(groups.count(i) > largest) largest = groups.count(i); printf("%d\n", largest); } return 0; }
void MetaSQLSaveParameters::sGetGroups() { ParameterList params; if (_schema->currentText() == "public") params.append("public"); else if (! _schema->currentText().isEmpty()) params.append("schema", _schema->currentText()); QString groups("SELECT DISTINCT metasql_group" "<? if exists(\"public\") ?>" " FROM ONLY metasql" "<? elseif exists(\"schema\") ?>" " FROM <? literal(\"schema\") ?>.pkgmetasql" "<? else ?>" " FROM metasql" "<? endif ?>" " ORDER BY metasql_group;"); MetaSQLQuery groupm(groups); XSqlQuery groupq = groupm.toQuery(params); groupq.exec(); _group->clear(); _group->addItem(""); while (groupq.next()) _group->addItem(groupq.value("metasql_group").toString()); if (groupq.lastError().type() != QSqlError::NoError) QMessageBox::warning(this, tr("Database Errror"), groupq.lastError().text()); _group->setCurrentIndex(-1); }
vector< vector<TPosition> > splitToParts(const TBoard& board, int partsNum, const TPositionsV& centers, vector<vector<int> >* marks) { // O(m * n) int X, Y; X = board.XMax; Y = board.YMax; marks->clear(); marks->assign(X, vector<int> (Y, -1)); queue<TPosition> Q; for (int i = 0; i < centers.size(); ++i) { Q.push(centers[i]); (*marks)[centers[i].X][centers[i].Y] = i; } while(!Q.empty()) { TPosition p = Q.front(); Q.pop(); vector<TPosition> moves = board.getNeighbours(p); for (int i = 0; i < moves.size(); ++i) { if (board.IsPassable(moves[i])) { int x = moves[i].X; int y = moves[i].Y; if ((*marks)[x][y] == -1) { (*marks)[x][y] = (*marks)[p.X][p.Y]; Q.push(moves[i]); } } } } vector<vector<TPosition> > groups(centers.size()); for (int i = 0; i < marks->size(); ++i) for (int j = 0; j < (*marks)[i].size(); ++j) if ((*marks)[i][j] >= 0) groups[(*marks)[i][j]].push_back(TPosition(i, j)); //debug(*marks); return groups; }
void PolyMesh::updateVertNormalGroups(Vertex *vert) { PolyMesh::VertFaceIter f; ArraySet<SmoothGroup> groups(8); int g = 0; //Walk the adjacent faces and merge smooth groups for (f.begin(vert); !f.end(); ++f) { //Walk the existing groups int matchCount = 0; SmoothGroup *firstMatch = NULL; for (g=0; g<groups.size(); ) { //Add normal if any common smoothing group if (groups[g] == *f) { groups[g] += (*f); //Store first match if (++matchCount == 1) { firstMatch = &groups[g]; }else { //Merge multiple matches (*firstMatch) += groups[g]; groups.removeAt (g); continue; } } g++; } //Walk groups //Create a new group if (matchCount == 0) groups.add (SmoothGroup (*f)); }//Walk faces //Average out the group normals and create //a new vertex normal for each for (g=0; g<groups.size(); ++g) { groups[g].normal /= (Float)groups[g].faceCount; vertexNormals.pushBack (VertexNormal (groups[g].normal)); vertexNormals.last().vert = vert; groups[g].vnormal = &vertexNormals.last(); } //Pass2: Apply unique normals to faces for (f.begin(vert); !f.end(); ++f) { //Find the matching merged group for (g=0; g<groups.size(); ++g) { if (groups[g] == *f) { f.hedgeToVertex()->vnormal = groups[g].vnormal; break; }} } }
int Family::ConnectedGroups(IntArray * groupMembership) { IntArray groups(count); // Use the quick union algorithm to identify connected groups groups.SetSequence(0, 1); for (int i = count - 1; i >= founders; i--) { // Lookup parents int group0 = i; int group1 = ped[path[i]].father->traverse; int group2 = ped[path[i]].mother->traverse; // Identify their corresponding groupings while (groups[group0] != group0) group0 = groups[group0]; while (groups[group1] != group1) group1 = groups[group1]; while (groups[group2] != group2) group2 = groups[group2]; int group = group1 < group2 ? group1 : group2; if (group0 < group) group = group0; groups[group0] = groups[group1] = groups[group2] = group; } // Count groupings int groupCount = 0; for (int i = 0; i < founders; i++) if (groups[i] == i) groupCount++; if (groupMembership == NULL) return groupCount; // Flatten tree so all items point to root for (int i = 1; i < count; i++) groups[i] = groups[groups[i]]; // Update group membership info int group = 0; groupMembership->Dimension(count); for (int i = 0; i < count; i++) if (groups[i] == i) (*groupMembership)[i] = ++group; else (*groupMembership)[i] = (*groupMembership)[groups[i]]; #if 0 // This stretch of code outputs family structure and group membership // And should usually be commented out! for (int j = first; j <= last; j++) printf("%s %s %s %s %d %d\n", (const char *) famid, (const char *) ped[j].pid, (const char *) ped[j].fatid, (const char *) ped[j].motid, ped[j].sex, groups[ped[j].traverse]); #endif return groupCount; }
bool TimeSig::operator==(const TimeSig& ts) const { return (timeSigType() == ts.timeSigType()) && (sig().identical(ts.sig())) && (stretch() == ts.stretch()) && (groups() == ts.groups()) && (_numeratorString == ts._numeratorString) && (_denominatorString == ts._denominatorString) ; }
bool TimeSig::operator==(const TimeSig& ts) const { return (timeSigType() == ts.timeSigType()) && (sig().identical(ts.sig())) && (stretch() == ts.stretch()) && (groups() == ts.groups()) && (customText == ts.customText) && (!customText || (_numeratorString == ts._numeratorString && _denominatorString == ts._denominatorString)) ; }
TStringList FavoriteHubsFrame::getSortedGroups() const { set<tstring, noCaseStringLess> sorted_groups; const FavHubGroups& favHubGroups = FavoriteManager::getInstance()->getFavHubGroups(); for(FavHubGroups::const_iterator i = favHubGroups.begin(), iend = favHubGroups.end(); i != iend; ++i) sorted_groups.insert(Text::toT(i->first)); TStringList groups(sorted_groups.begin(), sorted_groups.end()); groups.insert(groups.begin(), Util::emptyStringT); // default group (otherwise, hubs without group don't show up) return groups; }
TStringList FavoriteHubsFrame::getSortedGroups() const { set<tstring, noCaseStringLess> sorted_groups; const FavHubGroups& favHubGroups = FavoriteManager::getInstance()->getFavHubGroups(); for(const auto& fhg: favHubGroups | map_keys) sorted_groups.insert(Text::toT(fhg)); TStringList groups(sorted_groups.begin(), sorted_groups.end()); groups.insert(groups.begin(), Util::emptyStringT); // default group (otherwise, hubs without group don't show up) return groups; }
int GetGroups(std::string file, char** groupIds , char** subjgroups, char** Groups) { std::ifstream groups(file.c_str(), std::ios::in); int length = 0; int length1 = 0; int length2 = 0; int first_line = 0; if (groups) { std::string s; while ( getline(groups,s) ) { if (first_line != 0) { // Get the values int pos = s.find(' ',0); int l; char group_name[20]; l = s.copy(group_name,pos,0); group_name[l] = '\0'; int pos1= s.find(' ',pos+1); int t; char subj_name[100]; t =s.copy(subj_name,pos1-pos-1,pos+1); subj_name[t]='\0'; int test = 0; for (int i = 0; i < length; ++i) if ( strcmp(groupIds[i], group_name) == 0 ) test = 1; //New entry if test = 0 if (test == 0) { groupIds[length] = new char[pos+1]; strcpy(groupIds[length],group_name); length++; } subjgroups[length1]= new char[pos1-pos+1]; strcpy(subjgroups[length1],subj_name); length1++; Groups[length2] = new char[pos+1]; strcpy(Groups[length2],group_name); length2++; } first_line = 1; s.clear(); } groups.close(); } else std::cerr << "File doesn't exist" << std::endl; return length; }
void FavoriteHubsFrame::fillList() { bool old_nosave = m_nosave; m_nosave = true; ctrlHubs.DeleteAllItems(); // sort groups TStringList groups(getSortedGroups()); for (size_t i = 0; i < groups.size(); ++i) { // insert groups LVGROUP lg = {0}; lg.cbSize = sizeof(lg); lg.iGroupId = static_cast<int>(i); lg.state = LVGS_NORMAL | #ifdef FLYLINKDC_SUPPORT_WIN_XP (CompatibilityManager::isOsVistaPlus() ? LVGS_COLLAPSIBLE : 0) #else LVGS_COLLAPSIBLE #endif ; lg.mask = LVGF_GROUPID | LVGF_HEADER | LVGF_STATE | LVGF_ALIGN; lg.uAlign = LVGA_HEADER_LEFT; // Header-title must be unicode (Convert if necessary) lg.pszHeader = (LPWSTR)groups[i].c_str(); lg.cchHeader = static_cast<int>(groups[i].size()); ctrlHubs.InsertGroup(i, &lg); } { // [!] IRainman fix. FavoriteManager::LockInstanceHubs lockedInstanceHubs; const auto& fl = lockedInstanceHubs.getFavoriteHubs(); auto cnt = ctrlHubs.GetItemCount(); for (auto i = fl.cbegin(); i != fl.cend(); ++i) { const string& group = (*i)->getGroup(); int index = 0; if (!group.empty()) { TStringList::const_iterator groupI = find(groups.begin() + 1, groups.end(), Text::toT(group)); if (groupI != groups.end()) index = groupI - groups.begin(); } addEntry(*i, cnt++, index); } } m_nosave = old_nosave; }
const std::string toString() const { std::ostringstream oss; oss << " <ipProtocol>" << ipProtocol() << "</ipProtocol>" << std::endl << " <fromPort>" << fromPort() << "</fromPort>" << std::endl << " <toPort>" << toPort() << "</toPort>" << std::endl << " <groups>" << groups() << "</groups>" << std::endl << " <ipRanges>" << ipRanges() << "</ipRanges>" << std::endl ; return oss.str(); }
void Ut_DBusInterfaceNotificationSink::testSendingGroupsToProxy() { QList<Notification> notifications; gNotificationManagerStub->stubSetReturnValue("notifications", notifications); QList<NotificationGroup> groups(createGroups()); gNotificationManagerStub->stubSetReturnValue("groups", groups); sink->registerSink("service1", "path"); QCOMPARE(gAddGroupProxies.count(), 1); }
void GraphiteLoadMenu::slotAboutToShow() { mSavedDescMap = GraphiteSavedDesc::select().groupedBy<QString,GraphiteSavedDescList>( "group" ); clear(); QStringList groups(mSavedDescMap.keys()); groups.sort(); foreach( QString group, groups ) { QMenu * menu = new QMenu( group, this ); addMenu( menu ); connect( menu, SIGNAL( aboutToShow() ), SLOT( slotAboutToShowGroupMenu() ) ); connect( menu, SIGNAL( triggered(QAction*) ), SLOT( slotSavedDescTriggered(QAction*) ) ); }
TStringList FavoriteHubsFrame::getSortedGroups() const { std::set<tstring, noCaseStringLess> sorted_groups; { FavoriteManager::LockInstanceHubs lockedInstanceHubs; const FavHubGroups& favHubGroups = lockedInstanceHubs.getFavHubGroups(); for (auto i = favHubGroups.cbegin(), iend = favHubGroups.cend(); i != iend; ++i) sorted_groups.insert(Text::toT(i->first)); } TStringList groups(sorted_groups.begin(), sorted_groups.end()); groups.insert(groups.begin(), Util::emptyStringT); // default group (otherwise, hubs without group don't show up) return groups; }
FriendGroups Communicator::getFriendGroups() { QVariantList params = authParams(); if (params.size() == 0) return FriendGroups(); request("LJ.XMLRPC.getfriendgroups", params); std::auto_ptr<QBuffer> buffer(m_responses.take(m_currentRequestId)); QByteArray buf = buffer->buffer(); FriendGroups groups(buf); return groups; }
void nix::file::BlockFS::createSubFolders(const std::shared_ptr<base::IFile> &file) { bfs::path data_arrays("data_arrays"); bfs::path tags("tags"); bfs::path multi_tags("multi_tags"); bfs::path sources("sources"); bfs::path p(location()); bfs::path groups("groups"); data_array_dir = Directory(p / data_arrays, file->fileMode()); tag_dir = Directory(p / tags, file->fileMode()); multi_tag_dir = Directory(p / multi_tags, file->fileMode()); source_dir = Directory(p / sources, file->fileMode()); group_dir = Directory(p / groups, file->fileMode()); }
int cmd(string str){ string *raw_array; string *grps = groups(); string ret = ""; PLAYERS_D->CompileCreList(); raw_array = sort_array(PLAYERS_D->GetCreatorList(),1); foreach(string wiz in raw_array){ string tmp = wiz; foreach(string group in grps){ if(member_group(wiz, group)) tmp += " "+group+","; } if(last(tmp,1) == ",") tmp = truncate(tmp,1); ret += capitalize(tmp)+"\n"; }
int GetNumberGroups(std::string file) { std::ifstream groups(file.c_str(), std::ios::in); int c = 0; if (groups) { std::string s; while ( getline(groups,s) ) c++; groups.close(); } else std::cerr << "File doesn't exist" << std::endl; return c; }
void MessageLoop::connect(const std::string &host, int port) { LOG(moba::INFO) << "Try to connect (" << host << ":" << port << ")..." << std::endl; this->msgHandler.connect(host, port); moba::JsonArrayPtr groups(new moba::JsonArray()); groups->push_back(moba::toJsonStringPtr("BASE")); groups->push_back(moba::toJsonStringPtr("ENV")); groups->push_back(moba::toJsonStringPtr("SYSTEM")); this->appId = this->msgHandler.registerApp( this->appName, this->version, groups ); LOG(moba::NOTICE) << "AppId <" << this->appId << ">" << std::endl; }
static int OnContactMenuBuild(WPARAM wParam, LPARAM) { int i; OBJLIST<GroupItemSort> groups(10, GroupItemSort::compare); if (!hMoveToGroupItem) { CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 100000; mi.pszName = LPGEN("&Move to group"); mi.flags = CMIF_ROOTHANDLE; mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_GROUP); hMoveToGroupItem = Menu_AddContactMenuItem(&mi); } for (i=0; i < lphGroupsItems.getCount(); i++) CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)lphGroupsItems[i], 0); lphGroupsItems.destroy(); ptrT szContactGroup( db_get_tsa((HANDLE)wParam, "CList", "Group")); int pos = 1000; AddGroupItem(hMoveToGroupItem, TranslateT("<Root group>"), pos, -1, !szContactGroup); pos += 100000; // Separator for (i=0; ; i++) { char intname[20]; _itoa(i, intname, 10); DBVARIANT dbv; if (db_get_ts(NULL, "CListGroups", intname, &dbv)) break; if (dbv.ptszVal[0]) groups.insert(new GroupItemSort(dbv.ptszVal + 1, i + 1)); mir_free(dbv.ptszVal); } for (i=0; i < groups.getCount(); i++) { bool checked = szContactGroup && !_tcscmp(szContactGroup, groups[i].name); AddGroupItem(hMoveToGroupItem, groups[i].name, ++pos, groups[i].position, checked); } return 0; }
static void EI_PostCreate(BaseExtraIcon *extra, const char *name, int _hLang) { char setting[512]; mir_snprintf(setting, "Position_%s", name); extra->setPosition(db_get_w(NULL, MODULE_NAME, setting, 1000)); mir_snprintf(setting, "Slot_%s", name); int slot = db_get_w(NULL, MODULE_NAME, setting, 1); if (slot == (WORD)-1) slot = -1; extra->setSlot(slot); extra->m_hLangpack = _hLang; registeredExtraIcons.insert(extra); extraIconsByHandle.insert(extra); LIST<ExtraIconGroup> groups(1); LoadGroups(groups); ExtraIconGroup *group = IsInGroup(groups, extra); if (group != NULL) RebuildListsBasedOnGroups(groups); else { for (int i = 0; i < groups.getCount(); i++) delete groups[i]; extraIconsBySlot.insert(extra); } if (slot >= 0 || group != NULL) { if (clistRebuildAlreadyCalled) extra->rebuildIcons(); slot = 0; for (int i = 0; i < extraIconsBySlot.getCount(); i++) { ExtraIcon *ex = extraIconsBySlot[i]; if (ex->getSlot() < 0) continue; int oldSlot = ex->getSlot(); ex->setSlot(slot++); if (clistApplyAlreadyCalled && (ex == group || ex == extra || oldSlot != slot)) extra->applyIcons(); } } }
static int OnContactMenuBuild(WPARAM wParam, LPARAM) { int i; OBJLIST<GroupItemSort> groups(10, GroupItemSort::compare); if (!hMoveToGroupItem) { CMenuItem mi; SET_UID(mi, 0x403c548, 0x4ac6, 0x4ced, 0xa7, 0x6c, 0x4e, 0xb9, 0xc8, 0xba, 0x94, 0x5); mi.position = 100000; mi.name.a = LPGEN("&Move to group"); mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_GROUP); hMoveToGroupItem = Menu_AddContactMenuItem(&mi); } for (i=0; i < lphGroupsItems.getCount(); i++) Menu_RemoveItem((HGENMENU)lphGroupsItems[i]); lphGroupsItems.destroy(); ptrT szContactGroup(db_get_tsa(wParam, "CList", "Group")); int pos = 1000; AddGroupItem(hMoveToGroupItem, TranslateT("<Root group>"), pos, -1, !szContactGroup); pos += 100000; // Separator for (i=0; ; i++) { char intname[20]; _itoa(i, intname, 10); DBVARIANT dbv; if (db_get_ts(NULL, "CListGroups", intname, &dbv)) break; if (dbv.ptszVal[0]) groups.insert(new GroupItemSort(dbv.ptszVal + 1, i + 1)); mir_free(dbv.ptszVal); } for (i=0; i < groups.getCount(); i++) { bool checked = szContactGroup && !mir_tstrcmp(szContactGroup, groups[i].name); AddGroupItem(hMoveToGroupItem, groups[i].name, ++pos, groups[i].position, checked); } return 0; }
void CMainFrame::handleItemAdded( const JID& jid ) { auto roster=GetContext()->GetClient()->rosterManager()->getRosterItem(jid); if(roster==NULL) return; CBuddyListItem *item=new CBuddyListItem; item->SetJid(jid); item->SetName(utf8dec(roster->name())); item->SetHeader(GetContext()->GetHeaderManager().GetHeader(jid,item->IsOnline())); m_pBuddyList->AddBuddy(utf8dec(roster->groups().front()),*item); auto vcardMgr=GetContext()->GetVCardManager(); if(vcardMgr) vcardMgr->fetchVCard(jid,this); }
void FavoriteHubsFrame::handleMove(bool up) { FavoriteHubEntryList& fh = FavoriteManager::getInstance()->getFavoriteHubs(); if(fh.size() <= 1) return; StateKeeper keeper(ctrlHubs); const FavoriteHubEntryList& selected = keeper.getSelection(); FavoriteHubEntryList fh_copy = fh; if(!up) reverse(fh_copy.begin(), fh_copy.end()); FavoriteHubEntryList moved; for(FavoriteHubEntryList::iterator i = fh_copy.begin(); i != fh_copy.end(); ++i) { if(find(selected.begin(), selected.end(), *i) == selected.end()) continue; if(find(moved.begin(), moved.end(), *i) != moved.end()) continue; const string& group = (*i)->getGroup(); for(FavoriteHubEntryList::iterator j = i; ;) { if(j == fh_copy.begin()) { // couldn't move within the same group; change group. TStringList groups(getSortedGroups()); if(!up) reverse(groups.begin(), groups.end()); TStringIterC ig = find(groups.begin(), groups.end(), Text::toT(group)); if(ig != groups.begin()) { FavoriteHubEntryPtr f = *i; f->setGroup(Text::fromT(*(ig - 1))); i = fh_copy.erase(i); fh_copy.push_back(f); moved.push_back(f); } break; } if((*--j)->getGroup() == group) { swap(*i, *j); break; } } } if(!up) reverse(fh_copy.begin(), fh_copy.end()); fh = fh_copy; FavoriteManager::getInstance()->save(); fillList(); }
void ModelWriter::visitFaces(SUEntitiesRef ents, VisitorFunc func, bool recursive, Transform transform) { size_t count =0; SUEntitiesGetNumFaces(ents,&count); vector<SUFaceRef> faces(count); SUEntitiesGetFaces(ents,count,faces.data(),&count); for(int i=0; i < count; i++){ (*this.*func)(faces[i], transform); } SUEntitiesGetNumGroups(ents,&count); vector<SUGroupRef> groups(count); SUEntitiesGetGroups(ents,count,groups.data(),&count); for(int i=0; i < count; i++){ SUEntitiesRef ents2 = SU_INVALID; SUGroupGetEntities(groups[i],&ents2); Transform t; SUGroupGetTransform(groups[i], (SUTransformation*)&t); visitFaces(ents2,func,true, transform * t); } if(recursive) { SUEntitiesGetNumInstances(ents,&count); vector<SUComponentInstanceRef> instances(count); SUEntitiesGetInstances(ents,count,instances.data(),&count); for(int i=0; i < count; i++){ Transform t; SUComponentDefinitionRef def = SU_INVALID; SUEntitiesRef ents2 = SU_INVALID; SUComponentInstanceGetTransform(instances[i],(SUTransformation*)&t); SUComponentInstanceGetDefinition(instances[i],&def); SUComponentDefinitionGetEntities(def,&ents2); visitFaces(ents2,func,true, transform * t); } } }
int main (int argc, char *argv[]) { unsigned total; std::string input; std::string output; po::options_description desc("Allowed options"); desc.add_options() ("help,h", "produce help message.") ("total", po::value(&total), "") ("input", po::value(&input), "") ("output", po::value(&output), "") ; po::positional_options_description p; p.add("input", 1).add("output", 1); po::variables_map vm; po::store(po::command_line_parser(argc, argv). options(desc).positional(p).run(), vm); po::notify(vm); if (vm.count("help") || (vm.count("input") == 0) || (vm.count("output") == 0) || (vm.count("total") == 0)) { std::cerr << desc; return 1; } std::vector<std::vector<std::vector<nise::ImageID>>> groups(nise::CONTAINER_SIZE); std::vector<int32_t> ids(total); std::fill(ids.begin(), ids.end(), -1); nise::ImageID cur = 0; // loading, write whole containers std::ifstream is(input.c_str(), std::ios::binary); for (;;) { std::vector<nise::ImageID> gr; nise::ReadVector<nise::ImageID>(is, &gr); if (!is) break; if (gr.size() > nise::CONTAINER_SIZE) break; // reaching the end BOOST_VERIFY(gr.size() <= nise::CONTAINER_SIZE); if (gr.size() == nise::CONTAINER_SIZE) { BOOST_FOREACH(auto v, gr) { ids[v] = cur++; } } else {