2 //=============================================================================
6 * Visitor generating code for Union in the client inline file
8 * @author Aniruddha Gokhale
10 //=============================================================================
14 be_visitor_union_ci::be_visitor_union_ci (be_visitor_context
*ctx
)
15 : be_visitor_union (ctx
)
19 be_visitor_union_ci::~be_visitor_union_ci ()
23 int be_visitor_union_ci::visit_union (be_union
*node
)
25 if (node
->cli_inline_gen () || node
->imported ())
30 be_visitor_context
ctx (*this->ctx_
);
33 TAO_OutStream
*os
= this->ctx_
->stream ();
35 TAO_INSERT_COMMENT (os
);
37 *os
<< "// *************************************************************"
39 *os
<< "// Inline operations for union " << node
->name () << be_nl
;
40 *os
<< "// *************************************************************";
42 // the discriminant type may have to be defined here if it was an enum
43 // declaration inside of the union statement.
45 be_type
*bt
= dynamic_cast<be_type
*> (node
->disc_type ());
49 ACE_ERROR_RETURN ((LM_ERROR
,
50 "(%N:%l) be_visitor_union_ci::"
52 "bad discriminant type\n"),
56 be_visitor_union_discriminant_ci
visitor (&ctx
);
58 if (bt
->accept (&visitor
) == -1)
60 ACE_ERROR_RETURN ((LM_ERROR
,
61 "(%N:%l) be_visitor_union_ci::"
63 "codegen for discrminant failed\n"),
67 // Now generate the implementation of the access methods for the
68 // union. For this set our state.
69 if (this->visit_scope (node
) == -1)
71 ACE_ERROR_RETURN ((LM_ERROR
,
72 "(%N:%l) be_visitor_union_ci::"
74 "codegen for scope failed\n"),
78 node
->cli_inline_gen (true);