diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2005-02-19 06:17:45 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2005-02-19 06:17:45 +0000 |
commit | 096a58c456d75c2ec2a769674b2cfbaa8bfb7a69 (patch) | |
tree | cef737d236c4e81843bf4cf3ea74154e448d7cb2 | |
parent | 819684a5b45dc091ea0c06fc718aa42642dffd67 (diff) | |
download | ATCD-096a58c456d75c2ec2a769674b2cfbaa8bfb7a69.tar.gz |
*** empty log message ***
5 files changed, 127 insertions, 46 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp b/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp index 9f3d7e49490..1fa46b4e6a7 100644 --- a/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp +++ b/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp @@ -123,7 +123,7 @@ be_visitor_arg_traits::visit_interface (be_interface *node) os->gen_ifdef_macro (node->flat_name (), guard_suffix.c_str ()); *os << be_nl << be_nl - << "ACE_TEMPLATE_SPECIALIZATION" << be_nl + << "template<>" << be_nl << "class " << (stub ? b->stub_export_macro () : b->skel_export_macro ()) << " " << this->S_ << "Arg_Traits<" @@ -205,7 +205,7 @@ be_visitor_arg_traits::visit_valuetype (be_valuetype *node) os->gen_ifdef_macro (node->flat_name (), guard_suffix.c_str ()); *os << be_nl << be_nl - << "ACE_TEMPLATE_SPECIALIZATION" << be_nl + << "template<>" << be_nl << "class " << be_global->stub_export_macro () << " " << this->S_ << "Arg_Traits<" << node->name () << ">" << be_idt_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 e1de06da2a3..fe415e012d2 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp @@ -223,11 +223,33 @@ be_visitor_interface_ss::visit_interface (be_interface *node) *os << be_nl << be_nl << "// TAO_IDL - Generated from " << be_nl << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - // @@ Can't automatically generate _interface skeleton code as - // easily as we do for _is_a and _non_existent above due to the - // IFR_Client_Adapter loading in the implementation. *sigh* + // @@ Can't fully automate generation of _interface() skeleton code + // as easily as we do for _is_a() and _non_existent() above due + // to the non-boilerplate IFR_Client_Adapter loading in the + // implementation. *sigh* // // Generate code for the _interface skeleton. +// { +// Identifier rt_name (ACE_OS::strdup (" CORBA::InterfaceDef")); +// UTL_ScopedName rt_scoped_name (&rt_name, 0); + +// be_type rt (AST_Decl::NT_interface, &rt_scoped_name); +// // @@ Cheat a little by placing a space before the operation name +// // to prevent the IDL compiler from interpreting the leading +// // underscore as an IDL escape. +// Identifier op_name (ACE_OS::strdup (" _get_interface")); +// UTL_ScopedName scoped_name (&op_name, 0); +// be_operation get_interface (&rt, +// AST_Operation::OP_noflags, +// &scoped_name, +// node->is_local (), +// node->is_abstract ()); +// get_interface.set_defined_in (node); + +// be_visitor_operation_upcall_command_ss upcall_command_visitor (this->ctx_); +// upcall_command_visitor.visit_operation (&get_interface); +// } + *os << be_nl << be_nl << "void " << full_skel_name << "::_interface_skel (" << be_idt << be_idt_nl @@ -273,47 +295,107 @@ be_visitor_interface_ss::visit_interface (be_interface *node) *os << be_uidt_nl << "}" << be_nl << be_nl; - // Generate code for the _component skeleton. - *os << "void " << full_skel_name - << "::_component_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest & server_request, " << be_nl - << "void * servant_upcall" << be_nl - << "ACE_ENV_ARG_DECL" << be_uidt_nl - << ")" << be_uidt_nl; - *os << "{" << be_idt_nl; - *os << full_skel_name << " * const impl =" << be_idt_nl - << "static_cast<" << full_skel_name - << " *> (_tao_object_reference);" << be_uidt_nl << be_nl; - - *os << "CORBA::Object_var retval =" << be_idt_nl - << "_tao_impl->_get_component (ACE_ENV_SINGLE_ARG_PARAMETER);" - << be_uidt_nl; - *os << "ACE_CHECK;" << be_nl << be_nl; - - *os << "server_request.init_reply ();" << be_nl; - *os << "TAO_OutputCDR & out = *server_request.outgoing ();" - << be_nl << be_nl; - - *os << "if (!(out << retval.in ()))" << be_idt_nl - << "{" << be_idt_nl; - - if (be_global->use_raw_throw ()) - { - *os << "throw CORBA::MARSHAL ();"; - } - else - { - *os << "ACE_THROW (CORBA::MARSHAL ());"; - } - *os << be_uidt_nl - << "}" << be_uidt; + // @@ Can't fully automate generation of _component() skeleton code + // as easily as we do for _is_a() and _non_existent() above due + // to naming conventions that differ from IDL based methods . + // *sigh* + // + // Generate code for the _component skeleton. + { + *os << "void " << full_skel_name + << "::_component_skel (" << be_idt << be_idt_nl + << "TAO_ServerRequest & server_request, " << be_nl + << "void * servant_upcall" << be_nl + << "ACE_ENV_ARG_DECL" << be_uidt_nl + << ")" << be_uidt_nl; + *os << "{" << be_idt_nl; - this->generate_send_reply (os); - *os << be_uidt_nl - << "}" << be_nl << be_nl; + be_predefined_type rt (AST_PredefinedType::PT_object, 0); + // @@ Cheat a little by placing a space before the operation name + // to prevent the IDL compiler from interpreting the leading + // underscore as an IDL escape. + // Yes, _get_component() + Identifier op_name (ACE_OS::strdup (" _get_component")); + UTL_ScopedName scoped_name (&op_name, 0); + be_operation get_component (&rt, + AST_Operation::OP_noflags, + &scoped_name, + node->is_local (), + node->is_abstract ()); + get_component.set_defined_in (node); + + be_visitor_operation_upcall_command_ss upcall_command_visitor (this->ctx_); + upcall_command_visitor.visit_operation (&get_component); + + // Generate exception list. + be_visitor_operation_exceptlist_ss exception_list (this->ctx_); + exception_list.visit_operation (&get_component); + + be_visitor_operation_ss operation_visitor (this->ctx_); + + *os << "TAO::SArg_Traits< "; + + operation_visitor.gen_arg_template_param_name (node, + &rt, + os); + + *os << ">::ret_val retval;"; + + *os << be_nl << be_nl + << "TAO::Argument * const args[] =" << be_idt_nl + << "{" << be_idt_nl + << "&retval" + << be_uidt_nl + << "};" << be_uidt_nl << be_nl; + + *os << "static size_t const nargs = 1;" << be_nl << be_nl; + + // Get the right object implementation. + *os << node->full_skel_name () << " * const impl =" << be_idt_nl + << "static_cast<" << be_idt_nl + << node->full_skel_name () << " *> (" << be_idt_nl + << "static_cast<TAO_Object_Adapter::Servant_Upcall *> (" << be_idt_nl + << "servant_upcall)->servant ()" << be_uidt_nl + << ");" << be_uidt << be_uidt << be_uidt_nl << be_nl; + + // Upcall_Command instantiation. + *os << be_nl + << "Upcall_Command command (" << be_idt_nl + << "impl"; + + if (!get_component.void_return_type () + || get_component.argument_count () > 0) + { + // server_request.operations_details () will be non-zero in the + // thru-POA collocation case. Use them if available. + *os << "," << be_nl + << "server_request.operations_details ()" << be_nl + << "? server_request.operations_details ()->args ()" << be_nl + << ": args"; + } + + *os << ");" << be_uidt_nl << be_nl; + + + *os << "TAO::Upcall_Wrapper upcall_wrapper;" << be_nl + << "upcall_wrapper.upcall (server_request" << be_nl + << " , args" << be_nl + << " , nargs" << be_nl + << " , command" << be_nl + << "\n#if TAO_HAS_INTERCEPTORS == 1" << be_nl + << " , servant_upcall" << be_nl + << " , exceptions" << be_nl + << " , nexceptions" + << "\n#endif /* TAO_HAS_INTERCEPTORS == 1 */" << be_nl << be_nl + << " ACE_ENV_ARG_PARAMETER);" << be_nl + << "ACE_CHECK;" << be_nl; + + *os << be_uidt_nl + << "}" << be_nl << be_nl; + } // Generate code for the _is_a override. *os << "CORBA::Boolean " << full_skel_name diff --git a/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_ss.cpp index ad63a0d912a..ae3a5c74ed2 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_ss.cpp @@ -107,7 +107,7 @@ be_visitor_interface_strategized_proxy_broker_ss::visit_interface ( << " op_len);" << be_nl << be_nl << "if (status == -1)" << be_idt_nl << "{" << be_idt_nl - << "ACE_THROW (CORBA::BAD_OPERATION (TAO::VMCID | 2, " + << "ACE_THROW (CORBA::BAD_OPERATION (CORBA::OMGVMCID | 2, " << "CORBA::COMPLETED_NO));" << be_uidt_nl << "}" << be_uidt_nl << be_nl << "TAO_Abstract_ServantBase * const servant =" diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp index 684333dae9e..e0a6963d53b 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp @@ -215,7 +215,7 @@ be_visitor_operation_ss::gen_skel_operation_body (be_operation * node, return_type, os); - *os << ">::ret_val _tao_retval;"; + *os << ">::ret_val retval;"; // Declare the argument helper classes. this->gen_skel_body_arglist (node, os); diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/operation.h b/TAO/TAO_IDL/be_include/be_visitor_operation/operation.h index 3f89b9477be..6142a9c9ab9 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/operation.h +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/operation.h @@ -1,6 +1,6 @@ +// -*- C++ -*- // // $Id$ -// // ============================================================================ // @@ -100,7 +100,6 @@ public: // helper that generates code for raising an exception within // interceptor's try block -protected: void gen_stub_body_arglist (be_operation *node, TAO_OutStream *os, idl_bool ami = I_FALSE); |