From a4f5ae7fb37a55e0b5ccf0f473057df395688eee Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Mon, 28 Feb 2005 18:58:41 +0000 Subject: ChangeLogTag: Mon Feb 28 18:57:12 UTC 2005 Johnny Willemsen --- TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_cs.cpp | 5 +- TAO/TAO_IDL/be/be_visitor_valuetype/marshal_cs.cpp | 36 +++++++------- .../be/be_visitor_valuetype/valuetype_ch.cpp | 58 +++++++++++----------- .../be/be_visitor_valuetype/valuetype_cs.cpp | 9 ++-- .../be/be_visitor_valuetype/valuetype_obv_ch.cpp | 24 ++++----- .../be/be_visitor_valuetype/valuetype_obv_cs.cpp | 22 ++++---- TAO/tao/Valuetype/ValueBase.cpp | 2 +- TAO/tao/Valuetype/ValueBase.h | 4 +- 8 files changed, 79 insertions(+), 81 deletions(-) diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_cs.cpp index 2bb5674fb48..96a21c4430a 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_cs.cpp @@ -74,7 +74,7 @@ be_visitor_valuetype_cdr_op_cs::visit_valuetype (be_valuetype *node) // Set the sub state as generating code for the output operator. this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_OUTPUT); - + *os << "CORBA::Boolean" << be_nl << "operator<< (" << be_idt << be_idt_nl << "TAO_OutputCDR &strm," << be_nl @@ -85,8 +85,7 @@ be_visitor_valuetype_cdr_op_cs::visit_valuetype (be_valuetype *node) *os << "return" << be_idt_nl << "CORBA::ValueBase::_tao_marshal (" << be_idt << be_idt_nl << "strm," << be_nl - << "const_cast<" << node->full_name () - << " *> (_tao_valuetype)," << be_nl + << "_tao_valuetype," << be_nl << "reinterpret_cast (&" << node->full_name () << "::_downcast)" << be_uidt_nl diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/marshal_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/marshal_cs.cpp index 442017f72d6..1b5c3ea9979 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/marshal_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/marshal_cs.cpp @@ -19,8 +19,8 @@ // // ============================================================================ -ACE_RCSID (be_visitor_valuetype, - marshal_cs, +ACE_RCSID (be_visitor_valuetype, + marshal_cs, "$Id$") be_visitor_valuetype_marshal_cs::be_visitor_valuetype_marshal_cs ( @@ -57,8 +57,8 @@ be_visitor_valuetype_marshal_cs::visit_valuetype (be_valuetype *node) { *os << "strm"; } - - *os << ")" << be_nl + + *os << ") const" << be_nl << "{" << be_idt_nl; if (inh) @@ -93,11 +93,11 @@ be_visitor_valuetype_marshal_cs::visit_valuetype (be_valuetype *node) *os << "return (" << be_idt << be_idt_nl; // All we have to do is to visit the scope and generate code. - this->gen_fields (node, + this->gen_fields (node, *this->ctx_); - *os << be_uidt_nl - << ");" << be_uidt << be_uidt_nl + *os << be_uidt_nl + << ");" << be_uidt << be_uidt_nl << "}" << be_nl << be_nl; // Set the substate as generating code for the input operator. @@ -108,14 +108,14 @@ be_visitor_valuetype_marshal_cs::visit_valuetype (be_valuetype *node) this->class_name (node, os); *os << "::_tao_unmarshal_state (TAO_InputCDR &"; - + // If the valuetype has no fields, and no stateful inherit, // the stream arg is unused. if (inh != 0 || node->data_members_count () > 0) { *os << "strm"; } - + *os << ")" << be_nl << "{" << be_idt_nl; @@ -129,7 +129,7 @@ be_visitor_valuetype_marshal_cs::visit_valuetype (be_valuetype *node) *os << "::_tao_unmarshal_state (strm))" << be_idt_nl << "{" << be_idt_nl - << "return 0;" << be_uidt_nl + << "return false;" << be_uidt_nl << "}" << be_uidt_nl << be_nl; } else // only can access base class via virtual function @@ -138,7 +138,7 @@ be_visitor_valuetype_marshal_cs::visit_valuetype (be_valuetype *node) << inh->flat_name () << " (strm))" << be_idt_nl << "{" << be_idt_nl - << "return 0;" << be_uidt_nl + << "return false;" << be_uidt_nl << "}" << be_uidt_nl << be_nl; } } @@ -149,11 +149,11 @@ be_visitor_valuetype_marshal_cs::visit_valuetype (be_valuetype *node) *os << "return (" << be_idt_nl; // All we have to do is to visit the scope and generate code. - this->gen_fields (node, + this->gen_fields (node, *this->ctx_); - *os << be_uidt_nl - << ");" << be_uidt << be_uidt_nl + *os << be_uidt_nl + << ");" << be_uidt << be_uidt_nl << "}"; return 0; @@ -171,7 +171,7 @@ be_visitor_valuetype_marshal_cs::class_name (be_valuetype *node, { if (node->opt_accessor ()) { - be_decl *scope = + be_decl *scope = be_scope::narrow_from_scope (node->defined_in ())->decl (); *os << "ACE_NESTED_CLASS (" @@ -204,7 +204,7 @@ be_visitor_valuetype_marshal_cs::gen_fields (be_valuetype *node, { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_scope::visit_scope - " - "bad node in this scope\n"), + "bad node in this scope\n"), -1); } @@ -227,7 +227,7 @@ be_visitor_valuetype_marshal_cs::gen_fields (be_valuetype *node, ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_valuetype_marshal_cs::" "visit_valuetype - " - "codegen for scope failed\n"), + "codegen for scope failed\n"), -1); } } @@ -235,7 +235,7 @@ be_visitor_valuetype_marshal_cs::gen_fields (be_valuetype *node, if (n_processed == 0) { - *os << "1"; + *os << "true"; } return 0; diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp index 1b554882495..2764662cb38 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp @@ -20,8 +20,8 @@ // // ============================================================================ -ACE_RCSID (be_visitor_valuetype, - valuetype_ch, +ACE_RCSID (be_visitor_valuetype, + valuetype_ch, "$Id$") // ****************************************************** @@ -57,7 +57,7 @@ be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node) // Now the valuetype definition itself. os->gen_ifdef_macro (node->flat_name ()); - + if (node->node_type () == AST_Decl::NT_eventtype) { *os << be_nl << be_nl @@ -124,12 +124,12 @@ be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node) ** changes required for this (n the *C.h file) are: ** 2.1) Generate the raise_method as non-abstract and provide a ** definition in place - ** 2.2) Generate a new constructor that takes in a + ** 2.2) Generate a new constructor that takes in a CORBA::Exception* - ** 2.3) Make the destructor public (instead of protected) + ** 2.3) Make the destructor public (instead of protected) ** 2.4) Generate a private CORBA::Exception* field. - ** 2.5) Generate the tao_marshal and tao_unmarshal methods as - ** non-abstarct. + ** 2.5) Generate the tao_marshal and tao_unmarshal methods as + ** non-abstarct. ** 2.6) Generate the right throw spec for the AMH ExceptionHolders ************************************************************************/ @@ -168,8 +168,8 @@ be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node) *os << "public virtual CORBA::ValueBase"; } - - // Generate the supported interfaces. + + // Generate the supported interfaces. for (i = 0; i < node->n_supports (); ++i) { *os << "," << be_nl @@ -178,10 +178,10 @@ be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node) } // Generate the body. - *os << be_uidt << be_uidt_nl + *os << be_uidt << be_uidt_nl << "{" << be_nl << "public:" << be_idt_nl - << "typedef " << node->local_name () << "_var _var_type;" + << "typedef " << node->local_name () << "_var _var_type;" << be_nl << be_nl; if (is_an_amh_exception_holder) @@ -190,7 +190,7 @@ be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node) *os << node->local_name () << " (CORBA::Exception *ex)" << be_idt_nl << ": exception (ex)" << be_uidt_nl << "{}" << be_nl << be_nl - << "virtual ~" << node->local_name () << " (void);" + << "virtual ~" << node->local_name () << " (void);" << be_nl << be_nl; } @@ -246,7 +246,7 @@ be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node) << "// " << __FILE__ << ":" << __LINE__; // If we inherit from CORBA::Object and/or CORBA::AbstractBase - // (in addition to CORBA::ValueBase) we have to add these + // (in addition to CORBA::ValueBase) we have to add these // to avoid ambiguity. if (node->n_supports () > 0) { @@ -264,7 +264,7 @@ be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node) if (!is_an_amh_exception_holder) { - *os << "virtual ~" << node->local_name () << " (void);" + *os << "virtual ~" << node->local_name () << " (void);" << be_nl << be_nl; } @@ -272,7 +272,7 @@ be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node) if (!node->is_abstract () && !is_an_amh_exception_holder) { *os << "virtual CORBA::Boolean " - << "_tao_marshal_v (TAO_OutputCDR &);" << be_nl; + << "_tao_marshal_v (TAO_OutputCDR &) const;" << be_nl; *os << "virtual CORBA::Boolean " << "_tao_unmarshal_v (TAO_InputCDR &);" << be_nl; } @@ -280,7 +280,7 @@ be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node) if (is_an_amh_exception_holder) { *os << "virtual CORBA::Boolean " - << "_tao_marshal_v (TAO_OutputCDR &) {return 1;}" << be_nl; + << "_tao_marshal_v (TAO_OutputCDR &) const {return 1;}" << be_nl; *os << "virtual CORBA::Boolean " << "_tao_unmarshal_v (TAO_InputCDR &) {return 1;}" << be_nl; } @@ -295,7 +295,7 @@ be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node) << be_nl << "void operator= (const " << node->local_name () << " &);" << be_nl; - + /*********************************************************/ // 2.4 if (is_an_amh_exception_holder) @@ -312,7 +312,7 @@ be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node) { *os << be_uidt_nl << "protected:" << be_idt_nl; *os << "CORBA::Boolean " - << "_tao_marshal_state (TAO_OutputCDR &);" << be_nl + << "_tao_marshal_state (TAO_OutputCDR &) const;" << be_nl << "CORBA::Boolean " << "_tao_unmarshal_state (TAO_InputCDR &);" << be_uidt_nl << be_nl; @@ -329,27 +329,27 @@ be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node) if (is_an_amh_exception_holder) { *os << "virtual CORBA::Boolean" << be_nl - << "_tao_marshal__" << node->flat_name () - << " (TAO_OutputCDR &) {return 1;}" + << "_tao_marshal__" << node->flat_name () + << " (TAO_OutputCDR &) const {return 1;}" << be_nl << be_nl; *os << "virtual CORBA::Boolean" << be_nl - << "_tao_unmarshal__" << node->flat_name () + << "_tao_unmarshal__" << node->flat_name () << " (TAO_InputCDR &) {return 1;}"; - } + } else - { + { *os << "virtual CORBA::Boolean" << be_nl - << "_tao_marshal__" << node->flat_name () - << " (TAO_OutputCDR &) = 0;" + << "_tao_marshal__" << node->flat_name () + << " (TAO_OutputCDR &) const = 0;" << be_nl << be_nl; *os << "virtual CORBA::Boolean" << be_nl - << "_tao_unmarshal__" << node->flat_name () + << "_tao_unmarshal__" << node->flat_name () << " (TAO_InputCDR &) = 0;"; } } } - *os << be_uidt_nl + *os << be_uidt_nl << "};"; os->gen_endif (); @@ -363,7 +363,7 @@ be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node) ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_valuetype_ch::" "visit_valuetype - " - "failed to generate _init construct.\n"), + "failed to generate _init construct.\n"), -1); } @@ -497,7 +497,7 @@ be_visitor_valuetype_ch::begin_private (void) *os << be_uidt_nl << be_nl << "protected:" << be_idt; } -int +int be_visitor_valuetype_ch::gen_supported_ops (be_interface *, be_interface *base, TAO_OutStream *os) diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp index ef432567f80..af3c2afbe50 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp @@ -121,10 +121,9 @@ be_visitor_valuetype_cs::visit_valuetype (be_valuetype *node) << "::_tao_any_destructor (void *_tao_void_pointer)" << be_nl << "{" << be_idt_nl << node->local_name () << " *_tao_tmp_pointer =" << be_idt_nl - << "static_cast<" << be_idt << be_idt_nl - << node->local_name () << " *> (" << be_nl - << "_tao_void_pointer" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl + << "static_cast<" << be_idt + << node->local_name () << " *> (" + << "_tao_void_pointer);" << be_uidt << be_uidt_nl << "CORBA::remove_ref (_tao_tmp_pointer);" << be_uidt_nl << "}" << be_nl << be_nl; } @@ -137,7 +136,7 @@ be_visitor_valuetype_cs::visit_valuetype (be_valuetype *node) { // The virtual _tao_marshal_v method. *os << "CORBA::Boolean " << node->name () - << "::_tao_marshal_v (TAO_OutputCDR & strm)" + << "::_tao_marshal_v (TAO_OutputCDR & strm) const" << be_nl << "{" << be_idt_nl << "return "; diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ch.cpp index 5cc1bbc11eb..2eeecb13117 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ch.cpp @@ -22,8 +22,8 @@ // // ============================================================================ -ACE_RCSID (be_visitor_valuetype, - valuetype_obv_ch, +ACE_RCSID (be_visitor_valuetype, + valuetype_obv_ch, "$Id$") // ****************************************************** @@ -160,15 +160,15 @@ be_visitor_valuetype_obv_ch::visit_valuetype (be_valuetype *node) *os << node->local_name () << " (void);"; *os << be_nl << "virtual ~"; - + if (! node->is_nested ()) { *os << "OBV_"; } - + *os << node->local_name () << " (void);"; } - + // Generate code for the OBV_ class definition. if (this->visit_valuetype_scope (node) == -1) @@ -181,7 +181,7 @@ be_visitor_valuetype_obv_ch::visit_valuetype (be_valuetype *node) } // If we inherit from CORBA::Object and/or CORBA::AbstractBase - // (in addition to CORBA::ValueBase) we have to add these + // (in addition to CORBA::ValueBase) we have to add these // to avoid ambiguity. if (node->n_supports () > 0) { @@ -206,12 +206,12 @@ be_visitor_valuetype_obv_ch::visit_valuetype (be_valuetype *node) *os << node->local_name () << " (void);"; *os << be_nl << "virtual ~"; - + if (! node->is_nested ()) { *os << "OBV_"; } - + *os << node->local_name () << " (void);"; } @@ -221,15 +221,15 @@ be_visitor_valuetype_obv_ch::visit_valuetype (be_valuetype *node) *os << be_nl << be_uidt_nl << "protected:" << be_idt_nl; *os << "virtual CORBA::Boolean" << be_nl - << "_tao_marshal__" << node->flat_name () - << " (TAO_OutputCDR &);" << be_nl << be_nl; + << "_tao_marshal__" << node->flat_name () + << " (TAO_OutputCDR &) const;" << be_nl << be_nl; *os << "virtual CORBA::Boolean" << be_nl - << "_tao_unmarshal__" << node->flat_name () + << "_tao_unmarshal__" << node->flat_name () << " (TAO_InputCDR &);" << be_nl << be_nl; *os << "CORBA::Boolean " - << "_tao_marshal_state (TAO_OutputCDR &);" << be_nl + << "_tao_marshal_state (TAO_OutputCDR &) const;" << be_nl << "CORBA::Boolean " << "_tao_unmarshal_state (TAO_InputCDR &);" << be_uidt_nl << be_nl; diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_cs.cpp index 20aeee342b1..a3d427ec64d 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_cs.cpp @@ -22,8 +22,8 @@ // // ============================================================================ -ACE_RCSID (be_visitor_valuetype, - valuetype_obv_cs, +ACE_RCSID (be_visitor_valuetype, + valuetype_obv_cs, "$Id$") // ****************************************************** @@ -66,7 +66,7 @@ be_visitor_valuetype_obv_cs::visit_valuetype (be_valuetype *node) *os << node->local_name () << " (void)" << be_nl << "{}" << be_nl << be_nl; - + *os << node->full_obv_skel_name () << "::~"; if (! node->is_nested ()) @@ -85,9 +85,9 @@ be_visitor_valuetype_obv_cs::visit_valuetype (be_valuetype *node) *os << be_nl << be_nl << "CORBA::Boolean" << be_nl << node->full_obv_skel_name () << "::_tao_marshal__" << node->flat_name () - << " (TAO_OutputCDR &strm)" << be_nl + << " (TAO_OutputCDR &strm) const" << be_nl << "{" << be_idt_nl - << "return _tao_marshal_state (strm);" << be_uidt_nl + << "return _tao_marshal_state (strm);" << be_uidt_nl << "}" << be_nl << be_nl; *os << "CORBA::Boolean" << be_nl @@ -95,7 +95,7 @@ be_visitor_valuetype_obv_cs::visit_valuetype (be_valuetype *node) << "::_tao_unmarshal__" << node->flat_name () << " (TAO_InputCDR &strm)" << be_nl << "{" << be_idt_nl - << "return _tao_unmarshal_state (strm);" << be_uidt_nl + << "return _tao_unmarshal_state (strm);" << be_uidt_nl << "}"; if (this->visit_scope (node) == -1) @@ -103,17 +103,17 @@ be_visitor_valuetype_obv_cs::visit_valuetype (be_valuetype *node) ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_valuetype_obv_cs::" "visit_valuetype - " - "visit_scope failed\n"), + "visit_scope failed\n"), -1); } // If we inherit from CORBA::Object and/or CORBA::AbstractBase - // (in addition to CORBA::ValueBase) we have to add these + // (in addition to CORBA::ValueBase) we have to add these // to avoid ambiguity. if (node->n_supports () > 0) { *os << be_nl << be_nl << "void" << be_nl - << node->full_obv_skel_name () + << node->full_obv_skel_name () << "::_add_ref (void)" << be_nl << "{" << be_idt_nl << "this->ACE_NESTED_CLASS (CORBA,DefaultValueRefCountBase)::_add_ref ();" @@ -121,7 +121,7 @@ be_visitor_valuetype_obv_cs::visit_valuetype (be_valuetype *node) << "}" << be_nl; *os << be_nl << "void" << be_nl - << node->full_obv_skel_name () + << node->full_obv_skel_name () << "::_remove_ref (void)" << be_nl << "{" << be_idt_nl << "this->ACE_NESTED_CLASS (CORBA,DefaultValueRefCountBase)::_remove_ref ();" @@ -154,6 +154,6 @@ be_visitor_valuetype_obv_cs::visit_field (be_field *node) "visit_field failed\n" ), -1); } - + return 0; } diff --git a/TAO/tao/Valuetype/ValueBase.cpp b/TAO/tao/Valuetype/ValueBase.cpp index 8c1b9d25b46..337dcccc2df 100644 --- a/TAO/tao/Valuetype/ValueBase.cpp +++ b/TAO/tao/Valuetype/ValueBase.cpp @@ -84,7 +84,7 @@ CORBA::ValueBase::_tao_any_destructor (void *x) CORBA::Boolean CORBA::ValueBase::_tao_marshal (TAO_OutputCDR &strm, - CORBA::ValueBase *this_, + const CORBA::ValueBase *this_, ptrdiff_t /* formal_type_id */) { CORBA::Boolean retval = true; diff --git a/TAO/tao/Valuetype/ValueBase.h b/TAO/tao/Valuetype/ValueBase.h index ff35debdefc..a883662270e 100644 --- a/TAO/tao/Valuetype/ValueBase.h +++ b/TAO/tao/Valuetype/ValueBase.h @@ -82,7 +82,7 @@ namespace CORBA /// Marshal a valuetype (see operator<< in tao_idl generated file /// how it is called) static CORBA::Boolean _tao_marshal (TAO_OutputCDR &strm, - ValueBase *_this, + const ValueBase *_this, ptrdiff_t formal_type_id = 0); /// Unmarshal a valuetype, if formal type is a pointer to @@ -105,7 +105,7 @@ namespace CORBA public: // otherwise these cannot be called from a static function /// during marshal jump to the most derived part - virtual CORBA::Boolean _tao_marshal_v (TAO_OutputCDR &) = 0; + virtual CORBA::Boolean _tao_marshal_v (TAO_OutputCDR &) const = 0; /// called after obtaining the fresh object from create_for_unmarshal () virtual CORBA::Boolean _tao_unmarshal_v (TAO_InputCDR &) = 0; -- cgit v1.2.1