2 //=============================================================================
6 * Visitor generating code for Native in the client header
8 * @author Johnny Willemsen
10 //=============================================================================
13 #include "be_visitor_typecode/typecode_decl.h"
14 #include "global_extern.h"
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.
29 be_visitor_native_ch::visit_native (be_native
*node
)
31 if (node
->cli_hdr_gen () || node
->imported ())
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.
55 << "typedef ::TAO::DCPS::ZeroCopyInfoSeq< "
57 << ", DCPS_ZERO_COPY_SEQ_DEFAULT_SIZE> "
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)
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';
80 << "typedef ::TAO::DCPS::ZeroCopyDataSeq< "
82 << ", DCPS_ZERO_COPY_SEQ_DEFAULT_SIZE> "
83 << node
->local_name ()
87 node
->cli_hdr_gen (true);