MateComponentObject * matecomponent_foreign_object_new (CORBA_Object corba_objref) { MateComponentObject *object; CORBA_Environment ev[1]; g_return_val_if_fail (corba_objref != CORBA_OBJECT_NIL, NULL); CORBA_exception_init (ev); if (!CORBA_Object_is_a (corba_objref, "IDL:MateComponent/Unknown:1.0", ev)) { if (ev->_major != CORBA_NO_EXCEPTION) { char *text = matecomponent_exception_get_text (ev); g_warning ("CORBA_Object_is_a: %s", text); g_free (text); } else g_warning ("matecomponent_foreign_object_new: corba_objref" " doesn't have interface MateComponent::Unknown"); object = NULL; } else { object = MATECOMPONENT_OBJECT (g_object_new (MATECOMPONENT_TYPE_FOREIGN_OBJECT, NULL)); object->corba_objref = CORBA_Object_duplicate (corba_objref, NULL); matecomponent_running_context_add_object_T (object->corba_objref); } CORBA_exception_free (ev); return object; }
Bonobo_Unknown bonobo_moniker_ior_resolve (BonoboMoniker *moniker, const Bonobo_ResolveOptions *options, const CORBA_char *requested_interface, CORBA_Environment *ev) { const char *ior; CORBA_Object object; Bonobo_Unknown retval; gboolean is_unknown, is_correct; ior = bonobo_moniker_get_name (moniker); object = CORBA_ORB_string_to_object (bonobo_orb (), ior, ev); BONOBO_RET_VAL_EX (ev, CORBA_OBJECT_NIL); is_unknown = CORBA_Object_is_a (object, "IDL:Bonobo/Unknown:1.0", ev); BONOBO_RET_VAL_EX (ev, CORBA_OBJECT_NIL); if (!is_unknown) { is_correct = CORBA_Object_is_a (object, requested_interface, ev); BONOBO_RET_VAL_EX (ev, CORBA_OBJECT_NIL); if (is_correct) return object; else { CORBA_exception_set ( ev, CORBA_USER_EXCEPTION, ex_Bonobo_Moniker_InterfaceNotFound, NULL); return CORBA_OBJECT_NIL; } } retval = Bonobo_Unknown_queryInterface ( object, requested_interface, ev); BONOBO_RET_VAL_EX (ev, CORBA_OBJECT_NIL); if (retval == CORBA_OBJECT_NIL) CORBA_exception_set ( ev, CORBA_USER_EXCEPTION, ex_Bonobo_Moniker_InterfaceNotFound, NULL); return retval; }
static int pymatecomponent_unknown_to_value(GValue *value, PyObject *object) { CORBA_Object objref; CORBA_Environment ev; gboolean type_matches; if (!PyObject_TypeCheck(object, &PyCORBA_Object_Type)) return -1; objref = ((PyCORBA_Object *)object)->objref; /* check if it is a MateComponent::Unknown */ CORBA_exception_init(&ev); type_matches = CORBA_Object_is_a(objref, "IDL:MateComponent/Unknown:1.0", &ev); if (pymatecorba_check_ex(&ev)) return -1; if (!type_matches) return -1; g_value_set_boxed(value, objref); return 0; }