From e46d2b5dc6575abc8f0c0aef92c138bdc5dcac13 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Thu, 21 Feb 2008 19:28:03 +0000 Subject: Thu Feb 21 19:25:12 UTC 2008 Johnny Willemsen --- TAO/TAO_IDL/be/be_interface.cpp | 28 +-- .../be/be_visitor_component/component_ch.cpp | 32 ++-- .../be/be_visitor_component/component_cs.cpp | 106 +++++++----- TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp | 19 ++- TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp | 21 ++- .../be/be_visitor_interface/interface_ch.cpp | 18 +- .../be/be_visitor_interface/interface_ci.cpp | 11 +- .../be/be_visitor_interface/interface_cs.cpp | 67 +++++--- .../be/be_visitor_interface/interface_ss.cpp | 187 ++++++++++++--------- TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp | 30 +++- TAO/TAO_IDL/be/be_visitor_operation/operation.cpp | 27 ++- TAO/TAO_IDL/be/be_visitor_root/root.cpp | 21 ++- TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp | 7 +- 13 files changed, 358 insertions(+), 216 deletions(-) (limited to 'TAO/TAO_IDL/be') diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp index d3613e446eb..628305ae9e5 100644 --- a/TAO/TAO_IDL/be/be_interface.cpp +++ b/TAO/TAO_IDL/be/be_interface.cpp @@ -571,12 +571,11 @@ be_interface::gen_stub_ctor (TAO_OutStream *os) << ")" << be_uidt; } - int status = + int const status = this->traverse_inheritance_graph ( be_interface::gen_abstract_init_helper, os, - true - ); + true); if (status == -1) { @@ -601,13 +600,20 @@ be_interface::gen_stub_ctor (TAO_OutStream *os) *os << "::CORBA::Object (objref, _tao_collocated, servant, oc)"; } - *os << "," << be_nl - << "the"<< this->base_proxy_broker_name () << "_ (0)" - << be_uidt << be_uidt; + if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) + { + *os << "," << be_nl + << "the"<< this->base_proxy_broker_name () << "_ (0)" + << be_uidt << be_uidt; + } + + *os << be_nl << "{" << be_idt_nl; - *os << be_nl << "{" << be_idt_nl - << "this->" << this->flat_name () - << "_setup_collocation ();"; + if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) + { + *os << "this->" << this->flat_name () + << "_setup_collocation ();"; + } if (this->is_abstract ()) { @@ -1859,7 +1865,7 @@ be_interface::gen_gperf_lookup_methods (const char *flat_name) if (result != -1) { result = process.spawn (process_options); - + // Spawn a process for gperf. if (result == -1) { @@ -1873,7 +1879,7 @@ be_interface::gen_gperf_lookup_methods (const char *flat_name) { ACE_exitcode exitcode; result = process.wait (&exitcode); - + if (result == -1) { ACE_ERROR ((LM_ERROR, diff --git a/TAO/TAO_IDL/be/be_visitor_component/component_ch.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_ch.cpp index a6a4348bf1d..39a243711f9 100644 --- a/TAO/TAO_IDL/be/be_visitor_component/component_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component/component_ch.cpp @@ -173,12 +173,15 @@ be_visitor_component_ch::visit_component (be_component *node) // The virtual marshal method, to prevent marshal of local iterfaces. *os << be_nl << "virtual ::CORBA::Boolean marshal (TAO_OutputCDR &cdr);"; - // Add the Proxy Broker member variable. - *os << be_uidt_nl << be_nl - << "private:" << be_idt_nl - << "TAO::Collocation_Proxy_Broker *" - << "the" << node->base_proxy_broker_name () - << "_;"; + if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) + { + // Add the Proxy Broker member variable. + *os << be_uidt_nl << be_nl + << "private:" << be_idt_nl + << "TAO::Collocation_Proxy_Broker *" + << "the" << node->base_proxy_broker_name () + << "_;"; + } *os << be_uidt_nl << be_nl << "protected:" << be_idt; @@ -189,13 +192,16 @@ be_visitor_component_ch::visit_component (be_component *node) *os << be_nl << node->local_name () << " (void);"; - *os << be_nl << be_nl - << "// These methods travese the inheritance tree and set the" - << be_nl - << "// parents piece of the given class in the right mode." - << be_nl - << "virtual void " << node->flat_name () - << "_setup_collocation (void);"; + if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) + { + *os << be_nl << be_nl + << "// These methods travese the inheritance tree and set the" + << be_nl + << "// parents piece of the given class in the right mode." + << be_nl + << "virtual void " << node->flat_name () + << "_setup_collocation (void);"; + } *os << be_nl << be_nl << node->local_name () << " (" << be_idt << be_idt_nl diff --git a/TAO/TAO_IDL/be/be_visitor_component/component_cs.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_cs.cpp index 2cf6a970b62..d6cd9ec762b 100644 --- a/TAO/TAO_IDL/be/be_visitor_component/component_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component/component_cs.cpp @@ -128,17 +128,20 @@ be_visitor_component_cs::visit_component (be_component *node) << "}"; } - // Generate the proxy broker factory function pointer definition. - *os << be_nl << be_nl - << "// Function pointer for collocation factory initialization." - << be_nl - << "TAO::Collocation_Proxy_Broker * " << be_nl - << "(*" << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function_pointer) (" - << be_idt << be_idt_nl - << "::CORBA::Object_ptr obj" << be_uidt_nl - << ") = 0;" << be_uidt; + if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) + { + // Generate the proxy broker factory function pointer definition. + *os << be_nl << be_nl + << "// Function pointer for collocation factory initialization." + << be_nl + << "TAO::Collocation_Proxy_Broker * " << be_nl + << "(*" << node->flat_client_enclosing_scope () + << node->base_proxy_broker_name () + << "_Factory_function_pointer) (" + << be_idt << be_idt_nl + << "::CORBA::Object_ptr obj" << be_uidt_nl + << ") = 0;" << be_uidt; + } // Generate the destructor and default constructor. *os << be_nl << be_nl @@ -148,36 +151,44 @@ be_visitor_component_cs::visit_component (be_component *node) *os << node->name () << "::" << node->local_name () << " (void)" << be_nl - << "{" << be_idt_nl - << "this->" << node->flat_name () - << "_setup_collocation ();" << be_uidt_nl - << be_uidt << "}" << be_nl << be_nl; - - // Collocation setup method. - *os << "void" << be_nl - << node->name () << "::" << node->flat_name () - << "_setup_collocation (void)" << be_nl - << "{" << be_idt_nl - << "if ("<< "::" << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function_pointer)" << be_idt_nl - << "this->the" << node->base_proxy_broker_name () - << "_ =" << be_idt_nl - << "::" << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function_pointer (this);" - << be_uidt << be_uidt_nl; - - AST_Component *base = node->base_component (); - - if (base != 0) + << "{" << be_idt_nl; + + if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) { - *os << be_nl - << "this->" << base->flat_name () - << "_setup_collocation" << " ();"; + *os << "this->" << node->flat_name () + << "_setup_collocation ();" << be_uidt_nl; } - *os << be_uidt_nl << "}" << be_nl << be_nl; + *os << be_uidt << "}" << be_nl << be_nl; + + if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) + { + // Collocation setup method. + *os << "void" << be_nl + << node->name () << "::" << node->flat_name () + << "_setup_collocation (void)" << be_nl + << "{" << be_idt_nl + << "if ("<< "::" << node->flat_client_enclosing_scope () + << node->base_proxy_broker_name () + << "_Factory_function_pointer)" << be_idt_nl + << "this->the" << node->base_proxy_broker_name () + << "_ =" << be_idt_nl + << "::" << node->flat_client_enclosing_scope () + << node->base_proxy_broker_name () + << "_Factory_function_pointer (this);" + << be_uidt << be_uidt_nl; + + AST_Component *base = node->base_component (); + + if (base != 0) + { + *os << be_nl + << "this->" << base->flat_name () + << "_setup_collocation" << " ();"; + } + + *os << be_uidt_nl << "}" << be_nl << be_nl; + } if (be_global->any_support ()) { @@ -212,11 +223,20 @@ be_visitor_component_cs::visit_component (be_component *node) *os << be_idt << be_idt_nl << "_tao_objref," << be_nl - << "\"" << node->repoID () << "\"," << be_nl - << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function_pointer" << be_uidt_nl - << ");" << be_uidt << be_uidt << be_uidt_nl + << "\"" << node->repoID () << "\"," << be_nl; + + if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) + { + *os << node->flat_client_enclosing_scope () + << node->base_proxy_broker_name () + << "_Factory_function_pointer" << be_uidt_nl; + } + else + { + *os << "0" << be_uidt_nl; + } + + *os << ");" << be_uidt << be_uidt << be_uidt_nl << "}" << be_nl << be_nl; // The _duplicate method 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 03c6a69d249..e1ded375507 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp @@ -102,11 +102,20 @@ be_visitor_amh_interface_ss::this_method (be_interface *node) *os << "TAO::AbstractBase_Narrow_Utils::unchecked_narrow ("; } *os << be_idt << be_idt_nl - << "obj.in ()," << be_nl - << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function_pointer" << be_uidt_nl - << ");" << be_uidt << be_uidt << be_uidt_nl + << "obj.in ()," << be_nl; + + if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) + { + *os << node->flat_client_enclosing_scope () + << node->base_proxy_broker_name () + << "_Factory_function_pointer" << be_uidt_nl; + } + else + { + *os << "0" << be_uidt_nl; + } + + *os << ");" << be_uidt << be_uidt << be_uidt_nl << "}"; } diff --git a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp index 944997fa5b8..31114b2a9db 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp @@ -133,11 +133,20 @@ be_visitor_interface_cdr_op_cs::visit_interface (be_interface *node) } *os << be_idt << be_idt_nl - << "obj.in ()," << be_nl - << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function_pointer" << be_uidt_nl - << ");" << be_uidt_nl << be_uidt_nl; + << "obj.in ()," << be_nl; + + if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) + { + *os << node->flat_client_enclosing_scope () + << node->base_proxy_broker_name () + << "_Factory_function_pointer" << be_uidt_nl; + } + else + { + *os << "0" << be_uidt_nl; + } + + *os << ");" << be_uidt_nl << be_uidt_nl; *os << "return true;" << be_uidt_nl << "}" << be_nl; @@ -145,7 +154,7 @@ be_visitor_interface_cdr_op_cs::visit_interface (be_interface *node) if (be_global->gen_ostream_operators ()) { *os << be_nl; - + node->gen_ostream_operator (os); } 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 83f754ef7eb..4a6ce723215 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp @@ -246,7 +246,8 @@ be_visitor_interface_ch::visit_interface (be_interface *node) << "virtual std::ostream &_tao_stream_v (std::ostream &) const;"; } - if (! node->is_local ()) + if (! node->is_local () && + (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ())) { // Add the Proxy Broker member variable. *os << be_uidt_nl @@ -271,12 +272,15 @@ be_visitor_interface_ch::visit_interface (be_interface *node) << be_nl << be_nl; } - *os << "// These methods travese the inheritance tree and set the" - << be_nl - << "// parents piece of the given class in the right mode." - << be_nl - << "virtual void " << node->flat_name () - << "_setup_collocation (void);" << be_nl << be_nl; + if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) + { + *os << "// These methods travese the inheritance tree and set the" + << be_nl + << "// parents piece of the given class in the right mode." + << be_nl + << "virtual void " << node->flat_name () + << "_setup_collocation (void);" << be_nl << be_nl; + } } if (node->is_abstract () || node->is_local ()) 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 5f81239c45a..0bb7a72b289 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp @@ -99,9 +99,14 @@ be_visitor_interface_ci::visit_interface (be_interface *node) << "IOP::IOR *ior," << be_nl << "TAO_ORB_Core *oc" << be_uidt_nl << ")" << be_nl; - *os << ": ::CORBA::Object (ior, oc)," << be_idt_nl - << "the"<< node->base_proxy_broker_name () << "_ (0)" - << be_uidt << be_uidt_nl + *os << ": ::CORBA::Object (ior, oc)" << be_idt_nl; + + if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) + { + *os << ", the"<< node->base_proxy_broker_name () << "_ (0)"; + } + + *os << be_uidt << 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 f7a3ede0f40..9d777b639d0 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp @@ -147,7 +147,8 @@ be_visitor_interface_cs::visit_interface (be_interface *node) << "}"; } - if (!node->is_local ()) + if (!node->is_local () && + (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ())) { // Generate the proxy broker factory function pointer definition. *os << be_nl << be_nl @@ -184,15 +185,25 @@ be_visitor_interface_cs::visit_interface (be_interface *node) { *os << be_nl << be_nl << node->name () << "::" << node->local_name () - << " (void)" << be_nl - << " : the" << node->base_proxy_broker_name () << "_ (0)" << be_nl - << "{" << be_idt_nl - << "this->" << node->flat_name () - << "_setup_collocation ();" << be_uidt_nl - << be_uidt << "}"; + << " (void)" << be_nl; + + if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) + { + *os << " : the" << node->base_proxy_broker_name () << "_ (0)" << be_nl; + } + + *os << "{" << be_idt_nl; + + if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) + { + *os << "this->" << node->flat_name () + << "_setup_collocation ();" << be_uidt_nl; + } + *os << be_uidt << "}"; } - if (! node->is_local ()) + if (! node->is_local () && + (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ())) { *os << be_nl << be_nl << "void" << be_nl @@ -241,7 +252,7 @@ be_visitor_interface_cs::visit_interface (be_interface *node) // Now we setup the immediate parents. long n_parents = node->n_inherits (); - int has_parent = 0; + bool has_parent = false; if (n_parents > 0) { @@ -255,7 +266,7 @@ be_visitor_interface_cs::visit_interface (be_interface *node) *os << be_nl; } - has_parent = 1; + has_parent = true; *os << be_nl << "this->" << inherited->flat_name () @@ -541,11 +552,19 @@ be_visitor_interface_cs::gen_xxx_narrow (const char *pre, *os << be_idt << be_idt_nl << "_tao_objref," << be_nl - << "\"" << node->repoID () << "\"," << be_nl - << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function_pointer" << be_uidt_nl - << ");" << be_uidt << be_nl + << "\"" << node->repoID () << "\"," << be_nl; + + if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) + { + *os << node->flat_client_enclosing_scope () + << node->base_proxy_broker_name () + << "_Factory_function_pointer" << be_uidt_nl; + } + else + { + *os << "0" << be_uidt_nl; + } + *os << ");" << be_uidt << be_nl << "return TAO_" << node->flat_name () << "_PROXY_FACTORY_ADAPTER::instance ()->create_proxy (proxy);" << be_uidt << be_uidt_nl @@ -568,11 +587,19 @@ be_visitor_interface_cs::gen_xxx_narrow (const char *pre, *os << be_idt << be_idt_nl << "_tao_objref," << be_nl - << "\"" << node->repoID () << "\"," << be_nl - << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function_pointer" << be_uidt_nl - << ");" << be_uidt << be_uidt << be_uidt_nl + << "\"" << node->repoID () << "\"," << be_nl; + + if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) + { + *os << node->flat_client_enclosing_scope () + << node->base_proxy_broker_name () + << "_Factory_function_pointer" << be_uidt_nl; + } + else + { + *os << "0" << be_uidt_nl; + } + *os << ");" << be_uidt << be_uidt << be_uidt_nl << "}" << be_nl << be_nl; } 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 328c13dcf58..7595e6cc36d 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp @@ -863,13 +863,28 @@ be_visitor_interface_ss::this_method (be_interface *node) /* Coverity whines about an unused return value from _nil() when initializing tmp. Just use zero instead. */ *os << "::CORBA::Object_ptr tmp = CORBA::Object_ptr ();" - << be_nl << be_nl - << "::CORBA::Boolean const _tao_opt_colloc =" << be_idt_nl - << "stub->servant_orb_var ()->orb_core ()->" - << "optimize_collocation_objects ();" << be_uidt_nl << be_nl - << "ACE_NEW_RETURN (" << be_idt << be_idt_nl + << be_nl << be_nl; + + if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) + { + *os << "::CORBA::Boolean const _tao_opt_colloc =" << be_idt_nl + << "stub->servant_orb_var ()->orb_core ()->" + << "optimize_collocation_objects ();" << be_uidt_nl << be_nl; + } + *os << "ACE_NEW_RETURN (" << be_idt << be_idt_nl << "tmp," << be_nl - << "::CORBA::Object (stub, _tao_opt_colloc, this)," << be_nl + << "::CORBA::Object (stub, "; + + if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) + { + *os << "_tao_opt_colloc"; + } + else + { + *os << "false"; + } + + *os << ", this)," << be_nl << "0" << be_uidt_nl << ");" << be_uidt_nl << be_nl; @@ -879,11 +894,20 @@ be_visitor_interface_ss::this_method (be_interface *node) << "return" << be_idt_nl << "TAO::Narrow_Utils::unchecked_narrow (" << be_idt << be_idt_nl - << "obj.in ()," << be_nl - << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function_pointer" << be_uidt_nl - << ");" << be_uidt << be_uidt << be_uidt_nl + << "obj.in ()," << be_nl; + + if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) + { + *os << node->flat_client_enclosing_scope () + << node->base_proxy_broker_name () + << "_Factory_function_pointer" << be_uidt_nl; + } + else + { + *os << "0" << be_uidt_nl; + } + + *os << ");" << be_uidt << be_uidt << be_uidt_nl << "}"; } @@ -954,75 +978,78 @@ be_visitor_interface_ss::generate_proxy_classes (be_interface *node) } } - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__; - - // Proxy Broker Factory Function. - *os << be_nl << be_nl - << "TAO::Collocation_Proxy_Broker *" << be_nl - << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function ( ::CORBA::Object_ptr)" << be_nl - << "{" << be_idt_nl - << "return"; - - if (be_global->gen_direct_collocation ()) - { - *os << be_idt_nl - << "::" - << node->full_strategized_proxy_broker_name () - << "::" <<"the" - << node->strategized_proxy_broker_name () - << " ();" << be_uidt; - } - else - { - // @@ HACK! - - // Dummy function pointer for the thru-POA case. It isn't - // used to call a function but it is used to determine if - // collocation is available. - - // @todo Change the way TAO's ORB_Core detects collocation, - // or at least augment it so that we don't have to - // resort this hack. - *os << " reinterpret_cast (0xdead);" - << " // Dummy"; - } - - *os << be_uidt_nl - << "}" << be_nl << be_nl; - - // Proxy Broker Function Pointer Initializer. - *os << "int" << be_nl - << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_Initializer (size_t)" << be_nl - << "{" << be_idt_nl - << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function_pointer = " - << be_idt_nl - << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_function;" - << be_uidt_nl - << be_nl - << "return 0;" << be_uidt_nl - << "}" << be_nl << be_nl; - - *os << "static int" << be_nl - << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Stub_Factory_Initializer_Scarecrow =" << be_idt_nl - << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_Initializer (" << be_idt << be_idt_nl - << "reinterpret_cast (" - << node->flat_client_enclosing_scope () - << node->base_proxy_broker_name () - << "_Factory_Initializer)" << be_uidt_nl - << ");" << be_uidt << be_uidt; + if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) + { + *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl + << "// " << __FILE__ << ":" << __LINE__; + + // Proxy Broker Factory Function. + *os << be_nl << be_nl + << "TAO::Collocation_Proxy_Broker *" << be_nl + << node->flat_client_enclosing_scope () + << node->base_proxy_broker_name () + << "_Factory_function ( ::CORBA::Object_ptr)" << be_nl + << "{" << be_idt_nl + << "return"; + + if (be_global->gen_direct_collocation ()) + { + *os << be_idt_nl + << "::" + << node->full_strategized_proxy_broker_name () + << "::" <<"the" + << node->strategized_proxy_broker_name () + << " ();" << be_uidt; + } + else + { + // @@ HACK! + + // Dummy function pointer for the thru-POA case. It isn't + // used to call a function but it is used to determine if + // collocation is available. + + // @todo Change the way TAO's ORB_Core detects collocation, + // or at least augment it so that we don't have to + // resort this hack. + *os << " reinterpret_cast (0xdead);" + << " // Dummy"; + } + + *os << be_uidt_nl + << "}" << be_nl << be_nl; + + // Proxy Broker Function Pointer Initializer. + *os << "int" << be_nl + << node->flat_client_enclosing_scope () + << node->base_proxy_broker_name () + << "_Factory_Initializer (size_t)" << be_nl + << "{" << be_idt_nl + << node->flat_client_enclosing_scope () + << node->base_proxy_broker_name () + << "_Factory_function_pointer = " + << be_idt_nl + << node->flat_client_enclosing_scope () + << node->base_proxy_broker_name () + << "_Factory_function;" + << be_uidt_nl + << be_nl + << "return 0;" << be_uidt_nl + << "}" << be_nl << be_nl; + + *os << "static int" << be_nl + << node->flat_client_enclosing_scope () + << node->base_proxy_broker_name () + << "_Stub_Factory_Initializer_Scarecrow =" << be_idt_nl + << node->flat_client_enclosing_scope () + << node->base_proxy_broker_name () + << "_Factory_Initializer (" << be_idt << be_idt_nl + << "reinterpret_cast (" + << node->flat_client_enclosing_scope () + << node->base_proxy_broker_name () + << "_Factory_Initializer)" << be_uidt_nl + << ");" << be_uidt << be_uidt; + } } if (be_global->gen_direct_collocation ()) diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp index 5040b2d6585..7f843bdf659 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp @@ -157,12 +157,15 @@ be_visitor_operation_ami_cs::visit_operation (be_operation *node) << be_uidt_nl << "}" << be_uidt_nl << be_nl; - *os << "if (this->the_TAO_" << parent->local_name () - << "_Proxy_Broker_ == 0)" << be_idt_nl - << "{" << be_idt_nl - << parent->flat_name () << "_setup_collocation (" - << ");" << be_uidt_nl - << "}" << be_uidt; + if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) + { + *os << "if (this->the_TAO_" << parent->local_name () + << "_Proxy_Broker_ == 0)" << be_idt_nl + << "{" << be_idt_nl + << parent->flat_name () << "_setup_collocation (" + << ");" << be_uidt_nl + << "}" << be_uidt; + } } // Includes the reply handler, but we have to add 1 for the retval anyway. @@ -243,9 +246,18 @@ be_visitor_operation_ami_cs::visit_operation (be_operation *node) << "_the_tao_operation_signature," << be_nl << nargs << "," << be_nl << "\"" << opname.fast_rep () << "\"," << be_nl - << opname_len << "," << be_nl - << "this->the" << intf->base_proxy_broker_name () << "_" - << be_uidt_nl + << opname_len << "," << be_nl; + + if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) + { + *os << "this->the" << intf->base_proxy_broker_name () << "_"; + } + else + { + *os << "0"; + } + + *os << be_uidt_nl << ");" << be_uidt; *os << be_nl << be_nl diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp index 66a0c2dcc2f..46bf569e49f 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp @@ -192,13 +192,16 @@ be_visitor_operation::gen_stub_operation_body ( << "{" << be_idt_nl << "::CORBA::Object::tao_object_initialize (this);" << be_uidt_nl - << "}" << be_uidt_nl << be_nl - << "if (this->the" << intf->base_proxy_broker_name () << "_ == 0)" - << be_idt_nl - << "{" << be_idt_nl - << intf->flat_name () << "_setup_collocation ();" - << be_uidt_nl << "}" << be_uidt_nl << be_nl; + if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) + { + *os << "if (this->the" << intf->base_proxy_broker_name () << "_ == 0)" + << be_idt_nl + << "{" << be_idt_nl + << intf->flat_name () << "_setup_collocation ();" + << be_uidt_nl + << "}" << be_uidt_nl << be_nl; + } } // Declare return type helper class. @@ -277,8 +280,16 @@ be_visitor_operation::gen_stub_operation_body ( // original_local_name() strips off the leading '_cxx_' if any. *os << node->original_local_name () << "\"," << be_nl - << tmp_len << "," << be_nl - << "this->the" << intf->base_proxy_broker_name () << "_"; + << tmp_len << "," << be_nl; + + if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) + { + *os << "this->the" << intf->base_proxy_broker_name () << "_"; + } + else + { + *os << "0"; + } if (node->flags () == AST_Operation::OP_oneway) { diff --git a/TAO/TAO_IDL/be/be_visitor_root/root.cpp b/TAO/TAO_IDL/be/be_visitor_root/root.cpp index 140ef6a4a93..4ce67d3821c 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/root.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/root.cpp @@ -143,15 +143,18 @@ int be_visitor_root::visit_root (be_root *node) { be_global->non_local_interfaces.dequeue_head (i); - *os << be_nl << be_nl - << "extern " << be_global->stub_export_macro () << be_nl - << "TAO::Collocation_Proxy_Broker *" << be_nl - << "(*" << i->flat_client_enclosing_scope () - << i->base_proxy_broker_name () - << "_Factory_function_pointer) (" - << be_idt << be_idt_nl - << "::CORBA::Object_ptr obj" << be_uidt_nl - << ");" << be_uidt; + if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) + { + *os << be_nl << be_nl + << "extern " << be_global->stub_export_macro () << be_nl + << "TAO::Collocation_Proxy_Broker *" << be_nl + << "(*" << i->flat_client_enclosing_scope () + << i->base_proxy_broker_name () + << "_Factory_function_pointer) (" + << be_idt << be_idt_nl + << "::CORBA::Object_ptr obj" << be_uidt_nl + << ");" << be_uidt; + } } size = be_global->non_defined_interfaces.size (); diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp index 26ab72be1cc..85387b345d0 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp @@ -62,12 +62,15 @@ be_visitor_root_ch::init (void) << "// " << __FILE__ << ":" << __LINE__; *os << be_global->core_versioning_begin () << be_nl; - + *os << be_nl << be_nl << "namespace TAO" << be_nl << "{" << be_idt_nl; - *os << "class Collocation_Proxy_Broker;" << be_nl; + if (be_global->gen_direct_collocation () || be_global->gen_thru_poa_collocation ()) + { + *os << "class Collocation_Proxy_Broker;" << be_nl; + } if (idl_global->abstract_iface_seen_) { -- cgit v1.2.1