本文整理汇总了C++中po::variables_map类的典型用法代码示例。如果您正苦于以下问题:C++ variables_map类的具体用法?C++ variables_map怎么用?C++ variables_map使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了variables_map类的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;
}
}
示例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>();
}
示例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;
}
示例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 ;
}
示例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>();
}
示例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;
}
}
}
示例7: _parse
bool SceneParameters::_parse( const po::variables_map& vm )
{
if( vm.count( PARAM_TIMESTAMP ))
_timestamp = vm[PARAM_TIMESTAMP].as< size_t >( );
return true;
}
示例8: 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 ;
}
示例9: 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;
}
}
示例10: parseOptions
bool StaticTestVerificationStage::parseOptions(po::variables_map& vm)
{
if(vm.count("enable-static-test"))
{
enabled = true;
}
return true;
}
示例11: 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;
}
示例12: 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 )
{}
示例13: 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;
}
示例14: 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;
}
示例15: backend
AnisotropicWavespeed::AnisotropicWavespeed( po::variables_map const& vm )
:
M_is_initialized( false ),
M_vm( vm ),
backend( backend_type::build( vm ) ),
meshSize( vm["hsize"].as<double>() ),
M_gammabc( vm["gamma-dir"].as<double>() ),
M_do_export( !vm.count( "no-export" ) ),
exporter( Exporter<mesh_type>::New( vm, "AnisotropicWavespeed" ) ),
M_Dmu( new parameterspace_type )
{
}