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_svh.cpp
blob009fc949d275741e83c66afc55fa374d33bff087
2 //=============================================================================
3 /**
4 * @file component_svh.cpp
6 * Visitor generating code for Components in the servant header.
8 * @author Jeff Parsons
9 */
10 //=============================================================================
12 #include "component.h"
14 be_visitor_component_svh::be_visitor_component_svh (be_visitor_context *ctx)
15 : be_visitor_component (ctx),
16 os_ (*ctx->stream ()),
17 export_macro_ (be_global->svnt_export_macro ())
19 /// All existing CIAO examples set the servant export values in the CIDL
20 /// compiler to equal the IDL compiler's skel export values. Below is a
21 /// partial effort to decouple them, should be completely decoupled
22 /// sometime. See comment in codegen.cpp, line 1173.
23 if (export_macro_ == "")
25 export_macro_ = be_global->skel_export_macro ();
29 be_visitor_component_svh::~be_visitor_component_svh ()
33 int
34 be_visitor_component_svh::visit_component (be_component *node)
36 if (node->imported ())
38 return 0;
41 /// Fills in the node's has_* members, for use in minimizing
42 /// code generation.
43 node->scan (node);
45 /// Use 'CIAO_' + component's flat name.
46 os_ << be_nl_2
47 << "namespace CIAO_" << node->flat_name ()
48 << "_Impl" << be_nl
49 << "{" << be_idt;
51 // // Generate the context class declaration.
52 // be_visitor_context_svth context_visitor (this->ctx_);
54 // if (context_visitor.visit_component (node) == -1)
55 // {
56 // ACE_ERROR_RETURN ((LM_ERROR,
57 // ACE_TEXT ("be_visitor_component_svh::")
58 // ACE_TEXT ("visit_component - ")
59 // ACE_TEXT ("context visitor failed\n")),
60 // -1);
61 // }
63 // Generate the servant class declaration.
64 be_visitor_servant_svh servant_visitor (this->ctx_);
66 if (servant_visitor.visit_component (node) == -1)
68 ACE_ERROR_RETURN ((LM_ERROR,
69 ACE_TEXT ("be_visitor_component_svh::")
70 ACE_TEXT ("visit_component - ")
71 ACE_TEXT ("servant visitor failed\n")),
72 -1);
75 this->gen_entrypoint (node);
77 os_ << be_uidt_nl
78 << "}";
80 return 0;
83 int
84 be_visitor_component_svh::visit_connector (be_connector *node)
86 return this->visit_component (node);
89 void
90 be_visitor_component_svh::gen_entrypoint (be_component *node)
92 os_ << be_nl_2
93 << "extern \"C\" " << export_macro_.c_str ()
94 << " ::PortableServer::Servant" << be_nl
95 << "create_" << node->flat_name ()
96 << "_Servant (" << be_idt_nl
97 << "::Components::EnterpriseComponent_ptr p," << be_nl
98 << "::CIAO::" << be_global->ciao_container_type ()
99 << "_Container_ptr c," << be_nl
100 << "const char * ins_name);" << be_uidt;