diff options
author | msmit <msmit@remedy.nl> | 2011-11-17 10:49:45 +0000 |
---|---|---|
committer | msmit <msmit@remedy.nl> | 2011-11-17 10:49:45 +0000 |
commit | 8589bc528cb2552d180942a35fb58738bfcb5211 (patch) | |
tree | 304e49b0f47e2a723a2487f74558bc172d027ca4 | |
parent | 3b582389421a3dd2de01a3c1a8e498be4beaeb64 (diff) | |
download | ATCD-8589bc528cb2552d180942a35fb58738bfcb5211.tar.gz |
Thu Nov 17 10:46:22 UTC 2011 Marcel Smit <msmit@remedy.nl>
* MPC/config/taobaseidldefaults.mpb:
* TAO_IDL/be/be_codegen.cpp:
* TAO_IDL/be/be_global.cpp:
* TAO_IDL/be/be_produce.cpp:
* TAO_IDL/be/be_visitor_component/component.cpp:
* TAO_IDL/be/be_visitor_component/facet_svh.cpp:
* TAO_IDL/be/be_visitor_component/facet_svs.cpp:
* TAO_IDL/be/be_visitor_component/servant_svs.cpp:
* TAO_IDL/be/be_visitor_module/module.cpp:
* TAO_IDL/be/be_visitor_root.cpp:
* TAO_IDL/be/be_visitor_root/root_svth.cpp:
* TAO_IDL/be/be_visitor_root/root_svts.cpp:
* TAO_IDL/be_include/be_codegen.h:
* TAO_IDL/be_include/be_global.h:
* TAO_IDL/be_include/be_visitor_root.h:
* TAO_IDL/be_include/be_visitor_root/root_svth.h:
* TAO_IDL/be_include/be_visitor_root/root_svts.h:
The IDL compileren doesn't generated the facet servants
in the _svnt.cpp/h files.
The IDL compiler now uses the template facet servant
implementation (which still need to be generated)
in the _svnt.cpp file.
The IDL compiler now creates the _svnt_T.cpp/h files and
initialize them.
-rw-r--r-- | TAO/ChangeLog.BRANCH | 27 | ||||
-rw-r--r-- | TAO/MPC/config/taobaseidldefaults.mpb | 4 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_codegen.cpp | 165 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_global.cpp | 65 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_produce.cpp | 8 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_component/component.cpp | 2 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_component/facet_svh.cpp | 18 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_component/facet_svs.cpp | 18 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_component/servant_svs.cpp | 16 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_module/module.cpp | 4 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_root.cpp | 2 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_root/root_svth.cpp | 73 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_root/root_svts.cpp | 73 | ||||
-rw-r--r-- | TAO/TAO_IDL/be_include/be_codegen.h | 18 | ||||
-rw-r--r-- | TAO/TAO_IDL/be_include/be_global.h | 26 | ||||
-rw-r--r-- | TAO/TAO_IDL/be_include/be_visitor_root.h | 2 | ||||
-rw-r--r-- | TAO/TAO_IDL/be_include/be_visitor_root/root_svth.h | 43 | ||||
-rw-r--r-- | TAO/TAO_IDL/be_include/be_visitor_root/root_svts.h | 43 |
18 files changed, 580 insertions, 27 deletions
diff --git a/TAO/ChangeLog.BRANCH b/TAO/ChangeLog.BRANCH index 0e0e6e9c1d3..e94dde7fe5f 100644 --- a/TAO/ChangeLog.BRANCH +++ b/TAO/ChangeLog.BRANCH @@ -1,3 +1,30 @@ +Thu Nov 17 10:46:22 UTC 2011 Marcel Smit <msmit@remedy.nl> + + * MPC/config/taobaseidldefaults.mpb: + * TAO_IDL/be/be_codegen.cpp: + * TAO_IDL/be/be_global.cpp: + * TAO_IDL/be/be_produce.cpp: + * TAO_IDL/be/be_visitor_component/component.cpp: + * TAO_IDL/be/be_visitor_component/facet_svh.cpp: + * TAO_IDL/be/be_visitor_component/facet_svs.cpp: + * TAO_IDL/be/be_visitor_component/servant_svs.cpp: + * TAO_IDL/be/be_visitor_module/module.cpp: + * TAO_IDL/be/be_visitor_root.cpp: + * TAO_IDL/be/be_visitor_root/root_svth.cpp: + * TAO_IDL/be/be_visitor_root/root_svts.cpp: + * TAO_IDL/be_include/be_codegen.h: + * TAO_IDL/be_include/be_global.h: + * TAO_IDL/be_include/be_visitor_root.h: + * TAO_IDL/be_include/be_visitor_root/root_svth.h: + * TAO_IDL/be_include/be_visitor_root/root_svts.h: + The IDL compileren doesn't generated the facet servants + in the _svnt.cpp/h files. + The IDL compiler now uses the template facet servant + implementation (which still need to be generated) + in the _svnt.cpp file. + The IDL compiler now creates the _svnt_T.cpp/h files and + initialize them. + Local Variables: mode: change-log diff --git a/TAO/MPC/config/taobaseidldefaults.mpb b/TAO/MPC/config/taobaseidldefaults.mpb index 510dcce15a0..c9bdfd4cc69 100644 --- a/TAO/MPC/config/taobaseidldefaults.mpb +++ b/TAO/MPC/config/taobaseidldefaults.mpb @@ -59,11 +59,11 @@ project: build_files { } optional(source_pre_extension) { - commandflags(-Gsv) += _svnt + commandflags(-Gsv) += _svnt, _svnt_T } optional(header_pre_extension) { - commandflags(-Gsv) += _svnt + commandflags(-Gsv) += _svnt, _svnt_T } optional(source_pre_extension) { diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp index 24d45909e88..3274a8aef53 100644 --- a/TAO/TAO_IDL/be/be_codegen.cpp +++ b/TAO/TAO_IDL/be/be_codegen.cpp @@ -49,6 +49,8 @@ TAO_CodeGen::TAO_CodeGen (void) 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), @@ -1154,6 +1156,133 @@ 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 (); + + return 0; +} + +int +TAO_CodeGen::start_ciao_svnt_template_header (const char *fname) +{ + // Clean up between multiple files. + delete this->ciao_svnt_header_; + + ACE_NEW_RETURN (this->ciao_svnt_header_, + TAO_OutStream, + -1); + + int status = + this->ciao_svnt_header_->open (fname, + TAO_OutStream::CIAO_SVNT_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_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_header_); + + // Generate the #ifndef clause. + this->gen_ifndef_string (fname, + this->ciao_svnt_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 (); + + return 0; +} + +int +TAO_CodeGen::start_ciao_svnt_template_source (const char *fname) +{ + // Clean up between multiple files. + delete this->ciao_svnt_source_; + + ACE_NEW_RETURN (this->ciao_svnt_source_, + TAO_OutStream, + -1); + + int status = + this->ciao_svnt_source_->open (fname, + TAO_OutStream::CIAO_SVNT_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_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_source_); + + // Generate the include statement for the server header. + *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 (); @@ -1172,6 +1301,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) { @@ -1868,6 +2010,29 @@ TAO_CodeGen::end_ciao_svnt_source (void) } int +TAO_CodeGen::end_ciao_svnt_template_header (void) +{ + if (be_global->post_include () != 0) + { + *this->ciao_svnt_header_ << "\n\n#include /**/ \"" + << be_global->post_include () + << "\""; + } + + *this->ciao_svnt_header_ << "\n\n#endif /* ifndef */\n"; + + return 0; +} + +int +TAO_CodeGen::end_ciao_svnt_template_source (void) +{ + *this->ciao_svnt_source_ << "\n"; + + return 0; +} + +int TAO_CodeGen::end_ciao_exec_header (void) { if (be_global->post_include () != 0) diff --git a/TAO/TAO_IDL/be/be_global.cpp b/TAO/TAO_IDL/be/be_global.cpp index 370eb6e2b18..8d7e6e786d3 100644 --- a/TAO/TAO_IDL/be/be_global.cpp +++ b/TAO/TAO_IDL/be/be_global.cpp @@ -75,6 +75,8 @@ BE_GlobalData::BE_GlobalData (void) 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")), @@ -431,6 +433,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) { @@ -440,6 +452,15 @@ 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) { @@ -674,6 +695,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) { @@ -683,6 +713,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) { @@ -1352,6 +1391,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_); diff --git a/TAO/TAO_IDL/be/be_produce.cpp b/TAO/TAO_IDL/be/be_produce.cpp index 75d88932c39..004cd5f965e 100644 --- a/TAO/TAO_IDL/be/be_produce.cpp +++ b/TAO/TAO_IDL/be/be_produce.cpp @@ -229,6 +229,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 ()) diff --git a/TAO/TAO_IDL/be/be_visitor_component/component.cpp b/TAO/TAO_IDL/be/be_visitor_component/component.cpp index 204ff9b79ad..dd9b629b121 100644 --- a/TAO/TAO_IDL/be/be_visitor_component/component.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component/component.cpp @@ -281,6 +281,8 @@ be_visitor_component::visit_typedef (be_typedef *node) 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/facet_svh.cpp b/TAO/TAO_IDL/be/be_visitor_component/facet_svh.cpp index 4f279b95e07..afc41ee5c41 100644 --- a/TAO/TAO_IDL/be/be_visitor_component/facet_svh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component/facet_svh.cpp @@ -25,15 +25,15 @@ be_visitor_facet_svh::~be_visitor_facet_svh (void) int be_visitor_facet_svh::visit_provides (be_provides *node) { - if (node->gen_facet_svnt_decl (os_) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("be_visitor_facet_svh") - ACE_TEXT ("::visit_provides - ") - ACE_TEXT ("gen_facet_svnt_decl() ") - ACE_TEXT ("failed\n")), - -1); - } +// if (node->gen_facet_svnt_decl (os_) == -1) +// { +// ACE_ERROR_RETURN ((LM_ERROR, +// ACE_TEXT ("be_visitor_facet_svh") +// ACE_TEXT ("::visit_provides - ") +// ACE_TEXT ("gen_facet_svnt_decl() ") +// ACE_TEXT ("failed\n")), +// -1); +// } return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_component/facet_svs.cpp b/TAO/TAO_IDL/be/be_visitor_component/facet_svs.cpp index c9127923226..126b733d38d 100644 --- a/TAO/TAO_IDL/be/be_visitor_component/facet_svs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component/facet_svs.cpp @@ -25,15 +25,15 @@ be_visitor_facet_svs::~be_visitor_facet_svs (void) int be_visitor_facet_svs::visit_provides (be_provides *node) { - if (node->gen_facet_svnt_defn (os_) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("be_visitor_facet_svs") - ACE_TEXT ("::visit_provides - ") - ACE_TEXT ("gen_facet_svnt_defn() ") - ACE_TEXT ("failed\n")), - -1); - } +// if (node->gen_facet_svnt_defn (os_) == -1) +// { +// ACE_ERROR_RETURN ((LM_ERROR, +// ACE_TEXT ("be_visitor_facet_svs") +// ACE_TEXT ("::visit_provides - ") +// ACE_TEXT ("gen_facet_svnt_defn() ") +// ACE_TEXT ("failed\n")), +// -1); +// } return 0; } 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 5778857cf35..52fa4ee453d 100644 --- a/TAO/TAO_IDL/be/be_visitor_component/servant_svs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component/servant_svs.cpp @@ -308,15 +308,17 @@ 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 - << global << sname << "::CCM_" << lname << "_var tmp_var = "<< global << sname <<"::CCM_" << lname - << "::_narrow (tmp.in());" << be_nl - << "::CIAO_FACET" << prefix_connector - << scope->flat_name () << "::" << lname - << "_Servant *" << port_name << "_servant_impl = 0;" << 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 () << global << lname << "_Servant_T <" << be_idt_nl << "POA_" << sname << global << lname + << "," << be_nl << global << sname <<"::CCM_" << lname << ">" << 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 - << "::CIAO_FACET" << prefix_connector - << scope->flat_name () << "::" << lname << "_Servant (" << be_idt_nl + << lname << "_type (" << be_idt_nl << "tmp_var.in(), " << be_nl << "this->context_)," << be_uidt_nl << "CORBA::NO_MEMORY ());" << be_uidt_nl << be_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..273211f4ad2 100644 --- a/TAO/TAO_IDL/be/be_visitor_module/module.cpp +++ b/TAO/TAO_IDL/be/be_visitor_module/module.cpp @@ -353,6 +353,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; @@ -678,6 +680,8 @@ be_visitor_module::visit_component (be_component *node) case TAO_CodeGen::TAO_ROOT_IS: case TAO_CodeGen::TAO_ROOT_CNH: case TAO_CodeGen::TAO_ROOT_CNS: + case TAO_CodeGen::TAO_ROOT_SVTH: + case TAO_CodeGen::TAO_ROOT_SVTS: break; case TAO_CodeGen::TAO_ROOT_SVH: { diff --git a/TAO/TAO_IDL/be/be_visitor_root.cpp b/TAO/TAO_IDL/be/be_visitor_root.cpp index 92456f48d4a..df9e3319e01 100644 --- a/TAO/TAO_IDL/be/be_visitor_root.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root.cpp @@ -74,6 +74,8 @@ #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_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_include/be_codegen.h b/TAO/TAO_IDL/be_include/be_codegen.h index b0611b2bb8a..8a956d0aebe 100644 --- a/TAO/TAO_IDL/be_include/be_codegen.h +++ b/TAO/TAO_IDL/be_include/be_codegen.h @@ -127,6 +127,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, @@ -243,6 +245,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); @@ -289,6 +293,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); @@ -341,6 +347,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); @@ -481,6 +493,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 59e544b0f13..eda452d4620 100644 --- a/TAO/TAO_IDL/be_include/be_global.h +++ b/TAO/TAO_IDL/be_include/be_global.h @@ -111,9 +111,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); @@ -196,10 +202,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); @@ -501,6 +515,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; @@ -990,6 +1010,12 @@ private: /// 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_; diff --git a/TAO/TAO_IDL/be_include/be_visitor_root.h b/TAO/TAO_IDL/be_include/be_visitor_root.h index 7cd109881cb..476bfe8754e 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_root.h +++ b/TAO/TAO_IDL/be_include/be_visitor_root.h @@ -31,6 +31,8 @@ #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_svth.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_svth.h new file mode 100644 index 00000000000..8565fd86c7b --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_svth.h @@ -0,0 +1,43 @@ +/* -*- c++ -*- */ + +//============================================================================= +/** + * @file root_svht.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_ */ |