diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2005-02-22 10:09:24 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2005-02-22 10:09:24 +0000 |
commit | 3cc357789f4d46c6cc3f78610c9ba4fe36aa4e0d (patch) | |
tree | 7ef3ccaa88be55250076d461f3e7435a6b8b9b2a | |
parent | a83f2d9caf6a2ef09e08b203762e3e7785d9e86f (diff) | |
download | ATCD-3cc357789f4d46c6cc3f78610c9ba4fe36aa4e0d.tar.gz |
ChangeLogTag:Tue Feb 22 02:03:20 2005 Ossama Othman <ossama@dre.vanderbilt.edu>
162 files changed, 5072 insertions, 8885 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 0315cac9957..882a44bb156 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,5 +1,9 @@ Tue Feb 22 02:03:20 2005 Ossama Othman <ossama@dre.vanderbilt.edu> + The following changes were made in the course of refactoring the + skeleton code generated by the TAO IDL compiler into the + PortableServer library. [Bug 1369] + * tao/Abstract_Servant_Base.h (_downcast): Removed this method. The C++ mapping does not require a diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp index fe6cb594ccd..980cadc0b93 100644 --- a/TAO/TAO_IDL/be/be_codegen.cpp +++ b/TAO/TAO_IDL/be/be_codegen.cpp @@ -406,6 +406,11 @@ TAO_CodeGen::start_server_header (const char *fname) << "\"\n"; } + // The server header should include the client header. + *this->server_header_ << "\n#include \"" + << be_global->be_get_client_hdr_fname (1) + << "\""; + // We must include all the skeleton headers corresponding to // IDL files included by the current IDL file. // We will use the included IDL file names as they appeared @@ -427,11 +432,6 @@ TAO_CodeGen::start_server_header (const char *fname) server_hdr); } - // The server header should include the client header. - *this->server_header_ << "\n#include \"" - << be_global->be_get_client_hdr_fname (1) - << "\""; - // Some compilers don't optimize the #ifndef header include // protection, but do optimize based on #pragma once. *this->server_header_ << "\n\n#if !defined (ACE_LACKS_PRAGMA_ONCE)\n" @@ -1569,7 +1569,7 @@ TAO_CodeGen::gen_stub_src_includes (void) this->gen_any_file_includes (); // Includes whatever arg helper template classes that may be needed. - this->gen_arg_file_includes (this->client_stubs_); + this->gen_stub_arg_file_includes (this->client_stubs_); // strcmp() is used with interfaces and exceptions. if (idl_global->interface_seen_ @@ -1601,12 +1601,17 @@ TAO_CodeGen::gen_skel_src_includes (void) } this->gen_standard_include (this->server_skeletons_, - "tao/PortableServer/Servant_Upcall.h"); - this->gen_standard_include (this->server_skeletons_, "tao/PortableServer/ForwardRequestC.h"); this->gen_standard_include (this->server_skeletons_, "tao/PortableServer/Operation_Table.h"); this->gen_standard_include (this->server_skeletons_, + "tao/PortableServer/Upcall_Command.h"); + this->gen_standard_include (this->server_skeletons_, + "tao/PortableServer/Upcall_Wrapper.h"); + + this->gen_skel_arg_file_includes (this->server_skeletons_); + + this->gen_standard_include (this->server_skeletons_, "tao/TAO_Server_Request.h"); this->gen_standard_include (this->server_skeletons_, "tao/ORB_Core.h"); @@ -1624,17 +1629,19 @@ TAO_CodeGen::gen_skel_src_includes (void) "tao/DynamicC.h"); this->gen_standard_include (this->server_skeletons_, "tao/CDR.h"); + this->gen_standard_include (this->server_skeletons_, + "tao/operation_details.h"); + this->gen_standard_include (this->server_skeletons_, + "tao/PortableInterceptor.h"); if (be_global->gen_thru_poa_collocation () || be_global->gen_direct_collocation ()) { - this->gen_arg_file_includes (this->server_skeletons_); + // Collocation skeleton code doesn't use "SArg" variants. + this->gen_stub_arg_file_includes (this->server_skeletons_); } // The following header must always be included. - this->gen_standard_include (this->server_skeletons_, - "tao/PortableInterceptor.h"); - if (be_global->gen_amh_classes ()) { this->gen_standard_include (this->server_skeletons_, @@ -1645,18 +1652,6 @@ TAO_CodeGen::gen_skel_src_includes (void) "ace/Auto_Functor.h"); } - // Include Portable Interceptor related headers. - *this->server_skeletons_ << "\n#if TAO_HAS_INTERCEPTORS == 1"; - this->gen_standard_include (this->server_skeletons_, - "tao/PortableServer/PICurrent_Guard.h"); - this->gen_standard_include (this->server_skeletons_, - "tao/PortableServer/ServerRequestInfo.h"); - this->gen_standard_include (this->server_skeletons_, - "tao/PortableServer/ServerInterceptorAdapter.h"); - this->gen_standard_include (this->server_skeletons_, - "tao/RequestInfo_Util.h"); - *this->server_skeletons_ << "\n#endif /* TAO_HAS_INTERCEPTORS == 1 */\n"; - this->gen_standard_include (this->server_skeletons_, "ace/Dynamic_Service.h"); @@ -1773,7 +1768,7 @@ TAO_CodeGen::gen_var_file_includes (void) } void -TAO_CodeGen::gen_arg_file_includes (TAO_OutStream *stream) +TAO_CodeGen::gen_stub_arg_file_includes (TAO_OutStream * stream) { this->gen_cond_file_include ( idl_global->basic_arg_seen_, @@ -1836,6 +1831,104 @@ TAO_CodeGen::gen_arg_file_includes (TAO_OutStream *stream) ); } + +void +TAO_CodeGen::gen_skel_arg_file_includes (TAO_OutStream * stream) +{ + this->gen_cond_file_include ( + idl_global->basic_arg_seen_, + "tao/PortableServer/Basic_SArguments.h", + stream + ); + + this->gen_cond_file_include ( + idl_global->bd_string_arg_seen_, + "tao/PortableServer/BD_String_SArgument_T.h", + stream + ); + + this->gen_cond_file_include ( + idl_global->fixed_array_arg_seen_, + "tao/PortableServer/Fixed_Array_SArgument_T.h", + stream + ); + + this->gen_cond_file_include ( + idl_global->fixed_size_arg_seen_, + "tao/PortableServer/Fixed_Size_SArgument_T.h", + stream + ); + + // Always needed for CORBA::Object handling in _component() skeleton + // code when an unconstrained (non-local) IDL interface is defined. + this->gen_cond_file_include ( + idl_global->non_local_iface_seen_ + || idl_global->object_arg_seen_, + "tao/PortableServer/Object_SArgument_T.h", + stream + ); + + // Always needed for CORBA::Boolean handling in _is_a() skeleton + // code when an unconstrained (non-local) IDL interface is defined. + this->gen_cond_file_include ( + idl_global->non_local_iface_seen_ + || idl_global->special_basic_arg_seen_, + "tao/PortableServer/Special_Basic_SArguments.h", + stream + ); + + // Always needed for string argument handling in _is_a() skeleton + // code when an unconstrained (non-local) IDL interface is defined. + this->gen_cond_file_include ( + idl_global->non_local_iface_seen_ + || idl_global->ub_string_arg_seen_, + "tao/PortableServer/UB_String_SArguments.h", + stream + ); + + this->gen_cond_file_include ( + idl_global->var_array_arg_seen_, + "tao/PortableServer/Var_Array_SArgument_T.h", + stream + ); + + this->gen_cond_file_include ( + idl_global->var_size_arg_seen_, + "tao/PortableServer/Var_Size_SArgument_T.h", + stream + ); + + this->gen_cond_file_include ( + idl_global->any_arg_seen_, + "tao/PortableServer/Any_SArg_Traits.h", + stream + ); + + this->gen_standard_include (stream, + "tao/PortableServer/TypeCode_SArg_Traits.h"); + this->gen_standard_include (stream, + "tao/PortableServer/Object_SArg_Traits.h"); + + if (be_global->gen_thru_poa_collocation ()) + { + // We need the stub side argument templates when thru-POA + // collocation is enabled for type resolution. + // this->gen_stub_arg_file_includes (stream); + + // Always needed for CORBA::Boolean handling in _is_a() skeleton + // code when an unconstrained (non-local) IDL interface is defined. + this->gen_cond_file_include (idl_global->non_local_iface_seen_, + "tao/Special_Basic_Arguments.h", + stream); + + // Always needed for string argument handling in _is_a() skeleton + // code when an unconstrained (non-local) IDL interface is defined. + this->gen_cond_file_include (idl_global->non_local_iface_seen_, + "tao/UB_String_Arguments.h", + stream); + } +} + void TAO_CodeGen::gen_cond_file_include (bool condition_green, const char *filepath, diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp index 06df1f23a52..d50120c0d47 100644 --- a/TAO/TAO_IDL/be/be_interface.cpp +++ b/TAO/TAO_IDL/be/be_interface.cpp @@ -788,22 +788,22 @@ be_interface::gen_operation_table (const char *flat_name, // Generate the skeleton for the is_a method. *os << "{\"_is_a\", &" << skeleton_class_name - << "::_is_a_skel, 0, 0}," << be_nl; + << "::_is_a_skel, 0}," << be_nl; this->skel_count_++; *os << "{\"_non_existent\", &" << skeleton_class_name - << "::_non_existent_skel, 0, 0}," << be_nl; + << "::_non_existent_skel, 0}," << be_nl; this->skel_count_++; *os << "{\"_component\", &" << skeleton_class_name - << "::_component_skel, 0, 0}," << be_nl; + << "::_component_skel, 0}," << be_nl; this->skel_count_++; *os << "{\"_interface\", &" << skeleton_class_name - << "::_interface_skel, 0, 0}" << be_uidt_nl; + << "::_interface_skel, 0}" << be_uidt_nl; this->skel_count_++; @@ -941,24 +941,24 @@ be_interface::gen_operation_table (const char *flat_name, *os << "_is_a,&" << skeleton_class_name - << "::_is_a_skel, 0, 0" << be_nl; + << "::_is_a_skel, 0" << be_nl; this->skel_count_++; *os << "_non_existent,&" << skeleton_class_name - << "::_non_existent_skel, 0, 0" << be_nl; + << "::_non_existent_skel, 0" << be_nl; this->skel_count_++; *os << "_component,&" << skeleton_class_name - << "::_component_skel, 0, 0" << be_nl; + << "::_component_skel, 0" << be_nl; this->skel_count_++; *os << "_interface,&" << skeleton_class_name - << "::_interface_skel, 0, 0" << be_nl; + << "::_interface_skel, 0" << be_nl; this->skel_count_++; @@ -1017,10 +1017,9 @@ be_interface::convert_parent_ops (be_visitor *visitor) void be_interface::gen_gperf_input_header (TAO_OutStream *os) { - *os << "class TAO_operation_db_entry {\n" - << "public:\n" - << "\tchar *opname_;" << "\n" - << "\tTAO_Skeleton skel_ptr_;" << "\n" + *os << "struct TAO_operation_db_entry {\n" + << "\tchar * opname;" << "\n" + << "\tTAO_Skeleton skel_ptr;" << "\n" << "};" << "\n" << "%%" << "\n"; @@ -1055,18 +1054,18 @@ be_interface::gen_optable_entries (be_interface *derived_interface, << full_skeleton_name << "::" << d->local_name () << "_skel,"; - if (be_global->gen_thru_poa_collocation ()) - { - *os << " &" - << derived_interface->full_thru_poa_proxy_impl_name () - << "::" << d->local_name (); - } - else - { - *os << " 0"; - } +// if (be_global->gen_thru_poa_collocation ()) +// { +// *os << " &" +// << derived_interface->full_thru_poa_proxy_impl_name () +// << "::" << d->local_name (); +// } +// else +// { +// *os << " 0"; +// } - *os << ","; +// *os << ","; if (be_global->gen_direct_collocation ()) { @@ -1097,18 +1096,18 @@ be_interface::gen_optable_entries (be_interface *derived_interface, << "\", &" << full_skeleton_name << "::_get_" << d->local_name () << "_skel,"; - if (be_global->gen_thru_poa_collocation ()) - { - *os << " &" - << derived_interface->full_thru_poa_proxy_impl_name () - << "::_get_" << d->local_name (); - } - else - { - *os << " 0"; - } +// if (be_global->gen_thru_poa_collocation ()) +// { +// *os << " &" +// << derived_interface->full_thru_poa_proxy_impl_name () +// << "::_get_" << d->local_name (); +// } +// else +// { +// *os << " 0"; +// } - *os << ","; +// *os << ","; if (be_global->gen_direct_collocation ()) { @@ -1132,18 +1131,18 @@ be_interface::gen_optable_entries (be_interface *derived_interface, << "\", &" << full_skeleton_name << "::_set_" << d->local_name () << "_skel,"; - if (be_global->gen_thru_poa_collocation ()) - { - *os << " &" - << derived_interface->full_thru_poa_proxy_impl_name () - << "::_set_" << d->local_name (); - } - else - { - *os << " 0"; - } +// if (be_global->gen_thru_poa_collocation ()) +// { +// *os << " &" +// << derived_interface->full_thru_poa_proxy_impl_name () +// << "::_set_" << d->local_name (); +// } +// else +// { +// *os << " 0"; +// } - *os << ","; +// *os << ","; if (be_global->gen_direct_collocation ()) { @@ -1190,18 +1189,18 @@ be_interface::gen_optable_entries (be_interface *derived_interface, << full_skeleton_name << "::" << d->local_name () << "_skel,"; - if (be_global->gen_thru_poa_collocation ()) - { - *os << " &" - << derived_interface->full_thru_poa_proxy_impl_name (); - *os << "::" << d->local_name (); - } - else - { - *os << " 0"; - } +// if (be_global->gen_thru_poa_collocation ()) +// { +// *os << " &" +// << derived_interface->full_thru_poa_proxy_impl_name (); +// *os << "::" << d->local_name (); +// } +// else +// { +// *os << " 0"; +// } - *os << ","; +// *os << ","; if (be_global->gen_direct_collocation ()) { @@ -1233,18 +1232,18 @@ be_interface::gen_optable_entries (be_interface *derived_interface, << full_skeleton_name << "::_get_" << d->local_name () << "_skel,"; - if (be_global->gen_thru_poa_collocation ()) - { - *os << " &" - << derived_interface->full_thru_poa_proxy_impl_name () - << "::_get_" << d->local_name (); - } - else - { - *os << " 0"; - } +// if (be_global->gen_thru_poa_collocation ()) +// { +// *os << " &" +// << derived_interface->full_thru_poa_proxy_impl_name () +// << "::_get_" << d->local_name (); +// } +// else +// { +// *os << " 0"; +// } - *os << ","; +// *os << ","; if (be_global->gen_direct_collocation ()) { @@ -1268,18 +1267,18 @@ be_interface::gen_optable_entries (be_interface *derived_interface, << full_skeleton_name << "::_set_" << d->local_name () << "_skel,"; - if (be_global->gen_thru_poa_collocation ()) - { - *os << " &" - << derived_interface->full_thru_poa_proxy_impl_name () - << "::_set_" << d->local_name (); - } - else - { - *os << " 0"; - } +// if (be_global->gen_thru_poa_collocation ()) +// { +// *os << " &" +// << derived_interface->full_thru_poa_proxy_impl_name () +// << "::_set_" << d->local_name (); +// } +// else +// { +// *os << " 0"; +// } - *os << ","; +// *os << ","; if (be_global->gen_direct_collocation ()) { @@ -1358,23 +1357,23 @@ be_interface::analyze_parentage (void) { return; } - + this->has_mixed_parentage_ = 0; for (long i = 0; i < this->pd_n_inherits; ++i) { be_interface *parent = be_interface::narrow_from_decl (this->pd_inherits[i]); - + if (parent->is_abstract () || parent->has_mixed_parentage ()) { this->has_mixed_parentage_ = 1; break; } } - + AST_Decl::NodeType nt = this->node_type (); - idl_bool can_be_mixed = nt == AST_Decl::NT_interface + idl_bool can_be_mixed = nt == AST_Decl::NT_interface || nt == AST_Decl::NT_component || nt == AST_Decl::NT_home; @@ -1741,11 +1740,11 @@ be_interface::gen_gperf_lookup_methods (const char *flat_name) " " "-D -E -T -f 0" " " - "-F 0,0,0" + "-F 0,0" " " "-a -o -t -p -K" " " - "opname_ -L C++" + "opname -L C++" " " "-Z TAO_%s_Perfect_Hash_OpTable" " " @@ -1768,7 +1767,7 @@ be_interface::gen_gperf_lookup_methods (const char *flat_name) " " "-a -o -t -p -K" " " - "opname_ -L C++" + "opname -L C++" " " "-Z TAO_%s_Binary_Search_OpTable" " " @@ -1777,7 +1776,7 @@ be_interface::gen_gperf_lookup_methods (const char *flat_name) flat_name); break; - // Linear search methods from GPERF. Everything and the -z flag. + // Linear search methods from GPERF. Everything and the -Z flag. case BE_GlobalData::TAO_LINEAR_SEARCH: process_options.command_line ("%s" " " @@ -1787,11 +1786,11 @@ be_interface::gen_gperf_lookup_methods (const char *flat_name) " " "-D -E -T -f 0" " " - "-F 0,0,0" + "-F 0,0" " " "-a -o -t -p -K" " " - "opname_ -L C++" + "opname -L C++" " " "-Z TAO_%s_Linear_Search_OpTable" " " @@ -1897,28 +1896,6 @@ be_interface::is_a_helper (be_interface * /*derived*/, } int -be_interface::downcast_helper (be_interface * /* derived */, - be_interface *base, - TAO_OutStream *os) -{ - // Abstract interfaces have no code generated on the skeleton side. - if (base->is_abstract ()) - { - return 0; - } - - *os << "if (ACE_OS::strcmp (logical_type_id," << be_nl - << " \"" - << base->repoID () << "\") == 0)" << be_idt_nl - << "{" << be_idt_nl - << "return static_cast<" - << base->full_skel_name () << "_ptr> (this);" << be_uidt_nl - << "}" << be_uidt_nl << be_nl; - - return 0; -} - -int be_interface::gen_skel_helper (be_interface *derived, be_interface *ancestor, TAO_OutStream *os) @@ -2247,16 +2224,16 @@ be_interface::gen_colloc_op_defn_helper (be_interface *derived, { op = be_operation::narrow_from_decl (d); - if (be_global->gen_thru_poa_collocation ()) - { - be_interface::gen_collocated_skel_body (derived, - ancestor, - d, - "", - I_FALSE, - op->exceptions (), - os); - } +// if (be_global->gen_thru_poa_collocation ()) +// { +// be_interface::gen_collocated_skel_body (derived, +// ancestor, +// d, +// "", +// I_FALSE, +// op->exceptions (), +// os); +// } if (be_global->gen_direct_collocation ()) { @@ -2278,18 +2255,18 @@ be_interface::gen_colloc_op_defn_helper (be_interface *derived, return -1; } - if (be_global->gen_thru_poa_collocation ()) - { - be_interface::gen_collocated_skel_body ( - derived, - ancestor, - d, - "_get_", - I_FALSE, - attr->get_get_exceptions (), - os - ); - } +// if (be_global->gen_thru_poa_collocation ()) +// { +// be_interface::gen_collocated_skel_body ( +// derived, +// ancestor, +// d, +// "_get_", +// I_FALSE, +// attr->get_get_exceptions (), +// os +// ); +// } if (be_global->gen_direct_collocation ()) { @@ -2306,18 +2283,18 @@ be_interface::gen_colloc_op_defn_helper (be_interface *derived, if (!attr->readonly ()) { - if (be_global->gen_thru_poa_collocation ()) - { - be_interface::gen_collocated_skel_body ( - derived, - ancestor, - d, - "_set_", - I_FALSE, - attr->get_set_exceptions (), - os - ); - } +// if (be_global->gen_thru_poa_collocation ()) +// { +// be_interface::gen_collocated_skel_body ( +// derived, +// ancestor, +// d, +// "_set_", +// I_FALSE, +// attr->get_set_exceptions (), +// os +// ); +// } if (be_global->gen_direct_collocation ()) { diff --git a/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp b/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp index f05e3843777..c0e1546e9b3 100644 --- a/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp +++ b/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp @@ -41,6 +41,9 @@ #include "utl_identifier.h" #include "idl_defines.h" +#include <string> + + ACE_RCSID (be, be_visitor_arg_traits, "$Id$") @@ -112,12 +115,15 @@ be_visitor_arg_traits::visit_interface (be_interface *node) idl_bool stub = (this->ctx_->state () == TAO_CodeGen::TAO_ROOT_CS); BE_GlobalData *b = be_global; - // This should be generated even for imported nodes. The ifdef guard prevents - // multiple declarations. - os->gen_ifdef_macro (node->flat_name (), "arg_traits"); + std::string guard_suffix = + std::string (this->S_) + std::string ("arg_traits"); + + // This should be generated even for imported nodes. The ifdef + // guard prevents multiple declarations. + 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<" @@ -126,8 +132,15 @@ be_visitor_arg_traits::visit_interface (be_interface *node) << "Object_" << this->S_ << "Arg_Traits_T<" << be_idt << be_idt_nl << node->name () << "_ptr," << be_nl << node->name () << "_var," << be_nl - << node->name () << "_out," << be_nl - << "TAO::Objref_Traits<" << node->name () << ">" << be_uidt_nl + << node->name () << "_out"; + + if (ACE_OS::strlen (this->S_) == 0) + { + *os << "," << be_nl + << "TAO::Objref_Traits<" << node->name () << ">"; + } + + *os << be_uidt_nl << ">" << be_uidt << be_uidt << be_uidt << be_uidt_nl << "{" << be_nl << "};"; @@ -182,28 +195,39 @@ be_visitor_arg_traits::visit_valuetype (be_valuetype *node) if (node->seen_in_operation ()) { - TAO_OutStream *os = this->ctx_->stream (); + TAO_OutStream & os = *this->ctx_->stream (); - // This should be generated even for imported nodes. The ifdef guard prevents - // multiple declarations. - os->gen_ifdef_macro (node->flat_name (), "arg_traits"); + std::string guard_suffix = + std::string (this->S_) + std::string ("arg_traits"); - *os << be_nl << be_nl - << "ACE_TEMPLATE_SPECIALIZATION" << be_nl - << "class " << be_global->stub_export_macro () << " " - << this->S_ << "Arg_Traits<" - << node->name () << ">" << be_idt_nl - << ": public" << be_idt << be_idt_nl - << "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 - << ">" << be_uidt << be_uidt << be_uidt << be_uidt_nl - << "{" << be_nl - << "};"; + // This should be generated even for imported nodes. The ifdef + // guard prevents multiple declarations. + os.gen_ifdef_macro (node->flat_name (), guard_suffix.c_str ()); - os->gen_endif (); + os << be_nl << be_nl + << "template<>" << be_nl + << "class " << be_global->stub_export_macro () << " " + << this->S_ << "Arg_Traits<" + << node->name () << ">" << be_idt_nl + << ": public" << be_idt << be_idt_nl + << "Object_" << this->S_ << "Arg_Traits_T<" << be_idt << be_idt_nl + << node->name () << " *," << be_nl + << node->name () << "_var," << be_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 + << "};"; + + os.gen_endif (); } if (this->visit_scope (node) != 0) @@ -264,10 +288,10 @@ be_visitor_arg_traits::visit_operation (be_operation *node) { return 0; } - + AST_Type *rt = node->return_type (); AST_Decl::NodeType nt = rt->node_type (); - + // If our return type is an unaliased bounded (w)string, we create // an empty struct using the operation's flat name for the type, // and use this type as the Arg_Traits<> template parameter. All @@ -279,16 +303,28 @@ be_visitor_arg_traits::visit_operation (be_operation *node) { AST_String *str = AST_String::narrow_from_decl (rt); unsigned long bound = str->max_size ()->ev ()->u.ulval; - + if (bound > 0) { TAO_OutStream *os = this->ctx_->stream (); idl_bool wide = (str->width () != 1); - *os << be_nl << be_nl - << "struct " << node->flat_name () << " {};" - << be_nl << be_nl - << "ACE_TEMPLATE_SPECIALIZATION" << be_nl + *os << be_nl << be_nl; + + idl_bool const skel = + (this->ctx_->state () == TAO_CodeGen::TAO_ROOT_SS); + + // Avoid generating a duplicate structure in the skeleton + // when generating Arg_Traits<> for ThruPOA and direct + // collocation code. + if (!skel + || (skel && ACE_OS::strlen (this->S_) != 0)) + { + *os << "struct " << node->flat_name () << " {};" + << be_nl << be_nl; + } + + *os << "template<>" << be_nl << "class " << be_global->stub_export_macro () << " " << this->S_ << "Arg_Traits<" << node->flat_name () << ">" << be_idt_nl @@ -324,19 +360,19 @@ be_visitor_arg_traits::visit_attribute (be_attribute *node) } AST_String *st = AST_String::narrow_from_decl (node->field_type ()); - + if (st == 0) { return 0; } - + unsigned long bound = st->max_size ()->ev ()->u.ulval; - + if (bound == 0) { return 0; } - + TAO_OutStream *os = this->ctx_->stream (); idl_bool wide = (st->width () != 1); @@ -349,7 +385,7 @@ be_visitor_arg_traits::visit_attribute (be_attribute *node) *os << be_nl << be_nl << "struct " << node->flat_name () << " {};" << be_nl << be_nl - << "ACE_TEMPLATE_SPECIALIZATION" << be_nl + << "template<>" << be_nl << "class " << be_global->stub_export_macro () << " " << this->S_ << "Arg_Traits<" << node->flat_name () << ">" << be_idt_nl @@ -359,7 +395,7 @@ be_visitor_arg_traits::visit_attribute (be_attribute *node) << be_uidt << be_uidt << be_uidt_nl << "{" << be_nl << "};"; - + this->generated (node, I_TRUE); return 0; } @@ -374,23 +410,23 @@ be_visitor_arg_traits::visit_argument (be_argument *node) AST_Type *bt = node->field_type (); AST_Decl::NodeType nt = bt->node_type (); - + // We are interested here only in unaliased, bounded // (w)strings. - + if (nt != AST_Decl::NT_string && nt != AST_Decl::NT_wstring) { return 0; } - + be_string *st = be_string::narrow_from_decl (bt); unsigned long bound = st->max_size ()->ev ()->u.ulval; - + if (bound == 0) { return 0; } - + TAO_OutStream *os = this->ctx_->stream (); idl_bool wide = (st->width () != 1); @@ -400,10 +436,21 @@ be_visitor_arg_traits::visit_argument (be_argument *node) // the same operation, so we use the argument's flat name to // declare an empty struct, and use that struct as the template // parameter for Arg_Traits<>. - *os << be_nl << be_nl - << "struct " << node->flat_name () << " {};" - << be_nl << be_nl - << "ACE_TEMPLATE_SPECIALIZATION" << be_nl + *os << be_nl << be_nl; + + idl_bool const skel = + (this->ctx_->state () == TAO_CodeGen::TAO_ROOT_SS); + + // Avoid generating a duplicate structure in the skeleton when + // generating Arg_Traits<> for ThruPOA and direct collocation code. + if (!skel + || (skel && ACE_OS::strlen (this->S_) != 0)) + { + *os << "struct " << node->flat_name () << " {};" + << be_nl << be_nl; + } + + *os << "template<>" << be_nl << "class " << be_global->stub_export_macro () << " " << this->S_ << "Arg_Traits<" << node->flat_name () << ">" << be_idt_nl @@ -413,7 +460,7 @@ be_visitor_arg_traits::visit_argument (be_argument *node) << be_uidt << be_uidt << be_uidt_nl << "{" << be_nl << "};"; - + this->generated (node, I_TRUE); return 0; } @@ -432,12 +479,15 @@ be_visitor_arg_traits::visit_sequence (be_sequence *node) *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl << "// " << __FILE__ << ":" << __LINE__; - // This will include the bound if there is one, and should also - // prevent duplication, even if there have been further typdefs. - os->gen_ifdef_macro (alias->flat_name (), "arg_traits"); + std::string guard_suffix = + std::string (this->S_) + std::string ("arg_traits"); + + // This should be generated even for imported nodes. The ifdef + // guard prevents multiple declarations. + os->gen_ifdef_macro (alias->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<" << alias->name () << ">" << be_idt_nl @@ -466,7 +516,7 @@ be_visitor_arg_traits::visit_string (be_string *node) unsigned long bound = node->max_size ()->ev ()->u.ulval; be_type *alias = this->ctx_->alias (); - + // Unbounded (w)string args are handled as a predefined type. // Bounded (w)strings must come in as a typedef - they can't // be used directly as arguments or return types. @@ -479,38 +529,53 @@ be_visitor_arg_traits::visit_string (be_string *node) TAO_OutStream *os = this->ctx_->stream (); - os->gen_ifdef_macro (node->flat_name (), "arg_traits"); + std::string guard_suffix = + std::string (this->S_) + std::string ("arg_traits"); - // A workaround 'dummy' type, since bounded (w)strings are all - // generated as typedefs of (w)char *. - *os << be_nl << be_nl - << "struct "; - - if (alias == 0) + // This should be generated even for imported nodes. The ifdef + // guard prevents multiple declarations. + os->gen_ifdef_macro (node->flat_name (), guard_suffix.c_str ()); + + + idl_bool const skel = + (this->ctx_->state () == TAO_CodeGen::TAO_ROOT_SS); + + // Avoid generating a duplicate structure in the skeleton when + // generating Arg_Traits<> for ThruPOA and direct collocation code. + if (!skel + || (skel && ACE_OS::strlen (this->S_) != 0)) { - *os << node->flat_name (); - } - else - { - *os << alias->local_name () << "_" << bound; + // A workaround 'dummy' type, since bounded (w)strings are all + // generated as typedefs of (w)char *. + *os << be_nl << be_nl + << "struct "; + + if (alias == 0) + { + *os << node->flat_name (); + } + else + { + *os << alias->local_name () << "_" << bound; + } + + *os << " {};"; } - - *os << " {};"; - + *os << be_nl << be_nl - << "ACE_TEMPLATE_SPECIALIZATION" << be_nl + << "template<>" << be_nl << "class " << be_global->stub_export_macro () << " " << this->S_ << "Arg_Traits<"; - + if (alias == 0) { *os << node->flat_name (); } else - { + { *os << alias->local_name () << "_" << bound; } - + *os << ">" << be_idt_nl << ": public" << be_idt << be_idt_nl << "BD_" << (wide ? "W" : "") @@ -542,18 +607,19 @@ be_visitor_arg_traits::visit_array (be_array *node) // Generate the array traits specialization definitions, // guarded by #ifdef on unaliased array element type and length. - ACE_CString unique; + ACE_CString unique (this->S_); + unique += ACE_CString ("_"); be_type *bt = be_type::narrow_from_decl (node->base_type ()); AST_Decl::NodeType nt = bt->node_type (); if (nt == AST_Decl::NT_typedef) { be_typedef *td = be_typedef::narrow_from_decl (bt); - unique = td->primitive_base_type ()->flat_name (); + unique += td->primitive_base_type ()->flat_name (); } else { - unique = bt->flat_name (); + unique += bt->flat_name (); } char buf[NAMEBUFSIZE]; @@ -573,7 +639,7 @@ be_visitor_arg_traits::visit_array (be_array *node) os->gen_ifdef_macro (unique.fast_rep ()); *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 @@ -591,14 +657,14 @@ be_visitor_arg_traits::visit_array (be_array *node) } *os << node->name () << "_forany"; - + // The SArgument classes don't need the TAG parameter, if (ACE_OS::strlen (this->S_) == 0) { *os << "," << be_nl << node->name () << "_tag"; } - + *os << be_uidt_nl << ">" << be_uidt << be_uidt << be_uidt << be_uidt_nl << "{" << be_nl @@ -623,12 +689,15 @@ be_visitor_arg_traits::visit_enum (be_enum *node) *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl << "// " << __FILE__ << ":" << __LINE__; - // This should be generated even for imported nodes. The ifdef guard prevents - // multiple declarations. - os->gen_ifdef_macro (node->flat_name (), "arg_traits"); + std::string guard_suffix = + std::string (this->S_) + std::string ("arg_traits"); + + // This should be generated even for imported nodes. The ifdef + // guard prevents multiple declarations. + 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 @@ -661,10 +730,15 @@ be_visitor_arg_traits::visit_structure (be_structure *node) *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl << "// " << __FILE__ << ":" << __LINE__; - os->gen_ifdef_macro (node->flat_name (), "arg_traits"); + std::string guard_suffix = + std::string (this->S_) + std::string ("arg_traits"); + + // This should be generated even for imported nodes. The ifdef + // guard prevents multiple declarations. + 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 @@ -689,7 +763,7 @@ be_visitor_arg_traits::visit_structure (be_structure *node) os->gen_endif (); /* Set this before visiting the scope so things like - + interface foo { struct bar @@ -697,13 +771,13 @@ be_visitor_arg_traits::visit_structure (be_structure *node) .... foo foo_member; }; - + void op (in bar inarg); }; - + will not cause infinite recursion in this visitor. */ - + this->generated (node, I_TRUE); if (this->visit_scope (node) != 0) @@ -770,10 +844,15 @@ be_visitor_arg_traits::visit_union (be_union *node) *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl << "// " << __FILE__ << ":" << __LINE__; - os->gen_ifdef_macro (node->flat_name (), "arg_traits"); + std::string guard_suffix = + std::string (this->S_) + std::string ("arg_traits"); + + // This should be generated even for imported nodes. The ifdef + // guard prevents multiple declarations. + 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 @@ -798,7 +877,7 @@ be_visitor_arg_traits::visit_union (be_union *node) os->gen_endif (); /* Set this before visiting the scope so things like - + interface foo { struct bar @@ -806,13 +885,13 @@ be_visitor_arg_traits::visit_union (be_union *node) .... foo foo_member; }; - + void op (in bar inarg); }; - + will not cause infinite recursion in this visitor. */ - + this->generated (node, I_TRUE); int status = this->visit_scope (node); @@ -935,4 +1014,3 @@ be_visitor_arg_traits::visit_home (be_home *node) { return this->visit_interface (node); } - diff --git a/TAO/TAO_IDL/be/be_visitor_argument.cpp b/TAO/TAO_IDL/be/be_visitor_argument.cpp index 75ab20cf610..ecdaa032a57 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument.cpp @@ -54,11 +54,7 @@ #include "be_visitor_argument/vardecl_ss.cpp" #include "be_visitor_argument/invoke_cs.cpp" #include "be_visitor_argument/paramlist.cpp" -#include "be_visitor_argument/request_info_sh.cpp" -#include "be_visitor_argument/request_info_ss.cpp" -#include "be_visitor_argument/request_info_result.cpp" -#include "be_visitor_argument/request_info_arglist.cpp" -ACE_RCSID (be, - be_visitor_argument, +ACE_RCSID (be, + be_visitor_argument, "$Id$") diff --git a/TAO/TAO_IDL/be/be_visitor_argument/request_info_arglist.cpp b/TAO/TAO_IDL/be/be_visitor_argument/request_info_arglist.cpp deleted file mode 100644 index 9896c17f4f9..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_argument/request_info_arglist.cpp +++ /dev/null @@ -1,495 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// request_info_arglist.cpp -// -// = DESCRIPTION -// Visitor that generates the parameters in an Operation signature -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// ============================================================================ - -ACE_RCSID (be_visitor_argument, - request_info_arglist, - "$Id$") - - -// ************************************************************ -// be_visitor_args_request_info_arglist for parameter list in method declarations and -// definitions -// ************************************************************ - -be_visitor_args_request_info_arglist::be_visitor_args_request_info_arglist ( - be_visitor_context *ctx - ) - : be_visitor_args (ctx) -{ -} - -be_visitor_args_request_info_arglist::~be_visitor_args_request_info_arglist ( - void - ) -{ -} - -int be_visitor_args_request_info_arglist::visit_argument (be_argument *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - this->ctx_->node (node); // save the argument node - - // retrieve the type - be_type *bt = be_type::narrow_from_decl (node->field_type ()); - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_request_info_arglist::" - "visit_argument - " - "Bad argument type\n"), - -1); - } - - // Different types have different mappings when used as in/out or - // inout parameters. Let this visitor deal with the type. - - if (bt->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_request_info_arglist::" - "visit_argument - " - "cannot accept visitor\n"), - -1); - } - - *os << " " << node->local_name (); - return 0; -} - -int be_visitor_args_request_info_arglist::visit_array (be_array *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - { - *os << "const " << this->type_name (node); - - break; - } - case AST_Argument::dir_INOUT: - { - *os << this->type_name (node); - - break; - } - case AST_Argument::dir_OUT: - { - *os << this->type_name (node, "_out"); - - break; - } - } - - return 0; -} - -int be_visitor_args_request_info_arglist::visit_enum (be_enum *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - { - *os << this->type_name (node) << " &"; - - break; - } - case AST_Argument::dir_INOUT: - { - *os << this->type_name (node) << " &"; - - break; - - } - case AST_Argument::dir_OUT: - { - *os << this->type_name (node, "_out"); - - break; - } - } - - return 0; -} - -int be_visitor_args_request_info_arglist::visit_interface (be_interface *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << this->type_name (node, "_ptr"); - break; - case AST_Argument::dir_INOUT: // inout - *os << this->type_name (node, "_ptr"); - break; - case AST_Argument::dir_OUT: - *os << this->type_name (node, "_out"); - break; - } - - return 0; -} - -int be_visitor_args_request_info_arglist::visit_interface_fwd ( - be_interface_fwd *node - ) -{ - TAO_OutStream *os = this->ctx_->stream (); - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << this->type_name (node, "_ptr"); - break; - case AST_Argument::dir_INOUT: // inout - *os << this->type_name (node, "_ptr"); - break; - case AST_Argument::dir_OUT: - *os << this->type_name (node, "_out"); - break; - } - - return 0; -} - -int be_visitor_args_request_info_arglist::visit_native (be_native *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << this->type_name (node); - break; - case AST_Argument::dir_INOUT: - *os << this->type_name (node) << " &"; - break; - case AST_Argument::dir_OUT: - *os << this->type_name (node) << " &"; - break; - } - - return 0; -} - -int be_visitor_args_request_info_arglist::visit_predefined_type ( - be_predefined_type *node - ) -{ - TAO_OutStream *os = this->ctx_->stream (); - AST_PredefinedType::PredefinedType pt = node->pt (); - - if (pt == AST_PredefinedType::PT_any) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - { - *os << "const " << this->type_name (node) << " &"; - - break; - } - case AST_Argument::dir_INOUT: - { - *os << this->type_name (node) << " &"; - - break; - } - case AST_Argument::dir_OUT: - { - *os << this->type_name (node, "_out"); - - break; - } - } - } - else if (pt == AST_PredefinedType::PT_pseudo - || pt == AST_PredefinedType::PT_object) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << this->type_name (node, "_ptr"); - break; - case AST_Argument::dir_INOUT: - *os << this->type_name (node, "_ptr"); - break; - case AST_Argument::dir_OUT: - *os << this->type_name (node, "_out"); - break; - } - } - else - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - { - *os << "const " << this->type_name (node) << " &"; - - break; - } - case AST_Argument::dir_INOUT: - { - *os << this->type_name (node) << " &"; - - break; - } - case AST_Argument::dir_OUT: - { - *os << this->type_name (node, "_out"); - - break; - } - } // end switch direction - } // end of else - - return 0; -} - -int be_visitor_args_request_info_arglist::visit_sequence (be_sequence *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - { - *os << "const " << this->type_name (node) << " &"; - - break; - } - case AST_Argument::dir_INOUT: - { - *os << this->type_name (node) << " &"; - - break; - } - case AST_Argument::dir_OUT: - { - *os << this->type_name (node, "_out"); - - break; - } - } - - return 0; -} - -int be_visitor_args_request_info_arglist::visit_string (be_string *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - if (node->width () == (long) sizeof (char)) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << "const char *"; - break; - case AST_Argument::dir_INOUT: - *os << "char *&"; - break; - case AST_Argument::dir_OUT: - *os << "CORBA::String_out"; - break; - } - } - else - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << "const CORBA::WChar *"; - break; - case AST_Argument::dir_INOUT: - *os << "CORBA::WChar *&"; - break; - case AST_Argument::dir_OUT: - *os << "CORBA::WString_out"; - break; - } - } - - return 0; -} - -int be_visitor_args_request_info_arglist::visit_structure (be_structure *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - { - *os << "const " << this->type_name (node) << " &"; - - break; - } - case AST_Argument::dir_INOUT: - { - *os << this->type_name (node) << " &"; - - break; - } - case AST_Argument::dir_OUT: - { - *os << this->type_name (node, "_out"); - - break; - } - } - - return 0; -} - -int be_visitor_args_request_info_arglist::visit_union (be_union *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - { - *os << "const " << this->type_name (node) << " &"; - - break; - } - case AST_Argument::dir_INOUT: - { - *os << this->type_name (node) << " &"; - - break; - } - case AST_Argument::dir_OUT: - { - *os << this->type_name (node, "_out"); - - break; - } - } - - return 0; -} - -int be_visitor_args_request_info_arglist::visit_typedef (be_typedef *node) -{ - this->ctx_->alias (node); - - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_request_info_arglist::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - - this->ctx_->alias (0); - return 0; -} - - -int be_visitor_args_request_info_arglist::visit_valuetype (be_valuetype *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << this->type_name (node) << " *"; - break; - case AST_Argument::dir_INOUT: - *os << this->type_name (node) << " *&"; - break; - case AST_Argument::dir_OUT: - *os << this->type_name (node, "_out"); - break; - } - - return 0; -} - -int be_visitor_args_request_info_arglist::visit_valuetype_fwd (be_valuetype_fwd *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << "const " << this->type_name (node) << " *"; - break; - case AST_Argument::dir_INOUT: - *os << this->type_name (node) << " *&"; - break; - case AST_Argument::dir_OUT: - *os << this->type_name (node, "_out"); - break; - } - - return 0; -} - -int -be_visitor_args_request_info_arglist::visit_component ( - be_component *node - ) -{ - return this->visit_interface (node); -} - -int -be_visitor_args_request_info_arglist::visit_component_fwd ( - be_component_fwd *node - ) -{ - return this->visit_interface_fwd (node); -} - -int -be_visitor_args_request_info_arglist::visit_eventtype ( - be_eventtype *node - ) -{ - return this->visit_valuetype (node); -} - -int -be_visitor_args_request_info_arglist::visit_eventtype_fwd ( - be_eventtype_fwd *node - ) -{ - return this->visit_valuetype_fwd (node); -} - -int -be_visitor_args_request_info_arglist::visit_home ( - be_home *node - ) -{ - return this->visit_interface (node); -} - - diff --git a/TAO/TAO_IDL/be/be_visitor_argument/request_info_ch.cpp b/TAO/TAO_IDL/be/be_visitor_argument/request_info_ch.cpp deleted file mode 100644 index 8ba93c73b82..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_argument/request_info_ch.cpp +++ /dev/null @@ -1,493 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// request_info_ch.cpp -// -// = DESCRIPTION -// Visitor that generates the private members in Request_Info class for interceptors -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// ============================================================================ - -ACE_RCSID (be_visitor_argument, - request_info_ch, - "$Id$") - - -// ************************************************************ -// be_visitor_args_request_info_ch for parameter list in method declarations and -// definitions -// ************************************************************ - -be_visitor_args_request_info_ch::be_visitor_args_request_info_ch (be_visitor_context *ctx) - : be_visitor_args (ctx) -{ -} - -be_visitor_args_request_info_ch::~be_visitor_args_request_info_ch (void) -{ -} - -int be_visitor_args_request_info_ch::visit_argument (be_argument *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - this->ctx_->node (node); - - // retrieve the type - be_type *bt = be_type::narrow_from_decl (node->field_type ()); - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_request_info_ch::" - "visit_argument - " - "Bad argument type\n"), - -1); - } - - // Different types have different mappings when used as in/out or - // inout parameters. Let this visitor deal with the type - - if (bt->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_request_info_ch::" - "visit_argument - " - "cannot accept visitor\n"), - -1); - } - - // As we visit each type we print out the &. - *os << " " << node->local_name () << "_;"; - - return 0; -} - -int be_visitor_args_request_info_ch::visit_array (be_array *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - { - *os << "const " << this->type_name (node) << "_slice *"; - - break; - } - case AST_Argument::dir_INOUT: - { - *os << this->type_name (node) << "_slice *"; - - break; - } - case AST_Argument::dir_OUT: - { - *os << this->type_name (node, "_out"); - - break; - } - } - - return 0; -} - -int be_visitor_args_request_info_ch::visit_enum (be_enum *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - { - *os << "const " << this->type_name (node) << " &"; - - break; - } - case AST_Argument::dir_INOUT: - { - *os << this->type_name (node) << " &"; - - break; - } - case AST_Argument::dir_OUT: - { - *os << this->type_name (node, "_out"); - - break; - } - - } - - return 0; -} - -int be_visitor_args_request_info_ch::visit_interface (be_interface *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << this->type_name (node, "_ptr"); - break; - case AST_Argument::dir_INOUT: // inout - *os << this->type_name (node, "_ptr"); - break; - case AST_Argument::dir_OUT: - *os << this->type_name (node, "_out"); - break; - } - - return 0; -} - -int be_visitor_args_request_info_ch::visit_interface_fwd ( - be_interface_fwd *node - ) -{ - TAO_OutStream *os = this->ctx_->stream (); - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << this->type_name (node, "_ptr"); - break; - case AST_Argument::dir_INOUT: // inout - *os << this->type_name (node, "_ptr"); - break; - case AST_Argument::dir_OUT: - *os << this->type_name (node, "_out"); - break; - } - - return 0; -} - -int be_visitor_args_request_info_ch::visit_native (be_native *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << this->type_name (node) << " &"; - break; - case AST_Argument::dir_INOUT: - *os << this->type_name (node) << " &"; - break; - case AST_Argument::dir_OUT: - *os << this->type_name (node) << " &"; - break; - } - - return 0; -} - -int be_visitor_args_request_info_ch::visit_predefined_type ( - be_predefined_type *node - ) -{ - TAO_OutStream *os = this->ctx_->stream (); - AST_PredefinedType::PredefinedType pt = node-> pt (); - - if (pt == AST_PredefinedType::PT_any) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - { - *os << "const " << this->type_name (node) << " &"; - - break; - } - case AST_Argument::dir_INOUT: - { - *os << this->type_name (node) << " &"; - - break; - } - case AST_Argument::dir_OUT: - { - *os << this->type_name (node, "_out"); - - break; - } - } - } - else if (pt == AST_PredefinedType::PT_pseudo - || pt == AST_PredefinedType::PT_object) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << this->type_name (node, "_ptr"); - break; - case AST_Argument::dir_INOUT: - *os << this->type_name (node, "_ptr"); - break; - case AST_Argument::dir_OUT: - *os << this->type_name (node, "_out"); - break; - } - } - else - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - { - *os << "const " << this->type_name (node) << " &"; - - break; - } - case AST_Argument::dir_INOUT: - { - *os << this->type_name (node) << " &"; - - break; - } - case AST_Argument::dir_OUT: - { - *os << this->type_name (node, "_out"); - - break; - } - } // end switch direction - } // end of else - - return 0; -} - -int be_visitor_args_request_info_ch::visit_sequence (be_sequence *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - { - *os << "const " << this->type_name (node) << " &"; - break; - } - case AST_Argument::dir_INOUT: - { - *os << this->type_name (node) << " &"; - break; - } - case AST_Argument::dir_OUT: - { - *os << this->type_name (node, "_out"); - break; - } - - } - - return 0; -} - -int be_visitor_args_request_info_ch::visit_string (be_string *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - if (node->width () == 1) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << "const char *"; - break; - case AST_Argument::dir_INOUT: - *os << "char *"; - break; - case AST_Argument::dir_OUT: - *os << "CORBA::String_out "; - break; - } - } - else - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << "const CORBA::WChar *"; - break; - case AST_Argument::dir_INOUT: - *os << "CORBA::WChar *"; - break; - case AST_Argument::dir_OUT: - *os << "CORBA::WString_out "; - break; - } - } - - return 0; -} - -int be_visitor_args_request_info_ch::visit_structure (be_structure *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - { - *os << "const " << this->type_name (node) << " &"; - - break; - } - case AST_Argument::dir_INOUT: - { - *os << this->type_name (node) << " &"; - - break; - } - case AST_Argument::dir_OUT: - { - *os << this->type_name (node, "_out"); - - break; - } - } - - return 0; -} - -int be_visitor_args_request_info_ch::visit_union (be_union *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - { - *os << "const " << this->type_name (node) << " &"; - - break; - } - case AST_Argument::dir_INOUT: - { - *os << this->type_name (node) << " &"; - - break; - } - case AST_Argument::dir_OUT: - { - *os << this->type_name (node, "_out"); - - break; - } - } - - return 0; -} - -int be_visitor_args_request_info_ch::visit_typedef (be_typedef *node) -{ - this->ctx_->alias (node); - - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_request_info_ch::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - - this->ctx_->alias (0); - return 0; -} - - -int be_visitor_args_request_info_ch::visit_valuetype (be_valuetype *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << this->type_name (node) << " *"; - break; - case AST_Argument::dir_INOUT: - *os << this->type_name (node) << " *&"; - break; - case AST_Argument::dir_OUT: - *os << this->type_name (node, "_out"); - break; - } - - return 0; -} - -int be_visitor_args_request_info_ch::visit_valuetype_fwd ( - be_valuetype_fwd *node - ) -{ - TAO_OutStream *os = this->ctx_->stream (); - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << "const " << this->type_name (node) << " *"; - break; - case AST_Argument::dir_INOUT: - *os << this->type_name (node) << " *&"; - break; - case AST_Argument::dir_OUT: - *os << this->type_name (node, "_out"); - break; - } - - return 0; -} - -int -be_visitor_args_request_info_ch::visit_component ( - be_component *node - ) -{ - return this->visit_interface (node); -} - -int -be_visitor_args_request_info_ch::visit_component_fwd ( - be_component_fwd *node - ) -{ - return this->visit_interface_fwd (node); -} - -int -be_visitor_args_request_info_ch::visit_eventtype ( - be_eventtype *node - ) -{ - return this->visit_valuetype (node); -} - -int -be_visitor_args_request_info_ch::visit_eventtype_fwd ( - be_eventtype_fwd *node - ) -{ - return this->visit_valuetype_fwd (node); -} - -int -be_visitor_args_request_info_ch::visit_home ( - be_home *node - ) -{ - return this->visit_interface (node); -} - - diff --git a/TAO/TAO_IDL/be/be_visitor_argument/request_info_cs.cpp b/TAO/TAO_IDL/be/be_visitor_argument/request_info_cs.cpp deleted file mode 100644 index 07650498daf..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_argument/request_info_cs.cpp +++ /dev/null @@ -1,85 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// request_info_cs.cpp -// -// = DESCRIPTION -// Visitor that generates the constructor memberlist in Request_Info class for interceptors -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// ============================================================================ - -ACE_RCSID (be_visitor_argument, - request_info_cs, - "$Id$") - - -// ************************************************************ -// be_visitor_args_request_info_cs for parameter list in method declarations and -// definitions -// ************************************************************ - -be_visitor_args_request_info_cs::be_visitor_args_request_info_cs ( - be_visitor_context *ctx - ) - : be_visitor_args (ctx) -{ -} - -be_visitor_args_request_info_cs::~be_visitor_args_request_info_cs (void) -{ -} - -int be_visitor_args_request_info_cs::visit_argument (be_argument *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - this->ctx_->node (node); - - // Retrieve the type. - be_type *bt = be_type::narrow_from_decl (node->field_type ()); - - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_request_info_cs::" - "visit_argument - " - "Bad argument type\n"), - -1); - } - - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_ARGLIST_CS: - { - // Generate the memberlist definition for the constructor. - *os << " " << node->local_name () - << "_ " << "(" << node->local_name () << ")"; - break; - } - case TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_INFO_ARGLIST_CS: - { - // Generate the arglist for object instantiation. - *os << node->local_name (); - break; - } - default: - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interceptors_request_info_cs::" - "post_process - " - "Bad context\n"), - -1); - } - } - - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_argument/request_info_result.cpp b/TAO/TAO_IDL/be/be_visitor_argument/request_info_result.cpp deleted file mode 100644 index e99ed0cce59..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_argument/request_info_result.cpp +++ /dev/null @@ -1,295 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// request_info_result.cpp -// -// = DESCRIPTION -// Visitor that generates the Dyanmic::ParameterList -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// ============================================================================ - -ACE_RCSID (be_visitor_argument, - request_info_result, - "$Id$") - - -// ************************************************************ -// be_visitor_args_request_info_result for generating the result as -// stored in the request info for interceptors -// ************************************************************ - -be_visitor_args_request_info_result::be_visitor_args_request_info_result ( - be_visitor_context *ctx - ) - : be_visitor_args (ctx) -{ -} - -be_visitor_args_request_info_result::~be_visitor_args_request_info_result ( - void - ) -{ -} - -int be_visitor_args_request_info_result::visit_argument (be_argument *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - this->ctx_->node (node); - - os->indent (); - be_type *bt = be_type::narrow_from_decl (node->field_type ()); - - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_::" - "visit_argument - " - "Bad return type\n"), - -1); - } - - if (bt->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_vardecl_ss::" - "visit_argument - " - "cannot accept visitor\n"), - -1); - } - - *os << be_nl; - - // Set the appropriate mode for each parameter. - return 0; -} - -int be_visitor_args_request_info_result::visit_array (be_array *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - be_type *bt; - - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - os->indent (); - - *os << bt->name () << "_forany _tao_forany_result" - << " (this->result_);" << be_nl - << "this->result_val_ <<= _tao_forany_result;" << be_nl; - - return 0; -} - -int be_visitor_args_request_info_result::visit_enum (be_enum *) -{ - TAO_OutStream *os = this->ctx_->stream (); - - os->indent (); - *os << "this->result_val_ <<= this->result_;"; - - return 0; -} - -int be_visitor_args_request_info_result::visit_interface (be_interface *) -{ - TAO_OutStream *os = this->ctx_->stream (); - - os->indent (); - *os << "this->result_val_ <<= this->result_;"; - - return 0; -} - -int be_visitor_args_request_info_result::visit_interface_fwd ( - be_interface_fwd * - ) -{ - TAO_OutStream *os = this->ctx_->stream (); - - os->indent (); - *os << "this->result_val_ <<= this->result_;"; - - return 0; -} - -int be_visitor_args_request_info_result::visit_valuetype (be_valuetype *) -{ - TAO_OutStream *os = this->ctx_->stream (); - - os->indent (); - *os << "this->result_val_ <<= this->result_;"; - - return 0; -} - -int be_visitor_args_request_info_result::visit_valuetype_fwd ( - be_valuetype_fwd * - ) -{ - TAO_OutStream *os = this->ctx_->stream (); - - os->indent (); - *os << "this->result_val_ <<= this->result_;"; - - return 0; -} - -int -be_visitor_args_request_info_result::visit_predefined_type ( - be_predefined_type *node - ) -{ - TAO_OutStream *os = this->ctx_->stream (); - os->indent (); - - *os << "this->result_val_ <<= "; - - switch (node->pt ()) - { - case AST_PredefinedType::PT_boolean: - *os << "CORBA::Any::from_boolean (this->result_);" << be_nl; - - break; - case AST_PredefinedType::PT_char: - *os << "CORBA::Any::from_char (this->result_);"<<be_nl; - - break; - case AST_PredefinedType::PT_wchar: - *os << "CORBA::Any::from_wchar (this->result_);"<<be_nl; - - break; - case AST_PredefinedType::PT_octet: - *os << "CORBA::Any::from_octet (this->result_);"<<be_nl; - - break; - default: - *os << "this->result_;"<<be_nl; - - break; - } - - return 0; -} - -int be_visitor_args_request_info_result::visit_sequence (be_sequence *) -{ - TAO_OutStream *os = this->ctx_->stream (); - os->indent (); - - *os << "this->result_val_ <<= this->result_;"; - - return 0; -} - -int -be_visitor_args_request_info_result::visit_string (be_string *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - os->indent (); - - *os << "this->result_val_ <<= "; - - // We need to make a distinction between bounded and unbounded strings. - if (node->max_size ()->ev ()->u.ulval != 0) - { - if (node->width () == (long) sizeof (char)) - { - *os << "CORBA::Any::from_string ((char *)"; - } - else - { - *os << "CORBA::Any::from_wstring ((CORBA::WChar *)"; - } - - *os <<"this->result_, " - << node->max_size ()->ev ()->u.ulval - << ");"; - } - else - { - *os << "this->result_; "; - } - - return 0; -} - -int be_visitor_args_request_info_result::visit_structure (be_structure *) -{ - TAO_OutStream *os = this->ctx_->stream (); - os->indent (); - - *os << "this->result_val_ <<= this->result_;"; - - return 0; -} - -int be_visitor_args_request_info_result::visit_union (be_union *) -{ - TAO_OutStream *os = this->ctx_->stream (); - os->indent (); - - *os << "this->result_val_ <<= this->result_;"; - - return 0; -} - -int be_visitor_args_request_info_result::visit_typedef (be_typedef *) -{ - TAO_OutStream *os = this->ctx_->stream (); - os->indent (); - - *os << "this->result_val_ <<= this->result_;"; - - return 0; -} - -int -be_visitor_args_request_info_result::visit_component ( - be_component *node - ) -{ - return this->visit_interface (node); -} - -int -be_visitor_args_request_info_result::visit_component_fwd ( - be_component_fwd *node - ) -{ - return this->visit_interface_fwd (node); -} - -int -be_visitor_args_request_info_result::visit_eventtype ( - be_eventtype *node - ) -{ - return this->visit_valuetype (node); -} - -int -be_visitor_args_request_info_result::visit_eventtype_fwd ( - be_eventtype_fwd *node - ) -{ - return this->visit_valuetype_fwd (node); -} - - diff --git a/TAO/TAO_IDL/be/be_visitor_argument/request_info_sh.cpp b/TAO/TAO_IDL/be/be_visitor_argument/request_info_sh.cpp deleted file mode 100644 index a9f1c48709f..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_argument/request_info_sh.cpp +++ /dev/null @@ -1,421 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// request_info_sh.cpp -// -// = DESCRIPTION -// Visitor that generates the private members in Request_Info class for interceptors -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// ============================================================================ - -ACE_RCSID (be_visitor_argument, - request_info_sh, - "$Id$") - - -// ************************************************************ -// be_visitor_args_request_info_sh for parameter list in method declarations and -// definitions -// ************************************************************ - -be_visitor_args_request_info_sh::be_visitor_args_request_info_sh ( - be_visitor_context *ctx - ) - : be_visitor_args (ctx) -{ -} - -be_visitor_args_request_info_sh::~be_visitor_args_request_info_sh (void) -{ -} - -int be_visitor_args_request_info_sh::visit_argument (be_argument *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - this->ctx_->node (node); - be_type *bt = be_type::narrow_from_decl (node->field_type ()); - - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_request_info_sh::" - "visit_argument - " - "Bad argument type\n"), - -1); - } - - // Different types have different mappings when used as in/out or - // inout parameters. Let this visitor deal with the type. - - if (bt->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_request_info_sh::" - "visit_argument - " - "cannot accept visitor\n"), - -1); - } - - *os << " " << node->local_name () << "_;"; - - return 0; -} - -int be_visitor_args_request_info_sh::visit_array (be_array *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << "const " << this->type_name (node) << "_slice *"; - break; - case AST_Argument::dir_INOUT: - *os << this->type_name (node) << "_slice *"; - break; - case AST_Argument::dir_OUT: - *os << this->type_name (node, "_out"); - break; - } - - return 0; -} - -int be_visitor_args_request_info_sh::visit_enum (be_enum *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << "const " << this->type_name (node) << " &";; - break; - case AST_Argument::dir_INOUT: - *os << this->type_name (node) << " &"; - break; - case AST_Argument::dir_OUT: - *os << this->type_name (node, "_out"); - break; - } - - return 0; -} - -int be_visitor_args_request_info_sh::visit_interface (be_interface *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << this->type_name (node, "_ptr"); - break; - case AST_Argument::dir_INOUT: - *os << this->type_name (node, "_ptr"); - break; - case AST_Argument::dir_OUT: - *os << this->type_name (node, "_out"); - break; - } - - return 0; -} - -int be_visitor_args_request_info_sh::visit_interface_fwd (be_interface_fwd *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << this->type_name (node, "_ptr"); - break; - case AST_Argument::dir_INOUT: - *os << this->type_name (node, "_ptr"); - break; - case AST_Argument::dir_OUT: - *os << this->type_name (node, "_out"); - break; - } - - return 0; -} - -int be_visitor_args_request_info_sh::visit_native (be_native *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << this->type_name (node) << " &"; - break; - case AST_Argument::dir_INOUT: - *os << this->type_name (node) << " &"; - break; - case AST_Argument::dir_OUT: - *os << this->type_name (node) << " &"; - break; - } - - return 0; -} - -int be_visitor_args_request_info_sh::visit_predefined_type ( - be_predefined_type *node - ) -{ - TAO_OutStream *os = this->ctx_->stream (); - AST_PredefinedType::PredefinedType pt = node->pt (); - - if (pt == AST_PredefinedType::PT_any) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << "const " << this->type_name (node) << " &"; - break; - case AST_Argument::dir_INOUT: - *os << this->type_name (node) << " &"; - break; - case AST_Argument::dir_OUT: - *os << this->type_name (node, "_out"); - break; - } - } - else if (pt == AST_PredefinedType::PT_pseudo - || pt == AST_PredefinedType::PT_object) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << this->type_name (node, "_ptr"); - break; - case AST_Argument::dir_INOUT: - *os << this->type_name (node, "_ptr"); - break; - case AST_Argument::dir_OUT: - *os << this->type_name (node, "_out"); - break; - } - } - else - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << "const " << this->type_name (node) <<" &"; - break; - case AST_Argument::dir_INOUT: - *os << this->type_name (node) << " &"; - break; - case AST_Argument::dir_OUT: - *os << this->type_name (node, "_out"); - break; - } // end switch direction - } // end of else - - return 0; -} - -int be_visitor_args_request_info_sh::visit_sequence (be_sequence *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << "const " << this->type_name (node) << " &"; - break; - case AST_Argument::dir_INOUT: - *os << this->type_name (node) << " &"; - break; - case AST_Argument::dir_OUT: - *os << this->type_name (node, "_out"); - break; - } - - return 0; -} - -int be_visitor_args_request_info_sh::visit_string (be_string *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - if (node->width () == 1) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << "const char *"; - break; - case AST_Argument::dir_INOUT: - *os << "char *&"; - break; - case AST_Argument::dir_OUT: - *os << "CORBA::String_out "; - break; - } - } - else - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << "const CORBA::WChar *"; - break; - case AST_Argument::dir_INOUT: - *os << "CORBA::WChar *&"; - break; - case AST_Argument::dir_OUT: - *os << "CORBA::WString_out"; - break; - } - } - - return 0; -} - -int be_visitor_args_request_info_sh::visit_structure (be_structure *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << "const " << this->type_name (node) << " &"; - break; - case AST_Argument::dir_INOUT: - *os << this->type_name (node) << " &"; - break; - case AST_Argument::dir_OUT: - *os << this->type_name (node, "_out"); - break; - } - - return 0; -} - -int be_visitor_args_request_info_sh::visit_union (be_union *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get the stream - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << "const " << this->type_name (node) << " &"; - break; - case AST_Argument::dir_INOUT: - *os << this->type_name (node) << " &"; - break; - case AST_Argument::dir_OUT: - *os << this->type_name (node, "_out"); - break; - } - - return 0; -} - -int be_visitor_args_request_info_sh::visit_typedef (be_typedef *node) -{ - this->ctx_->alias (node); - - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_request_info_sh::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - - this->ctx_->alias (0); - return 0; -} - - -int be_visitor_args_request_info_sh::visit_valuetype (be_valuetype *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << this->type_name (node) << " *"; - break; - case AST_Argument::dir_INOUT: - *os << this->type_name (node) << " *&"; - break; - case AST_Argument::dir_OUT: - *os << this->type_name (node, "_out"); - break; - } - - return 0; -} - -int be_visitor_args_request_info_sh::visit_valuetype_fwd ( - be_valuetype_fwd *node - ) -{ - TAO_OutStream *os = this->ctx_->stream (); - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << "const " << this->type_name (node) << " *"; - break; - case AST_Argument::dir_INOUT: - *os << this->type_name (node) << " *&"; - break; - case AST_Argument::dir_OUT: - *os << this->type_name (node, "_out"); - break; - } - - return 0; -} - -int -be_visitor_args_request_info_sh::visit_component ( - be_component *node - ) -{ - return this->visit_interface (node); -} - -int -be_visitor_args_request_info_sh::visit_component_fwd ( - be_component_fwd *node - ) -{ - return this->visit_interface_fwd (node); -} - -int -be_visitor_args_request_info_sh::visit_eventtype ( - be_eventtype *node - ) -{ - return this->visit_valuetype (node); -} - -int -be_visitor_args_request_info_sh::visit_eventtype_fwd ( - be_eventtype_fwd *node - ) -{ - return this->visit_valuetype_fwd (node); -} - - diff --git a/TAO/TAO_IDL/be/be_visitor_argument/request_info_ss.cpp b/TAO/TAO_IDL/be/be_visitor_argument/request_info_ss.cpp deleted file mode 100644 index 024686018c7..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_argument/request_info_ss.cpp +++ /dev/null @@ -1,106 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// request_info_ss.cpp -// -// = DESCRIPTION -// Visitor that generates the constructor memberlist in Request_Info class for interceptors -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// ============================================================================ - -ACE_RCSID (be_visitor_argument, - request_info_ss, - "$Id$") - - -// ************************************************************ -// be_visitor_args_request_info_ss for parameter list in method declarations and -// definitions -// ************************************************************ - -be_visitor_args_request_info_ss::be_visitor_args_request_info_ss ( - be_visitor_context *ctx - ) - : be_visitor_args (ctx) -{ -} - -be_visitor_args_request_info_ss::~be_visitor_args_request_info_ss (void) -{ -} - -int be_visitor_args_request_info_ss::visit_argument (be_argument *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - this->ctx_->node (node); // save the argument node - // retrieve the type - be_type *bt = be_type::narrow_from_decl (node->field_type ()); - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_request_info_ss::" - "visit_argument - " - "Bad argument type\n"), - -1); - } - - os->indent (); - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_ARGLIST_SS: - { - // Generate the memberlist definition for the constructor. - *os << node->local_name () << "_ " << "("<< node->local_name () - <<")"; - break; - } - case TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_INFO_ARGLIST_SS: - { - // Generate the arglist for object instantiation. - //*os << node->local_name (); - - // retrieve the type of the argument - /* be_type *bt = be_type::narrow_from_decl (node->field_type ()); - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_compiled_marshal_ss::" - "visit_argument - " - "Bad argument type\n"), - -1); - } - - // Different types have different mappings when used as in/out or - // inout parameters. Let this visitor deal with the type - if (bt->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_compiled_marshal_ss::" - "visit_argument - " - "cannot accept visitor\n"), - -1); - } - */ - break; - } - default: - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interceptors_request_info_ss::" - "post_process - " - "Bad context\n"), - -1); - } - } - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp b/TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp index a0ef398247a..f863ede4891 100644 --- a/TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp @@ -188,7 +188,7 @@ int be_visitor_array_ci::visit_array (be_array *node) unique += "_traits"; *os << be_nl << be_nl - << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION" << be_nl +// << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION" << be_nl << "ACE_INLINE" << be_nl << "void" << be_nl << "TAO::Array_Traits<" << be_idt << be_idt_nl @@ -203,7 +203,7 @@ int be_visitor_array_ci::visit_array (be_array *node) << "}"; *os << be_nl << be_nl - << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION" << be_nl +// << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION" << be_nl << "ACE_INLINE" << be_nl << fname << "_slice *" << be_nl << "TAO::Array_Traits<" << be_idt << be_idt_nl @@ -218,7 +218,7 @@ int be_visitor_array_ci::visit_array (be_array *node) << "}"; *os << be_nl << be_nl - << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION" << be_nl +// << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION" << be_nl << "ACE_INLINE" << be_nl << "void" << be_nl << "TAO::Array_Traits<" << be_idt << be_idt_nl @@ -234,7 +234,7 @@ int be_visitor_array_ci::visit_array (be_array *node) << "}"; *os << be_nl << be_nl - << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION" << be_nl +// << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION" << be_nl << "ACE_INLINE" << be_nl << fname << "_slice *" << be_nl << "TAO::Array_Traits<" << be_idt << be_idt_nl diff --git a/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp b/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp index 9eb582d7b89..6538562c977 100644 --- a/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp +++ b/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp @@ -18,8 +18,8 @@ // // ============================================================================ -ACE_RCSID (be_visitor_attribute, - attribute, +ACE_RCSID (be_visitor_attribute, + attribute, "$Id$") // Attribute gets mapped to one or possibly two operations based on whether @@ -147,18 +147,6 @@ be_visitor_attribute::visit_attribute (be_attribute *node) status = get_op.accept (&visitor); break; } - case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SH: - { - be_visitor_operation_interceptors_sh visitor (&ctx); - status = get_op.accept (&visitor); - break; - } - case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SS: - { - be_visitor_operation_interceptors_ss visitor (&ctx); - status = get_op.accept (&visitor); - break; - } case TAO_CodeGen::TAO_ROOT_TIE_SH: { be_visitor_operation_tie_sh visitor (&ctx); @@ -328,18 +316,6 @@ be_visitor_attribute::visit_attribute (be_attribute *node) status = set_op.accept (&visitor); break; } - case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SH: - { - be_visitor_operation_interceptors_sh visitor (&ctx); - status = set_op.accept (&visitor); - break; - } - case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SS: - { - be_visitor_operation_interceptors_ss visitor (&ctx); - status = set_op.accept (&visitor); - break; - } case TAO_CodeGen::TAO_ROOT_TIE_SH: { be_visitor_operation_tie_sh visitor (&ctx); diff --git a/TAO/TAO_IDL/be/be_visitor_component/component_cs.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_cs.cpp index d9aa9352aad..861b469cd59 100644 --- a/TAO/TAO_IDL/be/be_visitor_component/component_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component/component_cs.cpp @@ -66,7 +66,7 @@ be_visitor_component_cs::visit_component (be_component *node) << "// Traits specializations for " << node->name () << "."; *os << be_nl << be_nl - << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION " << be_nl +// << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION " << be_nl << node->name () << "_ptr" << be_nl << "TAO::Objref_Traits<" << node->name () << ">::duplicate (" << be_idt << be_idt_nl @@ -77,7 +77,7 @@ be_visitor_component_cs::visit_component (be_component *node) << "}"; *os << be_nl << be_nl - << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION " << be_nl +// << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION " << be_nl << "void" << be_nl << "TAO::Objref_Traits<" << node->name () << ">::release (" << be_idt << be_idt_nl @@ -88,7 +88,7 @@ be_visitor_component_cs::visit_component (be_component *node) << "}"; *os << be_nl << be_nl - << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION " << be_nl +// << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION " << be_nl << node->name () << "_ptr" << be_nl << "TAO::Objref_Traits<" << node->name () << ">::nil (void)" << be_nl @@ -97,7 +97,7 @@ be_visitor_component_cs::visit_component (be_component *node) << "}"; *os << be_nl << be_nl - << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION " << be_nl +// << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION " << be_nl << "CORBA::Boolean" << be_nl << "TAO::Objref_Traits<" << node->name () << ">::marshal (" << be_idt << be_idt_nl diff --git a/TAO/TAO_IDL/be/be_visitor_interface.cpp b/TAO/TAO_IDL/be/be_visitor_interface.cpp index b55cd141464..96343041ea4 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface.cpp @@ -68,7 +68,6 @@ #include "be_visitor_interface/smart_proxy_ch.cpp" #include "be_visitor_interface/smart_proxy_cs.cpp" #include "be_visitor_interface/ami_interface_ch.cpp" -#include "be_visitor_interface/interceptors_ss.cpp" // Proxy Brokers #include "be_visitor_interface/strategized_proxy_broker_sh.cpp" @@ -88,6 +87,6 @@ #include "be_visitor_interface/amh_rh_ss.cpp" #include "be_visitor_interface/amh_rh_sh.cpp" -ACE_RCSID (be, - be_visitor_interface, +ACE_RCSID (be, + be_visitor_interface, "$Id$") diff --git a/TAO/TAO_IDL/be/be_visitor_interface/amh_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/amh_sh.cpp index 4619aa4f754..7b27398cf57 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/amh_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/amh_sh.cpp @@ -92,7 +92,6 @@ be_visitor_amh_interface_sh::visit_interface (be_interface *node) // instead of delete. ACE_OS::free (buf); - if (i != 0) { *os << ", "; @@ -126,9 +125,9 @@ be_visitor_amh_interface_sh::visit_interface (be_interface *node) << "ACE_ENV_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl << ");" << be_uidt_nl << be_nl; - *os << "virtual void* _downcast (" << be_idt << be_idt_nl - << "const char* logical_type_id" << be_uidt_nl - << ");" << be_uidt_nl << be_nl; +// *os << "virtual void* _downcast (" << be_idt << be_idt_nl +// << "const char* logical_type_id" << be_uidt_nl +// << ");" << be_uidt_nl << be_nl; // Add a skeleton for our _is_a method. *os << "static void _is_a_skel (" << be_idt << be_idt_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 4a82a7a80da..50becd43eb9 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp @@ -76,7 +76,7 @@ be_visitor_amh_interface_ss::this_method (be_interface *node) << "TAO_Stub *stub = this->_create_stub (ACE_ENV_SINGLE_ARG_PARAMETER);" << be_nl << "ACE_CHECK_RETURN (0);" << be_nl << be_nl; - + *os << "TAO_Stub_Auto_Ptr safe_stub (stub);" << be_nl << "CORBA::Object_ptr tmp = CORBA::Object::_nil ();" << be_nl << be_nl @@ -100,7 +100,7 @@ be_visitor_amh_interface_ss::this_method (be_interface *node) << "}" << be_uidt_nl << be_nl << "CORBA::Object_var obj = tmp;" << be_nl << "(void) safe_stub.release ();" << be_nl << be_nl; - + *os << "typedef ::" << node->name () << " STUB_SCOPED_NAME;" << be_nl << "return" << be_idt_nl; @@ -136,8 +136,8 @@ be_visitor_amh_interface_ss::dispatch_method (be_interface *node) *os << "void" << be_nl << full_skel_name << "::_dispatch (" << be_idt << be_idt_nl - << "TAO_ServerRequest &req," << be_nl - << "void *context" << be_nl + << "TAO_ServerRequest & req," << be_nl + << "void * context" << be_nl << "ACE_ENV_ARG_DECL" << be_uidt_nl << ")" << be_uidt_nl << "{" << be_idt_nl @@ -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 ();"; } @@ -217,28 +217,6 @@ emit (be_interface * /* derived */, return 0; } -int -be_visitor_amh_interface_ss::generate_downcast_implementation (be_interface *node, - TAO_OutStream *os) -{ - // Make sure the queues are empty. - node->get_insert_queue ().reset (); - node->get_del_queue ().reset (); - - - // Insert ourselves in the queue. - if (node->get_insert_queue ().enqueue_tail (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_interface::traverse_inheritance_graph - " - "error generating entries\n"), - -1); - } - - TAO_IDL_Downcast_Implementation_Worker worker; - return node->traverse_inheritance_graph (worker, os); -} - // **************************************************************** class TAO_IDL_Copy_Ctor_Worker diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp index b02cd9a48e1..054f7b04885 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp @@ -18,8 +18,8 @@ // // ============================================================================ -ACE_RCSID (be_visitor_interface, - interface, +ACE_RCSID (be_visitor_interface, + interface, "$Id$") // ****************************************************** @@ -72,39 +72,35 @@ be_visitor_interface::visit_scope (be_scope *node) switch (this->ctx_->state ()) { case TAO_CodeGen::TAO_INTERFACE_CH: - helper = + helper = be_visitor_interface_ch::gen_abstract_ops_helper; break; case TAO_CodeGen::TAO_ROOT_CS: - helper = + helper = be_visitor_interface_cs::gen_abstract_ops_helper; break; case TAO_CodeGen::TAO_ROOT_SH: - helper = + helper = be_visitor_interface_sh::gen_abstract_ops_helper; break; case TAO_CodeGen::TAO_INTERFACE_THRU_POA_PROXY_IMPL_SH: - helper = + helper = be_visitor_interface_thru_poa_proxy_impl_sh::gen_abstract_ops_helper; break; case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SH: - helper = + helper = be_visitor_interface_direct_proxy_impl_sh::gen_abstract_ops_helper; break; case TAO_CodeGen::TAO_ROOT_SS: - helper = + helper = be_visitor_interface_ss::gen_abstract_ops_helper; break; - case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SS: - helper = - be_visitor_interface_interceptors_ss::gen_abstract_ops_helper; - break; case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SS: - helper = + helper = be_visitor_interface_direct_proxy_impl_ss::gen_abstract_ops_helper; break; case TAO_CodeGen::TAO_INTERFACE_THRU_POA_PROXY_IMPL_SS: - helper = + helper = be_visitor_interface_thru_poa_proxy_impl_ss::gen_abstract_ops_helper; break; default: @@ -140,7 +136,7 @@ int be_visitor_interface::is_amh_rh_node (be_interface *node) { //If, is implied-IDL - if (node->original_interface () != 0) + if (node->original_interface () != 0) { // and the name starts with AMH if (ACE_OS::strncmp (node->local_name (), "AMH", 3) == 0) @@ -188,7 +184,7 @@ be_visitor_interface::visit_attribute (be_attribute *node) ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_interface::" "visit_attribute - " - "failed to accept visitor\n"), + "failed to accept visitor\n"), -1); } @@ -219,7 +215,7 @@ be_visitor_interface::visit_constant (be_constant *node) break; } default: - return 0; // nothing to be done + return 0; // nothing to be done } if (status == -1) @@ -227,7 +223,7 @@ be_visitor_interface::visit_constant (be_constant *node) ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_interface::" "visit_constant - " - "failed to accept visitor\n"), + "failed to accept visitor\n"), -1); } @@ -290,7 +286,7 @@ be_visitor_interface::visit_enum (be_enum *node) ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_interface::" "visit_enum - " - "failed to accept visitor\n"), + "failed to accept visitor\n"), -1); } @@ -352,7 +348,7 @@ be_visitor_interface::visit_exception (be_exception *node) break; } default: - return 0; // nothing to be done + return 0; // nothing to be done } if (status == -1) @@ -360,7 +356,7 @@ be_visitor_interface::visit_exception (be_exception *node) ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_interface::" "visit_exception - " - "failed to accept visitor\n"), + "failed to accept visitor\n"), -1); } @@ -435,18 +431,6 @@ be_visitor_interface::visit_operation (be_operation *node) status = node->accept (&visitor); break; } - case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SH: - { - be_visitor_operation_interceptors_sh visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SS: - { - be_visitor_operation_interceptors_ss visitor (&ctx); - status = node->accept (&visitor); - break; - } case TAO_CodeGen::TAO_INTERFACE_THRU_POA_PROXY_IMPL_SH: case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SH: { @@ -504,7 +488,7 @@ be_visitor_interface::visit_operation (be_operation *node) ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_interface::" "visit_operation - " - "failed to accept visitor\n"), + "failed to accept visitor\n"), -1); } @@ -520,7 +504,7 @@ be_visitor_interface::visit_operation (be_operation *node) ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_interface::" "visit_operation - " - "NUL visitor\n"), + "NUL visitor\n"), -1); } @@ -529,7 +513,7 @@ be_visitor_interface::visit_operation (be_operation *node) ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_interface::" "visit_operation - " - "failed to accept visitor\n"), + "failed to accept visitor\n"), -1); } @@ -552,7 +536,7 @@ be_visitor_interface::visit_operation (be_operation *node) ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_interface::" "visit_operation - " - "NUL visitor\n"), + "NUL visitor\n"), -1); } @@ -561,7 +545,7 @@ be_visitor_interface::visit_operation (be_operation *node) ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_interface::" "visit_operation - " - "failed to accept visitor\n"), + "failed to accept visitor\n"), -1); } @@ -634,7 +618,7 @@ be_visitor_interface::visit_structure (be_structure *node) ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_interface::" "visit_structure - " - "failed to accept visitor\n"), + "failed to accept visitor\n"), -1); } @@ -667,7 +651,7 @@ be_visitor_interface::visit_structure_fwd (be_structure_fwd *node) ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_interface::" "visit_structure_fwd - " - "failed to accept visitor\n"), + "failed to accept visitor\n"), -1); } @@ -728,7 +712,7 @@ be_visitor_interface::visit_union (be_union *node) break; } default: - return 0; // nothing to be done + return 0; // nothing to be done } if (status == -1) @@ -736,7 +720,7 @@ be_visitor_interface::visit_union (be_union *node) ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_interface::" "visit_union - " - "failed to accept visitor\n"), + "failed to accept visitor\n"), -1); } @@ -769,7 +753,7 @@ be_visitor_interface::visit_union_fwd (be_union_fwd *node) ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_interface::" "visit_union_fwd - " - "failed to accept visitor\n"), + "failed to accept visitor\n"), -1); } @@ -830,7 +814,7 @@ be_visitor_interface::visit_typedef (be_typedef *node) break; } default: - return 0; // nothing to be done + return 0; // nothing to be done } if (status == -1) @@ -838,7 +822,7 @@ be_visitor_interface::visit_typedef (be_typedef *node) ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_interface::" "visit_typedef - " - "failed to accept visitor\n"), + "failed to accept visitor\n"), -1); } diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp index e21027e99aa..530d25e9c3b 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp @@ -139,6 +139,8 @@ be_visitor_interface_ch::visit_interface (be_interface *node) // _nil operations. *os << "// The static operations." << be_nl << "static " << node->local_name () << "_ptr " << "_duplicate (" + << node->local_name () << "_ptr obj);" << be_nl << be_nl + << "static void _tao_release (" << node->local_name () << "_ptr obj);" << be_nl << be_nl; if (this->gen_xxx_narrow ("_narrow", 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 c3ad637baa7..72a65046da0 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp @@ -65,7 +65,7 @@ be_visitor_interface_cs::visit_interface (be_interface *node) << "// Traits specializations for " << node->name () << "."; *os << be_nl << be_nl - << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION" << be_nl +// << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION" << be_nl << node->name () << "_ptr" << be_nl << "TAO::Objref_Traits<" << node->name () << ">::duplicate (" << be_idt << be_idt_nl @@ -76,7 +76,7 @@ be_visitor_interface_cs::visit_interface (be_interface *node) << "}"; *os << be_nl << be_nl - << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION" << be_nl +// << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION" << be_nl << "void" << be_nl << "TAO::Objref_Traits<" << node->name () << ">::release (" << be_idt << be_idt_nl @@ -87,7 +87,7 @@ be_visitor_interface_cs::visit_interface (be_interface *node) << "}"; *os << be_nl << be_nl - << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION" << be_nl +// << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION" << be_nl << node->name () << "_ptr" << be_nl << "TAO::Objref_Traits<" << node->name () << ">::nil (void)" << be_nl @@ -96,7 +96,7 @@ be_visitor_interface_cs::visit_interface (be_interface *node) << "}"; *os << be_nl << be_nl - << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION" << be_nl +// << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION" << be_nl << "CORBA::Boolean" << be_nl << "TAO::Objref_Traits<" << node->name () << ">::marshal (" << be_idt << be_idt_nl @@ -326,13 +326,23 @@ be_visitor_interface_cs::visit_interface (be_interface *node) << "return obj;" << be_uidt_nl << "}" << be_nl << be_nl; + // The _tao_release method + *os << "void" << be_nl + << node->full_name () << "::_tao_release (" + << bt->local_name () + << "_ptr obj)" << be_nl + << "{" << be_idt_nl + << "CORBA::release (obj);" << be_uidt_nl + << "}" << be_nl << be_nl; + + // Empty implementations so the application can override or not. if (node->session_component_child () == 1) { - *os << "// These two are inherited from SessionComponent." + *os << "// These two are inherited from SessionComponent." << be_nl << be_nl << "void" << be_nl - << node->full_name () << "::ciao_preactivate (" + << node->full_name () << "::ciao_preactivate (" << be_idt << be_idt_nl << "ACE_ENV_SINGLE_ARG_DECL_NOT_USED" << be_uidt_nl << ")" << be_uidt_nl @@ -341,7 +351,7 @@ be_visitor_interface_cs::visit_interface (be_interface *node) << "{" << be_nl << "}" << be_nl << be_nl << "void" << be_nl - << node->full_name () << "::ciao_postactivate (" + << node->full_name () << "::ciao_postactivate (" << be_idt << be_idt_nl << "ACE_ENV_SINGLE_ARG_DECL_NOT_USED" << be_uidt_nl << ")" << be_uidt_nl diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp index e8d950f4d1f..62d93ce439a 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp @@ -18,8 +18,8 @@ // // ============================================================================ -ACE_RCSID (be_visitor_interface, - interface_sh, +ACE_RCSID (be_visitor_interface, + interface_sh, "$Id$") // ************************************************************ @@ -38,7 +38,7 @@ be_visitor_interface_sh::~be_visitor_interface_sh (void) int be_visitor_interface_sh::visit_interface (be_interface *node) { - if (node->srv_hdr_gen () + if (node->srv_hdr_gen () || node->imported () || node->is_abstract ()) { @@ -94,10 +94,10 @@ be_visitor_interface_sh::visit_interface (be_interface *node) << "_ptr;" << be_nl << be_nl; // Forward class declarations. - if (be_global->gen_thru_poa_collocation ()) - { - *os << "class " << node->thru_poa_proxy_impl_name () << ";" << be_nl; - } +// if (be_global->gen_thru_poa_collocation ()) +// { +// *os << "class " << node->thru_poa_proxy_impl_name () << ";" << be_nl; +// } if (be_global->gen_direct_collocation ()) { @@ -124,7 +124,7 @@ be_visitor_interface_sh::visit_interface (be_interface *node) for (int i = 0; i < n_parents; ++i) { parent = node->inherits ()[i]; - + if (parent->is_abstract ()) { continue; @@ -160,11 +160,11 @@ be_visitor_interface_sh::visit_interface (be_interface *node) *os << "// Useful for template programming." << be_nl << "typedef ::" << node->name () << " _stub_type;" << be_nl << "typedef ::" << node->name () << "_ptr _stub_ptr_type;" << be_nl - << "typedef ::" << node->name () << "_var _stub_var_type;" + << "typedef ::" << node->name () << "_var _stub_var_type;" << be_nl << be_nl; // Copy constructor and destructor. - *os << class_name.c_str () << " (const " + *os << class_name.c_str () << " (const " << class_name.c_str () << "& rhs);" << be_nl << "virtual ~" << class_name.c_str () << " (void);" << be_nl << be_nl; @@ -174,47 +174,47 @@ be_visitor_interface_sh::visit_interface (be_interface *node) << "ACE_ENV_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl << ");" << be_uidt_nl << be_nl; - // _downcast - *os << "virtual void* _downcast (" << be_idt << be_idt_nl - << "const char* logical_type_id" << be_uidt_nl - << ");" << be_uidt_nl << be_nl; +// // _downcast +// *os << "virtual void* _downcast (" << be_idt << be_idt_nl +// << "const char* logical_type_id" << be_uidt_nl +// << ");" << be_uidt_nl << be_nl; // Add a skeleton for our _is_a method. *os << "static void _is_a_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest &req," << be_nl - << "void *servant," << be_nl - << "void *servant_upcall" << be_nl + << "TAO_ServerRequest & req," << be_nl + << "void * servant_upcall," << be_nl + << "void * servant" << be_nl << "ACE_ENV_ARG_DECL" << be_uidt_nl << ");" << be_uidt_nl << be_nl; // Add a skeleton for our _non_existent method. *os << "static void _non_existent_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest &req," << be_nl - << "void *servant," << be_nl - << "void *servant_upcall" << be_nl + << "TAO_ServerRequest & req," << be_nl + << "void * servant_upcall," << be_nl + << "void * servant" << be_nl << "ACE_ENV_ARG_DECL" << be_uidt_nl << ");" << be_uidt_nl << be_nl; // Add a skeleton for our _interface method. *os << "static void _interface_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest &req," << be_nl - << "void *servant," << be_nl - << "void *servant_upcall" << be_nl + << "TAO_ServerRequest & req," << be_nl + << "void * servant_upcall," << be_nl + << "void * servant" << be_nl << "ACE_ENV_ARG_DECL" << be_uidt_nl << ");" << be_uidt_nl << be_nl; // Add a skeleton for our _component method. *os << "static void _component_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest &req," << be_nl - << "void *obj," << be_nl - << "void *servant_upcall" << be_nl + << "TAO_ServerRequest & req," << be_nl + << "void * servant_upcall," << be_nl + << "void * servant" << be_nl << "ACE_ENV_ARG_DECL" << be_uidt_nl << ");" << be_uidt_nl << be_nl; // Add the dispatch method. *os << "virtual void _dispatch (" << be_idt << be_idt_nl - << "TAO_ServerRequest &req," << be_nl - << "void *_servant_upcall" << be_nl + << "TAO_ServerRequest & req," << be_nl + << "void * servant_upcall" << be_nl << "ACE_ENV_ARG_DECL" << be_uidt_nl << ");" << be_uidt_nl << be_nl; @@ -238,9 +238,9 @@ be_visitor_interface_sh::visit_interface (be_interface *node) // Generate skeletons for operations of our base classes. These // skeletons just cast the pointer to the appropriate type // before invoking the call. - int status = + int status = node->traverse_inheritance_graph ( - be_interface::gen_skel_helper, + be_interface::gen_skel_helper, os ); @@ -270,7 +270,7 @@ be_visitor_interface_sh::visit_interface (be_interface *node) LM_ERROR, "be_visitor_interface_sh::" "visit_interface - " - "codegen for thru_poa_collocated class failed\n" + "codegen for strategized proxy broker class failed\n" ), -1 ); @@ -280,21 +280,21 @@ be_visitor_interface_sh::visit_interface (be_interface *node) ctx = *this->ctx_; // Generate the collocated class. - if (be_global->gen_thru_poa_collocation ()) - { - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_INTERFACE_THRU_POA_PROXY_IMPL_SH); - be_visitor_interface_thru_poa_proxy_impl_sh itppi_visitor (&ctx); - - if (node->accept (&itppi_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_interface_sh::" - "visit_interface - " - "codegen for thru_poa_collocated class failed\n"), - -1); - } - } +// if (be_global->gen_thru_poa_collocation ()) +// { +// ctx = *this->ctx_; +// ctx.state (TAO_CodeGen::TAO_INTERFACE_THRU_POA_PROXY_IMPL_SH); +// be_visitor_interface_thru_poa_proxy_impl_sh itppi_visitor (&ctx); + +// if (node->accept (&itppi_visitor) == -1) +// { +// ACE_ERROR_RETURN ((LM_ERROR, +// "be_visitor_interface_sh::" +// "visit_interface - " +// "codegen for thru_poa_collocated class failed\n"), +// -1); +// } +// } ctx = *this->ctx_; @@ -310,7 +310,7 @@ be_visitor_interface_sh::visit_interface (be_interface *node) LM_ERROR, "be_visitor_interface_sh::" "visit_interface - " - "codegen for thru_poa_collocated class failed\n" + "codegen for direct collocated class failed\n" ), -1 ); @@ -320,7 +320,7 @@ be_visitor_interface_sh::visit_interface (be_interface *node) return 0; } -int +int be_visitor_interface_sh::gen_abstract_ops_helper ( be_interface *node, be_interface *base, diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp index 793b46238a2..204c057dc5b 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp @@ -18,8 +18,8 @@ // // ============================================================================ -ACE_RCSID (be_visitor_interface, - interface_si, +ACE_RCSID (be_visitor_interface, + interface_si, "$Id$") @@ -39,8 +39,8 @@ be_visitor_interface_si::~be_visitor_interface_si (void) int be_visitor_interface_si::visit_interface (be_interface *node) { - if (node->srv_inline_gen () - || node->imported () + if (node->srv_inline_gen () + || node->imported () || node->is_local () || node->is_abstract ()) { @@ -50,7 +50,7 @@ be_visitor_interface_si::visit_interface (be_interface *node) TAO_OutStream *os = this->ctx_->stream (); // Determine if we are in some form of a multiple inheritance. - int status = + int status = node->traverse_inheritance_graph (be_interface::in_mult_inheritance_helper, 0); @@ -65,14 +65,14 @@ be_visitor_interface_si::visit_interface (be_interface *node) // Generate skeletons for operations of our base classes. These skeletons // just cast the pointer to the appropriate type before invoking the // call. Hence we generate these in the inline file. - status = node->traverse_inheritance_graph (be_interface::gen_skel_helper, + status = node->traverse_inheritance_graph (be_interface::gen_skel_helper, os); if (status == -1) { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_interface_si::" "visit_interface - " - "codegen for base class skeletons failed\n"), + "codegen for base class skeletons failed\n"), -1); } @@ -81,10 +81,11 @@ be_visitor_interface_si::visit_interface (be_interface *node) return -1; } - if (be_global->gen_thru_poa_collocation () - || be_global->gen_direct_collocation ()) + if (// be_global->gen_thru_poa_collocation () + // || + be_global->gen_direct_collocation ()) { - status = + status = node->traverse_inheritance_graph ( be_interface::gen_colloc_op_defn_helper, os @@ -133,4 +134,3 @@ be_visitor_interface_si::generate_amh_classes (be_interface *node) return 0; } - 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 2971e498bb4..2dc74e7175c 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp @@ -18,10 +18,16 @@ // // ============================================================================ +#include "global_extern.h" +#include "ast_generator.h" +#include "ast_string.h" + + ACE_RCSID (be_visitor_interface, interface_ss, "$Id$") + // ************************************************************ // Interface visitor for server skeletons. // ************************************************************ @@ -113,12 +119,13 @@ be_visitor_interface_ss::visit_interface (be_interface *node) *os << full_skel_name << "::" << local_name_prefix << node_local_name - << " (void)\n"; + << " (void)" << be_idt_nl; + + *os << ": TAO_ServantBase ()" << be_uidt_nl; - // Generate optable + // Default constructor body. *os << "{" << be_idt_nl - << "this->optable_ = &tao_" << flat_name - << "_optable;" << be_uidt_nl + << "this->optable_ = &tao_" << flat_name << "_optable;" << be_uidt_nl << "}" << be_nl << be_nl; // find if we are at the top scope or inside some module @@ -162,117 +169,254 @@ be_visitor_interface_ss::visit_interface (be_interface *node) << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; // Generate code for the _is_a skeleton. - *os << "void " << full_skel_name - << "::_is_a_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest &_tao_server_request, " << be_nl - << "void * _tao_servant," << be_nl - << "void * /* Servant_Upcall */" << be_nl - << "ACE_ENV_ARG_DECL" << be_uidt_nl - << ")" << be_uidt_nl; - *os << "{" << be_idt_nl; - *os << "TAO_InputCDR &_tao_in = _tao_server_request.incoming ();" - << be_nl << be_nl; + { + *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 + // underscore as an IDL escape. + Identifier op_name (ACE_OS::strdup (" _is_a")); + UTL_ScopedName scoped_name (&op_name, 0); + be_operation is_a (&rt, + AST_Operation::OP_noflags, + &scoped_name, + node->is_local (), + node->is_abstract ()); + is_a.set_defined_in (node); + + auto_ptr<AST_String> s ( + idl_global->gen ()->create_string ( + idl_global->gen ()->create_expr ((idl_uns_long) 0, + AST_Expression::EV_ulong))); + + Identifier arg_name (ACE_OS::strdup ("repository_id")); + UTL_ScopedName scoped_arg_name (&arg_name, 0); + be_argument repository_id (AST_Argument::dir_IN, + s.get (), + &scoped_arg_name); + + 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_); + + *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; + + this->generate_send_reply (os); + + *os << be_uidt_nl + << "}" << be_nl << be_nl; + } - *os << full_skel_name << " *_tao_impl =" << be_idt_nl - << "static_cast<" << full_skel_name - << " *> (_tao_servant);" << be_uidt_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 + // underscore as an IDL escape. + Identifier op_name (ACE_OS::strdup (" _non_existent")); + UTL_ScopedName scoped_name (&op_name, 0); + be_operation non_existent (&rt, + AST_Operation::OP_noflags, + &scoped_name, + node->is_local (), + node->is_abstract ()); + non_existent.set_defined_in (node); - *os << "CORBA::Boolean _tao_retval = 0;" << be_nl; - *os << "CORBA::String_var value;" << be_nl << be_nl; + be_visitor_operation_upcall_command_ss upcall_command_visitor (this->ctx_); + upcall_command_visitor.visit (&non_existent, full_skel_name); - *os << "if (!(_tao_in >> value.out ()))" << be_idt_nl - << "{" << be_idt_nl; + // Generate exception list. + be_visitor_operation_exceptlist_ss exception_list (this->ctx_); + exception_list.visit_operation (&non_existent); - if (be_global->use_raw_throw ()) - { - *os << "throw CORBA::MARSHAL ();" ; - } - else - { - *os << "ACE_THROW (CORBA::MARSHAL ());"; - } + be_visitor_operation_ss op_visitor (this->ctx_); - *os << be_uidt_nl - << "}" << be_uidt_nl << be_nl; + *os << "TAO::SArg_Traits< "; - *os << "_tao_retval = _tao_impl->_is_a (value.in () ACE_ENV_ARG_PARAMETER);" - << be_nl; - *os << "ACE_CHECK;" << be_nl << be_nl; - *os << "_tao_server_request.init_reply ();" << be_nl; - *os << "TAO_OutputCDR &_tao_out = _tao_server_request.outgoing ();" - << be_nl << be_nl; + op_visitor.gen_arg_template_param_name (&non_existent, + &rt, + os); - *os << "if (!(_tao_out << CORBA::Any::from_boolean (_tao_retval)))" - << be_idt_nl - << "{" << be_idt_nl; + *os << ">::ret_val retval;"; - if (be_global->use_raw_throw ()) - { - *os << "throw CORBA::MARSHAL ();"; - } - else - { - *os << "ACE_THROW (CORBA::MARSHAL ());"; - } + op_visitor.gen_skel_body_arglist (&non_existent, + os); - *os << be_uidt_nl - << "}" << be_uidt; + *os << be_nl << be_nl + << "TAO::Argument * const args[] =" << be_idt_nl + << "{" << be_idt_nl + << "&retval" + << be_uidt_nl + << "};" << be_uidt_nl << be_nl; - this->generate_send_reply (os); + *os << "static size_t const nargs = 1;" << be_nl << be_nl; - *os << be_uidt_nl - << "}" << 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"; - // Generate code for the _non_existent skeleton. - *os << "void " << full_skel_name - << "::_non_existent_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest &_tao_server_request, " << be_nl - << "void * _tao_servant," << 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 << " *_tao_impl =" << be_idt_nl - << "static_cast<" << full_skel_name - << " *> (_tao_servant);" << be_uidt_nl << be_nl; + 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; - *os << "CORBA::Boolean _tao_retval =" << be_idt_nl - << "_tao_impl->_non_existent (ACE_ENV_SINGLE_ARG_PARAMETER);" - << be_uidt_nl; - *os << "ACE_CHECK;" << be_nl << be_nl; + if (be_global->gen_thru_poa_collocation ()) + *os << "server_request.operation_details ()," << be_nl; - *os << "_tao_server_request.init_reply ();" << be_nl; - *os << "TAO_OutputCDR &_tao_out = _tao_server_request.outgoing ();" - << be_nl << be_nl; + *os << "args"; + } - *os << "if (!(_tao_out << CORBA::Any::from_boolean (_tao_retval)))" - << be_idt_nl - << "{" << be_idt_nl; + *os << ");" << be_uidt_nl << be_nl; - if (be_global->use_raw_throw ()) - { - *os << "throw CORBA::MARSHAL ();"; - } - else - { - *os << "ACE_THROW (CORBA::MARSHAL ());"; - } + *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_uidt; + this->generate_send_reply (os); - this->generate_send_reply (os); + *os << be_uidt_nl + << "}" << be_nl << be_nl; - *os << be_uidt_nl - << "}" << be_nl << be_nl; + } + + *os << be_nl << be_nl << "// TAO_IDL - Generated from " << be_nl + << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; + // @@ 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. - *os << "void " << full_skel_name +// { +// 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 (&get_interface, full_skel_name); +// } + + *os << be_nl << be_nl + << "void " << full_skel_name << "::_interface_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest &_tao_server_request, " << be_nl - << "void * _tao_servant," << be_nl - << "void * /* Servant_Upcall */" << be_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; @@ -283,20 +427,24 @@ be_visitor_interface_ss::visit_interface (be_interface *node) << ");" << be_uidt_nl << be_uidt_nl; *os << "if (_tao_adapter == 0)" << be_idt_nl << "{" << be_idt_nl - << "ACE_THROW (CORBA::INTF_REPOS ());" << be_uidt_nl + << "ACE_THROW (CORBA::INTF_REPOS (CORBA::OMGVMCID | 1," << be_nl + << " CORBA::COMPLETED_NO));" << be_uidt_nl << "}" << be_uidt_nl << be_nl; - *os << full_skel_name << " *_tao_impl =" << be_idt_nl - << "static_cast<" << full_skel_name - << " *> (_tao_servant);" << be_uidt_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; *os << "CORBA::InterfaceDef_ptr _tao_retval = " << be_idt_nl - << "_tao_impl->_get_interface (ACE_ENV_SINGLE_ARG_PARAMETER);" + << "impl->_get_interface (ACE_ENV_SINGLE_ARG_PARAMETER);" << be_uidt_nl << "ACE_CHECK;" << be_nl << be_nl - << "_tao_server_request.init_reply ();" << be_nl - << "TAO_OutputCDR &_tao_out = _tao_server_request.outgoing ();" + << "server_request.init_reply ();" << be_nl + << "TAO_OutputCDR &_tao_out = *server_request.outgoing ();" << be_nl << be_nl - << "CORBA::Boolean _tao_result =" << be_idt_nl + << "CORBA::Boolean const _tao_result =" << be_idt_nl << "_tao_adapter->interfacedef_cdr_insert (" << be_idt << be_idt_nl << "_tao_out," << be_nl << "_tao_retval" << be_uidt_nl @@ -313,47 +461,103 @@ 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 &_tao_server_request, " << be_nl - << "void * _tao_object_reference," << 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 << " *_tao_impl =" << be_idt_nl - << "static_cast<" << full_skel_name - << " *> (_tao_object_reference);" << be_uidt_nl << be_nl; - - *os << "CORBA::Object_var _tao_retval =" << be_idt_nl - << "_tao_impl->_get_component (ACE_ENV_SINGLE_ARG_PARAMETER);" - << be_uidt_nl; - *os << "ACE_CHECK;" << be_nl << be_nl; - - *os << "_tao_server_request.init_reply ();" << be_nl; - *os << "TAO_OutputCDR &_tao_out = _tao_server_request.outgoing ();" - << be_nl << be_nl; - - *os << "if (!(_tao_out << _tao_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; - - this->generate_send_reply (os); - - *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 + << "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_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 (&get_component, full_skel_name); + + // 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 (&get_component, + &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 << 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 (!get_component.void_return_type () + || get_component.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 _is_a override. @@ -393,32 +597,32 @@ be_visitor_interface_ss::visit_interface (be_interface *node) << ");" << be_uidt << be_uidt_nl << "}" << be_nl << be_nl; - // the downcast method. - *os << "void* " << full_skel_name - << "::_downcast (" << be_idt << be_idt_nl - << "const char* logical_type_id" << be_uidt_nl - << ")" << be_uidt_nl - << "{" << be_idt_nl; - - if (this->generate_downcast_implementation (node, os) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_interface_ss::" - "visit_interface - " - "traverse for downcast implementation failed\n"), - -1); - } - - *os << "if (ACE_OS::strcmp (logical_type_id," << be_nl - << " \"IDL:omg.org/CORBA/Object:1.0\") == 0)" - << be_idt_nl - << "{" << be_idt_nl - << "return static_cast<PortableServer::Servant> (this);" - << be_uidt_nl - << "}" << be_uidt_nl << be_nl; - - *os << "return 0;" << be_uidt_nl - << "}" << be_nl << be_nl; +// // the downcast method. +// *os << "void* " << full_skel_name +// << "::_downcast (" << be_idt << be_idt_nl +// << "const char* logical_type_id" << be_uidt_nl +// << ")" << be_uidt_nl +// << "{" << be_idt_nl; + +// if (this->generate_downcast_implementation (node, os) == -1) +// { +// ACE_ERROR_RETURN ((LM_ERROR, +// "be_visitor_interface_ss::" +// "visit_interface - " +// "traverse for downcast implementation failed\n"), +// -1); +// } + +// *os << "if (ACE_OS::strcmp (logical_type_id," << be_nl +// << " \"IDL:omg.org/CORBA/Object:1.0\") == 0)" +// << be_idt_nl +// << "{" << be_idt_nl +// << "return static_cast<PortableServer::Servant> (this);" +// << be_uidt_nl +// << "}" << be_uidt_nl << be_nl; + +// *os << "return 0;" << be_uidt_nl +// << "}" << be_nl << be_nl; *os << "const char* " << full_skel_name << "::_interface_repository_id (void) const" @@ -577,8 +781,8 @@ be_visitor_interface_ss::dispatch_method (be_interface *node) *os << "void " << node->full_skel_name () << "::_dispatch (" << be_idt << be_idt_nl - << "TAO_ServerRequest &req," << be_nl - << "void *servant_upcall" << be_nl + << "TAO_ServerRequest & req," << be_nl + << "void * servant_upcall" << be_nl << "ACE_ENV_ARG_DECL" << be_uidt_nl << ")" << be_uidt_nl; *os << "{" << be_idt_nl; @@ -608,18 +812,6 @@ be_visitor_interface_ss::generate_proxy_classes (be_interface *node) TAO_OutStream *os = this->ctx_->stream (); be_visitor_context ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SS); - be_visitor_interface_interceptors_ss ii_visitor (&ctx); - - if (node->accept (&ii_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_interface_cs::" - "generate_proxy_classes - " - "codegen for interceptors classes failed\n"), - -1); - } - // Strategized Proxy Broker Implementation. if (be_global->gen_thru_poa_collocation () || be_global->gen_direct_collocation ()) @@ -690,21 +882,21 @@ be_visitor_interface_ss::generate_proxy_classes (be_interface *node) // Proxy Impl Implementations. - if (be_global->gen_thru_poa_collocation ()) - { - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_INTERFACE_THRU_POA_PROXY_IMPL_SS); - be_visitor_interface_thru_poa_proxy_impl_ss itppi_visitor (&ctx); - - if (node->accept (&itppi_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_interface_cs::" - "generate_proxy_classes - " - "codegen for Base Proxy Broker class failed\n"), - -1); - } - } +// if (be_global->gen_thru_poa_collocation ()) +// { +// ctx = *this->ctx_; +// ctx.state (TAO_CodeGen::TAO_INTERFACE_THRU_POA_PROXY_IMPL_SS); +// be_visitor_interface_thru_poa_proxy_impl_ss itppi_visitor (&ctx); + +// if (node->accept (&itppi_visitor) == -1) +// { +// ACE_ERROR_RETURN ((LM_ERROR, +// "be_visitor_interface_cs::" +// "generate_proxy_classes - " +// "codegen for Base Proxy Broker class failed\n"), +// -1); +// } +// } if (be_global->gen_direct_collocation ()) { @@ -725,13 +917,13 @@ be_visitor_interface_ss::generate_proxy_classes (be_interface *node) return 0; } -int -be_visitor_interface_ss::generate_downcast_implementation (be_interface *node, - TAO_OutStream *os) -{ - return node->traverse_inheritance_graph (be_interface::downcast_helper, - os); -} +// int +// be_visitor_interface_ss::generate_downcast_implementation (be_interface *node, +// TAO_OutStream *os) +// { +// return node->traverse_inheritance_graph (be_interface::downcast_helper, +// os); +// } int be_visitor_interface_ss::generate_copy_ctor (be_interface *node, 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 64c97461afb..903e6d61aac 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 @@ -94,41 +94,23 @@ be_visitor_interface_strategized_proxy_broker_ss::visit_interface ( << ")" << be_nl << "ACE_THROW_SPEC ((CORBA::Exception))" << be_uidt_nl << "{" << be_idt_nl - << "TAO::Portable_Server::Servant_Upcall servant_upcall (" - << be_idt << be_idt_nl - << "obj->_stubobj ()" - << "->servant_orb_var ()->orb_core ()" - << be_uidt_nl - << ");" << be_uidt_nl << be_nl +// << "TAO::Portable_Server::Servant_Upcall servant_upcall (" +// << be_idt << be_idt_nl +// << "obj->_stubobj ()" +// << "->servant_orb_var ()->orb_core ()" +// << be_uidt_nl +// << ");" << be_uidt_nl << be_nl + << "TAO_Abstract_ServantBase * const servant =" + << " obj->_servant ();" << be_nl + << be_nl << "TAO_Collocated_Skeleton collocated_skel;" << be_nl - << "TAO_Abstract_ServantBase *servant = 0;" << be_nl << be_nl - << "if (strategy == TAO::TAO_CS_THRU_POA_STRATEGY)" << be_idt_nl - << "{" << be_idt_nl - << "servant_upcall.prepare_for_upcall (" << be_idt << be_idt_nl - << "obj->_stubobj ()->object_key ()," << be_nl - << "op," << be_nl - << "forward_obj" << be_nl - << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl - << ");" << be_uidt_nl - << "ACE_CHECK;" << be_nl << be_nl - << "servant_upcall.pre_invoke_collocated_request (" - << be_idt << be_idt_nl - << "ACE_ENV_SINGLE_ARG_PARAMETER" << be_uidt_nl - << ");" << be_uidt_nl - << "ACE_CHECK;" << be_nl << be_nl - << "servant = servant_upcall.servant ();" << be_uidt_nl - << "}" << be_uidt_nl - << "else" << be_idt_nl - << "{" << be_idt_nl - << "servant = obj->_servant ();" << be_uidt_nl - << "}" << be_uidt_nl << be_nl - << "int status = servant->_find (op," << be_nl - << " collocated_skel," << be_nl - << " strategy," << be_nl - << " op_len);" << be_nl << be_nl + << "int const status = servant->_find (op," << be_nl + << " collocated_skel," << be_nl + << " strategy," << be_nl + << " 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 << "ACE_TRY" << be_idt_nl diff --git a/TAO/TAO_IDL/be/be_visitor_module.cpp b/TAO/TAO_IDL/be/be_visitor_module.cpp index 296a97fb111..34400b57b7b 100644 --- a/TAO/TAO_IDL/be/be_visitor_module.cpp +++ b/TAO/TAO_IDL/be/be_visitor_module.cpp @@ -70,4 +70,3 @@ ACE_RCSID (be, be_visitor_module, "$Id$") - diff --git a/TAO/TAO_IDL/be/be_visitor_operation.cpp b/TAO/TAO_IDL/be/be_visitor_operation.cpp index 07e7ef11fd9..cccdeb5ec0b 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation.cpp @@ -58,6 +58,7 @@ #include "be_visitor_operation/argument_invoke.cpp" #include "be_visitor_operation/argument_marshal.cpp" #include "be_visitor_operation/exceptlist_cs.cpp" +#include "be_visitor_operation/exceptlist_ss.cpp" #include "be_visitor_operation/operation_ch.cpp" #include "be_visitor_operation/operation_cs.cpp" #include "be_visitor_operation/operation_sh.cpp" @@ -73,6 +74,7 @@ #include "be_visitor_operation/rettype_vardecl_ss.cpp" #include "be_visitor_operation/tie_sh.cpp" #include "be_visitor_operation/tie_si.cpp" +#include "be_visitor_operation/upcall_command_ss.cpp" // AMI #include "be_visitor_operation/ami_ch.cpp" @@ -85,14 +87,6 @@ #include "be_visitor_operation/smart_proxy_ch.cpp" #include "be_visitor_operation/smart_proxy_cs.cpp" -// Interceptors -#include "be_visitor_operation/interceptors_arglist.cpp" -#include "be_visitor_operation/interceptors_sh.cpp" -#include "be_visitor_operation/interceptors_ss.cpp" -#include "be_visitor_operation/interceptors_exceptlist.cpp" -#include "be_visitor_operation/interceptors_info_rettype.cpp" -#include "be_visitor_operation/interceptors_result.cpp" - // Collocation #include "be_visitor_operation/proxy_impl_xh.cpp" #include "be_visitor_operation/thru_poa_proxy_impl_ss.cpp" @@ -104,6 +98,6 @@ #include "be_visitor_operation/amh_rh_ss.cpp" #include "be_visitor_operation/amh_rh_sh.cpp" -ACE_RCSID (be, - be_visitor_operation, +ACE_RCSID (be, + be_visitor_operation, "$Id$") 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/direct_proxy_impl_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/direct_proxy_impl_ss.cpp index 31a5efbdafb..12d05031c93 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/direct_proxy_impl_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/direct_proxy_impl_ss.cpp @@ -100,12 +100,9 @@ be_visitor_operation_direct_proxy_impl_ss::visit_operation ( *os << ">::ret_val *) args[0])->arg () =" << be_idt_nl; } - *os << "reinterpret_cast<" << be_idt << be_idt_nl + *os << "dynamic_cast<" << be_idt << be_idt_nl << intf->full_skel_name () << "_ptr> (" << be_nl - << "servant->_downcast (" << be_idt << be_idt_nl - << "\"" << intf->repoID () << "\"" << be_uidt_nl - << ")" << be_uidt << be_uidt_nl - << ")" << be_uidt; + << "servant)" << be_uidt << be_uidt_nl; be_visitor_context ctx; @@ -126,7 +123,7 @@ be_visitor_operation_direct_proxy_impl_ss::visit_operation ( *os << "ACE_CHECK;"; } *os << be_uidt_nl - << "}"; + << "}" << be_nl; return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_operation/exceptlist_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/exceptlist_ss.cpp new file mode 100644 index 00000000000..36fbf8cfaae --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_operation/exceptlist_ss.cpp @@ -0,0 +1,85 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// exceptlist_ss.cpp +// +// = DESCRIPTION +// Visitor generating code for the list of exceptions that an operation +// raises (skeleton/server side). +// +// = AUTHOR +// Ossama Othman +// +// ============================================================================ + +ACE_RCSID (be_visitor_operation, + exceptlist_ss, + "$Id$") + +// **************************************************************************** +// visitor to generate the exception list for operations (skeleton/server_side) +// **************************************************************************** + +be_visitor_operation_exceptlist_ss::be_visitor_operation_exceptlist_ss ( + be_visitor_context *ctx + ) + : be_visitor_decl (ctx) +{ +} + +be_visitor_operation_exceptlist_ss::~be_visitor_operation_exceptlist_ss (void) +{ +} + +int +be_visitor_operation_exceptlist_ss::visit_operation (be_operation * node) +{ + TAO_OutStream * const os = this->ctx_->stream (); + + *os << be_nl + << "\n#if TAO_HAS_INTERCEPTORS == 1" << be_nl; + + // Don't do anything if the exception list is empty. + if (node->exceptions ()) + { + *os << "static CORBA::TypeCode_ptr const exceptions[] = " << be_idt_nl; + *os << "{" << be_idt_nl; + + // Initialize an iterator to iterate thru the exception list. + // Continue until each element is visited. + // Iterator must be advanced explicitly inside the loop. + for (UTL_ExceptlistActiveIterator ei (node->exceptions ()); + !ei.is_done ();) + { + be_exception * ex = be_exception::narrow_from_decl (ei.item ()); + + *os << ex->tc_name (); + + ei.next (); + + if (!ei.is_done ()) + { + *os << "," << be_nl; + } + } + + *os << be_uidt_nl << "};" << be_uidt_nl + << "static size_t const nexceptions = " + << node->exceptions()->length () << ";"; + } + else + { + *os << "static CORBA::TypeCode_ptr const exceptions[] = {};" + << be_nl + << "static size_t const nexceptions = 0;"; + } + + *os << "\n#endif /* TAO_HAS_INTERCEPTORS */" << be_nl << be_nl; + + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_arglist.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_arglist.cpp deleted file mode 100644 index b68edb7616c..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_arglist.cpp +++ /dev/null @@ -1,306 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// interceptors_arglist.cpp -// -// = DESCRIPTION -// Visitor generating code for the parameter list of the Operation signature. -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// ============================================================================ - -ACE_RCSID (be_visitor_operation, - interceptors_arglist, - "$Id$") - -// ************************************************************ -// Operation visitor to generate the argument list. -// We have separated code generation for this from the 4 main -// visitors to avoid code duplication and tight coupling. -// ************************************************************ - -be_visitor_operation_interceptors_arglist:: -be_visitor_operation_interceptors_arglist (be_visitor_context *ctx) - : be_visitor_operation (ctx) -{ -} - -be_visitor_operation_interceptors_arglist:: -~be_visitor_operation_interceptors_arglist (void) -{ -} - -int -be_visitor_operation_interceptors_arglist::visit_operation ( - be_operation *node - ) -{ - TAO_OutStream *os = this->ctx_->stream (); - - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_interceptors_arglist::" - "visit_operation - " - "codegen for scope failed\n"), - -1); - } - - if (!be_global->exception_support ()) - { - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_SH: - case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_PARAMLIST: - case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARG_INFO_SS: - break; - case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_SS: - { - *os << be_nl << "ACE_ENV_ARG_PARAMETER"; - break; - } - case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_SS: - { - // Last argument - is always CORBA::Environment. - *os << be_nl << "ACE_ENV_ARG_DECL_NOT_USED"; - break; - } - case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_SH: - { - // @@ Do it for all cases i.e arg count > = 0 - - // Last argument - is always CORBA::Environment. - *os << be_nl << "ACE_ENV_ARG_DECL_WITH_DEFAULTS"; - break; - } - default: - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interceptors_arglist::" - "visit_operation - " - "Bad context\n"), - -1); - } - } - } - - return 0; -} - -int -be_visitor_operation_interceptors_arglist::pre_process (be_decl *bd) -{ - TAO_OutStream *os = this->ctx_->stream (); - be_argument *arg = be_argument::narrow_from_decl (bd); - - if (!arg) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) " - "be_visitor_operation_argument_invoke" - "::post_process - " - "Bad argument node\n"), - -1); - } - - if (arg->direction () == AST_Argument::dir_OUT) - { - return 0; - } - - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_SH: - case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_SS: - case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARG_INFO_SS: - case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_SS: - { - // If we are not the last node in the list of arguments, generate a comma - // else decide if we are generating code to support true exceptions - in - // which case there will not be any CORBA::Environment parameter. - *os << ","; - break; - } - case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_PARAMLIST: - case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_SH: - break; - default: - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interceptors_arglist::" - "post_process - " - "Bad context\n"), - -1); - } - - } - - return 0; -} - -int -be_visitor_operation_interceptors_arglist::visit_argument (be_argument *node) -{ - // Get the visitor that will dump the argument's mapping in the operation - // signature. - be_visitor_context ctx (*this->ctx_); - - // First grab the interface definition inside which this operation is - // defined. We need this since argument types may very well be declared - // inside the scope of the interface node. In such cases, we would like to - // generate the appropriate relative scoped names. - be_operation *op = this->ctx_->be_scope_as_operation (); - - if (op == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interceptors_arglist::" - "visit_argument - " - "Bad operation\n"), - -1); - } - - // We don't generate the "out" args as part of arglist - if (node->direction () == AST_Argument::dir_OUT) - { - return 0; - } - - // We need the interface node in which this operation was defined. However, - // if this operation node was an attribute node in disguise, we get this - // information from the context. - be_interface *intf = this->ctx_->attribute () - ? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ()) - : be_interface::narrow_from_scope (op->defined_in ()); - - if (!intf) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interceptors_arglist::" - "visit_argument - " - "Bad interface\n"), - -1); - } - - ctx.scope (intf); - int status = 0; - - TAO_OutStream *os = this->ctx_->stream (); - - *os << be_nl; - - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_SH: - case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_SS: - { - be_visitor_args_request_info_arglist visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_PARAMLIST: - { - be_visitor_args_paramlist visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_SH: - { - be_visitor_args_request_info_sh visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARG_INFO_SS: - { - ctx.state (TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_ARGLIST_SS); - be_visitor_args_request_info_ss visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_SS: - { - be_visitor_args_upcall_ss visitor (&ctx); - status = node->accept (&visitor); - break; - } - default: - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interceptors_arglist::" - "visit_argument - " - "Bad context\n"), - -1); - } - } - - if (status == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interceptors_arglist::" - "visit_argument - " - "codegen for interceptors_arglist failed\n"), - -1); - } - - return 0; -} - -int -be_visitor_operation_interceptors_arglist::post_process (be_decl *bd) -{ - TAO_OutStream *os = this->ctx_->stream (); - be_argument *arg = be_argument::narrow_from_decl (bd); - - if (!arg) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) " - "be_visitor_operation_argument_invoke" - "::post_process - " - "Bad argument node\n"), - -1); - } - - if (arg->direction () != AST_Argument::dir_OUT) - { - return 0; - } - - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_SH: - case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_PARAMLIST: - case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_SH: - case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARG_INFO_SS: - case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_SS: - case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_SS: - { - if (!this->last_node (bd)) - { - os->indent (); - *os << "\n"; - } - break; - } - default: - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interceptors_arglist::" - "post_process - " - "Bad context\n"), - -1); - } - - } - - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ch.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ch.cpp deleted file mode 100644 index d0632d128ac..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ch.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// operation_interceptors_ch.cpp -// -// = DESCRIPTION -// Visitor generating code for Operation node in the client header. -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// ============================================================================ - -ACE_RCSID (be_visitor_operation, - operation_interceptors_ch, - "$Id$") - -// ****************************************************** -// primary visitor for "operation" in client header -// ****************************************************** - -be_visitor_operation_interceptors_ch::be_visitor_operation_interceptors_ch ( - be_visitor_context *ctx - ) - : be_visitor_operation (ctx) -{ -} - -be_visitor_operation_interceptors_ch::~be_visitor_operation_interceptors_ch ( - void - ) -{ -} - -int -be_visitor_operation_interceptors_ch::visit_operation (be_operation *) -{ - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_cs.cpp deleted file mode 100644 index a53f97e43ef..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_cs.cpp +++ /dev/null @@ -1,891 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// operation_interceptors_cs.cpp -// -// = DESCRIPTION -// Visitor generating code for Operation node in the client stubs. -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// ============================================================================ - -ACE_RCSID (be_visitor_operation, - operation_interceptors_cs, - "$Id$") - -// ****************************************************** -// Primary visitor for "operation" in client header -// ****************************************************** - -be_visitor_operation_interceptors_cs::be_visitor_operation_interceptors_cs ( - be_visitor_context *ctx - ) - : be_visitor_operation (ctx) -{ -} - -be_visitor_operation_interceptors_cs::~be_visitor_operation_interceptors_cs ( - void - ) -{ -} - -int -be_visitor_operation_interceptors_cs::visit_operation (be_operation *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - if (this->generate_class_declaration (os, node) == -1) - { - return -1; - } - - if (this->generate_class_definition (os, node) == -1) - { - return -1; - } - - return 0; -} - -int -be_visitor_operation_interceptors_cs::generate_class_declaration ( - TAO_OutStream *os, - be_operation *node - ) -{ - be_type *bt = 0; - be_visitor_context ctx (*this->ctx_); - - // Save the node. - this->ctx_->node (node); - - // Generate the ClientRequestInfo object per operation to - // be used by the interceptors. - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__; - - *os << be_nl << be_nl - << "class TAO_ClientRequestInfo_" << node->flat_name (); - - // We need the interface node in which this operation was defined. However, - // if this operation node was an attribute node in disguise, we get this - // information from the context and add a "_get"/"_set" to the flat - // name to get around the problem of overloaded methods which are - // generated for attributes. - if (this->ctx_->attribute ()) - { - bt = be_type::narrow_from_decl (node->return_type ()); - - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interceptors_ch::" - "visit_operation - " - "Bad return type\n"), - -1); - } - - // Grab the right visitor to generate the return type if its not - // void it means it is not the accessor. - if (!this->void_return_type (bt)) - { - *os << "_get"; - } - else - { - *os << "_set"; - } - } - - *os << " : public TAO_ClientRequestInfo_i" << be_nl - << "{" << be_nl - << "public:" << be_idt_nl; - - *os << "TAO_ClientRequestInfo_" << node->flat_name (); - - // We need the interface node in which this operation was defined. However, - // if this operation node was an attribute node in disguise, we get this - // information from the context and add a "_get"/"_set" to the flat - // name to get around the problem of overloaded methods which are - // generated for attributes. - if (this->ctx_->attribute ()) - { - bt = be_type::narrow_from_decl (node->return_type ()); - - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interceptors_ch::" - "visit_operation - " - "Bad return type\n"), - -1); - } - - // Grab the right visitor to generate the return type if its not - // void it means it is not the accessor. - if (!this->void_return_type (bt)) - { - *os << "_get"; - } - else - { - *os << "_set"; - } - } - - *os << " (" << be_idt << be_idt_nl - << "TAO_GIOP_Invocation *_tao_invocation," << be_nl; - - if (node->defined_in ()->is_abstract ()) - { - *os << "CORBA::AbstractBase_ptr _tao_target"; - } - else - { - *os << "CORBA::Object_ptr _tao_target"; - } - - // Generate the argument list with the appropriate mapping. For these - // we grab a visitor that generates the parameter listing. - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_CH); - be_visitor_operation_interceptors_arglist oia_visitor (&ctx); - - if (node->accept (&oia_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_interceptors_ch::" - "visit_operation - " - "codegen for argument list failed\n"), - -1); - } - - if (be_global->exception_support ()) - { - *os << be_uidt; - } - - *os << ");\n" << be_uidt_nl; - - // Here I still need to generate the other methods + private args. - *os << "virtual Dynamic::ParameterList * arguments " - << "(ACE_ENV_SINGLE_ARG_DECL)" << be_idt_nl - << "ACE_THROW_SPEC ((CORBA::SystemException));" - << be_uidt_nl << be_nl; - - *os << "virtual Dynamic::ExceptionList * exceptions " - << "(ACE_ENV_SINGLE_ARG_DECL)" << be_idt_nl - << "ACE_THROW_SPEC ((CORBA::SystemException));" - << be_uidt_nl << be_nl; - - *os << "virtual CORBA::Any * result " - << "(ACE_ENV_SINGLE_ARG_DECL)" << be_idt_nl - << "ACE_THROW_SPEC ((CORBA::SystemException));\n" - << be_uidt; - - // Store the result for later use. - // generate the return type. - bt = be_type::narrow_from_decl (node->return_type ()); - AST_Decl::NodeType nt = bt->node_type (); - - if (nt == AST_Decl::NT_typedef) - { - be_typedef *td = be_typedef::narrow_from_decl (bt); - nt = td->base_node_type (); - } - - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interceptors_ch::" - "visit_operation - " - "Bad return type\n"), - -1); - } - - idl_bool void_return_type = this->void_return_type (bt); - - // Grab the right visitor to generate the return type if its not - // void since we can't have a private member to be of void type. - if (! void_return_type) - { - *os << be_nl << "void result ("; - - if (nt != AST_Decl::NT_string) - { - *os << "::"; - } - - ctx = *this->ctx_; - be_visitor_operation_interceptors_info_rettype oiir_visitor (&ctx); - - if (bt->accept (&oiir_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_cs::" - "visit_operation - " - "codegen for retval pre invoke failed\n"), - -1); - } - - *os << " result);" << be_nl; - } - - *os << be_uidt_nl << "private:" << be_idt_nl; - *os << "TAO_ClientRequestInfo_" << node->flat_name (); - - // We need the interface node in which this operation was defined. However, - // if this operation node was an attribute node in disguise, we get this - // information from the context and add a "_get"/"_set" to the flat - // name to get around the problem of overloaded methods which are - // generated for attributes. - if (this->ctx_->attribute ()) - { - // Grab the right visitor to generate the return type if its not - // void it means it is not the accessor. - if (! void_return_type) - { - *os << "_get"; - } - else - { - *os << "_set"; - } - } - - *os << " (const " << "TAO_ClientRequestInfo_" << node->flat_name (); - - // We need the interface node in which this operation was defined. However, - // if this operation node was an attribute node in disguise, we get this - // information from the context and add a "_get"/"_set" to the flat - // name to get around the problem of overloaded methods which are - // generated for attributes. - if (this->ctx_->attribute ()) - { - // Grab the right visitor to generate the return type if its not - // void it means it is not the accessor. - if (! void_return_type) - { - *os << "_get"; - } - else - { - *os << "_set"; - } - } - - *os << " &);" << be_nl - << "void operator= (const " - << "TAO_ClientRequestInfo_"<< node->flat_name (); - - // We need the interface node in which this operation was defined. However, - // if this operation node was an attribute node in disguise, we get this - // information from the context and add a "_get"/"_set" to the flat - // name to get around the problem of overloaded methods which are - // generated for attributes. - if (this->ctx_->attribute ()) - { - // Grab the right visitor to generate the return type if its not - // void it means it is not the accessor. - if (! void_return_type) - { - *os << "_get"; - } - else - { - *os << "_set"; - } - } - - *os << " &);"; - - // Need to generate the args as reference memebers... - // Generate the member list with the appropriate mapping. For these - // we grab a visitor that generates the parameter listing and - // modify it to generate reference members. - ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_CH); - be_visitor_operation_interceptors_arglist oiia_visitor (&ctx); - - if (node->accept (&oiia_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_interceptors_ch::" - "visit_operation - " - "codegen for argument list failed\n"), - -1); - } - - // Generate the result data member. - // Generate the return type. - // Grab the right visitor to generate the return type if it's not - // void since we can't have a private member to be of void type. - if (! void_return_type) - { - *os << be_nl << be_nl; - - // Guards against a return type called 'result'. - if (nt != AST_Decl::NT_string) - { - *os << "::"; - } - - ctx = *this->ctx_; - be_visitor_operation_interceptors_info_rettype toiir_visitor (&ctx); - - if (bt->accept (&toiir_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_cs::" - "visit_operation - " - "codegen for retval pre invoke failed\n"), - -1); - } - - *os << " _result;"; - } - - *os << be_uidt_nl << "};"; - - return 0; -} - -int -be_visitor_operation_interceptors_cs::generate_class_definition ( - TAO_OutStream *os, - be_operation *node - ) -{ - be_type *bt = 0; - be_visitor_context ctx (*this->ctx_); - - // Save the node. - this->ctx_->node (node); - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__; - - *os << be_nl << be_nl - << "TAO_ClientRequestInfo_"<< node->flat_name (); - - // We need the interface node in which this operation was defined. However, - // if this operation node was an attribute node in disguise, we get this - // information from the context and add a "_get"/"_set" to the flat - // name to get around the problem of overloaded methods which are - // generated for attributes. - if (this->ctx_->attribute ()) - { - bt = be_type::narrow_from_decl (node->return_type ()); - - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interceptors_ch::" - "visit_operation - " - "Bad return type\n"), - -1); - } - - // Grab the right visitor to generate the return type if its not - // void it means it is not the accessor. - if (!this->void_return_type (bt)) - { - *os << "_get"; - } - else - { - *os << "_set"; - } - } - - *os << "::" - << "TAO_ClientRequestInfo_"<< node->flat_name (); - - // We need the interface node in which this operation was defined. However, - // if this operation node was an attribute node in disguise, we get this - // information from the context and add a "_get"/"_set" to the flat - // name to get around the problem of overloaded methods which are - // generated for attributes. - if (this->ctx_->attribute ()) - { - bt = be_type::narrow_from_decl (node->return_type ()); - - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interceptors_ch::" - "visit_operation - " - "Bad return type\n"), - -1); - } - - // Grab the right visitor to generate the return type if its not - // void it means it is not the accessor. - if (!this->void_return_type (bt)) - { - *os << "_get"; - } - else - { - *os << "_set"; - } - } - - *os << " (" << be_idt << be_idt_nl - << "TAO_GIOP_Invocation *_tao_invocation," << be_nl; - - if (node->defined_in ()->is_abstract ()) - { - *os << "CORBA::AbstractBase_ptr _tao_target"; - } - else - { - *os << "CORBA::Object_ptr _tao_target"; - } - - // Generate the argument list with the appropriate mapping. For these - // we grab a visitor that generates the parameter listing. - - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_CS); - be_visitor_operation_interceptors_arglist toiia_visitor (&ctx); - - if (node->accept (&toiia_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_cs::" - "visit_operation - " - "codegen for argument pre invoke failed\n"), - -1); - } - - os->indent (); - *os << be_uidt_nl << ")" << be_uidt_nl; - - // Generate the member list and set each member but before that, - // its necessary to pass on some args to the base class. - os->indent (); - *os << " : TAO_ClientRequestInfo_i (_tao_invocation, _tao_target)"; - - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARG_INFO_CS); - be_visitor_operation_interceptors_arglist oiai_visitor (&ctx); - - if (node->accept (&oiai_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_cs::" - "visit_operation - " - "codegen for argument pre invoke failed\n"), - -1); - } - - os->decr_indent (); - *os << be_nl << "{}\n\n"; - - // ----------------------------------------------------------------- - // PortableInterceptor::ClientRequestInfo::arguments() - // ----------------------------------------------------------------- - *os << "Dynamic::ParameterList *" << be_nl; - - // The interceptors cant modify "in" and "out" parameters. - *os << "TAO_ClientRequestInfo_" << node->flat_name (); - - // We need the interface node in which this operation was defined. However, - // if this operation node was an attribute node in disguise, we get this - // information from the context and add a "_get"/"_set" to the flat - // name to get around the problem of overloaded methods which are - // generated for attributes. - if (this->ctx_->attribute ()) - { - bt = be_type::narrow_from_decl (node->return_type ()); - - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interceptors_ch::" - "visit_operation - " - "Bad return type\n"), - -1); - } - - // Grab the right visitor to generate the return type if its not - // void it means it is not the accessor. - if (!this->void_return_type (bt)) - { - *os << "_get"; - } - else - { - *os << "_set"; - } - } - - *os << "::arguments (ACE_ENV_SINGLE_ARG_DECL)" << be_idt_nl - << "ACE_THROW_SPEC ((CORBA::SystemException))"<< be_uidt_nl - << "{" << be_idt_nl; - - if (be_global->any_support ()) - { - *os << "// Generate the argument list on demand." << be_nl - << "Dynamic::ParameterList *parameter_list =" << be_idt_nl - << "TAO_RequestInfo_Util::make_parameter_list " - << "(ACE_ENV_SINGLE_ARG_PARAMETER);" - << be_uidt_nl - << "ACE_CHECK_RETURN (0);" << be_nl - << be_nl; - - size_t parameter_count = this->count_non_out_parameters (node); - - if (node->argument_count () == 0 - || parameter_count == 0 - // Now make sure that we have some in and inout - // parameters. Otherwise, there is nothing to be put into - // the Dyanmic::Paramlist. - || (!(this->has_param_type (node, AST_Argument::dir_IN)) - && !(this->has_param_type (node, AST_Argument::dir_INOUT)))) - { - *os << "return parameter_list;"; - } - else - { - *os << "Dynamic::ParameterList_var safe_parameter_list = " - << "parameter_list;" << be_nl; - - // Precompute the length of the Dynamic::ParameterList. This is - // a nice optimization since it reduces the number of additional - // allocations to one, instead of one for each argument, in - // addition to remove all copying that occured when growing the - // sequence for each parameter. - - *os << be_nl - << "parameter_list->length (" << parameter_count << ");" - << be_nl; - - *os << "CORBA::ULong len = 0;"; - - // The insertion operator is different for different nodes. We - // change our scope to go to the argument scope to be able to - // decide this. - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_PARAMLIST); - be_visitor_operation_interceptors_arglist oip_visitor (&ctx); - - if (node->accept (&oip_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_cs::" - "visit_operation - " - "codegen for argument pre invoke failed\n"), - -1); - } - - *os << be_nl - << "return safe_parameter_list._retn ();"; - } - } - else - { - if (be_global->use_raw_throw ()) - { - *os << "throw (CORBA::NO_IMPLEMENT ());" << be_nl - << "return 0;"; - } - else - { - *os << "ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0);"; - } - } - - *os << be_uidt_nl << "}"; - - // ----------------------------------------------------------------- - // PortableInterceptor::ClientRequestInfo::exceptions() - // ----------------------------------------------------------------- - - *os << be_nl << be_nl - << "Dynamic::ExceptionList *" << be_nl; - - *os << "TAO_ClientRequestInfo_" << node->flat_name (); - - // We need the interface node in which this operation was defined. However, - // if this operation node was an attribute node in disguise, we get this - // information from the context and add a "_get"/"_set" to the flat - // name to get around the problem of overloaded methods which are - // generated for attributes. - if (this->ctx_->attribute ()) - { - bt = be_type::narrow_from_decl (node->return_type ()); - - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interceptors_ch::" - "visit_operation - " - "Bad return type\n"), - -1); - } - - // Grab the right visitor to generate the return type if its not - // void it means it is not the accessor. - if (!this->void_return_type (bt)) - { - *os << "_get"; - } - else - { - *os << "_set"; - } - } - - *os << "::exceptions (ACE_ENV_SINGLE_ARG_DECL)"<< be_idt_nl - << "ACE_THROW_SPEC ((CORBA::SystemException))" << be_uidt_nl - << "{" << be_idt_nl; - - if (be_global->tc_support ()) - { - *os << "// Generate the exception list on demand." << be_nl - << "Dynamic::ExceptionList *exception_list =" << be_idt_nl - << "TAO_RequestInfo_Util::make_exception_list " - << "(ACE_ENV_SINGLE_ARG_PARAMETER);" - << be_uidt_nl - << "ACE_CHECK_RETURN (0);" << be_nl - << be_nl; - - if (!node->exceptions ()) - { - *os << "return exception_list;"; - } - else - { - *os << "Dynamic::ExceptionList_var safe_exception_list = " - << "exception_list;" << be_nl; - - // We change our scope to be able to generate the exceptionlist. - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_EXCEPTLIST); - be_visitor_operation_interceptors_exceptlist oie_visitor (&ctx); - - if (node->accept (&oie_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_cs::" - "visit_operation - " - "codegen for exceptlist failed\n"), - -1); - } - - *os << be_nl - << "return safe_exception_list._retn ();"; - } - } - else - { - if (be_global->use_raw_throw ()) - { - *os << "throw (CORBA::NO_IMPLEMENT ());" << be_nl - << "return 0;"; - } - else - { - *os << "ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0);"; - } - } - - *os << be_uidt_nl << "}\n\n"; - - os->decr_indent (); - - // ----------------------------------------------------------------- - // PortableInterceptor::ClientRequestInfo::result() - // ----------------------------------------------------------------- - *os << "CORBA::Any * " << be_nl; - - *os << "TAO_ClientRequestInfo_" << node->flat_name (); - - // We need the interface node in which this operation was defined. However, - // if this operation node was an attribute node in disguise, we get this - // information from the context and add a "_get"/"_set" to the flat - // name to get around the problem of overloaded methods which are - // generated for attributes. - if (this->ctx_->attribute ()) - { - bt = be_type::narrow_from_decl (node->return_type ()); - - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interceptors_ch::" - "visit_operation - " - "Bad return type\n"), - -1); - } - - // Grab the right visitor to generate the return type if its not - // void it means it is not the accessor. - if (!this->void_return_type (bt)) - { - *os << "_get"; - } - else - { - *os << "_set"; - } - } - - *os << "::result (ACE_ENV_SINGLE_ARG_DECL)" << be_idt_nl - << "ACE_THROW_SPEC ((CORBA::SystemException))" << be_uidt_nl - << "{" << be_idt_nl; - - if (be_global->any_support ()) - { - *os << "// Generate the result on demand." << be_nl; - - bt = be_type::narrow_from_decl (node->return_type ()); - - if (this->void_return_type (bt)) - { - // Return an Any with tk_void TypeCode. - *os << "const CORBA::Boolean tk_void_any = 1;" << be_nl - << "CORBA::Any *result_any =" << be_idt_nl - << "TAO_RequestInfo_Util::make_any " - << "(tk_void_any ACE_ENV_ARG_PARAMETER);" - << be_uidt_nl - << "ACE_CHECK_RETURN (0);" << be_nl - << be_nl - << "return result_any;"; - } - else - { - *os << "const CORBA::Boolean tk_void_any = 0;" << be_nl - << "CORBA::Any *result_any =" << be_idt_nl - << "TAO_RequestInfo_Util::make_any " - << "(tk_void_any ACE_ENV_ARG_PARAMETER);" - << be_uidt_nl - << "ACE_CHECK_RETURN (0);" << be_nl - << be_nl - << "CORBA::Any_var safe_result_any = " - << "result_any;" << be_nl << be_nl; - - // Generate the insertion of result into Any. - ctx = *this->ctx_; - be_visitor_operation_interceptors_result oir_visitor (&ctx); - - if (bt->accept (&oir_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_cs::" - "visit_operation - " - "codegen for result failed\n"), - -1); - } - - *os << "return safe_result_any._retn ();"; - } - } - else - { - if (be_global->use_raw_throw ()) - { - *os << "throw (CORBA::NO_IMPLEMENT ());" << be_nl - << "return 0;"; - } - else - { - *os << "ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0);"; - } - } - - *os << be_uidt_nl << "}\n\n"; - - os->decr_indent (); - - // ----------------------------------------------------------------- - // Update the result. - // ----------------------------------------------------------------- - bt = be_type::narrow_from_decl (node->return_type ()); - - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interceptors_ch::" - "visit_operation - " - "Bad return type\n"), - -1); - } - - // Grab the right visitor to generate the return type accessor if - // its not void since we cant have a private member to be of void - // type. - if (!this->void_return_type (bt)) - { - *os << "void " << be_nl; - - *os << "TAO_ClientRequestInfo_"<< node->flat_name (); - - // We need the interface node in which this operation was defined. - // However, if this operation node was an attribute node in disguise, - // we get this information from the context and add a "_get"/"_set" - // to the flat name to get around the problem of overloaded methods - // which are generated for attributes. - if (this->ctx_->attribute ()) - { - bt = be_type::narrow_from_decl (node->return_type ()); - - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interceptors_ch::" - "visit_operation - " - "Bad return type\n"), - -1); - } - - // Grab the right visitor to generate the return type if its not - // void it means it is not the accessor. - if (!this->void_return_type (bt)) - { - *os << "_get"; - } - else - { - *os << "_set"; - } - } - - *os << "::" - << "result ("; - - ctx = *this->ctx_; - be_visitor_operation_rettype or_visitor (&ctx); - - if (bt->accept (&or_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_cs::" - "visit_operation - " - "codegen for retval pre invoke failed\n"), - -1); - } - - os->indent (); - - *os << " result)" << be_uidt << be_uidt << be_uidt_nl - << "{" << be_idt_nl - << "// Update the result. " << be_nl - << "this->_result = result;" << be_uidt_nl - << "}"; - } - - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_exceptlist.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_exceptlist.cpp deleted file mode 100644 index 591da0bf7dd..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_exceptlist.cpp +++ /dev/null @@ -1,123 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// interceptors_exceptlist.cpp -// -// = DESCRIPTION -// Visitor generating code for Operation in the stubs file. -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// ============================================================================ - -ACE_RCSID (be_visitor_operation, - interceptors_exceptlist, - "$Id$") - -// ************************************************************ -// Operation visitor for exception list -// ************************************************************ - -be_visitor_operation_interceptors_exceptlist:: -be_visitor_operation_interceptors_exceptlist (be_visitor_context *ctx) - : be_visitor_operation (ctx) -{ -} - -be_visitor_operation_interceptors_exceptlist:: -~be_visitor_operation_interceptors_exceptlist (void) -{ -} - -int -be_visitor_operation_interceptors_exceptlist::visit_operation (be_operation *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - this->ctx_->node (node); - - // Start with the current indentation level. - os->indent (); - TAO_CodeGen::CG_STATE state = this->ctx_->state (); - - if (state == TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_EXCEPTLIST) - { - return this->gen_exceptlist (node); - } - - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interceptors_exceptlist::" - "visit_operation - " - "Bad context\n"), - -1); -} - -int -be_visitor_operation_interceptors_exceptlist::gen_exceptlist ( - be_operation *node - ) -{ - TAO_OutStream *os = this->ctx_->stream (); - this->ctx_->node (node); - - // Generate the exception data array. - *os << be_nl - << "static CORBA::TypeCode_ptr " << "_tao_" << node->flat_name () - << "_exceptiondata[] = " << be_nl; - *os << "{" << be_idt_nl; - - be_exception *excp = 0; - - // Initialize an iterator to iterate thru the exception list. - // Continue until each element is visited. - // Iterator must be advanced explicitly inside the loop. - for (UTL_ExceptlistActiveIterator ei (node->exceptions ()); - !ei.is_done ();) - { - excp = be_exception::narrow_from_decl (ei.item ()); - - if (excp == 0) - { - ACE_ERROR_RETURN (( - LM_ERROR, - "(%N:%l) be_visitor_operation_interceptors_exceptlist" - "gen_exceptlist - " - "be_exception::narrow_from_decl failed\n"), - -1 - ); - } - - *os << excp->tc_name (); - ei.next (); - - if (!ei.is_done ()) - { - *os << "," << be_nl; - } - } - - *os << be_uidt_nl << "};" << be_nl; - - long excp_count = (node->exceptions())->length (); - - *os << be_nl - << "exception_list->length (" << excp_count << ");" << be_nl - << "for (CORBA::ULong i = 0; i < " << excp_count << "; ++i)" - << be_idt_nl - << "{" << be_idt_nl - << "CORBA::TypeCode_ptr tcp = _tao_" << node->flat_name () - << "_exceptiondata[i];" << be_nl - << "TAO_Pseudo_Object_Manager<CORBA::TypeCode> tcp_object (&tcp, 1);" - << be_nl - << "(*exception_list)[i] = tcp_object;" << be_uidt_nl - << "}\n" << be_uidt; - - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_info_rettype.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_info_rettype.cpp deleted file mode 100644 index 6094412d1f5..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_info_rettype.cpp +++ /dev/null @@ -1,372 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// interceptors_info_rettype.cpp -// -// = DESCRIPTION -// Visitor generating code for return type stored in RequestInfo class for -// Interceptors. -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// ============================================================================ - -ACE_RCSID (be_visitor_operation, - interceptors_info_rettype, - "$Id$") - -// **************************************************************************** -// Operation visitor for return types. This generates the mapping for a return -// type in an operation signature -// **************************************************************************** - -be_visitor_operation_interceptors_info_rettype:: -be_visitor_operation_interceptors_info_rettype (be_visitor_context *ctx) - : be_visitor_decl (ctx) -{ -} - -be_visitor_operation_interceptors_info_rettype:: -~be_visitor_operation_interceptors_info_rettype (void) -{ -} - -int -be_visitor_operation_interceptors_info_rettype::visit_array (be_array *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - be_type *bt; - - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - *os << bt->name () << "_slice *"; - - return 0; -} - -int -be_visitor_operation_interceptors_info_rettype::visit_enum (be_enum *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - be_type *bt; - - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - *os << bt->name (); - - return 0; -} - -int -be_visitor_operation_interceptors_info_rettype::visit_interface (be_interface *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - be_type *bt; - - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - *os << bt->name () << "_ptr"; - - return 0; -} - -int -be_visitor_operation_interceptors_info_rettype::visit_interface_fwd (be_interface_fwd *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - be_type *bt; - - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - *os << bt->name () << "_ptr"; - - return 0; -} - -int -be_visitor_operation_interceptors_info_rettype::visit_native (be_native *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - be_type *bt; - - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - *os << bt->name (); - - return 0; -} - -int -be_visitor_operation_interceptors_info_rettype::visit_predefined_type (be_predefined_type *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - be_type *bt; - - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - switch (node->pt ()) - { - case AST_PredefinedType::PT_pseudo: - case AST_PredefinedType::PT_object: - *os << bt->name () << "_ptr"; - break; - case AST_PredefinedType::PT_any: - { - *os << bt->name () << " *"; - - break; - } - default: - { - *os << bt->name (); - - break; - } - } - - return 0; -} - -int -be_visitor_operation_interceptors_info_rettype::visit_sequence (be_sequence *node) -{ - // We should never directly be here because anonymous sequence return types - // are not allowed - TAO_OutStream *os = this->ctx_->stream (); - be_type *bt; - - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - *os << bt->name () << " *"; - - return 0; -} - -int -be_visitor_operation_interceptors_info_rettype::visit_string (be_string *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - if (node->width () == (long) sizeof (char)) - { - *os << "char *"; - } - else - { - *os << "CORBA::WChar *"; - } - - return 0; -} - -int -be_visitor_operation_interceptors_info_rettype::visit_structure (be_structure *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - be_type *bt; - - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - *os << bt->name (); - - // Based on whether we are variable or not, we return a pointer or the - // aggregate type. - if (node->size_type () == AST_Type::VARIABLE) - { - *os << " *"; - } - - return 0; -} - -int -be_visitor_operation_interceptors_info_rettype::visit_typedef (be_typedef *node) -{ - // Set the alias node. - this->ctx_->alias (node); - - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_interceptors_info_rettype::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - - this->ctx_->alias (0); - return 0; -} - -int -be_visitor_operation_interceptors_info_rettype::visit_union (be_union *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - be_type *bt; - - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - *os << bt->name (); - - // Based on whether we are variable or not, we return a pointer or the - // aggregate type. - if (node->size_type () == AST_Type::VARIABLE) - { - *os << " *"; - } - - return 0; -} - -int -be_visitor_operation_interceptors_info_rettype::visit_valuetype (be_valuetype *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - be_type *bt; - - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - *os << bt->name () << " *"; - - return 0; -} - -int -be_visitor_operation_interceptors_info_rettype::visit_valuetype_fwd ( - be_valuetype_fwd *node - ) -{ - TAO_OutStream *os = this->ctx_->stream (); - be_type *bt; - - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - *os << bt->name () << " *"; - - return 0; -} - -int -be_visitor_operation_interceptors_info_rettype::visit_component ( - be_component *node - ) -{ - return this->visit_interface (node); -} - -int -be_visitor_operation_interceptors_info_rettype::visit_component_fwd ( - be_component_fwd *node - ) -{ - return this->visit_interface_fwd (node); -} - -int -be_visitor_operation_interceptors_info_rettype::visit_eventtype ( - be_eventtype *node - ) -{ - return this->visit_valuetype (node); -} - -int -be_visitor_operation_interceptors_info_rettype::visit_eventtype_fwd ( - be_eventtype_fwd *node - ) -{ - return this->visit_valuetype_fwd (node); -} - -int -be_visitor_operation_interceptors_info_rettype::visit_home ( - be_home *node - ) -{ - return this->visit_interface (node); -} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_result.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_result.cpp deleted file mode 100644 index 4c1198eaccf..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_result.cpp +++ /dev/null @@ -1,282 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// interceptors_result.cpp -// -// = DESCRIPTION -// Visitor that generates the operation-specific -// PortableInterceptor::RequestInfo::result() method -// implementation. -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// Ossama Othman <ossama@dre.vanderbilt.edu> -// -// ============================================================================ - -ACE_RCSID (be_visitor_argument, - interceptors_result, - "$Id$") - -// ************************************************************ -// be_visitor_operation_interceptors_result for generating the result as -// stored in the request info for interceptors -// ************************************************************ - -be_visitor_operation_interceptors_result:: -be_visitor_operation_interceptors_result (be_visitor_context *ctx) - : be_visitor_decl (ctx) -{ -} - -be_visitor_operation_interceptors_result:: -~be_visitor_operation_interceptors_result (void) -{ -} - -int -be_visitor_operation_interceptors_result::visit_array (be_array *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - be_type *bt; - - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - *os << bt->name () << "_forany _tao_forany_result" - << " (this->_result);" << be_nl - << "(*result_any) <<= _tao_forany_result;" << be_nl; - - return 0; -} - -int -be_visitor_operation_interceptors_result::visit_enum (be_enum *) -{ - TAO_OutStream *os = this->ctx_->stream (); - - *os << "(*result_any) <<= this->_result;" << be_nl; - - return 0; -} - -int -be_visitor_operation_interceptors_result::visit_interface (be_interface *) -{ - TAO_OutStream *os = this->ctx_->stream (); - - *os << "(*result_any) <<= this->_result;" << be_nl; - - return 0; -} - -int -be_visitor_operation_interceptors_result::visit_interface_fwd (be_interface_fwd *) -{ - TAO_OutStream *os = this->ctx_->stream (); - - *os << "(*result_any) <<= this->_result;" << be_nl; - - return 0; -} - -int -be_visitor_operation_interceptors_result::visit_valuetype (be_valuetype *) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - *os << "(*result_any) <<= this->_result;" << be_nl; - - return 0; -} - -int -be_visitor_operation_interceptors_result::visit_valuetype_fwd (be_valuetype_fwd *) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - *os << "(*result_any) <<= this->_result;" << be_nl; - - return 0; -} - - -int -be_visitor_operation_interceptors_result::visit_predefined_type (be_predefined_type *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - *os << "(*result_any) <<= "; - - switch (node->pt ()) - { - case AST_PredefinedType::PT_boolean: - *os << "CORBA::Any::from_boolean (this->_result);" << be_nl; - break; - case AST_PredefinedType::PT_char: - *os << "CORBA::Any::from_char (this->_result);" << be_nl; - break; - case AST_PredefinedType::PT_wchar: - *os << "CORBA::Any::from_wchar (this->_result);" << be_nl; - break; - case AST_PredefinedType::PT_octet: - *os << "CORBA::Any::from_octet (this->_result);" << be_nl; - break; - case AST_PredefinedType::PT_pseudo: - case AST_PredefinedType::PT_object: - case AST_PredefinedType::PT_any: - case AST_PredefinedType::PT_long: - case AST_PredefinedType::PT_ulong: - case AST_PredefinedType::PT_longlong: - case AST_PredefinedType::PT_ulonglong: - case AST_PredefinedType::PT_short: - case AST_PredefinedType::PT_ushort: - case AST_PredefinedType::PT_float: - case AST_PredefinedType::PT_double: - case AST_PredefinedType::PT_longdouble: - *os << "this->_result;" << be_nl; - break; - default: - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_interceptors_result::" - "visit_predefined_type - " - "Bad predefined type\n"), - -1); - - } - - return 0; -} - -int -be_visitor_operation_interceptors_result::visit_sequence (be_sequence *) -{ - TAO_OutStream *os = this->ctx_->stream (); - - // Force copying when inserting into the Any. - *os << "(*result_any) <<= *this->_result;" << be_nl; - - return 0; -} - -int -be_visitor_operation_interceptors_result::visit_string (be_string *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - *os << "(*result_any) <<= "; - - // We need to make a distinction between bounded and unbounded strings. - if (node->max_size ()->ev ()->u.ulval != 0) - { - // Bounded strings. - if (node->width () == (long) sizeof (char)) - { - *os << "CORBA::Any::from_string ((char *)"; - } - else - { - *os << "CORBA::Any::from_wstring ((CORBA::WChar *)"; - } - - *os <<"this->_result, " - << node->max_size ()->ev ()->u.ulval - << ");" << be_nl; - } - else - { - *os << "this->_result;" << be_nl; - } - -return 0; -} - -int -be_visitor_operation_interceptors_result::visit_structure (be_structure * node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - *os << "(*result_any) <<= "; - - if (node->size_type () == AST_Type::VARIABLE) - *os << "*this->_result;" << be_nl; // Force copying when - // inserting into the Any. - else - *os << "this->_result;" << be_nl; - - return 0; - -} - -int -be_visitor_operation_interceptors_result::visit_union (be_union * node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - *os << "(*result_any) <<= "; - - if (node->size_type () == AST_Type::VARIABLE) - *os << "*this->_result;" << be_nl; // Force copying when - // inserting into the Any. - else - *os << "this->_result;" << be_nl; - - return 0; -} - -int -be_visitor_operation_interceptors_result::visit_typedef (be_typedef *node) -{ - node->primitive_base_type ()->accept (this); - - return 0; -} - -int -be_visitor_operation_interceptors_result::visit_component (be_component *node) -{ - return this->visit_interface (node); -} - -int -be_visitor_operation_interceptors_result::visit_component_fwd ( - be_component_fwd *node - ) -{ - return this->visit_interface_fwd (node); -} - -int -be_visitor_operation_interceptors_result::visit_eventtype (be_eventtype *node) -{ - return this->visit_valuetype (node); -} - -int -be_visitor_operation_interceptors_result::visit_eventtype_fwd ( - be_eventtype_fwd *node - ) -{ - return this->visit_valuetype_fwd (node); -} - -int -be_visitor_operation_interceptors_result::visit_home ( - be_home *node - ) -{ - return this->visit_interface (node); -} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_sh.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_sh.cpp deleted file mode 100644 index d82171570fc..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_sh.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// operation_interceptors_sh.cpp -// -// = DESCRIPTION -// Visitor generating code for Operation node in the server header. -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// ============================================================================ - -ACE_RCSID (be_visitor_operation, - operation_interceptors_sh, - "$Id$") - -// ****************************************************** -// primary visitor for "operation" in server header -// ****************************************************** - -be_visitor_operation_interceptors_sh::be_visitor_operation_interceptors_sh ( - be_visitor_context *ctx - ) - : be_visitor_operation (ctx) -{ -} - -be_visitor_operation_interceptors_sh::~be_visitor_operation_interceptors_sh ( - void - ) -{ -} - -int -be_visitor_operation_interceptors_sh::visit_operation (be_operation *) -{ - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp index 7055773131a..c0f6e6eb4f8 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp @@ -702,13 +702,13 @@ be_visitor_operation::gen_arg_template_param_name (AST_Decl *scope, { AST_String *s = AST_String::narrow_from_decl (bt->unaliased_type ()); unsigned long bound = s->max_size ()->ev ()->u.ulval; - + // If the (w)string is unbounded, code is generated below by the // last line of this method, whether bt is a typedef or not. if (bound > 0) { *os << "::TAO::"; - + if (alias != 0) { *os << alias->local_name () << "_" << bound; @@ -726,13 +726,13 @@ be_visitor_operation::gen_arg_template_param_name (AST_Decl *scope, // flat name. *os << scope->flat_name (); } - + return; } } - + // We need the unaliased type name to make the code block below - // work correctly. + // work correctly. AST_Type *ut = bt->unaliased_type (); nt = ut->node_type (); diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_sh.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_sh.cpp index 1c4f7ff9280..32530788656 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/operation_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_sh.cpp @@ -111,9 +111,9 @@ be_visitor_operation_sh::visit_operation (be_operation *node) *os << node->local_name () << "_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest &_tao_req," << be_nl - << "void *_tao_servant," << be_nl - << "void *_tao_servant_upcall" << be_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; } 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 95b181f19ab..5c9a2bbc8df 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp @@ -18,6 +18,7 @@ // // ============================================================================ + ACE_RCSID (be_visitor_operation, operation_ss, "$Id$") @@ -35,23 +36,23 @@ be_visitor_operation_ss::~be_visitor_operation_ss (void) { } -// Processing to be done after every element in the scope is processed. -int -be_visitor_operation_ss::post_process (be_decl *bd) -{ - // All we do here is to insert a comma and a newline. - TAO_OutStream *os = this->ctx_->stream (); +// // Processing to be done after every element in the scope is processed. +// int +// be_visitor_operation_ss::post_process (be_decl *bd) +// { +// // All we do here is to insert a comma and a newline. +// TAO_OutStream *os = this->ctx_->stream (); - if (!this->last_node (bd)) - { - *os << ",\n"; - } +// if (!this->last_node (bd)) +// { +// *os << ",\n"; +// } - return 0; -} +// return 0; +// } int -be_visitor_operation_ss::visit_operation (be_operation *node) +be_visitor_operation_ss::visit_operation (be_operation * node) { TAO_OutStream *os = this->ctx_->stream (); be_type *bt = 0; @@ -78,10 +79,76 @@ be_visitor_operation_ss::visit_operation (be_operation *node) -1); } - // We need the interface node in which this operation was defined. However, - // if this operation node was an attribute node in disguise, we get this - // information from the context - be_interface *intf = this->ctx_->attribute () + return this->gen_skel_operation_body (node, bt); +} + +int +be_visitor_operation_ss::visit_argument (be_argument *node) +{ + // This method is used to generate the ParamData table entry. + + TAO_OutStream *os = this->ctx_->stream (); + + // Retrieve the type for this argument. + be_type *bt = be_type::narrow_from_decl (node->field_type ()); + + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_ss::" + "visit_argument - " + "Bad argument type\n"), + -1); + } + + os->indent (); + *os << "{" << bt->tc_name () << ", "; + switch (node->direction ()) + { + case AST_Argument::dir_IN: + *os << "CORBA::ARG_IN, "; + break; + case AST_Argument::dir_INOUT: + *os << "CORBA::ARG_INOUT, "; + break; + case AST_Argument::dir_OUT: + *os << "CORBA::ARG_OUT, "; + break; + } + *os << "0}"; + + return 0; +} + +int +be_visitor_operation_ss::gen_pre_skel_info (be_operation * node) +{ + be_visitor_context ctx = *this->ctx_; + be_visitor_operation_exceptlist_ss visitor (&ctx); + + if (node->accept (&visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) " + "be_visitor_operation_ss::" + "gen_pre_skel_info - " + "Exception TypeCode list generation error\n"), + -1); + } + + return 0; +} + +int +be_visitor_operation_ss::gen_skel_operation_body (be_operation * node, + be_type * return_type) +{ + TAO_OutStream * const os = this->ctx_->stream (); + + // We need the interface node in which this operation was + // defined. However, if this operation node was an attribute node + // in disguise, we get this information from the context + 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 ()); @@ -115,9 +182,9 @@ be_visitor_operation_ss::visit_operation (be_operation *node) *os << node->local_name () << "_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest &_tao_server_request," << be_nl - << "void *_tao_servant," << be_nl - << "void *_tao_servant_upcall" << be_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; @@ -126,6 +193,11 @@ be_visitor_operation_ss::visit_operation (be_operation *node) // last argument - is always CORBA::Environment. *os << "{" << be_idt_nl; + // Generate the local class encapsulating the actual servant upcall + // command/invocation. + be_visitor_operation_upcall_command_ss upcall_command_visitor (this->ctx_); + upcall_command_visitor.visit_operation (node); + // Generate all the tables and other pre-skel info. if (this->gen_pre_skel_info (node) == -1) { @@ -136,614 +208,120 @@ be_visitor_operation_ss::visit_operation (be_operation *node) -1); } - // Get the right object implementation. - *os << intf->full_skel_name () << " *_tao_impl =" << be_idt_nl - << "static_cast<" << be_idt << be_idt_nl - << intf->full_skel_name () << " *> (" << be_nl - << "_tao_servant" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl; - - // Declare a return type variable. - be_visitor_context ctx = *this->ctx_; - be_visitor_operation_rettype_vardecl_ss ord_visitor (&ctx); - - // Do we have any arguments in the operation that needs marshalling? - int flag = - node->count_arguments_with_direction (AST_Argument::dir_INOUT | - AST_Argument::dir_OUT); - - // Check if the flag is zero and for the return type. - if (flag == 0 && node->void_return_type () == 1) - { - // There are no return type and argument values that needs to be - // marshalled. - *os << "_tao_server_request.argument_flag (0);" << be_nl; - } - - if (bt->accept (&ord_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ss::" - "visit_operation - " - "codegen for return var decl failed\n"), - -1); - } - - // Declare variables for arguments. - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_DECL_SS); - be_visitor_operation_argument oad_visitor (&ctx); - - if (node->accept (&oad_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ss::" - "visit_operation - " - "codegen for return var decl failed\n"), - -1); - } - - // Demarshal parameters. - if (this->gen_demarshal_params (node, bt) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ss::" - "visit_operation - " - "gen_demarshal_params failed\n"), - -1); - } - - // Fish out the interceptors. - *os << be_nl - << "\n#if (TAO_HAS_INTERCEPTORS == 1)" << be_nl; - - // Cast the Servant_Upcall pointer. - *os << "TAO::Portable_Server::Servant_Upcall *_tao_upcall =" << be_idt_nl - << "static_cast<" << be_idt << be_idt_nl - << "TAO::Portable_Server::Servant_Upcall *> (" << be_nl - << "_tao_servant_upcall" << be_uidt_nl - << ");" << be_uidt_nl << be_uidt_nl; - - *os << "TAO_ServerRequestInterceptor_Adapter _tao_vfr (" - << be_idt << be_idt_nl - << "_tao_server_request.orb_core ()->server_request_interceptors ()," - << be_nl - << "_tao_server_request.interceptor_count ()" << be_uidt_nl - << ");" << be_uidt_nl << be_nl; - - *os << "TAO_ServerRequestInfo_" << node->flat_name (); - - // We need the interface node in which this operation was defined. However, - // if this operation node was an attribute node in disguise, we get this - // information from the context and add a "_get"/"_set" to the flat - // name to get around the problem of overloaded methods which are - // generated for attributes. - if (this->ctx_->attribute ()) - { - bt = be_type::narrow_from_decl (node->return_type ()); - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interceptors_ch::" - "visit_operation - " - "Bad return type\n"), - -1); - } - - // Grab the right visitor to generate the return type if its not - // void it means it is not the accessor. - if (!this->void_return_type (bt)) - { - *os << "_get"; - } - else - { - *os << "_set"; - } - } - - *os << " _tao_ri (" << be_idt << be_idt_nl - << "_tao_server_request," << be_nl - << "_tao_upcall," << be_nl - << "_tao_impl"; - - // Generate the formal argument fields which are passed to the - // RequestInfo object. - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_SS); - be_visitor_operation_interceptors_arglist oiia_visitor (&ctx); - - if (node->accept (&oiia_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_cs::" - "visit_operation - " - "codegen for arglist failed\n"), - -1); - } - - *os << be_uidt_nl << ");" << be_uidt_nl << be_nl; + // Declare return type helper class. - *os << "ACE_TRY" << be_idt_nl - << "{" << be_idt_nl; + *os << "TAO::SArg_Traits< "; - // Create a new scope. The receive_request() interception point and - // the upcall will occur within this scope. - *os << "{" << be_idt_nl; + this->gen_arg_template_param_name (node, + return_type, + os); - // Copy the thread scope current (TSC) to the request scope current - // (RSC) upon leaving this scope, i.e. just after the upcall - // completes. A "guard" is used to make the copy also occur if an - // exception is thrown. - *os << "TAO::PICurrent_Guard _tao_pi_guard (_tao_ri.server_request ()," - << be_nl - << " true /* Copy TSC to RSC */);" - << be_nl << be_nl; - - // Invoke the receive_request() interception point. - *os << "_tao_vfr.receive_request (&_tao_ri ACE_ENV_ARG_PARAMETER);" << be_nl - << "ACE_TRY_CHECK;" << be_nl; - - // Check if a PortableInterceptor::ForwardRequest was raised by - // ServerRequestInterceptor::receive_request(). - *os << be_nl - << "if (!_tao_vfr.location_forwarded ())" << be_idt_nl - << "{" << be_idt; + *os << ">::ret_val retval;"; - *os << "\n#endif /* TAO_HAS_INTERCEPTORS */\n"; + // Declare the argument helper classes. + this->gen_skel_body_arglist (node, os); - // Make the upcall and assign to the return val. - ctx = *this->ctx_; - be_visitor_operation_rettype_assign_ss ora_visitor (&ctx); - - if (bt->accept (&ora_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ss::" - "visit_operation - " - "codegen for retval assignment failed\n"), - -1); - } - - // Make the upcall. - *os << be_idt_nl - << "_tao_impl->" << node->local_name () << " (" << be_idt << be_idt; - - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_UPCALL_SS); - be_visitor_operation_argument oau_visitor (&ctx); + *os << be_nl << be_nl + << "TAO::Argument * const args[] =" << be_idt_nl + << "{" << be_idt_nl + << "&retval"; - if (node->accept (&oau_visitor) == -1) + for (UTL_ScopeActiveIterator arg_list_iter (node, UTL_Scope::IK_decls); + ! arg_list_iter.is_done (); + arg_list_iter.next ()) { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ss::" - "visit_operation - " - "codegen for making upcall failed\n"), - -1); - } - - // End the upcall. - *os << be_uidt_nl << ");" - << be_uidt << be_uidt_nl; + AST_Argument * const arg = + AST_Argument::narrow_from_decl (arg_list_iter.item ()); - if (!be_global->exception_support ()) - { - *os << "TAO_INTERCEPTOR_CHECK;"; + *os << "," << be_nl + << "&_tao_" << arg->local_name (); } - // Update the result. - bt = be_type::narrow_from_decl (node->return_type ()); - - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interceptors_ch::" - "visit_operation - " - "Bad return type\n"), - -1); - } - - // Invoke the send_reply() or send_other() interception point, and - // check for exception. - *os << "\n#if (TAO_HAS_INTERCEPTORS == 1)"; - - // Close scope for "if (!_tao_vfr.location_forwarded ()" - *os << be_uidt_nl - << "}" << be_uidt; - - // Close the TAO_PICurrent_Guard scope *os << be_uidt_nl - << "}" << be_nl << be_nl; - - // Set reply status only if no PortableInterceptor::ForwardRequest - // was raised by ServerRequestInterceptor::receive_request(). We - // have to make this check a second time because the scope of the - // first check overlaps with the scope of TAO_PICurrent_Guard. - *os << "if (!_tao_vfr.location_forwarded ())" << be_idt_nl - << "{" << be_idt_nl; - - // Grab the right visitor to generate the return type accessor if - // it's not void since we can't have a private member to be of void - // type. - if (!this->void_return_type (bt)) - { - // Here's what we are going to do to have a uniform way of - // getting the return value updated for the Request Info: - // declare a operation_retval type object and assign the - // _tao_retval._retn() to it. We pass this to the result - // updation method (note: it hasn't been destroyed). We then - // put it back into the original _tao_retval object. And - // finally the _retn() is returned from the operation without - // causing any problems. - // Generate the return type mapping (same as in the header file) - ctx = *this->ctx_; - be_visitor_operation_rettype oro_visitor (&ctx); - - if (bt->accept (&oro_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_cs::" - "visit_operation - " - "codegen for return type failed\n"), - -1); - } + << "};" << be_uidt_nl << be_nl; - if (bt->size_type () == AST_Type::VARIABLE - || bt->node_type () == AST_Decl::NT_array) - { - *os << " _tao_retval_info = _tao_retval._retn ();" << be_nl - << "_tao_ri.result (_tao_retval_info);" << be_nl - << "_tao_retval = _tao_retval_info;" << be_nl; - } - else - { - *os << " _tao_retval_info = _tao_retval;" << be_nl - << "_tao_ri.result (_tao_retval_info);" << be_nl; - } - } + *os << "static size_t const nargs = " + << (node->argument_count () + 1) << ";" << be_nl << be_nl; - *os << "_tao_ri.reply_status (PortableInterceptor::SUCCESSFUL);" << be_nl - << "_tao_vfr.send_reply (&_tao_ri ACE_ENV_ARG_PARAMETER);"<< be_nl - << "ACE_TRY_CHECK;" << be_uidt_nl; - - // Close scope of the "if (!_tao_vfr.location_forwarded()" - // conditional block. - *os << be_uidt << "}" << be_uidt_nl; - - *os << "}" << be_uidt_nl - << "ACE_CATCHANY" << be_idt_nl - << "{" << be_idt_nl; - // Update the ServerRequestInfo exception attribute. - *os << "_tao_ri.exception (&ACE_ANY_EXCEPTION);"<< be_nl - << "_tao_vfr.send_exception (" << be_idt << be_idt_nl - << "&_tao_ri" << be_nl - << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl - << ");" << be_uidt_nl - << "ACE_TRY_CHECK;" << be_nl; - - // The send_exception() interception point may have transformed the - // caught exception. In that event, we must not re-throw the caught - // exception. - *os << be_nl - << "PortableInterceptor::ReplyStatus _tao_status =" << be_idt_nl - << "_tao_ri.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER);" << be_uidt_nl - << "ACE_TRY_CHECK;" << be_nl; - - *os << be_nl - << "if (_tao_status == PortableInterceptor::SYSTEM_EXCEPTION" << be_nl - << " || _tao_status == PortableInterceptor::USER_EXCEPTION)" - << be_idt_nl - << "{" << be_idt_nl; - - if (be_global->use_raw_throw ()) - { - *os << "throw;"; - } - else - { - *os << "ACE_RE_THROW;"; - } - - *os << be_uidt_nl - << "}" << be_uidt << be_uidt_nl - << "}" << be_uidt_nl; - - // Convert non-CORBA C++ exceptions to CORBA::UNKNOWN. - *os << "\n# if defined (ACE_HAS_EXCEPTIONS) \\\n" - << " && defined (ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS)" << be_nl - << "ACE_CATCHALL" << be_idt_nl - << "{" << be_idt_nl - << "CORBA::UNKNOWN ex;" << be_nl - << be_nl - << "_tao_ri.exception (&ex);"<< be_nl - << "_tao_vfr.send_exception (" << be_idt << be_idt_nl - << "&_tao_ri" << be_nl - << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl - << ");" << be_uidt_nl - << "ACE_TRY_CHECK;" << be_nl; - - // The receive_exception() interception point may have thrown a - // PortableInterceptor::ForwardRequest exception. In that event, - // the connection retry loop must be restarted so do not throw the - // CORBA::UNKNOWN exception to convert the unhandled C++ exception. - *os << be_nl - << "PortableInterceptor::ReplyStatus _tao_status =" << be_idt_nl - << "_tao_ri.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER);" << be_uidt_nl - << "ACE_TRY_CHECK;" << be_nl; + // Get the right object implementation. + *os << intf->full_skel_name () << " * const impl =" << be_idt_nl + << "static_cast<" << be_idt_nl + << intf->full_skel_name () << " *> (servant);" << be_uidt << be_uidt_nl; + // Upcall_Command instantiation. *os << be_nl - << "if (_tao_status == PortableInterceptor::SYSTEM_EXCEPTION)" - << be_idt_nl; + << "Upcall_Command command (" << be_idt_nl + << "impl"; - if (be_global->use_raw_throw ()) + if (!node->void_return_type () || node->argument_count () > 0) { - *os << "throw "; - } - else - { - *os << "ACE_TRY_THROW "; - } - - *os << "(ex);" << be_uidt << be_uidt_nl - << "}" << be_uidt - << "\n# endif /* ACE_HAS_EXCEPTIONS" - << " && ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS */" << be_nl; + // server_request.operation_details () will be non-zero in the + // thru-POA collocation case. Use them if available. + *os << "," << be_nl; - *os << "ACE_ENDTRY;" << be_nl; - *os << "ACE_CHECK;" - << "\n#endif /* TAO_HAS_INTERCEPTORS */" << be_nl << be_nl; + if (be_global->gen_thru_poa_collocation ()) + *os << "server_request.operation_details ()," << be_nl; - // Check if we are oneway in which case, we are done. - if (node->flags () == AST_Operation::OP_oneway) - { - // We are done. Nothing else to do, except closing the function body. - *os << "if (_tao_server_request.response_expected ()" << be_idt - << be_idt_nl - << "&& !_tao_server_request.sync_with_server ())" << be_uidt_nl - << "{" << be_idt_nl - << "_tao_server_request.init_reply ();" << be_uidt_nl - << "}" << be_uidt; + *os << "args"; } - // Marshal outgoing parameters. - else if (this->gen_marshal_params (node, bt) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ss::" - "visit_operation - " - "gen_marshal_params failed\n"), - -1); - } - - *os << be_nl << be_nl - << "// In case _tao_servant_upcall is not used in this function" - << be_nl - << "ACE_UNUSED_ARG (_tao_servant_upcall);" << be_uidt_nl - << "}";; + *os << ");" << be_uidt_nl << be_nl; - return 0; -} -int -be_visitor_operation_ss::visit_argument (be_argument *node) -{ - // This method is used to generate the ParamData table entry. + *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; - TAO_OutStream *os = this->ctx_->stream (); - // Retrieve the type for this argument. - be_type *bt = be_type::narrow_from_decl (node->field_type ()); - - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ss::" - "visit_argument - " - "Bad argument type\n"), - -1); - } - - os->indent (); - *os << "{" << bt->tc_name () << ", "; - switch (node->direction ()) - { - case AST_Argument::dir_IN: - *os << "CORBA::ARG_IN, "; - break; - case AST_Argument::dir_INOUT: - *os << "CORBA::ARG_INOUT, "; - break; - case AST_Argument::dir_OUT: - *os << "CORBA::ARG_OUT, "; - break; - } - *os << "0}"; + *os << be_uidt_nl + << "}"; return 0; } -int -be_visitor_operation_ss::gen_pre_skel_info (be_operation *node) +void +be_visitor_operation_ss::gen_skel_body_arglist (be_operation * node, + TAO_OutStream * os) { - TAO_OutStream *os = this->ctx_->stream (); - - // Now make sure that we have some in and inout parameters. Otherwise, there - // is nothing to be marshaled in. - if (this->has_param_type (node, AST_Argument::dir_IN) || - this->has_param_type (node, AST_Argument::dir_INOUT)) + for (UTL_ScopeActiveIterator arg_decl_iter (node, UTL_Scope::IK_decls); + ! arg_decl_iter.is_done (); + arg_decl_iter.next ()) { - // Instantiate a TAO_InputCDR variable. - *os << "TAO_InputCDR &_tao_in = _tao_server_request.incoming ();" - << be_nl; - } + AST_Argument * const arg = + AST_Argument::narrow_from_decl (arg_decl_iter.item ()); - return 0; -} + *os << be_nl + << "TAO::SArg_Traits< "; -int -be_visitor_operation_ss::gen_demarshal_params (be_operation *node, - be_type *) -{ - TAO_OutStream *os = this->ctx_->stream (); - be_visitor_context ctx; + this->gen_arg_template_param_name (arg, + arg->field_type (), + os); - // Now make sure that we have some in and inout parameters. Otherwise, there - // is nothing to be marshaled in. - if (this->has_param_type (node, AST_Argument::dir_IN) || - this->has_param_type (node, AST_Argument::dir_INOUT)) - { - // demarshal the in and inout arguments - *os << be_nl << be_nl << "if (!(" << be_idt << be_idt; - - // Marshal each in and inout argument. - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_DEMARSHAL_SS); - ctx.sub_state (TAO_CodeGen::TAO_CDR_INPUT); - be_visitor_operation_argument_marshal oad_visitor (&ctx); + *os << ">::"; - if (node->accept (&oad_visitor) == -1) + switch (arg->direction ()) { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ss::" - "gen_demarshal_params - " - "codegen for demarshal failed\n"), - -1); + case AST_Argument::dir_IN: + *os << "in"; + break; + case AST_Argument::dir_INOUT: + *os << "inout"; + break; + case AST_Argument::dir_OUT: + *os << "out"; + default: + break; } - *os << be_nl << "))" << be_uidt_nl; - - // If marshaling fails, raise exception (codesetting has minor codes) - *os << "{" << be_idt_nl - << "TAO_InputCDR::throw_skel_exception " - << "(errno ACE_ENV_ARG_PARAMETER);" - << be_nl - << "ACE_CHECK;" << be_uidt_nl - << "}" << be_uidt; - }; - - return 0; -} - -int -be_visitor_operation_ss::gen_marshal_params (be_operation *node, - be_type *bt) -{ - TAO_OutStream *os = this->ctx_->stream (); - be_visitor_context ctx; - - // Setup parameters for marshaling and marshal them into the - // outgoing stream. - // The code below this is for 2way operations only. - - // We will be here only if we are 2way - // first initialize a reply message - *os << "_tao_server_request.init_reply ();"; - - // We still need the following check because we maybe 2way and yet have no - // parameters and a void return type. - if (this->void_return_type (bt) - && !this->has_param_type (node, AST_Argument::dir_INOUT) - && !this->has_param_type (node, AST_Argument::dir_OUT)) - { - return 0; + *os << "_arg_val _tao_" << arg->local_name () << ";"; } - - // Create temporary variables for the out and return parameters. - if (!this->void_return_type (bt)) - { - ctx = *this->ctx_; - - be_visitor_operation_rettype_post_upcall_ss visitor (&ctx); - - if (bt->accept (&visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ss::" - "gen_marshal_params - " - "codegen for return var [post upcall] failed\n"), - -1); - } - } - - // Generate any temporary variables to demarshal the arguments. - ctx = *this->ctx_; - be_visitor_args_post_upcall_ss vis1 (&ctx); - - if (node->accept (&vis1) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_cs::" - "gen_pre_stub_info - " - "codegen for pre args failed\n"), - -1); - } - - // Skip marshalling on location forward - *os << "\n#if (TAO_HAS_INTERCEPTORS == 1)" << be_nl - << "if (!_tao_vfr.location_forwarded ())" << be_idt_nl - << "{" << be_idt; - *os << "\n#endif /* TAO_HAS_INTERCEPTORS */"<< be_nl; - - *os << "TAO_OutputCDR &_tao_out = _tao_server_request.outgoing ();" - << be_nl << be_nl; - - *os << "if (!(" << be_idt << be_idt; - - if (!this->void_return_type (bt)) - { - // Demarshal the return val and each inout and out argument. - ctx = *this->ctx_; - ctx.sub_state (TAO_CodeGen::TAO_CDR_OUTPUT); - be_visitor_operation_rettype_marshal_ss orm_visitor (&ctx); - - if (node->accept (&orm_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ss::" - "gen_marshal_params - " - "codegen for return var failed\n"), - -1); - } - } - - if (this->has_param_type (node, AST_Argument::dir_INOUT) - || this->has_param_type (node, AST_Argument::dir_OUT)) - { - if (!this->void_return_type (bt)) - { - // We have already printed the return val. SO put a &&. - *os << " &&"; - } - - // Marshal each in and inout argument. - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_MARSHAL_SS); - ctx.sub_state (TAO_CodeGen::TAO_CDR_OUTPUT); - be_visitor_operation_argument_marshal oam_visitor (&ctx); - - if (node->accept (&oam_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ss::" - "gen_marshal_params - " - "codegen for args failed\n"), - -1); - } - } - - *os << be_nl << "))" << be_uidt_nl; - - // If marshaling fails, raise exception (codesetting has minor codes) - *os << "{" << be_idt_nl - << "TAO_OutputCDR::throw_skel_exception (errno ACE_ENV_ARG_PARAMETER);" - << be_nl - << "ACE_CHECK;" << be_uidt_nl - << "}" << be_uidt; - - // End of scope: Skip marshalling on location forward - *os << "\n#if (TAO_HAS_INTERCEPTORS == 1)" - << be_uidt_nl << "}" << be_uidt; - *os << "\n#endif /* TAO_HAS_INTERCEPTORS */" << be_nl; - - 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 new file mode 100644 index 00000000000..849e40bd9b3 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_operation/upcall_command_ss.cpp @@ -0,0 +1,392 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// upcall_command_ss.cpp +// +// = DESCRIPTION +// Visitor that generates operation-specific TAO::Upcall_Command +// objects in skeletons. +// +// = AUTHOR +// Ossama Othman +// +// ============================================================================ + + +ACE_RCSID (be_visitor_operation, + upcall_command_ss, + "$Id$") + + +be_visitor_operation_upcall_command_ss +::be_visitor_operation_upcall_command_ss ( + be_visitor_context *ctx) + : be_visitor_operation (ctx) +{ +} + +be_visitor_operation_upcall_command_ss +::~be_visitor_operation_upcall_command_ss (void) +{ +} + +int +be_visitor_operation_upcall_command_ss::visit_operation (be_operation * node) +{ + 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; + + // Generate the operation-specific TAO::Upcall_Command concrete class. + + 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 - " + "bad interface scope\n"), + -1); + } + + // Generate an operation-specific concrete TAO::Upcall_Command + // class, an instance of which will be invoked by the + // TAO::Upcall_Wrapper object. + + os << "class Upcall_Command" << be_nl + << " : public TAO::Upcall_Command" << be_nl + << "{" << be_nl + << "public:" << be_idt_nl << be_nl; + + // Generate constructor + os << "inline Upcall_Command (" << be_idt_nl + << full_skel_name << " * servant"; + + // No need to accept an argument array parameter if the operation + // has no arguments. + if (!node->void_return_type () || node->argument_count () > 0) + { + os << "," << be_nl; + + if (be_global->gen_thru_poa_collocation ()) + os << "TAO_Operation_Details const * operation_details," << be_nl; + + os << "TAO::Argument * const args[])" << be_nl; + } + else + { + os << ")" << be_nl; + } + + os << ": servant_ (servant)"; + + // If the operation has no arguments don't generate a member + // initializer for the class argument array member/attribute. + if (!node->void_return_type () || node->argument_count () > 0) + { + os << be_nl; + + if (be_global->gen_thru_poa_collocation ()) + os << ", operation_details_ (operation_details)" << be_nl; + + os << ", args_ (args)"; + } + + os << be_uidt_nl; + + os << "{" << be_nl + << "}" << be_nl << be_nl; + + // Generate execute() method. + os << "virtual void execute (ACE_ENV_SINGLE_ARG_DECL)" << be_nl + << "{" << be_idt_nl; + + if (!node->void_return_type ()) + { + os << "TAO::SArg_Traits< "; + + + this->gen_arg_template_param_name (node, + node->return_type (), + &os); + + os << ">::ret_arg_type retval =" << be_idt_nl; + + if (be_global->gen_thru_poa_collocation ()) + { + os << "get_ret_arg< "; + + this->gen_arg_template_param_name (node, + node->return_type (), + &os); + + os << "> (" << be_idt_nl + << "this->operation_details_," << be_nl + << "this->args_);" << be_uidt; + } + else + { + os << "static_cast<TAO::SArg_Traits< "; + + this->gen_arg_template_param_name (node, + node->return_type (), + &os); + + os << ">::ret_val *> (this->args_[0])->arg ();"; + } + + os << be_uidt_nl << be_nl; + } + + if (this->gen_upcall (node) == -1) + { + return -1; + } + + if (!node->void_return_type ()) + { + os << be_uidt; + } + + os << be_nl + << "ACE_CHECK;" << be_uidt_nl + << "}" << be_uidt_nl << be_nl; + + // Prevent copying/assignment and generation of default copy + // constructor and assignment operator. + os << "private:" << be_idt_nl << be_nl + << "Upcall_Command (" + << "Upcall_Command const &);" << be_nl + << "void operator= (Upcall_Command const &);" + << be_uidt_nl << be_nl; + + // Generate class attributes. + os << "private:" << be_idt_nl << be_nl + << full_skel_name << " * const servant_;"; + + // Don't bother generating an argument array attribute if the + // operation has no arguments. + if (!node->void_return_type () || node->argument_count () > 0) + { + os << be_nl; + + if (be_global->gen_thru_poa_collocation ()) + os << "TAO_Operation_Details const * const operation_details_;" << be_nl; + + + os << "TAO::Argument * const * const args_;"; + } + + os << be_uidt_nl + << "};" << be_nl; + + return 0; +} + +int +be_visitor_operation_upcall_command_ss::gen_upcall (be_operation * node) +{ + TAO_OutStream & os = *this->ctx_->stream (); + + UTL_ScopeActiveIterator si (node, + UTL_Scope::IK_decls); + + unsigned int index = 1; + + for (; !si.is_done (); si.next (), ++index) + { + AST_Argument * const arg = + AST_Argument::narrow_from_decl (si.item ()); + + os << "TAO::SArg_Traits< "; + + this->gen_arg_template_param_name (arg, + arg->field_type (), + &os); + + os << ">::"; + + switch (arg->direction ()) + { + case AST_Argument::dir_IN: + os << "in"; + break; + case AST_Argument::dir_INOUT: + os << "inout"; + break; + case AST_Argument::dir_OUT: + os << "out"; + default: + break; + } + + os << "_arg_type arg_" << index << " =" << be_idt_nl; + + if (be_global->gen_thru_poa_collocation ()) + { + os << "get_"; + + switch (arg->direction ()) + { + case AST_Argument::dir_IN: + os << "in"; + break; + case AST_Argument::dir_INOUT: + os << "inout"; + break; + case AST_Argument::dir_OUT: + os << "out"; + default: + break; + } + + os << "_arg< "; + + this->gen_arg_template_param_name (arg, + arg->field_type (), + &os); + + os << "> (" << be_idt_nl + << "this->operation_details_," << be_nl + << "this->args_," << be_nl + << index << ");" << be_uidt_nl; + } + else + { + os << "static_cast<TAO::SArg_Traits< "; + + this->gen_arg_template_param_name (arg, + arg->field_type (), + &os); + + os << ">::"; + + switch (arg->direction ()) + { + case AST_Argument::dir_IN: + os << "in"; + break; + case AST_Argument::dir_INOUT: + os << "inout"; + break; + case AST_Argument::dir_OUT: + os << "out"; + default: + break; + } + + os << "_arg_val *> (this->args_[" << index << "])->arg ();" + << be_nl; + } + + os << be_uidt_nl; + + } + + + + if (!node->void_return_type ()) + { + os << be_nl + << "retval =" << be_idt_nl; + } + + os << "this->servant_->" << node->local_name () << " (" + << be_idt_nl; + + size_t const count = node->argument_count (); + + for (unsigned int i = 0; i < count; ++i) + os << (i == 0 ? "" : ", ") << "arg_" << i + 1 << be_nl; + + if (count > 0) + os << "ACE_ENV_ARG_PARAMETER);" << be_uidt_nl; + else + os << "ACE_ENV_SINGLE_ARG_PARAMETER);" << be_uidt_nl; + +// UTL_ScopeActiveIterator si (node, +// UTL_Scope::IK_decls); + +// if (si.is_done ()) +// { +// os << be_nl +// << "ACE_ENV_SINGLE_ARG_PARAMETER" << be_uidt_nl +// << ");"; + +// return 0; +// } + +// int index = 1; + +// for (; !si.is_done (); si.next (), ++index) +// { +// AST_Argument * const arg = +// AST_Argument::narrow_from_decl (si.item ()); + +// os << (index == 1 ? "" : ",") << be_nl +// << "static_cast<TAO::SArg_Traits< "; + +// this->gen_arg_template_param_name (arg, +// arg->field_type (), +// &os); + +// os << ">::"; + +// switch (arg->direction ()) +// { +// case AST_Argument::dir_IN: +// os << "in"; +// break; +// case AST_Argument::dir_INOUT: +// os << "inout"; +// break; +// case AST_Argument::dir_OUT: +// os << "out"; +// default: +// break; +// } + +// os << "_arg_val *> (this->args_[" << index << "])->arg ()"; +// } + + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_root/root.cpp b/TAO/TAO_IDL/be/be_visitor_root/root.cpp index 3cc1fb40633..bb9eda6e089 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/root.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/root.cpp @@ -46,6 +46,8 @@ int be_visitor_root::visit_root (be_root *node) -1); } + TAO_OutStream * const os = this->ctx_->stream (); + int status = 0; be_visitor_context ctx = *this->ctx_; @@ -69,6 +71,18 @@ int be_visitor_root::visit_root (be_root *node) break; case TAO_CodeGen::TAO_ROOT_SS: { + be_visitor_arg_traits arg_visitor ("S", &ctx); + status = node->accept (&arg_visitor); + + if (status == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "visit_root - " + "failed to generate skeleton arg traits\n"), + -1); + } + if (be_global->gen_thru_poa_collocation () || be_global->gen_direct_collocation ()) { @@ -80,10 +94,108 @@ int be_visitor_root::visit_root (be_root *node) ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_root::" "visit_root - " - "failed to generate stub arg traits\n"), + "failed to generate collocated skeleton arg traits\n"), -1); } } + + // Generate stub/skeleton argument selection function templates + // in skeleton. + if (be_global->gen_thru_poa_collocation ()) + { + *os << be_nl << be_nl + << "// Stub/skeleton argument selection function templates." + << be_nl + << "// TAO_IDL - Generated from " + << __FILE__ << ":" << __LINE__; + + *os << be_nl << be_nl + << "namespace" << be_nl + << "{" << be_idt_nl; + + // Return value selection function template + *os << "template<typename T>" << be_nl + << "typename TAO::SArg_Traits<T>::ret_arg_type" << be_nl + << "get_ret_arg (TAO_Operation_Details const * details," + << be_nl + << " TAO::Argument * const * skel_args)" << be_nl + << "{" << be_idt_nl + << "return" << be_idt_nl + << "details" << be_nl + << "? static_cast<typename TAO::Arg_Traits<T>::ret_val *> (" + << be_idt << be_idt_nl + // return value is always the first element in the + // TAO::Argument array + << "details->args ()[0])->arg ()" + << be_uidt << be_uidt_nl + << ": static_cast<typename TAO::SArg_Traits<T>::ret_val *> (" + << be_idt << be_idt_nl + << "skel_args[0])->arg ();" << be_uidt << be_uidt + << be_uidt << be_uidt_nl + << "}" << be_nl << be_nl; + + // IN argument selection function template + *os << "template<typename T>" << be_nl + << "typename TAO::SArg_Traits<T>::in_arg_type" << be_nl + << "get_in_arg (TAO_Operation_Details const * details," + << be_nl + << " TAO::Argument * const * skel_args," << be_nl + << " size_t i)" << be_nl + << "{" << be_idt_nl + << "return" << be_idt_nl + << "details" << be_nl + << "? static_cast<typename TAO::Arg_Traits<T>::in_arg_val *> (" + << be_idt << be_idt_nl + << "details->args ()[i])->arg ()" + << be_uidt << be_uidt_nl + << ": static_cast<typename TAO::SArg_Traits<T>::in_arg_val *> (" + << be_idt << be_idt_nl + << "skel_args[i])->arg ();" << be_uidt << be_uidt + << be_uidt << be_uidt_nl + << "}" << be_nl << be_nl; + + // INOUT argument selection function template + *os << "template<typename T>" << be_nl + << "typename TAO::SArg_Traits<T>::inout_arg_type" << be_nl + << "get_inout_arg (TAO_Operation_Details const * details," + << be_nl + << " TAO::Argument * const * skel_args," << be_nl + << " size_t i)" << be_nl + << "{" << be_idt_nl + << "return" << be_idt_nl + << "details" << be_nl + << "? static_cast<typename TAO::Arg_Traits<T>::inout_arg_val *> (" + << be_idt << be_idt_nl + << "details->args ()[i])->arg ()" + << be_uidt << be_uidt_nl + << ": static_cast<typename TAO::SArg_Traits<T>::inout_arg_val *> (" + << be_idt << be_idt_nl + << "skel_args[i])->arg ();" << be_uidt << be_uidt + << be_uidt << be_uidt_nl + << "}" << be_nl << be_nl; + + // OUT argument selection function template + *os << "template<typename T>" << be_nl + << "typename TAO::SArg_Traits<T>::out_arg_type" << be_nl + << "get_out_arg (TAO_Operation_Details const * details," + << be_nl + << " TAO::Argument * const * skel_args," << be_nl + << " size_t i)" << be_nl + << "{" << be_idt_nl + << "return" << be_idt_nl + << "details" << be_nl + << "? static_cast<typename TAO::Arg_Traits<T>::out_arg_val *> (" + << be_idt << be_idt_nl + << "details->args ()[i])->arg ()" + << be_uidt << be_uidt_nl + << ": static_cast<typename TAO::SArg_Traits<T>::out_arg_val *> (" + << be_idt << be_idt_nl + << "skel_args[i])->arg ();" << be_uidt << be_uidt + << be_uidt << be_uidt_nl + << "}" << be_uidt << be_uidt_nl; + + *os << "}" << be_uidt_nl; + } } break; @@ -99,8 +211,6 @@ int be_visitor_root::visit_root (be_root *node) -1); } - TAO_OutStream *os = this->ctx_->stream (); - // If we are generating the client header file, this is the place to // generate the proxy broker factory function pointer declarations // and the extern declarations for non-defined interfaces. @@ -1549,7 +1659,7 @@ be_visitor_root::gen_explicit_tmplinst (be_root *node, if (be_global->gen_anyop_files ()) { tao_cg->anyop_source ()->gen_endif_AHETI (); - + *tao_cg->anyop_source () << "\n"; } } diff --git a/TAO/TAO_IDL/be/be_visitor_traits.cpp b/TAO/TAO_IDL/be/be_visitor_traits.cpp index 189ad0d4f06..b4c528f9780 100644 --- a/TAO/TAO_IDL/be/be_visitor_traits.cpp +++ b/TAO/TAO_IDL/be/be_visitor_traits.cpp @@ -110,7 +110,7 @@ be_visitor_traits::visit_interface (be_interface *node) os->gen_ifdef_macro (node->flat_name (), "traits"); *os << be_nl << be_nl - << "ACE_TEMPLATE_SPECIALIZATION" << be_nl + << "template<>" << be_nl << "struct " << be_global->stub_export_macro () << " Objref_Traits<" << " ::" << node->name () << ">" << be_nl << "{" << be_idt_nl @@ -185,7 +185,7 @@ be_visitor_traits::visit_valuetype (be_valuetype *node) os->gen_ifdef_macro (node->flat_name (), "traits"); *os << be_nl << be_nl - << "ACE_TEMPLATE_SPECIALIZATION" << be_nl + << "template<>" << be_nl << "struct " << be_global->stub_export_macro () << " Value_Traits<" << node->name () << ">" << be_nl << "{" << be_idt_nl @@ -387,7 +387,7 @@ be_visitor_traits::visit_array (be_array *node) TAO_OutStream *os = this->ctx_->stream (); *os << be_nl << be_nl - << "ACE_TEMPLATE_SPECIALIZATION" << be_nl + << "template<>" << be_nl << "struct " << be_global->stub_export_macro () << " Array_Traits<" << be_idt << be_idt_nl << name << "," << be_nl diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_decl.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_decl.cpp index b51004f3d57..247095a8c12 100644 --- a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_decl.cpp +++ b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_decl.cpp @@ -18,8 +18,8 @@ // // ============================================================================ -ACE_RCSID (be_visitor_typecode, - typecode_decl, +ACE_RCSID (be_visitor_typecode, + typecode_decl, "$Id$") // ****************************************************** @@ -58,7 +58,7 @@ be_visitor_typecode_decl::visit_type (be_type *node) *os << "static "; } - *os << "::CORBA::TypeCode_ptr " + *os << "::CORBA::TypeCode_ptr const " << node->tc_name ()->last_component () << ";"; } @@ -66,8 +66,8 @@ be_visitor_typecode_decl::visit_type (be_type *node) { // We are in the ROOT scope. *os << "extern " << be_global->stub_export_macro () - << " ::CORBA::TypeCode_ptr " - << " " << node->tc_name ()->last_component () + << " ::CORBA::TypeCode_ptr const " + << node->tc_name ()->last_component () << ";"; } diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp index 62125ca7e31..b43f94e21bf 100644 --- a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp +++ b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp @@ -404,7 +404,7 @@ be_visitor_typecode_defn::visit_type (be_type *node) -1); } - *os << "::CORBA::TypeCode_ptr _tc_" + *os << "::CORBA::TypeCode_ptr const _tc_" << node->local_name () << " =" << be_idt_nl << "&_tc_TAO_tc_" @@ -422,7 +422,7 @@ be_visitor_typecode_defn::visit_type (be_type *node) else { // outermost scope. - *os << "::CORBA::TypeCode_ptr "; + *os << "::CORBA::TypeCode_ptr const "; // Tc name generation. *os << node->tc_name (); diff --git a/TAO/TAO_IDL/be_include/be_codegen.h b/TAO/TAO_IDL/be_include/be_codegen.h index c4086d203db..63ae9119fee 100644 --- a/TAO/TAO_IDL/be_include/be_codegen.h +++ b/TAO/TAO_IDL/be_include/be_codegen.h @@ -1,5 +1,7 @@ +// -*- C++ -*- +// // $Id$ -/* -*- c++ -*- */ + // ================================================================ // // = LIBRARY @@ -56,8 +58,6 @@ public: // Emitting code for arguments of an operation. No distinction between // headers, inlines, stubs. - TAO_ARGUMENT_INTERCEPTORS_ARGLIST_SS, // ... server source - TAO_ARGUMENT_INTERCEPTORS_INFO_ARGLIST_SS, // ... server source TAO_ARGUMENT_COLLOCATED_UPCALL_SS, // passing argument // variable to upcall @@ -72,8 +72,6 @@ public: TAO_INTERFACE_CH, TAO_INTERFACE_SMART_PROXY_CH, TAO_INTERFACE_SMART_PROXY_CS, - TAO_INTERFACE_INTERCEPTORS_SH, - TAO_INTERFACE_INTERCEPTORS_SS, TAO_INTERFACE_THRU_POA_PROXY_IMPL_SH, TAO_INTERFACE_THRU_POA_PROXY_IMPL_SS, @@ -101,13 +99,6 @@ public: TAO_OPERATION_ARGLIST_CH, // parameter list in op signature TAO_OPERATION_ARGLIST_SH, // ... for server header - TAO_OPERATION_INTERCEPTORS_PARAMLIST, // create the paramlist on demand - TAO_OPERATION_INTERCEPTORS_EXCEPTLIST, // create the exceptionlist on demand - TAO_OPERATION_INTERCEPTORS_ARGLIST_SH, // private member list list for request info - TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_SH, // private member list list for request info - TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_SS, // arglist for request info obj instantiation - TAO_OPERATION_INTERCEPTORS_ARGLIST_SS, // private member list list for request info // ... for server source - TAO_OPERATION_ARGLIST_PROXY_IMPL_XH, // Proxy impl arg list generation // in client/server header TAO_OPERATION_ARGLIST_PROXY_IMPL_XS, @@ -126,7 +117,6 @@ public: TAO_OPERATION_ARG_UPCALL_SS, // variables to upcall TAO_OPERATION_COLLOCATED_ARG_UPCALL_SS, // variables to upcall for // collocated op - TAO_OPERATION_INTERCEPTORS_ARG_INFO_SS, // Interceptor args TAO_OBV_OPERATION_ARGLIST_CH, // parameter list in obv op signature TAO_OBV_OPERATION_ARGLIST_CS, // used only for AMH exceptions @@ -393,7 +383,8 @@ private: void gen_seq_file_includes (void); void gen_any_file_includes (void); void gen_var_file_includes (void); - void gen_arg_file_includes (TAO_OutStream *stream); + void gen_stub_arg_file_includes (TAO_OutStream * stream); + void gen_skel_arg_file_includes (TAO_OutStream * stream); void gen_cond_file_include (bool condition_green, const char *filepath, TAO_OutStream *stream); diff --git a/TAO/TAO_IDL/be_include/be_interface.h b/TAO/TAO_IDL/be_include/be_interface.h index c0546cb8359..ab7a2b2cb90 100644 --- a/TAO/TAO_IDL/be_include/be_interface.h +++ b/TAO/TAO_IDL/be_include/be_interface.h @@ -1,4 +1,5 @@ -/* -*- c++ -*- */ +// -*- C++ -*- +// // $Id$ // ============================================================================ @@ -234,12 +235,6 @@ public: // Helper method passed to the template method that generates code for the // is_a method. - static int downcast_helper (be_interface *, - be_interface *, - TAO_OutStream *os); - // Helper method passed to the template method that generates code for the - // downcast. - static int ami_handler_gen_optable_helper (be_interface *, be_interface *, TAO_OutStream *os); @@ -297,7 +292,7 @@ public: const char *full_skeleton_name, TAO_OutStream *os); // generate the operation table entries. - + int convert_parent_ops (be_visitor *visitor); // If we are local, regenerate non-local base class operations as // pure virtual. @@ -338,7 +333,7 @@ public: int has_mixed_parentage (void); // Do we have both abstract and concrete parents? - + int session_component_child (void); // Is Components::SessionComponent an immediate parent? @@ -379,7 +374,7 @@ private: static void gen_throw_spec (UTL_ExceptList *list, TAO_OutStream *os); - // Helper for the helpers that generate collocated static + // Helper for the helpers that generate collocated static // base class methods. protected: @@ -403,7 +398,7 @@ private: int has_mixed_parentage_; // Do we have both abstract and concrete parents? - + int session_component_child_; // Are we a direct child of Components::SessionComponent? }; diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument.h b/TAO/TAO_IDL/be_include/be_visitor_argument.h index f18351d0870..e379754d28d 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_argument.h +++ b/TAO/TAO_IDL/be_include/be_visitor_argument.h @@ -1,6 +1,6 @@ +// -*- C++ -*- // // $Id$ -// // ============================================================================ // @@ -33,9 +33,5 @@ #include "be_visitor_argument/marshal_ss.h" #include "be_visitor_argument/invoke_cs.h" #include "be_visitor_argument/paramlist.h" -#include "be_visitor_argument/request_info_sh.h" -#include "be_visitor_argument/request_info_ss.h" -#include "be_visitor_argument/request_info_result.h" -#include "be_visitor_argument/request_info_arglist.h" #endif /* _BE_VISITOR_ARGUMENT_H */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/request_info_arglist.h b/TAO/TAO_IDL/be_include/be_visitor_argument/request_info_arglist.h deleted file mode 100644 index 81fb89a6f3d..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_argument/request_info_arglist.h +++ /dev/null @@ -1,108 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// request_info_arglist.h -// -// = DESCRIPTION -// Visitors for generation of code for Arguments as parameter lists in the -// RequestInfo constructor. -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// ============================================================================ - -#ifndef _BE_VISITOR_ARGUMENT_REQUEST_INFO_ARGLIST_H_ -#define _BE_VISITOR_ARGUMENT_REQUEST_INFO_ARGLIST_H_ - -class be_visitor_args_request_info_arglist : public be_visitor_args -{ - // - // = TITLE - // Generates the code for arguments output. - // - // = DESCRIPTION - // At several stages in the code generation a node of type - // "be_operation" is visited, and the code for its arguments must - // be generated. - // Sometimes the argument declarations must be generated (such as - // in the class declaration), other the arguments names (such as - // in method invocations). - // This class implements the declaration output, in other words, - // it outputs both the arguments and their types. - // -public: - be_visitor_args_request_info_arglist (be_visitor_context *ctx); - // constructor - - virtual ~be_visitor_args_request_info_arglist (void); - // destructor - - virtual int visit_argument (be_argument *node); - // visit the argument node - - // =visit all the nodes that can be the types for the argument - - virtual int visit_array (be_array *node); - // visit array type - - virtual int visit_enum (be_enum *node); - // visit the enum node - - virtual int visit_interface (be_interface *node); - // visit interface - - virtual int visit_interface_fwd (be_interface_fwd *node); - // visit interface forward - - virtual int visit_native (be_native *node); - // visit native node - - virtual int visit_predefined_type (be_predefined_type *node); - // visit predefined type - - virtual int visit_sequence (be_sequence *node); - // visit sequence type - - virtual int visit_string (be_string *node); - // visit string type - - virtual int visit_structure (be_structure *node); - // visit structure type - - virtual int visit_union (be_union *node); - // visit union type - - virtual int visit_typedef (be_typedef *node); - // visit the typedef type - - virtual int visit_valuetype (be_valuetype *node); - // visit valuetype - - virtual int visit_valuetype_fwd (be_valuetype_fwd *node); - // visit valuetype_fwd - - virtual int visit_component (be_component *node); - // visit a component node - - virtual int visit_component_fwd (be_component_fwd *node); - // visit a forward declared component node - - virtual int visit_eventtype (be_eventtype *node); - // visit an eventtype node - - virtual int visit_eventtype_fwd (be_eventtype_fwd *node); - // visit a forward declared eventtype node - - virtual int visit_home (be_home *node); - // visit a component home -}; - -#endif /* _BE_VISITOR_ARGUMENT_REQUEST_INFO_ARGLIST_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/request_info_ch.h b/TAO/TAO_IDL/be_include/be_visitor_argument/request_info_ch.h deleted file mode 100644 index bc93a98ef51..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_argument/request_info_ch.h +++ /dev/null @@ -1,109 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// request_info.h -// -// = DESCRIPTION -// Visitors for generation of code for Arguments as private member lists in the -// request_info class for interceptors -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// ============================================================================ - -#ifndef _BE_VISITOR_ARGUMENT_REQUEST_INFO_CH_H_ -#define _BE_VISITOR_ARGUMENT_REQUEST_INFO_CH_H_ - -class be_visitor_args_request_info_ch : public be_visitor_args -{ - // - // = TITLE - // Generates the code for arguments output. - // - // = DESCRIPTION - // At several stages in the code generation a node of type - // "be_operation" is visited, and the code for its arguments must - // be generated. - // Sometimes the argument declarations must be generated (such as - // in the class declaration), other the arguments names (such as - // in method invocations). - // This class implements the declaration output, in other words, - // it outputs both the arguments and their types. - // -public: - be_visitor_args_request_info_ch (be_visitor_context *ctx); - // constructor - - virtual ~be_visitor_args_request_info_ch (void); - // destructor - - virtual int visit_argument (be_argument *node); - // visit the argument node - - - // =visit all the nodes that can be the types for the argument - - virtual int visit_array (be_array *node); - // visit array type - - virtual int visit_enum (be_enum *node); - // visit the enum node - - virtual int visit_interface (be_interface *node); - // visit interface - - virtual int visit_interface_fwd (be_interface_fwd *node); - // visit interface forward - - virtual int visit_native (be_native *node); - // visit native node - - virtual int visit_predefined_type (be_predefined_type *node); - // visit predefined type - - virtual int visit_sequence (be_sequence *node); - // visit sequence type - - virtual int visit_string (be_string *node); - // visit string type - - virtual int visit_structure (be_structure *node); - // visit structure type - - virtual int visit_union (be_union *node); - // visit union type - - virtual int visit_typedef (be_typedef *node); - // visit the typedef type - - virtual int visit_valuetype (be_valuetype *node); - // visit valuetype - - virtual int visit_valuetype_fwd (be_valuetype_fwd *node); - // visit valuetype_fwd - - virtual int visit_component (be_component *node); - // visit a component node - - virtual int visit_component_fwd (be_component_fwd *node); - // visit a forward declared component node - - virtual int visit_eventtype (be_eventtype *node); - // visit an eventtype node - - virtual int visit_eventtype_fwd (be_eventtype_fwd *node); - // visit a forward declared eventtype node - - virtual int visit_home (be_home *node); - // visit a component home -}; - -#endif /* _BE_VISITOR_ARGUMENT_REQUEST_INFO_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/request_info_cs.h b/TAO/TAO_IDL/be_include/be_visitor_argument/request_info_cs.h deleted file mode 100644 index 569323254db..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_argument/request_info_cs.h +++ /dev/null @@ -1,48 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// request_info_cs.h -// -// = DESCRIPTION -// Visitors for generation of code for Arguments as private member lists in the -// request_info class for interceptors -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// ============================================================================ - -#ifndef _BE_VISITOR_ARGUMENT_REQUEST_INFO_CS_H_ -#define _BE_VISITOR_ARGUMENT_REQUEST_INFO_CS_H_ - -class be_visitor_args_request_info_cs : public be_visitor_args -{ - // - // = TITLE - // Generates the code for arguments output. - // - // = DESCRIPTION - // At several stages in the code generation a node of type - // "be_operation" is visited, and the code for its arguments must - // be generated. This class generates the constructor member list - // for the Request_Info class. - // -public: - be_visitor_args_request_info_cs (be_visitor_context *ctx); - // constructor - - virtual ~be_visitor_args_request_info_cs (void); - // destructor - - virtual int visit_argument (be_argument *node); - // visit the argument node -}; - -#endif /* _BE_VISITOR_ARGUMENT_REQUEST_INFO_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/request_info_result.h b/TAO/TAO_IDL/be_include/be_visitor_argument/request_info_result.h deleted file mode 100644 index feadf9c20aa..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_argument/request_info_result.h +++ /dev/null @@ -1,97 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// request_info_result.h -// -// = DESCRIPTION -// Visitors for generation of code for building Dynamic::Result -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// ============================================================================ - -#ifndef _BE_VISITOR_ARGUMENT_REQUEST_INFO_RESULT_H_ -#define _BE_VISITOR_ARGUMENT_REQUEST_INFO_RESULT_H_ - -class be_visitor_args_request_info_result : public be_visitor_args -{ - // - // = TITLE - // Generates the code for request info result output. - // - // = DESCRIPTION - // At several stages in the code generation a node of type - // "be_operation" is visited, and the code for its arguments must - // be generated. Here the generationis to build the ParameterList - // on demand. - -public: - be_visitor_args_request_info_result (be_visitor_context *ctx); - // constructor - - virtual ~be_visitor_args_request_info_result (void); - // destructor - - virtual int visit_argument (be_argument *node); - // visit the argument node - - // =visit all the nodes that can be the types for the argument - - virtual int visit_array (be_array *node); - // visit array type - - virtual int visit_enum (be_enum *node); - // visit the enum node - - virtual int visit_interface (be_interface *node); - // visit interface - - virtual int visit_interface_fwd (be_interface_fwd *node); - // visit interface forward - - virtual int visit_valuetype (be_valuetype *node); - // visit valuetype - - virtual int visit_valuetype_fwd (be_valuetype_fwd *node); - // visit valuetype forward - - virtual int visit_predefined_type (be_predefined_type *node); - // visit predefined type - - virtual int visit_sequence (be_sequence *node); - // visit sequence type - - virtual int visit_string (be_string *node); - // visit string type - - virtual int visit_structure (be_structure *node); - // visit structure type - - virtual int visit_union (be_union *node); - // visit union type - - virtual int visit_typedef (be_typedef *node); - // visit the typedef type - - virtual int visit_component (be_component *node); - // visit a component node - - virtual int visit_component_fwd (be_component_fwd *node); - // visit a forward declared component node - - virtual int visit_eventtype (be_eventtype *node); - // visit an eventtype node - - virtual int visit_eventtype_fwd (be_eventtype_fwd *node); - // visit a forward declared eventtype node -}; - -#endif /* _BE_VISITOR_ARGUMENT_REQUEST_INFO_RESULT_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/request_info_sh.h b/TAO/TAO_IDL/be_include/be_visitor_argument/request_info_sh.h deleted file mode 100644 index e5218f796b6..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_argument/request_info_sh.h +++ /dev/null @@ -1,106 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// request_info_sh.h -// -// = DESCRIPTION -// Visitors for generation of code for Arguments as private member lists in the -// request_info class for interceptors -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// ============================================================================ - -#ifndef _BE_VISITOR_ARGUMENT_REQUEST_INFO_SH_H_ -#define _BE_VISITOR_ARGUMENT_REQUEST_INFO_SH_H_ - -class be_visitor_args_request_info_sh : public be_visitor_args -{ - // - // = TITLE - // Generates the code for arguments output. - // - // = DESCRIPTION - // At several stages in the code generation a node of type - // "be_operation" is visited, and the code for its arguments must - // be generated. - // Sometimes the argument declarations must be generated (such as - // in the class declaration), other the arguments names (such as - // in method invocations). - // This class implements the declaration output, in other words, - // it outputs both the arguments and their types. - // -public: - be_visitor_args_request_info_sh (be_visitor_context *ctx); - // constructor - - virtual ~be_visitor_args_request_info_sh (void); - // destructor - - virtual int visit_argument (be_argument *node); - // visit the argument node - - - // =visit all the nodes that can be the types for the argument - - virtual int visit_array (be_array *node); - // visit array type - - virtual int visit_enum (be_enum *node); - // visit the enum node - - virtual int visit_interface (be_interface *node); - // visit interface - - virtual int visit_interface_fwd (be_interface_fwd *node); - // visit interface forward - - virtual int visit_native (be_native *node); - // visit native node - - virtual int visit_predefined_type (be_predefined_type *node); - // visit predefined type - - virtual int visit_sequence (be_sequence *node); - // visit sequence type - - virtual int visit_string (be_string *node); - // visit string type - - virtual int visit_structure (be_structure *node); - // visit structure type - - virtual int visit_union (be_union *node); - // visit union type - - virtual int visit_typedef (be_typedef *node); - // visit the typedef type - - virtual int visit_valuetype (be_valuetype *node); - // visit valuetype - - virtual int visit_valuetype_fwd (be_valuetype_fwd *node); - // visit valuetype_fwd - - virtual int visit_component (be_component *node); - // visit a component node - - virtual int visit_component_fwd (be_component_fwd *node); - // visit a forward declared component node - - virtual int visit_eventtype (be_eventtype *node); - // visit an eventtype node - - virtual int visit_eventtype_fwd (be_eventtype_fwd *node); - // visit a forward declared eventtype node -}; - -#endif /* _BE_VISITOR_ARGUMENT_REQUEST_INFO_SH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/request_info_ss.h b/TAO/TAO_IDL/be_include/be_visitor_argument/request_info_ss.h deleted file mode 100644 index 00d6706136f..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_argument/request_info_ss.h +++ /dev/null @@ -1,48 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// request_info_ss.h -// -// = DESCRIPTION -// Visitors for generation of code for Arguments as private member lists in the -// request_info class for interceptors -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// ============================================================================ - -#ifndef _BE_VISITOR_ARGUMENT_REQUEST_INFO_SS_H_ -#define _BE_VISITOR_ARGUMENT_REQUEST_INFO_SS_H_ - -class be_visitor_args_request_info_ss : public be_visitor_args -{ - // - // = TITLE - // Generates the code for arguments output. - // - // = DESCRIPTION - // At several stages in the code generation a node of type - // "be_operation" is visited, and the code for its arguments must - // be generated. This class generates the constructor member list - // for the Request_Info class. - // -public: - be_visitor_args_request_info_ss (be_visitor_context *ctx); - // constructor - - virtual ~be_visitor_args_request_info_ss (void); - // destructor - - virtual int visit_argument (be_argument *node); - // visit the argument node -}; - -#endif /* _BE_VISITOR_ARGUMENT_REQUEST_INFO_SS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface.h b/TAO/TAO_IDL/be_include/be_visitor_interface.h index 60a57feb6ef..dc5d7af1daa 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_interface.h +++ b/TAO/TAO_IDL/be_include/be_visitor_interface.h @@ -43,7 +43,6 @@ #include "be_visitor_interface/ami_interface_ch.h" #include "be_visitor_interface/smart_proxy_ch.h" #include "be_visitor_interface/smart_proxy_cs.h" -#include "be_visitor_interface/interceptors_ss.h" // Proxy Brokers #include "be_visitor_interface/strategized_proxy_broker_sh.h" diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/amh_ss.h b/TAO/TAO_IDL/be_include/be_visitor_interface/amh_ss.h index b9b5f6a6717..c65578519df 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_interface/amh_ss.h +++ b/TAO/TAO_IDL/be_include/be_visitor_interface/amh_ss.h @@ -1,3 +1,5 @@ +// -*- C++ -*- + //============================================================================= /** * @file amh_ss.h @@ -33,8 +35,8 @@ protected: virtual int generate_amh_classes (be_interface *node); virtual int generate_proxy_classes (be_interface *node); - virtual int generate_downcast_implementation (be_interface *node, - TAO_OutStream *os); +// virtual int generate_downcast_implementation (be_interface *node, +// TAO_OutStream *os); virtual int generate_copy_ctor (be_interface *node, TAO_OutStream *os); virtual ACE_CString generate_flat_name (be_interface *node); diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/interceptors_cs.h b/TAO/TAO_IDL/be_include/be_visitor_interface/interceptors_cs.h deleted file mode 100644 index 95ca89fde04..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_interface/interceptors_cs.h +++ /dev/null @@ -1,51 +0,0 @@ -// -// $Id$ -// -/* -*- c++ -*- */ -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// interceptors_cs.h -// -// = DESCRIPTION -// Concrete visitor for the Interface node. -// This provides code generation for interceptor classes for an -// interface in the client header. -// -// = AUTHOR -// Kirthika Parameswaran -// -// ============================================================================ - -#ifndef _BE_INTERFACE_INTERCEPTORS_CS_H_ -#define _BE_INTERFACE_INTERCEPTORS_CS_H_ - -class be_visitor_interface_interceptors_cs : public be_visitor_interface -{ - // = TITLE - // Generate the "interceptors" class declaration. - -public: - be_visitor_interface_interceptors_cs (be_visitor_context *ctx); - // constructor - - virtual ~be_visitor_interface_interceptors_cs (void); - // destructor - - virtual int visit_interface (be_interface *node); - // visit an interface - - virtual int visit_component (be_component *node); - // visit a component - - static int gen_abstract_ops_helper (be_interface *node, - be_interface *base, - TAO_OutStream *os); - // Helper to generate the declarations for the operations - // of any abstract parents we may have. -}; - -#endif /* _BE_INTERFACE_INTERCEPTORS_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/interceptors_ss.h b/TAO/TAO_IDL/be_include/be_visitor_interface/interceptors_ss.h deleted file mode 100644 index 22df885f3b3..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_interface/interceptors_ss.h +++ /dev/null @@ -1,51 +0,0 @@ -// -// $Id$ -// -/* -*- c++ -*- */ -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// interceptors_ss.h -// -// = DESCRIPTION -// Concrete visitor for the Interface node. -// This provides code generation for interceptor classes for an -// interface in the server source. -// -// = AUTHOR -// Kirthika Parameswaran -// -// ============================================================================ - -#ifndef _BE_INTERFACE_INTERCEPTORS_SS_H_ -#define _BE_INTERFACE_INTERCEPTORS_SS_H_ - -class be_visitor_interface_interceptors_ss : public be_visitor_interface -{ - // = TITLE - // Generate the "interceptors" class declaration. - -public: - be_visitor_interface_interceptors_ss (be_visitor_context *ctx); - // constructor - - virtual ~be_visitor_interface_interceptors_ss (void); - // destructor - - virtual int visit_interface (be_interface *node); - // visit an interface - - virtual int visit_component (be_component *node); - // visit a component - - static int gen_abstract_ops_helper (be_interface *node, - be_interface *base, - TAO_OutStream *os); - // Helper to generate the declarations for the operations - // of any abstract parents we may have. -}; - -#endif /* _BE_INTERFACE_INTERCEPTORS_SS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ss.h b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ss.h index 26017450331..67642002063 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ss.h +++ b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_ss.h @@ -1,7 +1,8 @@ +// -*- C++ -*- // // $Id$ -// -/* -*- c++ -*- */ + + // ============================================================================ // // = LIBRARY @@ -59,8 +60,8 @@ protected: virtual int generate_amh_classes (be_interface *node); virtual int generate_proxy_classes (be_interface *node); - virtual int generate_downcast_implementation (be_interface *node, - TAO_OutStream *os); +// virtual int generate_downcast_implementation (be_interface *node, +// TAO_OutStream *os); virtual int generate_copy_ctor (be_interface *node, TAO_OutStream *os); virtual ACE_CString generate_flat_name (be_interface *node); diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation.h b/TAO/TAO_IDL/be_include/be_visitor_operation.h index afd8113fc9d..41284d1d669 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_operation.h +++ b/TAO/TAO_IDL/be_include/be_visitor_operation.h @@ -39,6 +39,7 @@ #include "be_visitor_operation/rettype_is.h" #include "be_visitor_operation/rettype_return_cs.h" #include "be_visitor_operation/exceptlist_cs.h" +#include "be_visitor_operation/exceptlist_ss.h" #include "be_visitor_operation/argument.h" #include "be_visitor_operation/argument_invoke.h" #include "be_visitor_operation/argument_marshal.h" @@ -53,12 +54,7 @@ #include "be_visitor_operation/ami_exception_holder_operation_cs.h" #include "be_visitor_operation/smart_proxy_ch.h" #include "be_visitor_operation/smart_proxy_cs.h" -#include "be_visitor_operation/interceptors_arglist.h" -#include "be_visitor_operation/interceptors_sh.h" -#include "be_visitor_operation/interceptors_ss.h" -#include "be_visitor_operation/interceptors_exceptlist.h" -#include "be_visitor_operation/interceptors_info_rettype.h" -#include "be_visitor_operation/interceptors_result.h" +#include "be_visitor_operation/upcall_command_ss.h" #include "be_visitor_operation/proxy_impl_xh.h" #include "be_visitor_operation/thru_poa_proxy_impl_ss.h" #include "be_visitor_operation/direct_proxy_impl_ss.h" diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/exceptlist_ss.h b/TAO/TAO_IDL/be_include/be_visitor_operation/exceptlist_ss.h new file mode 100644 index 00000000000..7af7556bdd6 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/exceptlist_ss.h @@ -0,0 +1,54 @@ +// -*- C++ -*- +// +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// exceptlist_ss.h +// +// = DESCRIPTION +// Generates the array of user exception TypeCodes used by the +// skeletons. +// +// = AUTHOR +// Ossama Othman +// +// ============================================================================ + +#ifndef _BE_VISITOR_OPERATION_EXCEPTIONLIST_SS_H_ +#define _BE_VISITOR_OPERATION_EXCEPTIONLIST_SS_H_ + +// *************************************************************************** +// Visitor for generating the user exception TypeCode list used by the +// skeletons. +// *************************************************************************** + +class be_visitor_operation_exceptlist_ss : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_operaion_exceptlist_ss + // + // = DESCRIPTION + // This is a visitor to generate operation exception TypeCode list + // to be used by the skeletons. + // + // +public: + + /// constructor + be_visitor_operation_exceptlist_ss (be_visitor_context * ctx); + + /// destructor + ~be_visitor_operation_exceptlist_ss (void); + + /// visit the operation + int visit_operation (be_operation * node); + +}; + +#endif /* _BE_VISITOR_OPERATION_EXCEPTIONLIST_SS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/interceptors_arglist.h b/TAO/TAO_IDL/be_include/be_visitor_operation/interceptors_arglist.h deleted file mode 100644 index 04027eaeaf2..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/interceptors_arglist.h +++ /dev/null @@ -1,58 +0,0 @@ -// -// $Id$ -// -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// interceptors_arglist.h -// -// = DESCRIPTION -// Visitor for generating code for IDL operations. This generates the -// operation signature. -// -// = AUTHOR -// Kirthika Parameswaran -// -// ============================================================================ - -#ifndef _BE_VISITOR_OPERATION_INTERCEPTORS_ARGLIST_H_ -#define _BE_VISITOR_OPERATION_INTERCEPTORS_ARGLIST_H_ - -// ****************************************************************************** -// Operation visitor for argument list - generates parameters in the signature -// ****************************************************************************** - -class be_visitor_operation_interceptors_arglist : public be_visitor_operation -{ - // - // = TITLE - // be_visitor_operaion_interceptors_arglist - // - // = DESCRIPTION - // This is a visitor to generate operation argument list - // - // -public: - be_visitor_operation_interceptors_arglist (be_visitor_context *ctx); - // constructor - - ~be_visitor_operation_interceptors_arglist (void); - // destructor - - virtual int visit_operation (be_operation *node); - // visit the operation - - virtual int visit_argument (be_argument *node); - // visit each argument - - virtual int pre_process (be_decl *); - // stuff to o/p before each element of the scope is handled - - virtual int post_process (be_decl *); - // stuff to o/p after each element of the scope is handled -}; - -#endif /* _BE_VISITOR_OPERATION_INTERCEPTORS_ARGLIST_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/interceptors_ch.h b/TAO/TAO_IDL/be_include/be_visitor_operation/interceptors_ch.h deleted file mode 100644 index 18e4cae5c90..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/interceptors_ch.h +++ /dev/null @@ -1,51 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// interceptors_ch.h -// -// = DESCRIPTION -// Visitor for generating code for IDL operations for the interceptor case -// inside of the client stubs header -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// ============================================================================ - -#ifndef _BE_VISITOR_OPERATION_INTERCEPTORS_CH_H_ -#define _BE_VISITOR_OPERATION_INTERCEPTORS_CH_H_ - -// ************************************************************ -// Operation visitor for client header in the interceptor class -// ************************************************************ - -class be_visitor_operation_interceptors_ch : public be_visitor_operation -{ - // - // = TITLE - // be_visitor_operation_interceptors_ch - // - // = DESCRIPTION - // This is a concrete visitor to generate the client request info - // in header for operation in the interceptor class - // - // -public: - be_visitor_operation_interceptors_ch (be_visitor_context *ctx); - // constructor - - ~be_visitor_operation_interceptors_ch (void); - // destructor - - virtual int visit_operation (be_operation *node); - // visit operation node. -}; - -#endif /* _BE_VISITOR_OPERATION_INTERCEPTORS_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/interceptors_cs.h b/TAO/TAO_IDL/be_include/be_visitor_operation/interceptors_cs.h deleted file mode 100644 index ad6771ae902..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/interceptors_cs.h +++ /dev/null @@ -1,61 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// interceptors_cs.h -// -// = DESCRIPTION -// Visitor for generating code for IDL operations. This is a generic visitor -// that calls visitors for the operation class. -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// ============================================================================ - -#ifndef _BE_VISITOR_OPERATION_INTERCEPTORS_CS_H_ -#define _BE_VISITOR_OPERATION_INTERCEPTORS_CS_H_ - -// ************************************************************ -// generic operation visitor for docall, upcall, pre/post -// ************************************************************ - -class TAO_OutStream; - -class be_visitor_operation_interceptors_cs : public be_visitor_operation -{ - // - // = TITLE - // be_visitor_operation_interceptors_cs - // - // = DESCRIPTION - // This is a visitor to generate a variable declaration ofr an operation - // return type - // -public: - be_visitor_operation_interceptors_cs (be_visitor_context *ctx); - // constructor - - ~be_visitor_operation_interceptors_cs (void); - // destructor - - virtual int visit_operation (be_operation *node); - // visit the operation - -private: - int generate_class_declaration (TAO_OutStream *os, - be_operation *node); - // Generate the declaration for the helper RequestInfo class - - int generate_class_definition (TAO_OutStream *os, - be_operation *node); - // Generate the definition for the helper RequestInfo class -}; - -#endif /* _BE_VISITOR_OPERATION_INTERCEPTORS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/interceptors_exceptlist.h b/TAO/TAO_IDL/be_include/be_visitor_operation/interceptors_exceptlist.h deleted file mode 100644 index e829f7c37f2..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/interceptors_exceptlist.h +++ /dev/null @@ -1,50 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// operation_interceptors_exceptlist.h -// -// = DESCRIPTION -// Visitor for generating code for exceptionlist for interceptors -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// ============================================================================ - -#ifndef _BE_VISITOR_OPERATION_OPERATION_INTERCEPTORS_EXCEPTLIST_H_ -#define _BE_VISITOR_OPERATION_OPERATION_INTERCEPTORS_EXCEPTLIST_H_ - - -class be_visitor_operation_interceptors_exceptlist : public be_visitor_operation -{ - // - // = TITLE - // be_visitor_operation_interceptors_exceptlist - // - // = DESCRIPTION - // This is a concrete visitor to generate exceptionlist for interceptors - // - // -public: - be_visitor_operation_interceptors_exceptlist (be_visitor_context *ctx); - // constructor - - ~be_visitor_operation_interceptors_exceptlist (void); - // destructor - - virtual int visit_operation (be_operation *node); - // visit operation. - protected: - virtual int gen_exceptlist (be_operation *node); -}; - - - -#endif /* _BE_VISITOR_OPERATION_OPERATION_INTERCEPTORS_EXCEPTLIST_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/interceptors_info_rettype.h b/TAO/TAO_IDL/be_include/be_visitor_operation/interceptors_info_rettype.h deleted file mode 100644 index 39480d1804a..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/interceptors_info_rettype.h +++ /dev/null @@ -1,101 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// interceptors_info_rettype.h -// -// = DESCRIPTION -// Visitor for generating code for IDL operations. This generates the return -// type stored in the RequestInfo class for Interceptors. -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// ============================================================================ - -#ifndef _BE_VISITOR_OPERATION_INTERCEPTORS_INFO_RETTYPE_H_ -#define _BE_VISITOR_OPERATION_INTERCEPTORS_INFO_RETTYPE_H_ - -// *********************************************************************** -// Operation visitor for return types in the signature of the operation -// *********************************************************************** - -class be_visitor_operation_interceptors_info_rettype : public be_visitor_decl -{ - // - // = TITLE - // be_visitor_operation_ch - // - // = DESCRIPTION - // This is a visitor to generate operation return types - // - // -public: - be_visitor_operation_interceptors_info_rettype (be_visitor_context *ctx); - // constructor - - ~be_visitor_operation_interceptors_info_rettype (void); - // destructor - - int visit_array (be_array *node); - // visit an array node - - int visit_enum (be_enum *node); - // visit an enum node - - int visit_interface (be_interface *node); - // visit an interface node - - int visit_interface_fwd (be_interface_fwd *node); - // visit a forward declared interface node - - int visit_native (be_native *node); - // visit native type - - int visit_predefined_type (be_predefined_type *node); - // visit a predefined type node - - int visit_sequence (be_sequence *node); - // visit a sequence node - - int visit_string (be_string *node); - // visit a sequence node - - int visit_structure (be_structure *node); - // visit a structure node - - int visit_typedef (be_typedef *node); - // visit a typedef node - - int visit_union (be_union *node); - // visit a union node - - int visit_valuetype (be_valuetype *node); - // visit a valuetype node - - int visit_valuetype_fwd (be_valuetype_fwd *node); - // visit a forward declared valuetype node - - int visit_component (be_component *node); - // visit a component node - - int visit_component_fwd (be_component_fwd *node); - // visit a forward declared component node - - int visit_eventtype (be_eventtype *node); - // visit an eventtype node - - int visit_eventtype_fwd (be_eventtype_fwd *node); - // visit a forward declared eventtype node - - int visit_home (be_home *node); - // visit a component home node -}; - -#endif /* _BE_VISITOR_OPERATION_INTERCEPTORS_INFO_RETTYPE_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/interceptors_result.h b/TAO/TAO_IDL/be_include/be_visitor_operation/interceptors_result.h deleted file mode 100644 index 5f7abd89ea9..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/interceptors_result.h +++ /dev/null @@ -1,97 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// interceptors_result.h -// -// = DESCRIPTION -// Visitors for generation of code for building Dynamic::Result -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// ============================================================================ - -#ifndef _BE_VISITOR_OPERATION_INTERCEPTORS_RESULT_H_ -#define _BE_VISITOR_OPERATION_INTERCEPTORS_RESULT_H_ - -class be_visitor_operation_interceptors_result : public be_visitor_decl -{ - // - // = TITLE - // Generates the code for request info result output. - // - // = DESCRIPTION - // At several stages in the code generation a node of type - // "be_operation" is visited, and the code for its arguments must - // be generated. Here the generationis to build the ParameterList - // on demand. - -public: - be_visitor_operation_interceptors_result (be_visitor_context *ctx); - // constructor - - virtual ~be_visitor_operation_interceptors_result (void); - // destructor - - // =visit all the nodes that can be the types for the result - - virtual int visit_array (be_array *node); - // visit array type - - virtual int visit_enum (be_enum *node); - // visit the enum node - - virtual int visit_interface (be_interface *node); - // visit interface - - virtual int visit_interface_fwd (be_interface_fwd *node); - // visit interface forward - - virtual int visit_valuetype (be_valuetype *node); - // visit valuetype - - virtual int visit_valuetype_fwd (be_valuetype_fwd *node); - // visit valuetype forward - - virtual int visit_predefined_type (be_predefined_type *node); - // visit predefined type - - virtual int visit_sequence (be_sequence *node); - // visit sequence type - - virtual int visit_string (be_string *node); - // visit string type - - virtual int visit_structure (be_structure *node); - // visit structure type - - virtual int visit_union (be_union *node); - // visit union type - - virtual int visit_typedef (be_typedef *node); - // visit the typedef type - - virtual int visit_component (be_component *node); - // visit a component node - - virtual int visit_component_fwd (be_component_fwd *node); - // visit a forward declared component node - - virtual int visit_eventtype (be_eventtype *node); - // visit an eventtype node - - virtual int visit_eventtype_fwd (be_eventtype_fwd *node); - // visit a forward declared eventtype node - - virtual int visit_home (be_home *node); - // visit a component home node -}; - -#endif /* _BE_VISITOR_OPERATION_INTERCEPTORS_RESULT_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/interceptors_sh.h b/TAO/TAO_IDL/be_include/be_visitor_operation/interceptors_sh.h deleted file mode 100644 index d9e6f7ee4e7..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/interceptors_sh.h +++ /dev/null @@ -1,51 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// interceptors_sh.h -// -// = DESCRIPTION -// Visitor for generating code for IDL operations for the interceptor case -// inside of the server side header -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// ============================================================================ - -#ifndef _BE_VISITOR_OPERATION_INTERCEPTORS_SH_H_ -#define _BE_VISITOR_OPERATION_INTERCEPTORS_SH_H_ - -// ************************************************************ -// Operation visitor for client header in the interceptor class -// ************************************************************ - -class be_visitor_operation_interceptors_sh : public be_visitor_operation -{ - // - // = TITLE - // be_visitor_operation_interceptors_sh - // - // = DESCRIPTION - // This is a concrete visitor to generate the client request info - // in header for operation in the interceptor class - // - // -public: - be_visitor_operation_interceptors_sh (be_visitor_context *ctx); - // constructor - - ~be_visitor_operation_interceptors_sh (void); - // destructor - - virtual int visit_operation (be_operation *node); - // visit operation node. -}; - -#endif /* _BE_VISITOR_OPERATION_INTERCEPTORS_SH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/interceptors_ss.h b/TAO/TAO_IDL/be_include/be_visitor_operation/interceptors_ss.h deleted file mode 100644 index 72e3b56df83..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/interceptors_ss.h +++ /dev/null @@ -1,59 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// interceptors_ss.h -// -// = DESCRIPTION -// Visitor for generating code for IDL operations. This is a generic visitor -// that calls visitors for the operation class. -// -// = AUTHOR -// Kirthika Parameswaran <kirthika@cs.wustl.edu> -// -// ============================================================================ - -#ifndef _BE_VISITOR_OPERATION_INTERCEPTORS_SS_H_ -#define _BE_VISITOR_OPERATION_INTERCEPTORS_SS_H_ - -// ************************************************************ -// generic operation visitor for docall, upcall, pre/post -// ************************************************************ - -class be_visitor_operation_interceptors_ss : public be_visitor_operation -{ - // - // = TITLE - // be_visitor_operation_interceptors_ss - // - // = DESCRIPTION - // This is a visitor to generate a variable declaration ofr an operation - // return type - // -public: - be_visitor_operation_interceptors_ss (be_visitor_context *ctx); - // constructor - - ~be_visitor_operation_interceptors_ss (void); - // destructor - - virtual int visit_operation (be_operation *node); - // visit the operation - -private: - int generate_class_declaration (TAO_OutStream *os, - be_operation *node); - // Generate the declaration for the helper RequestInfo class - - int generate_class_definition (TAO_OutStream *os, - be_operation *node); - // Generate the definition for the helper RequestInfo class -}; - -#endif /* _BE_VISITOR_OPERATION_INTERCEPTORS_SS_H_ */ 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 49714baac26..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$ -// // ============================================================================ // @@ -47,7 +47,7 @@ public: virtual int void_return_type (be_type *); // is my return type void? - virtual int has_param_type (be_operation *, + virtual int has_param_type (be_operation *, AST_Argument::Direction); // does any of the argument node have the specified direction @@ -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); diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/operation_ss.h b/TAO/TAO_IDL/be_include/be_visitor_operation/operation_ss.h index 2ef99dc4160..826d9912e6c 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/operation_ss.h +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/operation_ss.h @@ -1,6 +1,6 @@ +// -*- C++ -*- // // $Id$ -// // ============================================================================ // @@ -53,17 +53,13 @@ public: virtual int gen_pre_skel_info (be_operation *node); // generate any pre skeleton code info - virtual int gen_demarshal_params (be_operation *node, - be_type *bt); - // generate code for demarshaling incoming parameters - - virtual int gen_marshal_params (be_operation *node, - be_type *bt); - // generate code for marshaling outgoing parameters + /// Generate the skeleton operation body. + int gen_skel_operation_body (be_operation * node, + be_type * return_type); - // = helper - virtual int post_process (be_decl *); - // stuff to output after every member of the scope is handled + /// Generate the skeleton operation argument list. + void gen_skel_body_arglist (be_operation * node, + TAO_OutStream * os); }; #endif /* _BE_VISITOR_OPERATION_OPERATION_SS_H_ */ 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 new file mode 100644 index 00000000000..99d87780b72 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/upcall_command_ss.h @@ -0,0 +1,49 @@ +// -*- C++ -*- +// +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// upcall_command_ss.cpp +// +// = DESCRIPTION +// Visitor that generates operation-specific TAO::Upcall_Command +// objects in skeletons. +// +// = AUTHOR +// Ossama Othman +// +// ============================================================================ + +#ifndef _BE_VISITOR_OPERATION_UPCALL_COMMAND_SS_H_ +#define _BE_VISITOR_OPERATION_UPCALL_COMMAND_SS_H_ + +class be_visitor_operation_upcall_command_ss + : public be_visitor_operation +{ +public: + + /// constructor + be_visitor_operation_upcall_command_ss (be_visitor_context * ctx); + + /// destructor + ~be_visitor_operation_upcall_command_ss (void); + + /// 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. + int gen_upcall (be_operation * node); + +}; + +#endif /* _BE_VISITOR_OPERATION_UPCALL_COMMAND_SS_H_ */ diff --git a/TAO/tao/Abstract_Servant_Base.h b/TAO/tao/Abstract_Servant_Base.h index 2fb1e26a510..d58be951cc0 100644 --- a/TAO/tao/Abstract_Servant_Base.h +++ b/TAO/tao/Abstract_Servant_Base.h @@ -105,9 +105,6 @@ public: virtual void _remove_ref (ACE_ENV_SINGLE_ARG_DECL); //@} - /// Get the correct vtable. - virtual void *_downcast (const char *repository_id) = 0; - /// This is an auxiliary method for _this() and _narrow(). virtual TAO_Stub *_create_stub (ACE_ENV_SINGLE_ARG_DECL) = 0; diff --git a/TAO/tao/Any_Arg_Traits.h b/TAO/tao/Any_Arg_Traits.h index 624e051bdd9..5cbf50e0558 100644 --- a/TAO/tao/Any_Arg_Traits.h +++ b/TAO/tao/Any_Arg_Traits.h @@ -16,14 +16,14 @@ #include /**/ "ace/pre.h" +#include "tao/TAO_Export.h" + #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "tao/Arg_Traits_T.h" #include "tao/Var_Size_Argument_T.h" -#include "tao/Var_Size_SArgument_T.h" -#include "tao/TAO_Export.h" +#include "tao/Arg_Traits_T.h" namespace CORBA { @@ -44,17 +44,6 @@ namespace TAO > { }; - - template<> - class TAO_Export SArg_Traits<CORBA::Any> - : public - Var_Size_SArg_Traits_T< - CORBA::Any, - CORBA::Any_var, - CORBA::Any_out - > - { - }; } #include /**/ "ace/post.h" diff --git a/TAO/tao/Argument.h b/TAO/tao/Argument.h index 647b26a1685..0a42a2a7064 100644 --- a/TAO/tao/Argument.h +++ b/TAO/tao/Argument.h @@ -15,6 +15,7 @@ #define TAO_ARGUMENT_H #include /**/ "ace/pre.h" + #include "tao/Basic_Types.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) @@ -42,19 +43,58 @@ namespace TAO /** * @class Argument * - * @brief Base class for template argument classes. + * @brief Base class for argument class templates. * + * @c Argument subclasses override the virtual methods + * appropriately. For example, a stub "IN" argument class + * template would override the @c marshal() method, but wouldn't + * need to override the @c demarshal() method. */ class TAO_Export Argument { public: + + /// Destructor. virtual ~Argument (void); + + /// Marshal the argument into the given CDR output stream. + /** + * @note The default implementation simply returns @c true. + */ virtual CORBA::Boolean marshal (TAO_OutputCDR &); + + /// Demarshal the argument from the given CDR input stream. + /** + * @note The default implementation simply returns @c true. + */ virtual CORBA::Boolean demarshal (TAO_InputCDR &); + #if TAO_HAS_INTERCEPTORS == 1 + + /** + * @name Portable Interceptor Related Methods + * + * These methods are only used when setting up + * @c PortableInterceptor::RequestInfo instances with the + * appropriate operation-specific parameter list and return + * value, if either or both exist. + */ + //@{ + /// Populate the given @a Dynamic::Parameter argument. + /** + * @note The default implementation is a no-op. + */ virtual void interceptor_param (Dynamic::Parameter &); + + /// Populate the given @a CORBA::Any result argument. + /** + * @note The default implementation is a no-op. + */ virtual void interceptor_result (CORBA::Any *); + //@} + #endif /* TAO_HAS_INTERCEPTORS == 1 */ + }; } diff --git a/TAO/tao/BD_String_Argument_T.h b/TAO/tao/BD_String_Argument_T.h index 43502f0b869..20a8e86e45b 100644 --- a/TAO/tao/BD_String_Argument_T.h +++ b/TAO/tao/BD_String_Argument_T.h @@ -1,4 +1,4 @@ -// This may look like C, but it's really -*- C++ -*- +// -*- C++ -*- //============================================================================= /** @@ -15,6 +15,7 @@ #define TAO_BD_STRING_ARGUMENT_T_H #include /**/ "ace/pre.h" + #include "ace/CDR_Stream.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) @@ -38,13 +39,17 @@ namespace TAO In_BD_String_Argument_T (const S * x); virtual CORBA::Boolean marshal (TAO_OutputCDR &); + #if TAO_HAS_INTERCEPTORS == 1 virtual void interceptor_param (Dynamic::Parameter &); #endif /* TAO_HAS_INTERCEPTORS == 1 */ - const S * arg (void) const; + + S const * arg (void) const; private: - const S * x_; + + S const * x_; + }; /** @@ -67,7 +72,7 @@ namespace TAO S *& arg (void); private: - mutable S *& x_; + S *& x_; }; /** @@ -93,7 +98,7 @@ namespace TAO S *& arg (void); private: - mutable S *& x_; + S *& x_; }; /** @@ -122,7 +127,9 @@ namespace TAO S * retn (void); private: + S_var x_; + }; /** @@ -134,7 +141,7 @@ namespace TAO struct TAO_Export BD_String_Tag {}; /** - * @struct Basic_Arg_Traits_T + * @struct BD_String_Arg_Traits_T * * @brief Template class for stub argument traits of bounded (w)strings. * @@ -148,7 +155,7 @@ namespace TAO struct BD_String_Arg_Traits_T { typedef T * ret_type; - typedef const T * in_type; + typedef T const * in_type; typedef T *& inout_type; typedef T_out out_type; diff --git a/TAO/tao/Basic_Argument_T.h b/TAO/tao/Basic_Argument_T.h index 101aa3d94c5..5f41f537813 100644 --- a/TAO/tao/Basic_Argument_T.h +++ b/TAO/tao/Basic_Argument_T.h @@ -1,4 +1,4 @@ -// This may look like C, but it's really -*- C++ -*- +// -*- C++ -*- //============================================================================= /** @@ -66,7 +66,7 @@ namespace TAO S & arg (void); private: - mutable S & x_; + S & x_; }; /** diff --git a/TAO/tao/CDR.cpp b/TAO/tao/CDR.cpp index 89cbe621255..ccc993ff3b0 100644 --- a/TAO/tao/CDR.cpp +++ b/TAO/tao/CDR.cpp @@ -1,37 +1,5 @@ // $Id$ - -// Portions of this file are: -// Copyright 1994-1995 by Sun Microsystems Inc. -// All Rights Reserved - -// CDR: Encode/Decode basic machine data types -// -// Implementation of OMG "Common Data Representation" (CDR) ... there -// are one routine each for byte/halfword/word/doubleword put/get, -// which adjust to establish "natural" alignment (the bulk of the -// code) and then put or get with byteswapping as needed. -// -// The implementation knows that native data formats are conformant -// with OMG-IDL's (and hence CDR's) size requirements, and relies on -// the fact that (for example) CORBA::Long is always four bytes long -// even if the environment's "int" is a different size. -// -// char, octet 8 bits (1 byte) -// short, unsigned short 16 bits (2 bytes) -// long, unsigned long, float 32 bits (4 bytes) -// double, (unsigned) long long 64 bits (8 bytes) -// long double 128 bits (16 bytes) -// -// Moreover, this "knows" that the native 'char' represents ISO -// Latin/1 characters (an ASCII superset addressing Western European -// characters) and that "double" and "float" comply with the IEEE -// standards. (The "long double" may not be a native data type, -// though.) -// -// THREADING NOTE: "CDR" is a data structure which must be protected -// by external critical sections. - #include "tao/CDR.h" #include "tao/Timeprobe.h" #include "tao/ORB_Core.h" @@ -43,8 +11,9 @@ #endif /* ! __ACE_INLINE__ */ -ACE_RCSID(tao, CDR, "$Id$") - +ACE_RCSID (tao, + CDR, + "$Id$") #if defined (ACE_ENABLE_TIMEPROBES) @@ -162,22 +131,25 @@ TAO_OutputCDR::throw_skel_exception (int error_num ACE_ENV_ARG_DECL) { case 0 : break; + case EINVAL : // wchar from a GIOP 1.0 - ACE_THROW (CORBA::MARSHAL(CORBA::OMGVMCID | 5, CORBA::COMPLETED_YES)); + ACE_THROW (CORBA::MARSHAL (CORBA::OMGVMCID | 5, CORBA::COMPLETED_YES)); ACE_NOTREACHED(break); case EACCES : // wchar but no codeset - ACE_THROW (CORBA::BAD_PARAM(CORBA::OMGVMCID | 23, CORBA::COMPLETED_YES)); + ACE_THROW (CORBA::BAD_PARAM (CORBA::OMGVMCID | 23, + CORBA::COMPLETED_YES)); ACE_NOTREACHED(break); #if (ERANGE != EINVAL) case ERANGE : // untranslatable character - ACE_THROW (CORBA::DATA_CONVERSION(CORBA::OMGVMCID | 1, CORBA::COMPLETED_YES)); + ACE_THROW (CORBA::DATA_CONVERSION (CORBA::OMGVMCID | 1, + CORBA::COMPLETED_YES)); ACE_NOTREACHED(break); #endif default : - ACE_THROW (CORBA::MARSHAL(0, CORBA::COMPLETED_YES)); + ACE_THROW (CORBA::MARSHAL (0, CORBA::COMPLETED_YES)); } } diff --git a/TAO/tao/Collocated_Invocation.cpp b/TAO/tao/Collocated_Invocation.cpp index 584414397cc..6c3f17b6f1b 100644 --- a/TAO/tao/Collocated_Invocation.cpp +++ b/TAO/tao/Collocated_Invocation.cpp @@ -1,11 +1,16 @@ #include "Collocated_Invocation.h" #include "Collocation_Proxy_Broker.h" +#include "ORB_Core.h" +#include "Request_Dispatcher.h" +#include "TAO_Server_Request.h" #include "operation_details.h" + ACE_RCSID (tao, Collocated_Invocation, "$Id$") + namespace TAO { Collocated_Invocation::Collocated_Invocation (CORBA::Object_ptr t, @@ -41,15 +46,35 @@ namespace TAO ACE_TRY { - cpb->dispatch (this->effective_target (), - this->forwarded_to_.out (), - this->details_.args (), - this->details_.args_num (), - this->details_.opname (), - this->details_.opname_len (), - strat - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + if (strat == TAO_CS_THRU_POA_STRATEGY) + { + TAO_ORB_Core * const orb_core = this->orb_core (); + + TAO_ServerRequest request (orb_core, + this->details_, + this->effective_target ()); + + TAO_Request_Dispatcher * const dispatcher = + orb_core->request_dispatcher (); + + dispatcher->dispatch (orb_core, + request, + this->forwarded_to_.out () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + else + { + cpb->dispatch (this->effective_target (), + this->forwarded_to_.out (), + this->details_.args (), + this->details_.args_num (), + this->details_.opname (), + this->details_.opname_len (), + strat + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } // Invocation completed succesfully s = TAO_INVOKE_SUCCESS; diff --git a/TAO/tao/DynamicInterface/Server_Request.cpp b/TAO/tao/DynamicInterface/Server_Request.cpp index 4af2cafe296..776104d7ed6 100644 --- a/TAO/tao/DynamicInterface/Server_Request.cpp +++ b/TAO/tao/DynamicInterface/Server_Request.cpp @@ -92,7 +92,7 @@ CORBA::ServerRequest::arguments (CORBA::NVList_ptr &list // Save params for later use when marshaling the reply. this->params_ = list; - this->params_->_tao_incoming_cdr (this->orb_server_request_.incoming (), + this->params_->_tao_incoming_cdr (*this->orb_server_request_.incoming (), CORBA::ARG_IN | CORBA::ARG_INOUT, this->lazy_evaluation_ ACE_ENV_ARG_PARAMETER); diff --git a/TAO/tao/DynamicInterface/Server_Request.inl b/TAO/tao/DynamicInterface/Server_Request.inl index dea7c3e0b05..8431d78ad0d 100644 --- a/TAO/tao/DynamicInterface/Server_Request.inl +++ b/TAO/tao/DynamicInterface/Server_Request.inl @@ -65,13 +65,13 @@ CORBA::ServerRequest::_tao_lazy_evaluation (bool lazy_evaluation) ACE_INLINE int CORBA::ServerRequest::_tao_incoming_byte_order (void) const { - return this->orb_server_request_.incoming ().byte_order (); + return this->orb_server_request_.incoming ()->byte_order (); } ACE_INLINE void CORBA::ServerRequest::_tao_reply_byte_order (int byte_order) { - this->orb_server_request_.outgoing ().reset_byte_order (byte_order); + this->orb_server_request_.outgoing ()->reset_byte_order (byte_order); } diff --git a/TAO/tao/Fixed_Array_Argument_T.h b/TAO/tao/Fixed_Array_Argument_T.h index e4506ec5d8c..bf3522022e5 100644 --- a/TAO/tao/Fixed_Array_Argument_T.h +++ b/TAO/tao/Fixed_Array_Argument_T.h @@ -1,4 +1,4 @@ -// This may look like C, but it's really -*- C++ -*- +// -*- C++ -*- //============================================================================= /** @@ -39,7 +39,7 @@ namespace TAO #if TAO_HAS_INTERCEPTORS == 1 virtual void interceptor_param (Dynamic::Parameter &); #endif /* TAO_HAS_INTERCEPTORS == 1 */ - const S_slice * arg (void) const; + S_slice const * arg (void) const; private: S_forany x_; @@ -84,7 +84,7 @@ namespace TAO #if TAO_HAS_INTERCEPTORS == 1 virtual void interceptor_param (Dynamic::Parameter &); #endif /* TAO_HAS_INTERCEPTORS == 1 */ - S_slice *& arg (void); + S_slice *& arg (void); private: S_forany x_; @@ -141,7 +141,7 @@ namespace TAO struct Fixed_Array_Arg_Traits_T { typedef T_slice * ret_type; - typedef const T in_type; + typedef T const in_type; typedef T inout_type; typedef T out_type; diff --git a/TAO/tao/Fixed_Array_SArgument_T.cpp b/TAO/tao/Fixed_Array_SArgument_T.cpp deleted file mode 100644 index 48c9cda74c8..00000000000 --- a/TAO/tao/Fixed_Array_SArgument_T.cpp +++ /dev/null @@ -1,117 +0,0 @@ -// $Id$ - -#ifndef TAO_FIXED_ARRAY_SARGUMENT_T_C -#define TAO_FIXED_ARRAY_SARGUMENT_T_C - -#include "tao/Fixed_Array_SArgument_T.h" -#include "tao/Dynamic_ParameterC.h" - -#if !defined (__ACE_INLINE__) -#include "tao/Fixed_Array_SArgument_T.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID (tao, - Fixed_Array_SArgument_T, - "$Id$") - -template<typename S, typename S_forany> -CORBA::Boolean -TAO::In_Fixed_Array_SArgument_T<S,S_forany>::demarshal (TAO_InputCDR &cdr) -{ - S_forany tmp (this->x_); - return cdr >> tmp; -} - -#if TAO_HAS_INTERCEPTORS == 1 - -template<typename S, typename S_forany> -void -TAO::In_Fixed_Array_SArgument_T<S,S_forany>::interceptor_param ( - Dynamic::Parameter & p - ) -{ - p.argument <<= S_forany (this->x_); - p.mode = CORBA::PARAM_IN; -} - -#endif /* TAO_HAS_INTERCEPTORS */ - -// =========================================================== - -template<typename S, typename S_forany> -CORBA::Boolean -TAO::Inout_Fixed_Array_SArgument_T<S,S_forany>::marshal (TAO_OutputCDR & cdr) -{ - return cdr << S_forany (this->x_); -} - -template<typename S, typename S_forany> -CORBA::Boolean -TAO::Inout_Fixed_Array_SArgument_T<S,S_forany>::demarshal (TAO_InputCDR & cdr) -{ - S_forany tmp (this->x_); - return cdr >> tmp; -} - -#if TAO_HAS_INTERCEPTORS == 1 - -template<typename S, typename S_forany> -void -TAO::Inout_Fixed_Array_SArgument_T<S,S_forany>::interceptor_param ( - Dynamic::Parameter & p - ) -{ - p.argument <<= S_forany (this->x_); - p.mode = CORBA::PARAM_INOUT; -} - -#endif /* TAO_HAS_INTERCEPTORS */ - -// ============================================================== - -template<typename S, typename S_forany> -CORBA::Boolean -TAO::Out_Fixed_Array_SArgument_T<S,S_forany>::marshal (TAO_OutputCDR &cdr) -{ - return cdr << S_forany (this->x_); -} - -#if TAO_HAS_INTERCEPTORS == 1 - -template<typename S, typename S_forany> -void -TAO::Out_Fixed_Array_SArgument_T<S,S_forany>::interceptor_param ( - Dynamic::Parameter & p - ) -{ - p.argument <<= S_forany (this->x_); - p.mode = CORBA::PARAM_OUT; -} - -#endif /* TAO_HAS_INTERCEPTORS */ - -// ============================================================ - -template<typename S_slice, typename S_var, typename S_forany> -CORBA::Boolean -TAO::Ret_Fixed_Array_SArgument_T<S_slice,S_var,S_forany>::marshal ( - TAO_OutputCDR & cdr - ) -{ - return cdr << S_forany (this->x_.inout ()); -} - -#if TAO_HAS_INTERCEPTORS == 1 - -template<typename S_slice, typename S_var, typename S_forany> -void -TAO::Ret_Fixed_Array_SArgument_T<S_slice,S_var,S_forany>::interceptor_result ( - CORBA::Any * any - ) -{ - (*any) <<= S_forany (this->x_.ptr ()); -} - -#endif /* TAO_HAS_INTERCEPTORS */ - -#endif /* TAO_FIXED_ARRAY_SARGUMENT_T_C */ diff --git a/TAO/tao/Fixed_Array_SArgument_T.inl b/TAO/tao/Fixed_Array_SArgument_T.inl deleted file mode 100644 index 4595eecce77..00000000000 --- a/TAO/tao/Fixed_Array_SArgument_T.inl +++ /dev/null @@ -1,63 +0,0 @@ -// $Id$ - -template<typename S, typename S_forany> -ACE_INLINE -TAO::In_Fixed_Array_SArgument_T<S,S_forany>::In_Fixed_Array_SArgument_T (void) -{} - -template<typename S, typename S_forany> -ACE_INLINE -const S & -TAO::In_Fixed_Array_SArgument_T<S,S_forany>::arg (void) const -{ - return this->x_; -} - -// =========================================================================== - -template<typename S, typename S_forany> -ACE_INLINE -TAO::Inout_Fixed_Array_SArgument_T<S,S_forany>:: -Inout_Fixed_Array_SArgument_T (void) -{} - -template<typename S, typename S_forany> -ACE_INLINE -S & -TAO::Inout_Fixed_Array_SArgument_T<S,S_forany>::arg (void) -{ - return this->x_; -} - -// =========================================================================== - -template<typename S, typename S_forany> -ACE_INLINE -TAO::Out_Fixed_Array_SArgument_T<S,S_forany>::Out_Fixed_Array_SArgument_T ( - void - ) -{} - -template<typename S, typename S_forany> -ACE_INLINE -S & -TAO::Out_Fixed_Array_SArgument_T<S,S_forany>::arg (void) -{ - return this->x_; -} - -// =========================================================================== - -template<typename S_slice, typename S_var, typename S_forany> -ACE_INLINE -TAO::Ret_Fixed_Array_SArgument_T<S_slice,S_var,S_forany>:: -Ret_Fixed_Array_SArgument_T (void) -{} - -template<typename S_slice, typename S_var, typename S_forany> -ACE_INLINE -S_slice *& -TAO::Ret_Fixed_Array_SArgument_T<S_slice,S_var,S_forany>::arg (void) -{ - return this->x_.out (); -} diff --git a/TAO/tao/Fixed_Size_Argument_T.h b/TAO/tao/Fixed_Size_Argument_T.h index c2cabced3e4..c71bf4047ba 100644 --- a/TAO/tao/Fixed_Size_Argument_T.h +++ b/TAO/tao/Fixed_Size_Argument_T.h @@ -39,10 +39,10 @@ namespace TAO #if TAO_HAS_INTERCEPTORS == 1 virtual void interceptor_param (Dynamic::Parameter &); #endif /* TAO_HAS_INTERCEPTORS == 1 */ - const S & arg (void) const; + S const & arg (void) const; private: - const S * x_; + S const * x_; }; /** @@ -87,7 +87,8 @@ namespace TAO S & arg (void); private: - mutable S & x_; + + S & x_; }; /** @@ -133,7 +134,7 @@ namespace TAO struct Fixed_Size_Arg_Traits_T { typedef T ret_type; - typedef const T & in_type; + typedef T const & in_type; typedef T & inout_type; typedef T & out_type; diff --git a/TAO/tao/GIOP_Message_Generator_Parser_10.cpp b/TAO/tao/GIOP_Message_Generator_Parser_10.cpp index dad464a724c..c76d5b60b18 100644 --- a/TAO/tao/GIOP_Message_Generator_Parser_10.cpp +++ b/TAO/tao/GIOP_Message_Generator_Parser_10.cpp @@ -322,7 +322,7 @@ TAO_GIOP_Message_Generator_Parser_10::parse_request_header ( // infrastructure. // Get the input CDR in the request class - TAO_InputCDR& input = request.incoming (); + TAO_InputCDR & input = *request.incoming (); IOP::ServiceContextList &service_info = request.request_service_info (); diff --git a/TAO/tao/GIOP_Message_Generator_Parser_12.cpp b/TAO/tao/GIOP_Message_Generator_Parser_12.cpp index 04daba08086..411058acd2a 100644 --- a/TAO/tao/GIOP_Message_Generator_Parser_12.cpp +++ b/TAO/tao/GIOP_Message_Generator_Parser_12.cpp @@ -253,7 +253,7 @@ TAO_GIOP_Message_Generator_Parser_12::parse_request_header ( ) { // Get the input CDR in the request class - TAO_InputCDR& input = request.incoming (); + TAO_InputCDR & input = *request.incoming (); CORBA::Boolean hdr_status = (CORBA::Boolean) input.good_bit (); diff --git a/TAO/tao/GIOP_Message_Lite.cpp b/TAO/tao/GIOP_Message_Lite.cpp index 4c13403bdfe..d56e5a5dee0 100644 --- a/TAO/tao/GIOP_Message_Lite.cpp +++ b/TAO/tao/GIOP_Message_Lite.cpp @@ -1293,7 +1293,7 @@ int TAO_GIOP_Message_Lite::parse_request_header (TAO_ServerRequest &request) { // Get the input CDR in the request class - TAO_InputCDR& input = request.incoming (); + TAO_InputCDR & input = *request.incoming (); CORBA::Boolean hdr_status = (CORBA::Boolean) input.good_bit (); diff --git a/TAO/tao/Invocation_Adapter.cpp b/TAO/tao/Invocation_Adapter.cpp index ceac1257dd7..58ba52b5fa3 100644 --- a/TAO/tao/Invocation_Adapter.cpp +++ b/TAO/tao/Invocation_Adapter.cpp @@ -129,7 +129,7 @@ namespace TAO TAO_Stub * Invocation_Adapter::get_stub (ACE_ENV_SINGLE_ARG_DECL) const { - TAO_Stub *stub = + TAO_Stub * const stub = this->target_->_stubobj (); if (stub == 0) diff --git a/TAO/tao/Invocation_Adapter.h b/TAO/tao/Invocation_Adapter.h index 23e75c89b8a..d9f3ad21c1e 100644 --- a/TAO/tao/Invocation_Adapter.h +++ b/TAO/tao/Invocation_Adapter.h @@ -240,40 +240,43 @@ namespace TAO void set_response_flags (TAO_Stub *stub, TAO_Operation_Details &details); + private: + /// Dont allow default initializations + Invocation_Adapter (void); + + // Prevent copying + Invocation_Adapter (Invocation_Adapter const &); + Invocation_Adapter & operator= (const Invocation_Adapter &); + protected: /// The target object on which this invocation is carried out. CORBA::Object_ptr target_; /// Array of arguments for this operation - Argument **args_; + Argument ** const args_; /// Number of arguments for this operation. /** * This includes the return values too */ - const int number_args_; + int const number_args_; /// Name of the operation. - const char *operation_; + char const * operation_; /// String length of the operation name. - const int op_len_; - + int const op_len_; + /// Collocation proxy broker for this operation. - Collocation_Proxy_Broker *cpb_; + Collocation_Proxy_Broker * const cpb_; /// The invocation type - Invocation_Type type_; + Invocation_Type const type_; /// The invocation mode - Invocation_Mode mode_; - - private: - /// Dont allow default initializations - ACE_UNIMPLEMENTED_FUNC (Invocation_Adapter (void)) + Invocation_Mode const mode_; - ACE_UNIMPLEMENTED_FUNC (Invocation_Adapter & operator= (const Invocation_Adapter &)) }; } // End namespace TAO diff --git a/TAO/tao/Object_Argument_T.h b/TAO/tao/Object_Argument_T.h index 206d20fc631..2e2d86fb2a3 100644 --- a/TAO/tao/Object_Argument_T.h +++ b/TAO/tao/Object_Argument_T.h @@ -1,4 +1,4 @@ -// This may look like C, but it's really -*- C++ -*- +// -*- C++ -*- //============================================================================= /** @@ -15,6 +15,7 @@ #define TAO_OBJECT_ARGUMENT_T_H #include /**/ "ace/pre.h" + #include "tao/Argument.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) @@ -70,7 +71,7 @@ namespace TAO S_ptr & arg (void); private: - mutable S_ptr & x_; + S_ptr & x_; }; /** @@ -92,7 +93,7 @@ namespace TAO S_out arg (void); private: - mutable S_ptr & x_; + S_ptr & x_; }; /** @@ -105,6 +106,7 @@ namespace TAO class Ret_Object_Argument_T : public Argument { public: + Ret_Object_Argument_T (void); virtual CORBA::Boolean demarshal (TAO_InputCDR &); diff --git a/TAO/tao/Object_Argument_T.inl b/TAO/tao/Object_Argument_T.inl index c3db6b0ffdd..feb64a6af6e 100644 --- a/TAO/tao/Object_Argument_T.inl +++ b/TAO/tao/Object_Argument_T.inl @@ -1,3 +1,5 @@ +// -*- C++ -*- +// // $Id$ template<typename S_ptr> diff --git a/TAO/tao/PolicyA.cpp b/TAO/tao/PolicyA.cpp index 86293998b21..333293fa25b 100644 --- a/TAO/tao/PolicyA.cpp +++ b/TAO/tao/PolicyA.cpp @@ -33,7 +33,7 @@ #include "tao/Any_Dual_Impl_T.h" // TAO_IDL - Generated from -// be\be_visitor_typecode/typecode_defn.cpp:295 +// be/be_visitor_typecode/typecode_defn.cpp:295 static const CORBA::Long _oc_CORBA_PolicyErrorCode[] = { @@ -68,12 +68,12 @@ static CORBA::TypeCode _tc_TAO_tc_CORBA_PolicyErrorCode ( namespace CORBA { - ::CORBA::TypeCode_ptr _tc_PolicyErrorCode = + ::CORBA::TypeCode_ptr const _tc_PolicyErrorCode = &_tc_TAO_tc_CORBA_PolicyErrorCode; } // TAO_IDL - Generated from -// be\be_visitor_typecode/typecode_defn.cpp:295 +// be/be_visitor_typecode/typecode_defn.cpp:295 static const CORBA::Long _oc_CORBA_Policy[] = { @@ -102,12 +102,12 @@ static CORBA::TypeCode _tc_TAO_tc_CORBA_Policy ( namespace CORBA { - ::CORBA::TypeCode_ptr _tc_Policy = + ::CORBA::TypeCode_ptr const _tc_Policy = &_tc_TAO_tc_CORBA_Policy; } // TAO_IDL - Generated from -// be\be_visitor_typecode/typecode_defn.cpp:295 +// be/be_visitor_typecode/typecode_defn.cpp:295 static const CORBA::Long _oc_CORBA_PolicyManager[] = { @@ -139,12 +139,12 @@ static CORBA::TypeCode _tc_TAO_tc_CORBA_PolicyManager ( namespace CORBA { - ::CORBA::TypeCode_ptr _tc_PolicyManager = + ::CORBA::TypeCode_ptr const _tc_PolicyManager = &_tc_TAO_tc_CORBA_PolicyManager; } // TAO_IDL - Generated from -// be\be_visitor_typecode/typecode_defn.cpp:295 +// be/be_visitor_typecode/typecode_defn.cpp:295 static const CORBA::Long _oc_CORBA_PolicyCurrent[] = { @@ -176,12 +176,12 @@ static CORBA::TypeCode _tc_TAO_tc_CORBA_PolicyCurrent ( namespace CORBA { - ::CORBA::TypeCode_ptr _tc_PolicyCurrent = + ::CORBA::TypeCode_ptr const _tc_PolicyCurrent = &_tc_TAO_tc_CORBA_PolicyCurrent; } // TAO_IDL - Generated from -// be\be_visitor_exception/any_op_cs.cpp:50 +// be/be_visitor_exception/any_op_cs.cpp:50 ACE_TEMPLATE_SPECIALIZATION CORBA::Boolean @@ -266,7 +266,7 @@ CORBA::Boolean operator>>= ( } // TAO_IDL - Generated from -// be\be_visitor_exception/any_op_cs.cpp:50 +// be/be_visitor_exception/any_op_cs.cpp:50 ACE_TEMPLATE_SPECIALIZATION CORBA::Boolean @@ -351,7 +351,7 @@ CORBA::Boolean operator>>= ( } // TAO_IDL - Generated from -// be\be_visitor_interface/any_op_cs.cpp:50 +// be/be_visitor_interface/any_op_cs.cpp:50 ACE_TEMPLATE_SPECIALIZATION CORBA::Boolean @@ -406,7 +406,7 @@ operator>>= ( } // TAO_IDL - Generated from -// be\be_visitor_interface/any_op_cs.cpp:50 +// be/be_visitor_interface/any_op_cs.cpp:50 ACE_TEMPLATE_SPECIALIZATION CORBA::Boolean @@ -475,7 +475,7 @@ operator>>= ( } // TAO_IDL - Generated from -// be\be_visitor_interface/any_op_cs.cpp:50 +// be/be_visitor_interface/any_op_cs.cpp:50 ACE_TEMPLATE_SPECIALIZATION CORBA::Boolean diff --git a/TAO/tao/PolicyC.cpp b/TAO/tao/PolicyC.cpp index 4ea5cc52a6c..0bada5796b5 100644 --- a/TAO/tao/PolicyC.cpp +++ b/TAO/tao/PolicyC.cpp @@ -26,7 +26,7 @@ // http://www.cs.wustl.edu/~schmidt/TAO.html // TAO_IDL - Generated from -// be\be_codegen.cpp:302 +// be/be_codegen.cpp:302 #include "PolicyC.h" @@ -48,7 +48,7 @@ #endif /* !defined INLINE */ // TAO_IDL - Generated from -// be\be_visitor_arg_traits.cpp:66 +// be/be_visitor_arg_traits.cpp:69 // Arg traits specializations. namespace TAO @@ -57,7 +57,7 @@ namespace TAO #if !defined (_CORBA_POLICY__ARG_TRAITS_CS_) #define _CORBA_POLICY__ARG_TRAITS_CS_ - ACE_TEMPLATE_SPECIALIZATION + template<> class TAO_Export Arg_Traits<CORBA::Policy> : public Object_Arg_Traits_T< @@ -74,7 +74,7 @@ namespace TAO // TAO_IDL - Generated from -// be\be_visitor_exception/exception_cs.cpp:63 +// be/be_visitor_exception/exception_cs.cpp:63 CORBA::PolicyError::PolicyError (void) : CORBA::UserException ( @@ -177,7 +177,7 @@ void CORBA::PolicyError::_tao_decode ( // TAO_IDL - Generated from -// be\be_visitor_exception/exception_ctor.cpp:66 +// be/be_visitor_exception/exception_ctor.cpp:66 CORBA::PolicyError::PolicyError ( CORBA::PolicyErrorCode _tao_reason @@ -197,7 +197,7 @@ CORBA::TypeCode_ptr CORBA::PolicyError::_type (void) const } // TAO_IDL - Generated from -// be\be_visitor_typecode/typecode_defn.cpp:295 +// be/be_visitor_typecode/typecode_defn.cpp:295 static const CORBA::Long _oc_CORBA_PolicyError[] = { @@ -254,12 +254,12 @@ static CORBA::TypeCode _tc_TAO_tc_CORBA_PolicyError ( namespace CORBA { - ::CORBA::TypeCode_ptr _tc_PolicyError = + ::CORBA::TypeCode_ptr const _tc_PolicyError = &_tc_TAO_tc_CORBA_PolicyError; } // TAO_IDL - Generated from -// be\be_visitor_exception/exception_cs.cpp:63 +// be/be_visitor_exception/exception_cs.cpp:63 CORBA::InvalidPolicies::InvalidPolicies (void) : CORBA::UserException ( @@ -362,7 +362,7 @@ void CORBA::InvalidPolicies::_tao_decode ( // TAO_IDL - Generated from -// be\be_visitor_exception/exception_ctor.cpp:66 +// be/be_visitor_exception/exception_ctor.cpp:66 CORBA::InvalidPolicies::InvalidPolicies ( const CORBA::UShortSeq & _tao_indices @@ -382,7 +382,7 @@ CORBA::TypeCode_ptr CORBA::InvalidPolicies::_type (void) const } // TAO_IDL - Generated from -// be\be_visitor_typecode/typecode_defn.cpp:295 +// be/be_visitor_typecode/typecode_defn.cpp:295 static const CORBA::Long _oc_CORBA_InvalidPolicies[] = { @@ -443,16 +443,15 @@ static CORBA::TypeCode _tc_TAO_tc_CORBA_InvalidPolicies ( namespace CORBA { - ::CORBA::TypeCode_ptr _tc_InvalidPolicies = + ::CORBA::TypeCode_ptr const _tc_InvalidPolicies = &_tc_TAO_tc_CORBA_InvalidPolicies; } // TAO_IDL - Generated from -// be\be_visitor_interface/interface_cs.cpp:60 +// be/be_visitor_interface/interface_cs.cpp:60 // Traits specializations for CORBA::Policy. -ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION CORBA::Policy_ptr TAO::Objref_Traits<CORBA::Policy>::duplicate ( CORBA::Policy_ptr p @@ -461,7 +460,6 @@ TAO::Objref_Traits<CORBA::Policy>::duplicate ( return CORBA::Policy::_duplicate (p); } -ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION void TAO::Objref_Traits<CORBA::Policy>::release ( CORBA::Policy_ptr p @@ -470,14 +468,12 @@ TAO::Objref_Traits<CORBA::Policy>::release ( CORBA::release (p); } -ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION CORBA::Policy_ptr TAO::Objref_Traits<CORBA::Policy>::nil (void) { return CORBA::Policy::_nil (); } -ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION CORBA::Boolean TAO::Objref_Traits<CORBA::Policy>::marshal ( CORBA::Policy_ptr p, @@ -494,7 +490,7 @@ TAO::Collocation_Proxy_Broker * ) = 0; // TAO_IDL - Generated from -// be\be_visitor_operation/operation_cs.cpp:78 +// be/be_visitor_operation/operation_cs.cpp:78 CORBA::PolicyType CORBA::Policy::policy_type ( ACE_ENV_SINGLE_ARG_DECL @@ -536,7 +532,7 @@ CORBA::PolicyType CORBA::Policy::policy_type ( } // TAO_IDL - Generated from -// be\be_visitor_operation/operation_cs.cpp:78 +// be/be_visitor_operation/operation_cs.cpp:78 ::CORBA::Policy_ptr CORBA::Policy::copy ( ACE_ENV_SINGLE_ARG_DECL @@ -578,7 +574,7 @@ CORBA::PolicyType CORBA::Policy::policy_type ( } // TAO_IDL - Generated from -// be\be_visitor_operation/operation_cs.cpp:78 +// be/be_visitor_operation/operation_cs.cpp:78 void CORBA::Policy::destroy ( ACE_ENV_SINGLE_ARG_DECL @@ -685,6 +681,12 @@ CORBA::Policy::_duplicate (Policy_ptr obj) return obj; } +void +CORBA::Policy::_tao_release (Policy_ptr obj) +{ + CORBA::release (obj); +} + CORBA::Boolean CORBA::Policy::_is_a ( const char *value @@ -725,11 +727,10 @@ CORBA::Policy::marshal (TAO_OutputCDR &cdr) } // TAO_IDL - Generated from -// be\be_visitor_interface/interface_cs.cpp:60 +// be/be_visitor_interface/interface_cs.cpp:60 // Traits specializations for CORBA::PolicyManager. -ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION CORBA::PolicyManager_ptr TAO::Objref_Traits<CORBA::PolicyManager>::duplicate ( CORBA::PolicyManager_ptr p @@ -738,7 +739,6 @@ TAO::Objref_Traits<CORBA::PolicyManager>::duplicate ( return CORBA::PolicyManager::_duplicate (p); } -ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION void TAO::Objref_Traits<CORBA::PolicyManager>::release ( CORBA::PolicyManager_ptr p @@ -747,14 +747,12 @@ TAO::Objref_Traits<CORBA::PolicyManager>::release ( CORBA::release (p); } -ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION CORBA::PolicyManager_ptr TAO::Objref_Traits<CORBA::PolicyManager>::nil (void) { return CORBA::PolicyManager::_nil (); } -ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION CORBA::Boolean TAO::Objref_Traits<CORBA::PolicyManager>::marshal ( CORBA::PolicyManager_ptr p, @@ -823,6 +821,12 @@ CORBA::PolicyManager::_duplicate (PolicyManager_ptr obj) return obj; } +void +CORBA::PolicyManager::_tao_release (PolicyManager_ptr obj) +{ + CORBA::release (obj); +} + CORBA::Boolean CORBA::PolicyManager::_is_a ( const char *value @@ -864,11 +868,10 @@ CORBA::PolicyManager::marshal (TAO_OutputCDR &) } // TAO_IDL - Generated from -// be\be_visitor_interface/interface_cs.cpp:60 +// be/be_visitor_interface/interface_cs.cpp:60 // Traits specializations for CORBA::PolicyCurrent. -ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION CORBA::PolicyCurrent_ptr TAO::Objref_Traits<CORBA::PolicyCurrent>::duplicate ( CORBA::PolicyCurrent_ptr p @@ -877,7 +880,6 @@ TAO::Objref_Traits<CORBA::PolicyCurrent>::duplicate ( return CORBA::PolicyCurrent::_duplicate (p); } -ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION void TAO::Objref_Traits<CORBA::PolicyCurrent>::release ( CORBA::PolicyCurrent_ptr p @@ -886,14 +888,12 @@ TAO::Objref_Traits<CORBA::PolicyCurrent>::release ( CORBA::release (p); } -ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION CORBA::PolicyCurrent_ptr TAO::Objref_Traits<CORBA::PolicyCurrent>::nil (void) { return CORBA::PolicyCurrent::_nil (); } -ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION CORBA::Boolean TAO::Objref_Traits<CORBA::PolicyCurrent>::marshal ( CORBA::PolicyCurrent_ptr p, @@ -962,6 +962,12 @@ CORBA::PolicyCurrent::_duplicate (PolicyCurrent_ptr obj) return obj; } +void +CORBA::PolicyCurrent::_tao_release (PolicyCurrent_ptr obj) +{ + CORBA::release (obj); +} + CORBA::Boolean CORBA::PolicyCurrent::_is_a ( const char *value @@ -1011,7 +1017,7 @@ CORBA::PolicyCurrent::marshal (TAO_OutputCDR &) } // TAO_IDL - Generated from -// be\be_visitor_exception/cdr_op_cs.cpp:60 +// be/be_visitor_exception/cdr_op_cs.cpp:60 CORBA::Boolean operator<< ( TAO_OutputCDR &strm, @@ -1044,7 +1050,7 @@ CORBA::Boolean operator>> ( } // TAO_IDL - Generated from -// be\be_visitor_exception/cdr_op_cs.cpp:60 +// be/be_visitor_exception/cdr_op_cs.cpp:60 CORBA::Boolean operator<< ( TAO_OutputCDR &strm, @@ -1105,7 +1111,7 @@ CORBA::Policy::_tao_scope (void) const // **************************************************************** // TAO_IDL - Generated from -// be\be_visitor_interface/cdr_op_cs.cpp:63 +// be/be_visitor_interface/cdr_op_cs.cpp:63 CORBA::Boolean operator<< ( TAO_OutputCDR &strm, @@ -1141,7 +1147,7 @@ CORBA::Boolean operator>> ( } // TAO_IDL - Generated from -// be\be_visitor_root/root.cpp:1509 +// be/be_visitor_root/root.cpp:1619 #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) diff --git a/TAO/tao/PolicyC.h b/TAO/tao/PolicyC.h index 967d2342105..28d3f9118d6 100644 --- a/TAO/tao/PolicyC.h +++ b/TAO/tao/PolicyC.h @@ -26,7 +26,7 @@ // http://www.cs.wustl.edu/~schmidt/TAO.html // TAO_IDL - Generated from -// be\be_codegen.cpp:153 +// be/be_codegen.cpp:153 #ifndef _TAO_IDL_ORIG_POLICYC_H_ #define _TAO_IDL_ORIG_POLICYC_H_ @@ -73,7 +73,7 @@ #endif /* __BORLANDC__ */ // TAO_IDL - Generated from -// be\be_visitor_root/root_ch.cpp:62 +// be/be_visitor_root/root_ch.cpp:62 namespace TAO { @@ -84,49 +84,49 @@ namespace TAO } // TAO_IDL - Generated from -// be\be_visitor_module/module_ch.cpp:48 +// be/be_visitor_module/module_ch.cpp:48 namespace CORBA { // TAO_IDL - Generated from - // be\be_visitor_typedef/typedef_ch.cpp:379 + // be/be_visitor_typedef/typedef_ch.cpp:379 typedef CORBA::Short PolicyErrorCode; typedef CORBA::Short_out PolicyErrorCode_out; // TAO_IDL - Generated from - // be\be_visitor_typecode/typecode_decl.cpp:44 + // be/be_visitor_typecode/typecode_decl.cpp:44 - TAO_NAMESPACE_STORAGE_CLASS ::CORBA::TypeCode_ptr _tc_PolicyErrorCode; + TAO_NAMESPACE_STORAGE_CLASS ::CORBA::TypeCode_ptr const _tc_PolicyErrorCode; // TAO_IDL - Generated from - // be\be_visitor_constant/constant_ch.cpp:52 + // be/be_visitor_constant/constant_ch.cpp:52 const CORBA::PolicyErrorCode BAD_POLICY = 0; // TAO_IDL - Generated from - // be\be_visitor_constant/constant_ch.cpp:52 + // be/be_visitor_constant/constant_ch.cpp:52 const CORBA::PolicyErrorCode UNSUPPORTED_POLICY = 1; // TAO_IDL - Generated from - // be\be_visitor_constant/constant_ch.cpp:52 + // be/be_visitor_constant/constant_ch.cpp:52 const CORBA::PolicyErrorCode BAD_POLICY_TYPE = 2; // TAO_IDL - Generated from - // be\be_visitor_constant/constant_ch.cpp:52 + // be/be_visitor_constant/constant_ch.cpp:52 const CORBA::PolicyErrorCode BAD_POLICY_VALUE = 3; // TAO_IDL - Generated from - // be\be_visitor_constant/constant_ch.cpp:52 + // be/be_visitor_constant/constant_ch.cpp:52 const CORBA::PolicyErrorCode UNSUPPORTED_POLICY_VALUE = 4; // TAO_IDL - Generated from - // be\be_visitor_exception/exception_ch.cpp:51 + // be/be_visitor_exception/exception_ch.cpp:51 #if !defined (_CORBA_POLICYERROR_CH_) #define _CORBA_POLICYERROR_CH_ @@ -164,27 +164,27 @@ namespace CORBA ); // TAO_IDL - Generated from - // be\be_visitor_exception/exception_ctor.cpp:66 + // be/be_visitor_exception/exception_ctor.cpp:66 PolicyError ( ACE_NESTED_CLASS (CORBA, PolicyErrorCode) _tao_reason ); // TAO_IDL - Generated from - // be\be_visitor_exception/exception_ch.cpp:127 + // be/be_visitor_exception/exception_ch.cpp:127 virtual CORBA::TypeCode_ptr _type (void) const; }; // TAO_IDL - Generated from - // be\be_visitor_typecode/typecode_decl.cpp:44 + // be/be_visitor_typecode/typecode_decl.cpp:44 - TAO_NAMESPACE_STORAGE_CLASS ::CORBA::TypeCode_ptr _tc_PolicyError; + TAO_NAMESPACE_STORAGE_CLASS ::CORBA::TypeCode_ptr const _tc_PolicyError; #endif /* end #if !defined */ // TAO_IDL - Generated from - // be\be_visitor_exception/exception_ch.cpp:51 + // be/be_visitor_exception/exception_ch.cpp:51 #if !defined (_CORBA_INVALIDPOLICIES_CH_) #define _CORBA_INVALIDPOLICIES_CH_ @@ -222,27 +222,27 @@ namespace CORBA ); // TAO_IDL - Generated from - // be\be_visitor_exception/exception_ctor.cpp:66 + // be/be_visitor_exception/exception_ctor.cpp:66 InvalidPolicies ( const ACE_NESTED_CLASS (CORBA, UShortSeq) & _tao_indices ); // TAO_IDL - Generated from - // be\be_visitor_exception/exception_ch.cpp:127 + // be/be_visitor_exception/exception_ch.cpp:127 virtual CORBA::TypeCode_ptr _type (void) const; }; // TAO_IDL - Generated from - // be\be_visitor_typecode/typecode_decl.cpp:44 + // be/be_visitor_typecode/typecode_decl.cpp:44 - TAO_NAMESPACE_STORAGE_CLASS ::CORBA::TypeCode_ptr _tc_InvalidPolicies; + TAO_NAMESPACE_STORAGE_CLASS ::CORBA::TypeCode_ptr const _tc_InvalidPolicies; #endif /* end #if !defined */ // TAO_IDL - Generated from - // be\be_interface.cpp:598 + // be/be_interface.cpp:598 #if !defined (_CORBA_POLICY__VAR_OUT_CH_) #define _CORBA_POLICY__VAR_OUT_CH_ @@ -265,7 +265,7 @@ namespace CORBA #endif /* end #if !defined */ // TAO_IDL - Generated from - // be\be_visitor_interface/interface_ch.cpp:54 + // be/be_visitor_interface/interface_ch.cpp:54 #if !defined (_CORBA_POLICY_CH_) #define _CORBA_POLICY_CH_ @@ -281,6 +281,8 @@ namespace CORBA // The static operations. static Policy_ptr _duplicate (Policy_ptr obj); + static void _tao_release (Policy_ptr obj); + static Policy_ptr _narrow ( CORBA::Object_ptr obj ACE_ENV_ARG_DECL_WITH_DEFAULTS @@ -299,7 +301,7 @@ namespace CORBA static void _tao_any_destructor (void *); // TAO_IDL - Generated from - // be\be_visitor_operation/operation_ch.cpp:46 + // be/be_visitor_operation/operation_ch.cpp:46 virtual CORBA::PolicyType policy_type ( ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS @@ -309,7 +311,7 @@ namespace CORBA )); // TAO_IDL - Generated from - // be\be_visitor_operation/operation_ch.cpp:46 + // be/be_visitor_operation/operation_ch.cpp:46 virtual ::CORBA::Policy_ptr copy ( ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS @@ -319,7 +321,7 @@ namespace CORBA )); // TAO_IDL - Generated from - // be\be_visitor_operation/operation_ch.cpp:46 + // be/be_visitor_operation/operation_ch.cpp:46 virtual void destroy ( ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS @@ -329,7 +331,7 @@ namespace CORBA )); // TAO_IDL - Generated from - // be\be_visitor_interface/interface_ch.cpp:208 + // be/be_visitor_interface/interface_ch.cpp:210 virtual CORBA::Boolean _is_a ( const char *type_id @@ -384,12 +386,12 @@ namespace CORBA #endif /* end #if !defined */ // TAO_IDL - Generated from - // be\be_visitor_typecode/typecode_decl.cpp:44 + // be/be_visitor_typecode/typecode_decl.cpp:44 - TAO_NAMESPACE_STORAGE_CLASS ::CORBA::TypeCode_ptr _tc_Policy; + TAO_NAMESPACE_STORAGE_CLASS ::CORBA::TypeCode_ptr const _tc_Policy; // TAO_IDL - Generated from - // be\be_interface.cpp:598 + // be/be_interface.cpp:598 #if !defined (_CORBA_POLICYMANAGER__VAR_OUT_CH_) #define _CORBA_POLICYMANAGER__VAR_OUT_CH_ @@ -412,7 +414,7 @@ namespace CORBA #endif /* end #if !defined */ // TAO_IDL - Generated from - // be\be_visitor_interface/interface_ch.cpp:54 + // be/be_visitor_interface/interface_ch.cpp:54 #if !defined (_CORBA_POLICYMANAGER_CH_) #define _CORBA_POLICYMANAGER_CH_ @@ -427,6 +429,8 @@ namespace CORBA // The static operations. static PolicyManager_ptr _duplicate (PolicyManager_ptr obj); + static void _tao_release (PolicyManager_ptr obj); + static PolicyManager_ptr _narrow ( CORBA::Object_ptr obj ACE_ENV_ARG_DECL_WITH_DEFAULTS @@ -445,7 +449,7 @@ namespace CORBA static void _tao_any_destructor (void *); // TAO_IDL - Generated from - // be\be_visitor_operation/operation_ch.cpp:46 + // be/be_visitor_operation/operation_ch.cpp:46 virtual ::CORBA::PolicyList * get_policy_overrides ( const ::CORBA::PolicyTypeSeq & ts @@ -456,7 +460,7 @@ namespace CORBA )) = 0; // TAO_IDL - Generated from - // be\be_visitor_operation/operation_ch.cpp:46 + // be/be_visitor_operation/operation_ch.cpp:46 virtual void set_policy_overrides ( const ::CORBA::PolicyList & policies, @@ -469,7 +473,7 @@ namespace CORBA )) = 0; // TAO_IDL - Generated from - // be\be_visitor_interface/interface_ch.cpp:208 + // be/be_visitor_interface/interface_ch.cpp:210 virtual CORBA::Boolean _is_a ( const char *type_id @@ -495,12 +499,12 @@ namespace CORBA #endif /* end #if !defined */ // TAO_IDL - Generated from - // be\be_visitor_typecode/typecode_decl.cpp:44 + // be/be_visitor_typecode/typecode_decl.cpp:44 - TAO_NAMESPACE_STORAGE_CLASS ::CORBA::TypeCode_ptr _tc_PolicyManager; + TAO_NAMESPACE_STORAGE_CLASS ::CORBA::TypeCode_ptr const _tc_PolicyManager; // TAO_IDL - Generated from - // be\be_interface.cpp:598 + // be/be_interface.cpp:598 #if !defined (_CORBA_POLICYCURRENT__VAR_OUT_CH_) #define _CORBA_POLICYCURRENT__VAR_OUT_CH_ @@ -523,7 +527,7 @@ namespace CORBA #endif /* end #if !defined */ // TAO_IDL - Generated from - // be\be_visitor_interface/interface_ch.cpp:54 + // be/be_visitor_interface/interface_ch.cpp:54 #if !defined (_CORBA_POLICYCURRENT_CH_) #define _CORBA_POLICYCURRENT_CH_ @@ -539,6 +543,8 @@ namespace CORBA // The static operations. static PolicyCurrent_ptr _duplicate (PolicyCurrent_ptr obj); + static void _tao_release (PolicyCurrent_ptr obj); + static PolicyCurrent_ptr _narrow ( CORBA::Object_ptr obj ACE_ENV_ARG_DECL_WITH_DEFAULTS @@ -557,7 +563,7 @@ namespace CORBA static void _tao_any_destructor (void *); // TAO_IDL - Generated from - // be\be_visitor_interface/interface_ch.cpp:208 + // be/be_visitor_interface/interface_ch.cpp:210 virtual CORBA::Boolean _is_a ( const char *type_id @@ -583,19 +589,19 @@ namespace CORBA #endif /* end #if !defined */ // TAO_IDL - Generated from - // be\be_visitor_typecode/typecode_decl.cpp:44 + // be/be_visitor_typecode/typecode_decl.cpp:44 - TAO_NAMESPACE_STORAGE_CLASS ::CORBA::TypeCode_ptr _tc_PolicyCurrent; + TAO_NAMESPACE_STORAGE_CLASS ::CORBA::TypeCode_ptr const _tc_PolicyCurrent; // TAO_IDL - Generated from -// be\be_visitor_module/module_ch.cpp:66 +// be/be_visitor_module/module_ch.cpp:66 } // module CORBA // Proxy Broker Factory function pointer declarations. // TAO_IDL - Generated from -// be\be_visitor_root/root.cpp:120 +// be/be_visitor_root/root.cpp:230 extern TAO_Export TAO::Collocation_Proxy_Broker * @@ -604,7 +610,7 @@ TAO::Collocation_Proxy_Broker * ); // TAO_IDL - Generated from -// be\be_visitor_traits.cpp:59 +// be/be_visitor_traits.cpp:59 // Traits specializations. namespace TAO @@ -613,7 +619,7 @@ namespace TAO #if !defined (_CORBA_POLICY__TRAITS_CH_) #define _CORBA_POLICY__TRAITS_CH_ - ACE_TEMPLATE_SPECIALIZATION + template<> struct TAO_Export Objref_Traits< ::CORBA::Policy> { static ::CORBA::Policy_ptr duplicate ( @@ -634,7 +640,7 @@ namespace TAO #if !defined (_CORBA_POLICYCURRENT__TRAITS_CH_) #define _CORBA_POLICYCURRENT__TRAITS_CH_ - ACE_TEMPLATE_SPECIALIZATION + template<> struct TAO_Export Objref_Traits< ::CORBA::PolicyCurrent> { static ::CORBA::PolicyCurrent_ptr duplicate ( @@ -655,7 +661,7 @@ namespace TAO #if !defined (_CORBA_POLICYMANAGER__TRAITS_CH_) #define _CORBA_POLICYMANAGER__TRAITS_CH_ - ACE_TEMPLATE_SPECIALIZATION + template<> struct TAO_Export Objref_Traits< ::CORBA::PolicyManager> { static ::CORBA::PolicyManager_ptr duplicate ( @@ -675,7 +681,7 @@ namespace TAO } // TAO_IDL - Generated from -// be\be_visitor_exception/any_op_ch.cpp:52 +// be/be_visitor_exception/any_op_ch.cpp:52 TAO_Export void operator<<= (CORBA::Any &, const CORBA::PolicyError &); // copying version TAO_Export void operator<<= (CORBA::Any &, CORBA::PolicyError*); // noncopying version @@ -683,7 +689,7 @@ TAO_Export CORBA::Boolean operator>>= (const CORBA::Any &, CORBA::PolicyError *& TAO_Export CORBA::Boolean operator>>= (const CORBA::Any &, const CORBA::PolicyError *&); // TAO_IDL - Generated from -// be\be_visitor_exception/any_op_ch.cpp:52 +// be/be_visitor_exception/any_op_ch.cpp:52 TAO_Export void operator<<= (CORBA::Any &, const CORBA::InvalidPolicies &); // copying version TAO_Export void operator<<= (CORBA::Any &, CORBA::InvalidPolicies*); // noncopying version @@ -691,46 +697,46 @@ TAO_Export CORBA::Boolean operator>>= (const CORBA::Any &, CORBA::InvalidPolicie TAO_Export CORBA::Boolean operator>>= (const CORBA::Any &, const CORBA::InvalidPolicies *&); // TAO_IDL - Generated from -// be\be_visitor_interface/any_op_ch.cpp:52 +// be/be_visitor_interface/any_op_ch.cpp:52 TAO_Export void operator<<= (CORBA::Any &, CORBA::Policy_ptr); // copying TAO_Export void operator<<= (CORBA::Any &, CORBA::Policy_ptr *); // non-copying TAO_Export CORBA::Boolean operator>>= (const CORBA::Any &, CORBA::Policy_ptr &); // TAO_IDL - Generated from -// be\be_visitor_interface/any_op_ch.cpp:52 +// be/be_visitor_interface/any_op_ch.cpp:52 TAO_Export void operator<<= (CORBA::Any &, CORBA::PolicyManager_ptr); // copying TAO_Export void operator<<= (CORBA::Any &, CORBA::PolicyManager_ptr *); // non-copying TAO_Export CORBA::Boolean operator>>= (const CORBA::Any &, CORBA::PolicyManager_ptr &); // TAO_IDL - Generated from -// be\be_visitor_interface/any_op_ch.cpp:52 +// be/be_visitor_interface/any_op_ch.cpp:52 TAO_Export void operator<<= (CORBA::Any &, CORBA::PolicyCurrent_ptr); // copying TAO_Export void operator<<= (CORBA::Any &, CORBA::PolicyCurrent_ptr *); // non-copying TAO_Export CORBA::Boolean operator>>= (const CORBA::Any &, CORBA::PolicyCurrent_ptr &); // TAO_IDL - Generated from -// be\be_visitor_exception/cdr_op_ch.cpp:52 +// be/be_visitor_exception/cdr_op_ch.cpp:52 TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &, const CORBA::PolicyError &); TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &, CORBA::PolicyError &); // TAO_IDL - Generated from -// be\be_visitor_exception/cdr_op_ch.cpp:52 +// be/be_visitor_exception/cdr_op_ch.cpp:52 TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &, const CORBA::InvalidPolicies &); TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &, CORBA::InvalidPolicies &); // TAO_IDL - Generated from -// be\be_visitor_interface/cdr_op_ch.cpp:55 +// be/be_visitor_interface/cdr_op_ch.cpp:55 TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &, const CORBA::Policy_ptr ); TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &, CORBA::Policy_ptr &); // TAO_IDL - Generated from -// be\be_codegen.cpp:961 +// be/be_codegen.cpp:961 #if defined (__ACE_INLINE__) #include "PolicyC.inl" diff --git a/TAO/tao/PolicyC.inl b/TAO/tao/PolicyC.inl index 2bc9b36e2dc..d250cfb9634 100644 --- a/TAO/tao/PolicyC.inl +++ b/TAO/tao/PolicyC.inl @@ -27,7 +27,7 @@ // TAO_IDL - Generated from -// be\be_visitor_interface/interface_ci.cpp:70 +// be/be_visitor_interface/interface_ci.cpp:70 #if !defined (_CORBA_POLICY___CI_) #define _CORBA_POLICY___CI_ diff --git a/TAO/tao/PortableServer/Any_SArg_Traits.h b/TAO/tao/PortableServer/Any_SArg_Traits.h new file mode 100644 index 00000000000..393bb958210 --- /dev/null +++ b/TAO/tao/PortableServer/Any_SArg_Traits.h @@ -0,0 +1,50 @@ +// This may look like C, but it's really -*- C++ -*- + +//============================================================================= +/** + * @file Any_Arg_Traits.h + * + * $Id$ + * + * @author Jeff Parsons + * @author Ossama Othman + */ +//============================================================================= + + +#ifndef TAO_ANY_SARG_TRAITS_H +#define TAO_ANY_SARG_TRAITS_H + +#include /**/ "ace/pre.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/PortableServer/Var_Size_SArgument_T.h" +#include "tao/PortableServer/portableserver_export.h" + +namespace CORBA +{ + class Any; + class Any_var; + class Any_out; +} + +namespace TAO +{ + template<> + class TAO_PortableServer_Export SArg_Traits<CORBA::Any> + : public + Var_Size_SArg_Traits_T< + CORBA::Any, + CORBA::Any_var, + CORBA::Any_out + > + { + }; +} + +#include /**/ "ace/post.h" + +#endif /* TAO_ANY_ARG_TRAITS_H */ diff --git a/TAO/tao/BD_String_SArgument_T.cpp b/TAO/tao/PortableServer/BD_String_SArgument_T.cpp index d428442272a..37ae58694da 100644 --- a/TAO/tao/BD_String_SArgument_T.cpp +++ b/TAO/tao/PortableServer/BD_String_SArgument_T.cpp @@ -1,23 +1,20 @@ // $Id$ -#ifndef TAO_BD_STRING_SARGUMENT_T_C -#define TAO_BD_STRING_SARGUMENT_T_C +#ifndef TAO_BD_STRING_SARGUMENT_T_CPP +#define TAO_BD_STRING_SARGUMENT_T_CPP -#include "tao/BD_String_SArgument_T.h" +#include "tao/PortableServer/BD_String_SArgument_T.h" #include "tao/Dynamic_ParameterC.h" #if !defined (__ACE_INLINE__) #include "tao/BD_String_SArgument_T.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID (tao, - BD_String_SArgument_T, - "$Id$") -template<typename S, - typename S_var, - typename to_S, - typename from_S, +template<typename S, + typename S_var, + typename to_S, + typename from_S, size_t BOUND> CORBA::Boolean TAO::In_BD_String_SArgument_T<S,S_var,to_S,from_S,BOUND>::demarshal ( @@ -29,10 +26,10 @@ TAO::In_BD_String_SArgument_T<S,S_var,to_S,from_S,BOUND>::demarshal ( #if TAO_HAS_INTERCEPTORS == 1 -template<typename S, - typename S_var, - typename to_S, - typename from_S, +template<typename S, + typename S_var, + typename to_S, + typename from_S, size_t BOUND> void TAO::In_BD_String_SArgument_T<S,S_var,to_S,from_S,BOUND>::interceptor_param ( @@ -47,10 +44,10 @@ TAO::In_BD_String_SArgument_T<S,S_var,to_S,from_S,BOUND>::interceptor_param ( // =========================================================== -template<typename S, - typename S_var, - typename to_S, - typename from_S, +template<typename S, + typename S_var, + typename to_S, + typename from_S, size_t BOUND> CORBA::Boolean TAO::Inout_BD_String_SArgument_T<S,S_var,to_S,from_S,BOUND>::marshal ( @@ -60,10 +57,10 @@ TAO::Inout_BD_String_SArgument_T<S,S_var,to_S,from_S,BOUND>::marshal ( return cdr << from_S (this->x_.in (), BOUND); } -template<typename S, - typename S_var, - typename to_S, - typename from_S, +template<typename S, + typename S_var, + typename to_S, + typename from_S, size_t BOUND> CORBA::Boolean TAO::Inout_BD_String_SArgument_T<S,S_var,to_S,from_S,BOUND>::demarshal ( @@ -75,10 +72,10 @@ TAO::Inout_BD_String_SArgument_T<S,S_var,to_S,from_S,BOUND>::demarshal ( #if TAO_HAS_INTERCEPTORS == 1 -template<typename S, - typename S_var, - typename to_S, - typename from_S, +template<typename S, + typename S_var, + typename to_S, + typename from_S, size_t BOUND> void TAO::Inout_BD_String_SArgument_T<S,S_var,to_S,from_S,BOUND>:: @@ -92,11 +89,11 @@ interceptor_param (Dynamic::Parameter & p) // ============================================================== -template<typename S, +template<typename S, typename S_var, typename S_out, - typename to_S, - typename from_S, + typename to_S, + typename from_S, size_t BOUND> CORBA::Boolean TAO::Out_BD_String_SArgument_T<S,S_var,S_out,to_S,from_S,BOUND>::marshal ( @@ -108,11 +105,11 @@ TAO::Out_BD_String_SArgument_T<S,S_var,S_out,to_S,from_S,BOUND>::marshal ( #if TAO_HAS_INTERCEPTORS == 1 -template<typename S, - typename S_var, +template<typename S, + typename S_var, typename S_out, - typename to_S, - typename from_S, + typename to_S, + typename from_S, size_t BOUND> void TAO::Out_BD_String_SArgument_T<S,S_var,S_out,to_S,from_S,BOUND>:: @@ -126,10 +123,10 @@ interceptor_param (Dynamic::Parameter & p) // ============================================================ -template<typename S, - typename S_var, - typename to_S, - typename from_S, +template<typename S, + typename S_var, + typename to_S, + typename from_S, size_t BOUND> CORBA::Boolean TAO::Ret_BD_String_SArgument_T<S,S_var,to_S,from_S,BOUND>::marshal ( @@ -141,10 +138,10 @@ TAO::Ret_BD_String_SArgument_T<S,S_var,to_S,from_S,BOUND>::marshal ( #if TAO_HAS_INTERCEPTORS == 1 -template<typename S, - typename S_var, - typename to_S, - typename from_S, +template<typename S, + typename S_var, + typename to_S, + typename from_S, size_t BOUND> void TAO::Ret_BD_String_SArgument_T<S,S_var,to_S,from_S,BOUND>:: @@ -155,4 +152,4 @@ interceptor_result (CORBA::Any * any) #endif /* TAO_HAS_INTERCEPTORS */ -#endif /* TAO_BD_STRING_SARGUMENT_T_C */ +#endif /* TAO_BD_STRING_SARGUMENT_T_CPP */ diff --git a/TAO/tao/BD_String_SArgument_T.h b/TAO/tao/PortableServer/BD_String_SArgument_T.h index 829fd3dc548..0b165c2cdd5 100644 --- a/TAO/tao/BD_String_SArgument_T.h +++ b/TAO/tao/PortableServer/BD_String_SArgument_T.h @@ -1,4 +1,4 @@ -// This may look like C, but it's really -*- C++ -*- +// -*- C++ -*- //============================================================================= /** @@ -6,7 +6,7 @@ * * $Id$ * - * @authors Jeff Parsons and Carlos O'Ryan + * @authors Jeff Parsons, Carlos O'Ryan and Ossama Othman */ //============================================================================= @@ -15,6 +15,7 @@ #define TAO_BD_STRING_SARGUMENT_T_H #include /**/ "ace/pre.h" + #include "ace/CDR_Stream.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) @@ -154,7 +155,7 @@ namespace TAO T_var, to_T, from_T, - BOUND> in_sarg_val; + BOUND> in_arg_val; typedef Inout_BD_String_SArgument_T<T, T_var, to_T, @@ -171,6 +172,14 @@ namespace TAO to_T, from_T, BOUND> ret_val; + + // Typedefs corresponding to return value of arg() method in both + // the client and server side argument class templates. + typedef in_type in_arg_type; + typedef inout_type inout_arg_type; + typedef inout_type out_arg_type; + typedef inout_type ret_arg_type; + }; /** @@ -180,7 +189,7 @@ namespace TAO */ template<size_t BOUND> - class BD_StringS_Arg_Traits + class BD_String_SArg_Traits : public BD_String_SArg_Traits_T<CORBA::Char, CORBA::String_var, CORBA::String_out, @@ -203,11 +212,11 @@ namespace TAO }; #if defined (__ACE_INLINE__) -#include "tao/BD_String_SArgument_T.inl" +#include "tao/PortableServer/BD_String_SArgument_T.inl" #endif /* __ACE_INLINE__ */ #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "tao/BD_String_SArgument_T.cpp" +#include "tao/PortableServer/BD_String_SArgument_T.cpp" #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) diff --git a/TAO/tao/BD_String_SArgument_T.inl b/TAO/tao/PortableServer/BD_String_SArgument_T.inl index f8a76b8938f..f8a76b8938f 100644 --- a/TAO/tao/BD_String_SArgument_T.inl +++ b/TAO/tao/PortableServer/BD_String_SArgument_T.inl diff --git a/TAO/tao/Basic_SArgument_T.cpp b/TAO/tao/PortableServer/Basic_SArgument_T.cpp index 2bfd618f9a6..79301cfb9aa 100644 --- a/TAO/tao/Basic_SArgument_T.cpp +++ b/TAO/tao/PortableServer/Basic_SArgument_T.cpp @@ -1,18 +1,15 @@ // $Id$ -#ifndef TAO_BASIC_SARGUMENT_T_C -#define TAO_BASIC_SARGUMENT_T_C +#ifndef TAO_BASIC_SARGUMENT_T_CPP +#define TAO_BASIC_SARGUMENT_T_CPP -#include "tao/Basic_SArgument_T.h" +#include "tao/PortableServer/Basic_SArgument_T.h" #include "tao/Dynamic_ParameterC.h" #if !defined (__ACE_INLINE__) -#include "tao/Basic_SArgument_T.inl" +#include "tao/PortableServer/Basic_SArgument_T.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID (tao, - Basic_SArgument_T, - "$Id$") template<typename S> CORBA::Boolean @@ -102,4 +99,4 @@ TAO::Ret_Basic_SArgument_T<S>::interceptor_result (CORBA::Any * any) #endif /* TAO_HAS_INTERCEPTORS */ -#endif /* TAO_BASIC_SARGUMENT_T_C */ +#endif /* TAO_BASIC_SARGUMENT_T_CPP */ diff --git a/TAO/tao/Basic_SArgument_T.h b/TAO/tao/PortableServer/Basic_SArgument_T.h index f4eaf282bf0..7a5b9ac870e 100644 --- a/TAO/tao/Basic_SArgument_T.h +++ b/TAO/tao/PortableServer/Basic_SArgument_T.h @@ -1,4 +1,4 @@ -// This may look like C, but it's really -*- C++ -*- +// -*- C++ -*- //============================================================================= /** @@ -6,7 +6,7 @@ * * $Id$ * - * @authors Jeff Parsons and Carlos O'Ryan + * @authors Jeff Parsons, Carlos O'Ryan and Ossama Othman */ //============================================================================= @@ -131,15 +131,23 @@ namespace TAO typedef Inout_Basic_SArgument_T<T> inout_arg_val; typedef Out_Basic_SArgument_T<T> out_arg_val; typedef Ret_Basic_SArgument_T<T> ret_val; + + // Typedefs corresponding to return value of arg() method in both + // the client and server side argument class templates. + typedef in_type in_arg_type; + typedef inout_type inout_arg_type; + typedef out_type out_arg_type; + typedef out_type ret_arg_type; + }; }; #if defined (__ACE_INLINE__) -#include "tao/Basic_SArgument_T.inl" +#include "tao/PortableServer/Basic_SArgument_T.inl" #endif /* __ACE_INLINE__ */ #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "tao/Basic_SArgument_T.cpp" +#include "tao/PortableServer/Basic_SArgument_T.cpp" #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) diff --git a/TAO/tao/Basic_SArgument_T.inl b/TAO/tao/PortableServer/Basic_SArgument_T.inl index 0958abeed27..2bbaba955ab 100644 --- a/TAO/tao/Basic_SArgument_T.inl +++ b/TAO/tao/PortableServer/Basic_SArgument_T.inl @@ -1,3 +1,5 @@ +// -*- C++ -*- +// // $Id$ template<typename S> diff --git a/TAO/tao/Basic_SArguments.cpp b/TAO/tao/PortableServer/Basic_SArguments.cpp index c4a1b17ff71..75c2e33d850 100644 --- a/TAO/tao/Basic_SArguments.cpp +++ b/TAO/tao/PortableServer/Basic_SArguments.cpp @@ -1,8 +1,8 @@ // $Id$ -#include "tao/Basic_SArguments.h" +#include "Basic_SArguments.h" -ACE_RCSID (tao, +ACE_RCSID (PortableServer, Basic_SArguments, "$Id$") diff --git a/TAO/tao/Basic_SArguments.h b/TAO/tao/PortableServer/Basic_SArguments.h index 44e06b5885c..a61a5dc68b6 100644 --- a/TAO/tao/Basic_SArguments.h +++ b/TAO/tao/PortableServer/Basic_SArguments.h @@ -1,3 +1,6 @@ +// -*- C++ -*- + +//============================================================================= /** * @file Basic_SArguments.h * @@ -13,14 +16,16 @@ #include /**/ "ace/pre.h" -#include "tao/Basic_SArgument_T.h" +#include "tao/PortableServer/portableserver_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/PortableServer/Basic_SArgument_T.h" #include "tao/Arg_Traits_T.h" + namespace TAO { /** @@ -29,12 +34,13 @@ namespace TAO * */ template<> - class TAO_Export SArg_Traits<void> + class TAO_PortableServer_Export SArg_Traits<void> { - public: - typedef void ret_type; + public: + typedef void ret_type; typedef Argument ret_val; + }; /** @@ -45,59 +51,60 @@ namespace TAO */ template<> - class TAO_Export SArg_Traits<CORBA::Short> + class TAO_PortableServer_Export SArg_Traits<CORBA::Short> : public Basic_SArg_Traits_T<CORBA::Short> { }; template<> - class TAO_Export SArg_Traits<CORBA::Long> + class TAO_PortableServer_Export SArg_Traits<CORBA::Long> : public Basic_SArg_Traits_T<CORBA::Long> { }; template<> - class TAO_Export SArg_Traits<CORBA::UShort> + class TAO_PortableServer_Export SArg_Traits<CORBA::UShort> : public Basic_SArg_Traits_T<CORBA::UShort> { }; template<> - class TAO_Export SArg_Traits<CORBA::ULong> + class TAO_PortableServer_Export SArg_Traits<CORBA::ULong> : public Basic_SArg_Traits_T<CORBA::ULong> { }; template<> - class TAO_Export SArg_Traits<CORBA::Float> + class TAO_PortableServer_Export SArg_Traits<CORBA::Float> : public Basic_SArg_Traits_T<CORBA::Float> { }; template<> - class TAO_Export SArg_Traits<CORBA::Double> + class TAO_PortableServer_Export SArg_Traits<CORBA::Double> : public Basic_SArg_Traits_T<CORBA::Double> { }; template<> - class TAO_Export SArg_Traits<CORBA::LongLong> + class TAO_PortableServer_Export SArg_Traits<CORBA::LongLong> : public Basic_SArg_Traits_T<CORBA::LongLong> { }; template<> - class TAO_Export SArg_Traits<CORBA::ULongLong> + class TAO_PortableServer_Export SArg_Traits<CORBA::ULongLong> : public Basic_SArg_Traits_T<CORBA::ULongLong> { }; template<> - class TAO_Export SArg_Traits<CORBA::LongDouble> + class TAO_PortableServer_Export SArg_Traits<CORBA::LongDouble> : public Basic_SArg_Traits_T<CORBA::LongDouble> { }; -}; + +} #include /**/ "ace/post.h" diff --git a/TAO/tao/PortableServer/Fixed_Array_SArgument_T.cpp b/TAO/tao/PortableServer/Fixed_Array_SArgument_T.cpp new file mode 100644 index 00000000000..424e0a8f5b4 --- /dev/null +++ b/TAO/tao/PortableServer/Fixed_Array_SArgument_T.cpp @@ -0,0 +1,127 @@ +// $Id$ + +#ifndef TAO_FIXED_ARRAY_SARGUMENT_T_CPP +#define TAO_FIXED_ARRAY_SARGUMENT_T_CPP + +#include "tao/PortableServer/Fixed_Array_SArgument_T.h" +#include "tao/Dynamic_ParameterC.h" + +#if !defined (__ACE_INLINE__) +#include "tao/PortableServer/Fixed_Array_SArgument_T.inl" +#endif /* __ACE_INLINE__ */ + + +template<typename S, typename S_slice, typename S_forany> +CORBA::Boolean +TAO::In_Fixed_Array_SArgument_T<S, + S_slice, + S_forany>::demarshal (TAO_InputCDR &cdr) +{ + S_forany tmp (this->x_); + return cdr >> tmp; +} + +#if TAO_HAS_INTERCEPTORS == 1 + +template<typename S, typename S_slice, typename S_forany> +void +TAO::In_Fixed_Array_SArgument_T<S, + S_slice, + S_forany>::interceptor_param ( + Dynamic::Parameter & p + ) +{ + p.argument <<= S_forany (this->x_); + p.mode = CORBA::PARAM_IN; +} + +#endif /* TAO_HAS_INTERCEPTORS */ + +// =========================================================== + +template<typename S, typename S_slice, typename S_forany> +CORBA::Boolean +TAO::Inout_Fixed_Array_SArgument_T<S, + S_slice, + S_forany>::marshal (TAO_OutputCDR & cdr) +{ + return cdr << S_forany (this->x_); +} + +template<typename S, typename S_slice, typename S_forany> +CORBA::Boolean +TAO::Inout_Fixed_Array_SArgument_T<S, + S_slice, + S_forany>::demarshal (TAO_InputCDR & cdr) +{ + S_forany tmp (this->x_); + return cdr >> tmp; +} + +#if TAO_HAS_INTERCEPTORS == 1 + +template<typename S, typename S_slice, typename S_forany> +void +TAO::Inout_Fixed_Array_SArgument_T<S, + S_slice, + S_forany>::interceptor_param ( + Dynamic::Parameter & p + ) +{ + p.argument <<= S_forany (this->x_); + p.mode = CORBA::PARAM_INOUT; +} + +#endif /* TAO_HAS_INTERCEPTORS */ + +// ============================================================== + +template<typename S, typename S_slice, typename S_forany> +CORBA::Boolean +TAO::Out_Fixed_Array_SArgument_T<S, + S_slice, + S_forany>::marshal (TAO_OutputCDR &cdr) +{ + return cdr << S_forany (this->x_); +} + +#if TAO_HAS_INTERCEPTORS == 1 + +template<typename S, typename S_slice, typename S_forany> +void +TAO::Out_Fixed_Array_SArgument_T<S, + S_slice, + S_forany>::interceptor_param ( + Dynamic::Parameter & p) +{ + p.argument <<= S_forany (this->x_); + p.mode = CORBA::PARAM_OUT; +} + +#endif /* TAO_HAS_INTERCEPTORS */ + +// ============================================================ + +template<typename S_slice, typename S_var, typename S_forany> +CORBA::Boolean +TAO::Ret_Fixed_Array_SArgument_T<S_slice,S_var,S_forany>::marshal ( + TAO_OutputCDR & cdr + ) +{ + return cdr << S_forany (this->x_.inout ()); +} + +#if TAO_HAS_INTERCEPTORS == 1 + +template<typename S_slice, typename S_var, typename S_forany> +void +TAO::Ret_Fixed_Array_SArgument_T<S_slice,S_var,S_forany>::interceptor_result ( + CORBA::Any * any + ) +{ + (*any) <<= S_forany (this->x_.ptr ()); +} + +#endif /* TAO_HAS_INTERCEPTORS */ + +#endif /* TAO_FIXED_ARRAY_SARGUMENT_T_CPP */ diff --git a/TAO/tao/Fixed_Array_SArgument_T.h b/TAO/tao/PortableServer/Fixed_Array_SArgument_T.h index 6e6fb9a52f7..246b827ff10 100644 --- a/TAO/tao/Fixed_Array_SArgument_T.h +++ b/TAO/tao/PortableServer/Fixed_Array_SArgument_T.h @@ -1,4 +1,4 @@ -// This may look like C, but it's really -*- C++ -*- +// -*- C++ -*- //============================================================================= /** @@ -6,7 +6,7 @@ * * $Id$ * - * @authors Jeff Parsons and Carlos O'Ryan + * @authors Jeff Parsons, Carlos O'Ryan and Ossama Othman */ //============================================================================= @@ -15,6 +15,7 @@ #define TAO_FIXED_ARRAY_SARGUMENT_T_H #include /**/ "ace/pre.h" + #include "tao/Argument.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) @@ -29,7 +30,7 @@ namespace TAO * @brief IN skeleton argument of fixed size element array. * */ - template<typename S, typename S_forany> + template<typename S, typename S_slice, typename S_forany> class In_Fixed_Array_SArgument_T : public Argument { public: @@ -39,10 +40,10 @@ namespace TAO #if TAO_HAS_INTERCEPTORS == 1 virtual void interceptor_param (Dynamic::Parameter &); #endif /* TAO_HAS_INTERCEPTORS == 1 */ - const S & arg (void) const; + S_slice const * arg (void) const; private: - S x_; + S_forany x_; }; /** @@ -51,7 +52,7 @@ namespace TAO * @brief INOUT skeleton argument of fixed size element array. * */ - template<typename S, typename S_forany> + template<typename S, typename S_slice, typename S_forany> class Inout_Fixed_Array_SArgument_T : public Argument { public: @@ -62,10 +63,10 @@ namespace TAO #if TAO_HAS_INTERCEPTORS == 1 virtual void interceptor_param (Dynamic::Parameter &); #endif /* TAO_HAS_INTERCEPTORS == 1 */ - S & arg (void); + S_slice * arg (void); private: - S x_; + S_forany x_; }; /** @@ -74,7 +75,7 @@ namespace TAO * @brief OUT skeleton argument of fixed size element array. * */ - template<typename S, typename S_forany> + template<typename S, typename S_slice, typename S_forany> class Out_Fixed_Array_SArgument_T : public Argument { public: @@ -84,10 +85,10 @@ namespace TAO #if TAO_HAS_INTERCEPTORS == 1 virtual void interceptor_param (Dynamic::Parameter &); #endif /* TAO_HAS_INTERCEPTORS == 1 */ - S & arg (void); + S_slice *& arg (void); private: - S x_; + S_forany x_; }; /** @@ -129,21 +130,35 @@ namespace TAO typedef T inout_type; typedef T out_type; - typedef In_Fixed_Array_SArgument_T<T,T_forany> in_arg_val; - typedef Inout_Fixed_Array_SArgument_T<T,T_forany> inout_arg_val; - typedef Out_Fixed_Array_SArgument_T<T,T_forany> out_arg_val; + typedef In_Fixed_Array_SArgument_T<T, + T_slice, + T_forany> in_arg_val; + typedef Inout_Fixed_Array_SArgument_T<T, + T_slice, + T_forany> inout_arg_val; + typedef Out_Fixed_Array_SArgument_T<T, + T_slice, + T_forany> out_arg_val; typedef Ret_Fixed_Array_SArgument_T<T_slice, T_var, T_forany> ret_val; + + // Typedefs corresponding to return value of arg() method in both + // the client and server side argument class templates. + typedef T_slice const * in_arg_type; + typedef ret_type inout_arg_type; + typedef ret_type & out_arg_type; + typedef ret_type & ret_arg_type; + }; }; #if defined (__ACE_INLINE__) -#include "tao/Fixed_Array_SArgument_T.inl" +#include "tao/PortableServer/Fixed_Array_SArgument_T.inl" #endif /* __ACE_INLINE__ */ #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "tao/Fixed_Array_SArgument_T.cpp" +#include "tao/PortableServer/Fixed_Array_SArgument_T.cpp" #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) diff --git a/TAO/tao/PortableServer/Fixed_Array_SArgument_T.inl b/TAO/tao/PortableServer/Fixed_Array_SArgument_T.inl new file mode 100644 index 00000000000..95349e884b7 --- /dev/null +++ b/TAO/tao/PortableServer/Fixed_Array_SArgument_T.inl @@ -0,0 +1,73 @@ +// -*- C++ -*- +// +// $Id$ + +template<typename S, typename S_slice, typename S_forany> +ACE_INLINE +TAO::In_Fixed_Array_SArgument_T<S, + S_slice, + S_forany>::In_Fixed_Array_SArgument_T (void) +{} + +template<typename S, typename S_slice, typename S_forany> +ACE_INLINE +S_slice const * +TAO::In_Fixed_Array_SArgument_T<S, S_slice, S_forany>::arg (void) const +{ + return this->x_.in (); +} + +// =========================================================================== + +template<typename S, typename S_slice, typename S_forany> +ACE_INLINE +TAO::Inout_Fixed_Array_SArgument_T<S, + S_slice, + S_forany>:: +Inout_Fixed_Array_SArgument_T (void) +{} + +template<typename S, typename S_slice, typename S_forany> +ACE_INLINE +S_slice * +TAO::Inout_Fixed_Array_SArgument_T<S, + S_slice, + S_forany>::arg (void) +{ + return this->x_.inout (); +} + +// =========================================================================== + +template<typename S, typename S_slice, typename S_forany> +ACE_INLINE +TAO::Out_Fixed_Array_SArgument_T<S, + S_slice, + S_forany>::Out_Fixed_Array_SArgument_T (void) +{} + +template<typename S, typename S_slice, typename S_forany> +ACE_INLINE +S_slice *& +TAO::Out_Fixed_Array_SArgument_T<S, + S_slice, + S_forany>::arg (void) +{ + return this->x_.out (); +} + +// =========================================================================== + +template<typename S_slice, typename S_var, typename S_forany> +ACE_INLINE +TAO::Ret_Fixed_Array_SArgument_T<S_slice,S_var,S_forany>:: +Ret_Fixed_Array_SArgument_T (void) +{} + +template<typename S_slice, typename S_var, typename S_forany> +ACE_INLINE +S_slice *& +TAO::Ret_Fixed_Array_SArgument_T<S_slice,S_var,S_forany>::arg (void) +{ + return this->x_.out (); +} diff --git a/TAO/tao/Fixed_Size_SArgument_T.cpp b/TAO/tao/PortableServer/Fixed_Size_SArgument_T.cpp index 28408a12af2..de4c433f7b2 100644 --- a/TAO/tao/Fixed_Size_SArgument_T.cpp +++ b/TAO/tao/PortableServer/Fixed_Size_SArgument_T.cpp @@ -1,22 +1,22 @@ // $Id$ -#ifndef TAO_FIXED_SIZE_SARGUMENT_T_C -#define TAO_FIXED_SIZE_SARGUMENT_T_C +#ifndef TAO_FIXED_SIZE_SARGUMENT_T_CPP +#define TAO_FIXED_SIZE_SARGUMENT_T_CPP -#include "tao/Fixed_Size_SArgument_T.h" -#include "tao/Dynamic_ParameterC.h" +#include "tao/PortableServer/Fixed_Size_SArgument_T.h" + +#if TAO_HAS_INTERCEPTORS == 1 +# include "tao/Dynamic_ParameterC.h" +#endif /* TAO_HAS_INTERCEPTORS == 1 */ #if !defined (__ACE_INLINE__) -#include "tao/Fixed_Size_SArgument_T.inl" +#include "tao/PortableServer/Fixed_Size_SArgument_T.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID (tao, - Fixed_Size_SArgument_T, - "$Id$") template<typename S> CORBA::Boolean -TAO::In_Fixed_Size_SArgument_T<S>::demarshal (TAO_InputCDR &cdr) +TAO::In_Fixed_Size_SArgument_T<S>::demarshal (TAO_InputCDR & cdr) { return cdr >> *this->x_; } @@ -78,7 +78,7 @@ template<typename S> void TAO::Out_Fixed_Size_SArgument_T<S>::interceptor_param (Dynamic::Parameter & p) { - p.argument <<= *this->x_; + p.argument <<= this->x_; p.mode = CORBA::PARAM_OUT; } diff --git a/TAO/tao/Fixed_Size_SArgument_T.h b/TAO/tao/PortableServer/Fixed_Size_SArgument_T.h index 4ba6e2f0bfa..df2699dd2bc 100644 --- a/TAO/tao/Fixed_Size_SArgument_T.h +++ b/TAO/tao/PortableServer/Fixed_Size_SArgument_T.h @@ -1,4 +1,4 @@ -// This may look like C, but it's really -*- C++ -*- +// -*- C++ -*- //============================================================================= /** @@ -6,7 +6,9 @@ * * $Id$ * - * @authors Jeff Parsons and Carlos O'Ryan + * @author Jeff Parsons + * @author Carlos O'Ryan + * @author Ossama Othman */ //============================================================================= @@ -15,6 +17,7 @@ #define TAO_FIXED_SIZE_SARGUMENT_T_H #include /**/ "ace/pre.h" + #include "tao/Argument.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) @@ -26,25 +29,45 @@ namespace TAO /** * @class In_Fixed_Size_SArgument_T * - * @brief Template class for IN skeleton argument of fixed size IDL types. + * @brief Skeleton class template for operation "IN" arguments of + * fixed size IDL types. * + * Skeleton class template for operation "IN" arguments of fixed + * size IDL types. */ template<typename S> class In_Fixed_Size_SArgument_T : public Argument { public: - In_Fixed_Size_SArgument_T (void); - virtual CORBA::Boolean demarshal (TAO_InputCDR &); + /** + * @name @c TAO::Argument Method Overrides + * + * @c TAO::Argument method overrides specific to the type of + * operation argument represented by this class. + * + * @see @c TAO::Argument. + */ + //@{ + virtual CORBA::Boolean demarshal (TAO_InputCDR & cdr); + #if TAO_HAS_INTERCEPTORS == 1 - virtual void interceptor_param (Dynamic::Parameter &); + virtual void interceptor_param (Dynamic::Parameter & p); #endif /* TAO_HAS_INTERCEPTORS == 1 */ - const S & arg (void) const; + //@} + + /// Retrieve underlying argument. + S const & arg (void) const; private: + + /// Reference to the "IN" argument. S * x_; + }; + // ------------------------------------------------------------ + /** * @class Inout_Fixed_Size_SArgument_T * @@ -55,19 +78,35 @@ namespace TAO class Inout_Fixed_Size_SArgument_T : public Argument { public: + + /// Constructor. Inout_Fixed_Size_SArgument_T (void); + /** + * @name @c TAO::Argument Method Overrides + * + * @c TAO::Argument method overrides specific to the type of + * operation argument represented by this class. + * + * @see @c TAO::Argument. + */ + //@{ virtual CORBA::Boolean marshal (TAO_OutputCDR &); virtual CORBA::Boolean demarshal (TAO_InputCDR &); #if TAO_HAS_INTERCEPTORS == 1 virtual void interceptor_param (Dynamic::Parameter &); #endif /* TAO_HAS_INTERCEPTORS == 1 */ + //@} + S & arg (void); private: + S * x_; }; + // ------------------------------------------------------------ + /** * @class Out_Fixed_Size_SArgument_T * @@ -78,18 +117,35 @@ namespace TAO class Out_Fixed_Size_SArgument_T : public Argument { public: + + /// Constructor. Out_Fixed_Size_SArgument_T (void); + /** + * @name @c TAO::Argument Method Overrides + * + * @c TAO::Argument method overrides specific to the type of + * operation argument represented by this class. + * + * @see @c TAO::Argument. + */ + //@{ virtual CORBA::Boolean marshal (TAO_OutputCDR &); #if TAO_HAS_INTERCEPTORS == 1 virtual void interceptor_param (Dynamic::Parameter &); #endif /* TAO_HAS_INTERCEPTORS == 1 */ + //@} + S & arg (void); private: + S x_; + }; + // ------------------------------------------------------------ + /** * @class Ret_Fixed_Size_SArgument_T * @@ -100,20 +156,37 @@ namespace TAO class Ret_Fixed_Size_SArgument_T : public Argument { public: + + /// Constructor. Ret_Fixed_Size_SArgument_T (void); + /** + * @name @c TAO::Argument Method Overrides + * + * @c TAO::Argument method overrides specific to the type of + * operation argument represented by this class. + * + * @see @c TAO::Argument. + */ + //@{ virtual CORBA::Boolean marshal (TAO_OutputCDR &); #if TAO_HAS_INTERCEPTORS == 1 virtual void interceptor_result (CORBA::Any *); #endif /* TAO_HAS_INTERCEPTORS == 1 */ + //@} + S & arg (void); private: + S * x_; + }; + // ------------------------------------------------------------ + /** - * @struct Basic_Arg_Traits_T + * @struct Fixed_Size_SArg_Traits_T * * @brief Template class for argument traits of fixed size IDL types. * @@ -122,7 +195,7 @@ namespace TAO struct Fixed_Size_SArg_Traits_T { typedef T ret_type; - typedef const T & in_type; + typedef T const & in_type; typedef T & inout_type; typedef T & out_type; @@ -130,15 +203,25 @@ namespace TAO typedef Inout_Fixed_Size_SArgument_T<T> inout_arg_val; typedef Out_Fixed_Size_SArgument_T<T> out_arg_val; typedef Ret_Fixed_Size_SArgument_T<T> ret_val; + + // Typedefs corresponding to return value of arg() method in both + // the client and server side argument class templates. + typedef in_type in_arg_type; + typedef inout_type inout_arg_type; + typedef out_type out_arg_type; + typedef ret_type ret_arg_type; + }; -}; + +} + #if defined (__ACE_INLINE__) -#include "tao/Fixed_Size_SArgument_T.inl" +#include "tao/PortableServer/Fixed_Size_SArgument_T.inl" #endif /* __ACE_INLINE__ */ #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "tao/Fixed_Size_SArgument_T.cpp" +#include "tao/PortableServer/Fixed_Size_SArgument_T.cpp" #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) diff --git a/TAO/tao/Fixed_Size_SArgument_T.inl b/TAO/tao/PortableServer/Fixed_Size_SArgument_T.inl index 287e3a813bf..1e06b317dcf 100644 --- a/TAO/tao/Fixed_Size_SArgument_T.inl +++ b/TAO/tao/PortableServer/Fixed_Size_SArgument_T.inl @@ -1,13 +1,10 @@ +// -*- C++ -*- +// // $Id$ template<typename S> ACE_INLINE -TAO::In_Fixed_Size_SArgument_T<S>::In_Fixed_Size_SArgument_T (void) -{} - -template<typename S> -ACE_INLINE -const S & +S const & TAO::In_Fixed_Size_SArgument_T<S>::arg (void) const { return *this->x_; @@ -55,4 +52,3 @@ TAO::Ret_Fixed_Size_SArgument_T<S>::arg (void) { return *this->x_; } - diff --git a/TAO/tao/PortableServer/Object_Adapter.cpp b/TAO/tao/PortableServer/Object_Adapter.cpp index daac760650d..dd498fc8258 100644 --- a/TAO/tao/PortableServer/Object_Adapter.cpp +++ b/TAO/tao/PortableServer/Object_Adapter.cpp @@ -726,11 +726,14 @@ TAO_Object_Adapter::dispatch (TAO::ObjectKey &key, int result = 0; #if TAO_HAS_INTERCEPTORS == 1 - TAO_ServerRequestInterceptor_Adapter sri_adapter ( - this->orb_core_.server_request_interceptors (), - request.interceptor_count ()); + TAO::ServerRequestInterceptor_Adapter sri_adapter (request); - TAO_ServerRequestInfo ri (request, 0); + TAO::ServerRequestInfo ri (request, + 0, // args + 0, // nargs + 0, // servant_upcall + 0, // exceptions + 0); // nexceptions ACE_TRY { @@ -838,10 +841,10 @@ TAO_Object_Adapter::create_collocated_object (TAO_Stub *stub, // zero. CORBA::Object_ptr x; ACE_NEW_RETURN (x, - CORBA::Object (stub, - 1, - sb), - CORBA::Object::_nil ()); + CORBA::Object (stub, + 1, + sb), + CORBA::Object::_nil ()); // Here we set the strategized Proxy Broker. x->_proxy_broker (the_tao_collocated_object_proxy_broker ()); diff --git a/TAO/tao/PortableServer/Object_SArg_Traits.h b/TAO/tao/PortableServer/Object_SArg_Traits.h new file mode 100644 index 00000000000..e8f9530e739 --- /dev/null +++ b/TAO/tao/PortableServer/Object_SArg_Traits.h @@ -0,0 +1,56 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Object_SArg_Traits.h + * + * $Id$ + * + * @author Ossama Othman + */ +//============================================================================= + +#ifndef TAO_OBJECT_SARG_TRAITS_H +#define TAO_OBJECT_SARG_TRAITS_H + +#include /**/ "ace/pre.h" + +#include "tao/CORBA_methods.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/PortableServer/Object_SArgument_T.h" +#include "tao/Pseudo_VarOut_T.h" + + +namespace CORBA +{ + class Object; + typedef Object *Object_ptr; + + typedef TAO_Pseudo_Var_T<Object> Object_var; + typedef TAO_Pseudo_Out_T<Object, Object_var> Object_out; +} + +// -------------------------------------------------------------- + +namespace TAO +{ + template <typename T> class SArg_Traits; + + /// Used in generated code if CORBA::Object is an argument or + /// return type. + ACE_TEMPLATE_SPECIALIZATION + class TAO_PortableServer_Export SArg_Traits<CORBA::Object> + : public Object_SArg_Traits_T<CORBA::Object_ptr, + CORBA::Object_var, + CORBA::Object_out> + { + }; +} + +#include /**/ "ace/post.h" + +#endif /* TAO_OBJECT_SARG_TRAITS_H */ diff --git a/TAO/tao/Object_SArgument_T.cpp b/TAO/tao/PortableServer/Object_SArgument_T.cpp index cdd83d2e90f..9a0c2906035 100644 --- a/TAO/tao/Object_SArgument_T.cpp +++ b/TAO/tao/PortableServer/Object_SArgument_T.cpp @@ -1,18 +1,15 @@ // $Id$ -#ifndef TAO_OBJECT_SARGUMENT_T_C -#define TAO_OBJECT_SARGUMENT_T_C +#ifndef TAO_OBJECT_SARGUMENT_T_CPP +#define TAO_OBJECT_SARGUMENT_T_CPP -#include "tao/Object_SArgument_T.h" +#include "tao/PortableServer/Object_SArgument_T.h" #include "tao/Dynamic_ParameterC.h" #if !defined (__ACE_INLINE__) -#include "tao/Object_SArgument_T.inl" +#include "tao/PortableServer/Object_SArgument_T.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID (tao, - Object_SArgument_T, - "$Id$") template<typename S_ptr, typename S_var> CORBA::Boolean @@ -110,4 +107,4 @@ TAO::Ret_Object_SArgument_T<S_ptr,S_var>::interceptor_result ( #endif /* TAO_HAS_INTERCEPTORS */ -#endif /* TAO_OBJECT_SARGUMENT_T_C */ +#endif /* TAO_OBJECT_SARGUMENT_T_CPP */ diff --git a/TAO/tao/PortableServer/Object_SArgument_T.h b/TAO/tao/PortableServer/Object_SArgument_T.h new file mode 100644 index 00000000000..b1e5e1a864e --- /dev/null +++ b/TAO/tao/PortableServer/Object_SArgument_T.h @@ -0,0 +1,163 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Object_SArgument_T.h + * + * $Id$ + * + * @authors Jeff Parsons, Carlos O'Ryan and Ossama Othman + */ +//============================================================================= + + +#ifndef TAO_OBJECT_SARGUMENT_T_H +#define TAO_OBJECT_SARGUMENT_T_H + +#include /**/ "ace/pre.h" + +#include "tao/Argument.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +// This set of classes is also used by valuetype arguments. If the +// specialization is done using S * for the parameter, the semantics +// are the same as for interfaces, so there's no need for another +// set of classes. + +namespace TAO +{ + /** + * @class In_Object_SArgument_T + * + * @brief Template class for IN skeleton object argument. + * + */ + template<typename S_ptr, typename S_var> + class In_Object_SArgument_T : public Argument + { + public: + + virtual CORBA::Boolean demarshal (TAO_InputCDR &); +#if TAO_HAS_INTERCEPTORS == 1 + virtual void interceptor_param (Dynamic::Parameter &); +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + S_ptr arg (void) const; + + private: + S_var x_; + }; + + /** + * @class Inout_Object_SArgument_T + * + * @brief Template class for INOUT skeleton object argument. + * + */ + template<typename S_ptr, typename S_var> + class Inout_Object_SArgument_T : public Argument + { + public: + Inout_Object_SArgument_T (void); + + virtual CORBA::Boolean marshal (TAO_OutputCDR &); + virtual CORBA::Boolean demarshal (TAO_InputCDR &); +#if TAO_HAS_INTERCEPTORS == 1 + virtual void interceptor_param (Dynamic::Parameter &); +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + S_ptr & arg (void); + + private: + S_var x_; + }; + + /** + * @class Out_Object_SArgument_T + * + * @brief Template class for INOUT skeleton object argument. + * + */ + template<typename S_ptr, typename S_var, typename S_out> + class Out_Object_SArgument_T : public Argument + { + public: + Out_Object_SArgument_T (void); + + virtual CORBA::Boolean marshal (TAO_OutputCDR &); +#if TAO_HAS_INTERCEPTORS == 1 + virtual void interceptor_param (Dynamic::Parameter &); +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + S_out arg (void); + + private: + S_var x_; + }; + + /** + * @class Ret_Object_SArgument_T + * + * @brief Template class for return skeleton value of object. + * + */ + template<typename S_ptr, typename S_var> + class Ret_Object_SArgument_T : public Argument + { + public: + Ret_Object_SArgument_T (void); + + virtual CORBA::Boolean marshal (TAO_OutputCDR &); +#if TAO_HAS_INTERCEPTORS == 1 + virtual void interceptor_result (CORBA::Any *); +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + S_ptr & arg (void); + + private: + S_var x_; + }; + + /** + * @struct Object_SArg_Traits_T + * + * @brief Template class for skeleton argument traits of objects. + * + */ + template<typename T_ptr, typename T_var, typename T_out> + struct Object_SArg_Traits_T + { + typedef T_ptr ret_type; + typedef T_ptr in_type; + typedef T_ptr & inout_type; + typedef T_out out_type; + + typedef In_Object_SArgument_T<T_ptr,T_var> in_arg_val; + typedef Inout_Object_SArgument_T<T_ptr,T_var> inout_arg_val; + typedef Out_Object_SArgument_T<T_ptr,T_var,T_out> out_arg_val; + typedef Ret_Object_SArgument_T<T_ptr,T_var> ret_val; + + // Typedefs corresponding to return value of arg() method in both + // the client and server side argument class templates. + typedef in_type in_arg_type; + typedef inout_type inout_arg_type; + typedef out_type out_arg_type; + typedef inout_type ret_arg_type; + + }; +} + +#if defined (__ACE_INLINE__) +#include "tao/PortableServer/Object_SArgument_T.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "tao/PortableServer/Object_SArgument_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Object_SArgument_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" + +#endif /* TAO_OBJECT_SARGUMENT_T_H */ diff --git a/TAO/tao/Object_SArgument_T.inl b/TAO/tao/PortableServer/Object_SArgument_T.inl index 4fdf9f7b72f..9588e14e67b 100644 --- a/TAO/tao/Object_SArgument_T.inl +++ b/TAO/tao/PortableServer/Object_SArgument_T.inl @@ -1,9 +1,7 @@ +// -*- C++ -*- +// // $Id$ -template<typename S_ptr, typename S_var> -ACE_INLINE -TAO::In_Object_SArgument_T<S_ptr,S_var>::In_Object_SArgument_T (void) -{} template<typename S_ptr, typename S_var> ACE_INLINE @@ -59,4 +57,3 @@ TAO::Ret_Object_SArgument_T<S_ptr,S_var>::arg (void) { return this->x_.out (); } - diff --git a/TAO/tao/PortableServer/Operation_Table.cpp b/TAO/tao/PortableServer/Operation_Table.cpp index bee2f5698e9..613d26a39d9 100644 --- a/TAO/tao/PortableServer/Operation_Table.cpp +++ b/TAO/tao/PortableServer/Operation_Table.cpp @@ -59,23 +59,24 @@ TAO_Operation_Table::~TAO_Operation_Table (void) } // constructor -TAO_Dynamic_Hash_OpTable::TAO_Dynamic_Hash_OpTable (const TAO_operation_db_entry *db, - CORBA::ULong dbsize, - CORBA::ULong hashtblsize, - ACE_Allocator *alloc) +TAO_Dynamic_Hash_OpTable::TAO_Dynamic_Hash_OpTable ( + TAO_operation_db_entry const * db, + CORBA::ULong dbsize, + CORBA::ULong hashtblsize, + ACE_Allocator *alloc) : hash_ (hashtblsize, alloc) { // Iterate thru each entry in the database and bind the operation // name to its corresponding skeleton. - for (CORBA::ULong i = 0; i < dbsize; i++) + for (CORBA::ULong i = 0; i < dbsize; ++i) { TAO::Operation_Skeletons s; - s.skel_ptr_ = db[i].skel_ptr_; - s.thruPOA_skel_ptr_ = db[i].thruPOA_skel_ptr_; - s.direct_skel_ptr_ = db[i].direct_skel_ptr_; + s.skel_ptr = db[i].skel_ptr; + s.thruPOA_skel_ptr = db[i].skel_ptr; + s.direct_skel_ptr = db[i].direct_skel_ptr; // @@ (ASG): what happens if bind fails ??? - if (this->bind (db[i].opname_, s) == -1) + if (this->bind (db[i].opname, s) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("bind failed"))); @@ -122,7 +123,7 @@ TAO_Dynamic_Hash_OpTable::find (const char *opname, if (retval != -1) { - skel_ptr = s.skel_ptr_; + skel_ptr = s.skel_ptr; } return retval; @@ -145,11 +146,8 @@ TAO_Dynamic_Hash_OpTable::find (const char *opname, { switch (s) { - case TAO::TAO_CS_THRU_POA_STRATEGY: - skel_ptr = skel.thruPOA_skel_ptr_; - break; case TAO::TAO_CS_DIRECT_STRATEGY: - skel_ptr = skel.direct_skel_ptr_; + skel_ptr = skel.direct_skel_ptr; break; default: return -1; @@ -183,14 +181,14 @@ TAO_Linear_Search_OpTable::find (const char *opname, { ACE_FUNCTION_TIMEPROBE (TAO_LINEAR_SEARCH_OPTABLE_FIND_START); - const TAO_operation_db_entry *entry = lookup (opname); + TAO_operation_db_entry const * const entry = lookup (opname); if (entry == 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("TAO_Linear_Search_Table:find failed\n")), -1); // Valid entry. Figure out the skel_ptr. - skelfunc = entry->skel_ptr_; + skelfunc = entry->skel_ptr; return 0; } @@ -204,7 +202,7 @@ TAO_Linear_Search_OpTable::find (const char *opname, { ACE_FUNCTION_TIMEPROBE (TAO_LINEAR_SEARCH_OPTABLE_FIND_START); - const TAO_operation_db_entry *entry = lookup (opname); + TAO_operation_db_entry const * const entry = lookup (opname); if (entry == 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("TAO_Linear_Search_Table:find failed\n")), @@ -212,11 +210,8 @@ TAO_Linear_Search_OpTable::find (const char *opname, switch (st) { - case TAO::TAO_CS_THRU_POA_STRATEGY: - skelfunc = entry->thruPOA_skel_ptr_; - break; case TAO::TAO_CS_DIRECT_STRATEGY: - skelfunc = entry->direct_skel_ptr_; + skelfunc = entry->direct_skel_ptr; break; default: return -1; @@ -242,12 +237,12 @@ TAO_Active_Demux_OpTable::TAO_Active_Demux_OpTable (const for (CORBA::ULong i=0; i < dbsize; i++) { TAO::Operation_Skeletons s; - s.skel_ptr_ = db[i].skel_ptr_; - s.thruPOA_skel_ptr_ = db[i].thruPOA_skel_ptr_; - s.direct_skel_ptr_ = db[i].direct_skel_ptr_; + s.skel_ptr = db[i].skel_ptr; + s.thruPOA_skel_ptr = db[i].skel_ptr; + s.direct_skel_ptr = db[i].direct_skel_ptr; // @@ (ASG): what happens if bind fails ??? - (void) this->bind (db[i].opname_, s); + (void) this->bind (db[i].opname, s); } } @@ -257,14 +252,14 @@ TAO_Active_Demux_OpTable::~TAO_Active_Demux_OpTable (void) } int -TAO_Active_Demux_OpTable::bind (const char *opname, +TAO_Active_Demux_OpTable::bind (const char * opname, const TAO::Operation_Skeletons skel_ptr) { CORBA::ULong i = ACE_OS::atoi (opname); if (i < this->tablesize_) { - if (this->tbl_[i].op_skel_ptr_.skel_ptr_ != 0) + if (this->tbl_[i].op_skel_ptr_.skel_ptr != 0) // overwriting previous one return 1; else @@ -286,7 +281,7 @@ TAO_Active_Demux_OpTable::find (const char *opname, CORBA::ULong i = ACE_OS::atoi (opname); ACE_ASSERT (i < this->tablesize_); - skel_ptr = this->tbl_[i].op_skel_ptr_.skel_ptr_; + skel_ptr = this->tbl_[i].op_skel_ptr_.skel_ptr; return 0; //success } @@ -305,11 +300,8 @@ TAO_Active_Demux_OpTable::find (const char *opname, switch (st) { - case TAO::TAO_CS_THRU_POA_STRATEGY: - skel_ptr = this->tbl_[i].op_skel_ptr_.thruPOA_skel_ptr_; - break; case TAO::TAO_CS_DIRECT_STRATEGY: - skel_ptr = this->tbl_[i].op_skel_ptr_.direct_skel_ptr_; + skel_ptr = this->tbl_[i].op_skel_ptr_.direct_skel_ptr; break; default: return -1; @@ -343,8 +335,8 @@ TAO_Perfect_Hash_OpTable::find (const char *opname, { ACE_FUNCTION_TIMEPROBE (TAO_PERFECT_HASH_OPTABLE_FIND_START); - const TAO_operation_db_entry *entry = lookup (opname, - length); + TAO_operation_db_entry const * const entry = lookup (opname, + length); if (entry == 0) { skelfunc = 0; // insure that somebody can't call a wrong function! @@ -356,7 +348,7 @@ TAO_Perfect_Hash_OpTable::find (const char *opname, } // Valid entry. Figure out the skel_ptr. - skelfunc = entry->skel_ptr_; + skelfunc = entry->skel_ptr; return 0; } @@ -369,8 +361,8 @@ TAO_Perfect_Hash_OpTable::find (const char *opname, { ACE_FUNCTION_TIMEPROBE (TAO_PERFECT_HASH_OPTABLE_FIND_START); - const TAO_operation_db_entry *entry = lookup (opname, - length); + TAO_operation_db_entry const * const entry = lookup (opname, + length); if (entry == 0) { skelfunc = 0; // insure that somebody can't call a wrong function! @@ -383,11 +375,8 @@ TAO_Perfect_Hash_OpTable::find (const char *opname, switch (st) { - case TAO::TAO_CS_THRU_POA_STRATEGY: - skelfunc = entry->thruPOA_skel_ptr_; - break; case TAO::TAO_CS_DIRECT_STRATEGY: - skelfunc = entry->direct_skel_ptr_; + skelfunc = entry->direct_skel_ptr; break; default: return -1; @@ -419,14 +408,14 @@ TAO_Binary_Search_OpTable::find (const char *opname, { ACE_FUNCTION_TIMEPROBE (TAO_BINARY_SEARCH_OPTABLE_FIND_START); - const TAO_operation_db_entry *entry = lookup (opname); + TAO_operation_db_entry const * const entry = lookup (opname); if (entry == 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("TAO_Binary_Search_Table:find failed\n")), -1); // Valid entry. Figure out the skel_ptr. - skelfunc = entry->skel_ptr_; + skelfunc = entry->skel_ptr; return 0; } @@ -440,7 +429,7 @@ TAO_Binary_Search_OpTable::find (const char *opname, { ACE_FUNCTION_TIMEPROBE (TAO_BINARY_SEARCH_OPTABLE_FIND_START); - const TAO_operation_db_entry *entry = lookup (opname); + TAO_operation_db_entry const * const entry = lookup (opname); if (entry == 0) ACE_ERROR_RETURN ((LM_ERROR, @@ -449,11 +438,8 @@ TAO_Binary_Search_OpTable::find (const char *opname, switch (st) { - case TAO::TAO_CS_THRU_POA_STRATEGY: - skelfunc = entry->thruPOA_skel_ptr_; - break; case TAO::TAO_CS_DIRECT_STRATEGY: - skelfunc = entry->direct_skel_ptr_; + skelfunc = entry->direct_skel_ptr; break; default: return -1; @@ -518,7 +504,7 @@ TAO_Operation_Table_Factory::~TAO_Operation_Table_Factory (void) TAO_Operation_Table * TAO_Operation_Table_Factory::opname_lookup_strategy (void) { - TAO_Operation_Table_Parameters *p = + TAO_Operation_Table_Parameters * const p = TAO_OP_TABLE_PARAMETERS::instance (); return p->concrete_strategy (); @@ -526,9 +512,9 @@ TAO_Operation_Table_Factory::opname_lookup_strategy (void) /**************************************************************/ TAO::Operation_Skeletons::Operation_Skeletons (void) - : skel_ptr_ (0) - , thruPOA_skel_ptr_ (0) - , direct_skel_ptr_ (0) + : skel_ptr (0) + , thruPOA_skel_ptr (0) + , direct_skel_ptr (0) { } diff --git a/TAO/tao/PortableServer/Operation_Table.h b/TAO/tao/PortableServer/Operation_Table.h index 34022c768dd..e98f1e3d4c4 100644 --- a/TAO/tao/PortableServer/Operation_Table.h +++ b/TAO/tao/PortableServer/Operation_Table.h @@ -61,18 +61,16 @@ typedef void (*TAO_Collocated_Skeleton)( * corresponding skeleton. A table of such entries is used to * initialize the different lookup strategies. */ -class TAO_operation_db_entry +struct TAO_operation_db_entry { -public: /// Operation name - const char* opname_; + char const * const opname; - /// Remote skeleton pointer - TAO_Skeleton skel_ptr_; + /// Remote/thru-POA skeleton pointer + TAO_Skeleton skel_ptr; /// Collocated skeleton pointers. - TAO_Collocated_Skeleton thruPOA_skel_ptr_; - TAO_Collocated_Skeleton direct_skel_ptr_; + TAO_Collocated_Skeleton direct_skel_ptr; }; @@ -92,11 +90,11 @@ namespace TAO Operation_Skeletons (void); /// Remote skeleton pointer - TAO_Skeleton skel_ptr_; + TAO_Skeleton skel_ptr; /// Collocated skeleton pointers. - TAO_Collocated_Skeleton thruPOA_skel_ptr_; - TAO_Collocated_Skeleton direct_skel_ptr_; + TAO_Skeleton thruPOA_skel_ptr; + TAO_Collocated_Skeleton direct_skel_ptr; }; } diff --git a/TAO/tao/PortableServer/PolicyS.cpp b/TAO/tao/PortableServer/PolicyS.cpp index b4f434bd14d..326e7df4f8f 100644 --- a/TAO/tao/PortableServer/PolicyS.cpp +++ b/TAO/tao/PortableServer/PolicyS.cpp @@ -27,16 +27,25 @@ // TAO_IDL - Generated from -// be\be_codegen.cpp:609 +// be/be_codegen.cpp:609 #ifndef _TAO_IDL_ORIG_POLICYS_CPP_ #define _TAO_IDL_ORIG_POLICYS_CPP_ #include "PolicyS.h" -#include "tao/PortableServer/Servant_Upcall.h" #include "tao/PortableServer/ForwardRequestC.h" #include "tao/PortableServer/Operation_Table.h" +#include "tao/PortableServer/Upcall_Command.h" +#include "tao/PortableServer/Upcall_Wrapper.h" +#include "tao/PortableServer/Basic_SArguments.h" +#include "tao/PortableServer/Object_SArgument_T.h" +#include "tao/PortableServer/Special_Basic_SArguments.h" +#include "tao/PortableServer/UB_String_SArguments.h" +#include "tao/PortableServer/TypeCode_SArg_Traits.h" +#include "tao/PortableServer/Object_SArg_Traits.h" +#include "tao/Special_Basic_Arguments.h" +#include "tao/UB_String_Arguments.h" #include "tao/TAO_Server_Request.h" #include "tao/ORB_Core.h" #include "tao/Profile.h" @@ -46,16 +55,10 @@ #include "tao/Typecode.h" #include "tao/DynamicC.h" #include "tao/CDR.h" +#include "tao/operation_details.h" +#include "tao/PortableInterceptor.h" #include "tao/Basic_Arguments.h" #include "tao/Object_Argument_T.h" -#include "tao/PortableInterceptor.h" -#if TAO_HAS_INTERCEPTORS == 1 -#include "tao/PortableServer/PICurrent_Guard.h" -#include "tao/PortableServer/ServerRequestInfo.h" -#include "tao/PortableServer/ServerInterceptorAdapter.h" -#include "tao/RequestInfo_Util.h" -#endif /* TAO_HAS_INTERCEPTORS == 1 */ - #include "ace/Dynamic_Service.h" #include "ace/Malloc_Allocator.h" @@ -68,7 +71,32 @@ #endif /* !defined INLINE */ // TAO_IDL - Generated from -// be\be_visitor_arg_traits.cpp:66 +// be/be_visitor_arg_traits.cpp:69 + +// Arg traits specializations. +namespace TAO +{ + +#if !defined (_CORBA_POLICY__SARG_TRAITS_SS_) +#define _CORBA_POLICY__SARG_TRAITS_SS_ + + template<> + class TAO_PortableServer_Export SArg_Traits<CORBA::Policy> + : public + Object_SArg_Traits_T< + CORBA::Policy_ptr, + CORBA::Policy_var, + CORBA::Policy_out + > + { + }; + +#endif /* end #if !defined */ +} + + +// TAO_IDL - Generated from +// be/be_visitor_arg_traits.cpp:69 // Arg traits specializations. namespace TAO @@ -77,7 +105,7 @@ namespace TAO #if !defined (_CORBA_POLICY__ARG_TRAITS_SS_) #define _CORBA_POLICY__ARG_TRAITS_SS_ - ACE_TEMPLATE_SPECIALIZATION + template<> class TAO_PortableServer_Export Arg_Traits<CORBA::Policy> : public Object_Arg_Traits_T< @@ -93,8 +121,70 @@ namespace TAO } +// Stub/skeleton argument selection function templates. +// TAO_IDL - Generated from be/be_visitor_root/root.cpp:110 + +namespace +{ + template<typename T> + typename TAO::SArg_Traits<T>::ret_arg_type + get_ret_arg (TAO_Operation_Details const * details, + TAO::Argument * const * skel_args) + { + return + details + ? static_cast<typename TAO::Arg_Traits<T>::ret_val *> ( + details->args ()[0])->arg () + : static_cast<typename TAO::SArg_Traits<T>::ret_val *> ( + skel_args[0])->arg (); + } + + template<typename T> + typename TAO::SArg_Traits<T>::in_arg_type + get_in_arg (TAO_Operation_Details const * details, + TAO::Argument * const * skel_args, + size_t i) + { + return + details + ? static_cast<typename TAO::Arg_Traits<T>::in_arg_val *> ( + details->args ()[i])->arg () + : static_cast<typename TAO::SArg_Traits<T>::in_arg_val *> ( + skel_args[i])->arg (); + } + + template<typename T> + typename TAO::SArg_Traits<T>::inout_arg_type + get_inout_arg (TAO_Operation_Details const * details, + TAO::Argument * const * skel_args, + size_t i) + { + return + details + ? static_cast<typename TAO::Arg_Traits<T>::inout_arg_val *> ( + details->args ()[i])->arg () + : static_cast<typename TAO::SArg_Traits<T>::inout_arg_val *> ( + skel_args[i])->arg (); + } + + template<typename T> + typename TAO::SArg_Traits<T>::out_arg_type + get_out_arg (TAO_Operation_Details const * details, + TAO::Argument * const * skel_args, + size_t i) + { + return + details + ? static_cast<typename TAO::Arg_Traits<T>::out_arg_val *> ( + details->args ()[i])->arg () + : static_cast<typename TAO::SArg_Traits<T>::out_arg_val *> ( + skel_args[i])->arg (); + } +} + + // TAO_IDL - Generated from -// be\be_interface.cpp:1536 +// be/be_interface.cpp:1535 class TAO_CORBA_Policy_Perfect_Hash_OpTable : public TAO_Perfect_Hash_OpTable @@ -107,7 +197,7 @@ public: }; /* C++ code produced by gperf version 2.8 (ACE version) */ -/* Command-line: c:\ace\POArefactor3\ace_wrappers\bin\gperf.exe -m -M -J -c -C -D -E -T -f 0 -F 0,0,0 -a -o -t -p -K opname_ -L C++ -Z TAO_CORBA_Policy_Perfect_Hash_OpTable -N lookup */ +/* Command-line: /home/ossama/work/skeleton-refactor-merge/ACE_wrappers/bin/gperf -m -M -J -c -C -D -E -T -f 0 -F 0,0 -a -o -t -p -K opname -L C++ -Z TAO_CORBA_Policy_Perfect_Hash_OpTable -N lookup */ unsigned int TAO_CORBA_Policy_Perfect_Hash_OpTable::hash (const char *str, unsigned int len) { @@ -159,7 +249,7 @@ TAO_CORBA_Policy_Perfect_Hash_OpTable::hash (const char *str, unsigned int len) return len + asso_values[(int) str[len - 1]] + asso_values[(int) str[0]]; } -const class TAO_operation_db_entry * +const struct TAO_operation_db_entry * TAO_CORBA_Policy_Perfect_Hash_OpTable::lookup (const char *str, unsigned int len) { enum @@ -174,21 +264,21 @@ TAO_CORBA_Policy_Perfect_Hash_OpTable::lookup (const char *str, unsigned int len WORDLIST_SIZE = 11 }; - static const class TAO_operation_db_entry wordlist[] = + static const struct TAO_operation_db_entry wordlist[] = { - {"",0,0,0},{"",0,0,0},{"",0,0,0},{"",0,0,0}, - {"copy", &POA_CORBA::Policy::copy_skel, &POA_CORBA::_TAO_Policy_ThruPOA_Proxy_Impl::copy, &POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::copy}, - {"_is_a", &POA_CORBA::Policy::_is_a_skel, 0, 0}, - {"",0,0,0}, - {"destroy", &POA_CORBA::Policy::destroy_skel, &POA_CORBA::_TAO_Policy_ThruPOA_Proxy_Impl::destroy, &POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::destroy}, - {"",0,0,0},{"",0,0,0}, - {"_component", &POA_CORBA::Policy::_component_skel, 0, 0}, - {"",0,0,0},{"",0,0,0}, - {"_non_existent", &POA_CORBA::Policy::_non_existent_skel, 0, 0}, - {"",0,0,0}, - {"_interface", &POA_CORBA::Policy::_interface_skel, 0, 0}, - {"",0,0,0},{"",0,0,0},{"",0,0,0},{"",0,0,0},{"",0,0,0}, - {"_get_policy_type", &POA_CORBA::Policy::_get_policy_type_skel, &POA_CORBA::_TAO_Policy_ThruPOA_Proxy_Impl::_get_policy_type, &POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::_get_policy_type}, + {"",0,0},{"",0,0},{"",0,0},{"",0,0}, + {"copy", &POA_CORBA::Policy::copy_skel, &POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::copy}, + {"_is_a", &POA_CORBA::Policy::_is_a_skel, 0}, + {"",0,0}, + {"destroy", &POA_CORBA::Policy::destroy_skel, &POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::destroy}, + {"",0,0},{"",0,0}, + {"_component", &POA_CORBA::Policy::_component_skel, 0}, + {"",0,0},{"",0,0}, + {"_non_existent", &POA_CORBA::Policy::_non_existent_skel, 0}, + {"",0,0}, + {"_interface", &POA_CORBA::Policy::_interface_skel, 0}, + {"",0,0},{"",0,0},{"",0,0},{"",0,0},{"",0,0}, + {"_get_policy_type", &POA_CORBA::Policy::_get_policy_type_skel, &POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::_get_policy_type}, }; if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) @@ -197,7 +287,7 @@ TAO_CORBA_Policy_Perfect_Hash_OpTable::lookup (const char *str, unsigned int len if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE) { - const char *s = wordlist[key].opname_; + const char *s = wordlist[key].opname; if (*str == *s && !strncmp (str + 1, s + 1, len - 1)) return &wordlist[key]; @@ -207,435 +297,12 @@ TAO_CORBA_Policy_Perfect_Hash_OpTable::lookup (const char *str, unsigned int len } static TAO_CORBA_Policy_Perfect_Hash_OpTable tao_CORBA_Policy_optable; - -// TAO_IDL - Generated from -// be\be_visitor_interface/interceptors_ss.cpp:53 - -#if (TAO_HAS_INTERCEPTORS == 1) - -// TAO_IDL - Generated from -// be\be_visitor_operation/interceptors_ss.cpp:74 - -class TAO_ServerRequestInfo_CORBA_Policy_policy_type_get : public TAO_ServerRequestInfo -{ -public: - TAO_ServerRequestInfo_CORBA_Policy_policy_type_get ( - TAO_ServerRequest &_tao_server_request, - TAO::Portable_Server::Servant_Upcall *tao_servant_upcall, - POA_CORBA::Policy *tao_impl - ACE_ENV_ARG_DECL_WITH_DEFAULTS - ); - - virtual Dynamic::ParameterList * arguments ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS - ) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual Dynamic::ExceptionList * exceptions ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS - ) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual CORBA::Any * result ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS - ) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual char * target_most_derived_interface ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS - ) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual CORBA::Boolean target_is_a ( - const char * id - ACE_ENV_ARG_DECL_WITH_DEFAULTS - ) - ACE_THROW_SPEC ((CORBA::SystemException)); - - void result (CORBA::PolicyType result); - -private: - TAO_ServerRequestInfo_CORBA_Policy_policy_type_get ( - const TAO_ServerRequestInfo_CORBA_Policy_policy_type_get & - ); - - void operator= ( - const TAO_ServerRequestInfo_CORBA_Policy_policy_type_get & - ); - -private: - POA_CORBA::Policy *_tao_impl; - - CORBA::PolicyType _result; -}; - -// TAO_IDL - Generated from -// be\be_visitor_operation/interceptors_ss.cpp:438 - -TAO_ServerRequestInfo_CORBA_Policy_policy_type_get::TAO_ServerRequestInfo_CORBA_Policy_policy_type_get ( - TAO_ServerRequest &_tao_server_request, - TAO::Portable_Server::Servant_Upcall *_tao_servant_upcall, - POA_CORBA::Policy *tao_impl - ACE_ENV_ARG_DECL_NOT_USED - ) - : TAO_ServerRequestInfo (_tao_server_request, _tao_servant_upcall), - _tao_impl (tao_impl) -{} - -Dynamic::ParameterList * -TAO_ServerRequestInfo_CORBA_Policy_policy_type_get::arguments ( - ACE_ENV_SINGLE_ARG_DECL - ) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - // Generate the argument list on demand. - Dynamic::ParameterList *parameter_list = - TAO_RequestInfo_Util::make_parameter_list (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - return parameter_list; -} - -Dynamic::ExceptionList * -TAO_ServerRequestInfo_CORBA_Policy_policy_type_get::exceptions ( - ACE_ENV_SINGLE_ARG_DECL - ) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - // Generate the exception list on demand. - Dynamic::ExceptionList *exception_list = - TAO_RequestInfo_Util::make_exception_list (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - return exception_list; -} - -CORBA::Any * -TAO_ServerRequestInfo_CORBA_Policy_policy_type_get::result ( - ACE_ENV_SINGLE_ARG_DECL - ) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - // Generate the result on demand. - CORBA::Boolean tk_void_any = 0; - CORBA::Any *result_any = - TAO_RequestInfo_Util::make_any (tk_void_any ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - CORBA::Any_var safe_result_any = result_any; - - (*result_any) <<= this->_result; - - return safe_result_any._retn (); -} - -char * -TAO_ServerRequestInfo_CORBA_Policy_policy_type_get::target_most_derived_interface ( - ACE_ENV_SINGLE_ARG_DECL_NOT_USED - ) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return - CORBA::string_dup (this->_tao_impl->_interface_repository_id ()); -} - -CORBA::Boolean -TAO_ServerRequestInfo_CORBA_Policy_policy_type_get::target_is_a ( - const char * id - ACE_ENV_ARG_DECL - ) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->_tao_impl->_is_a (id ACE_ENV_ARG_PARAMETER); -} - -void -TAO_ServerRequestInfo_CORBA_Policy_policy_type_get::result (CORBA::PolicyType result) -{ - // Update the result. - this->_result = result; -} - -// TAO_IDL - Generated from -// be\be_visitor_operation/interceptors_ss.cpp:74 - -class TAO_ServerRequestInfo_CORBA_Policy_copy : public TAO_ServerRequestInfo -{ -public: - TAO_ServerRequestInfo_CORBA_Policy_copy ( - TAO_ServerRequest &_tao_server_request, - TAO::Portable_Server::Servant_Upcall *tao_servant_upcall, - POA_CORBA::Policy *tao_impl - ACE_ENV_ARG_DECL_WITH_DEFAULTS - ); - - virtual Dynamic::ParameterList * arguments ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS - ) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual Dynamic::ExceptionList * exceptions ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS - ) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual CORBA::Any * result ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS - ) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual char * target_most_derived_interface ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS - ) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual CORBA::Boolean target_is_a ( - const char * id - ACE_ENV_ARG_DECL_WITH_DEFAULTS - ) - ACE_THROW_SPEC ((CORBA::SystemException)); - - void result (::CORBA::Policy_ptr result); - -private: - TAO_ServerRequestInfo_CORBA_Policy_copy ( - const TAO_ServerRequestInfo_CORBA_Policy_copy & - ); - - void operator= ( - const TAO_ServerRequestInfo_CORBA_Policy_copy & - ); - -private: - POA_CORBA::Policy *_tao_impl; - - ::CORBA::Policy_ptr _result; -}; - -// TAO_IDL - Generated from -// be\be_visitor_operation/interceptors_ss.cpp:438 - -TAO_ServerRequestInfo_CORBA_Policy_copy::TAO_ServerRequestInfo_CORBA_Policy_copy ( - TAO_ServerRequest &_tao_server_request, - TAO::Portable_Server::Servant_Upcall *_tao_servant_upcall, - POA_CORBA::Policy *tao_impl - ACE_ENV_ARG_DECL_NOT_USED - ) - : TAO_ServerRequestInfo (_tao_server_request, _tao_servant_upcall), - _tao_impl (tao_impl) -{} - -Dynamic::ParameterList * -TAO_ServerRequestInfo_CORBA_Policy_copy::arguments ( - ACE_ENV_SINGLE_ARG_DECL - ) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - // Generate the argument list on demand. - Dynamic::ParameterList *parameter_list = - TAO_RequestInfo_Util::make_parameter_list (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - return parameter_list; -} - -Dynamic::ExceptionList * -TAO_ServerRequestInfo_CORBA_Policy_copy::exceptions ( - ACE_ENV_SINGLE_ARG_DECL - ) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - // Generate the exception list on demand. - Dynamic::ExceptionList *exception_list = - TAO_RequestInfo_Util::make_exception_list (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - return exception_list; -} - -CORBA::Any * -TAO_ServerRequestInfo_CORBA_Policy_copy::result ( - ACE_ENV_SINGLE_ARG_DECL - ) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - // Generate the result on demand. - CORBA::Boolean tk_void_any = 0; - CORBA::Any *result_any = - TAO_RequestInfo_Util::make_any (tk_void_any ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - CORBA::Any_var safe_result_any = result_any; - - (*result_any) <<= this->_result; - - return safe_result_any._retn (); -} - -char * -TAO_ServerRequestInfo_CORBA_Policy_copy::target_most_derived_interface ( - ACE_ENV_SINGLE_ARG_DECL_NOT_USED - ) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return - CORBA::string_dup (this->_tao_impl->_interface_repository_id ()); -} - -CORBA::Boolean -TAO_ServerRequestInfo_CORBA_Policy_copy::target_is_a ( - const char * id - ACE_ENV_ARG_DECL - ) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->_tao_impl->_is_a (id ACE_ENV_ARG_PARAMETER); -} - -void -TAO_ServerRequestInfo_CORBA_Policy_copy::result (::CORBA::Policy_ptr result) -{ - // Update the result. - this->_result = result; -} - -// TAO_IDL - Generated from -// be\be_visitor_operation/interceptors_ss.cpp:74 - -class TAO_ServerRequestInfo_CORBA_Policy_destroy : public TAO_ServerRequestInfo -{ -public: - TAO_ServerRequestInfo_CORBA_Policy_destroy ( - TAO_ServerRequest &_tao_server_request, - TAO::Portable_Server::Servant_Upcall *tao_servant_upcall, - POA_CORBA::Policy *tao_impl - ACE_ENV_ARG_DECL_WITH_DEFAULTS - ); - - virtual Dynamic::ParameterList * arguments ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS - ) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual Dynamic::ExceptionList * exceptions ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS - ) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual CORBA::Any * result ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS - ) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual char * target_most_derived_interface ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS - ) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual CORBA::Boolean target_is_a ( - const char * id - ACE_ENV_ARG_DECL_WITH_DEFAULTS - ) - ACE_THROW_SPEC ((CORBA::SystemException)); - -private: - TAO_ServerRequestInfo_CORBA_Policy_destroy ( - const TAO_ServerRequestInfo_CORBA_Policy_destroy & - ); - - void operator= ( - const TAO_ServerRequestInfo_CORBA_Policy_destroy & - ); - -private: - POA_CORBA::Policy *_tao_impl; - -}; - -// TAO_IDL - Generated from -// be\be_visitor_operation/interceptors_ss.cpp:438 - -TAO_ServerRequestInfo_CORBA_Policy_destroy::TAO_ServerRequestInfo_CORBA_Policy_destroy ( - TAO_ServerRequest &_tao_server_request, - TAO::Portable_Server::Servant_Upcall *_tao_servant_upcall, - POA_CORBA::Policy *tao_impl - ACE_ENV_ARG_DECL_NOT_USED - ) - : TAO_ServerRequestInfo (_tao_server_request, _tao_servant_upcall), - _tao_impl (tao_impl) -{} - -Dynamic::ParameterList * -TAO_ServerRequestInfo_CORBA_Policy_destroy::arguments ( - ACE_ENV_SINGLE_ARG_DECL - ) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - // Generate the argument list on demand. - Dynamic::ParameterList *parameter_list = - TAO_RequestInfo_Util::make_parameter_list (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - return parameter_list; -} - -Dynamic::ExceptionList * -TAO_ServerRequestInfo_CORBA_Policy_destroy::exceptions ( - ACE_ENV_SINGLE_ARG_DECL - ) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - // Generate the exception list on demand. - Dynamic::ExceptionList *exception_list = - TAO_RequestInfo_Util::make_exception_list (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - return exception_list; -} - -CORBA::Any * -TAO_ServerRequestInfo_CORBA_Policy_destroy::result ( - ACE_ENV_SINGLE_ARG_DECL - ) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - // Generate the result on demand. - CORBA::Boolean tk_void_any = 1; - CORBA::Any *result_any = - TAO_RequestInfo_Util::make_any (tk_void_any ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - - return result_any; -} - -char * -TAO_ServerRequestInfo_CORBA_Policy_destroy::target_most_derived_interface ( - ACE_ENV_SINGLE_ARG_DECL_NOT_USED - ) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return - CORBA::string_dup (this->_tao_impl->_interface_repository_id ()); -} - -CORBA::Boolean -TAO_ServerRequestInfo_CORBA_Policy_destroy::target_is_a ( - const char * id - ACE_ENV_ARG_DECL - ) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->_tao_impl->_is_a (id ACE_ENV_ARG_PARAMETER); -} - -#endif /* TAO_HAS_INTERCEPTORS */ - /////////////////////////////////////////////////////////////////////// // Strategized Proxy Broker Implementation // // TAO_IDL - Generated from -// be\be_visitor_interface/strategized_proxy_broker_ss.cpp:40 +// be/be_visitor_interface/strategized_proxy_broker_ss.cpp:40 // Factory function Implementation. POA_CORBA::_TAO_Policy_Strategized_Proxy_Broker * @@ -682,43 +349,17 @@ POA_CORBA::_TAO_Policy_Strategized_Proxy_Broker::dispatch ( ) ACE_THROW_SPEC ((CORBA::Exception)) { - TAO::Portable_Server::Servant_Upcall servant_upcall ( - obj->_stubobj ()->servant_orb_var ()->orb_core () - ); + TAO_Abstract_ServantBase * const servant = obj->_servant (); TAO_Collocated_Skeleton collocated_skel; - TAO_Abstract_ServantBase *servant = 0; - - if (strategy == TAO::TAO_CS_THRU_POA_STRATEGY) - { - servant_upcall.prepare_for_upcall ( - obj->_stubobj ()->object_key (), - op, - forward_obj - ACE_ENV_ARG_PARAMETER - ); - ACE_CHECK; - - servant_upcall.pre_invoke_collocated_request ( - ACE_ENV_SINGLE_ARG_PARAMETER - ); - ACE_CHECK; - - servant = servant_upcall.servant (); - } - else - { - servant = obj->_servant (); - } - - int status = servant->_find (op, - collocated_skel, - strategy, - op_len); + int const status = servant->_find (op, + collocated_skel, + strategy, + op_len); if (status == -1) { - ACE_THROW (CORBA::BAD_OPERATION (TAO::VMCID | 2, CORBA::COMPLETED_NO)); + ACE_THROW (CORBA::BAD_OPERATION (CORBA::OMGVMCID | 2, CORBA::COMPLETED_NO)); } ACE_TRY @@ -752,7 +393,7 @@ POA_CORBA::_TAO_Policy_Strategized_Proxy_Broker::dispatch ( /////////////////////////////////////////////////////////////////////// // TAO_IDL - Generated from -// be\be_visitor_interface/interface_ss.cpp:640 +// be/be_visitor_interface/interface_ss.cpp:833 TAO::Collocation_Proxy_Broker * CORBA__TAO_Policy_Proxy_Broker_Factory_function (CORBA::Object_ptr) @@ -780,98 +421,6 @@ CORBA__TAO_Policy_Proxy_Broker_Stub_Factory_Initializer_Scarecrow = ); -/////////////////////////////////////////////////////////////////////// -// ThruPOA Proxy Implementation -// - -// TAO_IDL - Generated from -// be\be_visitor_interface/thru_poa_proxy_impl_ss.cpp:37 - -POA_CORBA::_TAO_Policy_ThruPOA_Proxy_Impl::_TAO_Policy_ThruPOA_Proxy_Impl (void) -{} - -// ThruPOA Implementation of the IDL interface methods - -// TAO_IDL - Generated from -// be\be_visitor_operation/thru_poa_proxy_impl_ss.cpp:52 - -void -POA_CORBA::_TAO_Policy_ThruPOA_Proxy_Impl::_get_policy_type ( - TAO_Abstract_ServantBase *servant, - TAO::Argument ** args, - int - ACE_ENV_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )) -{ - ((TAO::Arg_Traits< ::CORBA::PolicyType>::ret_val *) args[0])->arg () = - reinterpret_cast< - POA_CORBA::Policy_ptr> ( - servant->_downcast ( - "IDL:omg.org/CORBA/Policy:1.0" - ) - )->policy_type ( - ACE_ENV_SINGLE_ARG_PARAMETER - ); - ACE_CHECK; -} - -// TAO_IDL - Generated from -// be\be_visitor_operation/thru_poa_proxy_impl_ss.cpp:52 - -void -POA_CORBA::_TAO_Policy_ThruPOA_Proxy_Impl::copy ( - TAO_Abstract_ServantBase *servant, - TAO::Argument ** args, - int - ACE_ENV_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )) -{ - ((TAO::Arg_Traits< CORBA::Policy>::ret_val *) args[0])->arg () = - reinterpret_cast< - POA_CORBA::Policy_ptr> ( - servant->_downcast ( - "IDL:omg.org/CORBA/Policy:1.0" - ) - )->copy ( - ACE_ENV_SINGLE_ARG_PARAMETER - ); - ACE_CHECK; -} - -// TAO_IDL - Generated from -// be\be_visitor_operation/thru_poa_proxy_impl_ss.cpp:52 - -void -POA_CORBA::_TAO_Policy_ThruPOA_Proxy_Impl::destroy ( - TAO_Abstract_ServantBase *servant, - TAO::Argument **, - int - ACE_ENV_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )) -{ - reinterpret_cast< - POA_CORBA::Policy_ptr> ( - servant->_downcast ( - "IDL:omg.org/CORBA/Policy:1.0" - ) - )->destroy ( - ACE_ENV_SINGLE_ARG_PARAMETER - ); - ACE_CHECK; -} - -// -// End ThruPOA Proxy Implementation -/////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// // Direct Proxy Implementation @@ -881,7 +430,7 @@ POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::_TAO_Policy_Direct_Proxy_Impl (void) {} // TAO_IDL - Generated from -// be\be_visitor_operation/direct_proxy_impl_ss.cpp:42 +// be/be_visitor_operation/direct_proxy_impl_ss.cpp:42 void POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::_get_policy_type ( @@ -895,17 +444,16 @@ POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::_get_policy_type ( )) { ((TAO::Arg_Traits< ::CORBA::PolicyType>::ret_val *) args[0])->arg () = - reinterpret_cast< + dynamic_cast< POA_CORBA::Policy_ptr> ( - servant->_downcast ( - "IDL:omg.org/CORBA/Policy:1.0" - ) - )->policy_type ( + servant) + ->policy_type ( ACE_ENV_SINGLE_ARG_PARAMETER ); ACE_CHECK; -}// TAO_IDL - Generated from -// be\be_visitor_operation/direct_proxy_impl_ss.cpp:42 +} +// TAO_IDL - Generated from +// be/be_visitor_operation/direct_proxy_impl_ss.cpp:42 void POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::copy ( @@ -919,17 +467,16 @@ POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::copy ( )) { ((TAO::Arg_Traits< CORBA::Policy>::ret_val *) args[0])->arg () = - reinterpret_cast< + dynamic_cast< POA_CORBA::Policy_ptr> ( - servant->_downcast ( - "IDL:omg.org/CORBA/Policy:1.0" - ) - )->copy ( + servant) + ->copy ( ACE_ENV_SINGLE_ARG_PARAMETER ); ACE_CHECK; -}// TAO_IDL - Generated from -// be\be_visitor_operation/direct_proxy_impl_ss.cpp:42 +} +// TAO_IDL - Generated from +// be/be_visitor_operation/direct_proxy_impl_ss.cpp:42 void POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::destroy ( @@ -942,25 +489,25 @@ POA_CORBA::_TAO_Policy_Direct_Proxy_Impl::destroy ( CORBA::SystemException )) { - reinterpret_cast< + dynamic_cast< POA_CORBA::Policy_ptr> ( - servant->_downcast ( - "IDL:omg.org/CORBA/Policy:1.0" - ) - )->destroy ( + servant) + ->destroy ( ACE_ENV_SINGLE_ARG_PARAMETER ); ACE_CHECK; } + // // End Direct Proxy Implementation /////////////////////////////////////////////////////////////////////// // TAO_IDL - Generated from -// be\be_visitor_interface/interface_ss.cpp:97 +// be/be_visitor_interface/interface_ss.cpp:103 POA_CORBA::Policy::Policy (void) + : TAO_ServantBase () { this->optable_ = &tao_CORBA_Policy_optable; } @@ -976,452 +523,497 @@ POA_CORBA::Policy::~Policy (void) } // TAO_IDL - Generated from -// be\be_visitor_operation/operation_ss.cpp:98 +// be/be_visitor_operation/operation_ss.cpp:165 void POA_CORBA::Policy::_get_policy_type_skel ( - TAO_ServerRequest &_tao_server_request, - void *_tao_servant, - void *_tao_servant_upcall + TAO_ServerRequest & server_request, + void * servant_upcall, + void * servant ACE_ENV_ARG_DECL ) { - POA_CORBA::Policy *_tao_impl = - static_cast< - POA_CORBA::Policy *> ( - _tao_servant - ); - CORBA::PolicyType _tao_retval = 0; -#if (TAO_HAS_INTERCEPTORS == 1) - TAO::Portable_Server::Servant_Upcall *_tao_upcall = - static_cast< - TAO::Portable_Server::Servant_Upcall *> ( - _tao_servant_upcall - ); - - TAO_ServerRequestInterceptor_Adapter _tao_vfr ( - _tao_server_request.orb_core ()->server_request_interceptors (), - _tao_server_request.interceptor_count () - ); - TAO_ServerRequestInfo_CORBA_Policy_policy_type_get _tao_ri ( - _tao_server_request, - _tao_upcall, - _tao_impl - ACE_ENV_ARG_PARAMETER - ); + // TAO_IDL - Generated from + // be/be_visitor_operation/upcall_command_ss.cpp:74 - ACE_TRY + class Upcall_Command + : public TAO::Upcall_Command + { + public: + + inline Upcall_Command ( + POA_CORBA::Policy * servant, + TAO_Operation_Details const * operation_details, + TAO::Argument * const args[]) + : servant_ (servant) + , operation_details_ (operation_details) + , args_ (args) { - { - TAO::PICurrent_Guard _tao_pi_guard (_tao_ri.server_request (), - true /* Copy TSC to RSC */); - - _tao_vfr.receive_request (&_tao_ri ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (!_tao_vfr.location_forwarded ()) - { -#endif /* TAO_HAS_INTERCEPTORS */ - _tao_retval = - _tao_impl->policy_type ( - ACE_ENV_SINGLE_ARG_PARAMETER - ); - TAO_INTERCEPTOR_CHECK; -#if (TAO_HAS_INTERCEPTORS == 1) - } - } - - if (!_tao_vfr.location_forwarded ()) - { - CORBA::PolicyType _tao_retval_info = _tao_retval; - _tao_ri.result (_tao_retval_info); - _tao_ri.reply_status (PortableInterceptor::SUCCESSFUL); - _tao_vfr.send_reply (&_tao_ri ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } } - ACE_CATCHANY + + virtual void execute (ACE_ENV_SINGLE_ARG_DECL) { - _tao_ri.exception (&ACE_ANY_EXCEPTION); - _tao_vfr.send_exception ( - &_tao_ri - ACE_ENV_ARG_PARAMETER - ); - ACE_TRY_CHECK; + TAO::SArg_Traits< ::CORBA::PolicyType>::ret_arg_type retval = + get_ret_arg< ::CORBA::PolicyType> ( + this->operation_details_, + this->args_); - PortableInterceptor::ReplyStatus _tao_status = - _tao_ri.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - if (_tao_status == PortableInterceptor::SYSTEM_EXCEPTION - || _tao_status == PortableInterceptor::USER_EXCEPTION) - { - ACE_RE_THROW; - } + retval = + this->servant_->policy_type ( + ACE_ENV_SINGLE_ARG_PARAMETER); + + ACE_CHECK; } -# if defined (ACE_HAS_EXCEPTIONS) \ - && defined (ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS) - ACE_CATCHALL - { - CORBA::UNKNOWN ex; - - _tao_ri.exception (&ex); - _tao_vfr.send_exception ( - &_tao_ri - ACE_ENV_ARG_PARAMETER - ); - ACE_TRY_CHECK; - - PortableInterceptor::ReplyStatus _tao_status = - _tao_ri.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (_tao_status == PortableInterceptor::SYSTEM_EXCEPTION) - ACE_TRY_THROW (ex); - } -# endif /* ACE_HAS_EXCEPTIONS && ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS */ - ACE_ENDTRY; - ACE_CHECK; + private: + + Upcall_Command (Upcall_Command const &); + void operator= (Upcall_Command const &); + + private: + + POA_CORBA::Policy * const servant_; + TAO_Operation_Details const * const operation_details_; + TAO::Argument * const * const args_; + }; + + +#if TAO_HAS_INTERCEPTORS == 1 + static CORBA::TypeCode_ptr const exceptions[] = {}; + static size_t const nexceptions = 0; #endif /* TAO_HAS_INTERCEPTORS */ - _tao_server_request.init_reply (); -#if (TAO_HAS_INTERCEPTORS == 1) - if (!_tao_vfr.location_forwarded ()) + TAO::SArg_Traits< ::CORBA::PolicyType>::ret_val retval; + + TAO::Argument * const args[] = { -#endif /* TAO_HAS_INTERCEPTORS */ - TAO_OutputCDR &_tao_out = _tao_server_request.outgoing (); - - if (!( - (_tao_out << _tao_retval) - )) - { - TAO_OutputCDR::throw_skel_exception (errno ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } -#if (TAO_HAS_INTERCEPTORS == 1) - } -#endif /* TAO_HAS_INTERCEPTORS */ + &retval + }; + static size_t const nargs = 1; + + POA_CORBA::Policy * const impl = + static_cast< + POA_CORBA::Policy *> (servant); + + Upcall_Command command ( + impl, + server_request.operation_details (), + args); + + TAO::Upcall_Wrapper upcall_wrapper; + upcall_wrapper.upcall (server_request + , args + , nargs + , command + +#if TAO_HAS_INTERCEPTORS == 1 + , servant_upcall + , exceptions + , nexceptions +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; - // In case _tao_servant_upcall is not used in this function - ACE_UNUSED_ARG (_tao_servant_upcall); } // TAO_IDL - Generated from -// be\be_visitor_operation/operation_ss.cpp:98 +// be/be_visitor_operation/operation_ss.cpp:165 void POA_CORBA::Policy::copy_skel ( - TAO_ServerRequest &_tao_server_request, - void *_tao_servant, - void *_tao_servant_upcall + TAO_ServerRequest & server_request, + void * servant_upcall, + void * servant ACE_ENV_ARG_DECL ) { - POA_CORBA::Policy *_tao_impl = - static_cast< - POA_CORBA::Policy *> ( - _tao_servant - ); - ::CORBA::Policy_var _tao_retval; -#if (TAO_HAS_INTERCEPTORS == 1) - TAO::Portable_Server::Servant_Upcall *_tao_upcall = - static_cast< - TAO::Portable_Server::Servant_Upcall *> ( - _tao_servant_upcall - ); - - TAO_ServerRequestInterceptor_Adapter _tao_vfr ( - _tao_server_request.orb_core ()->server_request_interceptors (), - _tao_server_request.interceptor_count () - ); - TAO_ServerRequestInfo_CORBA_Policy_copy _tao_ri ( - _tao_server_request, - _tao_upcall, - _tao_impl - ACE_ENV_ARG_PARAMETER - ); + // TAO_IDL - Generated from + // be/be_visitor_operation/upcall_command_ss.cpp:74 - ACE_TRY + class Upcall_Command + : public TAO::Upcall_Command + { + public: + + inline Upcall_Command ( + POA_CORBA::Policy * servant, + TAO_Operation_Details const * operation_details, + TAO::Argument * const args[]) + : servant_ (servant) + , operation_details_ (operation_details) + , args_ (args) { - { - TAO::PICurrent_Guard _tao_pi_guard (_tao_ri.server_request (), - true /* Copy TSC to RSC */); - - _tao_vfr.receive_request (&_tao_ri ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (!_tao_vfr.location_forwarded ()) - { -#endif /* TAO_HAS_INTERCEPTORS */ - _tao_retval = - _tao_impl->copy ( - ACE_ENV_SINGLE_ARG_PARAMETER - ); - TAO_INTERCEPTOR_CHECK; -#if (TAO_HAS_INTERCEPTORS == 1) - } - } - - if (!_tao_vfr.location_forwarded ()) - { - ::CORBA::Policy_ptr _tao_retval_info = _tao_retval._retn (); - _tao_ri.result (_tao_retval_info); - _tao_retval = _tao_retval_info; - _tao_ri.reply_status (PortableInterceptor::SUCCESSFUL); - _tao_vfr.send_reply (&_tao_ri ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } } - ACE_CATCHANY + + virtual void execute (ACE_ENV_SINGLE_ARG_DECL) { - _tao_ri.exception (&ACE_ANY_EXCEPTION); - _tao_vfr.send_exception ( - &_tao_ri - ACE_ENV_ARG_PARAMETER - ); - ACE_TRY_CHECK; + TAO::SArg_Traits< CORBA::Policy>::ret_arg_type retval = + get_ret_arg< CORBA::Policy> ( + this->operation_details_, + this->args_); - PortableInterceptor::ReplyStatus _tao_status = - _tao_ri.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - if (_tao_status == PortableInterceptor::SYSTEM_EXCEPTION - || _tao_status == PortableInterceptor::USER_EXCEPTION) - { - ACE_RE_THROW; - } + retval = + this->servant_->copy ( + ACE_ENV_SINGLE_ARG_PARAMETER); + + ACE_CHECK; } -# if defined (ACE_HAS_EXCEPTIONS) \ - && defined (ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS) - ACE_CATCHALL - { - CORBA::UNKNOWN ex; - - _tao_ri.exception (&ex); - _tao_vfr.send_exception ( - &_tao_ri - ACE_ENV_ARG_PARAMETER - ); - ACE_TRY_CHECK; - - PortableInterceptor::ReplyStatus _tao_status = - _tao_ri.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (_tao_status == PortableInterceptor::SYSTEM_EXCEPTION) - ACE_TRY_THROW (ex); - } -# endif /* ACE_HAS_EXCEPTIONS && ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS */ - ACE_ENDTRY; - ACE_CHECK; + private: + + Upcall_Command (Upcall_Command const &); + void operator= (Upcall_Command const &); + + private: + + POA_CORBA::Policy * const servant_; + TAO_Operation_Details const * const operation_details_; + TAO::Argument * const * const args_; + }; + + +#if TAO_HAS_INTERCEPTORS == 1 + static CORBA::TypeCode_ptr const exceptions[] = {}; + static size_t const nexceptions = 0; #endif /* TAO_HAS_INTERCEPTORS */ - _tao_server_request.init_reply (); -#if (TAO_HAS_INTERCEPTORS == 1) - if (!_tao_vfr.location_forwarded ()) + TAO::SArg_Traits< CORBA::Policy>::ret_val retval; + + TAO::Argument * const args[] = { -#endif /* TAO_HAS_INTERCEPTORS */ - TAO_OutputCDR &_tao_out = _tao_server_request.outgoing (); - - if (!( - (_tao_out << _tao_retval.in ()) - )) - { - TAO_OutputCDR::throw_skel_exception (errno ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } -#if (TAO_HAS_INTERCEPTORS == 1) - } -#endif /* TAO_HAS_INTERCEPTORS */ + &retval + }; + + static size_t const nargs = 1; + + POA_CORBA::Policy * const impl = + static_cast< + POA_CORBA::Policy *> (servant); + Upcall_Command command ( + impl, + server_request.operation_details (), + args); + + TAO::Upcall_Wrapper upcall_wrapper; + upcall_wrapper.upcall (server_request + , args + , nargs + , command + +#if TAO_HAS_INTERCEPTORS == 1 + , servant_upcall + , exceptions + , nexceptions +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; - // In case _tao_servant_upcall is not used in this function - ACE_UNUSED_ARG (_tao_servant_upcall); } // TAO_IDL - Generated from -// be\be_visitor_operation/operation_ss.cpp:98 +// be/be_visitor_operation/operation_ss.cpp:165 void POA_CORBA::Policy::destroy_skel ( - TAO_ServerRequest &_tao_server_request, - void *_tao_servant, - void *_tao_servant_upcall + TAO_ServerRequest & server_request, + void * servant_upcall, + void * servant ACE_ENV_ARG_DECL ) { - POA_CORBA::Policy *_tao_impl = - static_cast< - POA_CORBA::Policy *> ( - _tao_servant - ); - _tao_server_request.argument_flag (0); -#if (TAO_HAS_INTERCEPTORS == 1) - TAO::Portable_Server::Servant_Upcall *_tao_upcall = - static_cast< - TAO::Portable_Server::Servant_Upcall *> ( - _tao_servant_upcall - ); - - TAO_ServerRequestInterceptor_Adapter _tao_vfr ( - _tao_server_request.orb_core ()->server_request_interceptors (), - _tao_server_request.interceptor_count () - ); - - TAO_ServerRequestInfo_CORBA_Policy_destroy _tao_ri ( - _tao_server_request, - _tao_upcall, - _tao_impl - ACE_ENV_ARG_PARAMETER - ); + // TAO_IDL - Generated from + // be/be_visitor_operation/upcall_command_ss.cpp:74 - ACE_TRY + class Upcall_Command + : public TAO::Upcall_Command + { + public: + + inline Upcall_Command ( + POA_CORBA::Policy * servant) + : servant_ (servant) { - { - TAO::PICurrent_Guard _tao_pi_guard (_tao_ri.server_request (), - true /* Copy TSC to RSC */); - - _tao_vfr.receive_request (&_tao_ri ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (!_tao_vfr.location_forwarded ()) - { -#endif /* TAO_HAS_INTERCEPTORS */ - - _tao_impl->destroy ( - ACE_ENV_SINGLE_ARG_PARAMETER - ); - TAO_INTERCEPTOR_CHECK; -#if (TAO_HAS_INTERCEPTORS == 1) - } - } - - if (!_tao_vfr.location_forwarded ()) - { - _tao_ri.reply_status (PortableInterceptor::SUCCESSFUL); - _tao_vfr.send_reply (&_tao_ri ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } } - ACE_CATCHANY + + virtual void execute (ACE_ENV_SINGLE_ARG_DECL) { - _tao_ri.exception (&ACE_ANY_EXCEPTION); - _tao_vfr.send_exception ( - &_tao_ri - ACE_ENV_ARG_PARAMETER - ); - ACE_TRY_CHECK; - - PortableInterceptor::ReplyStatus _tao_status = - _tao_ri.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + this->servant_->destroy ( + ACE_ENV_SINGLE_ARG_PARAMETER); - if (_tao_status == PortableInterceptor::SYSTEM_EXCEPTION - || _tao_status == PortableInterceptor::USER_EXCEPTION) - { - ACE_RE_THROW; - } + ACE_CHECK; } -# if defined (ACE_HAS_EXCEPTIONS) \ - && defined (ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS) - ACE_CATCHALL - { - CORBA::UNKNOWN ex; - - _tao_ri.exception (&ex); - _tao_vfr.send_exception ( - &_tao_ri - ACE_ENV_ARG_PARAMETER - ); - ACE_TRY_CHECK; - - PortableInterceptor::ReplyStatus _tao_status = - _tao_ri.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (_tao_status == PortableInterceptor::SYSTEM_EXCEPTION) - ACE_TRY_THROW (ex); - } -# endif /* ACE_HAS_EXCEPTIONS && ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS */ - ACE_ENDTRY; - ACE_CHECK; + private: + + Upcall_Command (Upcall_Command const &); + void operator= (Upcall_Command const &); + + private: + + POA_CORBA::Policy * const servant_; + }; + + +#if TAO_HAS_INTERCEPTORS == 1 + static CORBA::TypeCode_ptr const exceptions[] = {}; + static size_t const nexceptions = 0; #endif /* TAO_HAS_INTERCEPTORS */ - _tao_server_request.init_reply (); + TAO::SArg_Traits< void>::ret_val retval; + + TAO::Argument * const args[] = + { + &retval + }; + + static size_t const nargs = 1; + + POA_CORBA::Policy * const impl = + static_cast< + POA_CORBA::Policy *> (servant); + + Upcall_Command command ( + impl); + + TAO::Upcall_Wrapper upcall_wrapper; + upcall_wrapper.upcall (server_request + , args + , nargs + , command + +#if TAO_HAS_INTERCEPTORS == 1 + , servant_upcall + , exceptions + , nexceptions +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; - // In case _tao_servant_upcall is not used in this function - ACE_UNUSED_ARG (_tao_servant_upcall); } // TAO_IDL - Generated from -// be\be_visitor_interface/interface_ss.cpp:162 +// be/be_visitor_interface/interface_ss.cpp:170 void POA_CORBA::Policy::_is_a_skel ( - TAO_ServerRequest &_tao_server_request, - void * _tao_servant, - void * /* Servant_Upcall */ + TAO_ServerRequest & server_request, + void * servant_upcall, + void * servant ACE_ENV_ARG_DECL ) { - TAO_InputCDR &_tao_in = _tao_server_request.incoming (); - POA_CORBA::Policy *_tao_impl = - static_cast<POA_CORBA::Policy *> (_tao_servant); - CORBA::Boolean _tao_retval = 0; - CORBA::String_var value; + // TAO_IDL - Generated from + // be/be_visitor_operation/upcall_command_ss.cpp:74 - if (!(_tao_in >> value.out ())) + class Upcall_Command + : public TAO::Upcall_Command + { + public: + + inline Upcall_Command ( + POA_CORBA::Policy * servant, + TAO_Operation_Details const * operation_details, + TAO::Argument * const args[]) + : servant_ (servant) + , operation_details_ (operation_details) + , args_ (args) { - ACE_THROW (CORBA::MARSHAL ()); + } + + virtual void execute (ACE_ENV_SINGLE_ARG_DECL) + { + TAO::SArg_Traits< ::ACE_InputCDR::to_boolean>::ret_arg_type retval = + get_ret_arg< ::ACE_InputCDR::to_boolean> ( + this->operation_details_, + this->args_); + + TAO::SArg_Traits< CORBA::Char *>::in_arg_type arg_1 = + get_in_arg< CORBA::Char *> ( + this->operation_details_, + this->args_, + 1); + + + retval = + this->servant_-> _is_a ( + arg_1 + ACE_ENV_ARG_PARAMETER); + + ACE_CHECK; } - _tao_retval = _tao_impl->_is_a (value.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK; + private: + + Upcall_Command (Upcall_Command const &); + void operator= (Upcall_Command const &); + + private: + + POA_CORBA::Policy * const servant_; + TAO_Operation_Details const * const operation_details_; + TAO::Argument * const * const args_; + }; + - _tao_server_request.init_reply (); - TAO_OutputCDR &_tao_out = _tao_server_request.outgoing (); +#if TAO_HAS_INTERCEPTORS == 1 + static CORBA::TypeCode_ptr const exceptions[] = {}; + static size_t const nexceptions = 0; +#endif /* TAO_HAS_INTERCEPTORS */ - if (!(_tao_out << CORBA::Any::from_boolean (_tao_retval))) + TAO::SArg_Traits< ::ACE_InputCDR::to_boolean>::ret_val retval; + TAO::SArg_Traits< CORBA::Char *>::in_arg_val _tao_repository_id; + + TAO::Argument * const args[] = { - ACE_THROW (CORBA::MARSHAL ()); - } + &retval, + &_tao_repository_id + }; + + static size_t const nargs = 2; + + POA_CORBA::Policy * const impl = + static_cast< + POA_CORBA::Policy *> (servant); + + Upcall_Command command ( + impl, + server_request.operation_details (), + args); + + TAO::Upcall_Wrapper upcall_wrapper; + upcall_wrapper.upcall (server_request + , args + , nargs + , command + +#if TAO_HAS_INTERCEPTORS == 1 + , servant_upcall + , exceptions + , nexceptions +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } void POA_CORBA::Policy::_non_existent_skel ( - TAO_ServerRequest &_tao_server_request, - void * _tao_servant, - void * /* Servant_Upcall */ + TAO_ServerRequest & server_request, + void * servant_upcall, + void * servant ACE_ENV_ARG_DECL ) { - POA_CORBA::Policy *_tao_impl = - static_cast<POA_CORBA::Policy *> (_tao_servant); - CORBA::Boolean _tao_retval = - _tao_impl->_non_existent (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - _tao_server_request.init_reply (); - TAO_OutputCDR &_tao_out = _tao_server_request.outgoing (); + // TAO_IDL - Generated from + // be/be_visitor_operation/upcall_command_ss.cpp:74 - if (!(_tao_out << CORBA::Any::from_boolean (_tao_retval))) + class Upcall_Command + : public TAO::Upcall_Command + { + public: + + inline Upcall_Command ( + POA_CORBA::Policy * servant, + TAO_Operation_Details const * operation_details, + TAO::Argument * const args[]) + : servant_ (servant) + , operation_details_ (operation_details) + , args_ (args) { - ACE_THROW (CORBA::MARSHAL ()); } + + virtual void execute (ACE_ENV_SINGLE_ARG_DECL) + { + TAO::SArg_Traits< ::ACE_InputCDR::to_boolean>::ret_arg_type retval = + get_ret_arg< ::ACE_InputCDR::to_boolean> ( + this->operation_details_, + this->args_); + + + retval = + this->servant_-> _non_existent ( + ACE_ENV_SINGLE_ARG_PARAMETER); + + ACE_CHECK; + } + + private: + + Upcall_Command (Upcall_Command const &); + void operator= (Upcall_Command const &); + + private: + + POA_CORBA::Policy * const servant_; + TAO_Operation_Details const * const operation_details_; + TAO::Argument * const * const args_; + }; + + +#if TAO_HAS_INTERCEPTORS == 1 + static CORBA::TypeCode_ptr const exceptions[] = {}; + static size_t const nexceptions = 0; +#endif /* TAO_HAS_INTERCEPTORS */ + + TAO::SArg_Traits< ::ACE_InputCDR::to_boolean>::ret_val retval; + + TAO::Argument * const args[] = + { + &retval + }; + + static size_t const nargs = 1; + + POA_CORBA::Policy * const impl = + static_cast< + POA_CORBA::Policy *> (servant); + + Upcall_Command command ( + impl, + server_request.operation_details (), + args); + + TAO::Upcall_Wrapper upcall_wrapper; + upcall_wrapper.upcall (server_request + , args + , nargs + , command + +#if TAO_HAS_INTERCEPTORS == 1 + , servant_upcall + , exceptions + , nexceptions +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + + +// TAO_IDL - Generated from +// be/be_visitor_interface/interface_ss.cpp:386 + + + void POA_CORBA::Policy::_interface_skel ( - TAO_ServerRequest &_tao_server_request, - void * _tao_servant, - void * /* Servant_Upcall */ + TAO_ServerRequest & server_request, + void * /* servant_upcall */, + void * servant ACE_ENV_ARG_DECL ) { @@ -1432,20 +1024,21 @@ void POA_CORBA::Policy::_interface_skel ( if (_tao_adapter == 0) { - ACE_THROW (CORBA::INTF_REPOS ()); + ACE_THROW (CORBA::INTF_REPOS (CORBA::OMGVMCID | 1, + CORBA::COMPLETED_NO)); } - POA_CORBA::Policy *_tao_impl = - static_cast<POA_CORBA::Policy *> (_tao_servant); - + POA_CORBA::Policy * const impl = + static_cast< + POA_CORBA::Policy *> (servant); CORBA::InterfaceDef_ptr _tao_retval = - _tao_impl->_get_interface (ACE_ENV_SINGLE_ARG_PARAMETER); + impl->_get_interface (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; - _tao_server_request.init_reply (); - TAO_OutputCDR &_tao_out = _tao_server_request.outgoing (); + server_request.init_reply (); + TAO_OutputCDR &_tao_out = *server_request.outgoing (); - CORBA::Boolean _tao_result = + CORBA::Boolean const _tao_result = _tao_adapter->interfacedef_cdr_insert ( _tao_out, _tao_retval @@ -1460,26 +1053,98 @@ void POA_CORBA::Policy::_interface_skel ( } void POA_CORBA::Policy::_component_skel ( - TAO_ServerRequest &_tao_server_request, - void * _tao_object_reference, - void * /* Servant_Upcall */ + TAO_ServerRequest & server_request, + void * servant_upcall, + void * servant ACE_ENV_ARG_DECL ) { - POA_CORBA::Policy *_tao_impl = - static_cast<POA_CORBA::Policy *> (_tao_object_reference); - CORBA::Object_var _tao_retval = - _tao_impl->_get_component (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - _tao_server_request.init_reply (); - TAO_OutputCDR &_tao_out = _tao_server_request.outgoing (); + // TAO_IDL - Generated from + // be/be_visitor_operation/upcall_command_ss.cpp:74 - if (!(_tao_out << _tao_retval.in ())) + class Upcall_Command + : public TAO::Upcall_Command + { + public: + + inline Upcall_Command ( + POA_CORBA::Policy * servant, + TAO_Operation_Details const * operation_details, + TAO::Argument * const args[]) + : servant_ (servant) + , operation_details_ (operation_details) + , args_ (args) { - ACE_THROW (CORBA::MARSHAL ()); } + + virtual void execute (ACE_ENV_SINGLE_ARG_DECL) + { + TAO::SArg_Traits< ::CORBA::Object>::ret_arg_type retval = + get_ret_arg< ::CORBA::Object> ( + this->operation_details_, + this->args_); + + + retval = + this->servant_-> _get_component ( + ACE_ENV_SINGLE_ARG_PARAMETER); + + ACE_CHECK; + } + + private: + + Upcall_Command (Upcall_Command const &); + void operator= (Upcall_Command const &); + + private: + + POA_CORBA::Policy * const servant_; + TAO_Operation_Details const * const operation_details_; + TAO::Argument * const * const args_; + }; + + +#if TAO_HAS_INTERCEPTORS == 1 + static CORBA::TypeCode_ptr const exceptions[] = {}; + static size_t const nexceptions = 0; +#endif /* TAO_HAS_INTERCEPTORS */ + + TAO::SArg_Traits< ::CORBA::Object>::ret_val retval; + + TAO::Argument * const args[] = + { + &retval + }; + + static size_t const nargs = 1; + + POA_CORBA::Policy * const impl = + static_cast< + POA_CORBA::Policy *> (servant); + + Upcall_Command command ( + impl, + server_request.operation_details (), + args); + + TAO::Upcall_Wrapper upcall_wrapper; + upcall_wrapper.upcall (server_request + , args + , nargs + , command + +#if TAO_HAS_INTERCEPTORS == 1 + , servant_upcall + , exceptions + , nexceptions +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } CORBA::Boolean POA_CORBA::Policy::_is_a ( @@ -1500,36 +1165,17 @@ CORBA::Boolean POA_CORBA::Policy::_is_a ( ); } -void* POA_CORBA::Policy::_downcast ( - const char* logical_type_id - ) -{ - if (ACE_OS::strcmp (logical_type_id, - "IDL:omg.org/CORBA/Policy:1.0") == 0) - { - return static_cast<POA_CORBA::Policy_ptr> (this); - } - - if (ACE_OS::strcmp (logical_type_id, - "IDL:omg.org/CORBA/Object:1.0") == 0) - { - return static_cast<PortableServer::Servant> (this); - } - - return 0; -} - const char* POA_CORBA::Policy::_interface_repository_id (void) const { return "IDL:omg.org/CORBA/Policy:1.0"; } // TAO_IDL - Generated from -// be\be_visitor_interface/interface_ss.cpp:576 +// be/be_visitor_interface/interface_ss.cpp:781 void POA_CORBA::Policy::_dispatch ( - TAO_ServerRequest &req, - void *servant_upcall + TAO_ServerRequest & req, + void * servant_upcall ACE_ENV_ARG_DECL ) { @@ -1540,7 +1186,7 @@ void POA_CORBA::Policy::_dispatch ( } // TAO_IDL - Generated from -// be\be_visitor_interface/interface_ss.cpp:527 +// be/be_visitor_interface/interface_ss.cpp:732 CORBA::Policy * POA_CORBA::Policy::_this (ACE_ENV_SINGLE_ARG_DECL) @@ -1572,7 +1218,7 @@ POA_CORBA::Policy::_this (ACE_ENV_SINGLE_ARG_DECL) } // TAO_IDL - Generated from -// be\be_visitor_root/root.cpp:1683 +// be/be_visitor_root/root.cpp:1673 #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) diff --git a/TAO/tao/PortableServer/PolicyS.h b/TAO/tao/PortableServer/PolicyS.h index d971a512ff8..42c9952ea22 100644 --- a/TAO/tao/PortableServer/PolicyS.h +++ b/TAO/tao/PortableServer/PolicyS.h @@ -26,16 +26,13 @@ // http://www.cs.wustl.edu/~schmidt/TAO.html // TAO_IDL - Generated from -// be\be_codegen.cpp:390 +// be/be_codegen.cpp:390 #ifndef _TAO_IDL_ORIG_POLICYS_H_ #define _TAO_IDL_ORIG_POLICYS_H_ #include /**/ "ace/pre.h" -#include "tao/UShortSeqS.h" -#include "tao/CurrentS.h" -#include "tao/Policy_ForwardS.h" #include "tao/PolicyC.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) @@ -69,134 +66,129 @@ #endif /* TAO_EXPORT_NESTED_CLASSES */ // TAO_IDL - Generated from -// be\be_visitor_module/module_sh.cpp:49 +// be/be_visitor_module/module_sh.cpp:49 namespace POA_CORBA { - - + + // TAO_IDL - Generated from - // be\be_visitor_interface/interface_sh.cpp:87 - + // be/be_visitor_interface/interface_sh.cpp:87 + class Policy; typedef Policy *Policy_ptr; - - class _TAO_Policy_ThruPOA_Proxy_Impl; + class _TAO_Policy_Direct_Proxy_Impl; class _TAO_Policy_Strategized_Proxy_Broker; - + class TAO_PortableServer_Export Policy : public virtual PortableServer::ServantBase { protected: Policy (void); - + public: // Useful for template programming. typedef ::CORBA::Policy _stub_type; typedef ::CORBA::Policy_ptr _stub_ptr_type; typedef ::CORBA::Policy_var _stub_var_type; - + Policy (const Policy& rhs); virtual ~Policy (void); - + virtual CORBA::Boolean _is_a ( const char* logical_type_id ACE_ENV_ARG_DECL_WITH_DEFAULTS ); - - virtual void* _downcast ( - const char* logical_type_id - ); - + static void _is_a_skel ( - TAO_ServerRequest &req, - void *servant, - void *servant_upcall + TAO_ServerRequest & req, + void * servant_upcall, + void * servant ACE_ENV_ARG_DECL ); - + static void _non_existent_skel ( - TAO_ServerRequest &req, - void *servant, - void *servant_upcall + TAO_ServerRequest & req, + void * servant_upcall, + void * servant ACE_ENV_ARG_DECL ); - + static void _interface_skel ( - TAO_ServerRequest &req, - void *servant, - void *servant_upcall + TAO_ServerRequest & req, + void * servant_upcall, + void * servant ACE_ENV_ARG_DECL ); - + static void _component_skel ( - TAO_ServerRequest &req, - void *obj, - void *servant_upcall + TAO_ServerRequest & req, + void * servant_upcall, + void * servant ACE_ENV_ARG_DECL ); - + virtual void _dispatch ( - TAO_ServerRequest &req, - void *_servant_upcall + TAO_ServerRequest & req, + void * servant_upcall ACE_ENV_ARG_DECL ); - + ::CORBA::Policy *_this ( ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS ); - + virtual const char* _interface_repository_id (void) const; - + // TAO_IDL - Generated from - // be\be_visitor_operation/operation_sh.cpp:45 - + // be/be_visitor_operation/operation_sh.cpp:45 + virtual CORBA::PolicyType policy_type ( ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS ) ACE_THROW_SPEC (( CORBA::SystemException )) = 0; - + static void _get_policy_type_skel ( - TAO_ServerRequest &_tao_req, - void *_tao_servant, - void *_tao_servant_upcall + TAO_ServerRequest & server_request, + void * servant_upcall, + void * servant ACE_ENV_ARG_DECL ); - + // TAO_IDL - Generated from - // be\be_visitor_operation/operation_sh.cpp:45 - + // be/be_visitor_operation/operation_sh.cpp:45 + virtual ::CORBA::Policy_ptr copy ( ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS ) ACE_THROW_SPEC (( CORBA::SystemException )) = 0; - + static void copy_skel ( - TAO_ServerRequest &_tao_req, - void *_tao_servant, - void *_tao_servant_upcall + TAO_ServerRequest & server_request, + void * servant_upcall, + void * servant ACE_ENV_ARG_DECL ); - + // TAO_IDL - Generated from - // be\be_visitor_operation/operation_sh.cpp:45 - + // be/be_visitor_operation/operation_sh.cpp:45 + virtual void destroy ( ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS ) ACE_THROW_SPEC (( CORBA::SystemException )) = 0; - + static void destroy_skel ( - TAO_ServerRequest &_tao_req, - void *_tao_servant, - void *_tao_servant_upcall + TAO_ServerRequest & server_request, + void * servant_upcall, + void * servant ACE_ENV_ARG_DECL ); }; @@ -206,7 +198,7 @@ namespace POA_CORBA // // TAO_IDL - Generated from - // be\be_visitor_interface/strategized_proxy_broker_sh.cpp:36 + // be/be_visitor_interface/strategized_proxy_broker_sh.cpp:36 class TAO_PortableServer_Export _TAO_Policy_Strategized_Proxy_Broker : public virtual TAO::Collocation_Proxy_Broker @@ -245,69 +237,9 @@ namespace POA_CORBA /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - // ThruPOA Proxy Impl. Declaration - // - - // TAO_IDL - Generated from - // be\be_visitor_interface/thru_poa_proxy_impl_sh.cpp:37 - - class TAO_PortableServer_Export _TAO_Policy_ThruPOA_Proxy_Impl - { - public: - _TAO_Policy_ThruPOA_Proxy_Impl (void); - - virtual ~_TAO_Policy_ThruPOA_Proxy_Impl (void) {} - - // TAO_IDL - Generated from - // be\be_visitor_operation/proxy_impl_xh.cpp:24 - - static void - _get_policy_type ( - TAO_Abstract_ServantBase *servant, - TAO::Argument ** args, - int num_args - ACE_ENV_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - - // TAO_IDL - Generated from - // be\be_visitor_operation/proxy_impl_xh.cpp:24 - - static void - copy ( - TAO_Abstract_ServantBase *servant, - TAO::Argument ** args, - int num_args - ACE_ENV_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - - // TAO_IDL - Generated from - // be\be_visitor_operation/proxy_impl_xh.cpp:24 - - static void - destroy ( - TAO_Abstract_ServantBase *servant, - TAO::Argument ** args, - int num_args - ACE_ENV_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - }; - - // - // ThruPOA Proxy Impl. Declaration - /////////////////////////////////////////////////////////////////////// // TAO_IDL - Generated from - // be\be_visitor_interface/direct_proxy_impl_sh.cpp:31 + // be/be_visitor_interface/direct_proxy_impl_sh.cpp:31 /////////////////////////////////////////////////////////////////////// // Direct Impl. Declaration @@ -321,7 +253,7 @@ namespace POA_CORBA virtual ~_TAO_Policy_Direct_Proxy_Impl (void) {} // TAO_IDL - Generated from - // be\be_visitor_operation/proxy_impl_xh.cpp:24 + // be/be_visitor_operation/proxy_impl_xh.cpp:24 static void _get_policy_type ( @@ -335,7 +267,7 @@ namespace POA_CORBA )); // TAO_IDL - Generated from - // be\be_visitor_operation/proxy_impl_xh.cpp:24 + // be/be_visitor_operation/proxy_impl_xh.cpp:24 static void copy ( @@ -349,7 +281,7 @@ namespace POA_CORBA )); // TAO_IDL - Generated from - // be\be_visitor_operation/proxy_impl_xh.cpp:24 + // be/be_visitor_operation/proxy_impl_xh.cpp:24 static void destroy ( @@ -370,12 +302,12 @@ namespace POA_CORBA // TAO_IDL - Generated from -// be\be_visitor_module/module_sh.cpp:80 +// be/be_visitor_module/module_sh.cpp:80 } // module CORBA // TAO_IDL - Generated from -// be\be_codegen.cpp:997 +// be/be_codegen.cpp:997 #include "PolicyS_T.h" diff --git a/TAO/tao/PortableServer/PolicyS_T.cpp b/TAO/tao/PortableServer/PolicyS_T.cpp index 01dfaa34975..ef925792d16 100644 --- a/TAO/tao/PortableServer/PolicyS_T.cpp +++ b/TAO/tao/PortableServer/PolicyS_T.cpp @@ -26,7 +26,7 @@ // http://www.cs.wustl.edu/~schmidt/TAO.html // TAO_IDL - Generated from -// be\be_codegen.cpp:683 +// be/be_codegen.cpp:683 #ifndef _TAO_IDL_ORIG_POLICYS_T_CPP_ #define _TAO_IDL_ORIG_POLICYS_T_CPP_ diff --git a/TAO/tao/PortableServer/PolicyS_T.h b/TAO/tao/PortableServer/PolicyS_T.h index 07d9445660a..be1a67ace7c 100644 --- a/TAO/tao/PortableServer/PolicyS_T.h +++ b/TAO/tao/PortableServer/PolicyS_T.h @@ -26,7 +26,7 @@ // http://www.cs.wustl.edu/~schmidt/TAO.html // TAO_IDL - Generated from -// be\be_codegen.cpp:546 +// be/be_codegen.cpp:546 #ifndef _TAO_IDL_ORIG_POLICYS_T_H_ #define _TAO_IDL_ORIG_POLICYS_T_H_ @@ -40,13 +40,13 @@ // TAO_IDL - Generated from -// be\be_visitor_root/root_sth.cpp:116 +// be/be_visitor_root/root_sth.cpp:116 namespace POA_CORBA { // TAO_IDL - Generated from - // be\be_visitor_interface/tie_sh.cpp:87 + // be/be_visitor_interface/tie_sh.cpp:87 // TIE class: Refer to CORBA v2.2, Section 20.34.4 template <class T> @@ -86,7 +86,7 @@ namespace POA_CORBA ); // TAO_IDL - Generated from - // be\be_visitor_operation/tie_sh.cpp:60 + // be/be_visitor_operation/tie_sh.cpp:60 CORBA::PolicyType policy_type ( ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS @@ -96,7 +96,7 @@ namespace POA_CORBA )); // TAO_IDL - Generated from - // be\be_visitor_operation/tie_sh.cpp:60 + // be/be_visitor_operation/tie_sh.cpp:60 ::CORBA::Policy_ptr copy ( ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS @@ -106,7 +106,7 @@ namespace POA_CORBA )); // TAO_IDL - Generated from - // be\be_visitor_operation/tie_sh.cpp:60 + // be/be_visitor_operation/tie_sh.cpp:60 void destroy ( ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS @@ -127,7 +127,7 @@ namespace POA_CORBA } // module CORBA // TAO_IDL - Generated from -// be\be_codegen.cpp:1094 +// be/be_codegen.cpp:1094 #if defined (__ACE_INLINE__) #include "PolicyS_T.inl" diff --git a/TAO/tao/PortableServer/PolicyS_T.inl b/TAO/tao/PortableServer/PolicyS_T.inl index 42c4ad90eac..b24fde0f1e8 100644 --- a/TAO/tao/PortableServer/PolicyS_T.inl +++ b/TAO/tao/PortableServer/PolicyS_T.inl @@ -27,7 +27,7 @@ // TAO_IDL - Generated from -// be\be_visitor_interface/tie_si.cpp:96 +// be/be_visitor_interface/tie_si.cpp:96 template <class T> ACE_INLINE POA_CORBA::Policy_tie<T>::Policy_tie (T &t) @@ -120,7 +120,7 @@ POA_CORBA::Policy_tie<T>::_default_POA (ACE_ENV_SINGLE_ARG_DECL) } // TAO_IDL - Generated from -// be\be_visitor_operation/tie_si.cpp:68 +// be/be_visitor_operation/tie_si.cpp:68 template <class T> ACE_INLINE CORBA::PolicyType POA_CORBA::Policy_tie<T>::policy_type ( @@ -136,7 +136,7 @@ CORBA::PolicyType POA_CORBA::Policy_tie<T>::policy_type ( } // TAO_IDL - Generated from -// be\be_visitor_operation/tie_si.cpp:68 +// be/be_visitor_operation/tie_si.cpp:68 template <class T> ACE_INLINE ::CORBA::Policy_ptr POA_CORBA::Policy_tie<T>::copy ( @@ -152,7 +152,7 @@ template <class T> ACE_INLINE } // TAO_IDL - Generated from -// be\be_visitor_operation/tie_si.cpp:68 +// be/be_visitor_operation/tie_si.cpp:68 template <class T> ACE_INLINE void POA_CORBA::Policy_tie<T>::destroy ( diff --git a/TAO/tao/PortableServer/Servant_Base.cpp b/TAO/tao/PortableServer/Servant_Base.cpp index 75bd7654c92..98d5f2cd549 100644 --- a/TAO/tao/PortableServer/Servant_Base.cpp +++ b/TAO/tao/PortableServer/Servant_Base.cpp @@ -26,7 +26,7 @@ ACE_RCSID (PortableServer, #if defined (ACE_ENABLE_TIMEPROBES) - static const char *TAO_Servant_Base_Timeprobe_Description[] = +static const char *TAO_Servant_Base_Timeprobe_Description[] = { "Servant_Base::_find - start", "Servant_Base::_find - end" @@ -46,13 +46,13 @@ ACE_TIMEPROBE_EVENT_DESCRIPTIONS (TAO_Servant_Base_Timeprobe_Description, TAO_ServantBase::TAO_ServantBase (void) : TAO_Abstract_ServantBase () - , optable_ (0) + , optable_ (0) { } TAO_ServantBase::TAO_ServantBase (const TAO_ServantBase &rhs) : TAO_Abstract_ServantBase () - , optable_ (rhs.optable_) + , optable_ (rhs.optable_) { } @@ -82,7 +82,7 @@ CORBA::Boolean TAO_ServantBase::_is_a (const char *logical_type_id ACE_ENV_ARG_DECL_NOT_USED) { - const char *id = "IDL:omg.org/CORBA/Object:1.0"; + static char const id[] = "IDL:omg.org/CORBA/Object:1.0"; return ACE_OS::strcmp (logical_type_id, id) == 0; } @@ -125,7 +125,7 @@ TAO_ServantBase::_find (const char *opname, const unsigned int length) { ACE_FUNCTION_TIMEPROBE (TAO_SERVANT_BASE_FIND_START); - return optable_->find (opname, skelfunc, length); + return this->optable_->find (opname, skelfunc, length); } int @@ -135,7 +135,7 @@ TAO_ServantBase::_find (const char *opname, const unsigned int length) { ACE_FUNCTION_TIMEPROBE (TAO_SERVANT_BASE_FIND_START); - return optable_->find (opname, skelfunc, st, length); + return this->optable_->find (opname, skelfunc, st, length); } TAO_Stub * @@ -187,9 +187,9 @@ TAO_ServantBase::_create_stub (ACE_ENV_SINGLE_ARG_DECL) return stub; } -void TAO_ServantBase::synchronous_upcall_dispatch (TAO_ServerRequest &req, - void *servant_upcall, - void *derived_this +void TAO_ServantBase::synchronous_upcall_dispatch (TAO_ServerRequest & req, + void * servant_upcall, + void * derived_this ACE_ENV_ARG_DECL) { TAO_Skeleton skel; @@ -218,12 +218,13 @@ void TAO_ServantBase::synchronous_upcall_dispatch (TAO_ServerRequest &req, ACE_TRY { - // Invoke the skeleton, it will demarshal the arguments, - // invoke the right operation on the skeleton class - // (<derived_this>), and marshal any results. + // Invoke the skeleton, it will demarshal the arguments, invoke + // the right operation on the skeleton class, and marshal any + // results. De/marshaling will only occur in the uncollocated + // case. skel (req, - derived_this, - servant_upcall + servant_upcall, + derived_this ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; @@ -253,9 +254,9 @@ void TAO_ServantBase::synchronous_upcall_dispatch (TAO_ServerRequest &req, return; } -void TAO_ServantBase::asynchronous_upcall_dispatch (TAO_ServerRequest &req, - void *servant_upcall, - void *derived_this +void TAO_ServantBase::asynchronous_upcall_dispatch (TAO_ServerRequest & req, + void * servant_upcall, + void * derived_this ACE_ENV_ARG_DECL) { TAO_Skeleton skel; @@ -272,17 +273,25 @@ void TAO_ServantBase::asynchronous_upcall_dispatch (TAO_ServerRequest &req, } // Fetch the skeleton for this operation - if (this->_find (opname, skel, - static_cast <unsigned int> (req.operation_length())) == -1) + if (this->_find (opname, + skel, + static_cast <unsigned int> (req.operation_length())) == -1) { ACE_THROW (CORBA::BAD_OPERATION ()); } ACE_TRY { - // Invoke the skeleton, it will demarshal the arguments, - // invoke the right operation on the skeleton class - // (<derived_this>), and marshal any results. + // Invoke the skeleton, it will demarshal the arguments, invoke + // the right operation on the skeleton class, and marshal any + // results. De/marshaling will only occur in the uncollocated + // case. + + // @@ Why does AMH have to swap the servant_upcall and + // derived_this arguments relative to synchronous upcall + // argument order? Inconsistencies for no good reason! + // *sigh* + // -Ossama skel (req, derived_this, servant_upcall diff --git a/TAO/tao/PortableServer/Servant_Base.h b/TAO/tao/PortableServer/Servant_Base.h index 0095b24f1c0..b6c714f8e10 100644 --- a/TAO/tao/PortableServer/Servant_Base.h +++ b/TAO/tao/PortableServer/Servant_Base.h @@ -39,6 +39,7 @@ class TAO_PortableServer_Export TAO_ServantBase : public virtual TAO_Abstract_ServantBase { public: + /// Destructor. virtual ~TAO_ServantBase (void); @@ -66,10 +67,7 @@ public: ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS ); - /// Get the correct vtable. - virtual void *_downcast (const char *repository_id) = 0; - - /// This is an auxiliar method for _this() and _narrow(). + /// This is an auxiliary method for _this() and _narrow(). virtual TAO_Stub *_create_stub (ACE_ENV_SINGLE_ARG_DECL); /** @@ -108,19 +106,22 @@ protected: /// Assignment operator. TAO_ServantBase &operator= (const TAO_ServantBase &); - virtual void synchronous_upcall_dispatch (TAO_ServerRequest &req, - void *servant_upcall, - void *derived_this + virtual void synchronous_upcall_dispatch (TAO_ServerRequest & req, + void * servant_upcall, + void * derived_this ACE_ENV_ARG_DECL); - virtual void asynchronous_upcall_dispatch (TAO_ServerRequest &req, - void *servant_upcall, - void *derived_this + virtual void asynchronous_upcall_dispatch (TAO_ServerRequest & req, + void * servant_upcall, + void * derived_this ACE_ENV_ARG_DECL); + protected: - /// The operation table for this servant, it is initialized by the + + /// The operation table for this servant. It is initialized by the /// most derived class. - TAO_Operation_Table *optable_; + TAO_Operation_Table * optable_; + }; /** diff --git a/TAO/tao/PortableServer/Servant_Base.i b/TAO/tao/PortableServer/Servant_Base.i index 9821c56e03e..b48403a8e3c 100644 --- a/TAO/tao/PortableServer/Servant_Base.i +++ b/TAO/tao/PortableServer/Servant_Base.i @@ -1,8 +1,9 @@ +// -*- C++ -*- +// // $Id$ ACE_INLINE u_long TAO_Servant_Hash::operator () (PortableServer::Servant servant) const { - return static_cast <u_long>(reinterpret_cast <ptrdiff_t> (servant)); + return static_cast<u_long> (reinterpret_cast<ptrdiff_t> (servant)); } - diff --git a/TAO/tao/PortableServer/ServerInterceptorAdapter.cpp b/TAO/tao/PortableServer/ServerInterceptorAdapter.cpp index f51119658fc..47ba3705d7e 100644 --- a/TAO/tao/PortableServer/ServerInterceptorAdapter.cpp +++ b/TAO/tao/PortableServer/ServerInterceptorAdapter.cpp @@ -8,23 +8,31 @@ ACE_RCSID (PortableServer, ServerInterceptorAdapter, "$Id$") -#if !defined (__ACE_INLINE__) +#ifndef __ACE_INLINE__ # include "ServerInterceptorAdapter.inl" -#endif /* __ACE_INLINE__ */ +#endif /* !__ACE_INLINE__ */ #include "ServerRequestInfo.h" #include "PICurrent_Guard.h" +#include "tao/TAO_Server_Request.h" +#include "tao/ORB_Core.h" -TAO_ServerRequestInterceptor_Adapter::~TAO_ServerRequestInterceptor_Adapter (void) + +TAO::ServerRequestInterceptor_Adapter::ServerRequestInterceptor_Adapter ( + TAO_ServerRequest & server_request) + : interceptors_ (server_request.orb_core ()->server_request_interceptors ()) + , len_ (interceptors_.size ()) + , stack_size_ (server_request.interceptor_count ()) + , location_forwarded_ (false) { } #if TAO_HAS_EXTENDED_FT_INTERCEPTORS == 1 void -TAO_ServerRequestInterceptor_Adapter::tao_ft_interception_point ( - TAO_ServerRequestInfo *ri, - CORBA::OctetSeq_out oc +TAO::ServerRequestInterceptor_Adapter::tao_ft_interception_point ( + TAO::ServerRequestInfo * ri, + CORBA::OctetSeq_out oc ACE_ENV_ARG_DECL) { // This method implements one of the "starting" server side @@ -36,8 +44,8 @@ TAO_ServerRequestInterceptor_Adapter::tao_ft_interception_point ( // current (TSC) upon leaving this scope, i.e. just after the // receive_request_service_contexts() completes. A "guard" is // used to make the copy also occur if an exception is thrown. - TAO::PICurrent_Guard pi_guard (ri->server_request (), - false /* Copy RSC to TSC */); + TAO::PICurrent_Guard const pi_guard (ri->server_request (), + false /* Copy RSC to TSC */); oc = 0; @@ -70,16 +78,15 @@ TAO_ServerRequestInterceptor_Adapter::tao_ft_interception_point ( ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - this->location_forwarded_ = 1; + this->location_forwarded_ = true; } ACE_ENDTRY; ACE_CHECK; } void -TAO_ServerRequestInterceptor_Adapter:: -receive_request_service_contexts ( - TAO_ServerRequestInfo *ri +TAO::ServerRequestInterceptor_Adapter::receive_request_service_contexts ( + TAO::ServerRequestInfo * ri ACE_ENV_ARG_DECL) { // This method implements one of the "intermediate" server side @@ -96,6 +103,7 @@ receive_request_service_contexts ( // internal error that must be corrected. ACE_THROW (CORBA::INTERNAL ()); } + ACE_TRY { for (size_t i = 0 ; i < this->stack_size_; ++i) @@ -113,7 +121,7 @@ receive_request_service_contexts ( ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - this->location_forwarded_ = 1; + this->location_forwarded_ = true; } ACE_ENDTRY; ACE_CHECK; @@ -125,9 +133,8 @@ receive_request_service_contexts ( /// messing around things in the same function, which is harder to /// read and could make the code buggier. void -TAO_ServerRequestInterceptor_Adapter:: -receive_request_service_contexts ( - TAO_ServerRequestInfo *ri +TAO::ServerRequestInterceptor_Adapter::receive_request_service_contexts ( + TAO::ServerRequestInfo * ri ACE_ENV_ARG_DECL) { @@ -140,8 +147,8 @@ receive_request_service_contexts ( // current (TSC) upon leaving this scope, i.e. just after the // receive_request_service_contexts() completes. A "guard" is // used to make the copy also occur if an exception is thrown. - TAO::PICurrent_Guard pi_guard (ri->server_request (), - false /* Copy RSC to TSC */); + TAO::PICurrent_Guard const pi_guard (ri->server_request (), + false /* Copy RSC to TSC */); for (size_t i = 0 ; i < this->len_; ++i) { @@ -162,7 +169,7 @@ receive_request_service_contexts ( ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - this->location_forwarded_ = 1; + this->location_forwarded_ = true; } ACE_ENDTRY; ACE_CHECK; @@ -171,9 +178,9 @@ receive_request_service_contexts ( #endif /*TAO_HAS_EXTENDED_FT_INTERCEPTORS*/ void -TAO_ServerRequestInterceptor_Adapter:: -receive_request (TAO_ServerRequestInfo *ri - ACE_ENV_ARG_DECL) +TAO::ServerRequestInterceptor_Adapter::receive_request ( + TAO::ServerRequestInfo * ri + ACE_ENV_ARG_DECL) { // This method implements an "intermediate" server side interception // point. Interceptors are invoked in the same order they were @@ -212,7 +219,7 @@ receive_request (TAO_ServerRequestInfo *ri ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - this->location_forwarded_ = 1; + this->location_forwarded_ = true; } ACE_ENDTRY; ACE_CHECK; @@ -220,9 +227,9 @@ receive_request (TAO_ServerRequestInfo *ri } void -TAO_ServerRequestInterceptor_Adapter:: -send_reply (TAO_ServerRequestInfo *ri - ACE_ENV_ARG_DECL) +TAO::ServerRequestInterceptor_Adapter::send_reply ( + TAO::ServerRequestInfo * ri + ACE_ENV_ARG_DECL) { // This is an "ending" interception point so we only process the // interceptors pushed on to the flow stack. @@ -232,7 +239,7 @@ send_reply (TAO_ServerRequestInfo *ri // interception point. // Unwind the stack. - const size_t len = this->stack_size_; + size_t const len = this->stack_size_; for (size_t i = 0; i < len; ++i) { // Pop the interceptor off of the flow stack before it is @@ -253,9 +260,9 @@ send_reply (TAO_ServerRequestInfo *ri } void -TAO_ServerRequestInterceptor_Adapter:: -send_exception (TAO_ServerRequestInfo *ri - ACE_ENV_ARG_DECL) +TAO::ServerRequestInterceptor_Adapter::send_exception ( + TAO::ServerRequestInfo *ri + ACE_ENV_ARG_DECL) { // This is an "ending" server side interception point so we only // process the interceptors pushed on to the flow stack. @@ -267,7 +274,7 @@ send_exception (TAO_ServerRequestInfo *ri ACE_TRY { // Unwind the flow stack. - const size_t len = this->stack_size_; + size_t const len = this->stack_size_; for (size_t i = 0; i < len; ++i) { // Pop the interceptor off of the flow stack before it is @@ -289,7 +296,7 @@ send_exception (TAO_ServerRequestInfo *ri ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - this->location_forwarded_ = 1; + this->location_forwarded_ = true; } ACE_CATCHANY { @@ -324,9 +331,9 @@ send_exception (TAO_ServerRequestInfo *ri } void -TAO_ServerRequestInterceptor_Adapter:: -send_other (TAO_ServerRequestInfo *ri - ACE_ENV_ARG_DECL) +TAO::ServerRequestInterceptor_Adapter::send_other ( + TAO::ServerRequestInfo * ri + ACE_ENV_ARG_DECL) { // This is an "ending" server side interception point so we only // process the interceptors pushed on to the flow stack. @@ -338,7 +345,7 @@ send_other (TAO_ServerRequestInfo *ri ACE_TRY { // Unwind the flow stack. - const size_t len = this->stack_size_; + size_t const len = this->stack_size_; for (size_t i = 0; i < len; ++i) { // Pop the interceptor off of the flow stack before it is @@ -360,7 +367,7 @@ send_other (TAO_ServerRequestInfo *ri ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - this->location_forwarded_ = 1; + this->location_forwarded_ = true; } ACE_ENDTRY; ACE_CHECK; diff --git a/TAO/tao/PortableServer/ServerInterceptorAdapter.h b/TAO/tao/PortableServer/ServerInterceptorAdapter.h index 3ba1051a2ee..4dacdb6fea0 100644 --- a/TAO/tao/PortableServer/ServerInterceptorAdapter.h +++ b/TAO/tao/PortableServer/ServerInterceptorAdapter.h @@ -7,7 +7,7 @@ * $Id$ * * This file contains a helper class to simplify the support of - * interceptors in tao_idl generated skeletons. + * interceptors in TAO_IDL generated skeletons. * * @author Nanbor Wang <nanbor@cs.wustl.edu> * @author Ossama Othman <ossama@uci.edu> @@ -34,97 +34,100 @@ #include "tao/Basic_Types.h" #include "tao/Interceptor_List.h" -class TAO_ServerRequestInfo; +class TAO_ServerRequest; -/** - * @class TAO_ServerRequestInterceptor_Adapter - * - * @brief TAO_ServerRequestInterceptor_Adapter - * - * A convenient helper class to invoke registered server request - * interceptor(s) in tao_idl generated code. - */ -class TAO_PortableServer_Export TAO_ServerRequestInterceptor_Adapter -{ -public: - TAO_ServerRequestInterceptor_Adapter ( - TAO_ServerRequestInterceptor_List::TYPE &interceptors, - size_t &stack_size); - - ~TAO_ServerRequestInterceptor_Adapter (void); +namespace TAO +{ + class ServerRequestInfo; /** - * @name PortableInterceptor Client Side Interception Points + * @class ServerRequestInterceptor_Adapter * - * Each of these methods corresponds to a client side interception - * point. + * @brief ServerRequestInterceptor_Adapter * + * A convenient helper class to invoke registered server request + * interceptor(s). */ - //@{ + class ServerRequestInterceptor_Adapter + { + public: + + /// Constructor. + ServerRequestInterceptor_Adapter (TAO_ServerRequest & server_request); + + /** + * @name PortableInterceptor Client Side Interception Points + * + * Each of these methods corresponds to a client side interception + * point. + */ + //@{ #if TAO_HAS_EXTENDED_FT_INTERCEPTORS == 1 - /// This method implements the "starting" server side interception - /// point. It will be used as the first interception point and it is - /// proprietary to TAO. - /// @@ Will go away once Bug 1369 is fixed - void tao_ft_interception_point ( - TAO_ServerRequestInfo *ri , - CORBA::OctetSeq_out oc - ACE_ENV_ARG_DECL); + /// This method implements the "starting" server side interception + /// point. It will be used as the first interception point and it is + /// proprietary to TAO. + /// @@ Will go away once Bug 1369 is fixed + void tao_ft_interception_point (TAO::ServerRequestInfo * ri , + CORBA::OctetSeq_out oc + ACE_ENV_ARG_DECL); #endif /*TAO_HAS_EXTENDED_FT_INTERCEPTORS*/ - /// This method implements the "intermediate" server side interception - /// point if the above #ifdef is set to 1 and a starting intercetion - /// point if it is not set to 1. - /// @@ NOTE: This method should have been the "starting" - /// interception point according to the interceptor spec. This will - /// be fixed once Bug 1369 is completely done. - void receive_request_service_contexts ( - TAO_ServerRequestInfo * ri - ACE_ENV_ARG_DECL); - - /// This method an "intermediate" server side interception point. - void receive_request (TAO_ServerRequestInfo * ri - ACE_ENV_ARG_DECL); - - /// This method implements one of the "ending" server side - /// interception points. - void send_reply (TAO_ServerRequestInfo * ri - ACE_ENV_ARG_DECL); - - /// This method implements one of the "ending" server side - /// interception points. - void send_exception (TAO_ServerRequestInfo * ri - ACE_ENV_ARG_DECL); - - /// This method implements one of the "ending" server side - /// interception points. - void send_other (TAO_ServerRequestInfo * ri - ACE_ENV_ARG_DECL); - //@} - - /// Returns true if a LOCATION_FORWARD was generated, and false - /// otherwise. - CORBA::Boolean location_forwarded (void) const; - -private: - - /// Reference to the list of registered interceptors. - TAO_ServerRequestInterceptor_List::TYPE & interceptors_; - - /// Cache the length of the interceptor list so that we don't have - /// to compute it at each stage of the current interception. - const size_t len_; - - /// The number of interceptors "pushed" onto the logical flow - /// stack. This is used when unwinding the flow stack. - size_t & stack_size_; - - /// True if a PortableInterceptor::ForwardRequest exception was - /// thrown. - CORBA::Boolean location_forwarded_; - -}; + /// This method implements the "intermediate" server side + /// interception point if the above #ifdef is set to 1 and a + /// starting intercetion point if it is not set to 1. + /// + /// @note This method should have been the "starting" interception + /// point according to the interceptor spec. This will be + /// fixed once Bug 1369 is completely done. + void receive_request_service_contexts (TAO::ServerRequestInfo * ri + ACE_ENV_ARG_DECL); + + /// This method an "intermediate" server side interception point. + void receive_request (TAO::ServerRequestInfo * ri + ACE_ENV_ARG_DECL); + + /// This method implements one of the "ending" server side + /// interception points. + void send_reply (TAO::ServerRequestInfo * ri + ACE_ENV_ARG_DECL); + + /// This method implements one of the "ending" server side + /// interception points. + void send_exception (TAO::ServerRequestInfo * ri + ACE_ENV_ARG_DECL); + + /// This method implements one of the "ending" server side + /// interception points. + void send_other (TAO::ServerRequestInfo * ri + ACE_ENV_ARG_DECL); + //@} + + /// Returns true if a LOCATION_FORWARD was generated, and false + /// otherwise. + bool location_forwarded (void) const; + + private: + + /// Reference to the list of registered interceptors. + TAO_ServerRequestInterceptor_List::TYPE & interceptors_; + + /// Cache the length of the interceptor list so that we don't have + /// to compute it at each stage of the current interception. + size_t const len_; + + /// The number of interceptors "pushed" onto the logical flow + /// stack. This is used when unwinding the flow stack. + size_t & stack_size_; + + /// True if a PortableInterceptor::ForwardRequest exception was + /// thrown. + bool location_forwarded_; + + }; + +} // End namespace TAO + #if defined (__ACE_INLINE__) # include "ServerInterceptorAdapter.inl" diff --git a/TAO/tao/PortableServer/ServerInterceptorAdapter.inl b/TAO/tao/PortableServer/ServerInterceptorAdapter.inl index 45c3bbfd4d8..30e0c4508ce 100644 --- a/TAO/tao/PortableServer/ServerInterceptorAdapter.inl +++ b/TAO/tao/PortableServer/ServerInterceptorAdapter.inl @@ -2,19 +2,8 @@ // // $Id$ -ACE_INLINE -TAO_ServerRequestInterceptor_Adapter::TAO_ServerRequestInterceptor_Adapter - (TAO_ServerRequestInterceptor_List::TYPE & interceptors, - size_t & stack_size) - : interceptors_ (interceptors), - len_ (interceptors.size ()), - stack_size_ (stack_size), - location_forwarded_ (0) -{ -} - -ACE_INLINE CORBA::Boolean -TAO_ServerRequestInterceptor_Adapter::location_forwarded (void) const +ACE_INLINE bool +TAO::ServerRequestInterceptor_Adapter::location_forwarded (void) const { return this->location_forwarded_; } diff --git a/TAO/tao/PortableServer/ServerRequestInfo.cpp b/TAO/tao/PortableServer/ServerRequestInfo.cpp index 4e6dbc4bda3..f9de6afb8eb 100644 --- a/TAO/tao/PortableServer/ServerRequestInfo.cpp +++ b/TAO/tao/PortableServer/ServerRequestInfo.cpp @@ -1,3 +1,5 @@ +// $Id$ + #include "ServerRequestInfo.h" #if (TAO_HAS_INTERCEPTORS == 1) @@ -8,11 +10,15 @@ ACE_RCSID (PortableServer, #include "Root_POA.h" #include "Servant_Upcall.h" +#include "Servant_Base.h" #include "tao/TAO_Server_Request.h" #include "tao/ORB_Core.h" #include "tao/PolicyC.h" +#include "tao/DynamicC.h" #include "tao/ORB_Core.h" +#include "tao/Service_Context.h" +#include "tao/RequestInfo_Util.h" #include "ace/OS_NS_string.h" @@ -20,18 +26,9 @@ ACE_RCSID (PortableServer, # include "ServerRequestInfo.inl" # endif /* !__ACE_INLINE__ */ -TAO_ServerRequestInfo::TAO_ServerRequestInfo ( - TAO_ServerRequest &server_request, - TAO::Portable_Server::Servant_Upcall *servant_upcall) - : server_request_ (server_request), - servant_upcall_ (servant_upcall), - caught_exception_ (0), - reply_status_ (-1) -{ -} CORBA::ULong -TAO_ServerRequestInfo::request_id (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +TAO::ServerRequestInfo::request_id (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException)) { // The request ID returned by this method need not correspond to the @@ -75,32 +72,89 @@ TAO_ServerRequestInfo::request_id (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) } char * -TAO_ServerRequestInfo::operation (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +TAO::ServerRequestInfo::operation (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException)) { return CORBA::string_dup (this->server_request_.operation ()); } Dynamic::ParameterList * -TAO_ServerRequestInfo::arguments (ACE_ENV_SINGLE_ARG_DECL) +TAO::ServerRequestInfo::arguments (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14, - CORBA::COMPLETED_NO), - 0); + if (this->args_ == 0) + { + ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14, + CORBA::COMPLETED_NO), + 0); + } + + // Generate the argument list on demand. + Dynamic::ParameterList * const parameter_list = + TAO_RequestInfo_Util::make_parameter_list (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + Dynamic::ParameterList_var safe_parameter_list = parameter_list; + + // Return value is always generated as first TAO::Argument in + // skeleton. It shouldn't be included in the parameter list. + // Skip it. + + TAO::Argument * const * const begin = this->args_ + 1; + TAO::Argument * const * const end = this->args_ + this->nargs_; + + ACE_ASSERT (end - begin >= 0); + + parameter_list->length (static_cast<CORBA::ULong> (end - begin)); + + CORBA::ULong p = 0; + for (TAO::Argument * const * i = begin; i != end; ++i, ++p) + { + // Insert the operation parameters into the + // Dynamic::ParameterList. + (*i)->interceptor_param ((*parameter_list)[p]); + } + + return safe_parameter_list._retn (); } Dynamic::ExceptionList * -TAO_ServerRequestInfo::exceptions (ACE_ENV_SINGLE_ARG_DECL) +TAO::ServerRequestInfo::exceptions (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14, - CORBA::COMPLETED_NO), - 0); + if (this->args_ == 0) + { + ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14, + CORBA::COMPLETED_NO), + 0); + } + + // Generate the exception list on demand. + Dynamic::ExceptionList * const exception_list = + TAO_RequestInfo_Util::make_exception_list (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + Dynamic::ExceptionList_var safe_exception_list = exception_list; + + exception_list->length (this->nexceptions_); + + CORBA::TypeCode_ptr const * const begin = this->exceptions_; + CORBA::TypeCode_ptr const * const end = + this->exceptions_ + this->nexceptions_; + + CORBA::ULong e = 0; + for (CORBA::TypeCode_ptr const * i = begin; i != end; ++i, ++e) + { + TAO_Pseudo_Object_Manager<CORBA::TypeCode> tcp_object ( + const_cast<CORBA::TypeCode_ptr *> (i), 1); + (*exception_list)[e] = tcp_object; + } + + return safe_exception_list._retn (); } Dynamic::ContextList * -TAO_ServerRequestInfo::contexts (ACE_ENV_SINGLE_ARG_DECL) +TAO::ServerRequestInfo::contexts (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14, @@ -109,7 +163,7 @@ TAO_ServerRequestInfo::contexts (ACE_ENV_SINGLE_ARG_DECL) } Dynamic::RequestContext * -TAO_ServerRequestInfo::operation_context (ACE_ENV_SINGLE_ARG_DECL) +TAO::ServerRequestInfo::operation_context (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14, @@ -118,23 +172,44 @@ TAO_ServerRequestInfo::operation_context (ACE_ENV_SINGLE_ARG_DECL) } CORBA::Any * -TAO_ServerRequestInfo::result (ACE_ENV_SINGLE_ARG_DECL) +TAO::ServerRequestInfo::result (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14, - CORBA::COMPLETED_NO), - 0); + if (this->args_ == 0) + { + ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14, + CORBA::COMPLETED_NO), + 0); + } + + // Generate the result on demand. + + static CORBA::Boolean const tk_void_any = 1; + + CORBA::Any * result_any = + TAO_RequestInfo_Util::make_any (tk_void_any + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + CORBA::Any_var safe_result_any = result_any; + + // Result is always first element in TAO::Argument array. + TAO::Argument * const r = this->args_[0]; + + r->interceptor_result (result_any); + + return safe_result_any._retn (); } CORBA::Boolean -TAO_ServerRequestInfo::response_expected (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +TAO::ServerRequestInfo::response_expected (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException)) { return this->server_request_.response_expected (); } Messaging::SyncScope -TAO_ServerRequestInfo::sync_scope (ACE_ENV_SINGLE_ARG_DECL) +TAO::ServerRequestInfo::sync_scope (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { if (this->server_request_.sync_with_server ()) @@ -146,7 +221,7 @@ TAO_ServerRequestInfo::sync_scope (ACE_ENV_SINGLE_ARG_DECL) } PortableInterceptor::ReplyStatus -TAO_ServerRequestInfo::reply_status (ACE_ENV_SINGLE_ARG_DECL) +TAO::ServerRequestInfo::reply_status (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { if (this->reply_status_ == -1) @@ -159,7 +234,7 @@ TAO_ServerRequestInfo::reply_status (ACE_ENV_SINGLE_ARG_DECL) } CORBA::Object_ptr -TAO_ServerRequestInfo::forward_reference (ACE_ENV_SINGLE_ARG_DECL) +TAO::ServerRequestInfo::forward_reference (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { if (this->reply_status_ != PortableInterceptor::LOCATION_FORWARD) @@ -173,8 +248,8 @@ TAO_ServerRequestInfo::forward_reference (ACE_ENV_SINGLE_ARG_DECL) } CORBA::Any * -TAO_ServerRequestInfo::get_slot (PortableInterceptor::SlotId id - ACE_ENV_ARG_DECL) +TAO::ServerRequestInfo::get_slot (PortableInterceptor::SlotId id + ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, PortableInterceptor::InvalidSlot)) { @@ -197,7 +272,7 @@ TAO_ServerRequestInfo::get_slot (PortableInterceptor::SlotId id } IOP::ServiceContext * -TAO_ServerRequestInfo::get_request_service_context ( +TAO::ServerRequestInfo::get_request_service_context ( IOP::ServiceId id ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) @@ -211,12 +286,12 @@ TAO_ServerRequestInfo::get_request_service_context ( } IOP::ServiceContext * -TAO_ServerRequestInfo::get_reply_service_context ( +TAO::ServerRequestInfo::get_reply_service_context ( IOP::ServiceId id ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - TAO_Service_Context &service_context_list = + TAO_Service_Context & service_context_list = this->server_request_.reply_service_context (); return this->get_service_context_i (service_context_list, @@ -225,8 +300,8 @@ TAO_ServerRequestInfo::get_reply_service_context ( } IOP::ServiceContext * -TAO_ServerRequestInfo::get_service_context_i ( - TAO_Service_Context &service_context_list, +TAO::ServerRequestInfo::get_service_context_i ( + TAO_Service_Context & service_context_list, IOP::ServiceId id ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) @@ -251,7 +326,7 @@ TAO_ServerRequestInfo::get_service_context_i ( // exception from an Any. This method is in place just to be compliant // with the spec. CORBA::Any * -TAO_ServerRequestInfo::sending_exception (ACE_ENV_SINGLE_ARG_DECL) +TAO::ServerRequestInfo::sending_exception (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { if (this->reply_status_ != PortableInterceptor::SYSTEM_EXCEPTION @@ -285,17 +360,8 @@ TAO_ServerRequestInfo::sending_exception (ACE_ENV_SINGLE_ARG_DECL) return caught_exception._retn (); } -// = TAO specific method done since there currently is no simple way -// to extract exceptions from an Any -CORBA::Exception * -TAO_ServerRequestInfo::_sending_exception (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->caught_exception_; -} - char * -TAO_ServerRequestInfo::server_id (ACE_ENV_SINGLE_ARG_DECL) +TAO::ServerRequestInfo::server_id (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { if (this->servant_upcall_ != 0) @@ -309,7 +375,7 @@ TAO_ServerRequestInfo::server_id (ACE_ENV_SINGLE_ARG_DECL) } char * -TAO_ServerRequestInfo::orb_id (ACE_ENV_SINGLE_ARG_DECL) +TAO::ServerRequestInfo::orb_id (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { if (this->servant_upcall_ != 0) @@ -322,7 +388,7 @@ TAO_ServerRequestInfo::orb_id (ACE_ENV_SINGLE_ARG_DECL) } PortableInterceptor::AdapterName * -TAO_ServerRequestInfo::adapter_name (ACE_ENV_SINGLE_ARG_DECL) +TAO::ServerRequestInfo::adapter_name (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { // The adapter_name attribute defines a name for the object adapter @@ -341,7 +407,7 @@ TAO_ServerRequestInfo::adapter_name (ACE_ENV_SINGLE_ARG_DECL) } PortableInterceptor::ObjectId * -TAO_ServerRequestInfo::object_id (ACE_ENV_SINGLE_ARG_DECL) +TAO::ServerRequestInfo::object_id (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { if (this->servant_upcall_ != 0) @@ -384,7 +450,7 @@ TAO_ServerRequestInfo::object_id (ACE_ENV_SINGLE_ARG_DECL) } CORBA::OctetSeq * -TAO_ServerRequestInfo::adapter_id (ACE_ENV_SINGLE_ARG_DECL) +TAO::ServerRequestInfo::adapter_id (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { if (this->servant_upcall_ != 0) @@ -396,20 +462,28 @@ TAO_ServerRequestInfo::adapter_id (ACE_ENV_SINGLE_ARG_DECL) } char * -TAO_ServerRequestInfo::target_most_derived_interface ( +TAO::ServerRequestInfo::target_most_derived_interface ( ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - // Implemented in the generated skeleton. + PortableServer::Servant const servant = + (this->servant_upcall_ == 0 + ? 0 + : this->servant_upcall_->servant ()); - ACE_THROW_RETURN (CORBA::NO_RESOURCES (CORBA::OMGVMCID | 1, - CORBA::COMPLETED_NO), - 0); + if (servant == 0) + { + ACE_THROW_RETURN (CORBA::NO_RESOURCES (CORBA::OMGVMCID | 1, + CORBA::COMPLETED_NO), + 0); + } + + return CORBA::string_dup (servant->_interface_repository_id ()); } CORBA::Policy_ptr -TAO_ServerRequestInfo::get_server_policy (CORBA::PolicyType type - ACE_ENV_ARG_DECL) +TAO::ServerRequestInfo::get_server_policy (CORBA::PolicyType type + ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { if (this->servant_upcall_ != 0) @@ -440,9 +514,9 @@ TAO_ServerRequestInfo::get_server_policy (CORBA::PolicyType type } void -TAO_ServerRequestInfo::set_slot (PortableInterceptor::SlotId id, - const CORBA::Any &data - ACE_ENV_ARG_DECL) +TAO::ServerRequestInfo::set_slot (PortableInterceptor::SlotId id, + const CORBA::Any &data + ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, PortableInterceptor::InvalidSlot)) { @@ -465,18 +539,31 @@ TAO_ServerRequestInfo::set_slot (PortableInterceptor::SlotId id, } CORBA::Boolean -TAO_ServerRequestInfo::target_is_a (const char * /* id */ - ACE_ENV_ARG_DECL) +TAO::ServerRequestInfo::target_is_a (const char * id + ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { // Implemented in the generated skeleton. - ACE_THROW_RETURN (CORBA::NO_RESOURCES (CORBA::OMGVMCID | 1, - CORBA::COMPLETED_NO), 0); + PortableServer::Servant const servant = + (this->servant_upcall_ == 0 + ? 0 + : this->servant_upcall_->servant ()); + + + if (servant == 0) + { + ACE_THROW_RETURN (CORBA::NO_RESOURCES (CORBA::OMGVMCID | 1, + CORBA::COMPLETED_NO), + 0); + } + + return servant->_is_a (id + ACE_ENV_ARG_PARAMETER); } void -TAO_ServerRequestInfo::add_reply_service_context ( +TAO::ServerRequestInfo::add_reply_service_context ( const IOP::ServiceContext & service_context, CORBA::Boolean replace ACE_ENV_ARG_DECL) diff --git a/TAO/tao/PortableServer/ServerRequestInfo.h b/TAO/tao/PortableServer/ServerRequestInfo.h index eabc646c982..1cc2cd261ed 100644 --- a/TAO/tao/PortableServer/ServerRequestInfo.h +++ b/TAO/tao/PortableServer/ServerRequestInfo.h @@ -7,10 +7,10 @@ * $Id$ * * This is the implementation of the - * PortableInterceptor::ServerRequestInfo interface. + * @c PortableInterceptor::ServerRequestInfo interface. * * @author Kirthika Parameswaran <kirthika@cs.wustl.edu> - * @author Ossama Othman <ossama@uci.edu> + * @author Ossama Othman */ //============================================================================= @@ -19,14 +19,12 @@ #include /**/ "ace/pre.h" -#include "portableserver_export.h" +#include "tao/orbconf.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "tao/orbconf.h" - #if (TAO_HAS_INTERCEPTORS == 1) #include "tao/PortableInterceptorC.h" @@ -50,239 +48,267 @@ namespace TAO } } -/** - * @class TAO_ServerRequestInfo - * - * @brief Implementation of the PortableInterceptor::ServerRequestInfo - * interface. - */ -class TAO_PortableServer_Export TAO_ServerRequestInfo - : public virtual PortableInterceptor::ServerRequestInfo, - public virtual CORBA::LocalObject +namespace TAO { -public: - - /// Constructor. - TAO_ServerRequestInfo (TAO_ServerRequest &server_request, - TAO::Portable_Server::Servant_Upcall *servant_upcall); - - /// Return an ID unique to the current request. This request ID may - /// or may not be the same as the GIOP request ID. - virtual CORBA::ULong request_id ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /// Return the operation name for the current request. - virtual char * operation ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /// Return the list of arguments passed to the current operation. - virtual Dynamic::ParameterList * arguments ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /// Return the list of exceptions the current operation is capable - /// of throwing. - virtual Dynamic::ExceptionList * exceptions ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual Dynamic::ContextList * contexts ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual Dynamic::RequestContext * operation_context ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /// Return the result of the current request. If there is no return - /// value then an Any with tk_void TypeCode is returned. This - /// method is not valid for oneway operations. - virtual CORBA::Any * result ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /// Returns true for a two-way operation, and false otherwise. - virtual CORBA::Boolean response_expected ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /// Return the sync_scope policy value for the current one-way - /// operation. If the operation is not a one-way, a - /// CORBA::BAD_INV_ORDER exception is thrown. - virtual Messaging::SyncScope sync_scope ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /// Return the reply status for the current request. Statuses can - /// be PortableInterceptor::SUCCESSFUL, SYSTEM_EXCEPTION, - /// USER_EXCEPTION, LOCATION_FORWARD, LOCATION_FORWARD_PERMANENT, - /// TRANSPORT_RETRY. - virtual PortableInterceptor::ReplyStatus reply_status ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /// If the reply status is PortableInterceptor::LOCATION_FORWARD or - /// PortableInterceptor::LOCATION_FORWARD_PERMANENT, return the - /// object reference to which the request was forwarded. - virtual CORBA::Object_ptr forward_reference ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)) ; - - /// Retrieve data from the "request scope" PICurrent object. - virtual CORBA::Any * get_slot ( - PortableInterceptor::SlotId id - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::InvalidSlot)); - - /// Return the IOP::ServiceContext with the given IOP::ServiceId - /// from the request service context list. - virtual IOP::ServiceContext * get_request_service_context ( - IOP::ServiceId id - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /// Return the IOP::ServiceContext with the given IOP::ServiceId - /// from the reply service context list. - virtual IOP::ServiceContext * get_reply_service_context ( - IOP::ServiceId id - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /// Return an Any containing the exception being sent, if any. - /// Otherwise, throw a CORBA::BAD_INV_ORDER exception. - /** - * @note There is no trivial way to extract the exception from an Any. - */ - virtual CORBA::Any * sending_exception ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /** - * @note This is TAO specific and was done to combat the previous - * problem to some extent. Avoid this method whenever - * possible. - */ - virtual CORBA::Exception * _sending_exception ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /// Return the ObjectId for the target object. - virtual PortableInterceptor::ObjectId * object_id ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /// Return the AdapterId for the POA handling the current request. - virtual CORBA::OctetSeq * adapter_id ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /// Return the server_id of the server. The value is passed to - /// the ORB via -ORBServerId parameter. - virtual char * server_id (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /// Return the ORBId value that is passed to the ORB::Init call. - virtual char * orb_id (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /// Return the name of the object adapter that services requests for - /// the invoked object. - virtual PortableInterceptor::AdapterName * adapter_name ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /// Return the most derived interface of the target object. - virtual char * target_most_derived_interface ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /// Return the policy of the given type in effect for the current - /// request. - virtual CORBA::Policy_ptr get_server_policy ( - CORBA::PolicyType type - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /// Insert data into the "request scope" PICurrent object. - virtual void set_slot ( - PortableInterceptor::SlotId id, - const CORBA::Any & data - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableInterceptor::InvalidSlot)); - - /// Returns true if the target's type corresponds to the given - /// RepositoryId. - virtual CORBA::Boolean target_is_a ( - const char * id - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - - /// Add the IOP::ServiceContext to the reply (outgoing) - /// IOP::ServiceContextList. - virtual void add_reply_service_context ( - const IOP::ServiceContext & service_context, - CORBA::Boolean replace - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - -public: - /** - * @name Helper methods specific to TAO. + * @class ServerRequestInfo + * + * @brief Implementation of the + * @c PortableInterceptor::ServerRequestInfo IDL interface. + * + * Implementation of the @c PortableInterceptor::ServerRequestInfo + * IDL interface. + * + * @note This class is currently not meant to be reference counted + * since it is instantiated on the stack. */ - //@{ - - /// Change the exception status. - void exception (CORBA::Exception *exception); - - /// Set the status of the received reply. - void reply_status (PortableInterceptor::ReplyStatus s); - - /// Extract the forward object reference from the - /// PortableInterceptor::ForwardRequest exception, and set the reply - /// status flag accordingly. - void forward_reference (PortableInterceptor::ForwardRequest &exc); - - /// Set the forward reference associated with the current - /// LOCATION_FORWARD reply. This method is only invoked when a - /// PortableServer::ForwardRequest exception is thrown by a servant - /// manager. - void forward_reference (CORBA::Object_ptr obj); - - //@} - - /// Return a reference to the underlying TAO_ServerRequest object. - TAO_ServerRequest &server_request (void); - -protected: - - /// Helper method to get the request and response service contexts. - IOP::ServiceContext *get_service_context_i ( - TAO_Service_Context &service_context_list, - IOP::ServiceId id - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - -protected: - - /// Underlying request object that contains much of the information - /// encapsulated by this TAO_ServerRequestInfo class. - TAO_ServerRequest &server_request_; + class ServerRequestInfo + : public virtual PortableInterceptor::ServerRequestInfo, + public virtual CORBA::LocalObject + { + public: + + /// Constructor. + ServerRequestInfo (TAO_ServerRequest & server_request, + TAO::Argument * const * args, + size_t nargs, + void * servant_upcall, + CORBA::TypeCode_ptr const exceptions[], + size_t nexceptions); + + /// Return an ID unique to the current request. This request ID may + /// or may not be the same as the GIOP request ID. + virtual CORBA::ULong request_id (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Return the operation name for the current request. + virtual char * operation (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Return the list of arguments passed to the current operation. + virtual Dynamic::ParameterList * arguments ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Return the list of exceptions the current operation is capable + /// of throwing. + virtual Dynamic::ExceptionList * exceptions ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual Dynamic::ContextList * contexts ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual Dynamic::RequestContext * operation_context ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Return the result of the current request. If there is no + /// return value then an @c Any with @c tk_void @c TypeCode is + /// returned. This method is not valid for oneway operations. + virtual CORBA::Any * result ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Returns @c true for a two-way operation, and @c false otherwise. + virtual CORBA::Boolean response_expected ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Return the @c sync_scope policy value for the current one-way + /// operation. If the operation is not a one-way, a + /// @c CORBA::BAD_INV_ORDER exception is thrown. + virtual Messaging::SyncScope sync_scope ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Return the reply status for the current request. + /** + * Statuses can be @c PortableInterceptor::SUCCESSFUL, + * @c SYSTEM_EXCEPTION, @c USER_EXCEPTION, @c LOCATION_FORWARD, + * @c LOCATION_FORWARD_PERMANENT, @c TRANSPORT_RETRY. + */ + virtual PortableInterceptor::ReplyStatus reply_status ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// If the reply status is + /// @c PortableInterceptor::LOCATION_FORWARD or + /// @c PortableInterceptor::LOCATION_FORWARD_PERMANENT, return the + /// object reference to which the request was forwarded. + virtual CORBA::Object_ptr forward_reference ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)) ; + + /// Retrieve data from the "request scope" @c PICurrent object. + virtual CORBA::Any * get_slot ( + PortableInterceptor::SlotId id + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::InvalidSlot)); + + /// Return the @c IOP::ServiceContext with the given + /// @c IOP::ServiceId from the request service context list. + virtual IOP::ServiceContext * get_request_service_context ( + IOP::ServiceId id + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Return the @c IOP::ServiceContext with the given + /// @c IOP::ServiceId from the reply service context list. + virtual IOP::ServiceContext * get_reply_service_context ( + IOP::ServiceId id + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Return an @c Any containing the exception being sent, if any. + /// Otherwise, throw a @c CORBA::BAD_INV_ORDER exception. + /** + * @note There is no trivial way to extract the exception from an + * @c Any. + */ + virtual CORBA::Any * sending_exception ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Return the @c ObjectId for the target object. + virtual PortableInterceptor::ObjectId * object_id ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Return the @c AdapterId for the POA handling the current + /// request. + virtual CORBA::OctetSeq * adapter_id ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Return the server_id of the server. The value is passed to + /// the ORB via @c -ORBServerId parameter. + virtual char * server_id (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Return the ORBId value that is passed to the @c ORB_init + /// call. + virtual char * orb_id (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Return the name of the object adapter that services requests + /// for the invoked object. + virtual PortableInterceptor::AdapterName * adapter_name ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Return the most derived interface of the target object. + virtual char * target_most_derived_interface ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Return the policy of the given type in effect for the current + /// request. + virtual CORBA::Policy_ptr get_server_policy ( + CORBA::PolicyType type + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Insert data into the "request scope" @c PICurrent object. + virtual void set_slot (PortableInterceptor::SlotId id, + const CORBA::Any & data + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableInterceptor::InvalidSlot)); + + /// Returns true if the target's type corresponds to the given + /// @c RepositoryId. + virtual CORBA::Boolean target_is_a (const char * id + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Add the @c IOP::ServiceContext to the reply (outgoing) + /// @c IOP::ServiceContextList. + virtual void add_reply_service_context ( + const IOP::ServiceContext & service_context, + CORBA::Boolean replace + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + public: + + /** + * @name Helper methods specific to TAO. + */ + //@{ + + /// Change the exception status. + void exception (CORBA::Exception *exception); + + /// Set the status of the received reply. + void reply_status (PortableInterceptor::ReplyStatus s); + + /// Extract the forward object reference from the + /// @c PortableInterceptor::ForwardRequest exception, and set the + /// reply status flag accordingly. + void forward_reference (PortableInterceptor::ForwardRequest &exc); + + /// Set the forward reference associated with the current + /// LOCATION_FORWARD reply. + /** + * @note This method is only invoked when a + * @c PortableServer::ForwardRequest exception is thrown by a + * servant manager. + */ + void forward_reference (CORBA::Object_ptr obj); + + //@} + + /// Return a reference to the underlying @c TAO_ServerRequest + /// object. + TAO_ServerRequest &server_request (void); + + protected: + + /// Helper method to get the request and response service + /// contexts. + IOP::ServiceContext * get_service_context_i ( + TAO_Service_Context & service_context_list, + IOP::ServiceId id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + + /// Underlying request object that contains much of the + /// information encapsulated by this @c ServerRequestInfo + /// implementation. + TAO_ServerRequest & server_request_; + + /// Operation argument list. + TAO::Argument * const * const args_; + + /// Number of element in the operation argument list. + size_t const nargs_; + + /// Pointer to the @c Servant_Upcall object that contains the + /// object ID, among other things. + TAO::Portable_Server::Servant_Upcall * const servant_upcall_; + + /// Array of @c TypeCodes for user exceptions the operation is + /// capable of raising. + CORBA::TypeCode_ptr const * const exceptions_; + + /// The number of elements in the @c exceptions_ array. + size_t const nexceptions_; - /// Pointer to the Servant_Upcall object that contains the object - /// ID, among other things. - TAO::Portable_Server::Servant_Upcall *servant_upcall_; + /// Pointer to the caught exception. + CORBA::Exception * caught_exception_; + + /// Reply status for the current request. + PortableInterceptor::ReplyStatus reply_status_; + + }; - /// Pointer to the caught exception. - CORBA::Exception *caught_exception_; +} // End namespace TAO - /// Reply status for the current request. - PortableInterceptor::ReplyStatus reply_status_; -}; # if defined (__ACE_INLINE__) # include "ServerRequestInfo.inl" diff --git a/TAO/tao/PortableServer/ServerRequestInfo.inl b/TAO/tao/PortableServer/ServerRequestInfo.inl index c3a98809fd1..838b5d3fc8b 100644 --- a/TAO/tao/PortableServer/ServerRequestInfo.inl +++ b/TAO/tao/PortableServer/ServerRequestInfo.inl @@ -2,8 +2,31 @@ // // $Id$ +#include "tao/PortableServer/Servant_Upcall.h" + + +ACE_INLINE +TAO::ServerRequestInfo::ServerRequestInfo ( + TAO_ServerRequest & server_request, + TAO::Argument * const * args, + size_t nargs, + void * servant_upcall, + CORBA::TypeCode_ptr const exceptions[], + size_t nexceptions) + : server_request_ (server_request) + , args_ (args) + , nargs_ (nargs) + , servant_upcall_ ( + static_cast<TAO::Portable_Server::Servant_Upcall *> (servant_upcall)) + , exceptions_ (exceptions) + , nexceptions_ (nexceptions) + , caught_exception_ (0) + , reply_status_ (-1) +{ +} + ACE_INLINE void -TAO_ServerRequestInfo::exception (CORBA::Exception *exception) +TAO::ServerRequestInfo::exception (CORBA::Exception * exception) { if (CORBA::SystemException::_downcast (exception) != 0) this->reply_status_ = PortableInterceptor::SYSTEM_EXCEPTION; @@ -16,13 +39,13 @@ TAO_ServerRequestInfo::exception (CORBA::Exception *exception) } ACE_INLINE void -TAO_ServerRequestInfo::reply_status (PortableInterceptor::ReplyStatus s) +TAO::ServerRequestInfo::reply_status (PortableInterceptor::ReplyStatus s) { this->reply_status_ = s; } ACE_INLINE void -TAO_ServerRequestInfo::forward_reference ( +TAO::ServerRequestInfo::forward_reference ( PortableInterceptor::ForwardRequest &exc) { // Note that we're converting the ForwardRequest exception in to a @@ -35,7 +58,7 @@ TAO_ServerRequestInfo::forward_reference ( } ACE_INLINE void -TAO_ServerRequestInfo::forward_reference (CORBA::Object_ptr obj) +TAO::ServerRequestInfo::forward_reference (CORBA::Object_ptr obj) { // We only get here if a servant manager threw a // PortableServer::ForwardRequest exception. @@ -47,7 +70,7 @@ TAO_ServerRequestInfo::forward_reference (CORBA::Object_ptr obj) } ACE_INLINE TAO_ServerRequest & -TAO_ServerRequestInfo::server_request (void) +TAO::ServerRequestInfo::server_request (void) { return this->server_request_; } diff --git a/TAO/tao/Special_Basic_SArgument_T.cpp b/TAO/tao/PortableServer/Special_Basic_SArgument_T.cpp index c997f057d98..515032f91a2 100644 --- a/TAO/tao/Special_Basic_SArgument_T.cpp +++ b/TAO/tao/PortableServer/Special_Basic_SArgument_T.cpp @@ -1,18 +1,15 @@ // $Id$ -#ifndef TAO_SPECIAL_BASIC_SARGUMENT_T_C -#define TAO_SPECIAL_BASIC_SARGUMENT_T_C +#ifndef TAO_SPECIAL_BASIC_SARGUMENT_T_CPP +#define TAO_SPECIAL_BASIC_SARGUMENT_T_CPP -#include "tao/Special_Basic_SArgument_T.h" +#include "tao/PortableServer/Special_Basic_SArgument_T.h" #include "tao/Dynamic_ParameterC.h" #if !defined (__ACE_INLINE__) -#include "tao/Special_Basic_SArgument_T.inl" +#include "tao/PortableServer/Special_Basic_SArgument_T.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID (tao, - Special_Basic_SArgument_T, - "$Id$") // ============================================================ @@ -122,5 +119,4 @@ TAO::Ret_Special_Basic_SArgument_T<S,to_S,from_S>::interceptor_result ( #endif /* TAO_HAS_INTERCEPTORS */ -#endif /* TAO_SPECIAL_BASIC_SARGUMENT_T_C */ - +#endif /* TAO_SPECIAL_BASIC_SARGUMENT_T_CPP */ diff --git a/TAO/tao/Special_Basic_SArgument_T.h b/TAO/tao/PortableServer/Special_Basic_SArgument_T.h index fcd4254358c..e9ae2bee3b3 100644 --- a/TAO/tao/Special_Basic_SArgument_T.h +++ b/TAO/tao/PortableServer/Special_Basic_SArgument_T.h @@ -1,4 +1,4 @@ -// This may look like C, but it's really -*- C++ -*- +// -*- C++ -*- //============================================================================= /** @@ -6,7 +6,7 @@ * * $Id$ * - * @authors Jeff Parsons and Carlos O'Ryan + * @authors Jeff Parsons, Carlos O'Ryan and Ossama Othman */ //============================================================================= @@ -16,12 +16,12 @@ #include /**/ "ace/pre.h" +#include "tao/Argument.h" + #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "tao/Argument.h" - namespace TAO { /** @@ -31,7 +31,7 @@ namespace TAO * */ template<typename S, typename to_S, typename from_S> - class TAO_Export In_Special_Basic_SArgument_T : public Argument + class In_Special_Basic_SArgument_T : public Argument { public: In_Special_Basic_SArgument_T (void); @@ -40,7 +40,7 @@ namespace TAO #if TAO_HAS_INTERCEPTORS == 1 virtual void interceptor_param (Dynamic::Parameter &); #endif /* TAO_HAS_INTERCEPTORS == 1 */ - S arg (void) const; + S const & arg (void) const; private: S x_; @@ -53,7 +53,7 @@ namespace TAO * */ template<typename S, typename to_S, typename from_S> - class TAO_Export Inout_Special_Basic_SArgument_T : public Argument + class Inout_Special_Basic_SArgument_T : public Argument { public: Inout_Special_Basic_SArgument_T (void); @@ -76,7 +76,7 @@ namespace TAO * */ template<typename S, typename to_S, typename from_S> - class TAO_Export Out_Special_Basic_SArgument_T : public Argument + class Out_Special_Basic_SArgument_T : public Argument { public: Out_Special_Basic_SArgument_T (void); @@ -98,7 +98,7 @@ namespace TAO * */ template<typename S, typename to_S, typename from_S> - class TAO_Export Ret_Special_Basic_SArgument_T : public Argument + class Ret_Special_Basic_SArgument_T : public Argument { public: Ret_Special_Basic_SArgument_T (void); @@ -121,7 +121,7 @@ namespace TAO * */ template<typename T, typename to_T, typename from_T> - struct TAO_Export Special_Basic_SArg_Traits_T + struct Special_Basic_SArg_Traits_T { typedef T ret_type; typedef T in_type; @@ -132,15 +132,23 @@ namespace TAO typedef Inout_Special_Basic_SArgument_T<T,to_T,from_T> inout_arg_val; typedef Out_Special_Basic_SArgument_T<T,to_T,from_T> out_arg_val; typedef Ret_Special_Basic_SArgument_T<T,to_T,from_T> ret_val; + + // Typedefs corresponding to return value of arg() method in both + // the client and server side argument class templates. + typedef T const & in_arg_type; + typedef inout_type inout_arg_type; + typedef out_type out_arg_type; + typedef out_type ret_arg_type; + }; }; #if defined (__ACE_INLINE__) -#include "tao/Special_Basic_SArgument_T.inl" +#include "tao/PortableServer/Special_Basic_SArgument_T.inl" #endif /* __ACE_INLINE__ */ #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "tao/Special_Basic_SArgument_T.cpp" +#include "tao/PortableServer/Special_Basic_SArgument_T.cpp" #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) diff --git a/TAO/tao/Special_Basic_SArgument_T.inl b/TAO/tao/PortableServer/Special_Basic_SArgument_T.inl index f6a161f7d09..a0fd902d4fd 100644 --- a/TAO/tao/Special_Basic_SArgument_T.inl +++ b/TAO/tao/PortableServer/Special_Basic_SArgument_T.inl @@ -1,3 +1,5 @@ +// -*- C++ -*- +// // $Id$ template<typename S, typename to_S, typename from_S> @@ -8,7 +10,7 @@ In_Special_Basic_SArgument_T (void) template<typename S, typename to_S, typename from_S> ACE_INLINE -S +S const & TAO::In_Special_Basic_SArgument_T<S,to_S,from_S>::arg (void) const { return this->x_; diff --git a/TAO/tao/Special_Basic_SArguments.cpp b/TAO/tao/PortableServer/Special_Basic_SArguments.cpp index ece6387e035..70f5f0c0eb6 100644 --- a/TAO/tao/Special_Basic_SArguments.cpp +++ b/TAO/tao/PortableServer/Special_Basic_SArguments.cpp @@ -1,8 +1,8 @@ // $Id$ -#include "tao/Special_Basic_SArguments.h" +#include "Special_Basic_SArguments.h" -ACE_RCSID (tao, +ACE_RCSID (PortableServer, Special_Basic_SArguments, "$Id$") diff --git a/TAO/tao/Special_Basic_SArguments.h b/TAO/tao/PortableServer/Special_Basic_SArguments.h index 6ecfb99b52f..b334c347597 100644 --- a/TAO/tao/Special_Basic_SArguments.h +++ b/TAO/tao/PortableServer/Special_Basic_SArguments.h @@ -15,14 +15,18 @@ #define TAO_SPECIAL_BASIC_SARGUMENTS_H #include /**/ "ace/pre.h" -#include "ace/CDR_Stream.h" + +#include "tao/PortableServer/portableserver_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "tao/Special_Basic_SArgument_T.h" -#include "Arg_Traits_T.h" +#include "tao/PortableServer/Special_Basic_SArgument_T.h" +#include "tao/Arg_Traits_T.h" + +#include "ace/CDR_Stream.h" + namespace TAO { @@ -33,7 +37,7 @@ namespace TAO */ template<> - class TAO_Export SArg_Traits<ACE_InputCDR::to_char> + class TAO_PortableServer_Export SArg_Traits<ACE_InputCDR::to_char> : public Special_Basic_SArg_Traits_T<CORBA::Char, ACE_InputCDR::to_char, ACE_OutputCDR::from_char> @@ -41,7 +45,7 @@ namespace TAO }; template<> - class TAO_Export SArg_Traits<ACE_InputCDR::to_wchar> + class TAO_PortableServer_Export SArg_Traits<ACE_InputCDR::to_wchar> : public Special_Basic_SArg_Traits_T<CORBA::WChar, ACE_InputCDR::to_wchar, ACE_OutputCDR::from_wchar> @@ -49,7 +53,7 @@ namespace TAO }; template<> - class TAO_Export SArg_Traits<ACE_InputCDR::to_octet> + class TAO_PortableServer_Export SArg_Traits<ACE_InputCDR::to_octet> : public Special_Basic_SArg_Traits_T<CORBA::Octet, ACE_InputCDR::to_octet, ACE_OutputCDR::from_octet> @@ -57,7 +61,7 @@ namespace TAO }; template<> - class TAO_Export SArg_Traits<ACE_InputCDR::to_boolean> + class TAO_PortableServer_Export SArg_Traits<ACE_InputCDR::to_boolean> : public Special_Basic_SArg_Traits_T<CORBA::Boolean, ACE_InputCDR::to_boolean, ACE_OutputCDR::from_boolean> diff --git a/TAO/tao/PortableServer/TypeCode_SArg_Traits.h b/TAO/tao/PortableServer/TypeCode_SArg_Traits.h new file mode 100644 index 00000000000..5a40a393b43 --- /dev/null +++ b/TAO/tao/PortableServer/TypeCode_SArg_Traits.h @@ -0,0 +1,56 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file TypeCode_SArg_Traits.h + * + * $Id$ + * + * @author Ossama Othman + */ +//============================================================================= + +#ifndef TAO_TYPECODE_SARG_TRAITS_H +#define TAO_TYPECODE_SARG_TRAITS_H + +#include /**/ "ace/pre.h" + +#include "tao/CORBA_methods.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/PortableServer/Object_SArgument_T.h" +#include "tao/Pseudo_VarOut_T.h" + + +namespace CORBA +{ + class TypeCode; + typedef TypeCode *TypeCode_ptr; + + typedef TAO_Pseudo_Var_T<TypeCode> TypeCode_var; + typedef TAO_Pseudo_Out_T<TypeCode, TypeCode_var> TypeCode_out; +} + +// -------------------------------------------------------------- + +namespace TAO +{ + template <typename T> class SArg_Traits; + + /// Used in generated code if CORBA::TypeCode is an argument or + /// return type. + ACE_TEMPLATE_SPECIALIZATION + class TAO_PortableServer_Export SArg_Traits<CORBA::TypeCode> + : public Object_SArg_Traits_T<CORBA::TypeCode_ptr, + CORBA::TypeCode_var, + CORBA::TypeCode_out> + { + }; +} + +#include /**/ "ace/post.h" + +#endif /* TAO_TYPECODE_SARG_TRAITS_H */ diff --git a/TAO/tao/UB_String_SArgument_T.cpp b/TAO/tao/PortableServer/UB_String_SArgument_T.cpp index 04844f9fea0..d73fa550b34 100644 --- a/TAO/tao/UB_String_SArgument_T.cpp +++ b/TAO/tao/PortableServer/UB_String_SArgument_T.cpp @@ -1,18 +1,15 @@ // $Id$ -#ifndef TAO_UB_STRING_SARGUMENT_T_C -#define TAO_UB_STRING_SARGUMENT_T_C +#ifndef TAO_UB_STRING_SARGUMENT_T_CPP +#define TAO_UB_STRING_SARGUMENT_T_CPP -#include "tao/UB_String_SArgument_T.h" +#include "tao/PortableServer/UB_String_SArgument_T.h" #include "tao/Dynamic_ParameterC.h" #if !defined (__ACE_INLINE__) -#include "tao/UB_String_SArgument_T.inl" +#include "tao/PortableServer/UB_String_SArgument_T.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID (tao, - UB_String_SArgument_T, - "$Id$") template<typename S, typename S_var> CORBA::Boolean @@ -108,4 +105,4 @@ TAO::Ret_UB_String_SArgument_T<S,S_var>::interceptor_result (CORBA::Any * any) #endif /* TAO_HAS_INTERCEPTORS */ -#endif /* TAO_UB_STRING_SARGUMENT_T_C */ +#endif /* TAO_UB_STRING_SARGUMENT_T_CPP */ diff --git a/TAO/tao/UB_String_SArgument_T.h b/TAO/tao/PortableServer/UB_String_SArgument_T.h index f6e2d0f6297..3f3faeaa299 100644 --- a/TAO/tao/UB_String_SArgument_T.h +++ b/TAO/tao/PortableServer/UB_String_SArgument_T.h @@ -1,4 +1,4 @@ -// This may look like C, but it's really -*- C++ -*- +// -*- C++ -*- //============================================================================= /** @@ -6,7 +6,7 @@ * * $Id$ * - * @authors Jeff Parsons and Carlos O'Ryan + * @authors Jeff Parsons, Carlos O'Ryan and Ossama Othman */ //============================================================================= @@ -14,6 +14,7 @@ #define TAO_UB_STRING_SARGUMENT_T_H #include /**/ "ace/pre.h" + #include "tao/Argument.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) @@ -38,7 +39,7 @@ namespace TAO #if TAO_HAS_INTERCEPTORS == 1 virtual void interceptor_param (Dynamic::Parameter &); #endif /* TAO_HAS_INTERCEPTORS == 1 */ - const S * arg (void) const; + S const * arg (void) const; private: S_var x_; @@ -129,15 +130,23 @@ namespace TAO typedef Inout_UB_String_SArgument_T<T,T_var> inout_arg_val; typedef Out_UB_String_SArgument_T<T,T_var> out_arg_val; typedef Ret_UB_String_SArgument_T<T,T_var> ret_val; + + // Typedefs corresponding to return value of arg() method in both + // the client and server side argument class templates. + typedef in_type in_arg_type; + typedef inout_type inout_arg_type; + typedef inout_type out_arg_type; + typedef inout_type ret_arg_type; + }; }; #if defined (__ACE_INLINE__) -#include "tao/UB_String_SArgument_T.inl" +#include "tao/PortableServer/UB_String_SArgument_T.inl" #endif /* __ACE_INLINE__ */ #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "tao/UB_String_SArgument_T.cpp" +#include "tao/PortableServer/UB_String_SArgument_T.cpp" #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) diff --git a/TAO/tao/UB_String_SArgument_T.inl b/TAO/tao/PortableServer/UB_String_SArgument_T.inl index daf8637012c..daf8637012c 100644 --- a/TAO/tao/UB_String_SArgument_T.inl +++ b/TAO/tao/PortableServer/UB_String_SArgument_T.inl diff --git a/TAO/tao/UB_String_SArguments.cpp b/TAO/tao/PortableServer/UB_String_SArguments.cpp index 217b9143790..ccc5b449a7e 100644 --- a/TAO/tao/UB_String_SArguments.cpp +++ b/TAO/tao/PortableServer/UB_String_SArguments.cpp @@ -1,8 +1,8 @@ // $Id$ -#include "tao/UB_String_SArguments.h" +#include "UB_String_SArguments.h" -ACE_RCSID (tao, +ACE_RCSID (PortableServer, Special_Basic_SArguments, "$Id$") @@ -11,10 +11,10 @@ ACE_RCSID (tao, template class TAO::SArg_Traits<CORBA::String>; template class TAO::SArg_Traits<CORBA::WString>; -template class TAO::UB_String_SArg_Traits_T<CORBA::Char, - CORBA::String_var, +template class TAO::UB_String_SArg_Traits_T<CORBA::Char, + CORBA::String_var, CORBA::String_out>; -template class TAO::UB_String_SArg_Traits_T<CORBA::WChar, +template class TAO::UB_String_SArg_Traits_T<CORBA::WChar, CORBA::WString_var, CORBA::WString_out>; diff --git a/TAO/tao/UB_String_SArguments.h b/TAO/tao/PortableServer/UB_String_SArguments.h index 1a2ee106a1a..d70ebf0e941 100644 --- a/TAO/tao/UB_String_SArguments.h +++ b/TAO/tao/PortableServer/UB_String_SArguments.h @@ -15,12 +15,13 @@ #include /**/ "ace/pre.h" -#include "tao/UB_String_SArgument_T.h" +#include "tao/PortableServer/portableserver_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/PortableServer/UB_String_SArgument_T.h" #include "tao/Arg_Traits_T.h" namespace TAO @@ -32,7 +33,7 @@ namespace TAO */ template<> - class TAO_Export SArg_Traits<CORBA::Char *> + class TAO_PortableServer_Export SArg_Traits<CORBA::Char *> : public UB_String_SArg_Traits_T<CORBA::Char, CORBA::String_var, CORBA::String_out> @@ -40,7 +41,7 @@ namespace TAO }; template<> - class TAO_Export SArg_Traits<CORBA::WChar *> + class TAO_PortableServer_Export SArg_Traits<CORBA::WChar *> : public UB_String_SArg_Traits_T<CORBA::WChar, CORBA::WString_var, CORBA::WString_out> diff --git a/TAO/tao/PortableServer/Upcall_Command.h b/TAO/tao/PortableServer/Upcall_Command.h new file mode 100644 index 00000000000..be65d5b2349 --- /dev/null +++ b/TAO/tao/PortableServer/Upcall_Command.h @@ -0,0 +1,54 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Upcall_Command.h + * + * $Id$ + * + * @author Ossama Othman + */ +//============================================================================= + +#ifndef TAO_UPCALL_COMMAND_H +#define TAO_UPCALL_COMMAND_H + +#include /**/ "ace/pre.h" + +#include "ace/CORBA_macros.h" + +#ifndef ACE_LACKS_PRAGMA_ONCE +# pragma once +#endif /* !ACE_LACKS_PRAGMA_ONCE */ + + +namespace TAO +{ + + /** + * @class Upcall_Command + * + * @brief "ABC" that all operation-specific command objects must + * subclass. + * + * The actual upcall into a servant is executed through a concrete + * @c Upcall_Command object. This is necessary to simplify upcall + * interactions in the presence of interceptors, such as when the + * @c send_exception() interception point must be invoked when the + * servant operation throws an exception. + */ + class Upcall_Command + { + public: + + /// Execute the upcall. + virtual void execute (ACE_ENV_SINGLE_ARG_DECL) = 0; + + }; + +} // End namespace TAO + + +#include /**/ "ace/post.h" + +#endif /* TAO_UPCALL_COMMAND_H */ diff --git a/TAO/tao/PortableServer/Upcall_Wrapper.cpp b/TAO/tao/PortableServer/Upcall_Wrapper.cpp new file mode 100644 index 00000000000..d5ecfac2d19 --- /dev/null +++ b/TAO/tao/PortableServer/Upcall_Wrapper.cpp @@ -0,0 +1,215 @@ +// $Id$ + +#include "Upcall_Wrapper.h" + +#include "Upcall_Command.h" + +#if TAO_HAS_INTERCEPTORS == 1 +# include "PICurrent_Guard.h" + +# include "tao/PortableInterceptor.h" +# include "tao/PortableServer/ServerRequestInfo.h" +# include "tao/PortableServer/ServerInterceptorAdapter.h" + +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + +#include "tao/TAO_Server_Request.h" +#include "tao/CDR.h" + + +ACE_RCSID (PortableServer, + Upcall_Wrapper, + "$Id$") + + +void +TAO::Upcall_Wrapper::upcall (TAO_ServerRequest & server_request, + TAO::Argument * const args[], + size_t nargs, + TAO::Upcall_Command & command + +#if TAO_HAS_INTERCEPTORS == 1 + , void * servant_upcall + , CORBA::TypeCode_ptr const exceptions[] + , size_t nexceptions +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + + ACE_ENV_ARG_DECL + ) +{ + if (server_request.incoming ()) + { + this->pre_upcall (*server_request.incoming (), + args, + nargs + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + +#if TAO_HAS_INTERCEPTORS == 1 + + TAO::ServerRequestInfo request_info (server_request, + args, + nargs, + servant_upcall, + exceptions, + nexceptions); + + TAO::ServerRequestInterceptor_Adapter interceptor_adapter (server_request); + + ACE_TRY + { + TAO::PICurrent_Guard pi_guard (server_request, + true /* Copy TSC to RSC */); + + // Invoke intermediate server side interception points. + interceptor_adapter.receive_request (&request_info + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // Don't bother performing the upcall if an interceptor caused a + // location forward. + if (!interceptor_adapter.location_forwarded ()) + { +#endif /* TAO_HAS_INTERCEPTORS */ + + // The actual upcall. + command.execute (ACE_ENV_SINGLE_ARG_PARAMETER); + TAO_INTERCEPTOR_CHECK; + +#if TAO_HAS_INTERCEPTORS == 1 + } + + // Do not execute the send_reply() interception point if an + // interceptor caused a location forward. The send_other() + // interception point should already have been executed by the + // ServerRequestInterceptor_Adapter object. + // + // It should actually be safe to call this interception point, + // regardless, since the interceptor flow stack should have been + // emptied by the send_other() interception point. Note that + // we'd still need to avoid resetting the reply status to + // SUCCESSFUL, however. + if (!interceptor_adapter.location_forwarded ()) + { + // No location forward by interceptors and successful upcall. + + request_info.reply_status (PortableInterceptor::SUCCESSFUL); + interceptor_adapter.send_reply (&request_info + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + } + ACE_CATCHANY + { + request_info.exception (&ACE_ANY_EXCEPTION); + interceptor_adapter.send_exception (&request_info + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + PortableInterceptor::ReplyStatus status = + request_info.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (status == PortableInterceptor::SYSTEM_EXCEPTION + || status == PortableInterceptor::USER_EXCEPTION) + { + ACE_RE_THROW; + } + } +# if defined (ACE_HAS_EXCEPTIONS) \ + && defined (ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS) + ACE_CATCHALL + { + CORBA::UNKNOWN ex; + + request_info.exception (&ex); + interceptor_adapter.send_exception (&request_info + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + PortableInterceptor::ReplyStatus status = + request_info.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (status == PortableInterceptor::SYSTEM_EXCEPTION) + ACE_TRY_THROW (ex); + } +# endif /* ACE_HAS_EXCEPTIONS && ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS */ + ACE_ENDTRY; + ACE_CHECK; +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + + if (server_request.response_expected () + && !server_request.sync_with_server ()) + { + server_request.init_reply (); + } + +#if TAO_HAS_INTERCEPTORS == 1 + // Don't bother marshaling inout/out/return values if an interceptor + // caused a location forward. + if (!interceptor_adapter.location_forwarded ()) +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + { + if (server_request.outgoing ()) + { + this->post_upcall (*server_request.outgoing (), + args, + nargs + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + } +} + +void +TAO::Upcall_Wrapper::pre_upcall (TAO_InputCDR & cdr, + TAO::Argument * const * args, + size_t nargs + ACE_ENV_ARG_DECL) +{ + // Demarshal the operation "in" and "inout" arguments, if any. + + // NOTE: The TAO::Argument corresponding to the return value is + // always the first element in the array, regardless of + // whether or not the return type is void. + + ACE_ASSERT (nargs != 0); + + TAO::Argument * const * const begin = args + 1; // Skip the return value. + TAO::Argument * const * const end = args + nargs; + + for (TAO::Argument * const * i = begin; i != end; ++i) + { + if (!(*i)->demarshal (cdr)) + { + TAO_InputCDR::throw_skel_exception (errno + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + } +} + +void +TAO::Upcall_Wrapper::post_upcall (TAO_OutputCDR & cdr, + TAO::Argument * const * args, + size_t nargs + ACE_ENV_ARG_DECL) +{ + // Marshal the operation "inout" and "out" arguments and return + // value, if any. + + TAO::Argument * const * const begin = args; + TAO::Argument * const * const end = args + nargs; + + for (TAO::Argument * const * i = begin; i != end; ++i) + { + if (!(*i)->marshal (cdr)) + { + TAO_OutputCDR::throw_skel_exception (errno + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + } +} diff --git a/TAO/tao/PortableServer/Upcall_Wrapper.h b/TAO/tao/PortableServer/Upcall_Wrapper.h index 1ac32dc06ee..f7c612e54fa 100644 --- a/TAO/tao/PortableServer/Upcall_Wrapper.h +++ b/TAO/tao/PortableServer/Upcall_Wrapper.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -6,6 +6,7 @@ * * $Id$ * + * @author Ossama Othman * @author Jeff Parsons * @author Carlos O'Ryan */ @@ -18,52 +19,105 @@ #include "portableserver_export.h" -#if !defined (ACE_LACKS_PRAGMA_ONCE) +#ifndef ACE_LACKS_PRAGMA_ONCE # pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ +#endif /* !ACE_LACKS_PRAGMA_ONCE */ -#include "ServerInterceptorAdapter.h" -#include "tao/SArgument_T.h" -#include "tao/TAO_Server_Request.h" +#include "tao/Basic_Types.h" +#include "tao/orbconf.h" +#include "ace/CORBA_macros.h" -/** - * @class TAO_Upcall_Wrapper - * - * @brief Wraps the activities of the _skel operations. - * - */ -class TAO_PortableServer_Export TAO_Upcall_Wrapper + +class TAO_ServantBase; +class TAO_ServerRequest; +class TAO_InputCDR; +class TAO_OutputCDR; + +namespace PortableServer { -public: - TAO_Upcall_Wrapper (TAO::SArgument * _tao_arguments, - size_t nargs, - TAO::SArgument * _tao_retval, - TAO_ServerRequest * _tao_server_request, - void * _tao_servant_upcall) - : arglist_ (_tao_arguments), - nargs_ (nargs), - retval (_tao_retval), - tao_server_request (_tao_server_request), - servant_upcall_ (_tao_servant_upcall) - {} - - virtual ~TAO_Upcall_Wrapper (void); - - void pre_upcall (void) - { - } + typedef ::TAO_ServantBase ServantBase; +} + - void post_upcall (void) +namespace TAO +{ + class Argument; + class Upcall_Command; + + /** + * @class Upcall_Wrapper + * + * @brief Wraps the activities of the _skel operations. + * + */ + class TAO_PortableServer_Export Upcall_Wrapper { - } - -private: - TAO::SArgument * arglist_; - size_t nargs_; - TAO::SArgument * retval_; - TAO_ServerRequest * tao_server_request_; - void * servant_upcall_; -}; + public: + + /** + * @note The TAO::Argument corresponding to the return value is + * always the first element in the array, regardless of + * whether or not the return type is void. + */ + + /// Perform the upcall. + /** + * @param server_request Object containing server side messaging + * operations (e.g. CDR reply construction, etc). + * @param args Operation argument list. + * @param nargs Number of arguments in the operation + * argument list. + * @param command @c Command object that performs the + * actual upcall into the servant. + * + * @param servant_upcall Object containing information for POA + * that dispatched the servant. + * @param servant The servant handling the upcall. + * @param exceptions Array of user exceptions the operation + * may raise. + * @param nexceptions The number of exceptions in the operation + * user exception array. + */ + void upcall (TAO_ServerRequest & server_request, + TAO::Argument * const args[], + size_t nargs, + TAO::Upcall_Command & command + +#if TAO_HAS_INTERCEPTORS == 1 + , void * servant_upcall + , CORBA::TypeCode_ptr const exceptions[] + , size_t nexceptions +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + + ACE_ENV_ARG_DECL); + + private: + + + /// Perform pre-upcall operations. + /** + * Perform pre-upcall operations, including operation @c IN and + * @c INOUT argument demarshaling. + */ + void pre_upcall (TAO_InputCDR & cdr, + TAO::Argument * const * args, + size_t nargs + ACE_ENV_ARG_DECL); + + /// Perform post-upcall operations. + /** + * Perform post-upcall operations, including operation @c INOUT + * and @c OUT argument marshaling. + */ + void post_upcall (TAO_OutputCDR & cdr, + TAO::Argument * const * args, + size_t nargs + ACE_ENV_ARG_DECL); + + }; + +} // End namespace TAO + #include /**/ "ace/post.h" diff --git a/TAO/tao/Var_Array_SArgument_T.cpp b/TAO/tao/PortableServer/Var_Array_SArgument_T.cpp index 216b9071d74..3bf33ee7e48 100644 --- a/TAO/tao/Var_Array_SArgument_T.cpp +++ b/TAO/tao/PortableServer/Var_Array_SArgument_T.cpp @@ -1,36 +1,35 @@ // $Id$ -#ifndef TAO_VAR_ARRAY_SARGUMENT_T_C -#define TAO_VAR_ARRAY_SARGUMENT_T_C +#ifndef TAO_VAR_ARRAY_SARGUMENT_T_CPP +#define TAO_VAR_ARRAY_SARGUMENT_T_CPP -#include "tao/Var_Array_SArgument_T.h" +#include "tao/PortableServer/Var_Array_SArgument_T.h" #include "tao/Dynamic_ParameterC.h" #if !defined (__ACE_INLINE__) -#include "tao/Var_Array_SArgument_T.inl" +#include "tao/PortableServer/Var_Array_SArgument_T.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID (tao, - Var_Array_SArgument_T, - "$Id$") -template<typename S, typename S_forany> +template<typename S, typename S_slice, typename S_forany> CORBA::Boolean -TAO::In_Var_Array_SArgument_T<S,S_forany>::demarshal (TAO_InputCDR &cdr) +TAO::In_Var_Array_SArgument_T<S, + S_slice, + S_forany>::demarshal (TAO_InputCDR & cdr) { - S_forany tmp (this->x_); - return cdr >> tmp; + return cdr >> this->x_; } #if TAO_HAS_INTERCEPTORS == 1 -template<typename S, typename S_forany> +template<typename S, typename S_slice, typename S_forany> void -TAO::In_Var_Array_SArgument_T<S,S_forany>::interceptor_param ( - Dynamic::Parameter & p - ) +TAO::In_Var_Array_SArgument_T<S, + S_slice, + S_forany>::interceptor_param ( + Dynamic::Parameter & p) { - p.argument <<= S_forany (this->x_); + p.argument <<= this->x_; p.mode = CORBA::PARAM_IN; } @@ -38,30 +37,32 @@ TAO::In_Var_Array_SArgument_T<S,S_forany>::interceptor_param ( // =========================================================== -template<typename S, typename S_forany> +template<typename S, typename S_slice, typename S_forany> CORBA::Boolean -TAO::Inout_Var_Array_SArgument_T<S,S_forany>::marshal (TAO_OutputCDR & cdr) +TAO::Inout_Var_Array_SArgument_T<S, + S_slice, + S_forany>::marshal (TAO_OutputCDR & cdr) { - return cdr << S_forany (this->x_); + return cdr << this->x_; } -template<typename S, typename S_forany> +template<typename S, typename S_slice, typename S_forany> CORBA::Boolean -TAO::Inout_Var_Array_SArgument_T<S,S_forany>::demarshal (TAO_InputCDR & cdr) +TAO::Inout_Var_Array_SArgument_T<S, + S_slice, + S_forany>::demarshal (TAO_InputCDR & cdr) { - S_forany tmp (this->x_); - return cdr >> tmp; + return cdr >> this->x_; } #if TAO_HAS_INTERCEPTORS == 1 -template<typename S, typename S_forany> +template<typename S, typename S_slice, typename S_forany> void -TAO::Inout_Var_Array_SArgument_T<S,S_forany>::interceptor_param ( - Dynamic::Parameter & p - ) +TAO::Inout_Var_Array_SArgument_T<S, S_slice, S_forany>::interceptor_param ( + Dynamic::Parameter & p) { - p.argument <<= S_forany (this->x_); + p.argument <<= this->x_; p.mode = CORBA::PARAM_INOUT; } @@ -75,7 +76,7 @@ TAO::Out_Var_Array_SArgument_T<S_slice,S_var,S_forany>::marshal ( TAO_OutputCDR & cdr ) { - return cdr << S_forany (this->x_.ptr ()); + return cdr << this->x_.ptr (); } #if TAO_HAS_INTERCEPTORS == 1 @@ -116,4 +117,4 @@ TAO::Ret_Var_Array_SArgument_T<S_slice,S_var,S_forany>::interceptor_result ( #endif /* TAO_HAS_INTERCEPTORS */ -#endif /* TAO_VAR_ARRAY_SARGUMENT_T_C */ +#endif /* TAO_VAR_ARRAY_SARGUMENT_T_CPP */ diff --git a/TAO/tao/Var_Array_SArgument_T.h b/TAO/tao/PortableServer/Var_Array_SArgument_T.h index 70f5caad9fa..f8dd6e884e8 100644 --- a/TAO/tao/Var_Array_SArgument_T.h +++ b/TAO/tao/PortableServer/Var_Array_SArgument_T.h @@ -1,4 +1,4 @@ -// This may look like C, but it's really -*- C++ -*- +// -*- C++ -*- //============================================================================= /** @@ -6,7 +6,7 @@ * * $Id$ * - * @authors Jeff Parsons and Carlos O'Ryan + * @authors Jeff Parsons, Carlos O'Ryan and Ossama Othman */ //============================================================================= @@ -14,6 +14,7 @@ #define TAO_VAR_ARRAY_SARGUMENT_T_H #include /**/ "ace/pre.h" + #include "tao/Argument.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) @@ -28,20 +29,21 @@ namespace TAO * @brief IN skeleton argument of variable size element array. * */ - template<typename S, typename S_forany> + template<typename S, typename S_slice, typename S_forany> class In_Var_Array_SArgument_T : public Argument { public: + In_Var_Array_SArgument_T (void); virtual CORBA::Boolean demarshal (TAO_InputCDR &); #if TAO_HAS_INTERCEPTORS == 1 virtual void interceptor_param (Dynamic::Parameter &); #endif /* TAO_HAS_INTERCEPTORS == 1 */ - const S & arg (void) const; + S_slice const * arg (void) const; private: - S x_; + S_forany x_; }; /** @@ -50,7 +52,7 @@ namespace TAO * @brief INOUT skeleton argument of variable size element array. * */ - template<typename S, typename S_forany> + template<typename S, typename S_slice, typename S_forany> class Inout_Var_Array_SArgument_T : public Argument { public: @@ -61,10 +63,10 @@ namespace TAO #if TAO_HAS_INTERCEPTORS == 1 virtual void interceptor_param (Dynamic::Parameter &); #endif /* TAO_HAS_INTERCEPTORS == 1 */ - S & arg (void); + S_slice * arg (void); private: - S x_; + S_forany x_; }; /** @@ -129,23 +131,35 @@ namespace TAO typedef T inout_type; typedef T_out out_type; - typedef In_Var_Array_SArgument_T<T,T_forany> in_arg_val; - typedef Inout_Var_Array_SArgument_T<T,T_forany> inout_arg_val; + typedef In_Var_Array_SArgument_T<T, + T_slice, + T_forany> in_arg_val; + typedef Inout_Var_Array_SArgument_T<T, + T_slice, + T_forany> inout_arg_val; typedef Out_Var_Array_SArgument_T<T_slice, T_var, T_forany> out_arg_val; typedef Ret_Var_Array_SArgument_T<T_slice, T_var, T_forany> ret_val; + + // Typedefs corresponding to return value of arg() method in both + // the client and server side argument class templates. + typedef T_slice const * in_arg_type; + typedef ret_type inout_arg_type; + typedef ret_type & out_arg_type; + typedef ret_type & ret_arg_type; + }; }; #if defined (__ACE_INLINE__) -#include "tao/Var_Array_SArgument_T.inl" +#include "tao/PortableServer/Var_Array_SArgument_T.inl" #endif /* __ACE_INLINE__ */ #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "tao/Var_Array_SArgument_T.cpp" +#include "tao/PortableServer/Var_Array_SArgument_T.cpp" #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) diff --git a/TAO/tao/Var_Array_SArgument_T.inl b/TAO/tao/PortableServer/Var_Array_SArgument_T.inl index 74909b17512..58bf2c6dbb9 100644 --- a/TAO/tao/Var_Array_SArgument_T.inl +++ b/TAO/tao/PortableServer/Var_Array_SArgument_T.inl @@ -1,32 +1,41 @@ +// -*- C++ -*- +// // $Id$ -template<typename S, typename S_forany> +template<typename S, typename S_slice, typename S_forany> ACE_INLINE -TAO::In_Var_Array_SArgument_T<S,S_forany>::In_Var_Array_SArgument_T (void) +TAO::In_Var_Array_SArgument_T<S, + S_slice, + S_forany>::In_Var_Array_SArgument_T (void) {} -template<typename S, typename S_forany> +template<typename S, typename S_slice, typename S_forany> ACE_INLINE -const S & -TAO::In_Var_Array_SArgument_T<S,S_forany>::arg (void) const +S_slice const * +TAO::In_Var_Array_SArgument_T<S, + S_slice, + S_forany>::arg (void) const { - return this->x_; + return this->x_.in (); } // ========================================================================== -template<typename S, typename S_forany> +template<typename S, typename S_slice, typename S_forany> ACE_INLINE -TAO::Inout_Var_Array_SArgument_T<S,S_forany>:: -Inout_Var_Array_SArgument_T (void) +TAO::Inout_Var_Array_SArgument_T<S, + S_slice, + S_forany>::Inout_Var_Array_SArgument_T (void) {} -template<typename S, typename S_forany> -S & -TAO::Inout_Var_Array_SArgument_T<S,S_forany>::arg (void) +template<typename S, typename S_slice, typename S_forany> +S_slice * +TAO::Inout_Var_Array_SArgument_T<S, + S_slice, + S_forany>::arg (void) { - return this->x_; + return this->x_.inout (); } // ========================================================================== diff --git a/TAO/tao/Var_Size_SArgument_T.cpp b/TAO/tao/PortableServer/Var_Size_SArgument_T.cpp index 682b18ac6a3..d2e25bebae1 100644 --- a/TAO/tao/Var_Size_SArgument_T.cpp +++ b/TAO/tao/PortableServer/Var_Size_SArgument_T.cpp @@ -1,18 +1,15 @@ // $Id$ -#ifndef TAO_VAR_SIZE_SARGUMENT_T_C -#define TAO_VAR_SIZE_SARGUMENT_T_C +#ifndef TAO_VAR_SIZE_SARGUMENT_T_CPP +#define TAO_VAR_SIZE_SARGUMENT_T_CPP -#include "tao/Var_Size_SArgument_T.h" +#include "tao/PortableServer/Var_Size_SArgument_T.h" #include "tao/Dynamic_ParameterC.h" #if !defined (__ACE_INLINE__) -#include "tao/Var_Size_SArgument_T.inl" +#include "tao/PortableServer/Var_Size_SArgument_T.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID (tao, - Var_Size_SArgument_T, - "$Id$") template<typename S> CORBA::Boolean @@ -78,7 +75,7 @@ TAO::Out_Var_Size_SArgument_T<S,S_var>::interceptor_param ( Dynamic::Parameter & p ) { - p.argument <<= *this->x_; + p.argument <<= this->x_.in (); p.mode = CORBA::PARAM_OUT; } @@ -104,4 +101,4 @@ TAO::Ret_Var_Size_SArgument_T<S,S_var>::interceptor_result (CORBA::Any * any) #endif /* TAO_HAS_INTERCEPTORS */ -#endif /* TAO_VAR_SIZE_SARGUMENT_T_C */ +#endif /* TAO_VAR_SIZE_SARGUMENT_T_CPP */ diff --git a/TAO/tao/PortableServer/Var_Size_SArgument_T.h b/TAO/tao/PortableServer/Var_Size_SArgument_T.h new file mode 100644 index 00000000000..d135d1815a9 --- /dev/null +++ b/TAO/tao/PortableServer/Var_Size_SArgument_T.h @@ -0,0 +1,157 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Var_Size_SArgument_T.h + * + * $Id$ + * + * @authors Jeff Parsons, Carlos O'Ryan and Ossama Othman + */ +//============================================================================= + +#ifndef TAO_VAR_SIZE_SARGUMENT_T_H +#define TAO_VAR_SIZE_SARGUMENT_T_H + +#include /**/ "ace/pre.h" +#include "tao/Argument.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace TAO +{ + /** + * @class In_Var_Size_SArgument_T + * + * @brief Template class for IN skeleton argument of fixed size IDL types. + * + */ + template<typename S> + class In_Var_Size_SArgument_T : public Argument + { + public: + + virtual CORBA::Boolean demarshal (TAO_InputCDR &); +#if TAO_HAS_INTERCEPTORS == 1 + virtual void interceptor_param (Dynamic::Parameter &); +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + S const & arg (void) const; + + private: + S * x_; + }; + + /** + * @class Inout_Var_Size_SArgument_T + * + * @brief Template class for INOUT skeleton arg of fixed size IDL types. + * + */ + template<typename S> + class Inout_Var_Size_SArgument_T : public Argument + { + public: + Inout_Var_Size_SArgument_T (void); + + virtual CORBA::Boolean marshal (TAO_OutputCDR &); + virtual CORBA::Boolean demarshal (TAO_InputCDR &); +#if TAO_HAS_INTERCEPTORS == 1 + virtual void interceptor_param (Dynamic::Parameter &); +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + S & arg (void); + + private: + S * x_; + }; + + /** + * @class Out_Var_Size_SArgument_T + * + * @brief Template class for OUT skeleton argument of fixed size IDL types. + * + */ + template<typename S, typename S_var> + class Out_Var_Size_SArgument_T : public Argument + { + public: + Out_Var_Size_SArgument_T (void); + + virtual CORBA::Boolean marshal (TAO_OutputCDR &); +#if TAO_HAS_INTERCEPTORS == 1 + virtual void interceptor_param (Dynamic::Parameter &); +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + S *& arg (void); + + private: + S_var x_; + }; + + /** + * @class Ret_Var_Size_SArgument_T + * + * @brief Template class for return skeleton value of fixed size IDL types. + * + */ + template<typename S, typename S_var> + class Ret_Var_Size_SArgument_T : public Argument + { + public: + Ret_Var_Size_SArgument_T (void); + + virtual CORBA::Boolean marshal (TAO_OutputCDR &); +#if TAO_HAS_INTERCEPTORS == 1 + virtual void interceptor_result (CORBA::Any *); +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + S *& arg (void); + + private: + S_var x_; + }; + + /** + * @struct Basic_SArg_Traits_T + * + * @brief Template class for skeleton argument traits of + * variable size IDL types. + * + */ + template<typename T, typename T_var, typename T_out> + struct Var_Size_SArg_Traits_T + { + typedef T * ret_type; + typedef const T & in_type; + typedef T & inout_type; + typedef T_out out_type; + + typedef In_Var_Size_SArgument_T<T> in_arg_val; + typedef Inout_Var_Size_SArgument_T<T> inout_arg_val; + typedef Out_Var_Size_SArgument_T<T,T_var> out_arg_val; + typedef Ret_Var_Size_SArgument_T<T,T_var> ret_val; + + // Typedefs corresponding to return value of arg() method in both + // the client and server side argument class templates. + typedef in_type in_arg_type; + typedef inout_type inout_arg_type; + typedef ret_type & out_arg_type; + typedef ret_type & ret_arg_type; + + }; +} + +#if defined (__ACE_INLINE__) +#include "tao/PortableServer/Var_Size_SArgument_T.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "tao/PortableServer/Var_Size_SArgument_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Var_Size_SArgument_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" + +#endif /* TAO_VAR_SIZE_SARGUMENT_T_H */ diff --git a/TAO/tao/Var_Size_SArgument_T.inl b/TAO/tao/PortableServer/Var_Size_SArgument_T.inl index 2d9f217bd39..5c53ed118ef 100644 --- a/TAO/tao/Var_Size_SArgument_T.inl +++ b/TAO/tao/PortableServer/Var_Size_SArgument_T.inl @@ -1,9 +1,5 @@ // $Id$ -template<typename S> -ACE_INLINE -TAO::In_Var_Size_SArgument_T<S>::In_Var_Size_SArgument_T (void) -{} template<typename S> const S & diff --git a/TAO/tao/Special_Basic_Argument_T.h b/TAO/tao/Special_Basic_Argument_T.h index 6d405e4bbaa..b132bb85aa1 100644 --- a/TAO/tao/Special_Basic_Argument_T.h +++ b/TAO/tao/Special_Basic_Argument_T.h @@ -1,4 +1,4 @@ -// This may look like C, but it's really -*- C++ -*- +// -*- C++ -*- //============================================================================= /** @@ -41,7 +41,7 @@ namespace TAO #if TAO_HAS_INTERCEPTORS == 1 virtual void interceptor_param (Dynamic::Parameter &); #endif /* TAO_HAS_INTERCEPTORS == 1 */ - S const & arg (void); + S const & arg (void) const; private: S const & x_; @@ -67,7 +67,7 @@ namespace TAO S & arg (void); private: - mutable S & x_; + S & x_; }; /** diff --git a/TAO/tao/Special_Basic_Argument_T.inl b/TAO/tao/Special_Basic_Argument_T.inl index ee170d6dd53..66887ab09a3 100644 --- a/TAO/tao/Special_Basic_Argument_T.inl +++ b/TAO/tao/Special_Basic_Argument_T.inl @@ -1,3 +1,5 @@ +// -*- C++ -*- +// // $Id$ template<typename S, typename to_S, typename from_S> @@ -11,7 +13,7 @@ TAO::In_Special_Basic_Argument_T<S,to_S,from_S>::In_Special_Basic_Argument_T ( template<typename S, typename to_S, typename from_S> ACE_INLINE S const & -TAO::In_Special_Basic_Argument_T<S,to_S,from_S>::arg (void) +TAO::In_Special_Basic_Argument_T<S,to_S,from_S>::arg (void) const { return this->x_; } diff --git a/TAO/tao/TAO_Server_Request.cpp b/TAO/tao/TAO_Server_Request.cpp index 879a332ccfc..50376438d16 100644 --- a/TAO/tao/TAO_Server_Request.cpp +++ b/TAO/tao/TAO_Server_Request.cpp @@ -6,6 +6,8 @@ #include "debug.h" #include "Pluggable_Messaging.h" #include "GIOP_Utils.h" +#include "Stub.h" +#include "operation_details.h" #include "Transport.h" #include "CDR.h" #include "SystemException.h" @@ -20,7 +22,7 @@ ACE_RCSID (tao, #if defined (ACE_ENABLE_TIMEPROBES) - static const char *TAO_Server_Request_Timeprobe_Description[] = +static const char * TAO_Server_Request_Timeprobe_Description[] = { "TAO_ServerRequest::TAO_ServerRequest - start", "TAO_ServerRequest::TAO_ServerRequest - end", @@ -51,17 +53,18 @@ TAO_ServerRequest::TAO_ServerRequest (TAO_Pluggable_Messaging *mesg_base, // transport already duplicated in // TAO_Transport::process_parsed_messages () transport_(transport), - response_expected_ (0), - deferred_reply_ (0), - sync_with_server_ (0), + response_expected_ (false), + deferred_reply_ (false), + sync_with_server_ (false), + is_dsi_ (false), // @@ We shouldn't be using GIOP specific types here. Need to be revisited. exception_type_ (TAO_GIOP_NO_EXCEPTION), orb_core_ (orb_core), request_id_ (0), profile_ (orb_core), requesting_principal_ (0), - is_dsi_ (0), dsi_nvlist_align_ (0), + operation_details_ (0), argument_flag_ (1) #if TAO_HAS_INTERCEPTORS == 1 , interceptor_count_ (0) @@ -94,15 +97,16 @@ TAO_ServerRequest::TAO_ServerRequest (TAO_Pluggable_Messaging *mesg_base, transport_ (transport), response_expected_ (response_expected), deferred_reply_ (deferred_reply), - sync_with_server_ (0), + sync_with_server_ (false), + is_dsi_ (false), exception_type_ (TAO_GIOP_NO_EXCEPTION), orb_core_ (orb_core), request_id_ (request_id), profile_ (orb_core), requesting_principal_ (0), - is_dsi_ (0), dsi_nvlist_align_ (0), - argument_flag_ (1) + operation_details_ (0), + argument_flag_ (true) #if TAO_HAS_INTERCEPTORS == 1 , interceptor_count_ (0) , rs_pi_current_ () @@ -113,6 +117,39 @@ TAO_ServerRequest::TAO_ServerRequest (TAO_Pluggable_Messaging *mesg_base, parse_error = 0; } +// Constructor used in Thru-POA collocation code. +TAO_ServerRequest::TAO_ServerRequest (TAO_ORB_Core * orb_core, + TAO_Operation_Details const & details, + CORBA::Object_ptr target) + : mesg_base_ (0), + operation_ (details.opname ()), + incoming_ (0), + outgoing_ (0), + transport_ (0), + response_expected_ (details.response_flags () == TAO_TWOWAY_RESPONSE_FLAG + || details.response_flags () == static_cast<CORBA::Octet> (Messaging::SYNC_WITH_SERVER) + || details.response_flags () == static_cast<CORBA::Octet> (Messaging::SYNC_WITH_TARGET)), + deferred_reply_ (false), + sync_with_server_ (details.response_flags () == static_cast<CORBA::Octet> (Messaging::SYNC_WITH_SERVER)), + is_dsi_ (false), + exception_type_ (TAO_GIOP_NO_EXCEPTION), + orb_core_ (orb_core), + request_id_ (0), + profile_ (orb_core), + requesting_principal_ (0), + dsi_nvlist_align_ (0), + operation_details_ (&details), + argument_flag_ (false) +#if TAO_HAS_INTERCEPTORS == 1 + , interceptor_count_ (0) + , rs_pi_current_ () + , result_seq_ (0) +#endif /* TAO_HAS_INTERCEPTORS == 1 */ +{ + // Have to use a const_cast<>. *sigh* + this->profile_.object_key (const_cast<TAO::ObjectKey &> (target->_stubobj ()->object_key ())); +} + TAO_ServerRequest::~TAO_ServerRequest (void) { } @@ -126,6 +163,9 @@ TAO_ServerRequest::orb (void) void TAO_ServerRequest::init_reply (void) { + if (!this->outgoing_) + return; // Collocated + // Construct our reply generator. TAO_Pluggable_Reply_Params_Base reply_params; @@ -134,9 +174,9 @@ TAO_ServerRequest::init_reply (void) // pluggable_messaging_interface. One point to be noted however is // that, it was the pluggable_messaging classes who created us and // delegated us to do work on its behalf. But we would be calling - // back. As we dont have a LOCK or any such things we can call + // back. As we don't have a LOCK or any such things we can call // pluggable_messaging guys again. We would be on the same thread of - // invocation. So *theoratically* there should not be a problem. + // invocation. So *theoretically* there should not be a problem. reply_params.request_id_ = this->request_id_; reply_params.is_dsi_ = this->is_dsi_; reply_params.dsi_nvlist_align_ = this->dsi_nvlist_align_; @@ -180,7 +220,7 @@ TAO_ServerRequest::init_reply (void) ACE_TEXT ("marshal encoding forwarded objref failed\n"))); } } - this->transport_->assign_translators (0,this->outgoing_); + this->transport_->assign_translators (0, this->outgoing_); } void diff --git a/TAO/tao/TAO_Server_Request.h b/TAO/tao/TAO_Server_Request.h index 8796f78d207..f878aad1591 100644 --- a/TAO/tao/TAO_Server_Request.h +++ b/TAO/tao/TAO_Server_Request.h @@ -44,6 +44,8 @@ namespace CORBA typedef ORB *ORB_ptr; } +class TAO_Operation_Details; + /** * @class TAO_ServerRequest * @@ -88,6 +90,11 @@ public: TAO_ORB_Core *orb_core, int &parse_error); + /// Constructor used by thru-POA collocated invocation path. + TAO_ServerRequest (TAO_ORB_Core * orb_core, + TAO_Operation_Details const & details, + CORBA::Object_ptr target); + /// Destructor. virtual ~TAO_ServerRequest (void); @@ -111,16 +118,16 @@ public: CORBA::ORB_ptr orb (void); /// Return the ORB core pointer member. - TAO_ORB_Core *orb_core (void); + TAO_ORB_Core *orb_core (void) const; /// Start a Reply message. void init_reply (void); /// Retrieve the incoming stream. - TAO_InputCDR &incoming (void); + TAO_InputCDR * incoming (void) const; /// Retrieve the outgoing stream. - TAO_OutputCDR &outgoing (void); + TAO_OutputCDR * outgoing (void) const; /// Is the response expected? CORBA::Boolean response_expected (void) const; @@ -204,6 +211,9 @@ public: /// Set the member. void dsi_nvlist_align (ptrdiff_t alignment); + // Get the operation details for the current request. + TAO_Operation_Details const * operation_details (void) const; + /// Get/Set operations for the argument_flag void argument_flag (CORBA::Boolean flag); CORBA::Boolean argument_flag (void); @@ -270,6 +280,9 @@ private: /// 0: anything else CORBA::Boolean sync_with_server_; + /// Did we get passed to a CORBA::ServerRequest? + CORBA::Boolean is_dsi_; + // TAO_GIOP_ReplyStatusType exception_type_; /// Exception type (will be NO_EXCEPTION in the majority of the cases). CORBA::ULong exception_type_; @@ -291,12 +304,11 @@ private: /// Identifies the requester. CORBA::OctetSeq_var requesting_principal_; - /// Did we get passed to a CORBA::ServerRequest? - CORBA::Boolean is_dsi_; - /// Used to pad CDR stream if we have used DSI. ptrdiff_t dsi_nvlist_align_; + TAO_Operation_Details const * const operation_details_; + /** * An argument flag to indicate whether there is any data that is * going to get marshalled along as a reply. The default will be 1 diff --git a/TAO/tao/TAO_Server_Request.i b/TAO/tao/TAO_Server_Request.i index f87daa86d7b..82f4a9cf919 100644 --- a/TAO/tao/TAO_Server_Request.i +++ b/TAO/tao/TAO_Server_Request.i @@ -3,21 +3,21 @@ // $Id$ ACE_INLINE TAO_ORB_Core * -TAO_ServerRequest::orb_core (void) +TAO_ServerRequest::orb_core (void) const { return this->orb_core_; } -ACE_INLINE TAO_InputCDR & -TAO_ServerRequest::incoming (void) +ACE_INLINE TAO_InputCDR * +TAO_ServerRequest::incoming (void) const { - return *this->incoming_; + return this->incoming_; } -ACE_INLINE TAO_OutputCDR & -TAO_ServerRequest::outgoing (void) +ACE_INLINE TAO_OutputCDR * +TAO_ServerRequest::outgoing (void) const { - return *this->outgoing_; + return this->outgoing_; } ACE_INLINE const char * @@ -168,6 +168,12 @@ TAO_ServerRequest::is_dsi (void) this->is_dsi_ = 1; } +ACE_INLINE TAO_Operation_Details const * +TAO_ServerRequest::operation_details (void) const +{ + return this->operation_details_; +} + ACE_INLINE void TAO_ServerRequest::dsi_nvlist_align (ptrdiff_t alignment) { diff --git a/TAO/tao/UB_String_Argument_T.h b/TAO/tao/UB_String_Argument_T.h index 4553e79a9e2..b7ba07c21d1 100644 --- a/TAO/tao/UB_String_Argument_T.h +++ b/TAO/tao/UB_String_Argument_T.h @@ -1,4 +1,4 @@ -// This may look like C, but it's really -*- C++ -*- +// -*- C++ -*- //============================================================================= /** @@ -14,6 +14,7 @@ #define TAO_UB_STRING_ARGUMENT_T_H #include /**/ "ace/pre.h" + #include "tao/Argument.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) @@ -38,10 +39,10 @@ namespace TAO #if TAO_HAS_INTERCEPTORS == 1 virtual void interceptor_param (Dynamic::Parameter &); #endif /* TAO_HAS_INTERCEPTORS == 1 */ - const S * arg (void) const; + S const * arg (void) const; private: - const S * x_; + S const * x_; }; /** @@ -132,7 +133,7 @@ namespace TAO struct UB_String_Arg_Traits_T { typedef T * ret_type; - typedef const T * in_type; + typedef T const * in_type; typedef T *& inout_type; typedef T_out out_type; diff --git a/TAO/tao/Var_Array_Argument_T.h b/TAO/tao/Var_Array_Argument_T.h index 342acbc5311..0e411bf87dc 100644 --- a/TAO/tao/Var_Array_Argument_T.h +++ b/TAO/tao/Var_Array_Argument_T.h @@ -1,4 +1,4 @@ -// This may look like C, but it's really -*- C++ -*- +// -*- C++ -*- //============================================================================= /** @@ -14,6 +14,7 @@ #define TAO_VAR_ARRAY_ARGUMENT_T_H #include /**/ "ace/pre.h" + #include "tao/Argument.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) @@ -38,7 +39,7 @@ namespace TAO #if TAO_HAS_INTERCEPTORS == 1 virtual void interceptor_param (Dynamic::Parameter &); #endif /* TAO_HAS_INTERCEPTORS == 1 */ - const S_slice * arg (void) const; + S_slice const * arg (void) const; private: S_forany x_; diff --git a/TAO/tao/Var_Array_Argument_T.inl b/TAO/tao/Var_Array_Argument_T.inl index bc1c0bf0f45..a189584da2e 100644 --- a/TAO/tao/Var_Array_Argument_T.inl +++ b/TAO/tao/Var_Array_Argument_T.inl @@ -11,7 +11,7 @@ In_Var_Array_Argument_T (const S_slice * x) template<typename S, typename S_slice, typename S_forany> ACE_INLINE -const S_slice * +S_slice const * TAO::In_Var_Array_Argument_T<S,S_slice,S_forany>::arg (void) const { return this->x_.in (); diff --git a/TAO/tao/Var_Size_Argument_T.h b/TAO/tao/Var_Size_Argument_T.h index 88b81297218..e417f5b72fe 100644 --- a/TAO/tao/Var_Size_Argument_T.h +++ b/TAO/tao/Var_Size_Argument_T.h @@ -1,4 +1,4 @@ -// This may look like C, but it's really -*- C++ -*- +// -*- C++ -*- //============================================================================= /** @@ -14,6 +14,7 @@ #define TAO_VAR_SIZE_ARGUMENT_T_H #include /**/ "ace/pre.h" + #include "tao/Argument.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) @@ -38,7 +39,7 @@ namespace TAO #if TAO_HAS_INTERCEPTORS == 1 virtual void interceptor_param (Dynamic::Parameter &); #endif /* TAO_HAS_INTERCEPTORS == 1 */ - const S & arg (void) const; + S const & arg (void) const; private: const S * x_; @@ -133,7 +134,7 @@ namespace TAO struct Var_Size_Arg_Traits_T { typedef T * ret_type; - typedef const T & in_type; + typedef T const & in_type; typedef T & inout_type; typedef T_out out_type; diff --git a/TAO/tao/operation_details.h b/TAO/tao/operation_details.h index 5950a8b3235..c793cc47d9b 100644 --- a/TAO/tao/operation_details.h +++ b/TAO/tao/operation_details.h @@ -149,7 +149,7 @@ public: //@} /// Accessors for the argumet list - TAO::Argument **args (void); + TAO::Argument ** args (void) const; CORBA::ULong args_num (void) const ; private: diff --git a/TAO/tao/operation_details.i b/TAO/tao/operation_details.i index beaf554c50b..7c75e72cf79 100644 --- a/TAO/tao/operation_details.i +++ b/TAO/tao/operation_details.i @@ -168,7 +168,7 @@ TAO_Operation_Details::addressing_mode (CORBA::Short mode) } ACE_INLINE TAO::Argument ** -TAO_Operation_Details::args (void) +TAO_Operation_Details::args (void) const { return this->args_; } |