2 //=============================================================================
6 * Visitor generating code for Enums in the client header
8 * @author Aniruddha Gokhale
10 //=============================================================================
13 #include "be_visitor_typecode/typecode_decl.h"
15 // ********************************************************************
16 // Visitor implementation for the Enum type
17 // This one for the client header file
18 // ********************************************************************
20 be_visitor_enum_ch::be_visitor_enum_ch (be_visitor_context
*ctx
)
21 : be_visitor_scope (ctx
)
25 // Visit the enum_ch node and its scope.
27 be_visitor_enum_ch::visit_enum (be_enum
*node
)
29 if (node
->cli_hdr_gen () || node
->imported ())
34 TAO_OutStream
*os
= this->ctx_
->stream ();
36 // Comma to be generated by the scope visitor.
37 this->ctx_
->comma (true);
39 TAO_INSERT_COMMENT (os
);
41 *os
<< "enum " << node
->local_name () << be_nl
;
42 *os
<< "{" << be_idt_nl
;
44 if (this->visit_scope (node
) == 1)
46 ACE_ERROR_RETURN ((LM_ERROR
,
47 ACE_TEXT ("be_visitor_enum_ch::")
48 ACE_TEXT ("visit_enum - ")
49 ACE_TEXT ("scope generation failed\n")),
54 *os
<< "};" << be_nl_2
;
56 // As per the ORBOS spec, we need the following typedef
57 *os
<< "typedef " << node
->local_name () << " &" << node
->local_name ()
60 if (be_global
->tc_support ())
62 be_visitor_context
ctx (*this->ctx_
);
63 be_visitor_typecode_decl
visitor (&ctx
);
65 if (node
->accept (&visitor
) == -1)
67 ACE_ERROR_RETURN ((LM_ERROR
,
68 ACE_TEXT ("be_visitor_enum_ch::")
69 ACE_TEXT ("visit_enum - ")
70 ACE_TEXT ("TypeCode declaration failed\n" )),
75 node
->cli_hdr_gen (true);
80 be_visitor_enum_ch::post_process (be_decl
*bd
)
82 TAO_OutStream
*os
= this->ctx_
->stream ();
85 if (!this->last_node (bd
))
94 be_visitor_enum_ch::visit_enum_val (be_enum_val
*node
)
96 TAO_OutStream
*os
= this->ctx_
->stream ();
98 *os
<< node
->local_name ();