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


C++ options_description::add方法代码示例

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


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

示例1: set_program_options

void application::set_program_options(boost::program_options::options_description& command_line_options,
                                      boost::program_options::options_description& configuration_file_options) const
{
   configuration_file_options.add_options()
         ("p2p-endpoint", bpo::value<string>(), "Endpoint for P2P node to listen on")
         ("seed-node,s", bpo::value<vector<string>>()->composing(), "P2P nodes to connect to on startup (may specify multiple times)")
         ("rpc-endpoint", bpo::value<string>()->implicit_value("127.0.0.1:8090"), "Endpoint for websocket RPC to listen on")
         ("rpc-tls-endpoint", bpo::value<string>()->implicit_value("127.0.0.1:8089"), "Endpoint for TLS websocket RPC to listen on")
         ("server-pem,p", bpo::value<string>()->implicit_value("server.pem"), "The TLS certificate file for this server")
         ("server-pem-password,P", bpo::value<string>()->implicit_value(""), "Password for this certificate")
         ("genesis-json", bpo::value<boost::filesystem::path>(), "File to read Genesis State from")
         ("apiaccess", bpo::value<boost::filesystem::path>(), "JSON file specifying API permissions")
         ;
   command_line_options.add(configuration_file_options);
   command_line_options.add_options()
         ("create-genesis-json", bpo::value<boost::filesystem::path>(),
          "Path to create a Genesis State at. If a well-formed JSON file exists at the path, it will be parsed and any "
          "missing fields in a Genesis State will be added, and any unknown fields will be removed. If no file or an "
          "invalid file is found, it will be replaced with an example Genesis State.")
         ("replay-blockchain", "Rebuild object graph by replaying all blocks")
         ("resync-blockchain", "Delete all blocks and re-sync with network from scratch")
         ;
   command_line_options.add(_cli_options);
   configuration_file_options.add(_cfg_options);
}
开发者ID:VoR0220,项目名称:graphene,代码行数:25,代码来源:application.cpp

示例2: set_program_options

void producer_plugin::set_program_options(
   boost::program_options::options_description& command_line_options,
   boost::program_options::options_description& config_file_options)
{
   auto default_priv_key = private_key_type::regenerate<fc::ecc::private_key_shim>(fc::sha256::hash(std::string("nathan")));
   auto private_key_default = std::make_pair(default_priv_key.get_public_key(), default_priv_key );

   boost::program_options::options_description producer_options;

   producer_options.add_options()
         ("enable-stale-production,e", boost::program_options::bool_switch()->notifier([this](bool e){my->_production_enabled = e;}), "Enable block production, even if the chain is stale.")
         ("required-participation", boost::program_options::value<uint32_t>()
                                       ->default_value(uint32_t(config::required_producer_participation/config::percent_1))
                                       ->notifier([this](uint32_t e) {
                                          my->_required_producer_participation = std::min(e, 100u) * config::percent_1;
                                       }),
                                       "Percent of producers (0-100) that must be participating in order to produce blocks")
         ("producer-name,p", boost::program_options::value<vector<string>>()->composing()->multitoken(),
          "ID of producer controlled by this node (e.g. inita; may specify multiple times)")
         ("private-key", boost::program_options::value<vector<string>>()->composing()->multitoken()->default_value({fc::json::to_string(private_key_default)},
                                                                                                fc::json::to_string(private_key_default)),
          "Tuple of [public key, WIF private key] (may specify multiple times)")
         ;
   config_file_options.add(producer_options);
}
开发者ID:BestSilent,项目名称:eos,代码行数:25,代码来源:producer_plugin.cpp

示例3: plugin_set_program_options

void delayed_node_plugin::plugin_set_program_options(bpo::options_description& cli, bpo::options_description& cfg)
{
   cli.add_options()
         ("trusted-node", boost::program_options::value<std::string>(), "RPC endpoint of a trusted validating node (required)")
         ;
   cfg.add(cli);
}
开发者ID:iamsmooth,项目名称:steem,代码行数:7,代码来源:delayed_node_plugin.cpp

示例4: simopts

  void
  Engine::getCommonOptions(boost::program_options::options_description& opts)
  {
    boost::program_options::options_description simopts("Common Engine Options");

    simopts.add_options()
      ("events,c", boost::program_options::value<size_t>()
       ->default_value(std::numeric_limits<size_t>::max(), "no-limit"),
       "No. of events to run the simulation for.")
      ("print-events,p", boost::program_options::value<size_t>()->default_value(100000), 
       "No. of events between periodic screen output.")
      ("random-seed,s", boost::program_options::value<unsigned int>(),
       "Random seed for generator (To make the simulation reproduceable - Only for debugging!)")
      ("ticker-period,t",boost::program_options::value<double>(), 
       "Time between data collections. Defaults to the system MFT or 1 if no MFT available")
      ("equilibrate,E", "Turns off most output for a fast silent run")
      ("load-plugin,L", boost::program_options::value<std::vector<std::string> >(), 
       "Additional individual plugins to load")
      ("sim-end-time,f", boost::program_options::value<double>()->default_value(std::numeric_limits<double>::max(), "no limit"), 
       "Simulation end time (Note, In replica exchange, each systems end time is scaled by"
       "(T_cold/T_i)^{1/2}, see replex-interval)")
      ("unwrapped", "Don't apply the boundary conditions of the system when writing out the particle positions.")
      ("snapshot", boost::program_options::value<double>(),
       "Sets the system time inbetween saving snapshots of the system.")
      ;
  
    opts.add(simopts);
  }
开发者ID:MChudak,项目名称:DynamO,代码行数:28,代码来源:engine.cpp

示例5: ParseCommand

bool CLICommand::ParseCommand(int argc, char **argv, po::options_description& visibleDesc,
    po::options_description& hiddenDesc,
    po::positional_options_description& positionalDesc,
    po::variables_map& vm, String& cmdname, CLICommand::Ptr& command, bool autocomplete)
{
	boost::mutex::scoped_lock lock(GetRegistryMutex());

	typedef std::map<std::vector<String>, CLICommand::Ptr>::value_type CLIKeyValue;

	std::vector<String> best_match;
	int arg_end = 1;

	BOOST_FOREACH(const CLIKeyValue& kv, GetRegistry()) {
		const std::vector<String>& vname = kv.first;

		for (int i = 0, k = 1; i < vname.size() && k < argc; i++, k++) {
			if (strcmp(argv[k], "--no-stack-rlimit") == 0 || strcmp(argv[k], "--autocomplete") == 0 || strcmp(argv[k], "--scm") == 0) {
				i--;
				continue;
			}

			if (vname[i] != argv[k])
				break;

			if (i >= best_match.size())
				best_match.push_back(vname[i]);

			if (i == vname.size() - 1) {
				cmdname = boost::algorithm::join(vname, " ");
				command = kv.second;
				arg_end = k;
				goto found_command;
			}
		}
	}

found_command:
	lock.unlock();

	po::options_description vdesc("Command options");

	if (command)
		command->InitParameters(vdesc, hiddenDesc);

	visibleDesc.add(vdesc);

	if (autocomplete)
		return true;

	po::options_description adesc;
	adesc.add(visibleDesc);
	adesc.add(hiddenDesc);

	po::store(po::command_line_parser(argc - arg_end, argv + arg_end).options(adesc).positional(positionalDesc).run(), vm);
	po::notify(vm);

	return true;
}
开发者ID:abitduck,项目名称:icinga2,代码行数:58,代码来源:clicommand.cpp

示例6: process_options

void options_system::process_options(int ac, char *av[])
{
    try {
        po::options_description  cmdline_options;
        cmdline_options.add(*generics).add(*configure);

        visible->add(*generics);
        visible->add(*configure);

        store(po::command_line_parser(ac,av).options(cmdline_options).run(), vm);
        notify(vm);


    } catch(std::exception ex) {
        std::cout<<" Error : " <<  ex.what() <<std::endl;
    }

}
开发者ID:rchatsiri,项目名称:techniquecpp,代码行数:18,代码来源:options_system.hpp

示例7: plugin_set_program_options

void monitor_plugin::plugin_set_program_options(
   boost::program_options::options_description& command_line_options,
   boost::program_options::options_description& config_file_options)
{
   command_line_options.add_options()
         (MONITOR_OPT_ACTION_TYPE, boost::program_options::value<uint32_t>(), "The type of operation monitored")
         ;
   config_file_options.add(command_line_options);
}
开发者ID:hutaow,项目名称:hutaow.github.io,代码行数:9,代码来源:bitshares_plugin_monitor.cpp

示例8: plugin_set_program_options

void account_history_plugin::plugin_set_program_options(
   boost::program_options::options_description& cli,
   boost::program_options::options_description& cfg
   )
{
   cli.add_options()
         ("track-account", boost::program_options::value<std::vector<std::string>>()->composing()->multitoken(), "Account ID to track history for (may specify multiple times)")
         ;
   cfg.add(cli);
}
开发者ID:clar,项目名称:graphene,代码行数:10,代码来源:account_history_plugin.cpp

示例9: default_condition

int options_system::default_condition()
{
    std::ifstream ifs(config_file->c_str());

    if(!ifs) {
        std::cout<< "cannot open file name : " << *config_file <<std::endl;
    } else {
        config_file_options  = new po::options_description();
        config_file_options->add(*configure);

        store(parse_config_file(ifs, *config_file_options),vm);
        notify(vm);
    }

    if(vm.count("help")) {
        std::cout<< *visible <<std::endl;
        return 0;
    }

    if(vm.count("version")) {
        std::cout<< "HanumanAV, version releases :  0.0.1 " <<std::endl;
    }

    if(vm.count("db-signature-path")) {
        std::vector<std::string>  vec =  vm["db-signature-path"].as<std::vector<std::string> >();
        database_path = new std::stringstream;
        read_config(*database_path,vec);
    }

    if(vm.count("scanning-file")) {
        std::vector<std::string>  vec =  vm["scanning-file"].as<std::vector<std::string> >();
        scanfile_path = new std::stringstream;
        read_config(*scanfile_path,vec);
    }

    if(vm.count("cl-file")) {
        std::vector<std::string>  vec =  vm["cl-file"].as<std::vector<std::string> >();
        clfile_path = new std::stringstream;
        read_config(*clfile_path,vec);
    }

    if(vm.count("logger-main")) {
        std::vector<std::string>  vec =  vm["logger-main"].as<std::vector<std::string> >();
        logger_mainfile_path = new std::stringstream;
        read_config(*logger_mainfile_path,vec);
    }

    if(vm.count("logger-settings")) {
        std::vector<std::string> vec =  vm["logger-settings"].as<std::vector<std::string> >();
        logger_settingsfile_path = new std::stringstream;
        read_config(*logger_settingsfile_path,vec);

    }

}
开发者ID:rchatsiri,项目名称:techniquecpp,代码行数:55,代码来源:options_system.hpp

示例10: addToOptions

	void addToOptions(po::options_description &options, std::string section, std::string prefix, std::string default_host, int default_port, bool add_timeout, int default_timeout = 0) {
		po::options_description desc(section);
		desc.add_options()
			((prefix+"host").c_str(), po::value<std::string>(&host)->default_value(default_host),"Host")
			((prefix+"port").c_str(), po::value<in_port_t>(&port)->default_value(default_port), "Port")
		;
		if (add_timeout) {
			desc.add_options() ((prefix+"timeout").c_str(), po::value<int>(&timeout)->default_value(default_timeout),"Timeout") ;
		}
		options.add(desc);
	}
开发者ID:ApelSYN,项目名称:leveldb-daemon,代码行数:11,代码来源:boost_options_mysqljson.hpp

示例11: plugin_set_program_options

void snapshot_plugin::plugin_set_program_options(
   boost::program_options::options_description& command_line_options,
   boost::program_options::options_description& config_file_options)
{
   command_line_options.add_options()
         (OPT_BLOCK_NUM, bpo::value<uint32_t>(), "Block number after which to do a snapshot")
         (OPT_BLOCK_TIME, bpo::value<string>(), "Block time (ISO format) after which to do a snapshot")
         (OPT_DEST, bpo::value<string>(), "Pathname of JSON file where to store the snapshot")
         ;
   config_file_options.add(command_line_options);
}
开发者ID:FollowMyVote,项目名称:graphene,代码行数:11,代码来源:snapshot.cpp

示例12: setup_options

void engine_factory::setup_options(boost::program_options::options_description& options) {
  for (engine_data::const_iterator it = s_engine_data.data().begin(); it != s_engine_data.data().end(); ++ it) {
    std::stringstream ss;
    ss << "Engine '" << it->second->get_id() << "' options";
    boost::program_options::options_description engine_options(ss.str());
    it->second->setup_options(engine_options);
    if (engine_options.options().size() > 0) {
      options.add(engine_options);
    }
  }
}
开发者ID:SRI-CSL,项目名称:sally,代码行数:11,代码来源:factory.cpp

示例13: plugin_set_program_options

void account_history_plugin::plugin_set_program_options(
   boost::program_options::options_description& cli,
   boost::program_options::options_description& cfg
   )
{
   cli.add_options()
         ("track-account-range", boost::program_options::value<std::vector<std::string>>()->composing()->multitoken(), "Defines a range of accounts to track as a json pair [\"from\",\"to\"] [from,to]")
         ("filter-posting-ops", "Ignore posting operations, only track transfers and account updates")
         ;
   cfg.add(cli);
}
开发者ID:TigerND,项目名称:steem,代码行数:11,代码来源:account_history_plugin.cpp

示例14: setupOptions

void Scenario::setupOptions(int argc,
                            char **argv,
                            boost::program_options::options_description &options,
                            boost::program_options::variables_map &variables)
{
  boost::program_options::options_description local("Scenario " + d->m_name);
  setupOptions(local, variables);

  if (variables.empty())
    options.add(local);
  else
    d->m_options = variables;
}
开发者ID:kostko,项目名称:unisphere,代码行数:13,代码来源:scenario.cpp

示例15: plugin_set_program_options

void witness_plugin::plugin_set_program_options(
   boost::program_options::options_description& command_line_options,
   boost::program_options::options_description& config_file_options)
{
   command_line_options.add_options()
         ("enable-stale-production", bpo::bool_switch()->notifier([this](bool e){_production_enabled = e;}), "Enable block production, even if the chain is stale")
         ("witness-id,w", bpo::value<vector<string>>()->composing()->multitoken(),
          "ID of witness controlled by this node (e.g. \"1.7.0\", quotes are required, may specify multiple times)")
         ("private-key", bpo::value<vector<string>>()->composing()->multitoken()->
          DEFAULT_VALUE_VECTOR(std::make_pair(chain::key_id_type(), fc::ecc::private_key::regenerate(fc::sha256::hash(std::string("genesis"))))),
          "Tuple of [key ID, private key] (may specify multiple times)")
         ;
   config_file_options.add(command_line_options);
}
开发者ID:bitshares,项目名称:bitshares-toolkit,代码行数:14,代码来源:witness.cpp


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