本文整理汇总了C++中variables_map类的典型用法代码示例。如果您正苦于以下问题:C++ variables_map类的具体用法?C++ variables_map怎么用?C++ variables_map使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了variables_map类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: load_As_and_random_T
/// \brief Load a collection of alignments based on command line parameters and generate a random tree.
///
/// \param args The command line parameters.
/// \param alignments The alignments.
/// \param T The leaf-labelled tree.
/// \param internal_sequences Should each resulting alignment have sequences for internal nodes on the tree?
///
void load_As_and_random_T(const variables_map& args,vector<alignment>& alignments,SequenceTree& T,const vector<bool>& internal_sequences)
{
alignments = load_As(args);
//------------- Load random tree ------------------------//
SequenceTree TC = star_tree(sequence_names(alignments[0]));
if (args.count("t-constraint"))
TC = load_constraint_tree(args["t-constraint"].as<string>(),sequence_names(alignments[0]));
T = TC;
RandomTree(T,1.0);
//-------------- Link --------------------------------//
link(alignments,T,internal_sequences);
//---------------process----------------//
for(int i=0;i<alignments.size();i++)
{
//---------------- Randomize alignment? -----------------//
if (args.count("randomize-alignment"))
alignments[i] = randomize(alignments[i],T.n_leaves());
//------------------ Analyze 'internal'------------------//
if ((args.count("internal") and args["internal"].as<string>() == "+")
or args.count("randomize-alignment"))
for(int column=0;column< alignments[i].length();column++) {
for(int j=T.n_leaves();j<alignments[i].n_sequences();j++)
alignments[i](column,j) = alphabet::not_gap;
}
//---- Check that internal sequence satisfy constraints ----//
check_alignment(alignments[i],T,internal_sequences[i]);
}
}
开发者ID:argriffing,项目名称:BAli-Phy,代码行数:42,代码来源:setup.C
示例2: load_A_and_random_T
/// \brief Load an alignment based on command line parameters and generate a random tree.
///
/// \param args The command line parameters.
/// \param alignments The alignments.
/// \param T The leaf-labelled tree.
/// \param internal_sequences Should each resulting alignment have sequences for internal nodes on the tree?
///
void load_A_and_random_T(const variables_map& args,alignment& A,SequenceTree& T,bool internal_sequences)
{
// NO internal sequences, yet!
A = load_A(args,internal_sequences);
//------------- Load random tree ------------------------//
SequenceTree TC = star_tree(sequence_names(A));
if (args.count("t-constraint"))
TC = load_constraint_tree(args["t-constraint"].as<string>(),sequence_names(A));
T = TC;
RandomTree(T,1.0);
//------------- Link Alignment and Tree -----------------//
link(A,T,internal_sequences);
//---------------- Randomize alignment? -----------------//
if (args.count("randomize-alignment"))
A = randomize(A,T.n_leaves());
//------------------ Analyze 'internal'------------------//
if ((args.count("internal") and args["internal"].as<string>() == "+")
or args.count("randomize-alignment"))
for(int column=0;column< A.length();column++) {
for(int i=T.n_leaves();i<A.n_sequences();i++)
A(column,i) = alphabet::not_gap;
}
//---- Check that internal sequence satisfy constraints ----//
check_alignment(A,T,internal_sequences);
}
开发者ID:argriffing,项目名称:BAli-Phy,代码行数:38,代码来源:setup.C
示例3: plugin_initialize
void http_client_plugin::plugin_initialize(const variables_map& options) {
if ( options.count("https-client-root-cert") ) {
const std::vector<std::string> root_pems = options["https-client-root-cert"].as<std::vector<std::string>>();
for (const auto& root_pem : root_pems) {
std::string pem_str = root_pem;
if (!boost::algorithm::starts_with(pem_str, "-----BEGIN CERTIFICATE-----\n")) {
try {
auto infile = std::ifstream(pem_str);
std::stringstream sstr;
sstr << infile.rdbuf();
pem_str = sstr.str();
FC_ASSERT(boost::algorithm::starts_with(pem_str, "-----BEGIN CERTIFICATE-----\n"), "File does not appear to be a PEM encoded certificate");
} catch (const fc::exception& e) {
elog("Failed to read PEM ${f} : ${e}", ("f", root_pem)("e",e.to_detail_string()));
}
}
try {
my->add_cert(pem_str);
} catch (const fc::exception& e) {
elog("Failed to read PEM : ${e} \n${pem}\n", ("pem", pem_str)("e",e.to_detail_string()));
}
}
}
my->set_verify_peers(options.at("https-client-validate-peers").as<bool>());
}
开发者ID:108518,项目名称:eos,代码行数:27,代码来源:http_client_plugin.cpp
示例4: hpx_main
int hpx_main(variables_map& vm)
{
std::size_t pxthreads = 0;
if (vm.count("pxthreads"))
pxthreads = vm["pxthreads"].as<std::size_t>();
std::size_t iterations = 0;
if (vm.count("iterations"))
iterations = vm["iterations"].as<std::size_t>();
std::size_t suspend_duration = 0;
if (vm.count("suspend-duration"))
suspend_duration = vm["suspend-duration"].as<std::size_t>();
{
barrier b(pxthreads + 1);
// Create the hpx-threads.
for (std::size_t i = 0; i < pxthreads; ++i)
register_work(boost::bind
(&suspend_test, boost::ref(b), iterations, suspend_duration));
b.wait(); // Wait for all hpx-threads to enter the barrier.
}
// Initiate shutdown of the runtime system.
return finalize();
}
开发者ID:NOMORECOFFEE,项目名称:hpx,代码行数:31,代码来源:thread_suspend_duration.cpp
示例5: check_options
// checks options for sanity; returns true if papi component is needed
bool check_options(variables_map const& vm)
{
bool needed = need_papi_component(vm);
if (vm.count("hpx:papi-event-info"))
{
std::string v = vm["hpx:papi-event-info"].as<std::string>();
if (v != "preset" && v != "native" && v != "all")
HPX_THROW_EXCEPTION(hpx::commandline_option_error,
NS_STR "check_options()",
"unsupported mode "+v+" in --hpx:papi-event-info");
}
if (vm.count("hpx:papi-domain"))
{
std::string v = vm["hpx:papi-domain"].as<std::string>();
int dom = map_domain(v); // throws if not found
papi_call(PAPI_set_domain(dom),
"could not switch to \""+v+"\" domain monitoring",
NS_STR "check_options()");
needed = true;
}
// FIXME: implement multiplexing properly and uncomment below when done
if (vm.count("hpx:papi-multiplex"))
HPX_THROW_EXCEPTION(hpx::not_implemented,
NS_STR "check_options()",
"counter multiplexing is currently not supported");
#if 0
if (vm.count("hpx:papi-multiplex") && vm["hpx:papi-multiplex"].as<long>() < 0)
HPX_THROW_EXCEPTION(hpx::commandline_option_error,
NS_STR "check_options()",
"argument to --hpx:papi-multiplex must be positive");
#endif
return needed;
}
开发者ID:ct-clmsn,项目名称:hpx,代码行数:34,代码来源:papi.cpp
示例6: load_As_and_T
/// \brief Load a tree and a collection of alignments based on command line parameters.
///
/// \param args The command line parameters.
/// \param alignments The alignments.
/// \param T The leaf-labelled tree.
/// \param internal_sequences Should each resulting alignment have sequences for internal nodes on the tree?
///
void load_As_and_T(const variables_map& args,vector<alignment>& alignments,RootedSequenceTree& T,const vector<bool>& internal_sequences)
{
alignments = load_As(args);
T = load_T(args);
link(alignments,T,internal_sequences);
for(int i=0;i<alignments.size();i++)
{
//---------------- Randomize alignment? -----------------//
if (args.count("randomize-alignment"))
alignments[i] = randomize(alignments[i],T.n_leaves());
//------------------ Analyze 'internal'------------------//
if ((args.count("internal") and args["internal"].as<string>() == "+")
or args.count("randomize-alignment"))
for(int column=0;column< alignments[i].length();column++) {
for(int j=T.n_leaves();j<alignments[i].n_sequences();j++)
alignments[i](column,j) = alphabet::not_gap;
}
//---- Check that internal sequence satisfy constraints ----//
check_alignment(alignments[i],T,internal_sequences[i]);
}
}
开发者ID:argriffing,项目名称:BAli-Phy,代码行数:34,代码来源:setup.C
示例7: hpx_main
int hpx_main(variables_map& vm)
{
std::size_t pxthreads = 0;
if (vm.count("pxthreads"))
pxthreads = vm["pxthreads"].as<std::size_t>();
std::size_t iterations = 0;
if (vm.count("iterations"))
iterations = vm["iterations"].as<std::size_t>();
for (std::size_t i = 0; i < iterations; ++i)
{
// create a barrier waiting on 'count' threads
barrier b(pxthreads + 1);
boost::atomic<std::size_t> c(0);
// create the threads which will wait on the barrier
for (std::size_t i = 0; i < pxthreads; ++i)
register_work(hpx::util::bind
(&local_barrier_test, std::ref(b), std::ref(c)));
b.wait(); // wait for all threads to enter the barrier
HPX_TEST_EQ(pxthreads, c);
}
// initiate shutdown of the runtime system
finalize();
return 0;
}
开发者ID:atrantan,项目名称:hpx,代码行数:32,代码来源:local_barrier.cpp
示例8: conflicting_options
/* Function used to check that 'opt1' and 'opt2' are not specified
at the same time. */
void conflicting_options(const variables_map& vm,
const char* opt1, const char* opt2)
{
if (vm.count(opt1) && !vm[opt1].defaulted()
&& vm.count(opt2) && !vm[opt2].defaulted())
throw logic_error(string("Conflicting options '")
+ opt1 + "' and '" + opt2 + "'.");
}
开发者ID:gijs,项目名称:hexer,代码行数:10,代码来源:real.cpp
示例9: logic_error
void Configuration::Configuration_Impl::conflicting_options(const variables_map& vm,
const string& opt1, const string& opt2)
{
if (vm.count(opt1) && !vm[opt1].defaulted()
&& vm.count(opt2) && !vm[opt2].defaulted())
throw logic_error(string("Conflicting options '")
+ opt1 + "' and '" + opt2 + "'.");
}
开发者ID:temporaer,项目名称:hancock_real,代码行数:8,代码来源:configuration.cpp
示例10: option_dependency
/* Function used to check that of 'for_what' is specified, then
'required_option' is specified too. */
void option_dependency(const variables_map& vm,
const char* for_what, const char* required_option)
{
if (vm.count(for_what) && !vm[for_what].defaulted())
if (vm.count(required_option) == 0 || vm[required_option].defaulted())
throw logic_error(string("Option '") + for_what
+ "' requires option '" + required_option + "'.");
}
开发者ID:gijs,项目名称:hexer,代码行数:10,代码来源:real.cpp
示例11: hpx_main
int hpx_main(variables_map& vm){
uint64_t num = vm["number-spawned"].as<uint64_t>();
bool rtype = (vm.count("result-action") ? true : false);
string atype = vm["arg-type"].as<string>();
int c = vm["argc"].as<int>();
csv = (vm.count("csv") ? true : false);
parse_arg(atype, rtype, num, c);
return hpx::finalize();
}
开发者ID:vamatya,项目名称:hpx_benchmarks,代码行数:9,代码来源:general_pa_create_analysis.cpp
示例12: hpx_main
int hpx_main(variables_map& vm)
{
try {
std::cout << ( boost::format("prefix: %d")
% hpx::naming::get_locality_id_from_id(hpx::find_here()))
<< std::endl;
// Try to connect to existing throttle instance, create a new one if
// this fails.
char const* throttle_component_name = "/throttle/0";
hpx::naming::id_type gid;
hpx::agas::resolve_name(throttle_component_name, gid);
throttle::throttle t;
if (!t.get_gid()) {
std::vector<hpx::naming::id_type> localities =
hpx::find_remote_localities();
// create throttle on the console, register the instance with AGAS
// and add an additional reference count to keep it alive
if (!localities.empty()) {
// use AGAS client to get the component type as we do not
// register any factories
hpx::components::component_type type =
get_agas_client().get_component_id("throttle_throttle_type");
std::cout << "throttle component type: " << (int)type << std::endl;
t.create(localities[0], type);
hpx::agas::register_name(throttle_component_name, t.get_gid());
}
else {
std::cerr << "Can't find throttle component." << std::endl;
}
}
// handle commands
if (t.get_gid()) {
if (vm.count("suspend")) {
t.suspend(vm["suspend"].as<int>());
}
else if (vm.count("resume")) {
t.resume(vm["resume"].as<int>());
}
else if (vm.count("release")) {
// unregister from AGAS, remove additional reference count which
// will allow for the throttle instance to be released
hpx::agas::unregister_name(throttle_component_name);
}
}
}
catch (hpx::exception const& e) {
std::cerr << "throttle_client: caught exception: " << e.what() << std::endl;
}
hpx::disconnect();
return 0;
}
开发者ID:Stevejohntest,项目名称:hpx,代码行数:56,代码来源:throttle_client.cpp
示例13: transform_options
config::stitching_options program_options_parser::
transform_options(const variables_map& vm) const {
config::stitching_options r;
r.verbose(vm.count(verbose_arg));
if (!vm.count(target_arg))
throw_missing_target();
r.target(vm[target_arg].as<std::string>());
r.force_write(vm.count(force_write_arg));
return r;
}
开发者ID:pgannon,项目名称:dogen,代码行数:12,代码来源:program_options_parser.cpp
示例14: load_alphabets
vector<shared_ptr<const alphabet> > load_alphabets(const variables_map& args)
{
vector<shared_ptr<const alphabet> > alphabets;
if (not args.count("alphabet")) {
alphabets.push_back(shared_ptr<const alphabet>(new DNA));
alphabets.push_back(shared_ptr<const alphabet>(new RNA));
alphabets.push_back(shared_ptr<const alphabet>(new AminoAcids));
alphabets.push_back(shared_ptr<const alphabet>(new AminoAcidsWithStop));
return alphabets;
}
const string name = args["alphabet"].as<string>();
if (name == "Codons" or name == "Codons+stop") {
shared_ptr<const AminoAcids> AA;
if (name == "Codons")
AA = shared_ptr<const AminoAcids>(new AminoAcids);
else
AA = shared_ptr<const AminoAcids>(new AminoAcidsWithStop);
string genetic_code_filename = "standard-code.txt";
if (args.count("genetic-code"))
genetic_code_filename = args["genetic-code"].as<string>();
genetic_code_filename = args["data-dir"].as<string>() + "/" + genetic_code_filename;
alphabets.push_back(shared_ptr<const alphabet>(new Codons(DNA(),*AA,genetic_code_filename)));
alphabets.push_back(shared_ptr<const alphabet>(new Codons(RNA(),*AA,genetic_code_filename)));
}
else if (name == "Triplets") {
alphabets.push_back(shared_ptr<const alphabet>(new Triplets(DNA())));
alphabets.push_back(shared_ptr<const alphabet>(new Triplets(RNA())));
}
else if (name == "DNA")
alphabets.push_back(shared_ptr<const alphabet>(new DNA()));
else if (name == "RNA")
alphabets.push_back(shared_ptr<const alphabet>(new RNA()));
else if (name == "Amino-Acids")
alphabets.push_back(shared_ptr<const alphabet>(new AminoAcids()));
else if (name == "Amino-Acids+stop")
alphabets.push_back(shared_ptr<const alphabet>(new AminoAcidsWithStop()));
else
throw myexception()<<"I don't recognize alphabet '"<<name<<"'";
return alphabets;
}
开发者ID:msuchard,项目名称:BAli-Phy,代码行数:49,代码来源:alignment-util.C
示例15: qthreads_main
int qthreads_main(
variables_map& vm
)
{
if (vm.count("no-header"))
header = false;
{
// Validate command line.
if (0 == tasks)
throw std::invalid_argument("count of 0 tasks specified\n");
// Start the clock.
high_resolution_timer t;
for (boost::uint64_t i = 0; i < tasks; ++i)
{
void* const ptr = &delay;
qthread_fork(&worker_func, ptr, NULL);
}
// Yield until all our null qthreads are done.
do {
qthread_yield();
} while (donecount != tasks);
print_results(qthread_num_workers(), t.elapsed());
}
return 0;
}
开发者ID:adk9,项目名称:hpx,代码行数:30,代码来源:qthreads_homogeneous_task_spawn.cpp
示例16: hpx_main
int hpx_main(
variables_map& vm
)
{
{
boost::uint64_t test_runs = vm["test-runs"].as<boost::uint64_t>();
boost::uint64_t children = vm["children"].as<boost::uint64_t>();
boost::uint64_t max_depth = vm["depth"].as<boost::uint64_t>() + 1;
boost::uint64_t delay_iterations
= vm["delay-iterations"].as<boost::uint64_t>();
bool verbose = vm.count("verbose") != 0;
hpx::id_type const here = hpx::find_here();
double d = 0.;
null_tree_action null_act;
for ( boost::uint64_t i = 0
; (test_runs == 0) || (i < test_runs)
; ++i)
{
d += null_act(here, 0, children, 1, max_depth, delay_iterations);
if (verbose)
std::cout << (boost::format("%016u : %f\n") % i % d)
<< std::flush;
}
}
return hpx::finalize();
}
开发者ID:7ev3n,项目名称:hpx,代码行数:35,代码来源:future_hang_on_wait_with_callback_629.cpp
示例17: hpx_main
int hpx_main(variables_map& vm)
{
{
num_iterations = vm["delay-iterations"].as<std::uint64_t>();
const std::uint64_t count = vm["futures"].as<std::uint64_t>();
bool csv = vm.count("csv") != 0;
if (HPX_UNLIKELY(0 == count))
throw std::logic_error("error: count of 0 futures specified\n");
const int nl = 1;
hpx::parallel::execution::default_executor def;
hpx::parallel::execution::parallel_executor par;
for (int i=0; i<nl; i++) {
measure_action_futures_wait_each(count, csv);
measure_action_futures_wait_all(count, csv);
measure_function_futures_wait_each(count, csv, def);
measure_function_futures_wait_each(count, csv, par);
measure_function_futures_wait_all(count, csv, def);
measure_function_futures_wait_all(count, csv, par);
measure_function_futures_thread_count(count, csv, def);
measure_function_futures_thread_count(count, csv, par);
measure_function_futures_limiting_executor(count, csv, def);
measure_function_futures_limiting_executor(count, csv, par);
measure_function_futures_sliding_semaphore(count, csv, def);
}
}
return hpx::finalize();
}
开发者ID:K-ballo,项目名称:hpx,代码行数:31,代码来源:future_overhead.cpp
示例18: app_main
int app_main(
variables_map& vm
)
{
if (vm.count("no-header"))
header = false;
if (0 == tasks)
throw std::invalid_argument("count of 0 tasks specified\n");
// Start the clock.
high_resolution_timer t;
for (boost::uint64_t i = 0; i < tasks; ++i)
{
worker_timed(delay * 1000);
}
double elapsed = t.elapsed();
// Print out the results.
print_results(vm, elapsed, (elapsed * 1e6) / double(tasks));
return 0;
}
开发者ID:AntonBikineev,项目名称:hpx,代码行数:25,代码来源:delay_baseline.cpp
示例19: hpx_main
int hpx_main(variables_map& vm){
uint64_t num = vm["iterations"].as<uint64_t>();
int threads = vm["hpx-threads"].as<int>();
csv = (vm.count("csv") ? true : false);
run_tests(num, threads);
return hpx::finalize();
}
开发者ID:Stevejohntest,项目名称:hpx,代码行数:7,代码来源:thread_cs_analysis.cpp
示例20: hpx_main
int hpx_main(
variables_map& vm
)
{
if (vm.count("no-header"))
header = false;
{
if (0 == tasks)
throw std::invalid_argument("count of 0 tasks specified\n");
// Start the clock.
high_resolution_timer t;
for (boost::uint64_t i = 0; i < tasks; ++i)
register_work(HPX_STD_BIND(&invoke_worker, delay));
// Reschedule hpx_main until all other hpx-threads have finished. We
// should be resumed after most of the null px-threads have been
// executed. If we haven't, we just reschedule ourselves again.
do {
suspend();
} while (get_thread_count(hpx::threads::thread_priority_normal) > 1);
print_results(get_os_thread_count(), t.elapsed());
}
return finalize();
}
开发者ID:fpelliccioni,项目名称:hpx,代码行数:29,代码来源:hpx_homogeneous_task_spawn.cpp
注:本文中的variables_map类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论