]> rtime.felk.cvut.cz Git - frescor/forb.git/commitdiff
Object references as out parameters are now supported as well
authorMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 3 Oct 2008 08:44:06 +0000 (10:44 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 3 Oct 2008 08:44:06 +0000 (10:44 +0200)
forb-idl/forb-idl-c-headers.c
forb-idl/forb-idl-c-skels.c
forb-idl/forb-idl-c-stubs.c
object.c
object.h
tests-idl/interface.idl

index d1308de0e96898ac5d62b5e519dfca69a4f17d96..e74546393586fe64cea943e0da19582f98f16976 100644 (file)
@@ -446,7 +446,7 @@ ch_output_interface(IDL_tree tree, OIDL_Run_Info *rinfo, OIDL_C_Info *ci)
 /*         fprintf(ci->fh, "#define %s__freekids CORBA_Object__freekids\n", fullname); */
        fprintf(ci->fh, "typedef forb_object %s;\n", fullname);
        fprintf(ci->fh, "#define %s_serialize(codec, obj) forb_object_serialize((codec), (obj))\n", fullname);
-       fprintf(ci->fh, "#define %s_deserialize(orb, codec, obj) forb_object_deserialize((orb), (codec), (obj))\n", fullname);
+       fprintf(ci->fh, "#define %s_deserialize(codec, obj, orb) forb_object_deserialize((codec), (obj), (orb))\n", fullname);
 /*             fprintf(ci->fh, "extern CORBA_unsigned_long %s__classid;\n", fullname); */
 
        ch_output_impl_struct(tree, rinfo, ci);
index fd18bd001ebc1b98201c351b666a06cf092317d4..81a7c244616efe4f43edc9ff53b90b867a5c2ea3 100644 (file)
@@ -243,11 +243,6 @@ static void free_memory_if_needed(IDL_tree type_spec, const char *name, OIDL_C_I
 
 }
 
-bool is_object_reference(IDL_tree parm)
-{
-       return IDL_NODE_TYPE(forb_cbe_get_typespec(parm)) == IDLN_INTERFACE;
-}
-
 static void ck_output_op_skel(IDL_tree op, char *intf_id, OIDL_Run_Info *rinfo, OIDL_C_Info *ci)
 {
        char *id, *id_plain;
@@ -292,8 +287,8 @@ static void ck_output_op_skel(IDL_tree op, char *intf_id, OIDL_Run_Info *rinfo,
                        char *name = IDL_IDENT(IDL_PARAM_DCL(parm).simple_declarator).str;
                        fprintf(ci->fh, /* "  r = " */ "    ");
                        forb_cbe_write_typespec(ci->fh, IDL_PARAM_DCL(parm).param_type_spec);
-                       if (is_object_reference(parm)) {
-                         fprintf(ci->fh, "_deserialize(_obj->orb, cin, &%s);\n", name);
+                       if (IDL_NODE_TYPE(forb_cbe_get_typespec(parm)) == IDLN_INTERFACE) {
+                         fprintf(ci->fh, "_deserialize(cin, &%s, _obj->orb);\n", name);
                        } else {
                          fprintf(ci->fh, "_deserialize(cin, &%s);\n", name);
                        }
index 2bd1b69f8f221c20cefa903d624137539d20e630..11d2a93dcc366656a27ff6f74640a92a368bcaa0 100644 (file)
@@ -101,7 +101,11 @@ cs_output_stub (IDL_tree     tree,
                  char *name = IDL_IDENT(IDL_PARAM_DCL(parm).simple_declarator).str;
                  fprintf(of, "    ");
                  forb_cbe_write_typespec(of, IDL_PARAM_DCL(parm).param_type_spec);
-                 fprintf(of, "_deserialize(req.cdr_reply, %s);\n", name);
+                 if (IDL_NODE_TYPE(forb_cbe_get_typespec(parm)) == IDLN_INTERFACE) {
+                         fprintf(ci->fh, "_deserialize(req.cdr_reply, %s, _obj->orb);\n", name);
+                 } else {
+                         fprintf(ci->fh, "_deserialize(req.cdr_reply, %s);\n", name);
+                 }
                }
        }
        fprintf(of, "    forb_request_signal_processed(&req);\n"
index 42955563887cc6bb65afd696634e5a1fc624fe3d..ba568789b0f3f633d07c2c61a676790ed7e93961 100644 (file)
--- a/object.c
+++ b/object.c
@@ -225,7 +225,7 @@ forb_object_serialize(CDR_Codec *codec, const forb_object *obj)
  * @return CORBA_TRUE on success, CORBA_FALSE on error.
  */
 CORBA_boolean
-forb_object_deserialize(forb_orb orb, CDR_Codec *codec, forb_object *obj)
+forb_object_deserialize(CDR_Codec *codec, forb_object *obj, forb_orb orb)
 {
        forb_server_id server_id;
        forb_object_key objkey;
index 9fda97258a180d05bfc99c6d15c17a1bfa228940..fc88e57be8400aaaac775f5e8161eb0c20528021 100644 (file)
--- a/object.h
+++ b/object.h
@@ -126,6 +126,6 @@ forb_object_is_remote(forb_object obj)
 CORBA_boolean
 forb_object_serialize(CDR_Codec *codec, const forb_object *obj);
 CORBA_boolean
-forb_object_deserialize(forb_orb orb, CDR_Codec *codec, forb_object *obj);
+forb_object_deserialize(CDR_Codec *codec, forb_object *obj, forb_orb orb);
 
 #endif
index 321262523fbe7a1aec75f53242322d23348348eb..f2a674a49b5324366e02025134cb2e7823594502 100644 (file)
@@ -10,7 +10,7 @@ interface myinterface {
        void square(inout long r);
        void message(in string msg);
        void last_message(out string msg);
-       void struct_method(in struct_t s);
-       void obj_method(in myinterface mi);
-//     void mytype_method(in mytype mt);
+       void struct_method(in struct_t s, out struct_t ss);
+       void obj_method(in myinterface mi, out myinterface mo);
+       void mytype_method(in mytype mt, out mytype mtt);
 };