diff options
author | Marijke Hengstmengel <MHengstmengel@users.noreply.github.com> | 2011-11-30 14:21:59 +0000 |
---|---|---|
committer | Marijke Hengstmengel <MHengstmengel@users.noreply.github.com> | 2011-11-30 14:21:59 +0000 |
commit | 2f45ff70da83419c788a34db5f02f020c5365090 (patch) | |
tree | d4f47505599d610d08a82b7ece62507b6a64bec9 | |
parent | 6dc115b50d07fdc65ddaacfd3b7bdc84b1b23edf (diff) | |
download | ATCD-2f45ff70da83419c788a34db5f02f020c5365090.tar.gz |
Wed Nov 30 14:19:10 UTC 2011 Marijke Hengstmengel <mhengstmengel@remedy.nl>
* TAO_IDL/be/be_codegen.cpp:
// remove debug info
* TAO_IDL/be/be_visitor_connector/facet_ami_exh.cpp:
* TAO_IDL/be/be_visitor_connector/facet_ami_exs.cpp:
* TAO_IDL/be_include/be_visitor_connector/facet_ami_exs.h:
Add visit_attribute functionality.
-rw-r--r-- | TAO/ChangeLog.BRANCH | 11 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_codegen.cpp | 4 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_connector/facet_ami_exh.cpp | 107 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_connector/facet_ami_exs.cpp | 105 | ||||
-rw-r--r-- | TAO/TAO_IDL/be_include/be_visitor_connector/facet_ami_exs.h | 1 |
5 files changed, 158 insertions, 70 deletions
diff --git a/TAO/ChangeLog.BRANCH b/TAO/ChangeLog.BRANCH index 315a7632f34..413c4e8448b 100644 --- a/TAO/ChangeLog.BRANCH +++ b/TAO/ChangeLog.BRANCH @@ -1,3 +1,12 @@ +Wed Nov 30 14:19:10 UTC 2011 Marijke Hengstmengel <mhengstmengel@remedy.nl> + + * TAO_IDL/be/be_codegen.cpp: + // remove debug info + * TAO_IDL/be/be_visitor_connector/facet_ami_exh.cpp: + * TAO_IDL/be/be_visitor_connector/facet_ami_exs.cpp: + * TAO_IDL/be_include/be_visitor_connector/facet_ami_exs.h: + Add visit_attribute functionality. + Tue Nov 29 12:59:03 UTC 2011 Marijke Hengstmengel <mhengstmengel@remedy.nl> * TAO_IDL/be/be_visitor_connector/facet_ami_exs.cpp: Correct check nil pointer in facet operation @@ -9,7 +18,7 @@ Mon Nov 28 15:26:03 UTC 2011 Marijke Hengstmengel <hengstmengel_m@remedy.nl> * TAO_IDL/be/be_visitor_connector/facet_ami_exs.cpp: * TAO_IDL/be_include/be_visitor_connector/facet_ami_exh.h: * TAO_IDL/be_include/be_visitor_connector/facet_ami_exs.h: - Add traverse_inheritance_graph, needed for derived interfaces + Add traverse_inheritance_graph, needed for derived interfaces Wed Nov 23 14:00:38 UTC 2011 Marijke Hengstmengel <hengstmengel_m@remedy.nl> diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp index 76e2ff24ef0..eca1e42fdeb 100644 --- a/TAO/TAO_IDL/be/be_codegen.cpp +++ b/TAO/TAO_IDL/be/be_codegen.cpp @@ -3371,9 +3371,9 @@ TAO_CodeGen::gen_exec_idl_includes (void) const char *exec_idl_fname = be_global->be_get_ciao_exec_idl_fname (true); - //mh cmp Base/HelloE.idl with Hello.idl ? + bool skip_incl = false; - // special case for ami4ccm, if xxxE.idl. don't inlude xxxAE.idl. + // special case for ami4ccm, if xxxE.idl. don't include xxxAE.idl. char *exe_idl_fname = ACE_OS::strdup(exec_idl_fname); char * base = ACE_OS::strstr(exe_idl_fname, "E.idl"); if (base != 0) diff --git a/TAO/TAO_IDL/be/be_visitor_connector/facet_ami_exh.cpp b/TAO/TAO_IDL/be/be_visitor_connector/facet_ami_exh.cpp index 9e117965e25..c91c885a114 100644 --- a/TAO/TAO_IDL/be/be_visitor_connector/facet_ami_exh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_connector/facet_ami_exh.cpp @@ -12,6 +12,8 @@ * @author Jeff Parsons */ //============================================================================= +#include "ast_generator.h" +#include "be_predefined_type.h" be_visitor_facet_ami_exh::be_visitor_facet_ami_exh ( be_visitor_context *ctx) @@ -78,12 +80,70 @@ be_visitor_facet_ami_exh::visit_provides (be_provides *node) int be_visitor_facet_ami_exh::visit_attribute (be_attribute *node) { - // Do something, do we come here? - os_ << be_nl_2 << "// TAO_IDL - Generated from be_visitor_facet_ami_exh::visit_attribute !!!!!!!!!!!!!!!!!!!!!!" << be_nl - << "// " << __FILE__ << ":" << __LINE__; - // Yes, we come here, to do :implement - return 0; + os_ << be_nl_2 << "// TAO_IDL - Generated from be_visitor_facet_ami_exh::visit_attribute" << be_nl + << "// " << __FILE__ << ":" << __LINE__; + + be_operation get_op (node->field_type (), + AST_Operation::OP_noflags, + node->name (), + 0, + 0); + + get_op.set_name ((UTL_IdList *) node->name ()->copy ()); + if (this->visit_operation (&get_op) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_facet_ami_exh::" + "visit_attribute - " + "codegen for get_attribute failed\n"), + -1); + } + get_op.destroy (); + + if (node->readonly ()) + { + // Nothing else to do. + return 0; + } + Identifier id ("void"); + UTL_ScopedName sn (&id, 0); + + // Create the return type, which is "void" + be_predefined_type rt (AST_PredefinedType::PT_void, &sn); + + // Argument type is the same as the attribute type. + AST_Argument *arg = + idl_global->gen ()->create_argument (AST_Argument::dir_IN, + node->field_type (), + node->name ()); + + arg->set_name ((UTL_IdList *) node->name ()->copy ()); + + // Create the operation. + be_operation set_op (&rt, + AST_Operation::OP_noflags, + node->name (), + 0, + 0); + + set_op.set_name ((UTL_IdList *) node->name ()->copy ()); + set_op.be_add_argument (arg); + + if (this->visit_operation (&set_op) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_facet_ami_exh::" + "visit_attribute - " + "codegen for set_attribute failed\n"), + -1); + } + + set_op.destroy (); + rt.destroy (); + + return 0; } + int be_visitor_facet_ami_exh::visit_operation (be_operation *node) { @@ -94,7 +154,9 @@ be_visitor_facet_ami_exh::visit_operation (be_operation *node) /// connector. We want to skip the CCM-related operations /// that were added to the connector since it's a component. /// We want only the facet interface operations. - if (d->node_type () != AST_Decl::NT_interface) + /// In case of sync. attribute operations we have a node_type NT_root + if ((d->node_type () != AST_Decl::NT_interface) && + (d->node_type () != AST_Decl::NT_root)) { return 0; } @@ -103,8 +165,6 @@ be_visitor_facet_ami_exh::visit_operation (be_operation *node) /// We're generating implementation operation declarations, /// so we can just use this visitor. - if (this->sync_) - this->ctx_->state (TAO_CodeGen::TAO_ROOT_IH); be_visitor_operation_ih v (this->ctx_); if (v.visit_operation (node) == -1) @@ -237,16 +297,6 @@ be_visitor_facet_ami_exh::gen_facet_executor_class (void) << "virtual ~" << iface_name << suffix << " (void);"; - /* if (this->visit_scope (this->iface_) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("be_visitor_connector_ami_exh") - ACE_TEXT ("::gen_facet_executor_class - ") - ACE_TEXT ("visit_scope() on sendc ") - ACE_TEXT ("interface failed\n")), - -1); - } -*/ ACE_CString handler_str ( ScopeAsDecl (this->iface_->defined_in ())->full_name ()); @@ -269,7 +319,6 @@ be_visitor_facet_ami_exh::gen_facet_executor_class (void) delete sn; sn = 0; - be_interface *sync_iface = be_interface::narrow_from_decl (d); @@ -356,25 +405,9 @@ Facet_AMI_ExecH_Op_Attr_Generator::Facet_AMI_ExecH_Op_Attr_Generator ( } int -Facet_AMI_ExecH_Op_Attr_Generator::emit (be_interface * derived_interface, - TAO_OutStream * os, +Facet_AMI_ExecH_Op_Attr_Generator::emit (be_interface * /*derived_interface*/, + TAO_OutStream * /*os*/, be_interface * base_interface) { - /*be_visitor_context ctx; - ctx.stream (os); - ctx.state (TAO_CodeGen::TAO_ROOT_IH); - AST_Decl::NodeType nt = derived_interface->node_type(); - if (nt == AST_Decl::NT_attr) - { - AST_Decl *d = derived_interface; - be_attribute *attr = be_attribute::narrow_from_decl (d); - be_visitor_attribute v (&ctx); - v.op_scope (derived_interface); - v.visit_attribute (attr); - return 0; - - } - else -*/ return visitor_->visit_scope (base_interface); } diff --git a/TAO/TAO_IDL/be/be_visitor_connector/facet_ami_exs.cpp b/TAO/TAO_IDL/be/be_visitor_connector/facet_ami_exs.cpp index c02e4a22565..e50c340f3d6 100644 --- a/TAO/TAO_IDL/be/be_visitor_connector/facet_ami_exs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_connector/facet_ami_exs.cpp @@ -11,6 +11,9 @@ * @author Jeff Parsons */ //============================================================================= +#include "ast_generator.h" +#include "be_predefined_type.h" + be_visitor_facet_ami_exs::be_visitor_facet_ami_exs ( be_visitor_context *ctx) @@ -71,24 +74,88 @@ be_visitor_facet_ami_exs::visit_provides (be_provides *node) int be_visitor_facet_ami_exs::visit_attribute (be_attribute *node) { - // Do something, do we come here? - os_ << be_nl_2 << "// TAO_IDL - Generated from be_visitor_facet_ami_exs::visit_attribute !!!!!!!!!!!!!!!!!!!!!!" << be_nl + os_ << be_nl_2 << "// TAO_IDL - Generated from be_visitor_facet_ami_exs::visit_attribute" << be_nl << "// " << __FILE__ << ":" << __LINE__; - // Yes, we come here! to do : implement - os_ << "// name = " << node->local_name()->get_string (); + + be_operation get_op (node->field_type (), + AST_Operation::OP_noflags, + node->name (), + 0, + 0); + get_op.set_name ((UTL_IdList *) node->name ()->copy ()); + if (this->visit_operation (&get_op) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_facet_ami_exs::" + "visit_attribute - " + "codegen for get_attribute failed\n"), + -1); + } + + get_op.destroy (); + + if (node->readonly ()) + { + // Nothing else to do. + return 0; + } + Identifier id ("void"); + UTL_ScopedName sn (&id, 0); + + // Create the return type, which is "void" + be_predefined_type rt (AST_PredefinedType::PT_void, &sn); + + // Argument type is the same as the attribute type. + AST_Argument *arg = + idl_global->gen ()->create_argument (AST_Argument::dir_IN, + node->field_type (), + node->name ()); + + arg->set_name ((UTL_IdList *) node->name ()->copy ()); + + // Create the operation. + be_operation set_op (&rt, + AST_Operation::OP_noflags, + node->name (), + 0, + 0); + + set_op.set_name ((UTL_IdList *) node->name ()->copy ()); + set_op.be_add_argument (arg); + + if (this->visit_operation (&set_op) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_facet_ami_exs::" + "visit_attribute - " + "codegen for set_attribute failed\n"), + -1); + } + + set_op.destroy (); + rt.destroy (); return 0; } + int be_visitor_facet_ami_exs::visit_operation (be_operation *node) { AST_Decl *d = ScopeAsDecl (node->defined_in ()); + os_ << "// visit_operatio " << be_nl; /// We end up here also from the visit_scope() call on the /// connector. We want to skip the CCM-related operations /// that were added to the connector since it's a component. /// We want only the facet interface operations. + + // Coming for sync attribute operations, node_type is NT_root + if (d->node_type () == AST_Decl::NT_root) + { + return gen_facet_executor_sync_op (node); + } + if (d->node_type () != AST_Decl::NT_interface) { return 0; @@ -112,7 +179,7 @@ be_visitor_facet_ami_exs::visit_operation (be_operation *node) return this->gen_facet_executor_op (node); } else - return 0; + return 0; } int @@ -165,11 +232,8 @@ be_visitor_facet_ami_exs::init (void) be_interface *callback_iface = be_interface::narrow_from_decl (d); -//mh if (callback_iface == 0) - { - this->sync_ = true; - } + this->sync_ = true; else this->sync_ = false; @@ -294,17 +358,6 @@ be_visitor_facet_ami_exs::gen_facet_executor_class (void) << "{" << be_nl << "}"; - -/* if (this->visit_scope (this->iface_) == -1) - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("be_visitor_connector_ami_exs") - ACE_TEXT ("::gen_reply_handler_class - ") - ACE_TEXT ("visit_scope() on sendc ") - ACE_TEXT ("interface failed\n"))); - } -*/ - ACE_CString handler_str ( ScopeAsDecl (this->iface_->defined_in ())->full_name ()); ACE_CString tmp (this->iface_->local_name ()); @@ -616,7 +669,7 @@ be_visitor_facet_ami_exs::gen_facet_executor_sync_op (be_operation *node) if (node->is_sendc_ami()) return 0; - // STEP I: generate the return type. + // generate the return type. be_type *bt = be_type::narrow_from_decl (node->return_type ()); if (!bt) @@ -630,7 +683,6 @@ be_visitor_facet_ami_exs::gen_facet_executor_sync_op (be_operation *node) // Grab the right visitor to generate the return type. be_visitor_operation_rettype oro_visitor (this->ctx_); - // grab the right visitor to generate the return type if (bt->accept (&oro_visitor) == -1) { @@ -641,7 +693,6 @@ be_visitor_facet_ami_exs::gen_facet_executor_sync_op (be_operation *node) -1); } - os_ << be_nl << this->iface_->local_name () << "_exec_i::" << node->local_name (); @@ -662,11 +713,7 @@ be_visitor_facet_ami_exs::gen_facet_executor_sync_op (be_operation *node) bool global = (scope->node_type () == AST_Decl::NT_root); const char *smart_scope = (global ? "" : "::"); - // const char *prefix = "CCM_"; ACE_CString iface_str (this->iface_->local_name ()); - // ACE_CString orig_iface_str ( - // iface_str.substr (ACE_OS::strlen (prefix))); - // const char *orig_iface_name = orig_iface_str.c_str (); const char *orig_iface_name = iface_str.c_str (); os_ << be_nl << "{" << be_idt_nl; @@ -727,8 +774,8 @@ Facet_AMI_Exec_Op_Attr_Generator::Facet_AMI_Exec_Op_Attr_Generator ( } int -Facet_AMI_Exec_Op_Attr_Generator::emit (be_interface * /*derived_interface */, - TAO_OutStream * /* os */, +Facet_AMI_Exec_Op_Attr_Generator::emit (be_interface * /*derived_interface*/, + TAO_OutStream * /*os*/ , be_interface * base_interface) { return visitor_->visit_scope (base_interface); diff --git a/TAO/TAO_IDL/be_include/be_visitor_connector/facet_ami_exs.h b/TAO/TAO_IDL/be_include/be_visitor_connector/facet_ami_exs.h index 4a61d2271f5..95fb47a81ea 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_connector/facet_ami_exs.h +++ b/TAO/TAO_IDL/be_include/be_visitor_connector/facet_ami_exs.h @@ -39,7 +39,6 @@ public: virtual int visit_argument (be_argument *node); virtual int visit_attribute (be_attribute *node); - virtual int post_process (be_decl *node); private: |