diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2010-12-03 18:16:13 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2010-12-03 18:16:13 +0000 |
commit | 4eca127edb40a445060d89ed48be25079f03f5e3 (patch) | |
tree | b1cadb66a706526c1c67b8011e61614414fd8b94 | |
parent | 8ca68c433253aeecf5011a9a1b5f52ce630c82c7 (diff) | |
download | ATCD-4eca127edb40a445060d89ed48be25079f03f5e3.tar.gz |
ChangeLogTag: Fri Dec 3 18:13:01 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu>
5 files changed, 82 insertions, 63 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 8392c012eb2..3911dcc9883 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,17 @@ +Fri Dec 3 18:13:01 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu> + + * TAO_IDL/be/be_visitor_component/component_ami_rh_exs.cpp: + * TAO_IDL/be/be_visitor_component/component_ami_rh_ex_base.cpp: + * TAO_IDL/be/be_visitor_component/component_ami_rh_exh.cpp: + * TAO_IDL/be_include/be_visitor_component/component_ami_rh_ex_base.h: + + Modified generation of AMI4CCM reply handler implementation + class to include the port name in the constructed class + name. This change eliminates redefinition errors when + a component has more than one AMI receptacle that uses + the same interface. The application developer can give + each of these reply handlers a unique behavior if desired. + Fri Dec 3 16:10:08 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu> * TAO_IDL/be/be_codegen.cpp: diff --git a/TAO/TAO_IDL/be/be_visitor_component/component_ami_rh_ex_base.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_ami_rh_ex_base.cpp index 8d4ca76849b..8e4d70d6e59 100644 --- a/TAO/TAO_IDL/be/be_visitor_component/component_ami_rh_ex_base.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component/component_ami_rh_ex_base.cpp @@ -17,11 +17,7 @@ be_visitor_component_ami_rh_ex_base::be_visitor_component_ami_rh_ex_base ( be_visitor_context *ctx) : be_visitor_scope (ctx), iface_ (0), - scope_name_ (0), - iface_name_ (0), - smart_scope_ (0), - prefix_ ("AMI4CCM_"), - suffix_ ("ReplyHandler") + port_ (0) { } @@ -55,14 +51,22 @@ be_visitor_component_ami_rh_ex_base::init (void) { UTL_Scope *s = this->iface_->defined_in (); AST_Decl *scope = ScopeAsDecl (s); - this->scope_name_ = scope->full_name (); bool global = (scope->node_type () == AST_Decl::NT_root); - this->smart_scope_ = (global ? "" : "::"); - this->iface_name_ = - this->iface_->original_local_name ()->get_string (); - this->class_name_ = ACE_CString (this->prefix_) - + this->iface_name_ - + this->suffix_; + const char *smart_scope = (global ? "" : "::"); + + ACE_CString base ("AMI4CCM_"); + base += this->iface_->original_local_name ()->get_string (); + base += "ReplyHandler"; + + this->base_class_name_ = scope->full_name (); + this->base_class_name_ += smart_scope; + this->base_class_name_ += base; + + this->class_name_ = base; + this->class_name_ += '_'; + this->class_name_ += + this->port_->original_local_name ()->get_string (); + this->class_name_ += "_i"; } void @@ -76,7 +80,7 @@ be_visitor_component_ami_rh_ex_base::gen_excep_op ( if (for_defn) { - os_ << this->class_name_ << "_i::"; + os_ << this->class_name_ << "::"; } os_ << prefix << node->local_name ()->get_string () @@ -104,7 +108,7 @@ be_visitor_component_ami_rh_ex_base::gen_attr_op ( if (for_defn) { - os_ << this->class_name_ << "_i::"; + os_ << this->class_name_ << "::"; } os_ << "get_" << node->local_name ()->get_string () @@ -145,7 +149,7 @@ be_visitor_component_ami_rh_ex_base::gen_attr_op ( if (for_defn) { - os_ << this->class_name_ << "_i::"; + os_ << this->class_name_ << "::"; } os_ << "set_" << node->local_name ()->get_string () diff --git a/TAO/TAO_IDL/be/be_visitor_component/component_ami_rh_exh.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_ami_rh_exh.cpp index eb80e91432b..12d081fe174 100644 --- a/TAO/TAO_IDL/be/be_visitor_component/component_ami_rh_exh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component/component_ami_rh_exh.cpp @@ -26,6 +26,8 @@ be_visitor_component_ami_rh_exh::~be_visitor_component_ami_rh_exh (void) int be_visitor_component_ami_rh_exh::visit_uses (be_uses *node) { + this->port_ = node; + this->iface_ = be_interface::narrow_from_decl (node->uses_type ()); @@ -33,15 +35,12 @@ be_visitor_component_ami_rh_exh::visit_uses (be_uses *node) os_ << be_nl_2 << "class " << this->export_macro_.c_str () << " " - << this->class_name_ << "_i" << be_idt_nl - << ": public ::" << this->scope_name_ << this->smart_scope_ - << this->class_name_ << be_uidt_nl + << this->class_name_ << be_idt_nl + << ": public ::" << this->base_class_name_ << be_uidt_nl << "{" << be_nl << "public:" << be_idt_nl - << this->prefix_ << this->iface_name_ << this->suffix_ - << "_i (void);" << be_nl - << "virtual ~" << this->prefix_ << this->iface_name_ - << this->suffix_ << "_i (void);"; + << this->class_name_ << " (void);" << be_nl + << "virtual ~" << this->class_name_ << " (void);"; /// This overload of traverse_inheritance_graph() used here /// doesn't automatically prime the queues. @@ -115,46 +114,49 @@ be_visitor_component_ami_rh_exh::visit_operation ( if (count == 0 && vrt) { os_ << "void);"; - - return 0; } - - os_ << be_idt_nl; - - if (!vrt) + else { - be_visitor_operation_rettype rt_visitor (this->ctx_); - be_decl *rt = - be_decl::narrow_from_decl (node->return_type ()); + os_ << be_idt_nl; - if (rt->accept (&rt_visitor) == -1) + if (!vrt) { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("be_visitor_component_ami_rh_exh") - ACE_TEXT ("::visit_operation - ") - ACE_TEXT ("return type arg gen failed\n")), - -1); + be_visitor_operation_rettype rt_visitor (this->ctx_); + be_decl *rt = + be_decl::narrow_from_decl (node->return_type ()); + + if (rt->accept (&rt_visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_component") + ACE_TEXT ("_ami_rh_exh") + ACE_TEXT ("::visit_operation - ") + ACE_TEXT ("return type arg") + ACE_TEXT (" gen failed\n")), + -1); + } + + os_ << " ami_return_val"; + + if (count != 0) + { + os_ << "," << be_nl; + } } - os_ << " ami_return_val"; - - if (count != 0) + if (this->visit_scope (node) == -1) { - os_ << "," << be_nl; + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_component") + ACE_TEXT ("_ami_rh_exh") + ACE_TEXT ("::visit_operation - ") + ACE_TEXT ("visit_scope() failed\n")), + -1); } - } - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("be_visitor_component_ami_rh_exh") - ACE_TEXT ("::visit_operation - ") - ACE_TEXT ("visit_scope() failed\n")), - -1); + os_ << ");" << be_uidt; } - os_ << ");" << be_uidt; - this->gen_excep_op ("", node, false); return 0; diff --git a/TAO/TAO_IDL/be/be_visitor_component/component_ami_rh_exs.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_ami_rh_exs.cpp index fde0e86a289..9fa3790613c 100644 --- a/TAO/TAO_IDL/be/be_visitor_component/component_ami_rh_exs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component/component_ami_rh_exs.cpp @@ -27,20 +27,22 @@ be_visitor_component_ami_rh_exs::~be_visitor_component_ami_rh_exs (void) int be_visitor_component_ami_rh_exs::visit_uses (be_uses *node) { + this->port_ = node; + this->iface_ = be_interface::narrow_from_decl (node->uses_type ()); this->init (); os_ << be_nl_2 - << this->prefix_ << this->iface_name_ << this->suffix_ << "_i" << "::" - << this->prefix_ << this->iface_name_ << this->suffix_ << "_i" << " (void)" << be_nl + << this->class_name_ << "::" + << this->class_name_ << " (void)" << be_nl << "{" << be_nl << "}"; os_ << be_nl_2 - << this->prefix_ << this->iface_name_ << this->suffix_ << "_i" << "::~" - << this->prefix_ << this->iface_name_ << this->suffix_ << "_i" << " (void)" << be_nl + << this->class_name_ << "::~" + << this->class_name_ << " (void)" << be_nl << "{" << be_nl << "}"; @@ -99,8 +101,8 @@ be_visitor_component_ami_rh_exs::visit_operation ( os_ << be_nl_2 << "void" << be_nl - << this->class_name_ << "_i" - << "::" << node->local_name ()->get_string () + << this->class_name_ << "::" + << node->local_name ()->get_string () << " ("; int count = @@ -150,7 +152,7 @@ be_visitor_component_ami_rh_exs::visit_operation ( -1); } - if (count != 0 || vrt) + if (count != 0 || ! vrt) { os_ << ")" << be_uidt; } diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/component_ami_rh_ex_base.h b/TAO/TAO_IDL/be_include/be_visitor_component/component_ami_rh_ex_base.h index c9cb3c3a294..d6d2ba2c7a3 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_component/component_ami_rh_ex_base.h +++ b/TAO/TAO_IDL/be_include/be_visitor_component/component_ami_rh_ex_base.h @@ -48,12 +48,9 @@ protected: protected: be_interface *iface_; - const char *scope_name_; - const char *iface_name_; - const char *smart_scope_; - const char *prefix_; - const char *suffix_; + be_uses *port_; ACE_CString class_name_; + ACE_CString base_class_name_; }; // ====================================================== |