Esempio n. 1
0
VALUE rCORBA_Stub_invoke(int _argc, VALUE *_argv, VALUE self)
{
  // since rb_exc_raise () does not return and does *not* honour
  // C++ exception rules we invoke from an inner function and
  // only raise the user exception when returned so all stack
  // unwinding has been correctly handled.
  VALUE ret=Qnil;
  bool _raise = false;
  CORBA::Object_ptr obj;
  VALUE opname = Qnil;
  VALUE arg_list = Qnil;
  VALUE result_type = Qnil;
  VALUE exc_list = Qnil;
  VALUE v1=Qnil;

  // extract and check arguments
  rb_scan_args(_argc, _argv, "20", &opname, &v1);
  Check_Type (v1, T_HASH);

  arg_list = rb_hash_aref (v1, ID_arg_list);
  result_type = rb_hash_aref (v1, ID_result_type);
  exc_list = rb_hash_aref (v1, ID_exc_list);

  Check_Type(opname, T_STRING);
  if (arg_list != Qnil)
    Check_Type (arg_list, T_ARRAY);
  if (result_type != Qnil)
    r2tao_check_type(result_type, r2tao_cTypecode);
  if (exc_list != Qnil)
    Check_Type (exc_list, T_ARRAY);

  obj = r2tao_Object_r2t (self);

  R2TAO_TRY
  {
    CORBA::Request_var _req = obj->_request (RSTRING(opname)->ptr);

    if (arg_list != Qnil)
      _r2tao_set_request_arguments(_req.in (), arg_list);
    if (exc_list != Qnil)
      _r2tao_set_request_exceptions(_req.in (), exc_list);
    if (result_type != Qnil)
      _r2tao_set_request_return_type(_req.in (), result_type);

    ret = _r2tao_invoke_request(_req.in (), _raise);
  }
  R2TAO_CATCH;
  if (_raise) rb_exc_raise (ret);
  return ret;
}
Esempio n. 2
0
VALUE
rCORBA_Object_request(VALUE self, VALUE op_name)
{
  CORBA::Object_ptr obj;
  CORBA::Request_var req;

  obj = r2tao_Object_r2t (self);
  Check_Type(op_name, T_STRING);

  R2TAO_TRY
  {
    req = obj->_request (RSTRING(op_name)->ptr);
  }
  R2TAO_CATCH;

  return r2tao_Request_t2r (req.in ());
}