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_exs.cpp
blob71278e46fc712b2c17e5183f280c68c08f20e6a2
2 //=============================================================================
3 /**
4 * @file component_exs.cpp
6 * Visitor generating code for Components in the exec impl source.
8 * @author Jeff Parsons
9 */
10 //=============================================================================
12 #include "component.h"
14 be_visitor_component_exs::be_visitor_component_exs (
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_exs::~be_visitor_component_exs ()
29 int
30 be_visitor_component_exs::visit_component (be_component *node)
32 if (node->imported ())
34 return 0;
37 node_ = node;
39 /// Use 'CIAO_' + component's flat name.
40 os_ << be_nl_2
41 << "namespace CIAO_" << node->flat_name ()
42 << "_Impl" << be_nl
43 << "{" << be_idt;
45 be_visitor_facet_exs facet_visitor (this->ctx_);
46 facet_visitor.node (node);
48 if (facet_visitor.visit_component_scope (node) == -1)
50 ACE_ERROR_RETURN ((LM_ERROR,
51 ACE_TEXT ("be_visitor_component_exs::")
52 ACE_TEXT ("visit_component - ")
53 ACE_TEXT ("facet visitor failed\n")),
54 -1);
57 be_visitor_executor_exs exec_visitor (this->ctx_);
58 exec_visitor.node (node);
60 if (exec_visitor.visit_component (node) == -1)
62 ACE_ERROR_RETURN ((LM_ERROR,
63 ACE_TEXT ("be_visitor_component_exs::")
64 ACE_TEXT ("visit_component - ")
65 ACE_TEXT ("exec visitor failed\n")),
66 -1);
69 /// Generate the empty ops for the AMI4CCM reply handlers,
70 /// if any.
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_exs")
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_exs 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_exs")
127 ACE_TEXT ("::visit_component - ")
128 ACE_TEXT ("AMI reply handler generation ")
129 ACE_TEXT ("failed\n")),
130 -1);
135 this->gen_exec_entrypoint_defn ();
137 os_ << be_uidt_nl
138 << "}";
140 return 0;
143 // ==================================================
145 Component_Exec_Op_Attr_Generator::Component_Exec_Op_Attr_Generator (
146 be_visitor_scope * visitor)
147 : visitor_ (visitor)
152 Component_Exec_Op_Attr_Generator::emit (be_interface * /*derived_interface */,
153 TAO_OutStream * /* os */,
154 be_interface * base_interface)
156 AST_Decl::NodeType nt = base_interface->node_type ();
158 if (nt == AST_Decl::NT_component || nt == AST_Decl::NT_connector)
160 return 0;
163 return visitor_->visit_scope (base_interface);