Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / TAO_IDL / be / be_visitor_root / root_cs.cpp
blobc535e266697a3a657bf8f17ea3dfb9f59e189270
2 //=============================================================================
3 /**
4 * @file root_cs.cpp
6 * Visitor generating code for Root in the client stubs file.
8 * @author Aniruddha Gokhale
9 */
10 //=============================================================================
12 #include "root.h"
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 ()
23 int
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")),
31 -1);
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")),
39 -1);
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")),
49 -1);
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")),
59 -1);
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")),
69 -1);
73 (void) tao_cg->end_client_stubs ();
75 return 0;
78 int
79 be_visitor_root_cs::init ()
81 /// First open the client-side file for writing
82 int status =
83 tao_cg->start_client_stubs (
84 be_global->be_get_client_stub_fname ());
86 if (status == -1)
88 ACE_ERROR_RETURN ((LM_ERROR,
89 ACE_TEXT ("be_visitor_root_cs::init - ")
90 ACE_TEXT ("Error opening client source file\n")),
91 -1);
94 /// Initialize the stream.
95 this->ctx_->stream (tao_cg->client_stubs ());
96 return 0;
99 int
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)
111 int status = 0;
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 ();
128 return status;
132 be_visitor_root_cs::gen_cdr_ops (be_root *node)
134 int status = 0;
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);
144 return status;