2 //=============================================================================
6 * Visitor generating code for facets in the exec impl header.
10 //=============================================================================
12 #include "component.h"
14 be_visitor_facet_exh::be_visitor_facet_exh (
15 be_visitor_context
*ctx
)
16 : be_visitor_component_scope (ctx
)
17 // comment_start_border_ ("/**"),
18 // comment_end_border_ (" */")
20 // This is initialized in the base class to svnt_export_macro()
21 // or skel_export_macro(), since there are many more visitor
22 // classes generating servant code. So we can just override
24 export_macro_
= be_global
->exec_export_macro ();
27 be_visitor_facet_exh::~be_visitor_facet_exh ()
32 be_visitor_facet_exh::visit_provides (be_provides
*node
)
34 be_type
*impl
= node
->provides_type ();
36 impl
->original_local_name ()->get_string ();
38 ACE_CString
lname_str (this->ctx_
->port_prefix ());
39 lname_str
+= node
->original_local_name ()->get_string ();
40 const char *lname
= lname_str
.c_str ();
42 AST_Decl
*s
= ScopeAsDecl (impl
->defined_in ());
43 ACE_CString sname_str
=
44 IdentifierHelper::orig_sn (s
->name (), false);
45 const char *sname
= sname_str
.c_str ();
46 const char *global
= (sname_str
== "" ? "" : "::");
48 AST_Decl
*c_scope
= ScopeAsDecl (this->node_
->defined_in ());
49 bool is_global
= (c_scope
->node_type () == AST_Decl::NT_root
);
50 const char *smart_scope
= (is_global
? "" : "::");
53 << "/// Executor implementation class for "
58 << lname
<< "_exec_i" << be_idt_nl
59 << ": public virtual " << global
<< sname
<< "::CCM_"
60 << iname
<< "," << be_idt_nl
61 << "public virtual ::CORBA::LocalObject"
62 << be_uidt
<< be_uidt_nl
64 << "public:" << be_idt_nl
65 << "/// Constructor" << be_nl
66 << "/// @param[in] ctx - Container context" << be_nl
67 << lname
<< "_exec_i (" << be_idt_nl
68 << smart_scope
<< c_scope
->full_name () << "::CCM_"
69 << this->node_
->local_name ()
70 << "_Context_ptr ctx);" << be_uidt_nl
71 << "/// Destructor" << be_nl
72 << "virtual ~" << lname
<< "_exec_i ();";
74 if (impl
->node_type () == AST_Decl::NT_interface
)
77 dynamic_cast<be_interface
*> (impl
);
80 << "/** @name Operations and attributes from "
81 << intf
->full_name () << " */" << be_nl
85 intf
->traverse_inheritance_graph (
86 be_visitor_facet_exh::method_helper
,
91 ACE_ERROR_RETURN ((LM_ERROR
,
92 ACE_TEXT ("be_visitor_facet_exh::")
93 ACE_TEXT ("visit_provides - ")
94 ACE_TEXT ("traverse_inheritance_graph() ")
95 ACE_TEXT ("failed\n")),
99 os_
<< be_nl
<< "//@}";
102 os_
<< be_uidt
<< be_nl_2
103 << "private:" << be_idt_nl
104 << "/// Context for component instance. Used for all middleware communication." << be_nl
105 << smart_scope
<< c_scope
->full_name () << "::CCM_"
106 << this->node_
->local_name ()
107 << "_Context_var ciao_context_;" << be_uidt_nl
114 be_visitor_facet_exh::method_helper (be_interface
*derived
,
118 be_visitor_context ctx
;
119 ctx
.state (TAO_CodeGen::TAO_ROOT_IH
);
120 ctx
.interface (derived
);
122 be_visitor_interface_ih
visitor (&ctx
);
124 if (visitor
.visit_scope (node
) == -1)
126 ACE_ERROR_RETURN ((LM_ERROR
,
127 "be_visitor_facet_exh::method_helper "
128 "- visit_scope() failed\n"),