From fd411e566e9bad60707580fae7fa0accc2c7632b Mon Sep 17 00:00:00 2001 From: gokhale Date: Tue, 26 May 1998 14:54:59 +0000 Subject: *** empty log message *** --- TAO/TAO_IDL/be/be_interface.cpp | 800 ---------------------------------------- 1 file changed, 800 deletions(-) (limited to 'TAO/TAO_IDL/be/be_interface.cpp') diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp index 478aa6010ab..4ed92d1ca4c 100644 --- a/TAO/TAO_IDL/be/be_interface.cpp +++ b/TAO/TAO_IDL/be/be_interface.cpp @@ -240,806 +240,6 @@ be_interface::full_skel_name (void) return this->full_skel_name_; } -// ---------------------------------------- -// CODE GENERATION METHODS -// ---------------------------------------- - -// generate the client header -int -be_interface::gen_client_header (void) -{ - if (!this->cli_hdr_gen_) // not already generated - { - long i; // loop index - TAO_NL nl; // end line - - // retrieve a singleton instance of the code generator - TAO_CodeGen *cg = TAO_CODEGEN::instance (); - - cg->push (TAO_CodeGen::TAO_INTERFACE_CH); // set the current code - // generation state - - TAO_OutStream *ch = cg->client_header (); - - // == STEP 1: generate the class name and class names we inherit == - ch->indent (); // start with whatever indentation level we are at - - // generate the ifdefined macro for the _ptr type - ch->gen_ifdef_macro (this->flatname (), "_ptr"); - - // the following two are required to be under the ifdef macro to avoid - // multiple declarations - - // forward declaration - *ch << "class " << this->local_name () << ";" << nl; - // generate the _ptr declaration - *ch << "typedef " << this->local_name () << " *" << this->local_name () - << "_ptr;" << nl; - - ch->gen_endif (); - - // generate the ifdefined macro for the var type - ch->gen_ifdef_macro (this->flatname (), "_var"); - - // generate the _var declaration - if (this->gen_var_defn () == -1) - { - ACE_ERROR ((LM_ERROR, - "be_interface - error generating _var definition\n")); - return -1; - } - ch->gen_endif (); - - // generate the ifdef macro for the _out class - ch->gen_ifdef_macro (this->flatname (), "_out"); - - // generate the _out declaration - ORBOS/97-05-15 pg 16-20 spec - if (this->gen_out_defn () == -1) - { - ACE_ERROR ((LM_ERROR, - "be_interface - error generating _var definition\n")); - return -1; - } - // generate the endif macro - ch->gen_endif (); - - ch->gen_ifdef_macro (this->flatname ()); - - // now generate the class definition - ch->indent (); - *ch << "class " << idl_global->export_macro () - << " " << this->local_name (); - - if (n_inherits () > 0) // this interface inherits from other interfaces - { - *ch << ": "; - for (i = 0; i < n_inherits (); i++) - { - be_interface *inherited = be_interface::narrow_from_decl - (this->inherits ()[i]); - be_decl *scope = 0; - if (inherited->is_nested ()) - { - // inherited node is used in the scope of "this" node - scope = be_scope::narrow_from_scope (this->defined_in - ())->decl (); - } - - *ch << "public virtual "; - *ch << inherited->nested_type_name (scope); // dump the scoped name - if (i < n_inherits () - 1) // this is the case of multiple - // inheritance - { - *ch << ", "; - } - } // end of for loop - *ch << nl; - } - else - { - // we do not inherit from anybody, hence we do so from the base - // CORBA::Object class - *ch << " : public virtual CORBA::Object" << nl; - } - - // generate the body - - *ch << "{" << nl; - *ch << "public:\n"; - ch->incr_indent (); - // generate the static _duplicate, _narrow, and _nil operations - *ch << "// the static operations" << nl; - *ch << "static " << this->local_name () << "_ptr " << "_duplicate (" - << this->local_name () << "_ptr obj);" << nl; - *ch << "static " << this->local_name () << "_ptr " << "_narrow (" - << "CORBA::Object_ptr obj, CORBA::Environment &env);" << nl; - *ch << "static " << this->local_name () << "_ptr " - << "_nil (void);" << nl; - - // generate a TAO-specific _bind method similar to what Orbix and VisiBroker - // have - *ch << "static " << this->local_name () << "_ptr _bind (const char *host, " - << "CORBA::UShort port, const char *key, CORBA::Environment &env);\n\n"; - - // the _is_a method - ch->indent (); - *ch << "virtual CORBA::Boolean _is_a (const CORBA::Char *type_id, " - << "CORBA::Environment &env);\n" << be_nl - << "// = user methods\n"; - - // generate code for the interface definition by traversing thru the - // elements of its scope. We depend on the front-end to have made sure - // that only legal syntactic elements appear in our scope. - if (this->be_scope::gen_client_header () == -1) - { - ACE_ERROR ((LM_ERROR, "be_interface::gen_client_header\n")); - ACE_ERROR ((LM_ERROR, "Scope code generation failure\n")); - return -1; - } - - // generate the "protected" constructor so that users cannot instantiate - // us - *ch << be_uidt_nl - << "protected:" << be_idt_nl - << this->local_name () << " (" << be_idt << be_idt_nl - << "STUB_Object *objref = 0," << be_nl - << "TAO_ServantBase *servant = 0," << be_nl - << "CORBA::Boolean collocated = CORBA::B_FALSE" << be_uidt_nl - << ");\n" << be_uidt; - ch->decr_indent (); - - // dtor is public... - *ch << "public:" << be_idt_nl - << "virtual ~" << this->local_name () << " (void);" << be_uidt_nl; - - // private copy constructor and assignment operator. These are not - // allowed, hence they are private. - *ch << "private:\n"; - ch->incr_indent (); - *ch << this->local_name () << " (const " << this->local_name () << "&);" << nl; - *ch << "void operator= (const " << this->local_name () << "&);\n"; - ch->decr_indent (); - *ch << "};\n\n"; - ch->gen_endif (); - - - // generate the typecode decl. If we are in the outermost scope, our typecode - // decl is extern - if (this->is_nested ()) - { - // we have a scoped name - ch->indent (); - *ch << "static CORBA::TypeCode_ptr " << this->tc_name - ()->last_component () << ";\n\n"; - } - else - { - // we are in the ROOT scope - ch->indent (); - *ch << "extern " - << idl_global->export_macro () - << " CORBA::TypeCode_ptr " - << this->tc_name ()->last_component () << ";\n\n"; - } - - cg->pop (); - this->cli_hdr_gen_ = I_TRUE; - } - return 0; -} - -// Generates the client-side inline functions -int -be_interface::gen_client_inline (void) -{ - TAO_NL nl; // end line - - // retrieve a singleton instance of the code generator - TAO_CodeGen *cg = TAO_CODEGEN::instance (); - - TAO_OutStream *ci = cg->client_inline (); - ci->indent (); // start from the current indentation level - - *ci << "ACE_INLINE" << nl; - *ci << this->name () << "::" - << this->local_name () << "(" << be_idt << be_idt_nl - << "STUB_Object *objref," << be_nl - << "TAO_ServantBase *servant," << be_nl - << "CORBA::Boolean collocated" << be_uidt_nl - << ")" << be_uidt_nl - << " : ACE_CORBA_1 (Object) (objref, servant, collocated)" << be_nl - << "{}" << be_nl << be_nl; - - *ci << "ACE_INLINE" << nl; - *ci << this->name () << "::~" << this->local_name () << - " (void) // destructor" << nl; - *ci << "{}\n\n"; - - // _nil method - *ci << "ACE_INLINE " << this->name () << "_ptr" << be_nl - << this->name () << "::_nil (void)" << be_nl - << "{" << be_idt_nl - << "return (" << this->name () << "_ptr)0;" << be_uidt_nl - << "}\n" << be_nl; - - // generate the ifdefined macro for the _var type - ci->gen_ifdef_macro (this->flatname (), "_var"); - - if (this->gen_var_impl () == -1) - { - ACE_ERROR ((LM_ERROR, "be_interface: _var impl code gen failed\n")); - return -1; - } - ci->gen_endif (); - - // generate the ifdefined macro for the _out type - ci->gen_ifdef_macro (this->flatname (), "_out"); - - if (this->gen_out_impl () == -1) - { - ACE_ERROR ((LM_ERROR, "be_interface: _out impl code gen failed\n")); - return -1; - } - ci->gen_endif (); - - if (this->be_scope::gen_client_inline () == -1) - { - ACE_ERROR ((LM_ERROR, "be_interface: code gen failed for scope\n")); - return -1; - } - - return 0; -} - - -// Generate the client-side stubs -int -be_interface::gen_client_stubs (void) -{ - TAO_NL nl; // end line - - // retrieve a singleton instance of the code generator - TAO_CodeGen *cg = TAO_CODEGEN::instance (); - cg->push (TAO_CodeGen::TAO_INTERFACE_CS); // set the current code generation - // state - - TAO_OutStream *cs = cg->client_stubs (); - - cs->indent (); // start with whatever indentation level we are at - - // first generate the code for the static methods - // The _duplicate method - *cs << this->name () << "_ptr " << this->name () << "::_duplicate (" - << this->name () << "_ptr obj)" << nl; - *cs << "{\n"; - cs->incr_indent (); - *cs << "if (!CORBA::is_nil (obj))\n"; - cs->incr_indent (); - *cs << "obj->AddRef ();\n"; - cs->decr_indent (); - *cs << nl; - *cs << "return obj;\n"; - cs->decr_indent (); - *cs << "} // end of _duplicate" << nl << nl; - - // The _narrow method - *cs << this->name () << "_ptr " << this->name () - << "::_narrow (" << be_idt << be_idt_nl - << "CORBA::Object_ptr obj," << be_nl - << "CORBA::Environment &env" << be_uidt_nl - << ")" << be_uidt_nl - << "{" << be_idt_nl - << "if (CORBA::is_nil (obj))" << be_idt_nl - << "return " << this->name () << "::_nil ();" << be_uidt_nl - << "if (!obj->_is_a (\"" << this->repoID () << "\", env))" - << be_idt_nl - << "return " << this->name () << "::_nil ();" << be_uidt_nl; - - *cs << "if (!obj->_is_collocated () || !obj->_servant())" << be_nl - << "{" << be_idt_nl; - *cs << this->name () << "_ptr new_obj = new " << this->name () << "(obj->_get_parent ());" << be_nl - << "return new_obj;" << be_uidt_nl - << "} // end of if" << be_nl; - - *cs << "STUB_Object *stub = obj->_servant ()->_create_stub (env);" << be_nl - << "if (env.exception () != 0)" << be_idt_nl - << "return " << this->name () << "::_nil ();" << be_uidt_nl - << "void* servant = obj->_servant ()->_downcast (\"" - << this->repoID () << "\");" << be_nl - << "return new "; - - // This may be necessary to work around a GCC compiler bug! - const char *coll_name = this->full_coll_name (); - const char *skel_name = this->full_skel_name (); - - *cs << coll_name << "(" << be_idt << be_idt_nl - << "ACE_reinterpret_cast(" << skel_name - << "_ptr, servant)," << be_nl - << "stub" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl - << "}" << be_nl << be_nl; - - // the _bind method - *cs << this->name () << "_ptr " << this->name () << "::_bind (" << - "const char *host, CORBA::UShort port, const char *key, " << - "CORBA::Environment &env)" << nl; - *cs << "{" << be_idt_nl - << "IIOP_Object *data = new IIOP_Object (host, port, key);" << be_nl - << "if (!data) return " << this->name () << "::_nil ();" << be_nl - << "// create the CORBA level proxy" << be_nl - << "CORBA::Object_ptr objref = new CORBA_Object (data);" << be_nl - << "if (objref == 0)" << be_idt_nl << "{" << be_idt_nl - << "data->Release ();" << be_nl - << "env.exception (new CORBA::DATA_CONVERSION (CORBA::COMPLETED_NO));" << be_nl - << "return " << this->name () << "::_nil ();" << be_uidt_nl << "}" << be_uidt_nl - << "return " << this->name () << "::_narrow (objref, env);" << be_uidt_nl - << "}" << be_nl << be_nl; - - // generate code for the elements of the interface - if (this->be_scope::gen_client_stubs () == -1) - { - ACE_ERROR ((LM_ERROR, "be_interface::gen_client_stubs\n")); - ACE_ERROR ((LM_ERROR, "Scope code generation failure\n")); - return -1; - } - - // generate the is_a method - cs->indent (); - *cs << "CORBA::Boolean " << this->name () << "::_is_a (" << - "const CORBA::Char *value, CORBA::Environment &_tao_environment)" << nl; - *cs << "{\n"; - cs->incr_indent (); - *cs << "if (\n"; - cs->incr_indent (0); - if (this->traverse_inheritance_graph (be_interface::is_a_helper, cs) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_interface::gen_client_stubs - " - "inheritance graph failed\n"), -1); - } - cs->indent (); - *cs << "(!ACE_OS::strcmp ((char *)value, CORBA::_tc_Object->id (_tao_environment))))\n"; - *cs << " return 1; // success using local knowledge\n"; - cs->decr_indent (); - *cs << "else" << nl; - *cs << " return this->CORBA_Object::_is_a (value, _tao_environment); // remote call\n"; - cs->decr_indent (); - *cs << "}\n\n"; - - // generate the typecode information here - cs->indent (); // start from current indentation level - *cs << "static const CORBA::Long _oc_" << this->flatname () << "[] =" << - nl; - *cs << "{\n"; - cs->incr_indent (0); - if (this->gen_encapsulation () == -1) - { - ACE_ERROR ((LM_ERROR, "Error generating typecode\n\n")); - return -1; - } - cs->decr_indent (); - *cs << "};" << nl; - - *cs << "static CORBA::TypeCode _tc__tc_" << this->flatname () << - " (CORBA::tk_objref, sizeof (_oc_" << this->flatname () << - "), (char *) &_oc_" << this->flatname () << - ", CORBA::B_FALSE);" << nl; - *cs << "CORBA::TypeCode_ptr " << this->tc_name () << " = &_tc__tc_" << - this->flatname () << ";\n\n"; - - cg->pop (); - return 0; -} - -// generate server header -int be_interface::gen_server_header (void) -{ - TAO_OutStream *sh; // output stream - long i; // loop index - TAO_NL nl; // end line - static char namebuf [NAMEBUFSIZE]; // holds the class name - AST_Decl *d; // enclosing scope - - ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE); - - // retrieve a singleton instance of the code generator - TAO_CodeGen *cg = TAO_CODEGEN::instance (); - cg->push (TAO_CodeGen::TAO_INTERFACE_SH); // set the current code generation - // state - - sh = cg->server_header (); - - // generate the skeleton class name - - sh->indent (); // start with whatever indentation level we are at - - // we shall have a POA_ prefix only if we are at the topmost level - // generate the forward declaration - d = ScopeAsDecl (this->defined_in ()); - if (d->node_type () == AST_Decl::NT_root) - { - // we are outermost - ACE_OS::sprintf (namebuf, "POA_%s", this->local_name ()->get_string ()); - } - else - { - ACE_OS::sprintf (namebuf, "%s", this->local_name ()->get_string ()); - } - - *sh << "class " << namebuf << ";" << nl; - - // generate the _ptr declaration - *sh << "typedef " << namebuf << " *" << namebuf - << "_ptr;" << nl; - - // now generate the class definition - *sh << "class " << idl_global->export_macro () - << " " << namebuf << " : "; - if (n_inherits () > 0) // this interface inherits from other interfaces - { - be_interface *intf; - - *sh << "public virtual "; - intf = be_interface::narrow_from_decl (inherits ()[0]); - *sh << intf->relative_skel_name (this->full_skel_name ()); - for (i = 1; i < n_inherits (); i++) - { - *sh << ", public virtual "; - intf = be_interface::narrow_from_decl (inherits ()[i]); - *sh << intf->relative_skel_name (this->full_skel_name ()); - } // end of for loop - } - else - { - // We don't inherit from another user defined object, hence our - // base class is the ServantBase class. - *sh << " public virtual PortableServer::ServantBase"; - } - *sh << nl; - *sh << "{" << nl; - *sh << "protected:\n"; - sh->incr_indent (); - *sh << namebuf << " (void);" << nl; - sh->decr_indent (); - *sh << "public:\n"; - sh->incr_indent (); - *sh << "virtual ~" << namebuf << " (void);\n"; - - sh->indent (); - *sh << "virtual CORBA::Boolean _is_a (" << be_idt << be_idt_nl - << "const char* logical_type_id," << be_nl - << "CORBA::Environment &_tao_environment" << be_uidt - << ");\n" << be_uidt; - - sh->indent (); - *sh << "virtual void* _downcast (" << be_idt << be_idt_nl - << "const char* logical_type_id" << be_uidt_nl - << ");\n" << be_uidt; - - // generate code for elements in the scope (e.g., operations) - if (be_scope::gen_server_header () == -1) - { - ACE_ERROR ((LM_ERROR, "be_interface::gen_server_header\n")); - ACE_ERROR ((LM_ERROR, "Scope code generation failure\n")); - return -1; - } - - // add our _is_a method - sh->indent (); - *sh << "static void _is_a_skel (CORBA::ServerRequest &req, " << - "void *obj, void *context, CORBA::Environment &_tao_enviroment);\n\n"; - - // generate skeletons for operations of our base classes. These skeletons - // just cast the pointer to the appropriate type before invoking the call - if (this->traverse_inheritance_graph (be_interface::gen_skel_helper, sh) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_interface::gen_server_header - " - "inheritance graph traversal failed\n"), -1); - } - - // add the dispatch method - sh->indent (); - *sh << "virtual void _dispatch (CORBA::ServerRequest &req, " << - "void *context, CORBA::Environment &env);\n\n"; - - // Print out the _this() method. - sh->indent (); - *sh << this->name () << " *_this (CORBA::Environment &_tao_environment);\n"; - - sh->indent (); - *sh << "virtual const char* _interface_repository_id" - << " (void) const;\n"; - - sh->decr_indent (); - - *sh << "};\n\n"; - -#if 0 - be_visitor_collocated_sh visitor; - this->accept (&visitor); - *sh << "\n"; -#endif - cg->pop (); - return 0; -} - -int be_interface::gen_server_skeletons (void) -{ - TAO_OutStream *ss; // output stream - TAO_NL nl; // end line - AST_Decl *d; // temporary - - // retrieve a singleton instance of the code generator - TAO_CodeGen *cg = TAO_CODEGEN::instance (); - cg->push (TAO_CodeGen::TAO_INTERFACE_SS); // set the current code generation - // state - - ss = cg->server_skeletons (); - - // generate the skeleton class name - - ss->indent (); // start with whatever indentation level we are at - - if (this->gen_operation_table () == -1) - { - ACE_ERROR ((LM_ERROR, - "be_interface::gen_operation_table failure\n")); - return -1; - } - - *ss << "// skeleton constructor" << nl; - // find if we are at the top scope or inside some module - d = ScopeAsDecl (this->defined_in ()); - - // if (d && d->node_type () == AST_Decl::NT_root) - if (!this->is_nested ()) - { - // we are outermost. So the POA_ prefix is prepended to our name - *ss << this->full_skel_name () << "::POA_" << this->local_name () << - " (void)" << nl; - } - else - { - // the POA_ prefix is prepended to our outermost module name - *ss << this->full_skel_name () << "::" << this->local_name () << - " (void)" << nl; - } - - *ss << "{" << be_idt_nl - << "this->optable_ = &tao_" << this->flatname () - << "_optable;" << be_uidt_nl - << "}\n\n"; - - // generate code for elements in the scope (e.g., operations) - if (be_scope::gen_server_skeletons () == -1) - { - ACE_ERROR ((LM_ERROR, "be_interface::gen_server_skeletons\n")); - ACE_ERROR ((LM_ERROR, "Scope code generation failure\n")); - return -1; - } - - // generate code for the _is_a skeleton - ss->indent (); - *ss << "void " << this->full_skel_name () - << "::_is_a_skel (" << be_idt << be_idt_nl - << "CORBA::ServerRequest &req, " << be_nl - << "void * _tao_object_reference," << be_nl - << "void * /*context*/," << be_nl - << "CORBA::Environment &_tao_environment" << be_uidt_nl - << ")" << be_uidt_nl; - - *ss << "{\n"; - ss->incr_indent (); - *ss << "CORBA::NVList_ptr nvlist;" << nl; - *ss << "CORBA::NamedValue_ptr nv;" << nl; - *ss << "CORBA::Any temp_value (CORBA::_tc_string);" << nl; - *ss << "CORBA::Any *any;" << nl; - *ss << "CORBA::Boolean *retval = new CORBA::Boolean;" << nl; - *ss << "CORBA::String value;" << nl; - *ss << nl; - *ss << "req.orb()->create_list (0, nvlist);" << nl; - *ss << "nv = nvlist->add_value (0, temp_value, " - << "CORBA::ARG_IN, _tao_environment);" << nl; - *ss << "req.params (nvlist, _tao_environment); // parse the args" << nl; - *ss << "if (_tao_environment.exception () != 0) return;" << nl; - *ss << "value = *(CORBA::String *)nv->value ()->value ();" << nl; - - *ss << this->full_skel_name () << "_ptr impl = (" - << this->full_skel_name () << "_ptr) _tao_object_reference;" - << nl; - - *ss << "*retval = impl->_is_a (value, _tao_environment);" << be_nl - << "if (_tao_environment.exception () != 0) return;" << be_nl; - *ss << "any = new CORBA::Any (CORBA::_tc_boolean, " - << "retval, CORBA::B_TRUE);" << nl; - *ss << "req.result (any, _tao_environment);\n"; - ss->decr_indent (); - *ss << "}\n\n"; - - ss->indent (); - *ss << "CORBA::Boolean " << this->full_skel_name () - << "::_is_a (" << be_idt << be_idt_nl - << "const char* value," << be_nl - << "CORBA::Environment &_tao_environment" << be_uidt_nl - << ")" << be_uidt_nl - << "{" << be_idt_nl - << "if (\n" << be_idt; - if (this->traverse_inheritance_graph (be_interface::is_a_helper, ss) == -1) - { - return -1; - } - - ss->indent (); - *ss << "(!ACE_OS::strcmp ((char *)value, " - << "CORBA::_tc_Object->id (_tao_environment))))" - << be_idt_nl << "return CORBA::B_TRUE;" << be_uidt_nl - << "else" << be_idt_nl - << "return CORBA::B_FALSE;" << be_uidt << be_uidt << be_uidt_nl - << "}\n\n"; - - ss->indent (); - *ss << "void* " << this->full_skel_name () - << "::_downcast (" << be_idt << be_idt_nl - << "const char* logical_type_id" << be_uidt_nl - << ")" << be_uidt_nl - << "{" << be_idt_nl; - - if (this->traverse_inheritance_graph (be_interface::downcast_helper, ss) == -1) - { - return -1; - } - - *ss << "if (ACE_OS::strcmp (logical_type_id, " - << "\"IDL:omg.org/CORBA/Object:1.0\") == 0)" << be_idt_nl - << "return ACE_static_cast(PortableServer::Servant, this);" - << be_uidt_nl; - - *ss << "return 0;" << be_uidt_nl - << "}\n\n"; - - - // now the dispatch method - ss->indent (); - *ss << "void " << this->full_skel_name () << - "::_dispatch (CORBA::ServerRequest &req, " << - "void *context, CORBA::Environment &env)" << nl; - *ss << "{\n"; - ss->incr_indent (); - *ss << "TAO_Skeleton skel; // pointer to skeleton for operation" << nl; - *ss << "CORBA::String opname = req.operation (); // retrieve operation name" << - nl; - *ss << "// find the skeleton corresponding to this opname" << nl; - *ss << "if (this->_find (opname, skel) == -1)" << nl; - *ss << "{\n"; - ss->incr_indent (); - *ss << "env.exception (new CORBA_BAD_OPERATION (CORBA::COMPLETED_NO));" << - nl; - *ss << "ACE_ERROR ((LM_ERROR, \"Bad operation <%s>\\n\", opname));\n"; - ss->decr_indent (); - *ss << "}\n"; - *ss << "else" << nl; - *ss << " skel (req, this, context, env);\n"; - ss->decr_indent (); - *ss << "}\n\n"; - - ss->indent (); - *ss << "const char* " << this->full_skel_name () - << "::_interface_repository_id (void) const" - << nl; - *ss << "{\n"; - ss->incr_indent (); - *ss << "return \"" << this->repoID () << "\";\n"; - ss->decr_indent (); - *ss << "}\n\n"; - - cg->pop (); - -#if 0 - be_visitor_collocated_ss visitor; - this->accept (&visitor); - *ss << "\n"; -#endif - *ss << this->name () << "*" << be_nl - << this->full_skel_name () - << "::_this (CORBA_Environment &_env)" << be_nl - << "{" << be_idt_nl - << "STUB_Object *stub = this->_create_stub (_env);" << be_nl - << "if (_env.exception () != 0)" << be_idt_nl - << "return 0;" << be_uidt_nl - -#if 0 - << "TAO_ORB_Core *orb_core = TAO_ORB_Core_instance ();" << be_nl - << "if (orb_core->get_current ()->in_servant_upcall ())" << be_nl - << "{" << be_idt << be_nl - << "stub = new IIOP_Object (" << be_idt << be_idt << be_nl - << "CORBA::string_copy (this->_interface_repository_id ())," << be_nl - << "IIOP::Profile (" << be_idt << be_idt << be_nl - << "TAO_ORB_Core_instance ()->orb_params ()->addr ()," << be_nl - << "orb_core->get_current ()->object_key ()" << be_uidt << be_nl - << ")" << be_uidt << be_uidt << be_nl - << ");" << be_uidt << be_uidt << be_nl - << "}" << be_nl - << "else" << be_nl - << "{" << be_idt_nl - << "POA* poa = this->default_poa (_env);" << be_nl - << "if (_env.exception () != 0)" << be_idt << be_nl - << "return 0;" << be_uidt << be_nl - << "const TAO::ObjectKey& object_key = " << be_idt << be_nl - << "poa->servant_to_id (this, _env);" << be_uidt << be_nl - << "if (_env.exception () != 0)" << be_idt << be_nl - << "return 0;" << be_uidt << be_nl - << "stub = new IIOP_Object (" << be_idt << be_idt << be_nl - << "CORBA::string_copy (this->_interface_repository_id ())," << be_nl - << "IIOP::Profile (" << be_idt << be_idt << be_nl - << "TAO_ORB_Core_instance ()->orb_params ()->addr ()," << be_nl - << "object_key" << be_uidt << be_nl - << ")" << be_uidt << be_uidt << be_nl - << ");" << be_uidt << be_uidt << be_nl - << "}\n" << be_nl -#endif /* 0 */ - - << "return new " << this->full_coll_name () - << " (this, stub);" << be_uidt << be_nl; - - *ss << "}\n\n"; - - return 0; -} - -// Generates the server-side inline -int -be_interface::gen_server_inline (void) -{ - // nothing to be done - TAO_OutStream *si; // output stream - long i; // loop index - TAO_NL nl; // end line - - // Macro to avoid "warning: unused parameter" type warning. - ACE_UNUSED_ARG (i); - - // retrieve a singleton instance of the code generator - TAO_CodeGen *cg = TAO_CODEGEN::instance (); - - si = cg->server_inline (); - - // generate the skeleton class name - - si->indent (); // start with whatever indentation level we are at - - *si << "// skeleton destructor" << nl; - - *si << "ACE_INLINE" << nl; - if (!this->is_nested ()) - { - // we are outermost. So the POA_ prefix is prepended to our name - *si << this->full_skel_name () << "::~POA_" << this->local_name () << - " (void)" << nl; - } - else - { - // the POA_ prefix is prepended to our outermost module name - *si << this->full_skel_name () << "::~" << this->local_name () << - " (void)" << nl; - } - - *si << "{\n"; - *si << "}\n"; - - - // generate skeletons for operations of our base classes. These skeletons - // just cast the pointer to the appropriate type before invoking the call - if (this->traverse_inheritance_graph (be_interface::gen_skel_helper, si) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_interface::gen_server_inline - " - "inheritance graph traversal failed\n"), -1); - } - - return 0; -} - // generate the var definition int be_interface::gen_var_defn (void) -- cgit v1.2.1