当前位置: 首页>>代码示例>>C++>>正文


C++ Hash::Add方法代码示例

本文整理汇总了C++中Hash::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ Hash::Add方法的具体用法?C++ Hash::Add怎么用?C++ Hash::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Hash的用法示例。


在下文中一共展示了Hash::Add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: prefilter_db


//.........这里部分代码省略.........

    HH_LOG(INFO)
        << "HMMs passed 1st prefilter (gapless profile-profile alignment)  : "
        << count_dbs << std::endl;

#pragma omp parallel for schedule(static)
    // Loop over all database sequences
//  for (int n = 0; n < count_dbs; n++) {
    for (size_t i = 0; i < first_prefilter.size(); i++) {
      int thread_id = 0;
#ifdef OPENMP
      thread_id = omp_get_thread_num();
#endif

      int n = first_prefilter[i].second;

      // Perform search step
      int score = swStripedByte(qc, LQ, first[n], length[n], gap_init,
          gap_extend, workspace[thread_id], workspace[thread_id] + W,
          workspace[thread_id] + 2 * W, prefilter_score_offset);

      double evalue = factor * length[n] * fpow2(-score / prefilter_bit_factor);

      if (evalue < prefilter_evalue_coarse_thresh) {
#pragma omp critical
        hits.push_back(std::pair<double, int>(evalue, n));
      }
    }

    //filter after calculation of evalues to include at least min_prefilter_hits
    sort(hits.begin(), hits.end());

    std::vector<std::pair<double, int> >::iterator second_prefilter_begin_erase =
        hits.end();
    std::vector<std::pair<double, int> >::iterator second_prefilter_end_erase =
        hits.end();
    std::vector<std::pair<double, int> >::iterator it2;

    count_dbs = 0;
    for (it2 = hits.begin(); it2 < hits.end(); it2++) {
      if (count_dbs >= min_prefilter_hits
          && (*it2).first > prefilter_evalue_thresh) {
        second_prefilter_begin_erase = it2;
        break;
      }
      else {
        count_dbs++;
      }
    }

    hits.erase(second_prefilter_begin_erase, second_prefilter_end_erase);

    count_dbs = 0;

    for (it2 = hits.begin(); it2 < hits.end(); it2++) {
      // Add hit to dbfiles
      count_dbs++;
      char db_name[NAMELEN];
      strcpy(db_name, dbnames[(*it2).second]);

      char name[NAMELEN];
      RemoveExtension(name, db_name);

      if (!doubled->Contains(db_name)) {
        doubled->Add(db_name);

        std::pair<int, std::string> result;
        result.first = length[(*it2).second];
        result.second = std::string(db_name);

        // check, if DB was searched in previous rounds
        strcat(name, "__1");  // irep=1

        if (previous_hits->Contains(name)) {
          old_prefilter_hits.push_back(result);
        }
        else {
          new_prefilter_hits.push_back(result);
        }
      }
      if (count_dbs >= maxnumdb)
      {
        HH_LOG(WARNING)
        << "Number of hits passing 2nd prefilter (reduced from " << hits.size() << " to allowed maximum of " << maxnumdb << ").\n"
        <<"You can increase the allowed maximum using the -maxfilt <max> option.\n";
        break;
      }
    }


      
      
    // Free memory
    free(qc);
    for (int i = 0; i < threads; i++)
      free(workspace[i]);
    delete[] workspace;
    if (doubled)
      delete doubled;
  }
开发者ID:andyquaile,项目名称:hh-suite,代码行数:101,代码来源:hhprefilter.cpp

示例2: main

int main(int argc, char* argv[])
{
    int i;
    int nums;
    FDATA fdata;
    Hash AddHash;
    BigFile DestBigFile;
    BigFile SourceBigFile;
    BigFileEntry *bfe;
    int numok,numnew,numupdated;
    int sourcetype;
    bool update;
    char *p1=0;
    char *p2=0;
    char *p3=0;
    int tosspath=0;
    DataHandle addhandle;
    int vargc;
    char **vargv;
    vargc=argc;
    vargv=argv;

    /* handle encrypted file */
    kGUIProt DestProt;
    bool usedestprot;
    kGUIProt SourceProt;
    bool usesourceprot;
    kGUISystemBig sysbig;

    kGUI::SetSystem(&sysbig);
    signal(SIGINT, sigint_handler);
    optcompress=false;
    optrecursive=true;
    optverify=false;
    optdelete=false;
    optmissing=false;
    usedestprot=false;
    usesourceprot=false;

#if 0
    p1="/source/kgui/_data.big";
    p2="/source/kgui/big";
    p3="/source/kgui/big/";
    optverify=true;
#endif

    for(i=1; i<vargc; ++i)
    {
        if(vargv[i][0]=='-')
        {
            switch(vargv[i][1])
            {
            case 'c':
                optcompress=true;
                break;
            case 'd':
                optdelete=true;
                break;
            case 'm':
                optmissing=true;	/* delete missing files from subdir */
                break;
            case 'v':
                optverify=true;
                break;
            case 'r':
                optrecursive=false;
                break;
            case 'k':
                if(vargv[i][2]=='d')	/* encryption key on destination file */
                {
                    printf("using dest key\n");
                    if(DestProt.SetKey(vargv[i+1],atoi(vargv[i+2]),atoi(vargv[i+3]),true)==false)
                    {
                        printf("Error loading dest keyfile '%s'\n",vargv[i+1]);
                        return(0);
                    }
                    usedestprot=true;
                    i+=3;
                }
                else if(vargv[i][2]=='s') /* encryption key on source file */
                {
                    printf("using source key\n");
                    if(SourceProt.SetKey(vargv[i+1],atoi(vargv[i+2]),atoi(vargv[i+3]),true)==false)
                    {
                        printf("Error loading source keyfile '%s'\n",vargv[i+1]);
                        return(0);
                    }
                    usesourceprot=true;
                    i+=3;
                }
                optrecursive=false;
                break;
            default:
                printf("Unknown parm '%s'\n",vargv[i]);
                return(0);
                break;
            }
        }
        else
        {
//.........这里部分代码省略.........
开发者ID:t0mac0,项目名称:kgui,代码行数:101,代码来源:kguibig.cpp


注:本文中的Hash::Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。