diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2010-03-02 23:23:26 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2010-03-02 23:23:26 +0000 |
commit | 86a16366f0f72abf1103dc69cf8125b8c00e49c2 (patch) | |
tree | 2287a3aef77767ff23d74b65624adca651aea878 | |
parent | 4f527a67ac5ffb33d5b9e093a366c286be94a066 (diff) | |
download | ATCD-86a16366f0f72abf1103dc69cf8125b8c00e49c2.tar.gz |
ChangeLogTag: Tue Mar 2 23:18:32 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu>
25 files changed, 683 insertions, 535 deletions
diff --git a/modules/TAO/ChangeLog b/modules/TAO/ChangeLog index bea29040548..b2be2e0aa20 100644 --- a/modules/TAO/ChangeLog +++ b/modules/TAO/ChangeLog @@ -1,3 +1,38 @@ +Tue Mar 2 23:18:32 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu> + + * tests/Param_Test/param_test_i.cpp: + * tests/Param_Test/Param_Test.mpc: + * tests/Param_Test/param_testC.cpp: + * tests/Param_Test/param_testS.cpp: + * tests/Param_Test/param_testC.h: + * tests/Param_Test/param_testS.h: + * tests/Param_Test/param_test_i.h: + * TAO_IDL/be/be_visitor_argument/arglist.cpp: + * TAO_IDL/be/be_codegen.cpp: + * TAO_IDL/be/be_visitor_sequence/any_op_ch.cpp: + * TAO_IDL/be/be_visitor_sequence/cdr_op_ch.cpp: + * TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp: + * TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp: + * TAO_IDL/be/be_visitor_root/cdr_op.cpp: + * TAO_IDL/be/be_visitor_root/any_op.cpp: + * TAO_IDL/be/be_visitor_argument.cpp: + * TAO_IDL/be/be_global.cpp: + * TAO_IDL/be_include/be_global.h: + * tao/AnyTypeCode/Any.h: + * tao/AnyTypeCode/Any.cpp: + * tao/CDR.inl + * tao/Array_VarOut_T.h: + * tao/CDR.h: + + Progress toward generation of code for alternate mapping + in the general case. + + * tao/Vector_CDR_T.h: + + New file containing template methods for (de)marshaling + std::vector<T>. Includes a general case and special + cases for interfaces and arrays. + Tue Feb 23 17:06:19 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu> * TAO_IDL/be/be_visitor_arg_traits.cpp: diff --git a/modules/TAO/TAO_IDL/be/be_codegen.cpp b/modules/TAO/TAO_IDL/be/be_codegen.cpp index ddde5064627..060a99f8caa 100644 --- a/modules/TAO/TAO_IDL/be/be_codegen.cpp +++ b/modules/TAO/TAO_IDL/be/be_codegen.cpp @@ -272,7 +272,7 @@ TAO_CodeGen::start_client_header (const char *fname) } else { - *this->client_header_ << "#include <string>"; + *this->client_header_ << "\n#include <string>"; *this->client_header_ << "\n#include <vector>\n"; this->gen_stub_hdr_includes (); diff --git a/modules/TAO/TAO_IDL/be/be_global.cpp b/modules/TAO/TAO_IDL/be/be_global.cpp index cf9999542a1..dde78ddc05f 100644 --- a/modules/TAO/TAO_IDL/be/be_global.cpp +++ b/modules/TAO/TAO_IDL/be/be_global.cpp @@ -134,7 +134,8 @@ BE_GlobalData::BE_GlobalData (void) gen_skel_export_hdr_file_ (false), gen_svnt_export_hdr_file_ (false), gen_exec_export_hdr_file_ (false), - gen_lem_force_all_ (false) + gen_lem_force_all_ (false), + alt_mapping_ (false) { } @@ -2104,6 +2105,18 @@ BE_GlobalData::gen_lem_force_all (bool val) this->gen_lem_force_all_ = val; } +bool +BE_GlobalData::alt_mapping (void) const +{ + return this->alt_mapping_; +} + +void +BE_GlobalData::alt_mapping (bool val) +{ + this->alt_mapping_ = val; +} + ACE_CString BE_GlobalData::spawn_options (void) { diff --git a/modules/TAO/TAO_IDL/be/be_visitor_argument.cpp b/modules/TAO/TAO_IDL/be/be_visitor_argument.cpp index 1024f14f6bd..168f926c22b 100644 --- a/modules/TAO/TAO_IDL/be/be_visitor_argument.cpp +++ b/modules/TAO/TAO_IDL/be/be_visitor_argument.cpp @@ -43,8 +43,12 @@ #include "be_home.h" #include "be_operation.h" #include "be_helper.h" +#include "be_extern.h" + #include "utl_identifier.h" + #include "nr_extern.h" + #include "ace/Log_Msg.h" #include "be_visitor_argument/arglist.cpp" diff --git a/modules/TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp b/modules/TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp index 7d3c42f91d5..b066a5ad80a 100644 --- a/modules/TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp +++ b/modules/TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp @@ -297,17 +297,33 @@ int be_visitor_args_arglist::visit_sequence (be_sequence *node) TAO_OutStream *os = this->ctx_->stream (); - switch (this->direction ()) + if (be_global->alt_mapping ()) { - case AST_Argument::dir_IN: - *os << "const " << this->type_name (node) << " &"; - break; - case AST_Argument::dir_INOUT: - *os << this->type_name (node) << " &"; - break; - case AST_Argument::dir_OUT: - *os << this->type_name (node, "_out"); - break; + switch (this->direction ()) + { + case AST_Argument::dir_IN: + *os << "const std::vector<" << this->type_name (node) << "> &"; + break; + case AST_Argument::dir_INOUT: + case AST_Argument::dir_OUT: + *os << "std::vector<" << this->type_name (node) << "> &"; + break; + } + } + else + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + *os << "const " << this->type_name (node) << " &"; + break; + case AST_Argument::dir_INOUT: + *os << this->type_name (node) << " &"; + break; + case AST_Argument::dir_OUT: + *os << this->type_name (node, "_out"); + break; + } } return 0; @@ -409,13 +425,6 @@ int be_visitor_args_arglist::visit_union (be_union *node) int be_visitor_args_arglist::visit_typedef (be_typedef *node) { - if (ACE_OS::strcmp (node->full_name (), "CORBA::LongSeq") == 0) - { - *this->ctx_->stream () << "Param_Test::UB_Long_Seq &"; - - return 0; - } - this->ctx_->alias (node); if (node->primitive_base_type ()->accept (this) == -1) diff --git a/modules/TAO/TAO_IDL/be/be_visitor_root/any_op.cpp b/modules/TAO/TAO_IDL/be/be_visitor_root/any_op.cpp index cc81d7719c3..6017d332735 100644 --- a/modules/TAO/TAO_IDL/be/be_visitor_root/any_op.cpp +++ b/modules/TAO/TAO_IDL/be/be_visitor_root/any_op.cpp @@ -65,73 +65,5 @@ be_visitor_root_any_op::visit_root (be_root *node) -1); } - TAO_OutStream *os = this->ctx_->stream (); - TAO_CodeGen::CG_STATE cg_state = this->ctx_->state (); - - if (cg_state == TAO_CodeGen::TAO_ROOT_ANY_OP_CH) - { - *os << be_nl << be_nl - << "TAO_BEGIN_VERSIONED_NAMESPACE_DECL"; - - *os << be_nl << be_nl - << "void operator<<= ( ::CORBA::Any &, const std::string);" - << be_nl - << "::CORBA::Boolean operator>>= (const ::CORBA::Any &, std::string &);" - << be_nl << be_nl - << "TAO_END_VERSIONED_NAMESPACE_DECL" << be_nl << be_nl - << "TAO_BEGIN_VERSIONED_NAMESPACE_DECL" - << be_nl << be_nl - << "void operator<<= ( ::CORBA::Any &, const Param_Test::UB_Long_Seq);" - << be_nl - << "::CORBA::Boolean operator>>= (const ::CORBA::Any &, Param_Test::UB_Long_Seq &);"; - - *os << be_nl << be_nl - << "TAO_END_VERSIONED_NAMESPACE_DECL"; - } - else if (cg_state == TAO_CodeGen::TAO_ROOT_ANY_OP_CS) - { - *os << be_nl << be_nl - << "TAO_BEGIN_VERSIONED_NAMESPACE_DECL"; - - *os << be_nl << be_nl - << "void operator<<= (" << be_idt_nl - << "::CORBA::Any &," << be_nl - << "const std::string)" << be_uidt_nl - << "{" << be_nl - << "}"; - - *os << be_nl << be_nl - << "::CORBA::Boolean operator>>= (" << be_idt_nl - << "const ::CORBA::Any &," << be_nl - << "std::string &)" << be_uidt_nl - << "{" << be_idt_nl - << "return true;" << be_uidt_nl - << "}"; - - *os << be_nl << be_nl - << "TAO_END_VERSIONED_NAMESPACE_DECL"; - - *os << be_nl << be_nl - << "TAO_BEGIN_VERSIONED_NAMESPACE_DECL"; - - *os << be_nl << be_nl - << "void operator<<= (" << be_idt_nl - << "::CORBA::Any &," << be_nl - << "const Param_Test::UB_Long_Seq)" << be_uidt_nl - << "{" << be_nl - << "}"; - - *os << be_nl << be_nl - << "::CORBA::Boolean operator>>= (" << be_idt_nl - << "const ::CORBA::Any &," << be_nl - << "Param_Test::UB_Long_Seq &)" << be_uidt_nl - << "{" << be_idt_nl - << "return true;" << be_uidt_nl - << "}"; - - *os << be_nl << be_nl - << "TAO_END_VERSIONED_NAMESPACE_DECL"; - } - return 0; } diff --git a/modules/TAO/TAO_IDL/be/be_visitor_root/cdr_op.cpp b/modules/TAO/TAO_IDL/be/be_visitor_root/cdr_op.cpp index f5ff95d4b41..24bee065237 100644 --- a/modules/TAO/TAO_IDL/be/be_visitor_root/cdr_op.cpp +++ b/modules/TAO/TAO_IDL/be/be_visitor_root/cdr_op.cpp @@ -48,97 +48,5 @@ be_visitor_root_cdr_op::visit_root (be_root *node) -1); } - TAO_OutStream *os = this->ctx_->stream (); - TAO_CodeGen::CG_STATE cg_state = this->ctx_->state (); - - if (cg_state == TAO_CodeGen::TAO_ROOT_CDR_OP_CH) - { - *os << be_nl << be_nl - << "TAO_BEGIN_VERSIONED_NAMESPACE_DECL" - << be_nl << be_nl - << "::CORBA::Boolean operator<< (TAO_OutputCDR &strm, const std::string &_tao_string);" - << be_nl - << "::CORBA::Boolean operator>> (TAO_InputCDR &strm, std::string &_tao_string);"; - - *os << be_nl << be_nl - << "TAO_END_VERSIONED_NAMESPACE_DECL"; - - *os << be_nl << be_nl - << "TAO_BEGIN_VERSIONED_NAMESPACE_DECL"; - - *os << be_nl << be_nl - << "::CORBA::Boolean operator<< (TAO_OutputCDR &strm, const Param_Test::UB_Long_Seq &_tao_vector);" - << be_nl - << "::CORBA::Boolean operator>> (TAO_InputCDR &strm, Param_Test::UB_Long_Seq &_tao_vector);"; - - *os << be_nl << be_nl - << "TAO_END_VERSIONED_NAMESPACE_DECL"; - } - else if (cg_state == TAO_CodeGen::TAO_ROOT_CDR_OP_CS) - { - *os << be_nl << be_nl - << "TAO_BEGIN_VERSIONED_NAMESPACE_DECL"; - - *os << be_nl << be_nl - << "::CORBA::Boolean operator<< (" << be_idt_nl - << "TAO_OutputCDR &strm," << be_nl - << "const std::string &_tao_string)" << be_uidt_nl - << "{" << be_idt_nl - << "return strm << _tao_string.c_str ();" << be_uidt_nl - << "}" << be_nl << be_nl - << "::CORBA::Boolean operator>> (" << be_idt_nl - << "TAO_InputCDR &strm," << be_nl - << "std::string &_tao_string)" << be_uidt_nl - << "{" << be_idt_nl - << "char *buf = 0;" << be_nl - << "strm >> buf;" << be_nl - << "_tao_string.assign (buf);" << be_nl - << "ACE::strdelete (buf);" << be_nl - << "return true;" << be_uidt_nl - << "}"; - - *os << be_nl << be_nl - << "TAO_END_VERSIONED_NAMESPACE_DECL"; - - *os << be_nl << be_nl - << "TAO_BEGIN_VERSIONED_NAMESPACE_DECL"; - - *os << be_nl << be_nl - << "::CORBA::Boolean operator<< (" << be_idt_nl - << "TAO_OutputCDR &strm," << be_nl - << "const Param_Test::UB_Long_Seq &_tao_vector)" - << be_uidt_nl - << "{" << be_idt_nl - << "::CORBA::ULong length = _tao_vector.size ();" - << be_nl - << "strm << length;" << be_nl << be_nl - << "for ( ::CORBA::ULong i = 0UL; i < length; ++i)" - << be_idt_nl - << "{" << be_idt_nl - << "strm << _tao_vector[i];" << be_uidt_nl - << "}" << be_uidt_nl << be_nl - << "return true;" << be_uidt_nl - << "}"; - - *os << be_nl << be_nl - << "::CORBA::Boolean operator>> (" << be_idt_nl - << "TAO_InputCDR &strm," << be_nl - << "Param_Test::UB_Long_Seq &_tao_vector)" << be_uidt_nl - << "{" << be_idt_nl - << "::CORBA::ULong length = 0UL;" << be_nl - << "::CORBA::ULong tmp = 0UL;" << be_nl << be_nl - << "for ( ::CORBA::ULong i = 0UL; i < length; ++i)" - << be_idt_nl - << "{" << be_idt_nl - << "strm >> tmp;" << be_nl - << "_tao_vector[i] = tmp;" << be_uidt_nl - << "}" << be_uidt_nl << be_nl - << "return true;" << be_uidt_nl - << "}"; - - *os << be_nl << be_nl - << "TAO_BEGIN_VERSIONED_NAMESPACE_DECL"; - } - return 0; } diff --git a/modules/TAO/TAO_IDL/be/be_visitor_sequence/any_op_ch.cpp b/modules/TAO/TAO_IDL/be/be_visitor_sequence/any_op_ch.cpp index 9195f4c7d3e..b1b74da85cf 100644 --- a/modules/TAO/TAO_IDL/be/be_visitor_sequence/any_op_ch.cpp +++ b/modules/TAO/TAO_IDL/be/be_visitor_sequence/any_op_ch.cpp @@ -52,32 +52,51 @@ be_visitor_sequence_any_op_ch::visit_sequence (be_sequence *node) *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; + ACE_CString name; + + if (be_global->alt_mapping ()) + { + be_type *bt = + be_type::narrow_from_decl (node->base_type ()); + + name = "std::vector<"; + name += bt->full_name (); + name += ">"; + } + else + { + name = node->full_name (); + } + *os << be_global->core_versioning_begin () << be_nl; // Generate the Any <<= and >>= operators. - *os << macro; - *os << " void" - << " operator<<= ( ::CORBA::Any &, const "; - *os << node->name (); - *os << " &); // copying version" << be_nl; - *os << macro; - *os << " void" - << " operator<<= ( ::CORBA::Any &, "; - *os << node->name (); - *os << "*); // noncopying version" << be_nl; - *os << macro; - *os << " ::CORBA::Boolean" - << " operator>>= (const ::CORBA::Any &, "; - *os << node->name (); - *os << " *&); // deprecated" << be_nl; - *os << macro; - *os << " ::CORBA::Boolean" - << " operator>>= (const ::CORBA::Any &, const "; - *os << node->name (); - *os << " *&);"; + *os << macro + << " void" + << " operator<<= ( ::CORBA::Any &, const " + << name.c_str () + << " &); // copying version" << be_nl; + + *os << macro + << " void" + << " operator<<= ( ::CORBA::Any &, " + << name.c_str () + << "*); // noncopying version" << be_nl; + + *os << macro + << " ::CORBA::Boolean" + << " operator>>= (const ::CORBA::Any &, " + << name.c_str () + << " *&); // deprecated" << be_nl; + + *os << macro + << " ::CORBA::Boolean" + << " operator>>= (const ::CORBA::Any &, const " + << name.c_str () + << " *&);"; *os << be_global->core_versioning_end () << be_nl; - node->cli_hdr_any_op_gen (1); + node->cli_hdr_any_op_gen (true); return 0; } diff --git a/modules/TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp b/modules/TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp index 217120aeb16..0dd2aa5aa3d 100644 --- a/modules/TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp +++ b/modules/TAO/TAO_IDL/be/be_visitor_sequence/any_op_cs.cpp @@ -55,6 +55,35 @@ be_visitor_sequence_any_op_cs::visit_sequence (be_sequence *node) *os << be_global->core_versioning_begin () << be_nl; + // These are no-ops for now, so we just generate them and return + if (be_global->alt_mapping ()) + { + be_type *bt = + be_type::narrow_from_decl (node->base_type ()); + + *os << be_nl + << "void operator<<= (" << be_idt_nl + << "::CORBA::Any &," << be_nl + << "const std::vector<" << bt->full_name () + << ">" << be_uidt_nl + << "{" << be_nl + << "}"; + + *os << be_nl << be_nl + << "::CORBA::Boolean operator>>= (" << be_idt_nl + << "const ::CORBA::Any &," << be_nl + << "std::vector<" << bt->full_name () + << ">" << be_uidt_nl + << "{" << be_idt_nl + << "return true;" << be_uidt_nl + << "}"; + + *os << be_global->core_versioning_end () << be_nl; + + node->cli_stub_any_op_gen (true); + return 0; + } + // Since we don't generate CDR stream operators for types that // explicitly contain a local interface (at some level), we // must override these Any template class methods to avoid @@ -89,7 +118,8 @@ be_visitor_sequence_any_op_cs::visit_sequence (be_sequence *node) be_typedef *td = this->ctx_->tdef (); // Copying insertion. - *os << be_nl << "// Copying insertion." << be_nl + *os << be_nl + << "// Copying insertion." << be_nl << "void operator<<= (" << be_idt << be_idt_nl << "::CORBA::Any &_tao_any," << be_nl << "const " << node->name () << " &_tao_elem" << be_uidt_nl @@ -159,6 +189,6 @@ be_visitor_sequence_any_op_cs::visit_sequence (be_sequence *node) *os << be_global->core_versioning_end () << be_nl; - node->cli_stub_any_op_gen (1); + node->cli_stub_any_op_gen (true); return 0; } diff --git a/modules/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ch.cpp b/modules/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ch.cpp index ee680e0aad6..bc63444ec1c 100644 --- a/modules/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ch.cpp +++ b/modules/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ch.cpp @@ -78,6 +78,8 @@ be_visitor_sequence_cdr_op_ch::visit_sequence (be_sequence *node) << node->flat_name () << "_H_" << "\n#define _TAO_CDR_OP_" << node->flat_name () << "_H_"; } + + bool alt = be_global->alt_mapping (); *os << be_global->core_versioning_begin () << be_nl; @@ -85,12 +87,34 @@ be_visitor_sequence_cdr_op_ch::visit_sequence (be_sequence *node) << be_global->stub_export_macro () << " ::CORBA::Boolean" << " operator<< (" << be_idt << be_idt_nl << "TAO_OutputCDR &strm," << be_nl - << "const " << node->name () << " &_tao_sequence" << be_uidt_nl + << "const "; + + if (alt) + { + *os << "std::vector<" << base_type->name () << ">"; + } + else + { + *os << node->name (); + } + + *os << " &_tao_sequence" << be_uidt_nl << ");" << be_uidt_nl; + *os << be_global->stub_export_macro () << " ::CORBA::Boolean" << " operator>> (" << be_idt << be_idt_nl - << "TAO_InputCDR &strm," << be_nl - << node->name () << " &_tao_sequence" << be_uidt_nl + << "TAO_InputCDR &strm," << be_nl; + + if (alt) + { + *os << "std::vector<" << base_type->name () << ">"; + } + else + { + *os << node->name (); + } + + *os << " &_tao_sequence" << be_uidt_nl << ");" << be_uidt; if (be_global->gen_ostream_operators ()) diff --git a/modules/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp b/modules/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp index c304ee58b14..2fc8d0f42ce 100644 --- a/modules/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp +++ b/modules/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp @@ -99,41 +99,96 @@ be_visitor_sequence_cdr_op_cs::visit_sequence (be_sequence *node) << node->flat_name () << "_CPP_" << be_nl << "#define _TAO_CDR_OP_" << node->flat_name () << "_CPP_" << be_nl; + + bool alt = be_global->alt_mapping (); *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 operator<< (" << be_idt << be_idt_nl - << "TAO_OutputCDR &strm," << be_nl - << "const " << node->name () - << " &_tao_sequence" << be_uidt_nl - << ")" << be_uidt_nl - << "{" << be_idt_nl; - - *os << "return TAO::marshal_sequence(strm, _tao_sequence);" - << be_uidt_nl; - - *os << "}" << be_nl << be_nl; + + if (alt) + { + *os << "::CORBA::Boolean operator<< (" << be_idt_nl + << "TAO_OutputCDR &strm," << be_nl + << "const std:;vector<" << bt->full_name () + << " &_tao_vector)" + << be_uidt_nl + << "{" << be_idt_nl + << "::CORBA::ULong length = _tao_vector.size ();" + << be_nl + << "strm << length;" << be_nl << be_nl + << "for ( ::CORBA::ULong i = 0UL; i < length; ++i)" + << be_idt_nl + << "{" << be_idt_nl + << "if (! strm << _tao_vector[i]" << be_idt_nl + << "{" << be_idt_nl + << "return false;" << be_uidt_nl + << "}" << be_uidt_nl + << "}" << be_uidt_nl << be_nl + << "return true;" << be_uidt_nl + << "}" << be_nl << be_nl; + } + else + { + *os << "::CORBA::Boolean operator<< (" + << be_idt << be_idt_nl + << "TAO_OutputCDR &strm," << be_nl + << "const " << node->name () << " &_tao_sequence" + << be_uidt_nl + << ")" << be_uidt_nl + << "{" << be_idt_nl + << "return TAO::marshal_sequence(strm, _tao_sequence);" + << be_uidt_nl + << "}" << be_nl << be_nl; + } // Set the sub state as generating code for the input operator. this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_INPUT); - *os << "::CORBA::Boolean operator>> (" << be_idt << be_idt_nl - << "TAO_InputCDR &strm"; - - *os << "," << be_nl - << node->name () << " &_tao_sequence"; - - *os << be_uidt_nl - << ")" << be_uidt_nl - << "{" << be_idt_nl; - - *os << "return TAO::demarshal_sequence(strm, _tao_sequence);" - << be_uidt_nl; - - *os << "}" << be_nl; + if (alt) + { + *os << "::CORBA::Boolean operator>> (" << be_idt_nl + << "TAO_InputCDR &strm," << be_nl + << "std::vector<" << bt->full_name () + << " &_tao_vector)" << be_uidt_nl + << "{" << be_idt_nl + << "::CORBA::ULong length = 0UL;" << be_nl + << bt->full_name (); + + if (bt->size_type () == AST_Type::VARIABLE) + { + *os << " *"; + } + + *os << " tmp;" << be_nl << be_nl + << "for ( ::CORBA::ULong i = 0UL; i < length; ++i)" + << be_idt_nl + << "{" << be_idt_nl + << "if (! strm >> tmp)" << be_idt_nl + << "{" << be_idt_nl + << "return false;" << be_uidt_nl + << "}" << be_uidt_nl << be_nl + << "_tao_vector[i] = tmp;" << be_uidt_nl + << "}" << be_uidt_nl << be_nl + << "return true;" << be_uidt_nl + << "}" << be_nl; + } + else + { + *os << "::CORBA::Boolean operator>> (" + << be_idt << be_idt_nl + << "TAO_InputCDR &strm" + << "," << be_nl + << node->name () + << " &_tao_sequence" + << be_uidt_nl + << ")" << be_uidt_nl + << "{" << be_idt_nl + << "return TAO::demarshal_sequence(strm, _tao_sequence);" + << be_uidt_nl + << "}" << be_nl; + } if (be_global->gen_ostream_operators ()) { diff --git a/modules/TAO/TAO_IDL/be_include/be_global.h b/modules/TAO/TAO_IDL/be_include/be_global.h index 340a13d784d..dae95fa6582 100644 --- a/modules/TAO/TAO_IDL/be_include/be_global.h +++ b/modules/TAO/TAO_IDL/be_include/be_global.h @@ -727,6 +727,9 @@ public: bool gen_lem_force_all (void) const; void gen_lem_force_all (bool val); + + bool alt_mapping (void) const; + void alt_mapping (bool val); ACE_CString spawn_options (void); // Command line passed to ACE_Process::spawn. Different @@ -1033,6 +1036,9 @@ private: bool gen_lem_force_all_; // Toggles generation of exec IDL for facets with imported // interface types (not in main IDL file). + + bool alt_mapping_; + // Are we generating STL types? }; #endif /* _BE_GLOBAL_H */ diff --git a/modules/TAO/tao/AnyTypeCode/Any.cpp b/modules/TAO/tao/AnyTypeCode/Any.cpp index bd769921aed..661b42b7a9d 100644 --- a/modules/TAO/tao/AnyTypeCode/Any.cpp +++ b/modules/TAO/tao/AnyTypeCode/Any.cpp @@ -516,6 +516,12 @@ operator<<= (CORBA::Any &any, const CORBA::WChar *ws) 0); } +ACE_INLINE void +operator <<= (CORBA::Any &any, std::string & str) +{ + any <<= str.c_str (); +} + // Extraction: these are safe and hence we have to check that the // typecode of the Any is equal to the one we are trying to extract // into. @@ -721,6 +727,16 @@ operator>>= (const CORBA::Any &any, CORBA::TypeCode_ptr &tc) ); } +CORBA::Boolean +operator >>= (const CORBA::Any &any, std::string &str) +{ + const char *buf = 0; + CORBA::Boolean flag = any >>= buf; + str.assign (buf); + ACE::strdelete (const_cast <char *> (buf)); + return flag; +} + // ================================================================ // Any_Impl_T template specializations. diff --git a/modules/TAO/tao/AnyTypeCode/Any.h b/modules/TAO/tao/AnyTypeCode/Any.h index 85184997880..2fd0723b25a 100644 --- a/modules/TAO/tao/AnyTypeCode/Any.h +++ b/modules/TAO/tao/AnyTypeCode/Any.h @@ -301,6 +301,7 @@ TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::TypeCode_ptr); TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::TypeCode_ptr *); TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, const CORBA::Object_ptr); TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::Object_ptr *); +TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, const std::string &); /// Typesafe extraction. @@ -330,6 +331,8 @@ TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &, const CORBA::Char *&); TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &, const CORBA::WChar *&); +TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &, + std::string &); TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/modules/TAO/tao/Array_VarOut_T.h b/modules/TAO/tao/Array_VarOut_T.h index b70fd19c6b6..4bbfba4fdfe 100644 --- a/modules/TAO/tao/Array_VarOut_T.h +++ b/modules/TAO/tao/Array_VarOut_T.h @@ -47,6 +47,7 @@ class TAO_Array_Forany_T public: typedef T _array_type; typedef T_slice _slice_type; + typedef TAG _tag_type; TAO_Array_Forany_T (void); TAO_Array_Forany_T (_slice_type *, CORBA::Boolean nocopy = false); diff --git a/modules/TAO/tao/CDR.h b/modules/TAO/tao/CDR.h index 5b97e998e02..a0228ac2e03 100644 --- a/modules/TAO/tao/CDR.h +++ b/modules/TAO/tao/CDR.h @@ -62,6 +62,8 @@ #include "ace/Hash_Map_Manager_T.h" #include "ace/Null_Mutex.h" +#include <string> + TAO_BEGIN_VERSIONED_NAMESPACE_DECL class TAO_ORB_Core; @@ -489,6 +491,8 @@ TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os, ACE_OutputCDR::from_string x); TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os, ACE_OutputCDR::from_wstring x); +TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &os, + const std::string &x); // CDR input operators for CORBA types @@ -518,6 +522,8 @@ TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &os, ACE_InputCDR::to_string x); TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &os, ACE_InputCDR::to_wstring x); +TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &os, + std::string &x); TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/modules/TAO/tao/CDR.inl b/modules/TAO/tao/CDR.inl index 7a4943589fc..204f247c996 100644 --- a/modules/TAO/tao/CDR.inl +++ b/modules/TAO/tao/CDR.inl @@ -455,6 +455,12 @@ ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os, return os << x.val_; } +ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os, + const std::string &x) +{ + return os << x.c_str (); +} + // **************************************************************** ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is, @@ -549,5 +555,14 @@ ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is, return marshal_flag; } +ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is, + std::string &x) +{ + char *buf = 0; + CORBA::Boolean const marshal_flag = is >> buf; + x.assign (buf); + ACE::strdelete (buf); + return marshal_flag; +} TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/modules/TAO/tao/Vector_CDR_T.h b/modules/TAO/tao/Vector_CDR_T.h new file mode 100644 index 00000000000..28a9ca98924 --- /dev/null +++ b/modules/TAO/tao/Vector_CDR_T.h @@ -0,0 +1,217 @@ +#ifndef guard_vector_cdr +#define guard_vector_cdr +/** + * @file + * + * @brief CDR (de)marshaling for std::vector + * + * $Id$ + * + * @author Jeff Parsons + */ + +#include <vector> + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ + template<typename T> + bool marshal_value_vector ( + TAO_OutputCDR &strm, + const std::vector<T> &source) + { + ::CORBA::ULong const length = source.size (); + + if (! (strm << length)) + { + return false; + } + + for (std::vector<T>::const_iterator i = source.begin (); + i != source.end (); + ++i) + { + if (! (strm << *i)) + { + return false; + } + } + + return true; + } + + template<typename T> + bool demarshal_value_vector ( + TAO_InputCDR &strm, + std::vector<T> &target) + { + ::CORBA::ULong new_length = 0; + + if (! (strm >> new_length)) + { + return false; + } + + if (new_length > strm.length ()) + { + return false; + } + + std::vector<T> tmp; + tmp.reserve (new_length); + T tmp_elem; + + for ( ::CORBA::ULong i = 0; i < new_length; ++i) + { + if (! (strm >> tmp_elem)) + { + return false; + } + + tmp[i] = tmp_elem; + } + + tmp.swap(target); + return true; + } + + template<typename T> + bool marshal_objref_vector ( + TAO_OutputCDR &strm, + const std::vector<T::_ptr_type> &source) + { + ::CORBA::ULong const length = source.size (); + + if (! (strm << length)) + { + return false; + } + + for (std::vector<T::_ptr_type>::const_iterator i = source.begin (); + i != source.end (); + ++i) + { + if (! (TAO::Objref_Traits<T>::marshal (*i, strm))) + { + return false' + } + } + + return true; + } + + template<typename T> + bool demarshal_objref_vector ( + TAO_InputCDR &strm, + std::vector<T::_ptr_type> &target) + { + ::CORBA::ULong new_length = 0; + + if (! (strm >> new_length)) + { + return false; + } + + if (new_length > strm.length ()) + { + return false; + } + + std::vector<T::_ptr_type> tmp; + tmp.reserve (new_length); + T::_ptr_type tmp_elem = T::_nil (); + + for ( ::CORBA::ULong i = 0; i < new_length; ++i) + { + if (! (strm >> tmp_elem)) + { + return false; + } + + tmp[i] = tmp_elem; + } + + tmp.swap (target); + return true; + } + + template<typename T_forany> + bool marshal_array_vector ( + TAO_OutputCDR &strm, + const std::vector<T_forany::_slice_type *> &source) + { + typedef TAO_FixedArray_Var_T <T_forany::_array_type, + T_forany::_slice_type, + T_forany::_tag_type> var_type; + ::CORBA::ULong const length = source.size (); + + if (! (strm << length)) + { + return false; + } + + for (std::vector<T_forany::_slice_type *> i = source.begin (); + i != source.end (); + ++i) + { + var_type tmp_array = + TAO::Array_Traits<T_forany>::dup (*i); + T_forany const tmp (tmp_array.inout ()); + + if (! (strm << tmp)) + { + return false; + } + } + + return true; + } + + template<typename T_forany> + bool demarshal_array_vector ( + TAO_InputCDR &strm, + const std::vector<T_forany::_slice_type *> &source) + { + typedef TAO::Array_Traits<T_forany> array_traits; + ::CORBA::ULong new_length = 0; + + if (! (strm >> new_length)) + { + return false; + } + + if (new_length > strm.length ()) + { + return false; + } + + std::vector<T_forany::_slice_type *> tmp_vec; + tmp_vec.reserve (new_length); + + for ( ::CORBA::ULong i = 0; i < new_length; ++i) + { + T_forany tmp_array (array_traits::alloc ()); + bool const _tao_marshal_flag = (strm >> tmp_array); + + if (_tao_marshal_flag) + { + array_traits::copy (tmp_vec[i], tmp_array.in ()); + } + + array_traits::free (tmp_array.inout ()); + + if (!_tao_marshal_flag) + { + return false; + } + } + + tmp_vec.swap (target); + return true; + } +} + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif // guard_vector_cdr
\ No newline at end of file diff --git a/modules/TAO/tests/Param_Test/Param_Test.mpc b/modules/TAO/tests/Param_Test/Param_Test.mpc index c80fa509cf3..41280d6076e 100644 --- a/modules/TAO/tests/Param_Test/Param_Test.mpc +++ b/modules/TAO/tests/Param_Test/Param_Test.mpc @@ -1,6 +1,14 @@ // -*- MPC -*- // $Id$ +project(*idl): taoidldefaults { + IDL_Files { + idlflags -= -Sa -St + param_test.idl + } + custom_only = 1 +} + project(*Server): taoserver, codeset, avoids_minimum_corba, avoids_corba_e_compact, avoids_corba_e_micro { after += *idl Source_Files { diff --git a/modules/TAO/tests/Param_Test/param_testC.cpp b/modules/TAO/tests/Param_Test/param_testC.cpp index 61cf0d63023..a9886583de5 100644 --- a/modules/TAO/tests/Param_Test/param_testC.cpp +++ b/modules/TAO/tests/Param_Test/param_testC.cpp @@ -27,7 +27,7 @@ **/ // TAO_IDL - Generated from -// .\be\be_codegen.cpp:375 +// .\be\be_codegen.cpp:378 #include "param_testC.h" @@ -80,34 +80,16 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace TAO { - // TAO_IDL - Generated from - // .\be\be_visitor_arg_traits.cpp:620 - -#if !defined (_CORBA_LONGSEQ__ARG_TRAITS_) -#define _CORBA_LONGSEQ__ARG_TRAITS_ - - template<> - class Arg_Traits<CORBA::LongSeq> - : public - Var_Size_Arg_Traits_T< - CORBA::LongSeq, - TAO::Any_Insert_Policy_Stream <CORBA::LongSeq> - > - { - }; - template<> class Arg_Traits<Param_Test::UB_Long_Seq> - : public - Basic_Arg_Traits_T < + : public + Basic_Arg_Traits_T< Param_Test::UB_Long_Seq, TAO::Any_Insert_Policy_Stream <Param_Test::UB_Long_Seq> > { }; - -#endif /* end #if !defined */ - + // TAO_IDL - Generated from // .\be\be_visitor_arg_traits.cpp:620 @@ -202,7 +184,7 @@ namespace TAO #endif /* end #if !defined */ // TAO_IDL - Generated from - // .\be\be_visitor_arg_traits.cpp:870 + // .\be\be_visitor_arg_traits.cpp:871 #if !defined (_COFFEE_DESC__ARG_TRAITS_) #define _COFFEE_DESC__ARG_TRAITS_ @@ -260,7 +242,7 @@ namespace TAO #endif /* end #if !defined */ // TAO_IDL - Generated from - // .\be\be_visitor_arg_traits.cpp:870 + // .\be\be_visitor_arg_traits.cpp:871 #if !defined (_PARAM_TEST_FIXED_STRUCT__ARG_TRAITS_) #define _PARAM_TEST_FIXED_STRUCT__ARG_TRAITS_ @@ -440,7 +422,7 @@ namespace TAO #endif /* end #if !defined */ // TAO_IDL - Generated from - // .\be\be_visitor_arg_traits.cpp:870 + // .\be\be_visitor_arg_traits.cpp:871 #if !defined (_PARAM_TEST_VAR_STRUCT__ARG_TRAITS_) #define _PARAM_TEST_VAR_STRUCT__ARG_TRAITS_ @@ -458,7 +440,7 @@ namespace TAO #endif /* end #if !defined */ // TAO_IDL - Generated from - // .\be\be_visitor_arg_traits.cpp:870 + // .\be\be_visitor_arg_traits.cpp:871 #if !defined (_PARAM_TEST_NESTED_STRUCT__ARG_TRAITS_) #define _PARAM_TEST_NESTED_STRUCT__ARG_TRAITS_ @@ -476,7 +458,7 @@ namespace TAO #endif /* end #if !defined */ // TAO_IDL - Generated from - // .\be\be_visitor_arg_traits.cpp:870 + // .\be\be_visitor_arg_traits.cpp:871 #if !defined (_PARAM_TEST_OBJREF_STRUCT__ARG_TRAITS_) #define _PARAM_TEST_OBJREF_STRUCT__ARG_TRAITS_ @@ -562,7 +544,7 @@ namespace TAO #endif /* end #if !defined */ // TAO_IDL - Generated from - // .\be\be_visitor_arg_traits.cpp:978 + // .\be\be_visitor_arg_traits.cpp:979 #if !defined (_PARAM_TEST_BIG_UNION__ARG_TRAITS_) #define _PARAM_TEST_BIG_UNION__ARG_TRAITS_ @@ -580,7 +562,7 @@ namespace TAO #endif /* end #if !defined */ // TAO_IDL - Generated from - // .\be\be_visitor_arg_traits.cpp:978 + // .\be\be_visitor_arg_traits.cpp:979 #if !defined (_PARAM_TEST_SMALL_UNION__ARG_TRAITS_) #define _PARAM_TEST_SMALL_UNION__ARG_TRAITS_ @@ -598,7 +580,7 @@ namespace TAO #endif /* end #if !defined */ // TAO_IDL - Generated from - // .\be\be_visitor_arg_traits.cpp:870 + // .\be\be_visitor_arg_traits.cpp:871 #if !defined (_PARAM_TEST_RECURSIVE_STRUCT__ARG_TRAITS_) #define _PARAM_TEST_RECURSIVE_STRUCT__ARG_TRAITS_ @@ -616,7 +598,7 @@ namespace TAO #endif /* end #if !defined */ // TAO_IDL - Generated from - // .\be\be_visitor_arg_traits.cpp:978 + // .\be\be_visitor_arg_traits.cpp:979 #if !defined (_PARAM_TEST_RECURSIVE_UNION__ARG_TRAITS_) #define _PARAM_TEST_RECURSIVE_UNION__ARG_TRAITS_ @@ -1059,54 +1041,11 @@ Param_Test::test_ulonglong ( // TAO_IDL - Generated from // w:\tao\tao_idl\be\be_visitor_operation/operation_cs.cpp:78 -char * -Param_Test::test_unbounded_string ( - const char * s1, - char *& s2, - ::CORBA::String_out s3) -{ - if (!this->is_evaluated ()) - { - ::CORBA::Object::tao_object_initialize (this); - } - - if (this->the_TAO_Param_Test_Proxy_Broker_ == 0) - { - Param_Test_setup_collocation (); - } - - TAO::Arg_Traits< char *>::ret_val _tao_retval; - TAO::Arg_Traits< char *>::in_arg_val _tao_s1 (s1); - TAO::Arg_Traits< char *>::inout_arg_val _tao_s2 (s2); - TAO::Arg_Traits< char *>::out_arg_val _tao_s3 (s3); - - TAO::Argument *_the_tao_operation_signature [] = - { - &_tao_retval, - &_tao_s1, - &_tao_s2, - &_tao_s3 - }; - - TAO::Invocation_Adapter _tao_call ( - this, - _the_tao_operation_signature, - 4, - "test_unbounded_string", - 21, - this->the_TAO_Param_Test_Proxy_Broker_ - ); - - _tao_call.invoke (0, 0); - - return _tao_retval.retn (); -} - std::string -Param_Test::test_unbounded_string( +Param_Test::test_unbounded_string ( const std::string s1, - std::string &s2, - std::string &s3) + std::string & s2, + std::string & s3) { if (!this->is_evaluated ()) { @@ -1118,10 +1057,10 @@ Param_Test::test_unbounded_string( Param_Test_setup_collocation (); } - TAO::Arg_Traits<std::string>::ret_val _tao_retval; - TAO::Arg_Traits<std::string>::in_arg_val _tao_s1 (s1); - TAO::Arg_Traits<std::string>::inout_arg_val _tao_s2 (s2); - TAO::Arg_Traits<std::string>::out_arg_val _tao_s3 (s3); + TAO::Arg_Traits< std::string>::ret_val _tao_retval; + TAO::Arg_Traits< std::string>::in_arg_val _tao_s1 (s1); + TAO::Arg_Traits< std::string>::inout_arg_val _tao_s2 (s2); + TAO::Arg_Traits< std::string>::out_arg_val _tao_s3 (s3); TAO::Argument *_the_tao_operation_signature [] = { @@ -1891,54 +1830,11 @@ Param_Test::test_bounded_short_sequence ( // TAO_IDL - Generated from // w:\tao\tao_idl\be\be_visitor_operation/operation_cs.cpp:78 -::CORBA::LongSeq * -Param_Test::test_long_sequence ( - const ::CORBA::LongSeq & s1, - ::CORBA::LongSeq & s2, - ::CORBA::LongSeq_out s3) -{ - if (!this->is_evaluated ()) - { - ::CORBA::Object::tao_object_initialize (this); - } - - if (this->the_TAO_Param_Test_Proxy_Broker_ == 0) - { - Param_Test_setup_collocation (); - } - - TAO::Arg_Traits< ::CORBA::LongSeq>::ret_val _tao_retval; - TAO::Arg_Traits< ::CORBA::LongSeq>::in_arg_val _tao_s1 (s1); - TAO::Arg_Traits< ::CORBA::LongSeq>::inout_arg_val _tao_s2 (s2); - TAO::Arg_Traits< ::CORBA::LongSeq>::out_arg_val _tao_s3 (s3); - - TAO::Argument *_the_tao_operation_signature [] = - { - &_tao_retval, - &_tao_s1, - &_tao_s2, - &_tao_s3 - }; - - TAO::Invocation_Adapter _tao_call ( - this, - _the_tao_operation_signature, - 4, - "test_long_sequence", - 18, - this->the_TAO_Param_Test_Proxy_Broker_ - ); - - _tao_call.invoke (0, 0); - - return _tao_retval.retn (); -} - Param_Test::UB_Long_Seq Param_Test::test_long_sequence ( - UB_Long_Seq &s1, - UB_Long_Seq &s2, - UB_Long_Seq &s3) + const Param_Test::UB_Long_Seq & s1, + Param_Test::UB_Long_Seq & s2, + Param_Test::UB_Long_Seq & s3) { if (!this->is_evaluated ()) { @@ -1950,10 +1846,10 @@ Param_Test::test_long_sequence ( Param_Test_setup_collocation (); } - TAO::Arg_Traits<UB_Long_Seq>::ret_val _tao_retval; - TAO::Arg_Traits<UB_Long_Seq>::in_arg_val _tao_s1 (s1); - TAO::Arg_Traits<UB_Long_Seq>::inout_arg_val _tao_s2 (s2); - TAO::Arg_Traits<UB_Long_Seq>::out_arg_val _tao_s3 (s3); + TAO::Arg_Traits< Param_Test::UB_Long_Seq>::ret_val _tao_retval; + TAO::Arg_Traits< Param_Test::UB_Long_Seq>::in_arg_val _tao_s1 (s1); + TAO::Arg_Traits< Param_Test::UB_Long_Seq>::inout_arg_val _tao_s2 (s2); + TAO::Arg_Traits< Param_Test::UB_Long_Seq>::out_arg_val _tao_s3 (s3); TAO::Argument *_the_tao_operation_signature [] = { @@ -8458,6 +8354,40 @@ TAO_END_VERSIONED_NAMESPACE_DECL +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +void operator<<= ( + ::CORBA::Any &, + const std::string) +{ +} + +::CORBA::Boolean operator>>= ( + const ::CORBA::Any &, + std::string &) +{ + return true; +} + +TAO_END_VERSIONED_NAMESPACE_DECL + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +void operator<<= ( + ::CORBA::Any &, + const Param_Test::UB_Long_Seq) +{ +} + +::CORBA::Boolean operator>>= ( + const ::CORBA::Any &, + Param_Test::UB_Long_Seq &) +{ + return true; +} + +TAO_END_VERSIONED_NAMESPACE_DECL + // TAO_IDL - Generated from // w:\tao\tao_idl\be\be_visitor_structure/cdr_op_cs.cpp:61 @@ -10040,6 +9970,8 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_END_VERSIONED_NAMESPACE_DECL + + TAO_BEGIN_VERSIONED_NAMESPACE_DECL ::CORBA::Boolean operator<< ( @@ -10060,26 +9992,13 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL return true; } -void operator<<= ( - ::CORBA::Any &, - const std::string) -{ -} - -::CORBA::Boolean operator>>= ( - const ::CORBA::Any &, - std::string &) -{ - return true; -} - TAO_END_VERSIONED_NAMESPACE_DECL TAO_BEGIN_VERSIONED_NAMESPACE_DECL ::CORBA::Boolean operator<< ( - TAO_OutputCDR &strm, - const Param_Test::UB_Long_Seq &_tao_vector) + TAO_OutputCDR &strm, + const Param_Test::UB_Long_Seq &_tao_vector) { ::CORBA::ULong length = _tao_vector.size (); strm << length; @@ -10088,20 +10007,17 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL { strm << _tao_vector[i]; } - + return true; } ::CORBA::Boolean operator>> ( - TAO_InputCDR &strm, - Param_Test::UB_Long_Seq &_tao_vector) + TAO_InputCDR &strm, + Param_Test::UB_Long_Seq &_tao_vector) { ::CORBA::ULong length = 0UL; ::CORBA::ULong tmp = 0UL; - strm >> length; - _tao_vector.resize (length); - for ( ::CORBA::ULong i = 0UL; i < length; ++i) { strm >> tmp; @@ -10111,23 +10027,5 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL return true; } -void operator<<= ( - ::CORBA::Any &, - const Param_Test::UB_Long_Seq) -{ -} - -::CORBA::Boolean operator>>= ( - const ::CORBA::Any &, - Param_Test::UB_Long_Seq &) -{ - return true; -} - -TAO_END_VERSIONED_NAMESPACE_DECL - - - - - +TAO_BEGIN_VERSIONED_NAMESPACE_DECL diff --git a/modules/TAO/tests/Param_Test/param_testC.h b/modules/TAO/tests/Param_Test/param_testC.h index 023224bbc4a..e760afdcf76 100644 --- a/modules/TAO/tests/Param_Test/param_testC.h +++ b/modules/TAO/tests/Param_Test/param_testC.h @@ -41,6 +41,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include <string> +#include <vector> #include "tao/AnyTypeCode/AnyTypeCode_methods.h" #include "tao/ORB.h" @@ -110,9 +112,6 @@ #include "tao/WrongTransactionC.h" #include "tao/AnyTypeCode/AnySeqC.h" -#include <string> -#include <vector> - #if defined (TAO_EXPORT_MACRO) #undef TAO_EXPORT_MACRO #endif @@ -342,23 +341,11 @@ public: // TAO_IDL - Generated from // w:\tao\tao_idl\be\be_visitor_operation/operation_ch.cpp:42 - virtual char * - test_unbounded_string ( - const char * s1, - char *& s2, - ::CORBA::String_out s3); - - //================================================ - // Another version of test_unbounded_string, this - // one using std::string. - virtual std::string test_unbounded_string ( const std::string s1, - std::string &s2, - std::string &s3); - - //================================================ + std::string & s2, + std::string & s3); // TAO_IDL - Generated from // w:\tao\tao_idl\be\be_visitor_typedef/typedef_ch.cpp:413 @@ -657,26 +644,14 @@ public: // TAO_IDL - Generated from // w:\tao\tao_idl\be\be_visitor_operation/operation_ch.cpp:42 - virtual ::CORBA::LongSeq * - test_long_sequence ( - const ::CORBA::LongSeq & s1, - ::CORBA::LongSeq & s2, - ::CORBA::LongSeq_out s3); - - //=========================================================== - // Another version of test_long_sequence, this one using - // std::vector. - typedef std::vector< ::CORBA::Long> UB_Long_Seq; - - virtual UB_Long_Seq + + virtual Param_Test::UB_Long_Seq test_long_sequence ( - UB_Long_Seq &s1, - UB_Long_Seq &s2, - UB_Long_Seq &s3); - - //=========================================================== - + const Param_Test::UB_Long_Seq & s1, + Param_Test::UB_Long_Seq & s2, + Param_Test::UB_Long_Seq & s3); + // TAO_IDL - Generated from // w:\tao\tao_idl\be\be_visitor_sequence/sequence_ch.cpp:107 @@ -3059,6 +3034,20 @@ TAO_END_VERSIONED_NAMESPACE_DECL +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +void operator<<= ( ::CORBA::Any &, const std::string); +::CORBA::Boolean operator>>= (const ::CORBA::Any &, std::string &); + +TAO_END_VERSIONED_NAMESPACE_DECL + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +void operator<<= ( ::CORBA::Any &, const Param_Test::UB_Long_Seq); +::CORBA::Boolean operator>>= (const ::CORBA::Any &, Param_Test::UB_Long_Seq &); + +TAO_END_VERSIONED_NAMESPACE_DECL + // TAO_IDL - Generated from // w:\tao\tao_idl\be\be_visitor_interface/cdr_op_ch.cpp:55 @@ -3676,24 +3665,20 @@ TAO_END_VERSIONED_NAMESPACE_DECL TAO_BEGIN_VERSIONED_NAMESPACE_DECL - ::CORBA::Boolean operator<< (TAO_OutputCDR &strm, const std::string &_tao_string); - ::CORBA::Boolean operator>> (TAO_InputCDR &, std::string &_tao_string); - void operator<<= ( ::CORBA::Any &, const std::string); - ::CORBA::Boolean operator>>= (const ::CORBA::Any &, std::string &); +::CORBA::Boolean operator<< (TAO_OutputCDR &strm, const std::string &_tao_string); +::CORBA::Boolean operator>> (TAO_InputCDR &strm, std::string &_tao_string); TAO_END_VERSIONED_NAMESPACE_DECL TAO_BEGIN_VERSIONED_NAMESPACE_DECL - ::CORBA::Boolean operator<< (TAO_OutputCDR &strm, const Param_Test::UB_Long_Seq &_tao_vector); - ::CORBA::Boolean operator>> (TAO_InputCDR &, Param_Test::UB_Long_Seq &_tao_array); - void operator<<= ( ::CORBA::Any &, const Param_Test::UB_Long_Seq); - ::CORBA::Boolean operator>>= (const ::CORBA::Any &, Param_Test::UB_Long_Seq &); +::CORBA::Boolean operator<< (TAO_OutputCDR &strm, const Param_Test::UB_Long_Seq &_tao_vector); +::CORBA::Boolean operator>> (TAO_InputCDR &strm, Param_Test::UB_Long_Seq &_tao_vector); TAO_END_VERSIONED_NAMESPACE_DECL // TAO_IDL - Generated from -// .\be\be_codegen.cpp:1452 +// .\be\be_codegen.cpp:1455 #if defined (__ACE_INLINE__) #include "param_testC.inl" #endif /* defined INLINE */ diff --git a/modules/TAO/tests/Param_Test/param_testS.cpp b/modules/TAO/tests/Param_Test/param_testS.cpp index 36aa6f7ccdc..45b2f6ca193 100644 --- a/modules/TAO/tests/Param_Test/param_testS.cpp +++ b/modules/TAO/tests/Param_Test/param_testS.cpp @@ -28,7 +28,7 @@ // TAO_IDL - Generated from -// .\be\be_codegen.cpp:682 +// .\be\be_codegen.cpp:685 #ifndef _TAO_IDL_PARAM_TESTS_CPP_ #define _TAO_IDL_PARAM_TESTS_CPP_ @@ -92,34 +92,16 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace TAO { - // TAO_IDL - Generated from - // .\be\be_visitor_arg_traits.cpp:620 - -#if !defined (_CORBA_LONGSEQ__SARG_TRAITS_) -#define _CORBA_LONGSEQ__SARG_TRAITS_ - - template<> - class SArg_Traits<CORBA::LongSeq> - : public - Var_Size_SArg_Traits_T< - CORBA::LongSeq, - TAO::Any_Insert_Policy_Stream <CORBA::LongSeq> - > - { - }; - template<> class SArg_Traits<Param_Test::UB_Long_Seq> - : public - Basic_SArg_Traits_T < + : public + Basic_SArg_Traits_T< Param_Test::UB_Long_Seq, TAO::Any_Insert_Policy_Stream <Param_Test::UB_Long_Seq> > { }; - -#endif /* end #if !defined */ - + // TAO_IDL - Generated from // .\be\be_visitor_arg_traits.cpp:620 @@ -213,7 +195,7 @@ namespace TAO #endif /* end #if !defined */ // TAO_IDL - Generated from - // .\be\be_visitor_arg_traits.cpp:870 + // .\be\be_visitor_arg_traits.cpp:871 #if !defined (_COFFEE_DESC__SARG_TRAITS_) #define _COFFEE_DESC__SARG_TRAITS_ @@ -271,7 +253,7 @@ namespace TAO #endif /* end #if !defined */ // TAO_IDL - Generated from - // .\be\be_visitor_arg_traits.cpp:870 + // .\be\be_visitor_arg_traits.cpp:871 #if !defined (_PARAM_TEST_FIXED_STRUCT__SARG_TRAITS_) #define _PARAM_TEST_FIXED_STRUCT__SARG_TRAITS_ @@ -451,7 +433,7 @@ namespace TAO #endif /* end #if !defined */ // TAO_IDL - Generated from - // .\be\be_visitor_arg_traits.cpp:870 + // .\be\be_visitor_arg_traits.cpp:871 #if !defined (_PARAM_TEST_VAR_STRUCT__SARG_TRAITS_) #define _PARAM_TEST_VAR_STRUCT__SARG_TRAITS_ @@ -469,7 +451,7 @@ namespace TAO #endif /* end #if !defined */ // TAO_IDL - Generated from - // .\be\be_visitor_arg_traits.cpp:870 + // .\be\be_visitor_arg_traits.cpp:871 #if !defined (_PARAM_TEST_NESTED_STRUCT__SARG_TRAITS_) #define _PARAM_TEST_NESTED_STRUCT__SARG_TRAITS_ @@ -487,7 +469,7 @@ namespace TAO #endif /* end #if !defined */ // TAO_IDL - Generated from - // .\be\be_visitor_arg_traits.cpp:870 + // .\be\be_visitor_arg_traits.cpp:871 #if !defined (_PARAM_TEST_OBJREF_STRUCT__SARG_TRAITS_) #define _PARAM_TEST_OBJREF_STRUCT__SARG_TRAITS_ @@ -573,7 +555,7 @@ namespace TAO #endif /* end #if !defined */ // TAO_IDL - Generated from - // .\be\be_visitor_arg_traits.cpp:978 + // .\be\be_visitor_arg_traits.cpp:979 #if !defined (_PARAM_TEST_BIG_UNION__SARG_TRAITS_) #define _PARAM_TEST_BIG_UNION__SARG_TRAITS_ @@ -591,7 +573,7 @@ namespace TAO #endif /* end #if !defined */ // TAO_IDL - Generated from - // .\be\be_visitor_arg_traits.cpp:978 + // .\be\be_visitor_arg_traits.cpp:979 #if !defined (_PARAM_TEST_SMALL_UNION__SARG_TRAITS_) #define _PARAM_TEST_SMALL_UNION__SARG_TRAITS_ @@ -609,7 +591,7 @@ namespace TAO #endif /* end #if !defined */ // TAO_IDL - Generated from - // .\be\be_visitor_arg_traits.cpp:870 + // .\be\be_visitor_arg_traits.cpp:871 #if !defined (_PARAM_TEST_RECURSIVE_STRUCT__SARG_TRAITS_) #define _PARAM_TEST_RECURSIVE_STRUCT__SARG_TRAITS_ @@ -627,7 +609,7 @@ namespace TAO #endif /* end #if !defined */ // TAO_IDL - Generated from - // .\be\be_visitor_arg_traits.cpp:978 + // .\be\be_visitor_arg_traits.cpp:979 #if !defined (_PARAM_TEST_RECURSIVE_UNION__SARG_TRAITS_) #define _PARAM_TEST_RECURSIVE_UNION__SARG_TRAITS_ @@ -675,33 +657,15 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace TAO { - // TAO_IDL - Generated from - // .\be\be_visitor_arg_traits.cpp:620 - -#if !defined (_CORBA_LONGSEQ__ARG_TRAITS_) -#define _CORBA_LONGSEQ__ARG_TRAITS_ - - template<> - class Arg_Traits<CORBA::LongSeq> - : public - Var_Size_Arg_Traits_T< - CORBA::LongSeq, - TAO::Any_Insert_Policy_Stream <CORBA::LongSeq> - > - { - }; - template<> class Arg_Traits<Param_Test::UB_Long_Seq> - : public - Basic_Arg_Traits_T < + : public + Basic_Arg_Traits_T< Param_Test::UB_Long_Seq, TAO::Any_Insert_Policy_Stream <Param_Test::UB_Long_Seq> > { }; - -#endif /* end #if !defined */ // TAO_IDL - Generated from // .\be\be_visitor_arg_traits.cpp:620 @@ -797,7 +761,7 @@ namespace TAO #endif /* end #if !defined */ // TAO_IDL - Generated from - // .\be\be_visitor_arg_traits.cpp:870 + // .\be\be_visitor_arg_traits.cpp:871 #if !defined (_COFFEE_DESC__ARG_TRAITS_) #define _COFFEE_DESC__ARG_TRAITS_ @@ -851,7 +815,7 @@ namespace TAO #endif /* end #if !defined */ // TAO_IDL - Generated from - // .\be\be_visitor_arg_traits.cpp:870 + // .\be\be_visitor_arg_traits.cpp:871 #if !defined (_PARAM_TEST_FIXED_STRUCT__ARG_TRAITS_) #define _PARAM_TEST_FIXED_STRUCT__ARG_TRAITS_ @@ -1031,7 +995,7 @@ namespace TAO #endif /* end #if !defined */ // TAO_IDL - Generated from - // .\be\be_visitor_arg_traits.cpp:870 + // .\be\be_visitor_arg_traits.cpp:871 #if !defined (_PARAM_TEST_VAR_STRUCT__ARG_TRAITS_) #define _PARAM_TEST_VAR_STRUCT__ARG_TRAITS_ @@ -1049,7 +1013,7 @@ namespace TAO #endif /* end #if !defined */ // TAO_IDL - Generated from - // .\be\be_visitor_arg_traits.cpp:870 + // .\be\be_visitor_arg_traits.cpp:871 #if !defined (_PARAM_TEST_NESTED_STRUCT__ARG_TRAITS_) #define _PARAM_TEST_NESTED_STRUCT__ARG_TRAITS_ @@ -1067,7 +1031,7 @@ namespace TAO #endif /* end #if !defined */ // TAO_IDL - Generated from - // .\be\be_visitor_arg_traits.cpp:870 + // .\be\be_visitor_arg_traits.cpp:871 #if !defined (_PARAM_TEST_OBJREF_STRUCT__ARG_TRAITS_) #define _PARAM_TEST_OBJREF_STRUCT__ARG_TRAITS_ @@ -1153,7 +1117,7 @@ namespace TAO #endif /* end #if !defined */ // TAO_IDL - Generated from - // .\be\be_visitor_arg_traits.cpp:978 + // .\be\be_visitor_arg_traits.cpp:979 #if !defined (_PARAM_TEST_BIG_UNION__ARG_TRAITS_) #define _PARAM_TEST_BIG_UNION__ARG_TRAITS_ @@ -1171,7 +1135,7 @@ namespace TAO #endif /* end #if !defined */ // TAO_IDL - Generated from - // .\be\be_visitor_arg_traits.cpp:978 + // .\be\be_visitor_arg_traits.cpp:979 #if !defined (_PARAM_TEST_SMALL_UNION__ARG_TRAITS_) #define _PARAM_TEST_SMALL_UNION__ARG_TRAITS_ @@ -1189,7 +1153,7 @@ namespace TAO #endif /* end #if !defined */ // TAO_IDL - Generated from - // .\be\be_visitor_arg_traits.cpp:870 + // .\be\be_visitor_arg_traits.cpp:871 #if !defined (_PARAM_TEST_RECURSIVE_STRUCT__ARG_TRAITS_) #define _PARAM_TEST_RECURSIVE_STRUCT__ARG_TRAITS_ @@ -1207,7 +1171,7 @@ namespace TAO #endif /* end #if !defined */ // TAO_IDL - Generated from - // .\be\be_visitor_arg_traits.cpp:978 + // .\be\be_visitor_arg_traits.cpp:979 #if !defined (_PARAM_TEST_RECURSIVE_UNION__ARG_TRAITS_) #define _PARAM_TEST_RECURSIVE_UNION__ARG_TRAITS_ @@ -2443,25 +2407,25 @@ public: virtual void execute (void) { - TAO::SArg_Traits<std::string>::ret_arg_type retval = - TAO::Portable_Server::get_ret_arg<std::string> ( + TAO::SArg_Traits< std::string>::ret_arg_type retval = + TAO::Portable_Server::get_ret_arg< std::string> ( this->operation_details_, this->args_); - TAO::SArg_Traits<std::string>::in_arg_type arg_1 = - TAO::Portable_Server::get_in_arg<std::string> ( + TAO::SArg_Traits< std::string>::in_arg_type arg_1 = + TAO::Portable_Server::get_in_arg< std::string> ( this->operation_details_, this->args_, 1); - TAO::SArg_Traits<std::string>::inout_arg_type arg_2 = - TAO::Portable_Server::get_inout_arg<std::string> ( + TAO::SArg_Traits< std::string>::inout_arg_type arg_2 = + TAO::Portable_Server::get_inout_arg< std::string> ( this->operation_details_, this->args_, 2); - TAO::SArg_Traits<std::string>::out_arg_type arg_3 = - TAO::Portable_Server::get_out_arg<std::string> ( + TAO::SArg_Traits< std::string>::out_arg_type arg_3 = + TAO::Portable_Server::get_out_arg< std::string> ( this->operation_details_, this->args_, 3); @@ -2492,10 +2456,10 @@ void POA_Param_Test::test_unbounded_string_skel ( static ::CORBA::ULong const nexceptions = 0; #endif /* TAO_HAS_INTERCEPTORS */ - TAO::SArg_Traits<std::string>::ret_val retval; - TAO::SArg_Traits<std::string>::in_arg_val _tao_s1; - TAO::SArg_Traits<std::string>::inout_arg_val _tao_s2; - TAO::SArg_Traits<std::string>::out_arg_val _tao_s3; + TAO::SArg_Traits< std::string>::ret_val retval; + TAO::SArg_Traits< std::string>::in_arg_val _tao_s1; + TAO::SArg_Traits< std::string>::inout_arg_val _tao_s2; + TAO::SArg_Traits< std::string>::out_arg_val _tao_s3; TAO::Argument * const args[] = { @@ -3291,25 +3255,25 @@ public: virtual void execute (void) { - TAO::SArg_Traits<Param_Test::UB_Long_Seq>::ret_arg_type retval = - TAO::Portable_Server::get_ret_arg<Param_Test::UB_Long_Seq> ( + TAO::SArg_Traits< Param_Test::UB_Long_Seq>::ret_arg_type retval = + TAO::Portable_Server::get_ret_arg< Param_Test::UB_Long_Seq> ( this->operation_details_, this->args_); - TAO::SArg_Traits<Param_Test::UB_Long_Seq>::in_arg_type arg_1 = - TAO::Portable_Server::get_in_arg<Param_Test::UB_Long_Seq> ( + TAO::SArg_Traits< Param_Test::UB_Long_Seq>::in_arg_type arg_1 = + TAO::Portable_Server::get_in_arg< Param_Test::UB_Long_Seq> ( this->operation_details_, this->args_, 1); - TAO::SArg_Traits<Param_Test::UB_Long_Seq>::inout_arg_type arg_2 = - TAO::Portable_Server::get_inout_arg<Param_Test::UB_Long_Seq> ( + TAO::SArg_Traits< Param_Test::UB_Long_Seq>::inout_arg_type arg_2 = + TAO::Portable_Server::get_inout_arg< Param_Test::UB_Long_Seq> ( this->operation_details_, this->args_, 2); - TAO::SArg_Traits<Param_Test::UB_Long_Seq>::out_arg_type arg_3 = - TAO::Portable_Server::get_out_arg<Param_Test::UB_Long_Seq> ( + TAO::SArg_Traits< Param_Test::UB_Long_Seq>::out_arg_type arg_3 = + TAO::Portable_Server::get_out_arg< Param_Test::UB_Long_Seq> ( this->operation_details_, this->args_, 3); @@ -3340,10 +3304,10 @@ void POA_Param_Test::test_long_sequence_skel ( static ::CORBA::ULong const nexceptions = 0; #endif /* TAO_HAS_INTERCEPTORS */ - TAO::SArg_Traits<Param_Test::UB_Long_Seq>::ret_val retval; - TAO::SArg_Traits<Param_Test::UB_Long_Seq>::in_arg_val _tao_s1; - TAO::SArg_Traits<Param_Test::UB_Long_Seq>::inout_arg_val _tao_s2; - TAO::SArg_Traits<Param_Test::UB_Long_Seq>::out_arg_val _tao_s3; + TAO::SArg_Traits< Param_Test::UB_Long_Seq>::ret_val retval; + TAO::SArg_Traits< Param_Test::UB_Long_Seq>::in_arg_val _tao_s1; + TAO::SArg_Traits< Param_Test::UB_Long_Seq>::inout_arg_val _tao_s2; + TAO::SArg_Traits< Param_Test::UB_Long_Seq>::out_arg_val _tao_s3; TAO::Argument * const args[] = { diff --git a/modules/TAO/tests/Param_Test/param_testS.h b/modules/TAO/tests/Param_Test/param_testS.h index d65796aa6da..69df3e2232e 100644 --- a/modules/TAO/tests/Param_Test/param_testS.h +++ b/modules/TAO/tests/Param_Test/param_testS.h @@ -27,7 +27,7 @@ **/ // TAO_IDL - Generated from -// .\be\be_codegen.cpp:471 +// .\be\be_codegen.cpp:474 #ifndef _TAO_IDL_PARAM_TESTS_H_ #define _TAO_IDL_PARAM_TESTS_H_ @@ -356,7 +356,7 @@ public: // w:\tao\tao_idl\be\be_visitor_operation/operation_sh.cpp:45 virtual Param_Test::UB_Long_Seq test_long_sequence ( - Param_Test::UB_Long_Seq & s1, + const Param_Test::UB_Long_Seq & s1, Param_Test::UB_Long_Seq & s2, Param_Test::UB_Long_Seq & s3) = 0; @@ -768,7 +768,7 @@ public: }; // TAO_IDL - Generated from -// .\be\be_codegen.cpp:1514 +// .\be\be_codegen.cpp:1517 #if defined (__ACE_INLINE__) diff --git a/modules/TAO/tests/Param_Test/param_test_i.cpp b/modules/TAO/tests/Param_Test/param_test_i.cpp index 78d36e18f88..7f0a76cd1e3 100644 --- a/modules/TAO/tests/Param_Test/param_test_i.cpp +++ b/modules/TAO/tests/Param_Test/param_test_i.cpp @@ -188,7 +188,7 @@ Param_Test_i::test_fixed_struct (const Param_Test::Fixed_Struct &s1, // = Sequences Param_Test::UB_Long_Seq -Param_Test_i::test_long_sequence (Param_Test::UB_Long_Seq & s1, +Param_Test_i::test_long_sequence (const Param_Test::UB_Long_Seq & s1, Param_Test::UB_Long_Seq & s2, Param_Test::UB_Long_Seq & s3) { diff --git a/modules/TAO/tests/Param_Test/param_test_i.h b/modules/TAO/tests/Param_Test/param_test_i.h index 04d6c18f243..f11ed2c6426 100644 --- a/modules/TAO/tests/Param_Test/param_test_i.h +++ b/modules/TAO/tests/Param_Test/param_test_i.h @@ -95,7 +95,7 @@ public: // = Start of sequences tests... virtual Param_Test::UB_Long_Seq test_long_sequence ( - Param_Test::UB_Long_Seq & s1, + const Param_Test::UB_Long_Seq & s1, Param_Test::UB_Long_Seq & s2, Param_Test::UB_Long_Seq & s3); |