diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2005-02-21 07:53:01 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2005-02-21 07:53:01 +0000 |
commit | 2c91482508f1d0b20052eb714b955bbee3b447ed (patch) | |
tree | c8c404f586a7a9f84e1ac06eafc3b43cff7109d5 | |
parent | 001582371ed0533332255b36169a73f9c110d3bf (diff) | |
download | ATCD-2c91482508f1d0b20052eb714b955bbee3b447ed.tar.gz |
*** empty log message ***
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_arg_traits.cpp | 12 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp | 2 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp | 181 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_operation/amh_ss.cpp | 16 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_operation/upcall_command_ss.cpp | 33 | ||||
-rw-r--r-- | TAO/TAO_IDL/be_include/be_visitor_operation/upcall_command_ss.h | 3 |
6 files changed, 218 insertions, 29 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp b/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp index 23c0d64ac76..c0e1546e9b3 100644 --- a/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp +++ b/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp @@ -213,8 +213,16 @@ be_visitor_arg_traits::visit_valuetype (be_valuetype *node) << "Object_" << this->S_ << "Arg_Traits_T<" << be_idt << be_idt_nl << node->name () << " *," << be_nl << node->name () << "_var," << be_nl - << node->name () << "_out," << be_nl - << "TAO::Value_Traits<" << node->name () << ">" << be_uidt_nl + << node->name () << "_out"; + + // The SArgument classes don't need the traits parameter (yet?) + if (ACE_OS::strlen (this->S_) == 0) + { + os << "," << be_nl + << "TAO::Value_Traits<" << node->name () << ">"; + } + + os << be_uidt_nl << ">" << be_uidt << be_uidt << be_uidt << be_uidt_nl << "{" << be_nl << "};"; diff --git a/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp index 23e6290a59b..4aeba00ea8f 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp @@ -154,7 +154,7 @@ void be_visitor_amh_interface_ss::generate_send_reply (TAO_OutStream * os) { *os << be_nl << be_nl - << "_tao_server_request.tao_send_reply ();"; + << "server_request.tao_send_reply ();"; } 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 8e4fa72fa30..51e6d03bd97 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp @@ -171,6 +171,16 @@ be_visitor_interface_ss::visit_interface (be_interface *node) // Generate code for the _is_a skeleton. { + *os << "void " << full_skel_name + << "::_is_a_skel (" << be_idt << be_idt_nl + << "TAO_ServerRequest & server_request, " << be_nl + << "void * servant_upcall," << be_nl + << "void * servant" << be_nl + << "ACE_ENV_ARG_DECL" << be_uidt_nl + << ")" << be_uidt_nl; + *os << "{" << be_idt_nl; + + be_predefined_type rt (AST_PredefinedType::PT_boolean, 0); // @@ Cheat a little by placing a space before the operation name // to prevent the IDL compiler from interpreting the leading @@ -197,12 +207,91 @@ be_visitor_interface_ss::visit_interface (be_interface *node) is_a.be_add_argument (&repository_id); + be_visitor_operation_upcall_command_ss upcall_command_visitor (this->ctx_); + upcall_command_visitor.visit (&is_a, full_skel_name); + + // Generate exception list. + be_visitor_operation_exceptlist_ss exception_list (this->ctx_); + exception_list.visit_operation (&is_a); + be_visitor_operation_ss op_visitor (this->ctx_); - op_visitor.visit_operation (&is_a); + + *os << "TAO::SArg_Traits< "; + + op_visitor.gen_arg_template_param_name (&is_a, + &rt, + os); + + *os << ">::ret_val retval;"; + + op_visitor.gen_skel_body_arglist (&is_a, + os); + + *os << be_nl << be_nl + << "TAO::Argument * const args[] =" << be_idt_nl + << "{" << be_idt_nl + << "&retval," << be_nl + << "&_tao_" << arg_name.get_string () + << be_uidt_nl + << "};" << be_uidt_nl << be_nl; + + *os << "static size_t const nargs = 2;" << be_nl << be_nl; + + // Get the right object implementation. + *os << full_skel_name << " * const impl =" << be_idt_nl + << "static_cast<" << be_idt_nl + << full_skel_name << " *> (servant);" << be_uidt + << be_uidt_nl; + + // Upcall_Command instantiation. + *os << be_nl + << "Upcall_Command command (" << be_idt_nl + << "impl"; + + if (!is_a.void_return_type () + || is_a.argument_count () > 0) + { + // server_request.operation_details () will be non-zero in the + // thru-POA collocation case. Use them if available. + *os << "," << be_nl; + + if (be_global->gen_thru_poa_collocation ()) + *os << "server_request.operation_details ()," << be_nl; + + *os << "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 _non_existent skeleton. { + *os << "void " << full_skel_name + << "::_non_existent_skel (" << be_idt << be_idt_nl + << "TAO_ServerRequest & server_request, " << be_nl + << "void * servant_upcall," << be_nl + << "void * servant" << be_nl + << "ACE_ENV_ARG_DECL" << be_uidt_nl + << ")" << be_uidt_nl; + *os << "{" << be_idt_nl; + + be_predefined_type rt (AST_PredefinedType::PT_boolean, 0); // @@ Cheat a little by placing a space before the operation name // to prevent the IDL compiler from interpreting the leading @@ -216,8 +305,77 @@ be_visitor_interface_ss::visit_interface (be_interface *node) node->is_abstract ()); non_existent.set_defined_in (node); + be_visitor_operation_upcall_command_ss upcall_command_visitor (this->ctx_); + upcall_command_visitor.visit (&non_existent, full_skel_name); + + // Generate exception list. + be_visitor_operation_exceptlist_ss exception_list (this->ctx_); + exception_list.visit_operation (&non_existent); + be_visitor_operation_ss op_visitor (this->ctx_); - op_visitor.visit_operation (&non_existent); + + *os << "TAO::SArg_Traits< "; + + op_visitor.gen_arg_template_param_name (&non_existent, + &rt, + os); + + *os << ">::ret_val retval;"; + + op_visitor.gen_skel_body_arglist (&non_existent, + os); + + *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 << full_skel_name << " * const impl =" << be_idt_nl + << "static_cast<" << be_idt_nl + << full_skel_name << " *> (servant);" << be_uidt + << be_uidt_nl; + + // Upcall_Command instantiation. + *os << be_nl + << "Upcall_Command command (" << be_idt_nl + << "impl"; + + if (!non_existent.void_return_type () + || non_existent.argument_count () > 0) + { + // server_request.operation_details () will be non-zero in the + // thru-POA collocation case. Use them if available. + *os << "," << be_nl; + + if (be_global->gen_thru_poa_collocation ()) + *os << "server_request.operation_details ()," << be_nl; + + *os << "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; + } *os << be_nl << be_nl << "// TAO_IDL - Generated from " << be_nl @@ -247,7 +405,7 @@ be_visitor_interface_ss::visit_interface (be_interface *node) // get_interface.set_defined_in (node); // be_visitor_operation_upcall_command_ss upcall_command_visitor (this->ctx_); -// upcall_command_visitor.visit_operation (&get_interface); +// upcall_command_visitor.visit (&get_interface, full_skel_name); // } *os << be_nl << be_nl @@ -271,9 +429,9 @@ be_visitor_interface_ss::visit_interface (be_interface *node) << "}" << be_uidt_nl << be_nl; // Get the right object implementation. - *os << node->full_skel_name () << " * const impl =" << be_idt_nl + *os << full_skel_name << " * const impl =" << be_idt_nl << "static_cast<" << be_idt_nl - << node->full_skel_name () << " *> (servant);" << be_uidt + << full_skel_name << " *> (servant);" << be_uidt << be_uidt_nl; *os << "CORBA::InterfaceDef_ptr _tao_retval = " << be_idt_nl @@ -301,11 +459,6 @@ be_visitor_interface_ss::visit_interface (be_interface *node) << "}" << be_nl << be_nl; - // @@ 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 @@ -334,7 +487,7 @@ be_visitor_interface_ss::visit_interface (be_interface *node) get_component.set_defined_in (node); be_visitor_operation_upcall_command_ss upcall_command_visitor (this->ctx_); - upcall_command_visitor.visit_operation (&get_component); + upcall_command_visitor.visit (&get_component, full_skel_name); // Generate exception list. be_visitor_operation_exceptlist_ss exception_list (this->ctx_); @@ -344,7 +497,7 @@ be_visitor_interface_ss::visit_interface (be_interface *node) *os << "TAO::SArg_Traits< "; - operation_visitor.gen_arg_template_param_name (node, + operation_visitor.gen_arg_template_param_name (&get_component, &rt, os); @@ -360,9 +513,9 @@ be_visitor_interface_ss::visit_interface (be_interface *node) *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 + *os << full_skel_name << " * const impl =" << be_idt_nl << "static_cast<" << be_idt_nl - << node->full_skel_name () << " *> (servant);" << be_uidt + << full_skel_name << " *> (servant);" << be_uidt << be_uidt_nl; // Upcall_Command instantiation. diff --git a/TAO/TAO_IDL/be/be_visitor_operation/amh_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/amh_ss.cpp index c48a71faded..38ccf0a282b 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/amh_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/amh_ss.cpp @@ -81,8 +81,8 @@ be_visitor_amh_operation_ss::visit_operation (be_operation *node) } *os << be_nl - << "TAO_InputCDR &_tao_in =" - << " _tao_server_request.incoming ();" << be_nl << be_nl + << "TAO_InputCDR & _tao_in =" + << " *_tao_server_request.incoming ();" << be_nl << be_nl << "if (!(" << be_idt << be_idt; // Marshal each in and inout argument. @@ -233,8 +233,8 @@ be_visitor_amh_operation_ss::visit_attribute (be_attribute *node) } *os << be_nl - << "TAO_InputCDR &_tao_in =" - << " _tao_server_request.incoming ();" + << "TAO_InputCDR & _tao_in =" + << " *_tao_server_request.incoming ();" << be_nl << be_nl << "if (!(" << be_idt << be_idt; @@ -330,8 +330,8 @@ be_visitor_amh_operation_ss::generate_shared_prologue (be_decl *node, << skel_prefix << node->local_name () << "_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest &_tao_server_request," << be_nl - << "void *_tao_object_reference, " << be_nl + << "TAO_ServerRequest & _tao_server_request," << be_nl + << "void * _tao_servant, " << be_nl << "void * /* context */ " << be_nl << "ACE_ENV_ARG_DECL" << be_uidt_nl << ")" << be_uidt_nl; @@ -341,10 +341,10 @@ be_visitor_amh_operation_ss::generate_shared_prologue (be_decl *node, *os << "{" << be_idt_nl; // Get the right object implementation. - *os << amh_skel_name.c_str () << " *_tao_impl =" << be_idt_nl + *os << amh_skel_name.c_str () << " * const _tao_impl =" << be_idt_nl << "static_cast<" << be_idt << be_idt_nl << amh_skel_name.c_str () << " *> (" << be_nl - << "_tao_object_reference" << be_uidt_nl + << "_tao_servant" << be_uidt_nl << ");" << be_uidt << be_uidt; return 0; diff --git a/TAO/TAO_IDL/be/be_visitor_operation/upcall_command_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/upcall_command_ss.cpp index 6da8a7450dc..849e40bd9b3 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/upcall_command_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/upcall_command_ss.cpp @@ -38,13 +38,38 @@ be_visitor_operation_upcall_command_ss int be_visitor_operation_upcall_command_ss::visit_operation (be_operation * node) { - TAO_OutStream & os = *this->ctx_->stream (); + be_visitor_context ctx (*this->ctx_); + // save the node. + this->ctx_->node (node); + + be_interface * const intf = this->ctx_->attribute () + ? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ()) + : be_interface::narrow_from_scope (node->defined_in ()); + + if (!intf) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_upcall_command_ss::" + "visit_operation - " + "bad interface scope\n"), + -1); + } + + return this->visit (node, intf->full_skel_name ()); +} + +int +be_visitor_operation_upcall_command_ss::visit (be_operation * node, + char const * full_skel_name) +{ be_visitor_context ctx (*this->ctx_); // save the node. this->ctx_->node (node); + TAO_OutStream & os = *this->ctx_->stream (); + os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; @@ -58,7 +83,7 @@ be_visitor_operation_upcall_command_ss::visit_operation (be_operation * node) { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_upcall_command_ss::" - "visit_operation - " + "visit - " "bad interface scope\n"), -1); } @@ -74,7 +99,7 @@ be_visitor_operation_upcall_command_ss::visit_operation (be_operation * node) // Generate constructor os << "inline Upcall_Command (" << be_idt_nl - << intf->full_skel_name () << " * servant"; + << full_skel_name << " * servant"; // No need to accept an argument array parameter if the operation // has no arguments. @@ -176,7 +201,7 @@ be_visitor_operation_upcall_command_ss::visit_operation (be_operation * node) // Generate class attributes. os << "private:" << be_idt_nl << be_nl - << intf->full_skel_name () << " * const servant_;"; + << full_skel_name << " * const servant_;"; // Don't bother generating an argument array attribute if the // operation has no arguments. diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/upcall_command_ss.h b/TAO/TAO_IDL/be_include/be_visitor_operation/upcall_command_ss.h index b03b8d5a66f..99d87780b72 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/upcall_command_ss.h +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/upcall_command_ss.h @@ -36,6 +36,9 @@ public: /// visit the operation virtual int visit_operation (be_operation * node); + /// Same as visit_operation() but override full_skel_name. + int visit (be_operation * node, char const * full_skel_name); + private: /// Generate the upcall. |