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


C++ GetPot::enable_loop方法代码示例

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


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

示例1: parseConfig


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

  
  log_=LogFile(config.follow("",2,"-l","--logfile"));

  if(config.search(2,"-D","--defaultdists"))
  {
    for(uint i=0;i<retriever_.numberOfSuffices();++i)
    {
      retriever_.dist(i,distanceMaker_.getDefaultDistance(retriever_.featureType(i)));
      retriever_.weight(i,1.0);
      DBG(10) << "default dist[" << i << "]=" << retriever_.dist(i)->name() << endl;
    }
  }

  config.init_multiple_occurrence(); // can have multiple distances
  while(config.search(2,"-d","--dist"))
  {
    uint idx=config.follow(0,2,"-d","--dist");
    string distname=config.next("basedist");  // default distance measure (dummy!)
    retriever_.weight(idx,1.0); // set default weight for configured distances
    retriever_.dist(idx,distanceMaker_.makeDistance(distname));
    DBG(10) << "dist[" << idx << "]=" << retriever_.dist(idx)->name() << endl;
  }

  config.init_multiple_occurrence(); // can have multiple weights
  while(config.search(2,"-w","--weight"))
  {
    uint idx=config.follow(0,2,"-w","--weight");
    double w=config.next(1.0);
    retriever_.weight(idx,w);
    DBG(10) << "weight[" << idx << "]=" << w << endl;
  }

  retriever_.setScoring(config.follow("linear",2,"-C","--scoring"));
  
  if(config.search(2,"-I","--interactor"))
  {
    retriever_.setInteractor(config.follow("",2,"-I","--interactor"));
  }

  config.enable_loop(); // enable returning to the beginning of command line (was disabled for multiplicity before)
  if(config.search(2,"-S","--startAfterInit"))
  {
    startAfterInit_=config.follow("echo \"No program defined\"",2,"-S","--startAfterInit");
  }

  if(config.search(2,"-P","--proxy"))
  {
    proxyhost_=config.follow("localhost",2,"-P","--proxy");
    proxyport_=config.next(12963);
    DBG(10) << "Will notify proxy at " << proxyhost_ << ":"<<proxyport_ << " about my existence." << endl;
  }

  if(config.search(2,"-r","--results"))
  {
    retriever_.results(config.follow(9,2,"-r","--results"));
    DBG(10) << "results=" << retriever_.results() << endl;
  }

  if(config.search(2,"-l","--log"))
  {
    logfile_=config.follow("log.txt",2,"-l","--log");
    DBG(10) << "logfile="<< logfile_ << endl;
  }

  if(config.search(2,"-s","--server"))
  {
    port_=config.follow(12961,2,"-s","--server");
    DBG(10) << "port="<< port_ << endl;
  }

  if(config.search(2,"-B","--batch"))
  {
    batchfile_=config.follow("batch",2,"-B","--batch");
    DBG(10) << "batchfile="<< batchfile_ << endl;
  }
  
  if(config.search("--cache")) {
    retriever_.setCache(config.follow("cache.sqlite3.db","--cache"));
  }


  if(config.search(2,"-e","--expansion"))
  {
    retriever_.extensions(config.follow(2,2,"-e","--expansion"));
    DBG(10) << "expansions=" << config.follow(2,2,"-e","--expansion") << endl;
  }

  if(config.search(2,"-p","--password"))
  {
    password_=config.follow("",2,"-p","--password");
    DBG(10) << "password necessary for changing settings: " << password_ << endl;
  }

  if(config.search(2,"-t","--type2bin"))
  {
    t2bpath=config.follow("",2,"-t","--type2bin");
    DBG(10) << "type2bin-file has been reset to: " << t2bpath << endl;
  }
}
开发者ID:418231020,项目名称:fire-cbir,代码行数:101,代码来源:server.cpp


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