From 0276b7c1dd82ab2102c0b7879b36b301fe7c271f Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Mon, 18 Sep 2023 08:25:31 +0200 Subject: [PATCH 1/2] Extend this unit test to reproduce some problems in the generated code * exf/tests/apc/ext-sync-complex/components/receiver/hello_receiver_exec.cpp: * exf/tests/apc/ext-sync-complex/components/receiver/hello_receiver_exec.h: * exf/tests/apc/ext-sync-complex/data2/hello2.idl: --- .../receiver/hello_receiver_exec.cpp | 98 +++++++++++++++++++ .../components/receiver/hello_receiver_exec.h | 44 +++++++++ .../apc/ext-sync-complex/data2/hello2.idl | 7 +- 3 files changed, 148 insertions(+), 1 deletion(-) diff --git a/exf/tests/apc/ext-sync-complex/components/receiver/hello_receiver_exec.cpp b/exf/tests/apc/ext-sync-complex/components/receiver/hello_receiver_exec.cpp index b6d7cc7a9..ac5406f7b 100644 --- a/exf/tests/apc/ext-sync-complex/components/receiver/hello_receiver_exec.cpp +++ b/exf/tests/apc/ext-sync-complex/components/receiver/hello_receiver_exec.cpp @@ -64,6 +64,70 @@ namespace Hello_Receiver_Impl //@@{__RIDL_REGEN_MARKER__} - END : Hello_Receiver_Impl::do_my_B_exec_i::op_B[_in_l_s_in_l] } + bool + do_my_B_exec_i::op_C ( + int32_t in_c, + bool in_b, + bool& out_b, + bool& inout_b) + { + //@@{__RIDL_REGEN_MARKER__} - BEGIN : Hello_Receiver_Impl::do_my_B_exec_i::op_C[_in_c_in_b_out_b_inout_b] + X11_UNUSED_ARG(in_c); + X11_UNUSED_ARG(in_b); + X11_UNUSED_ARG(out_b); + X11_UNUSED_ARG(inout_b); + return {}; + //@@{__RIDL_REGEN_MARKER__} - END : Hello_Receiver_Impl::do_my_B_exec_i::op_C[_in_c_in_b_out_b_inout_b] + } + + bool + do_my_B_exec_i::op_D ( + int32_t in_c, + uint8_t in_b, + uint8_t& out_b, + uint8_t& inout_b) + { + //@@{__RIDL_REGEN_MARKER__} - BEGIN : Hello_Receiver_Impl::do_my_B_exec_i::op_D[_in_c_in_b_out_b_inout_b] + X11_UNUSED_ARG(in_c); + X11_UNUSED_ARG(in_b); + X11_UNUSED_ARG(out_b); + X11_UNUSED_ARG(inout_b); + return {}; + //@@{__RIDL_REGEN_MARKER__} - END : Hello_Receiver_Impl::do_my_B_exec_i::op_D[_in_c_in_b_out_b_inout_b] + } + + bool + do_my_B_exec_i::op_E ( + int32_t in_c, + char in_b, + char& out_b, + char& inout_b) + { + //@@{__RIDL_REGEN_MARKER__} - BEGIN : Hello_Receiver_Impl::do_my_B_exec_i::op_E[_in_c_in_b_out_b_inout_b] + X11_UNUSED_ARG(in_c); + X11_UNUSED_ARG(in_b); + X11_UNUSED_ARG(out_b); + X11_UNUSED_ARG(inout_b); + return {}; + //@@{__RIDL_REGEN_MARKER__} - END : Hello_Receiver_Impl::do_my_B_exec_i::op_E[_in_c_in_b_out_b_inout_b] + } + + bool + do_my_B_exec_i::op_F ( + int32_t in_c, + wchar_t in_b, + wchar_t& out_b, + wchar_t& inout_b) + { + //@@{__RIDL_REGEN_MARKER__} - BEGIN : Hello_Receiver_Impl::do_my_B_exec_i::op_F[_in_c_in_b_out_b_inout_b] + X11_UNUSED_ARG(in_c); + X11_UNUSED_ARG(in_b); + X11_UNUSED_ARG(out_b); + X11_UNUSED_ARG(inout_b); + return {}; + //@@{__RIDL_REGEN_MARKER__} - END : Hello_Receiver_Impl::do_my_B_exec_i::op_F[_in_c_in_b_out_b_inout_b] + } + int32_t do_my_B_exec_i::op_A ( int32_t in_l) @@ -73,6 +137,40 @@ namespace Hello_Receiver_Impl //@@{__RIDL_REGEN_MARKER__} - END : Hello_Receiver_Impl::do_my_B_exec_i::op_A[_in_l] } + bool + do_my_B_exec_i::at_D () + { + //@@{__RIDL_REGEN_MARKER__} - BEGIN : Hello_Receiver_Impl::do_my_B_exec_i::at_D[getter] + return this->at_D_; + //@@{__RIDL_REGEN_MARKER__} - END : Hello_Receiver_Impl::do_my_B_exec_i::at_D[getter] + } + + void + do_my_B_exec_i::at_D ( + bool at_D) + { + //@@{__RIDL_REGEN_MARKER__} - BEGIN : Hello_Receiver_Impl::do_my_B_exec_i::at_D[setter] + this->at_D_ = at_D; + //@@{__RIDL_REGEN_MARKER__} - END : Hello_Receiver_Impl::do_my_B_exec_i::at_D[setter] + } + + int32_t + do_my_B_exec_i::at_E () + { + //@@{__RIDL_REGEN_MARKER__} - BEGIN : Hello_Receiver_Impl::do_my_B_exec_i::at_E[getter] + return this->at_E_; + //@@{__RIDL_REGEN_MARKER__} - END : Hello_Receiver_Impl::do_my_B_exec_i::at_E[getter] + } + + void + do_my_B_exec_i::at_E ( + int32_t at_E) + { + //@@{__RIDL_REGEN_MARKER__} - BEGIN : Hello_Receiver_Impl::do_my_B_exec_i::at_E[setter] + this->at_E_ = at_E; + //@@{__RIDL_REGEN_MARKER__} - END : Hello_Receiver_Impl::do_my_B_exec_i::at_E[setter] + } + /** * Component Executor Implementation Class : Receiver_exec_i */ diff --git a/exf/tests/apc/ext-sync-complex/components/receiver/hello_receiver_exec.h b/exf/tests/apc/ext-sync-complex/components/receiver/hello_receiver_exec.h index dae62696c..07a60e3bd 100644 --- a/exf/tests/apc/ext-sync-complex/components/receiver/hello_receiver_exec.h +++ b/exf/tests/apc/ext-sync-complex/components/receiver/hello_receiver_exec.h @@ -57,11 +57,47 @@ namespace Hello_Receiver_Impl int32_t in_l, const ::Hello::S1& s_in_l) override; + bool + op_C ( + int32_t in_c, + bool in_b, + bool& out_b, + bool& inout_b) override; + + bool + op_D ( + int32_t in_c, + uint8_t in_b, + uint8_t& out_b, + uint8_t& inout_b) override; + + bool + op_E ( + int32_t in_c, + char in_b, + char& out_b, + char& inout_b) override; + + bool + op_F ( + int32_t in_c, + wchar_t in_b, + wchar_t& out_b, + wchar_t& inout_b) override; + int32_t op_A ( int32_t in_l) override; //@} + /** @name Attributes from ::Hello::CCM_B */ + //@{ + bool at_D () override; + void at_D (bool at_D) override; + int32_t at_E () override; + void at_E (int32_t at_E) override; + //@} + /** @name User defined public operations. */ //@{ //@@{__RIDL_REGEN_MARKER__} - BEGIN : Hello_Receiver_Impl::do_my_B_exec_i[user_public_ops] @@ -73,6 +109,14 @@ namespace Hello_Receiver_Impl /// Context for component instance. Used for all middleware communication. IDL::traits<::Hello::CCM_Receiver_Context>::ref_type context_; + /** @name Members to store attribute values from ::Hello::CCM_B */ + //@{ + /// Class member storing value of at_D attribute + bool at_D_{}; + /// Class member storing value of at_E attribute + int32_t at_E_{}; + //@} + /** @name User defined members. */ //@{ //@@{__RIDL_REGEN_MARKER__} - BEGIN : Hello_Receiver_Impl::do_my_B_exec_i[user_members] diff --git a/exf/tests/apc/ext-sync-complex/data2/hello2.idl b/exf/tests/apc/ext-sync-complex/data2/hello2.idl index 7e30da8ba..1a1c5c94a 100644 --- a/exf/tests/apc/ext-sync-complex/data2/hello2.idl +++ b/exf/tests/apc/ext-sync-complex/data2/hello2.idl @@ -15,11 +15,16 @@ module Hello { - // Sender/Receiver interface interface B:A { long op_B (in long in_l, in S1 s_in_l); + boolean op_C (in long in_c, in boolean in_b, out boolean out_b, inout boolean inout_b); + boolean op_D (in long in_c, in octet in_b, out octet out_b, inout octet inout_b); + boolean op_E (in long in_c, in char in_b, out char out_b, inout char inout_b); + boolean op_F (in long in_c, in wchar in_b, out wchar out_b, inout wchar inout_b); + attribute boolean at_D; + attribute long at_E; }; }; From 7e4c537c553f36964a84e52c8be4244a999a45e1 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Mon, 18 Sep 2023 11:43:12 +0200 Subject: [PATCH 2/2] Fix ExF CORBA4CCM code generation issue * exf/ridlbe/ccmx11/facets/exf4cc/templates/srv/src/exf/exf_attribute.erb: * exf/ridlbe/ccmx11/facets/exf4cc/templates/srv/src/exf/exf_operation.erb: --- .../facets/exf4cc/templates/srv/src/exf/exf_attribute.erb | 4 ++-- .../facets/exf4cc/templates/srv/src/exf/exf_operation.erb | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/exf/ridlbe/ccmx11/facets/exf4cc/templates/srv/src/exf/exf_attribute.erb b/exf/ridlbe/ccmx11/facets/exf4cc/templates/srv/src/exf/exf_attribute.erb index 72ae9c748..f7b808144 100644 --- a/exf/ridlbe/ccmx11/facets/exf4cc/templates/srv/src/exf/exf_attribute.erb +++ b/exf/ridlbe/ccmx11/facets/exf4cc/templates/srv/src/exf/exf_attribute.erb @@ -24,7 +24,7 @@ void } else { - if (!(this->_exf_rh_output () << <%= cdr_to_fmt % 'this->val_' %>)) + if (!(this->_exf_rh_output () << <%= cdr_from_fmt % 'this->val_' %>)) { throw TAO_CORBA::MARSHAL(); } @@ -45,7 +45,7 @@ void { TAO_InputCDR & _tao_in = *srvreq.incoming (); - if (!((_tao_in >> <%= cdr_from_fmt % 'this->val_' %>))) + if (!((_tao_in >> <%= cdr_to_fmt % 'this->val_' %>))) { throw TAO_CORBA::MARSHAL(); } diff --git a/exf/ridlbe/ccmx11/facets/exf4cc/templates/srv/src/exf/exf_operation.erb b/exf/ridlbe/ccmx11/facets/exf4cc/templates/srv/src/exf/exf_operation.erb index 059e97cc9..5f06ad04a 100644 --- a/exf/ridlbe/ccmx11/facets/exf4cc/templates/srv/src/exf/exf_operation.erb +++ b/exf/ridlbe/ccmx11/facets/exf4cc/templates/srv/src/exf/exf_operation.erb @@ -23,7 +23,7 @@ void % _in_args = in_arguments.dup % while !_in_args.empty? % _arg = _in_args.shift - (_tao_in >> <%= _arg.cdr_from_fmt % "this->#{_arg.cxxname}" %>)<% unless _in_args.empty? %> &&<% end %> + (_tao_in >> <%= _arg.cdr_to_fmt % "this->#{_arg.cxxname}" %>)<% unless _in_args.empty? %> &&<% end %> % end )) { @@ -76,11 +76,11 @@ void if (!( % _out_args = out_arguments.dup % unless is_oneway? || is_void? - (this->_exf_rh_output () << <%= cdr_to_fmt % 'this->retval' %>)<% unless _out_args.empty? %> &&<% end %> + (this->_exf_rh_output () << <%= cdr_from_fmt % 'this->retval' %>)<% unless _out_args.empty? %> &&<% end %> % end % while !_out_args.empty? % _arg = _out_args.shift - (this->_exf_rh_output () << <%= _arg.cdr_to_fmt % "this->#{_arg.cxxname}" %>)<% unless _out_args.empty? %> &&<% end %> + (this->_exf_rh_output () << <%= _arg.cdr_from_fmt % "this->#{_arg.cxxname}" %>)<% unless _out_args.empty? %> &&<% end %> % end )) {