blob: 2c0d915220986a135b64c74cd0b198e6399056d9 (
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
|
// -*- C++ -*-
//=============================================================================
/**
* @file alias_typecode.cpp
*
* $Id$
*
* Alias (typedef) TypeCode generation visitor.
*
* @author Ossama Othman <ossama@dre.vanderbilt.edu>
*/
//=============================================================================
TAO::be_visitor_alias_typecode::be_visitor_alias_typecode (
be_visitor_context * ctx)
: be_visitor_typecode_defn (ctx)
{
}
int
TAO::be_visitor_alias_typecode::visit_typedef (be_typedef * node)
{
be_type * const base = be_type::narrow_from_decl (node->base_type ());
TAO_OutStream & os = *this->ctx_->stream ();
os << be_nl << be_nl
<< "// TAO_IDL - Generated from" << be_nl
<< "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
// generate typecode for the base type
this->ctx_->sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE_NESTED);
if (!base || base->accept (this) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("(%N:%l) be_visitor_alias_typecode")
ACE_TEXT ("::visit_typedef) - ")
ACE_TEXT ("failed to generate base typecode\n")),
-1);
}
// Generate the alias TypeCode instantiation.
os
<< "static TAO::TypeCode::Alias<char const *," << be_nl
<< " TAO::Null_RefCount_Policy> const"
<< be_idt_nl
<< "_tao_tc_" << node->flat_name () << " (" << be_idt_nl
<< "\"" << node->repoID () << "\"," << be_nl
<< "\"" << node->original_local_name () << "\"," << be_nl
<< "&";
if (base->is_nested ()
&& base->defined_in ()->scope_node_type () == AST_Decl::NT_module)
{
be_module * const module =
be_module::narrow_from_scope (base->defined_in ());
ACE_ASSERT (module);
for (UTL_IdListActiveIterator i (module->name ());
!i.is_done ();
i.next ())
{
char * const module_name = i.item ()->get_string ();
if (ACE_OS::strcmp (module_name, "") != 0)
{
os << "::";
}
os << module_name;
}
os << "::_tao_tc_" << base->flat_name ();
}
else
os << "&" << base->tc_name ();
os << ");" << be_uidt_nl
<< be_uidt_nl;
return this->gen_typecode_ptr (node);
}
|