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>
11 #include <semaphore.h>
13 #include "myinterface.h"
15 #define ex_on_fail(command, ex) if (!(command)) do { ev->major = (ex); goto exception; } while(0)
16 #define FORB_REQEST_HDR_SIZE (forb_iop_MESSAGE_HEADER_SIZE + forb_iop_REQUEST_HEADER_SIZE)
18 #define _myinterface_impl(obj) ((struct forb_myinterface_impl*)(obj)->implementation)
20 CORBA_long myinterface_add(myinterface _obj, const CORBA_long a, const CORBA_long b, CORBA_Environment *ev)
22 CORBA_long _forb_retval;
23 forb_executor_t *exec_current;
24 if (ev) ev->major = FORB_EX_NONE;
26 if (forb_object_is_local(_obj) && !forb_get_current_executor(exec_current) &&
27 (forb_object_get_executor(_obj) == exec_current)) {
28 if (!_obj->interface ||
29 strncmp(_obj->interface->name, "myinterface", 11) != 0) {
30 ev->major = FORB_EX_BAD_OPERATION;
33 /* direct invocation */
34 _forb_retval = _myinterface_impl(_obj)->add(_obj, a, b, ev);
36 /* remote object - the same as before */
39 ex_on_fail(forb_request_init(&req, _obj, "myinterface", FORB_METHOD_INDEX(myinterface_add)) == 0, FORB_EX_INTERNAL);
40 forb_iop_prepare_request(&req, &index, ev);
41 if (forb_exception_occurred(ev)) goto exception;
42 ex_on_fail(CORBA_long_serialize(&req.cdr_request, &a), FORB_EX_IMP_LIMIT);
43 ex_on_fail(CORBA_long_serialize(&req.cdr_request, &b), FORB_EX_IMP_LIMIT);
44 forb_request_send(&req, index, ev);
45 if (forb_exception_occurred(ev)) goto exception;
46 forb_request_wait_for_reply(&req);
47 if (forb_exception_occurred(ev)) goto exception;
48 CORBA_long_deserialize(req.cdr_reply, &_forb_retval);
49 forb_request_signal_processed(&req);
51 forb_request_destroy(&req);