Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / TAO_IDL / be / be_visitor_component / component_exh.cpp
blobcfb2a7196aa713d18855aafa7c73a46259cbd910
2 //=============================================================================
3 /**
4 * @file component_exh.cpp
6 * Visitor generating code for Components in the exec impl header.
8 * @author Jeff Parsons
9 */
10 //=============================================================================
12 #include "component.h"
14 be_visitor_component_exh::be_visitor_component_exh (
15 be_visitor_context *ctx)
16 : be_visitor_component_scope (ctx)
18 // This is initialized in the base class to svnt_export_macro()
19 // or skel_export_macro(), since there are many more visitor
20 // classes generating servant code. So we can just override
21 // all that here.
22 export_macro_ = be_global->exec_export_macro ();
25 be_visitor_component_exh::~be_visitor_component_exh ()
29 int
30 be_visitor_component_exh::visit_component (be_component *node)
32 if (node->imported ())
34 return 0;
37 this->node_ = node;
39 /// Use 'CIAO_' + component's flat name.
40 os_ << be_nl_2
41 << "/// Namespace for implementation of " << node->full_name () << " component" << be_nl
42 << "namespace CIAO_" << node->flat_name ()
43 << "_Impl" << be_nl
44 << "{" << be_idt;
46 be_visitor_facet_exh facet_visitor (this->ctx_);
47 facet_visitor.node (node);
49 if (facet_visitor.visit_component_scope (node) == -1)
51 ACE_ERROR_RETURN ((LM_ERROR,
52 ACE_TEXT ("be_visitor_component_exh::")
53 ACE_TEXT ("visit_component - ")
54 ACE_TEXT ("facet visitor failed\n")),
55 -1);
58 be_visitor_executor_exh exec_visitor (this->ctx_);
60 if (exec_visitor.visit_component (node) == -1)
62 ACE_ERROR_RETURN ((LM_ERROR,
63 ACE_TEXT ("be_visitor_component_exh::")
64 ACE_TEXT ("visit_component - ")
65 ACE_TEXT ("exec visitor failed\n")),
66 -1);
69 /// If this list has members, then we can assume that the
70 /// artifacts from -GC exist.
71 for (ACE_Unbounded_Queue<char *>::CONST_ITERATOR i (
72 idl_global->ciao_ami_recep_names ());
73 ! i.done ();
74 i.advance ())
76 char **item = nullptr;
77 i.next (item);
79 UTL_ScopedName *sn =
80 FE_Utils::string_to_scoped_name (*item);
82 UTL_Scope *s =
83 idl_global->scopes ().top_non_null ();
85 AST_Decl *d = s->lookup_by_name (sn, true);
87 if (d == nullptr)
89 idl_global->err ()->lookup_error (sn);
91 sn->destroy ();
92 delete sn;
93 sn = nullptr;
95 continue;
98 sn->destroy ();
99 delete sn;
100 sn = nullptr;
102 be_uses *u = dynamic_cast<be_uses*> (d);
104 if (u == nullptr)
106 ACE_ERROR_RETURN ((LM_ERROR,
107 ACE_TEXT ("be_visitor_component_exh")
108 ACE_TEXT ("::visit_component - ")
109 ACE_TEXT ("narrow to AMI receptacle ")
110 ACE_TEXT ("failed\n")),
111 -1);
114 be_component *c =
115 dynamic_cast<be_component*> (
116 ScopeAsDecl (u->defined_in ()));
118 if (c == node)
120 be_visitor_context ctx (*this->ctx_);
121 be_visitor_component_ami_rh_exh ami_rh_visitor (&ctx);
123 if (ami_rh_visitor.visit_uses (u) == -1)
125 ACE_ERROR_RETURN ((LM_ERROR,
126 ACE_TEXT ("be_visitor_component_exh")
127 ACE_TEXT ("::visit_component - ")
128 ACE_TEXT ("AMI reply handler generation ")
129 ACE_TEXT ("failed\n")),
130 -1);
135 this->gen_exec_entrypoint_decl ();
137 os_ << be_uidt_nl
138 << "}";
140 return 0;