diff options
Diffstat (limited to 'TAO/TAO_IDL/be/be_visitor_valuetype')
30 files changed, 0 insertions, 8884 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_ch.cpp deleted file mode 100644 index 84d1bd214c5..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_ch.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_exception_holder_ch.cpp -// -// = DESCRIPTION -// Visitor generating exception holders for the AMI callback model. -// -// = AUTHOR -// Michael Kircher <Michael.Kircher@mchp.siemens.de> -// -// ============================================================================ - -ACE_RCSID (be_visitor_valuetype, - ami_exception_holder_ch, - "$Id$") - -// ****************************************************** -// Interface visitor for client header. -// ****************************************************** - -be_visitor_valuetype_ami_exception_holder_ch:: -be_visitor_valuetype_ami_exception_holder_ch (be_visitor_context *ctx) - : be_visitor_valuetype (ctx) -{ -} - -be_visitor_valuetype_ami_exception_holder_ch:: -~be_visitor_valuetype_ami_exception_holder_ch (void) -{ -} - -int -be_visitor_valuetype_ami_exception_holder_ch::visit_operation ( - be_operation *node - ) -{ - be_visitor_context ctx (*this->ctx_); - - // Using the implementation class visitor is strange, but we - // do it here because it's the only one that generates the - // environment variable in the operation signature without - // the trailing _WITH_DEFAULTS, which is what we want. - // For performance reasons, we would rather there be a - // compile error if the user does not pass an environment - // variable, than create a default one, which causes extra - // TSS activity. - be_visitor_operation_ih visitor (&ctx); - - if (node->accept (&visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_" - "ami_exception_holder_ch::" - "visit_operation - " - "codegen for argument list failed\n"), - -1); - } - - TAO_OutStream *os = this->ctx_->stream (); - - *os << be_uidt; - - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_cs.cpp deleted file mode 100644 index 726706a8ff1..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_cs.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// ami_exception_holder_cs.cpp -// -// = DESCRIPTION -// Visitor generating code for excpetion holders. -// -// = AUTHOR -// Michael Kircher -// -// ============================================================================ - -ACE_RCSID (be_visitor_valuetype, - ami_exception_holder_cs, - "$Id$") - -// ************************************************************ -// Interface visitor for client stubs -// ************************************************************ - -be_visitor_valuetype_ami_exception_holder_cs:: -be_visitor_valuetype_ami_exception_holder_cs (be_visitor_context *ctx) - : be_visitor_valuetype (ctx) -{ -} - -be_visitor_valuetype_ami_exception_holder_cs:: -~be_visitor_valuetype_ami_exception_holder_cs (void) -{ -} - -int -be_visitor_valuetype_ami_exception_holder_cs::visit_valuetype ( - be_valuetype *node - ) -{ - ACE_UNUSED_ARG (node); - return 0; -} - - -int -be_visitor_valuetype_ami_exception_holder_cs::visit_operation (be_operation *node) -{ - be_visitor_context ctx (*this->ctx_); - ctx.state (TAO_CodeGen::TAO_AMI_EXCEPTION_HOLDER_RAISE_OPERATION_CS); - be_visitor_operation_ami_exception_holder_operation_cs visitor (&ctx); - - if (node->accept (&visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_ami_exception_holder_ch::" - "visit_operation - " - "codegen for argument list failed\n"), - -1); - } - - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/any_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/any_op_ch.cpp deleted file mode 100644 index 4d3b75db1e8..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/any_op_ch.cpp +++ /dev/null @@ -1,125 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// any_op_ch.cpp -// -// = DESCRIPTION -// Visitor generating code for Any operators for a valuetype in the client -// header. -// -// = AUTHOR -// Jeff Parsons <parsons@cs.wustl.edu> -// Boris Kolpackov <bosk@ipmce.ru> -// -// ============================================================================ - -ACE_RCSID (be_visitor_valuetype, - any_op_ch, - "$Id$") - -// *************************************************************************** -// Valuetype visitor for generating Any operator declarations. -// *************************************************************************** - -be_visitor_valuetype_any_op_ch::be_visitor_valuetype_any_op_ch ( - be_visitor_context *ctx - ) - : be_visitor_valuetype (ctx) -{ -} - -be_visitor_valuetype_any_op_ch::~be_visitor_valuetype_any_op_ch (void) -{ -} - -int -be_visitor_valuetype_any_op_ch::visit_valuetype (be_valuetype *node) -{ - if (node->cli_hdr_any_op_gen () - || node->imported ()) - { - return 0; - } - - TAO_OutStream *os = this->ctx_->stream (); - const char *macro = this->ctx_->export_macro (); - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - be_module *module = 0; - - if (node->is_nested () && - node->defined_in ()->scope_node_type () == AST_Decl::NT_module) - { - module = be_module::narrow_from_scope (node->defined_in ()); - - if (!module) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_valuebox_any_op_ch::" - "visit_valuebox - " - "Error parsing nested name\n"), - -1); - } - - // Some compilers handle "any" operators in a namespace - // corresponding to their module, others do not. - *os << "\n\n#if defined (ACE_ANY_OPS_USE_NAMESPACE)\n"; - - be_util::gen_nested_namespace_begin (os, module); - - // emit nested variation of any operators - *os << macro << " void" - << " operator<<= ( ::CORBA::Any &, " << node->local_name () - << " *); // copying" << be_nl; - - *os << macro << " void" - << " operator<<= ( ::CORBA::Any &, " << node->local_name () - << " **); // non-copying" << be_nl; - - *os << macro << " ::CORBA::Boolean" - << " operator>>= (const ::CORBA::Any &, " - << node->local_name () << " *&);"; - - be_util::gen_nested_namespace_end (os, module); - - // emit #else - *os << "#else\n\n"; - } - - *os << be_global->core_versioning_begin () << be_nl; - - *os << macro << " void operator<<= (::CORBA::Any &, " << node->name () - << " *); // copying" << be_nl; - - *os << macro << " void operator<<= (::CORBA::Any &, " << node->name () - << " **); // non-copying" << be_nl; - - *os << macro << " ::CORBA::Boolean operator>>= (const ::CORBA::Any &, " - << node->name () << " *&);"; - - *os << be_global->core_versioning_end () << be_nl; - - if (module != 0) - { - *os << "\n\n#endif"; - } - - node->cli_hdr_any_op_gen (1); - return 0; -} - -int -be_visitor_valuetype_any_op_ch::visit_eventtype (be_eventtype *node) -{ - return this->visit_valuetype (node); -} - 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 deleted file mode 100644 index aa784e3a0e1..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/any_op_cs.cpp +++ /dev/null @@ -1,214 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// any_op_cs.cpp -// -// = DESCRIPTION -// Visitor generating code for Any operators for valuetypes in the stubs -// file. -// -// = AUTHOR -// Jeff Parsons <parsons@cs.wustl.edu> -// Boris Kolpackov <bosk@ipmce.ru> -// -// ============================================================================ - -ACE_RCSID (be_visitor_valuetype, - any_op_cs, - "$Id$") - - -// *************************************************************************** -// Valuetype visitor for generating Any operator declarations in the client -// stubs file -// *************************************************************************** - -be_visitor_valuetype_any_op_cs::be_visitor_valuetype_any_op_cs ( - be_visitor_context *ctx - ) - : be_visitor_valuetype (ctx) -{ -} - -be_visitor_valuetype_any_op_cs::~be_visitor_valuetype_any_op_cs (void) -{ -} - -int -be_visitor_valuetype_any_op_cs::visit_valuetype (be_valuetype *node) -{ - if (node->cli_stub_any_op_gen () - || node->imported () - || node->is_local ()) - { - return 0; - } - - TAO_OutStream *os = this->ctx_->stream (); - - // Generate the Any <<= and >>= operator declarations - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__; - - *os << be_global->core_versioning_begin () << be_nl; - - // All template specializations must be generated before the instantiations - // in the operators. - *os << be_nl << be_nl - << "namespace TAO" << be_nl - << "{" << be_idt_nl - << "template<>" << be_nl - << "::CORBA::Boolean" << be_nl - << "Any_Impl_T<" << node->name () << ">::to_value (" - << be_idt << be_idt_nl - << "::CORBA::ValueBase *&_tao_elem" << be_uidt_nl - << ") const" << be_uidt_nl - << "{" << be_idt_nl - << "::CORBA::add_ref (this->value_);" << be_nl - << "_tao_elem = this->value_;" << be_nl - << "return true;" << be_uidt_nl - << "}" << be_uidt_nl - << "}" << be_nl << be_nl; - - *os << be_global->core_versioning_end () << be_nl; - - be_module *module = 0; - - if (node->is_nested () && - node->defined_in ()->scope_node_type () == AST_Decl::NT_module) - { - module = be_module::narrow_from_scope (node->defined_in ()); - - if (!module) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_valuebox_any_op_cs::" - "visit_valuebox - " - "Error parsing nested name\n"), - -1); - } - - // Some compiler handle "any" operators in a namespace corresponding - // to their module, others do not. - *os << "\n\n#if defined (ACE_ANY_OPS_USE_NAMESPACE)\n"; - - be_util::gen_nested_namespace_begin (os, module); - - // emit nested variation of any operators - *os << "// Copying insertion." << be_nl - << "void" << be_nl - << "operator<<= (" << be_idt << be_idt_nl - << "::CORBA::Any &_tao_any," << be_nl - << node->local_name () << " *_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl - << "{" << be_idt_nl - << "::CORBA::add_ref (_tao_elem);" << be_nl - << "_tao_any <<= &_tao_elem;" << be_uidt_nl - << "}" << be_nl << be_nl; - - *os << "// Non-copying insertion." << be_nl - << "void" << be_nl - << "operator<<= (" << be_idt << be_idt_nl - << "::CORBA::Any &_tao_any," << be_nl - << node->local_name () << " **_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl - << "{" << be_idt_nl - << "TAO::Any_Impl_T<" << node->local_name () << ">::insert (" - << be_idt << be_idt_nl - << "_tao_any," << be_nl - << node->local_name () << "::_tao_any_destructor," << be_nl - << node->tc_name ()->last_component () << "," << be_nl - << "*_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl - << "}" << be_nl << be_nl; - - *os << "::CORBA::Boolean" << be_nl - << "operator>>= (" << be_idt << be_idt_nl - << "const ::CORBA::Any &_tao_any," << be_nl - << node->local_name () << " *&_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl - << "{" << be_idt_nl - << "return" << be_idt_nl - << "TAO::Any_Impl_T<" << node->local_name () << ">::extract (" - << be_idt << be_idt_nl - << "_tao_any," << be_nl - << node->local_name () << "::_tao_any_destructor," << be_nl - << node->tc_name ()->last_component () << "," << be_nl - << "_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt << be_uidt_nl - << "}" << be_nl << be_nl; - - be_util::gen_nested_namespace_end (os, module); - - // emit #else - *os << "#else\n"; - } - - *os << be_global->core_versioning_begin () << be_nl; - - *os << "// Copying insertion." << be_nl - << "void" << be_nl - << "operator<<= (" << be_idt << be_idt_nl - << "::CORBA::Any &_tao_any," << be_nl - << node->full_name () << " *_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl - << "{" << be_idt_nl - << "::CORBA::add_ref (_tao_elem);" << be_nl - << "_tao_any <<= &_tao_elem;" << be_uidt_nl - << "}" << be_nl << be_nl; - - *os << "// Non-copying insertion." << be_nl - << "void" << be_nl - << "operator<<= (" << be_idt << be_idt_nl - << "::CORBA::Any &_tao_any," << be_nl - << node->full_name () << " **_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl - << "{" << be_idt_nl - << "TAO::Any_Impl_T<" << node->name () << ">::insert (" - << be_idt << be_idt_nl - << "_tao_any," << be_nl - << node->name () << "::_tao_any_destructor," << be_nl - << node->tc_name () << "," << be_nl - << "*_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl - << "}" << be_nl << be_nl; - - *os << "::CORBA::Boolean" << be_nl - << "operator>>= (" << be_idt << be_idt_nl - << "const ::CORBA::Any &_tao_any," << be_nl - << node->full_name () << " *&_tao_elem" << be_uidt_nl - << ")" << be_uidt_nl - << "{" << be_idt_nl - << "return" << be_idt_nl - << "TAO::Any_Impl_T<" << node->name () << ">::extract (" - << be_idt << be_idt_nl - << "_tao_any," << be_nl - << node->name () << "::_tao_any_destructor," << be_nl - << node->tc_name () << "," << be_nl - << "_tao_elem" << be_uidt_nl - << ");" << be_uidt << be_uidt << be_uidt_nl - << "}" << be_nl << be_nl; - - *os << be_global->core_versioning_end () << be_nl; - - if (module != 0) - { - *os << "\n\n#endif"; - } - - node->cli_stub_any_op_gen (1); - return 0; -} - -int -be_visitor_valuetype_any_op_cs::visit_eventtype (be_eventtype *node) -{ - return this->visit_valuetype (node); -} - diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp deleted file mode 100644 index 87186a23ea3..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp +++ /dev/null @@ -1,303 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// arglist.cpp -// -// = DESCRIPTION -// Visitor generating the parameter list of operations -// in the Valuetype class. -// -// = AUTHOR -// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de> -// based on code from Aniruddha Gokhale -// -// ============================================================================ - -ACE_RCSID (be_visitor_valuetype, - arglist, - "$Id$") - -// ************************************************************ -// Operation visitor to generate the argument list. -// We have separated code generation for this from the 4 main -// visitors to avoid code duplication and tight coupling. -// ************************************************************ - -be_visitor_obv_operation_arglist::be_visitor_obv_operation_arglist ( - be_visitor_context *ctx - ) - : be_visitor_scope (ctx) -{ -} - -be_visitor_obv_operation_arglist::~be_visitor_obv_operation_arglist (void) -{ -} - -bool -be_visitor_obv_operation_arglist::is_amh_exception_holder (be_operation *node) -{ - UTL_Scope *scope = node->defined_in (); - be_interface *iface = be_interface::narrow_from_scope (scope); - - if (iface != 0) - { - if (ACE_OS::strncmp (iface->local_name (), "AMH_", 4) == 0) - { - const char *last_E = ACE_OS::strrchr (iface->full_name (), 'E'); - - if (last_E != 0 - && ACE_OS::strcmp (last_E, "ExceptionHolder") == 0) - { - return true; - } - } - } - - return false; -} - -int -be_visitor_obv_operation_arglist::visit_operation (be_operation *node) -{ - bool amh_valuetype = this->is_amh_exception_holder (node); - TAO_OutStream *os = this->ctx_->stream (); - - *os << " ("; - - if (!be_global->exception_support () || node->nmembers () > 0) - { - *os << be_idt << be_idt_nl; - - // All we do is hand over code generation to our scope. - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_obv_operation_arglist::" - "visit_operation - " - "codegen for scope failed\n"), - -1); - } - - // Generate the ACE_ENV_ARG_DECL parameter for the alternative mapping. - if (!be_global->exception_support ()) - { - /***********************************************************/ - // If it ian an AMHExceptionHolder we are going to generate the - // function definition "in-place" right here. Also all - // AMHExceptionHolder 'raise' methods do not take any - // parameters. So always declare - // ACE_ENV_SINGLE_ARG_DECL_NOT_USED when generating argument - // list for AMHExceptioHolders - /***********************************************************/ - if (amh_valuetype) - { - *os << (be_global->use_raw_throw () - ? "" - : "ACE_ENV_SINGLE_ARG_DECL"); - } - /***********************************************************/ - else - { - // Use ACE_ENV_SINGLE_ARG_DECL or ACE_ENV_ARG_DECL - // depending on whether the operation node has parameters. - - if (node->argument_count () == 0) - { - *os << (be_global->use_raw_throw () - ? "" - : " ACE_ENV_SINGLE_ARG_DECL"); - } - else - { - *os << (be_global->use_raw_throw () - ? "" - : " ACE_ENV_ARG_DECL"); - } - } - - if (!amh_valuetype) - { - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_CH: - // Last argument - is always ACE_ENV_ARG_DECL. - *os << (be_global->use_raw_throw () - ? "" - : "_WITH_DEFAULTS"); - break; - default: - break; - } - } - } - - *os << be_uidt_nl - << ")"; - } - else - { - *os << "void)"; - } - - be_visitor_context ctx = *this->ctx_; - be_visitor_operation operation_visitor (&ctx); - - if (operation_visitor.gen_throw_spec (node) == -1) - { - return -1; - } - - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_CH: - // Each method is pure virtual in the Valuetype class. - // BUT, not if it is an AMH ExceptionHolder! - if (amh_valuetype) - { - *os << ";" << be_uidt; - } - else - { - *os << " = 0;" << be_uidt; - } - break; - case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_CS: - *os << be_uidt; - break; - case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IH: - case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IS: - default: - break; - } - - return 0; -} - -int -be_visitor_obv_operation_arglist::visit_argument (be_argument *node) -{ - be_visitor_context ctx (*this->ctx_); - - // First grab the interface definition inside which this operation is - // defined. We need this since argument types may very well be declared - // inside the scope of the interface node. In such cases, we would like to - // generate the appropriate relative scoped names. - be_operation *op = this->ctx_->be_scope_as_operation (); - - if (!op) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_arglist::" - "visit_argument - " - "Bad operation\n"), - -1); - } - - // We need the interface node in which this operation was defined. However, - // if this operation node was an attribute node in disguise, we get this - // information from the context. - // %! use AST_Interface - be_interface *intf = this->ctx_->attribute () - ? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ()) - : be_interface::narrow_from_scope (op->defined_in ()); - - if (!intf) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_arglist::" - "visit_argument - " - "Bad interface\n"), - -1); - } - - ctx.scope (intf); - ctx.node (node); // save the argument node - - // Retrieve the type. - be_type *bt = be_type::narrow_from_decl (node->field_type ()); - - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_arglist::" - "visit_argument - " - "Bad argument type\n"), - -1); - } - - int status = 0; - - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_CH: - { - be_visitor_args_arglist visitor (&ctx); - status = bt->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_SH: - case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IH: - case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IS: - { - be_visitor_args_arglist visitor (&ctx); - status = bt->accept (&visitor); - break; - } - default: - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_arglist::" - "visit_argument - " - "Bad context\n"), - -1); - } - } - - if (status == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_arglist::" - "visit_argument - " - "codegen for argument failed\n"), - -1); - } - - return 0; -} - -int -be_visitor_obv_operation_arglist::post_process (be_decl *bd) -// derived from be_visitor_operation_argument::post_process (be_decl *bd) -{ - TAO_OutStream *os = this->ctx_->stream (); - - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_CH: - case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_SH: - case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IH: - case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IS: - if (!this->last_node (bd)) - { - *os << ", "; - } - else - { - *os << ""; - } - - break; - default: - break; - } - - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ch.cpp deleted file mode 100644 index 2cfe3923843..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ch.cpp +++ /dev/null @@ -1,103 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// cdr_op_ch.cpp -// -// = DESCRIPTION -// Concrete visitor for valuetypes. -// This one provides code generation for the CDR operators. -// -// = AUTHOR -// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de> -// based on code from Aniruddha Gokhale -// -// ============================================================================ - -ACE_RCSID (be_visitor_valuetype, - cdr_op_ch, - "$Id$") - -be_visitor_valuetype_cdr_op_ch::be_visitor_valuetype_cdr_op_ch ( - be_visitor_context *ctx - ) - : be_visitor_valuetype (ctx) -{ -} - -be_visitor_valuetype_cdr_op_ch::~be_visitor_valuetype_cdr_op_ch (void) -{ -} - -int -be_visitor_valuetype_cdr_op_ch::visit_valuetype (be_valuetype *node) -{ - if (node->imported () - || node->cli_hdr_cdr_op_gen ()) - { - return 0; - } - - TAO_OutStream *os = this->ctx_->stream (); - - // Generate helper functions declaration. - if (node->gen_helper_header () == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_cdr_op_ch::" - "visit_valuetype - " - "codegen for helper functions failed\n"), - -1); - } - - *os << be_nl << be_nl - << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - *os << be_global->core_versioning_begin () << be_nl; - - *os << be_global->stub_export_macro () << " " - << "::CORBA::Boolean operator<< (TAO_OutputCDR &, const " - << node->full_name () << " *);" << be_nl; - - *os << be_global->stub_export_macro () << " " - << "::CORBA::Boolean operator>> (TAO_InputCDR &, " - << node->full_name () << " *&);"; - - *os << be_global->core_versioning_end () << be_nl; - - // Set the substate as generating code for the types defined in our scope. - this->ctx_->sub_state (TAO_CodeGen::TAO_CDR_SCOPE); - - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_cdr_op_ch::" - "visit_valuetype - " - "codegen for scope failed\n"), - -1); - } - - if (!node->is_abstract ()) - { - // Functions that marshal state. - be_visitor_context new_ctx (*this->ctx_); - be_visitor_valuetype_marshal_ch visitor (&new_ctx); - visitor.visit_valuetype (node); - } - - node->cli_hdr_cdr_op_gen (1); - return 0; -} - -int -be_visitor_valuetype_cdr_op_ch::visit_eventtype (be_eventtype *node) -{ - return this->visit_valuetype (node); -} 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 deleted file mode 100644 index 1b7ac0be4b3..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_cs.cpp +++ /dev/null @@ -1,170 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// cdr_op_cs.cpp -// -// = DESCRIPTION -// Concrete visitor for valuetypes. -// This one provides code generation for the CDR operators. -// -// = AUTHOR -// Boris Kolpackov <bosk@ipmce.ru> -// based on code from Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de> -// based on code from Aniruddha Gokhale -// -// ============================================================================ - -ACE_RCSID (be_visitor_valuetype, - valuetype_cdr_op_cs, - "$Id$") - -be_visitor_valuetype_cdr_op_cs::be_visitor_valuetype_cdr_op_cs ( - be_visitor_context *ctx - ) - : be_visitor_valuetype (ctx) -{ -} - -be_visitor_valuetype_cdr_op_cs::~be_visitor_valuetype_cdr_op_cs (void) -{ -} - -int -be_visitor_valuetype_cdr_op_cs::visit_valuetype (be_valuetype *node) -{ - // Already generated and/or we are imported. Don't do anything. - if (node->cli_stub_cdr_op_gen () - || node->imported () - || ! node->is_defined ()) - { - return 0; - } - - // Generate helper functions implementation. - if (node->gen_helper_stubs () == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_cdr_op_cs::" - "visit_valuetype - " - "codegen for helper functions failed\n"), - -1); - } - - TAO_OutStream *os = this->ctx_->stream (); - node->cli_stub_cdr_op_gen (true); - - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_cdr_op_ci" - "::visit_valuetype - " - "codegen for scope failed\n"), - -1); - } - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - *os << be_global->core_versioning_begin () << be_nl; - - // 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 - << "const " << node->full_name () - << " *_tao_valuetype" << be_uidt_nl - << ")" << be_uidt_nl - << "{" << be_idt_nl; - *os << "return" << be_idt_nl - << "::CORBA::ValueBase::_tao_marshal (" << be_idt << be_idt_nl - << "strm," << be_nl - << "_tao_valuetype," << be_nl - << "reinterpret_cast<ptrdiff_t> (&" - << node->full_name () << "::_downcast)" - << be_uidt_nl - << ");" << be_uidt << be_uidt << be_uidt_nl - << "}" << be_nl << be_nl; - - *os << "::CORBA::Boolean" << be_nl - << "operator>> (" << be_idt << be_idt_nl - << "TAO_InputCDR &strm," << be_nl - << node->full_name () - << " *&_tao_valuetype" << be_uidt_nl - << ")" << be_uidt_nl - << "{" << be_idt_nl; - *os << "return " << node->full_name () - << "::_tao_unmarshal (strm, _tao_valuetype);" - << be_uidt_nl - << "}" << be_nl << be_nl; - - *os << be_global->core_versioning_end () << be_nl; - - if (!node->is_abstract ()) - { - // Functions that marshal state. - be_visitor_context new_ctx (*this->ctx_); - be_visitor_valuetype_marshal_cs visitor (&new_ctx); - visitor.visit_valuetype (node); - } - - return 0; -} - -int -be_visitor_valuetype_cdr_op_cs::visit_eventtype (be_eventtype *node) -{ - return this->visit_valuetype (node); -} - -// @@@ (JP) The following three methods are a hack to get CDR -// operators generated for anonymous array and sequence -// valuetype members. This should be done like it is in structs, -// but part of that mechanism is used by valuetypes for -// generating code to marshal the state. Someday this should -// be untangled and made consistent. - -int -be_visitor_valuetype_cdr_op_cs::visit_field (be_field *node) -{ - be_type *bt = be_type::narrow_from_decl (node->field_type ()); - - if (bt == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_field_cdr_op_ci::" - "visit_field - " - "Bad field type\n"), - -1); - } - - // Save the node. - this->ctx_->node (node); - - if (bt->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_cdr_op_ci::" - "visit_field - " - "codegen for field type failed\n"), - -1); - } - - return 0; -} - -int -be_visitor_valuetype_cdr_op_cs::visit_sequence (be_sequence *node) -{ - be_visitor_context ctx (*this->ctx_); - be_visitor_sequence_cdr_op_cs visitor (&ctx); - return node->accept (&visitor); -} diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/field_cdr_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/field_cdr_ch.cpp deleted file mode 100644 index a72fc8de0b5..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/field_cdr_ch.cpp +++ /dev/null @@ -1,216 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// field_cdr_ch.cpp -// -// = DESCRIPTION -// Visitor generating code for Field in the client header file. -// -// = AUTHOR -// Jeff Parsons -// -// ============================================================================ - -ACE_RCSID (be_visitor_valuetype, - field_cdr_op_ch, - "$Id$") - -// ********************************************** -// Visitor for field in the client header file. -// ********************************************** - -be_visitor_valuetype_field_cdr_ch::be_visitor_valuetype_field_cdr_ch ( - be_visitor_context *ctx - ) - : be_visitor_decl (ctx), - pre_ (""), - post_ ("") -{ -} - -be_visitor_valuetype_field_cdr_ch::~be_visitor_valuetype_field_cdr_ch (void) -{ -} - -int -be_visitor_valuetype_field_cdr_ch::visit_field (be_field *node) -{ - be_type *bt = be_type::narrow_from_decl (node->field_type ()); - - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_ch::" - "visit_field - " - "Bad field type\n"), - -1); - } - - this->ctx_->node (node); - - if (bt->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_ch::" - "visit_field - " - "codegen for field type failed\n"), - -1); - } - - return 0; -} - -// Visit operations on all possible data types that a field can be - -int -be_visitor_valuetype_field_cdr_ch::visit_array (be_array *node) -{ - // If not a typedef and we are defined in the use scope, we must be defined. - if (!this->ctx_->alias () - && node->is_child (this->ctx_->scope ())) - { - // This is the case for anonymous arrays. - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - be_visitor_array_cdr_op_ch visitor (&ctx); - - if (node->accept (&visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_ch::" - "visit_array - " - "codegen failed\n"), - -1); - } - } - - return 0; -} - -int -be_visitor_valuetype_field_cdr_ch::visit_enum (be_enum *node) -{ - // If not a typedef and we are defined in the use scope, we must be defined. - if (!this->ctx_->alias () - && node->is_child (this->ctx_->scope ())) - { - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - be_visitor_enum_cdr_op_ch visitor (&ctx); - - if (node->accept (&visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_ch::" - "visit_enum - " - "codegen failed\n"), - -1); - } - } - - return 0; -} - -int -be_visitor_valuetype_field_cdr_ch::visit_sequence (be_sequence *node) -{ - // If not a typedef and we are defined in the use scope, we must be defined. - if (!this->ctx_->alias () // not a typedef - && node->is_child (this->ctx_->scope ())) - { - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - be_visitor_sequence_cdr_op_ch visitor (&ctx); - - if (node->accept (&visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_ch::" - "visit_sequence - " - "codegen failed\n"), - -1); - } - } - - return 0; -} - -int -be_visitor_valuetype_field_cdr_ch::visit_structure (be_structure *node) -{ - // If not a typedef and we are defined in the use scope, we must be defined. - if (!this->ctx_->alias () - && node->is_child (this->ctx_->scope ())) - { - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - be_visitor_structure_cdr_op_ch visitor (&ctx); - - if (node->accept (&visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_ch::" - "visit_struct - " - "codegen failed\n"), - -1); - } - } - - return 0; -} - -int -be_visitor_valuetype_field_cdr_ch::visit_typedef (be_typedef *node) -{ - // Save the node for use in code generation and - // indicate that the field of the field node - // is a typedefed quantity. - this->ctx_->alias (node); - - // Make a decision based on the primitive base type. - be_type *bt = node->primitive_base_type (); - - if (!bt || (bt->accept (this) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_ch::" - "visit_typedef - " - "Bad primitive type\n"), - -1); - } - - this->ctx_->alias (0); - return 0; -} - -int -be_visitor_valuetype_field_cdr_ch::visit_union (be_union *node) -{ - // If not a typedef and we are defined in the use scope, we must be defined. - if (!this->ctx_->alias () - && node->is_child (this->ctx_->scope ())) - { - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - be_visitor_union_cdr_op_ch visitor (&ctx); - - if (node->accept (&visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_ch::" - "visit_enum - " - "codegen failed\n"), - -1); - } - } - - return 0; -} - diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/field_cdr_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/field_cdr_cs.cpp deleted file mode 100644 index c89015e7bcd..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/field_cdr_cs.cpp +++ /dev/null @@ -1,974 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// field_cdr_cs.cpp -// -// = DESCRIPTION -// Visitor generating code for Field in the client stubs file. -// -// = AUTHOR -// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de> -// derived from be_visitor_field/cdr_op_cs.cpp -// -// ============================================================================ - -ACE_RCSID (be_visitor_valuetype, - field_cdr_op_cs, - "$Id$") - -// ********************************************** -// Visitor for field in the client inline file. -// ********************************************** - -be_visitor_valuetype_field_cdr_cs::be_visitor_valuetype_field_cdr_cs ( - be_visitor_context *ctx - ) - : be_visitor_decl (ctx), - pre_ (""), - post_ ("") -{ -} - -be_visitor_valuetype_field_cdr_cs::~be_visitor_valuetype_field_cdr_cs (void) -{ -} - -int -be_visitor_valuetype_field_cdr_cs::visit_field (be_field *node) -{ - be_type *bt = be_type::narrow_from_decl (node->field_type ()); - - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_cs::" - "visit_field - " - "Bad field type\n"), - -1); - } - - this->ctx_->node (node); - - if (bt->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_cs::" - "visit_field - " - "codegen for field type failed\n"), - -1); - } - - return 0; -} - -int -be_visitor_valuetype_field_cdr_cs::visit_array (be_array *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - // Retrieve the field node. - be_field *f = this->ctx_->be_node_as_field (); - - if (!f) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_cs::" - "visit_array - " - "cannot retrieve field node\n"), - -1); - } - - // For anonymous arrays, the type name has a _ prepended. We compute - // the full_name with or without the underscore and use it later on. - char fname [NAMEBUFSIZE]; - ACE_OS::memset (fname, - '\0', - NAMEBUFSIZE); - - if (!this->ctx_->alias () - && node->is_child (this->ctx_->scope ())) - { - // For anonymous arrays ... - // We have to generate a name for us that has an underscore - // prepended to our local name. This needs to be inserted after - // the parents's name. - - if (node->is_nested ()) - { - be_decl *parent = - be_scope::narrow_from_scope (node->defined_in ())->decl (); - ACE_OS::sprintf (fname, - "%s::_%s", - parent->full_name (), - node->local_name ()->get_string ()); - } - else - { - ACE_OS::sprintf (fname, - "_%s", - node->full_name ()); - } - } - else - { - // Typedefed node. - ACE_OS::sprintf (fname, - "%s", - node->full_name ()); - } - - // Check what is the code generation substate. Are we generating - // code for the in/out operators for our parent or for us? - switch (this->ctx_->sub_state ()) - { - case TAO_CodeGen::TAO_CDR_INPUT: - *os << "(strm >> " - << "_tao_" << this->pre_ << f->local_name () - << this->post_ << ")"; - return 0; - case TAO_CodeGen::TAO_CDR_OUTPUT: - *os << "(strm << " - << "_tao_" << this->pre_ << f->local_name () - << this->post_ << ")"; - return 0; - case TAO_CodeGen::TAO_CDR_SCOPE: - // Proceed further. - break; - default: - // Error. - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_cs::" - "visit_array - " - "bad sub state\n"), - -1); - } - - // If not a typedef and we are defined in the use scope, we must be defined. - if (!this->ctx_->alias () // not a typedef - && node->is_child (this->ctx_->scope ())) - { - // This is the case for anonymous arrays. - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - be_visitor_array_cdr_op_cs visitor (&ctx); - - if (node->accept (&visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_cs::" - "visit_array - " - "codegen failed\n"), - -1); - } - } - - return 0; -} - -int -be_visitor_valuetype_field_cdr_cs::visit_enum (be_enum *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - // Retrieve the field node. - be_field *f = this->ctx_->be_node_as_field (); - - if (!f) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_cs::" - "visit_array - " - "cannot retrieve field node\n"), - -1); - } - - // Check what is the code generation substate. Are we generating code for - // the in/out operators for our parent or for us? - switch (this->ctx_->sub_state ()) - { - case TAO_CodeGen::TAO_CDR_INPUT: - *os << "(strm >> " << this->pre_ << f->local_name () - << this->post_ << ")"; - return 0; - case TAO_CodeGen::TAO_CDR_OUTPUT: - *os << "(strm << " << this->pre_ << f->local_name () - << this->post_ << ")"; - return 0; - case TAO_CodeGen::TAO_CDR_SCOPE: - // Proceed further. - break; - default: - // Error. - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_cs::" - "visit_enum - " - "bad sub state\n"), - -1); - } - - if (node->node_type () != AST_Decl::NT_typedef - && node->is_child (this->ctx_->scope ())) - { - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - be_visitor_enum_cdr_op_cs visitor (&ctx); - - if (node->accept (&visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_cs::" - "visit_enum - " - "codegen failed\n"), - -1); - } - } - - return 0; -} - -int -be_visitor_valuetype_field_cdr_cs::visit_interface (be_interface *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - // Retrieve the field node. - be_field *f = this->ctx_->be_node_as_field (); - - if (!f) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_cs::" - "visit_interface - " - "cannot retrieve field node\n"), - -1); - } - - // Check what is the code generations substate. Are we generating code for - // the in/out operators for our parent or for us? - switch (this->ctx_->sub_state ()) - { - case TAO_CodeGen::TAO_CDR_INPUT: - *os << "(strm >> " << this->pre_ << f->local_name () - << this->post_ << ".out ())"; - break; - case TAO_CodeGen::TAO_CDR_OUTPUT: - *os << "TAO::Objref_Traits< ::" << node->name () - << ">::marshal (" << be_idt << be_idt_nl - << this->pre_ << f->local_name () - << this->post_ << ".in (), " << be_nl - << "strm" << be_uidt_nl - << ")" << be_uidt; - break; - case TAO_CodeGen::TAO_CDR_SCOPE: - // Nothing to be done because an interface cannit be declared inside a - // structure. - break; - default: - // Error. - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_cs::" - "visit_interface - " - "bad sub state\n"), - -1); - } - - return 0; -} - -int -be_visitor_valuetype_field_cdr_cs::visit_interface_fwd (be_interface_fwd *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - // Retrieve the field node. - be_field *f = this->ctx_->be_node_as_field (); - - if (!f) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_cs::" - "visit_interface_fwd - " - "cannot retrieve field node\n"), - -1); - } - - // Check what is the code generations substate. Are we generating code for - // the in/out operators for our parent or for us? - switch (this->ctx_->sub_state ()) - { - case TAO_CodeGen::TAO_CDR_INPUT: - *os << "(strm >> " << this->pre_ << f->local_name () - << this->post_ << ").out ()"; - break; - case TAO_CodeGen::TAO_CDR_OUTPUT: - *os << "TAO::Objref_Traits< ::" << node->name () - << ">::marshal (" << be_idt << be_idt_nl - << this->pre_ << f->local_name () - << this->post_ << ".in (), " << be_nl - << "strm" << be_uidt_nl - << ")" << be_uidt; - break; - case TAO_CodeGen::TAO_CDR_SCOPE: - // Nothing to be done because an interface cannot be declared inside a - // structure. - break; - default: - // Error. - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_cs::" - "visit_interface_fwd - " - "bad sub state\n"), - -1); - } - - return 0; -} - -int -be_visitor_valuetype_field_cdr_cs::visit_valuebox (be_valuebox * node) -{ - return this->valuetype_common (node); -} - -int -be_visitor_valuetype_field_cdr_cs::valuetype_common (be_type *) -{ - TAO_OutStream *os = this->ctx_->stream (); - - // Retrieve the field node. - be_field *f = this->ctx_->be_node_as_field (); - - if (!f) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_cs::" - "visit_valuetype - " - "cannot retrieve field node\n"), - -1); - } - - // Check what is the code generations substate. Are we generating code for - // the in/out operators for our parent or for us? - switch (this->ctx_->sub_state ()) - { - case TAO_CodeGen::TAO_CDR_INPUT: - *os << "(strm >> " << this->pre_ << f->local_name () - << this->post_ << ".out ())"; - break; - case TAO_CodeGen::TAO_CDR_OUTPUT: - *os << "(strm << " << this->pre_ << f->local_name () - << this->post_ << ".in ())"; - break; - case TAO_CodeGen::TAO_CDR_SCOPE: - // Nothing to be done because a valuetype cannit be declared inside a - // structure. - break; - default: - // Error. - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_cs::" - "visit_valuetype - " - "bad sub state\n"), - -1); - } - - return 0; -} - -int -be_visitor_valuetype_field_cdr_cs::visit_valuetype (be_valuetype * node) -{ - return this->valuetype_common (node); -} - -int -be_visitor_valuetype_field_cdr_cs::visit_valuetype_fwd (be_valuetype_fwd *) -{ - TAO_OutStream *os = this->ctx_->stream (); - - // Retrieve the field node. - be_field *f = this->ctx_->be_node_as_field (); - - if (!f) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_cs::" - "visit_valuetype_fwd - " - "cannot retrieve field node\n"), - -1); - } - - // Check what is the code generations substate. Are we generating code for - // the in/out operators for our parent or for us? - switch (this->ctx_->sub_state ()) - { - case TAO_CodeGen::TAO_CDR_INPUT: - *os << "(strm >> " << this->pre_ << f->local_name () - << this->post_ << ").out ()"; - break; - case TAO_CodeGen::TAO_CDR_OUTPUT: - *os << "(strm << " << this->pre_ << f->local_name () - << this->post_ << ").in ()"; - break; - case TAO_CodeGen::TAO_CDR_SCOPE: - // Nothing to be done because a valuetype cannot be declared inside a - // structure. - break; - default: - // Error. - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_cs::" - "visit_valuetype_fwd - " - "bad sub state\n"), - -1); - } - - return 0; -} - -int -be_visitor_valuetype_field_cdr_cs::visit_component (be_component *node) -{ - return this->visit_interface (node); -} - -int -be_visitor_valuetype_field_cdr_cs::visit_component_fwd (be_component_fwd *node) -{ - return this->visit_interface_fwd (node); -} - -int -be_visitor_valuetype_field_cdr_cs::visit_eventtype (be_eventtype *node) -{ - return this->visit_valuetype (node); -} - -int -be_visitor_valuetype_field_cdr_cs::visit_eventtype_fwd (be_eventtype_fwd *node) -{ - return this->visit_valuetype_fwd (node); -} - -int -be_visitor_valuetype_field_cdr_cs::visit_predefined_type (be_predefined_type *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - // Retrieve the field node. - be_field *f = this->ctx_->be_node_as_field (); - - if (!f) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_cs::" - "visit_predefined_type - " - "cannot retrieve field node\n"), - -1); - } - - AST_PredefinedType::PredefinedType pt = node->pt (); - - // Check what is the code generations substate. Are we generating code for - // the in/out operators for our parent or for us? - switch (this->ctx_->sub_state ()) - { - case TAO_CodeGen::TAO_CDR_INPUT: - if (pt == AST_PredefinedType::PT_pseudo - || pt == AST_PredefinedType::PT_object) - { - *os << "(strm >> " << this->pre_ << f->local_name () - << this->post_ << ".out ())"; - } - else if (pt == AST_PredefinedType::PT_char) - { - *os << "(strm >> ::ACE_InputCDR::to_char (" - << this->pre_ << f->local_name () << this->post_ << "))"; - } - else if (pt == AST_PredefinedType::PT_wchar) - { - *os << "(strm >> ::ACE_InputCDR::to_wchar (" - << this->pre_ << f->local_name () << this->post_ << "))"; - } - else if (pt == AST_PredefinedType::PT_octet) - { - *os << "(strm >> ::ACE_InputCDR::to_octet (" - << this->pre_ << f->local_name () << this->post_ << "))"; - } - else if (pt == AST_PredefinedType::PT_boolean) - { - *os << "(strm >> ::ACE_InputCDR::to_boolean (" - << this->pre_ << f->local_name () << this->post_ << "))"; - } - else - { - *os << "(strm >> " << this->pre_ << f->local_name () - << this->post_ << ")"; - } - break; - case TAO_CodeGen::TAO_CDR_OUTPUT: - if (pt == AST_PredefinedType::PT_pseudo - || pt == AST_PredefinedType::PT_object) - { - *os << "(strm << " << this->pre_ << f->local_name () - << this->post_ << ".in ())"; - } - else if (pt == AST_PredefinedType::PT_char) - { - *os << "(strm << ::ACE_OutputCDR::from_char (" - << this->pre_ << f->local_name () << this->post_ << "))"; - } - else if (pt == AST_PredefinedType::PT_wchar) - { - *os << "(strm << ::ACE_OutputCDR::from_wchar (" - << this->pre_ << f->local_name () << this->post_ << "))"; - } - else if (pt == AST_PredefinedType::PT_octet) - { - *os << "(strm << ::ACE_OutputCDR::from_octet (" - << this->pre_ << f->local_name () << this->post_ << "))"; - } - else if (pt == AST_PredefinedType::PT_boolean) - { - *os << "(strm << ::ACE_OutputCDR::from_boolean (" - << this->pre_ << f->local_name () << this->post_ << "))"; - } - else - { - *os << "(strm << " << this->pre_ << f->local_name () - << this->post_ << ")"; - } - break; - case TAO_CodeGen::TAO_CDR_SCOPE: - // Nothing to be done. - break; - default: - // Error. - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_cs::" - "visit_array - " - "bad sub state\n"), - -1); - } - - return 0; -} - -int -be_visitor_valuetype_field_cdr_cs::visit_sequence (be_sequence *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - // Retrieve the field node. - be_field *f = this->ctx_->be_node_as_field (); - - if (!f) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_cs::" - "visit_sequence - " - "cannot retrieve field node\n" ), - -1); - } - - // Check what is the code generations substate. Are we generating code for - // the in/out operators for our parent or for us? - switch (this->ctx_->sub_state ()) - { - case TAO_CodeGen::TAO_CDR_INPUT: - *os << "(strm >> " << this->pre_ << f->local_name () - << this->post_ << ")"; - return 0; - case TAO_CodeGen::TAO_CDR_OUTPUT: - *os << "(strm << " << this->pre_ << f->local_name () - << this->post_ << ")"; - return 0; - case TAO_CodeGen::TAO_CDR_SCOPE: - // Proceed further. - break; - default: - // Error. - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_cs::" - "visit_sequence - " - "bad sub state\n"), - -1); - } - - if (node->node_type () != AST_Decl::NT_typedef - && node->is_child (this->ctx_->scope ())) - // Not a typedef AND - // node is defined inside the valuetype. - { - // Anonymous sequence. - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - be_visitor_sequence_cdr_op_cs visitor (&ctx); - - if (node->accept (&visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_cs::" - "visit_sequence - " - "codegen failed\n"), - -1); - } - } - - return 0; -} - -int -be_visitor_valuetype_field_cdr_cs::visit_string (be_string *) -{ - TAO_OutStream *os = this->ctx_->stream (); - - // Retrieve the field node. - be_field *f = this->ctx_->be_node_as_field (); - - if (!f) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_cs::" - "visit_string - " - "cannot retrieve field node\n"), - -1); - } - - // Check what is the code generations substate. Are we generating code for - // the in/out operators for our parent or for us? - switch (this->ctx_->sub_state ()) - { - case TAO_CodeGen::TAO_CDR_INPUT: - *os << "(strm >> " << this->pre_ << f->local_name () - << this->post_ << ".out ())"; - break; - case TAO_CodeGen::TAO_CDR_OUTPUT: - *os << "(strm << " << this->pre_ << f->local_name () - << this->post_ << ".in ())"; - break; - case TAO_CodeGen::TAO_CDR_SCOPE: - // Nothing to be done. - break; - default: - // Error. - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_cs::" - "visit_array - " - "bad sub state\n"), - -1); - } - - return 0; -} - -int -be_visitor_valuetype_field_cdr_cs::visit_structure (be_structure *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - // Retrieve the field node. - be_field *f = this->ctx_->be_node_as_field (); - - if (!f) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_cs::" - "visit_structure - " - "cannot retrieve field node\n"), - -1); - } - - // Check what is the code generations substate. Are we generating code for - // the in/out operators for our parent or for us? - switch (this->ctx_->sub_state ()) - { - case TAO_CodeGen::TAO_CDR_INPUT: - *os << "(strm >> " << this->pre_ << f->local_name () - << this->post_ << ")"; - return 0; - case TAO_CodeGen::TAO_CDR_OUTPUT: - *os << "(strm << " << this->pre_ << f->local_name () - << this->post_ << ")"; - return 0; - case TAO_CodeGen::TAO_CDR_SCOPE: - // Proceed further. - break; - default: - // Error. - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_cs::" - "visit_structure - " - "bad sub state\n"), - -1); - } - - if (node->node_type () != AST_Decl::NT_typedef - && node->is_child (this->ctx_->scope ())) - { - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - be_visitor_structure_cdr_op_cs visitor (&ctx); - - if (node->accept (&visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_cs::" - "visit_struct - " - "codegen failed\n"), - -1); - } - } - - return 0; -} - -int -be_visitor_valuetype_field_cdr_cs::visit_typedef (be_typedef *node) -{ - this->ctx_->alias (node); - - // The node to be visited in the base primitve type that gets typedefed. - be_type *bt = node->primitive_base_type (); - - if (!bt || (bt->accept (this) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_union_branch_public_cs::" - "visit_typedef - " - "Bad primitive type\n"), - -1); - } - - this->ctx_->alias (0); - return 0; -} - -int -be_visitor_valuetype_field_cdr_cs::visit_union (be_union *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - // Retrieve the field node. - be_field *f = this->ctx_->be_node_as_field (); - - if (!f) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_cs::" - "visit_union - " - "cannot retrieve field node\n"), - -1); - } - - // Check what is the code generations substate. Are we generating code for - // the in/out operators for our parent or for us? - switch (this->ctx_->sub_state ()) - { - case TAO_CodeGen::TAO_CDR_INPUT: - *os << "(strm >> " << this->pre_ << f->local_name () - << this->post_ << ")"; - return 0; - case TAO_CodeGen::TAO_CDR_OUTPUT: - *os << "(strm << " << this->pre_ << f->local_name () - << this->post_ << ")"; - return 0; - case TAO_CodeGen::TAO_CDR_SCOPE: - // Proceed further. - break; - default: - // Error. - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_cs::" - "visit_union - " - "bad sub state\n"), - -1); - } - - if (node->node_type () != AST_Decl::NT_typedef - && node->is_child (this->ctx_->scope ())) - { - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - be_visitor_union_cdr_op_cs visitor (&ctx); - - if (node->accept (&visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_cs::" - "visit_union - " - "codegen failed\n"), - -1); - } - } - - return 0; -} - - -// **************************************************************** - -be_visitor_valuetype_field_cdr_decl::be_visitor_valuetype_field_cdr_decl ( - be_visitor_context *ctx - ) - : be_visitor_scope (ctx) -{ -} - -// This is a field, but the action depends on the type of the field, -// use this visitor to detect the type of the field. -// Notice that this is why the parent visitor (who create us) cannot -// do the job, because it may have another purpose for some or all of -// the visit_* methods; in other words, while running a visitor to -// generate CDR operators for structures we cannot use that one to -// generate the code of each field, because visit_struct already has a -// meaning in that visitor. -int -be_visitor_valuetype_field_cdr_decl::visit_field (be_field *node) -{ - be_type *bt = be_type::narrow_from_decl (node->field_type ()); - - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_decl::" - "visit_field - " - "Bad field type\n"), - -1); - } - - // @@ Shouldn't this be saved in the visitor and not the context?! - this->ctx_->node (node); - - if (bt->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_decl::" - "visit_field - " - "codegen for field type failed\n"), - -1); - } - - return 0; -} - -int -be_visitor_valuetype_field_cdr_decl::visit_array (be_array *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - // Retrieve the field node. - be_field *f = this->ctx_->be_node_as_field (); - - if (!f) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_decl::" - "visit_array - " - "cannot retrieve field node\n"), - -1); - } - - // Retrieve the valuetype scope in which the code is generated. - be_decl *sc = this->ctx_->scope (); - be_valuetype *vt = be_valuetype::narrow_from_decl (sc); - - if (!vt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_decl::" - "visit_array - " - "cannot retrieve valuetype node\n"), - -1); - } - - // For anonymous arrays, the type name has a _ prepended. We compute - // the full_name with or without the underscore and use it later on. - char fname [NAMEBUFSIZE]; - ACE_OS::memset (fname, - '\0', - NAMEBUFSIZE); - - if (!this->ctx_->alias () - && node->is_child (this->ctx_->scope ())) - { - // For anonymous arrays ... - // We have to generate a name for us that has an underscope - // prepended to our local name. This needs to be inserted after - // the parent's name. - - if (node->is_nested ()) - { - be_decl *parent = - be_scope::narrow_from_scope (node->defined_in ())->decl (); - ACE_OS::sprintf (fname, - "%s::_%s", - parent->full_name (), - node->local_name ()->get_string ()); - } - else - { - ACE_OS::sprintf (fname, - "_%s", - node->full_name ()); - } - } - else - { - // Typedefed node. - ACE_OS::sprintf (fname, - "%s", - node->full_name ()); - } - - // Check what is the code generation substate. Are we generating code for - // the in/out operators for our parent or for us? - switch (this->ctx_->sub_state ()) - { - case TAO_CodeGen::TAO_CDR_INPUT: - case TAO_CodeGen::TAO_CDR_OUTPUT: - *os << fname << "_forany " - << "_tao_" << vt->field_pd_prefix () << f->local_name () - << vt->field_pd_postfix () << be_idt << be_idt_nl - << "(const_cast<" << be_idt << be_idt_nl - << fname << "_slice*> (" << be_nl - << vt->field_pd_prefix () << f->local_name () - << vt->field_pd_postfix () << be_uidt_nl - << ")" << be_uidt << be_uidt_nl - << ");" << be_uidt_nl; - return 0; - case TAO_CodeGen::TAO_CDR_SCOPE: - default: - // Error. - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cdr_decl::" - "visit_array - "), - -1); - } -} - -int -be_visitor_valuetype_field_cdr_decl::visit_typedef (be_typedef *node) -{ - this->ctx_->alias (node); - be_type *bt = node->primitive_base_type (); - - if (!bt || (bt->accept (this) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_cdr_op_field_decl::" - "visit_typedef - " - "Bad primitive type\n"), - -1); - } - - this->ctx_->alias (0); - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/field_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/field_ch.cpp deleted file mode 100644 index 5a245ed5c27..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/field_ch.cpp +++ /dev/null @@ -1,821 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// field_ch.cpp -// -// = DESCRIPTION -// Visitor generating the accessor and modifier declarations -// for valuetype fields in the valuetype class (header). -// -// = AUTHOR -// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de> -// derived from be_visitor_union_branch/public_ch.cpp -// -// ============================================================================ - -ACE_RCSID (be_visitor_valuetype, - field_ch, - "$Id$") - -be_visitor_valuetype_field_ch::be_visitor_valuetype_field_ch ( - be_visitor_context *ctx - ) - : be_visitor_decl (ctx) -{ - setenclosings ("", ";"); -} - -be_visitor_valuetype_field_ch::~be_visitor_valuetype_field_ch (void) -{ -} - -int -be_visitor_valuetype_field_ch::visit_field (be_field *node) -{ - be_type *bt = be_type::narrow_from_decl (node->field_type ()); - - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_ch::" - "visit_union_branch - " - "Bad type\n"), - -1); - } - - this->ctx_->node (node); // save the node - - this->visibility_ = node->visibility (); - - if (bt->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_ch::" - "visit_union_branch - " - "codegen failed\n"), - -1); - } - - return 0; -} - -// Visit operations on all possible data types (valuetype state member). - -int -be_visitor_valuetype_field_ch::visit_array (be_array *node) -{ - be_decl *ub = this->ctx_->node (); - be_decl *bu = this->ctx_->scope (); - be_type *bt; - - // Check if we are visiting this via a visit to a typedef node. - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - if (!ub || !bu) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_ch::" - "visit_array - " - "bad context information\n"), - -1); - } - - TAO_OutStream *os = this->ctx_->stream (); - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - if (bt->node_type () != AST_Decl::NT_typedef - && bt->is_child (bu)) - { - // This is the case of an anonymous array inside a valuetype. - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - ctx.state (TAO_CodeGen::TAO_ARRAY_CH); - be_visitor_array_ch visitor (&ctx); - - if (node->accept (&visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_ch::" - "visit_array - " - "codegen failed\n"), - -1); - } - - ctx.state (TAO_CodeGen::TAO_ROOT_CH); - - // Now use this array as a "type" for the subsequent declarator - // the set method. - *os << pre_op () << "void " << ub->local_name () << " (" - << "_" << bt->local_name () << ")" - << post_op () << be_nl; - // The get method. - *os << pre_op () << "const _" << bt->local_name () - << "_slice * " << ub->local_name () - << " (void) const" << post_op () << be_nl; - *os << pre_op () << "_" << bt->local_name () - << "_slice * " << ub->local_name () - << " (void)" << post_op (); - } - else - { - // Now use this array as a "type" for the subsequent declarator. - // The set method. - *os << pre_op () << "void " << ub->local_name () << " (const " - << bt->name () << ")" << post_op () << be_nl; - // The get method. - *os << pre_op () - << bt->name () << "_slice *" << ub->local_name () - << " (void)" << post_op () << be_nl; - // The get (read/write) method. - *os << pre_op () << "const " - << bt->name () << "_slice *" << ub->local_name () - << " (void) const" << post_op (); - } - - return 0; -} - -int -be_visitor_valuetype_field_ch::visit_enum (be_enum *node) -{ - be_decl *ub = this->ctx_->node (); - be_decl *bu = this->ctx_->scope (); - be_type *bt; - - // Check if we are visiting this via a visit to a typedef node. - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - if (!ub || !bu) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_ch::" - "visit_enum - " - "bad context information\n"), - -1); - } - - TAO_OutStream *os = this->ctx_->stream (); - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - if (bt->node_type () != AST_Decl::NT_typedef - && bt->is_child (bu)) - { - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - be_visitor_enum_ch visitor (&ctx); - - if (node->accept (&visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_ch::" - "visit_enum - " - "codegen failed\n"), - -1); - } - } - - // Now use this enum as a "type" for the subsequent declarator - // the set method. - *os << pre_op () << "void " << ub->local_name () << " (" - << bt->name () << ")" << post_op () << be_nl; - // The get method. - *os << pre_op () << bt->name () << " " << ub->local_name () - << " (void) const" << post_op (); - - return 0; -} - -int -be_visitor_valuetype_field_ch::visit_interface (be_interface *node) -{ - be_decl *ub = this->ctx_->node (); - be_decl *bu = this->ctx_->scope (); - be_type *bt; - - // Check if we are visiting this via a visit to a typedef node. - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - if (!ub || !bu) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_ch::" - "visit_interface - " - "bad context information\n"), - -1); - } - - TAO_OutStream *os = this->ctx_->stream (); - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - // Set method. - *os << pre_op() << "void " << ub->local_name () << " (" - << bt->name () << "_ptr" - << ")" << post_op() << be_nl; - // Get method. - *os << pre_op() - << bt->name () << "_ptr " << ub->local_name () - << " (void) const" << post_op(); - - return 0; -} - -int -be_visitor_valuetype_field_ch::visit_interface_fwd (be_interface_fwd *node) -{ - be_decl *ub = this->ctx_->node (); - be_decl *bu = this->ctx_->scope (); - be_type *bt; - - // Check if we are visiting this via a visit to a typedef node. - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - if (!ub || !bu) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_ch::" - "visit_interface_fwd - " - "bad context information\n"), - -1); - } - - TAO_OutStream *os = this->ctx_->stream (); - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - // Set method. - *os << pre_op () << "void " << ub->local_name () << " (" - << bt->name () << "_ptr" - << ")" << post_op () << be_nl; - // Get method. - *os << pre_op () - << bt->name () << "_ptr " << ub->local_name () - << " (void) const" << post_op (); - - return 0; -} - -int -be_visitor_valuetype_field_ch::visit_valuebox (be_valuebox *node) -{ - be_decl *ub = this->ctx_->node (); - be_decl *bu = this->ctx_->scope (); - be_type *bt; - - // Check if we are visiting this via a visit to a typedef node. - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - if (!ub || !bu) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_ch::" - "visit_valuebox - " - "bad context information\n"), - -1); - } - - TAO_OutStream *os = this->ctx_->stream (); - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - // Set method. - *os << pre_op () << "void " << ub->local_name () << " (" - << bt->name () << " *" - << ")" << post_op () << be_nl; - // Get method. - *os << pre_op () - << bt->name () << " *" << ub->local_name () - << " (void) const" << post_op (); - - return 0; -} - -int -be_visitor_valuetype_field_ch::visit_valuetype (be_valuetype *node) -{ - be_decl *ub = this->ctx_->node (); - be_decl *bu = this->ctx_->scope (); - be_type *bt; - - // Check if we are visiting this via a visit to a typedef node. - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - if (!ub || !bu) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_ch::" - "visit_valuetype - " - "bad context information\n"), - -1); - } - - TAO_OutStream *os = this->ctx_->stream (); - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - // Set method. - *os << pre_op () << "void " << ub->local_name () << " (" - << bt->name () << " *" - << ")" << post_op () << be_nl; - // Get method. - *os << pre_op () - << bt->name () << " *" << ub->local_name () - << " (void) const" << post_op (); - - return 0; -} - -int -be_visitor_valuetype_field_ch::visit_eventtype (be_eventtype *node) -{ - return this->visit_valuetype (node); -} - -int -be_visitor_valuetype_field_ch::visit_valuetype_fwd (be_valuetype_fwd *node) -{ - be_decl *ub = this->ctx_->node (); - be_decl *bu = this->ctx_->scope (); - be_type *bt; - - // Check if we are visiting this via a visit to a typedef node. - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - if (!ub || !bu) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_ch::" - "visit_valuetype_fwd - " - "bad context information\n"), - -1); - } - - TAO_OutStream *os = this->ctx_->stream (); - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - // Set method. - *os << pre_op () << "void " << ub->local_name () << " (" - << bt->name () << " *" - << ")" << post_op () << be_nl; - // Get method. - *os << pre_op () - << bt->name () << " *" << ub->local_name () - << " (void) const" << post_op (); - - return 0; -} - -int -be_visitor_valuetype_field_ch::visit_eventtype_fwd (be_eventtype_fwd *node) -{ - return this->visit_valuetype_fwd (node); -} - -int -be_visitor_valuetype_field_ch::visit_predefined_type (be_predefined_type *node) -{ - be_decl *ub = this->ctx_->node (); - be_decl *bu = this->ctx_->scope (); - be_type *bt; - - // Check if we are visiting this via a visit to a typedef node. - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - if (!ub || !bu) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_ch::" - "visit_predefined_type - " - "bad context information\n"), - -1); - } - - TAO_OutStream *os = this->ctx_->stream (); - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - switch (node->pt ()) - { - case AST_PredefinedType::PT_pseudo: - case AST_PredefinedType::PT_object: - // Set method. - *os << pre_op () << "void " << ub->local_name () << " ( ::" - << bt->name () << "_ptr)" - << post_op () << be_nl; - // Get method. - *os << pre_op () - << "::" << bt->name () << "_ptr " << ub->local_name () - << " (void) const" << post_op (); - break; - case AST_PredefinedType::PT_any: - // Set method. - *os << pre_op () << "void " << ub->local_name () - << " (const ::" << bt->name () << " &)" - << post_op () << be_nl; - // Get method (read-only). - *os << pre_op () << "const ::" << bt->name () << " &" - << ub->local_name () << " (void) const" - << post_op () << be_nl; - // Get method (read/write). - *os << pre_op () << "::" << bt->name () << " &" - << ub->local_name () << " (void)" - << post_op (); - break; - case AST_PredefinedType::PT_void: - break; - default: - // Set method. - *os << pre_op () << "void " << ub->local_name () - << " (const ::" << bt->name () << ")" - << post_op () << be_nl; - // Get method. - *os << pre_op () << "::" << bt->name () - << " " << ub->local_name () - << " (void) const" << post_op (); - } - - return 0; -} - -int -be_visitor_valuetype_field_ch::visit_sequence (be_sequence *node) -{ - be_decl *ub = this->ctx_->node (); - be_decl *bu = this->ctx_->scope (); - be_type *bt; - - // Check if we are visiting this via a visit to a typedef node. - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - if (!ub || !bu) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_ch::" - "visit_sequence - " - "bad context information\n"), - -1); - } - - TAO_OutStream *os = this->ctx_->stream (); - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - // Not a typedef and bt is defined here. - if (bt->node_type () != AST_Decl::NT_typedef - && bt->is_child (bu)) - { - be_field *member_node = - be_field::narrow_from_decl (this->ctx_->node ()); - node->field_node (member_node); - - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - be_visitor_sequence_ch visitor (&ctx); - - if (this->visibility_ == AST_Field::vis_PRIVATE) - { - *os << be_uidt_nl << "public:" << be_idt_nl; - } - - if (node->accept (&visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_ch::" - "visit_sequence - " - "codegen failed\n"), - -1); - } - - if (this->visibility_ == AST_Field::vis_PRIVATE) - { - *os << be_uidt_nl << be_nl << "protected:" << be_idt; - } - - // Generate the anonymous sequence member typedef. - // This provides a consistent name to use instead of the - // implementation-specific name. - *os << be_nl << be_nl << "typedef " << bt->nested_type_name (bu) - << " _" << ub->local_name () << "_seq;" << be_nl; - } - - // Set method. - *os << pre_op () << "void " << ub->local_name () << " (const " - << bt->name () << " &)" - << post_op () << be_nl; - // Read-only. - *os << pre_op () << "const " << bt->name () << " &" - << ub->local_name () << " (void) const" - << post_op () << be_nl; - // Read/write. - *os << pre_op () << bt->name () << " &" << ub->local_name () - << " (void)" - << post_op (); - - return 0; -} - -int -be_visitor_valuetype_field_ch::visit_string (be_string *node) -{ - be_decl *ub = this->ctx_->node (); - be_decl *bu = this->ctx_->scope (); - - if (!ub || !bu) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_ch::" - "visit_string - " - "bad context information\n"), - -1); - } - - TAO_OutStream *os = this->ctx_->stream (); - - *os << be_nl << be_nl<< "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - // Three methods to set the string value. - if (node->width () == (long) sizeof (char)) - { - *os << pre_op () - << "void " << ub->local_name () << " (char *val)" - << post_op () << be_nl; - *os << pre_op () - << "void " << ub->local_name () << " (const char *val)" - << post_op () << be_nl; - *os << pre_op () - << "void " << ub->local_name () << " (const ::CORBA::String_var &val)" - << post_op () << be_nl; - // Get method. - *os << pre_op () << "const char *" << ub->local_name () - << " (void) const" << post_op (); - } - else - { - *os << pre_op () - << "void " << ub->local_name () << " ( ::CORBA::WChar *val)" - << post_op () << be_nl; - *os << pre_op () - << "void " << ub->local_name () << " (const ::CORBA::WChar *val)" - << post_op () << be_nl; - *os << pre_op () - << "void " << ub->local_name () << " (const ::CORBA::WString_var &val)" - << post_op () << be_nl; - // Get method. - *os << pre_op() << "const ::CORBA::WChar *" << ub->local_name () - << " (void) const" << post_op(); - } - - return 0; -} - -int -be_visitor_valuetype_field_ch::visit_structure (be_structure *node) -{ - be_decl *ub = this->ctx_->node (); - be_decl *bu = this->ctx_->scope (); - be_type *bt; - - // Check if we are visiting this via a visit to a typedef node. - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - if (!ub || !bu) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_ch::" - "visit_structure - " - "bad context information\n"), - -1); - } - - TAO_OutStream *os = this->ctx_->stream (); - - *os << be_nl << be_nl<< "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - // Not a typedef and bt is defined here. - if (bt->node_type () != AST_Decl::NT_typedef - && bt->is_child (bu)) - { - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - be_visitor_structure_ch visitor (&ctx); - - if (node->accept (&visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_ch::" - "visit_structure - " - "codegen failed\n"), - -1); - } - } - - // Set method. - *os << pre_op () << "void " << ub->local_name () << " (const " - << bt->name () << " &)" - << post_op () << be_nl; - // Read-only. - *os << pre_op () << "const " << bt->name () << " &"; - *os << ub->local_name () << " (void) const" - << post_op () << be_nl - // Read/write. - << pre_op () << bt->name () << " &" << ub->local_name () - << " (void)" << post_op (); - - return 0; -} - -int -be_visitor_valuetype_field_ch::visit_typedef (be_typedef *node) -{ - this->ctx_->alias (node); - - // Make a decision based on the primitive base type. - be_type *bt = node->primitive_base_type (); - - if (!bt || (bt->accept (this) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_spec_ch::" - "visit_typedef - " - "Bad primitive type\n"), - -1); - } - - this->ctx_->alias (0); - return 0; -} - -int -be_visitor_valuetype_field_ch::visit_union (be_union *node) -{ - be_decl *ub = this->ctx_->node (); - be_decl *bu = this->ctx_->scope (); - be_type *bt; - - // Check if we are visiting this via a visit to a typedef node. - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - if (!ub || !bu) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_ch::" - "visit_union - " - "bad context information\n"), - -1); - } - - TAO_OutStream *os = this->ctx_->stream (); - - *os << be_nl << be_nl<< "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - // Not a typedef and bt is defined here. - if (bt->node_type () != AST_Decl::NT_typedef - && bt->is_child (bu)) - { - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - be_visitor_union_ch visitor (&ctx); - - if (node->accept (&visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_ch::" - "visit_union - " - "codegen failed\n"), - -1); - } - } - - // Set method. - *os << pre_op () << "void " << ub->local_name () << " (const " - << bt->name () << " &)" - << post_op () << be_nl; - // Read-only. - *os << pre_op () << "const " << bt->name () << " &" - << ub->local_name () << " (void) const" - << post_op () << be_nl; - // Read/write. - *os << pre_op () << bt->name () << " &" << ub->local_name () - << " (void)" << post_op (); - - return 0; -} - -void -be_visitor_valuetype_field_ch::setenclosings (const char *pre, - const char *post) -{ - pre_op_ = pre; - post_op_ = post; -} - -const char* -be_visitor_valuetype_field_ch::pre_op (void) -{ - return pre_op_; -} - -const char* -be_visitor_valuetype_field_ch::post_op (void) -{ - return post_op_; -} diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/field_ci.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/field_ci.cpp deleted file mode 100644 index 9574e2bca3d..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/field_ci.cpp +++ /dev/null @@ -1,233 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// field_ci.cpp -// -// = DESCRIPTION -// Visitor for the Valuetype class. -// This one generates code for accessor and modifier functions of -// valuetype state members (in the inline file). -// -// = AUTHOR -// Jeff Parsons -// -// ============================================================================ - -ACE_RCSID (be_visitor_valuetype, - field_ci, - "$Id$") - -be_visitor_valuetype_field_ci::be_visitor_valuetype_field_ci ( - be_visitor_context *ctx - ) - : be_visitor_decl (ctx), - in_obv_space_ (0) -{ - setenclosings (""); -} - -be_visitor_valuetype_field_ci::~be_visitor_valuetype_field_ci (void) -{ -} - -int -be_visitor_valuetype_field_ci::visit_field (be_field *node) -{ - be_type *bt = be_type::narrow_from_decl (node->field_type ()); - - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_field_cs::" - "visit_field - " - "Bad field type\n"), - -1); - } - - this->ctx_->node (node); - - if (bt->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_field_cs::" - "visit_field - " - "codegen for field type failed\n"), - -1); - } - - return 0; -} - -// Visit operations on all possible data types that a field can be. - -int -be_visitor_valuetype_field_ci::visit_array (be_array *node) -{ - be_decl *ub = this->ctx_->node (); - be_valuetype *bu = be_valuetype::narrow_from_decl (this->ctx_->scope ()); - be_type *bt; - - // Check if we are visiting this node via a visit to a typedef node. - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - if (!ub || !bu) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_ci::" - "visit_array - " - "bad context information\n"), - -1); - } - - if (bt->node_type () != AST_Decl::NT_typedef - && bt->is_child (bu)) - { - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - be_visitor_array_ci visitor (&ctx); - - if (node->accept (&visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_ci::" - "visit_array - " - "codegen failed\n"), - -1); - } - } - - return 0; -} - -int -be_visitor_valuetype_field_ci::visit_structure (be_structure *node) -{ - be_decl *ub = this->ctx_->node (); - be_valuetype *bu = be_valuetype::narrow_from_decl (this->ctx_->scope ()); - be_type *bt; - - // Check if we are visiting this node via a visit to a typedef node. - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - if (!ub || !bu) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_ci::" - "visit_structure - " - "bad context information\n"), - -1); - } - - if (bt->node_type () != AST_Decl::NT_typedef - && bt->is_child (bu)) - { - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - be_visitor_structure_ci visitor (&ctx); - - if (node->accept (&visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_ci::" - "visit_structure - " - "codegen failed\n"), - -1); - } - } - - return 0; -} - -int -be_visitor_valuetype_field_ci::visit_union (be_union *node) -{ - be_decl *ub = this->ctx_->node (); - be_valuetype *bu = be_valuetype::narrow_from_decl (this->ctx_->scope ()); - be_type *bt; - - // Check if we are visiting this node via a visit to a typedef node. - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - if (!ub || !bu) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_ci::" - "visit_union - " - "bad context information\n"), - -1); - } - - if (bt->node_type () != AST_Decl::NT_typedef - && bt->is_child (bu)) - { - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - be_visitor_union_ci visitor (&ctx); - - if (node->accept (&visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_ci::" - "visit_union - " - "codegen failed\n"), - -1); - } - } - - return 0; -} - -void -be_visitor_valuetype_field_ci::setenclosings (const char *pre) -{ - this->pre_op_ = pre; -} - -const char* -be_visitor_valuetype_field_ci::pre_op () -{ - return this->pre_op_; -} - -// Retrieve the fully scoped skeleton name. -void -be_visitor_valuetype_field_ci::op_name (be_valuetype *node, - TAO_OutStream *os) -{ - if (this->in_obv_space_) - { - *os << node->full_obv_skel_name (); - } - else - { - *os << node->name (); - } -} diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/field_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/field_cs.cpp deleted file mode 100644 index f5ae7a8e2de..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/field_cs.cpp +++ /dev/null @@ -1,1192 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// field_cs.cpp -// -// = DESCRIPTION -// Visitor for the Valuetype class. -// This one generates code for accessor and modifier functions of -// valuetype state members (in the stub file). -// -// = AUTHOR -// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de> -// derived from be_visitor_union_branch/public_ci.cpp -// -// ============================================================================ -ACE_RCSID (be_visitor_valuetype, - field_cs, - "$Id$") - -be_visitor_valuetype_field_cs::be_visitor_valuetype_field_cs ( - be_visitor_context *ctx - ) - : be_visitor_decl (ctx), - in_obv_space_ (0) -{ - setenclosings (""); -} - -be_visitor_valuetype_field_cs::~be_visitor_valuetype_field_cs (void) -{ -} - -int -be_visitor_valuetype_field_cs::visit_field (be_field *node) -{ - be_type *bt = be_type::narrow_from_decl (node->field_type ()); - - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_field_cs::" - "visit_field - " - "Bad field type\n"), - -1); - } - - this->ctx_->node (node); - - if (bt->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_field_cs::" - "visit_field - " - "codegen for field type failed\n"), - -1); - } - - return 0; -} - -// Visit operations on all possible data types that a field can be - -int -be_visitor_valuetype_field_cs::visit_array (be_array *node) -{ - be_decl *ub = this->ctx_->node (); - be_valuetype *bu = be_valuetype::narrow_from_decl (this->ctx_->scope ()); - be_type *bt; - - // Check if we are visiting this node via a visit to a typedef node. - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - if (!ub || !bu) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cs::" - "visit_array - " - "bad context information\n"), - -1); - } - - TAO_OutStream *os = this->ctx_->stream (); - - if (bt->node_type () != AST_Decl::NT_typedef - && bt->is_child (bu)) - { - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - be_visitor_array_cs visitor (&ctx); - - if (node->accept (&visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cs::" - "visit_array - " - "codegen failed\n"), - -1); - } - } - - // For anonymous arrays, the type name has a _ prepended. We compute the - // full_name with or without the underscore and use it later on. - char fname [NAMEBUFSIZE]; - ACE_OS::memset (fname, - '\0', - NAMEBUFSIZE); - - if (bt->node_type () != AST_Decl::NT_typedef - && bt->is_child (bu)) - { - // For anonymous arrays ... - // We have to generate a name for us that has an underscope prepended to - // our local name. This needs to be inserted after the parent's name. - if (bt->is_nested ()) - { - be_decl *parent = - be_scope::narrow_from_scope (bt->defined_in ())->decl (); - ACE_OS::sprintf (fname, - "%s::_%s", - parent->full_name (), - bt->local_name ()->get_string ()); - } - else - { - ACE_OS::sprintf (fname, - "_%s", - bt->full_name ()); - } - } - else - { - // Typedefed node. - ACE_OS::sprintf (fname, - "%s", - bt->full_name ()); - } - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - *os << "// Accessor to set the member." << be_nl - << this->pre_op () << "void" << be_nl; - - this->op_name (bu, - os); - - *os << "::" << ub->local_name () << " (const " << fname - << " val)" << be_nl - << "{" << be_idt_nl; - *os << fname << "_copy (" - << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix () - << ", val);" << be_uidt_nl; - *os << "}" << be_nl; - - *os << "/// Retrieve the member." << be_nl - << this->pre_op () << "const " << fname << "_slice *" << be_nl; - - this->op_name (bu, - os); - - *os << "::" << ub->local_name () << " (void) const" << be_nl - << "{" << be_idt_nl; - *os << "return this->" - << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix () << ";" << be_uidt_nl - << "}\n" << be_nl; - - *os << "/// Retrieve the member." << be_nl - << this->pre_op () << fname << "_slice *" << be_nl; - - this->op_name (bu, - os); - - *os << "::" << ub->local_name () << " (void)" << be_nl - << "{" << be_idt_nl; - *os << "return this->" - << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix () << ";" << be_uidt_nl; - *os << "}"; - - return 0; -} - -int -be_visitor_valuetype_field_cs::visit_enum (be_enum *node) -{ - be_decl *ub = this->ctx_->node (); - be_valuetype *bu = be_valuetype::narrow_from_decl (this->ctx_->scope ()); - be_type *bt; - - // Check if we are visiting this node via a visit to a typedef node. - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - if (!ub || !bu) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cs::" - "visit_enum - " - "bad context information\n"), - -1); - } - - TAO_OutStream *os = this->ctx_->stream (); - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - *os << "/// Accessor to set the member." << be_nl - << this->pre_op() << "void" << be_nl; - - this->op_name (bu, - os); - - *os << "::" << ub->local_name () << " (" << bt->name () - << " val)" << be_nl - << "{" << be_idt_nl; - - *os << "this->" - << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix () - << " = val;" << be_uidt_nl; - - *os << "}" << be_nl; - - *os << "/// Retrieve the member." << be_nl - << this->pre_op () << bt->name () << be_nl; - - this->op_name (bu, - os); - - *os << "::" << ub->local_name () << " () const" - << be_nl - << "{" << be_idt_nl; - - *os << "return this->" - << bu->field_pd_prefix() << ub->local_name () - << bu->field_pd_postfix () - << ";" << be_uidt_nl; - - *os << "}"; - - return 0; -} - -int -be_visitor_valuetype_field_cs::visit_interface (be_interface *node) -{ - be_decl *ub = this->ctx_->node (); - be_valuetype *bu = be_valuetype::narrow_from_decl (this->ctx_->scope ()); - be_type *bt; - - // Check if we are visiting this node via a visit to a typedef node. - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - if (!ub || !bu) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cs::" - "visit_interface - " - "bad context information\n"), - -1); - } - - TAO_OutStream *os = this->ctx_->stream (); - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - *os << "/// Accessor to set the member." << be_nl - << this->pre_op () << "void" << be_nl; - - this->op_name (bu, - os); - - *os << "::" << ub->local_name () << " (" << bt->name () - << "_ptr val)" << be_nl - << "{" << be_idt_nl; - - *os << "this->" - << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix () << " =" << be_idt_nl - << "TAO::Objref_Traits< ::" << bt->name () - << ">::duplicate (val);" << be_uidt << be_uidt_nl; - *os << "}" << be_nl << be_nl; - - *os << "/// Retrieve the member." << be_nl - << this->pre_op () << bt->name () << "_ptr " << be_nl; - - this->op_name (bu, - os); - - *os << "::" << ub->local_name () << " () const" - << be_nl - << "{" << be_idt_nl; - - *os << "return this->" - << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix () - << ".in ();" << be_uidt_nl; - - *os << "}"; - - return 0; -} - -int -be_visitor_valuetype_field_cs::visit_interface_fwd (be_interface_fwd *node) -{ - be_decl *ub = this->ctx_->node (); - be_valuetype *bu = be_valuetype::narrow_from_decl (this->ctx_->scope ()); - be_type *bt; - - // Check if we are visiting this node via a visit to a typedef node. - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - if (!ub || !bu) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cs::" - "visit_interface - " - "bad context information\n"), - -1); - } - - TAO_OutStream *os = this->ctx_->stream (); - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - *os << "// Accessor to set the member." << be_nl - << this->pre_op () << "void" << be_nl; - - this->op_name (bu, - os); - - *os << "::" << ub->local_name () << " (" << bt->name () - << "_ptr val)" << be_nl - << "{" << be_idt_nl; - - *os << "this->" - << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix () - << " = " << bt->name () << "::_duplicate (val);" << be_uidt_nl; - *os << "}" << be_nl << be_nl; - - *os << "/// Retrieve the member" << be_nl - << this->pre_op () << bt->name () << "_ptr " << be_nl; - - this->op_name (bu, - os); - - *os << "::" << ub->local_name () << " () const" - << be_nl - << "{" << be_idt_nl; - - *os << "return this->" - << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix () - << ".in ();" << be_uidt_nl; - - *os << "}"; - - return 0; -} - -int -be_visitor_valuetype_field_cs::visit_valuebox (be_valuebox *node) -{ - return this->valuetype_common (node); -} - -int -be_visitor_valuetype_field_cs::valuetype_common (be_type *node) -{ - be_decl *ub = this->ctx_->node (); - be_valuetype *bu = be_valuetype::narrow_from_decl (this->ctx_->scope ()); - be_type *bt; - - // Check if we are visiting this node via a visit to a typedef node. - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - if (!ub || !bu) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cs::" - "visit_interface - " - "bad context information\n"), - -1); - } - - TAO_OutStream *os = this->ctx_->stream (); - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - *os << "/// Accessor to set the member." << be_nl - << this->pre_op () << "void" << be_nl; - - this->op_name (bu, - os); - - *os << "::" << ub->local_name () << " (" << bt->name () - << "* val)" << be_nl - << "{" << be_idt_nl; - - *os << "::CORBA::add_ref (val);" << be_nl - << "this->" - << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix () - << " = val;" << be_uidt_nl; - *os << "}" << be_nl << be_nl; - - *os << "/// Retrieve the member" << be_nl - << this->pre_op () << bt->name () << " *" << be_nl; - - this->op_name (bu, - os); - - *os << "::" << ub->local_name () << " () const" - << be_nl - << "{" << be_idt_nl; - - *os << "return this->" - << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix () - << ".in ();" << be_uidt_nl; - - *os << "}"; - - return 0; -} - -int -be_visitor_valuetype_field_cs::visit_valuetype (be_valuetype *node) -{ - return this->valuetype_common (node); -} - -int -be_visitor_valuetype_field_cs::visit_eventtype (be_eventtype *node) -{ - return this->visit_valuetype (node); -} - -int -be_visitor_valuetype_field_cs::visit_valuetype_fwd (be_valuetype_fwd *node) -{ - be_decl *ub = this->ctx_->node (); - be_valuetype *bu = be_valuetype::narrow_from_decl (this->ctx_->scope ()); - be_type *bt; - - // Check if we are visiting this node via a visit to a typedef node. - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - if (!ub || !bu) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cs::" - "visit_interface - " - "bad context information\n"), - -1); - } - - TAO_OutStream *os = this->ctx_->stream (); - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - *os << "/// Accessor to set the member." << be_nl - << this->pre_op () << "void" << be_nl; - - this->op_name (bu, - os); - - *os << "::" << ub->local_name () << " (" << bt->name () - << "* val)" << be_nl - << "{" << be_idt_nl; - - *os << "::CORBA::add_ref (val);" << be_nl - << "this->" - << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix () - << " = val;" << be_uidt_nl; - *os << "}" << be_nl << be_nl; - - *os << "/// Retrieve the member." << be_nl - << this->pre_op () << bt->name () << " *" << be_nl; - - this->op_name (bu, - os); - - *os << "::" << ub->local_name () << " () const" - << be_nl - << "{" << be_idt_nl; - - *os << "return this->" - << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix - () - << ".in ();" << be_uidt_nl; - - *os << "}"; - - return 0; -} - -int -be_visitor_valuetype_field_cs::visit_eventtype_fwd (be_eventtype_fwd *node) -{ - return this->visit_valuetype_fwd (node); -} - -int -be_visitor_valuetype_field_cs::visit_predefined_type (be_predefined_type *node) -{ - be_decl *ub = this->ctx_->node (); - be_valuetype *bu = be_valuetype::narrow_from_decl (this->ctx_->scope ()); - be_type *bt; - - // Check if we are visiting this node via a visit to a typedef node. - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - if (!ub || !bu) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cs::" - "visit_predef... - " - "bad context information\n"), - -1); - } - - TAO_OutStream *os = this->ctx_->stream (); - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - *os << "// Accessor to set the member." << be_nl - << this->pre_op () << "void" << be_nl; - - this->op_name (bu, os); - - AST_PredefinedType::PredefinedType pt = node->pt (); - bool is_object = (pt == AST_PredefinedType::PT_object - || pt == AST_PredefinedType::PT_pseudo); - - // IN parameter semantics call for 'const' qualifier except - // for interface types, which here are Object and TypeCode. - *os << "::" << ub->local_name () - << " (" << (is_object ? "" : "const ") << bt->name (); - - if (is_object) - { - *os << "_ptr"; - } - else if (pt == AST_PredefinedType::PT_any) - { - *os << " &"; - } - - *os << " val)" << be_nl - << "{" << be_idt_nl; - - switch (pt) - { - case AST_PredefinedType::PT_pseudo: - case AST_PredefinedType::PT_object: - *os << "this->" << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix () << " = ::" - << bt->name () << "::_duplicate (val);" << be_uidt_nl; - - break; - case AST_PredefinedType::PT_any: - *os << "this->" << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix () << " = val;" << be_uidt_nl; - - break; - case AST_PredefinedType::PT_void: - break; - default: - *os << "// Set the value." << be_nl - << "this->" << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix () - << " = val;" << be_uidt_nl; - - break; - } - - *os << "}" << be_nl << be_nl; - - switch (node->pt ()) - { - case AST_PredefinedType::PT_pseudo: - case AST_PredefinedType::PT_object: - *os << "// Retrieve the member" << be_nl - << this->pre_op () << "::" << bt->name () << "_ptr" << be_nl; - - this->op_name (bu, - os); - - *os << "::" << ub->local_name () - << " (void) const" << be_nl - << "{" << be_idt_nl - << "return this->" - << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix () - << ".in ();" << be_uidt_nl - << "}"; - - break; - case AST_PredefinedType::PT_any: - *os << "// Retrieve the member." << be_nl - << this->pre_op () << "const ::" << bt->name () << " &" << be_nl; - - this->op_name (bu, os); - - *os << "::" << ub->local_name () - << " (void) const" << be_nl - << "{" << be_idt_nl - << "return this->" - << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix () - << ";" << be_uidt_nl - << "}" << be_nl << be_nl; - - *os << "// Retrieve the member" << be_nl - << this->pre_op () << "::" << bt->name () << " &" << be_nl; - - this->op_name (bu, os); - - *os << "::" << ub->local_name () - << " (void)" << be_nl - << "{" << be_idt_nl - << "return this->" - << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix () - << ";" << be_uidt_nl - << "}"; - - break; - case AST_PredefinedType::PT_void: - break; - default: - *os << "// Retrieve the member" << be_nl - << this->pre_op () << "::" << bt->name () << be_nl; - - this->op_name (bu, os); - - *os << "::" << ub->local_name () - << " (void) const" << be_nl - << "{" << be_idt_nl - << "return this->" - << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix () - << ";" << be_uidt_nl - << "}"; - - break; - } - - return 0; -} - -int -be_visitor_valuetype_field_cs::visit_sequence (be_sequence *node) -{ - be_decl *ub = this->ctx_->node (); - be_valuetype *bu = be_valuetype::narrow_from_decl (this->ctx_->scope ()); - be_type *bt; - - // Check if we are visiting this node via a visit to a typedef node. - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - if (!ub || !bu) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cs::" - "visit_sequence - " - "bad context information\n"), - -1); - } - - TAO_OutStream *os = this->ctx_->stream (); - - if (bt->node_type () != AST_Decl::NT_typedef // not a typedef - && bt->is_child (bu)) // bt is defined inside the union - { - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - be_visitor_sequence_cs visitor (&ctx); - - if (node->accept (&visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cs::" - "visit_sequence - " - "codegen failed\n"), - -1); - } - } - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - // (1) set from a const - *os << "// Accessor to set the member." << be_nl - << this->pre_op () << "void" << be_nl; - - this->op_name (bu, - os); - - *os << "::" << ub->local_name () - << " (const " << bt->name () << " &val)" << be_nl - << "{" << be_idt_nl; - - *os << "this->" - << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix () - << " = val;" << be_uidt_nl; - *os << "}" << be_nl << be_nl; - - *os << "// Readonly get method." << be_nl - << this->pre_op () << "const " << bt->name () << " &" << be_nl; - - this->op_name (bu, - os); - - *os << "::" << ub->local_name () - << " (void) const" << be_nl - << "{" << be_idt_nl - << "return this->" - << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix () - << ";" << be_uidt_nl - << "}" << be_nl << be_nl; - - *os << "// Read/write get method." << be_nl - << this->pre_op () << bt->name () << " &" << be_nl; - - this->op_name (bu, - os); - - *os << "::" << ub->local_name () << " (void)" << be_nl - << "{" << be_idt_nl - << "return this->" - << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix() - << ";" << be_uidt_nl - << "}"; - - return 0; -} - -int -be_visitor_valuetype_field_cs::visit_string (be_string *node) -{ - be_decl *ub = this->ctx_->node (); - be_valuetype *bu = be_valuetype::narrow_from_decl (this->ctx_->scope ()); - - if (!ub || !bu) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cs::" - "visit_string - " - "bad context information\n"), - -1); - } - - TAO_OutStream *os = this->ctx_->stream (); - - // Three methods to set the string value. - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - *os << "// Accessor to set the member." << be_nl - << this->pre_op () << "void" << be_nl; - - this->op_name (bu, - os); - - if (node->width () == (long) sizeof (char)) - { - *os << "::" << ub->local_name () << " (char *val)"; - } - else - { - *os << "::" << ub->local_name () << " ( ::CORBA::WChar *val)"; - } - - *os << be_nl - << "{" << be_idt_nl; - *os << "this->" - << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix () - << " = (val);" << be_uidt_nl - << "}" << be_nl << be_nl; - - // (2) Set method from const char * or const wchar*. - *os << "// Accessor to set the member." << be_nl - << this->pre_op () << "void" << be_nl; - - this->op_name (bu, - os); - *os << "::" << ub->local_name (); - - if (node->width () == (long) sizeof (char)) - { - *os << " (const char *val)" << be_nl; - } - else - { - *os << " (const ::CORBA::WChar *val)" << be_nl; - } - - *os << "{" << be_idt_nl; - - *os << "// Set the value." << be_nl - << "this->" - << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix () - << " = "; - - if (node->width () == (long) sizeof (char)) - { - *os << "::CORBA::string_dup (val);" << be_uidt_nl; - } - else - { - *os << "::CORBA::wstring_dup (val);" << be_uidt_nl; - } - - *os << "}" << be_nl << be_nl; - - // (3) Set from const String_var&. - *os << "// Accessor to set the member." << be_nl - << this->pre_op () << "void" << be_nl; - - this->op_name (bu, - os); - - *os << "::" << ub->local_name (); - - if (node->width () == (long) sizeof (char)) - { - *os << " (const ::CORBA::String_var &val)" << be_nl; - } - else - { - *os << " (const ::CORBA::WString_var &val)" << be_nl; - } - - *os << "{" << be_idt_nl; - - if (node->width () == (long) sizeof (char)) - { - *os << "::CORBA::String_var " << ub->local_name (); - } - else - { - *os << "::CORBA::WString_var " << ub->local_name (); - } - - *os << "_var = val;" << be_nl - << "this->" - << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix () - << " = " - << ub->local_name () << "_var._retn ();" << be_uidt_nl; - *os << "}" << be_nl << be_nl; - - if (node->width () == (long) sizeof (char)) - { - *os << this->pre_op () << "const char *" << be_nl; - } - else - { - *os << this->pre_op () << "const ::CORBA::WChar *" << be_nl; - } - - this->op_name (bu, - os); - - *os << "::" << ub->local_name () - << " (void) const // get method" << be_nl - << "{" << be_idt_nl - << "return this->" - << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix () - << ";" << be_uidt_nl - << "}"; - - return 0; -} - -int -be_visitor_valuetype_field_cs::visit_structure (be_structure *node) -{ - be_decl *ub = this->ctx_->node (); - be_valuetype *bu = be_valuetype::narrow_from_decl (this->ctx_->scope ()); - be_type *bt; - - // Check if we are visiting this node via a visit to a typedef node. - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - if (!ub || !bu) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cs::" - "visit_structure - " - "bad context information\n"), - -1); - } - - TAO_OutStream *os = this->ctx_->stream (); - - if (bt->node_type () != AST_Decl::NT_typedef - && bt->is_child (bu)) - { - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - be_visitor_structure_cs visitor (&ctx); - - if (node->accept (&visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cs::" - "visit_structure - " - "codegen failed\n"), - -1); - } - } - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - // (1) Set from a const. - *os << "// Accessor to set the member." << be_nl - << this->pre_op () << "void" << be_nl; - - this->op_name (bu, - os); - - *os << "::" << ub->local_name () - << " (const " << bt->name () << " &val)" << be_nl - << "{" << be_idt_nl; - - *os << "this->" - << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix () - << " = val;" << be_uidt_nl; - - *os << "}" << be_nl; - - *os << "// Readonly get method." << be_nl - << this->pre_op () << "const " << bt->name () << " &" << be_nl; - - this->op_name (bu, - os); - - *os << "::" << ub->local_name () << " (void) const" << be_nl - << "{" << be_idt_nl; - *os << "return this->" - << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix () - << ";" << be_uidt_nl; - *os << "}" << be_nl; - - *os << "// Read/write get method." << be_nl - << this->pre_op () << bt->name () << " &" << be_nl; - - this->op_name (bu, - os); - - *os << "::" << ub->local_name () << " (void)" << be_nl - << "{" << be_idt_nl; - *os << "return this->" - << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix () - << ";" << be_uidt_nl; - *os << "}"; - - return 0; -} - -int -be_visitor_valuetype_field_cs::visit_typedef (be_typedef *node) -{ - this->ctx_->alias (node); - be_type *bt = node->primitive_base_type (); - - if (!bt || (bt->accept (this) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cs::" - "visit_typedef - " - "Bad primitive type\n"), - -1); - } - - this->ctx_->alias (0); - return 0; -} - -int -be_visitor_valuetype_field_cs::visit_union (be_union *node) -{ - be_decl *ub = this->ctx_->node (); - be_valuetype *bu = be_valuetype::narrow_from_decl (this->ctx_->scope ()); - be_type *bt; - - // Check if we are visiting this node via a visit to a typedef node. - if (this->ctx_->alias ()) - { - bt = this->ctx_->alias (); - } - else - { - bt = node; - } - - if (!ub || !bu) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cs::" - "visit_union - " - "bad context information\n"), - -1); - } - - TAO_OutStream *os = this->ctx_->stream (); - - if (bt->node_type () != AST_Decl::NT_typedef - && bt->is_child (bu)) - { - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - be_visitor_union_cs visitor (&ctx); - - if (node->accept (&visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_field_cs::" - "visit_union - " - "codegen failed\n"), - -1); - } - } - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - *os << "// Accessor to set the member" << be_nl - << this->pre_op () << "void" << be_nl; - - this->op_name (bu, - os); - - *os << "::" << ub->local_name () - << " (const " << bt->name () << " &val)" << be_nl - << "{" << be_idt_nl; - *os << "this->" << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix () << " = val;" << be_uidt_nl; - *os << "}" << be_nl; - - *os << "// Readonly get method." << be_nl - << this->pre_op () << "const " << bt->name () << " &" << be_nl; - - this->op_name (bu, - os); - - *os << "::" << ub->local_name () << " (void) const" << be_nl - << "{" << be_idt_nl - << "return this->" - << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix () - << ";" << be_uidt_nl - << "}" << be_nl; - - *os << "// Read/write get method." << be_nl - << this->pre_op () << bt->name () << " &" << be_nl; - - this->op_name (bu, - os); - - *os << "::" << ub->local_name () << " (void)" << be_nl - << "{" << be_idt_nl - << "return this->" - << bu->field_pd_prefix () << ub->local_name () - << bu->field_pd_postfix () - << ";" << be_uidt_nl - << "}"; - - return 0; -} - -void -be_visitor_valuetype_field_cs::setenclosings (const char *pre) -{ - this->pre_op_ = pre; -} - -const char* -be_visitor_valuetype_field_cs::pre_op () -{ - return this->pre_op_; -} - -// Retrieve the fully scoped skeleton name. -void -be_visitor_valuetype_field_cs::op_name (be_valuetype *node, - TAO_OutStream *os) -{ - if (this->in_obv_space_) - { - *os << node->full_obv_skel_name (); - } - else - { - *os << node->name (); - } -} diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/marshal_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/marshal_ch.cpp deleted file mode 100644 index 55aec2de444..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/marshal_ch.cpp +++ /dev/null @@ -1,90 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// marshal_ch.cpp -// -// = DESCRIPTION -// Concrete visitor for valuetypes. -// This one provides code generation for marshalling. -// -// = AUTHOR -// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de> -// based on code from Aniruddha Gokhale -// -// ============================================================================ - -ACE_RCSID (be_visitor_valuetype, - marshal_ch, - "$Id$") - -// *************************************************************************** -// Structure visitor for generating declarations -// *************************************************************************** - -be_visitor_valuetype_marshal_ch::be_visitor_valuetype_marshal_ch ( - be_visitor_context *ctx - ) - : be_visitor_scope (ctx) -{ -} - -be_visitor_valuetype_marshal_ch::~be_visitor_valuetype_marshal_ch (void) -{ -} - -int -be_visitor_valuetype_marshal_ch::visit_valuetype (be_valuetype *node) -{ - this->elem_number_ = 0; - - for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls); - !si.is_done (); - si.next()) - { - AST_Decl *d = si.item (); - - if (!d) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_scope::visit_scope - " - "bad node in this scope\n"), - -1); - - } - - be_field *field = be_field::narrow_from_decl (d); - - if (field) - { - be_visitor_context ctx (*this->ctx_); - be_visitor_valuetype_field_cdr_ch visitor (&ctx); - visitor.pre_ = node->field_pd_prefix (); - visitor.post_ = node->field_pd_postfix (); - - if (visitor.visit_field (field) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_marshal_ch::" - "visit_valuetype - " - "codegen for scope failed\n"), - -1); - } - } - } - - return 0; -} - -int -be_visitor_valuetype_marshal_ch::visit_eventtype (be_eventtype *node) -{ - return this->visit_valuetype (node); -} - diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/marshal_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/marshal_cs.cpp deleted file mode 100644 index ef1bcb17051..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/marshal_cs.cpp +++ /dev/null @@ -1,302 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// marshal_cs.cpp -// -// = DESCRIPTION -// Concrete visitor for valuetypes. -// This one provides code generation for marshalling. -// -// = AUTHOR -// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de> -// -// ============================================================================ - -ACE_RCSID (be_visitor_valuetype, - marshal_cs, - "$Id$") - -be_visitor_valuetype_marshal_cs::be_visitor_valuetype_marshal_cs ( - be_visitor_context *ctx - ) - : be_visitor_scope (ctx) -{ -} - -be_visitor_valuetype_marshal_cs::~be_visitor_valuetype_marshal_cs (void) -{ -} - -int -be_visitor_valuetype_marshal_cs::visit_valuetype (be_valuetype *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - this->ctx_->sub_state (TAO_CodeGen::TAO_CDR_OUTPUT); - - *os << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - *os << "::CORBA::Boolean" << be_nl; - - this->class_name (node, os); - - *os << "::_tao_marshal_state (TAO_OutputCDR &"; - - be_valuetype *inh = node->statefull_inherit (); - - // 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 << ", TAO_ChunkInfo&"; - // If the valuetype has no fields, and no stateful inherit, - // the chunking helper arg is unused. - if (inh != 0 || node->data_members_count () > 0) - { - *os << "ci"; - } - - *os << ") const" << be_nl - << "{" << be_idt_nl; - - if (inh) - { - *os << "if (! ci.start_chunk (strm))" << be_idt_nl; - *os << "return false;" << be_uidt_nl << be_nl; - - if (inh->opt_accessor ()) - { - *os << "if (!this->"; - - this->class_name (inh, os); - - *os << "::_tao_marshal_state (strm, ci))" << be_idt_nl - << "{" << be_idt_nl - << "return false;" << be_uidt_nl - << "}" << be_uidt_nl << be_nl; - } - // Can access base class only via virtual function. - else - { - *os << "if (! this->_tao_marshal__" - << inh->flat_name () - << " (strm, ci))" << be_idt_nl - << "{" << be_idt_nl - << "return false;" << be_uidt_nl - << "}" << be_uidt_nl << be_nl; - } - } - - be_visitor_context new_ctx = *this->ctx_; - be_visitor_valuetype_field_cdr_decl field_out_cdr (&new_ctx); - field_out_cdr.visit_scope (node); - - if (node->data_members_count () > 0) - { - *os << "if (! ci.start_chunk (strm))" << be_idt_nl; - *os << "return false;" << be_uidt_nl << be_nl; - *os << "CORBA::Boolean const ret = " << be_idt << be_idt_nl; - - // All we have to do is to visit the scope and generate code. - this->gen_fields (node, - *this->ctx_); - - *os << ";" << be_uidt << be_uidt_nl; - - *os << "if ( ! ret) " << be_idt_nl; - *os << "return false; " << be_uidt_nl << be_nl; - *os << "if (! ci.end_chunk (strm))" << be_idt_nl; - *os << "return false;" << be_uidt_nl << be_nl; - } - - if (inh) - { - *os << "if (! ci.end_chunk (strm))" << be_idt_nl; - *os << "return false;" << be_uidt_nl << be_nl; - } - - *os << "return true;" << be_uidt_nl; - *os << "}" << be_nl << be_nl; - - // Set the substate as generating code for the input operator. - this->ctx_->sub_state (TAO_CodeGen::TAO_CDR_INPUT); - - *os << "::CORBA::Boolean" << be_nl; - - 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 << ", TAO_ChunkInfo&"; - // If the valuetype has no fields, and no stateful inherit, - // the chunking helper arg is unused. - if (inh != 0 || node->data_members_count () > 0) - { - *os << "ci"; - } - - *os << ")" << be_nl - << "{" << be_idt_nl; - - if (inh) - { - *os << "if (! ci.handle_chunking (strm))" << be_idt_nl; - *os << "return false;" << be_uidt_nl << be_nl; - - if (inh->opt_accessor ()) - { - *os << "if (!this->"; - - this->class_name (inh, os); - - *os << "::_tao_unmarshal_state (strm, ci))" << be_idt_nl - << "{" << be_idt_nl - << "return false;" << be_uidt_nl - << "}" << be_uidt_nl << be_nl; - } - else // only can access base class via virtual function - { - *os << "if (! this->_tao_unmarshal__" - << inh->flat_name () - << " (strm, ci))" << be_idt_nl - << "{" << be_idt_nl - << "return false;" << be_uidt_nl - << "}" << be_uidt_nl << be_nl; - } - } - - be_visitor_valuetype_field_cdr_decl field_in_cdr (&new_ctx); - field_in_cdr.visit_scope (node); - - if (node->data_members_count () > 0) - { - *os << "if (! ci.handle_chunking (strm))" << be_idt_nl; - *os << "return false;" << be_uidt_nl << be_nl; - *os << "CORBA::Boolean const ret = " << be_idt << be_idt_nl; - - // All we have to do is to visit the scope and generate code. - this->gen_fields (node, - *this->ctx_); - - *os << ";" << be_uidt << be_uidt_nl; - - *os << "if ( ! ret) " << be_idt_nl; - *os << "return false; " << be_uidt_nl << be_nl; - *os << "if (this->require_truncation_)" << be_idt_nl; - *os << "return ci.skip_chunks (strm);" << be_uidt_nl << be_nl; - *os << "else" << be_idt_nl; - *os << "return ci.handle_chunking (strm);" << be_uidt_nl << be_nl; - } - else - *os << "return true;"; - *os << be_uidt_nl << "}" << be_nl << be_nl; - - *os << "void" << be_nl; - - this->class_name (node, os); - - *os << "::truncation_hook (void)" << be_nl - << "{" << be_idt_nl - << "this->require_truncation_ = true;" << be_uidt_nl - << "}" << be_nl << be_nl; - - return 0; -} - -int -be_visitor_valuetype_marshal_cs::visit_eventtype (be_eventtype *node) -{ - return this->visit_valuetype (node); -} - -void -be_visitor_valuetype_marshal_cs::class_name (be_valuetype *node, - TAO_OutStream *os) -{ - if (node->opt_accessor ()) - { - be_decl *scope = - be_scope::narrow_from_scope (node->defined_in ())->decl (); - - *os << scope->name () << "::" - << node->local_name (); - } - else - { - *os << node->full_obv_skel_name (); - } -} - -// Operations for field marshaling. -int -be_visitor_valuetype_marshal_cs::gen_fields (be_valuetype *node, - be_visitor_context &ctx) -{ - int n_processed = 0; - TAO_OutStream *os = ctx.stream (); - this->elem_number_ = 0; - - // Initialize an iterator to iterate thru our scope. - for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls); - !si.is_done (); - si.next()) - { - AST_Decl *d = si.item (); - - if (!d) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_scope::visit_scope - " - "bad node in this scope\n"), - -1); - } - - be_field *field = be_field::narrow_from_decl (d); - - if (field) - { - if (n_processed > 0) - { - *os << " &&" << be_nl; - } - - ++n_processed; - be_visitor_valuetype_field_cdr_cs visitor (&ctx); - visitor.pre_ = node->field_pd_prefix (); - visitor.post_ = node->field_pd_postfix (); - - if (visitor.visit_field (field) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_marshal_cs::" - "visit_valuetype - " - "codegen for scope failed\n"), - -1); - } - } - } - - if (n_processed == 0) - { - *os << "true"; - } - - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/obv_module.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/obv_module.cpp deleted file mode 100644 index c69154e3dce..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/obv_module.cpp +++ /dev/null @@ -1,287 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// obv_module.cpp -// -// = DESCRIPTION -// Concrete visitor for the Module class -// This provides code generation for the module in the header -// for the OBV_ namespace (see C++ mapping OMG 20.17) -// -// = AUTHOR -// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de> -// -// ============================================================================ - -ACE_RCSID (be_visitor_obv_module, - obv_module, - "$Id$") - -// ************************************************************ -// OBV module visitor for server header. -// ************************************************************ - -be_visitor_obv_module::be_visitor_obv_module (be_visitor_context *ctx) - : be_visitor_scope (ctx) -{ -} - -be_visitor_obv_module::~be_visitor_obv_module (void) -{ -} - -int -be_visitor_obv_module::visit_module (be_module *node) -{ - if (node->imported ()) - { - return 0; - } - - if (node->has_nested_valuetype ()) - { - TAO_OutStream *os = this->ctx_->stream (); - - if (this->ctx_->state () == TAO_CodeGen::TAO_MODULE_OBV_CH) - { - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - *os << "namespace "; - - if (!node->is_nested ()) - { - // We are outermost module, so prepend. - *os << "OBV_" << node->local_name () << be_nl; - } - else - { - // We are inside another module. - *os << node->local_name () << be_nl; - } - - *os << "{" << be_idt; - } - - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_obv_module::" - "visit_module - " - "codegen for scope failed\n"), - -1); - } - - if (this->ctx_->state () == TAO_CodeGen::TAO_MODULE_OBV_CH) - { - *os << be_uidt_nl << "}"; - } - } - - return 0; -} - -int -be_visitor_obv_module::visit_valuetype (be_valuetype *node) -{ - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - int status = 1; - - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_MODULE_OBV_CH: - ctx.state (TAO_CodeGen::TAO_VALUETYPE_OBV_CH); - break; - case TAO_CodeGen::TAO_MODULE_OBV_CI: - { - // This context state is not involved in any strategies. - ctx.state (TAO_CodeGen::TAO_VALUETYPE_OBV_CI); - be_visitor_valuetype_obv_ci visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_MODULE_OBV_CS: - ctx.state (TAO_CodeGen::TAO_VALUETYPE_OBV_CS); - break; - default: - return 0; - } - - if (status == 0) - { - return 0; - } - else if (status == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_obv_module::" - "visit_valuetype - " - "failed to accept visitor\n"), - -1); - } - - // Change the state depending on the kind of node strategy. - ctx.state (node->next_state (ctx.state ())); - - be_visitor *visitor = tao_cg->make_visitor (&ctx); - - if (!visitor) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_obv_module::" - "visit_valuetype - " - "NUL visitor\n"), - -1); - } - - if (node->accept (visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_obv_module::" - "visit_valuetype - " - "failed to accept visitor\n"), - -1); - } - - delete visitor; - visitor = 0; - - // Do addtional "extra" code generation if necessary. - if (node->has_extra_code_generation (ctx.state ())) - { - // Change the state depending on the kind of node strategy. - ctx.state (node->next_state (ctx.state (), 1)); - - visitor = tao_cg->make_visitor (&ctx); - - if (!visitor) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_obv_module::" - "visit_valuetype - " - "NUL visitor\n"), - -1); - } - - if (node->accept (visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_obv_module::" - "visit_valuetype - " - "failed to accept visitor\n"), - -1); - } - - delete visitor; - visitor = 0; - } - - return 0; -} - -int -be_visitor_obv_module::visit_eventtype (be_eventtype *node) -{ - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - int status = 1; - - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_MODULE_OBV_CH: - ctx.state (TAO_CodeGen::TAO_VALUETYPE_OBV_CH); - break; - case TAO_CodeGen::TAO_MODULE_OBV_CI: - { - // This context state is not involved in any strategies. - ctx.state (TAO_CodeGen::TAO_VALUETYPE_OBV_CI); - be_visitor_valuetype_obv_ci visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_MODULE_OBV_CS: - ctx.state (TAO_CodeGen::TAO_VALUETYPE_OBV_CS); - break; - default: - return 0; - } - - if (status == 0) - { - return 0; - } - else if (status == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_obv_module::" - "visit_valuetype - " - "failed to accept visitor\n"), - -1); - } - - // Change the state depending on the kind of node strategy. - ctx.state (node->next_state (ctx.state ())); - - be_visitor *visitor = tao_cg->make_visitor (&ctx); - - if (!visitor) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_obv_module::" - "visit_valuetype - " - "NUL visitor\n"), - -1); - } - - if (node->accept (visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_obv_module::" - "visit_valuetype - " - "failed to accept visitor\n"), - -1); - } - - delete visitor; - visitor = 0; - - // Do addtional "extra" code generation if necessary. - if (node->has_extra_code_generation (ctx.state ())) - { - // Change the state depending on the kind of node strategy. - ctx.state (node->next_state (ctx.state (), 1)); - - visitor = tao_cg->make_visitor (&ctx); - - if (!visitor) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_obv_module::" - "visit_valuetype - " - "NUL visitor\n"), - -1); - } - - if (node->accept (visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_obv_module::" - "visit_valuetype - " - "failed to accept visitor\n"), - -1); - } - - delete visitor; - visitor = 0; - } - - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp deleted file mode 100644 index ebbbd55dca8..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp +++ /dev/null @@ -1,986 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// valuetype.cpp -// -// = DESCRIPTION -// Visitor generating code for Valuetypes. This is a generic visitor. -// -// = AUTHOR -// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de> -// based on interface.cpp from Aniruddha Gokhale -// -// ============================================================================ - -ACE_RCSID (be_visitor_valuetype, - valuetype, - "$Id$") - -be_visitor_valuetype::be_visitor_valuetype (be_visitor_context *ctx) - : be_visitor_scope (ctx) -{ -} - -be_visitor_valuetype::~be_visitor_valuetype (void) -{ -} - -int -be_visitor_valuetype::visit_valuetype_scope (be_valuetype *node) -{ - this->elem_number_ = 0; - - for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls); - !si.is_done (); - si.next()) - { - AST_Decl *d = si.item (); - - if (!d) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_scope::visit_scope - " - "bad node in this scope\n"), - -1); - } - - be_decl *bd = be_decl::narrow_from_decl (d); - // Set the scope node as "node" in which the code is being - // generated so that elements in the node's scope can use it - // for code generation. - - this->ctx_->scope (node->decl ()); - this->ctx_->node (bd); - this->elem_number_++; - - AST_Field *field = AST_Field::narrow_from_decl (d); - - if (field != 0 && field->visibility () == AST_Field::vis_PRIVATE) - { - this->begin_private (); - } - else - { - this->begin_public (); - } - - if (bd == 0 || bd->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_scope::visit_scope - " - "codegen for scope failed\n"), - -1); - - } - } - - return 0; -} - -// These two are called from visit_valuetype_scope() -void -be_visitor_valuetype::begin_public () -{ - // In derived visitors print "public:" in class definition -} - -void -be_visitor_valuetype::begin_private () -{ - // In derived visitors print "protected:" in class definition -} - -// All common visit methods for valuetype visitor. - -int -be_visitor_valuetype::visit_attribute (be_attribute *node) -{ - this->ctx_->node (node); - this->ctx_->attribute (node); - - be_operation get_op (node->field_type (), - AST_Operation::OP_noflags, - node->name (), - 0, - 0); - - get_op.set_name ((UTL_IdList *) node->name ()->copy ()); - - if (this->visit_operation (&get_op) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_attribute::" - "visit_attribute - " - "codegen for get_attribute failed\n"), - -1); - } - - get_op.destroy (); - - if (node->readonly ()) - { - // Nothing else to do. - return 0; - } - - Identifier id ("void"); - - UTL_ScopedName sn (&id, - 0); - - be_predefined_type rt (AST_PredefinedType::PT_void, - &sn); - - // Argument type is the same as the attribute type. - AST_Argument *arg = - idl_global->gen ()->create_argument (AST_Argument::dir_IN, - node->field_type (), - node->name ()); - - arg->set_name ((UTL_IdList *) node->name ()->copy ()); - - // Create the operation. - be_operation set_op (&rt, - AST_Operation::OP_noflags, - node->name (), - 0, - 0); - - set_op.set_name ((UTL_IdList *) node->name ()->copy ()); - set_op.be_add_argument (arg); - - if (this->visit_operation (&set_op) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_attribute::" - "visit_attribute - " - "codegen for set_attribute failed\n"), - -1); - } - - set_op.destroy (); - rt.destroy (); - - return 0; -} - - -int -be_visitor_valuetype::visit_constant (be_constant *node) -{ - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - int status = 0; - - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_ROOT_CH: - { - be_visitor_constant_ch visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_CS: - { - be_visitor_constant_cs visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_VALUETYPE_OBV_CH: - case TAO_CodeGen::TAO_VALUETYPE_OBV_CI: - case TAO_CodeGen::TAO_VALUETYPE_OBV_CS: - case TAO_CodeGen::TAO_ROOT_ANY_OP_CH: - case TAO_CodeGen::TAO_ROOT_ANY_OP_CS: - case TAO_CodeGen::TAO_ROOT_CDR_OP_CH: - case TAO_CodeGen::TAO_ROOT_CDR_OP_CS: - case TAO_CodeGen::TAO_ROOT_CI: - case TAO_CodeGen::TAO_ROOT_SH: - case TAO_CodeGen::TAO_ROOT_IH: - case TAO_CodeGen::TAO_ROOT_IS: - case TAO_CodeGen::TAO_ROOT_SI: - case TAO_CodeGen::TAO_ROOT_SS: - return 0; // Nothing to be done. - default: - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype::" - "visit_constant - " - "Bad context state\n"), - -1); - } - } - - if (status == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype::" - "visit_constant - " - "failed to accept visitor\n"), - -1); - } - - return 0; -} - -int -be_visitor_valuetype::visit_enum (be_enum *node) -{ - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - int status = 0; - - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_ROOT_CH: - { - be_visitor_enum_ch visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_CS: - { - be_visitor_enum_cs visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_ANY_OP_CH: - { - be_visitor_enum_any_op_ch visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_ANY_OP_CS: - { - be_visitor_enum_any_op_cs visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_CDR_OP_CH: - { - be_visitor_enum_cdr_op_ch visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_CDR_OP_CS: - { - be_visitor_enum_cdr_op_cs visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_VALUETYPE_OBV_CH: - case TAO_CodeGen::TAO_VALUETYPE_OBV_CI: - case TAO_CodeGen::TAO_VALUETYPE_OBV_CS: - case TAO_CodeGen::TAO_ROOT_CI: - case TAO_CodeGen::TAO_ROOT_SH: - case TAO_CodeGen::TAO_ROOT_IH: - case TAO_CodeGen::TAO_ROOT_IS: - case TAO_CodeGen::TAO_ROOT_SI: - case TAO_CodeGen::TAO_ROOT_SS: - return 0; // Nothing to be done. - default: - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype::" - "visit_enum - " - "Bad context state\n"), - -1); - } - } - - if (status == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype::" - "visit_enum - " - "failed to accept visitor\n"), - -1); - } - - return 0; -} - -int -be_visitor_valuetype::visit_exception (be_exception *node) -{ - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - int status = 0; - - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_ROOT_CH: - { - be_visitor_exception_ch visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_CI: - { - be_visitor_exception_ci visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_CS: - { - be_visitor_exception_cs visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_ANY_OP_CH: - { - be_visitor_exception_any_op_ch visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_ANY_OP_CS: - { - be_visitor_exception_any_op_cs visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_CDR_OP_CH: - { - be_visitor_exception_cdr_op_ch visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_CDR_OP_CS: - { - be_visitor_exception_cdr_op_cs visitor (&ctx); - status = node->accept (&visitor); - break; - } - default: - return 0; // Nothing to be done. - } - - if (status == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface::" - "visit_exception - " - "failed to accept visitor\n"), - -1); - } - - return 0; -} - -int -be_visitor_valuetype::visit_structure (be_structure *node) -{ - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - int status = 0; - - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_ROOT_CH: - { - be_visitor_structure_ch visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_CI: - { - be_visitor_structure_ci visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_CS: - { - be_visitor_structure_cs visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_ANY_OP_CH: - { - be_visitor_structure_any_op_ch visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_ANY_OP_CS: - { - be_visitor_structure_any_op_cs visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_CDR_OP_CH: - { - be_visitor_structure_cdr_op_ch visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_CDR_OP_CS: - { - be_visitor_structure_cdr_op_cs visitor (&ctx); - status = node->accept (&visitor); - break; - } - default: - return 0; // Nothing to be done. - } - - if (status == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype::" - "visit_structure - " - "failed to accept visitor\n"), - -1); - } - - return 0; -} - -int -be_visitor_valuetype::visit_structure_fwd (be_structure_fwd *node) -{ - // Instantiate a visitor context with a copy of our context. This info - // will be modified based on what type of node we are visiting. - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - int status = 0; - - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_ROOT_CH: - { - be_visitor_structure_fwd_ch visitor (&ctx); - status = node->accept (&visitor); - break; - } - default: - return 0; // nothing to be done - } - - if (status == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype::" - "visit_structure_fwd - " - "failed to accept visitor\n"), - -1); - } - - return 0; -} - -int -be_visitor_valuetype::visit_union (be_union *node) -{ - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - int status = 0; - - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_ROOT_CH: - { - be_visitor_union_ch visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_CI: - { - be_visitor_union_ci visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_CS: - { - be_visitor_union_cs visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_ANY_OP_CH: - { - be_visitor_union_any_op_ch visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_ANY_OP_CS: - { - be_visitor_union_any_op_cs visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_CDR_OP_CH: - { - be_visitor_union_cdr_op_ch visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_CDR_OP_CS: - { - be_visitor_union_cdr_op_cs visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_VALUETYPE_OBV_CH: - case TAO_CodeGen::TAO_VALUETYPE_OBV_CI: - case TAO_CodeGen::TAO_VALUETYPE_OBV_CS: - case TAO_CodeGen::TAO_ROOT_SH: - case TAO_CodeGen::TAO_ROOT_IH: - case TAO_CodeGen::TAO_ROOT_IS: - case TAO_CodeGen::TAO_ROOT_SI: - case TAO_CodeGen::TAO_ROOT_SS: - return 0; // Nothing to be done. - default: - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype::" - "visit_union - " - "Bad context state\n"), - -1); - } - } - - if (status == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype::" - "visit_union - " - "failed to accept visitor\n"), - -1); - } - - return 0; -} - -int -be_visitor_valuetype::visit_union_fwd (be_union_fwd *node) -{ - // Instantiate a visitor context with a copy of our context. This info - // will be modified based on what type of node we are visiting. - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - int status = 0; - - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_ROOT_CH: - { - be_visitor_union_fwd_ch visitor (&ctx); - status = node->accept (&visitor); - break; - } - default: - return 0; // nothing to be done - } - - if (status == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype::" - "visit_union_fwd - " - "failed to accept visitor\n"), - -1); - } - - return 0; -} - -int -be_visitor_valuetype::visit_typedef (be_typedef *node) -{ - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - int status = 0; - - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_ROOT_CH: - { - be_visitor_typedef_ch visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_CI: - { - be_visitor_typedef_ci visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_CS: - { - be_visitor_typedef_cs visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_ANY_OP_CH: - { - be_visitor_typedef_any_op_ch visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_ANY_OP_CS: - { - be_visitor_typedef_any_op_cs visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_CDR_OP_CH: - { - be_visitor_typedef_cdr_op_ch visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_CDR_OP_CS: - { - be_visitor_typedef_cdr_op_cs visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_VALUETYPE_OBV_CH: - case TAO_CodeGen::TAO_VALUETYPE_OBV_CI: - case TAO_CodeGen::TAO_VALUETYPE_OBV_CS: - case TAO_CodeGen::TAO_ROOT_SH: - case TAO_CodeGen::TAO_ROOT_IH: - case TAO_CodeGen::TAO_ROOT_IS: - case TAO_CodeGen::TAO_ROOT_SI: - case TAO_CodeGen::TAO_ROOT_SS: - return 0; // Nothing to be done. - default: - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype::" - "visit_typedef - " - "Bad context state\n"), - -1); - } - } - - if (status == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype::" - "visit_typedef - " - "failed to accept visitor\n"), - -1); - } - - return 0; -} - -int -be_visitor_valuetype::visit_field (be_field *) -{ - // Is overridden in derived visitors. - return 0; -} - - -// Private data fields for scope. -int -be_visitor_valuetype::gen_pd (be_valuetype *node) -{ - int n_processed = 0; - this->elem_number_ = 0; - - for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls); - !si.is_done (); - si.next()) - { - AST_Decl *d = si.item (); - - if (!d) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_scope::visit_scope - " - "bad node in this scope\n"), - -1); - } - - be_field *field = be_field::narrow_from_decl (d); - - if (!field) - { - continue; - } - - ++n_processed; - - // Set the scope node as "node" in which the code is being - // generated so that elements in the node's scope can use it - // for code generation. - this->ctx_->scope (node->decl ()); - - // Set the node to be visited. - this->ctx_->node (field); - this->elem_number_++; - - if (this->gen_field_pd (field) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_scope::visit_scope - " - "codegen for scope failed\n"), - -1); - } - } - - return 0; -} - -// Private data for field. -int -be_visitor_valuetype::gen_field_pd (be_field *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - // First generate the type information. - be_type *bt = be_type::narrow_from_decl (node->field_type ()); - be_valuetype *vt = be_valuetype::narrow_from_scope (node->defined_in ()); - - if (!bt || !vt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_field_ch::" - "visit_field - " - "Bad field type\n"), - -1); - } - - // Instantiate a visitor context with a copy of our context. This info - // will be modified based on what type of node we are visiting. - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - be_visitor_field_ch visitor (&ctx); - - *os << be_nl; - - if (bt->accept (&visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_field_ch::" - "visit_field - " - "codegen for field type failed\n"), - -1); - } - - // Now output the field name. - *os << " " << vt->field_pd_prefix () - << node->local_name () - << vt->field_pd_postfix () << ";"; - - return 0; -} - -void -be_visitor_valuetype::gen_obv_init_constructor_args (be_valuetype *node, - unsigned long &index) -{ - TAO_OutStream *os = this->ctx_->stream (); - AST_ValueType *parent = node->inherits_concrete (); - - // Generate for inherited members first. - if (parent != 0) - { - be_valuetype *be_parent = - be_valuetype::narrow_from_decl (parent); - this->gen_obv_init_constructor_args (be_parent, index); - } - - be_visitor_context ctx (*this->ctx_); - be_visitor_args_arglist visitor (&ctx); - - for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls); - !si.is_done (); - si.next()) - { - be_field *f = be_field::narrow_from_decl (si.item ()); - - if (f == 0) - { - continue; - } - - *os << (index++ != 0 ? "," : "") << be_nl; - - ACE_CString arg_name ("_tao_init_"); - arg_name += f->local_name ()->get_string (); - Identifier id (arg_name.c_str ()); - UTL_ScopedName sn (&id, 0); - be_type *ft = be_type::narrow_from_decl (f->field_type ()); - bool seen = ft->seen_in_operation (); - - // This sets ft->seen_in_operation (true), so we have to - // restore the original value below. - be_argument arg (AST_Argument::dir_IN, - ft, - &sn); - ft->seen_in_operation (seen); - visitor.visit_argument (&arg); - - // AST_Argument inherits from AST_Field, which will destroy - // its field type if it is anonymous - we don't want that. - arg.be_decl::destroy (); - arg.AST_Decl::destroy (); - id.destroy (); - } -} - -// Generate the _init definition. -int -be_visitor_valuetype::gen_init_defn (be_valuetype *node) -{ - if (node->is_abstract ()) - { - return 0; - } - - TAO_OutStream *os = this->ctx_->stream (); - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - *os << "class " << be_global->stub_export_macro () - << " " << node->local_name () - << "_init : public ::CORBA::ValueFactoryBase" << be_nl; - - // Generate the body. - *os << "{" << be_nl - << "public:" << be_idt_nl - << "virtual ~" << node->local_name () << "_init (void);" << be_nl; - - *os << "virtual const char* tao_repository_id (void);\n" << be_nl; - *os << "// create () goes here" << be_nl; - *os << be_uidt_nl << "};" << be_nl; - - return 0; -} - -int -be_visitor_valuetype::gen_init_impl (be_valuetype *node) -{ - if (node->is_abstract ()) - { - return 0; - } - - TAO_OutStream *os = this->ctx_->stream (); - os->indent (); - - char fname [NAMEBUFSIZE]; // to hold the full and - char lname [NAMEBUFSIZE]; // local _out names - - ACE_OS::memset (fname, - '\0', - NAMEBUFSIZE); - ACE_OS::sprintf (fname, - "%s_init", - node->full_name ()); - - ACE_OS::memset (lname, - '\0', - NAMEBUFSIZE); - ACE_OS::sprintf (lname, - "%s_init", - node->local_name ()); - - // Destructor. - *os << fname << "::~" << lname << " (void)" << be_nl - << "{" << be_nl << "}\n\n"; - - *os << "const char* " << be_nl - << fname << "::tao_repository_id (void)" << be_nl - << "{" << be_idt_nl - << "return " << node->local_name () - << "::_tao_obv_static_repository_id ();" - << be_uidt_nl << "}\n\n"; - - return 0; -} - -bool -be_visitor_valuetype::obv_need_ref_counter (be_valuetype* node) -{ - // Go thru our base VTs and see if one has already. - for (int i = 0; i < node->n_inherits (); ++i) - { - be_valuetype *vt = - be_valuetype::narrow_from_decl (node->inherits ()[i]); - - if (vt != 0) - { - if (be_visitor_valuetype::obv_have_ref_counter (vt)) - { - return false; - } - } - } - - // If we inherit from CORBA::Object and/or CORBA::AbstractBase - // (in addition to CORBA::ValueBase) we have to override _add_ref() - // and _remove_ref() by calling the one in DefaultValueRefCountBase - // to avoid ambiguity. - if (node->n_supports () > 0) - { - return true; - } - - // VT needs RefCounter if it has concrete factory. - if (be_valuetype::FS_CONCRETE_FACTORY == node->determine_factory_style ()) - { - return true; - } - - return false; -} - -bool -be_visitor_valuetype::obv_have_ref_counter (be_valuetype* node) -{ - - // Just try to find a VT with concrete factory in inheritance tree. - if (node == 0) - { - return false; - } - - if (node->determine_factory_style () == be_valuetype::FS_CONCRETE_FACTORY) - { - return true; - } - - // Now go thru our base VTs. - for (int i = 0; i < node->n_inherits (); ++i) - { - be_valuetype *vt = be_valuetype::narrow_from_decl (node->inherits ()[i]); - - if (vt != 0) - { - if (be_visitor_valuetype::obv_have_ref_counter (vt)) - { - return true; - } - } - } - - return false; -} - -bool -be_visitor_valuetype::is_amh_exception_holder (be_valuetype *node) -{ - if (ACE_OS::strncmp (node->local_name (), "AMH_", 4) == 0) - { - const char *last_E = - ACE_OS::strrchr (node->full_name (), 'E'); - - if (last_E != 0 - && ACE_OS::strcmp (last_E, "ExceptionHolder") == 0) - { - return true; - } - } - - return false; -} diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp deleted file mode 100644 index fef8e7466a5..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp +++ /dev/null @@ -1,546 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// valuetype_ch.cpp -// -// = DESCRIPTION -// Visitor generating code for Valuetypes in the client header -// (see C++ mapping OMG 20.17) -// -// = AUTHOR -// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>, -// based on interface_ch.cpp from Aniruddha Gokhale -// -// ============================================================================ - -ACE_RCSID (be_visitor_valuetype, - valuetype_ch, - "$Id$") - -// ****************************************************** -// Valuetype visitor for client header -// ****************************************************** - -be_visitor_valuetype_ch::be_visitor_valuetype_ch (be_visitor_context *ctx) - : be_visitor_valuetype (ctx) -{ -} - -be_visitor_valuetype_ch::~be_visitor_valuetype_ch (void) -{ -} - -int -be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node) -{ - if (node->cli_hdr_gen () || node->imported ()) - { - return 0; - } - - // Evaluate the member in time for the decision to generate - // the recursive typecode include in the stub source file. - ACE_Unbounded_Queue<AST_Type *> list; - (void) node->in_recursion (list); - - // This will be a no-op if it has alread by done by a forward - // declaration. - node->gen_var_out_seq_decls (); - - TAO_OutStream *os = this->ctx_->stream (); - int status = 0; - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__; - - // 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 - << "class " << node->local_name () << "Consumer;" << be_nl - << "typedef " << node->local_name () << "Consumer *" - << node->local_name () << "Consumer_ptr;"; - } - - // Now generate the class definition. - *os << be_nl << be_nl << "class " << be_global->stub_export_macro () - << " " << node->local_name (); - - // Node valuetype inherits from other valuetypes (OMG 20.17.9) - // (ordinary (not abstract) interfaces ignored). - - *os << be_idt_nl << ": " << be_idt; - - long i; // loop index - be_valuetype *inherited = 0; - long n_inherits = node->n_inherits (); - int inherits_eventtype = 0; - - if (n_inherits > 0) - { - for (i = 0; i < n_inherits; ++i) - { - inherited = - be_valuetype::narrow_from_decl (node->inherits ()[i]); - - if (inherited->node_type () == AST_Decl::NT_eventtype) - { - inherits_eventtype = 1; - } - - if (i > 0) - { - *os << "," << be_nl; - } - - be_decl *scope = 0; - - if (inherited->is_nested ()) - { - // Inherited node is used in the scope of "node" node. - scope = - be_scope::narrow_from_scope (node->defined_in ())->decl (); - } - - // Dump the scoped name. - *os << "public virtual "; - *os << inherited->nested_type_name (scope); - } // end of for loop - } - - /*********************************************************************** - ** This is where we diverge for an ExceptionHolder ValueType. - ** This is how we proceed: - ** 1) Identify it is an AMH_ExceptionHolder class. - ** 2) Inherit from CORBA::DefaultValueBaseRef i.e. provide a CONCRETE - ** implementation for this ValueType! This is because the alternative - ** design of deriving a concrete-exception-holder class that the IDL - ** compiler again has to generate is superflous, unnecessary, more - ** coe bloat and unnecessary information for the app-programmer. The - ** 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 - CORBA::Exception* - ** 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-abstract. - ** 2.6) Generate the right throw spec for the AMH ExceptionHolders - ************************************************************************/ - - /****************************************************************/ - // 1) Find out if the ValueType is an AMH_*ExceptionHolder - bool is_an_amh_exception_holder = this->is_amh_exception_holder (node); - - if (is_an_amh_exception_holder) - { - if (n_inherits > 0) - { - *os << "," << be_nl; - } - - *os << "public virtual ::CORBA::DefaultValueRefCountBase"; - } - else if (node->node_type () == AST_Decl::NT_eventtype) - { - if (inherits_eventtype == 0) - { - if (n_inherits > 0) - { - *os << "," << be_nl; - } - - *os << "public virtual ::Components::EventBase"; - } - } - else if (n_inherits == 0) - { - *os << "public virtual ::CORBA::ValueBase"; - } - - // Generate the supported interfaces. - for (i = 0; i < node->n_supports (); ++i) - { - *os << "," << be_nl - << "public virtual " - << node->supports ()[i]->name (); - } - - // Generate the body. - *os << be_uidt << be_uidt_nl - << "{" << be_nl - << "public:" << be_idt_nl - << "typedef " << node->local_name () << " * _ptr_type;" << be_nl - << "typedef " << node->local_name () << "_var _var_type;" - << be_nl - << "typedef " << node->local_name () << "_out _out_type;" - << be_nl << be_nl; - - if (is_an_amh_exception_holder) - { - // Generate the constructor and destructor. - *os << node->local_name () << " ( ::CORBA::Exception *ex)" << be_idt_nl - << ": exception (ex)" << be_uidt_nl - << "{}" << be_nl << be_nl - << "virtual ~" << node->local_name () << " (void);" - << be_nl << be_nl; - } - - *os << "static " << node->local_name () << "* " - << "_downcast ( ::CORBA::ValueBase *v);" << be_nl - << be_nl - << "// (TAO extensions or internals)" << be_nl - << "static ::CORBA::Boolean _tao_unmarshal (" << be_idt << be_idt_nl - << "TAO_InputCDR &strm," << be_nl - << node->local_name () << " *&new_object" << be_uidt_nl - << ");" << be_uidt_nl << be_nl - << "virtual const char* " - << "_tao_obv_repository_id (void) const;" - << be_nl << be_nl - << "virtual void " - << "_tao_obv_truncatable_repo_ids (Repository_Id_List &) const;" - << be_nl << be_nl - << "static const char* " - << "_tao_obv_static_repository_id (void);" << be_nl << be_nl; - - if (be_global->any_support ()) - { - *os << "static void _tao_any_destructor (void *);"; - } - - // Generate code for the valuetype definition. - if (this->visit_valuetype_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_ch::" - "visit_valuetype - " - "codegen for scope failed\n"), - -1); - } - - // Generate pure virtual declarations of the operations in our - // supported interfaces. - status = - node->traverse_supports_list_graphs ( - be_visitor_valuetype_ch::gen_supported_ops, - os, - false, - true - ); - - if (status == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_ch::" - "visit_valuetype - " - "traversal of supported interfaces failed\n"), - -1); - } - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__; - - // If we inherit from CORBA::Object and/or CORBA::AbstractBase - // (in addition to CORBA::ValueBase) we have to add these - // to avoid ambiguity. - if (node->n_supports () > 0) - { - *os << be_uidt_nl << be_nl << "public:" << be_idt_nl; - *os << be_nl << "virtual void _add_ref (void) = 0;" << be_nl; - *os << "virtual void _remove_ref (void) = 0;" << be_nl; - *os << "virtual ::CORBA::ValueBase *_tao_to_value (void);"; - } - - // Generate the "protected" constructor so that users cannot - // instantiate us. - *os << be_uidt_nl << be_nl << "protected:" << be_idt_nl - << node->local_name () - << " (void);" << be_nl; - - if (!is_an_amh_exception_holder) - { - *os << "virtual ~" << node->local_name () << " (void);" - << be_nl << be_nl; - } - - // Support for marshalling. - if (!node->is_abstract () || is_an_amh_exception_holder) - { - *os << "virtual ::CORBA::Boolean " - << "_tao_marshal_v (TAO_OutputCDR &) const;" << be_nl; - *os << "virtual ::CORBA::Boolean " - << "_tao_unmarshal_v (TAO_InputCDR &);" << be_nl; - *os << "virtual ::CORBA::Boolean " - << "_tao_match_formal_type (ptrdiff_t ) const;" << be_nl; - } - - // Private member: - - // Private copy constructor and assignment operator. These are not - // allowed, hence they are private. - *os << be_uidt_nl << "private:" << be_idt_nl; - *os << node->local_name () << " (const " << node->local_name () << " &);" - << be_nl - << "void operator= (const " << node->local_name () << " &);" - << be_nl; - - /*********************************************************/ - // 2.4 - if (is_an_amh_exception_holder) - { - *os << be_nl - << "::CORBA::Exception *exception;" - << be_nl; - } - /*********************************************************/ - - - // Map fields to private data (if optimizing). - if (node->opt_accessor ()) - { - *os << be_uidt_nl << "protected:" << be_idt_nl; - *os << "::CORBA::Boolean " - << "_tao_marshal_state (TAO_OutputCDR &) const;" << be_nl - << "::CORBA::Boolean " - << "_tao_unmarshal_state (TAO_InputCDR &);" << be_nl - << "virtual void " - << "truncation_hook (void);" - << be_uidt_nl << be_nl; - *os << "private:" << be_idt_nl; - - this->gen_pd (node); - } - else // Need a way to access the state of derived OBV_ classes. - { - if (!node->is_abstract ()) - { - *os << be_uidt_nl << "protected:" << be_idt_nl; - - if (is_an_amh_exception_holder) - { - *os << "virtual ::CORBA::Boolean" << be_nl - << "_tao_marshal__" << node->flat_name () - << " (TAO_OutputCDR &, TAO_ChunkInfo &) const;" - << be_nl << be_nl; - *os << "virtual ::CORBA::Boolean" << be_nl - << "_tao_unmarshal__" << node->flat_name () - << " (TAO_InputCDR &, TAO_ChunkInfo &);"; - } - else - { - *os << "virtual ::CORBA::Boolean" << be_nl - << "_tao_marshal__" << node->flat_name () - << " (TAO_OutputCDR &, TAO_ChunkInfo &) const = 0;" - << be_nl << be_nl; - *os << "virtual ::CORBA::Boolean" << be_nl - << "_tao_unmarshal__" << node->flat_name () - << " (TAO_InputCDR &, TAO_ChunkInfo &) = 0;"; - } - } - } - - *os << be_uidt_nl - << "};"; - - os->gen_endif (); - - // Generate the _init -related declarations. - be_visitor_context ctx (*this->ctx_); - be_visitor_valuetype_init_ch visitor (&ctx); - - if (visitor.visit_valuetype (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_ch::" - "visit_valuetype - " - "failed to generate _init construct.\n"), - -1); - } - - // Step last: generate typecode declaration. - if (be_global->tc_support ()) - { - be_visitor_context ctx (*this->ctx_); - be_visitor_typecode_decl visitor (&ctx); - - if (node->accept (&visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_ch::" - "visit_structure - " - "TypeCode declaration failed\n"), - -1); - } - } - - node->cli_hdr_gen (true); - - return 0; -} - -int -be_visitor_valuetype_ch::visit_eventtype (be_eventtype *node) -{ - return this->visit_valuetype (node); -} - -int -be_visitor_valuetype_ch::visit_operation (be_operation *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - this->ctx_->node (node); // save the node - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl; - - // Every operation is declared public and virtual in the client code. - *os << be_uidt_nl << "public:" << be_idt_nl << "virtual "; - - be_type *bt = be_type::narrow_from_decl (node->return_type ()); - - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_ch::" - "visit_operation - " - "Bad return type\n"), - -1); - } - - be_visitor_context ctx (*this->ctx_); - be_visitor_operation_rettype or_visitor (&ctx); - - if (bt->accept (&or_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_ch::" - "visit_operation - " - "codegen for return type failed\n"), - -1); - } - - *os << " " << node->local_name (); - - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_CH); - be_visitor_obv_operation_arglist ooa_visitor (&ctx); - - if (node->accept (&ooa_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_ch::" - "visit_operation - " - "codegen for argument list failed\n"), - -1); - } - - return 0; -} - -int -be_visitor_valuetype_ch::visit_field (be_field *node) -{ - be_valuetype *vt = be_valuetype::narrow_from_scope (node->defined_in ()); - - if (!vt) - { - return -1; - } - - be_visitor_context ctx (*this->ctx_); - be_visitor_valuetype_field_ch visitor (&ctx); - - if (vt->opt_accessor ()) - { - visitor.setenclosings ("",";"); - } - else - { - visitor.setenclosings ("virtual "," = 0;"); - } - - if (node->accept (&visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_obv_ch::" - "visit_field - codegen failed\n"), - -1); - } - - return 0; -} - - -void -be_visitor_valuetype_ch::begin_public (void) -{ - TAO_OutStream *os = this->ctx_->stream (); - - *os << be_uidt_nl << be_nl << "public:" - << be_idt; -} - -void -be_visitor_valuetype_ch::begin_private (void) -{ - TAO_OutStream *os = this->ctx_->stream (); - - *os << be_uidt_nl << be_nl << "protected:" - << be_idt; -} - -int -be_visitor_valuetype_ch::gen_supported_ops (be_interface *, - be_interface *base, - TAO_OutStream *os) -{ - - AST_Decl *d = 0; - be_visitor_context ctx; - ctx.stream (os); - - for (UTL_ScopeActiveIterator si (base, UTL_Scope::IK_decls); - !si.is_done (); - si.next ()) - { - d = si.item (); - - if (d == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_ch::" - "gen_supported_ops - " - "bad node in this scope\n"), - -1); - } - - AST_Decl::NodeType nt = d->node_type (); - be_visitor_valuetype_ch visitor (&ctx); - - if (nt == AST_Decl::NT_op) - { - be_operation *op = be_operation::narrow_from_decl (d); - - if (visitor.visit_operation (op) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_ch::" - "gen_supported_ops - " - "failed to accept visitor\n"), - -1); - } - } - } - - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ci.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ci.cpp deleted file mode 100644 index eed0287f2ff..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ci.cpp +++ /dev/null @@ -1,129 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// valuetype_ci.cpp -// -// = DESCRIPTION -// Visitor generating code for Valuetypes in the client inline file -// -// = AUTHOR -// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de> -// based on code from Aniruddha Gokhale -// -// ============================================================================ - -ACE_RCSID (be_visitor_valuetype, - valuetype_ci, - "$Id$") - -// ************************************************** -// Valuetype visitor for client inline. -// ************************************************** - -be_visitor_valuetype_ci::be_visitor_valuetype_ci (be_visitor_context *ctx) - : be_visitor_valuetype (ctx), - opt_accessor_ (0) -{ -} - -be_visitor_valuetype_ci::~be_visitor_valuetype_ci (void) -{ -} - -int -be_visitor_valuetype_ci::visit_valuetype (be_valuetype *node) -{ - if (node->cli_inline_gen () || node->imported ()) - { - return 0; - } - - if (node->opt_accessor ()) - { - this->opt_accessor_ = 1; - } - - TAO_OutStream *os = this->ctx_->stream (); - - *os << be_nl << be_nl << "// TAO_IDL - Generated from " << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - *os << "ACE_INLINE" << be_nl; - *os << node->name () << "::" << node->local_name () << " (void)" << be_nl; - - if (node->truncatable()) - { - *os << "{" << be_idt_nl - << "this->is_truncatable_ = true;" << be_uidt_nl - << "}" << be_nl << be_nl; - } - else - *os << "{}" << be_nl << be_nl; - - - *os << "ACE_INLINE const char* " << be_nl - << node->name () << "::_tao_obv_static_repository_id ()" << be_nl - << "{" << be_idt_nl - << "return \"" << node->repoID () << "\";" << be_uidt_nl - << "}"; - - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_ci::" - "visit_valuetype - " - "codegen for scope failed\n"), - -1); - } - - // Generate the _init-related code. - be_visitor_context ctx (*this->ctx_); - be_visitor_valuetype_init_ci visitor (&ctx); - - if (visitor.visit_valuetype (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_ci::" - "visit_valuetype - " - "failed to generate _init construct.\n"), - -1); - } - - return 0; -} - -int -be_visitor_valuetype_ci::visit_eventtype (be_eventtype *node) -{ - return this->visit_valuetype (node); -} - -int -be_visitor_valuetype_ci::visit_field (be_field *node) -{ - if (opt_accessor_) - { - be_visitor_context ctx (*this->ctx_); - be_visitor_valuetype_field_cs visitor (&ctx); - visitor.in_obv_space_ = 0; - visitor.setenclosings ("ACE_INLINE "); - - if (visitor.visit_field (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_ci::" - "visit_field - " - "visit_field failed\n"), - -1); - } - } - - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp deleted file mode 100644 index 8e577ec39bf..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp +++ /dev/null @@ -1,430 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// valuetype_cs.cpp -// -// = DESCRIPTION -// Visitor generating code for Valuetypes in the client stubs file. -// -// = AUTHOR -// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de> -// based on code from Aniruddha Gokhale -// -// ============================================================================ - -ACE_RCSID (be_visitor_valuetype, - valuetype_cs, - "$Id$") - -// ************************************************************ -// Valuetype visitor for client stubs. -// ************************************************************ - -be_visitor_valuetype_cs::be_visitor_valuetype_cs (be_visitor_context *ctx) - : be_visitor_valuetype (ctx) -{ -} - -be_visitor_valuetype_cs::~be_visitor_valuetype_cs (void) -{ -} - -int -be_visitor_valuetype_cs::visit_valuetype (be_valuetype *node) -{ - if (node->cli_stub_gen () || node->imported ()) - { - return 0; - } - - if (be_global->tc_support ()) - { - be_visitor_context ctx (*this->ctx_); - TAO::be_visitor_value_typecode tc_visitor (&ctx); - - if (tc_visitor.visit_valuetype (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_cs::" - "visit_valuetype - " - "TypeCode definition failed\n"), - -1); - } - } - - TAO_OutStream *os = this->ctx_->stream (); - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__; - - if (node->is_defined ()) - { - *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 << node->name () - << "::_downcast ( ::CORBA::ValueBase *v)" << be_nl - << "{" << be_idt_nl - << "return dynamic_cast< ::" << node->name () - << " * > (v);" << be_uidt_nl - << "}" << be_nl << be_nl; - - // The _tao_obv_repository_id method. - *os << "const char *" << be_nl - << node->name () << "::_tao_obv_repository_id (void) const" << be_nl - << "{" << be_idt_nl - << "return this->_tao_obv_static_repository_id ();" << be_uidt_nl - << "}" << be_nl << be_nl; - - *os << "void" << be_nl - << node->name () << "::_tao_obv_truncatable_repo_ids (Repository_Id_List& ids) const" << be_nl - << "{" << be_idt_nl - << "ids.push_back (this->_tao_obv_static_repository_id ());"; - - if (node->truncatable ()) - { - *os << be_nl; - *os << node->inherits_concrete ()->name () << "::_tao_obv_truncatable_repo_ids (ids);" << be_uidt_nl; - *os << "}" << be_nl << be_nl; - } - else - *os << be_uidt_nl << "}" << be_nl << be_nl; - - if (be_global->any_support ()) - { - *os << "void" << be_nl - << node->name () - << "::_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 - << node->local_name () << " *> (" - << "_tao_void_pointer);" << be_uidt << be_uidt_nl - << "::CORBA::remove_ref (_tao_tmp_pointer);" << be_uidt_nl - << "}" << be_nl << be_nl; - } - - // Generate destructor. - // - // @@ Do not inline this destructor. It is virtual. Inlining - // virtual functions, including virtual destructors, wreaks havoc - // with g++ >= 4.0 RTTI support when the - // "-fvisibility-inlines-hidden" command line option is used. - *os << node->name () << "::~" << node->local_name () << " (void)" << be_nl; - *os << "{}\n" << be_nl; - - bool is_an_amh_exception_holder = - this->is_amh_exception_holder (node); - - // Nothing to marshal if abstract valuetype. - if (!node->is_abstract () && !is_an_amh_exception_holder) - { - // The virtual _tao_marshal_v method. - *os << "::CORBA::Boolean " << be_nl - << node->name () - << "::_tao_marshal_v (TAO_OutputCDR & strm) const" << be_nl - << "{" << be_idt_nl - << "TAO_ChunkInfo ci(this->is_truncatable_ || this->chunking_);" - << be_nl - << "return "; - - if (node->opt_accessor ()) - { - be_decl *scope = - be_scope::narrow_from_scope (node->defined_in ())->decl (); - - *os << scope->name () << "::" - << node->local_name () - << "::_tao_marshal_state (strm, ci);" << be_uidt_nl; - } - else - { - *os << "this->_tao_marshal__" << node->flat_name () - << " (strm, ci);" << be_uidt_nl; - } - - *os << "}" << be_nl << be_nl; - - // The virtual _tao_unmarshal_v method. - *os << "::CORBA::Boolean " << be_nl - << node->name () - << "::_tao_unmarshal_v (TAO_InputCDR & strm)" - << be_nl - << "{" << be_idt_nl - << "TAO_ChunkInfo ci(this->is_truncatable_ || this->chunking_ ,1);" - << be_nl - << "return "; - - if (node->opt_accessor ()) - { - be_decl *scope = - be_scope::narrow_from_scope (node->defined_in ())->decl (); - - *os << scope->name () << "::" - << node->local_name () - <<"::_tao_unmarshal_state (strm,ci);" << be_uidt_nl; - } - else - { - *os << "this->_tao_unmarshal__" << node->flat_name () - << " (strm,ci);" << be_uidt_nl; - } - - *os << "}" << be_nl << be_nl; - - *os << "::CORBA::Boolean " << be_nl - << node->name () - << "::_tao_match_formal_type (ptrdiff_t formal_type_id) const" - << be_nl - << "{" << be_idt_nl - << "return formal_type_id == reinterpret_cast<ptrdiff_t> (" - << node->name() << "::_downcast);" << be_uidt_nl - << "}" << be_nl << be_nl; - - } - else if (is_an_amh_exception_holder) - { - // @@ Do not inline. They're virtual. Inlining virtual - // functions, including virtual destructors, wreaks havoc with - // g++ >= 4.0 RTTI support when the - // "-fvisibility-inlines-hidden" command line option is used. - - // The virtual _tao_marshal_v method. - *os << "::CORBA::Boolean" << be_nl - << node->name () << "::_tao_marshal_v (TAO_OutputCDR &) const" - << be_nl - << "{" << be_idt_nl - << "return true;" << be_uidt_nl - << "}" << be_nl << be_nl; - - // The virtual _tao_unmarshal_v method. - *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; - - // The virtual _tao_match_formal_type method. - *os << "::CORBA::Boolean " << be_nl - << node->name () - << "::_tao_match_formal_type (ptrdiff_t ) const" - << be_nl - << "{" << be_idt_nl - << "return false;"<< be_uidt_nl - << "}" << be_nl << be_nl; - - - if (!node->opt_accessor () && !node->is_abstract ()) - { - *os << "::CORBA::Boolean" << be_nl - << node->name () << "::_tao_marshal__" << node->flat_name () - << " (TAO_OutputCDR &, TAO_ChunkInfo&) const" << be_nl - << "{" << be_idt_nl - << "return true;" << be_uidt_nl - << "}" << be_nl << be_nl; - - *os << "::CORBA::Boolean" << be_nl - << node->name () << "::_tao_unmarshal__" << node->flat_name () - << " (TAO_InputCDR &, TAO_ChunkInfo&)" << be_nl - << "{" << be_idt_nl - << "return true;" << be_uidt_nl - << "}" << be_nl << be_nl; - } - } - - // The static T::_tao_unmarshal method - - *os << "::CORBA::Boolean " << node->name() - << "::_tao_unmarshal (" << be_idt << be_idt_nl - << "TAO_InputCDR &strm," << be_nl - << node->local_name () << " *&new_object" << be_uidt_nl - << ")" << be_uidt_nl - << "{" << be_idt_nl - << "::CORBA::ValueBase *base = 0;" << be_nl - << "::CORBA::Boolean retval =" << be_idt_nl - << "::CORBA::ValueBase::_tao_unmarshal_pre (" << be_idt << be_idt_nl - << "strm," << be_nl - << "base," << be_nl - << node->local_name () << "::_tao_obv_static_repository_id ()" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl << be_nl - << "if (!retval)" << be_idt_nl - << "return false;" << be_uidt_nl << be_nl - << "if (base != 0 && ! base->_tao_unmarshal_v (strm))" << be_idt_nl - << "return false;" << be_uidt_nl << be_nl - << "// Now base must be null or point to the unmarshaled object." << be_nl - << "// Align the pointer to the right subobject." << be_nl - << "new_object = " << node->local_name () << "::_downcast (base);" << be_nl - << "return true;" << be_uidt_nl - << "}"; - - // If we inherit from CORBA::Object and/or CORBA::AbstractBase - // (in addition to CORBA::ValueBase) we have to add these - // to avoid ambiguity. - if (node->n_supports () > 0) - { - *os << be_nl << be_nl - << "::CORBA::ValueBase *" << be_nl - << node->name () << "::_tao_to_value (void)" << be_nl - << "{" << be_idt_nl - << "return this;" << be_uidt_nl - << "}"; - } - - // Generate code for the elements of the valuetype. - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_cs::" - "visit_valuetype - " - "codegen for scope failed\n"), - -1); - } - - // Generate the _init-related code. - be_visitor_context ctx (*this->ctx_); - be_visitor_valuetype_init_cs vi_visitor (&ctx); - - if (vi_visitor.visit_valuetype (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_ch::" - "visit_valuetype - " - "failed to generate _init construct.\n"), - -1); - } - - return 0; -} - -int -be_visitor_valuetype_cs::visit_eventtype (be_eventtype *node) -{ - return this->visit_valuetype (node); -} - -int -be_visitor_valuetype_cs::visit_operation (be_operation *node) -{ - if (node->cli_stub_gen () || node->imported ()) - { - return 0; - } - - be_valuetype *parent = - be_valuetype::narrow_from_scope (node->defined_in ()); - - if (parent == 0 || ! this->is_amh_exception_holder (parent)) - { - return 0; - } - - TAO_OutStream *os = this->ctx_->stream (); - this->ctx_->node (node); - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - // STEP I: Generate the return type. - be_type *bt = be_type::narrow_from_decl (node->return_type ()); - - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_cs::" - "visit_operation - " - "Bad return type\n"), - -1); - } - - // Grab the right visitor to generate the return type. - be_visitor_context ctx (*this->ctx_); - be_visitor_operation_rettype or_visitor (&ctx); - - if (bt->accept (&or_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_cs::" - "visit_operation - " - "codegen for return type failed\n"), - -1); - } - - // STEP 2: Generate the operation name. - *os << be_nl << parent->name () << "::" << node->local_name (); - - // STEP 3: Generate the argument list with the appropriate mapping. For these - // we grab a visitor that generates the parameter listing. - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_CS); - be_visitor_obv_operation_arglist ooa_visitor (&ctx); - - if (node->accept (&ooa_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_cs::" - "visit_operation - " - "codegen for argument list failed\n"), - -1); - } - - // We need to throw an exceptions that was assigned in a - // different place (by the app-developer). ACE_THROW does - // not fit the bill since the ACE_THROW macro contructs the - // exception passed to it. Also exception->_raise() is - // ruled out since in platforms without native exception - // support, the _raise() function does not do anything. Below we - // explicitly take care of both cases (platforms with - // and without native exception support). - *os << be_nl - << "{" << be_nl - << "#if defined (TAO_HAS_EXCEPTIONS)" << be_idt_nl - << "auto_ptr< ::CORBA::Exception> safety (this->exception);" << be_nl - << "// Direct throw because we don't have the ACE_TRY_ENV." << be_nl - << "this->exception->_raise ();" << be_uidt_nl - << "#else" << be_idt_nl - << "// We can not use ACE_THROW here." << be_nl - << "ACE_TRY_ENV.exception (this->exception);" << be_uidt_nl - << "#endif" << be_nl - << "}" - << be_uidt_nl; - - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init.cpp deleted file mode 100644 index bc351d2fc65..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// valuetype_init.cpp -// -// = DESCRIPTION -// Coomon visitor for valuetypes factory construct -// (see IDL to C++ mapping). Based on ptc/00-01-02. -// -// = AUTHOR -// Boris Kolpackov <bosk@ipmce.ru> -// -// -// ============================================================================ - -ACE_RCSID (be_visitor_valuetype, - valuetype_init, - "$Id$") - -be_visitor_valuetype_init::be_visitor_valuetype_init ( - be_visitor_context *ctx - ) - : be_visitor_valuetype (ctx) -{ -} - -be_visitor_valuetype_init::~be_visitor_valuetype_init (void) -{ -} - -void -be_visitor_valuetype_init::begin_public (void) -{ -} - -void -be_visitor_valuetype_init::begin_private (void) -{ -} diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_arglist_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_arglist_ch.cpp deleted file mode 100644 index ba41ba1371a..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_arglist_ch.cpp +++ /dev/null @@ -1,168 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// valuetype_init_arglist_ch.cpp -// -// = DESCRIPTION -// Visitor generating code for the parameter list of the OBV factory -// signature. -// -// = AUTHOR -// Boris Kolpackov <bosk@ipmce.ru> -// -// ============================================================================ - -ACE_RCSID (be_visitor_valuetype_init, - arglist_ch, - "$Id$") - -be_visitor_valuetype_init_arglist_ch::be_visitor_valuetype_init_arglist_ch ( - be_visitor_context *ctx - ) - : be_visitor_scope (ctx) -{ -} - -be_visitor_valuetype_init_arglist_ch::~be_visitor_valuetype_init_arglist_ch ( - void - ) -{ -} - -int -be_visitor_valuetype_init_arglist_ch::visit_factory (be_factory *node) -{ - TAO_OutStream& os = *(this->ctx_->stream ()); - - os << " ("; - - if (node->nmembers () > 0) - { - os << be_idt << be_idt_nl; - - // All we do is hand over code generation to our scope. - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_init_arglist_ch::" - "visit_factory - " - "codegen for scope failed\n"), - -1); - } - - os << be_uidt_nl - << ")"; - } - else - { - os << "void)" << be_idt; - } - - // Now generate the throw specs. - if (this->gen_throw_spec (node) == -1) - { - ACE_ERROR_RETURN (( - LM_ERROR, - ACE_TEXT ("(%N:%l) be_visitor_valuetype_init_arglist_ch") - ACE_TEXT ("::visit_factory - ") - ACE_TEXT ("Failed to generate throw spec\n") - ), - -1 - ); - } - - return 0; -} - -int -be_visitor_valuetype_init_arglist_ch::visit_argument (be_argument *node) -{ - // Get the visitor that will dump the argument's mapping in the operation - // signature. - be_visitor_context ctx (*this->ctx_); - be_visitor_args_arglist visitor (&ctx); - int status = node->accept (&visitor); - - if (status == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_init_arglist_ch::" - "visit_argument - " - "codegen for arglist failed\n"), - -1); - } - - return 0; -} - -int -be_visitor_valuetype_init_arglist_ch::post_process (be_decl *bd) -{ - TAO_OutStream *os = this->ctx_->stream (); - - // If we are not the last node in the list of arguments, generate a comma. - if (!this->last_node (bd)) - { - *os << "," << be_nl; - } - - return 0; -} - -int -be_visitor_valuetype_init_arglist_ch::gen_throw_spec (be_factory *node) -{ - TAO_OutStream *os = this->ctx_->stream (); - - if (node->exceptions ()) - { - const char *throw_spec_open = "throw ("; - const char *throw_spec_close = ")"; - - if (!be_global->use_raw_throw ()) - { - throw_spec_open = "ACE_THROW_SPEC (("; - throw_spec_close = "))"; - } - - *os << be_nl << throw_spec_open << be_idt; - - bool first = true; - - // Initialize an iterator to iterate thru the exception list. - for (UTL_ExceptlistActiveIterator ei (node->exceptions ()); - !ei.is_done (); - ei.next ()) - { - be_exception *excp = - be_exception::narrow_from_decl (ei.item ()); - - if (excp == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation" - "gen_throw_spec - " - "bad exception node\n"), - -1); - - } - - *os << (first ? "" : ",") << be_nl - << excp->name (); - - first = false; - } - - *os << be_uidt_nl << throw_spec_close << be_uidt; - } - - return 0; -} - diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ch.cpp deleted file mode 100644 index c68a18b7670..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ch.cpp +++ /dev/null @@ -1,194 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// valuetype_init_ch.cpp -// -// = DESCRIPTION -// Visitor generating code for Valuetypes factory in the client header -// (see IDL to C++ mapping). Based on ptc/00-01-02. -// -// = AUTHOR -// Boris Kolpackov <bosk@ipmce.ru> -// -// -// ============================================================================ - -ACE_RCSID (be_visitor_valuetype, - valuetype_init_ch, - "$Id$") - -be_visitor_valuetype_init_ch::be_visitor_valuetype_init_ch ( - be_visitor_context *ctx - ) - : be_visitor_valuetype_init (ctx) -{ -} - -be_visitor_valuetype_init_ch::~be_visitor_valuetype_init_ch (void) -{ -} - -int -be_visitor_valuetype_init_ch::visit_valuetype (be_valuetype *node) -{ - if (node->is_abstract ()) - { - return 0; - } - - // There are three possible situations. - // (1) If there is no initializers but at least one operation. - // In this case we don't need to bother about factory. - // - // (2) There are no (operations or initializers) (i.e. only state - // members) then we need a concrete type-specific factory - // class whose create_for_unmarshal creates OBV_ class. - // - // (3) There is at least one operation and at least one initializer. - // In this case we need to generate abstract factory class. - - be_valuetype::FactoryStyle factory_style = - node->determine_factory_style (); - - if (factory_style == be_valuetype::FS_NO_FACTORY) - { - // Nothing to do. - return 0; - } - - TAO_OutStream& os = *(this->ctx_->stream ()); - - // Generate the ifdef macro for the _init class. - os.gen_ifdef_macro (node->flat_name (), "_init"); - - os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - //@@ If I'm generating concrete class I need a RefCounter. - os << "class " << be_global->stub_export_macro () - << " " << node->local_name () - << "_init : public virtual ::CORBA::ValueFactoryBase" << be_nl; - - // Generate the body. - os << "{" << be_nl - << "public:" << be_idt; - - if (factory_style == be_valuetype::FS_CONCRETE_FACTORY) - { - // Public constructor. - os << be_nl - << node->local_name () << "_init (void);"; - } - - if (this->visit_valuetype_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_init_ch::" - "visit_valuetype - " - "codegen for scope failed\n"), - -1); - } - - // Generate _downcast method. - os << be_nl << be_nl - << "static " << node->local_name () << "_init* " - << "_downcast ( ::CORBA::ValueFactoryBase *);"; - - if (factory_style == be_valuetype::FS_CONCRETE_FACTORY) - { - //@@ Boris: create_for_unmarshal is still public... - // generate create_for_unmarshal - os << be_nl << be_nl - << "virtual ::CORBA::ValueBase *" << be_nl - << "create_for_unmarshal (" - << be_idt << be_idt - << env_sngl_dflts << be_uidt_nl - << ");" << be_uidt; - - if (node->supports_abstract ()) - { - os << be_nl << be_nl - << "virtual ::CORBA::AbstractBase_ptr" << be_nl - << "create_for_unmarshal_abstract (" << be_idt << be_idt - << env_sngl_dflts << be_uidt_nl - << ");" << be_uidt; - } - } - - os << be_nl << be_nl; - - // Proprietary extensions. - os << "// TAO-specific extensions" - << be_uidt_nl - << "public:" << be_idt_nl; - os << "virtual const char* tao_repository_id (void);"; - - if (factory_style == be_valuetype::FS_ABSTRACT_FACTORY) - { - // Protected constructor. - os << be_uidt_nl << be_nl - << "protected:" << be_idt_nl; - os << node->local_name () << "_init (void);"; - } - - // Protected virtual destructor. - os << be_uidt_nl << be_nl << "protected:" << be_idt_nl; - os << "virtual ~" << node->local_name () << "_init (void);"; - - os << be_uidt_nl << "};"; - - // Generate the endif macro. - os.gen_endif (); - - return 0; -} - -int -be_visitor_valuetype_init_ch::visit_eventtype (be_eventtype *node) -{ - return this->visit_valuetype (node); -} - -int -be_visitor_valuetype_init_ch::visit_factory (be_factory *node) -{ - - TAO_OutStream& os = *(this->ctx_->stream ()); - - be_valuetype *vt = - be_valuetype::narrow_from_decl (this->ctx_->scope ()); - - - // STEP I: Generate preambule. - os << be_nl << be_nl - << "virtual " << vt->local_name () << "* "; - - // STEP 2: Generate the operation name. - os << node->local_name (); - - // STEP 3: Generate the argument list with the appropriate mapping. For these - // we grab a visitor that generates the parameter listing. - be_visitor_context ctx (*this->ctx_); - be_visitor_valuetype_init_arglist_ch visitor (&ctx); - - if (node->accept (&visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_init_arglist__ch::" - "visit_operation - " - "codegen for argument list failed\n"), - -1); - } - - // Make pure virtual. - os << " = 0;"; - - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ci.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ci.cpp deleted file mode 100644 index 68e9b6f3bb1..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ci.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// valuetype_init_ci.cpp -// -// = DESCRIPTION -// Visitor generating code for Valuetypes factory in the client header -// (see IDL to C++ mapping) -// -// = AUTHOR -// Boris Kolpackov <bosk@ipmce.ru> -// -// -// ============================================================================ - -ACE_RCSID (be_visitor_valuetype, - valuetype_init_ci, - "$Id$") - -be_visitor_valuetype_init_ci::be_visitor_valuetype_init_ci ( - be_visitor_context *ctx - ) - : be_visitor_valuetype_init (ctx) -{ -} - -be_visitor_valuetype_init_ci::~be_visitor_valuetype_init_ci (void) -{ -} - diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_cs.cpp deleted file mode 100644 index 07d27795d03..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_cs.cpp +++ /dev/null @@ -1,165 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// valuetype_init_cs.cpp -// -// = DESCRIPTION -// Visitor generating code for Valuetypes factory in the client header -// (see IDL to C++ mapping) -// -// = AUTHOR -// Boris Kolpackov <bosk@ipmce.ru> -// -// -// ============================================================================ - -ACE_RCSID (be_visitor_valuetype, - valuetype_init_cs, - "$Id$") - -be_visitor_valuetype_init_cs::be_visitor_valuetype_init_cs ( - be_visitor_context *ctx - ) - : be_visitor_valuetype_init (ctx) -{ -} - -be_visitor_valuetype_init_cs::~be_visitor_valuetype_init_cs (void) -{ -} - -int -be_visitor_valuetype_init_cs::visit_valuetype (be_valuetype *node) -{ - if (node->is_abstract ()) - { - return 0; - } - - // There are three possible situations. - // (1) If there is no initializers but at least one operation. - // In this case we don't need to bother about factory. - // - // (2) There are no (operations or initializers) (i.e. only state - // members) then we need a concrete type-specific factory - // class whose create_for_unmarshal creates OBV_ class. - // - // (3) There is at least one operation and at least one initializer. - // In this case we need to generate abstract factory class. - - be_valuetype::FactoryStyle factory_style = - node->determine_factory_style (); - - if (factory_style == be_valuetype::FS_NO_FACTORY) - { - return 0; - } - - TAO_OutStream *os = this->ctx_->stream (); - - char fname [NAMEBUFSIZE]; // to hold the full and - char lname [NAMEBUFSIZE]; // local _out names - - ACE_OS::memset (fname, - '\0', - NAMEBUFSIZE); - ACE_OS::sprintf (fname, - "%s_init", - node->full_name ()); - - ACE_OS::memset (lname, - '\0', - NAMEBUFSIZE); - ACE_OS::sprintf (lname, - "%s_init", - node->local_name ()); - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__; - - // ctor - *os << be_nl << be_nl - << fname << "::" << lname << " (void)" << be_nl - << "{" << be_nl << "}"; - - // dtor - *os << be_nl << be_nl - << fname << "::~" << lname << " (void)" << be_nl - << "{" << be_nl << "}"; - - // The _downcast method. - *os << be_nl << be_nl - << node->name () << "_init *" << be_nl << node->name () - << "_init::_downcast ( ::CORBA::ValueFactoryBase *v)" << be_nl - << "{" << be_idt_nl - << "return dynamic_cast< ::" << node->name () - << "_init * > (v);" << be_uidt_nl - << "}"; - - // tao_repository_id - *os << be_nl << be_nl - << "const char* " << be_nl - << fname << "::tao_repository_id (void)" << be_nl - << "{" << be_idt_nl - << "return ::" << node->full_name () - << "::_tao_obv_static_repository_id ();" - << be_uidt_nl << "}"; - - - if (factory_style == be_valuetype::FS_CONCRETE_FACTORY) - { - // generate create_for_unmarshal() - *os << be_nl << be_nl - << "::CORBA::ValueBase *" << be_nl - << fname << "::create_for_unmarshal" << " (" - << (be_global->use_raw_throw () - ? "void" - : "ACE_ENV_SINGLE_ARG_DECL") - << ")" << be_nl - << "{" << be_idt_nl - << "::CORBA::ValueBase *ret_val = 0;" << be_nl - << "ACE_NEW_THROW_EX (" << be_idt << be_idt_nl - << "ret_val," << be_nl - << "OBV_" << node->full_name () << "," << be_nl - << "::CORBA::NO_MEMORY ()" << be_uidt_nl - << ");" << be_uidt_nl - << "return ret_val;" - << be_uidt_nl << "}"; - - if (node->supports_abstract ()) - { - *os << be_nl << be_nl - << "::CORBA::AbstractBase_ptr" << be_nl - << fname << "::create_for_unmarshal_abstract (" - << (be_global->use_raw_throw () - ? "void" - : "ACE_ENV_SINGLE_ARG_DECL") - << ")" << be_nl - << "{" << be_idt_nl - << "::CORBA::AbstractBase *ret_val = 0;" << be_nl - << "ACE_NEW_THROW_EX (" << be_idt << be_idt_nl - << "ret_val," << be_nl - << "OBV_" << node->full_name () << "," << be_nl - << "::CORBA::NO_MEMORY ()" << be_uidt_nl - << ");" << be_uidt_nl - << "return ret_val;" - << be_uidt_nl << "}"; - } - } - - return 0; -} - -int -be_visitor_valuetype_init_cs::visit_eventtype (be_eventtype *node) -{ - return this->visit_valuetype (node); -} - 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 deleted file mode 100644 index 3a04f825b06..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ch.cpp +++ /dev/null @@ -1,313 +0,0 @@ - -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// valuetype_obv__ch.cpp -// -// = DESCRIPTION -// Visitor generating code for Valuetypes in the client header -// OBV_ class -// (see C++ mapping OMG 20.17) -// -// = AUTHOR -// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>, -// based on interface_ch.cpp from Aniruddha Gokhale -// -// ============================================================================ - -ACE_RCSID (be_visitor_valuetype, - valuetype_obv_ch, - "$Id$") - -// ****************************************************** -// Valuetype visitor for client header -// ****************************************************** - -be_visitor_valuetype_obv_ch::be_visitor_valuetype_obv_ch ( - be_visitor_context *ctx - ) - : be_visitor_valuetype (ctx) -{ -} - -be_visitor_valuetype_obv_ch::~be_visitor_valuetype_obv_ch (void) -{ -} - - -// OBV_ class must be in OBV_ namespace. -int -be_visitor_valuetype_obv_ch::visit_valuetype (be_valuetype *node) -{ - // Only visit non-abstract non-imported valuetype. - if (node->is_abstract () || node->imported ()) - { - return 0; - } - - TAO_OutStream *os = this->ctx_->stream (); - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ ; - - // OBV_ class maps only to a typedef if we are optimizing accessors. - if (node->opt_accessor ()) - { - *os << be_nl << be_nl << "typedef " << node->full_name () << " "; - - if (!node->is_nested ()) - { - *os << "OBV_"; - } - - *os << node->local_name () << ";" << be_nl; - } - else - { - // STEP 1: Generate the class name and the class name we inherit. - os->gen_ifdef_macro (node->flat_name (), "_OBV"); - - *os << be_nl << be_nl << "// OBV_ class" << be_nl; - *os << "class " << be_global->stub_export_macro() << " ";; - - if (!node->is_nested()) - { - *os << "OBV_"; - } - - *os << node->local_name () << be_idt_nl - << ": public virtual " - << node->full_name (); - - // STEP 1a (about which previous implementer forgot ): - // Generate inheritance from corresponding OBV_ classes. - -//------>>> - - // Here we need to be careful. There are few cases to consider: - // - // (1) We have VT with concrete factory and no inhereted VT with - // concrete factory then we need to mix-in RefCounter - // - // (2) We have VT with concerete factory and inheretence from - // another (not abstract or empty abstract <would like to - // know how to go there>) then its OBV_ already has mix-in - // - // (3) We have VT that supports an abstract interface. In this case, - // we will add implementations of _add_ref and _remove_ref that - // call this->DefaultValueRefCountBase and so it must be mixed in - // - // (4) The rest. Don't need to bother about anything, just inherit - // whatever there is. - // - - int i = 0; - AST_Interface *inherited = 0; - - for (; i < node->n_inherits (); ++i) - { - inherited = node->inherits ()[i]; - - // We need only concrete valuetypes. - if (inherited->is_abstract ()) - { - continue; - } - - *os << "," << be_nl; - - // dump the scoped name. - *os << " public virtual OBV_"; - *os << inherited->full_name(); - } // end of for loop - - if (this->obv_need_ref_counter (node)) - { - *os << "," << be_nl; - - // dump the scoped name. - *os << " public virtual ::CORBA::DefaultValueRefCountBase"; - } - - *os << be_uidt_nl; - -//------>>> - - // STEP 2: Generate the body == - - *os << "{"; - - // Generate code for the OBV_ class definition. - if (this->visit_valuetype_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_obv_ch::" - "visit_valuetype - " - "codegen for scope failed\n"), - -1); - } - - // If we inherit from CORBA::Object and/or CORBA::AbstractBase - // (in addition to CORBA::ValueBase) we have to add these - // to avoid ambiguity. - if (node->n_supports () > 0) - { - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ ; - - *os << be_nl << be_nl << "virtual void _add_ref (void);" << be_nl; - *os << "virtual void _remove_ref (void);"; - } - - if (node->have_operation ()) - { - this->begin_private (); - } - else - { - this->begin_public (); - } - - *os << be_nl; - - // Default constructor. - if (! node->is_nested ()) - { - *os << "OBV_"; - } - - *os << node->local_name () << " (void);"; - - // Initializing constructor. - if (node->has_member ()) - { - *os << be_nl; - - if (! node->is_nested ()) - { - *os << "OBV_"; - } - - *os << node->local_name () << " (" << be_idt << be_idt; - - unsigned long index = 0; - this->gen_obv_init_constructor_args (node, index); - - *os << be_uidt_nl - << ");" << be_uidt; - } - - // Virtual destructor. - *os << be_nl << "virtual ~"; - - if (! node->is_nested ()) - { - *os << "OBV_"; - } - - *os << node->local_name () << " (void);"; - - // Map fields to private data. - if (!node->opt_accessor ()) - { - *os << be_nl << be_uidt_nl << "protected:" << be_idt_nl; - - *os << "virtual ::CORBA::Boolean" << be_nl - << "_tao_marshal__" << node->flat_name () - << " (TAO_OutputCDR &, TAO_ChunkInfo &) const;" << be_nl << be_nl; - - *os << "virtual ::CORBA::Boolean" << be_nl - << "_tao_unmarshal__" << node->flat_name () - << " (TAO_InputCDR &, TAO_ChunkInfo &);" << be_nl << be_nl; - - *os << "::CORBA::Boolean " - << "_tao_marshal_state (TAO_OutputCDR &, TAO_ChunkInfo &) const;" - << be_nl - << "::CORBA::Boolean " - << "_tao_unmarshal_state (TAO_InputCDR &, TAO_ChunkInfo &);" - << be_nl - << "virtual void " - << "truncation_hook (void);" - << be_uidt_nl << be_nl; - - *os << "private:" << be_idt; - - this->gen_pd (node); - } - - *os << be_nl - << "CORBA::Boolean require_truncation_;" << be_uidt_nl - << "};"; - - os->gen_endif (); - } - - return 0; -} - -int -be_visitor_valuetype_obv_ch::visit_eventtype (be_eventtype *node) -{ - return this->visit_valuetype (node); -} - -int -be_visitor_valuetype_obv_ch::visit_field (be_field *node) -{ - be_valuetype *vt = be_valuetype::narrow_from_scope (node->defined_in ()); - - if (!vt) - { - return -1; - } - - // Only in OBV_ class, if we are not optimizing accessors (and modifiers). - if (!vt->opt_accessor ()) - { - be_visitor_context ctx (*this->ctx_); - be_visitor_valuetype_field_ch visitor (&ctx); - - visitor.setenclosings ("virtual ",";"); - - if (node->accept (&visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_obv_ch::" - "visit_field - codegen failed\n"), - -1); - } - } - - return 0; -} - -void -be_visitor_valuetype_obv_ch::begin_public (void) -{ - AST_Decl::NodeType nt = this->ctx_->node ()->node_type (); - - // These types are skipped in the OBV class. - if (nt == AST_Decl::NT_attr || nt == AST_Decl::NT_op) - { - return; - } - - TAO_OutStream *os = this->ctx_->stream (); - *os << be_uidt_nl << be_nl - << "public:" << be_idt; -} - -void -be_visitor_valuetype_obv_ch::begin_private (void) -{ - TAO_OutStream *os = this->ctx_->stream (); - *os << be_uidt_nl << be_nl - << "protected:" << be_idt; -} diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ci.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ci.cpp deleted file mode 100644 index 66750c54136..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ci.cpp +++ /dev/null @@ -1,103 +0,0 @@ - -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// valuetype_obv_ci.cpp -// -// = DESCRIPTION -// Visitor generating code for Valuetypes -// OBV_ class implementation -// (see C++ mapping OMG 20.17) -// -// = AUTHOR -// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>, -// based on interface_ch.cpp from Aniruddha Gokhale -// -// ============================================================================ - -ACE_RCSID (be_visitor_valuetype, - valuetype_obv_ci, - "$Id$") - -// ****************************************************** -// Valuetype visitor for OBV_ class implementation -// ****************************************************** - -be_visitor_valuetype_obv_ci::be_visitor_valuetype_obv_ci ( - be_visitor_context *ctx - ) - : be_visitor_valuetype (ctx) -{ -} - -be_visitor_valuetype_obv_ci::~be_visitor_valuetype_obv_ci (void) -{ -} - - -// OBV_ class must be in OBV_ namespace -int -be_visitor_valuetype_obv_ci::visit_valuetype (be_valuetype *node) -{ - // only visit non-abstract valuetype - if (node->is_abstract ()) - { - return 0; - } - - TAO_OutStream *os; // output stream - - os = this->ctx_->stream (); - os->indent (); - - // OBV_ class is only a typedef if we are optimizing accessors - if (node->opt_accessor ()) - { - } - else - { - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_obv_cs::" - "visit_valuetype - " - "visit_scope failed\n" - ), -1); - } - } // if !opt_accessor () - - return 0; -} - -int -be_visitor_valuetype_obv_ci::visit_eventtype (be_eventtype *node) -{ - return this->visit_valuetype (node); -} - -int -be_visitor_valuetype_obv_ci::visit_field (be_field *node) -{ - be_visitor_context new_ctx (*this->ctx_); - be_visitor_valuetype_field_ci visitor (&new_ctx); - - visitor.in_obv_space_ = 1; - - if (visitor.visit_field (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_obv_ci::" - "visit_field - " - "visit_field failed\n"), - -1); - } - - return 0; -} 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 deleted file mode 100644 index b5123ed6be4..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_cs.cpp +++ /dev/null @@ -1,257 +0,0 @@ - -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// valuetype_obv_cs.cpp -// -// = DESCRIPTION -// Visitor generating code for Valuetypes -// OBV_ class implementation -// (see C++ mapping OMG 20.17) -// -// = AUTHOR -// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de>, -// derived from interface_ch.cpp from Aniruddha Gokhale -// -// ============================================================================ - -ACE_RCSID (be_visitor_valuetype, - valuetype_obv_cs, - "$Id$") - -// ****************************************************** -// Valuetype visitor for OBV_ class implementation -// ****************************************************** - -be_visitor_valuetype_obv_cs::be_visitor_valuetype_obv_cs ( - be_visitor_context *ctx - ) - : be_visitor_valuetype (ctx) -{ -} - -be_visitor_valuetype_obv_cs::~be_visitor_valuetype_obv_cs (void) -{ -} - - -// OBV_ class must be in OBV_ namespace -int -be_visitor_valuetype_obv_cs::visit_valuetype (be_valuetype *node) -{ - // only visit non-abstract non-imported valuetype - if (node->is_abstract () || node->imported ()) - { - return 0; - } - - TAO_OutStream *os = this->ctx_->stream (); - - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - // Default constructor. - *os << node->full_obv_skel_name () << "::"; - - if (! node->is_nested ()) - { - *os << "OBV_"; - } - - *os << node->local_name () << " (void)" << be_nl; - *os << ": require_truncation_ (false)" << be_nl - << "{}" << be_nl << be_nl; - - // Initializing constructor. - if (node->has_member ()) - { - *os << node->full_obv_skel_name () << "::"; - - if (! node->is_nested ()) - { - *os << "OBV_"; - } - - *os << node->local_name () << " (" << be_idt << be_idt; - - unsigned long index = 0; - this->gen_obv_init_constructor_args (node, index); - - *os << be_uidt_nl - << ")" << be_uidt << be_uidt_nl - << ": require_truncation_ (false)" << be_nl - << "{" << be_idt; - - this->gen_obv_init_constructor_inits (node); - - *os << be_uidt_nl - << "}" << be_nl << be_nl; - } - - // Destructor. - *os << node->full_obv_skel_name () << "::~"; - - if (! node->is_nested ()) - { - *os << "OBV_"; - } - - *os << node->local_name () << " (void)" << be_nl - << "{}"; - - - // OBV_ class has no accessors or modifiers if we are optimizing - // or the valuetype is abstract. - if (!node->opt_accessor ()) - { - *os << be_nl << be_nl << "::CORBA::Boolean" << be_nl - << node->full_obv_skel_name () - << "::_tao_marshal__" << node->flat_name () - << " (TAO_OutputCDR &strm, TAO_ChunkInfo& ci) const" << be_nl - << "{" << be_idt_nl - << "return _tao_marshal_state (strm, ci);" << be_uidt_nl - << "}" << be_nl << be_nl; - - *os << "::CORBA::Boolean" << be_nl - << node->full_obv_skel_name () - << "::_tao_unmarshal__" << node->flat_name () - << " (TAO_InputCDR &strm, TAO_ChunkInfo& ci)" << be_nl - << "{" << be_idt_nl - << "return _tao_unmarshal_state (strm, ci);" << be_uidt_nl - << "}"; - - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_obv_cs::" - "visit_valuetype - " - "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 - // to avoid ambiguity. - if (node->n_supports () > 0) - { - *os << be_nl << be_nl << "void" << be_nl - << node->full_obv_skel_name () - << "::_add_ref (void)" << be_nl - << "{" << be_idt_nl - << "this->::CORBA::DefaultValueRefCountBase::_add_ref ();" - << be_uidt_nl - << "}" << be_nl; - - *os << be_nl << "void" << be_nl - << node->full_obv_skel_name () - << "::_remove_ref (void)" << be_nl - << "{" << be_idt_nl - << "this->::CORBA::DefaultValueRefCountBase::_remove_ref ();" - << be_uidt_nl - << "}"; - } - } - - return 0; -} - -int -be_visitor_valuetype_obv_cs::visit_eventtype (be_eventtype *node) -{ - return this->visit_valuetype (node); -} - -int -be_visitor_valuetype_obv_cs::visit_field (be_field *node) -{ - be_visitor_context ctx = (*this->ctx_); - be_visitor_valuetype_field_cs visitor (&ctx); - visitor.in_obv_space_ = 1; - - if (visitor.visit_field (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_obv_cs::" - "visit_field - " - "visit_field failed\n" - ), -1); - } - - return 0; -} - -void -be_visitor_valuetype_obv_cs::gen_obv_init_base_constructor_args ( - be_valuetype *node, - unsigned long &index - ) -{ - TAO_OutStream *os = this->ctx_->stream (); - AST_ValueType *parent = node->inherits_concrete (); - - // Generate for inherited members first. - if (parent != 0) - { - be_valuetype *be_parent = - be_valuetype::narrow_from_decl (parent); - this->gen_obv_init_base_constructor_args (be_parent, index); - } - - for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls); - !si.is_done (); - si.next()) - { - // be_attribute doesn't inherit from be_field (unlike the - // AST_* counterparts, so this screens attributes and operations. - be_field *f = be_field::narrow_from_decl (si.item ()); - - if (f == 0) - { - continue; - } - - *os << (index++ != 0 ? "," : "") << be_nl - << "_tao_init_" << f->local_name (); - } -} - -void -be_visitor_valuetype_obv_cs::gen_obv_init_constructor_inits ( - be_valuetype *node - ) -{ - TAO_OutStream *os = this->ctx_->stream (); - AST_ValueType *parent = node->inherits_concrete (); - - // Generate for inherited members first. - if (parent != 0) - { - be_valuetype *be_parent = be_valuetype::narrow_from_decl (parent); - this->gen_obv_init_constructor_inits (be_parent); - } - - for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls); - !si.is_done (); - si.next()) - { - be_field *f = be_field::narrow_from_decl (si.item ()); - - // be_attribute doesn't inherit from be_field (unlike the - // AST_* counterparts, so this screens attributes and operations. - if (f == 0) - { - continue; - } - - *os << be_nl - << f->local_name () << " (_tao_init_" << f->local_name () - << ");"; - } -} diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_sh.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_sh.cpp deleted file mode 100644 index c17523bf982..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_sh.cpp +++ /dev/null @@ -1,131 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// valuetype_sh.cpp -// -// = DESCRIPTION -// Visitor generating code for value types in the server header -// -// = AUTHOR -// Jeff Parsons -// -// ============================================================================ - -ACE_RCSID (be_visitor_valuetype, - valuetype_sh, - "$Id$") - - -// ************************************************************ -// Valuetype visitor for server header. -// ************************************************************ - -be_visitor_valuetype_sh::be_visitor_valuetype_sh (be_visitor_context *ctx) - : be_visitor_valuetype (ctx) -{ -} - -be_visitor_valuetype_sh::~be_visitor_valuetype_sh (void) -{ -} - -int -be_visitor_valuetype_sh::visit_valuetype (be_valuetype *node) -{ - if (node->srv_hdr_gen () || node->imported () || node->is_abstract ()) - { - return 0; - } - - AST_Interface *concrete = node->supports_concrete (); - - // We generate a skeleton class only if the valuetype supports a - // non-abstract interface. - if (concrete == 0) - { - return 0; - } - - TAO_OutStream *os = this->ctx_->stream (); - - os->indent (); - ACE_CString class_name; - - // We shall have a POA_ prefix only if we are at the topmost level. - if (!node->is_nested ()) - { - // We are outermost. - class_name += "POA_"; - class_name += node->local_name (); - } - else - { - class_name += node->local_name (); - } - - *os << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - // Generate the skeleton class name. - *os << "class " << class_name.c_str () << ";" << be_nl; - - // Generate the _ptr declaration. - *os << "typedef " << class_name.c_str () << " *" << class_name.c_str () - << "_ptr;" << be_nl; - - // Forward class declaration. - *os << "// Forward Classes Declaration" << be_nl; - - if (be_global->gen_direct_collocation ()) - { - *os << "class " << node->direct_proxy_impl_name () << ";" << be_nl; - } - - if (be_global->gen_direct_collocation ()) - { - *os << "class " << node->strategized_proxy_broker_name () - << ";" << be_nl; - } - - *os << be_nl; - - // Now generate the class definition. - *os << "class " << be_global->skel_export_macro () - << " " << class_name.c_str () << be_idt_nl << ": " << be_idt; - - *os << "public virtual " << "POA_" - << concrete->name () << ","; - - *os << be_nl << "public virtual " << "::" << node->full_name (); - - *os << be_uidt << be_uidt_nl - << "{" << be_nl - << "protected:" << be_idt_nl - << class_name.c_str () << " (void);" << be_uidt_nl << be_nl - << "public:" << be_idt_nl; - - *os << "virtual ~" << class_name.c_str () << " (void);" << be_nl << be_uidt_nl; - - // No copy constructor for locality constraint interface. - *os << "private:" << be_idt_nl - << class_name.c_str () << " (const " << class_name.c_str () - << "& rhs);" << be_uidt_nl; - - - *os << "};" << be_nl << be_nl; - - return 0; -} - -int -be_visitor_valuetype_sh::visit_eventtype (be_eventtype *node) -{ - return this->visit_valuetype (node); -} diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_si.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_si.cpp deleted file mode 100644 index 34cd0b2f248..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_si.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// valuetype_si.cpp -// -// = DESCRIPTION -// Visitor generating code for Interfaces in the server inline file -// -// = AUTHOR -// Jeff Parsons -// -// ============================================================================ - -ACE_RCSID (be_visitor_valuetype, - valuetype_si, - "$Id$") - - -// ************************************************************************ -// Valuetype visitor for server inline -// ************************************************************************ - -be_visitor_valuetype_si::be_visitor_valuetype_si (be_visitor_context *ctx) - : be_visitor_valuetype (ctx) -{ -} - -be_visitor_valuetype_si::~be_visitor_valuetype_si (void) -{ -} - -int -be_visitor_valuetype_si::visit_valuetype (be_valuetype *) -{ - // Nothing needed for now, but the visitor is here just in case. - return 0; -} - -int -be_visitor_valuetype_si::visit_eventtype (be_eventtype *node) -{ - return this->visit_valuetype (node); -} - diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ss.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ss.cpp deleted file mode 100644 index 65c98639643..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ss.cpp +++ /dev/null @@ -1,159 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// valuetype_ss.cpp -// -// = DESCRIPTION -// Visitor generating code for Interfaces in the server skeletons file. -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#include "nr_extern.h" - -ACE_RCSID (be_visitor_valuetype, - valuetype_ss, - "$Id$") - - -// ************************************************************ -// Interface visitor for server skeletons. -// ************************************************************ - -be_visitor_valuetype_ss::be_visitor_valuetype_ss (be_visitor_context *ctx) - : be_visitor_valuetype (ctx) -{ -} - -be_visitor_valuetype_ss::~be_visitor_valuetype_ss (void) -{ -} - -int -be_visitor_valuetype_ss::visit_valuetype (be_valuetype *node) -{ - if (node->srv_skel_gen () || node->imported () || node->is_abstract ()) - { - return 0; - } - - AST_Interface *concrete = node->supports_concrete (); - - // We generate a skeleton class only if the valuetype supports a - // non-abstract interface. - if (concrete == 0) - { - return 0; - } - - // Generate the normal skeleton as usual. - - TAO_OutStream *os = this->ctx_->stream (); - - os->indent (); - - ACE_CString full_skel_name_holder = - this->generate_full_skel_name (node); - - const char *full_skel_name = full_skel_name_holder.c_str (); - - ACE_CString flat_name_holder = - this->generate_flat_name (node); - - *os << be_nl << "// TAO_IDL - Generated from " << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - // Find if we are at the top scope or inside some module, - // pre-compute the prefix that must be added to the local name in - // each case. - const char *local_name_prefix = ""; - - if (!node->is_nested ()) - { - local_name_prefix = "POA_"; - } - - ACE_CString node_local_name_holder = - this->generate_local_name (node); - - const char *node_local_name = node_local_name_holder.c_str (); - - *os << full_skel_name << "::" - << local_name_prefix << node_local_name - << " (void)" << be_nl - << "{}" << be_nl << be_nl; - -// @@@ (JP) I'm commenting out the copy constructor for now. The -// declaration in the skeleton header file has been made private. These -// valuetypes (only if a concrete interface is supported) inherit -// from the stub-side valuetype, which has a private umimplemented -// copy constructor. This makes it impossible to call all the base -// class copy constructors, which some compilers require. If there -// is no fallout from this change, this code will be removed, if -// there is a problem, we'll have to reevaluate the approach. -/* - *os << full_skel_name << "::" - << local_name_prefix << node_local_name << " (" - << "const " << local_name_prefix << node_local_name << "& rhs)"; - - *os << be_idt_nl - << ": TAO_Abstract_ServantBase (rhs)," << be_nl - << " TAO_ServantBase (rhs)," << be_idt_nl; - - if (concrete->is_nested ()) - { - AST_Decl *scope = ScopeAsDecl (concrete->defined_in ()); - - *os << "POA_" << scope->name () << "::" - << concrete->local_name () << " (rhs)," << be_nl; - } - else - { - be_interface *bd = be_interface::narrow_from_decl (concrete); - *os << bd->full_skel_name () << " (rhs)," << be_nl; - } - - *os << "ValueBase (rhs)" << be_uidt << be_uidt_nl - << "{}" << be_nl << be_nl; -*/ - - *os << full_skel_name << "::~" - << local_name_prefix << node_local_name - << " (void)" << be_nl - << "{}"; - - return 0; -} - -int -be_visitor_valuetype_ss::visit_eventtype (be_eventtype *node) -{ - return this->visit_valuetype (node); -} - -ACE_CString -be_visitor_valuetype_ss::generate_flat_name (be_valuetype *node) -{ - return ACE_CString (node->flat_name ()); -} - -ACE_CString -be_visitor_valuetype_ss::generate_local_name (be_valuetype *node) -{ - return ACE_CString (node->local_name ()); -} - -ACE_CString -be_visitor_valuetype_ss::generate_full_skel_name (be_valuetype *node) -{ - return ACE_CString (node->full_skel_name ()); -} |