• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ context类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中context的典型用法代码示例。如果您正苦于以下问题:C++ context类的具体用法?C++ context怎么用?C++ context使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: get_parameter

void tag_delete::execute(context &ctx, std::ostream &out,
  const tag *caller) const {

	const string &collection = get_parameter(ctx, "collection");
	if (collection.empty())
		throw tag_delete_exception(
		  _("query collection (collection) is not defined"));

	string db_ptr = ctx.get_value("@MONGODB:[email protected]");
	if (db_ptr.empty()) {
		throw tag_delete_exception(
		  _("MongoDB database is not defined in the current context"));
	}
	database *db = (database*)from_string<void*>(db_ptr);

	ctx.enter();
	try {
		BSONObjBuilder b;
		ctx.add_value("@MONGODB:[email protected]", to_string<BSONObjBuilder*>(&b));

		// call inherited method
		tag_impl::execute(ctx, out, caller);

		db->remove(collection, b.obj());

	}
	catch (...) {
		ctx.leave();
		throw;
	}
	ctx.leave();
}
开发者ID:wolfsoft,项目名称:dbpager,代码行数:32,代码来源:tag_delete.cpp


示例2: EmitRegisters

//[reg id, reg value, taint]* [REG_INVALID_, 0, 0]
void EmitRegisters(FILE *f, const CONTEXT *ctx, context &delta){
  ADDRINT v, taint;
  int i, sz;
  //XXX: if you change order of these ids, you also need to change numbering
  //in motriage.ml, function: rid2reg
  REG regs[] = {LEVEL_BASE::REG_EAX, LEVEL_BASE::REG_EBX, LEVEL_BASE::REG_ECX,
              LEVEL_BASE::REG_EDX, LEVEL_BASE::REG_ESI, LEVEL_BASE::REG_EDI, LEVEL_BASE::REG_EBP,
              LEVEL_BASE::REG_ESP, LEVEL_BASE::REG_EFLAGS, LEVEL_BASE::REG_EIP};

  context::iterator it;

  sz = sizeof(regs)/sizeof(regs[0]);

  write_u32(f, TAG_REGS);
  write_u32(f, sz);

  for(i=0;i<sz;i++){
    REG r = regs[i];
    v = PIN_GetContextReg(ctx, r);
    write_u32(f, i); //we don't use PIN's ids
    write_u32(f, v);
    it = delta.find(r);
    if(it != delta.end()){
      taint = it->second;
    }
    else{
      taint = 0;
    }
    write_u32(f, taint);
    fprintf(stderr, "%s v=0x%08x, t=0x%08x\n", REG_StringShort(r).c_str(), v, 
        taint);
  }
}
开发者ID:GREYFOXRGR,项目名称:moflow,代码行数:34,代码来源:snapshot.cpp


示例3: m

 mk_unfold::mk_unfold(context& ctx):
     rule_transformer::plugin(100, false),
     m_ctx(ctx),
     m(ctx.get_manager()),
     rm(ctx.get_rule_manager()),
     m_unify(ctx)
 {}
开发者ID:NikolajBjorner,项目名称:z3,代码行数:7,代码来源:dl_mk_unfold.cpp


示例4: native_rule

HAMIGAKI_BJAM_DECL string_list native_rule(context& ctx)
{
    frame& f = ctx.current_frame();
    const list_of_list& args = f.arguments();

    const std::string& module_name = args[0][0];
    const std::string& rule_name = args[1][0];

    typedef std::map<std::string,bjam::native_rule> table_type;
    typedef table_type::const_iterator iter_type;

    module& m = ctx.get_module(module_name);
    const table_type& table = m.native_rules;
    iter_type it = table.find(rule_name);
    if (it == table.end())
        throw rule_not_found(rule_name);

    const bjam::native_rule& rule = it->second;

    rule_definition def;
    def.parameters = rule.parameters;
    def.native = rule.native;
    def.module_name = module_name;
    def.exported = true;
    m.rules.set_native_rule(rule_name, def);

    return string_list();
}
开发者ID:fpelliccioni,项目名称:hamigaki,代码行数:28,代码来源:builtin_rules.cpp


示例5: build

void checkbox_w::build( context &ctxt )
{
	const style &s = ctxt.get_style();

	draw::paint c;
	platform::context &hwc = ctxt.hw_context();
	gl::api &ogl = hwc.api();

	_unchecked.rebuild( hwc );
	_checked.rebuild( hwc );

	c.set_fill_color( s.active_icon( s.background_color() ) );
	_unchecked.add( ogl, draw::iconCheckBoxEmpty(), c );

	c.set_fill_color( s.dominant_color() );
	_checked.add( ogl, draw::iconCheckBoxChecked(), c );

	size sz = s.widget_minimum_size();
	auto native = ctxt.to_native( sz );
	_unchecked.shape_size( native.w(), native.h() );
	_checked.shape_size( native.w(), native.h() );
	_unchecked.set_size( sz.w(), sz.h() );
	_checked.set_size( sz.w(), sz.h() );

	auto &l = layout_target();
	l->set_minimum( sz );
	l->set_maximum( sz );
}
开发者ID:kdt3rd,项目名称:gecko,代码行数:28,代码来源:checkbox.cpp


示例6: import

HAMIGAKI_BJAM_DECL string_list import(context& ctx)
{
    frame& f = ctx.current_frame();
    const list_of_list& args = f.arguments();

    module& src_module = ctx.get_module(args[0].try_front());
    const string_list& src_rules = args[1];
    const boost::optional<std::string>& tgt_module_name = args[2].try_front();
    module& tgt_module = ctx.get_module(tgt_module_name);
    const string_list& tgt_rules = args[3];
    const bool localize = !args[4].empty();

    if (src_rules.size() != tgt_rules.size())
        throw std::runtime_error("the count of rule names mismatch"); // FIXME

    for (std::size_t i = 0, size = src_rules.size(); i < size; ++i)
    {
        rule_definition def =
            src_module.rules.get_rule_definition(src_rules[i]);

        if (localize)
            def.module_name = tgt_module_name;
        def.exported = false;

        tgt_module.rules.set_rule_definition(tgt_rules[i], def);
    }

    return string_list();
}
开发者ID:fpelliccioni,项目名称:hamigaki,代码行数:29,代码来源:builtin_rules.cpp


示例7: plugin

 mk_unbound_compressor::mk_unbound_compressor(context & ctx) :
     plugin(500),
     m_context(ctx),
     m_manager(ctx.get_manager()),
     m_rules(ctx.get_rule_manager()),
     m_pinned(m_manager) {
 }
开发者ID:Moondee,项目名称:Artemis,代码行数:7,代码来源:dl_mk_unbound_compressor.cpp


示例8: apply

void variability_feature_bundle_transform::
apply(const context& ctx, meta_model::model& m) {
    tracing::scoped_transform_tracer stp(lg,
        "variability feature bundle transform", transform_id,
        m.name().qualified().dot(), *ctx.tracer(), m);

    const auto& bundles(m.variability_elements().feature_bundles());
    if (bundles.empty())
        return;

    const auto& fm(*ctx.feature_model());
    const auto fg(make_feature_group(fm));
    for (auto& pair : bundles) {
        auto& fb(*pair.second);
        for (auto& ft : fb.feature_templates())
            update(fg, ft);
    }

    if (m.variability_elements().feature_template_initializer() == nullptr)
        return;

    auto& fti(*m.variability_elements().feature_template_initializer());
    for (auto& pair : bundles) {
        auto& fb(*pair.second);
        fti.bundles().push_back(fb.name());
    }
    fti.bundles().sort();

    stp.end_transform(m);
}
开发者ID:DomainDrivenConsulting,项目名称:dogen,代码行数:30,代码来源:variability_feature_bundle_transform.cpp


示例9: m

    aig_exporter::aig_exporter(const rule_set& rules, context& ctx, const fact_vector *facts) :
        m_rules(rules), m_facts(facts), m(ctx.get_manager()), m_rm(ctx.get_rule_manager()),
        m_aigm(m), m_next_decl_id(1), m_next_aig_expr_id(2), m_num_and_gates(0),
        m_latch_vars(m), m_latch_varsp(m), m_ruleid_var_set(m), m_ruleid_varp_set(m)
    {
        std::set<func_decl*> predicates;
        for (rule_set::decl2rules::iterator I = m_rules.begin_grouped_rules(),
            E = m_rules.end_grouped_rules(); I != E; ++I) {
            predicates.insert(I->m_key);
        }

        for (fact_vector::const_iterator I = facts->begin(), E = facts->end(); I != E; ++I) {
            predicates.insert(I->first);
        }

        // reserve pred id = 0 for initalization purposes
        unsigned num_preds = (unsigned)predicates.size() + 1;

        // poor's man round-up log2
        unsigned preds_bitsize = log2(num_preds);
        if ((1U << preds_bitsize) < num_preds)
            ++preds_bitsize;
        SASSERT((1U << preds_bitsize) >= num_preds);

        for (unsigned i = 0; i < preds_bitsize; ++i) {
            m_ruleid_var_set.push_back(m.mk_fresh_const("rule_id", m.mk_bool_sort()));
            m_ruleid_varp_set.push_back(m.mk_fresh_const("rule_id_p", m.mk_bool_sort()));
        }
    }
开发者ID:greatmazinger,项目名称:z3,代码行数:29,代码来源:aig_exporter.cpp


示例10: do_handle_section

void eit_section_filter::do_handle_section(
    context& c,
    const char* section_buffer,
    size_t section_length) {
  section s;
  s.unpack(section_buffer, section_length);
  event_information_table eit;
  s.convert(eit);

  if(s.header.table_id == 0x4E) //FIXME
  c.get_view().print(
      c.get_packet_num(),
      s.header,
      eit,
      subtable_is_changed(s.header, eit));

  if(s.header.table_id == 0x4E &&
     s.header.section_number == 0) {
    if(subtable_is_changed(s.header, eit)){
      c.signal_eit();
    }
  }

  // FIXME
  if(s.header.section_number == s.header.last_section_number) {
    version_
      [s.header.table_id]
      [s.header.table_id_extension]
      [eit.transport_stream_id]
      [eit.original_network_id]
        = s.header.version;
  }
}
开发者ID:range3,项目名称:tsdivider,代码行数:33,代码来源:eit_section_filter_impl.hpp


示例11: execute

void tag_database::execute(context &ctx, std::ostream &out,
  const tag *caller) const {
	const string &dsn = get_parameter(ctx, "dsn");
	const string &database = get_parameter(ctx, "id");
	if (dsn.empty()) {
		throw tag_database_exception(
		  _("data source name (dsn) is not defined"));
	}

	string db_ptr = ctx.get_value(string("@SQLITE:[email protected]") + database);
	if (!db_ptr.empty()) {
		tag_impl::execute(ctx, out, caller);
		return;
	}

	ctx.enter();
	try {
		pool_ptr<sqlite_connection> c = database_pool::instance().acquire(dsn);
		if (!c->is_open())
			c->open(dsn);
		// save the pointer to database for nested tags
		ctx.add_value(string("@SQLITE:[email protected]") + get_parameter(ctx, "id"),
		  to_string<sqlite3*>(c->get_ptr()));
		tag_impl::execute(ctx, out, caller);
		ctx.leave();
	}
	catch (...) {
		ctx.leave();
		throw;
	}

}
开发者ID:wolfsoft,项目名称:dbpager,代码行数:32,代码来源:tag_database.cpp


示例12: do_handle_section

void pat_section_filter::do_handle_section(
      context& c,
      const char* section_buffer,
      size_t section_length) {
  section s;
  s.unpack(section_buffer, section_length);
  program_association_table pat;
  s.convert<program_association_table>(pat);

  c.get_view().print(
      c.get_packet_num(),
      s.header,
      pat,
      last_version_ != s.header.version);

  if(last_version_ == s.header.version)
    return;

  c.pat = pat;

  for(auto& i : pat.association) {
    if(i.program_number != 0) {
      if(!c.is_opened(i.pmt_pid)) {
        c.open_section_filter(
            i.pmt_pid,
            std::unique_ptr<section_filter>(
              new pmt_section_filter()));
      }
    }
  }

  last_version_ = s.header.version;
}
开发者ID:range3,项目名称:tsdivider,代码行数:33,代码来源:pat_section_filter_impl.hpp


示例13: plugin

 mk_magic_sets::mk_magic_sets(context & ctx, func_decl* goal) :
     plugin(10000, true),
     m_context(ctx),
     m(ctx.get_manager()),
     rm(ctx.get_rule_manager()),
     m_pinned(m), 
     m_goal(goal, m) {
 }
开发者ID:NikolajBjorner,项目名称:z3,代码行数:8,代码来源:dl_mk_magic_sets.cpp


示例14: build_with_source

    /**
     * In case BOOST_COMPUTE_USE_OFFLINE_CACHE macro is defined,
     * the compiled binary is stored for reuse in the offline cache located in
     * $HOME/.boost_compute on UNIX-like systems and in %APPDATA%/boost_compute
     * on Windows.
     */
    static program build_with_source(
            const std::string &source,
            const context     &context,
            const std::string &options = std::string()
            )
    {
#ifdef BOOST_COMPUTE_USE_OFFLINE_CACHE
        // Get hash string for the kernel.
        std::string hash;
        {
            device   d(context.get_device());
            platform p(d.get_info<cl_platform_id>(CL_DEVICE_PLATFORM));

            std::ostringstream src;
            src << "// " << p.name() << " v" << p.version() << "\n"
                << "// " << context.get_device().name() << "\n"
                << "// " << options << "\n\n"
                << source;

            hash = detail::sha1(src.str());
        }

        // Try to get cached program binaries:
        try {
            boost::optional<program> prog = load_program_binary(hash, context);

            if (prog) {
                prog->build(options);
                return *prog;
            }
        } catch (...) {
            // Something bad happened. Fallback to normal compilation.
        }

        // Cache is apparently not available. Just compile the sources.
#endif
        const char *source_string = source.c_str();

        cl_int error = 0;
        cl_program program_ = clCreateProgramWithSource(context,
                                                        uint_(1),
                                                        &source_string,
                                                        0,
                                                        &error);
        if(!program_){
            BOOST_THROW_EXCEPTION(runtime_exception(error));
        }

        program prog(program_, false);
        prog.build(options);

#ifdef BOOST_COMPUTE_USE_OFFLINE_CACHE
        // Save program binaries for future reuse.
        save_program_binary(hash, prog);
#endif

        return prog;
    }
开发者ID:Quanteek,项目名称:compute,代码行数:64,代码来源:program.hpp


示例15: join_planner

 join_planner(context & ctx, rule_set & rs_aux_copy)
     : m_context(ctx), m(ctx.get_manager()), 
       rm(ctx.get_rule_manager()),
       m_var_subst(ctx.get_var_subst()),
       m_rs_aux_copy(rs_aux_copy), 
       m_introduced_rules(ctx.get_rule_manager()),
       m_pinned(ctx.get_manager())
 {
 }
开发者ID:CHolmes3,项目名称:z3,代码行数:9,代码来源:dl_mk_simple_joins.cpp


示例16: m

 mk_coalesce::mk_coalesce(context& ctx):
     rule_transformer::plugin(50, false),
     m_ctx(ctx),
     m(ctx.get_manager()),
     rm(ctx.get_rule_manager()),
     m_sub1(m),
     m_sub2(m),
     m_idx(0)
 {}
开发者ID:kayceesrk,项目名称:Z3,代码行数:9,代码来源:dl_mk_coalesce.cpp


示例17: context_

transformer::transformer(const dynamic::workflow& w, context& c)
    : context_(c),
      identifier_parser_(new sml::identifier_parser(c.top_level_module_names(),
              c.model().name().external_module_path(),
              c.model().name().model_name())),
      dynamic_workflow_(w) {

    BOOST_LOG_SEV(lg, debug) << "Initial context: " << context_;
}
开发者ID:pgannon,项目名称:dogen,代码行数:9,代码来源:transformer.cpp


示例18: update

HAMIGAKI_BJAM_DECL string_list update(context& ctx)
{
    frame& f = ctx.current_frame();
    const list_of_list& args = f.arguments();

    string_list old = ctx.targets_to_update();
    ctx.targets_to_update(args[0]);
    return old;
}
开发者ID:fpelliccioni,项目名称:hamigaki,代码行数:9,代码来源:builtin_rules.cpp


示例19: apply

coding::meta_model::model injection_model_to_coding_model_transform::
apply(const context& ctx, const injection::meta_model::model& m) {
    tracing::scoped_transform_tracer stp(lg,
        "injection model to coding model transform", transform_id, m.name(),
        *ctx.coding_context().tracer(), m);

    /*
     * First we compute the model name and technical space by reading
     * data from configuration.
     */
    const auto& cfg(*m.configuration());
    auto& gcfg(m.configuration());
    const auto& fm(*ctx.coding_context().feature_model());
    const auto fg(make_feature_group(fm));
    const auto nc(make_naming_configuration(fg, cfg));
    const auto model_location(create_location(nc));

    coding::meta_model::model r;
    coding::helpers::name_builder b(true/*model_name_mode*/);
    b.external_modules(model_location.external_modules());
    b.model_modules(model_location.model_modules());
    r.name(b.build());
    r.input_technical_space(to_technical_space(m.input_technical_space()));
    BOOST_LOG_SEV(lg, debug) << "Computed model name: " << r.name();

    /*
     * Then we populate all model elements by adapting the injection
     * elements into coding elements.
     */
    const helpers::adapter ad;
    for (const auto& e : m.elements()) {
        const auto l(e.in_global_module() ? empty_location : model_location);
        process_element(ad, l, e, r);
    }

    /*
     * Finally we handle the creation of the root module. This is done
     * separately from regular module processing due to the vagaries
     * of the root module: its not an element from an injection
     * perspective, etc.
     */
    r.root_module(boost::make_shared<coding::meta_model::structural::module>());
    auto& rm(*r.root_module());
    rm.name(r.name());
    rm.configuration(gcfg);
    rm.configuration()->name().qualified(rm.name().qualified().dot());
    rm.is_root(true);

    helpers::stereotypes_helper h;
    const auto scr(h.from_string(m.stereotypes()));
    rm.dynamic_stereotypes(scr.dynamic_stereotypes());
    rm.documentation(m.documentation());
    insert(r.root_module(), r.structural_elements().modules());

    stp.end_transform(r);
    return r;
}
开发者ID:DomainDrivenConsulting,项目名称:dogen,代码行数:57,代码来源:injection_model_to_coding_model_transform.cpp


示例20: instance

HAMIGAKI_BJAM_DECL string_list instance(context& ctx)
{
    frame& f = ctx.current_frame();
    const list_of_list& args = f.arguments();

    module& instance_module = ctx.get_module(args[0][0]);
    instance_module.class_module = args[1][0];

    return string_list();
}
开发者ID:fpelliccioni,项目名称:hamigaki,代码行数:10,代码来源:builtin_rules.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ context_t类代码示例发布时间:2022-05-31
下一篇:
C++ container_type类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap