Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / TAO_IDL / be / be_visitor_exception / exception.cpp
blobf1e7c6b5fdb5688ab270b9dcd2d99bef04928432
2 //=============================================================================
3 /**
4 * @file exception.cpp
6 * Generic visitor generating code for Exceptions.
8 * @author Aniruddha Gokhale
9 */
10 //=============================================================================
12 #include "exception.h"
14 // Generic exception visitor.
15 be_visitor_exception::be_visitor_exception (be_visitor_context *ctx)
16 : be_visitor_scope (ctx)
20 be_visitor_exception::~be_visitor_exception ()
24 // Visit the Exception node and its scope.
25 int
26 be_visitor_exception::visit_exception (be_exception *)
28 // Must be overriden.
29 return -1;
32 int
33 be_visitor_exception::visit_field (be_field *node)
35 // Instantiate a visitor context with a copy of our context. This info
36 // will be modified based on what type of node we are visiting.
37 be_visitor_context ctx (*this->ctx_);
38 ctx.node (node);
39 int status = 0;
41 // This switch is acceptable rather than having derived visitors overriding
42 // this method and differing only in what state they set
44 switch (this->ctx_->state ())
46 case TAO_CodeGen::TAO_ROOT_CH:
47 case TAO_CodeGen::TAO_INTERFACE_CH:
49 be_visitor_field_ch visitor (&ctx);
50 status = node->accept (&visitor);
51 break;
53 case TAO_CodeGen::TAO_ROOT_CI:
55 be_visitor_field_ci visitor (&ctx);
56 status = node->accept (&visitor);
57 break;
59 case TAO_CodeGen::TAO_ROOT_CS:
61 be_visitor_field_cs visitor (&ctx);
62 status = node->accept (&visitor);
63 break;
65 case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
67 be_visitor_field_cdr_op_ch visitor (&ctx);
68 status = node->accept (&visitor);
69 break;
71 case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
73 be_visitor_field_cdr_op_cs visitor (&ctx);
74 status = node->accept (&visitor);
75 break;
77 default:
79 ACE_ERROR_RETURN ((LM_ERROR,
80 "(%N:%l) be_visitor_exception::"
81 "visit_field - "
82 "Bad context state\n"),
83 -1);
87 if (status == -1)
89 ACE_ERROR_RETURN ((LM_ERROR,
90 "(%N:%l) be_visitor_exception::"
91 "visit_field - "
92 "failed to accept visitor\n"),
93 -1);
96 return 0;