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


C++ variables_map::count方法代码示例

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


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

示例1: read_arguments

 void read_arguments(po::variables_map& arguments) {
     if (arguments.count("lumi") == 0) {
         TERMINATE("No Luminosity specified!");
     }
     if (arguments.count("xs") == 0) {
         TERMINATE("No cross-section file specified!");
     }
     std::ifstream xsf(xs_file);
     FATAL_ASSERT(xsf.good(), "Couldn't read xs file");
     while(!xsf.eof()) {
         std::string _ln;
         std::getline(xsf, _ln);
         if (_ln.size() < 2) continue;
         if (_ln[0] == '#') continue;
         std::stringstream ln(_ln);
         int run; double w, k, filt;
         ln >> std::skipws;
         ln >> run >> w;
         if (ln.fail()) {
             WARNING("Failed to read line: ", ln.str());
             continue;
         }
         ln >> k >> filt;
         if (!ln.fail()) w *= k*filt;
         xs[run] = w;
     }
 }
开发者ID:JohannesEbke,项目名称:a4,代码行数:27,代码来源:a4reweight.cpp

示例2: ProcessVariables

    void ProcessVariables(const po::variables_map& variables) override {
        IndexWriterConfig.Verbose = variables.count("verbose");
        if (variables.count("chunk-size"))
            IndexWriterConfig.ChunkSize = variables["chunk-size"].as<size_t>();

        Home = variables["home"].as<std::string>();
        Proxy = variables["proxy"].as<std::string>();
    }
开发者ID:pavelkalinnikov,项目名称:codesearch,代码行数:8,代码来源:main.cpp

示例3: parseOptions

bool ThorScriptParserStage::parseOptions(po::variables_map& vm)
{
	debug_parser = (vm.count("debug-parser") > 0);
	debug_ast = (vm.count("debug-parser-ast") > 0);
	debug_ast_with_loc = (vm.count("debug-parser-ast-with-loc") > 0);
	use_relative_path = (vm.count("use-relative-path") > 0);
	dump_graphviz = (vm.count("dump-graphviz") > 0);
    if(vm.count("dump-graphviz-dir") > 0)
    {
        dump_graphviz_dir = vm["dump-graphviz-dir"].as<std::string>();
    }
    if(vm.count("prepand-package"))
    {
        prepand_package = vm["prepand-package"].as<std::string>();
    }

	if(vm.count("root-dir") == 0)
		root_dir = boost::filesystem::current_path() / "src";
	else
	{
		root_dir = vm["root-dir"].as<std::string>();
		root_dir = normalize_path(root_dir);
	}

	if(vm.count("input") == 0)
		return false;

	inputs = vm["input"].as<std::vector<std::string>>();
	return true;
}
开发者ID:zillians,项目名称:supercell_language,代码行数:30,代码来源:ThorScriptParserStage.cpp

示例4: importVM

//从vm导入配置信息到pmdOptions
//vm[PMD_OPTION_CONFPATH]  -> _confPath
//"./"CONFFILENAME -> _confPath
int pmdOptions::importVM ( const po::variables_map &vm, bool isDefault )
{
	int rc = EDB_OK ;
	
	const char *p = NULL ;
	
	// conf path
	if ( vm.count ( PMD_OPTION_CONFPATH ) )
	{
		p = vm[PMD_OPTION_CONFPATH].as<string>().c_str() ;
		strncpy ( _confPath, p, OSS_MAX_PATHSIZE ) ;
	}
	else if ( isDefault )
	{
		strcpy ( _confPath, "./"CONFFILENAME ) ;
	}
	
	// log path
	if ( vm.count ( PMD_OPTION_LOGPATH ) )
	{
		p = vm[PMD_OPTION_LOGPATH].as<string>().c_str() ;
		strncpy ( _logPath, p, OSS_MAX_PATHSIZE ) ;
	}
	else if ( isDefault )
	{
		strcpy ( _logPath, "./"LOGFILENAME ) ;
	}
	
	// db file path
	if ( vm.count ( PMD_OPTION_DBPATH ) )
	{
		p = vm[PMD_OPTION_DBPATH].as<string>().c_str() ;
		strncpy ( _dbPath, p, OSS_MAX_PATHSIZE ) ;
	}
	else if ( isDefault )
	{
		strcpy ( _dbPath, "./"DBFILENAME ) ;
	}
	
	// maxpool
	if ( vm.count ( PMD_OPTION_MAXPOOL ) )
	{
		_maxPool = vm [ PMD_OPTION_MAXPOOL ].as<unsigned int> () ;
	}
	else if ( isDefault )
	{
		_maxPool = NUMPOOL ;
	}
	
	return rc ;
}
开发者ID:parasitew,项目名称:My-Emerald-DB,代码行数:54,代码来源:pmdOptions.cpp

示例5: ProcessVariables

    void ProcessVariables(const po::variables_map& variables) override {
        ListerConfig.Verbose = variables.count("verbose");
        ListerConfig.Recursive = variables["recursive"].as<bool>();
        ListerConfig.IgnoreHidden = variables.count("hidden");

        IndexWriterConfig.Verbose = variables.count("verbose");

        DocsPath = variables["path"].as<std::string>();
        IndexPath = variables["index"].as<std::string>();
    }
开发者ID:pavelkalinnikov,项目名称:codesearch,代码行数:10,代码来源:main.cpp

示例6: filterate

void options_io::filterate( po::variables_map const & vm )
{
	if( !vm.count("out") ){
		// TODO: Guess output from input.
	}

	if( !vm.count("export-as") ){
		fmt = llvm_ir;
	} else {
		to_lower(fmt_str);
		if( fmt_str == "llvm" || fmt_str == "llvm_ir" ){
			fmt = llvm_ir;
		}
	}
}
开发者ID:wuye9036,项目名称:soul,代码行数:15,代码来源:options.cpp

示例7: _parse

bool SceneParameters::_parse( const po::variables_map& vm )
{
    if( vm.count( PARAM_TIMESTAMP ))
        _timestamp = vm[PARAM_TIMESTAMP].as< size_t >( );

    return true;
}
开发者ID:helloweishi,项目名称:Brayns,代码行数:7,代码来源:SceneParameters.cpp

示例8: parse

  int parse( const int & argc, char * argv[] ) {
    try {
      po::positional_options_description p;
      po::store(
        po::command_line_parser(argc, argv)
           .options( descriptions )
           .positional( p ) // we don't support positional parameters for now
           .run(),
        map );
      po::notify( map );

      if ( map.count("help") ) {
        printUsage( std::cout ) << std::endl;
        return EXIT_SUCCESS;
      } else
        return -1;
    } catch ( const std::exception & e ) {
      std::cerr << "command line parsing error: " << e.what() << std::endl;
      printUsage( std::cerr ) << std::endl;
      return EXIT_FAILURE;
    } catch(...) {
      std::cerr << "command line parsing error:  Unknown error!" << std::endl;
      printUsage( std::cerr ) << std::endl;
      return EXIT_FAILURE;
    }
  }
开发者ID:hpcdev,项目名称:xylose,代码行数:26,代码来源:appsPack.cpp

示例9: initArgs

   // initialize options
   INT32 initArgs ( INT32 argc, CHAR **argv, po::variables_map &vm )
   {
      INT32 rc = SDB_OK ;
      po::options_description desc ( "Command options" ) ;
      po::options_description all ( "Command options" ) ;

      PMD_ADD_PARAM_OPTIONS_BEGIN ( all )
         COMMANDS_OPTIONS
         COMMANDS_HIDE_OPTIONS
      PMD_ADD_PARAM_OPTIONS_END

      PMD_ADD_PARAM_OPTIONS_BEGIN ( desc )
         COMMANDS_OPTIONS
      PMD_ADD_PARAM_OPTIONS_END

      // validate arguments
      rc = utilReadCommandLine( argc, argv, all, vm ) ;
      if ( rc )
      {
         std::cout << "Invalid arguments: " << rc << std::endl ;
         displayArg ( desc ) ;
         goto done ;
      }

      /// read cmd first
      if ( vm.count( PMD_OPTION_HELP ) )
      {
         displayArg( desc ) ;
         rc = SDB_PMD_HELP_ONLY ;
         goto done ;
      }
      if ( vm.count( PMD_OPTION_HELPFULL ) )
      {
         displayArg( all ) ;
         rc = SDB_PMD_HELP_ONLY ;
         goto done ;
      }
      if ( vm.count( PMD_OPTION_VERSION ) )
      {
         ossPrintVersion( "Sdb CM version" ) ;
         rc = SDB_PMD_VERSION_ONLY ;
         goto done ;
      }

   done:
      return rc ;
   }
开发者ID:Andrew8305,项目名称:SequoiaDB,代码行数:48,代码来源:pmdCMMain.cpp

示例10: setVM

void GlyphEditor::setVM(po::variables_map& vm, po::options_description& desc){
    this->desc = &desc;
    if (vm.count("threshold")) setThreshold(vm["threshold"].as<float>());
    if (vm.count("radius")) setRadius(vm["radius"].as<float>());
    if (vm.count("normalization")) setNormalization(vm["normalization"].as<float>());
    if (vm.count("primsize")) setSize(vm["primsize"].as<float>());
    if (vm.count("display")) setDisplay(vm["display"].as<int>());
    if (vm.count("color")) setColor(vm["color"].as<int>());
    if (vm.count("geometry")) setGeometry(vm["geometry"].as<int>());
    if (vm.count("glyphstyle")) setGlyphstyle(vm["glyphstyle"].as<int>());
    if (vm.count("primitives")) setPrimitives(vm["primitives"].as<int>());
    if (vm.count("minlength")) setMinlength(vm["minlength"].as<float>());
    if (vm.count("minlsource")) {
        setMinlSource(vm["minlsource"].as<int>());
        qDebug() << "***** minlsource: " << minlSource;
    }
}
开发者ID:NeuroanatomyAndConnectivity,项目名称:vidview,代码行数:17,代码来源:glypheditor.cpp

示例11: parseOptions

bool StaticTestVerificationStage::parseOptions(po::variables_map& vm)
{
    if(vm.count("enable-static-test"))
    {
        enabled = true;
    }
	return true;
}
开发者ID:zillians,项目名称:supercell_language,代码行数:8,代码来源:StaticTestVerificationStage.cpp

示例12: IsParameterAvailable

bool IsParameterAvailable(const std::string& parameterAvailable, po::variables_map& vm)
{
    bool success = false;
    if(vm.count(parameterAvailable) >0)
        success = true;
    else
        LOGWARNING(parameterAvailable << " is not available");
    return success;
}
开发者ID:yzbx,项目名称:opencv-qt,代码行数:9,代码来源:trackingtest.cpp

示例13: backend

AdvectionDiffusion::AdvectionDiffusion( po::variables_map const& vm )
    :
    M_vm( vm ),
    backend( backend_type::build( vm ) ),
    meshSize( vm["hsize"].as<double>() ),
    M_do_export( !vm.count( "no-export" ) ),
    export_number( 0 ),
    M_Dmu( new parameterspace_type )
{}
开发者ID:ChaliZhg,项目名称:feelpp,代码行数:9,代码来源:ad.hpp

示例14: read_options

//==============================================================================
bool CC_Base::read_options(const po::options_description &desc, const po::variables_map &vm)
{
	if (vm.count("help"))
	{
		on_help(desc);
		return false;
	}

	if (vm.count("device"))
	{
		uint_t bus = 0, device = 0;
		if (!extract_usb_address(option_device_address_, bus, device))
			throw po::error("Bad device address format");
	}

	option_fast_interface_speed_ = vm.count("fast") > 0;
	return true;
}
开发者ID:scott-42,项目名称:cc-tool,代码行数:19,代码来源:cc_base.cpp

示例15: should_search_path

bool should_search_path(const std::string& file,
                        const po::variables_map& config) {
    auto p = boost::filesystem::path(file);
    auto extension = boost::filesystem::extension(p);
    if (!config.count("search-all-extensions") && extension != ".cpp" &&
        extension != ".c" && extension != ".h" && extension != ".hpp") {
        return false;
    }
    return true;
}
开发者ID:ALSchwalm,项目名称:SyntaxAwareSearch,代码行数:10,代码来源:search.cpp


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