2 * This file was generated by forb-idl but now it is a test
6 #include <forb/forb-internal.h>
7 #include <forb/request.h>
10 #include <forb/object.h>
12 #include "myinterface.h"
14 #define ex_on_fail(command, ex) if (!(command)) do { ev->major = (ex); goto exception; } while(0)
15 #define FORB_REQEST_HDR_SIZE (forb_iop_MESSAGE_HEADER_SIZE + forb_iop_REQUEST_HEADER_SIZE)
17 #define _myinterface_impl(obj) ((struct forb_myinterface_impl*)(obj)->implementation)
19 CORBA_long myinterface_add(myinterface _obj, const CORBA_long a, const CORBA_long b, CORBA_Environment *ev)
21 CORBA_long _forb_retval;
22 executor *exec_current;
23 if (ev) ev->major = FORB_EX_NONE;
25 if (forb_object_is_local(_obj)) {
26 if (!_obj->interface ||
27 strncmp(_obj->interface->name, "myinterface", 11) != 0) {
28 ev->major = FORB_EX_BAD_OPERATION;
31 if (!forb_get_current_executor(exec_current) && (forb_object_get_executor(_obj) == exec_current))
32 /* direct invocation */
33 _forb_retval = _myinterface_impl(_obj)->add(_obj, a, b, ev);
35 /* TODO inter-thread invocation*/
38 /* remote object - the same as before */
40 ex_on_fail(forb_request_init(&req, _obj) == 0, FORB_EX_INTERNAL);
41 forb_iop_prepare_request(&req, "myinterface", FORB_METHOD_INDEX(myinterface_add), ev);
42 if (forb_exception_occurred(ev)) goto exception;
43 ex_on_fail(CORBA_long_serialize(&req.cdr_request, &a), FORB_EX_IMP_LIMIT);
44 ex_on_fail(CORBA_long_serialize(&req.cdr_request, &b), FORB_EX_IMP_LIMIT);
45 forb_request_send(&req, ev);
46 if (forb_exception_occurred(ev)) goto exception;
47 forb_request_wait_for_reply(&req);
48 if (forb_exception_occurred(ev)) goto exception;
49 CORBA_long_deserialize(req.cdr_reply, &_forb_retval);
50 forb_request_signal_processed(&req);
52 forb_request_destroy(&req);