Beispiel #1
0
 virtual bool perform(execution_context & ctx) {
     if (m_store) {
         if (ctx.reg(m_reg)) {
             ctx.get_datalog_context().store_relation(m_pred, ctx.release_reg(m_reg));
         }
         else {
             context & dctx = ctx.get_datalog_context();
             relation_base * empty_rel;
             //the object referenced by sig is valid only until we call dctx.store_relation()
             const relation_signature & sig = dctx.get_relation(m_pred).get_signature();
             empty_rel = dctx.get_rmanager().mk_empty_relation(sig, m_pred.get());
             dctx.store_relation(m_pred, empty_rel);
         }
     }
     else {
         relation_base& rel = ctx.get_datalog_context().get_relation(m_pred);
         if ((!ctx.eager_emptiness_checking() || !rel.empty())) {
             ctx.set_reg(m_reg, rel.clone());
         }
         else {
             ctx.make_empty(m_reg);
         }
     }
     return true;
 }
 void external_relation::mk_accessor(decl_kind k, func_decl_ref& fn, const relation_fact& f, bool destructive, expr_ref& res) const {
     ast_manager& m = m_rel.get_manager();
     family_id fid = get_plugin().get_family_id();
     ptr_vector<expr> args;
     args.push_back(m_rel);
     for (unsigned i = 0; i < f.size(); ++i) {
         args.push_back(f[i]);
     }
     if (!fn.get()) {
        fn = m.mk_func_decl(fid, k, 0, 0, args.size(), args.c_ptr());
     }        
     if (destructive) {
         get_plugin().reduce_assign(fn, args.size(), args.c_ptr(), 1, args.c_ptr());
         res = m_rel;
     }
     else {
         get_plugin().reduce(fn, args.size(), args.c_ptr(), res);
     }
 }
 void operator()(relation_base & t, const relation_base & negated_obj) {
     m_args[0] = get(t).get_relation();
     m_args[1] = get(negated_obj).get_relation();
     m_plugin.reduce_assign(m_negated_filter_fn.get(), 2, m_args, 1, m_args);                       
 }