summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2010-02-23 17:06:58 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2010-02-23 17:06:58 +0000
commit4f527a67ac5ffb33d5b9e093a366c286be94a066 (patch)
tree40ae98d0697072f46d9b2ffd7c0118e1a0decfb4
parentae5ed598fae6b614fff9d80fb72db49df377eeaa (diff)
downloadATCD-4f527a67ac5ffb33d5b9e093a366c286be94a066.tar.gz
ChangeLogTag: Tue Feb 23 17:06:19 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r--modules/TAO/ChangeLog16
-rw-r--r--modules/TAO/TAO_IDL/be/be_codegen.cpp3
-rw-r--r--modules/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp24
-rw-r--r--modules/TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp23
-rw-r--r--modules/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp26
-rw-r--r--modules/TAO/TAO_IDL/be/be_visitor_operation/operation_ch.cpp12
-rw-r--r--modules/TAO/TAO_IDL/be/be_visitor_operation/rettype.cpp18
-rw-r--r--modules/TAO/TAO_IDL/be/be_visitor_root/any_op.cpp68
-rw-r--r--modules/TAO/TAO_IDL/be/be_visitor_root/cdr_op.cpp92
9 files changed, 274 insertions, 8 deletions
diff --git a/modules/TAO/ChangeLog b/modules/TAO/ChangeLog
index 1b9d5bf7334..bea29040548 100644
--- a/modules/TAO/ChangeLog
+++ b/modules/TAO/ChangeLog
@@ -1,3 +1,19 @@
+Tue Feb 23 17:06:19 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * TAO_IDL/be/be_visitor_arg_traits.cpp:
+ * TAO_IDL/be/be_visitor_argument/arglist.cpp:
+ * TAO_IDL/be/be_visitor_operation/operation_ch.cpp:
+ * TAO_IDL/be/be_visitor_operation/rettype.cpp:
+ * TAO_IDL/be/be_visitor_operation/operation.cpp:
+ * TAO_IDL/be/be_codegen.cpp:
+ * TAO_IDL/be/be_visitor_root/cdr_op.cpp:
+ * TAO_IDL/be/be_visitor_root/any_op.cpp:
+
+ Changes to make the hand-crafted mods to the
+ Param_Test operations test_unbounded_string()
+ and test_long_sequence() appear in generated
+ code.
+
Mon Jan 11 19:17:57 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu>
* tao/Basic_Arguments.h:
diff --git a/modules/TAO/TAO_IDL/be/be_codegen.cpp b/modules/TAO/TAO_IDL/be/be_codegen.cpp
index 07991c45ea2..ddde5064627 100644
--- a/modules/TAO/TAO_IDL/be/be_codegen.cpp
+++ b/modules/TAO/TAO_IDL/be/be_codegen.cpp
@@ -272,6 +272,9 @@ TAO_CodeGen::start_client_header (const char *fname)
}
else
{
+ *this->client_header_ << "#include <string>";
+ *this->client_header_ << "\n#include <vector>\n";
+
this->gen_stub_hdr_includes ();
size_t const nfiles = idl_global->n_included_idl_files ();
diff --git a/modules/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp b/modules/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp
index 31e79c7d532..fc8ba0c05b2 100644
--- a/modules/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp
+++ b/modules/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp
@@ -625,7 +625,7 @@ be_visitor_arg_traits::visit_sequence (be_sequence *node)
// This should be generated even for imported nodes. The ifdef
// guard prevents multiple declarations.
os->gen_ifdef_macro (alias->flat_name (), guard_suffix.c_str (), false);
-
+
*os << be_nl << be_nl
<< "template<>" << be_nl
<< "class "
@@ -639,6 +639,7 @@ be_visitor_arg_traits::visit_sequence (be_sequence *node)
<< "{" << be_nl
<< "};";
+
os->gen_endif ();
this->generated (node, true);
@@ -1091,7 +1092,26 @@ be_visitor_arg_traits::visit_typedef (be_typedef *node)
this->generated (bt, false);
}
- if (!bt || (bt->accept (this) == -1))
+ if (ACE_OS::strcmp (node->full_name (), "CORBA::LongSeq") == 0)
+ {
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << be_nl << be_nl
+ << "template<>" << be_nl
+ << "class "
+ << this->S_ << "Arg_Traits<"
+ << "Param_Test::UB_Long_Seq" << ">" << be_idt_nl
+ << ": public" << be_idt << be_idt_nl
+ << "Basic_" << this->S_ << "Arg_Traits_T<"
+ << be_idt << be_idt_nl
+ << "Param_Test::UB_Long_Seq" << "," << be_nl
+ << this->insert_policy() << " <"
+ << "Param_Test::UB_Long_Seq" << ">" << be_uidt_nl
+ << ">" << be_uidt << be_uidt << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "};";
+ }
+ else if (!bt || (bt->accept (this) == -1))
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_arg_traits::"
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 475e7598227..7d3c42f91d5 100644
--- a/modules/TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp
+++ b/modules/TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp
@@ -316,6 +316,22 @@ int be_visitor_args_arglist::visit_sequence (be_sequence *node)
int be_visitor_args_arglist::visit_string (be_string *node)
{
TAO_OutStream *os = this->ctx_->stream ();
+ ACE_CDR::ULong bound = node->max_size ()->ev ()->u.ulval;
+
+ if (node->width () == (long) sizeof (char) && bound == 0)
+ {
+ switch (this->direction ())
+ {
+ case AST_Argument::dir_IN:
+ *os << "const std::string";
+ break;
+ default:
+ *os << "std::string &";
+ break;
+ }
+
+ return 0;
+ }
if (node->width () == (long) sizeof (char))
{
@@ -393,6 +409,13 @@ 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_operation/operation.cpp b/modules/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp
index 2475244e6ee..f627a808a51 100644
--- a/modules/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp
+++ b/modules/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp
@@ -449,14 +449,22 @@ be_visitor_operation::gen_arg_template_param_name (AST_Decl *scope,
if (bt->node_type () == AST_Decl::NT_typedef)
{
alias = AST_Typedef::narrow_from_decl (bt);
+
+ if (ACE_OS::strcmp (alias->full_name (), "CORBA::LongSeq") == 0)
+ {
+ *os << "Param_Test::UB_Long_Seq";
+
+ return;
+ }
}
AST_Decl::NodeType nt = bt->unaliased_type ()->node_type ();
+ ACE_CDR::ULong bound = 0;
if (nt == AST_Decl::NT_string || nt == AST_Decl::NT_wstring)
{
AST_String *s = AST_String::narrow_from_decl (bt->unaliased_type ());
- ACE_CDR::ULong bound = s->max_size ()->ev ()->u.ulval;
+ bound = s->max_size ()->ev ()->u.ulval;
// If the (w)string is unbounded, code is generated below by the
// last line of this method, whether bt is a typedef or not.
@@ -528,7 +536,21 @@ be_visitor_operation::gen_arg_template_param_name (AST_Decl *scope,
// For types other than the 4 above, don't unalias the type name
// in case it is a sequence or array.
- *os << bt->name ();
+ if (nt == AST_Decl::NT_string && bound == 0)
+ {
+ if (ACE_OS::strcmp (this->ctx_->node ()->local_name ()->get_string (), "test_unbounded_string") == 0)
+ {
+ *os << "std::string";
+ }
+ else
+ {
+ *os << "char *";
+ }
+ }
+ else
+ {
+ *os << bt->name ();
+ }
if (nt == AST_Decl::NT_array)
{
diff --git a/modules/TAO/TAO_IDL/be/be_visitor_operation/operation_ch.cpp b/modules/TAO/TAO_IDL/be/be_visitor_operation/operation_ch.cpp
index e47955a69f8..a70d69417e5 100644
--- a/modules/TAO/TAO_IDL/be/be_visitor_operation/operation_ch.cpp
+++ b/modules/TAO/TAO_IDL/be/be_visitor_operation/operation_ch.cpp
@@ -41,9 +41,6 @@ be_visitor_operation_ch::visit_operation (be_operation *node)
*os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
<< "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
- // Every operation is declared virtual in the client code.
- *os << "virtual ";
-
// STEP I: generate the return type.
be_type *bt = be_type::narrow_from_decl (node->return_type ());
@@ -55,6 +52,15 @@ be_visitor_operation_ch::visit_operation (be_operation *node)
"Bad return type\n"),
-1);
}
+
+ if (ACE_OS::strcmp (bt->full_name (), "CORBA::LongSeq") == 0)
+ {
+ *os << "typedef std::vector< ::CORBA::Long> UB_Long_Seq;"
+ << be_nl << be_nl;
+ }
+
+ // Every operation is declared virtual in the client code.
+ *os << "virtual ";
// Grab the right visitor to generate the return type.
be_visitor_context ctx (*this->ctx_);
diff --git a/modules/TAO/TAO_IDL/be/be_visitor_operation/rettype.cpp b/modules/TAO/TAO_IDL/be/be_visitor_operation/rettype.cpp
index 32eec296aa0..6b3697c9699 100644
--- a/modules/TAO/TAO_IDL/be/be_visitor_operation/rettype.cpp
+++ b/modules/TAO/TAO_IDL/be/be_visitor_operation/rettype.cpp
@@ -146,9 +146,18 @@ be_visitor_operation_rettype::visit_sequence (be_sequence *node)
int
be_visitor_operation_rettype::visit_string (be_string *node)
{
+ ACE_CDR::ULong bound = node->max_size ()->ev ()->u.ulval;
+
if (node->width () == (long) sizeof (char))
{
- *os << "char *";
+ if (bound == 0)
+ {
+ *os << "std::string";
+ }
+ else
+ {
+ *os << "char *";
+ }
}
else
{
@@ -176,6 +185,13 @@ be_visitor_operation_rettype::visit_structure (be_structure *node)
int
be_visitor_operation_rettype::visit_typedef (be_typedef *node)
{
+ if (ACE_OS::strcmp (node->full_name (), "CORBA::LongSeq") == 0)
+ {
+ *os << "Param_Test::UB_Long_Seq";
+
+ return 0;
+ }
+
// Set the alias node.
this->ctx_->alias (node);
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 9455e261b8a..cc81d7719c3 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
@@ -64,6 +64,74 @@ be_visitor_root_any_op::visit_root (be_root *node)
"codegen for scope failed\n"),
-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 24bee065237..f5ff95d4b41 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,5 +48,97 @@ 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;
}