From 7ddd94a0159a234a2c31b4a1b07b7748b5114e0d Mon Sep 17 00:00:00 2001 From: parsons Date: Tue, 1 Apr 2003 07:03:13 +0000 Subject: ChangeLogTag: Tue Apr 1 000:37:21 2003 Jeff Parsons --- TAO/ChangeLog | 29 +++++++++++++ TAO/TAO_IDL/be/be_sequence.cpp | 3 +- TAO/TAO_IDL/be/be_type.cpp | 18 +++++++- TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp | 35 ---------------- .../interceptors_exceptlist.cpp | 3 +- TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp | 14 +++++-- TAO/TAO_IDL/be/be_visitor_valuetype/any_op_cs.cpp | 16 -------- TAO/TAO_IDL/be_include/be_type.h | 7 ++++ TAO/tao/DynamicAny/DynamicAny.pidl | 2 +- TAO/tao/DynamicAny/DynamicAnyC.cpp | 18 ++++++++ TAO/tao/Sequence_T.cpp | 48 ++++------------------ 11 files changed, 93 insertions(+), 100 deletions(-) diff --git a/TAO/ChangeLog b/TAO/ChangeLog index b63819fd3b6..3000cc12000 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,32 @@ +Tue Apr 1 000:37:21 2003 Jeff Parsons + + * TAO_IDL/be/be_sequence.cpp: + * TAO_IDL/be/be_type.cpp: + * TAO_IDL/be/be_visitor_interface/any_op_cs.cpp: + * TAO_IDL/be/be_visitor_operation/interceptors_exceptlist.cpp: + * TAO_IDL/be/be_type.cpp: + * TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp: + * TAO_IDL/be_include/be_type.h: + + Moved managed type template class generation from the Any + operator pass (which might be skipped if Any operator generation + is suppressed, or generated needlessly if the type is not used + in a sequence) to the sequence visitor. + + * tao/Sequence_T.cpp: + + Fixed code in TAO_Abstract_Manager that doesn't work with + forward declared abstract interfaces. + + * tao/DynamicAny/DynamicAny.pidl: + * tao/DynamicAny/DynamicAnyC.cpp: + + Regenerated hand-crafted DynamicAny.pidl files and changed comment + at the top of the .pidl file to show added options to the IDL + compiler command line to suppress Any operator and Typecode + generation. Although these types contain a Typecode, they do + not need Typecodes or Any operators of their own. + Mon Mar 31 22:31:47 2003 Jeff Parsons * TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp: diff --git a/TAO/TAO_IDL/be/be_sequence.cpp b/TAO/TAO_IDL/be/be_sequence.cpp index 1d505d590be..744049d7efb 100644 --- a/TAO/TAO_IDL/be/be_sequence.cpp +++ b/TAO/TAO_IDL/be/be_sequence.cpp @@ -111,8 +111,7 @@ be_sequence::gen_name (void) 0); } - // Some platforms define IDL sequences as template classes - // and some do not. If the nested sequence were defined in + // If the nested sequence were defined in // the scope of the enclosing sequence, we would have to // not only define the nested class in two places, but also // deal with the fact that, for the template classes, the diff --git a/TAO/TAO_IDL/be/be_type.cpp b/TAO/TAO_IDL/be/be_type.cpp index d46d7af7cd5..22a1d0f9ea0 100644 --- a/TAO/TAO_IDL/be/be_type.cpp +++ b/TAO/TAO_IDL/be/be_type.cpp @@ -34,7 +34,8 @@ ACE_RCSID (be, be_type::be_type (void) : tc_name_ (0), - common_varout_gen_ (0) + common_varout_gen_ (I_FALSE), + seen_in_sequence_ (I_FALSE) { } @@ -47,7 +48,8 @@ be_type::be_type (AST_Decl::NodeType nt, AST_Decl (nt, n), tc_name_ (0), - common_varout_gen_ (0) + common_varout_gen_ (I_FALSE), + seen_in_sequence_ (I_FALSE) { AST_Decl *parent = ScopeAsDecl (this->defined_in ()); Identifier *segment = 0; @@ -316,6 +318,18 @@ be_type::gen_common_tmplinst (TAO_OutStream *os) os->gen_endif_AHETI (); } +idl_bool +be_type::seen_in_sequence (void) const +{ + return this->seen_in_sequence_; +} + +void +be_type::seen_in_sequence (idl_bool val) +{ + this->seen_in_sequence_ = val; +} + AST_Decl::NodeType be_type::base_node_type (void) const { diff --git a/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp index 89199b1f70f..638e707822a 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp @@ -153,41 +153,6 @@ be_visitor_interface_any_op_cs::visit_interface (be_interface *node) << "}"; } - *os << be_nl << be_nl - << "#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) || \\" - << be_idt_nl - << " defined (ACE_HAS_GNU_REPO)" << be_nl; - - if (node->is_abstract ()) - { - *os << "template class TAO_Abstract_Manager<"; - } - else - { - *os << "template class TAO_Object_Manager<"; - } - - *os << node->full_name () << "," - << node->full_name () << "_var>;" << be_nl - << "template class TAO::Any_Impl_T<" << node->name () << ">;" - << be_uidt_nl - << "#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)" << be_nl; - - if (node->is_abstract ()) - { - *os << "# pragma instantiate TAO_Abstract_Manager<"; - } - else - { - *os << "# pragma instantiate TAO_Object_Manager<"; - } - - *os << node->full_name () << ", " - << node->full_name () << "_var>" << be_nl - << "# pragma instantiate TAO::Any_Impl_T<" << node->name () << ">" - << be_uidt_nl - << "#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */"; - // All we have to do is to visit the scope and generate code. if (!node->is_local ()) { diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_exceptlist.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_exceptlist.cpp index f60dd96d77d..47364de4493 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_exceptlist.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_exceptlist.cpp @@ -106,6 +106,7 @@ be_visitor_operation_interceptors_exceptlist::gen_exceptlist ( *os << be_uidt_nl << "};" << be_nl; long excp_count = (node->exceptions())->length (); + *os << be_nl << "exception_list->length (" << excp_count << ");" << be_nl << "for (CORBA::ULong i = 0; i < " << excp_count << "; ++i)" @@ -118,5 +119,5 @@ be_visitor_operation_interceptors_exceptlist::gen_exceptlist ( << "(*exception_list)[i] = tcp_object;" << be_uidt_nl << "}\n" << be_uidt; -return 0; + return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp index 56c2e03d43f..1e61cb91bbc 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp @@ -37,13 +37,20 @@ be_visitor_sequence_cs::~be_visitor_sequence_cs (void) int be_visitor_sequence_cs::visit_sequence (be_sequence *node) { - if (node->cli_stub_gen () || node->imported ()) + be_type *bt = be_type::narrow_from_decl (node->base_type ()); + + if (node->imported ()) + { + bt->seen_in_sequence (I_TRUE); + return 0; + } + + if (node->cli_stub_gen ()) { return 0; } TAO_OutStream *os = this->ctx_->stream (); - be_type *bt = be_type::narrow_from_decl (node->base_type ()); *os << be_nl << be_nl << "// TAO_IDL - Generated from " << be_nl << "// "__FILE__ << ":" << __LINE__; @@ -168,10 +175,11 @@ int be_visitor_sequence_cs::visit_sequence (be_sequence *node) } // If Any operators are generated, that code will take care of this. - if (!be_global->any_support ()) + if (!bt->seen_in_sequence ()) { // This is a no-op unless our element is a managed type. this->gen_managed_type_tmplinst (node, bt); + bt->seen_in_sequence (I_TRUE); } if (this->ctx_->tdef () != 0) diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/any_op_cs.cpp index 4aa2ef13718..04c1b914f5a 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/any_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/any_op_cs.cpp @@ -110,22 +110,6 @@ be_visitor_valuetype_any_op_cs::visit_valuetype (be_valuetype *node) << "return 1;" << be_uidt_nl << "}" << be_nl << be_nl; - *os << "#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) || \\" - << be_idt_nl - << " defined (ACE_HAS_GNU_REPO)" << be_nl - << "template class TAO_Valuetype_Manager<" - << node->full_name () << ", " - << node->full_name () << "_var>;" << be_nl - << "template class TAO::Any_Impl_T<" << node->full_name () - << ">;" << be_uidt_nl - << "#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)" << be_nl - << "# pragma instantiate TAO_Valuetype_Manager<" - << node->full_name () << ", " - << node->full_name () << "_var>" << be_nl - << "# pragma instantiate TAO::Any_Impl_T<" << node->full_name () - << ">" << be_uidt_nl - << "#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */"; - node->cli_stub_any_op_gen (1); return 0; } diff --git a/TAO/TAO_IDL/be_include/be_type.h b/TAO/TAO_IDL/be_include/be_type.h index 5f5d0bfea5c..cd653c08bca 100644 --- a/TAO/TAO_IDL/be_include/be_type.h +++ b/TAO/TAO_IDL/be_include/be_type.h @@ -63,6 +63,10 @@ public: void gen_common_tmplinst (TAO_OutStream *os); // Generate explicit template instantiations for the above. + idl_bool seen_in_sequence (void) const; + void seen_in_sequence (idl_bool val); + // Accessors for the member. + virtual AST_Decl::NodeType base_node_type (void) const; // Typedefs are tricky to handle, in many points their mapping // depend on base type they are aliasing. Since typedefs can be @@ -91,6 +95,9 @@ protected: idl_bool common_varout_gen_; // Have we generated our _var and _out class typedefs yet? + + idl_bool seen_in_sequence_; + // Has this type been used as a sequence element? }; #endif // end of if !defined diff --git a/TAO/tao/DynamicAny/DynamicAny.pidl b/TAO/tao/DynamicAny/DynamicAny.pidl index 09dc9b8e59c..44efe91babb 100644 --- a/TAO/tao/DynamicAny/DynamicAny.pidl +++ b/TAO/tao/DynamicAny/DynamicAny.pidl @@ -20,7 +20,7 @@ * The command used to generate code from this file is: * * tao_idl \ - * -o orig -Gp -Gd -Ge 1 \ + * -o orig -Gp -Gd -Ge 1 -Sa -St \ * -Wb,export_macro=TAO_DynamicAny_Export \ * -Wb,export_include=dynamicany_export.h \ * -Wb,pre_include="ace/pre.h" \ diff --git a/TAO/tao/DynamicAny/DynamicAnyC.cpp b/TAO/tao/DynamicAny/DynamicAnyC.cpp index 5f804c0f95e..2a0730f5778 100644 --- a/TAO/tao/DynamicAny/DynamicAnyC.cpp +++ b/TAO/tao/DynamicAny/DynamicAnyC.cpp @@ -1467,7 +1467,25 @@ DynamicAny::DynAnySeq::DynAnySeq (const DynAnySeq &seq) DynamicAny::DynAnySeq::~DynAnySeq (void) {} +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +template class + TAO_Object_Manager< + DynamicAny::DynAny, + DynamicAny::DynAny_var, + DynamicAny::tao_DynAny_life + >; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +# pragma instantiate \ + TAO_Object_Manager< \ + DynamicAny::DynAny, \ + DynamicAny::DynAny_var, \ + DynamicAny::tao_DynAny_life \ + > + +#endif /* !ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) diff --git a/TAO/tao/Sequence_T.cpp b/TAO/tao/Sequence_T.cpp index 2c7bbb97fce..a78e7aa8e10 100644 --- a/TAO/tao/Sequence_T.cpp +++ b/TAO/tao/Sequence_T.cpp @@ -636,23 +636,11 @@ TAO_Abstract_Manager::operator= ( if (this->release_) { - if (*this->ptr_ != 0) - { - (*this->ptr_)->_remove_ref (); - } - - *this->ptr_ = *rhs.ptr_; - - if (*this->ptr_ != 0) - { - (*this->ptr_)->_add_ref (); - } - } - else - { - *this->ptr_ = *rhs.ptr_; + T_life::tao_release (*this->ptr_); + T_life::tao_duplicate (*rhs->ptr_); } + *this->ptr_ = *rhs.ptr_; return *this; } @@ -666,18 +654,10 @@ TAO_Abstract_Manager::operator= (T * p) // that of a var variable. Therefore we will not duplicate the // user provided pointer before assigning it to the internal // variable. - if (*this->ptr_ != 0) - { - (*this->ptr_)->_remove_ref (); - } - - *this->ptr_ = p; - } - else - { - *this->ptr_ = p; + T_life::tao_release (*this->ptr_); } + *this->ptr_ = p; return *this; } @@ -691,23 +671,11 @@ TAO_Abstract_Manager::operator= (const T_var & p) // that of a var variable. Therefore we duplicate p's // pointer before assigning it to the internal // variable. - if (*this->ptr_ != 0) - { - (*this->ptr_)->_remove_ref (); - } - - *this->ptr_ = p.in (); - - if (p != 0) - { - p->_add_ref (); - } - } - else - { - *this->ptr_ = p.in (); + T_life::tao_release (*this->ptr_); + T_life::tao_duplicate (p.in ()); } + *this->ptr_ = p.in (); return *this; } -- cgit v1.2.1