本文整理汇总了C++中auto_vector::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ auto_vector::empty方法的具体用法?C++ auto_vector::empty怎么用?C++ auto_vector::empty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类auto_vector
的用法示例。
在下文中一共展示了auto_vector::empty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoStyle
void Styler_Syntax::DoStyle(StyleRun& sr, unsigned int offset, const auto_vector<stxmatch>& matches) {
const unsigned int rstart = sr.GetRunStart();
const unsigned int rend = sr.GetRunEnd();
const unsigned int styleStart = offset < rstart ? rstart - offset : 0;
const stxmatch m(wxEmptyString, NULL, styleStart, 0, 0, 0, NULL);
if (matches.empty()) return;
auto_vector<stxmatch>::const_iterator p = lower_bound(matches.begin(), matches.end(), &m, stxmatch_start_less());
if (p != matches.begin()) --p;
for (; p != matches.end(); ++p) {
const unsigned int mStart = (*p)->start+offset;
const unsigned int mEnd = (*p)->end+offset;
if (mStart > rend) break;
// Check for overlap
if (mEnd > rstart && mStart < rend) {
const unsigned int start = wxMax(rstart, mStart);
const unsigned int end = wxMin(rend, mEnd);
const style* st = (*p)->st;
if (st) {
if (st->foregroundcolor != wxNullColour) sr.SetForegroundColor(start, end, st->foregroundcolor);
if (st->backgroundcolor != wxNullColour) {
sr.SetBackgroundColor(start, end, st->backgroundcolor);
if (mEnd > rend) sr.SetExtendBgColor(st->backgroundcolor);
}
if (st->fontflags != wxFONTFLAG_DEFAULT) sr.SetFontStyle(start, end, st->fontflags);
}
// Check if there are submatches
if ((*p)->subMatch.get()) {
DoStyle(sr, (*p)->start+offset, (*p)->subMatch->matches);
}
}
}
}
示例2: main
int main(int argc,char** argv)
{
const char* exonFile=0;
int optind=1;
char* faidxfile=NULL;
while(optind < argc)
{
if(strcmp(argv[optind],"-h")==0)
{
this->usage(cerr,argc,argv);
return(EXIT_FAILURE);
}
else if(strcmp(argv[optind],"-f")==0 && optind+1< argc)
{
faidxfile = argv[++optind];
}
else if(strcmp(argv[optind],"-g")==0 && optind+1< argc)
{
exonFile=argv[++optind];
}
else if(strcmp(argv[optind],"--")==0)
{
++optind;
break;
}
else if(argv[optind][0]=='-')
{
cerr << "unknown option '" << argv[optind]<< "'" << endl;
this->usage(cerr,argc,argv);
return EXIT_FAILURE;
}
else
{
break;
}
++optind;
}
if(faidxfile==0)
{
cerr << "no fasta genome defined." << endl;
this->usage(cerr,argc,argv);
return EXIT_FAILURE;
}
this->faidx.reset(new IndexedFasta(faidxfile));
if(exonFile==0)
{
cerr << "no bed for exons defined." << endl;
this->usage(cerr,argc,argv);
return EXIT_FAILURE;
}
if(optind==argc)
{
cerr << "BAM files missing"<< endl;
return EXIT_FAILURE;
}
else
{
while(optind< argc)
{
char* bamfile=argv[optind++];
WHERE("Open "<< bamfile);
BamFile2* bam=new BamFile2(bamfile);
this->bamFiles.push_back(bam);
bam->open(true);
}
}
//open exon file
igzstreambuf buf(exonFile);
istream in(&buf);
this->readExons(in);
buf.close();
if(exons.empty())
{
cerr << "No exon.\n";
return EXIT_FAILURE;
}
run();
for(size_t i=0;i< bamFiles.size();++i)
{
bamFiles[i]->close();
}
return EXIT_SUCCESS;
}
示例3: run
void run(std::istream& in)
{
vector<string> tokens;
string line;
int chromCol=0;
int posCol=1;
int idCol=2;
int refCol=3;
int altCol=4;
int sampleCol=-1;
while(getline(in,line,'\n'))
{
if(AbstractApplication::stopping()) break;
if(line.empty() || line[0]=='#') continue;
tokenizer.split(line,tokens);
string chrom=tokens[chromCol];
chat *p2;
int pos=(int)strtol(tokens[posCol].c_str(),&p2,10);
string id=tokens[idCol];
string ref=tokens[refCol];
string alt=tokens[altCol];
string sampleName=tokens[sampleCol];
Row* therow=NULL;
if(!rows.empty() &&
rows.back()->pos->chrom.compare(chrom)==0 &&
rows.back()->pos->pos==pos &&
rows.back()->ref.compare(ref)==0 &&
rows.back()->alt.compare(alt)==0
)
{
therow=rows.back();
}
else
{
therow=new Row;
therow->pos=new ChromPosition(chrom,pos);
therow->id.assign(id);
therow->ref.assign(ref);
therow->alt.assign(alt);
rows.push_back(therow);
}
int index_sample=0;
if(sampleCol==-1)
{
if(sample2col.empty())
{
Sample* sample=new Sample;
sample->name.assign("Sample");
sample->column_index=0;
samples.push_back(sample);
}
index_sample=0;
}
else
{
map<string,Sample*>::iterator r= sample2col.find(sampleName);
if(r==sample2col.end())
{
Sample* sample=new Sample;
sample->name.assign(sampleName);
sample->column_index=sample2col.size();
index_sample=sample->column_index;
samples.push_back(sample);
sample2col.put(sample->name,sample);
}
else
{
index_sample=r->second->column_index;
}
}
if(index_sample>=therow->data.size())
{
therow->data.resize(index_sample+1);
}
Data* data=new Data;
therow->data.assign(index_sample,data);
}
}