diff options
author | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-06-15 21:32:11 +0000 |
---|---|---|
committer | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-06-15 21:32:11 +0000 |
commit | af65e6b8f7a2003d4259e5cbcec19c120088e799 (patch) | |
tree | dfbd048672db99b2f6339960fd0fc86c265e6c95 | |
parent | 6cae9bd84006f8d6d21a07975febad03a8dac388 (diff) | |
download | ATCD-af65e6b8f7a2003d4259e5cbcec19c120088e799.tar.gz |
Tue Jun 15 16:16:48 1999 Nanbor Wang <nanbor@cs.wustl.edu>
-rw-r--r-- | TAO/TAO_IDL/be/be_codegen.cpp | 2 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp | 29 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp | 3 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp | 12 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_operation/collocated_ss.cpp | 48 | ||||
-rw-r--r-- | TAO/TAO_IDL/be_include/be_visitor_operation/collocated_ss.h | 8 | ||||
-rw-r--r-- | TAO/tao/Servant_Base.cpp | 4 | ||||
-rw-r--r-- | TAO/tao/Servant_Base.h | 3 |
8 files changed, 74 insertions, 35 deletions
diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp index 150a685f105..26d1765a64b 100644 --- a/TAO/TAO_IDL/be/be_codegen.cpp +++ b/TAO/TAO_IDL/be/be_codegen.cpp @@ -278,7 +278,7 @@ TAO_CodeGen::start_client_stubs (const char *fname) *this->client_stubs_ << "#include \"" << idl_global->be_get_client_hdr_fname (1) << "\"\n\n"; -#if 1 // Nanbor's collocation change +#if 0 // Nanbor's collocation change *this->client_stubs_ << "#include \"" << idl_global->be_get_server_hdr_fname (1) << "\"\n\n"; #endif /* Nanbor */ 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 4120dc25f28..a3e5db92568 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp @@ -92,24 +92,25 @@ be_visitor_interface_cs::visit_interface (be_interface *node) *os << "if (obj->_is_collocated () " << "&& obj->_servant() != 0)" << be_idt_nl << "servant = obj->_servant()->_downcast (\"" - << node->repoID () << "\");" << be_uidt_nl; + << "IDL:omg.org/CORBA/Object:1.0\");" << be_uidt_nl; *os << "if (servant != 0)" << be_idt_nl << "{" << be_idt_nl // The collocated object reference factory is not working right (yet) - << "// PortableServer::Servant iservant = ACE_reinterpret_cast(" - << skel_name << "_ptr, servant);" << be_nl - << "// " << node->name () << "_ptr retv = ACE_reinterpret_cast (" << be_idt << be_idt_nl - << "// " << node->name () << "_ptr," << be_nl - << "// iservant->_create_collocated_objref (TAO_ORB_Core::ORB_CONTROL, stub)" << be_uidt_nl - << "// );" << be_uidt_nl - << "// if (retv != 0)" << be_idt_nl - << "// return retv;" << be_uidt_nl - // So we are still using the old way to create collocated objref. - << "return new " << coll_name << "(" << be_idt << be_idt_nl - << "ACE_reinterpret_cast(" << skel_name - << "_ptr, servant)," << be_nl + << node->name () << "_ptr retv = ACE_reinterpret_cast (" << be_idt << be_idt_nl + << node->name () << "_ptr," << be_nl + << "ACE_reinterpret_cast (" << be_idt << be_idt_nl + << "PortableServer::Servant," << be_nl + << "servant" << be_uidt_nl + << ")" << be_uidt_nl + << "->_create_collocated_objref (" << be_idt << be_idt_nl + << "\"" << node->repoID () << "\"," << be_nl + << "TAO_ORB_Core::ORB_CONTROL," << be_nl << "stub" << be_uidt_nl - << ");" << be_uidt + << ")" << be_uidt << be_uidt_nl + << ");" << be_uidt_nl + << "if (retv != 0)" << be_idt_nl + << "return retv;" << be_uidt + // So we are still using the old way to create collocated objref. << be_uidt_nl << "}" << be_uidt_nl; diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp index 2ff854f92e6..c6e2dcdd647 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp @@ -161,7 +161,8 @@ be_visitor_interface_sh::visit_interface (be_interface *node) // the _create_collocated_objref method. *os << "virtual void* _create_collocated_objref" - << "(CORBA::ULong type, TAO_Stub *sobj);" << be_nl << be_nl; + << "(const char*, CORBA::ULong type, TAO_Stub *sobj);" + << be_nl << be_nl; // generate code for elements in the scope (e.g., operations). if (this->visit_scope (node) == -1) 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 83627e64086..7ab84eeda93 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp @@ -290,10 +290,16 @@ be_visitor_interface_ss::visit_interface (be_interface *node) // the _create_collocated_objref method *os << "void*" << be_nl << node->full_skel_name () - << "::_create_collocated_objref (CORBA::ULong type, TAO_Stub *stub)" << be_nl + << "::_create_collocated_objref (const char* repository_id, " + << "CORBA::ULong type, TAO_Stub *stub)" << be_nl << "{" << be_idt_nl - << "return new " << node->full_coll_name () - << " (this, stub);" << be_uidt_nl + << "if (!ACE_OS::strcmp (\"" << node->repoID () + << "\", repository_id))" << be_idt_nl + << "return ACE_reinterpret_cast (" << be_idt << be_idt_nl + << node->name () << "_ptr," << be_nl + << "new " << node->full_coll_name () << " (this, stub)" << be_uidt_nl + << ");" << be_uidt << be_uidt_nl + << "return 0;" << be_uidt_nl << "}" << be_nl << be_nl; // generate the collocated class impl diff --git a/TAO/TAO_IDL/be/be_visitor_operation/collocated_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/collocated_ss.cpp index 8b558980192..c1fb75c62c1 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/collocated_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/collocated_ss.cpp @@ -150,6 +150,25 @@ int be_visitor_operation_collocated_ss::visit_operation (be_operation *node) -1); } + if (!this->void_return_type (bt)) + { + os->indent (); + *os << "ACE_UNUSED_ARG ("; + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_RETURN_CS); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (bt->accept (visitor) == -1)) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_collocated_cs::" + "gen_check_exception - " + "codegen failed\n"), + -1); + } + *os << ");\n"; + } + os->indent (); *os <<"TAO_Object_Adapter::Servant_Upcall servant_upcall (" << be_idt << be_idt_nl @@ -175,9 +194,7 @@ int be_visitor_operation_collocated_ss::visit_operation (be_operation *node) os->indent (); - if (bt->node_type () != AST_Decl::NT_pre_defined - || be_predefined_type::narrow_from_decl (bt)->pt () - != AST_PredefinedType::PT_void) + if (!this->void_return_type (bt)) { *os << "return "; } @@ -192,9 +209,7 @@ int be_visitor_operation_collocated_ss::visit_operation (be_operation *node) if (this->gen_invoke (ctx, node) == -1) return -1; - if (bt->node_type () == AST_Decl::NT_pre_defined - && be_predefined_type::narrow_from_decl (bt)->pt () - == AST_PredefinedType::PT_void) + if (this->void_return_type (bt)) { os->indent (); *os << "return;"; @@ -203,9 +218,7 @@ int be_visitor_operation_collocated_ss::visit_operation (be_operation *node) *os << be_uidt_nl << "}" << be_uidt_nl; - if (bt->node_type () != AST_Decl::NT_pre_defined - || be_predefined_type::narrow_from_decl (bt)->pt () - != AST_PredefinedType::PT_void) + if (!this->void_return_type (bt)) { *os << "return "; } @@ -256,9 +269,7 @@ be_visitor_operation_collocated_ss::gen_check_exception (be_type *bt) os->indent (); // check if there is an exception - if (bt->node_type () != AST_Decl::NT_pre_defined - || be_predefined_type::narrow_from_decl (bt)->pt () - != AST_PredefinedType::PT_void) + if (!this->void_return_type (bt)) { *os << "ACE_CHECK_RETURN ("; // << "_tao_environment, "; @@ -286,3 +297,16 @@ be_visitor_operation_collocated_ss::gen_check_exception (be_type *bt) return 0; } + +int +be_visitor_operation_collocated_ss::void_return_type (be_type *bt) +{ + // is the operation return type void? + + if (bt->node_type () == AST_Decl::NT_pre_defined + && (be_predefined_type::narrow_from_decl (bt)->pt () + == AST_PredefinedType::PT_void)) + return 1; + else + return 0; +} diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/collocated_ss.h b/TAO/TAO_IDL/be_include/be_visitor_operation/collocated_ss.h index f817d87c833..c1d9720ffe1 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/collocated_ss.h +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/collocated_ss.h @@ -47,10 +47,14 @@ public: virtual int visit_operation (be_operation *node); // visit operation node. - int gen_invoke (be_visitor_context &ctx, be_operation *node); + virtual int gen_invoke (be_visitor_context &ctx, be_operation *node); // A helper method to generate operation invocation code. - int gen_check_exception (be_type *bt); + virtual int gen_check_exception (be_type *bt); + // ACE_CHECK macros generator. + + virtual int void_return_type (be_type *bt); + // is my return type void? }; #endif /* _BE_VISITOR_OPERATION_COLLOCATED_SS_H_ */ diff --git a/TAO/tao/Servant_Base.cpp b/TAO/tao/Servant_Base.cpp index b0d517b0d7f..145dac6e608 100644 --- a/TAO/tao/Servant_Base.cpp +++ b/TAO/tao/Servant_Base.cpp @@ -189,7 +189,9 @@ TAO_ServantBase::_decrement_single_threaded_poa_lock_count (void) } void * -TAO_ServantBase::_create_collocated_objref (CORBA::ULong, TAO_Stub *) +TAO_ServantBase::_create_collocated_objref (const char *, + CORBA::ULong, + TAO_Stub *) { return 0; } diff --git a/TAO/tao/Servant_Base.h b/TAO/tao/Servant_Base.h index a97f59868ab..b40fc0e691a 100644 --- a/TAO/tao/Servant_Base.h +++ b/TAO/tao/Servant_Base.h @@ -59,7 +59,8 @@ public: virtual TAO_Stub *_create_stub (CORBA_Environment &ACE_TRY_ENV = TAO_default_environment ()); // This is an auxiliar method for _this() and _narrow(). - virtual void * _create_collocated_objref (CORBA::ULong type, + virtual void * _create_collocated_objref (const char *repository_id, + CORBA::ULong type, TAO_Stub *stub); // Collocated object factory. |