blob: 5fc92908f1b6f0438825b364c8e45c2fdfae1af8 (
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
|
//
// $Id$
//
// ============================================================================
//
// = LIBRARY
// TAO IDL
//
// = FILENAME
// be_visitor_decl.cpp
//
// = DESCRIPTION
// Visitor for the base be_decl node. This serves to maintain the current
// state (context) of code generation for the derived visitor.
//
// = AUTHOR
// Aniruddha Gokhale
//
// ============================================================================
#include "be_visitor_decl.h"
#include "be_visitor_sequence.h"
#include "be_visitor_context.h"
#include "be_typedef.h"
#include "be_type.h"
ACE_RCSID (be,
be_visitor_decl,
"$Id$")
// Root visitor for client header
be_visitor_decl::be_visitor_decl (be_visitor_context *ctx)
: ctx_ (ctx)
{
}
be_visitor_decl::~be_visitor_decl (void)
{
// delete this->ctx_;
}
int
be_visitor_decl::gen_anonymous_base_type (be_type *bt,
TAO_CodeGen::CG_STATE cg_state)
{
be_typedef *tdef = be_typedef::narrow_from_decl (bt);
if (!tdef)
{
be_visitor_context ctx (*this->ctx_);
ctx.state (cg_state);
// In case our container was typedef'd.
ctx.tdef (0);
int status = 0;
switch (cg_state)
{
case TAO_CodeGen::TAO_SEQUENCE_CH:
{
be_visitor_sequence_ch visitor (&ctx);
status = bt->accept (&visitor);
break;
}
case TAO_CodeGen::TAO_SEQUENCE_CI:
{
be_visitor_sequence_ci visitor (&ctx);
status = bt->accept (&visitor);
break;
}
case TAO_CodeGen::TAO_SEQUENCE_CS:
{
be_visitor_sequence_cs visitor (&ctx);
status = bt->accept (&visitor);
break;
}
case TAO_CodeGen::TAO_SEQUENCE_CDR_OP_CS:
{
be_visitor_sequence_cdr_op_cs visitor (&ctx);
status = bt->accept (&visitor);
break;
}
default:
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_decl::"
"gen_anonymous_base_type - "
"bad context state\n"),
-1);
}
if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_decl::"
"gen_anonymous_base_type - "
"anonymous base type codegen failed\n"),
-1);
}
}
return 0;
}
|