summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/be/be_visitor_traits.cpp
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-12-07 07:00:20 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-12-07 07:00:20 +0000
commit6feedbb121fb24f0ddd3fc78c60ff97d65449e4d (patch)
treeca44e139ccdeb1f9656d375de023cfde447ec9d5 /TAO/TAO_IDL/be/be_visitor_traits.cpp
parent133a564033533fcc103dbce1b7698428dafbf711 (diff)
downloadATCD-6feedbb121fb24f0ddd3fc78c60ff97d65449e4d.tar.gz
ChangeLogTag: Sun Dec 7 000:46:52 2003 Jeff Parsons <j.parsons@vanderbilt.edu>
Diffstat (limited to 'TAO/TAO_IDL/be/be_visitor_traits.cpp')
-rw-r--r--TAO/TAO_IDL/be/be_visitor_traits.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_traits.cpp b/TAO/TAO_IDL/be/be_visitor_traits.cpp
index a27ab57ca23..90c423b1eb4 100644
--- a/TAO/TAO_IDL/be/be_visitor_traits.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_traits.cpp
@@ -35,6 +35,7 @@
#include "be_extern.h"
#include "utl_identifier.h"
+#include "idl_defines.h"
ACE_RCSID (be,
be_visitor_traits,
@@ -387,6 +388,39 @@ be_visitor_traits::visit_array (be_array *node)
TAO_OutStream *os = this->ctx_->stream ();
+ // Generate the array traits specialization definitions,
+ // guarded by #ifdef on unaliased array element type and length.
+
+ ACE_CString unique;
+ be_type *bt = be_type::narrow_from_decl (node->base_type ());
+ AST_Decl::NodeType nt = bt->node_type ();
+
+ if (nt == AST_Decl::NT_typedef)
+ {
+ be_typedef *td = be_typedef::narrow_from_decl (bt);
+ unique = td->primitive_base_type ()->flat_name ();
+ }
+ else
+ {
+ unique = bt->flat_name ();
+ }
+
+ char buf[NAMEBUFSIZE];
+
+ for (unsigned long i = 0; i < node->n_dims (); ++i)
+ {
+ ACE_OS::memset (buf,
+ '\0',
+ NAMEBUFSIZE);
+ ACE_OS::sprintf (buf,
+ "_%ld",
+ node->dims ()[i]->ev ()->u.ulval);
+ unique += buf;
+ }
+
+ unique += "_traits";
+ os->gen_ifdef_macro (unique.fast_rep ());
+
*os << be_nl << be_nl
<< "ACE_TEMPLATE_SPECIALIZATION" << be_nl
<< "struct " << be_global->stub_export_macro () << " Array_Traits<"
@@ -410,6 +444,8 @@ be_visitor_traits::visit_array (be_array *node)
<< be_uidt_nl
<< "};";
+ os->gen_endif ();
+
node->cli_traits_gen (I_TRUE);
return 0;
}