2 //=============================================================================
6 * Visitor generating code for Root in the client stubs file.
8 * @author Aniruddha Gokhale
10 //=============================================================================
14 be_visitor_root_cs::be_visitor_root_cs (be_visitor_context
*ctx
)
15 : be_visitor_root (ctx
)
19 be_visitor_root_cs::~be_visitor_root_cs ()
24 be_visitor_root_cs::visit_root (be_root
*node
)
26 if (this->init () == -1)
28 ACE_ERROR_RETURN ((LM_ERROR
,
29 ACE_TEXT ("be_visitor_root_cs::init - ")
30 ACE_TEXT ("failed to initialize\n")),
34 if (this->visit_scope (node
) == -1)
36 ACE_ERROR_RETURN ((LM_ERROR
,
37 ACE_TEXT ("be_visitor_root_cs::visit_root - ")
38 ACE_TEXT ("codegen for scope failed\n")),
43 if (this->gen_obv_defns (node
) == -1)
45 ACE_ERROR_RETURN ((LM_ERROR
,
46 ACE_TEXT ("be_visitor_root_cs::")
47 ACE_TEXT ("visit_root - ")
48 ACE_TEXT ("failed to generate OBV_ defns\n")),
53 if (this->gen_any_ops (node
) == -1)
55 ACE_ERROR_RETURN ((LM_ERROR
,
56 ACE_TEXT ("be_visitor_root_cs::")
57 ACE_TEXT ("visit_root - failed to ")
58 ACE_TEXT ("generate Any operators\n")),
63 if (this->gen_cdr_ops (node
) == -1)
65 ACE_ERROR_RETURN ((LM_ERROR
,
66 ACE_TEXT ("be_visitor_root_cs::")
67 ACE_TEXT ("visit_root - failed to ")
68 ACE_TEXT ("generate CDR operators\n")),
73 (void) tao_cg
->end_client_stubs ();
79 be_visitor_root_cs::init ()
81 /// First open the client-side file for writing
83 tao_cg
->start_client_stubs (
84 be_global
->be_get_client_stub_fname ());
88 ACE_ERROR_RETURN ((LM_ERROR
,
89 ACE_TEXT ("be_visitor_root_cs::init - ")
90 ACE_TEXT ("Error opening client source file\n")),
94 /// Initialize the stream.
95 this->ctx_
->stream (tao_cg
->client_stubs ());
100 be_visitor_root_cs::gen_obv_defns (be_root
*node
)
102 be_visitor_context ctx
= *this->ctx_
;
103 ctx
.state (TAO_CodeGen::TAO_MODULE_OBV_CS
);
104 be_visitor_obv_module
obv_visitor (&ctx
);
105 return obv_visitor
.visit_scope (node
);
109 be_visitor_root_cs::gen_any_ops (be_root
*node
)
113 if (be_global
->any_support ())
115 be_visitor_context ctx
= *this->ctx_
;
116 ctx
.state (TAO_CodeGen::TAO_ROOT_ANY_OP_CS
);
117 be_visitor_root_any_op
any_op_visitor (&ctx
);
118 status
= node
->accept (&any_op_visitor
);
121 /// Conditional switch to the *A.cpp stream is done
122 /// in the visitor constructor.
123 if (be_global
->gen_anyop_files ())
125 (void) tao_cg
->end_anyop_source ();
132 be_visitor_root_cs::gen_cdr_ops (be_root
*node
)
136 if (be_global
->cdr_support ())
138 be_visitor_context ctx
= *this->ctx_
;
139 ctx
.state (TAO_CodeGen::TAO_ROOT_CDR_OP_CS
);
140 be_visitor_root_cdr_op
visitor (&ctx
);
141 status
= node
->accept (&visitor
);