diff options
Diffstat (limited to 'TAO/TAO_IDL/be/be_visitor_enum')
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_enum/any_op_ch.cpp | 63 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_enum/any_op_cs.cpp | 100 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_enum/cdr_op_ch.cpp | 63 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_enum/cdr_op_cs.cpp | 77 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_enum/enum_ch.cpp | 113 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_enum/enum_cs.cpp | 71 |
6 files changed, 0 insertions, 487 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_enum/any_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_enum/any_op_ch.cpp deleted file mode 100644 index 5e79530c2f1..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_enum/any_op_ch.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// any_op_ch.cpp -// -// = DESCRIPTION -// Visitor generating code for Enums for the Any operators -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#include "idl.h" -#include "idl_extern.h" -#include "be.h" - -#include "be_visitor_enum.h" - -ACE_RCSID(be_visitor_enum, any_op_ch, "$Id$") - - -// *************************************************************************** -// Enum visitor for generating Any operator declarations in the client header -// *************************************************************************** - -be_visitor_enum_any_op_ch::be_visitor_enum_any_op_ch -(be_visitor_context *ctx) - : be_visitor_scope (ctx) -{ -} - -be_visitor_enum_any_op_ch::~be_visitor_enum_any_op_ch (void) -{ -} - -int -be_visitor_enum_any_op_ch::visit_enum (be_enum *node) -{ - if (node->cli_hdr_any_op_gen () || node->imported ()) - return 0; - - TAO_OutStream *os = tao_cg->client_header (); - - // generate the Any <<= and >>= operators - os->indent (); - *os << "void " << idl_global->export_macro () - << " operator<<= (CORBA::Any &, " << node->name () - << ");" << be_nl; - *os << "CORBA::Boolean " << idl_global->export_macro () - << " operator>>= (const CORBA::Any &, " - << node->name () << " &);\n"; - - node->cli_hdr_any_op_gen (1); - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_enum/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_enum/any_op_cs.cpp deleted file mode 100644 index 5f1ff5c75a5..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_enum/any_op_cs.cpp +++ /dev/null @@ -1,100 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// any_op_cs.cpp -// -// = DESCRIPTION -// Visitors for generation of code for Enum for the Any operators -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#include "idl.h" -#include "idl_extern.h" -#include "be.h" - -#include "be_visitor_enum.h" - -ACE_RCSID(be_visitor_enum, any_op_cs, "$Id$") - - -// *************************************************************************** -// Enum visitor for generating Any operator declarations in the client -// stubs file -// *************************************************************************** - -be_visitor_enum_any_op_cs::be_visitor_enum_any_op_cs -(be_visitor_context *ctx) - : be_visitor_scope (ctx) -{ -} - -be_visitor_enum_any_op_cs::~be_visitor_enum_any_op_cs (void) -{ -} - -int -be_visitor_enum_any_op_cs::visit_enum (be_enum *node) -{ - if (node->cli_stub_any_op_gen () || node->imported ()) - return 0; - - TAO_OutStream *os = tao_cg->client_stubs (); - - // generate the Any <<= and >>= operator declarations - // Any <<= and >>= operators - os->indent (); - *os << "void operator<<= (CORBA::Any &_tao_any, " - << node->name () << " _tao_elem)" << be_nl - << "{" << be_idt_nl - << node->name () << " *_any_val;" << be_nl - << "ACE_NEW (_any_val, " << node->name () - << " (_tao_elem));" << be_nl - << "TAO_TRY" << be_nl - << "{" << be_idt_nl - << "_tao_any.replace (" << node->tc_name () - << ", _any_val, 1, TAO_TRY_ENV);" << be_nl - << "TAO_CHECK_ENV;" << be_uidt_nl - << "}" << be_nl - << "TAO_CATCHANY" << be_nl - << "{" << be_idt_nl - << "// free allocated storage" << be_nl - << "delete _any_val;" << be_uidt_nl - << "}" << 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 - << "TAO_InputCDR stream ((ACE_Message_Block *)_tao_any.value ());" - << be_nl - << "if (stream.decode (" << node->tc_name () - << ", &_tao_elem, 0, TAO_TRY_ENV)" << be_nl - << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl - << " return 1;" << be_nl - << "TAO_CHECK_ENV;" << be_uidt_nl - << "}" << be_nl - << "TAO_CATCHANY {}" << be_nl - << "TAO_ENDTRY;" << be_nl - << "return 0;" << be_uidt_nl - << "}\n\n"; - - node->cli_stub_any_op_gen (1); - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_enum/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_enum/cdr_op_ch.cpp deleted file mode 100644 index 0eec4fe9db9..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_enum/cdr_op_ch.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// cdr_op_ch.cpp -// -// = DESCRIPTION -// Visitor generating code for Enums for the CDR operators -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#include "idl.h" -#include "idl_extern.h" -#include "be.h" - -#include "be_visitor_enum.h" - -ACE_RCSID(be_visitor_enum, cdr_op_ch, "$Id$") - - -// *************************************************************************** -// Enum visitor for generating Cdr operator declarations in the client header -// *************************************************************************** - -be_visitor_enum_cdr_op_ch::be_visitor_enum_cdr_op_ch -(be_visitor_context *ctx) - : be_visitor_scope (ctx) -{ -} - -be_visitor_enum_cdr_op_ch::~be_visitor_enum_cdr_op_ch (void) -{ -} - -int -be_visitor_enum_cdr_op_ch::visit_enum (be_enum *node) -{ - if (node->cli_hdr_cdr_op_gen () || node->imported ()) - return 0; - - TAO_OutStream *os = tao_cg->client_header (); - - // generate the CDR << and >> operators - os->indent (); - *os << "CORBA::Boolean " << idl_global->export_macro () - << " operator<< (TAO_OutputCDR &, const " << node->name () - << " &); // " << be_nl; - *os << "CORBA::Boolean " << idl_global->export_macro () - << " operator>> (TAO_InputCDR &, " - << node->name () << " &);\n"; - - node->cli_hdr_cdr_op_gen (1); - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_enum/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_enum/cdr_op_cs.cpp deleted file mode 100644 index 679bcf96ad8..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_enum/cdr_op_cs.cpp +++ /dev/null @@ -1,77 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// cdr_op_cs.cpp -// -// = DESCRIPTION -// Visitors for generation of code for Enum for the CDR operators -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#include "idl.h" -#include "idl_extern.h" -#include "be.h" - -#include "be_visitor_enum.h" - -ACE_RCSID(be_visitor_enum, cdr_op_cs, "$Id$") - - -// *************************************************************************** -// Enum visitor for generating CDR operator declarations in the client -// stubs file -// *************************************************************************** - -be_visitor_enum_cdr_op_cs::be_visitor_enum_cdr_op_cs -(be_visitor_context *ctx) - : be_visitor_scope (ctx) -{ -} - -be_visitor_enum_cdr_op_cs::~be_visitor_enum_cdr_op_cs (void) -{ -} - -int -be_visitor_enum_cdr_op_cs::visit_enum (be_enum *node) -{ - if (node->cli_stub_cdr_op_gen () || node->imported ()) - return 0; - - TAO_OutStream *os = tao_cg->client_stubs (); - - // generate CDR << and >> operators - os->indent (); - *os << "CORBA::Boolean operator<< (TAO_OutputCDR &strm, " - << "const " << node->name () << " &_tao_enumval)" << be_nl - << "{" << be_idt_nl - << "return strm.write_ulong ((CORBA::ULong) _tao_enumval);" << be_uidt_nl - << "}\n\n"; - - *os << "CORBA::Boolean operator>> (TAO_InputCDR &strm, " - << node->name () << " &_tao_enumval)" << be_nl - << "{" << be_idt_nl - << "CORBA::ULong _tao_temp;" << be_nl - << "if (strm.read_ulong (_tao_temp))" << be_nl - << "{" << be_idt_nl - << "ACE_OS::memcpy (&_tao_enumval, &_tao_temp, sizeof (CORBA::ULong));" - << be_nl - << "return 1;" << be_uidt_nl - << "}" << be_nl - << "else" << be_idt_nl - << "return 0;" << be_uidt << be_uidt_nl - << "}\n\n"; - - node->cli_stub_cdr_op_gen (1); - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_enum/enum_ch.cpp b/TAO/TAO_IDL/be/be_visitor_enum/enum_ch.cpp deleted file mode 100644 index 3ca5ff12115..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_enum/enum_ch.cpp +++ /dev/null @@ -1,113 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// enum_ch.cpp -// -// = DESCRIPTION -// Visitor generating code for Enums in the client header -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#include "idl.h" -#include "idl_extern.h" -#include "be.h" - -#include "be_visitor_enum.h" - -ACE_RCSID(be_visitor_enum, enum_ch, "$Id$") - - -// ******************************************************************** -// Visitor implementation for the Enum type -// This one for the client header file -// ******************************************************************** - -be_visitor_enum_ch::be_visitor_enum_ch (be_visitor_context *ctx) - : be_visitor_scope (ctx) -{ -} - -be_visitor_enum_ch::~be_visitor_enum_ch (void) -{ -} - -// visit the Enum_Ch node and its scope -int -be_visitor_enum_ch::visit_enum (be_enum *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - this->ctx_->comma (1); // comma to be generated by the scope visitor - - if (!node->cli_hdr_gen () && !node->imported ()) - { - os->indent (); // start from whatever indentation level we were at - *os << "enum " << node->local_name () << be_nl; - *os << "{\n"; - os->incr_indent (); - if (this->visit_scope (node) == 1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_enum_ch::" - "visit_enum - " - "scope generation failed\n" - ), -1); - } - - os->decr_indent (); - *os << "};" << be_nl; - // As per the ORBOS spec, we need the following typedef - *os << "typedef " << node->local_name () << " &" << node->local_name () - << "_out;\n"; - - // by using a visitor to declare and define the TypeCode, we have the - // added advantage to conditionally not generate any code. This will be - // based on the command line options. This is still TO-DO - be_visitor *visitor; - be_visitor_context ctx (*this->ctx_); - ctx.state (TAO_CodeGen::TAO_TYPECODE_DECL); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_enum_ch::" - "visit_enum - " - "TypeCode declaration failed\n" - ), -1); - } - - node->cli_hdr_gen (I_TRUE); - } - return 0; -} - -int -be_visitor_enum_ch::post_process (be_decl *bd) -{ - TAO_OutStream *os = this->ctx_->stream (); - - // Am I the last one? - if (!this->last_node (bd)) - *os << "," << be_nl; - return 0; -} - -int -be_visitor_enum_ch::visit_enum_val (be_enum_val *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - os->indent (); - *os << node->local_name (); - - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_enum/enum_cs.cpp b/TAO/TAO_IDL/be/be_visitor_enum/enum_cs.cpp deleted file mode 100644 index 2ced2f40cfe..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_enum/enum_cs.cpp +++ /dev/null @@ -1,71 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// enum_cs.cpp -// -// = DESCRIPTION -// Visitor generating code for Enums in the client stubs -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#include "idl.h" -#include "idl_extern.h" -#include "be.h" - -#include "be_visitor_enum.h" - -ACE_RCSID(be_visitor_enum, enum_cs, "$Id$") - - -// ******************************************************************** -// Visitor implementation for the Enum type -// This one for the client stubs file -// ******************************************************************** - -be_visitor_enum_cs::be_visitor_enum_cs (be_visitor_context *ctx) - : be_visitor_scope (ctx) -{ -} - -be_visitor_enum_cs::~be_visitor_enum_cs (void) -{ -} - -// visit the Enum_cs node and its scope -int -be_visitor_enum_cs::visit_enum (be_enum *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - if (!node->cli_stub_gen () && !node->imported ()) - { - // by using a visitor to declare and define the TypeCode, we have the - // added advantage to conditionally not generate any code. This will be - // based on the command line options. This is still TO-DO - be_visitor *visitor; - be_visitor_context ctx (*this->ctx_); - ctx.state (TAO_CodeGen::TAO_TYPECODE_DEFN); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_enum_cs::" - "visit_enum - " - "TypeCode definition failed\n" - ), -1); - } - - node->cli_stub_gen (I_TRUE); - } - return 0; -} |