diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-08-10 23:10:02 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-08-10 23:10:02 +0000 |
commit | abf2c223c8fee40c4737ebd955bd102718e3f3e9 (patch) | |
tree | 4edd1e760d4356695bc47223bb7130e68028cfa8 /TAO/TAO_IDL | |
parent | e2f61cbf127cf89220bd41658150f0996e383776 (diff) | |
download | ATCD-abf2c223c8fee40c4737ebd955bd102718e3f3e9.tar.gz |
ChangeLogTag: Tue Aug 10 17:56:00 2004 Jeff Parsons <j.parsons@vanderbilt.edu>
Diffstat (limited to 'TAO/TAO_IDL')
-rw-r--r-- | TAO/TAO_IDL/be/be_interface.cpp | 6 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_arg_traits.cpp | 7 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_component/component_sh.cpp | 3 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp | 424 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ss.cpp | 20 |
5 files changed, 222 insertions, 238 deletions
diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp index 2856108bf60..bbcdb44e5c7 100644 --- a/TAO/TAO_IDL/be/be_interface.cpp +++ b/TAO/TAO_IDL/be/be_interface.cpp @@ -1472,10 +1472,8 @@ be_interface::traverse_inheritance_graph ( abstract_paths_only); } } - else - { - (void) this->insert_non_dup (be_global->ccmobject ()); - } + + (void) this->insert_non_dup (be_global->ccmobject ()); } (void) this->insert_non_dup (intf, abstract_paths_only); diff --git a/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp b/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp index 3548c50705a..bbd8afc91f9 100644 --- a/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp +++ b/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp @@ -107,6 +107,8 @@ be_visitor_arg_traits::visit_interface (be_interface *node) if (node->seen_in_operation ()) { TAO_OutStream *os = this->ctx_->stream (); + idl_bool stub = (this->ctx_->state () == TAO_CodeGen::TAO_ROOT_CS); + BE_GlobalData *b = be_global; // This should be generated even for imported nodes. The ifdef guard prevents // multiple declarations. @@ -114,8 +116,9 @@ be_visitor_arg_traits::visit_interface (be_interface *node) *os << be_nl << be_nl << "ACE_TEMPLATE_SPECIALIZATION" << be_nl - << "class " << be_global->stub_export_macro () << " " - << this->S_ << "Arg_Traits<" + << "class " + << (stub ? b->stub_export_macro () : b->skel_export_macro ()) + << " " << this->S_ << "Arg_Traits<" << node->name () << ">" << be_idt_nl << ": public" << be_idt << be_idt_nl << "Object_" << this->S_ << "Arg_Traits_T<" << be_idt << be_idt_nl diff --git a/TAO/TAO_IDL/be/be_visitor_component/component_sh.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_sh.cpp index 107adfc34af..146ae4a0524 100644 --- a/TAO/TAO_IDL/be/be_visitor_component/component_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component/component_sh.cpp @@ -83,7 +83,8 @@ be_visitor_component_sh::visit_component (be_component *node) class_name += node->local_name (); } - *os << "// TAO_IDL - Generated from" << be_nl + *os << be_nl << be_nl + << "// TAO_IDL - Generated from" << be_nl << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; // Generate the skeleton class name. 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 1e798193964..d413ed775a3 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp @@ -39,225 +39,221 @@ int be_visitor_interface_sh::visit_interface (be_interface *node) { if (node->srv_hdr_gen () - || node->imported ()) + || node->imported () + || node->is_abstract ()) { return 0; } - // For abstract interfaces, we just generated the collocation stuff - // (see below). - if (! node->is_abstract ()) + // If this node is a AMH-RH node, then generate code for it + if (node->is_local ()) { - // If this node is a AMH-RH node, then generate code for it - if (node->is_local ()) - { - if (this->is_amh_rh_node (node)) - { - // Create amh_rh_visitors. - be_visitor_amh_rh_interface_sh amh_rh_intf (this->ctx_); - amh_rh_intf.visit_interface (node); - } - - return 0; - } - - if (this->generate_amh_classes (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_interface_sh::" - "visit_interface - " - "codegen for AMH classes failed\n"), - -1); - } - - TAO_OutStream *os = this->ctx_->stream (); - ACE_CString class_name; - - // We shall have a POA_ prefix only if we are at the topmost level. - if (!node->is_nested ()) - { - // We are outermost. - class_name += "POA_"; - class_name += node->local_name (); - } - else - { - class_name += node->local_name (); - } - - *os << be_nl << be_nl - << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - // Generate the skeleton class name. - *os << "class " << class_name.c_str () << ";" << be_nl; - - // Generate the _ptr declaration. - *os << "typedef " << class_name.c_str () << " *" << class_name.c_str () - << "_ptr;" << be_nl << be_nl; - - // Forward class declarations. - if (be_global->gen_thru_poa_collocation ()) - { - *os << "class " << node->thru_poa_proxy_impl_name () << ";" << be_nl; - } - - if (be_global->gen_direct_collocation ()) - { - *os << "class " << node->direct_proxy_impl_name () << ";" << be_nl; - } - - if (be_global->gen_thru_poa_collocation () - || be_global->gen_direct_collocation ()) - { - *os << "class " << node->strategized_proxy_broker_name () - << ";" << be_nl; - } - - *os << be_nl; - - // Now generate the class definition. - *os << "class " << be_global->skel_export_macro () - << " " << class_name.c_str () << be_idt_nl << ": " << be_idt; - - long n_parents = node->n_inherits (); - AST_Interface *parent = 0; - int has_concrete_parent = 0; - - for (int i = 0; i < n_parents; ++i) - { - parent = node->inherits ()[i]; - - if (parent->is_abstract ()) - { - continue; - } - - if (has_concrete_parent == 1) - { - *os << "," << be_nl; - } - - *os << "public virtual " << "POA_" - << parent->name (); - - has_concrete_parent = 1; - } - - if (has_concrete_parent == 0) - { - // We don't inherit from another user defined object, hence our - // base class is the ServantBase class. - *os << "public virtual PortableServer::ServantBase"; - } - - *os << be_uidt << be_uidt_nl - << "{" << be_nl - << "protected:" << be_idt_nl; - - // Default constructor. - *os << class_name.c_str () << " (void);" << be_uidt_nl << be_nl - << "public:" << be_idt_nl; - - // Some useful typedefs. - *os << "// Useful for template programming." << be_nl - << "typedef ::" << node->name () << " _stub_type;" << be_nl - << "typedef ::" << node->name () << "_ptr _stub_ptr_type;" << be_nl - << "typedef ::" << node->name () << "_var _stub_var_type;" - << be_nl << be_nl; - - // Copy constructor and destructor. - *os << class_name.c_str () << " (const " - << class_name.c_str () << "& rhs);" << be_nl - << "virtual ~" << class_name.c_str () << " (void);" << be_nl << be_nl; - - // _is_a - *os << "virtual CORBA::Boolean _is_a (" << be_idt << be_idt_nl - << "const char* logical_type_id" << be_nl - << "ACE_ENV_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl - << ");" << be_uidt_nl << be_nl; - - // _downcast - *os << "virtual void* _downcast (" << be_idt << be_idt_nl - << "const char* logical_type_id" << be_uidt_nl - << ");" << be_uidt_nl << be_nl; - - // Add a skeleton for our _is_a method. - *os << "static void _is_a_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest &req," << be_nl - << "void *servant," << be_nl - << "void *servant_upcall" << be_nl - << "ACE_ENV_ARG_DECL" << be_uidt_nl - << ");" << be_uidt_nl << be_nl; - - // Add a skeleton for our _non_existent method. - *os << "static void _non_existent_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest &req," << be_nl - << "void *servant," << be_nl - << "void *servant_upcall" << be_nl - << "ACE_ENV_ARG_DECL" << be_uidt_nl - << ");" << be_uidt_nl << be_nl; - - // Add a skeleton for our _interface method. - *os << "static void _interface_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest &req," << be_nl - << "void *servant," << be_nl - << "void *servant_upcall" << be_nl - << "ACE_ENV_ARG_DECL" << be_uidt_nl - << ");" << be_uidt_nl << be_nl; - - // Add a skeleton for our _component method. - *os << "static void _component_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest &req," << be_nl - << "void *obj," << be_nl - << "void *servant_upcall" << be_nl - << "ACE_ENV_ARG_DECL" << be_uidt_nl - << ");" << be_uidt_nl << be_nl; - - // Add the dispatch method. - *os << "virtual void _dispatch (" << be_idt << be_idt_nl - << "TAO_ServerRequest &req," << be_nl - << "void *_servant_upcall" << be_nl - << "ACE_ENV_ARG_DECL" << be_uidt_nl - << ");" << be_uidt_nl << be_nl; - - this->this_method (node); - - // The _interface_repository_id method. - *os << be_nl - << "virtual const char* _interface_repository_id " - << "(void) const;"; - - // Generate code for elements in the scope (e.g., operations). - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_interface_sh::" - "visit_interface - " - "codegen for scope failed\n"), - -1); - } - - // Generate skeletons for operations of our base classes. These - // skeletons just cast the pointer to the appropriate type - // before invoking the call. - int status = - node->traverse_inheritance_graph ( - be_interface::gen_skel_helper, - os - ); - - if (status == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_interface_sh::" - "visit_interface - " - "inheritance graph traversal failed\n"), - -1); - } - - *os << be_uidt_nl << "};"; - } // if ! node->is_abstract () + if (this->is_amh_rh_node (node)) + { + // Create amh_rh_visitors. + be_visitor_amh_rh_interface_sh amh_rh_intf (this->ctx_); + amh_rh_intf.visit_interface (node); + } + + return 0; + } + + if (this->generate_amh_classes (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_interface_sh::" + "visit_interface - " + "codegen for AMH classes failed\n"), + -1); + } + + TAO_OutStream *os = this->ctx_->stream (); + ACE_CString class_name; + + // We shall have a POA_ prefix only if we are at the topmost level. + if (!node->is_nested ()) + { + // We are outermost. + class_name += "POA_"; + class_name += node->local_name (); + } + else + { + class_name += node->local_name (); + } + + *os << be_nl << be_nl + << "// TAO_IDL - Generated from" << be_nl + << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; + + // Generate the skeleton class name. + *os << "class " << class_name.c_str () << ";" << be_nl; + + // Generate the _ptr declaration. + *os << "typedef " << class_name.c_str () << " *" << class_name.c_str () + << "_ptr;" << be_nl << be_nl; + + // Forward class declarations. + if (be_global->gen_thru_poa_collocation ()) + { + *os << "class " << node->thru_poa_proxy_impl_name () << ";" << be_nl; + } + + if (be_global->gen_direct_collocation ()) + { + *os << "class " << node->direct_proxy_impl_name () << ";" << be_nl; + } + + if (be_global->gen_thru_poa_collocation () + || be_global->gen_direct_collocation ()) + { + *os << "class " << node->strategized_proxy_broker_name () + << ";" << be_nl; + } + + *os << be_nl; + + // Now generate the class definition. + *os << "class " << be_global->skel_export_macro () + << " " << class_name.c_str () << be_idt_nl << ": " << be_idt; + + long n_parents = node->n_inherits (); + AST_Interface *parent = 0; + int has_concrete_parent = 0; + + for (int i = 0; i < n_parents; ++i) + { + parent = node->inherits ()[i]; + + if (parent->is_abstract ()) + { + continue; + } + + if (has_concrete_parent == 1) + { + *os << "," << be_nl; + } + + *os << "public virtual " << "POA_" + << parent->name (); + + has_concrete_parent = 1; + } + + if (has_concrete_parent == 0) + { + // We don't inherit from another user defined object, hence our + // base class is the ServantBase class. + *os << "public virtual PortableServer::ServantBase"; + } + + *os << be_uidt << be_uidt_nl + << "{" << be_nl + << "protected:" << be_idt_nl; + + // Default constructor. + *os << class_name.c_str () << " (void);" << be_uidt_nl << be_nl + << "public:" << be_idt_nl; + + // Some useful typedefs. + *os << "// Useful for template programming." << be_nl + << "typedef ::" << node->name () << " _stub_type;" << be_nl + << "typedef ::" << node->name () << "_ptr _stub_ptr_type;" << be_nl + << "typedef ::" << node->name () << "_var _stub_var_type;" + << be_nl << be_nl; + + // Copy constructor and destructor. + *os << class_name.c_str () << " (const " + << class_name.c_str () << "& rhs);" << be_nl + << "virtual ~" << class_name.c_str () << " (void);" << be_nl << be_nl; + + // _is_a + *os << "virtual CORBA::Boolean _is_a (" << be_idt << be_idt_nl + << "const char* logical_type_id" << be_nl + << "ACE_ENV_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl + << ");" << be_uidt_nl << be_nl; + + // _downcast + *os << "virtual void* _downcast (" << be_idt << be_idt_nl + << "const char* logical_type_id" << be_uidt_nl + << ");" << be_uidt_nl << be_nl; + + // Add a skeleton for our _is_a method. + *os << "static void _is_a_skel (" << be_idt << be_idt_nl + << "TAO_ServerRequest &req," << be_nl + << "void *servant," << be_nl + << "void *servant_upcall" << be_nl + << "ACE_ENV_ARG_DECL" << be_uidt_nl + << ");" << be_uidt_nl << be_nl; + + // Add a skeleton for our _non_existent method. + *os << "static void _non_existent_skel (" << be_idt << be_idt_nl + << "TAO_ServerRequest &req," << be_nl + << "void *servant," << be_nl + << "void *servant_upcall" << be_nl + << "ACE_ENV_ARG_DECL" << be_uidt_nl + << ");" << be_uidt_nl << be_nl; + + // Add a skeleton for our _interface method. + *os << "static void _interface_skel (" << be_idt << be_idt_nl + << "TAO_ServerRequest &req," << be_nl + << "void *servant," << be_nl + << "void *servant_upcall" << be_nl + << "ACE_ENV_ARG_DECL" << be_uidt_nl + << ");" << be_uidt_nl << be_nl; + + // Add a skeleton for our _component method. + *os << "static void _component_skel (" << be_idt << be_idt_nl + << "TAO_ServerRequest &req," << be_nl + << "void *obj," << be_nl + << "void *servant_upcall" << be_nl + << "ACE_ENV_ARG_DECL" << be_uidt_nl + << ");" << be_uidt_nl << be_nl; + + // Add the dispatch method. + *os << "virtual void _dispatch (" << be_idt << be_idt_nl + << "TAO_ServerRequest &req," << be_nl + << "void *_servant_upcall" << be_nl + << "ACE_ENV_ARG_DECL" << be_uidt_nl + << ");" << be_uidt_nl << be_nl; + + this->this_method (node); + + // The _interface_repository_id method. + *os << be_nl + << "virtual const char* _interface_repository_id " + << "(void) const;"; + + // Generate code for elements in the scope (e.g., operations). + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_interface_sh::" + "visit_interface - " + "codegen for scope failed\n"), + -1); + } + + // Generate skeletons for operations of our base classes. These + // skeletons just cast the pointer to the appropriate type + // before invoking the call. + int status = + node->traverse_inheritance_graph ( + be_interface::gen_skel_helper, + os + ); + + if (status == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_interface_sh::" + "visit_interface - " + "inheritance graph traversal failed\n"), + -1); + } + + *os << be_uidt_nl << "};"; be_visitor_context ctx (*this->ctx_); diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ss.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ss.cpp index f7db8a0ca0f..e3f63a051a7 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ss.cpp @@ -98,7 +98,7 @@ be_visitor_valuetype_ss::visit_valuetype (be_valuetype *node) *os << be_idt_nl << ": TAO_Abstract_ServantBase (rhs)," << be_nl - << " TAO_ServantBase (rhs)," << be_nl; + << " TAO_ServantBase (rhs)," << be_idt_nl; if (concrete->is_nested ()) { @@ -113,22 +113,8 @@ be_visitor_valuetype_ss::visit_valuetype (be_valuetype *node) *os << bd->full_skel_name () << " (rhs)," << be_nl; } - *os << " ValueBase (rhs)," << be_nl; - - if (node->is_nested ()) - { - AST_Decl *scope = ScopeAsDecl (node->defined_in ()); - - *os << " ACE_NESTED_CLASS (" << scope->name () << ", " - << node->local_name () << ") ()"; - } - else - { - be_interface *bd = be_interface::narrow_from_decl (node); - *os << bd->full_skel_name () << " ()"; - } - - *os << be_uidt_nl << "{}" << be_nl << be_nl; + *os << "ValueBase (rhs)" << be_uidt << be_uidt_nl + << "{}" << be_nl << be_nl; *os << full_skel_name << "::~" << local_name_prefix << node_local_name |