Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / TAO_IDL / be / be_visitor_native / native_ch.cpp
blob670f885ceaa1b96bafc58926c4a0add17c2e1358
2 //=============================================================================
3 /**
4 * @file native_ch.cpp
6 * Visitor generating code for Native in the client header
8 * @author Johnny Willemsen
9 */
10 //=============================================================================
12 #include "native.h"
13 #include "be_visitor_typecode/typecode_decl.h"
14 #include "global_extern.h"
15 #include <cstring>
17 // ********************************************************************
18 // Visitor implementation for the Native type
19 // This one for the client header file
20 // ********************************************************************
22 be_visitor_native_ch::be_visitor_native_ch (be_visitor_context *ctx)
23 : be_visitor_scope (ctx)
27 /// Visit the native_ch node and its scope.
28 int
29 be_visitor_native_ch::visit_native (be_native *node)
31 if (node->cli_hdr_gen () || node->imported ())
33 return 0;
36 TAO_OutStream *os = this->ctx_->stream ();
38 TAO_INSERT_COMMENT (os);
40 const char *node_name = node->full_name ();
42 if (ACE_OS::strcmp (node_name, "PortableServer::ServantLocator::Cookie") == 0)
44 *os << "typedef void *Cookie;" << be_nl;
46 else if (ACE_OS::strcmp (node_name, "CORBA::VoidData") == 0)
48 *os << "typedef void *VoidData;" << be_nl;
50 else if (idl_global->dcps_support_zero_copy_read ()
51 && 0 == ACE_OS::strcmp (node->full_name (),"DDS::SampleInfoSeq"))
53 // DDS/DCPS zero-copy read sequence type support.
54 *os << be_nl_2
55 << "typedef ::TAO::DCPS::ZeroCopyInfoSeq< "
56 << "SampleInfo"
57 << ", DCPS_ZERO_COPY_SEQ_DEFAULT_SIZE> "
58 << "SampleInfo"
59 << "Seq;" << be_nl;
61 else if (idl_global->dcps_support_zero_copy_read ())
63 // DDS/DCPS zero-copy read sequence type support.
65 // strip the "Seq" ending to get the sample's name
66 const char * node_name = node->full_name ();
67 const size_t max_name_length = 2000;
68 const size_t node_name_length = std::strlen (node_name);
69 if (node_name_length >= max_name_length ||
70 node_name_length <= 3)
72 return -1;
74 char sample_name[max_name_length];
75 // Copy node_name into sample_name and shorten to remove Seq suffix
76 std::strcpy (sample_name, node_name);
77 sample_name[node_name_length - 3] = '\0';
79 *os << be_nl_2
80 << "typedef ::TAO::DCPS::ZeroCopyDataSeq< "
81 << sample_name
82 << ", DCPS_ZERO_COPY_SEQ_DEFAULT_SIZE> "
83 << node->local_name ()
84 << ";" << be_nl;
87 node->cli_hdr_gen (true);
88 return 0;