typename basic_otp_mailbox_registry<Alloc, Mutex>::mailbox_ptr
basic_otp_mailbox_registry<Alloc, Mutex>::get(const eterm<Alloc>& a_proc) const
    throw (err_bad_argument, err_no_process)
{
    switch (a_proc.type()) {
        case ATOM:  return get(a_proc.to_atom());
        case PID:   return get(a_proc.to_pid());
        default:    throw err_bad_argument("Unknown process identifier", a_proc);
    }
}
Exemple #2
0
 bool match(const eterm<Alloc>& pattern, varbind<Alloc>* binding) const
     throw (err_unbound_variable)
 {
     if (is_any()) return true;
     if (!binding) return false;
     const eterm<Alloc>* value = binding->find(name());
     if (value)
         return check_type(value->type()) ? value->match(pattern, binding) : false;
     if (!check_type(pattern.type()))
         return false;
     // Bind the variable
     eterm<Alloc> et;
     binding->bind(name(), pattern.subst(et, binding) ? et : pattern);
     return true; 
 }
Exemple #3
0
bool on_io_request(otp_mailbox& a_mbox, eixx::transport_msg*& a_msg) {

    static const eterm s_put_chars = eterm::format("{io_request,_,_,{put_chars,S}}");

    if (!a_msg)
        return true;

    varbind l_binding;
    if (s_put_chars.match(a_msg->msg(), &l_binding))
        std::cerr << "I/O request from server: "
                    << l_binding[S]->to_string() << std::endl;
    else
        std::cerr << "I/O server got a message: " << a_msg->msg() << std::endl;

    return true;
}
Exemple #4
0
 bool match(const eterm<Alloc>& pattern, varbind<Alloc>* binding) const
     throw (err_unbound_variable) {
     if (is_any()) return true;
     const eterm<Alloc>* value = binding ? binding->find(c_str()) : NULL;
     if (value)
         return value->match(pattern, binding);
     if (binding != NULL) {
         // Bind the variable
         eterm<Alloc> et;
         binding->bind(name(), pattern.subst(et, binding) ? et : pattern);
     }
     return true; 
 }