2 //=============================================================================
4 * @file component_svh.cpp
6 * Visitor generating code for Components in the servant header.
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 ()
34 be_visitor_component_svh::visit_component (be_component
*node
)
36 if (node
->imported ())
41 /// Fills in the node's has_* members, for use in minimizing
45 /// Use 'CIAO_' + component's flat name.
47 << "namespace CIAO_" << node
->flat_name ()
51 // // Generate the context class declaration.
52 // be_visitor_context_svth context_visitor (this->ctx_);
54 // if (context_visitor.visit_component (node) == -1)
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")),
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")),
75 this->gen_entrypoint (node
);
84 be_visitor_component_svh::visit_connector (be_connector
*node
)
86 return this->visit_component (node
);
90 be_visitor_component_svh::gen_entrypoint (be_component
*node
)
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
;