Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / TAO_IDL / be / be_visitor_module / module.cpp
blob5cd0cf15ed2297f5407e1fb3d509314c8c7a3a9b
2 //=============================================================================
3 /**
4 * @file module.cpp
6 * Generic visitor generating code for Module
8 * @author Aniruddha Gokhale
9 */
10 //=============================================================================
12 #include "module.h"
14 be_visitor_module::be_visitor_module (be_visitor_context *ctx)
15 : be_visitor_scope (ctx)
19 be_visitor_module::~be_visitor_module (void)
23 int
24 be_visitor_module::visit_module (be_module *node)
26 if (node->nmembers () == 0)
28 idl_global->err ()->error1 (UTL_Error::EIDL_EMPTY_MODULE,
29 node);
32 if (this->visit_scope (node) == -1)
34 ACE_ERROR_RETURN ((LM_ERROR,
35 ACE_TEXT ("be_visitor_module::visit_module - ")
36 ACE_TEXT ("codegen for scope failed\n")),
37 -1);
40 return 0;
43 int
44 be_visitor_module::visit_constant (be_constant *node)
46 // Instantiate a visitor context with a copy of our context. This info
47 // will be modified based on what type of node we are visiting.
48 be_visitor_context ctx (*this->ctx_);
49 ctx.node (node);
50 int status = 0;
52 switch (this->ctx_->state ())
54 case TAO_CodeGen::TAO_ROOT_CH:
56 be_visitor_constant_ch visitor (&ctx);
57 status = node->accept (&visitor);
58 break;
60 case TAO_CodeGen::TAO_ROOT_CS:
62 be_visitor_constant_cs visitor (&ctx);
63 status = node->accept (&visitor);
64 break;
66 default:
67 return 0; // nothing to be done
70 if (status == -1)
72 ACE_ERROR_RETURN ((LM_ERROR,
73 ACE_TEXT ("be_visitor_module::")
74 ACE_TEXT ("visit_constant - ")
75 ACE_TEXT ("failed to accept visitor\n")),
76 -1);
79 return 0;
82 int
83 be_visitor_module::visit_native (be_native *node)
85 // Instantiate a visitor context with a copy of our context. This info
86 // will be modified based on what type of node we are visiting
87 be_visitor_context ctx (*this->ctx_);
88 ctx.node (node);
89 int status = 0;
91 switch (this->ctx_->state ())
93 case TAO_CodeGen::TAO_ROOT_CH:
95 be_visitor_native_ch visitor (&ctx);
96 status = node->accept (&visitor);
97 break;
99 default:
100 return 0; // nothing to be done
103 if (status == -1)
105 ACE_ERROR_RETURN ((LM_ERROR,
106 ACE_TEXT ("be_visitor_module::::")
107 ACE_TEXT ("visit_native - ")
108 ACE_TEXT ("failed to accept visitor\n")),
109 -1);
112 return 0;
116 be_visitor_module::visit_enum (be_enum *node)
118 // Instantiate a visitor context with a copy of our context. This info
119 // will be modified based on what type of node we are visiting.
120 be_visitor_context ctx (*this->ctx_);
121 ctx.node (node);
122 int status = 0;
124 switch (this->ctx_->state ())
126 case TAO_CodeGen::TAO_ROOT_CH:
128 be_visitor_enum_ch visitor (&ctx);
129 status = node->accept (&visitor);
130 break;
132 case TAO_CodeGen::TAO_ROOT_CS:
134 be_visitor_enum_cs visitor (&ctx);
135 status = node->accept (&visitor);
136 break;
138 case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
140 be_visitor_enum_any_op_ch visitor (&ctx);
141 status = node->accept (&visitor);
142 break;
144 case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
146 be_visitor_enum_any_op_cs visitor (&ctx);
147 status = node->accept (&visitor);
148 break;
150 case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
152 be_visitor_enum_cdr_op_ch visitor (&ctx);
153 status = node->accept (&visitor);
154 break;
156 case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
158 be_visitor_enum_cdr_op_cs visitor (&ctx);
159 status = node->accept (&visitor);
160 break;
162 default:
163 return 0; // nothing to be done
166 if (status == -1)
168 ACE_ERROR_RETURN ((LM_ERROR,
169 ACE_TEXT ("be_visitor_module::")
170 ACE_TEXT ("visit_enum - ")
171 ACE_TEXT ("failed to accept visitor\n")),
172 -1);
175 return 0;
179 be_visitor_module::visit_exception (be_exception *node)
181 // Instantiate a visitor context with a copy of our context. This info
182 // will be modified based on what type of node we are visiting.
183 be_visitor_context ctx (*this->ctx_);
184 ctx.node (node);
185 int status = 0;
187 switch (this->ctx_->state ())
189 case TAO_CodeGen::TAO_ROOT_CH:
191 be_visitor_exception_ch visitor (&ctx);
192 status = node->accept (&visitor);
193 break;
195 case TAO_CodeGen::TAO_ROOT_CI:
197 be_visitor_exception_ci visitor (&ctx);
198 status = node->accept (&visitor);
199 break;
201 case TAO_CodeGen::TAO_ROOT_CS:
203 be_visitor_exception_cs visitor (&ctx);
204 status = node->accept (&visitor);
205 break;
207 case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
209 be_visitor_exception_any_op_ch visitor (&ctx);
210 status = node->accept (&visitor);
211 break;
213 case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
215 be_visitor_exception_any_op_cs visitor (&ctx);
216 status = node->accept (&visitor);
217 break;
219 case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
221 be_visitor_exception_cdr_op_ch visitor (&ctx);
222 status = node->accept (&visitor);
223 break;
225 case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
227 be_visitor_exception_cdr_op_cs visitor (&ctx);
228 status = node->accept (&visitor);
229 break;
231 default:
232 return 0; // nothing to be done
235 if (status == -1)
237 ACE_ERROR_RETURN ((LM_ERROR,
238 ACE_TEXT ("be_visitor_module::")
239 ACE_TEXT ("visit_exception - ")
240 ACE_TEXT ("failed to accept visitor\n")),
241 -1);
244 return 0;
248 be_visitor_module::visit_interface (be_interface *node)
250 be_visitor_context ctx (*this->ctx_);
251 ctx.node (node);
252 int status = 1;
254 switch (this->ctx_->state ())
256 case TAO_CodeGen::TAO_ROOT_CH:
258 ctx.state (TAO_CodeGen::TAO_INTERFACE_CH);
259 be_visitor_interface_ch visitor (&ctx);
260 status = node->accept (&visitor);
261 break;
263 case TAO_CodeGen::TAO_ROOT_CI:
265 be_visitor_interface_ci visitor (&ctx);
266 status = node->accept (&visitor);
267 break;
269 case TAO_CodeGen::TAO_ROOT_CS:
271 be_visitor_interface_cs visitor (&ctx);
272 status = node->accept (&visitor);
273 break;
275 case TAO_CodeGen::TAO_ROOT_SH:
277 be_visitor_interface_sh visitor (&ctx);
278 status = node->accept (&visitor);
279 break;
281 case TAO_CodeGen::TAO_ROOT_IH:
283 be_visitor_interface_ih visitor (&ctx);
284 status = node->accept (&visitor);
285 break;
287 case TAO_CodeGen::TAO_ROOT_SS:
289 be_visitor_interface_ss visitor (&ctx);
290 status = node->accept (&visitor);
291 break;
293 case TAO_CodeGen::TAO_ROOT_IS:
295 be_visitor_interface_is visitor (&ctx);
296 status = node->accept (&visitor);
297 break;
299 case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
301 be_visitor_interface_any_op_ch visitor (&ctx);
302 status = node->accept (&visitor);
303 break;
305 case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
307 be_visitor_interface_any_op_cs visitor (&ctx);
308 status = node->accept (&visitor);
309 break;
311 case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
313 be_visitor_interface_cdr_op_ch visitor (&ctx);
314 status = node->accept (&visitor);
315 break;
317 case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
319 be_visitor_interface_cdr_op_cs visitor (&ctx);
320 status = node->accept (&visitor);
321 break;
323 case TAO_CodeGen::TAO_ROOT_EX_IDL:
325 be_visitor_interface_ex_idl visitor (&ctx);
326 status = node->accept (&visitor);
327 break;
329 case TAO_CodeGen::TAO_ROOT_SVTH:
331 be_visitor_interface_svth visitor (&ctx);
332 status = node->accept (&visitor);
333 break;
335 case TAO_CodeGen::TAO_ROOT_SVTS:
337 be_visitor_interface_svts visitor (&ctx);
338 status = node->accept (&visitor);
339 break;
341 case TAO_CodeGen::TAO_ROOT_SVH:
342 case TAO_CodeGen::TAO_ROOT_SVS:
343 case TAO_CodeGen::TAO_ROOT_EXH:
344 case TAO_CodeGen::TAO_ROOT_EXS:
345 case TAO_CodeGen::TAO_ROOT_CNH:
346 case TAO_CodeGen::TAO_ROOT_CNS:
348 // Nothing to be done for these cases.
349 return 0;
350 break;
352 default:
354 ACE_ERROR_RETURN ((LM_ERROR,
355 ACE_TEXT ("be_visitor_module::")
356 ACE_TEXT ("visit_interface - ")
357 ACE_TEXT ("Bad context state\n")),
358 -1);
362 if (status == 0)
364 return 0;
366 else if (status == -1)
368 ACE_ERROR_RETURN ((LM_ERROR,
369 ACE_TEXT ("be_visitor_module::")
370 ACE_TEXT ("visit_interface - ")
371 ACE_TEXT ("failed to accept visitor\n")),
372 -1);
375 ctx.state (TAO_CodeGen::TAO_ROOT_CH);
376 return 0;
380 be_visitor_module::visit_interface_fwd (be_interface_fwd *node)
382 // Instantiate a visitor context with a copy of our context. This info
383 // will be modified based on what type of node we are visiting.
384 be_visitor_context ctx (*this->ctx_);
385 ctx.node (node);
386 int status = 0;
388 switch (this->ctx_->state ())
390 case TAO_CodeGen::TAO_ROOT_CH:
392 be_visitor_interface_fwd_ch visitor (&ctx);
393 status = node->accept (&visitor);
394 break;
396 case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
398 be_visitor_interface_fwd_any_op_ch visitor (&ctx);
399 status = node->accept (&visitor);
400 break;
402 case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
404 be_visitor_interface_fwd_cdr_op_ch visitor (&ctx);
405 status = node->accept (&visitor);
406 break;
408 default:
409 return 0; // nothing to be done
412 if (status == -1)
414 ACE_ERROR_RETURN ((LM_ERROR,
415 ACE_TEXT ("be_visitor_module::")
416 ACE_TEXT ("visit_interface_fwd - ")
417 ACE_TEXT ("failed to accept visitor\n")),
418 -1);
421 return 0;
425 be_visitor_module::visit_valuebox (be_valuebox *node)
427 // Instantiate a visitor context with a copy of our context. This info
428 // will be modified based on what type of node we are visiting.
429 be_visitor_context ctx (*this->ctx_);
430 ctx.node (node);
431 int status = 0;
433 switch (this->ctx_->state ())
435 case TAO_CodeGen::TAO_ROOT_CH:
437 be_visitor_valuebox_ch visitor (&ctx);
438 status = node->accept (&visitor);
439 break;
441 case TAO_CodeGen::TAO_ROOT_CI:
443 be_visitor_valuebox_ci visitor (&ctx);
444 status = node->accept (&visitor);
445 break;
447 case TAO_CodeGen::TAO_ROOT_CS:
449 be_visitor_valuebox_cs visitor (&ctx);
450 status = node->accept (&visitor);
451 break;
453 case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
455 be_visitor_valuebox_cdr_op_ch visitor (&ctx);
456 status = node->accept (&visitor);
457 break;
459 case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
461 be_visitor_valuebox_cdr_op_cs visitor (&ctx);
462 status = node->accept (&visitor);
463 break;
465 case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
467 be_visitor_valuebox_any_op_ch visitor (&ctx);
468 status = node->accept (&visitor);
469 break;
471 case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
473 be_visitor_valuebox_any_op_cs visitor (&ctx);
474 status = node->accept (&visitor);
475 break;
477 case TAO_CodeGen::TAO_ROOT_SH:
478 case TAO_CodeGen::TAO_ROOT_SS:
480 break;
482 default:
483 return 0; // nothing to do.
486 if (status == -1)
488 ACE_ERROR_RETURN ((LM_ERROR,
489 ACE_TEXT ("be_visitor_module::")
490 ACE_TEXT ("visit_valuebox - ")
491 ACE_TEXT ("failed to accept visitor\n")),
492 -1);
495 return 0;
499 be_visitor_module::visit_valuetype (be_valuetype *node)
501 // Instantiate a visitor context with a copy of our context. This info
502 // will be modified based on what type of node we are visiting
503 be_visitor_context ctx (*this->ctx_);
504 ctx.node (node);
505 int status = 0;
507 switch (this->ctx_->state ())
509 case TAO_CodeGen::TAO_ROOT_CH:
511 be_visitor_valuetype_ch visitor (&ctx);
512 status = node->accept (&visitor);
513 break;
515 case TAO_CodeGen::TAO_ROOT_CI:
517 be_visitor_valuetype_ci visitor (&ctx);
518 status = node->accept (&visitor);
519 break;
521 case TAO_CodeGen::TAO_ROOT_CS:
523 be_visitor_valuetype_cs visitor (&ctx);
524 status = node->accept (&visitor);
525 break;
527 case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
529 be_visitor_valuetype_cdr_op_ch visitor (&ctx);
530 status = node->accept (&visitor);
531 break;
533 case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
535 be_visitor_valuetype_cdr_op_cs visitor (&ctx);
536 status = node->accept (&visitor);
537 break;
539 case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
541 be_visitor_valuetype_any_op_ch visitor (&ctx);
542 status = node->accept (&visitor);
543 break;
545 case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
547 be_visitor_valuetype_any_op_cs visitor (&ctx);
548 status = node->accept (&visitor);
549 break;
551 case TAO_CodeGen::TAO_ROOT_SH:
553 be_visitor_valuetype_sh visitor (&ctx);
554 status = node->accept (&visitor);
555 break;
557 case TAO_CodeGen::TAO_ROOT_SS:
559 be_visitor_valuetype_ss visitor (&ctx);
560 status = node->accept (&visitor);
561 break;
563 default:
564 return 0; // nothing to do.
567 if (status == -1)
569 ACE_ERROR_RETURN ((LM_ERROR,
570 ACE_TEXT ("be_visitor_module::")
571 ACE_TEXT ("visit_valuetype - ")
572 ACE_TEXT ("failed to accept visitor\n")),
573 -1);
576 return 0;
580 be_visitor_module::visit_valuetype_fwd (be_valuetype_fwd *node)
582 // Instantiate a visitor context with a copy of our context. This info
583 // will be modified based on what type of node we are visiting.
584 be_visitor_context ctx (*this->ctx_);
585 ctx.node (node);
586 int status = 0;
588 switch (this->ctx_->state ())
590 case TAO_CodeGen::TAO_ROOT_CH:
592 be_visitor_valuetype_fwd_ch visitor (&ctx);
593 status = node->accept (&visitor);
594 break;
596 case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
598 be_visitor_valuetype_fwd_any_op_ch visitor (&ctx);
599 status = node->accept (&visitor);
600 break;
602 case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
604 be_visitor_valuetype_fwd_cdr_op_ch visitor (&ctx);
605 status = node->accept (&visitor);
606 break;
608 default:
609 return 0; // nothing to be done
612 if (status == -1)
614 ACE_ERROR_RETURN ((LM_ERROR,
615 ACE_TEXT ("be_visitor_module::")
616 ACE_TEXT ("visit_valuetype_fwd - ")
617 ACE_TEXT ("failed to accept visitor\n")),
618 -1);
621 return 0;
625 be_visitor_module::visit_eventtype (be_eventtype *node)
627 return this->visit_valuetype (node);
631 be_visitor_module::visit_eventtype_fwd (be_eventtype_fwd *node)
633 return this->visit_valuetype_fwd (node);
637 be_visitor_module::visit_component (be_component *node)
639 // Instantiate a visitor context with a copy of our context. This info
640 // will be modified based on what type of node we are visiting
641 be_visitor_context ctx (*this->ctx_);
642 ctx.node (node);
643 int status = 0;
645 switch (this->ctx_->state ())
647 // These cases all behave like interfaces.
648 case TAO_CodeGen::TAO_ROOT_CH:
649 case TAO_CodeGen::TAO_ROOT_CI:
650 case TAO_CodeGen::TAO_ROOT_CS:
651 case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
652 case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
653 case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
654 case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
655 case TAO_CodeGen::TAO_ROOT_SH:
656 case TAO_CodeGen::TAO_ROOT_SS:
657 return this->visit_interface (node);
659 // Nothing for these with components.
660 case TAO_CodeGen::TAO_ROOT_IH:
661 case TAO_CodeGen::TAO_ROOT_IS:
662 case TAO_CodeGen::TAO_ROOT_CNH:
663 case TAO_CodeGen::TAO_ROOT_CNS:
664 break;
665 case TAO_CodeGen::TAO_ROOT_SVTH:
667 be_visitor_component_svth visitor (&ctx);
668 status = node->accept (&visitor);
669 break;
671 case TAO_CodeGen::TAO_ROOT_SVTS:
673 be_visitor_component_svts visitor (&ctx);
674 status = node->accept (&visitor);
675 break;
677 case TAO_CodeGen::TAO_ROOT_SVH:
679 be_visitor_component_svh visitor (&ctx);
680 status = node->accept (&visitor);
681 break;
683 case TAO_CodeGen::TAO_ROOT_SVS:
685 be_visitor_component_svs visitor (&ctx);
686 status = node->accept (&visitor);
687 break;
689 case TAO_CodeGen::TAO_ROOT_EXH:
691 be_visitor_component_exh visitor (&ctx);
692 status = node->accept (&visitor);
693 break;
695 case TAO_CodeGen::TAO_ROOT_EXS:
697 be_visitor_component_exs visitor (&ctx);
698 status = node->accept (&visitor);
699 break;
701 case TAO_CodeGen::TAO_ROOT_EX_IDL:
703 be_visitor_component_ex_idl visitor (&ctx);
704 status = node->accept (&visitor);
705 break;
707 default:
709 ACE_ERROR_RETURN ((LM_ERROR,
710 ACE_TEXT ("be_visitor_module::")
711 ACE_TEXT ("visit_component - ")
712 ACE_TEXT ("Bad context state\n")),
713 -1);
717 if (status == -1)
719 ACE_ERROR_RETURN ((LM_ERROR,
720 ACE_TEXT ("be_visitor_module::")
721 ACE_TEXT ("visit_component - ")
722 ACE_TEXT ("failed to accept visitor\n")),
723 -1);
726 return 0;
730 be_visitor_module::visit_component_fwd (be_component_fwd *node)
732 // Instantiate a visitor context with a copy of our context. This info
733 // will be modified based on what type of node we are visiting.
734 be_visitor_context ctx (*this->ctx_);
735 ctx.node (node);
736 int status = 0;
738 switch (this->ctx_->state ())
740 case TAO_CodeGen::TAO_ROOT_CH:
742 be_visitor_component_fwd_ch visitor (&ctx);
743 status = node->accept (&visitor);
744 break;
746 case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
748 be_visitor_component_fwd_any_op_ch visitor (&ctx);
749 status = node->accept (&visitor);
750 break;
752 case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
754 be_visitor_component_fwd_cdr_op_ch visitor (&ctx);
755 status = node->accept (&visitor);
756 break;
758 default:
759 return 0; // nothing to be done
762 if (status == -1)
764 ACE_ERROR_RETURN ((LM_ERROR,
765 ACE_TEXT ("be_visitor_module::")
766 ACE_TEXT ("visit_component_fwd - ")
767 ACE_TEXT ("failed to accept visitor\n")),
768 -1);
771 return 0;
775 be_visitor_module::visit_home (be_home *node)
777 // Instantiate a visitor context with a copy of our context. This info
778 // will be modified based on what type of node we are visiting.
779 be_visitor_context ctx (*this->ctx_);
780 ctx.node (node);
781 int status = 0;
783 switch (this->ctx_->state ())
785 case TAO_CodeGen::TAO_ROOT_SVH:
787 be_visitor_home_svh visitor (&ctx);
788 status = node->accept (&visitor);
789 break;
791 case TAO_CodeGen::TAO_ROOT_SVS:
793 be_visitor_home_svs visitor (&ctx);
794 status = node->accept (&visitor);
795 break;
797 case TAO_CodeGen::TAO_ROOT_EX_IDL:
799 be_visitor_home_ex_idl visitor (&ctx);
800 status = node->accept (&visitor);
801 break;
803 case TAO_CodeGen::TAO_ROOT_EXH:
805 be_visitor_home_exh visitor (&ctx);
806 status = node->accept (&visitor);
807 break;
809 case TAO_CodeGen::TAO_ROOT_EXS:
811 be_visitor_home_exs visitor (&ctx);
812 status = node->accept (&visitor);
813 break;
815 default:
816 return 0; // nothing to be done
819 if (status == -1)
821 ACE_ERROR_RETURN ((LM_ERROR,
822 ACE_TEXT ("be_visitor_module::")
823 ACE_TEXT ("visit_home - ")
824 ACE_TEXT ("failed to accept visitor\n")),
825 -1);
828 return 0;
832 be_visitor_module::visit_connector (be_connector *node)
834 // Instantiate a visitor context with a copy of our context. This info
835 // will be modified based on what type of node we are visiting.
836 be_visitor_context ctx (*this->ctx_);
837 ctx.node (node);
838 int status = 0;
840 switch (this->ctx_->state ())
842 case TAO_CodeGen::TAO_ROOT_CNH:
844 if (node->ami_connector ())
846 be_visitor_connector_ami_exh visitor (&ctx);
847 status = node->accept (&visitor);
849 else if (node->dds_connector ())
851 be_visitor_connector_dds_exh visitor (&ctx);
852 status = node->accept (&visitor);
854 break;
856 case TAO_CodeGen::TAO_ROOT_CNS:
858 if (node->ami_connector ())
860 be_visitor_connector_ami_exs visitor (&ctx);
861 status = node->accept (&visitor);
863 else if (node->dds_connector ())
865 be_visitor_connector_dds_exs visitor (&ctx);
866 status = node->accept (&visitor);
868 break;
870 // Skip these contexts, the connector impl is
871 // generated in a separate pass, using the context states
872 // above.
873 case TAO_CodeGen::TAO_ROOT_EXH:
874 case TAO_CodeGen::TAO_ROOT_EXS:
875 break;
876 default:
877 // In all other cases, same as component.
878 return this->visit_component (node);
881 if (status == -1)
883 ACE_ERROR_RETURN ((LM_ERROR,
884 ACE_TEXT ("be_visitor_module::")
885 ACE_TEXT ("visit_connector - ")
886 ACE_TEXT ("failed to accept visitor\n")),
887 -1);
890 return 0;
894 be_visitor_module::visit_structure (be_structure *node)
896 // Instantiate a visitor context with a copy of our context. This info
897 // will be modified based on what type of node we are visiting.
898 be_visitor_context ctx (*this->ctx_);
899 ctx.node (node);
900 int status = 0;
902 switch (this->ctx_->state ())
904 case TAO_CodeGen::TAO_ROOT_CH:
906 be_visitor_structure_ch visitor (&ctx);
907 status = node->accept (&visitor);
908 break;
910 case TAO_CodeGen::TAO_ROOT_CI:
912 be_visitor_structure_ci visitor (&ctx);
913 status = node->accept (&visitor);
914 break;
916 case TAO_CodeGen::TAO_ROOT_CS:
918 be_visitor_structure_cs visitor (&ctx);
919 status = node->accept (&visitor);
920 break;
922 case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
924 be_visitor_structure_any_op_ch visitor (&ctx);
925 status = node->accept (&visitor);
926 break;
928 case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
930 be_visitor_structure_any_op_cs visitor (&ctx);
931 status = node->accept (&visitor);
932 break;
934 case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
936 be_visitor_structure_cdr_op_ch visitor (&ctx);
937 status = node->accept (&visitor);
938 break;
940 case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
942 be_visitor_structure_cdr_op_cs visitor (&ctx);
943 status = node->accept (&visitor);
944 break;
946 default:
947 return 0; // nothing to be done
950 if (status == -1)
952 ACE_ERROR_RETURN ((LM_ERROR,
953 ACE_TEXT ("be_visitor_module::")
954 ACE_TEXT ("visit_structure - ")
955 ACE_TEXT ("failed to accept visitor\n")),
956 -1);
959 return 0;
963 be_visitor_module::visit_structure_fwd (be_structure_fwd *node)
965 // Instantiate a visitor context with a copy of our context. This info
966 // will be modified based on what type of node we are visiting.
967 be_visitor_context ctx (*this->ctx_);
968 ctx.node (node);
969 int status = 0;
971 switch (this->ctx_->state ())
973 case TAO_CodeGen::TAO_ROOT_CH:
975 be_visitor_structure_fwd_ch visitor (&ctx);
976 status = node->accept (&visitor);
977 break;
979 default:
980 return 0; // nothing to be done
983 if (status == -1)
985 ACE_ERROR_RETURN ((LM_ERROR,
986 ACE_TEXT ("be_visitor_module::")
987 ACE_TEXT ("visit_structure_fwd - ")
988 ACE_TEXT ("failed to accept visitor\n")),
989 -1);
992 return 0;
996 be_visitor_module::visit_union (be_union *node)
998 // Instantiate a visitor context with a copy of our context. This info
999 // will be modified based on what type of node we are visiting.
1000 be_visitor_context ctx (*this->ctx_);
1001 ctx.node (node);
1002 int status = 0;
1004 switch (this->ctx_->state ())
1006 case TAO_CodeGen::TAO_ROOT_CH:
1008 be_visitor_union_ch visitor (&ctx);
1009 status = node->accept (&visitor);
1010 break;
1012 case TAO_CodeGen::TAO_ROOT_CI:
1014 be_visitor_union_ci visitor (&ctx);
1015 status = node->accept (&visitor);
1016 break;
1018 case TAO_CodeGen::TAO_ROOT_CS:
1020 be_visitor_union_cs visitor (&ctx);
1021 status = node->accept (&visitor);
1022 break;
1024 case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
1026 be_visitor_union_any_op_ch visitor (&ctx);
1027 status = node->accept (&visitor);
1028 break;
1030 case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
1032 be_visitor_union_any_op_cs visitor (&ctx);
1033 status = node->accept (&visitor);
1034 break;
1036 case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
1038 be_visitor_union_cdr_op_ch visitor (&ctx);
1039 status = node->accept (&visitor);
1040 break;
1042 case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
1044 be_visitor_union_cdr_op_cs visitor (&ctx);
1045 status = node->accept (&visitor);
1046 break;
1048 default:
1049 return 0; // nothing to be done
1052 if (status == -1)
1054 ACE_ERROR_RETURN ((LM_ERROR,
1055 ACE_TEXT ("be_visitor_module::")
1056 ACE_TEXT ("visit_union - ")
1057 ACE_TEXT ("failed to accept visitor\n")),
1058 -1);
1061 return 0;
1065 be_visitor_module::visit_union_fwd (be_union_fwd *node)
1067 // Instantiate a visitor context with a copy of our context. This info
1068 // will be modified based on what type of node we are visiting.
1069 be_visitor_context ctx (*this->ctx_);
1070 ctx.node (node);
1071 int status = 0;
1073 switch (this->ctx_->state ())
1075 case TAO_CodeGen::TAO_ROOT_CH:
1077 be_visitor_union_fwd_ch visitor (&ctx);
1078 status = node->accept (&visitor);
1079 break;
1081 default:
1082 return 0; // nothing to be done
1085 if (status == -1)
1087 ACE_ERROR_RETURN ((LM_ERROR,
1088 ACE_TEXT ("be_visitor_module::")
1089 ACE_TEXT ("visit_union_fwd - ")
1090 ACE_TEXT ("failed to accept visitor\n")),
1091 -1);
1094 return 0;
1098 be_visitor_module::visit_typedef (be_typedef *node)
1100 // Instantiate a visitor context with a copy of our context. This info
1101 // will be modified based on what type of node we are visiting.
1102 be_visitor_context ctx (*this->ctx_);
1103 ctx.node (node);
1104 int status = 0;
1106 switch (this->ctx_->state ())
1108 case TAO_CodeGen::TAO_ROOT_CH:
1110 be_visitor_typedef_ch visitor (&ctx);
1111 status = node->accept (&visitor);
1112 break;
1114 case TAO_CodeGen::TAO_ROOT_CI:
1116 be_visitor_typedef_ci visitor (&ctx);
1117 status = node->accept (&visitor);
1118 break;
1120 case TAO_CodeGen::TAO_ROOT_CS:
1122 be_visitor_typedef_cs visitor (&ctx);
1123 status = node->accept (&visitor);
1124 break;
1126 case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
1128 be_visitor_typedef_any_op_ch visitor (&ctx);
1129 status = node->accept (&visitor);
1130 break;
1132 case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
1134 be_visitor_typedef_any_op_cs visitor (&ctx);
1135 status = node->accept (&visitor);
1136 break;
1138 case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
1140 be_visitor_typedef_cdr_op_ch visitor (&ctx);
1141 status = node->accept (&visitor);
1142 break;
1144 case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
1146 be_visitor_typedef_cdr_op_cs visitor (&ctx);
1147 status = node->accept (&visitor);
1148 break;
1150 default:
1151 return 0; // nothing to be done
1154 if (status == -1)
1156 ACE_ERROR_RETURN ((LM_ERROR,
1157 ACE_TEXT ("be_visitor_module::")
1158 ACE_TEXT ("visit_typedef - ")
1159 ACE_TEXT ("failed to accept visitor\n")),
1160 -1);
1163 return 0;