diff options
Diffstat (limited to 'TAO/TAO_IDL/be/be_visitor_valuebox/valuebox_cs.cpp')
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_valuebox/valuebox_cs.cpp | 223 |
1 files changed, 8 insertions, 215 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_valuebox/valuebox_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuebox/valuebox_cs.cpp index 45de64c965b..4c04dd07508 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuebox/valuebox_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuebox/valuebox_cs.cpp @@ -62,46 +62,15 @@ be_visitor_valuebox_cs::visit_valuebox (be_valuebox *node) *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl << "// " << __FILE__ << ":" << __LINE__; - *os << be_nl << be_nl - << "void" << be_nl - << "TAO::Value_Traits<" << node->name () << ">::add_ref (" - << be_idt << be_idt_nl - << node->name () << " * p" << be_uidt_nl - << ")" << be_uidt_nl - << "{" << be_idt_nl - << "::CORBA::add_ref (p);" << be_uidt_nl - << "}"; - - *os << be_nl << be_nl - << "void" << be_nl - << "TAO::Value_Traits<" << node->name () << ">::remove_ref (" - << be_idt << be_idt_nl - << node->name () << " * p" << be_uidt_nl - << ")" << be_uidt_nl - << "{" << be_idt_nl - << "::CORBA::remove_ref (p);" << be_uidt_nl - << "}"; - - *os << be_nl << be_nl - << "void" << be_nl - << "TAO::Value_Traits<" << node->name () << ">::release (" - << be_idt << be_idt_nl - << node->name () << " * p" << be_uidt_nl - << ")" << be_uidt_nl - << "{" << be_idt_nl - << "::CORBA::remove_ref (p);" << be_uidt_nl - << "}"; - // The _downcast method. - *os << be_nl << be_nl - << node->name () << " *" << be_nl + *os << be_nl << node->name () << " *" << be_nl << node->name () << "::_downcast ( ::CORBA::ValueBase *v)" << be_nl << "{" << be_idt_nl << "return dynamic_cast< ::" << node->name () << " * > (v);" << be_uidt_nl << "}" << be_nl << be_nl; // _copy_value method - *os << "::CORBA::ValueBase *" << be_nl + *os << be_nl << "::CORBA::ValueBase *" << be_nl << node->name () << "::_copy_value (void)" << be_nl << "{" << be_idt_nl << "::CORBA::ValueBase *result = 0;" << be_nl @@ -192,7 +161,6 @@ be_visitor_valuebox_cs::visit_valuebox (be_valuebox *node) << "vb_object," << be_nl << node->local_name () << "," << be_nl << "false);" << be_nl << be_uidt_nl; - if (is_array) { *os << at->full_name() << "_forany temp (vb_object->_boxed_inout ());" @@ -201,15 +169,7 @@ be_visitor_valuebox_cs::visit_valuebox (be_valuebox *node) *os << "return (strm >> " << unmarshal_arg << ");" << be_uidt_nl << "}" << be_nl << be_nl; - // _tao_unmarshal_v method. Generated because ValueBase interface - // requires it. But there is nothing for it to do in the valuebox - // case. - *os << "::CORBA::Boolean " << be_nl - << node->name () - << "::_tao_unmarshal_v (TAO_InputCDR &)" << be_nl - << "{" << be_idt_nl - << "return true;" << be_uidt_nl - << "}" << be_nl << be_nl; + // Emit the type specific elements. The visit_* methods in this // module do that work. @@ -222,57 +182,20 @@ be_visitor_valuebox_cs::visit_valuebox (be_valuebox *node) } // Indicate that code is already generated for this node. - node->cli_stub_gen (true); + node->cli_stub_gen (I_TRUE); return 0; } int -be_visitor_valuebox_cs::visit_array (be_array * node) +be_visitor_valuebox_cs::visit_array (be_array *) { - TAO_OutStream & os = *this->ctx_->stream (); - - // Retrieve the node being visited by this be_visitor_valuebox_cs. - be_decl * const vb_node = this->ctx_->node (); - - os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - // _tao_marshal_v method - os << "::CORBA::Boolean " << be_nl - << vb_node->name () - << "::_tao_marshal_v (TAO_OutputCDR & strm) const" << be_nl - << "{" << be_idt_nl - << node->name () << "_forany temp (this->_pd_value.ptr ());" << be_nl - << "return (strm << temp);" << be_uidt_nl - << "}" << be_nl << be_nl; - return 0; } int be_visitor_valuebox_cs::visit_enum (be_enum *) { - TAO_OutStream & os = *this->ctx_->stream (); - - // Retrieve the node being visited by this be_visitor_valuebox_cs. - be_decl * const vb_node = this->ctx_->node (); - - os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - this->emit_destructor (); - - static char const marshal_arg[] = "this->_pd_value"; - - // _tao_marshal_v method - os << "::CORBA::Boolean " << be_nl - << vb_node->name () - << "::_tao_marshal_v (TAO_OutputCDR & strm) const" << be_nl - << "{" << be_idt_nl - << "return (strm << " << marshal_arg << ");" << be_uidt_nl - << "}" << be_nl << be_nl; - return 0; } @@ -280,42 +203,13 @@ be_visitor_valuebox_cs::visit_enum (be_enum *) int be_visitor_valuebox_cs::visit_interface (be_interface *) { - return this->emit_for_predef_enum ("this->_pd_value"); + return 0; } int -be_visitor_valuebox_cs::visit_predefined_type (be_predefined_type * node) +be_visitor_valuebox_cs::visit_predefined_type (be_predefined_type *) { - char const * marshal_arg; - - switch (node->pt ()) - { - case AST_PredefinedType::PT_boolean: - marshal_arg = "::ACE_OutputCDR::from_boolean (this->_pd_value)"; - break; - - case AST_PredefinedType::PT_char: - marshal_arg = "::ACE_OutputCDR::from_char (this->_pd_value)"; - break; - - case AST_PredefinedType::PT_wchar: - marshal_arg = "::ACE_OutputCDR::from_wchar (this->_pd_value)"; - break; - - case AST_PredefinedType::PT_octet: - marshal_arg = "::ACE_OutputCDR::from_octet (this->_pd_value)"; - break; - - case AST_PredefinedType::PT_any: - marshal_arg = "this->_pd_value.in ()"; - break; - - default: - marshal_arg = "this->_pd_value"; - break; - } - - return this->emit_for_predef_enum (marshal_arg); + return 0; } int @@ -417,8 +311,6 @@ be_visitor_valuebox_cs::visit_sequence (be_sequence *node) // end: Public constructor for sequence with supplied buffer - this->emit_destructor (); - // Accessor: non const if (bt->accept (&bt_visitor) == -1) { @@ -493,62 +385,18 @@ be_visitor_valuebox_cs::visit_sequence (be_sequence *node) *os << "}" << be_nl << be_nl; - // _tao_marshal_v method - *os << "::CORBA::Boolean " << be_nl - << vb_node->name () - << "::_tao_marshal_v (TAO_OutputCDR & strm) const" << be_nl - << "{" << be_idt_nl - << "return (strm << this->_pd_value.in ());" << be_uidt_nl - << "}" << be_nl << be_nl; - return 0; } int be_visitor_valuebox_cs::visit_string (be_string *) { - TAO_OutStream & os = *this->ctx_->stream (); - - // Retrieve the node being visited by this be_visitor_valuebox_cs. - be_decl * const vb_node = this->ctx_->node (); - - os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - this->emit_destructor (); - - // _tao_marshal_v method - os << "::CORBA::Boolean " << be_nl - << vb_node->name () - << "::_tao_marshal_v (TAO_OutputCDR & strm) const" << be_nl - << "{" << be_idt_nl - << "return (strm << this->_pd_value);" << be_uidt_nl - << "}" << be_nl << be_nl; - return 0; } int be_visitor_valuebox_cs::visit_structure (be_structure *) { - TAO_OutStream & os = *this->ctx_->stream (); - - // Retrieve the node being visited by this be_visitor_valuebox_cs. - be_decl * const vb_node = this->ctx_->node (); - - os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - this->emit_destructor (); - - // _tao_marshal_v method - os << "::CORBA::Boolean " << be_nl - << vb_node->name () - << "::_tao_marshal_v (TAO_OutputCDR & strm) const" << be_nl - << "{" << be_idt_nl - << "return (strm << this->_pd_value.in ());" << be_uidt_nl - << "}" << be_nl << be_nl; - return 0; } @@ -573,60 +421,5 @@ be_visitor_valuebox_cs::visit_typedef (be_typedef *node) int be_visitor_valuebox_cs::visit_union (be_union *) { - TAO_OutStream & os = *this->ctx_->stream (); - - // Retrieve the node being visited by this be_visitor_valuebox_cs. - be_decl * const vb_node = this->ctx_->node (); - - os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - this->emit_destructor (); - - // _tao_marshal_v method - os << "::CORBA::Boolean " << be_nl - << vb_node->name () - << "::_tao_marshal_v (TAO_OutputCDR & strm) const" << be_nl - << "{" << be_idt_nl - << "return (strm << this->_pd_value.in ());" << be_uidt_nl - << "}" << be_nl << be_nl; - - return 0; -} - -void -be_visitor_valuebox_cs::emit_destructor (void) -{ - TAO_OutStream & os = *this->ctx_->stream (); - - // Retrieve the node being visited by this be_visitor_valuebox_cs. - be_decl * const vb_node = this->ctx_->node (); - - // Protected destructor - os << vb_node->name () << "::~" << vb_node->local_name () << " (void)" - << be_nl << "{" << be_nl << "}" << be_nl << be_nl; -} - -int -be_visitor_valuebox_cs::emit_for_predef_enum (char const * marshal_arg) -{ - TAO_OutStream & os = *this->ctx_->stream (); - - // Retrieve the node being visited by this be_visitor_valuebox_cs. - be_decl * const vb_node = this->ctx_->node (); - - os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - this->emit_destructor (); - - // _tao_marshal_v method - os << "::CORBA::Boolean " << be_nl - << vb_node->name () - << "::_tao_marshal_v (TAO_OutputCDR & strm) const" << be_nl - << "{" << be_idt_nl - << "return (strm << " << marshal_arg << ");" << be_uidt_nl - << "}" << be_nl << be_nl; - return 0; } |