From c3f712928c0f7e439e45b0c862efed4c680ef6b3 Mon Sep 17 00:00:00 2001 From: Ossama Othman Date: Fri, 18 Mar 2005 08:56:25 +0000 Subject: *** empty log message *** --- TAO/TAO_IDL/be/be_visitor_typecode.cpp | 1 + .../be/be_visitor_typecode/typecode_defn.cpp | 60 +++++++++++----------- .../be/be_visitor_typecode/union_typecode.cpp | 28 +++++++--- TAO/TAO_IDL/be_include/be_visitor_typecode.h | 1 + .../be_include/be_visitor_typecode/typecode_defn.h | 2 +- 5 files changed, 53 insertions(+), 39 deletions(-) diff --git a/TAO/TAO_IDL/be/be_visitor_typecode.cpp b/TAO/TAO_IDL/be/be_visitor_typecode.cpp index 3ff1f795d96..f4bf6396eb0 100644 --- a/TAO/TAO_IDL/be/be_visitor_typecode.cpp +++ b/TAO/TAO_IDL/be/be_visitor_typecode.cpp @@ -52,6 +52,7 @@ #include "be_visitor_typecode/enum_typecode.cpp" #include "be_visitor_typecode/objref_typecode.cpp" #include "be_visitor_typecode/struct_typecode.cpp" +#include "be_visitor_typecode/union_typecode.cpp" #include "be_visitor_typecode/value_typecode.cpp" diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp index a5bc4e7f15b..1e3b1173d09 100644 --- a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp +++ b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp @@ -776,37 +776,37 @@ be_visitor_typecode_defn::visit_string (be_string *node) // -1); // } -int -be_visitor_typecode_defn::visit_union (be_union *node) -{ - switch (this->ctx_->sub_state ()) - { - case TAO_CodeGen::TAO_TC_DEFN_TYPECODE: - return this->visit_type (node); - case TAO_CodeGen::TAO_TC_DEFN_TYPECODE_NESTED: - return this->gen_typecode (node); - case TAO_CodeGen::TAO_TC_DEFN_ENCAPSULATION: - return this->gen_encapsulation (node); - case TAO_CodeGen::TAO_TC_DEFN_TC_SIZE: - this->computed_tc_size_ = this->compute_tc_size (node); - return ((this->computed_tc_size_ > 0) ? 0 : -1); - case TAO_CodeGen::TAO_TC_DEFN_ENCAP_LEN: - this->computed_encap_len_ = this->compute_encap_length (node); - return ((this->computed_encap_len_ > 0) ? 0 : -1); - case TAO_CodeGen::TAO_TC_DEFN_SCOPE: - case TAO_CodeGen::TAO_TC_DEFN_SCOPE_LEN: -// return this->visit_members (node); - default: - // error - break; - } +// int +// be_visitor_typecode_defn::visit_union (be_union *node) +// { +// switch (this->ctx_->sub_state ()) +// { +// case TAO_CodeGen::TAO_TC_DEFN_TYPECODE: +// return this->visit_type (node); +// case TAO_CodeGen::TAO_TC_DEFN_TYPECODE_NESTED: +// return this->gen_typecode (node); +// case TAO_CodeGen::TAO_TC_DEFN_ENCAPSULATION: +// return this->gen_encapsulation (node); +// case TAO_CodeGen::TAO_TC_DEFN_TC_SIZE: +// this->computed_tc_size_ = this->compute_tc_size (node); +// return ((this->computed_tc_size_ > 0) ? 0 : -1); +// case TAO_CodeGen::TAO_TC_DEFN_ENCAP_LEN: +// this->computed_encap_len_ = this->compute_encap_length (node); +// return ((this->computed_encap_len_ > 0) ? 0 : -1); +// case TAO_CodeGen::TAO_TC_DEFN_SCOPE: +// case TAO_CodeGen::TAO_TC_DEFN_SCOPE_LEN: +// // return this->visit_members (node); +// default: +// // error +// break; +// } - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("(%N:%l) be_visitor_typecode_defn::") - ACE_TEXT ("visit - bad sub state ") - ACE_TEXT ("in visitor context\n")), - -1); -} +// ACE_ERROR_RETURN ((LM_ERROR, +// ACE_TEXT ("(%N:%l) be_visitor_typecode_defn::") +// ACE_TEXT ("visit - bad sub state ") +// ACE_TEXT ("in visitor context\n")), +// -1); +// } // int // be_visitor_typecode_defn::visit_valuetype (be_valuetype *node) diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/union_typecode.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/union_typecode.cpp index 783bd55d0ed..18b00194d7b 100644 --- a/TAO/TAO_IDL/be/be_visitor_typecode/union_typecode.cpp +++ b/TAO/TAO_IDL/be/be_visitor_typecode/union_typecode.cpp @@ -35,8 +35,20 @@ TAO::be_visitor_union_typecode::visit_union (be_union * node) std::string const fields_name (std::string ("_tao_cases_") + node->flat_name ()); - // Generate array containing union case characteristics. - os << "static TAO::TypeCode::Case const " + + be_type * const discriminant_type = + be_type::narrow_from_decl (node->disc_type ()); + + ACE_ASSERT (discriminant_type != 0); + + std::string const case_array_type ( + std::string ("TAO::TypeCode::Non_Default_Case<") + + std::string (discriminant_type->full_name ()) + + std::string (", char const *>")); + + // Generate array containing union non-default case + // characteristics. + os << "static " << case_array_type.c_str () << " const " << fields_name.c_str () << "[] =" << be_idt_nl << "{" << be_idt_nl; @@ -50,18 +62,18 @@ TAO::be_visitor_union_typecode::visit_union (be_union * node) // Generate the TypeCode instantiation. os << "static TAO::TypeCode::Union const *," << be_nl - << " TAO::Null_RefCount_Policy> const" + << " " << case_array_type.c_str () << " const *," << be_nl + << " TAO::Null_RefCount_Policy> const" << be_idt_nl << "_tao_tc_" << node->flat_name () << " (" << be_idt_nl << "\"" << node->repoID () << "\"," << be_nl << "\"" << node->original_local_name () << "\"," << be_nl - << node->disc_type ()->tc_name () << "," << be_nl + << discriminant_type->tc_name () << "," << be_nl << "_tao_cases_" << node->flat_name () << "," << be_nl << node->nfields () << "," - << node->default_index () "," << be_nl - << default_member_name, - << default_member_type + << node->default_index () << "," << be_nl +// << default_member_name, +// << default_member_type << ");" << be_uidt_nl << be_uidt_nl; diff --git a/TAO/TAO_IDL/be_include/be_visitor_typecode.h b/TAO/TAO_IDL/be_include/be_visitor_typecode.h index 1132de3cbb7..ae49fe87a1f 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_typecode.h +++ b/TAO/TAO_IDL/be_include/be_visitor_typecode.h @@ -32,6 +32,7 @@ #include "be_visitor_typecode/enum_typecode.h" #include "be_visitor_typecode/objref_typecode.h" #include "be_visitor_typecode/struct_typecode.h" +#include "be_visitor_typecode/union_typecode.h" #include "be_visitor_typecode/value_typecode.h" diff --git a/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_defn.h b/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_defn.h index d9674eef9f3..9223716eeb1 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_defn.h +++ b/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_defn.h @@ -89,7 +89,7 @@ public: // virtual int visit_structure (be_structure *node); // visit a structure - virtual int visit_union (be_union *node); +// virtual int visit_union (be_union *node); // visit a union // virtual int visit_valuetype (be_valuetype *node); -- cgit v1.2.1