本文整理汇总了C++中EList类的典型用法代码示例。如果您正苦于以下问题:C++ EList类的具体用法?C++ EList怎么用?C++ EList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: strdup
bool ProtoBuf::ImportFile(const string& pbfile, const string& pbinc,
DiskSourceTree& dst, Importer*& ipt,
const FileDescriptor*& fd)
{
// 分离proto_file的目录和文件名
char* dd;
dd = strdup(pbfile.c_str());
string dir = dirname(dd);
free(dd);
dd = strdup(pbfile.c_str());
string file = basename(dd);
free(dd);
// 增加proto_inc
EList<string> arrPath;
if (! pbinc.empty())
{
Str::SplitTrimNoNull(pbinc, arrPath, ":");
}
// 构造proto,遍历所有的service
dst.MapPath("", dir);
GLOG(IM_DEBUG, "add %s to map path", dir.c_str());
for(string* i = arrPath.begin(); ! arrPath.end(); i = arrPath.next())
{
GLOG(IM_DEBUG, "add %s to map path", i->c_str());
dst.MapPath("", *i);
}
dst.MapPath("", SETUP_ROOT_DIR "" PROTO_DIR "/");
dst.MapPath("", SETUP_ROOT_DIR "/dev/proto/");
ipt = new Importer(&dst, new IM_ErrorCollector());
fd = ipt->Import(file);
return fd != NULL;
}
示例2: end
void MechPurchaseScreen::end()
{
if ( !acceptPressed && status != MAINMENU )
{
// sell all current stuff
EList< LogisticsMech*, LogisticsMech* > list;
LogisticsData::instance->getInventory( list );
for ( EList< LogisticsMech*, LogisticsMech* >::EIterator iter = list.End(); !iter.IsDone(); iter-- )
{
LogisticsData::instance->sellMech( (*iter) );
}
unsigned long base, color1, color2;
for ( MECH_LIST::EIterator pIter = prevInventory.Begin(); !pIter.IsDone(); pIter++ )
{
(*pIter).getColors(base, color1, color2);
LogisticsData::instance->addMechToInventory( (*pIter).getVariant(), (*pIter).getPilot(),
(*pIter).getForceGroup(), true );
}
}
variantListBox.removeAllItems(true);
inventoryListBox.removeAllItems(true);
mechDisplay.setMech( NULL );
}
示例3: statusLine_
EHttpProxyResponse::EHttpProxyResponse(const char* httpVersion,
const char* statusLine, EMap<EString*, EList<EString*>*>* headers) {
this->httpVersion = httpVersion;
this->statusLine = statusLine;
// parses the status code from the status line
EString statusLine_(statusLine);
this->statusCode = statusLine_.charAt(0) == ' ' ? EInteger::parseInt(statusLine_.substring(1, 4).c_str()) : EInteger
::parseInt(statusLine_.substring(0, 3).c_str());
this->headers.clear(); // Clear old.
if (headers) {
sp<EIterator<EMapEntry<EString*, EList<EString*>*>*> > iter = headers->entrySet()->iterator();
while (iter->hasNext()) {
EMapEntry<EString*, EList<EString*>*>* header = iter->next();
EList<EString*>* v = header->getValue();
if (v) {
EArrayList<EString*>* list = new EArrayList<EString*>(1);
sp<EIterator<EString*> > it = v->iterator();
while (it->hasNext()) {
list->add(new EString(it->next()));
}
this->headers.put(new EString(header->getKey()->c_str()), list);
}
else {
this->headers.put(new EString(header->getKey()->c_str()), null);
}
}
}
}
示例4: getHeaders
EString EHttpProxyRequest::toHttpString() {
EString sb;
sb.append(getHttpVerb()).append(' ').append(getHttpURI()).append(' ').append(getHttpVersion())
.append(EHttpProxyConstants_CRLF);
boolean hostHeaderFound = false;
if (getHeaders() != null) {
sp<EIterator<EMapEntry<EString*, EList<EString*>*>*> > iter = getHeaders()->entrySet()->iterator();
while (iter->hasNext()) {
EMapEntry<EString*, EList<EString*>*>* header = iter->next();
if (!hostHeaderFound) {
hostHeaderFound = header->getKey()->equalsIgnoreCase("host");
}
EList<EString*>* values = header->getValue();
if (values) {
sp<EIterator<EString*> > iter2 = values->iterator();
while (iter2->hasNext()) {
sb.append(header->getKey()->c_str()).append(": ").append(iter2->next()).append(EHttpProxyConstants_CRLF);
}
}
}
if (!hostHeaderFound && (eso_strcmp(getHttpVersion(), EHttpProxyConstants_HTTP_1_1) == 0)) {
sb.append("Host: ").append(getHost()).append(EHttpProxyConstants_CRLF);
}
}
sb.append(EHttpProxyConstants_CRLF);
return sb;
}
示例5: print_index_sequences
static void print_index_sequences(ostream& fout, Ebwt& ebwt)
{
EList<string>* refnames = &(ebwt.refnames());
TStr cat_ref;
ebwt.restore(cat_ref);
uint32_t curr_ref = 0xffffffff;
string curr_ref_seq = "";
uint32_t curr_ref_len = 0xffffffff;
uint32_t last_text_off = 0;
size_t orig_len = cat_ref.length();
uint32_t tlen = 0xffffffff;
bool first = true;
for(size_t i = 0; i < orig_len; i++) {
uint32_t tidx = 0xffffffff;
uint32_t textoff = 0xffffffff;
tlen = 0xffffffff;
bool straddled = false;
ebwt.joinedToTextOff(1 /* qlen */, (uint32_t)i, tidx, textoff, tlen, true, straddled);
if (tidx != 0xffffffff && textoff < tlen)
{
if (curr_ref != tidx)
{
if (curr_ref != 0xffffffff)
{
// Add trailing gaps, if any exist
if(curr_ref_seq.length() < curr_ref_len) {
curr_ref_seq += string(curr_ref_len - curr_ref_seq.length(), 'N');
}
print_fasta_record(fout, (*refnames)[curr_ref], curr_ref_seq);
}
curr_ref = tidx;
curr_ref_seq = "";
curr_ref_len = tlen;
last_text_off = 0;
first = true;
}
uint32_t textoff_adj = textoff;
if(first && textoff > 0) textoff_adj++;
if (textoff_adj - last_text_off > 1)
curr_ref_seq += string(textoff_adj - last_text_off - 1, 'N');
curr_ref_seq.push_back(cat_ref[i]);
last_text_off = textoff;
first = false;
}
}
if (curr_ref < refnames->size())
{
// Add trailing gaps, if any exist
if(curr_ref_seq.length() < curr_ref_len) {
curr_ref_seq += string(curr_ref_len - curr_ref_seq.length(), 'N');
}
print_fasta_record(fout, (*refnames)[curr_ref], curr_ref_seq);
}
}
示例6: getAdj
EList ListGraph::getAdj(NodeID u) const{
EList lst;
node* temp = ary[u].next;
while(temp != NULL){
lst.push_back(temp->p);
temp = temp->next;
};
return lst;
};
示例7:
void
Client::RemoveEventWorker(EventWorker* p_worker) {
for(EList::compatibility_iterator it = m_eventWorkers.GetFirst(); it ; it = it->GetNext()) {
if (it->GetData() == p_worker) {
//wxLogDebug(wxT("Deleting event worker"));
delete it->GetData();
m_eventWorkers.DeleteNode(it);
return;
}
}
}
示例8:
std::list<NWPair> ListGraph::getAdj(NodeID u) const
{
EList temp;
EList::const_iterator it;
for(it = edgeList[u].begin(); it != edgeList[u].end(); it++)
{
NWPair theEdge = *it;
if(theEdge.first != NULL)
temp.push_back(NWPair(theEdge.first, theEdge.second));
}
return temp;
}
示例9: getAdj
EList MatrixGraph::getAdj(NodeID u) const{
EList lst;
//for the number of nodes
for(int i = 0; i < num_nodes; i++){
// if they are atached
if(ary[u][i] != 0){
//add to the vector
lst.push_back(NWPair(i, ary[u][i]));
};
};
return lst;
};
示例10: clipLo
/**
* Clip off some of the low-numbered positions.
*/
void Edit::clipLo(EList<Edit>& ed, size_t len, size_t amt) {
size_t nrm = 0;
for(size_t i = 0; i < ed.size(); i++) {
assert_lt(ed[i].pos, len);
if(ed[i].pos < amt) {
nrm++;
} else {
// Shift everyone else up
ed[i].pos -= (uint32_t)amt;
}
}
ed.erase(0, nrm);
}
示例11: pair
// @note The general idea of this method comes from https://github.com/ScottDVincent/HW05_vincensd_v2/
std::list<NWPair> MatrixGraph::getAdj(NodeID u) const {
if (0 <= u < M.size()) {
EList list;
for(int i = 0; i < M.at(u).size(); i++) {
if (M.at(u).at(i) != 0 ) {
NWPair pair(i, M.at(u).at(i));
if (pair.second != 0)
list.push_back(pair);
}
}
return list;
}
}
示例12: fastaRefReadSizes
/**
* Calculate a vector containing the sizes of all of the patterns in
* all of the given input files, in order. Returns the total size of
* all references combined. Rewinds each istream before returning.
*/
std::pair<size_t, size_t>
fastaRefReadSizes(
EList<FileBuf*>& in,
EList<RefRecord>& recs,
const RefReadInParams& rparms,
BitpairOutFileBuf* bpout,
int& numSeqs)
{
uint32_t unambigTot = 0;
uint32_t bothTot = 0;
RefReadInParams rpcp = rparms;
assert_gt(in.size(), 0);
// For each input istream
for(size_t i = 0; i < in.size(); i++) {
bool first = true;
assert(!in[i]->eof());
// For each pattern in this istream
while(!in[i]->eof()) {
RefRecord rec = fastaRefReadSize(*in[i], rparms, first, bpout);
if((unambigTot + rec.len) < unambigTot) {
cerr << "Error: Reference sequence has more than 2^32-1 characters! Please divide the" << endl
<< "reference into batches or chunks of about 3.6 billion characters or less each" << endl
<< "and index each independently." << endl;
throw 1;
}
// Add the length of this record.
if(rec.first) numSeqs++;
unambigTot += rec.len;
bothTot += rec.len;
bothTot += rec.off;
first = false;
if(rec.len == 0 && rec.off == 0 && !rec.first) continue;
recs.push_back(rec);
}
// Reset the input stream
in[i]->reset();
assert(!in[i]->eof());
#ifndef NDEBUG
// Check that it's really reset
int c = in[i]->get();
assert_eq('>', c);
in[i]->reset();
assert(!in[i]->eof());
#endif
}
assert_geq(bothTot, 0);
assert_geq(unambigTot, 0);
return make_pair(
unambigTot, // total number of unambiguous DNA characters read
bothTot); // total number of DNA characters read, incl. ambiguous ones
}
示例13: invertPoss
/**
* Given a list of edits and a DNA string representing the query
* sequence, check that the edits are consistent with respect to the
* query.
*/
bool Edit::repOk(
const EList<Edit>& edits,
const BTDnaString& s,
bool fw,
size_t trimBeg,
size_t trimEnd)
{
if(!fw) {
invertPoss(const_cast<EList<Edit>&>(edits), s.length()-trimBeg-trimEnd, false);
swap(trimBeg, trimEnd);
}
for(size_t i = 0; i < edits.size(); i++) {
const Edit& e = edits[i];
size_t pos = e.pos;
if(i > 0) {
assert_geq(pos, edits[i-1].pos);
}
bool del = false, mm = false;
while(i < edits.size() && edits[i].pos == pos) {
const Edit& ee = edits[i];
assert_lt(ee.pos, s.length());
if(ee.type != EDIT_TYPE_SPL) {
if(ee.qchr != '-') {
assert(ee.isRefGap() || ee.isMismatch());
assert_eq((int)ee.qchr, s.toChar(ee.pos+trimBeg));
}
}
if(ee.isMismatch()) {
assert(!mm);
mm = true;
assert(!del);
} else if(ee.isReadGap()) {
assert(!mm);
} else if(ee.isRefGap()) {
assert(!mm);
assert(!del);
del = true;
} else if(ee.isSpliced()) {
}
i++;
}
}
if(!fw) {
invertPoss(const_cast<EList<Edit>&>(edits), s.length()-trimBeg-trimEnd, false);
}
return true;
}
示例14: select
void AlignerDriverRootSelector::select(
const Read& q,
const Read* qo,
bool nofw,
bool norc,
EList<DescentConfig>& confs,
EList<DescentRoot>& roots)
{
// Calculate interval length for both mates
int interval = rootIval_.f<int>((double)q.length());
if(qo != NULL) {
// Boost interval length by 20% for paired-end reads
interval = (int)(interval * 1.2 + 0.5);
}
float pri = 0.0f;
for(int fwi = 0; fwi < 2; fwi++) {
bool fw = (fwi == 0);
if((fw && nofw) || (!fw && norc)) {
continue;
}
// Put down left-to-right roots w/r/t forward and reverse-complement reads
{
bool first = true;
size_t i = 0;
while(first || (i + landing_ <= q.length())) {
confs.expand();
confs.back().cons.init(landing_, consExp_);
roots.expand();
roots.back().init(
i, // offset from 5' end
true, // left-to-right?
fw, // fw?
q.length(), // query length
pri); // root priority
i += interval;
first = false;
}
}
// Put down right-to-left roots w/r/t forward and reverse-complement reads
{
bool first = true;
size_t i = 0;
while(first || (i + landing_ <= q.length())) {
confs.expand();
confs.back().cons.init(landing_, consExp_);
roots.expand();
roots.back().init(
q.length() - i - 1, // offset from 5' end
false, // left-to-right?
fw, // fw?
q.length(), // query length
pri); // root priority
i += interval;
first = false;
}
}
}
}
示例15: print_ref_sequences
/**
* Create a BitPairReference encapsulating the reference portion of the
* index at the given basename. Iterate through the reference
* sequences, sending each one to print_ref_sequence to print.
*/
static void print_ref_sequences(
ostream& fout,
bool color,
const EList<string>& refnames,
const uint32_t* plen,
const string& adjustedEbwtFileBase)
{
BitPairReference ref(
adjustedEbwtFileBase, // input basename
color, // true -> expect colorspace reference
false, // sanity-check reference
NULL, // infiles
NULL, // originals
false, // infiles are sequences
false, // memory-map
false, // use shared memory
false, // sweep mm-mapped ref
verbose, // be talkative
verbose); // be talkative at startup
assert_eq(ref.numRefs(), refnames.size());
for(size_t i = 0; i < ref.numRefs(); i++) {
print_ref_sequence(
fout,
ref,
refnames[i],
i,
plen[i] + (color ? 1 : 0));
}
}