本文整理汇总了C++中SharedUtil::isValidGroup方法的典型用法代码示例。如果您正苦于以下问题:C++ SharedUtil::isValidGroup方法的具体用法?C++ SharedUtil::isValidGroup怎么用?C++ SharedUtil::isValidGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SharedUtil
的用法示例。
在下文中一共展示了SharedUtil::isValidGroup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getMetadata
int CorrAxesCommand::getMetadata(){
try {
vector<string> groupNames;
ifstream in;
m->openInputFile(metadatafile, in);
string headerLine = m->getline(in); m->gobble(in);
istringstream iss (headerLine,istringstream::in);
//read the first label, because it refers to the groups
string columnLabel;
iss >> columnLabel; m->gobble(iss);
//save names of columns you are reading
while (!iss.eof()) {
iss >> columnLabel; m->gobble(iss);
metadataLabels.push_back(columnLabel);
}
int count = metadataLabels.size();
//read rest of file
while (!in.eof()) {
if (m->control_pressed) { in.close(); return 0; }
string group = "";
in >> group; m->gobble(in);
groupNames.push_back(group);
SharedRAbundFloatVector* tempLookup = new SharedRAbundFloatVector();
tempLookup->setGroup(group);
tempLookup->setLabel("1");
for (int i = 0; i < count; i++) {
float temp = 0.0;
in >> temp;
tempLookup->push_back(temp, group);
}
lookupFloat.push_back(tempLookup);
m->gobble(in);
}
in.close();
//remove any groups the user does not want, and set globaldata->groups with only valid groups
SharedUtil* util;
util = new SharedUtil();
Groups = m->getGroups();
util->setGroups(Groups, groupNames);
m->setGroups(Groups);
for (int i = 0; i < lookupFloat.size(); i++) {
//if this sharedrabund is not from a group the user wants then delete it.
if (util->isValidGroup(lookupFloat[i]->getGroup(), m->getGroups()) == false) {
delete lookupFloat[i]; lookupFloat[i] = NULL;
lookupFloat.erase(lookupFloat.begin()+i);
i--;
}
}
delete util;
return 0;
}
catch(exception& e) {
m->errorOut(e, "CorrAxesCommand", "getMetadata");
exit(1);
}
}