diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2020-12-09 14:42:46 +0100 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2020-12-09 14:42:46 +0100 |
commit | 151d2b56007cd0328bd2763602c13da1744c13cd (patch) | |
tree | 5013fb7bf306b0ddd9643970e264b5e16bd74fb7 /TAO | |
parent | e241aea9f367e19f9a8b2b58f9bd1b5bafac296e (diff) | |
download | ATCD-151d2b56007cd0328bd2763602c13da1744c13cd.tar.gz |
Test PI target_is_ and generate more compact _is_a operations
* TAO/TAO_IDL/be/be_component.cpp:
* TAO/TAO_IDL/be/be_interface.cpp:
* TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp:
* TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp:
* TAO/tests/Portable_Interceptors/Dynamic/server_interceptor.cpp:
Diffstat (limited to 'TAO')
-rw-r--r-- | TAO/TAO_IDL/be/be_component.cpp | 10 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_interface.cpp | 24 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp | 2 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp | 19 | ||||
-rw-r--r-- | TAO/tests/Portable_Interceptors/Dynamic/server_interceptor.cpp | 25 |
5 files changed, 40 insertions, 40 deletions
diff --git a/TAO/TAO_IDL/be/be_component.cpp b/TAO/TAO_IDL/be/be_component.cpp index 28b866663db..5262752f986 100644 --- a/TAO/TAO_IDL/be/be_component.cpp +++ b/TAO/TAO_IDL/be/be_component.cpp @@ -364,18 +364,12 @@ be_component::gen_is_a_ancestors (TAO_OutStream *os) while (ancestor != nullptr) { - *os << "std::strcmp (" << be_idt << be_idt_nl - << "value," << be_nl - << "\"" << ancestor->repoID () << "\"" << be_uidt_nl - << ") == 0 ||" << be_uidt_nl; + *os << "std::strcmp (value, \"" << ancestor->repoID () << "\") == 0 ||" << be_nl; ancestor = ancestor->base_component (); } - *os << "std::strcmp (" << be_idt << be_idt_nl - << "value," << be_nl - << "\"IDL:omg.org/Components/CCMObject:1.0\"" << be_uidt_nl - << ") == 0" << be_uidt << be_uidt_nl; + *os << "std::strcmp (value, \"IDL:omg.org/Components/CCMObject:1.0\") == 0" << be_nl; return 0; } diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp index 7cb827f423c..ba3b0ce5ff0 100644 --- a/TAO/TAO_IDL/be/be_interface.cpp +++ b/TAO/TAO_IDL/be/be_interface.cpp @@ -2309,10 +2309,7 @@ be_interface::is_a_helper (be_interface * /*derived*/, TAO_OutStream *os) { // Emit the comparison code. - *os << "std::strcmp (" << be_idt << be_idt_nl - << "value," << be_nl - << "\"" << bi->repoID () << "\"" << be_uidt_nl - << ") == 0 ||" << be_uidt_nl; + *os << "std::strcmp (value, \"" << bi->repoID () << "\") == 0 ||" << be_nl; return 0; } @@ -2756,34 +2753,25 @@ be_interface::gen_is_a_ancestors (TAO_OutStream *os) if (this->is_abstract () || this->has_mixed_parentage ()) { - *os << "std::strcmp (" << be_idt << be_idt_nl - << "value," << be_nl - << "\"IDL:omg.org/CORBA/AbstractBase:1.0\"" << be_uidt_nl - << ") == 0"; + *os << "std::strcmp (value, \"IDL:omg.org/CORBA/AbstractBase:1.0\") == 0"; } else if (this->is_local ()) { - *os << "std::strcmp (" << be_idt << be_idt_nl - << "value," << be_nl - << "\"IDL:omg.org/CORBA/LocalObject:1.0\"" << be_uidt_nl - << ") == 0"; + *os << "std::strcmp (value, \"IDL:omg.org/CORBA/LocalObject:1.0\") == 0"; } if (this->has_mixed_parentage () || this->is_local ()) { - *os << " ||" << be_uidt_nl; + *os << " ||" << be_nl; } else if (this->is_abstract ()) { - *os << be_uidt << be_uidt_nl; + *os << be_nl; } if (! this->is_abstract ()) { - *os << "std::strcmp (" << be_idt << be_idt_nl - << "value," << be_nl - << "\"IDL:omg.org/CORBA/Object:1.0\"" << be_uidt_nl - << ") == 0" << be_uidt << be_uidt_nl; + *os << "std::strcmp (value, \"IDL:omg.org/CORBA/Object:1.0\") == 0" << be_nl; } return 0; diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp index 8f681fbc85f..0b2826a3a2a 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp @@ -308,7 +308,7 @@ be_visitor_interface_cs::visit_interface (be_interface *node) -1); } - *os << ")" << be_nl + *os << ")" << be_uidt_nl << "{" << be_idt_nl << "return true; // success using local knowledge" << be_uidt_nl << "}" << be_uidt_nl diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp index 1d778cd0081..9b9f7e6933a 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp @@ -114,8 +114,8 @@ be_visitor_interface_ss::visit_interface (be_interface *node) // Default constructor body. *os << "{" << be_idt_nl - << "this->optable_ = &tao_" << flat_name - << "_optable;" << be_uidt_nl + << "this->optable_ = std::addressof(tao_" << flat_name + << "_optable);" << be_uidt_nl << "}" << be_nl_2; // find if we are at the top scope or inside some module @@ -182,22 +182,15 @@ be_visitor_interface_ss::visit_interface (be_interface *node) -1); } - *os << "!std::strcmp (" << be_idt << be_idt_nl - << "value," << be_nl - << "\"IDL:omg.org/CORBA/Object:1.0\"" << be_uidt_nl - << ")"; + *os << "std::strcmp (value, \"IDL:omg.org/CORBA/Object:1.0\") == 0"; if (node->has_mixed_parentage ()) { - *os << " ||" << be_uidt_nl - << "!std::strcmp (" << be_idt << be_idt_nl - << "value," << be_nl - << "\"IDL:omg.org/CORBA/AbstractBase:1.0\"" - << be_uidt_nl - << ")"; + *os << " ||" << be_nl + << "std::strcmp (value, \"IDL:omg.org/CORBA/AbstractBase:1.0\") == 0"; } - *os << be_uidt << be_uidt_nl + *os << be_uidt_nl << ");" << be_uidt << be_uidt_nl << "}" << be_nl_2; diff --git a/TAO/tests/Portable_Interceptors/Dynamic/server_interceptor.cpp b/TAO/tests/Portable_Interceptors/Dynamic/server_interceptor.cpp index 543c352abf8..20671f6c34b 100644 --- a/TAO/tests/Portable_Interceptors/Dynamic/server_interceptor.cpp +++ b/TAO/tests/Portable_Interceptors/Dynamic/server_interceptor.cpp @@ -130,6 +130,23 @@ Echo_Server_Request_Interceptor::receive_request ( "Echo_Server_Request_Interceptor::receive_request from \"%C\"\n", op.in ())); + CORBA::Boolean targetisa = ri->target_is_a ("FOO"); + if (targetisa) + { + ++this->result_; + ACE_ERROR ((LM_ERROR, + "(%P|%t) ERROR in receive_request while checking " + "target_is_a, it is not a FOO\n")); + } + targetisa = ri->target_is_a ("IDL:Test_Interceptors/Visual:1.0"); + if (!targetisa) + { + ++this->result_; + ACE_ERROR ((LM_ERROR, + "(%P|%t) ERROR in receive_request while checking " + "target_is_a, it should be IDL:Test_Interceptors/Visual:1.0\n")); + } + if (std::strcmp (op.in (), "normal") == 0) { Dynamic::ParameterList_var paramlist = ri->arguments (); @@ -161,6 +178,14 @@ Echo_Server_Request_Interceptor::receive_request ( "Target most derived interface: %C\n", tmdi.in ())); + if (std::strcmp (tmdi.in (), "IDL:Test_Interceptors/Visual:1.0") != 0) + { + ++this->result_; + ACE_ERROR ((LM_ERROR, + "(%P|%t) ERROR in receive_request while checking " + "target_most_derived_interface\n")); + } + catched_exception = false; try { |