summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp')
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp170
1 files changed, 0 insertions, 170 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp
deleted file mode 100644
index c2c762b19ef..00000000000
--- a/TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp
+++ /dev/null
@@ -1,170 +0,0 @@
-//
-// $Id$
-//
-
-// ============================================================================
-//
-// = LIBRARY
-// TAO IDL
-//
-// = FILENAME
-// any_op_cs.cpp
-//
-// = DESCRIPTION
-// Visitor generating code for Any operators for Union.
-//
-// = AUTHOR
-// Aniruddha Gokhale
-//
-// ============================================================================
-
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_union.h"
-
-ACE_RCSID(be_visitor_union, any_op_cs, "$Id$")
-
-
-// ***************************************************************************
-// Union visitor for generating Any operator declarations in the client
-// stubs file
-// ***************************************************************************
-
-be_visitor_union_any_op_cs::be_visitor_union_any_op_cs
-(be_visitor_context *ctx)
- : be_visitor_union (ctx)
-{
-}
-
-be_visitor_union_any_op_cs::~be_visitor_union_any_op_cs (void)
-{
-}
-
-int
-be_visitor_union_any_op_cs::visit_union (be_union *node)
-{
- if (node->cli_stub_any_op_gen () || node->imported ())
- return 0;
-
- TAO_OutStream *os = this->ctx_->stream ();
-
- // generate the Any <<= and >>= operator declarations
- os->indent ();
- *os << "void operator<<= (CORBA::Any &_tao_any, const "
- << node->name () << " &_tao_elem) // copying" << be_nl
- << "{" << be_idt_nl
- << node->name () << " *_any_val;" << be_nl
- << "ACE_NEW (_any_val, " << node->name () << " (_tao_elem));" << be_nl
- << "if (!_any_val) return;" << be_nl
- << "TAO_TRY" << be_nl
- << "{" << be_idt_nl
- << "_tao_any.replace (" << node->tc_name ()
- << ", _any_val, 1, TAO_TRY_ENV);" << " // copy the value" << be_nl
- << "TAO_CHECK_ENV;" << be_uidt_nl
- << "}" << be_nl
- << "TAO_CATCHANY" << be_nl
- << "{" << be_idt_nl
- << "delete _any_val;" << be_uidt_nl
- << "}" << be_nl
- << "TAO_ENDTRY;" << be_uidt_nl
- << "}\n" << be_nl;
-
- *os << "void operator<<= (CORBA::Any &_tao_any, "
- << node->name () << " *_tao_elem) // non copying" << be_nl
- << "{" << be_idt_nl
- << "TAO_TRY" << be_nl
- << "{" << be_idt_nl
- << "_tao_any.replace (" << node->tc_name () << ", "
- << "_tao_elem, 1, TAO_TRY_ENV); // consume it" << be_nl
- << "TAO_CHECK_ENV;" << be_uidt_nl
- << "}" << be_nl
- << "TAO_CATCHANY {}" << be_nl
- << "TAO_ENDTRY;" << be_uidt_nl
- << "}\n" << be_nl;
-
- *os << "CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, "
- << node->name () << " *&_tao_elem)" << be_nl
- << "{" << be_idt_nl
- << "TAO_TRY" << be_nl
- << "{" << be_idt_nl
- << "CORBA::TypeCode_var type = _tao_any.type ();" << be_nl
- << "if (!type->equal (" << node->tc_name ()
- << ", TAO_TRY_ENV)) return 0; // not equal" << be_nl
- << "TAO_CHECK_ENV;" << be_nl
- << "if (_tao_any.any_owns_data ())" << be_nl
- << "{" << be_idt_nl
- << "_tao_elem = (" << node->name () << " *)_tao_any.value ();"
- << be_nl
- << "return 1;" << be_uidt_nl
- << "}" << be_nl
- << "else" << be_nl // else any does not own the data
- << "{" << be_idt_nl
- << "ACE_NEW_RETURN (_tao_elem, " << node->name () << ", 0);"
- << be_nl
- << "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any._tao_get_cdr ());"
- << be_nl
- << "if (stream.decode (" << node->tc_name ()
- << ", _tao_elem, 0, TAO_TRY_ENV)" << be_nl
- << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl
- << "{" << be_idt_nl
- << "((CORBA::Any *)&_tao_any)->replace ("
- << node->tc_name () << ", _tao_elem, 1, TAO_TRY_ENV);" << be_nl
- << "TAO_CHECK_ENV;" << be_nl
- << "return 1;" << be_uidt_nl
- << "}" << be_nl
- << "else" << be_nl
- << "{" << be_idt_nl
- << "delete _tao_elem;" << be_uidt_nl
- << "}" << be_uidt_nl
- << "}" << be_uidt_nl
- << "}" << be_nl
- << "TAO_CATCHANY" << be_nl
- << "{" << be_idt_nl
- << "delete _tao_elem;" << be_nl
- << "return 0; " << be_uidt_nl
- << "}" << be_nl
- << "TAO_ENDTRY;" << be_nl
- << "return 0;" << be_uidt_nl
- << "}\n\n";
-
-
- // all we have to do is to visit the scope and generate code
- if (this->visit_scope (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union::visit_union - "
- "codegen for scope failed\n"), -1);
- }
-
- node->cli_stub_any_op_gen (1);
- return 0;
-}
-
-int
-be_visitor_union_any_op_cs::visit_union_branch (be_union_branch *node)
-{
- be_type *bt; // field's type
-
- // first generate the type information
- bt = be_type::narrow_from_decl (node->field_type ());
- if (!bt)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_any_op_cs::"
- "visit_union_branch - "
- "Bad field type\n"
- ), -1);
- }
-
- if (bt->accept (this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_union_any_op_cs::"
- "visit_union_branch - "
- "codegen for field type failed\n"
- ), -1);
- }
- return 0;
-}