blob: 5cae9b040cdb3c65f2f859237e3aa0dfadb3dd59 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
//=============================================================================
/**
* @file native_ch.cpp
*
* $Id$
*
* Visitor generating code for Native in the client header
*
*
* @author Johnny Willemsen
*/
//=============================================================================
#include "be_visitor_typecode/typecode_decl.h"
#include "global_extern.h"
// ********************************************************************
// Visitor implementation for the Native type
// This one for the client header file
// ********************************************************************
be_visitor_native_ch::be_visitor_native_ch (be_visitor_context *ctx)
: be_visitor_scope (ctx)
{
}
be_visitor_native_ch::~be_visitor_native_ch (void)
{
}
// Visit the native_ch node and its scope.
int
be_visitor_native_ch::visit_native (be_native *node)
{
if (node->cli_hdr_gen () || node->imported ())
{
return 0;
}
TAO_OutStream *os = this->ctx_->stream ();
*os << be_nl_2
<< "// TAO_IDL - Generated from" << be_nl
<< "// " << __FILE__ << ":" << __LINE__
<< be_nl_2;
const char *node_name = node->full_name ();
const char *dds_suffix = be_global->opendds_sequence_suffix ();
const size_t dds_suffix_len = ACE_OS::strlen (dds_suffix);
if (ACE_OS::strcmp (node_name, "PortableServer::ServantLocator::Cookie") == 0)
{
*os << "typedef void *Cookie;" << be_nl;
}
else if (ACE_OS::strcmp (node_name, "CORBA::VoidData") == 0)
{
*os << "typedef void *VoidData;" << be_nl;
}
else if (idl_global->dcps_support_zero_copy_read ()
&& 0 == ACE_OS::strcmp (node->full_name (),"DDS::SampleInfoSeq"))
{
// DDS/DCPS zero-copy read sequence type support.
*os << be_nl_2
<< "typedef ::TAO::DCPS::ZeroCopyInfoSeq< "
<< "SampleInfo"
<< ", DCPS_ZERO_COPY_SEQ_DEFAULT_SIZE> "
<< "SampleInfo"
<< "Seq;" << be_nl;
}
else if (idl_global->dcps_support_zero_copy_read ()
&& ACE_OS::strlen (node_name) > dds_suffix_len
&& 0 == ACE_OS::strcmp (node_name + ACE_OS::strlen (node_name) -
dds_suffix_len, dds_suffix) )
{
// DDS/DCPS zero-copy read sequence type support.
// strip the "Seq" ending to get the sample's name
const size_t max_name_length = 2000;
if (ACE_OS::strlen (node_name) >= max_name_length)
{
return -1;
}
char sample_name[max_name_length];
ACE_OS::strncpy (sample_name,
node_name,
ACE_OS::strlen (node_name) - dds_suffix_len);
sample_name[ACE_OS::strlen (node_name) - dds_suffix_len] = '\0';
*os << be_nl_2
<< "typedef ::TAO::DCPS::ZeroCopyDataSeq< "
<< sample_name
<< ", DCPS_ZERO_COPY_SEQ_DEFAULT_SIZE> "
<< node->local_name ()
<< ";" << be_nl;
}
node->cli_hdr_gen (true);
return 0;
}
|