diff options
author | mcorino <mcorino@users.noreply.github.com> | 2011-12-08 09:07:48 +0000 |
---|---|---|
committer | mcorino <mcorino@users.noreply.github.com> | 2011-12-08 09:07:48 +0000 |
commit | a67fe0bc8c98af0f2f0b468857c51f21f47d8e72 (patch) | |
tree | e99132cffef6ff51e76a05dd9ef5fa29da7d2f6a /TAO/TAO_IDL | |
parent | 094ebad8a4a3fac5422728616e3181cf3d0928f2 (diff) | |
download | ATCD-RemedyWorkSAStart.tar.gz |
restart work sa branchRemedyWorkSAStart
Diffstat (limited to 'TAO/TAO_IDL')
77 files changed, 1884 insertions, 2317 deletions
diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp index 856b20614c4..8604cf44788 100644 --- a/TAO/TAO_IDL/be/be_codegen.cpp +++ b/TAO/TAO_IDL/be/be_codegen.cpp @@ -43,12 +43,13 @@ TAO_CodeGen::TAO_CodeGen (void) server_template_header_ (0), server_skeletons_ (0), server_template_skeletons_ (0), - server_inline_ (0), anyop_header_ (0), anyop_source_ (0), gperf_input_stream_ (0), ciao_svnt_header_ (0), ciao_svnt_source_ (0), + ciao_svnt_template_header_ (0), + ciao_svnt_template_source_ (0), ciao_exec_header_ (0), ciao_exec_source_ (0), ciao_exec_idl_ (0), @@ -495,7 +496,7 @@ TAO_CodeGen::start_server_header (const char *fname) // 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 - // in the original main IDL file, not the one which went + // in the original main IDL file, not the one which went // thru CC preprocessor. for (size_t j = 0; j < idl_global->n_included_idl_files (); @@ -676,18 +677,6 @@ TAO_CodeGen::start_server_skeletons (const char *fname) this->gen_skel_src_includes (); - // Only when we generate a server inline file generate the include - if (be_global->gen_server_inline ()) - { - // Generate the code that includes the inline file if not included in the - // header file. - *this->server_skeletons_ << "\n\n#if !defined (__ACE_INLINE__)\n"; - *this->server_skeletons_ << "#include \"" - << be_global->be_get_server_inline_fname (1) - << "\"\n"; - *this->server_skeletons_ << "#endif /* !defined INLINE */"; - } - // Begin versioned namespace support after initial headers have been // included, but before the inline file and post include // directives. @@ -756,39 +745,6 @@ TAO_CodeGen::server_template_skeletons (void) return this->server_template_skeletons_; } -// Set the server inline stream. -int -TAO_CodeGen::start_server_inline (const char *fname) -{ - // Clean up between multiple files. - delete this->server_inline_; - - ACE_NEW_RETURN (this->server_inline_, - TAO_OutStream, - -1); - - if (this->server_inline_->open (fname, TAO_OutStream::TAO_SVR_INL) == -1) - { - return -1; - } - - // Generate the ident string, if any. - this->gen_ident_string (this->server_inline_); - - // Begin versioned namespace support after initial headers, if any, have been - // included. - *this->server_inline_ << be_global->versioning_begin (); - - return 0; -} - -// Get the server inline stream. -TAO_OutStream * -TAO_CodeGen::server_inline (void) -{ - return this->server_inline_; -} - int TAO_CodeGen::start_anyop_header (const char *fname) { @@ -1112,7 +1068,7 @@ TAO_CodeGen::start_ciao_svnt_header (const char *fname) << "# pragma once\n" << "#endif /* ACE_LACKS_PRAGMA_ONCE */\n"; - this->gen_svnt_hdr_includes (); + this->gen_svnt_hdr_includes (this->ciao_svnt_header_); return 0; } @@ -1154,9 +1110,131 @@ TAO_CodeGen::start_ciao_svnt_source (const char *fname) *this->ciao_svnt_source_ << "#include \"" << be_global->be_get_ciao_svnt_hdr_fname (true) + << "\"" << be_nl; + + *this->ciao_svnt_source_ + << "#include \"" + << be_global->be_get_ciao_tmpl_svnt_hdr_fname(true) << "\""; - this->gen_svnt_src_includes (); + this->gen_svnt_src_includes (this->ciao_svnt_source_); + + return 0; +} + +int +TAO_CodeGen::start_ciao_svnt_template_header (const char *fname) +{ + // Clean up between multiple files. + delete this->ciao_svnt_template_header_; + + ACE_NEW_RETURN (this->ciao_svnt_template_header_, + TAO_OutStream, + -1); + + int status = + this->ciao_svnt_template_header_->open (fname, + TAO_OutStream::CIAO_SVNT_T_HDR); + + if (status == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("TAO_CodeGen::start_ciao_svnt_template_header - ") + ACE_TEXT ("Error opening file\n")), + -1); + } + + TAO_OutStream &os = *this->ciao_svnt_template_header_; + + os << be_nl + << "// TAO_IDL - Generated from" << be_nl + << "// " << __FILE__ << ":" << __LINE__ + << be_nl_2; + + // Generate the #ident string, if any. + this->gen_ident_string (this->ciao_svnt_template_header_); + + // Generate the #ifndef clause. + this->gen_ifndef_string (fname, + this->ciao_svnt_template_header_, + "CIAO_SESSION_", + "_H_"); + + if (be_global->pre_include () != 0) + { + os << "#include /**/ \"" + << be_global->pre_include () + << "\"\n"; + } + + // All CIAO examples so far have component skeleton and servant + // generated code in the same library, using the skel export macro, + // so the values for the servant export default to the skel values. + // Eventually, there should be a way to completely decouple them. + if (be_global->svnt_export_include () != 0) + { + os << "\n#include /**/ \"" + << be_global->svnt_export_include () + << "\"\n"; + } + else if (be_global->skel_export_include () != 0) + { + os << "\n#include /**/ \"" + << be_global->skel_export_include () + << "\"\n"; + } + + // Some compilers don't optimize the #ifndef header include + // protection, but do optimize based on #pragma once. + os << "\n#if !defined (ACE_LACKS_PRAGMA_ONCE)\n" + << "# pragma once\n" + << "#endif /* ACE_LACKS_PRAGMA_ONCE */\n"; + + this->gen_svnt_hdr_includes (this->ciao_svnt_template_header_); + + return 0; +} + +int +TAO_CodeGen::start_ciao_svnt_template_source (const char *fname) +{ + // Clean up between multiple files. + delete this->ciao_svnt_template_source_; + + ACE_NEW_RETURN (this->ciao_svnt_template_source_, + TAO_OutStream, + -1); + + int status = + this->ciao_svnt_template_source_->open (fname, + TAO_OutStream::CIAO_SVNT_T_IMPL); + + if (status == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("TAO_CodeGen::") + ACE_TEXT ("start_ciao_svnt_template_source - ") + ACE_TEXT ("Error opening file\n")), + -1); + } + + TAO_OutStream &os = *this->ciao_svnt_template_source_; + + os << be_nl + << "// TAO_IDL - Generated from" << be_nl + << "// " << __FILE__ << ":" << __LINE__ + << be_nl_2; + + // Generate the #ident string, if any. + this->gen_ident_string (this->ciao_svnt_template_source_); + + // Generate the include statement for the server header. + *this->ciao_svnt_template_source_ + << "#include \"" + << be_global->be_get_ciao_svnt_hdr_fname (true) + << "\"" << be_nl; + + this->gen_svnt_src_includes (this->ciao_svnt_template_source_); return 0; } @@ -1172,6 +1250,19 @@ TAO_CodeGen::ciao_svnt_source (void) { return this->ciao_svnt_source_; } + +TAO_OutStream * +TAO_CodeGen::ciao_svnt_template_header (void) +{ + return this->ciao_svnt_template_header_; +} + +TAO_OutStream * +TAO_CodeGen::ciao_svnt_template_source (void) +{ + return this->ciao_svnt_template_source_; +} + int TAO_CodeGen::start_ciao_exec_header (const char *fname) { @@ -1183,8 +1274,8 @@ TAO_CodeGen::start_ciao_exec_header (const char *fname) -1); int status = - this->ciao_exec_header_->open (fname, - TAO_OutStream::CIAO_EXEC_HDR); + this->ciao_exec_header_->open (fname, + TAO_OutStream::CIAO_EXEC_HDR); if (status == -1) { @@ -1240,7 +1331,6 @@ TAO_CodeGen::start_ciao_exec_source (const char *fname) int status = this->ciao_exec_source_->open (fname, TAO_OutStream::CIAO_EXEC_IMPL); - if (status == -1) { ACE_ERROR_RETURN ((LM_ERROR, @@ -1654,17 +1744,6 @@ TAO_CodeGen::end_server_header (void) << be_global->be_get_server_template_hdr_fname (true) << "\"\n"; } - - // Only when we generate a server inline file generate the include - if (be_global->gen_server_inline ()) - { - // Insert the code to include the inline file. - *os << "\n#if defined (__ACE_INLINE__)\n"; - *os << "#include \"" - << be_global->be_get_server_inline_fname (1) - << "\"\n"; - *os << "#endif /* defined INLINE */"; - } } if (be_global->post_include () != 0) @@ -1682,18 +1761,6 @@ TAO_CodeGen::end_server_header (void) return 0; } -void -TAO_CodeGen::end_server_inline (void) -{ - *this->server_inline_ << "\n"; - - // End versioned namespace support. Do not place include directives - // before this. - *this->server_inline_ << be_global->versioning_end (); - - *this->server_inline_ << "\n"; -} - int TAO_CodeGen::end_implementation_header (const char *fname) { @@ -1869,6 +1936,43 @@ TAO_CodeGen::end_ciao_svnt_source (void) } int +TAO_CodeGen::end_ciao_svnt_template_header (void) +{ + *this->ciao_svnt_template_header_ << be_nl + << "#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)" + << be_nl << "#include \"" + << be_global->be_get_ciao_tmpl_svnt_src_fname (true) + << "\"" << be_nl + << "#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */" + << be_nl_2 + << "#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)" + << be_nl << "#pragma implementation (\"" + << be_global->be_get_ciao_tmpl_svnt_src_fname (true) + << "\")" + << be_nl << "#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */" + << be_nl; + + if (be_global->post_include () != 0) + { + *this->ciao_svnt_template_header_ << "\n\n#include /**/ \"" + << be_global->post_include () + << "\""; + } + + *this->ciao_svnt_template_header_ << "\n\n#endif /* ifndef */\n"; + + return 0; +} + +int +TAO_CodeGen::end_ciao_svnt_template_source (void) +{ + *this->ciao_svnt_template_source_ << "\n"; + + return 0; +} + +int TAO_CodeGen::end_ciao_exec_header (void) { if (be_global->post_include () != 0) @@ -2045,7 +2149,7 @@ TAO_CodeGen::gen_export_file (const char *filename, ACE_CString file_str; const char *output_path = - be_util::get_output_path (false, for_skel); + be_util::get_output_path (false, for_skel, false); if (output_path != 0) { @@ -2775,6 +2879,8 @@ TAO_CodeGen::gen_skel_src_includes (void) this->gen_standard_include (this->server_skeletons_, "tao/Buffer_Allocator_T.h"); this->gen_standard_include (this->server_skeletons_, + "tao/Messaging/AMH_Skeletons.h"); + this->gen_standard_include (this->server_skeletons_, "ace/Auto_Functor.h"); } @@ -3198,7 +3304,7 @@ TAO_CodeGen::gen_typecode_includes (TAO_OutStream * stream) } void -TAO_CodeGen::gen_svnt_hdr_includes (void) +TAO_CodeGen::gen_svnt_hdr_includes (TAO_OutStream *stream) { ACE_CString container_file ("ciao/Containers/"); container_file += be_global->ciao_container_type (); @@ -3207,7 +3313,7 @@ TAO_CodeGen::gen_svnt_hdr_includes (void) container_file += "_ContainerC.h"; this->gen_standard_include ( - this->ciao_svnt_header_, + stream, container_file.c_str ()); ACE_CString context_file ("ciao/Contexts/"); @@ -3217,55 +3323,59 @@ TAO_CodeGen::gen_svnt_hdr_includes (void) context_file += "_Context_T.h"; this->gen_standard_include ( - this->ciao_svnt_header_, - context_file.c_str ()); + stream, + context_file.c_str ()); ACE_CString servant_file ("ciao/Servants/"); servant_file += be_global->ciao_container_type (); servant_file += "/Servant_Impl_T.h"; this->gen_standard_include ( - this->ciao_svnt_header_, + stream, servant_file.c_str ()); this->gen_standard_include ( - this->ciao_svnt_header_, + stream, "ciao/Servants/Home_Servant_Impl_T.h"); - *this->ciao_svnt_header_ << be_nl; + this->gen_standard_include ( + stream, + "ciao/Servants/Facet_Servant_Base_T.h"); + + *stream << be_nl; this->gen_standard_include ( - this->ciao_svnt_header_, + stream, be_global->be_get_ciao_exec_stub_hdr_fname (true)); - *this->ciao_svnt_header_ << be_nl; + *stream << be_nl; this->gen_standard_include ( - this->ciao_svnt_header_, + stream, be_global->be_get_server_hdr_fname (true)); } void -TAO_CodeGen::gen_svnt_src_includes (void) +TAO_CodeGen::gen_svnt_src_includes (TAO_OutStream *stream) { this->gen_standard_include ( - this->ciao_svnt_source_, + stream, "ciao/Valuetype_Factories/Cookies.h"); this->gen_standard_include ( - this->ciao_svnt_source_, + stream, "tao/SystemException.h"); this->gen_standard_include ( - this->ciao_svnt_source_, + stream, "tao/Valuetype/ValueFactory.h"); this->gen_standard_include ( - this->ciao_svnt_source_, + stream, "tao/ORB_Core.h"); this->gen_standard_include ( - this->ciao_svnt_source_, + stream, "ace/SString.h"); } @@ -3372,11 +3482,31 @@ TAO_CodeGen::gen_exec_idl_includes (void) const char *exec_idl_fname = be_global->be_get_ciao_exec_idl_fname (true); - /// No need to have the exec IDL file include itself. - if (ACE_OS::strcmp (*path_tmp, exec_idl_fname) != 0) + bool skip_incl = false; + // special case for ami4ccm, if xxxE.idl. don't include xxxAE.idl. + char *exe_idl_fname = ACE_OS::strdup(exec_idl_fname); + char * base = ACE_OS::strstr(exe_idl_fname, "E.idl"); + if (base != 0) { - this->gen_standard_include (this->ciao_exec_idl_, *path_tmp); - } + static char test[MAXPATHLEN]; + ACE_OS::memset (test, 0, MAXPATHLEN); + + ACE_OS::strncpy(test, exe_idl_fname, base - exe_idl_fname); + ACE_OS::strcat (test, "AE.idl"); + + if (ACE_OS::strstr ( *path_tmp, test) != 0) + { + //skip include + skip_incl = true; + } + + } + /// No need to have the exec IDL file include itself. + if ((ACE_OS::strcmp (*path_tmp, exec_idl_fname) != 0) && + (!skip_incl)) + { + this->gen_standard_include (this->ciao_exec_idl_, *path_tmp); + } } } @@ -3620,7 +3750,6 @@ TAO_CodeGen::destroy (void) delete this->server_skeletons_; delete this->server_template_skeletons_; delete this->client_inline_; - delete this->server_inline_; delete this->anyop_source_; delete this->anyop_header_; delete this->ciao_svnt_header_; diff --git a/TAO/TAO_IDL/be/be_global.cpp b/TAO/TAO_IDL/be/be_global.cpp index d24446abc8e..7fbf68871e3 100644 --- a/TAO/TAO_IDL/be/be_global.cpp +++ b/TAO/TAO_IDL/be/be_global.cpp @@ -72,9 +72,10 @@ BE_GlobalData::BE_GlobalData (void) server_template_hdr_ending_ (ACE::strnew ("S_T.h")), server_skeleton_ending_ (ACE::strnew ("S.cpp")), server_template_skeleton_ending_ (ACE::strnew ("S_T.cpp")), - server_inline_ending_ (ACE::strnew ("S.inl")), anyop_hdr_ending_ (ACE::strnew ("A.h")), anyop_src_ending_ (ACE::strnew ("A.cpp")), + ciao_svnt_hdr_template_ending_ (ACE::strnew ("_svnt_T.h")), + ciao_svnt_src_template_ending_ (ACE::strnew ("_svnt_T.cpp")), ciao_svnt_hdr_ending_ (ACE::strnew ("_svnt.h")), ciao_svnt_src_ending_ (ACE::strnew ("_svnt.cpp")), ciao_exec_hdr_ending_ (ACE::strnew ("_exec.h")), @@ -92,6 +93,7 @@ BE_GlobalData::BE_GlobalData (void) stub_include_dir_ (0), skel_output_dir_ (0), anyop_output_dir_ (0), + exec_output_dir_ (0), any_support_ (true), cdr_support_ (true), tc_support_ (true), @@ -126,7 +128,6 @@ BE_GlobalData::BE_GlobalData (void) gen_anyop_files_ (false), gen_skel_files_ (true), gen_client_inline_ (true), - gen_server_inline_ (true), gen_client_stub_ (true), gen_server_skeleton_ (true), gen_local_iface_anyops_ (true), @@ -139,6 +140,7 @@ BE_GlobalData::BE_GlobalData (void) gen_ciao_exec_idl_ (false), gen_ciao_exec_impl_ (false), gen_ciao_exec_reactor_impl_ (false), + overwrite_not_exec_(false), gen_ciao_conn_impl_ (false), gen_dds_typesupport_idl_ (false), gen_ciao_valuefactory_reg_ (true), @@ -182,7 +184,8 @@ be_change_idl_file_extension (UTL_String* idl_file, const char *new_extension, bool base_name_only = false, bool for_anyop = false, - bool for_skel = false) + bool for_skel = false, + bool for_exec = false) { // @@ This shouldn't happen anyway; but a better error handling // mechanism is needed. @@ -227,7 +230,7 @@ be_change_idl_file_extension (UTL_String* idl_file, // Anyop * skel file output defaults to general output dir if not set. const char *output_path = - be_util::get_output_path (for_anyop, for_skel); + be_util::get_output_path (for_anyop, for_skel, for_exec); if (!base_name_only && output_path != 0) { @@ -272,7 +275,6 @@ be_change_idl_file_extension (UTL_String* idl_file, // Append the newextension. ACE_OS::strcat (fname, new_extension); - return fname; } @@ -389,17 +391,6 @@ BE_GlobalData::be_get_server_template_skeleton (UTL_String *idl_file_name, } const char * -BE_GlobalData::be_get_server_inline (UTL_String *idl_file_name, - bool base_name_only) -{ - return be_change_idl_file_extension (idl_file_name, - be_global->server_inline_ending (), - base_name_only, - false, - true); -} - -const char * BE_GlobalData::be_get_anyop_header (UTL_String *idl_file_name, bool base_name_only) { @@ -429,6 +420,16 @@ BE_GlobalData::be_get_ciao_svnt_header (UTL_String *idl_file_name, } const char * +BE_GlobalData::be_get_ciao_svnt_template_header (UTL_String *idl_file_name, + bool base_name_only) +{ + return be_change_idl_file_extension (idl_file_name, + be_global->ciao_svnt_header_template_ending (), + base_name_only); +} + + +const char * BE_GlobalData::be_get_ciao_svnt_source (UTL_String *idl_file_name, bool base_name_only) { @@ -438,12 +439,24 @@ BE_GlobalData::be_get_ciao_svnt_source (UTL_String *idl_file_name, } const char * +BE_GlobalData::be_get_ciao_svnt_template_source (UTL_String *idl_file_name, + bool base_name_only) +{ + return be_change_idl_file_extension (idl_file_name, + be_global->ciao_svnt_source_template_ending (), + base_name_only); +} + +const char * BE_GlobalData::be_get_ciao_exec_header (UTL_String *idl_file_name, bool base_name_only) { return be_change_idl_file_extension (idl_file_name, be_global->ciao_exec_header_ending (), - base_name_only); + base_name_only, + false, + false, + true); } const char * @@ -452,7 +465,10 @@ BE_GlobalData::be_get_ciao_exec_source (UTL_String *idl_file_name, { return be_change_idl_file_extension (idl_file_name, be_global->ciao_exec_source_ending (), - base_name_only); + base_name_only, + false, + false, + true); } const char * @@ -630,15 +646,6 @@ BE_GlobalData::be_get_server_template_skeleton_fname ( } const char * -BE_GlobalData::be_get_server_inline_fname ( - bool base_name_only) -{ - return - be_get_server_inline (idl_global->stripped_filename (), - base_name_only); -} - -const char * BE_GlobalData::be_get_anyop_source_fname ( bool base_name_only) { @@ -666,6 +673,15 @@ BE_GlobalData::be_get_ciao_svnt_hdr_fname ( } const char * +BE_GlobalData::be_get_ciao_tmpl_svnt_hdr_fname ( + bool base_name_only) +{ + return + be_get_ciao_svnt_template_header (idl_global->stripped_filename (), + base_name_only); +} + +const char * BE_GlobalData::be_get_ciao_svnt_src_fname ( bool base_name_only) { @@ -675,6 +691,15 @@ BE_GlobalData::be_get_ciao_svnt_src_fname ( } const char * +BE_GlobalData::be_get_ciao_tmpl_svnt_src_fname ( + bool base_name_only) +{ + return + be_get_ciao_svnt_template_source (idl_global->stripped_filename (), + base_name_only); +} + +const char * BE_GlobalData::be_get_ciao_exec_hdr_fname ( bool base_name_only) { @@ -1243,19 +1268,6 @@ BE_GlobalData::server_template_skeleton_ending (void) const } void -BE_GlobalData::server_inline_ending (const char* s) -{ - ACE::strdelete (this->server_inline_ending_); - this->server_inline_ending_ = ACE::strnew (s); -} - -const char* -BE_GlobalData::server_inline_ending (void) const -{ - return this->server_inline_ending_; -} - -void BE_GlobalData::anyop_header_ending (const char* s) { ACE::strdelete (this->anyop_hdr_ending_); @@ -1344,6 +1356,32 @@ BE_GlobalData::ciao_svnt_source_ending (void) const } void +BE_GlobalData::ciao_svnt_header_template_ending (const char* s) +{ + ACE::strdelete (this->ciao_svnt_hdr_template_ending_); + this->ciao_svnt_hdr_template_ending_ = ACE::strnew (s); +} + +const char* +BE_GlobalData::ciao_svnt_header_template_ending (void) const +{ + return this->ciao_svnt_hdr_template_ending_; +} + +void +BE_GlobalData::ciao_svnt_source_template_ending (const char* s) +{ + ACE::strdelete (this->ciao_svnt_src_template_ending_); + this->ciao_svnt_src_template_ending_ = ACE::strnew (s); +} + +const char* +BE_GlobalData::ciao_svnt_source_template_ending (void) const +{ + return this->ciao_svnt_src_template_ending_; +} + +void BE_GlobalData::ciao_exec_header_ending (const char* s) { ACE::strdelete (this->ciao_exec_hdr_ending_); @@ -1498,6 +1536,17 @@ BE_GlobalData::output_dir (void) const { return this->output_dir_; } +bool +BE_GlobalData::overwrite_not_exec (void) const +{ + return this->overwrite_not_exec_; +} + +void +BE_GlobalData::overwrite_not_exec (bool val) +{ + this->overwrite_not_exec_ = val; +} void BE_GlobalData::skel_output_dir (const char* s) @@ -1539,6 +1588,18 @@ BE_GlobalData::anyop_output_dir (void) const } void +BE_GlobalData::exec_output_dir (const char* s) +{ + ACE::strdelete (this->exec_output_dir_); + this->exec_output_dir_ = ACE::strnew (s); +} + +const char* +BE_GlobalData::exec_output_dir (void) const +{ + return this->exec_output_dir_; +} +void BE_GlobalData::any_support (bool val) { this->any_support_ = val; @@ -1972,9 +2033,6 @@ BE_GlobalData::destroy (void) ACE::strdelete (this->server_template_skeleton_ending_); this->server_template_skeleton_ending_ = 0; - ACE::strdelete (this->server_inline_ending_); - this->server_inline_ending_ = 0; - ACE::strdelete (this->anyop_hdr_ending_); this->anyop_hdr_ending_ = 0; @@ -2032,6 +2090,9 @@ BE_GlobalData::destroy (void) ACE::strdelete (this->anyop_output_dir_); this->anyop_output_dir_ = 0; + ACE::strdelete (this->exec_output_dir_); + this->exec_output_dir_ = 0; + if (0 != this->messaging_) { this->messaging_->destroy (); @@ -2304,18 +2365,6 @@ BE_GlobalData::gen_client_inline (bool val) } bool -BE_GlobalData::gen_server_inline (void) const -{ - return this->gen_server_inline_; -} - -void -BE_GlobalData::gen_server_inline (bool val) -{ - this->gen_server_inline_ = val; -} - -bool BE_GlobalData::gen_client_stub (void) const { return this->gen_client_stub_; @@ -2705,8 +2754,6 @@ BE_GlobalData::parse_args (long &i, char **av) // Default is "S.cpp". // <-sT Server's template skeleton file name ending> // Default is "S_T.cpp". - // <-si Server's inline file name ending> - // Default is "S.inl". // <-sI Server's implementation skeleton file name ending> // Default is "I.cpp". @@ -2722,12 +2769,6 @@ BE_GlobalData::parse_args (long &i, char **av) be_global->server_template_skeleton_ending (av[i + 1]); ++i; } - else if (av[i][2] == 'i') - { - idl_global->append_idl_flag (av[i + 1]); - be_global->server_inline_ending (av[i + 1]); - ++i; - } else if (av[i][2] == 'I') { idl_global->append_idl_flag (av[i + 1]); @@ -2736,7 +2777,7 @@ BE_GlobalData::parse_args (long &i, char **av) } else { - // I expect 's' or 'T' or 'i' or 't' after 's'. + // I expect 's' or 'T' or or 't' after 's'. ACE_ERROR (( LM_ERROR, ACE_TEXT ("IDL: I don't understand the '%C' option\n"), @@ -2924,6 +2965,61 @@ BE_GlobalData::parse_args (long &i, char **av) )); } } + else if (av[i][2] == 'E') + { + if (av[i][3] == '\0') + { + idl_global->append_idl_flag (av[i + 1]); + int result = ACE_OS::mkdir (av[i + 1]); + + #if !defined (__BORLANDC__) + if (result != 0 && errno != EEXIST) + #else + // The Borland RTL doesn't give EEXIST back, only EACCES in + // case the directory exists, reported to Borland as QC 9495 + if (result != 0 && errno != EEXIST && errno != EACCES) + #endif + { + ACE_ERROR (( + LM_ERROR, + ACE_TEXT ("IDL: unable to create directory %C") + ACE_TEXT (" specified by -oE option\n"), + av[i + 1] + )); + + break; + } + + be_global->exec_output_dir (av[i + 1]); + ++i; + } + else + { + ACE_ERROR (( + LM_ERROR, + ACE_TEXT ("IDL: I don't understand") + ACE_TEXT (" the '%C' option\n"), + av[i] + )); + } + } + else if (av[i][2] == 'N') + { + if (av[i][3] == '\0') + { + // Don't overwrite exec files. + be_global->overwrite_not_exec (true); + } + else + { + ACE_ERROR (( + LM_ERROR, + ACE_TEXT ("IDL: I don't understand") + ACE_TEXT (" the '%C' option\n"), + av[i] + )); + } + } else if (av[i][2] == 'S') { if (av[i][3] == '\0') @@ -3423,7 +3519,6 @@ BE_GlobalData::parse_args (long &i, char **av) { // Disable skeleton file generation. be_global->gen_skel_files (false); - be_global->gen_server_inline (false); be_global->gen_server_skeleton (false); } else @@ -3437,12 +3532,7 @@ BE_GlobalData::parse_args (long &i, char **av) } else if (av[i][2] == 's') { - if (av[i][3] == 'i') - { - // No skeleton inline. - be_global->gen_server_inline (false); - } - else if (av[i][3] == 'c') + if (av[i][3] == 'c') { // No skeleton inline. be_global->gen_server_skeleton (false); diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp index b0028396a15..799dd96221d 100644 --- a/TAO/TAO_IDL/be/be_interface.cpp +++ b/TAO/TAO_IDL/be/be_interface.cpp @@ -94,6 +94,7 @@ be_interface::be_interface (UTL_ScopedName *n, skel_count_ (0), in_mult_inheritance_ (-1), original_interface_ (0), + is_amh_rh_ (false), is_ami_rh_ (false), is_ami4ccm_rh_ (false), full_skel_name_ (0), @@ -929,6 +930,19 @@ int be_interface::gen_operation_table (const char *flat_name, const char *skeleton_class_name) { + // TODO: + // find another way to determine whether this is an AMH class + // Create 'is_amh' methods, just like AMI. Problem is finding where + // to invoke these methods since an AMH class is generated twice: + // once for AMH and once the 'normal' way. + + bool amh = false; + ACE_CString tmp (skeleton_class_name); + if (tmp.strstr ("AMH_") != ACE_String_Base_Const::npos) + { + amh = true; + } + // Check out the op_lookup_strategy. switch (be_global->lookup_strategy ()) { @@ -970,39 +984,96 @@ 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}," << be_nl; + if (amh) + { + *os << "{\"_is_a\", &TAO_AMH_Skeletons::_is_a_amh_skel, 0}," << be_nl; + } + else if (be_global->gen_thru_poa_collocation ()) + { + *os << "{\"_is_a\", &TAO_ServantBase::_is_a_thru_poa_skel, 0}," << be_nl; + } + else + { + *os << "{\"_is_a\", &TAO_ServantBase::_is_a_skel, 0}," << be_nl; + } ++this->skel_count_; if (!be_global->gen_minimum_corba ()) { - *os << "{\"_non_existent\", &" << skeleton_class_name - << "::_non_existent_skel, 0}," << be_nl; + if (amh) + { + *os << "{\"_non_existent\", &TAO_AMH_Skeletons" + << "::_non_existent_amh_skel, 0}," << be_nl; + } + else if (be_global->gen_thru_poa_collocation ()) + { + *os << "{\"_non_existent\", &TAO_ServantBase" + << "::_non_existent_thru_poa_skel, 0}," << be_nl; + } + else + { + *os << "{\"_non_existent\", &TAO_ServantBase" + << "::_non_existent_skel, 0}," << be_nl; + } ++this->skel_count_; } if (!be_global->gen_corba_e () && !be_global->gen_minimum_corba ()) { - *os << "{\"_component\", &" << skeleton_class_name - << "::_component_skel, 0}," << be_nl; + if (amh) + { + *os << "{\"_component\", &TAO_AMH_Skeletons" + << "::_component_amh_skel, 0}," << be_nl; + } + else if (be_global->gen_thru_poa_collocation ()) + { + *os << "{\"_component\", &TAO_ServantBase" + << "::_component_thru_poa_skel, 0}," << be_nl; + } + else + { + *os << "{\"_component\", &TAO_ServantBase" + << "::_component_skel, 0}," << be_nl; + } ++this->skel_count_; } if (!be_global->gen_corba_e () && !be_global->gen_minimum_corba ()) { - *os << "{\"_interface\", &" << skeleton_class_name - << "::_interface_skel, 0}," << be_nl; + if (amh) + { + *os << "{\"_interface\", &TAO_AMH_Skeletons" + << "::_interface_amh_skel, 0}," << be_nl; + } + else + { + *os << "{\"_interface\", &TAO_ServantBase" + << "::_interface_skel, 0}," << be_nl; + } ++this->skel_count_; } if (!be_global->gen_minimum_corba ()) { - *os << "{\"_repository_id\", &" << skeleton_class_name - << "::_repository_id_skel, 0}" << be_uidt_nl; + if (amh) + { + *os << "{\"_repository_id\", &TAO_AMH_Skeletons" + << "::_repository_id_amh_skel, 0}" << be_uidt_nl; + } + else if (be_global->gen_thru_poa_collocation ()) + { + *os << "{\"_repository_id\", &TAO_ServantBase" + << "::_repository_id_thru_poa_skel, 0}" << be_uidt_nl; + } + else + { + *os << "{\"_repository_id\", &TAO_ServantBase" + << "::_repository_id_skel, 0}" << be_uidt_nl; + } ++this->skel_count_; } @@ -1137,43 +1208,98 @@ be_interface::gen_operation_table (const char *flat_name, -1); } - *os << "_is_a,&" - << skeleton_class_name - << "::_is_a_skel, 0" << be_nl; + if (amh) + { + *os << "_is_a,&TAO_AMH_Skeletons" + << "::_is_a_amh_skel, 0" << be_nl; + } + else if (be_global->gen_thru_poa_collocation ()) + { + *os << "_is_a,&TAO_ServantBase" + << "::_is_a_thru_poa_skel, 0" << be_nl; + } + else + { + *os << "_is_a,&TAO_ServantBase" + << "::_is_a_skel, 0" << be_nl; + } ++this->skel_count_; if (!be_global->gen_minimum_corba ()) { - *os << "_non_existent,&" - << skeleton_class_name - << "::_non_existent_skel, 0" << be_nl; + if (amh) + { + *os << "_non_existent,&TAO_AMH_Skeletons" + << "::_non_existent_amh_skel, 0" << be_nl; + } + else if (be_global->gen_thru_poa_collocation ()) + { + *os << "_non_existent,&TAO_ServantBase" + << "::_non_existent_thru_poa_skel, 0" << be_nl; + } + else + { + *os << "_non_existent,&TAO_ServantBase" + << "::_non_existent_skel, 0" << be_nl; + } ++this->skel_count_; } if (!be_global->gen_corba_e () && !be_global->gen_minimum_corba ()) { - *os << "_component,&" - << skeleton_class_name - << "::_component_skel, 0" << be_nl; + if (amh) + { + *os << "_component,&TAO_AMH_Skeletons" + << "::_component_amh_skel, 0" << be_nl; + } + else if (be_global->gen_thru_poa_collocation ()) + { + *os << "_component,&TAO_ServantBase" + << "::_component_thru_poa_skel, 0" << be_nl; + } + else + { + *os << "_component,&TAO_ServantBase" + << "::_component_skel, 0" << be_nl; + } ++this->skel_count_; } if (!be_global->gen_corba_e () && !be_global->gen_minimum_corba ()) { - *os << "_interface,&" - << skeleton_class_name - << "::_interface_skel, 0" << be_nl; + if (amh) + { + *os << "_interface,&TAO_AMH_Skeletons" + << "::_interface_amh_skel, 0" << be_nl; + } + else + { + *os << "_interface,&TAO_ServantBase" + << "::_interface_skel, 0" << be_nl; + } ++this->skel_count_; } if (!be_global->gen_minimum_corba ()) { - *os << "_repository_id,&" - << skeleton_class_name - << "::_repository_id_skel, 0" << be_nl; + if (amh) + { + *os << "_repository_id,&TAO_AMH_Skeletons" + << "::_repository_id_amh_skel, 0" << be_nl; + } + else if (be_global->gen_thru_poa_collocation ()) + { + *os << "_repository_id,&TAO_ServantBase" + << "::_repository_id_thru_poa_skel, 0" << be_nl; + } + else + { + *os << "_repository_id,&TAO_ServantBase" + << "::_repository_id_skel, 0" << be_nl; + } ++this->skel_count_; } @@ -1281,7 +1407,7 @@ be_interface::gen_optable_entries (be_interface *derived_interface, if (be_global->gen_direct_collocation ()) { *os << " &" - << derived_interface->full_direct_proxy_impl_name () + << this->full_direct_proxy_impl_name () << "::" << d->local_name (); } else @@ -1310,7 +1436,7 @@ be_interface::gen_optable_entries (be_interface *derived_interface, if (be_global->gen_direct_collocation ()) { *os << " &" - << derived_interface->full_direct_proxy_impl_name () + << this->full_direct_proxy_impl_name () << "::_get_" << d->local_name (); } else @@ -1332,7 +1458,7 @@ be_interface::gen_optable_entries (be_interface *derived_interface, if (be_global->gen_direct_collocation ()) { *os << " &" - << derived_interface->full_direct_proxy_impl_name () + << this->full_direct_proxy_impl_name () << "::_set_" << d->local_name (); } else @@ -1378,15 +1504,64 @@ be_interface::gen_optable_entries (be_interface *derived_interface, // We are an operation node. We use the original // operation name, not the one with _cxx_ in it. - *os << d->original_local_name () << ",&" - << full_skeleton_name << "::" - << d->local_name () << "_skel,"; - + // We need to the name of the base class!! But since + // we don't know whether this is an AMH class, we + // need to check this, using the full_skeleton_name + // TODO: find a more elegant solution for this + ACE_CString tmp (full_skeleton_name); + if (tmp.strstr ("AMH_") != ACE_String_Base_Const::npos) + { + ACE_CString name (d->full_name ()); + ACE_String_Base_Const::size_type const last = name.rfind(':') - 1; + name = name.substring (0, last); + if (name.rfind (':') != ACE_String_Base_Const::npos) + { + ACE_CString nspace = name.substring (0, name.rfind (':') - 1); + name = name.substring (name.rfind (':') + 1); + *os << d->original_local_name () << ",&POA_" + << nspace.c_str () << "::AMH_" + << name.c_str () << "::" + << d->original_local_name () + << "_skel,"; + } + else + { + *os << d->original_local_name () << ",&POA_AMH_" + << name.c_str () << "::" + << d->original_local_name () + << "_skel,"; + } + } + else + { + if (!d->is_abstract ()) + { + *os << d->original_local_name () << ",&POA_" + << d->full_name () << "_skel,"; + } + else + { + *os << d->original_local_name () << ",&" + << full_skeleton_name << "::" + << d->original_local_name () + << "_skel,"; + } + } if (be_global->gen_direct_collocation ()) { - *os << " &" - << derived_interface->full_direct_proxy_impl_name (); - *os << "::" << d->local_name (); + if (!d->is_abstract ()) + { + *os << " &" + << this->full_direct_proxy_impl_name () + << "::" << d->local_name (); + } + else + { + *os << " &" + << derived_interface->full_direct_proxy_impl_name () + << "::" << d->local_name (); + } + } else { @@ -1408,19 +1583,47 @@ be_interface::gen_optable_entries (be_interface *derived_interface, } // Generate only the "get" entry if we are readonly. - *os << "_get_" << d->original_local_name () << ",&" - << full_skeleton_name << "::_get_" - << d->local_name () << "_skel,"; + // we need to split the full name in order to push _set_ + // or _get_ in between the namespace and attribute name. - if (be_global->gen_direct_collocation ()) + //determine the correct namespace + ACE_CString nspace (d->full_name ()); + ACE_String_Base_Const::size_type const pos = nspace.rfind(':'); + nspace = nspace.substring(0, pos + 1); + + if (!d->is_abstract ()) { - *os << " &" - << derived_interface->full_direct_proxy_impl_name () - << "::_get_" << d->local_name (); + *os << "_get_" << d->original_local_name () << ",&POA_" + << nspace.c_str () << "_get_" + << d->original_local_name () << "_skel,"; + + if (be_global->gen_direct_collocation ()) + { + *os << " &" + << this->full_direct_proxy_impl_name () + << "::_get_" << d->local_name (); + } + else + { + *os << " 0"; + } } else { - *os << " 0"; + *os << "_get_" << d->original_local_name () << ",&" + << full_skeleton_name << "::_get_" + << d->original_local_name () << "_skel,"; + + if (be_global->gen_direct_collocation ()) + { + *os << " &" + << derived_interface->full_direct_proxy_impl_name () + << "::_get_" << d->local_name (); + } + else + { + *os << " 0"; + } } *os << "\n"; @@ -1429,20 +1632,41 @@ be_interface::gen_optable_entries (be_interface *derived_interface, if (!attr->readonly ()) { - // The set method - *os << "_set_" << d->original_local_name () << ",&" - << full_skeleton_name << "::_set_" - << d->local_name () << "_skel,"; - - if (be_global->gen_direct_collocation ()) + if (!d->is_abstract ()) { - *os << " &" - << derived_interface->full_direct_proxy_impl_name () - << "::_set_" << d->local_name (); + // The set method + *os << "_set_" << d->original_local_name () << ",&POA_" + << nspace.c_str () << "_set_" + << d->original_local_name () << "_skel,"; + + if (be_global->gen_direct_collocation ()) + { + *os << " &" + << this->full_direct_proxy_impl_name () + << "::_set_" << d->local_name (); + } + else + { + *os << " 0"; + } } else { - *os << " 0"; + // The set method in case abstract + *os << "_set_" << d->original_local_name () << ",&" + << full_skeleton_name << "::_set_" + << d->original_local_name () << "_skel,"; + + if (be_global->gen_direct_collocation ()) + { + *os << " &" + << derived_interface->full_direct_proxy_impl_name () + << "::_set_" << d->local_name (); + } + else + { + *os << " 0"; + } } *os << "\n"; @@ -1464,37 +1688,6 @@ be_interface::gen_optable_entries (be_interface *derived_interface, } void -be_interface::gen_collocated_skel_body (be_interface *derived, - be_interface *ancestor, - AST_Decl *d, - const char *prefix, - bool /* direct */, - UTL_ExceptList *, - TAO_OutStream *os) -{ - *os << be_nl_2 << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__; - - // Generate the static method corresponding to this method. - *os << be_nl_2 - << "ACE_INLINE void" << be_nl - << derived->full_direct_proxy_impl_name () - << "::" << prefix << d->local_name () << " (" - << be_idt_nl - << "TAO_Abstract_ServantBase *servant," << be_nl - << "TAO::Argument ** args)" << be_uidt_nl; - - *os << "{" << be_idt_nl - << ancestor->full_direct_proxy_impl_name () - << "::" << prefix << d->local_name () << " (" - << be_idt_nl - << "servant," << be_nl - << "args);" << be_uidt - << be_uidt_nl - << "}"<< be_nl; -} - -void be_interface::gen_ostream_operator (TAO_OutStream *os, bool /* use_underscore */) { @@ -2130,375 +2323,6 @@ be_interface::is_a_helper (be_interface * /*derived*/, } int -be_interface::gen_skel_helper (be_interface *derived, - be_interface *ancestor, - TAO_OutStream *os) -{ - // If derived and ancestor are same, skip it. - if (derived == ancestor) - { - return 0; - } - - // If an operation or an attribute is abstract (declared in an - // abstract interface), we will either generate the full - // definition (if there are no concrete interfaces between the - // abstract ancestor and us) or, if there is a concrete ancestor - // in between, we will catch its definition elsewhere in this - // traversal. - if (ancestor->is_abstract ()) - { - return 0; - } - - // Else generate code that does the cast to the appropriate type. - - if (ancestor->nmembers () > 0) - { - // If there are elements in ancestor scope i.e., any operations and - // attributes defined by "ancestor", become methods on the derived - // class which call the corresponding method of the base class by - // doing the proper casting. - for (UTL_ScopeActiveIterator si (ancestor, UTL_Scope::IK_decls); - !si.is_done (); - si.next ()) - { - // Get the next AST decl node - AST_Decl *d = si.item (); - AST_Decl::NodeType nt = d->node_type (); - - if (nt == AST_Decl::NT_op) - { - be_operation *op = - be_operation::narrow_from_decl (d); - - /// These are not generated on the server side. - if (op->is_sendc_ami ()) - { - continue; - } - - *os << be_nl_2 - << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ - << be_nl_2; - - if (os->stream_type () == TAO_OutStream::TAO_SVR_HDR) - { - // Generate the static method corresponding to this method. - *os << "static void" << be_nl - << d->local_name () - << "_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest & server_request," << be_nl - << "void * servant_upcall," << be_nl - << "void * servant);" << be_uidt - << be_uidt; - } - else - { // Generate code in the inline file. - // Generate the static method corresponding to this method. - *os << "ACE_INLINE" << be_nl - << "void" << be_nl - << derived->full_skel_name () << "::" - << d->local_name () - << "_skel (" << be_idt_nl - << "TAO_ServerRequest & server_request," << be_nl - << "void * servant_upcall," << be_nl - << "void * servant)" - << be_uidt_nl - << "{" << be_idt_nl; - - *os << ancestor->full_skel_name () - << " * const impl =" << be_idt_nl - << "static_cast<" - << derived->full_skel_name () - << " *> (servant);" << be_uidt_nl; - - *os << ancestor->full_skel_name () - << "::" << d->local_name () - << "_skel (" << be_idt_nl - << "server_request," << be_nl - << "servant_upcall," << be_nl - << "impl);" << be_uidt - << be_uidt_nl - << "}"; - } - } - else if (nt == AST_Decl::NT_attr) - { - AST_Attribute *attr = AST_Attribute::narrow_from_decl (d); - - if (attr == 0) - { - return -1; - } - - *os << be_nl_2; - - if (os->stream_type () == TAO_OutStream::TAO_SVR_HDR) - { - // Generate the static method corresponding to this method. - *os << "static void" << be_nl - << "_get_" << d->local_name () - << "_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest & server_request," << be_nl - << "void * servant_upcall," << be_nl - << "void * servant);" << be_uidt - << be_uidt; - } - else - { // Generate code in the inline file. - // Generate the static method corresponding to this method. - *os << "ACE_INLINE" << be_nl - << "void" << be_nl - << derived->full_skel_name () << "::_get_" - << d->local_name () - << "_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest & server_request," << be_nl - << "void * servant_upcall," << be_nl - << "void * servant)" << be_uidt - << be_uidt_nl - << "{" << be_idt_nl; - - *os << ancestor->full_skel_name () - << " * const impl = static_cast<" - << derived->full_skel_name () - << " *> (servant);" << be_nl; - - *os << ancestor->full_skel_name () - << "::_get_" << d->local_name () - << "_skel (" << be_idt << be_idt_nl - << "server_request," << be_nl - << "servant_upcall," << be_nl - << "impl);" << be_uidt - << be_uidt << be_uidt_nl - << "}"; - } - - if (!attr->readonly ()) - { - *os << be_nl_2; - - if (os->stream_type () == TAO_OutStream::TAO_SVR_HDR) - { - // Generate the static method corresponding to - // this method. - *os << "static void" << be_nl - << "_set_" << d->local_name () - << "_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest & server_request," << be_nl - << "void * servant_upcall," << be_nl - << "void * servant);" << be_uidt - << be_uidt; - } - else - { // Generate code in the inline file. - // Generate the static method corresponding to - // this method. - *os << "ACE_INLINE" << be_nl - << "void" << be_nl - << derived->full_skel_name () - << "::_set_" << d->local_name () - << "_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest & server_request," << be_nl - << "void * servant_upcall," << be_nl - << "void * servant)" << be_uidt - << be_uidt_nl - << "{" << be_idt_nl; - - *os << ancestor->full_skel_name () - << " * const impl = static_cast<" - << derived->full_skel_name () - << " *> (servant);" << be_nl; - - *os << ancestor->full_skel_name () - << "::_set_" << d->local_name () - << "_skel (" << be_idt << be_idt_nl - << "server_request," << be_nl - << "servant_upcall," << be_nl - << "impl);" << be_uidt - << be_uidt << be_uidt_nl - << "}"; - } - } - } - } // End of FOR. - } - - return 0; -} - -int -be_interface::gen_colloc_op_decl_helper (be_interface *derived, - be_interface *ancestor, - TAO_OutStream *os) -{ - // If derived and ancestor are same, skip it. - if (derived == ancestor) - { - return 0; - } - - // If an operation or an attribute is abstract (declared in an - // abstract interface), we will either generate the full - // definition (if there are no concrete interfaces between the - // abstract ancestor and us) or, if there is a concrete ancestor - // in between, we will catch its definition elsewhere in this - // traversal. - if (ancestor->is_abstract () || ancestor->nmembers () == 0) - { - return 0; - } - - for (UTL_ScopeActiveIterator si (ancestor, UTL_Scope::IK_decls); - !si.is_done (); - si.next ()) - { - // Get the next AST decl node - AST_Decl *d = si.item (); - - if (d->node_type () == AST_Decl::NT_op) - { - *os << be_nl_2 << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl_2; - - // Generate the static method corresponding to this method. - *os << "static void" << be_nl - << d->local_name () << " (" << be_idt_nl - << "TAO_Abstract_ServantBase *servant, " - << "TAO::Argument **args);" << be_uidt_nl; - } - else if (d->node_type () == AST_Decl::NT_attr) - { - AST_Attribute *attr = AST_Attribute::narrow_from_decl (d); - - if (attr == 0) - { - return -1; - } - - // Generate the static method corresponding to this method. - *os << "static void" << be_nl - << "_get_" << d->local_name () << " (" << be_idt_nl - << "TAO_Abstract_ServantBase *servant, " - << "TAO::Argument **args);" << be_uidt_nl; - - if (!attr->readonly ()) - { - *os << be_nl_2; - - // Generate the static method corresponding to - // this method. - *os << "static void" << be_nl - << "_set_" << d->local_name () << " (" - << be_idt_nl - << "TAO_Abstract_ServantBase *servant, " - << "TAO::Argument **args);" << be_uidt_nl; - } - } - } - - return 0; -} - -int -be_interface::gen_colloc_op_defn_helper (be_interface *derived, - be_interface *ancestor, - TAO_OutStream *os) -{ - // If derived and ancestor are same, skip it. - if (derived == ancestor) - { - return 0; - } - - // If an operation or an attribute is abstract (declared in an - // abstract interface), we will either generate the full - // definition (if there are no concrete interfaces between the - // abstract ancestor and us) or, if there is a concrete ancestor - // in between, we will catch its definition elsewhere in this - // traversal. - if (ancestor->is_abstract () || ancestor->nmembers () == 0) - { - return 0; - } - - AST_Decl *d = 0; - be_operation *op = 0; - - for (UTL_ScopeActiveIterator si (ancestor, UTL_Scope::IK_decls); - !si.is_done (); - si.next ()) - { - // Get the next AST decl node - d = si.item (); - AST_Decl::NodeType nt = d->node_type (); - - if (nt == AST_Decl::NT_op) - { - op = be_operation::narrow_from_decl (d); - - /// Skip these on the skeleton side. - if (op->is_sendc_ami ()) - { - continue; - } - - if (be_global->gen_direct_collocation ()) - { - be_interface::gen_collocated_skel_body (derived, - ancestor, - d, - "", - true, - op->exceptions (), - os); - } - } - else if (nt == AST_Decl::NT_attr) - { - AST_Attribute *attr = AST_Attribute::narrow_from_decl (d); - - if (attr == 0) - { - return -1; - } - - if (be_global->gen_direct_collocation ()) - { - be_interface::gen_collocated_skel_body ( - derived, - ancestor, - d, - "_get_", - true, - attr->get_get_exceptions (), - os - ); - } - - if (!attr->readonly ()) - { - if (be_global->gen_direct_collocation ()) - { - be_interface::gen_collocated_skel_body ( - derived, - ancestor, - d, - "_set_", - true, - attr->get_set_exceptions (), - os - ); - } - } - } - } - - return 0; -} - -int be_interface::copy_ctor_helper (be_interface *derived, be_interface *base, TAO_OutStream *os) diff --git a/TAO/TAO_IDL/be/be_produce.cpp b/TAO/TAO_IDL/be/be_produce.cpp index aa74be74b5c..9cd87e5a950 100644 --- a/TAO/TAO_IDL/be/be_produce.cpp +++ b/TAO/TAO_IDL/be/be_produce.cpp @@ -74,6 +74,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "be_extern.h" #include "fe_extern.h" #include "global_extern.h" +#include "be_util.h" // Clean up before exit, whether successful or not. TAO_IDL_BE_Export void @@ -185,13 +186,6 @@ BE_produce (void) be_visitor_root_sh root_sh_visitor (&ctx); BE_visit_root (root_sh_visitor, "server header"); - if (be_global->gen_server_inline ()) - { - ctx.state (TAO_CodeGen::TAO_ROOT_SI); - be_visitor_root_si root_si_visitor (&ctx); - BE_visit_root (root_si_visitor, "server inline"); - } - if (be_global->gen_server_skeleton ()) { ctx.state (TAO_CodeGen::TAO_ROOT_SS); @@ -228,6 +222,14 @@ BE_produce (void) ctx.state (TAO_CodeGen::TAO_ROOT_SVS); be_visitor_root_svs root_svs_visitor (&ctx); BE_visit_root (root_svs_visitor, "CIAO servant source"); + + ctx.state (TAO_CodeGen::TAO_ROOT_SVTH); + be_visitor_root_svth root_svth_visitor (&ctx); + BE_visit_root (root_svth_visitor, "CIAO template servant header"); + + ctx.state (TAO_CodeGen::TAO_ROOT_SVTS); + be_visitor_root_svts root_svts_visitor (&ctx); + BE_visit_root (root_svts_visitor, "CIAO template servant source"); } if (be_global->gen_ciao_exec_idl ()) @@ -239,13 +241,17 @@ BE_produce (void) if (be_global->gen_ciao_exec_impl ()) { - ctx.state (TAO_CodeGen::TAO_ROOT_EXH); - be_visitor_root_exh root_exh_visitor (&ctx); - BE_visit_root (root_exh_visitor, "CIAO exec impl header"); - - ctx.state (TAO_CodeGen::TAO_ROOT_EXS); - be_visitor_root_exs root_exs_visitor (&ctx); - BE_visit_root (root_exs_visitor, "CIAO exec impl source"); + bool generate = be_util::overwrite_ciao_exec_files (); + if(generate) + { + ctx.state (TAO_CodeGen::TAO_ROOT_EXH); + be_visitor_root_exh root_exh_visitor (&ctx); + BE_visit_root (root_exh_visitor, "CIAO exec impl header"); + + ctx.state (TAO_CodeGen::TAO_ROOT_EXS); + be_visitor_root_exs root_exs_visitor (&ctx); + BE_visit_root (root_exs_visitor, "CIAO exec impl source"); + } } if (be_global->gen_ciao_conn_impl ()) diff --git a/TAO/TAO_IDL/be/be_provides.cpp b/TAO/TAO_IDL/be/be_provides.cpp index 5c788a3ee39..938c66559b4 100644 --- a/TAO/TAO_IDL/be/be_provides.cpp +++ b/TAO/TAO_IDL/be/be_provides.cpp @@ -47,19 +47,18 @@ be_provides::provides_type (void) const } int -be_provides::gen_facet_svnt_decl (TAO_OutStream &os) +be_provides::gen_facet_svnt_tmpl_decl (TAO_OutStream &os) { - be_type *impl = + be_type *impl = be_type::narrow_from_decl (this->provides_type ()); - if (impl->is_local () || impl->svnt_hdr_facet_gen ()) - { - return 0; - } + if (impl->is_local () || impl->svnt_hdr_facet_gen ()) + { + return 0; + } - // No '_cxx_' prefix> const char *lname = - impl->original_local_name ()->get_string (); + impl->local_name ()->get_string (); be_decl *scope = be_scope::narrow_from_scope (impl->defined_in ())->decl (); @@ -74,31 +73,22 @@ be_provides::gen_facet_svnt_decl (TAO_OutStream &os) << "namespace CIAO_FACET" << suffix.c_str () << be_nl << "{" << be_idt_nl; - const char *impl_name = "::CORBA::Object"; bool is_intf = impl->node_type () == AST_Decl::NT_interface; - if (is_intf) - { - impl_name = - be_interface::narrow_from_decl (impl)->full_skel_name (); - } - - os << "class " << lname << "_Servant" << be_idt_nl - << ": public virtual " << impl_name << be_uidt_nl - << "{" << be_nl + os << "template <typename BASE, typename EXEC, typename CONTEXT>" << be_nl + << "class " << lname << "_Servant_T" << be_idt_nl + << ": public virtual ::CIAO::Facet_Servant_Base_T<BASE, EXEC, " + << "CONTEXT>" << be_uidt_nl << "{" << be_nl << "public:" << be_idt_nl; AST_Decl *s = ScopeAsDecl (impl->defined_in ()); ACE_CString sname_str (s->full_name ()); - const char *sname = sname_str.c_str (); - const char *global = (sname_str == "" ? "" : "::"); - os << lname << "_Servant (" << be_idt_nl - << global << sname << "::CCM_" - << lname << "_ptr executor," << be_nl + os << lname << "_Servant_T (" << be_idt_nl + << "typename EXEC::_ptr_type executor," << be_nl << "::Components::CCMContext_ptr ctx);" << be_uidt_nl << be_nl; - os << "virtual ~" << lname << "_Servant (void);"; + os << "virtual ~" << lname << "_Servant_T (void);"; if (is_intf) { @@ -124,20 +114,7 @@ be_provides::gen_facet_svnt_decl (TAO_OutStream &os) } } - os << be_nl_2 << "/// Get component implementation." << be_nl - << "virtual CORBA::Object_ptr _get_component (void);" - << be_uidt_nl << be_nl; - - os << "protected:" << be_idt_nl; - - os << "/// Facet executor." << be_nl - << global << sname << "::CCM_" - << lname << "_var executor_;" << be_nl_2; - - os << "/// Context object." << be_nl - << "::Components::CCMContext_var ctx_;" << be_uidt_nl; - - os << "};" << be_nl << be_uidt_nl; + os << be_uidt_nl << "};" << be_nl << be_uidt_nl; os << "}"; @@ -146,7 +123,7 @@ be_provides::gen_facet_svnt_decl (TAO_OutStream &os) } int -be_provides::gen_facet_svnt_defn (TAO_OutStream &os) +be_provides::gen_facet_svnt_tmpl_defn (TAO_OutStream &os) { be_type *impl = be_type::narrow_from_decl (this->provides_type ()); @@ -156,16 +133,14 @@ be_provides::gen_facet_svnt_defn (TAO_OutStream &os) return 0; } - // No '_cxx_' prefix. const char *lname = - impl->original_local_name ()->get_string (); + impl->local_name ()->get_string (); be_decl *scope = be_scope::narrow_from_scope (impl->defined_in ())->decl (); ACE_CString sname_str (scope->full_name ()); - const char *sname = sname_str.c_str (); const char *global = (sname_str == "" ? "" : "::"); ACE_CString suffix (scope->flat_name ()); @@ -179,22 +154,20 @@ be_provides::gen_facet_svnt_defn (TAO_OutStream &os) << "namespace CIAO_FACET" << suffix.c_str () << be_nl << "{" << be_idt_nl; - os << lname << "_Servant::" - << lname << "_Servant (" << be_idt << be_idt_nl - << global << sname << "::CCM_" - << lname << "_ptr executor," << be_nl + os << "template <typename BASE, typename EXEC, typename CONTEXT>" << be_nl + << lname << "_Servant_T<BASE, EXEC, CONTEXT>::" + << lname << "_Servant_T (" << be_idt << be_idt_nl + << "typename EXEC::_ptr_type executor," << be_nl << "::Components::CCMContext_ptr ctx)" << be_uidt_nl - << ": executor_ ( " << global << sname - << "::CCM_" << lname - << "::_duplicate (executor))," << be_idt_nl - << "ctx_ ( ::Components::CCMContext::_duplicate (ctx))" - << be_uidt << be_uidt_nl + << ": " << global << "CIAO::Facet_Servant_Base_T<BASE, EXEC, " + << "CONTEXT> (executor, ctx)" + << be_uidt_nl << "{" << be_nl << "}"; - os << be_nl_2 - << lname << "_Servant::~" - << lname << "_Servant (void)" << be_nl + os << be_nl_2 << "template <typename BASE, typename EXEC, typename CONTEXT>" << be_nl + << lname << "_Servant_T<BASE, EXEC, CONTEXT>::~" + << lname << "_Servant_T (void)" << be_nl << "{" << be_nl << "}"; @@ -233,35 +206,7 @@ be_provides::gen_facet_svnt_defn (TAO_OutStream &os) } } - os << be_nl_2 - << "::CORBA::Object_ptr" << be_nl - << lname << "_Servant::_get_component (void)" - << be_nl - << "{" << be_idt_nl - << "::Components::" << be_global->ciao_container_type () - << "Context_var sc =" << be_idt_nl - << "::Components::" << be_global->ciao_container_type () - << "Context::_narrow (this->ctx_.in ());" - << be_uidt_nl << be_nl - << "if (! ::CORBA::is_nil (sc.in ()))" << be_idt_nl - << "{" << be_idt_nl; - - if (ACE_OS::strcmp (be_global->ciao_container_type (), "Session") == 0) - { - os << "return sc->get_CCM_object ();"; - } - else - { - os << "return ::CORBA::Object::_nil ();"; - } - - os << be_uidt_nl << "}" << be_uidt_nl << be_nl; - - os << "throw ::CORBA::INTERNAL ();" << be_uidt_nl - << "}"; - - os << be_uidt_nl - << "}"; + os << be_uidt_nl << "}"; impl->svnt_src_facet_gen (true); return 0; @@ -304,7 +249,7 @@ be_facet_op_attr_defn_helper::emit (be_interface * /* derived_interface */, be_visitor_context ctx; ctx.stream (os); - ctx.state (TAO_CodeGen::TAO_ROOT_SVS); + ctx.state (TAO_CodeGen::TAO_ROOT_SVTS); for (UTL_ScopeActiveIterator i (base_interface, UTL_Scope::IK_decls); !i.is_done (); diff --git a/TAO/TAO_IDL/be/be_util.cpp b/TAO/TAO_IDL/be/be_util.cpp index a3dd1bf7e12..4c5f786e8a1 100644 --- a/TAO/TAO_IDL/be/be_util.cpp +++ b/TAO/TAO_IDL/be/be_util.cpp @@ -789,6 +789,17 @@ be_util::usage (void) )); ACE_DEBUG (( LM_DEBUG, + ACE_TEXT (" -oE <output_dir>\tOutput directory for the generated ") + ACE_TEXT ("executor files, only when -Gex option is used.") + ACE_TEXT (" Default is current directory\n") + )); + ACE_DEBUG (( + LM_DEBUG, + ACE_TEXT (" -oN\tWhen -Gex option is used, executor files shouldn't be overwritten ") + ACE_TEXT ("if they are already in the output directory.\n") + )); + ACE_DEBUG (( + LM_DEBUG, ACE_TEXT (" -si\t\t\tServer's inline file name ending.") ACE_TEXT (" Default is S.inl\n") )); @@ -847,16 +858,11 @@ be_util::usage (void) ACE_DEBUG (( LM_DEBUG, ACE_TEXT (" -SS\t\t\tsuppress generating skeleton implementation") - ACE_TEXT (" and inline file (disabled by default)\n") - )); - ACE_DEBUG (( - LM_DEBUG, - ACE_TEXT (" -Sci\t\t\tsuppress generating client inline file") ACE_TEXT (" (disabled by default)\n") )); ACE_DEBUG (( LM_DEBUG, - ACE_TEXT (" -Ssi\t\t\tsuppress generating server inline file") + ACE_TEXT (" -Sci\t\t\tsuppress generating client inline file") ACE_TEXT (" (disabled by default)\n") )); ACE_DEBUG (( @@ -905,7 +911,8 @@ be_util::generator_init (void) const char * be_util::get_output_path (bool for_anyop, - bool for_skel) + bool for_skel, + bool for_exec) { if (for_anyop && 0 != be_global->anyop_output_dir ()) { @@ -915,12 +922,46 @@ be_util::get_output_path (bool for_anyop, { return be_global->skel_output_dir (); } + else if (for_exec && 0 != be_global->exec_output_dir ()) + { + return be_global->exec_output_dir (); + } else { return be_global->output_dir (); } } +bool +be_util::overwrite_ciao_exec_files () +{ + bool overwrite = true; + if (be_global->overwrite_not_exec()) + { + bool src_exist = false; + bool hdr_exist = false; + const char *fname_hdr = be_global->be_get_ciao_exec_hdr_fname (false); + FILE* fp_hdr = ACE_OS::fopen(fname_hdr, "r"); + if (fp_hdr) + { + // file exists, don't generate new exec files. + ACE_OS::fclose(fp_hdr); + hdr_exist = true; + } + const char *fname_src = be_global->be_get_ciao_exec_src_fname (false); + FILE* fp_src = ACE_OS::fopen(fname_src, "r"); + if (fp_src) + { + // file exists, don't generate new exec files. + ACE_OS::fclose(fp_src); + src_exist = true; + } + if (hdr_exist && src_exist) + overwrite = false; + } + return overwrite; +} + void be_util::set_arg_seen_bit (be_type *bt) { diff --git a/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp b/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp index 13d35b9613b..6f9c00523c2 100644 --- a/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp +++ b/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp @@ -115,7 +115,6 @@ be_visitor_amh_pre_proc::visit_interface (be_interface *node) be_interface *response_handler = this->create_response_handler (node, excep_holder); - if (response_handler == 0) { ACE_ERROR_RETURN ((LM_ERROR, diff --git a/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp b/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp index 36e5969b365..db8b57209f1 100644 --- a/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp +++ b/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp @@ -171,12 +171,14 @@ be_visitor_attribute::visit_attribute (be_attribute *node) status = get_op.accept (&visitor); break; } + case TAO_CodeGen::TAO_ROOT_SVTH: case TAO_CodeGen::TAO_ROOT_SVH: { be_visitor_operation_ch visitor (&ctx); status = get_op.accept (&visitor); break; } + case TAO_CodeGen::TAO_ROOT_SVTS: case TAO_CodeGen::TAO_ROOT_SVS: { be_visitor_operation_svs visitor (&ctx); @@ -340,12 +342,14 @@ be_visitor_attribute::visit_attribute (be_attribute *node) status = set_op.accept (&visitor); break; } + case TAO_CodeGen::TAO_ROOT_SVTH: case TAO_CodeGen::TAO_ROOT_SVH: { be_visitor_operation_ch visitor (&ctx); status = set_op.accept (&visitor); break; } + case TAO_CodeGen::TAO_ROOT_SVTS: case TAO_CodeGen::TAO_ROOT_SVS: { be_visitor_operation_svs visitor (&ctx); diff --git a/TAO/TAO_IDL/be/be_visitor_component.cpp b/TAO/TAO_IDL/be/be_visitor_component.cpp index a1e66d0c267..ac735c69cb9 100644 --- a/TAO/TAO_IDL/be/be_visitor_component.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component.cpp @@ -66,11 +66,11 @@ #include "be_visitor_component/component.cpp" #include "be_visitor_component/component_svh.cpp" -#include "be_visitor_component/facet_svh.cpp" +#include "be_visitor_component/facet_svth.cpp" #include "be_visitor_component/context_svh.cpp" #include "be_visitor_component/servant_svh.cpp" #include "be_visitor_component/component_svs.cpp" -#include "be_visitor_component/facet_svs.cpp" +#include "be_visitor_component/facet_svts.cpp" #include "be_visitor_component/context_svs.cpp" #include "be_visitor_component/servant_svs.cpp" #include "be_visitor_component/component_ex_idl.cpp" diff --git a/TAO/TAO_IDL/be/be_visitor_component/component.cpp b/TAO/TAO_IDL/be/be_visitor_component/component.cpp index 204ff9b79ad..3e1d2b5ddf2 100644 --- a/TAO/TAO_IDL/be/be_visitor_component/component.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component/component.cpp @@ -117,7 +117,6 @@ be_visitor_component::visit_operation (be_operation *node) case TAO_CodeGen::TAO_ROOT_CDR_OP_CH: case TAO_CodeGen::TAO_ROOT_CDR_OP_CS: case TAO_CodeGen::TAO_ROOT_CI: - case TAO_CodeGen::TAO_ROOT_SI: case TAO_CodeGen::TAO_ROOT_SVH: case TAO_CodeGen::TAO_ROOT_SVS: case TAO_CodeGen::TAO_ROOT_EXH: @@ -277,10 +276,11 @@ be_visitor_component::visit_typedef (be_typedef *node) case TAO_CodeGen::TAO_ROOT_SH: case TAO_CodeGen::TAO_ROOT_IH: case TAO_CodeGen::TAO_ROOT_IS: - case TAO_CodeGen::TAO_ROOT_SI: case TAO_CodeGen::TAO_ROOT_SS: case TAO_CodeGen::TAO_ROOT_SVH: case TAO_CodeGen::TAO_ROOT_SVS: + case TAO_CodeGen::TAO_ROOT_SVTH: + case TAO_CodeGen::TAO_ROOT_SVTS: case TAO_CodeGen::TAO_ROOT_EXH: case TAO_CodeGen::TAO_ROOT_EXS: case TAO_CodeGen::TAO_ROOT_CNH: diff --git a/TAO/TAO_IDL/be/be_visitor_component/component_svh.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_svh.cpp index 1764e19a800..b6a57eaacd2 100644 --- a/TAO/TAO_IDL/be/be_visitor_component/component_svh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component/component_svh.cpp @@ -47,18 +47,6 @@ be_visitor_component_svh::visit_component (be_component *node) /// code generation. node->scan (node); - // Generate the facet servant class declaration. - be_visitor_facet_svh facet_visitor (this->ctx_); - - if (facet_visitor.visit_component_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("be_visitor_component_svh::") - ACE_TEXT ("visit_component - ") - ACE_TEXT ("facet visitor failed\n")), - -1); - } - /// CIDL-generated namespace used 'CIDL_' + composition name. /// Now we use 'CIAO_' + component's flat name. os_ << be_nl_2 diff --git a/TAO/TAO_IDL/be/be_visitor_component/component_svs.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_svs.cpp index 5e098aa39fa..3248f0e7a88 100644 --- a/TAO/TAO_IDL/be/be_visitor_component/component_svs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component/component_svs.cpp @@ -43,17 +43,6 @@ be_visitor_component_svs::visit_component (be_component *node) return 0; } - be_visitor_facet_svs facet_visitor (this->ctx_); - - if (facet_visitor.visit_component_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("be_visitor_component_svs::") - ACE_TEXT ("visit_component - ") - ACE_TEXT ("facet visitor failed\n")), - -1); - } - /// CIDL-generated namespace used 'CIDL_' + composition name. /// Now we use 'CIAO_' + component's flat name. os_ << be_nl_2 diff --git a/TAO/TAO_IDL/be/be_visitor_component/executor_exh.cpp b/TAO/TAO_IDL/be/be_visitor_component/executor_exh.cpp index 287ee04e09d..a9edd6fa9dc 100644 --- a/TAO/TAO_IDL/be/be_visitor_component/executor_exh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component/executor_exh.cpp @@ -224,6 +224,7 @@ be_visitor_executor_exh::visit_component (be_component *node) return 0; } + int be_visitor_executor_exh::visit_provides (be_provides *node) { diff --git a/TAO/TAO_IDL/be/be_visitor_component/facet_svh.cpp b/TAO/TAO_IDL/be/be_visitor_component/facet_svth.cpp index 4f279b95e07..8bfe0c7b184 100644 --- a/TAO/TAO_IDL/be/be_visitor_component/facet_svh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component/facet_svth.cpp @@ -1,7 +1,7 @@ //============================================================================= /** - * @file facet_svh.cpp + * @file facet_svth.cpp * * $Id$ * @@ -13,28 +13,40 @@ */ //============================================================================= -be_visitor_facet_svh::be_visitor_facet_svh (be_visitor_context *ctx) +be_visitor_facet_svth::be_visitor_facet_svth (be_visitor_context *ctx) : be_visitor_component_scope (ctx) { } -be_visitor_facet_svh::~be_visitor_facet_svh (void) +be_visitor_facet_svth::~be_visitor_facet_svth (void) { } int -be_visitor_facet_svh::visit_provides (be_provides *node) +be_visitor_facet_svth::visit_provides (be_provides *node) { - if (node->gen_facet_svnt_decl (os_) == -1) + if (node->gen_facet_svnt_tmpl_decl (os_) == -1) { ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("be_visitor_facet_svh") + ACE_TEXT ("be_visitor_facet_svth") ACE_TEXT ("::visit_provides - ") ACE_TEXT ("gen_facet_svnt_decl() ") ACE_TEXT ("failed\n")), -1); } + return 0; +} + +int +be_visitor_facet_svth::visit_component (be_component *node) +{ + this->visit_component_scope (node); return 0; } +int +be_visitor_facet_svth::visit_connector (be_connector *node) +{ + return this->visit_component (node); +} diff --git a/TAO/TAO_IDL/be/be_visitor_component/facet_svs.cpp b/TAO/TAO_IDL/be/be_visitor_component/facet_svts.cpp index c9127923226..6c403855962 100644 --- a/TAO/TAO_IDL/be/be_visitor_component/facet_svs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component/facet_svts.cpp @@ -1,7 +1,7 @@ //============================================================================= /** - * @file facet_svs.cpp + * @file facet_svts.cpp * * $Id$ * @@ -13,28 +13,41 @@ */ //============================================================================= -be_visitor_facet_svs::be_visitor_facet_svs (be_visitor_context *ctx) +be_visitor_facet_svts::be_visitor_facet_svts (be_visitor_context *ctx) : be_visitor_component_scope (ctx) { } -be_visitor_facet_svs::~be_visitor_facet_svs (void) +be_visitor_facet_svts::~be_visitor_facet_svts (void) { } int -be_visitor_facet_svs::visit_provides (be_provides *node) +be_visitor_facet_svts::visit_provides (be_provides *node) { - if (node->gen_facet_svnt_defn (os_) == -1) + if (node->gen_facet_svnt_tmpl_defn (os_) == -1) { ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("be_visitor_facet_svs") + ACE_TEXT ("be_visitor_facet_svts") ACE_TEXT ("::visit_provides - ") ACE_TEXT ("gen_facet_svnt_defn() ") ACE_TEXT ("failed\n")), -1); } + return 0; +} +int +be_visitor_facet_svts::visit_component (be_component *node) +{ + this->visit_component_scope (node); return 0; } +int +be_visitor_facet_svts::visit_connector (be_connector *node) +{ + return this->visit_component (node); +} + + diff --git a/TAO/TAO_IDL/be/be_visitor_component/servant_svh.cpp b/TAO/TAO_IDL/be/be_visitor_component/servant_svh.cpp index 0709be18cd0..315309b808e 100644 --- a/TAO/TAO_IDL/be/be_visitor_component/servant_svh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component/servant_svh.cpp @@ -140,6 +140,7 @@ be_visitor_servant_svh::visit_attribute (be_attribute *node) return v.visit_attribute (node); } + int be_visitor_servant_svh::visit_provides (be_provides *node) { diff --git a/TAO/TAO_IDL/be/be_visitor_component/servant_svs.cpp b/TAO/TAO_IDL/be/be_visitor_component/servant_svs.cpp index f099df71945..d86de6b4ae1 100644 --- a/TAO/TAO_IDL/be/be_visitor_component/servant_svs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component/servant_svs.cpp @@ -1,4 +1,3 @@ - //============================================================================= /** * @file servant_svs.cpp @@ -12,6 +11,7 @@ * @author Jeff Parsons */ //============================================================================= +#include <be_helper.h> be_visitor_servant_svs::be_visitor_servant_svs (be_visitor_context *ctx) : be_visitor_component_scope (ctx), @@ -308,13 +308,25 @@ be_visitor_servant_svs::visit_provides (be_provides *node) << "PortableServer::POA_var POA = cnt_safe->the_port_POA ();" << be_nl << "::CORBA::Object_var tmp =" << be_idt_nl << "this->get_facet_executor (\"" << port_name << "\");"<< be_uidt_nl << be_nl - << "::CIAO_FACET" << prefix_connector - << scope->flat_name () << "::" << lname - << "_Servant *" << port_name << "_servant_impl = " << be_idt_nl - << "new ::CIAO_FACET" << prefix_connector - << scope->flat_name () << "::" << lname - << "_Servant ("<< global << sname << "::CCM_" << lname << "::_narrow (tmp.in())," << be_nl - << "this->context_);" << be_uidt_nl << be_nl + << global << sname << "::CCM_" << lname << "_var tmp_var = " << be_idt_nl + << global << sname <<"::CCM_" << lname + << "::_narrow (tmp.in());" << be_uidt_nl << be_nl + << "typedef " << global << "CIAO_FACET" << prefix_connector + << scope->flat_name () << "::" << obj->local_name () << "_Servant_T <" << be_idt_nl + << "POA_" << sname << global << obj->local_name () + << "," << be_nl << global << sname <<"::CCM_" << lname << "," << be_nl + << global << "Components::" << be_global->ciao_container_type () + << "Context>" << be_idt_nl << lname + << "_type;" << be_uidt_nl << be_uidt_nl + << lname << "_type *" << port_name << "_servant_impl = 0;" << be_nl + << "ACE_NEW_THROW_EX (" << be_idt_nl + << port_name << "_servant_impl," << be_nl + << lname << "_type (" << be_idt_nl + << "tmp_var.in(), " << be_nl + << "this->context_)," << be_uidt_nl + << "CORBA::NO_MEMORY ());" << be_uidt_nl << be_nl + << "PortableServer::ServantBase_var safe_base_servant (" + << port_name << "_servant_impl);" << be_nl << be_nl << "PortableServer::ObjectId_var " << port_name << "_servant_oid =" << be_idt_nl << "PortableServer::string_to_ObjectId (obj_id.c_str());" << be_uidt_nl << be_nl << "POA->activate_object_with_id(" << port_name << "_servant_oid.in()," diff --git a/TAO/TAO_IDL/be/be_visitor_connector/executor_ami_exh.cpp b/TAO/TAO_IDL/be/be_visitor_connector/executor_ami_exh.cpp index b523c254798..8bb17ebc304 100644 --- a/TAO/TAO_IDL/be/be_visitor_connector/executor_ami_exh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_connector/executor_ami_exh.cpp @@ -86,7 +86,11 @@ be_visitor_executor_ami_exh::visit_connector (be_connector *node) ACE_CString half_stripped_name ( connector_name.substr (0, connector_name.find ("_Connector"))); - os_ << half_stripped_name.c_str () << "_exec_i *facet_exec_;"; + os_ << half_stripped_name.c_str () << "_exec_i *facet_exec_0_;" << be_nl;; + + ACE_CString double_stripped_name ( + half_stripped_name.substr (ACE_OS::strlen ("AMI4CCM_"))); + os_ << double_stripped_name.c_str () << "_exec_i *facet_exec_1_;"; os_ << be_uidt_nl << "};"; diff --git a/TAO/TAO_IDL/be/be_visitor_connector/executor_ami_exs.cpp b/TAO/TAO_IDL/be/be_visitor_connector/executor_ami_exs.cpp index aac8f39309e..9747958a30f 100644 --- a/TAO/TAO_IDL/be/be_visitor_connector/executor_ami_exs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_connector/executor_ami_exs.cpp @@ -12,7 +12,6 @@ * @author Jeff Parsons */ //============================================================================= - be_visitor_executor_ami_exs::be_visitor_executor_ami_exs ( be_visitor_context *ctx) : be_visitor_component_scope (ctx) @@ -36,14 +35,15 @@ be_visitor_executor_ami_exs::visit_connector (be_connector *node) os_ << be_nl_2 << class_name << "::" - << class_name << " (void)" << be_idt_nl - << ": facet_exec_ (new "; + << class_name << " (void)" << be_idt_nl; /// The port is the only item in the connector's scope. UTL_ScopeActiveIterator j (node, UTL_Scope::IK_decls); AST_Extended_Port *p = AST_Extended_Port::narrow_from_decl (j.item ()); + bool first = true; + int port_nr = 0; for (UTL_ScopeActiveIterator i (p->port_type (), UTL_Scope::IK_decls); !i.is_done (); i.next ()) @@ -53,19 +53,35 @@ be_visitor_executor_ami_exs::visit_connector (be_connector *node) if (p != 0) { - os_ << p->provides_type ()->local_name (); + if (first) + { + os_ << ": facet_exec_" << port_nr << "_ (new "; + os_ << p->provides_type ()->local_name (); + os_ << suffix << " ())" << be_nl; + first = false; + } + else + { + os_ << ", facet_exec_" << port_nr << "_ (new "; + os_ << p->provides_type ()->local_name (); + os_ << suffix << " ())" << be_uidt_nl; + } + port_nr++; } } - os_ << suffix << " ())" << be_uidt_nl - << "{" << be_nl + os_ << "{" << be_nl << "}"; os_ << be_nl_2 << class_name << "::~" << class_name << " (void)" << be_nl - << "{" << be_idt_nl - << "::CORBA::release (this->facet_exec_);" << be_uidt_nl + << "{" << be_idt_nl; + for (int i = 0; i < port_nr; i ++) + { + os_ << "::CORBA::release (this->facet_exec_" << i <<"_);" << be_nl; + } + os_ << be_uidt_nl << "}"; if (this->visit_scope (node) == -1) @@ -87,19 +103,25 @@ be_visitor_executor_ami_exs::visit_connector (be_connector *node) << "::Components::" << be_global->ciao_container_type () << "Context_ptr ctx)" << be_uidt_nl - << "{" << be_idt_nl - << "this->facet_exec_->set_" + << "{" << be_idt_nl; + for (int i = 0; i < port_nr; i ++) + { + os_ << "this->facet_exec_" << i << "_->set_" << tao_cg->downcase (container_type) << "_context " - << "(ctx);" << be_uidt_nl - << "}"; + << "(ctx);" << be_nl; + } + os_ << be_uidt_nl << "}"; os_ << be_nl_2 << "void" << be_nl << class_name << "::configuration_complete (void)" << be_nl - << "{" << be_idt_nl - << "this->facet_exec_->_set_component (this);" << be_uidt_nl - << "}"; + << "{" << be_idt_nl; + for (int i = 0; i < port_nr; i ++) + { + os_ << "this->facet_exec_" << i << "_->_set_component (this);" << be_nl; + } + os_ << be_uidt_nl << "}"; os_ << be_nl_2 << "void" << be_nl @@ -121,12 +143,15 @@ be_visitor_executor_ami_exs::visit_connector (be_connector *node) os_ << be_nl_2 << "void" << be_nl << class_name << "::ccm_remove (void)" << be_nl - << "{" << be_idt_nl - << "this->facet_exec_->_set_component (" << be_idt_nl + << "{" << be_idt_nl; + for (int i = 0; i < port_nr; i ++) + { + os_ << "this->facet_exec_" << i <<"_->_set_component (" << be_idt_nl << "::" << s->name () << smart_scope << "CCM_" << this->node_->local_name () - << "::_nil ());" << be_uidt << be_uidt_nl - << "}"; + << "::_nil ());" << be_uidt_nl; + } + os_ << be_uidt_nl << "}"; return 0; } @@ -135,7 +160,7 @@ int be_visitor_executor_ami_exs::visit_provides (be_provides *node) { AST_Type *t = node->provides_type (); - AST_Decl *scope = ScopeAsDecl (t->defined_in ()); + AST_Decl *scope = ScopeAsDecl (t->defined_in ()); bool global = (scope->node_type () == AST_Decl::NT_root); const char *smart_scope = (global ? "" : "::"); @@ -150,14 +175,16 @@ be_visitor_executor_ami_exs::visit_provides (be_provides *node) UTL_ScopeActiveIterator i (this->node_, UTL_Scope::IK_decls); AST_Decl *d = i.item (); - os_ << d->local_name () << "_" + const char * loc_name = node->local_name()->get_string(); + const char *exec_ext = (strstr (loc_name, "sync") ? "1" : "0"); + + os_ << d->local_name () << "_" << node->local_name () << " (void)" << be_nl << "{" << be_idt_nl << "return " << smart_scope << scope->full_name () << "::CCM_" << t->local_name () << "::_duplicate (" - << "this->facet_exec_);" << be_uidt_nl + << "this->facet_exec_" << exec_ext << "_);" << be_uidt_nl << "}"; return 0; } - diff --git a/TAO/TAO_IDL/be/be_visitor_connector/facet_ami_exh.cpp b/TAO/TAO_IDL/be/be_visitor_connector/facet_ami_exh.cpp index e8eeef9e16e..f524a05ac16 100644 --- a/TAO/TAO_IDL/be/be_visitor_connector/facet_ami_exh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_connector/facet_ami_exh.cpp @@ -12,6 +12,8 @@ * @author Jeff Parsons */ //============================================================================= +#include "ast_generator.h" +#include "be_predefined_type.h" be_visitor_facet_ami_exh::be_visitor_facet_ami_exh ( be_visitor_context *ctx) @@ -19,7 +21,8 @@ be_visitor_facet_ami_exh::be_visitor_facet_ami_exh ( iface_ (0), callback_iface_ (0), scope_name_ (0), - iface_name_ (0) + iface_name_ (0), + sync_ (false) { // This is initialized in the base class to svnt_export_macro() // or skel_export_macro(), since there are many more visitor @@ -53,24 +56,89 @@ be_visitor_facet_ami_exh::visit_provides (be_provides *node) if (this->gen_reply_handler_class () == -1) { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_facet_ami_exh") + ACE_TEXT ("::visit_provides - ") + ACE_TEXT ("gen_reply_handler_class() ") + ACE_TEXT ("failed\n")), + -1); + } + + + if (this->gen_facet_executor_class () == -1) + { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("be_visitor_facet_ami_exh") ACE_TEXT ("::visit_provides - ") - ACE_TEXT ("gen_reply_handler_class() ") + ACE_TEXT ("gen_facet_executor_class() ") ACE_TEXT ("failed\n")), -1); } - if (this->gen_facet_executor_class () == -1) + return 0; +} +int +be_visitor_facet_ami_exh::visit_attribute (be_attribute *node) +{ + + be_operation get_op (node->field_type (), + AST_Operation::OP_noflags, + node->name (), + 0, + 0); + + get_op.set_name ((UTL_IdList *) node->name ()->copy ()); + if (this->visit_operation (&get_op) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_facet_ami_exh::" + "visit_attribute - " + "codegen for get_attribute failed\n"), + -1); + } + get_op.destroy (); + + if (node->readonly ()) + { + // Nothing else to do. + return 0; + } + Identifier id ("void"); + UTL_ScopedName sn (&id, 0); + + // Create the return type, which is "void" + be_predefined_type rt (AST_PredefinedType::PT_void, &sn); + + // Argument type is the same as the attribute type. + AST_Argument *arg = + idl_global->gen ()->create_argument (AST_Argument::dir_IN, + node->field_type (), + node->name ()); + + arg->set_name ((UTL_IdList *) node->name ()->copy ()); + + // Create the operation. + be_operation set_op (&rt, + AST_Operation::OP_noflags, + node->name (), + 0, + 0); + + set_op.set_name ((UTL_IdList *) node->name ()->copy ()); + set_op.be_add_argument (arg); + + if (this->visit_operation (&set_op) == -1) { ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("be_visitor_facet_ami_exh") - ACE_TEXT ("::visit_provides - ") - ACE_TEXT ("gen_facet_executor_class() ") - ACE_TEXT ("failed\n")), + "(%N:%l) be_visitor_facet_ami_exh::" + "visit_attribute - " + "codegen for set_attribute failed\n"), -1); } + set_op.destroy (); + rt.destroy (); + return 0; } @@ -84,7 +152,9 @@ be_visitor_facet_ami_exh::visit_operation (be_operation *node) /// connector. We want to skip the CCM-related operations /// that were added to the connector since it's a component. /// We want only the facet interface operations. - if (d->node_type () != AST_Decl::NT_interface) + /// In case of sync. attribute operations we have a node_type NT_root + if ((d->node_type () != AST_Decl::NT_interface) && + (d->node_type () != AST_Decl::NT_root)) { return 0; } @@ -139,6 +209,9 @@ be_visitor_facet_ami_exh::init (bool for_impl) AST_Decl *d = s->lookup_by_name (sn, true, false); this->callback_iface_ = be_interface::narrow_from_decl (d); + if (this->callback_iface_ == 0) + this->sync_ = true; + sn->destroy (); delete sn; sn = 0; @@ -147,9 +220,14 @@ be_visitor_facet_ami_exh::init (bool for_impl) int be_visitor_facet_ami_exh::gen_reply_handler_class (void) { + os_ << be_nl_2 << "// TAO_IDL - Generated from" << be_nl + << "// " << __FILE__ << ":" << __LINE__; + + const char *suffix = "_reply_handler"; this->init (false); - + if (this->sync_) + return 0; os_ << be_nl << "class " << this->export_macro_.c_str () << " " << this->iface_name_ << suffix << be_idt_nl @@ -194,6 +272,9 @@ be_visitor_facet_ami_exh::gen_reply_handler_class (void) int be_visitor_facet_ami_exh::gen_facet_executor_class (void) { + os_ << be_nl_2 << "// TAO_IDL - Generated from" << be_nl + << "// " << __FILE__ << ":" << __LINE__; + const char *suffix = "_exec_i"; const char *scope_name = ScopeAsDecl (this->iface_->defined_in ())->full_name (); @@ -212,15 +293,69 @@ be_visitor_facet_ami_exh::gen_facet_executor_class (void) << "virtual ~" << iface_name << suffix << " (void);"; - if (this->visit_scope (this->iface_) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("be_visitor_connector_ami_exh") - ACE_TEXT ("::gen_facet_executor_class - ") - ACE_TEXT ("visit_scope() on sendc ") - ACE_TEXT ("interface failed\n")), - -1); - } + + ACE_CString handler_str ( + ScopeAsDecl (this->iface_->defined_in ())->full_name ()); + ACE_CString tmp (this->iface_->local_name ()); + handler_str += "::"; + handler_str += tmp; + + if (ACE_OS::strstr (tmp.c_str(), "AMI4CCM") != 0) + this->sync_ = false; + else + this->sync_ = true; + if (this->sync_) + { + UTL_Scope *ss = this->iface_->defined_in(); + UTL_ScopedName *sn = + FE_Utils::string_to_scoped_name (handler_str.c_str ()); + AST_Decl *d = ss->lookup_by_name (sn, true); + + sn->destroy (); + delete sn; + sn = 0; + + be_interface *sync_iface = + be_interface::narrow_from_decl (d); + + /// The overload of traverse_inheritance_graph() used here + /// doesn't automatically prime the queues. + sync_iface->get_insert_queue ().reset (); + sync_iface->get_del_queue ().reset (); + sync_iface->get_insert_queue ().enqueue_tail (sync_iface); + + + + Facet_AMI_ExecH_Op_Attr_Generator op_attr_gen (this); + int status = + sync_iface->traverse_inheritance_graph( + op_attr_gen, + &os_, + false, + false); + + if (status == -1) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("be_visitor_facet_ami_exh") + ACE_TEXT ("::gen_facet_executor_class - ") + ACE_TEXT ("traverse_inheritance_graph() on ") + ACE_TEXT ("interface failed\n"))); + + } + } + else + { + if (this->visit_scope (this->iface_) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_connector_ami_exh") + ACE_TEXT ("::gen_facet_executor_class - ") + ACE_TEXT ("visit_scope() on sendc ") + ACE_TEXT ("interface failed\n")), + -1); + } + } const char *container_type = be_global->ciao_container_type (); @@ -257,4 +392,18 @@ be_visitor_facet_ami_exh::gen_facet_executor_class (void) return 0; } +// ================================================== +Facet_AMI_ExecH_Op_Attr_Generator::Facet_AMI_ExecH_Op_Attr_Generator ( + be_visitor_scope * visitor) + : visitor_ (visitor) +{ +} + +int +Facet_AMI_ExecH_Op_Attr_Generator::emit (be_interface * /*derived_interface*/, + TAO_OutStream * /*os*/, + be_interface * base_interface) +{ + return visitor_->visit_scope (base_interface); +} diff --git a/TAO/TAO_IDL/be/be_visitor_connector/facet_ami_exs.cpp b/TAO/TAO_IDL/be/be_visitor_connector/facet_ami_exs.cpp index a47895645a0..be124fd2dbf 100644 --- a/TAO/TAO_IDL/be/be_visitor_connector/facet_ami_exs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_connector/facet_ami_exs.cpp @@ -1,4 +1,3 @@ - //============================================================================= /** * @file facet_ami_exs.cpp @@ -12,11 +11,15 @@ * @author Jeff Parsons */ //============================================================================= +#include "ast_generator.h" +#include "be_predefined_type.h" + be_visitor_facet_ami_exs::be_visitor_facet_ami_exs ( be_visitor_context *ctx) : be_visitor_component_scope (ctx), - for_reply_handler_ (true) + for_reply_handler_ (true), + sync_(false) { } @@ -40,17 +43,18 @@ be_visitor_facet_ami_exs::visit_component (be_component *node) int be_visitor_facet_ami_exs::visit_provides (be_provides *node) { + this->iface_ = be_interface::narrow_from_decl (node->provides_type ()); - if (this->gen_reply_handler_class () == -1) + if (this->gen_reply_handler_class () == -1) { ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("be_visitor_facet_ami_exs") - ACE_TEXT ("::visit_provides - ") - ACE_TEXT ("gen_reply_handler_class() ") - ACE_TEXT ("failed\n")), - -1); + ACE_TEXT ("be_visitor_facet_ami_exs") + ACE_TEXT ("::visit_provides - ") + ACE_TEXT ("gen_reply_handler_class() ") + ACE_TEXT ("failed\n")), + -1); } if (this->gen_facet_executor_class () == -1) @@ -65,6 +69,70 @@ be_visitor_facet_ami_exs::visit_provides (be_provides *node) return 0; } +int +be_visitor_facet_ami_exs::visit_attribute (be_attribute *node) +{ + + be_operation get_op (node->field_type (), + AST_Operation::OP_noflags, + node->name (), + 0, + 0); + get_op.set_name ((UTL_IdList *) node->name ()->copy ()); + if (this->visit_operation (&get_op) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_facet_ami_exs::" + "visit_attribute - " + "codegen for get_attribute failed\n"), + -1); + } + + get_op.destroy (); + + if (node->readonly ()) + { + // Nothing else to do. + return 0; + } + Identifier id ("void"); + UTL_ScopedName sn (&id, 0); + + // Create the return type, which is "void" + be_predefined_type rt (AST_PredefinedType::PT_void, &sn); + + // Argument type is the same as the attribute type. + AST_Argument *arg = + idl_global->gen ()->create_argument (AST_Argument::dir_IN, + node->field_type (), + node->name ()); + + arg->set_name ((UTL_IdList *) node->name ()->copy ()); + + // Create the operation. + be_operation set_op (&rt, + AST_Operation::OP_noflags, + node->name (), + 0, + 0); + + set_op.set_name ((UTL_IdList *) node->name ()->copy ()); + set_op.be_add_argument (arg); + + if (this->visit_operation (&set_op) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_facet_ami_exs::" + "visit_attribute - " + "codegen for set_attribute failed\n"), + -1); + } + + set_op.destroy (); + rt.destroy (); + + return 0; +} int be_visitor_facet_ami_exs::visit_operation (be_operation *node) @@ -76,19 +144,37 @@ be_visitor_facet_ami_exs::visit_operation (be_operation *node) /// connector. We want to skip the CCM-related operations /// that were added to the connector since it's a component. /// We want only the facet interface operations. + + // Coming for sync attribute operations, node_type is NT_root + if (d->node_type () == AST_Decl::NT_root) + { + return gen_facet_executor_sync_op (node); + } + if (d->node_type () != AST_Decl::NT_interface) { return 0; } - if (this->for_reply_handler_) + if ((this->for_reply_handler_) && (this->sync_)) + { + return 0; + } + + if ((this->for_reply_handler_) && (!this->sync_)) { return this->gen_reply_hander_op (node); } - else + else if ((!this->for_reply_handler_) && (this->sync_)) + { + return gen_facet_executor_sync_op (node); + } + else if ((!this->for_reply_handler_) && (!this->sync_)) { return this->gen_facet_executor_op (node); } + else + return 0; } int @@ -118,12 +204,46 @@ be_visitor_facet_ami_exs::post_process (be_decl *node) return 0; } +void +be_visitor_facet_ami_exs::init (void) +{ + UTL_Scope *s = this->iface_->defined_in (); + ACE_CString handler_str ( + ScopeAsDecl (this->iface_->defined_in ())->full_name ()); + handler_str += "::AMI_"; + ACE_CString tmp (this->iface_->local_name ()); + handler_str += tmp.substr (ACE_OS::strlen ("AMI4CCM_")); + handler_str += "Handler"; + UTL_ScopedName *sn = + FE_Utils::string_to_scoped_name (handler_str.c_str ()); + AST_Decl *d = s->lookup_by_name (sn, true); + + sn->destroy (); + delete sn; + sn = 0; + + + be_interface *callback_iface = + be_interface::narrow_from_decl (d); + + if (callback_iface == 0) + this->sync_ = true; + else + this->sync_ = false; + + +} int be_visitor_facet_ami_exs::gen_reply_handler_class (void) { this->for_reply_handler_ = true; + this->init (); + if (this->sync_) + return 0; + + const char *suffix = "_reply_handler"; UTL_Scope *s = this->iface_->defined_in (); AST_Decl *scope = ScopeAsDecl (s); @@ -175,6 +295,7 @@ be_visitor_facet_ami_exs::gen_reply_handler_class (void) delete sn; sn = 0; + be_interface *callback_iface = be_interface::narrow_from_decl (d); @@ -186,7 +307,7 @@ be_visitor_facet_ami_exs::gen_reply_handler_class (void) Facet_AMI_Exec_Op_Attr_Generator op_attr_gen (this); - int status = + int const status = callback_iface->traverse_inheritance_graph ( op_attr_gen, &os_, @@ -208,6 +329,7 @@ be_visitor_facet_ami_exs::gen_reply_handler_class (void) int be_visitor_facet_ami_exs::gen_facet_executor_class (void) { + this->for_reply_handler_ = false; const char *suffix = "_exec_i"; @@ -227,15 +349,47 @@ be_visitor_facet_ami_exs::gen_facet_executor_class (void) << "{" << be_nl << "}"; - - if (this->visit_scope (this->iface_) == -1) - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("be_visitor_connector_ami_exs") - ACE_TEXT ("::gen_reply_handler_class - ") - ACE_TEXT ("visit_scope() on sendc ") - ACE_TEXT ("interface failed\n"))); - } + ACE_CString handler_str ( + ScopeAsDecl (this->iface_->defined_in ())->full_name ()); + ACE_CString tmp (this->iface_->local_name ()); + handler_str += "::"; + handler_str += tmp; + + UTL_Scope *ss = this->iface_->defined_in(); + UTL_ScopedName *sn = + FE_Utils::string_to_scoped_name (handler_str.c_str ()); + AST_Decl *d = ss->lookup_by_name (sn, true); + + sn->destroy (); + delete sn; + sn = 0; + + be_interface *sync_iface = + be_interface::narrow_from_decl (d); + + /// The overload of traverse_inheritance_graph() used here + /// doesn't automatically prime the queues. + sync_iface->get_insert_queue ().reset (); + sync_iface->get_del_queue ().reset (); + sync_iface->get_insert_queue ().enqueue_tail (sync_iface); + + Facet_AMI_Exec_Op_Attr_Generator op_attr_gen (this); + int status = + sync_iface->traverse_inheritance_graph( + op_attr_gen, + &os_, + false, + false); + + if (status == -1) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("be_visitor_facet_ami_exh") + ACE_TEXT ("::gen_facet_executor_class - ") + ACE_TEXT ("traverse_inheritance_graph() on ") + ACE_TEXT ("interface failed\n"))); + + } ACE_CString scope_str (scope_name, 0, false); @@ -299,6 +453,7 @@ be_visitor_facet_ami_exs::gen_facet_executor_class (void) int be_visitor_facet_ami_exs::gen_reply_hander_op (be_operation *node) { + os_ << be_nl_2 << "void" << be_nl << this->iface_->local_name () << "_reply_handler::" @@ -384,7 +539,12 @@ be_visitor_facet_ami_exs::gen_reply_hander_op (be_operation *node) int be_visitor_facet_ami_exs::gen_facet_executor_op (be_operation *node) { - os_ << be_nl_2 + + // do not handle not sendc operations. + if (ACE_OS::strstr (node->local_name()->get_string (), "sendc_")== 0) + return 0; + + os_ << be_nl_2 << "void" << be_nl << this->iface_->local_name () << "_exec_i::" << node->local_name (); @@ -486,7 +646,110 @@ be_visitor_facet_ami_exs::gen_facet_executor_op (be_operation *node) return 0; } +int +be_visitor_facet_ami_exs::gen_facet_executor_sync_op (be_operation *node) +{ + + if (node->is_sendc_ami()) + return 0; + + os_ << be_nl_2; + // generate the return type. + be_type *bt = be_type::narrow_from_decl (node->return_type ()); + + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_operation_ch::") + ACE_TEXT ("gen_facet_executor_sync_op - ") + ACE_TEXT ("Bad return type\n")), + -1); + } + + // Grab the right visitor to generate the return type. + be_visitor_operation_rettype oro_visitor (this->ctx_); + + if (bt->accept (&oro_visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) facet_ami_exs::" + "gen_facet_executor_sync_op - " + "codegen for return type failed\n"), + -1); + } + + os_ << be_nl + << this->iface_->local_name () << "_exec_i::" + << node->local_name (); + be_visitor_operation_arglist al_visitor (this->ctx_); + + if (node->accept (&al_visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_facet_ami_exs::") + ACE_TEXT ("gen_facet_executor_op - ") + ACE_TEXT ("codegen for argument ") + ACE_TEXT ("list failed\n")), + -1); + } + + AST_Decl *scope = ScopeAsDecl (this->iface_->defined_in ()); + bool global = (scope->node_type () == AST_Decl::NT_root); + const char *smart_scope = (global ? "" : "::"); + + ACE_CString iface_str (this->iface_->local_name ()); + const char *orig_iface_name = iface_str.c_str (); + os_ << be_nl + << "{" << be_idt_nl; + + AST_PredefinedType *pdt = 0; + pdt = AST_PredefinedType::narrow_from_decl (bt); + bool ret = true; + if ((pdt != 0) && (pdt->pt () == AST_PredefinedType::PT_void)) + ret =false; + + os_ << "::" << scope->full_name () << smart_scope + << orig_iface_name << "_var receptacle_objref =" << be_idt_nl + << "this->context_->get_connection_ami4ccm_port_ami4ccm_uses ();" + << be_uidt_nl << be_nl; + + os_ << "if (::CORBA::is_nil (receptacle_objref.in ()))" + << be_idt_nl + << "{" << be_idt_nl + << "throw ::CORBA::INV_OBJREF ();" << be_uidt_nl + << "}" << be_uidt_nl << be_nl; + if (ret) + { + os_ << "return " ; + } + os_ << "receptacle_objref->" << node->local_name () + << " (" << be_idt << be_idt_nl; + + unsigned long index = 0UL; + + /// Quick scope iteration to catch all the args . + for (UTL_ScopeActiveIterator i (node, UTL_Scope::IK_decls); + !i.is_done (); + i.next (), ++index) + { + AST_Decl *d = i.item (); + if (index == 0UL) + { + os_ << d->local_name (); + } + else + { + os_ << "," << be_nl + << d->local_name (); + } + } + + os_ << ");" << be_uidt << be_uidt << be_uidt_nl; + os_ << "}"; + + return 0; +} // ================================================== Facet_AMI_Exec_Op_Attr_Generator::Facet_AMI_Exec_Op_Attr_Generator ( @@ -496,10 +759,11 @@ Facet_AMI_Exec_Op_Attr_Generator::Facet_AMI_Exec_Op_Attr_Generator ( } int -Facet_AMI_Exec_Op_Attr_Generator::emit (be_interface * /*derived_interface */, - TAO_OutStream * /* os */, +Facet_AMI_Exec_Op_Attr_Generator::emit (be_interface * /*derived_interface*/, + TAO_OutStream * /*os*/ , be_interface * base_interface) { return visitor_->visit_scope (base_interface); } + diff --git a/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp index 6c2dbd5b4ae..38979db785e 100644 --- a/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp @@ -54,9 +54,9 @@ be_visitor_exception_any_op_cs::visit_exception (be_exception *node) << "template<>" << be_nl << "::CORBA::Boolean" << be_nl << "Any_Dual_Impl_T<" << node->name () - << ">::demarshal_value (" << be_idt << be_idt_nl - << "TAO_InputCDR & cdr" << be_uidt_nl - << ")" << be_uidt_nl + << ">::demarshal_value (" + << "TAO_InputCDR & cdr" + << ")" << be_nl << "{" << be_idt_nl << "::CORBA::String_var id;" << be_nl_2 << "if (!(cdr >> id.out ()))" << be_idt_nl diff --git a/TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp b/TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp index ed83ceca8a5..2996ce87e57 100644 --- a/TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp @@ -277,6 +277,27 @@ int be_visitor_exception_cs::visit_exception (be_exception *node) *os << "}" << be_nl_2; } + if ((ACE_OS::strcmp (node->full_name (), "CORBA::InvalidPolicies") == 0) || + (ACE_OS::strcmp (node->full_name (), "CORBA::PolicyError") == 0)) + { + *os << "// TAO extension - the virtual _type method." << be_nl + << "::CORBA::TypeCode_ptr " << node->name () + << "::_tao_type (void) const" << be_nl + << "{" << be_idt_nl + << "TAO_AnyTypeCode_Adapter *adapter =" << be_idt_nl + << "ACE_Dynamic_Service<TAO_AnyTypeCode_Adapter>::instance (" + << "\"AnyTypeCode_Adapter\");" << be_uidt_nl + << "if (adapter == 0)" << be_idt_nl + << "{" << be_idt_nl + << "ACE_ERROR_RETURN ((LM_ERROR," << be_idt_nl + << "ACE_TEXT (\"TAO \")," << be_nl + << "ACE_TEXT (\"Unable to find the \")" << be_nl + << "ACE_TEXT (\"AnyTypeCode Adapter instance\")), 0);" << be_uidt << be_uidt_nl + << "}" << be_uidt_nl + << "return adapter->_tao_type_" << node->local_name () << "();" << be_uidt_nl + << "}"; + } + // Switch streams to the *A.cpp file if we are using this option. if (be_global->gen_anyop_files ()) { @@ -284,14 +305,18 @@ int be_visitor_exception_cs::visit_exception (be_exception *node) *os << be_nl_2; } - if (be_global->tc_support ()) + if ((ACE_OS::strcmp (node->full_name (), "CORBA::InvalidPolicies") != 0) && + (ACE_OS::strcmp (node->full_name (), "CORBA::PolicyError") != 0)) { - *os << "// TAO extension - the virtual _type method." << be_nl; - *os << "::CORBA::TypeCode_ptr " << node->name () - << "::_tao_type (void) const" << be_nl; - *os << "{" << be_idt_nl; - *os << "return ::" << node->tc_name () << ";" << be_uidt_nl; - *os << "}"; + if (be_global->tc_support ()) + { + *os << "// TAO extension - the virtual _type method." << be_nl; + *os << "::CORBA::TypeCode_ptr " << node->name () + << "::_tao_type (void) const" << be_nl; + *os << "{" << be_idt_nl; + *os << "return ::" << node->tc_name () << ";" << be_uidt_nl; + *os << "}"; + } } // Make sure we are generating to *C.cpp regardless of the above. diff --git a/TAO/TAO_IDL/be/be_visitor_interface.cpp b/TAO/TAO_IDL/be/be_visitor_interface.cpp index 76d01092d19..b77d531b463 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface.cpp @@ -64,7 +64,6 @@ #include "be_visitor_interface/interface_cs.cpp" #include "be_visitor_interface/interface_sh.cpp" #include "be_visitor_interface/interface_ih.cpp" -#include "be_visitor_interface/interface_si.cpp" #include "be_visitor_interface/interface_ss.cpp" #include "be_visitor_interface/interface_is.cpp" #include "be_visitor_interface/interface_ex_idl.cpp" @@ -91,7 +90,6 @@ // AMH #include "be_visitor_interface/amh_ch.cpp" #include "be_visitor_interface/amh_ss.cpp" -#include "be_visitor_interface/amh_si.cpp" #include "be_visitor_interface/amh_sh.cpp" #include "be_visitor_interface/amh_rh_ss.cpp" #include "be_visitor_interface/amh_rh_sh.cpp" 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 13e39657395..4a969a016e1 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/amh_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/amh_sh.cpp @@ -118,58 +118,11 @@ be_visitor_amh_interface_sh::visit_interface (be_interface *node) << be_nl << "virtual ::CORBA::Boolean _is_a (const char* logical_type_id);" << be_nl_2; - // 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 *obj," << be_nl - << "void *servant_upcall" << be_uidt_nl - << ");" << be_uidt_nl << be_nl; - - if (!be_global->gen_minimum_corba ()) - { - // 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 *obj," << be_nl - << "void *servant_upcall" << be_uidt_nl - << ");" << be_uidt_nl << be_nl; - } - - if (!be_global->gen_corba_e () && !be_global->gen_minimum_corba ()) - { - // Add a skeleton for our _interface method. - *os << "static void _interface_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest &req," << be_nl - << "void *obj," << be_nl - << "void *servant_upcall" << be_uidt_nl - << ");" << be_uidt_nl << be_nl; - } - - if (!be_global->gen_corba_e () && !be_global->gen_minimum_corba ()) - { - // 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_uidt_nl - << ");" << be_uidt_nl << be_nl; - } - - if (!be_global->gen_minimum_corba ()) - { - // Add a skeleton for our _repository_id method. - *os << "static void _repository_id_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest &req," << be_nl - << "void *obj," << be_nl - << "void *servant_upcall" << 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_uidt_nl - << ");" << be_uidt_nl << be_nl; + << "TAO::Portable_Server::Servant_Upcall *_servant_upcall);" << be_uidt + << be_uidt_nl << be_nl; this->this_method (node); @@ -187,18 +140,6 @@ be_visitor_amh_interface_sh::visit_interface (be_interface *node) -1); } - // Generate skeletons for operations of our base classes. These - // skeletons just cast the pointer to the appropriate type - // before invoking the call. - if (node->traverse_inheritance_graph (be_interface::gen_skel_helper, os) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_amh_interface_sh::" - "visit_interface - " - "inheritance graph traversal failed\n"), - -1); - } - *os << be_uidt_nl << "};"; diff --git a/TAO/TAO_IDL/be/be_visitor_interface/amh_si.cpp b/TAO/TAO_IDL/be/be_visitor_interface/amh_si.cpp deleted file mode 100644 index 11b3910effa..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_interface/amh_si.cpp +++ /dev/null @@ -1,233 +0,0 @@ -//============================================================================= -/** -* @file amh_si.cpp -* -* $Id$ -* -* Specialized interface visitor for AMH generates code that is -* specific to AMH interfaces. -* -* @author Jeff Parsons <j.parsons@vanderbilt.edu> -*/ -//============================================================================= - -be_visitor_amh_interface_si::be_visitor_amh_interface_si ( - be_visitor_context *ctx) - : be_visitor_interface_si (ctx) -{ -} - -be_visitor_amh_interface_si::~be_visitor_amh_interface_si (void) -{ -} - -int -be_visitor_amh_interface_si::visit_interface (be_interface *node) -{ - if (node->srv_inline_gen () || node->imported () || node->is_local ()) - { - return 0; - } - - // Do not generate AMH classes for any sort of implied IDL. - if (node->original_interface () != 0) - { - return 0; - } - - TAO_OutStream *os = this->ctx_->stream (); - - int status = - node->traverse_inheritance_graph ( - be_visitor_amh_interface_si::gen_skel_helper, os); - - if (status == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_amh_interface_si::" - "visit_interface - " - "inheritance graph traversal failed\n"), - -1); - } - - return 0; -} - -int -be_visitor_amh_interface_si::gen_skel_helper (be_interface *derived, - be_interface *ancestor, - TAO_OutStream *os) -{ - // If derived and ancestor are same, skip it. - if (derived == ancestor) - { - return 0; - } - - // If an operation or an attribute is abstract (declared in an - // abstract interface), we will either generate the full - // definition (if there are no concrete interfaces between the - // abstract ancestor and us) or, if there is a concrete ancestor - // in between, we will catch its definition elsewhere in this - // traversal. - if (ancestor->is_abstract ()) - { - return 0; - } - - // Else generate code that does the cast to the appropriate type. - - if (ancestor->nmembers () > 0) - { - // If there are elements in ancestor scope i.e., any operations and - // attributes defined by "ancestor", become methods on the derived class - // which call the corresponding method of the base class by doing the - // proper casting. - - ACE_CString ancestor_name ("POA_"); - char *buf = 0; - ancestor->compute_full_name ("AMH_", "", buf); - ancestor_name += buf; - // buf was allocated by ACE_OS::strdup, so we need to use free instead - // of delete. - ACE_OS::free (buf); - buf = 0; - - const char *ancestor_amh_name = ancestor_name.fast_rep (); - - ACE_CString derived_name ("POA_"); - derived->compute_full_name ("AMH_", "", buf); - derived_name += buf; - // buf was allocated by ACE_OS::strdup, so we need to use free instead - // of delete. - ACE_OS::free (buf); - buf = 0; - - const char *derived_amh_name = derived_name.fast_rep (); - - for (UTL_ScopeActiveIterator si (ancestor, UTL_Scope::IK_decls); - !si.is_done (); - si.next ()) - { - // Get the next AST decl node - AST_Decl *d = si.item (); - AST_Decl::NodeType nt = d->node_type (); - - if (nt == AST_Decl::NT_op) - { - be_operation *op = - be_operation::narrow_from_decl (d); - - /// These implied IDL operations are for stub-side only. - if (op->is_sendc_ami ()) - { - continue; - } - - *os << be_nl_2 << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__; - - *os << be_nl_2; - - // Generate code in the inline file. - // Generate the static method corresponding to this method. - *os << "ACE_INLINE" << be_nl - << "void" << be_nl - << derived_amh_name << "::" - << d->local_name () - << "_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest & req," << be_nl - << "void * context," << be_nl - << "void * obj)" << be_uidt - << be_uidt_nl - << "{" << be_idt_nl; - *os << ancestor_amh_name - << "* const impl = static_cast<" - << derived_amh_name - << " *> (obj);" << be_nl; - *os << ancestor_amh_name - << "::" << d->local_name () - << "_skel (" << be_idt_nl - << "req," << be_nl - << "context," << be_nl - << "impl);" << be_uidt - << be_uidt_nl - << "}"; - } - else if (nt == AST_Decl::NT_attr) - { - be_attribute *attr = be_attribute::narrow_from_decl (d); - - if (attr == 0) - { - return -1; - } - - *os << be_nl_2; - - // Generate code in the inline file. - // Generate the static method corresponding to this method. - *os << "ACE_INLINE" << be_nl - << "void" << be_nl - << derived_amh_name << "::_get_" - << d->local_name () - << "_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest & req," << be_nl - << "void * context," << be_nl - << "void * obj)" << be_uidt - << be_uidt_nl - << "{" << be_idt_nl; - - *os << ancestor_amh_name - << "* const impl = static_cast<" - << derived_amh_name - << " *> (obj);" << be_nl; - - *os << ancestor_amh_name - << "::_get_" << d->local_name () - << "_skel (" << be_idt << be_idt_nl - << "req," << be_nl - << "context," << be_nl - << "impl);" << be_uidt - << be_uidt << be_uidt_nl - << "}"; - - if (!attr->readonly ()) - { - *os << be_nl_2; - - // Generate code in the inline file. - // Generate the static method corresponding to - // this method. - *os << "ACE_INLINE" << be_nl - << "void" << be_nl - << derived_amh_name - << "::_set_" << d->local_name () - << "_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest & req," << be_nl - << "void * context," << be_nl - << "void * obj)" << be_uidt - << be_uidt_nl - << "{" << be_idt_nl; - - *os << ancestor_amh_name - << "* const impl = static_cast<" - << derived_amh_name - << " *> (obj);" << be_nl; - - *os << ancestor_amh_name - << "::_set_" << d->local_name () - << "_skel (" << be_idt << be_idt_nl - << "req," << be_nl - << "context," << be_nl - << "impl);" << be_uidt - << be_uidt << be_uidt_nl - << "}"; - } - } - } // End of FOR - } - - return 0; -} - 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 bba533b2f72..41d97645066 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp @@ -118,25 +118,18 @@ 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_uidt_nl - << ")" << be_uidt_nl + << "TAO_ServerRequest &req," << be_nl + << "TAO::Portable_Server::Servant_Upcall *context)" << be_uidt + << be_uidt_nl << "{" << be_idt_nl - << "this->asynchronous_upcall_dispatch (" << be_idt << be_idt_nl - << "req," << be_nl - << "context," << be_nl - << "this" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl + << "this->asynchronous_upcall_dispatch (" + << "req," + << "context," + << "this" + << ");" << be_uidt_nl << "}"; } -void -be_visitor_amh_interface_ss::generate_send_reply (TAO_OutStream * os) -{ - *os << be_nl_2 - << "server_request.tao_send_reply ();"; -} - int be_visitor_amh_interface_ss::generate_amh_classes (be_interface *) { diff --git a/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_sh.cpp index 6426205be58..4766f0afb9a 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_sh.cpp @@ -91,23 +91,6 @@ be_visitor_interface_direct_proxy_impl_sh::visit_interface ( -1); } - // Generate static collocated operations for operations of our base - // classes. - int status = - node->traverse_inheritance_graph ( - be_interface::gen_colloc_op_decl_helper, - os - ); - - if (status == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_interface_direct_proxy_impl_sh::" - "visit_interface - " - "inheritance graph traversal failed\n"), - -1); - } - *os << be_uidt_nl << "};" << be_nl_2 << "//" << be_nl diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp index 2881de3760a..345e80863bc 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp @@ -497,7 +497,6 @@ be_visitor_interface::visit_operation (be_operation *node) case TAO_CodeGen::TAO_ROOT_CDR_OP_CH: case TAO_CodeGen::TAO_ROOT_CDR_OP_CS: case TAO_CodeGen::TAO_ROOT_CI: - case TAO_CodeGen::TAO_ROOT_SI: return 0; // nothing to be done default: { 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 c7f2c0abd69..eb9bfbe2caf 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp @@ -158,11 +158,21 @@ be_visitor_interface_ch::visit_interface (be_interface *node) *os << "virtual const char* _interface_repository_id " << "(void) const;"; - // The virtual marshal method, to prevent marshal of local iterfaces. + // The virtual marshal method, to prevent marshal of local interfaces. *os << be_nl << "virtual ::CORBA::Boolean marshal " << "(TAO_OutputCDR &cdr);"; + // If we are generating CORBA Policy we need to add some more methods + if (ACE_OS::strcmp (node->full_name (), "CORBA::Policy") == 0) + { + *os << be_nl + << "virtual CORBA::Boolean _tao_encode (TAO_OutputCDR &);" << be_nl + << "virtual CORBA::Boolean _tao_decode (TAO_InputCDR &);" << be_nl + << "virtual TAO_Cached_Policy_Type _tao_cached_type (void) const;" << be_nl + << "virtual TAO_Policy_Scope _tao_scope (void) const;" << be_nl; + } + if (c == 0 && be_global->gen_ostream_operators ()) { *os << be_nl diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp index e4944a84974..554c40f5875 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp @@ -91,9 +91,9 @@ be_visitor_interface_ci::visit_interface (be_interface *node) << be_idt << be_idt_nl << "::IOP::IOR *ior," << be_nl << "TAO_ORB_Core *oc)" << be_uidt_nl; - *os << ": ::CORBA::Object (ior, oc)" << be_idt_nl; + *os << ": ::CORBA::Object (ior, oc)"; - *os << be_uidt << be_uidt_nl + *os << be_uidt_nl << "{" << be_nl << "}" ; } 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 0680d6e970b..fb2d3352040 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp @@ -101,6 +101,7 @@ be_visitor_interface_cs::visit_interface (be_interface *node) << "{" << be_idt_nl << "return "; + if (node->is_abstract () || c != 0) { *os << "cdr << p;"; @@ -114,6 +115,32 @@ be_visitor_interface_cs::visit_interface (be_interface *node) << "}"; } + // If we are generating CORBA Policy we need to add some more methods + if (ACE_OS::strcmp (node->full_name (), "CORBA::Policy") == 0) + { + *os << be_nl + << "CORBA::Boolean" << be_nl + << "CORBA::Policy::_tao_encode (TAO_OutputCDR &)" << be_nl + << "{" << be_nl + << " return false;" << be_nl + << "}" << be_nl << be_nl + << "CORBA::Boolean" << be_nl + << "CORBA::Policy::_tao_decode (TAO_InputCDR &)" << be_nl + << "{" << be_nl + << " return false;" << be_nl + << "}" << be_nl << be_nl + << "TAO_Cached_Policy_Type" << be_nl + << "CORBA::Policy::_tao_cached_type (void) const" << be_nl + << "{" << be_nl + << "return TAO_CACHED_POLICY_UNCACHED;" << be_nl + << "}" << be_nl << be_nl + << "TAO_Policy_Scope" << be_nl + << "CORBA::Policy::_tao_scope (void) const" << be_nl + << "{" << be_nl + << " return TAO_POLICY_DEFAULT_SCOPE;" << be_nl + << "}" << be_nl; + } + if (c == 0 && be_global->gen_ostream_operators ()) { *os << be_nl_2 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 ece9840819c..25018bb4a05 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp @@ -127,60 +127,10 @@ be_visitor_interface_sh::visit_interface (be_interface *node) // _is_a *os << "virtual ::CORBA::Boolean _is_a (const char* logical_type_id);" << be_nl_2; - // 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_upcall," << be_nl - << "void * servant);" << be_uidt - << be_uidt_nl << be_nl; - - if (!be_global->gen_minimum_corba ()) - { - // 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_upcall," << be_nl - << "void * servant);" << be_uidt - << be_uidt_nl << be_nl; - } - - if (!be_global->gen_corba_e () && !be_global->gen_minimum_corba ()) - { - // Add a skeleton for our _interface method. - *os << "static void _interface_skel (" - << be_idt << be_idt_nl - << "TAO_ServerRequest & req," << be_nl - << "void * servant_upcall," << be_nl - << "void * servant);" << be_uidt - << be_uidt_nl << be_nl; - } - - if (!be_global->gen_corba_e () && !be_global->gen_minimum_corba ()) - { - // Add a skeleton for our _component method. - *os << "static void _component_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest & req," << be_nl - << "void * servant_upcall," << be_nl - << "void * servant);" << be_uidt - << be_uidt_nl << be_nl; - } - - if (!be_global->gen_minimum_corba ()) - { - // Add a skeleton for our _repository_id method. - *os << "static void _repository_id_skel (" - << be_idt << be_idt_nl - << "TAO_ServerRequest & req," << be_nl - << "void * servant_upcall," << be_nl - << "void * servant);" << be_uidt - << 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_uidt + << "TAO::Portable_Server::Servant_Upcall *servant_upcall);" << be_uidt << be_uidt_nl << be_nl; this->this_method (node); @@ -200,24 +150,6 @@ be_visitor_interface_sh::visit_interface (be_interface *node) -1); } - // Generate skeletons for operations of our base classes. These - // skeletons just cast the pointer to the appropriate type - // before invoking the call. - int const status = - node->traverse_inheritance_graph ( - be_interface::gen_skel_helper, - os); - - if (status == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("be_visitor_interface_sh::") - ACE_TEXT ("visit_interface - ") - ACE_TEXT ("inheritance graph ") - ACE_TEXT ("traversal failed\n")), - -1); - } - *os << be_uidt_nl << "};"; be_visitor_context ctx (*this->ctx_); diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp deleted file mode 100644 index 465650b6dc1..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp +++ /dev/null @@ -1,122 +0,0 @@ - -//============================================================================= -/** - * @file interface_si.cpp - * - * $Id$ - * - * Visitor generating code for Interfaces in the server inline file - * - * - * @author Aniruddha Gokhale - */ -//============================================================================= - -// ************************************************************************ -// Interface visitor for server inline -// ************************************************************************ - -be_visitor_interface_si::be_visitor_interface_si (be_visitor_context *ctx) - : be_visitor_interface (ctx) -{ -} - -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 () - || node->is_local () - || node->is_abstract ()) - { - return 0; - } - - TAO_OutStream *os = this->ctx_->stream (); - - // Determine if we are in some form of a multiple inheritance. - int status = - node->traverse_inheritance_graph (be_interface::in_mult_inheritance_helper, - 0); - - if (status == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("be_visitor_interface_si::") - ACE_TEXT ("visit_interface ") - ACE_TEXT ("error determining mult ") - ACE_TEXT ("inheritance\n")), - -1); - } - - // 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, - os); - if (status == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("be_visitor_interface_si::") - ACE_TEXT ("visit_interface - ") - ACE_TEXT ("codegen for base ") - ACE_TEXT ("class skeletons failed\n")), - -1); - } - - if (this->generate_amh_classes (node) == -1) - { - return -1; - } - - if (be_global->gen_direct_collocation ()) - { - status = - node->traverse_inheritance_graph ( - be_interface::gen_colloc_op_defn_helper, - os); - - if (status == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("be_visitor_interface_si::") - ACE_TEXT ("visit_interface - ") - ACE_TEXT ("codegen for collocated base ") - ACE_TEXT ("class skeletons failed\n")), - -1); - } - } - - return 0; -} - -int -be_visitor_interface_si::visit_component (be_component *node) -{ - return this->visit_interface (node); -} - -int -be_visitor_interface_si::visit_connector (be_connector *node) -{ - return this->visit_interface (node); -} - -int -be_visitor_interface_si::generate_amh_classes (be_interface *node) -{ - // We have to check for an abstract ancestor until AMH is integrated - // with abstract interfaces. If the node itself is abstract, this - // visitor would not be created. - if (be_global->gen_amh_classes () && !node->has_mixed_parentage ()) - { - be_visitor_amh_interface_si amh_intf (this->ctx_); - return amh_intf.visit_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 4298c71e52f..6528801c099 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp @@ -55,7 +55,6 @@ be_visitor_interface_ss::visit_interface (be_interface *node) { return -1; } - ACE_CString full_skel_name_holder = this->generate_full_skel_name (node); @@ -171,514 +170,7 @@ be_visitor_interface_ss::visit_interface (be_interface *node) *os << be_nl_2; - // Generate code for the _is_a skeleton. - { - 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 (" _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); - - ACE_CDR::ULong bound = 0UL; - - auto_ptr<AST_String> s ( - idl_global->gen ()->create_string ( - idl_global->gen ()->create_expr (bound, - AST_Expression::EV_ulong))); - - Identifier arg_name ("repository_id"); - UTL_ScopedName scoped_arg_name (&arg_name, 0); - AST_Argument *repository_id = - idl_global->gen ()->create_argument (AST_Argument::dir_IN, - s.get (), - &scoped_arg_name); - - is_a.be_add_argument (repository_id); - - ACE_CString is_a_upcall_command_name = - "_is_a_" + ACE_CString (node_local_name) + "_Upcall_Command" ; - - be_visitor_operation_upcall_command_ss upcall_command_visitor (this->ctx_); - upcall_command_visitor.visit (&is_a, - full_skel_name, - is_a_upcall_command_name.c_str ()); - - *os << be_nl_2 - << "void " << full_skel_name - << "::_is_a_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest & server_request," << be_nl - << "void * TAO_INTERCEPTOR (servant_upcall)," << be_nl - << "void * servant)" << be_uidt << be_uidt_nl - << "{" << be_idt; - - // 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_2 - << "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_2; - - // Get the right object implementation. - *os << full_skel_name << " * const impl =" << be_idt_nl - << "static_cast<" - << full_skel_name << " *> (servant);" - << be_uidt_nl; - - // Upcall_Command instantiation. - *os << be_nl - << is_a_upcall_command_name.c_str() - << " 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" - << "\n#if TAO_HAS_INTERCEPTORS == 1" << be_nl - << " , servant_upcall" << be_nl - << " , exceptions" << be_nl - << " , nexceptions" - << "\n#endif /* TAO_HAS_INTERCEPTORS == 1 */" << be_nl - << " );"; - - this->generate_send_reply (os); - - *os << be_uidt_nl - << "}" << be_nl_2; - - is_a.destroy (); - rt.destroy (); - s.get ()->destroy (); - } - - if (!be_global->gen_minimum_corba ()) - { - // Generate code for the _non_existent skeleton. - 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 (" _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); - - ACE_CString non_exist_upcall_command_name = - "_non_existent_" - + ACE_CString (node_local_name) - + "_Upcall_Command"; - - be_visitor_operation_upcall_command_ss upcall_command_visitor (this->ctx_); - upcall_command_visitor.visit (&non_existent, - full_skel_name, - non_exist_upcall_command_name.c_str ()); - - *os << be_nl_2 - << "void " << full_skel_name - << "::_non_existent_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest & server_request," << be_nl - << "void * TAO_INTERCEPTOR (servant_upcall)," << be_nl - << "void * servant)" << be_uidt << be_uidt_nl - << "{" << be_idt; - - // Generate exception list. - be_visitor_operation_exceptlist_ss exception_list (this->ctx_); - exception_list.visit_operation (&non_existent); - - be_visitor_operation_ss op_visitor (this->ctx_); - - *os << "TAO::SArg_Traits< "; - - op_visitor.gen_arg_template_param_name (&non_existent, - &rt, - os); - - *os << ">::ret_val retval;"; - - op_visitor.gen_skel_body_arglist (&non_existent, - os); - - *os << be_nl_2 - << "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_2; - - // Get the right object implementation. - *os << full_skel_name << " * const impl =" << be_idt_nl - << "static_cast<" - << full_skel_name << " *> (servant);" - << be_uidt_nl; - - // Upcall_Command instantiation. - *os << be_nl - << non_exist_upcall_command_name.c_str() - << " command (" << be_idt_nl - << "impl"; - - if (!non_existent.void_return_type () - || non_existent.argument_count () > 0) - { - // server_request.operation_details () will be non-zero in the - // thru-POA collocation case. Use them if available. - *os << "," << be_nl; - - if (be_global->gen_thru_poa_collocation ()) - *os << "server_request.operation_details ()," << be_nl; - - *os << "args"; - } - - *os << ");" << be_uidt_nl << be_nl; - - *os << "TAO::Upcall_Wrapper upcall_wrapper;" << be_nl - << "upcall_wrapper.upcall (server_request" << be_nl - << " , args" << be_nl - << " , nargs" << be_nl - << " , command" - << "\n#if TAO_HAS_INTERCEPTORS == 1" << be_nl - << " , servant_upcall" << be_nl - << " , exceptions" << be_nl - << " , nexceptions" - << "\n#endif /* TAO_HAS_INTERCEPTORS == 1 */" << be_nl - << " );"; - - this->generate_send_reply (os); - - *os << be_uidt_nl - << "}" << be_nl; - - non_existent.destroy (); - rt.destroy (); - } - - if (!be_global->gen_minimum_corba ()) - { - ACE_CDR::ULong bound = 0UL; - - // Generate code for the _repository_id skeleton. - auto_ptr<AST_String> s ( - idl_global->gen ()->create_string ( - idl_global->gen ()->create_expr (bound, - AST_Expression::EV_ulong))); - - // @@ 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 (" _repository_id"); - UTL_ScopedName scoped_name (&op_name, 0); - be_operation repository_id (s.get (), - AST_Operation::OP_noflags, - &scoped_name, - node->is_local (), - node->is_abstract ()); - repository_id.set_defined_in (node); - - ACE_CString repository_id_upcall_command_name = - "_repository_id_" - + ACE_CString (node_local_name) - + "_Upcall_Command" ; - - be_visitor_operation_upcall_command_ss upcall_command_visitor (this->ctx_); - upcall_command_visitor.visit (&repository_id, - full_skel_name, - repository_id_upcall_command_name.c_str ()); - - *os << be_nl_2 - << "void " << full_skel_name - << "::_repository_id_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest & server_request," << be_nl - << "void * TAO_INTERCEPTOR (servant_upcall)," << be_nl - << "void * servant)" << be_uidt << be_uidt_nl - << "{" << be_idt; - - // Generate exception list. - be_visitor_operation_exceptlist_ss exception_list (this->ctx_); - exception_list.visit_operation (&repository_id); - - be_visitor_operation_ss op_visitor (this->ctx_); - - *os << "TAO::SArg_Traits< "; - - op_visitor.gen_arg_template_param_name (&repository_id, - s.get (), - os); - - *os << ">::ret_val retval;"; - - op_visitor.gen_skel_body_arglist (&repository_id, - os); - - *os << be_nl_2 - << "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_2; - - // Get the right object implementation. - *os << full_skel_name << " * const impl =" << be_idt_nl - << "static_cast<" - << full_skel_name << " *> (servant);" - << be_uidt_nl; - - // Upcall_Command instantiation. - *os << be_nl - << repository_id_upcall_command_name.c_str() - << " command (" << be_idt_nl - << "impl"; - - if (!repository_id.void_return_type () - || repository_id.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" - << "\n#if TAO_HAS_INTERCEPTORS == 1" << be_nl - << " , servant_upcall" << be_nl - << " , exceptions" << be_nl - << " , nexceptions" - << "\n#endif /* TAO_HAS_INTERCEPTORS == 1 */" << be_nl - << " );"; - - this->generate_send_reply (os); - - *os << be_uidt_nl - << "}"; - - repository_id.destroy (); - s.get ()->destroy (); - } - - if (!be_global->gen_corba_e () - && !be_global->gen_minimum_corba ()) - { - *os << be_nl_2; - - *os << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__; - - *os << be_nl_2 - << "void " << full_skel_name - << "::_interface_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest & server_request," << be_nl - << "void * /* servant_upcall */," << be_nl - << "void * servant)" << be_uidt << be_uidt_nl; - *os << "{" << be_idt_nl; - *os << "TAO_IFR_Client_Adapter *_tao_adapter =" << be_idt_nl - << "ACE_Dynamic_Service<TAO_IFR_Client_Adapter>::instance (" - << be_idt << be_idt_nl - << "TAO_ORB_Core::ifr_client_adapter_name ());" - << be_uidt - << be_uidt_nl << be_uidt_nl; - *os << "if (!_tao_adapter)" << be_idt_nl - << "{" << be_idt_nl - << "throw ::CORBA::INTF_REPOS (::CORBA::OMGVMCID | 1, ::CORBA::COMPLETED_NO);" - << be_uidt_nl - << "}" << be_uidt_nl << be_nl; - - // Get the right object implementation. - *os << full_skel_name << " * const impl =" << be_idt_nl - << "static_cast<" - << full_skel_name << " *> (servant);" - << be_uidt_nl; - - *os << "::CORBA::InterfaceDef_ptr _tao_retval = impl->_get_interface ();" - << be_nl - << "server_request.init_reply ();" << be_nl - << "TAO_OutputCDR &_tao_out = *server_request.outgoing ();" - << be_nl_2 - << "::CORBA::Boolean const _tao_result =" << be_idt_nl - << "_tao_adapter->interfacedef_cdr_insert (_tao_out, _tao_retval);" - << be_uidt_nl << be_nl - << "_tao_adapter->dispose (_tao_retval);" - << be_nl_2; - - *os << "if (!_tao_result)" << be_idt_nl - << "{" << be_idt_nl - << "throw ::CORBA::MARSHAL ();" << be_uidt_nl - << "}" << be_uidt; - - this->generate_send_reply (os); - - *os << be_uidt_nl - << "}" << be_nl_2; - } - - // Generate code for the _component skeleton, don't generate it when - // we use CORBA/e - if (!be_global->gen_corba_e () && !be_global->gen_minimum_corba ()) - { - 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 (" _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); - - ACE_CString get_component_upcall_command_name = - "_get_component_" - + ACE_CString (node_local_name) - + "_Upcall_Command" ; - - be_visitor_operation_upcall_command_ss upcall_command_visitor (this->ctx_); - upcall_command_visitor.visit (&get_component, - full_skel_name, - get_component_upcall_command_name.c_str()); - - *os << be_nl_2 - << "void " << full_skel_name - << "::_component_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest & server_request," << be_nl - << "void * TAO_INTERCEPTOR (servant_upcall)," << be_nl - << "void * servant" << be_uidt_nl - << ")" << be_uidt_nl - << "{" << be_idt; - - // 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_2 - << "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_2; - - // Get the right object implementation. - *os << full_skel_name << " * const impl =" << be_idt_nl - << "static_cast<" - << full_skel_name << " *> (servant);" - << be_uidt_nl; - - // Upcall_Command instantiation. - *os << be_nl - << get_component_upcall_command_name.c_str () - << " 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" - << "\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_uidt_nl - << "}"; - - get_component.destroy (); - rt.destroy (); - } - // Generate code for the _is_a override. - *os << be_nl_2 << "::CORBA::Boolean " << full_skel_name << "::_is_a (const char* value)" << be_nl @@ -927,12 +419,6 @@ be_visitor_interface_ss::this_method (be_interface *node) } void -be_visitor_interface_ss::generate_send_reply (TAO_OutStream *) -{ - // no-op for regular interfaces -} - -void be_visitor_interface_ss::dispatch_method (be_interface *node) { TAO_OutStream *os = this->ctx_->stream (); @@ -945,8 +431,10 @@ be_visitor_interface_ss::dispatch_method (be_interface *node) *os << be_nl_2; *os << "void " << node->full_skel_name () - << "::_dispatch (TAO_ServerRequest & req, void * servant_upcall)" - << be_nl; + << "::_dispatch (" << be_idt_nl + << "TAO_ServerRequest & req," << be_nl + << "TAO::Portable_Server::Servant_Upcall* servant_upcall)" + << be_uidt_nl; *os << "{" << be_idt_nl; *os << "this->synchronous_upcall_dispatch (req, servant_upcall, this);" << be_uidt_nl; diff --git a/TAO/TAO_IDL/be/be_visitor_module/module.cpp b/TAO/TAO_IDL/be/be_visitor_module/module.cpp index 70965c24dc2..8402c983f6f 100644 --- a/TAO/TAO_IDL/be/be_visitor_module/module.cpp +++ b/TAO/TAO_IDL/be/be_visitor_module/module.cpp @@ -289,12 +289,6 @@ be_visitor_module::visit_interface (be_interface *node) status = node->accept (&visitor); break; } - case TAO_CodeGen::TAO_ROOT_SI: - { - be_visitor_interface_si visitor (&ctx); - status = node->accept (&visitor); - break; - } case TAO_CodeGen::TAO_ROOT_SS: { be_visitor_interface_ss visitor (&ctx); @@ -353,6 +347,8 @@ be_visitor_module::visit_interface (be_interface *node) case TAO_CodeGen::TAO_ROOT_EXS: case TAO_CodeGen::TAO_ROOT_CNH: case TAO_CodeGen::TAO_ROOT_CNS: + case TAO_CodeGen::TAO_ROOT_SVTH: + case TAO_CodeGen::TAO_ROOT_SVTS: { // Nothing to be done for these cases. return 0; @@ -484,7 +480,6 @@ be_visitor_module::visit_valuebox (be_valuebox *node) break; } case TAO_CodeGen::TAO_ROOT_SH: - case TAO_CodeGen::TAO_ROOT_SI: case TAO_CodeGen::TAO_ROOT_SS: { break; @@ -564,12 +559,6 @@ be_visitor_module::visit_valuetype (be_valuetype *node) status = node->accept (&visitor); break; } - case TAO_CodeGen::TAO_ROOT_SI: - { - be_visitor_valuetype_si visitor (&ctx); - status = node->accept (&visitor); - break; - } case TAO_CodeGen::TAO_ROOT_SS: { be_visitor_valuetype_ss visitor (&ctx); @@ -669,7 +658,6 @@ be_visitor_module::visit_component (be_component *node) case TAO_CodeGen::TAO_ROOT_ANY_OP_CH: case TAO_CodeGen::TAO_ROOT_ANY_OP_CS: case TAO_CodeGen::TAO_ROOT_SH: - case TAO_CodeGen::TAO_ROOT_SI: case TAO_CodeGen::TAO_ROOT_SS: return this->visit_interface (node); @@ -679,6 +667,18 @@ be_visitor_module::visit_component (be_component *node) case TAO_CodeGen::TAO_ROOT_CNH: case TAO_CodeGen::TAO_ROOT_CNS: break; + case TAO_CodeGen::TAO_ROOT_SVTH: + { + be_visitor_facet_svth visitor (&ctx); + status = node->accept (&visitor); + break; + } + case TAO_CodeGen::TAO_ROOT_SVTS: + { + be_visitor_facet_svts visitor (&ctx); + status = node->accept (&visitor); + break; + } case TAO_CodeGen::TAO_ROOT_SVH: { be_visitor_component_svh visitor (&ctx); diff --git a/TAO/TAO_IDL/be/be_visitor_operation/amh_sh.cpp b/TAO/TAO_IDL/be/be_visitor_operation/amh_sh.cpp index 58125600147..604677bb249 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/amh_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/amh_sh.cpp @@ -127,8 +127,7 @@ void be_visitor_amh_operation_sh::generate_shared_prologue ( be_decl *node, TAO_OutStream *os, - const char *skel_prefix - ) + const char *skel_prefix) { *os << be_nl_2 << "// TAO_IDL - Generated from" << be_nl << "// " << __FILE__ << ":" << __LINE__ << be_nl_2; @@ -138,9 +137,9 @@ be_visitor_amh_operation_sh::generate_shared_prologue ( << node->local_name () << "_skel (" << be_idt << be_idt_nl << "TAO_ServerRequest &_tao_req," << be_nl - << "void *_tao_obj," << be_nl - << "void *_tao_servant_upcall" << be_uidt_nl - << ");" << be_uidt_nl << be_nl; + << "TAO::Portable_Server::Servant_Upcall *_tao_obj," << be_nl + << "TAO_ServantBase *_tao_servant_upcall" + << ");" << be_uidt_nl << be_uidt_nl; // 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 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 da9362998b9..0df2834e727 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/amh_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/amh_ss.cpp @@ -336,9 +336,9 @@ be_visitor_amh_operation_ss::generate_shared_prologue (be_decl *node, << node->local_name () << "_skel (" << be_idt << be_idt_nl << "TAO_ServerRequest & _tao_server_request," << be_nl - << "void * /* context */," << be_nl - << "void * _tao_servant" << be_uidt_nl - << ")" << be_uidt_nl; + << "TAO::Portable_Server::Servant_Upcall * /* context */," << be_nl + << "TAO_ServantBase * _tao_servant)" << be_uidt + << be_uidt_nl; // Generate the actual code for the skeleton. // last argument @@ -346,7 +346,7 @@ be_visitor_amh_operation_ss::generate_shared_prologue (be_decl *node, // Get the right object implementation. *os << amh_skel_name.c_str () << " * const _tao_impl =" << be_idt_nl - << "static_cast<" << amh_skel_name.c_str () << " *> (" + << "dynamic_cast<" << amh_skel_name.c_str () << " *> (" << "_tao_servant" << ");" << be_uidt_nl; 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 c69901bbc09..6cc527087ba 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 @@ -88,6 +88,15 @@ be_visitor_operation_direct_proxy_impl_ss::visit_operation ( *os << be_uidt_nl << "{" << be_idt_nl; + *os << intf->full_skel_name () << "_ptr _tao_ptr = " << be_idt_nl + << "dynamic_cast<" << intf->full_skel_name () << "_ptr> (" + << "servant);" << be_uidt_nl; + + *os << "if (!_tao_ptr)" << be_idt_nl + << "{" << be_idt_nl + << "throw CORBA::INTERNAL ();" << be_uidt_nl + << "}" << be_uidt_nl << be_nl; + if (!node->void_return_type ()) { *os << "((TAO::Arg_Traits< "; @@ -99,9 +108,7 @@ be_visitor_operation_direct_proxy_impl_ss::visit_operation ( *os << ">::ret_val *) args[0])->arg () =" << be_idt_nl; } - *os << "dynamic_cast<" << be_idt - << intf->full_skel_name () << "_ptr>" << be_nl << "(" - << "servant)" << be_uidt_nl; + *os << "_tao_ptr"; be_visitor_context ctx; 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 af72ab06923..034344a7d96 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/operation_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_sh.cpp @@ -107,9 +107,9 @@ be_visitor_operation_sh::visit_operation (be_operation *node) *os << node->local_name () << "_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest & server_request," << be_nl - << "void * servant_upcall," << be_nl - << "void * servant);" << be_uidt + << "TAO_ServerRequest &server_request," << be_nl + << "TAO::Portable_Server::Servant_Upcall *servant_upcall," << be_nl + << "TAO_ServantBase *servant);" << be_uidt << 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 2903992ecba..80a6ff9a21b 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp @@ -191,8 +191,8 @@ be_visitor_operation_ss::gen_skel_operation_body (be_operation * node, *os << this->ctx_->port_prefix ().c_str () << node->local_name () << "_skel (" << be_idt << be_idt_nl << "TAO_ServerRequest & server_request," << be_nl - << "void * TAO_INTERCEPTOR (servant_upcall)," << be_nl - << "void * servant)" << be_uidt << be_uidt_nl; + << "TAO::Portable_Server::Servant_Upcall *TAO_INTERCEPTOR (servant_upcall)," << be_nl + << "TAO_ServantBase *servant)" << be_uidt << be_uidt_nl; // Generate the actual code for the skeleton. However, if any of the // argument types is "native", we do not generate any skeleton @@ -246,7 +246,7 @@ be_visitor_operation_ss::gen_skel_operation_body (be_operation * node, // Get the right object implementation. *os << intf->full_skel_name () << " * const impl =" << be_idt_nl - << "static_cast<" + << "dynamic_cast<" << intf->full_skel_name () << " *> (servant);" << be_uidt << be_uidt_nl; // Upcall_Command instantiation. diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_svs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_svs.cpp index 68084dc7420..4b6d36e3524 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/operation_svs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_svs.cpp @@ -11,6 +11,7 @@ * @author Jeff Parsons */ //============================================================================= +#include <be_visitor_operation/operation_svs.h> be_visitor_operation_svs::be_visitor_operation_svs ( be_visitor_context *ctx) @@ -30,6 +31,12 @@ be_visitor_operation_svs::visit_operation (be_operation *node) os_ << be_nl_2; + + if (this->ctx_->state () == TAO_CodeGen::TAO_ROOT_SVTS) + { + os_ << "template <typename BASE, typename EXEC, typename CONTEXT>" + << be_nl; + } // Retrieve the operation return type. be_type *bt = be_type::narrow_from_decl (node->return_type ()); @@ -56,9 +63,19 @@ be_visitor_operation_svs::visit_operation (be_operation *node) } // Generate the operation name, avoiding possible _cxx_ prefix. - os_ << be_nl - << scope_->original_local_name ()->get_string () - << "_Servant"; + // USE STATE con the context!!!!!!! + if (this->ctx_->state () == TAO_CodeGen::TAO_ROOT_SVTS) + { + os_ << be_nl + << scope_->original_local_name ()->get_string () + << "_Servant_T<BASE, EXEC, CONTEXT>"; + } + else + { + os_ << be_nl + << scope_->original_local_name ()->get_string () + << "_Servant"; + } os_ << "::" << node->local_name (); diff --git a/TAO/TAO_IDL/be/be_visitor_root.cpp b/TAO/TAO_IDL/be/be_visitor_root.cpp index 92456f48d4a..046c3c67913 100644 --- a/TAO/TAO_IDL/be/be_visitor_root.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root.cpp @@ -67,13 +67,14 @@ #include "be_visitor_root/root_ci.cpp" #include "be_visitor_root/root_cs.cpp" #include "be_visitor_root/root_sh.cpp" -#include "be_visitor_root/root_si.cpp" #include "be_visitor_root/root_ss.cpp" #include "be_visitor_root/root_sth.cpp" #include "be_visitor_root/root_is.cpp" #include "be_visitor_root/root_ih.cpp" #include "be_visitor_root/root_svh.cpp" #include "be_visitor_root/root_svs.cpp" +#include "be_visitor_root/root_svth.cpp" +#include "be_visitor_root/root_svts.cpp" #include "be_visitor_root/root_ex_idl.cpp" #include "be_visitor_root/root_exh.cpp" #include "be_visitor_root/root_exs.cpp" diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_si.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_si.cpp deleted file mode 100644 index 35b082bc11b..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_root/root_si.cpp +++ /dev/null @@ -1,71 +0,0 @@ - -//============================================================================= -/** - * @file root_si.cpp - * - * $Id$ - * - * Visitor generating code for the Root in the server inline file - * - * - * @author Aniruddha Gokhale - */ -//============================================================================= - -// *********************************************** -// Root visitor for server inline -// *********************************************** - -be_visitor_root_si::be_visitor_root_si (be_visitor_context *ctx) - : be_visitor_root (ctx) -{ -} - -be_visitor_root_si::~be_visitor_root_si (void) -{ -} - -int -be_visitor_root_si::visit_root (be_root *node) -{ - if (this->init () == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("be_visitor_root_si::init - ") - ACE_TEXT ("failed to initialize\n")), - -1); - } - - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("be_visitor_root_si::visit_root - ") - ACE_TEXT ("codegen for scope failed\n")), - -1); - } - - (void) tao_cg->end_server_inline (); - - return 0; -} - -int -be_visitor_root_si::init (void) -{ - /// First open the server-side file for writing - int status = - tao_cg->start_server_inline ( - be_global->be_get_server_inline_fname ()); - - if (status == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("be_visitor_root_si::init - ") - ACE_TEXT ("Error opening server inline file\n")), - -1); - } - - /// Initialize the stream. - this->ctx_->stream (tao_cg->server_inline ()); - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_svth.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_svth.cpp new file mode 100644 index 00000000000..c4b4a10e963 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_root/root_svth.cpp @@ -0,0 +1,73 @@ + +//============================================================================= +/** + * @file root_svth.cpp + * + * $Id$ + * + * Visitor generating code for Root in the CIAO template servant header + * + * + * @author Marcel Smit + */ +//============================================================================= + +// ******************************** +// Root visitor for CIAO template servant header +// ******************************** + +be_visitor_root_svth::be_visitor_root_svth (be_visitor_context *ctx) + : be_visitor_root (ctx) +{ +} + +be_visitor_root_svth::~be_visitor_root_svth (void) +{ +} + +int +be_visitor_root_svth::visit_root (be_root *node) +{ + if (this->init () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_svth::init - ") + ACE_TEXT ("failed to initialize\n")), + -1); + } + + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_svth::visit_root - ") + ACE_TEXT ("codegen for scope failed\n")), + -1); + } + + (void) tao_cg->end_ciao_svnt_template_header (); + + return 0; +} + +int +be_visitor_root_svth::init (void) +{ + /// First open the file for writing. + int status = + tao_cg->start_ciao_svnt_template_header ( + be_global->be_get_ciao_tmpl_svnt_hdr_fname ()); + + if (status == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_svth::init - ") + ACE_TEXT ("Error opening CIAO servant ") + ACE_TEXT ("header file\n")), + -1); + } + + /// Initialize the stream. + this->ctx_->stream (tao_cg->ciao_svnt_template_header ()); + + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_svts.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_svts.cpp new file mode 100644 index 00000000000..cfe25bf2e18 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_root/root_svts.cpp @@ -0,0 +1,73 @@ + +//============================================================================= +/** + * @file root_svts.cpp + * + * $Id$ + * + * Visitor generating code for Root in the CIAO template servant source + * + * + * @author Marcel Smit + */ +//============================================================================= + +// ******************************** +// Root visitor for CIAO template servant source +// ******************************** + +be_visitor_root_svts::be_visitor_root_svts (be_visitor_context *ctx) + : be_visitor_root (ctx) +{ +} + +be_visitor_root_svts::~be_visitor_root_svts (void) +{ +} + +int +be_visitor_root_svts::visit_root (be_root *node) +{ + if (this->init () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_svts::init - ") + ACE_TEXT ("failed to initialize\n")), + -1); + } + + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_svts::visit_root - ") + ACE_TEXT ("codegen for scope failed\n")), + -1); + } + + (void) tao_cg->end_ciao_svnt_template_source (); + + return 0; +} + +int +be_visitor_root_svts::init (void) +{ + // First open the client-side header file for writing. + int status = + tao_cg->start_ciao_svnt_template_source ( + be_global->be_get_ciao_tmpl_svnt_src_fname ()); + + if (status == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_svts::init - ") + ACE_TEXT ("Error opening CIAO servant ") + ACE_TEXT ("source file\n")), + -1); + } + + // Initialize the stream. + this->ctx_->stream (tao_cg->ciao_svnt_template_source ()); + + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype.cpp index a05039ae09b..0a9d72c2e74 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype.cpp @@ -69,7 +69,6 @@ #include "be_visitor_valuetype/valuetype_ci.cpp" #include "be_visitor_valuetype/valuetype_cs.cpp" #include "be_visitor_valuetype/valuetype_sh.cpp" -#include "be_visitor_valuetype/valuetype_si.cpp" #include "be_visitor_valuetype/valuetype_ss.cpp" #include "be_visitor_valuetype/valuetype_obv_ch.cpp" #include "be_visitor_valuetype/valuetype_obv_ci.cpp" diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/field_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/field_cs.cpp index 5c78a4feb29..dfd31b10afa 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/field_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/field_cs.cpp @@ -16,8 +16,7 @@ be_visitor_valuetype_field_cs::be_visitor_valuetype_field_cs ( - be_visitor_context *ctx - ) + be_visitor_context *ctx) : be_visitor_decl (ctx), in_obv_space_ (0) { @@ -144,7 +143,7 @@ be_visitor_valuetype_field_cs::visit_array (be_array *node) *os << be_nl_2 << "// TAO_IDL - Generated from" << be_nl << "// " << __FILE__ << ":" << __LINE__ << be_nl_2; - *os << "// Accessor to set the member." << be_nl + *os << "/// Accessor to set the member." << be_nl << this->pre_op () << "void" << be_nl; this->op_name (bu, @@ -589,7 +588,7 @@ be_visitor_valuetype_field_cs::visit_predefined_type (be_predefined_type *node) *os << be_nl_2 << "// TAO_IDL - Generated from" << be_nl << "// " << __FILE__ << ":" << __LINE__ << be_nl_2; - *os << "// Accessor to set the member." << be_nl + *os << "/// Accessor to set the member." << be_nl << this->pre_op () << "void" << be_nl; this->op_name (bu, os); @@ -646,7 +645,7 @@ be_visitor_valuetype_field_cs::visit_predefined_type (be_predefined_type *node) { case AST_PredefinedType::PT_pseudo: case AST_PredefinedType::PT_object: - *os << "// Retrieve the member" << be_nl + *os << "/// Retrieve the member" << be_nl << this->pre_op () << "::" << bt->name () << "_ptr" << be_nl; this->op_name (bu, @@ -765,7 +764,7 @@ be_visitor_valuetype_field_cs::visit_sequence (be_sequence *node) << "// " << __FILE__ << ":" << __LINE__ << be_nl_2; // (1) set from a const - *os << "// Accessor to set the member." << be_nl + *os << "/// Accessor to set the member." << be_nl << this->pre_op () << "void" << be_nl; this->op_name (bu, @@ -781,7 +780,7 @@ be_visitor_valuetype_field_cs::visit_sequence (be_sequence *node) << " = val;" << be_uidt_nl; *os << "}" << be_nl_2; - *os << "// Readonly get method." << be_nl + *os << "/// Readonly get method." << be_nl << this->pre_op () << "const " << bt->name () << " &" << be_nl; this->op_name (bu, @@ -796,7 +795,7 @@ be_visitor_valuetype_field_cs::visit_sequence (be_sequence *node) << ";" << be_uidt_nl << "}" << be_nl_2; - *os << "// Read/write get method." << be_nl + *os << "/// Read/write get method." << be_nl << this->pre_op () << bt->name () << " &" << be_nl; this->op_name (bu, @@ -836,7 +835,7 @@ be_visitor_valuetype_field_cs::visit_string (be_string *node) *os << be_nl_2 << "// TAO_IDL - Generated from" << be_nl << "// " << __FILE__ << ":" << __LINE__ << be_nl_2; - *os << "// Accessor to set the member." << be_nl + *os << "/// Accessor to set the member." << be_nl << this->pre_op () << "void" << be_nl; this->op_name (bu, @@ -860,7 +859,7 @@ be_visitor_valuetype_field_cs::visit_string (be_string *node) << "}" << be_nl_2; // (2) Set method from const char * or const wchar*. - *os << "// Accessor to set the member." << be_nl + *os << "/// Accessor to set the member." << be_nl << this->pre_op () << "void" << be_nl; this->op_name (bu, @@ -896,7 +895,7 @@ be_visitor_valuetype_field_cs::visit_string (be_string *node) *os << "}" << be_nl_2; // (3) Set from const String_var&. - *os << "// Accessor to set the member." << be_nl + *os << "/// Accessor to set the member." << be_nl << this->pre_op () << "void" << be_nl; this->op_name (bu, @@ -1006,7 +1005,7 @@ be_visitor_valuetype_field_cs::visit_structure (be_structure *node) << "// " << __FILE__ << ":" << __LINE__ << be_nl_2; // (1) Set from a const. - *os << "// Accessor to set the member." << be_nl + *os << "/// Accessor to set the member." << be_nl << this->pre_op () << "void" << be_nl; this->op_name (bu, @@ -1023,7 +1022,7 @@ be_visitor_valuetype_field_cs::visit_structure (be_structure *node) *os << "}" << be_nl; - *os << "// Readonly get method." << be_nl + *os << "/// Readonly get method." << be_nl << this->pre_op () << "const " << bt->name () << " &" << be_nl; this->op_name (bu, @@ -1037,7 +1036,7 @@ be_visitor_valuetype_field_cs::visit_structure (be_structure *node) << ";" << be_uidt_nl; *os << "}" << be_nl; - *os << "// Read/write get method." << be_nl + *os << "/// Read/write get method." << be_nl << this->pre_op () << bt->name () << " &" << be_nl; this->op_name (bu, @@ -1122,7 +1121,7 @@ be_visitor_valuetype_field_cs::visit_union (be_union *node) *os << be_nl_2 << "// TAO_IDL - Generated from" << be_nl << "// " << __FILE__ << ":" << __LINE__ << be_nl_2; - *os << "// Accessor to set the member" << be_nl + *os << "/// Accessor to set the member" << be_nl << this->pre_op () << "void" << be_nl; this->op_name (bu, @@ -1135,7 +1134,7 @@ be_visitor_valuetype_field_cs::visit_union (be_union *node) << bu->field_pd_postfix () << " = val;" << be_uidt_nl; *os << "}" << be_nl; - *os << "// Readonly get method." << be_nl + *os << "/// Readonly get method." << be_nl << this->pre_op () << "const " << bt->name () << " &" << be_nl; this->op_name (bu, @@ -1149,7 +1148,7 @@ be_visitor_valuetype_field_cs::visit_union (be_union *node) << ";" << be_uidt_nl << "}" << be_nl; - *os << "// Read/write get method." << be_nl + *os << "/// Read/write get method." << be_nl << this->pre_op () << bt->name () << " &" << be_nl; this->op_name (bu, diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp index 09db8aea597..dbe0de1df37 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp @@ -193,7 +193,6 @@ be_visitor_valuetype::visit_constant (be_constant *node) case TAO_CodeGen::TAO_ROOT_SH: case TAO_CodeGen::TAO_ROOT_IH: case TAO_CodeGen::TAO_ROOT_IS: - case TAO_CodeGen::TAO_ROOT_SI: case TAO_CodeGen::TAO_ROOT_SS: return 0; // Nothing to be done. default: @@ -268,7 +267,6 @@ be_visitor_valuetype::visit_enum (be_enum *node) case TAO_CodeGen::TAO_ROOT_SH: case TAO_CodeGen::TAO_ROOT_IH: case TAO_CodeGen::TAO_ROOT_IS: - case TAO_CodeGen::TAO_ROOT_SI: case TAO_CodeGen::TAO_ROOT_SS: return 0; // Nothing to be done. default: @@ -512,10 +510,11 @@ be_visitor_valuetype::visit_union (be_union *node) break; } case TAO_CodeGen::TAO_VALUETYPE_OBV_CH: + case TAO_CodeGen::TAO_MODULE_OBV_CI: + case TAO_CodeGen::TAO_MODULE_OBV_CS: case TAO_CodeGen::TAO_ROOT_SH: case TAO_CodeGen::TAO_ROOT_IH: case TAO_CodeGen::TAO_ROOT_IS: - case TAO_CodeGen::TAO_ROOT_SI: case TAO_CodeGen::TAO_ROOT_SS: return 0; // Nothing to be done. default: @@ -630,7 +629,6 @@ be_visitor_valuetype::visit_typedef (be_typedef *node) case TAO_CodeGen::TAO_ROOT_SH: case TAO_CodeGen::TAO_ROOT_IH: case TAO_CodeGen::TAO_ROOT_IS: - case TAO_CodeGen::TAO_ROOT_SI: case TAO_CodeGen::TAO_ROOT_SS: return 0; // Nothing to be done. default: diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_cs.cpp index 69c39553917..18c10a03b78 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_cs.cpp @@ -74,8 +74,7 @@ be_visitor_valuetype_obv_cs::visit_valuetype (be_valuetype *node) unsigned long index = 0; this->gen_obv_init_constructor_args (node, index); - *os << be_uidt_nl - << ")" << be_uidt << be_uidt_nl + *os << ")" << be_uidt << be_uidt << be_uidt_nl << ": require_truncation_ (false)" << be_nl << "{" << be_idt; diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_si.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_si.cpp deleted file mode 100644 index 7b49825afb5..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_si.cpp +++ /dev/null @@ -1,41 +0,0 @@ - -//============================================================================= -/** - * @file valuetype_si.cpp - * - * $Id$ - * - * Visitor generating code for Interfaces in the server inline file - * - * - * @author Jeff Parsons - */ -//============================================================================= - - -// ************************************************************************ -// Valuetype visitor for server inline -// ************************************************************************ - -be_visitor_valuetype_si::be_visitor_valuetype_si (be_visitor_context *ctx) - : be_visitor_valuetype (ctx) -{ -} - -be_visitor_valuetype_si::~be_visitor_valuetype_si (void) -{ -} - -int -be_visitor_valuetype_si::visit_valuetype (be_valuetype *) -{ - // Nothing needed for now, but the visitor is here just in case. - return 0; -} - -int -be_visitor_valuetype_si::visit_eventtype (be_eventtype *node) -{ - return this->visit_valuetype (node); -} - diff --git a/TAO/TAO_IDL/be_include/be_codegen.h b/TAO/TAO_IDL/be_include/be_codegen.h index b0611b2bb8a..03f7442c765 100644 --- a/TAO/TAO_IDL/be_include/be_codegen.h +++ b/TAO/TAO_IDL/be_include/be_codegen.h @@ -119,7 +119,6 @@ public: TAO_ROOT_CI, TAO_ROOT_CS, TAO_ROOT_SH, - TAO_ROOT_SI, TAO_ROOT_SS, TAO_ROOT_TIE_SH, TAO_ROOT_TIE_SS, @@ -127,6 +126,8 @@ public: TAO_ROOT_IS, TAO_ROOT_SVH, TAO_ROOT_SVS, + TAO_ROOT_SVTH, + TAO_ROOT_SVTS, TAO_ROOT_EXH, TAO_ROOT_EXS, TAO_ROOT_CNH, @@ -226,9 +227,6 @@ public: /// Set the server template header stream. int start_server_template_header (const char *fname); - /// Set the server inline stream. - int start_server_inline (const char *fname); - /// Set the server skeletons stream. int start_server_skeletons (const char *fname); @@ -243,6 +241,8 @@ public: int start_ciao_svnt_header (const char *fname); int start_ciao_svnt_source (const char *fname); + int start_ciao_svnt_template_header (const char *fname); + int start_ciao_svnt_template_source (const char *fname); int start_ciao_exec_header (const char *fname); int start_ciao_exec_source (const char *fname); int start_ciao_exec_idl (const char *fname); @@ -263,9 +263,6 @@ public: /// Put a last #endif in the server header. int end_server_header (void); - /// Generate necessary code at end of server inline file. - void end_server_inline (void); - /// Put a last #endif in the server header. int end_implementation_header (const char *fname); @@ -289,6 +286,8 @@ public: int end_ciao_svnt_header (void); int end_ciao_svnt_source (void); + int end_ciao_svnt_template_header (void); + int end_ciao_svnt_template_source (void); int end_ciao_exec_header (void); int end_ciao_exec_source (void); int end_ciao_exec_idl (void); @@ -323,9 +322,6 @@ public: /// Get the server template skeletons stream. TAO_OutStream *server_template_skeletons (void); - /// Get the server inline stream. - TAO_OutStream *server_inline (void); - /// Get the server template inline stream. TAO_OutStream *server_template_inline (void); @@ -341,6 +337,12 @@ public: /// Get the CIAO servant source stream. TAO_OutStream *ciao_svnt_source (void); + /// Get the CIAO template servant header stream. + TAO_OutStream *ciao_svnt_template_header (void); + + /// Get the CIAO template servant source stream. + TAO_OutStream *ciao_svnt_template_source (void); + /// Get the CIAO executor impl header stream. TAO_OutStream *ciao_exec_header (void); @@ -417,8 +419,8 @@ private: void gen_typecode_includes (TAO_OutStream * stream); /// Used if one or both of the CIAO code gen flags are set. - void gen_svnt_hdr_includes (void); - void gen_svnt_src_includes (void); + void gen_svnt_hdr_includes (TAO_OutStream *stream); + void gen_svnt_src_includes (TAO_OutStream *stream); void gen_exec_hdr_includes (void); void gen_exec_src_includes (void); void gen_exec_idl_includes (void); @@ -463,9 +465,6 @@ private: /// Server skeleton template stream. TAO_OutStream *server_template_skeletons_; - /// Server side inline file. - TAO_OutStream *server_inline_; - /// Anyop header file. TAO_OutStream *anyop_header_; @@ -481,6 +480,12 @@ private: /// Component servant source file. TAO_OutStream *ciao_svnt_source_; + /// Template component servant header file. + TAO_OutStream *ciao_svnt_template_header_; + + /// Template component servant source file. + TAO_OutStream *ciao_svnt_template_source_; + /// Component executor impl header file. TAO_OutStream *ciao_exec_header_; diff --git a/TAO/TAO_IDL/be_include/be_global.h b/TAO/TAO_IDL/be_include/be_global.h index 4838d0b77ff..e65c4d30646 100644 --- a/TAO/TAO_IDL/be_include/be_global.h +++ b/TAO/TAO_IDL/be_include/be_global.h @@ -99,9 +99,6 @@ public: static const char *be_get_server_template_skeleton_fname ( bool base_name_only = false); - static const char *be_get_server_inline_fname ( - bool base_name_only = false); - static const char *be_get_anyop_source_fname ( bool base_name_only = false); @@ -111,9 +108,15 @@ public: static const char *be_get_ciao_svnt_hdr_fname ( bool base_name_only = false); + static const char *be_get_ciao_tmpl_svnt_hdr_fname ( + bool base_name_only=false); + static const char *be_get_ciao_svnt_src_fname ( bool base_name_only = false); + static const char *be_get_ciao_tmpl_svnt_src_fname ( + bool base_name_only=false); + static const char *be_get_ciao_exec_hdr_fname ( bool base_name_only = false); @@ -180,10 +183,6 @@ public: UTL_String *idl_file_name, bool base_name_only = false); - static const char *be_get_server_inline ( - UTL_String *idl_file_name, - bool base_name_only = false); - static const char *be_get_anyop_header ( UTL_String *idl_file_name, bool base_name_only = false); @@ -196,10 +195,18 @@ public: UTL_String *idl_file_name, bool base_name_only = false); + static const char *be_get_ciao_svnt_template_header ( + UTL_String *idl_file_name, + bool base_name_only = false); + static const char *be_get_ciao_svnt_source ( UTL_String *idl_file_name, bool base_name_only = false); + static const char *be_get_ciao_svnt_template_source ( + UTL_String *idl_file_name, + bool base_name_only = false); + static const char *be_get_ciao_exec_header ( UTL_String *idl_file_name, bool base_name_only = false); @@ -481,12 +488,6 @@ public: /// Get the server_template_skeleton_ending. const char* server_template_skeleton_ending (void) const; - /// Set the server_inline_ending. - void server_inline_ending (const char* s); - - /// Get the server_inline_ending. - const char* server_inline_ending (void) const; - /// Set the anyop_header_ending. void anyop_header_ending (const char* s); @@ -501,6 +502,12 @@ public: /// Similar to above, but for CIAO servant and executor /// impl and executor IDL files, if generated. + void ciao_svnt_header_template_ending (const char* s); + const char* ciao_svnt_header_template_ending (void) const; + + void ciao_svnt_source_template_ending (const char* s); + const char* ciao_svnt_source_template_ending (void) const; + void ciao_svnt_header_ending (const char* s); const char* ciao_svnt_header_ending (void) const; @@ -603,6 +610,20 @@ public: /// to be kept. Default is output_dir_. const char* anyop_output_dir (void) const; + /// Set the directory where all the *exec.* files are + /// to be kept. Default is output_dir_. + void exec_output_dir (const char* s); + + /// Get the directory where all the *exec.* files are + /// to be kept. Default is output_dir_. + const char* exec_output_dir (void) const; + + ///Get the flag for not overwriting already existing exec files. + bool overwrite_not_exec (void) const; + + ///Set the flag for not overwriting already existing exec files. + void overwrite_not_exec (bool val); + /// Set any support. void any_support (bool); @@ -797,10 +818,6 @@ public: bool gen_client_inline (void) const; void gen_client_inline (bool val); - /// Accessors for the member gen_server_inline_. - bool gen_server_inline (void) const; - void gen_server_inline (bool val); - /// Accessors for the member gen_client_stub_. bool gen_client_stub (void) const; void gen_client_stub (bool val); @@ -967,15 +984,18 @@ private: /// "S_T.cpp". char* server_template_skeleton_ending_; - /// Server's inline file name ending. Default is "S.i". - char* server_inline_ending_; - /// Anyop header file name ending. Default is "A.h". char* anyop_hdr_ending_; /// Anyop source file name ending. Default is "A.cpp". char* anyop_src_ending_; + /// CIAO servant template header file name ending. Default is "_svnt_T.h". + char* ciao_svnt_hdr_template_ending_; + + /// CIAO servant template source file name ending. Default is "_svnt_T.cpp". + char* ciao_svnt_src_template_ending_; + /// CIAO servant header file name ending. Default is "_svnt.h". char* ciao_svnt_hdr_ending_; @@ -1045,6 +1065,14 @@ private: */ char* anyop_output_dir_; + /** + * Directory where all the *exec.* files are to be + * kept. Default value is 0 for this string which means the + * value for output_dir_ is used. + */ + char* exec_output_dir_; + + /// do we support Any operators? bool any_support_; @@ -1160,10 +1188,6 @@ private: bool gen_client_inline_; /// True by default, but a command line option can turn this off so - /// that we don't generate a server inline file - bool gen_server_inline_; - - /// True by default, but a command line option can turn this off so /// that we don't generate a client stub file bool gen_client_stub_; @@ -1206,6 +1230,10 @@ private: bool gen_ciao_exec_impl_; bool gen_ciao_exec_reactor_impl_; + ///Flag to indicate whether generated exec files should + ///overwritten already existing exe files + bool overwrite_not_exec_; + /// False by default, this flag triggers code generation /// for CCM connector implementations. bool gen_ciao_conn_impl_; diff --git a/TAO/TAO_IDL/be_include/be_helper.h b/TAO/TAO_IDL/be_include/be_helper.h index fa1938ef12a..a34083dc2af 100644 --- a/TAO/TAO_IDL/be_include/be_helper.h +++ b/TAO/TAO_IDL/be_include/be_helper.h @@ -110,6 +110,8 @@ public: TAO_GPERF_INPUT, CIAO_SVNT_HDR, CIAO_SVNT_IMPL, + CIAO_SVNT_T_HDR, + CIAO_SVNT_T_IMPL, CIAO_EXEC_HDR, CIAO_EXEC_IMPL, CIAO_EXEC_IDL, diff --git a/TAO/TAO_IDL/be_include/be_interface.h b/TAO/TAO_IDL/be_include/be_interface.h index ca64c76bdfd..46e95ec8235 100644 --- a/TAO/TAO_IDL/be_include/be_interface.h +++ b/TAO/TAO_IDL/be_include/be_interface.h @@ -185,24 +185,6 @@ public: be_interface *, TAO_OutStream *os); - /// Helper method passed to the template method to generate code for the - /// skeletons in the header and inline files. - static int gen_skel_helper (be_interface *, - be_interface *, - TAO_OutStream *); - - /// Helper method passed to the template method to generate code for the - /// collocated functions in the header file. - static int gen_colloc_op_decl_helper (be_interface *derived, - be_interface *ancestor, - TAO_OutStream *os); - - /// Helper method passed to the template method to generate code for the - /// collocated functions in the source file. - static int gen_colloc_op_defn_helper (be_interface *derived, - be_interface *ancestor, - TAO_OutStream *os); - /// Helper method passed to the template method to invoke ctors of all the /// base classes. static int copy_ctor_helper (be_interface *, @@ -247,15 +229,6 @@ public: /// pure virtual. int convert_parent_ops (be_visitor *visitor); - /// Common code called from gen_colloc_op_defn_helper(). - static void gen_collocated_skel_body (be_interface *derived, - be_interface *ancestor, - AST_Decl *d, - const char *prefix, - bool direct, - UTL_ExceptList *list, - TAO_OutStream *os); - /// Overridden from class be_type. virtual void gen_ostream_operator (TAO_OutStream *os, bool use_underscore); @@ -412,6 +385,9 @@ protected: /// applies only to implied IDL be_interface *original_interface_; + /// Are we an AMH reply handler? + bool is_amh_rh_; + /// Are we an AMI reply handler? bool is_ami_rh_; diff --git a/TAO/TAO_IDL/be_include/be_provides.h b/TAO/TAO_IDL/be_include/be_provides.h index 0effaf3ce33..6c32155c6b1 100644 --- a/TAO/TAO_IDL/be_include/be_provides.h +++ b/TAO/TAO_IDL/be_include/be_provides.h @@ -25,8 +25,8 @@ public: be_type *provides_type (void) const; // Common code called by visitors. - int gen_facet_svnt_decl (TAO_OutStream &os); - int gen_facet_svnt_defn (TAO_OutStream &os); + int gen_facet_svnt_tmpl_decl (TAO_OutStream &os); + int gen_facet_svnt_tmpl_defn (TAO_OutStream &os); // Narrowing. DEF_NARROW_FROM_DECL(be_provides); diff --git a/TAO/TAO_IDL/be_include/be_util.h b/TAO/TAO_IDL/be_include/be_util.h index 26f05ee0bd7..7152e910841 100644 --- a/TAO/TAO_IDL/be_include/be_util.h +++ b/TAO/TAO_IDL/be_include/be_util.h @@ -63,7 +63,14 @@ public: /// Called from various places. static const char * - get_output_path (bool for_anyop, bool for_skel); + get_output_path (bool for_anyop, bool for_skel, bool for_exec); + + static const char * + get_complete_file_name (bool for_exec); + + /// Called from various places. + static bool + overwrite_ciao_exec_files (void); // Called by each node upon construction. static void set_arg_seen_bit (be_type *); diff --git a/TAO/TAO_IDL/be_include/be_visitor_component.h b/TAO/TAO_IDL/be_include/be_visitor_component.h index deb945c9eab..1fd4cfdf9b1 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_component.h +++ b/TAO/TAO_IDL/be_include/be_visitor_component.h @@ -21,11 +21,11 @@ #include "be_visitor_component/component.h" #include "be_visitor_component/component_svh.h" -#include "be_visitor_component/facet_svh.h" +#include "be_visitor_component/facet_svth.h" #include "be_visitor_component/context_svh.h" #include "be_visitor_component/servant_svh.h" #include "be_visitor_component/component_svs.h" -#include "be_visitor_component/facet_svs.h" +#include "be_visitor_component/facet_svts.h" #include "be_visitor_component/context_svs.h" #include "be_visitor_component/servant_svs.h" #include "be_visitor_component/component_ex_idl.h" diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/facet_svh.h b/TAO/TAO_IDL/be_include/be_visitor_component/facet_svth.h index 93d83b4eb57..819e0dc8161 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_component/facet_svh.h +++ b/TAO/TAO_IDL/be_include/be_visitor_component/facet_svth.h @@ -1,7 +1,7 @@ /* -*- c++ -*- */ //============================================================================= /** - * @file facet_svh.h + * @file facet_svth.h * * $Id$ * @@ -18,20 +18,22 @@ #define _BE_COMPONENT_FACET_SVH_H_ /** - * @class be_visitor_facet_svh + * @class be_visitor_facet_svth * - * @brief be_visitor_facet_svh + * @brief be_visitor_facet_svth * * This is a concrete visitor to generate the facet servant decl * for a component. */ -class be_visitor_facet_svh : public be_visitor_component_scope +class be_visitor_facet_svth : public be_visitor_component_scope { public: - be_visitor_facet_svh (be_visitor_context *ctx); + be_visitor_facet_svth (be_visitor_context *ctx); - ~be_visitor_facet_svh (void); + ~be_visitor_facet_svth (void); + virtual int visit_connector (be_connector *node); + virtual int visit_component (be_component *node); virtual int visit_provides (be_provides *node); }; diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/facet_svs.h b/TAO/TAO_IDL/be_include/be_visitor_component/facet_svts.h index 46658f60257..771fd5c74df 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_component/facet_svs.h +++ b/TAO/TAO_IDL/be_include/be_visitor_component/facet_svts.h @@ -1,7 +1,7 @@ /* -*- c++ -*- */ //============================================================================= /** - * @file facet_svs.h + * @file facet_svts.h * * $Id$ * @@ -18,20 +18,22 @@ #define _BE_COMPONENT_FACET_SVS_H_ /** - * @class be_visitor_facet_svs + * @class be_visitor_facet_svts * - * @brief be_visitor_facet_svs + * @brief be_visitor_facet_svts * * This is a concrete visitor to generate the facet servant defn * for a component. */ -class be_visitor_facet_svs : public be_visitor_component_scope +class be_visitor_facet_svts : public be_visitor_component_scope { public: - be_visitor_facet_svs (be_visitor_context *ctx); + be_visitor_facet_svts (be_visitor_context *ctx); - ~be_visitor_facet_svs (void); + ~be_visitor_facet_svts (void); + virtual int visit_connector (be_connector *node); + virtual int visit_component (be_component *node); virtual int visit_provides (be_provides *node); }; diff --git a/TAO/TAO_IDL/be_include/be_visitor_connector/facet_ami_exh.h b/TAO/TAO_IDL/be_include/be_visitor_connector/facet_ami_exh.h index 1ab59a3edef..4041ff91eac 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_connector/facet_ami_exh.h +++ b/TAO/TAO_IDL/be_include/be_visitor_connector/facet_ami_exh.h @@ -36,6 +36,7 @@ public: virtual int visit_component (be_component *node); virtual int visit_provides (be_provides *node); virtual int visit_operation (be_operation *node); + virtual int visit_attribute (be_attribute *node); protected: /// Common the this class and derived class. @@ -48,11 +49,28 @@ protected: const char *scope_name_; const char *iface_name_; const char *smart_scope_; + bool sync_; private: int gen_reply_handler_class (void); int gen_facet_executor_class (void); }; + //============================================================== + /// Worker class passed to traverse_inheritance_graph(), + /// collects all operations and attributes. + class Facet_AMI_ExecH_Op_Attr_Generator + : public TAO_IDL_Inheritance_Hierarchy_Worker + { + public: + Facet_AMI_ExecH_Op_Attr_Generator (be_visitor_scope * visitor); + + virtual int emit (be_interface * derived_interface, + TAO_OutStream * os, + be_interface * base_interface); + + private: + be_visitor_scope * visitor_; + }; #endif /* _BE_COMPONENT_FACET_AMI_EXH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_connector/facet_ami_exs.h b/TAO/TAO_IDL/be_include/be_visitor_connector/facet_ami_exs.h index 525e9cfa439..95fb47a81ea 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_connector/facet_ami_exs.h +++ b/TAO/TAO_IDL/be_include/be_visitor_connector/facet_ami_exs.h @@ -37,14 +37,17 @@ public: virtual int visit_provides (be_provides *node); virtual int visit_operation (be_operation *node); virtual int visit_argument (be_argument *node); + virtual int visit_attribute (be_attribute *node); virtual int post_process (be_decl *node); private: + void init (void); int gen_reply_handler_class (void); int gen_facet_executor_class (void); int gen_reply_hander_op (be_operation *node); int gen_facet_executor_op (be_operation *node); + int gen_facet_executor_sync_op (be_operation *node); private: /// Storage for the interface type of the facet. @@ -53,6 +56,7 @@ private: /// Flag to tell us which operation body (reply handler /// or sendc_* class) we are generating. bool for_reply_handler_; + bool sync_; }; //============================================================== diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface.h b/TAO/TAO_IDL/be_include/be_visitor_interface.h index 740fa08dcae..a9334086554 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_interface.h +++ b/TAO/TAO_IDL/be_include/be_visitor_interface.h @@ -27,7 +27,6 @@ #include "be_visitor_interface/interface_cs.h" #include "be_visitor_interface/interface_sh.h" #include "be_visitor_interface/interface_ih.h" -#include "be_visitor_interface/interface_si.h" #include "be_visitor_interface/interface_ss.h" #include "be_visitor_interface/interface_is.h" #include "be_visitor_interface/interface_ex_idl.h" @@ -54,7 +53,6 @@ // AMH #include "be_visitor_interface/amh_ch.h" #include "be_visitor_interface/amh_sh.h" -#include "be_visitor_interface/amh_si.h" #include "be_visitor_interface/amh_ss.h" #include "be_visitor_interface/amh_rh_sh.h" #include "be_visitor_interface/amh_rh_ss.h" diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/amh_si.h b/TAO/TAO_IDL/be_include/be_visitor_interface/amh_si.h deleted file mode 100644 index 77eb09dc377..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_interface/amh_si.h +++ /dev/null @@ -1,31 +0,0 @@ -//============================================================================= -/** - * @file amh_si.h - * - * $Id$ - * - * Specialized interface visitor for AMH - * - * @author Jeff Parsons <j.parsons@vanderbilt.edu> - */ -//============================================================================= - -#ifndef AMH_SH_I_ -#define AMH_SH_I_ - -class be_visitor_amh_interface_si : public be_visitor_interface_si -{ -public: - be_visitor_amh_interface_si (be_visitor_context *ctx); - ~be_visitor_amh_interface_si (void); - - int visit_interface (be_interface *node); - - // Helper method passed to the template method to generate code for the - // AMH skeletons in the inline files. - static int gen_skel_helper (be_interface *, - be_interface *, - TAO_OutStream *); -}; - -#endif /* AMH_SH_I_ */ 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 c65578519df..d14fdf2ba03 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 @@ -31,8 +31,6 @@ protected: virtual void this_method (be_interface *node); virtual void dispatch_method (be_interface *node); - virtual void generate_send_reply (TAO_OutStream * os); - virtual int generate_amh_classes (be_interface *node); virtual int generate_proxy_classes (be_interface *node); // virtual int generate_downcast_implementation (be_interface *node, diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/interface_si.h b/TAO/TAO_IDL/be_include/be_visitor_interface/interface_si.h deleted file mode 100644 index cbf85d0f780..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_interface/interface_si.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- c++ -*- */ -//============================================================================= -/** - * @file interface_si.h - * - * $Id$ - * - * Concrete visitor for the Interface node. - * This provides for code generation in the server inline - * - * - * @author Aniruddha Gokhale - */ -//============================================================================= - -#ifndef _BE_INTERFACE_INTERFACE_SI_H_ -#define _BE_INTERFACE_INTERFACE_SI_H_ - -/** - * @class be_visitor_interface_si - * - * @brief be_visitor_interface_si - * - * This is a concrete visitor to generate the server inline for interface - */ -class be_visitor_interface_si : public be_visitor_interface -{ -public: - be_visitor_interface_si (be_visitor_context *ctx); - ~be_visitor_interface_si (void); - - virtual int visit_interface (be_interface *node); - virtual int visit_component (be_component *node); - virtual int visit_connector (be_connector *node); - -protected: - virtual int generate_amh_classes (be_interface *node); -}; - -#endif /* _BE_INTERFACE_INTERFACE_SI_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 f86a68aa722..440aceef479 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 @@ -46,13 +46,6 @@ protected: virtual void this_method (be_interface *node); virtual void dispatch_method (be_interface *node); - // Some AMH skeletons must explicitly send the reply, for regular - // classes the following function is empty, for AMH code it - // generates the explicit call. - virtual void generate_send_reply (TAO_OutStream * os); - -/// virtual int generate_downcast_implementation (be_interface *node, -/// TAO_OutStream *os); virtual int generate_amh_classes (be_interface *node); virtual int generate_proxy_classes (be_interface *node); virtual int generate_copy_ctor (be_interface *node, diff --git a/TAO/TAO_IDL/be_include/be_visitor_root.h b/TAO/TAO_IDL/be_include/be_visitor_root.h index 7cd109881cb..03bb3e7722a 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_root.h +++ b/TAO/TAO_IDL/be_include/be_visitor_root.h @@ -24,13 +24,14 @@ #include "be_visitor_root/root_ci.h" #include "be_visitor_root/root_cs.h" #include "be_visitor_root/root_sh.h" -#include "be_visitor_root/root_si.h" #include "be_visitor_root/root_ss.h" #include "be_visitor_root/root_sth.h" #include "be_visitor_root/root_is.h" #include "be_visitor_root/root_ih.h" #include "be_visitor_root/root_svh.h" #include "be_visitor_root/root_svs.h" +#include "be_visitor_root/root_svth.h" +#include "be_visitor_root/root_svts.h" #include "be_visitor_root/root_ex_idl.h" #include "be_visitor_root/root_exh.h" #include "be_visitor_root/root_exs.h" diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_si.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_si.h deleted file mode 100644 index f89c54e951d..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_root/root_si.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- c++ -*- */ - -//============================================================================= -/** - * @file root_si.h - * - * $Id$ - * - * Concrete visitor for the Root class - * This one provides code generation for elements of the Root node in the - * server inline. - * - * - * @author Aniruddha Gokhale - */ -//============================================================================= - -#ifndef _BE_VISITOR_ROOT_ROOT_SI_H_ -#define _BE_VISITOR_ROOT_ROOT_SI_H_ - -/** - * @class be_visitor_root_si - * - * @brief be_visitor_root_si - * - * This is a concrete visitor to generate the server inline for root - */ -class be_visitor_root_si : public be_visitor_root -{ -public: - be_visitor_root_si (be_visitor_context *ctx); - - ~be_visitor_root_si (void); - - virtual int visit_root (be_root *node); - -private: - /// Open file and initialize stream. - int init (void); -}; - -#endif /* _BE_VISITOR_ROOT_ROOT_SI_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_svth.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_svth.h new file mode 100644 index 00000000000..c871779a766 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_svth.h @@ -0,0 +1,43 @@ +/* -*- c++ -*- */ + +//============================================================================= +/** + * @file root_svth.h + * + * $Id$ + * + * Concrete visitor for the Root class + * This one provides code generation for elements of the Root node in the + * CIAO servant header. + * + * + * @author Marcel Smit + */ +//============================================================================= + +#ifndef _BE_VISITOR_ROOT_ROOT_SVTH_H_ +#define _BE_VISITOR_ROOT_ROOT_SVTH_H_ + +/** + * @class be_visitor_root_svth + * + * @brief be_visitor_root_svth + * + * This is a concrete visitor to generate the CIAO template servant + * header for root + */ +class be_visitor_root_svth : public be_visitor_root +{ +public: + be_visitor_root_svth (be_visitor_context *ctx); + + ~be_visitor_root_svth (void); + + virtual int visit_root (be_root *node); + +private: + /// Open file and initialize stream. + int init (void); +}; + +#endif /* _BE_VISITOR_ROOT_ROOT_SVTH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_svts.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_svts.h new file mode 100644 index 00000000000..28dcf4909a3 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_svts.h @@ -0,0 +1,43 @@ +/* -*- c++ -*- */ + +//============================================================================= +/** + * @file root_svts.h + * + * $Id$ + * + * Concrete visitor for the Root class + * This one provides code generation for elements of the Root node in the + * CIAO servant source. + * + * + * @author Marcel Smit + */ +//============================================================================= + +#ifndef _BE_VISITOR_ROOT_ROOT_SVTS_H_ +#define _BE_VISITOR_ROOT_ROOT_SVTS_H_ + +/** + * @class be_visitor_root_svts + * + * @brief be_visitor_root_svts + * + * This is a concrete visitor to generate the CIAO template servant + * source for root + */ +class be_visitor_root_svts : public be_visitor_root +{ +public: + be_visitor_root_svts (be_visitor_context *ctx); + + ~be_visitor_root_svts (void); + + virtual int visit_root (be_root *node); + +private: + /// Set the right context and make a visitor. + int init (void); +}; + +#endif /* _BE_VISITOR_ROOT_ROOT_SVTS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype.h index d2b8edfb80e..a8a73cc1846 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_valuetype.h +++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype.h @@ -26,7 +26,6 @@ #include "be_visitor_valuetype/valuetype_ci.h" #include "be_visitor_valuetype/valuetype_cs.h" #include "be_visitor_valuetype/valuetype_sh.h" -#include "be_visitor_valuetype/valuetype_si.h" #include "be_visitor_valuetype/valuetype_ss.h" #include "be_visitor_valuetype/any_op_ch.h" #include "be_visitor_valuetype/any_op_cs.h" diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_si.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_si.h deleted file mode 100644 index 698c702d03e..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_si.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- c++ -*- */ -//============================================================================= -/** - * @file valuetype_si.h - * - * $Id$ - * - * Concrete visitor for the valuetype node. - * This provides for code generation in the server inline - * - * - * @author Jeff Parsons - */ -//============================================================================= - - -#ifndef _BE_VALUETYPE_VALUETYPE_SI_H_ -#define _BE_VALUETYPE_VALUETYPE_SI_H_ - -/** - * @class be_visitor_valuetype_si - * - * @brief be_visitor_valuetype_si - * - * This is a concrete visitor to generate the server inline for valuetype - */ -class be_visitor_valuetype_si : public be_visitor_valuetype -{ -public: - /// constructor - be_visitor_valuetype_si (be_visitor_context *ctx); - - /// destructor - ~be_visitor_valuetype_si (void); - - virtual int visit_valuetype (be_valuetype *node); - virtual int visit_eventtype (be_eventtype *node); -}; - -#endif /* _BE_VALUETYPE_VALUETYPE_SI_H_ */ diff --git a/TAO/TAO_IDL/fe/idl.ll b/TAO/TAO_IDL/fe/idl.ll index dfe41a3e039..ff88c20ada1 100644 --- a/TAO/TAO_IDL/fe/idl.ll +++ b/TAO/TAO_IDL/fe/idl.ll @@ -846,7 +846,8 @@ idl_store_pragma (char *buf) // Delete tmp since add_ciao_spl_ts_file_names() doesn't take its ownership. delete [] tmp; } - else if (ACE_OS::strncmp (buf + 8, "ciao ami4ccm interface", 22) == 0) + else if ((ACE_OS::strncmp (buf + 8, "ciao ami4ccm interface", 22) == 0) || + (ACE_OS::strncmp (buf + 8, "ami4ccm interface", 17) == 0)) { if (idl_global->in_main_file ()) { @@ -857,7 +858,8 @@ idl_store_pragma (char *buf) delete [] tmp; } } - else if (ACE_OS::strncmp (buf + 8, "ciao ami4ccm receptacle", 23) == 0) + else if ((ACE_OS::strncmp (buf + 8, "ciao ami4ccm receptacle", 23) == 0)|| + (ACE_OS::strncmp (buf + 8, "ami4ccm receptacle", 18) == 0)) { char *tmp = idl_get_pragma_string (buf); @@ -876,7 +878,8 @@ idl_store_pragma (char *buf) // Delete tmp since add_ciao_spl_ts_file_names() doesn't take its ownership. delete [] tmp; } - else if (ACE_OS::strncmp (buf + 8, "ciao ami4ccm idl", 16) == 0) + else if ((ACE_OS::strncmp (buf + 8, "ciao ami4ccm idl", 16) == 0) || + (ACE_OS::strncmp (buf + 8, "ami4ccm idl", 11) == 0)) { char *tmp = idl_get_pragma_string (buf); diff --git a/TAO/TAO_IDL/fe/lex.yy.cpp b/TAO/TAO_IDL/fe/lex.yy.cpp index 1ba2ff65fac..e0242d36959 100644 --- a/TAO/TAO_IDL/fe/lex.yy.cpp +++ b/TAO/TAO_IDL/fe/lex.yy.cpp @@ -3368,7 +3368,8 @@ idl_store_pragma (char *buf) // Delete tmp since add_ciao_spl_ts_file_names() doesn't take its ownership. delete [] tmp; } - else if (ACE_OS::strncmp (buf + 8, "ciao ami4ccm interface", 22) == 0) + else if ((ACE_OS::strncmp (buf + 8, "ciao ami4ccm interface", 22) == 0) || + (ACE_OS::strncmp (buf + 8, "ami4ccm interface", 17) == 0)) { if (idl_global->in_main_file ()) { @@ -3379,7 +3380,8 @@ idl_store_pragma (char *buf) delete [] tmp; } } - else if (ACE_OS::strncmp (buf + 8, "ciao ami4ccm receptacle", 23) == 0) + else if ((ACE_OS::strncmp (buf + 8, "ciao ami4ccm receptacle", 23) == 0) || + (ACE_OS::strncmp (buf + 8, "ami4ccm receptacle", 18) == 0)) { char *tmp = idl_get_pragma_string (buf); @@ -3398,7 +3400,8 @@ idl_store_pragma (char *buf) // Delete tmp since add_ciao_spl_ts_file_names() doesn't take its ownership. delete [] tmp; } - else if (ACE_OS::strncmp (buf + 8, "ciao ami4ccm idl", 16) == 0) + else if ((ACE_OS::strncmp (buf + 8, "ciao ami4ccm idl", 16) == 0) || + (ACE_OS::strncmp (buf + 8, "ami4ccm idl", 11) == 0)) { char *tmp = idl_get_pragma_string (buf); diff --git a/TAO/TAO_IDL/include/idl_global.h b/TAO/TAO_IDL/include/idl_global.h index 0ae8a618e35..435a3275158 100644 --- a/TAO/TAO_IDL/include/idl_global.h +++ b/TAO/TAO_IDL/include/idl_global.h @@ -916,7 +916,8 @@ private: // ...but we need to do it only once. ACE_Unbounded_Queue<char *> ciao_ami_idl_fnames_; - // Stores directives from #pragma ciao ami4ccm idl "xxx". + // Stores directives from #pragma ciao ami4ccm idl "xxx" + // or #pragma ami4ccm idl "xxx". ACE_Unbounded_Queue<char *> dds4ccm_impl_fnames_; // Stores directives from #pragma dds4ccm impl "xxx". diff --git a/TAO/TAO_IDL/util/utl_stack.cpp b/TAO/TAO_IDL/util/utl_stack.cpp index aac41c094af..70c0168fe62 100644 --- a/TAO/TAO_IDL/util/utl_stack.cpp +++ b/TAO/TAO_IDL/util/utl_stack.cpp @@ -129,9 +129,11 @@ UTL_ScopeStack::pop (void) return; } + UTL_Scope *current = this->top (); + // If our top scope has a #pragma prefix associated with it, // it goes away with the scope. - if (this->top_non_null ()->has_prefix ()) + if (current != 0 && current->has_prefix ()) { char *trash = 0; idl_global->pragma_prefixes ().pop (trash); |