Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / TAO_IDL / be / be_visitor_root / root.cpp
blobe2e0ec92fae9b3bf3ea5a623ccdc8c97745b3d4b
2 //=============================================================================
3 /**
4 * @file root.cpp
6 * Visitor generating code for the Root node. This is a generic visitor.
8 * @author Aniruddha Gokhale
9 */
10 //=============================================================================
12 #include "root.h"
14 // Generic Root visitor
15 be_visitor_root::be_visitor_root (be_visitor_context *ctx)
16 : be_visitor_module (ctx)
20 be_visitor_root::~be_visitor_root (void)
24 int
25 be_visitor_root::visit_module (be_module *node)
27 // Instantiate a visitor context with a copy of our context. This info
28 // will be modified based on what type of node we are visiting.
29 be_visitor_context ctx (*this->ctx_);
30 ctx.node (node);
31 int status = 0;
33 switch (this->ctx_->state ())
35 case TAO_CodeGen::TAO_ROOT_CH:
37 be_visitor_module_ch visitor (&ctx);
38 status = node->accept (&visitor);
39 break;
41 case TAO_CodeGen::TAO_ROOT_SH:
43 be_visitor_module_sh visitor (&ctx);
44 status = node->accept (&visitor);
45 break;
47 case TAO_CodeGen::TAO_ROOT_IH:
49 be_visitor_module_ih visitor (&ctx);
50 status = node->accept (&visitor);
51 break;
53 case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
54 case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
56 be_visitor_module_any_op visitor (&ctx);
57 status = node->accept (&visitor);
58 break;
60 case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
61 case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
63 be_visitor_module_cdr_op visitor (&ctx);
64 status = node->accept (&visitor);
65 break;
67 default:
69 be_visitor_module visitor (&ctx);
70 status = node->accept (&visitor);
71 break;
75 if (status == -1)
77 ACE_ERROR_RETURN ((LM_ERROR,
78 "(%N:%l) be_visitor_root::"
79 "visit_module - "
80 "failed to accept visitor\n"),
81 -1);
84 return 0;