diff --git a/bin/taox11_tests.lst b/bin/taox11_tests.lst index a847c160..c9085b86 100644 --- a/bin/taox11_tests.lst +++ b/bin/taox11_tests.lst @@ -82,6 +82,7 @@ tests/idl4/default/run_test.pl: tests/idl4/enum/run_test.pl: tests/idl4/explicit_ints/run_test.pl: tests/idl4/explicit_ints/run_illegal_idl3_test.pl: +tests/idl4/external/run_test.pl: tests/idl4/illegal_idl/run_test.pl: tests/idl4/map/run_test.pl: tests/idl4/map/run_illegal_idl3_test.pl: diff --git a/ridlbe/c++11/templates/cli/hdr/struct_idl_traits_def.erb b/ridlbe/c++11/templates/cli/hdr/struct_idl_traits_def.erb index 86936b47..4892e0fc 100644 --- a/ridlbe/c++11/templates/cli/hdr/struct_idl_traits_def.erb +++ b/ridlbe/c++11/templates/cli/hdr/struct_idl_traits_def.erb @@ -34,7 +34,7 @@ struct formatter<<%= scoped_cxxtype %>, OStrm_> << "object}" % end % else -% unless _m.optional? +% unless _m.optional? || _m.external? << "<%= _sep %><%= _m.cxxname %>=" << IDL::traits<<%= _m.scoped_cxxtype %>>::write(val_.<%= _m.cxxname %> ()) % else %# TODO diff --git a/ridlbe/c++11/visitors/struct.rb b/ridlbe/c++11/visitors/struct.rb index 202686df..580570ec 100644 --- a/ridlbe/c++11/visitors/struct.rb +++ b/ridlbe/c++11/visitors/struct.rb @@ -78,6 +78,10 @@ def optional? !node.annotations[:optional].first.nil? end + def external? + !node.annotations[:external].first.nil? + end + def is_reference? if optional? false @@ -95,42 +99,52 @@ def is_pod? end def cxx_byval_type - unless optional? - super - else + if optional? "IDL::optional<#{cxx_return_type}>" + elsif external? + "std::shared_ptr<#{cxx_return_type}>" + else + super end end def cxx_out_type - unless optional? - super - else + if optional? "IDL::optional<#{cxx_return_type}>&" + elsif external? + "std::shared_ptr<#{cxx_return_type}>&" + else + super end end def cxx_in_type - unless optional? - super - else + if optional? "const IDL::optional<#{super}>&" + elsif external? + "const std::shared_ptr<#{super}>&" + else + super end end def cxx_move_type - unless optional? - super - else + if optional? "IDL::optional<#{cxx_return_type}>&&" + elsif external? + "std::shared_ptr<#{cxx_return_type}>&&" + else + super end end def cxx_member_type - unless optional? - super - else + if optional? "IDL::optional<#{super}>" + elsif external? + "std::shared_ptr<#{super}>" + else + super end end end diff --git a/tests/annotations/run_test.pl b/tests/annotations/run_test.pl index 82d03efe..1a1bcc10 100755 --- a/tests/annotations/run_test.pl +++ b/tests/annotations/run_test.pl @@ -22,7 +22,7 @@ $server = $SV->SpawnWaitKill ($target->ProcessStartWaitInterval()); if ($server != 0) { - print STDERR "ERROR: const returned $server\n"; + print STDERR "ERROR: client returned $server\n"; $status = 1; } diff --git a/tests/idl4/bitset/run_test.pl b/tests/idl4/bitset/run_test.pl index 82d03efe..1a1bcc10 100755 --- a/tests/idl4/bitset/run_test.pl +++ b/tests/idl4/bitset/run_test.pl @@ -22,7 +22,7 @@ $server = $SV->SpawnWaitKill ($target->ProcessStartWaitInterval()); if ($server != 0) { - print STDERR "ERROR: const returned $server\n"; + print STDERR "ERROR: client returned $server\n"; $status = 1; } diff --git a/tests/idl4/enum/run_test.pl b/tests/idl4/enum/run_test.pl index 82d03efe..1a1bcc10 100755 --- a/tests/idl4/enum/run_test.pl +++ b/tests/idl4/enum/run_test.pl @@ -22,7 +22,7 @@ $server = $SV->SpawnWaitKill ($target->ProcessStartWaitInterval()); if ($server != 0) { - print STDERR "ERROR: const returned $server\n"; + print STDERR "ERROR: client returned $server\n"; $status = 1; } diff --git a/tests/idl4/explicit_ints/run_test.pl b/tests/idl4/explicit_ints/run_test.pl index 82d03efe..1a1bcc10 100755 --- a/tests/idl4/explicit_ints/run_test.pl +++ b/tests/idl4/explicit_ints/run_test.pl @@ -22,7 +22,7 @@ $server = $SV->SpawnWaitKill ($target->ProcessStartWaitInterval()); if ($server != 0) { - print STDERR "ERROR: const returned $server\n"; + print STDERR "ERROR: client returned $server\n"; $status = 1; } diff --git a/tests/idl4/external/client.cpp b/tests/idl4/external/client.cpp new file mode 100644 index 00000000..71c79c4c --- /dev/null +++ b/tests/idl4/external/client.cpp @@ -0,0 +1,20 @@ +/** + * @file client.cpp + * @author Johnny Willemsen + * + * @brief CORBA C++11 client application + * + * @copyright Copyright (c) Remedy IT Expertise BV + */ + +#include "testC.h" +#include "testlib/taox11_testlog.h" + +int main (int /*argc*/, char* /*argv*/[]) +{ + int retval {}; + bar mybar; + + TAOX11_TEST_INFO << "mybar: " << mybar << std::endl; + return retval; +} diff --git a/tests/idl4/external/run_test.pl b/tests/idl4/external/run_test.pl new file mode 100755 index 00000000..1a1bcc10 --- /dev/null +++ b/tests/idl4/external/run_test.pl @@ -0,0 +1,31 @@ +#--------------------------------------------------------------------- +# @file run_test.pl +# @author Marcel Smit +# +# @copyright Copyright (c) Remedy IT Expertise BV +#--------------------------------------------------------------------- +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +my $target = PerlACE::TestTarget::create_target(2) || die "Create target 2 failed\n"; + +$status = 0; + +$SV = $target->CreateProcess ("client"); + +$server = $SV->SpawnWaitKill ($target->ProcessStartWaitInterval()); + +if ($server != 0) { + print STDERR "ERROR: client returned $server\n"; + $status = 1; +} + +$target->GetStderrLog(); + +exit $status; diff --git a/tests/idl4/external/test.idl b/tests/idl4/external/test.idl new file mode 100644 index 00000000..3dba88fb --- /dev/null +++ b/tests/idl4/external/test.idl @@ -0,0 +1,14 @@ +/** + * @file test.idl + * @author Johnny Willemsen + * + * @copyright Copyright (c) Remedy IT Expertise BV + */ + +struct bar +{ + short x; + string y; + @external short z; +}; + diff --git a/tests/idl4/external/test.mpc b/tests/idl4/external/test.mpc new file mode 100644 index 00000000..4b03445e --- /dev/null +++ b/tests/idl4/external/test.mpc @@ -0,0 +1,20 @@ +// -*- MPC -*- + +project(*external_gen_idl): ridl_ostream_defaults { + IDL_Files { + test.idl + idlflags += --idl-version=4 -Scdr + } + custom_only = 1 +} + +project(*external_client): taox11_client { + after += *external_gen_idl + Source_Files { + client.cpp + } + Source_Files { + testC.cpp + } +} + diff --git a/tests/idl4/optional/run_test.pl b/tests/idl4/optional/run_test.pl index 82d03efe..1a1bcc10 100755 --- a/tests/idl4/optional/run_test.pl +++ b/tests/idl4/optional/run_test.pl @@ -22,7 +22,7 @@ $server = $SV->SpawnWaitKill ($target->ProcessStartWaitInterval()); if ($server != 0) { - print STDERR "ERROR: const returned $server\n"; + print STDERR "ERROR: client returned $server\n"; $status = 1; } diff --git a/tests/idl4/union/run_test.pl b/tests/idl4/union/run_test.pl index 82d03efe..1a1bcc10 100755 --- a/tests/idl4/union/run_test.pl +++ b/tests/idl4/union/run_test.pl @@ -22,7 +22,7 @@ $server = $SV->SpawnWaitKill ($target->ProcessStartWaitInterval()); if ($server != 0) { - print STDERR "ERROR: const returned $server\n"; + print STDERR "ERROR: client returned $server\n"; $status = 1; }