summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2009-10-30 07:20:33 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2009-10-30 07:20:33 +0000
commitd661434327a984c185b3f7b14f434ea11e1be472 (patch)
tree8e2d932cfb847be4142631feb0842eff6abdcc98
parentdd1b28cde0efab4df66fd1232777a5285071564a (diff)
downloadATCD-d661434327a984c185b3f7b14f434ea11e1be472.tar.gz
Fri Oct 30 06:15:53 UTC 2009 Johnny Willemsen <jwillemsen@remedy.nl>
Merged changes from Jeff for port/porttype/mirrorport to head Thu Oct 29 12:50:35 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu> * TAO_IDL/be/be_visitor_connector.cpp: * TAO_IDL/be/be_visitor_connector/connector_dds_exs.cpp: * TAO_IDL/be/be_visitor_connector/connector_dds_exh.cpp: * TAO_IDL/be_include/be_visitor_connector.h: * TAO_IDL/be_include/be_visitor_connector/connector_dds_exs.h: * TAO_IDL/be_include/be_visitor_connector/connector_dds_exh.h: New visitors, implementing (so far) part of the code generation of connector executors. * TAO_IDL/be/be_codegen.cpp: * TAO_IDL/be/be_visitor_component/component_exh.cpp: * TAO_IDL/be/be_visitor_component/component_exs.cpp: * TAO_IDL/be/be_global.cpp: * TAO_IDL/be/be_visitor_component_scope.cpp: * TAO_IDL/be_include/be_codegen.h: * TAO_IDL/be_include/be_visitor_component_scope.h: * TAO_IDL/be_include/be_global.h: - Factored out code for generating entrypoint declarations and definitions. - Added mechanism to generate includes of DDS type support files for the connector executor. Sun Oct 25 17:10:27 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu> * TAO_IDL/be_include/be_visitor_component_scope.h: * TAO_IDL/be/be_visitor_component_scope.cpp: Moved these files from the be_visitor_component subdirectory, so the visitor would be accessible as a base class to be_visitor_ccm_pre_proc. Also add override of base class (be_visitor_scope) method pre_proces(), to extend the generated names of provides and uses methods with a prefix of the port or mirrorport name, if any. * TAO_IDL/be/be_visitor_ccm_pre_proc.cpp: * TAO_IDL/be_include/be_visitor_ccm_pre_proc.h: Made class be_visitor_component_scope the base class of this visitor, thereby adding support for simple ports, mirrorports and porttypes. * TAO_IDL/be_include/be_visitor_component.h: * TAO_IDL/be/be_visitor_component.cpp: Removed relocated files from these file lists. Thu Oct 22 20:39:02 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu> * TAO_IDL/be/be_visitor_component/component_scope.cpp: * TAO_IDL/be_include/be_visitor_component/component_scope.h: Added code generation for mirror ports. * TAO_IDL/be_include/be_visitor_component/facet_svh.h: * TAO_IDL/be_include/be_visitor_component/facet_svs.h: * TAO_IDL/be/be_visitor_component/facet_svh.cpp: * TAO_IDL/be/be_visitor_component/facet_svs.cpp: Changed base class to be_visitor_component_scope to pull in the mirror port support. Thu Oct 22 19:21:26 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu> * TAO_IDL/be/be_visitor_component/facet_exs.cpp: * TAO_IDL/be/be_visitor_component/executor_exh.cpp: * TAO_IDL/be/be_visitor_component/executor_exs.cpp: * TAO_IDL/be/be_visitor_component/facet_exh.cpp: * TAO_IDL/be_include/be_visitor_component/executor_exh.h: * TAO_IDL/be_include/be_visitor_component/executor_exs.h: * TAO_IDL/be_include/be_visitor_component/facet_exh.h: * TAO_IDL/be_include/be_visitor_component/facet_exs.h: New files, containing new visitors that handle code generation class-by-class in the executor implementation. * TAO_IDL/be/be_provides.cpp: * TAO_IDL/be/be_attribute.cpp: * TAO_IDL/be/be_consumes.cpp: * TAO_IDL/be/be_field.cpp: * TAO_IDL/be/be_publishes.cpp: * TAO_IDL/be/be_uses.cpp: * TAO_IDL/be/be_emits.cpp: * TAO_IDL/be/be_sequence.cpp: * TAO_IDL/be_include/be_field.h: * TAO_IDL/be_include/be_publishes.h: * TAO_IDL/be_include/be_component.h: * TAO_IDL/be_include/be_uses.h: * TAO_IDL/be_include/be_provides.h: * TAO_IDL/be_include/be_attribute.h: * TAO_IDL/be_include/be_emits.h: * TAO_IDL/be_include/be_consumes.h: * TAO_IDL/be_include/be_sequence.h: Add non-virtual override of frontend methods that fetch the referenced provides, uses, publishes, emits, consumes, field, or base type. This addition concentrates the narrowing to the backend type so it need not be done over and over in the visitors. * TAO_IDL/be/be_visitor_component.cpp: * TAO_IDL/be_include/be_visitor_component.h: Added new visitor files. * TAO_IDL/be/be_interface.cpp: * TAO_IDL/be_include/be_interface.h: Renamed static method facet_op_attr_decl_helper to op_attr_decl_helper, since its use is now more general. * TAO_IDL/be_include/be_visitor_component/component_exh.h: * TAO_IDL/be_include/be_visitor_component/component_exs.h: * TAO_IDL/be/be_visitor_component/component_exh.cpp: * TAO_IDL/be/be_visitor_component/component_exs.cpp: Split code out of these visitors and distributed it among the new visitors. * TAO_IDL/be/be_visitor_operation/operation_exs.cpp: * TAO_IDL/be/be_visitor_operation/operation_svs.cpp: * TAO_IDL/be/be_visitor_interface/interface_svs.cpp: * TAO_IDL/be/be_visitor_component/context_ex_idl.cpp: * TAO_IDL/be/be_visitor_component/executor_ex_idl.cpp: * TAO_IDL/be/be_visitor_component/servant_svh.cpp: * TAO_IDL/be/be_visitor_component/facet_ex_idl.cpp: * TAO_IDL/be/be_visitor_component/servant_svs.cpp: * TAO_IDL/be/be_visitor_attribute.cpp: * TAO_IDL/be/be_visitor_attribute/attribute.cpp: * TAO_IDL/be_include/be_visitor_operation/operation_svs.h: * TAO_IDL/be_include/be_visitor_component/component.h: Minor or cosmetic changes. Wed Oct 21 20:40:45 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu> * TAO_IDL/be/be_visitor_extended_port.cpp: * TAO_IDL/be_include/be_visitor_extended_port.h: Removed these files, should have been removed in Wed Oct 21 14:10:35 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu> * TAO_IDL/be/be_visitor_component/facet_ex_idl.cpp: * TAO_IDL/be/be_visitor_component/context_ex_idl.cpp: * TAO_IDL/be/be_visitor_component/executor_ex_idl.cpp: * TAO_IDL/be_include/be_visitor_component/facet_ex_idl.h: * TAO_IDL/be_include/be_visitor_component/context_ex_idl.h: * TAO_IDL/be_include/be_visitor_component/executor_ex_idl.h: New files, split executor IDL code generation into separate visitors for the facet, context and executor classes. Also added support for simple extended ports and porttypes. * TAO_IDL/be/be_visitor_component.cpp: * TAO_IDL/be_include/be_visitor_component.h: Added new files to the include lists. * TAO_IDL/be/be_util.cpp: * TAO_IDL/be_include/be_util.h: Moved utility methods to generate nested namespaces to this class, so they can be visible to all visitors. * TAO_IDL/be/be_visitor_component/servant_svh.cpp: * TAO_IDL/be/be_visitor_component/context_svh.cpp: * TAO_IDL/be/be_visitor_component/servant_svs.cpp: * TAO_IDL/be/be_visitor_component/context_svs.cpp: * TAO_IDL/be/be_visitor_component/component_ex_idl.cpp: * TAO_IDL/be/be_visitor_component/component_scope.cpp: * TAO_IDL/be_include/be_visitor_component/component_scope.h: * TAO_IDL/be_include/be_visitor_component/servant_svh.h: * TAO_IDL/be_include/be_visitor_component/context_svh.h: * TAO_IDL/be_include/be_visitor_component/servant_svs.h: * TAO_IDL/be_include/be_visitor_component/context_svs.h: * TAO_IDL/be_include/be_visitor_component/component_ex_idl.h: Moved visit method overrides for extended port, mirror port and porttype to the base class be_visitor_component_scope. In every case so far, the extended port (and eventually the mirror port) traversal just fetches the porttype reference and visits its scope, calling back the port kind traversal methods that happen to be overridden in the original visitor, so there's no need to reimplement these methods over and over. Wed Oct 21 14:10:35 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu> * TAO_IDL/be/be_visitor_extended_port/extended_port_svs.cpp: * TAO_IDL/be/be_visitor_extended_port/extended_port.cpp: * TAO_IDL/be/be_visitor_extended_port/extended_port_svh.cpp: * TAO_IDL/be_include/be_visitor_extended_port/extended_port_svs.h: * TAO_IDL/be_include/be_visitor_extended_port/extended_port.h: * TAO_IDL/be_include/be_visitor_extended_port/extended_port_svh.h: Removed these visitors, better use of polymorphism can be made by just implementing their methods in the appropriate component visitor. * TAO_IDL/be/be_visitor_component/facet_svh.cpp: * TAO_IDL/be/be_visitor_component/facet_svs.cpp: * TAO_IDL/be_include/be_visitor_component/facet_svh.h: * TAO_IDL/be_include/be_visitor_component/facet_svs.h: Copied code from removed visitor methods above, and removed visit_component() method. * TAO_IDL/be/be_visitor_component/component_svh.cpp: * TAO_IDL/be/be_visitor_component/component_svs.cpp: Spawned facet visitors above with visit_component_scope() call, eliminating the extra step of calling visit_component(). * TAO_IDL/be_include/be_extended_port.h: * TAO_IDL/be/be_extended_port.cpp: Overloaded port_type() method to return backend-specific type, to eliminate many narrowing calls. Tue Oct 20 22:55:25 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu> * TAO_IDL/be/be_visitor_component/component_scope.cpp: * TAO_IDL/be_include/be_visitor_component/component_scope.h: New files containing a new base class visitor, encapsulating a scope visitation method that recurses over the scopes of a component's ancestors, if any. * TAO_IDL/be/be_visitor_component.cpp: * TAO_IDL/be/be_component.cpp: * TAO_IDL/be/be_visitor_component/servant_svh.cpp: * TAO_IDL/be/be_visitor_component/facet_svh.cpp: * TAO_IDL/be/be_visitor_component/context_svh.cpp: * TAO_IDL/be/be_visitor_component/servant_svs.cpp: * TAO_IDL/be/be_visitor_component/facet_svs.cpp: * TAO_IDL/be/be_visitor_component/context_svs.cpp: * TAO_IDL/be_include/be_component.h: * TAO_IDL/be_include/be_visitor_component/servant_svh.h: * TAO_IDL/be_include/be_visitor_component/facet_svh.h: * TAO_IDL/be_include/be_visitor_component/context_svh.h: * TAO_IDL/be_include/be_visitor_component/facet_svs.h: * TAO_IDL/be_include/be_visitor_component/servant_svs.h: * TAO_IDL/be_include/be_visitor_component/context_svs.h: * TAO_IDL/be_include/be_visitor_component.h: Replaced all occurrences of recursive scope iteration with new visitor classes derived from the abstract visitor above. Mon Oct 19 23:26:07 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu> * TAO_IDL/be/be_visitor_component/servant_svs.cpp: * TAO_IDL/be/be_visitor_component/facet_svs.cpp: * TAO_IDL/be/be_visitor_component/context_svs.cpp: * TAO_IDL/be_include/be_visitor_component/facet_svs.h: * TAO_IDL/be_include/be_visitor_component/servant_svs.h: * TAO_IDL/be_include/be_visitor_component/context_svs.h: New files containing new visitors with code factored out of class be_visitor_component_svs * TAO_IDL/be/be_visitor_component.cpp: * TAO_IDL/be/be_visitor_component/facet_svh.cpp: * TAO_IDL/be/be_visitor_component/context_svh.cpp: * TAO_IDL/be/be_visitor_component/component_svs.cpp: * TAO_IDL/be/be_visitor_attribute/component_init.cpp: * TAO_IDL/be_include/be_visitor_component/component_svs.h: * TAO_IDL/be_include/be_visitor_component.h: Changes stemming from the new visitors above. Fri Oct 16 19:54:38 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu> * TAO_IDL/be/be_visitor_component/servant_svh.cpp: * TAO_IDL/be/be_visitor_component/facet_svh.cpp: * TAO_IDL/be/be_visitor_component/context_svh.cpp: * TAO_IDL/be_include/be_visitor_component/servant_svh.h: * TAO_IDL/be_include/be_visitor_component/facet_svh.h: * TAO_IDL/be_include/be_visitor_component/context_svh.h: New files, new visitors that contain code moved from private methods in class be_visitor_component_svh. * TAO_IDL/be/be_provides.cpp: Fixed bug in code generation. * TAO_IDL/be/be_visitor_component.cpp: * TAO_IDL/be_include/be_visitor_component.h: Added new visitor files. * TAO_IDL/be/be_visitor_component/component_exh.cpp: Removed debugging output. * TAO_IDL/be/be_visitor_component/component_svh.cpp: * TAO_IDL/be_include/be_visitor_component/component_svh.h: Moved code out to new visitor above.
-rw-r--r--TAO/ChangeLog313
-rw-r--r--TAO/TAO_IDL/be/be_attribute.cpp8
-rw-r--r--TAO/TAO_IDL/be/be_codegen.cpp114
-rw-r--r--TAO/TAO_IDL/be/be_component.cpp8
-rw-r--r--TAO/TAO_IDL/be/be_consumes.cpp8
-rw-r--r--TAO/TAO_IDL/be/be_emits.cpp8
-rw-r--r--TAO/TAO_IDL/be/be_extended_port.cpp8
-rw-r--r--TAO/TAO_IDL/be/be_field.cpp8
-rw-r--r--TAO/TAO_IDL/be/be_global.cpp26
-rw-r--r--TAO/TAO_IDL/be/be_interface.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_provides.cpp11
-rw-r--r--TAO/TAO_IDL/be/be_publishes.cpp8
-rw-r--r--TAO/TAO_IDL/be/be_sequence.cpp12
-rw-r--r--TAO/TAO_IDL/be/be_uses.cpp8
-rw-r--r--TAO/TAO_IDL/be/be_util.cpp76
-rw-r--r--TAO/TAO_IDL/be/be_visitor_attribute.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_visitor_attribute/component_init.cpp5
-rw-r--r--TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp9
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component.cpp21
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/component_ex_idl.cpp545
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/component_exh.cpp409
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/component_exs.cpp469
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/component_svh.cpp838
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/component_svs.cpp2752
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/context_ex_idl.cpp146
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/context_svh.cpp282
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/context_svs.cpp774
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/executor_ex_idl.cpp240
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/executor_exh.cpp171
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/executor_exs.cpp240
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/facet_ex_idl.cpp60
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/facet_exh.cpp93
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/facet_exs.cpp135
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/facet_svh.cpp46
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/facet_svs.cpp46
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/servant_svh.cpp411
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component/servant_svs.cpp1745
-rw-r--r--TAO/TAO_IDL/be/be_visitor_component_scope.cpp289
-rw-r--r--TAO/TAO_IDL/be/be_visitor_connector.cpp27
-rw-r--r--TAO/TAO_IDL/be/be_visitor_connector/connector_dds_exh.cpp57
-rw-r--r--TAO/TAO_IDL/be/be_visitor_connector/connector_dds_exs.cpp57
-rw-r--r--TAO/TAO_IDL/be/be_visitor_extended_port.cpp26
-rw-r--r--TAO/TAO_IDL/be/be_visitor_extended_port/extended_port.cpp36
-rw-r--r--TAO/TAO_IDL/be/be_visitor_extended_port/extended_port_svh.cpp70
-rw-r--r--TAO/TAO_IDL/be/be_visitor_extended_port/extended_port_svs.cpp70
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_svs.cpp1
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation_exs.cpp8
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation_svs.cpp18
-rw-r--r--TAO/TAO_IDL/be_include/be_attribute.h5
-rw-r--r--TAO/TAO_IDL/be_include/be_codegen.h10
-rw-r--r--TAO/TAO_IDL/be_include/be_component.h4
-rw-r--r--TAO/TAO_IDL/be_include/be_consumes.h5
-rw-r--r--TAO/TAO_IDL/be_include/be_emits.h5
-rw-r--r--TAO/TAO_IDL/be_include/be_extended_port.h3
-rw-r--r--TAO/TAO_IDL/be_include/be_field.h3
-rw-r--r--TAO/TAO_IDL/be_include/be_global.h11
-rw-r--r--TAO/TAO_IDL/be_include/be_interface.h6
-rw-r--r--TAO/TAO_IDL/be_include/be_provides.h3
-rw-r--r--TAO/TAO_IDL/be_include/be_publishes.h3
-rw-r--r--TAO/TAO_IDL/be_include/be_sequence.h3
-rw-r--r--TAO/TAO_IDL/be_include/be_uses.h3
-rw-r--r--TAO/TAO_IDL/be_include/be_util.h15
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h4
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component.h14
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/component.h2
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/component_ex_idl.h35
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/component_exh.h43
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/component_exs.h43
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/component_svh.h40
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/component_svs.h124
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/context_ex_idl.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/context_svh.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/context_svs.h77
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/executor_ex_idl.h62
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/executor_exh.h48
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/executor_exs.h54
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/facet_ex_idl.h46
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/facet_exh.h45
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/facet_exs.h52
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/facet_svh.h46
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/facet_svs.h46
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/servant_svh.h56
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component/servant_svs.h281
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_component_scope.h85
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_connector.h35
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_connector/connector_dds_exh.h48
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_connector/connector_dds_exs.h46
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_extended_port.h38
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_extended_port/extended_port.h48
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_extended_port/extended_port_svh.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_extended_port/extended_port_svs.h49
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/operation_svs.h2
93 files changed, 6761 insertions, 5662 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index a00f7231328..47978558b6d 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,316 @@
+Fri Oct 30 06:15:53 UTC 2009 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ Merged changes from Jeff for port/porttype/mirrorport to head
+
+ Thu Oct 29 12:50:35 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * TAO_IDL/be/be_visitor_connector.cpp:
+ * TAO_IDL/be/be_visitor_connector/connector_dds_exs.cpp:
+ * TAO_IDL/be/be_visitor_connector/connector_dds_exh.cpp:
+ * TAO_IDL/be_include/be_visitor_connector.h:
+ * TAO_IDL/be_include/be_visitor_connector/connector_dds_exs.h:
+ * TAO_IDL/be_include/be_visitor_connector/connector_dds_exh.h:
+
+ New visitors, implementing (so far) part of the code
+ generation of connector executors.
+
+ * TAO_IDL/be/be_codegen.cpp:
+ * TAO_IDL/be/be_visitor_component/component_exh.cpp:
+ * TAO_IDL/be/be_visitor_component/component_exs.cpp:
+ * TAO_IDL/be/be_global.cpp:
+ * TAO_IDL/be/be_visitor_component_scope.cpp:
+ * TAO_IDL/be_include/be_codegen.h:
+ * TAO_IDL/be_include/be_visitor_component_scope.h:
+ * TAO_IDL/be_include/be_global.h:
+
+ - Factored out code for generating entrypoint declarations
+ and definitions.
+
+ - Added mechanism to generate includes of DDS type
+ support files for the connector executor.
+
+ Sun Oct 25 17:10:27 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * TAO_IDL/be_include/be_visitor_component_scope.h:
+ * TAO_IDL/be/be_visitor_component_scope.cpp:
+
+ Moved these files from the be_visitor_component
+ subdirectory, so the visitor would be accessible
+ as a base class to be_visitor_ccm_pre_proc. Also
+ add override of base class (be_visitor_scope)
+ method pre_proces(), to extend the generated
+ names of provides and uses methods with a
+ prefix of the port or mirrorport name, if any.
+
+ * TAO_IDL/be/be_visitor_ccm_pre_proc.cpp:
+ * TAO_IDL/be_include/be_visitor_ccm_pre_proc.h:
+
+ Made class be_visitor_component_scope the base class
+ of this visitor, thereby adding support for simple
+ ports, mirrorports and porttypes.
+
+ * TAO_IDL/be_include/be_visitor_component.h:
+ * TAO_IDL/be/be_visitor_component.cpp:
+
+ Removed relocated files from these file lists.
+
+ Thu Oct 22 20:39:02 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * TAO_IDL/be/be_visitor_component/component_scope.cpp:
+ * TAO_IDL/be_include/be_visitor_component/component_scope.h:
+
+ Added code generation for mirror ports.
+
+ * TAO_IDL/be_include/be_visitor_component/facet_svh.h:
+ * TAO_IDL/be_include/be_visitor_component/facet_svs.h:
+ * TAO_IDL/be/be_visitor_component/facet_svh.cpp:
+ * TAO_IDL/be/be_visitor_component/facet_svs.cpp:
+
+ Changed base class to be_visitor_component_scope to
+ pull in the mirror port support.
+
+ Thu Oct 22 19:21:26 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * TAO_IDL/be/be_visitor_component/facet_exs.cpp:
+ * TAO_IDL/be/be_visitor_component/executor_exh.cpp:
+ * TAO_IDL/be/be_visitor_component/executor_exs.cpp:
+ * TAO_IDL/be/be_visitor_component/facet_exh.cpp:
+ * TAO_IDL/be_include/be_visitor_component/executor_exh.h:
+ * TAO_IDL/be_include/be_visitor_component/executor_exs.h:
+ * TAO_IDL/be_include/be_visitor_component/facet_exh.h:
+ * TAO_IDL/be_include/be_visitor_component/facet_exs.h:
+
+ New files, containing new visitors that handle code
+ generation class-by-class in the executor implementation.
+
+ * TAO_IDL/be/be_provides.cpp:
+ * TAO_IDL/be/be_attribute.cpp:
+ * TAO_IDL/be/be_consumes.cpp:
+ * TAO_IDL/be/be_field.cpp:
+ * TAO_IDL/be/be_publishes.cpp:
+ * TAO_IDL/be/be_uses.cpp:
+ * TAO_IDL/be/be_emits.cpp:
+ * TAO_IDL/be/be_sequence.cpp:
+ * TAO_IDL/be_include/be_field.h:
+ * TAO_IDL/be_include/be_publishes.h:
+ * TAO_IDL/be_include/be_component.h:
+ * TAO_IDL/be_include/be_uses.h:
+ * TAO_IDL/be_include/be_provides.h:
+ * TAO_IDL/be_include/be_attribute.h:
+ * TAO_IDL/be_include/be_emits.h:
+ * TAO_IDL/be_include/be_consumes.h:
+ * TAO_IDL/be_include/be_sequence.h:
+
+ Add non-virtual override of frontend methods that
+ fetch the referenced provides, uses, publishes, emits,
+ consumes, field, or base type. This addition concentrates
+ the narrowing to the backend type so it need not be
+ done over and over in the visitors.
+
+ * TAO_IDL/be/be_visitor_component.cpp:
+ * TAO_IDL/be_include/be_visitor_component.h:
+
+ Added new visitor files.
+
+ * TAO_IDL/be/be_interface.cpp:
+ * TAO_IDL/be_include/be_interface.h:
+
+ Renamed static method facet_op_attr_decl_helper to
+ op_attr_decl_helper, since its use is now more general.
+
+ * TAO_IDL/be_include/be_visitor_component/component_exh.h:
+ * TAO_IDL/be_include/be_visitor_component/component_exs.h:
+ * TAO_IDL/be/be_visitor_component/component_exh.cpp:
+ * TAO_IDL/be/be_visitor_component/component_exs.cpp:
+
+ Split code out of these visitors and distributed it
+ among the new visitors.
+
+ * TAO_IDL/be/be_visitor_operation/operation_exs.cpp:
+ * TAO_IDL/be/be_visitor_operation/operation_svs.cpp:
+ * TAO_IDL/be/be_visitor_interface/interface_svs.cpp:
+ * TAO_IDL/be/be_visitor_component/context_ex_idl.cpp:
+ * TAO_IDL/be/be_visitor_component/executor_ex_idl.cpp:
+ * TAO_IDL/be/be_visitor_component/servant_svh.cpp:
+ * TAO_IDL/be/be_visitor_component/facet_ex_idl.cpp:
+ * TAO_IDL/be/be_visitor_component/servant_svs.cpp:
+ * TAO_IDL/be/be_visitor_attribute.cpp:
+ * TAO_IDL/be/be_visitor_attribute/attribute.cpp:
+ * TAO_IDL/be_include/be_visitor_operation/operation_svs.h:
+ * TAO_IDL/be_include/be_visitor_component/component.h:
+
+ Minor or cosmetic changes.
+
+ Wed Oct 21 20:40:45 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * TAO_IDL/be/be_visitor_extended_port.cpp:
+ * TAO_IDL/be_include/be_visitor_extended_port.h:
+
+ Removed these files, should have been removed in
+
+ Wed Oct 21 14:10:35 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+
+ * TAO_IDL/be/be_visitor_component/facet_ex_idl.cpp:
+ * TAO_IDL/be/be_visitor_component/context_ex_idl.cpp:
+ * TAO_IDL/be/be_visitor_component/executor_ex_idl.cpp:
+ * TAO_IDL/be_include/be_visitor_component/facet_ex_idl.h:
+ * TAO_IDL/be_include/be_visitor_component/context_ex_idl.h:
+ * TAO_IDL/be_include/be_visitor_component/executor_ex_idl.h:
+
+ New files, split executor IDL code generation into separate
+ visitors for the facet, context and executor classes. Also
+ added support for simple extended ports and porttypes.
+
+ * TAO_IDL/be/be_visitor_component.cpp:
+ * TAO_IDL/be_include/be_visitor_component.h:
+
+ Added new files to the include lists.
+
+ * TAO_IDL/be/be_util.cpp:
+ * TAO_IDL/be_include/be_util.h:
+
+ Moved utility methods to generate nested namespaces
+ to this class, so they can be visible to all visitors.
+
+ * TAO_IDL/be/be_visitor_component/servant_svh.cpp:
+ * TAO_IDL/be/be_visitor_component/context_svh.cpp:
+ * TAO_IDL/be/be_visitor_component/servant_svs.cpp:
+ * TAO_IDL/be/be_visitor_component/context_svs.cpp:
+ * TAO_IDL/be/be_visitor_component/component_ex_idl.cpp:
+ * TAO_IDL/be/be_visitor_component/component_scope.cpp:
+ * TAO_IDL/be_include/be_visitor_component/component_scope.h:
+ * TAO_IDL/be_include/be_visitor_component/servant_svh.h:
+ * TAO_IDL/be_include/be_visitor_component/context_svh.h:
+ * TAO_IDL/be_include/be_visitor_component/servant_svs.h:
+ * TAO_IDL/be_include/be_visitor_component/context_svs.h:
+ * TAO_IDL/be_include/be_visitor_component/component_ex_idl.h:
+
+ Moved visit method overrides for extended port, mirror port
+ and porttype to the base class be_visitor_component_scope.
+ In every case so far, the extended port (and eventually the
+ mirror port) traversal just fetches the porttype reference
+ and visits its scope, calling back the port kind traversal
+ methods that happen to be overridden in the original
+ visitor, so there's no need to reimplement these methods
+ over and over.
+
+ Wed Oct 21 14:10:35 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * TAO_IDL/be/be_visitor_extended_port/extended_port_svs.cpp:
+ * TAO_IDL/be/be_visitor_extended_port/extended_port.cpp:
+ * TAO_IDL/be/be_visitor_extended_port/extended_port_svh.cpp:
+ * TAO_IDL/be_include/be_visitor_extended_port/extended_port_svs.h:
+ * TAO_IDL/be_include/be_visitor_extended_port/extended_port.h:
+ * TAO_IDL/be_include/be_visitor_extended_port/extended_port_svh.h:
+
+ Removed these visitors, better use of polymorphism can be made
+ by just implementing their methods in the appropriate
+ component visitor.
+
+ * TAO_IDL/be/be_visitor_component/facet_svh.cpp:
+ * TAO_IDL/be/be_visitor_component/facet_svs.cpp:
+ * TAO_IDL/be_include/be_visitor_component/facet_svh.h:
+ * TAO_IDL/be_include/be_visitor_component/facet_svs.h:
+
+ Copied code from removed visitor methods above, and
+ removed visit_component() method.
+
+ * TAO_IDL/be/be_visitor_component/component_svh.cpp:
+ * TAO_IDL/be/be_visitor_component/component_svs.cpp:
+
+ Spawned facet visitors above with visit_component_scope()
+ call, eliminating the extra step of calling visit_component().
+
+
+ * TAO_IDL/be_include/be_extended_port.h:
+ * TAO_IDL/be/be_extended_port.cpp:
+
+ Overloaded port_type() method to return backend-specific
+ type, to eliminate many narrowing calls.
+
+ Tue Oct 20 22:55:25 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * TAO_IDL/be/be_visitor_component/component_scope.cpp:
+ * TAO_IDL/be_include/be_visitor_component/component_scope.h:
+
+ New files containing a new base class visitor, encapsulating
+ a scope visitation method that recurses over the scopes of
+ a component's ancestors, if any.
+
+ * TAO_IDL/be/be_visitor_component.cpp:
+ * TAO_IDL/be/be_component.cpp:
+ * TAO_IDL/be/be_visitor_component/servant_svh.cpp:
+ * TAO_IDL/be/be_visitor_component/facet_svh.cpp:
+ * TAO_IDL/be/be_visitor_component/context_svh.cpp:
+ * TAO_IDL/be/be_visitor_component/servant_svs.cpp:
+ * TAO_IDL/be/be_visitor_component/facet_svs.cpp:
+ * TAO_IDL/be/be_visitor_component/context_svs.cpp:
+ * TAO_IDL/be_include/be_component.h:
+ * TAO_IDL/be_include/be_visitor_component/servant_svh.h:
+ * TAO_IDL/be_include/be_visitor_component/facet_svh.h:
+ * TAO_IDL/be_include/be_visitor_component/context_svh.h:
+ * TAO_IDL/be_include/be_visitor_component/facet_svs.h:
+ * TAO_IDL/be_include/be_visitor_component/servant_svs.h:
+ * TAO_IDL/be_include/be_visitor_component/context_svs.h:
+ * TAO_IDL/be_include/be_visitor_component.h:
+
+ Replaced all occurrences of recursive scope iteration
+ with new visitor classes derived from the abstract
+ visitor above.
+
+ Mon Oct 19 23:26:07 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * TAO_IDL/be/be_visitor_component/servant_svs.cpp:
+ * TAO_IDL/be/be_visitor_component/facet_svs.cpp:
+ * TAO_IDL/be/be_visitor_component/context_svs.cpp:
+ * TAO_IDL/be_include/be_visitor_component/facet_svs.h:
+ * TAO_IDL/be_include/be_visitor_component/servant_svs.h:
+ * TAO_IDL/be_include/be_visitor_component/context_svs.h:
+
+ New files containing new visitors with code factored out
+ of class be_visitor_component_svs
+
+ * TAO_IDL/be/be_visitor_component.cpp:
+ * TAO_IDL/be/be_visitor_component/facet_svh.cpp:
+ * TAO_IDL/be/be_visitor_component/context_svh.cpp:
+ * TAO_IDL/be/be_visitor_component/component_svs.cpp:
+ * TAO_IDL/be/be_visitor_attribute/component_init.cpp:
+ * TAO_IDL/be_include/be_visitor_component/component_svs.h:
+ * TAO_IDL/be_include/be_visitor_component.h:
+
+ Changes stemming from the new visitors above.
+
+ Fri Oct 16 19:54:38 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * TAO_IDL/be/be_visitor_component/servant_svh.cpp:
+ * TAO_IDL/be/be_visitor_component/facet_svh.cpp:
+ * TAO_IDL/be/be_visitor_component/context_svh.cpp:
+ * TAO_IDL/be_include/be_visitor_component/servant_svh.h:
+ * TAO_IDL/be_include/be_visitor_component/facet_svh.h:
+ * TAO_IDL/be_include/be_visitor_component/context_svh.h:
+
+ New files, new visitors that contain code moved from
+ private methods in class be_visitor_component_svh.
+
+ * TAO_IDL/be/be_provides.cpp:
+
+ Fixed bug in code generation.
+
+ * TAO_IDL/be/be_visitor_component.cpp:
+ * TAO_IDL/be_include/be_visitor_component.h:
+
+ Added new visitor files.
+
+ * TAO_IDL/be/be_visitor_component/component_exh.cpp:
+
+ Removed debugging output.
+
+ * TAO_IDL/be/be_visitor_component/component_svh.cpp:
+ * TAO_IDL/be_include/be_visitor_component/component_svh.h:
+
+ Moved code out to new visitor above.
+
Thu Oct 29 16:36:53 UTC 2009 Yan Dai <dai_y@ociweb.com>
* orbsvcs/orbsvcs/Notify/MonitorControl/MonitorManager.cpp:
diff --git a/TAO/TAO_IDL/be/be_attribute.cpp b/TAO/TAO_IDL/be/be_attribute.cpp
index e7108ecfcf8..b3189eacd69 100644
--- a/TAO/TAO_IDL/be/be_attribute.cpp
+++ b/TAO/TAO_IDL/be/be_attribute.cpp
@@ -86,7 +86,13 @@ be_attribute::be_attribute (bool ro,
}
}
-
+be_type *
+be_attribute::field_type (void) const
+{
+ return
+ be_type::narrow_from_decl (
+ this->AST_Attribute::field_type ());
+}
int
be_attribute::accept (be_visitor *visitor)
diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp
index 3a574a35a3e..96672c160f7 100644
--- a/TAO/TAO_IDL/be/be_codegen.cpp
+++ b/TAO/TAO_IDL/be/be_codegen.cpp
@@ -2008,6 +2008,37 @@ TAO_CodeGen::gen_export_file (const char *filename,
}
void
+TAO_CodeGen::gen_standard_include (TAO_OutStream *stream,
+ const char *included_file,
+ bool add_comment)
+{
+ // Switch between changing or non-changing standard include files
+ // include files, so that #include statements can be
+ // generated with ""s or <>s respectively, for the standard include
+ // files (e.g. tao/corba.h).
+
+ const char *start_delimiter = "\"";
+ const char *end_delimiter = "\"";
+
+ if (be_global->changing_standard_include_files () == 0)
+ {
+ start_delimiter = "<";
+ end_delimiter = ">";
+ }
+
+ *stream << "\n#include ";
+
+ if (add_comment)
+ {
+ *stream << "/**/ ";
+ }
+
+ *stream << start_delimiter
+ << included_file
+ << end_delimiter;
+}
+
+void
TAO_CodeGen::gen_ifndef_string (const char *fname,
TAO_OutStream *stream,
const char *prefix,
@@ -2055,37 +2086,6 @@ TAO_CodeGen::gen_ifndef_string (const char *fname,
}
void
-TAO_CodeGen::gen_standard_include (TAO_OutStream *stream,
- const char *included_file,
- bool add_comment)
-{
- // Switch between changing or non-changing standard include files
- // include files, so that #include statements can be
- // generated with ""s or <>s respectively, for the standard include
- // files (e.g. tao/corba.h).
-
- const char *start_delimiter = "\"";
- const char *end_delimiter = "\"";
-
- if (be_global->changing_standard_include_files () == 0)
- {
- start_delimiter = "<";
- end_delimiter = ">";
- }
-
- *stream << "\n#include ";
-
- if (add_comment)
- {
- *stream << "/**/ ";
- }
-
- *stream << start_delimiter
- << included_file
- << end_delimiter;
-}
-
-void
TAO_CodeGen::gen_stub_hdr_includes (void)
{
// Include valuetype and Any/TypeCode headers before ORB core
@@ -3121,6 +3121,58 @@ TAO_CodeGen::gen_exec_hdr_includes (void)
this->gen_standard_include (
this->ciao_exec_header_,
"tao/LocalObject.h");
+
+ // Placeholder until we get real-world logic in place.
+ bool dds_connector_seen = true;
+
+ if (dds_connector_seen)
+ {
+ *this->ciao_exec_header_ << be_nl;
+
+ this->gen_standard_include (this->ciao_exec_header_,
+ "dds4ccm/impl/ndds/NDDS_Traits.h");
+
+ this->gen_standard_include (this->ciao_exec_header_,
+ "dds4ccm/impl/ndds/Connector_T.h");
+
+ size_t const nfiles = idl_global->n_included_idl_files ();
+
+ for (size_t j = 0; j < nfiles; ++j)
+ {
+ char* idl_name = idl_global->included_idl_files ()[j];
+
+ // Make a String out of it.
+ UTL_String idl_name_str = idl_name;
+
+ // No *_svnt.h version of this one.
+ if (ACE_OS::strcmp (idl_name, "Components.idl") == 0)
+ {
+ continue;
+ }
+
+ // Get the constructed IDL file name.
+ const char* ts_hdr =
+ BE_GlobalData::be_get_dds_typesupport_header (
+ &idl_name_str);
+
+ idl_name_str.destroy ();
+
+ // Sanity check and then print.
+ if (ts_hdr != 0)
+ {
+ this->gen_standard_include (
+ this->ciao_exec_header_,
+ ts_hdr);
+ }
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("\nERROR, invalid ")
+ ACE_TEXT ("file '%C' included"),
+ ts_hdr));
+ }
+ }
+ }
}
void
diff --git a/TAO/TAO_IDL/be/be_component.cpp b/TAO/TAO_IDL/be/be_component.cpp
index 1b3947e8179..200e87c7dea 100644
--- a/TAO/TAO_IDL/be/be_component.cpp
+++ b/TAO/TAO_IDL/be/be_component.cpp
@@ -90,6 +90,14 @@ be_component::~be_component (void)
{
}
+be_component *
+be_component::base_component (void) const
+{
+ return
+ be_component::narrow_from_decl (
+ this->AST_Component::base_component ());
+}
+
void
be_component::redefine (AST_Interface *from)
{
diff --git a/TAO/TAO_IDL/be/be_consumes.cpp b/TAO/TAO_IDL/be/be_consumes.cpp
index b6f5c807eeb..fb0635a2288 100644
--- a/TAO/TAO_IDL/be/be_consumes.cpp
+++ b/TAO/TAO_IDL/be/be_consumes.cpp
@@ -26,6 +26,14 @@ be_consumes::~be_consumes (void)
{
}
+be_eventtype *
+be_consumes::consumes_type (void) const
+{
+ return
+ be_eventtype::narrow_from_decl (
+ this->AST_Consumes::consumes_type ());
+}
+
int
be_consumes::accept (be_visitor *visitor)
{
diff --git a/TAO/TAO_IDL/be/be_emits.cpp b/TAO/TAO_IDL/be/be_emits.cpp
index 8cf22061232..125481c0209 100644
--- a/TAO/TAO_IDL/be/be_emits.cpp
+++ b/TAO/TAO_IDL/be/be_emits.cpp
@@ -26,6 +26,14 @@ be_emits::~be_emits (void)
{
}
+be_eventtype *
+be_emits::emits_type (void) const
+{
+ return
+ be_eventtype::narrow_from_decl (
+ this->AST_Emits::emits_type ());
+}
+
int
be_emits::accept (be_visitor *visitor)
{
diff --git a/TAO/TAO_IDL/be/be_extended_port.cpp b/TAO/TAO_IDL/be/be_extended_port.cpp
index 3cef181851a..f0c87f953cc 100644
--- a/TAO/TAO_IDL/be/be_extended_port.cpp
+++ b/TAO/TAO_IDL/be/be_extended_port.cpp
@@ -32,6 +32,14 @@ be_extended_port::~be_extended_port (void)
{
}
+be_porttype *
+be_extended_port::port_type (void) const
+{
+ return
+ be_porttype::narrow_from_decl (
+ this->AST_Extended_Port::port_type ());
+}
+
void
be_extended_port::destroy (void)
{
diff --git a/TAO/TAO_IDL/be/be_field.cpp b/TAO/TAO_IDL/be/be_field.cpp
index 978a09eeb37..013058376e4 100644
--- a/TAO/TAO_IDL/be/be_field.cpp
+++ b/TAO/TAO_IDL/be/be_field.cpp
@@ -60,6 +60,14 @@ be_field::be_field (AST_Type *ft,
}
}
+be_type *
+be_field::field_type (void) const
+{
+ return
+ be_type::narrow_from_decl (
+ this->AST_Field::field_type ());
+}
+
void
be_field::gen_member_ostream_operator (TAO_OutStream *os,
const char *instance_name,
diff --git a/TAO/TAO_IDL/be/be_global.cpp b/TAO/TAO_IDL/be/be_global.cpp
index 59046a3e1d3..cf9999542a1 100644
--- a/TAO/TAO_IDL/be/be_global.cpp
+++ b/TAO/TAO_IDL/be/be_global.cpp
@@ -81,6 +81,7 @@ BE_GlobalData::BE_GlobalData (void)
ciao_exec_src_ending_ (ACE::strnew ("_exec.cpp")),
ciao_exec_stub_hdr_ending_ (ACE::strnew ("EC.h")),
ciao_exec_idl_ending_ (ACE::strnew ("E.idl")),
+ dds_typesupport_hdr_ending_ (ACE::strnew ("Support.h")),
output_dir_ (0),
skel_output_dir_ (0),
anyop_output_dir_ (0),
@@ -455,6 +456,18 @@ BE_GlobalData::be_get_ciao_exec_idl (
}
const char *
+BE_GlobalData::be_get_dds_typesupport_header (
+ UTL_String *idl_file_name,
+ bool base_name_only)
+{
+ return
+ be_change_idl_file_extension (
+ idl_file_name,
+ be_global->dds_typesupport_hdr_ending (),
+ base_name_only);
+}
+
+const char *
BE_GlobalData::be_get_client_hdr_fname (
bool base_name_only)
{
@@ -1181,6 +1194,19 @@ BE_GlobalData::ciao_exec_idl_ending (void) const
}
void
+BE_GlobalData::dds_typesupport_hdr_ending (const char* s)
+{
+ ACE::strdelete (this->dds_typesupport_hdr_ending_);
+ this->dds_typesupport_hdr_ending_ = ACE::strnew (s);
+}
+
+const char*
+BE_GlobalData::dds_typesupport_hdr_ending (void) const
+{
+ return this->dds_typesupport_hdr_ending_;
+}
+
+void
BE_GlobalData::output_dir (const char* s)
{
ACE::strdelete (this->output_dir_);
diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp
index 1cecaaad9bb..f2687fa982d 100644
--- a/TAO/TAO_IDL/be/be_interface.cpp
+++ b/TAO/TAO_IDL/be/be_interface.cpp
@@ -2480,9 +2480,9 @@ be_interface::gen_abstract_init_helper (be_interface *node,
}
int
-be_interface::facet_op_attr_decl_helper (be_interface * /*derived */,
- be_interface *ancestor,
- TAO_OutStream *os)
+be_interface::op_attr_decl_helper (be_interface * /*derived */,
+ be_interface *ancestor,
+ TAO_OutStream *os)
{
if (be_component::narrow_from_decl (ancestor) != 0)
{
diff --git a/TAO/TAO_IDL/be/be_provides.cpp b/TAO/TAO_IDL/be/be_provides.cpp
index f0929bef0cd..4fb62c9c584 100644
--- a/TAO/TAO_IDL/be/be_provides.cpp
+++ b/TAO/TAO_IDL/be/be_provides.cpp
@@ -37,6 +37,14 @@ be_provides::~be_provides (void)
{
}
+be_type *
+be_provides::provides_type (void) const
+{
+ return
+ be_type::narrow_from_decl (
+ this->AST_Provides::provides_type ());
+}
+
int
be_provides::gen_facet_svnt_decl (TAO_OutStream &os)
{
@@ -98,7 +106,7 @@ be_provides::gen_facet_svnt_decl (TAO_OutStream &os)
int status =
intf->traverse_inheritance_graph (
- be_interface::facet_op_attr_decl_helper,
+ be_interface::op_attr_decl_helper,
&os);
if (status == -1)
@@ -300,7 +308,6 @@ be_facet_op_attr_defn_helper::emit (be_interface * /* derived_interface */,
be_operation::narrow_from_decl (d);
be_visitor_operation_svs v (&ctx);
- v.for_facets (true);
v.scope (op_scope_);
if (v.visit_operation (op) == -1)
diff --git a/TAO/TAO_IDL/be/be_publishes.cpp b/TAO/TAO_IDL/be/be_publishes.cpp
index 508bd5e9626..fe9b3acba46 100644
--- a/TAO/TAO_IDL/be/be_publishes.cpp
+++ b/TAO/TAO_IDL/be/be_publishes.cpp
@@ -26,6 +26,14 @@ be_publishes::~be_publishes (void)
{
}
+be_eventtype *
+be_publishes::publishes_type (void) const
+{
+ return
+ be_eventtype::narrow_from_decl (
+ this->AST_Publishes::publishes_type ());
+}
+
int
be_publishes::accept (be_visitor *visitor)
{
diff --git a/TAO/TAO_IDL/be/be_sequence.cpp b/TAO/TAO_IDL/be/be_sequence.cpp
index cf85ef74961..bb0d944fc18 100644
--- a/TAO/TAO_IDL/be/be_sequence.cpp
+++ b/TAO/TAO_IDL/be/be_sequence.cpp
@@ -36,10 +36,6 @@
#include "ace/Log_Msg.h"
-ACE_RCSID (be,
- be_sequence,
- "$Id$")
-
be_sequence::be_sequence (void)
: COMMON_Base (),
AST_Decl (),
@@ -149,6 +145,14 @@ be_sequence::be_sequence (AST_Expression *v,
}
}
+be_type *
+be_sequence::base_type (void) const
+{
+ return
+ be_type::narrow_from_decl (
+ this->AST_Sequence::base_type ());
+}
+
// Helper to create_name.
char *
be_sequence::gen_name (void)
diff --git a/TAO/TAO_IDL/be/be_uses.cpp b/TAO/TAO_IDL/be/be_uses.cpp
index 461414e65f2..9fcb3ae93d0 100644
--- a/TAO/TAO_IDL/be/be_uses.cpp
+++ b/TAO/TAO_IDL/be/be_uses.cpp
@@ -28,6 +28,14 @@ be_uses::~be_uses (void)
{
}
+be_type *
+be_uses::uses_type (void) const
+{
+ return
+ be_type::narrow_from_decl (
+ this->AST_Uses::uses_type ());
+}
+
int
be_uses::accept (be_visitor *visitor)
{
diff --git a/TAO/TAO_IDL/be/be_util.cpp b/TAO/TAO_IDL/be/be_util.cpp
index fb257e3353e..9943bdc4c80 100644
--- a/TAO/TAO_IDL/be/be_util.cpp
+++ b/TAO/TAO_IDL/be/be_util.cpp
@@ -12,17 +12,18 @@
// Static helper methods used by multiple visitors.
//
// = AUTHOR
-// Gary Maxey
+// Gary Maxey, Jeff Parsons
//
// ============================================================================
#include "be_util.h"
+#include "be_helper.h"
+#include "be_module.h"
+#include "be_identifier_helper.h"
+
#include "utl_identifier.h"
-#include "ace/OS_NS_string.h"
-ACE_RCSID (be,
- be_util,
- "$Id$")
+#include "ace/OS_NS_string.h"
void
be_util::gen_nested_namespace_begin (TAO_OutStream *os, be_module *node)
@@ -56,3 +57,68 @@ be_util::gen_nested_namespace_end (TAO_OutStream *os, be_module *node)
*os << be_nl << be_nl;
}
+
+void
+be_util::gen_nesting_open (TAO_OutStream &os, AST_Decl *node)
+{
+ os << be_nl;
+
+ for (UTL_IdListActiveIterator i (node->name ()); ! i.is_done () ;)
+ {
+ UTL_ScopedName tmp (i.item (), 0);
+ AST_Decl *scope =
+ node->defined_in ()->lookup_by_name (&tmp, true);
+
+ if (scope == 0)
+ {
+ i.next ();
+ continue;
+ }
+
+ ACE_CString module_name =
+ IdentifierHelper::try_escape (scope->original_local_name ());
+
+ if (module_name == "")
+ {
+ i.next ();
+ continue;
+ }
+
+ i.next ();
+
+ if (i.is_done ())
+ {
+ break;
+ }
+
+ os << be_nl
+ << "module " << module_name.c_str () << be_nl
+ << "{" << be_idt;
+ }
+}
+
+void
+be_util::gen_nesting_close (TAO_OutStream &os, AST_Decl *node)
+{
+ for (UTL_IdListActiveIterator i (node->name ()); ! i.is_done () ;)
+ {
+ ACE_CString module_name (i.item ()->get_string ());
+
+ if (module_name == "")
+ {
+ i.next ();
+ continue;
+ }
+
+ i.next ();
+
+ if (i.is_done ())
+ {
+ break;
+ }
+
+ os << be_uidt_nl
+ << "};";
+ }
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_attribute.cpp b/TAO/TAO_IDL/be/be_visitor_attribute.cpp
index 59e23a5a07f..88f3910e46d 100644
--- a/TAO/TAO_IDL/be/be_visitor_attribute.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_attribute.cpp
@@ -54,7 +54,3 @@
#include "be_visitor_attribute/set_from_extracted.cpp"
#include "be_visitor_attribute/component_init.cpp"
-ACE_RCSID (be,
- be_visitor_attribute,
- "$Id$")
-
diff --git a/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp b/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp
index d667dca1898..540e8304543 100644
--- a/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp
@@ -18,10 +18,6 @@
//
// ============================================================================
-ACE_RCSID (be_visitor_attribute,
- attribute,
- "$Id$")
-
// Attribute gets mapped to one or possibly two operations based on whether
// it is readonly or not. The two operations "get" and "set" the value of the
// attribute.
@@ -177,7 +173,6 @@ be_visitor_attribute::visit_attribute (be_attribute *node)
case TAO_CodeGen::TAO_ROOT_SVS:
{
be_visitor_operation_svs visitor (&ctx);
- visitor.for_facets (this->for_facets_);
visitor.scope (this->op_scope_);
status = get_op.accept (&visitor);
break;
@@ -391,7 +386,6 @@ be_visitor_attribute::visit_attribute (be_attribute *node)
case TAO_CodeGen::TAO_ROOT_SVS:
{
be_visitor_operation_svs visitor (&ctx);
- visitor.for_facets (this->for_facets_);
visitor.scope (this->op_scope_);
status = set_op.accept (&visitor);
break;
diff --git a/TAO/TAO_IDL/be/be_visitor_attribute/component_init.cpp b/TAO/TAO_IDL/be/be_visitor_attribute/component_init.cpp
index 39a1e4cd024..33c54a91151 100644
--- a/TAO/TAO_IDL/be/be_visitor_attribute/component_init.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_attribute/component_init.cpp
@@ -35,6 +35,11 @@ int
be_visitor_attribute_component_init::visit_attribute (
be_attribute *node)
{
+ if (node->readonly ())
+ {
+ return 0;
+ }
+
attr_ = node;
be_type *ft = be_type::narrow_from_decl (node->field_type ());
return ft->accept (this);
diff --git a/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp b/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp
index 24d10dce4d2..c949e244fea 100644
--- a/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp
@@ -41,10 +41,6 @@
#include "global_extern.h"
#include "nr_extern.h"
-ACE_RCSID (be,
- be_visitor_ccm_pre_proc,
- "$Id$")
-
const char *EXCEP_NAMES[] =
{
"AlreadyConnected",
@@ -64,8 +60,9 @@ const char *EXCEP_NAMES[] =
const int N_EXCEPS = sizeof (EXCEP_NAMES) / sizeof (char *);
be_exception *EXCEPS[N_EXCEPS];
-be_visitor_ccm_pre_proc::be_visitor_ccm_pre_proc (be_visitor_context *ctx)
- : be_visitor_scope (ctx),
+be_visitor_ccm_pre_proc::be_visitor_ccm_pre_proc (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx),
module_id_ ("Components"),
cookie_ (0),
already_connected_ (0),
diff --git a/TAO/TAO_IDL/be/be_visitor_component.cpp b/TAO/TAO_IDL/be/be_visitor_component.cpp
index f4954f7c293..16802a84032 100644
--- a/TAO/TAO_IDL/be/be_visitor_component.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_component.cpp
@@ -47,7 +47,6 @@
#include "be_valuetype.h"
#include "be_visitor_component.h"
-#include "be_visitor_extended_port.h"
#include "be_visitor_attribute.h"
#include "be_visitor_operation.h"
#include "be_visitor_interface.h"
@@ -55,8 +54,9 @@
#include "be_visitor_typedef.h"
#include "be_visitor_typecode.h"
#include "be_visitor_context.h"
-#include "be_identifier_helper.h"
+#include "be_util.h"
#include "be_helper.h"
+#include "be_identifier_helper.h"
#include "be_extern.h"
#include "be_visitor_component/component.cpp"
@@ -69,16 +69,25 @@
#include "be_visitor_component/component_ih.cpp"
#include "be_visitor_component/component_is.cpp"
#include "be_visitor_component/component_svh.cpp"
+#include "be_visitor_component/facet_svh.cpp"
+#include "be_visitor_component/context_svh.cpp"
+#include "be_visitor_component/servant_svh.cpp"
#include "be_visitor_component/component_svs.cpp"
+#include "be_visitor_component/facet_svs.cpp"
+#include "be_visitor_component/context_svs.cpp"
+#include "be_visitor_component/servant_svs.cpp"
#include "be_visitor_component/component_ex_idl.cpp"
+#include "be_visitor_component/facet_ex_idl.cpp"
+#include "be_visitor_component/executor_ex_idl.cpp"
+#include "be_visitor_component/context_ex_idl.cpp"
#include "be_visitor_component/component_exh.cpp"
+#include "be_visitor_component/facet_exh.cpp"
+#include "be_visitor_component/executor_exh.cpp"
#include "be_visitor_component/component_exs.cpp"
+#include "be_visitor_component/facet_exs.cpp"
+#include "be_visitor_component/executor_exs.cpp"
#include "be_visitor_component/any_op_ch.cpp"
#include "be_visitor_component/any_op_cs.cpp"
#include "be_visitor_component/cdr_op_ch.cpp"
#include "be_visitor_component/cdr_op_cs.cpp"
-ACE_RCSID (be,
- be_visitor_component,
- "$Id$")
-
diff --git a/TAO/TAO_IDL/be/be_visitor_component/component_ex_idl.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_ex_idl.cpp
index a97227f3a6f..969292182d8 100644
--- a/TAO/TAO_IDL/be/be_visitor_component/component_ex_idl.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_component/component_ex_idl.cpp
@@ -18,18 +18,9 @@
//
// ============================================================================
-ACE_RCSID (be_visitor_component,
- component_ex_idl,
- "$Id$")
-
-// ******************************************************
-// Component visitor for CIAO executor IDL
-// ******************************************************
-
be_visitor_component_ex_idl::be_visitor_component_ex_idl (
be_visitor_context *ctx)
- : be_visitor_scope (ctx),
- node_ (0),
+ : be_visitor_decl (ctx),
os_ (*ctx->stream ())
{
}
@@ -39,537 +30,67 @@ be_visitor_component_ex_idl::~be_visitor_component_ex_idl (void)
}
int
-be_visitor_component_ex_idl::visit_component (be_component *node)
+be_visitor_component_ex_idl::visit_component (
+ be_component *node)
{
if (node->imported ())
{
return 0;
}
- node_ = node;
-
if (be_global->gen_lem_force_all ())
{
- this->gen_facets ();
- }
-
- this->gen_component ();
-
- this->gen_executor_derived ();
-
- return 0;
-}
-
-int
-be_visitor_component_ex_idl::visit_attribute (be_attribute *node)
-{
- bool rd_only = node->readonly ();
-
- // Keep output statements separate because of side effects.
- // No need to check for anonymous array - anonymous types not
- // accepted by parser for attributes.
- os_ << be_nl
- << (rd_only ? "readonly " : "") << "attribute ";
-
- be_type *ft = be_type::narrow_from_decl (node->field_type ());
-
- os_ << IdentifierHelper::type_name (ft, this);
- os_ << " "
- << IdentifierHelper::try_escape (node->original_local_name ()).c_str ();
-
- this->gen_exception_list (node->get_get_exceptions (),
- rd_only ? "" : "get");
-
- this->gen_exception_list (node->get_set_exceptions (),
- "set");
-
- os_ << ";";
-
- return 0;
-}
-
-int
-be_visitor_component_ex_idl::visit_sequence (be_sequence *node)
-{
- // Keep output statements separate because of side effects.
- os_ << "sequence<";
-
- be_type *bt = be_type::narrow_from_decl (node->base_type ());
-
- os_ << IdentifierHelper::type_name (bt, this);
-
- if (!node->unbounded ())
- {
- os_ << ", " << node->max_size ()->ev ()->u.ulval;
- }
-
- os_ << "> ";
-
- return 0;
-}
-
-int
-be_visitor_component_ex_idl::visit_string (be_string *node)
-{
- bool wide = static_cast<size_t> (node->width ()) > sizeof (char);
-
- os_ << (wide ? "w" : "") << "string";
-
- ACE_CDR::ULong const bound = node->max_size ()->ev ()->u.ulval;
-
- if (bound > 0UL)
- {
- os_ << "<" << bound << ">";
- }
-
- return 0;
-}
-
-void
-be_visitor_component_ex_idl::gen_nesting_open (AST_Decl *node)
-{
- os_ << be_nl;
-
- for (UTL_IdListActiveIterator i (node->name ()); ! i.is_done () ;)
- {
- UTL_ScopedName tmp (i.item (), 0);
- AST_Decl *scope =
- node->defined_in ()->lookup_by_name (&tmp, true);
-
- if (scope == 0)
- {
- i.next ();
- continue;
- }
-
- ACE_CString module_name =
- IdentifierHelper::try_escape (scope->original_local_name ());
-
- if (module_name == "")
- {
- i.next ();
- continue;
- }
-
- i.next ();
-
- if (i.is_done ())
- {
- break;
- }
-
- os_ << be_nl
- << "module " << module_name.c_str () << be_nl
- << "{" << be_idt;
- }
-}
-
-void
-be_visitor_component_ex_idl::gen_nesting_close (AST_Decl *node)
-{
- for (UTL_IdListActiveIterator i (node->name ()); ! i.is_done () ;)
- {
- ACE_CString module_name (i.item ()->get_string ());
-
- if (module_name == "")
- {
- i.next ();
- continue;
- }
-
- i.next ();
-
- if (i.is_done ())
- {
- break;
- }
-
- os_ << be_uidt_nl
- << "};";
- }
-}
-
-void
-be_visitor_component_ex_idl::gen_facets (void)
-{
- for (UTL_ScopeActiveIterator si (node_, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_provides)
- {
- continue;
- }
-
- AST_Provides *p =
- AST_Provides::narrow_from_decl (d);
-
- be_type *impl =
- be_type::narrow_from_decl (p->provides_type ());
-
- if (impl->ex_idl_facet_gen ())
- {
- continue;
- }
-
- this->gen_nesting_open (impl);
-
- os_ << be_nl
- << "local interface CCM_"
- << impl->original_local_name ()->get_string ()
- << " : ::"
- << IdentifierHelper::orig_sn (impl->name ()).c_str ()
- << be_nl
- << "{" << be_idt;
-
- os_ << be_uidt_nl
- << "};";
-
- this->gen_nesting_close (impl);
-
- impl->ex_idl_facet_gen (true);
- }
-}
-
-void
-be_visitor_component_ex_idl::gen_component (void)
-{
- this->gen_nesting_open (node_);
-
- this->gen_executor_base ();
-
- this->gen_context ();
-
- this->gen_nesting_close (node_);
-}
-
-void
-be_visitor_component_ex_idl::gen_executor_base (void)
-{
- AST_Component *base = node_->base_component ();
-
- os_ << be_nl
- << "local interface CCM_"
- << node_->original_local_name ()->get_string ()
- << be_idt_nl
- << ": ";
-
- if (base == 0)
- {
- os_ << "::Components::EnterpriseComponent";
-
- this->gen_supported ();
- }
- else
- {
- ACE_CString sname_str =
- IdentifierHelper::orig_sn (
- ScopeAsDecl (base->defined_in ())->name ());
-
- const char *sname = sname_str.c_str ();
- const char *global = (sname_str == "" ? "" : "::");
-
- os_ << global << sname << "::CCM_"
- << base->original_local_name ()->get_string ();
- }
-
- os_ << be_uidt_nl
- << "{" << be_idt;
-
- this->gen_executor_contents ();
-
- os_ << be_uidt_nl
- << "};";
-}
-
-void
-be_visitor_component_ex_idl::gen_supported (void)
-{
- os_ << be_idt;
-
- AST_Interface **supported = node_->supports ();
-
- for (long i = 0; i < node_->n_supports (); ++i)
- {
- os_ << "," << be_nl
- << "::"
- << IdentifierHelper::orig_sn (supported[i]->name ()).c_str ();
- }
-
- os_ << be_uidt;
-}
-
-void
-be_visitor_component_ex_idl::gen_executor_contents (void)
-{
- this->gen_facet_ops ();
- this->gen_consumer_ops ();
-
- /// This picks up the attributes.
- if (this->visit_scope (node_) == -1)
- {
- ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("be_visitor_component_ex_idl::")
- ACE_TEXT ("gen_executor_contents - ")
- ACE_TEXT ("visit_scope() failed\n")));
- }
-}
-
-void
-be_visitor_component_ex_idl::gen_facet_ops (void)
-{
- for (UTL_ScopeActiveIterator si (node_, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_provides)
- {
- continue;
- }
-
- AST_Provides *p =
- AST_Provides::narrow_from_decl (d);
-
- be_type *impl =
- be_type::narrow_from_decl (p->provides_type ());
-
- AST_Decl *scope = ScopeAsDecl (impl->defined_in ());
-
- ACE_CString sname_str =
- IdentifierHelper::orig_sn (scope->name ());
- const char *sname = sname_str.c_str ();
-
- const char *lname =
- impl->original_local_name ()->get_string ();
-
- const char *global = (sname_str == "" ? "" : "::");
-
- os_ << be_nl
- << global << sname << "::CCM_" << lname << " get_"
- << p->local_name ()->get_string () << " ();";
- }
-}
-
-void
-be_visitor_component_ex_idl::gen_consumer_ops (void)
-{
- for (UTL_ScopeActiveIterator si (node_, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_consumes)
- {
- continue;
- }
-
- AST_Consumes *c =
- AST_Consumes::narrow_from_decl (d);
-
- be_type *impl =
- be_type::narrow_from_decl (c->consumes_type ());
-
- os_ << be_nl
- << "void push_" << c->local_name ()->get_string ()
- << " (in ::"
- << IdentifierHelper::orig_sn (impl->name ()).c_str ()
- << " e);";
- }
-}
-
-void
-be_visitor_component_ex_idl::gen_exception_list (
- UTL_ExceptList *exceptions,
- const char *prefix,
- bool closed)
-{
- if (exceptions != 0 && exceptions->length () > 0)
- {
- os_ << be_idt_nl
- << prefix << "raises ( ";
-
- for (UTL_ExceptlistActiveIterator ei (exceptions);
- !ei.is_done ();)
- {
- os_ << "::"
- << IdentifierHelper::orig_sn (ei.item ()->name ()).c_str ();
-
- ei.next ();
-
- if (!ei.is_done () || !closed)
- {
- os_ << ", ";
- }
- }
-
- if (closed)
+ be_visitor_facet_ex_idl facet_visitor (this->ctx_);
+
+ if (facet_visitor.visit_scope (node) == -1)
{
- os_ << ")" << be_uidt;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_component_ex_idl::")
+ ACE_TEXT ("visit_component - ")
+ ACE_TEXT ("facet visitor failed\n")),
+ -1);
}
}
-}
-void
-be_visitor_component_ex_idl::gen_context (void)
-{
- os_ << be_nl << be_nl
- << "local interface CCM_"
- << node_->original_local_name ()->get_string ()
- << "_Context" << be_idt_nl
- << ": ";
+ be_util::gen_nesting_open (os_, node);
- AST_Component *base = node_->base_component ();
-
- if (base == 0)
- {
- os_ << "::Components::SessionContext";
- }
- else
+ be_visitor_executor_ex_idl exec_visitor (this->ctx_);
+
+ if (exec_visitor.visit_component (node) == -1)
{
- AST_Decl *scope = ScopeAsDecl (base->defined_in ());
-
- ACE_CString sname_str =
- IdentifierHelper::orig_sn (scope->name ());
- const char *sname = sname_str.c_str ();
-
- const char *lname =
- base->original_local_name ()->get_string ();
-
- const char *global = (sname_str == "" ? "" : "::");
-
- os_ << global << sname << "::CCM_" << lname << "_Context";
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_component_ex_idl::")
+ ACE_TEXT ("visit_component - ")
+ ACE_TEXT ("executor visitor failed\n")),
+ -1);
}
- os_ << be_uidt_nl
- << "{" << be_idt;
-
- this->gen_publisher_ops ();
- this->gen_emitter_ops ();
- this->gen_receptacle_ops ();
-
- os_ << be_uidt_nl
- << "};";
-}
-
-void
-be_visitor_component_ex_idl::gen_publisher_ops (void)
-{
- for (UTL_ScopeActiveIterator si (node_, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
+ be_visitor_context_ex_idl context_visitor (this->ctx_);
+
+ if (context_visitor.visit_component (node) == -1)
{
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_publishes)
- {
- continue;
- }
-
- AST_Publishes *p =
- AST_Publishes::narrow_from_decl (d);
-
- be_type *impl =
- be_type::narrow_from_decl (p->publishes_type ());
-
- os_ << be_nl
- << "void push_" << p->local_name ()->get_string () << " (in ::"
- << IdentifierHelper::orig_sn (impl->name ()).c_str ()
- << " e);";
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_component_ex_idl::")
+ ACE_TEXT ("visit_component - ")
+ ACE_TEXT ("context visitor failed\n")),
+ -1);
}
-}
-void
-be_visitor_component_ex_idl::gen_emitter_ops (void)
-{
- for (UTL_ScopeActiveIterator si (node_, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
+ be_util::gen_nesting_close (os_, node);
- if (d->node_type () != AST_Decl::NT_emits)
- {
- continue;
- }
-
- AST_Emits *e =
- AST_Emits::narrow_from_decl (d);
-
- be_type *impl =
- be_type::narrow_from_decl (e->emits_type ());
-
- os_ << be_nl
- << "void push_" << e->local_name ()->get_string () << " (in ::"
- << IdentifierHelper::orig_sn (impl->name ()).c_str ()
- << " e);";
- }
-}
-
-void
-be_visitor_component_ex_idl::gen_receptacle_ops (void)
-{
- for (UTL_ScopeActiveIterator si (node_, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_uses)
- {
- continue;
- }
-
- AST_Uses *u =
- AST_Uses::narrow_from_decl (d);
-
- be_type *impl =
- be_type::narrow_from_decl (u->uses_type ());
-
- os_ << be_nl
- << "::";
-
- // Note that we don't strip off the possible '_cxx_' when
- // adding the 'Connections' suffix. The front end will
- // create this implied IDL node with the '_cxx_' so lookup
- // will fail (when processing the *E.idl file) if we
- // strip it off here.
- if (u->is_multiple ())
- {
- os_ << IdentifierHelper::orig_sn (node_->name ()).c_str ()
- << "::" << u->local_name ()->get_string ()
- << "Connections get_connections_"
- << u->local_name ()->get_string () << " ();";
- }
- else
- {
- os_ << IdentifierHelper::orig_sn (impl->name ()).c_str ()
- << " get_connection_"
- << u->local_name ()->get_string () << " ();";
- }
- }
-}
-
-void
-be_visitor_component_ex_idl::gen_executor_derived (void)
-{
- AST_Decl *scope = ScopeAsDecl (node_->defined_in ());
+ AST_Decl *scope = ScopeAsDecl (node->defined_in ());
ACE_CString sname_str =
IdentifierHelper::orig_sn (scope->name ());
const char *sname = sname_str.c_str ();
const char *lname =
- node_->original_local_name ()->get_string ();
+ node->original_local_name ()->get_string ();
const char *global = (sname_str == "" ? "" : "::");
os_ << be_nl << be_nl
- << "module CIAO_" << node_->flat_name () << "_Impl" << be_nl
+ << "module CIAO_" << node->flat_name () << "_Impl" << be_nl
<< "{" << be_idt_nl
<< "typedef " << global << sname << "::CCM_" << lname
<< "_Context " << lname << "_Exec_Context;";
@@ -584,5 +105,7 @@ be_visitor_component_ex_idl::gen_executor_derived (void)
os_ << be_uidt_nl
<< "};";
+
+ return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_component/component_exh.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_exh.cpp
index 1928ce8136e..bb474af29a2 100644
--- a/TAO/TAO_IDL/be/be_visitor_component/component_exh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_component/component_exh.cpp
@@ -18,20 +18,14 @@
//
// ============================================================================
-ACE_RCSID (be_visitor_component,
- component_exh,
- "$Id$")
-
-// ******************************************************
-// Component visitor for CIAO exec impl header
-// ******************************************************
-
be_visitor_component_exh::be_visitor_component_exh (be_visitor_context *ctx)
- : be_visitor_component (ctx),
- node_ (0),
- os_ (*ctx->stream ()),
- export_macro_ (be_global->exec_export_macro ())
+ : be_visitor_component_scope (ctx)
{
+ // This is initialized in the base class to svnt_export_macro()
+ // or skel_export_macro(), since there are many more visitor
+ // classes generating servant code. So we can just override
+ // all that here
+ export_macro_ = be_global->exec_export_macro ();
}
be_visitor_component_exh::~be_visitor_component_exh (void)
@@ -41,39 +35,41 @@ be_visitor_component_exh::~be_visitor_component_exh (void)
int
be_visitor_component_exh::visit_component (be_component *node)
{
- if (node->imported ())
- {
- return 0;
- }
-
node_ = node;
-
+
/// CIDL-generated namespace used 'CIDL_' + composition name.
/// Now we use 'CIAO_' + component's flat name.
os_ << be_nl << be_nl
- << "namespace CIAO_" << node_->flat_name ()
+ << "namespace CIAO_" << node->flat_name ()
<< "_Impl" << be_nl
<< "{" << be_idt;
- if (this->gen_facets () == -1)
+ be_visitor_facet_exh facet_visitor (this->ctx_);
+
+ // (JP) Should this be visit_component_scope(), i.e.,
+ // generate inherited facets as well? Probably the
+ // behavior should be tied to the LEM force-all option.
+ if (facet_visitor.visit_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("be_visitor_component_exh::")
ACE_TEXT ("visit_component - ")
- ACE_TEXT ("gen_facets() failed\n")),
+ ACE_TEXT ("facet visitor failed\n")),
-1);
}
-
- if (this->gen_exec_class () == -1)
+
+ be_visitor_executor_exh exec_visitor (this->ctx_);
+
+ if (exec_visitor.visit_component (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("be_visitor_component_exh::")
ACE_TEXT ("visit_component - ")
- ACE_TEXT ("gen_servant_class() failed\n")),
+ ACE_TEXT ("exec visitor failed\n")),
-1);
}
- this->gen_entrypoint ();
+ this->gen_exec_entrypoint_decl ();
os_ << be_uidt_nl
<< "}";
@@ -81,366 +77,3 @@ be_visitor_component_exh::visit_component (be_component *node)
return 0;
}
-int
-be_visitor_component_exh::visit_operation (be_operation *node)
-{
- be_visitor_operation_ch v (this->ctx_);
- return v.visit_operation (node);
-}
-
-int
-be_visitor_component_exh::visit_attribute (be_attribute *node)
-{
- be_visitor_attribute v (this->ctx_);
- return v.visit_attribute (node);
-}
-
-int
-be_visitor_component_exh::gen_facets (void)
-{
- for (UTL_ScopeActiveIterator si (node_, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_provides)
- {
- continue;
- }
-
- AST_Provides *p =
- AST_Provides::narrow_from_decl (d);
-
- be_type *impl =
- be_type::narrow_from_decl (p->provides_type ());
-
- // We don't want a '_cxx_' prefix here.
- const char *lname =
- impl->original_local_name ()->get_string ();
-
- AST_Decl *s = ScopeAsDecl (impl->defined_in ());
- ACE_CString sname_str =
- IdentifierHelper::orig_sn (s->name (), false);
- const char *sname = sname_str.c_str ();
- const char *global = (sname_str == "" ? "" : "::");
-
- os_ << be_nl
- << "class " << export_macro_.c_str () << " "
- << lname << "_exec_i" << be_idt_nl
- << ": public virtual " << global << sname << "::CCM_"
- << lname << "," << be_idt_nl
- << "public virtual ::CORBA::LocalObject"
- << be_uidt << be_uidt_nl
- << "{" << be_nl
- << "public:" << be_idt_nl
- << lname << "_exec_i (void);" << be_nl
- << "virtual ~" << lname << "_exec_i (void);";
-
- if (impl->node_type () == AST_Decl::NT_interface)
- {
- be_interface *intf =
- be_interface::narrow_from_decl (impl);
-
- os_ << be_nl << be_nl
- << "// Operations and attributes from ::"
- << intf->full_name ();
-
- if (this->gen_facet_ops_attrs (intf) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_component_exh::gen_facet - "
- "gen_facet_ops_attrs() failed\n"),
- -1);
- }
- }
-
- os_ << be_uidt_nl
- << "};" << be_nl;
- }
-
- return 0;
-}
-
-int
-be_visitor_component_exh::gen_facet_ops_attrs (be_interface *node)
-{
- int status =
- node->traverse_inheritance_graph (
- be_visitor_component_exh::op_attr_decl_helper,
- &os_);
-
- if (status == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_component_exh::")
- ACE_TEXT ("gen_facet_ops_attrs - ")
- ACE_TEXT ("traverse_inheritance_graph() failed\n")),
- -1);
- }
-
- return 0;
-}
-
-int
-be_visitor_component_exh::gen_exec_class (void)
-{
- AST_Decl *scope = ScopeAsDecl (node_->defined_in ());
- ACE_CString sname_str (scope->full_name ());
- const char *sname = sname_str.c_str ();
-
- // No _cxx_ prefix.
- const char *lname =
- node_->original_local_name ()->get_string ();
-
- const char *global = (sname_str == "" ? "" : "::");
-
- os_ << be_nl
- << "class " << export_macro_.c_str () << " " << lname
- << "_exec_i" << be_idt_nl
- << ": public virtual " << lname << "_Exec," << be_idt_nl
- << "public virtual ::CORBA::LocalObject"
- << be_uidt << be_uidt_nl
- << "{" << be_nl
- << "public:" << be_idt_nl;
-
- os_ << lname << "_exec_i (void);";
-
- os_ << be_nl
- << "virtual ~" << lname << "_exec_i (void);";
-
- os_ << be_nl << be_nl
- << "// Supported operations and attributes.";
-
- int status =
- node_->traverse_inheritance_graph (
- be_visitor_component_exh::op_attr_decl_helper,
- &os_,
- false,
- false);
-
- if (status == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_component_exh::")
- ACE_TEXT ("gen_exec_class - ")
- ACE_TEXT ("traverse_inheritance_graph() failed\n")),
- -1);
- }
-
- os_ << be_nl << be_nl
- << "// Component attributes.";
-
- status = this->gen_component_attrs_r (node_);
-
- if (status == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_component_exh::")
- ACE_TEXT ("gen_exec_class - ")
- ACE_TEXT ("gen_component_attrs_r() failed\n")),
- -1);
- }
-
- os_ << be_nl << be_nl
- << "// Port operations.";
-
- this->gen_provides_r (node_);
- this->gen_consumes_r (node_);
-
- this->gen_non_type_specific ();
-
- os_ << be_uidt_nl << be_nl
- << "private:" << be_idt_nl
- << global << sname << "::CCM_" << lname
- << "_Context_var context_;"
- << be_uidt_nl
- << "};";
-
- return 0;
-}
-
-int
-be_visitor_component_exh::gen_component_attrs_r (AST_Component *node)
-{
- if (node == 0)
- {
- return 0;
- }
-
- /// Traverse the scope and ignore everything but attributes.
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
- be_attribute *attr = be_attribute::narrow_from_decl (d);
-
- if (attr == 0)
- {
- continue;
- }
-
- if (attr->accept (this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_component_exh::")
- ACE_TEXT ("gen_component_attrs_r - ")
- ACE_TEXT ("be_attribute::accept() failed\n")),
- -1);
- }
- }
-
- node = node->base_component ();
- return this->gen_component_attrs_r (node);
-}
-
-void
-be_visitor_component_exh::gen_provides_r (AST_Component *node)
-{
- if (node == 0)
- {
- return;
- }
-
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_provides)
- {
- continue;
- }
-
- AST_Provides *p =
- AST_Provides::narrow_from_decl (d);
-
- be_type *impl =
- be_type::narrow_from_decl (p->provides_type ());
-
- this->gen_provides (impl, p->local_name ()->get_string ());
- }
-
- node = node->base_component ();
- this->gen_provides_r (node);
-}
-
-void
-be_visitor_component_exh::gen_provides (AST_Type *obj,
- const char *port_name)
-{
- AST_Decl *scope = ScopeAsDecl (obj->defined_in ());
- ACE_CString sname_str (scope->full_name ());
- const char *sname = sname_str.c_str ();
-
- // No '_cxx_' prefix.
- const char *lname =
- obj->original_local_name ()->get_string ();
-
- const char *global = (sname_str == "" ? "" : "::");
-
- os_ << be_nl << be_nl
- << "virtual " << global << sname << "::CCM_"
- << lname << "_ptr" << be_nl
- << "get_" << port_name << " (void);";
-}
-
-void
-be_visitor_component_exh::gen_consumes_r (AST_Component *node)
-{
- if (node == 0)
- {
- return;
- }
-
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_consumes)
- {
- continue;
- }
-
- AST_Consumes *c =
- AST_Consumes::narrow_from_decl (d);
-
- ACE_DEBUG ((LM_DEBUG, "%s\n", c->full_name ()));
-
- be_type *impl =
- be_type::narrow_from_decl (c->consumes_type ());
-
- this->gen_consumes (impl->full_name (),
- c->local_name ()->get_string ());
- }
-
- node = node->base_component ();
- this->gen_consumes_r (node);
-}
-
-void
-be_visitor_component_exh::gen_consumes (const char *obj_name,
- const char *port_name)
-{
- os_ << be_nl << be_nl
- << "virtual void" << be_nl
- << "push_" << port_name << " (" << be_idt_nl
- << "::" << obj_name << " * ev);" << be_uidt;
-}
-
-void
-be_visitor_component_exh::gen_non_type_specific (void)
-{
- os_ << be_nl << be_nl
- << "// Operations from Components::SessionComponent.";
-
- os_ << be_nl << be_nl
- << "virtual void" << be_nl
- << "set_session_context (" << be_idt_nl
- << "::Components::SessionContext_ptr ctx);" << be_uidt;
-
- os_ << be_nl << be_nl
- << "virtual void configuration_complete (void);";
-
- os_ << be_nl << be_nl
- << "virtual void ccm_activate (void);" << be_nl
- << "virtual void ccm_passivate (void);" << be_nl
- << "virtual void ccm_remove (void);";
-}
-
-void
-be_visitor_component_exh::gen_entrypoint (void)
-{
- os_ << be_nl << be_nl
- << "extern \"C\" " << export_macro_.c_str ()
- << " ::Components::EnterpriseComponent_ptr" << be_nl
- << "create_" << node_->flat_name ()
- << "_Impl (void);";
-}
-
-int
-be_visitor_component_exh::op_attr_decl_helper (be_interface * /*derived */,
- be_interface *ancestor,
- TAO_OutStream *os)
-{
- if (be_component::narrow_from_decl (ancestor) != 0)
- {
- return 0;
- }
-
- /// We're in a static method, so we have to instantiate a temporary
- /// visitor and context.
- be_visitor_context ctx;
- ctx.state (TAO_CodeGen::TAO_ROOT_EXH);
- ctx.stream (os);
- be_visitor_component_exh visitor (&ctx);
-
- /// Since this visitor overriddes only visit_operation() and
- /// visit_attribute(), we can get away with this for the declarations.
- return visitor.visit_scope (ancestor);
-}
-
diff --git a/TAO/TAO_IDL/be/be_visitor_component/component_exs.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_exs.cpp
index bdaf85ba2af..4871359b5be 100644
--- a/TAO/TAO_IDL/be/be_visitor_component/component_exs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_component/component_exs.cpp
@@ -18,24 +18,15 @@
//
// ============================================================================
-ACE_RCSID (be_visitor_component,
- component_exs,
- "$Id$")
-
-// ******************************************************
-// Component visitor for CIAO exec impl source
-// ******************************************************
-
-be_visitor_component_exs::be_visitor_component_exs (be_visitor_context *ctx)
- : be_visitor_component (ctx),
- node_ (0),
- op_scope_ (0),
- os_ (*ctx->stream ()),
- comment_border_ ("//=============================="
- "=============================="),
- your_code_here_ ("/* Your code here. */"),
- export_macro_ (be_global->exec_export_macro ())
+be_visitor_component_exs::be_visitor_component_exs (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
{
+ // This is initialized in the base class to svnt_export_macro()
+ // or skel_export_macro(), since there are many more visitor
+ // classes generating servant code. So we can just override
+ // all that here.
+ export_macro_ = be_global->exec_export_macro ();
}
be_visitor_component_exs::~be_visitor_component_exs (void)
@@ -50,29 +41,36 @@ be_visitor_component_exs::visit_component (be_component *node)
/// CIDL-generated namespace used 'CIDL_' + composition name.
/// Now we use 'CIAO_' + component's flat name.
os_ << be_nl << be_nl
- << "namespace CIAO_" << node_->flat_name ()
+ << "namespace CIAO_" << node->flat_name ()
<< "_Impl" << be_nl
<< "{" << be_idt;
+
+ be_visitor_facet_exs facet_visitor (this->ctx_);
- if (this->gen_facets () == -1)
+ // (JP) Should this be visit_component_scope(), i.e.,
+ // generate inherited facets as well? Probably the
+ // behavior should be tied to the LEM force-all option.
+ if (facet_visitor.visit_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("be_visitor_component_exs::")
ACE_TEXT ("visit_component - ")
- ACE_TEXT ("gen_facets() failed\n")),
+ ACE_TEXT ("facet visitor failed\n")),
-1);
}
+
+ be_visitor_executor_exs exec_visitor (this->ctx_);
- if (this->gen_exec_class () == -1)
+ if (exec_visitor.visit_component (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("be_visitor_component_exs::")
ACE_TEXT ("visit_component - ")
- ACE_TEXT ("gen_servant_class() failed\n")),
+ ACE_TEXT ("exec visitor failed\n")),
-1);
}
- this->gen_entrypoint ();
+ this->gen_exec_entrypoint_defn ();
os_ << be_uidt_nl
<< "}";
@@ -80,431 +78,10 @@ be_visitor_component_exs::visit_component (be_component *node)
return 0;
}
-int
-be_visitor_component_exs::visit_operation (be_operation *node)
-{
- be_visitor_operation_exs v (this->ctx_);
- v.scope (op_scope_);
- return v.visit_operation (node);
-}
-
-int
-be_visitor_component_exs::visit_attribute (be_attribute *node)
-{
- be_visitor_attribute v (this->ctx_);
- v.op_scope (op_scope_);
- return v.visit_attribute (node);
-}
-
-int
-be_visitor_component_exs::gen_facets (void)
-{
- for (UTL_ScopeActiveIterator si (node_, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_provides)
- {
- continue;
- }
-
- AST_Provides *p =
- AST_Provides::narrow_from_decl (d);
-
- be_type *impl =
- be_type::narrow_from_decl (p->provides_type ());
-
- // We don't want any '_cxx_' prefix here.
- const char *lname =
- impl->original_local_name ()->get_string ();
-
- os_ << be_nl
- << comment_border_ << be_nl
- << "// Facet Executor Implementation Class: "
- << lname << "_exec_i" << be_nl
- << comment_border_;
-
- os_ << be_nl << be_nl
- << lname << "_exec_i::" << lname
- << "_exec_i (void)" << be_nl
- << "{" << be_nl
- << "}";
-
- os_ << be_nl << be_nl
- << lname << "_exec_i::~" << lname
- << "_exec_i (void)" << be_nl
- << "{" << be_nl
- << "}";
-
- if (impl->node_type () == AST_Decl::NT_interface)
- {
- be_interface *intf =
- be_interface::narrow_from_decl (impl);
-
- op_scope_ = intf;
-
- if (this->gen_facet_ops_attrs (intf) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_component_exs::gen_facet - "
- "gen_facet_ops_attrs() failed\n"),
- -1);
- }
- }
- }
-
- return 0;
-}
-
-int
-be_visitor_component_exs::gen_facet_ops_attrs (be_interface *node)
-{
- os_ << be_nl << be_nl
- << "// Operations from ::" << node->full_name ();
-
- /// The overload of traverse_inheritance_graph() used here
- /// doesn't automatically prime the queues.
- node->get_insert_queue ().reset ();
- node->get_del_queue ().reset ();
- node->get_insert_queue ().enqueue_tail (node);
-
- Component_Exec_Op_Attr_Generator op_attr_gen (this);
-
- int status =
- node->traverse_inheritance_graph (op_attr_gen,
- &os_,
- false,
- false);
-
- if (status == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_component_exs::")
- ACE_TEXT ("gen_facet_ops_attrs - ")
- ACE_TEXT ("traverse_inheritance_graph() ")
- ACE_TEXT ("failed\n")),
- -1);
- }
-
- return 0;
-}
-
-int
-be_visitor_component_exs::gen_exec_class (void)
-{
- const char *lname = node_->local_name ();
-
- // In the interest of pretty formatting....
- for (UTL_ScopeActiveIterator si (node_, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () == AST_Decl::NT_provides)
- {
- os_ << be_nl;
- break;
- }
- }
-
- os_ << be_nl
- << comment_border_ << be_nl
- << "// Component Executor Implementation Class: "
- << lname << "_exec_i" << be_nl
- << comment_border_;
-
- os_ << be_nl << be_nl
- << lname << "_exec_i::" << lname << "_exec_i (void)" << be_nl
- << "{" << be_nl
- << "}";
-
- os_ << be_nl << be_nl
- << lname << "_exec_i::~" << lname << "_exec_i (void)" << be_nl
- << "{" << be_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "// Supported operations and attributes.";
-
- op_scope_ = node_;
-
- /// The overload of traverse_inheritance_graph() used here
- /// doesn't automatically prime the queues.
- node_->get_insert_queue ().reset ();
- node_->get_del_queue ().reset ();
- node_->get_insert_queue ().enqueue_tail (node_);
-
- Component_Exec_Op_Attr_Generator op_attr_gen (this);
-
- int status =
- node_->traverse_inheritance_graph (op_attr_gen,
- &os_,
- false,
- false);
-
- if (status == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_component_exs::")
- ACE_TEXT ("gen_exec_class - ")
- ACE_TEXT ("traverse_inheritance_graph() failed\n")),
- -1);
- }
-
- os_ << be_nl << be_nl
- << "// Component attributes.";
-
- status = this->gen_component_attrs_r (node_);
-
- if (status == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_component_exs::")
- ACE_TEXT ("gen_exec_class - ")
- ACE_TEXT ("gen_component_attrs_r() failed\n")),
- -1);
- }
-
- os_ << be_nl << be_nl
- << "// Port operations.";
-
- this->gen_provides_r (node_);
- this->gen_consumes_r (node_);
-
- this->gen_non_type_specific ();
-
- return 0;
-}
-
-int
-be_visitor_component_exs::gen_component_attrs_r (AST_Component *node)
-{
- if (node == 0)
- {
- return 0;
- }
-
- /// Traverse the scope and ignore everything but attributes.
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
- be_attribute *attr = be_attribute::narrow_from_decl (d);
-
- if (attr == 0)
- {
- continue;
- }
-
- if (attr->accept (this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_component_exs::")
- ACE_TEXT ("gen_component_attrs_r - ")
- ACE_TEXT ("be_attribute::accept() failed\n")),
- -1);
- }
- }
-
- node = node->base_component ();
- return this->gen_component_attrs_r (node);
-}
-
-void
-be_visitor_component_exs::gen_provides_r (AST_Component *node)
-{
- if (node == 0)
- {
- return;
- }
-
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_provides)
- {
- continue;
- }
-
- AST_Provides *p =
- AST_Provides::narrow_from_decl (d);
-
- be_type *impl =
- be_type::narrow_from_decl (p->provides_type ());
-
- this->gen_provides (impl, p->local_name ());
- }
-
- node = node->base_component ();
- this->gen_provides_r (node);
-}
-
-void
-be_visitor_component_exs::gen_provides (AST_Type *obj,
- Identifier *port_id)
-{
- AST_Decl *scope = ScopeAsDecl (obj->defined_in ());
- ACE_CString sname_str (scope->full_name ());
- const char *sname = sname_str.c_str ();
-
- // No '_cxx_' prefix.
- const char *lname = obj->original_local_name ()->get_string ();
-
- const char *global = (sname_str == "" ? "" : "::");
-
- const char *port_name = port_id->get_string ();
-
- os_ << be_nl << be_nl
- << global << sname << "::CCM_" << lname
- << "_ptr" << be_nl
- << node_->local_name () << "_exec_i::get_"
- << port_name << " (void)" << be_nl
- << "{" << be_idt_nl
- << your_code_here_ << be_nl
- << "return " << global << sname << "::CCM_"
- << lname << "::_nil ();" << be_uidt_nl
- << "}";
-}
-
-void
-be_visitor_component_exs::gen_consumes_r (AST_Component *node)
-{
- if (node == 0)
- {
- return;
- }
-
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_consumes)
- {
- continue;
- }
-
- AST_Consumes *c =
- AST_Consumes::narrow_from_decl (d);
-
- be_type *impl =
- be_type::narrow_from_decl (c->consumes_type ());
-
- this->gen_consumes (impl, c->local_name ());
- }
-
- node = node->base_component ();
- this->gen_consumes_r (node);
-}
-
-void
-be_visitor_component_exs::gen_consumes (AST_Type *obj,
- Identifier *port_id)
-{
- const char *port_name = port_id->get_string ();
-
- os_ << be_nl << be_nl
- << "void" << be_nl
- << node_->original_local_name () << "_exec_i::push_"
- << port_name << " (" << be_idt_nl
- << "::" << IdentifierHelper::orig_sn (obj->name (), false).c_str ()
- << " * /* ev */)" << be_uidt_nl
- << "{" << be_idt_nl
- << your_code_here_ << be_uidt_nl
- << "}";
-}
-
-void
-be_visitor_component_exs::gen_non_type_specific (void)
-{
- os_ << be_nl << be_nl
- << "// Operations from Components::SessionComponent.";
-
- AST_Decl *scope = ScopeAsDecl (node_->defined_in ());
- ACE_CString sname_str (scope->full_name ());
- const char *sname = sname_str.c_str ();
- const char *lname = node_->local_name ();
- const char *global = (sname_str == "" ? "" : "::");
-
- os_ << be_nl << be_nl
- << "void" << be_nl
- << node_->local_name ()
- << "_exec_i::set_session_context (" << be_idt_nl
- << "::Components::SessionContext_ptr ctx)" << be_uidt_nl
- << "{" << be_idt_nl
- << "this->context_ =" << be_idt_nl
- << global << sname << "::CCM_" << lname
- << "_Context::_narrow (ctx);" << be_uidt_nl << be_nl
- << "if ( ::CORBA::is_nil (this->context_.in ()))" << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::CORBA::INTERNAL ();" << be_uidt_nl
- << "}" << be_uidt << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "void" << be_nl
- << node_->local_name ()
- << "_exec_i::configuration_complete (void)" << be_nl
- << "{" << be_idt_nl
- << your_code_here_ << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "void" << be_nl
- << node_->local_name ()
- << "_exec_i::ccm_activate (void)" << be_nl
- << "{" << be_idt_nl
- << your_code_here_ << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "void" << be_nl
- << node_->local_name ()
- << "_exec_i::ccm_passivate (void)" << be_nl
- << "{" << be_idt_nl
- << your_code_here_ << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "void" << be_nl
- << node_->local_name ()
- << "_exec_i::ccm_remove (void)" << be_nl
- << "{" << be_idt_nl
- << your_code_here_ << be_uidt_nl
- << "}";
-}
-
-void
-be_visitor_component_exs::gen_entrypoint (void)
-{
- os_ << be_nl << be_nl
- << "extern \"C\" " << export_macro_.c_str ()
- << " ::Components::EnterpriseComponent_ptr" << be_nl
- << "create_" << node_->flat_name ()
- << "_Impl (void)" << be_nl
- << "{" << be_idt_nl
- << "::Components::EnterpriseComponent_ptr retval ="
- << be_idt_nl
- << "::Components::EnterpriseComponent::_nil ();"
- << be_uidt_nl << be_nl
- << "ACE_NEW_NORETURN (" << be_idt_nl
- << "retval," << be_nl
- << node_->local_name () << "_exec_i);"
- << be_uidt_nl << be_nl
- << "return retval;" << be_uidt_nl
- << "}";
-}
+// ==================================================
Component_Exec_Op_Attr_Generator::Component_Exec_Op_Attr_Generator (
- be_visitor_scope * visitor)
+ be_visitor_scope * visitor)
: visitor_ (visitor)
{
}
diff --git a/TAO/TAO_IDL/be/be_visitor_component/component_svh.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_svh.cpp
index 97257994785..c025672d119 100644
--- a/TAO/TAO_IDL/be/be_visitor_component/component_svh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_component/component_svh.cpp
@@ -18,20 +18,14 @@
//
// ============================================================================
-ACE_RCSID (be_visitor_component,
- component_svh,
- "$Id$")
-
// ******************************************************
// Component visitor for server header
// ******************************************************
be_visitor_component_svh::be_visitor_component_svh (be_visitor_context *ctx)
: be_visitor_component (ctx),
- node_ (0),
os_ (*ctx->stream ()),
- export_macro_ (be_global->svnt_export_macro ()),
- in_ancestor_ (false)
+ export_macro_ (be_global->svnt_export_macro ())
{
/// All existing CIAO examples set the servant export values in the CIDL
/// compiler to equal the IDL compiler's skel export values. Below is a
@@ -50,852 +44,64 @@ be_visitor_component_svh::~be_visitor_component_svh (void)
int
be_visitor_component_svh::visit_component (be_component *node)
{
- node_ = node;
-
- if (this->gen_facets () == -1)
+ // Generate the facet servant class declaration.
+ be_visitor_facet_svh facet_visitor (this->ctx_);
+
+ if (facet_visitor.visit_component_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("be_visitor_component_svh::")
ACE_TEXT ("visit_component - ")
- ACE_TEXT ("gen_facets() failed\n")),
+ ACE_TEXT ("facet visitor failed\n")),
-1);
}
/// CIDL-generated namespace used 'CIDL_' + composition name.
/// Now we use 'CIAO_' + component's flat name.
os_ << be_nl << be_nl
- << "namespace CIAO_" << node_->flat_name ()
+ << "namespace CIAO_" << node->flat_name ()
<< "_Impl" << be_nl
<< "{" << be_idt;
- this->gen_context_class ();
+ // Generate the context class declaration.
+ be_visitor_context_svh context_visitor (this->ctx_);
- if (this->gen_servant_class () == -1)
+ if (context_visitor.visit_component (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("be_visitor_component_svh::")
ACE_TEXT ("visit_component - ")
- ACE_TEXT ("gen_servant_class() failed\n")),
+ ACE_TEXT ("context visitor failed\n")),
-1);
}
+
+ // Generate the servant class declaration.
+ be_visitor_servant_svh servant_visitor (this->ctx_);
- this->gen_entrypoint ();
-
- os_ << be_uidt_nl
- << "}";
-
- return 0;
-}
-
-int
-be_visitor_component_svh::visit_operation (be_operation *node)
-{
- be_visitor_operation_ch v (this->ctx_);
- return v.visit_operation (node);
-}
-
-int
-be_visitor_component_svh::visit_attribute (be_attribute *node)
-{
- be_visitor_attribute v (this->ctx_);
- return v.visit_attribute (node);
-}
-
-int
-be_visitor_component_svh::visit_extended_port (
- be_extended_port *)
-{
- return 0;
-}
-
-int
-be_visitor_component_svh::visit_mirror_port (
- be_mirror_port *)
-{
- return 0;
-}
-
-int
-be_visitor_component_svh::gen_facets (void)
-{
- for (UTL_ScopeActiveIterator si (node_, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
- AST_Decl::NodeType nt = d->node_type ();
-
- switch (nt)
- {
- case AST_Decl::NT_provides:
- {
- be_provides *p =
- be_provides::narrow_from_decl (d);
-
- if (p->gen_facet_svnt_decl (os_) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_component_svh")
- ACE_TEXT ("::gen_facets - ")
- ACE_TEXT ("gen_facet_svnt_decl() ")
- ACE_TEXT ("failed\n")),
- -1);
- }
-
- break;
- }
- case AST_Decl::NT_ext_port:
- {
- be_extended_port *ep =
- be_extended_port::narrow_from_decl (d);
-
- be_visitor_extended_port_facet_svh visitor (this->ctx_);
-
- if (visitor.visit_extended_port (ep) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_component_svh::gen_facets - "
- "visit_extended_port() failed\n"),
- -1);
- }
-
- break;
- }
- case AST_Decl::NT_mirror_port:
- {
- be_mirror_port *mp =
- be_mirror_port::narrow_from_decl (d);
-
- if (this->visit_mirror_port (mp) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_component_svh::gen_facets - "
- "visit_mirror_port() failed\n"),
- -1);
- }
-
- break;
- }
- default:
- continue;
- }
- }
-
- return 0;
-}
-
-void
-be_visitor_component_svh::gen_context_class (void)
-{
- AST_Decl *scope = ScopeAsDecl (node_->defined_in ());
- ACE_CString sname_str (scope->full_name ());
- const char *sname = sname_str.c_str ();
-
- // No '_cxx_' prefix.
- const char *lname =
- node_->original_local_name ()->get_string ();
-
- const char *global = (sname_str == "" ? "" : "::");
- bool swapping = be_global->gen_component_swapping ();
-
- os_ << be_nl
- << "class " << lname << "_Servant;"
- << be_nl << be_nl;
-
- os_ << "class " << export_macro_.c_str () << " " << lname
- << "_Context" << be_idt_nl
- << ": public virtual ::CIAO::"
- << (swapping ? "Upgradeable_" : "")
- << "Context_Impl<" << be_idt << be_idt_nl
- << global << sname << "::CCM_" << lname
- << "_Context," << be_nl
- << lname << "_Servant," << be_nl
- << "::" << node_->name () << ">" << be_uidt << be_uidt << be_uidt_nl
- << "{" << be_nl
- << "public:" << be_idt_nl;
-
- os_ << "// Allow the servant to access our state." << be_nl
- << "friend class " << lname << "_Servant;"
- << be_nl << be_nl;
-
- os_ << "// Some useful typedefs." << be_nl<< be_nl
- << "typedef" << be_nl
- << "::CIAO::Context_Impl<" << be_idt << be_idt_nl
- << global << sname << "::CCM_"
- << lname << "_Context," << be_nl
- << lname << "_Servant," << be_nl
- << "::" << node_->name () << ">" << be_uidt_nl
- << "base_type;" << be_uidt_nl << be_nl;
-
- os_ << "typedef base_type::context_type context_type;" << be_nl
- << "typedef base_type::servant_type servant_type;" << be_nl
- << "typedef base_type::component_type component_type;"
- << be_nl << be_nl;
-
- os_ << lname << "_Context (" << be_idt_nl
- << "::Components::CCMHome_ptr h," << be_nl
- << "::CIAO::Container_ptr c," << be_nl
- << lname << "_Servant *sv);" << be_uidt_nl << be_nl;
-
- os_ << "virtual ~" << lname << "_Context (void);";
-
- os_ << be_nl << be_nl
- << "// CIAO-specific." << be_nl
- << "static " << lname << "_Context *" << be_nl
- << "_narrow ( ::Components::SessionContext_ptr p);";
-
- this->gen_context_r (node_);
-
- if (swapping)
- {
- os_ << be_nl << be_nl
- << "/// Operation defined in " << sname << "::CCM_"
- << lname << "_Context" << be_nl
- << "/// that enable component swapping in the container."
- << be_nl
- << "virtual ::Components::ConsumerDescriptions *" << be_nl
- << "get_registered_consumers (const char * publisher_name);";
- }
-
- os_ << be_uidt_nl
- << "};";
-}
-
-void
-be_visitor_component_svh::gen_context_r (AST_Component *node)
-{
- if (node == 0)
- {
- return;
- }
-
- AST_Decl *scope = ScopeAsDecl (node->defined_in ());
- ACE_CString sname_str (scope->full_name ());
- const char *sname = sname_str.c_str ();
-
- // No '_cxx_' prefix.
- const char *lname =
- node->original_local_name ()->get_string ();
-
- const char *global = (sname_str == "" ? "" : "::");
-
- os_ << be_nl << be_nl
- << "// Operations for " << lname
- << " receptacles and event sources,"
- << be_nl
- << "// defined in " << global << sname
- << "::CCM_" << lname << "_Context.";
-
- this->gen_ports (node, AST_Decl::NT_uses, false);
- this->gen_ports (node, AST_Decl::NT_publishes, false);
- this->gen_ports (node, AST_Decl::NT_emits, false);
-
- AST_Component *ancestor = node->base_component ();
- in_ancestor_ |= (ancestor != 0);
-
- this->gen_context_r (ancestor);
-}
-
-int
-be_visitor_component_svh::gen_servant_class (void)
-{
- AST_Decl *scope = ScopeAsDecl (node_->defined_in ());
- ACE_CString sname_str (scope->full_name ());
- const char *sname = sname_str.c_str ();
-
- // No '_cxx_' prefix.
- const char *lname =
- node_->original_local_name ()->get_string ();
-
- const char *global = (sname_str == "" ? "" : "::");
-
- os_ << be_nl << be_nl
- << "class " << export_macro_.c_str () << " " << lname
- << "_Servant" << be_idt_nl
- << ": public virtual" << be_idt << be_idt_nl
- << "::CIAO::Servant_Impl<" << be_idt_nl
- << "::" << node_->full_skel_name () << "," << be_nl
- << global << sname << "::CCM_" << lname << "," << be_nl
- << lname << "_Context>"
- << be_uidt << be_uidt << be_uidt << be_uidt_nl
- << "{" << be_nl
- << "public:" << be_idt_nl;
-
- os_ << "typedef " << global << sname << "::CCM_" << lname
- << " _exec_type;" << be_nl;
-
- os_ << be_nl
- << lname << "_Servant (" << be_idt_nl
- << global << sname << "::CCM_"
- << lname << "_ptr executor," << be_nl
- << "::Components::CCMHome_ptr h," << be_nl
- << "const char * ins_name," << be_nl
- << "::CIAO::Home_Servant_Impl_Base *hs," << be_nl
- << "::CIAO::Container_ptr c);" << be_uidt_nl;
-
- os_ << be_nl
- << "virtual ~" << lname << "_Servant"
- << " (void);" << be_nl;
-
- os_ << be_nl
- << "virtual void" << be_nl
- << "set_attributes (const "
- << "::Components::ConfigValues & descr);"
- << be_nl;
-
- os_ << be_nl
- << "// Supported operations and attributes.";
-
- int status =
- node_->traverse_inheritance_graph (
- be_interface::facet_op_attr_decl_helper,
- &os_,
- false,
- false);
-
- if (status == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_component_svh::"
- "gen_servant_class - "
- "inheritance graph traversal failed\n"),
- -1);
- }
-
- /// Reset flag for servant class.
- in_ancestor_ = false;
-
- status = this->gen_servant_r (node_);
-
- if (status == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_component_svh::"
- "gen_servant_class - "
- "gen_servant_r() failed\n"),
- -1);
- }
-
- this->gen_non_type_specific ();
-
- os_ << be_uidt_nl
- << "};";
-
- return 0;
-}
-
-int
-be_visitor_component_svh::gen_servant_r (AST_Component *node)
-{
- if (node == 0)
- {
- return 0;
- }
-
- os_ << be_nl << be_nl
- << "// " << (in_ancestor_ ? "Inherited p" : "P")
- << "orts code.";
-
- this->gen_ports (node, AST_Decl::NT_provides, true);
- this->gen_ports (node, AST_Decl::NT_uses, true);
- this->gen_ports (node, AST_Decl::NT_publishes, true);
- this->gen_ports (node, AST_Decl::NT_emits, true);
- this->gen_ports (node, AST_Decl::NT_consumes, true);
-
- os_ << be_nl << be_nl
- << "// " << (in_ancestor_ ? "Inherited c" : "C")
- << "omponent attributes.";
-
- int status = this->gen_component_attrs (node);
-
- if (status == -1)
+ if (servant_visitor.visit_component (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("be_visitor_component_svh::")
- ACE_TEXT ("gen_servant_r - ")
- ACE_TEXT ("gen_component_attrs() failed\n")),
+ ACE_TEXT ("visit_component - ")
+ ACE_TEXT ("servant visitor failed\n")),
-1);
}
- AST_Component *ancestor = node->base_component ();
- in_ancestor_ |= (ancestor != 0);
-
- return gen_servant_r (ancestor);
-}
-
-int
-be_visitor_component_svh::gen_component_attrs (AST_Component *node)
-{
- /// Traverse the scope and ignore everything but attributes.
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
- be_attribute *attr = be_attribute::narrow_from_decl (d);
-
- if (attr == 0)
- {
- continue;
- }
-
- if (attr->accept (this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_component_svh::")
- ACE_TEXT ("gen_component_attrs - ")
- ACE_TEXT ("be_attribute::accept() failed\n")),
- -1);
- }
- }
-
- return 0;
-}
-
-void
-be_visitor_component_svh::gen_ports (AST_Component *node,
- AST_Decl::NodeType nt,
- bool in_servant)
-{
- os_ << be_nl << be_nl;
-
- switch (nt)
- {
- case AST_Decl::NT_provides:
- os_ << "// Facets.";
- break;
- case AST_Decl::NT_uses:
- os_ << "// Receptacles.";
- break;
- case AST_Decl::NT_publishes:
- os_ << "// Event publishers.";
- break;
- case AST_Decl::NT_consumes:
- os_ << "// Event consumers.";
- break;
- case AST_Decl::NT_emits:
- os_ << "// Event emitters.";
- break;
- default:
- break;
- }
-
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != nt)
- {
- continue;
- }
-
- switch (nt)
- {
- case AST_Decl::NT_provides:
- this->gen_provides (AST_Provides::narrow_from_decl (d));
- break;
- case AST_Decl::NT_uses:
- this->gen_uses (AST_Uses::narrow_from_decl (d),
- in_servant);
- break;
- case AST_Decl::NT_publishes:
- this->gen_publishes (AST_Publishes::narrow_from_decl (d),
- in_servant);
- break;
- case AST_Decl::NT_emits:
- this->gen_emits (AST_Emits::narrow_from_decl (d),
- in_servant);
- break;
- case AST_Decl::NT_consumes:
- this->gen_consumes (AST_Consumes::narrow_from_decl (d));
- break;
- default:
- break;
- }
- }
-}
-
-void
-be_visitor_component_svh::gen_provides (AST_Provides *p)
-{
- const char *obj_name = p->provides_type ()->full_name ();
- const char *port_name = p->local_name ()->get_string ();
-
- os_ << be_uidt_nl << be_nl
- << "public:" << be_idt_nl
- << "virtual ::" << obj_name << "_ptr" << be_nl
- << "provide_" << port_name << " (void);"
- << be_uidt_nl << be_nl;
-
- os_ << "private:" << be_idt_nl
- << "::CORBA::Object_ptr" << be_nl
- << "provide_" << port_name << "_i (void);"
- << be_uidt_nl << be_nl;
-
- os_ << "private:" << be_idt_nl
- << "::" << obj_name << "_var" << be_nl
- << "provide_" << port_name << "_;";
-}
-
-void
-be_visitor_component_svh::gen_uses (
- AST_Uses *u,
- bool in_servant)
-{
- const char *obj_name = u->uses_type ()->full_name ();
- const char *port_name = u->local_name ()->get_string ();
- bool is_multiple = u->is_multiple ();
-
- os_ << be_uidt_nl << be_nl
- << "public:" << be_idt_nl
- << "virtual ";
-
- if (is_multiple)
- {
- os_ << "::" << node_->full_name () << "::"
- << port_name << "Connections *" << be_nl
- << "get_connections_" << port_name << " (void);";
- }
- else
- {
- os_ << "::" << obj_name << "_ptr" << be_nl
- << "get_connection_" << port_name << " (void);";
- }
-
- os_ << be_nl;
-
- if (!in_servant)
- {
- os_ << be_uidt_nl
- << "protected:" << be_idt;
- }
-
- os_ << be_nl
- << "virtual "
- << (is_multiple ? "::Components::Cookie *" : "void")
- << be_nl
- << "connect_" << port_name << " (" << be_idt_nl
- << "::" << obj_name << "_ptr);"
- << be_uidt_nl << be_nl;
-
- os_ << "virtual ::" << obj_name << "_ptr" << be_nl
- << "disconnect_" << port_name << " (";
-
- if (is_multiple)
- {
- os_ << be_idt_nl
- << "::Components::Cookie * ck);" << be_uidt;
- }
- else
- {
- os_ << "void);";
- }
-
- if (!in_servant)
- {
- os_ << be_uidt_nl << be_nl
- << "protected:" << be_idt_nl;
-
- if (is_multiple)
- {
- os_ << "// Multiplex " << port_name << " connection." << be_nl
- << "typedef ACE_Array_Map<ptrdiff_t," << be_nl
- << " ::"
- << obj_name << "_var>" << be_idt_nl
- << tao_cg->upcase (port_name)
- << "_TABLE;" << be_uidt_nl
- << tao_cg->upcase (port_name) << "_TABLE "
- << "ciao_uses_" << port_name << "_;" << be_nl
- << "TAO_SYNCH_MUTEX " << port_name << "_lock_;";
- }
- else
- {
- os_ << "// Simplex " << port_name << " connection." << be_nl
- << "::" << obj_name << "_var" << be_nl
- << "ciao_uses_" << port_name << "_;";
- }
- }
-}
-
-void
-be_visitor_component_svh::gen_publishes (AST_Publishes *p,
- bool in_servant)
-{
- const char *obj_name = p->publishes_type ()->full_name ();
- const char *port_name = p->local_name ()->get_string ();
-
- os_ << be_uidt_nl << be_nl
- << "public:" << be_idt_nl;
-
- if (!in_servant)
- {
- os_ << "virtual void" << be_nl
- << "push_" << port_name << " (" << be_idt_nl
- << "::" << obj_name << " * ev);" << be_uidt_nl;
-
- os_ << be_uidt_nl
- << "protected:" << be_idt_nl;
- }
-
- os_ << "virtual ::Components::Cookie *" << be_nl
- << "subscribe_" << port_name << " (" << be_idt_nl
- << "::" << obj_name << "Consumer_ptr c);" << be_uidt_nl;
-
- os_ << be_nl
- << "// CIAO-specific." << be_nl
- << "::Components::Cookie *" << be_nl
- << "subscribe_" << port_name << "_generic (" << be_idt_nl
- << "::Components::EventConsumerBase_ptr c);" << be_uidt_nl;
-
- os_ << be_nl
- << "virtual ::" << obj_name << "Consumer_ptr" << be_nl
- << "unsubscribe_" << port_name << " (" << be_idt_nl
- << "::Components::Cookie * ck);" << be_uidt;
-
- if (!in_servant)
- {
- os_ << be_uidt_nl << be_nl
- << "protected:" << be_idt_nl;
-
- os_ << "typedef ACE_Array_Map<ptrdiff_t," << be_nl
- << " ::" << obj_name
- << "Consumer_var>" << be_idt_nl
- << tao_cg->upcase (port_name) << "_TABLE;" << be_uidt_nl
- << tao_cg->upcase (port_name) << "_TABLE ciao_publishes_"
- << port_name << "_;" << be_nl
- << "TAO_SYNCH_MUTEX " << port_name << "_lock_;"
- << be_nl << be_nl;
-
- os_ << "typedef ACE_Array_Map<ptrdiff_t," << be_nl
- << " ::Components::EventConsumerBase_var>"
- << be_idt_nl
- << tao_cg->upcase (port_name)
- << "_GENERIC_TABLE;" << be_uidt_nl
- << tao_cg->upcase (port_name)
- << "_GENERIC_TABLE ciao_publishes_"
- << port_name << "_generic_;";
- }
-}
-
-void
-be_visitor_component_svh::gen_consumes (AST_Consumes *c)
-{
- const char *obj_name = c->consumes_type ()->full_name ();
- const char *port_name = c->local_name ()->get_string ();
-
- ACE_CString holder (obj_name);
- ACE_CString::size_type pos = holder.rfind (':');
- const char *ev_lname = 0;
-
- if (pos == ACE_CString::npos)
- {
- ev_lname = obj_name;
- }
- else
- {
- holder = holder.substr (pos + 1);
- ev_lname = holder.c_str ();
- }
-
- os_ << be_uidt_nl << be_nl
- << "public:" << be_idt_nl;
-
- os_ << "// Servant class for the " << port_name
- << " consumer." << be_nl
- << "class " << export_macro_.c_str () << " " << ev_lname
- << "Consumer_" << port_name << "_Servant" << be_idt_nl
- << ": public virtual ::POA_" << obj_name << "Consumer"
- << be_uidt_nl
- << "{" << be_nl
- << "public:" << be_idt_nl;
-
- ACE_CString sname_str (
- ScopeAsDecl (node_->defined_in ())->full_name ());
- const char *sname = sname_str.c_str ();
- const char *lname = node_->local_name ();
- const char *global = (sname_str == "" ? "" : "::");
-
- os_ << ev_lname << "Consumer_" << port_name
- << "_Servant (" << be_idt_nl
- << global << sname << "::CCM_" << lname
- << "_ptr executor," << be_nl
- << global << sname << "::CCM_" << lname
- << "_Context_ptr c);" << be_uidt_nl << be_nl;
-
- os_ << "virtual ~" << ev_lname << "Consumer_" << port_name
- << "_Servant (void);";
-
- os_ << be_nl << be_nl
- << "virtual void" << be_nl
- << "push_" << ev_lname << " (" << be_idt_nl
- << "::" << obj_name << " * evt);" << be_uidt;
-
- os_ << be_nl << be_nl
- << "// Inherited from ::Components::EventConsumerBase." << be_nl
- << "virtual void" << be_nl
- << "push_event ( ::Components::EventBase * ev);";
-
- os_ << be_nl << be_nl
- << "// CIAO-specific in ::Components::EventConsumerBase." << be_nl
- << "virtual void" << be_nl
- << "ciao_push_event ( ::Components::EventBase * ev," << be_nl
- << " const char * source_id," << be_nl
- << " ::CORBA::TypeCode_ptr tc);";
-
- os_ << be_nl << be_nl
- << "// CIAO-specific in ::Components::EventConsumerBase." << be_nl
- << "virtual ::CORBA::Boolean" << be_nl
- << "ciao_is_substitutable (const char * event_repo_id);";
-
- os_ << be_nl << be_nl
- << "// Get component implementation." << be_nl
- << "virtual ::CORBA::Object_ptr" << be_nl
- << "_get_component (void);";
-
- os_ << be_uidt_nl << be_nl
- << "protected:" << be_idt_nl;
-
- os_ << global << sname << "::CCM_" << lname << "_var" << be_nl
- << "executor_;";
-
- os_ << be_nl << be_nl
- << global << sname << "::CCM_"
- << lname << "_Context_var" << be_nl
- << "ctx_;";
+ this->gen_entrypoint (node);
os_ << be_uidt_nl
- << "};";
-
- os_ << be_nl << be_nl
- << "virtual ::" << obj_name << "Consumer_ptr" << be_nl
- << "get_consumer_" << port_name << " (void);";
-
- os_ << be_uidt_nl << be_nl
- << "private:" << be_idt_nl;
-
- os_ << "::Components::EventConsumerBase_ptr" << be_nl
- << "get_consumer_" << port_name << "_i (void);";
-
- os_ << be_uidt_nl << be_nl
- << "private:" << be_idt_nl;
-
- os_ << "::" << obj_name << "Consumer_var" << be_nl
- << "consumes_" << port_name << "_;";
-}
-
-void
-be_visitor_component_svh::gen_emits (AST_Emits *e,
- bool in_servant)
-{
- const char *obj_name = e->emits_type ()->full_name ();
- const char *port_name = e->local_name ()->get_string ();
-
- if (in_servant)
- {
- os_ << be_nl << be_nl;
- }
- else
- {
- os_ << be_uidt_nl << be_nl
- << "public:" << be_idt_nl;
-
- os_ << "virtual void" << be_nl
- << "push_" << port_name << " (" << be_idt_nl
- << "::" << obj_name << " * ev);" << be_uidt;
-
- os_ << be_uidt_nl << be_nl
- << "protected:" << be_idt_nl;
- }
-
- os_ << "virtual void" << be_nl
- << "connect_" << port_name << " (" << be_idt_nl
- << "::" << obj_name << "Consumer_ptr c);" << be_uidt;
-
- os_ << be_nl << be_nl
- << "virtual ::" << obj_name << "Consumer_ptr" << be_nl
- << "disconnect_" << port_name << " (void);";
-
- if (!in_servant)
- {
- os_ << be_uidt_nl << be_nl
- << "protected:" << be_idt_nl
- << "::" << obj_name << "Consumer_var" << be_nl
- << "ciao_emits_" << port_name << "_consumer_;";
- }
-}
-
-void
-be_visitor_component_svh::gen_non_type_specific (void)
-{
- os_ << be_nl << be_nl
- << "// Base class overrides.";
-
- os_ << be_uidt_nl << be_nl
- << "public:" << be_idt_nl
- << "virtual ::Components::Cookie *" << be_nl
- << "connect (const char * name," << be_nl
- << " ::CORBA::Object_ptr connection);";
-
- os_ << be_nl << be_nl
- << "virtual ::CORBA::Object_ptr" << be_nl
- << "disconnect (const char * name," << be_nl
- << " ::Components::Cookie * ck);";
-
- os_ << be_nl << be_nl
- << "virtual ::Components::ReceptacleDescriptions *" << be_nl
- << "get_all_receptacles (void);";
-
- os_ << be_nl << be_nl
- << "virtual ::Components::Cookie *" << be_nl
- << "subscribe (const char * publisher_name," << be_nl
- << " ::Components::EventConsumerBase_ptr subscriber);";
-
- os_ << be_nl << be_nl
- << "virtual ::Components::EventConsumerBase_ptr" << be_nl
- << "unsubscribe (const char * publisher_name," << be_nl
- << " ::Components::Cookie * ck);";
-
- os_ << be_nl << be_nl
- << "virtual void" << be_nl
- << "connect_consumer (const char * emitter_name," << be_nl
- << " ::Components::EventConsumerBase_ptr consumer);";
-
- os_ << be_nl << be_nl
- << "virtual ::Components::EventConsumerBase_ptr" << be_nl
- << "disconnect_consumer (const char * source_name);";
-
- os_ << be_nl << be_nl
- << "virtual ::Components::PublisherDescriptions *" << be_nl
- << "get_all_publishers (void);";
-
- os_ << be_nl << be_nl
- << "virtual ::Components::EmitterDescriptions *" << be_nl
- << "get_all_emitters (void);";
-
- os_ << be_nl << be_nl
- << "// CIAO-specific." << be_nl
- << "::CORBA::Object_ptr" << be_nl
- << "get_facet_executor (const char * name);";
-
- os_ << be_uidt_nl << be_nl
- << "private:" << be_idt_nl
- << "void" << be_nl
- << "populate_port_tables (void);";
+ << "}";
- os_ << be_uidt_nl << be_nl
- << "private:" << be_idt_nl
- << "const char * ins_name_;";
+ return 0;
}
void
-be_visitor_component_svh::gen_entrypoint (void)
+be_visitor_component_svh::gen_entrypoint (be_component *node)
{
os_ << be_nl << be_nl
<< "extern \"C\" " << export_macro_.c_str ()
<< " ::PortableServer::Servant" << be_nl
- << "create_" << node_->flat_name ()
+ << "create_" << node->flat_name ()
<< "_Servant (" << be_idt_nl
<< "::Components::EnterpriseComponent_ptr p," << be_nl
<< "::CIAO::Container_ptr c," << be_nl
diff --git a/TAO/TAO_IDL/be/be_visitor_component/component_svs.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_svs.cpp
index da2158211fb..636b5fc4464 100644
--- a/TAO/TAO_IDL/be/be_visitor_component/component_svs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_component/component_svs.cpp
@@ -18,27 +18,14 @@
//
// ============================================================================
-ACE_RCSID (be_visitor_component,
- component_svs,
- "$Id$")
-
// ******************************************************
// Component visitor for servant source
// ******************************************************
-bool be_visitor_component_svs::in_facets_ = false;
-
be_visitor_component_svs::be_visitor_component_svs (be_visitor_context *ctx)
: be_visitor_component (ctx),
- node_ (0),
os_ (*ctx->stream ()),
- export_macro_ (be_global->svnt_export_macro ()),
- swapping_ (be_global->gen_component_swapping ()),
- n_provides_ (0UL),
- n_uses_ (0UL),
- n_publishes_ (0UL),
- n_emits_ (0UL),
- n_consumes_ (0UL)
+ export_macro_ (be_global->svnt_export_macro ())
{
/// All existing CIAO examples set the servant export values in the CIDL
/// compiler to equal the IDL compiler's skel export values. Below is a
@@ -57,394 +44,47 @@ be_visitor_component_svs::~be_visitor_component_svs (void)
int
be_visitor_component_svs::visit_component (be_component *node)
{
- node_ = node;
-
- n_provides_ = 0UL;
- n_uses_ = 0UL;
- n_publishes_ = 0UL;
- n_emits_ = 0UL;
- n_consumes_ = 0UL;
+ be_visitor_facet_svs facet_visitor (this->ctx_);
- this->compute_slots (node_);
-
- if (this->gen_facets () == -1)
+ if (facet_visitor.visit_component_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("be_visitor_component_svs::")
ACE_TEXT ("visit_component - ")
- ACE_TEXT ("gen_facets() failed\n")),
+ ACE_TEXT ("facet visitor failed\n")),
-1);
}
/// CIDL-generated namespace used 'CIDL_' + composition name.
/// Now we use 'CIAO_' + component's flat name.
os_ << be_nl << be_nl
- << "namespace CIAO_" << node_->flat_name ()
+ << "namespace CIAO_" << node->flat_name ()
<< "_Impl" << be_nl
<< "{" << be_idt;
+
+ be_visitor_context_svs context_visitor (this->ctx_);
- this->gen_context_class ();
-
- if (this->gen_servant_class () == -1)
+ if (context_visitor.visit_component (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("be_visitor_component_svs::")
ACE_TEXT ("visit_component - ")
- ACE_TEXT ("gen_servant_class() failed\n")),
+ ACE_TEXT ("context visitor failed\n")),
-1);
}
+
+ be_visitor_servant_svs servant_visitor (this->ctx_);
- this->gen_entrypoint ();
-
- os_ << be_uidt_nl
- << "}";
-
- return 0;
-}
-
-int
-be_visitor_component_svs::visit_operation (be_operation *node)
-{
- be_visitor_operation_svs v (this->ctx_);
- v.for_facets (be_visitor_component_svs::in_facets_);
- v.scope (this->op_scope_);
-
- return v.visit_operation (node);
-}
-
-int
-be_visitor_component_svs::visit_attribute (be_attribute *node)
-{
- be_visitor_attribute v (this->ctx_);
-
- v.for_facets (be_visitor_component_svs::in_facets_);
- v.op_scope (this->op_scope_);
-
- return v.visit_attribute (node);
-}
-
-int
-be_visitor_component_svs::gen_facets (void)
-{
- for (UTL_ScopeActiveIterator si (node_, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
- AST_Decl::NodeType nt = d->node_type ();
-
- switch (nt)
- {
- case AST_Decl::NT_provides:
- {
- be_provides *p =
- be_provides::narrow_from_decl (d);
-
- if (p->gen_facet_svnt_defn (os_) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_component_svs")
- ACE_TEXT ("::gen_facets - ")
- ACE_TEXT ("gen_facet_svnt_defn() ")
- ACE_TEXT ("failed\n")),
- -1);
- }
-
- break;
- }
- case AST_Decl::NT_ext_port:
- {
- be_extended_port *ep =
- be_extended_port::narrow_from_decl (d);
-
- be_visitor_extended_port_facet_svs visitor (this->ctx_);
-
- if (visitor.visit_extended_port (ep) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_component_svs::gen_facets - "
- "visit_extended_port() failed\n"),
- -1);
- }
-
- break;
- }
- case AST_Decl::NT_mirror_port:
- default:
- continue;
- }
- }
-
- return 0;
-}
-
-int
-be_visitor_component_svs::gen_facet_ops_attrs (be_interface *node)
-{
- os_ << be_nl << be_nl
- << "// All facet operations and attributes.";
-
- /// The overload of traverse_inheritance_graph() used here
- /// doesn't automatically prime the queues.
- node->get_insert_queue ().reset ();
- node->get_del_queue ().reset ();
- node->get_insert_queue ().enqueue_tail (node);
-
- Component_Op_Attr_Generator op_attr_gen (this);
-
- int status =
- node->traverse_inheritance_graph (op_attr_gen,
- &os_,
- false,
- false);
-
- if (status == -1)
+ if (servant_visitor.visit_component (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("be_visitor_component_svs::")
- ACE_TEXT ("gen_facet_ops_attrs - ")
- ACE_TEXT ("traverse_inheritance_graph() ")
- ACE_TEXT ("failed\n")),
- -1);
- }
-
- return 0;
-}
-
-void
-be_visitor_component_svs::gen_context_class (void)
-{
- AST_Decl *scope = ScopeAsDecl (node_->defined_in ());
- ACE_CString sname_str (scope->full_name ());
- const char *sname = sname_str.c_str ();
- const char *lname = node_->local_name ();
- const char *global = (sname_str == "" ? "" : "::");
-
- os_ << be_nl
- << lname <<"_Context::" << lname << "_Context ("
- << be_idt << be_idt_nl
- << "::Components::CCMHome_ptr h," << be_nl
- << "::CIAO::Container_ptr c," << be_nl
- << lname << "_Servant * sv)" << be_uidt_nl
- << ": ::CIAO::Context_Impl_Base (h, c)," << be_idt_nl
- << "::CIAO::Context_Impl<" << be_idt_nl
- << global << sname << "::CCM_"
- << lname << "_Context," << be_nl
- << lname << "_Servant," << be_nl
- << "::" << node_->full_name () << "> (h, c, sv)";
-
- if (swapping_)
- {
- os_ << "," << be_uidt_nl
- << "::CIAO::Upgradeable_Context_Impl<" << be_idt_nl
- << global << sname << "::CCM_" << lname
- << "_Context," << be_nl
- << lname << "_Servant," << be_nl
- << "::" << node_->full_name ()
- << "> (h, c, sv)";
- }
-
- os_ << be_uidt << be_uidt << be_uidt_nl
- << "{" << be_nl
- << "}";
-
- os_ << be_nl << be_nl
- << lname << "_Context::~"
- << lname << "_Context (void)" << be_nl
- << "{" << be_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "/// CIAO-specific." << be_nl
- << lname << "_Context *" << be_nl
- << lname
- << "_Context::_narrow ( ::Components::SessionContext_ptr p)"
- << be_nl
- << "{" << be_idt_nl
- << "return dynamic_cast<" << lname
- << "_Context *> (p);" << be_uidt_nl
- << "}";
-
- this->gen_uses_context_r (node_);
- this->gen_publishes_context_r (node_);
- this->gen_emits_context_r (node_);
-
- if (swapping_)
- {
- os_ << be_nl << be_nl
- << "/// Operations defined in " << sname
- << "::CCM_" << lname << "_Context" << be_nl
- << "/// that enable component swapping in the container"
- << be_nl << be_nl
- << "::Components::ConsumerDescriptions *" << be_nl
- << lname << "_Context::get_registered_consumers ("
- << be_idt_nl
- << "const char * publisher_name)" << be_uidt_nl
- << "{" << be_idt_nl
- << "if (publisher_name == 0)" << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::Components::InvalidName ();" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "::Components::ConsumerDescriptions * tmp = 0;"
- << be_nl
- << "::Components::ConsumerDescriptions_var retval;"
- << be_nl
- << "::CORBA::ULong _ciao_index = 0UL;" << be_nl
- << "::CORBA::ULong _ciao_size = 0UL;" << be_nl
- << "ACE_UNUSED_ARG (tmp);" << be_nl
- << "ACE_UNUSED_ARG (retval);" << be_nl
- << "ACE_UNUSED_ARG (_ciao_index);" << be_nl
- << "ACE_UNUSED_ARG (_ciao_size);";
-
- this->gen_swapping_get_consumers_r (node_);
-
- os_ << be_nl << be_nl
- << "throw ::Components::InvalidName ();" << be_uidt_nl
- << "}";
- }
-}
-
-int
-be_visitor_component_svs::gen_servant_class (void)
-{
- AST_Decl *scope = ScopeAsDecl (node_->defined_in ());
- ACE_CString sname_str (scope->full_name ());
- const char *sname = sname_str.c_str ();
- const char *lname = node_->local_name ();
- const char *global = (sname_str == "" ? "" : "::");
-
- os_ << be_nl << be_nl
- << lname << "_Servant::"
- << lname << "_Servant (" << be_idt << be_idt_nl
- << global << sname << "::CCM_" << lname
- << "_ptr exe," << be_nl
- << "::Components::CCMHome_ptr h," << be_nl
- << "const char * ins_name," << be_nl
- << "::CIAO::Home_Servant_Impl_Base * hs,"
- << be_nl
- << "::CIAO::Container_ptr c)" << be_uidt_nl
- << ": ::CIAO::Servant_Impl_Base (h, hs, c),"
- << be_idt_nl
- << "::CIAO::Servant_Impl<" << be_idt_nl
- << "::" << node_->full_skel_name ()
- << "," << be_nl
- << global << sname << "::CCM_"
- << lname << "," << be_nl
- << lname << "_Context> (exe, h, hs, c)," << be_uidt_nl
- << "ins_name_ (ins_name)" << be_uidt << be_uidt_nl
- << "{" << be_idt_nl
- << "ACE_NEW (this->context_," << be_nl
- << " " << lname << "_Context (h, c, this));"
- << be_nl << be_nl
- << "/// Set the instance id of the component on the context."
- << be_nl
- << "this->context_->_ciao_instance_id (this->ins_name_);";
-
- if (be_global->gen_ciao_valuefactory_reg ())
- {
- this->gen_all_factory_registration ();
- }
-
- os_ << be_nl << be_nl
- << "try" << be_idt_nl
- << "{" << be_idt_nl
- << "::Components::SessionComponent_var scom =" << be_idt_nl
- << "::Components::SessionComponent::_narrow (exe);"
- << be_uidt_nl << be_nl
- << "if (! ::CORBA::is_nil (scom.in ()))" << be_idt_nl
- << "{" << be_idt_nl
- << "scom->set_session_context (this->context_);" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "this->populate_port_tables ();" << be_uidt_nl
- << "}" << be_uidt_nl
- << "catch (const ::CORBA::Exception &)" << be_idt_nl
- << "{" << be_nl
- << "}" << be_uidt << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << lname << "_Servant::~"
- << lname << "_Servant (void)" << be_nl
- << "{" << be_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "void" << be_nl
- << lname << "_Servant::set_attributes (" << be_idt_nl
- << "const ::Components::ConfigValues & descr)" << be_uidt_nl
- << "{" << be_idt_nl;
-
- if (swapping_)
- {
- os_ << "this->activate_component ();" << be_nl << be_nl;
- }
-
- os_ << "for ( ::CORBA::ULong i = 0; i < descr.length (); ++i)"
- << be_idt_nl
- << "{" << be_idt_nl
- << "const char * descr_name = descr[i]->name ();" << be_nl
- << "::CORBA::Any & descr_value = descr[i]->value ();";
-
- this->gen_attr_set_r (node_);
-
- os_ << be_nl << be_nl
- << "ACE_UNUSED_ARG (descr_name);" << be_nl
- << "ACE_UNUSED_ARG (descr_value);" << be_uidt_nl
- << "}" << be_uidt << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "/// Supported operations and all attributes.";
-
- this->op_scope_ = node_;
-
- /// The overload of traverse_inheritance_graph() used here
- /// doesn't automatically prime the queues.
- node_->get_insert_queue ().reset ();
- node_->get_del_queue ().reset ();
- node_->get_insert_queue ().enqueue_tail (node_);
-
- Component_Op_Attr_Generator op_attr_gen (this);
-
- int status =
- node_->traverse_inheritance_graph (op_attr_gen,
- &os_,
- false,
- false);
-
- if (status == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_component_svs::"
- "gen_servant_class - "
- "inheritance graph traversal failed\n"),
+ ACE_TEXT ("visit_component - ")
+ ACE_TEXT ("servant visitor failed\n")),
-1);
}
-
- this->gen_component_attrs_r (node_);
-
- os_ << be_nl << be_nl
- << "/// All port operations.";
-
- this->gen_provides_top ();
- this->gen_publishes_servant_top ();
- this->gen_consumes_r (node_);
- this->gen_uses_servant_top ();
- this->gen_emits_servant_top ();
-
- os_ << be_nl << be_nl
- << "/// Private method to trigger population of the port"
- << be_nl
- << "/// tables (facets and event consumers)." << be_nl
- << "void" << be_nl
- << node_->local_name ()
- << "_Servant::populate_port_tables (void)" << be_nl
- << "{" << be_idt_nl
- << "::CORBA::Object_var obj_var;" << be_nl
- << "::Components::EventConsumerBase_var ecb_var;"
- << be_nl;
-
- this->gen_populate_r (node_);
+
+ this->gen_entrypoint (node);
os_ << be_uidt_nl
<< "}";
@@ -452,2186 +92,19 @@ be_visitor_component_svs::gen_servant_class (void)
return 0;
}
-int
-be_visitor_component_svs::gen_component_attrs_r (AST_Component *node)
-{
- if (node == 0)
- {
- return 0;
- }
-
- int status = this->gen_component_attrs (node);
-
- if (status == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_component_svs::")
- ACE_TEXT ("gen_servant_r - ")
- ACE_TEXT ("gen_component_attrs() failed\n")),
- -1);
- }
-
- AST_Component *ancestor = node->base_component ();
- return gen_component_attrs_r (ancestor);
-}
-
-int
-be_visitor_component_svs::gen_component_attrs (AST_Component *node)
-{
- /// Traverse the scope and ignore everything but attributes.
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
- be_attribute *attr = be_attribute::narrow_from_decl (d);
-
- if (attr == 0)
- {
- continue;
- }
-
- if (attr->accept (this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_component_svs::")
- ACE_TEXT ("gen_component_attrs - ")
- ACE_TEXT ("be_attribute::accept() failed\n")),
- -1);
- }
- }
-
- return 0;
-}
-
-void
-be_visitor_component_svs::gen_provides_top (void)
-{
- os_ << be_nl << be_nl
- << "/// CIAO-specific." << be_nl
- << "::CORBA::Object_ptr" << be_nl
- << node_->local_name ()
- << "_Servant::get_facet_executor (" << be_idt_nl
- << "const char * name)" << be_uidt_nl
- << "{" << be_idt_nl;
-
- if (swapping_)
- {
- os_ << "this->activate_component ();" << be_nl << be_nl;
- }
-
- os_ << "if (name == 0)" << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::CORBA::BAD_PARAM ();" << be_uidt_nl
- << "}" << be_uidt;
-
- AST_Component *node = node_;
-
- while (node != 0)
- {
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_provides)
- {
- continue;
- }
-
- this->gen_facet_executor_block (
- d->local_name ()->get_string ());
- }
-
- node = node->base_component ();
- }
-
- os_ << be_nl << be_nl
- << "return ::CORBA::Object::_nil ();" << be_uidt_nl
- << "}";
-
- this->gen_provides_r (node_);
-}
-
-void
-be_visitor_component_svs::gen_facet_executor_block (
- const char *port_name)
-{
- os_ << be_nl << be_nl
- << "if (ACE_OS::strcmp (name, \"" << port_name
- << "\") == 0)" << be_idt_nl
- << "{" << be_idt_nl
- << "return this->executor_->get_" << port_name
- << " ();" << be_uidt_nl
- << "}" << be_uidt;
-}
-
-void
-be_visitor_component_svs::gen_provides_r (AST_Component *node)
-{
- if (node == 0)
- {
- return;
- }
-
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_provides)
- {
- continue;
- }
-
- AST_Provides *p =
- AST_Provides::narrow_from_decl (d);
-
- this->gen_provides (p);
- }
-
- node = node->base_component ();
- this->gen_provides_r (node);
-}
-
-void
-be_visitor_component_svs::gen_provides (AST_Provides *p)
-{
- AST_Type *obj = p->provides_type ();
- const char *obj_name = obj->full_name ();
- const char *port_name = p->local_name ()->get_string ();
- AST_Decl *scope = ScopeAsDecl (obj->defined_in ());
- ACE_CString sname_str (scope->full_name ());
- const char *sname = sname_str.c_str ();
-
- // Avoid '_cxx_' prefix.
- const char *lname =
- obj->original_local_name ()->get_string ();
-
- const char *global = (sname_str == "" ? "" : "::");
- const char *prefix_connector = (sname_str == "" ? "" : "_");
-
- os_ << be_nl << be_nl
- << "::" << obj_name << "_ptr" << be_nl
- << node_->local_name () << "_Servant::provide_"
- << port_name << " (void)" << be_nl
- << "{" << be_idt_nl;
-
- if (swapping_)
- {
- os_ << "this->activate_component ();" << be_nl << be_nl;
- }
-
- os_ << "if ( ::CORBA::is_nil (this->provide_"
- << port_name << "_.in ()))" << be_idt_nl
- << "{" << be_idt_nl
- << "::CORBA::Object_var obj =" << be_idt_nl
- << "this->provide_" << port_name << "_i ();"
- << be_uidt_nl << be_nl
- << "::" << obj_name << "_var fo =" << be_idt_nl
- << "::" << obj_name << "::_narrow (obj.in ());"
- << be_uidt_nl << be_nl
- << "this->provide_" << port_name << "_ = fo;" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "return" << be_idt_nl
- << "::" << obj_name << "::_duplicate (this->provide_"
- << port_name << "_.in ());" << be_uidt << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "::CORBA::Object_ptr" << be_nl
- << node_->local_name () << "_Servant::provide_"
- << port_name << "_i (void)" << be_nl
- << "{" << be_idt_nl
- << "::CORBA::Object_ptr ret =" << be_idt_nl
- << "this->lookup_facet (\"" << port_name << "\");"
- << be_uidt_nl << be_nl
- << "if (! ::CORBA::is_nil (ret))" << be_idt_nl
- << "{" << be_idt_nl
- << "return ret;" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "typedef" << be_idt_nl
- << "::CIAO::Port_Activator_T<" << be_idt_nl
- << "::CIAO_FACET" << prefix_connector
- << scope->flat_name () << "::" << lname
- << "_Servant," << be_nl
- << global << sname << "::CCM_" << lname << "," << be_nl
- << "::Components::CCMContext," << be_nl
- << node_->local_name () << "_Servant>" << be_uidt_nl
- << "MACRO_MADNESS_TYPEDEF;" << be_uidt_nl << be_nl
- << "MACRO_MADNESS_TYPEDEF * tmp = 0;" << be_nl
- << "ACE_CString obj_id (this->ins_name_);" << be_nl
- << "obj_id += \"_" << port_name << "\";" << be_nl << be_nl
- << "ACE_NEW_THROW_EX (" << be_idt_nl
- << "tmp," << be_nl
- << "MACRO_MADNESS_TYPEDEF (" << be_idt_nl
- << "obj_id.c_str ()," << be_nl
- << "\"" << port_name << "\"," << be_nl
- << "::CIAO::Port_Activator_Types::FACET," << be_nl
- << "0," << be_nl
- << "this->context_," << be_nl
- << "this)," << be_uidt_nl
- << "::CORBA::NO_MEMORY ());" << be_uidt_nl << be_nl
- << "::CIAO::Port_Activator_var pa = tmp;" << be_nl << be_nl
- << "::CIAO::Servant_Activator_var sa =" << be_idt_nl
- << "this->container_->ports_servant_activator ();"
- << be_uidt_nl << be_nl
- << "if (! sa->register_port_activator (pa._retn ()))"
- << be_idt_nl
- << "{" << be_idt_nl
- << "return ::" << obj_name << "::_nil ();" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "::CORBA::Object_var obj =" << be_idt_nl
- << "this->container_->generate_reference (" << be_idt_nl
- << "obj_id.c_str ()," << be_nl
- << "\"" << obj->repoID () << "\"," << be_nl
- << "::CIAO::Container_Types::FACET_CONSUMER_t);"
- << be_uidt_nl << be_uidt_nl
- << "this->add_facet (\"" << port_name << "\", obj.in ());"
- << be_nl << be_nl
- << "return obj._retn ();" << be_uidt_nl
- << "}";
-}
-
-void
-be_visitor_component_svs::gen_uses_context_r (AST_Component *node)
-{
- if (node == 0)
- {
- return;
- }
-
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_uses)
- {
- continue;
- }
-
- AST_Uses *u =
- AST_Uses::narrow_from_decl (d);
-
- this->gen_uses_context (u);
- }
-
- node = node->base_component ();
- this->gen_uses_context_r (node);
-}
-
-void
-be_visitor_component_svs::gen_uses_context (
- AST_Uses *u)
-{
- AST_Type *obj = u->uses_type ();
- const char *port_name = u->local_name ()->get_string ();
- bool is_multiple = u->is_multiple ();
-
- if (is_multiple)
- {
- this->gen_uses_context_multiplex (obj, port_name);
- }
- else
- {
- this->gen_uses_context_simplex (obj, port_name);
- }
-}
-
-void
-be_visitor_component_svs::gen_uses_context_simplex (
- AST_Type *obj,
- const char *port_name)
-{
- const char *fname = obj->full_name ();
-
- os_ << be_nl << be_nl
- << "::" << fname << "_ptr" << be_nl
- << node_->local_name () << "_Context::get_connection_"
- << port_name << " (void)" << be_nl
- << "{" << be_idt_nl
- << "return ::" << fname << "::_duplicate (" << be_idt_nl
- << "this->ciao_uses_" << port_name << "_.in ());"
- << be_uidt << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "void" << be_nl
- << node_->local_name () << "_Context::connect_"
- << port_name << " (" << be_idt_nl
- << "::" << fname << "_ptr c)" << be_uidt_nl
- << "{" << be_idt_nl
- << "if (! ::CORBA::is_nil (this->ciao_uses_"
- << port_name << "_.in ()))" << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::Components::AlreadyConnected ();" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "if ( ::CORBA::is_nil (c))" << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::Components::InvalidConnection ();" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "this->ciao_uses_" << port_name << "_ =" << be_idt_nl
- << "::" << fname << "::_duplicate (c);"
- << be_uidt << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "::" << fname << "_ptr" << be_nl
- << node_->local_name () << "_Context::disconnect_"
- << port_name << " (void)" << be_nl
- << "{" << be_idt_nl
- << "if ( ::CORBA::is_nil (this->ciao_uses_"
- << port_name << "_.in ()))" << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::Components::NoConnection ();" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "return this->ciao_uses_" << port_name
- << "_._retn ();" << be_uidt_nl
- << "}";
-}
-
-void
-be_visitor_component_svs::gen_uses_context_multiplex (
- AST_Type *obj,
- const char *port_name)
-{
- const char *fname = obj->full_name ();
- bool static_config = be_global->gen_ciao_static_config ();
-
- os_ << be_nl << be_nl
- << "::" << node_->full_name () << "::" << port_name
- << "Connections *" << be_nl
- << node_->local_name () << "_Context::get_connections_"
- << port_name << " (void)" << be_nl
- << "{" << be_idt_nl;
-
- if (! static_config)
- {
- os_ << "ACE_READ_GUARD_RETURN (TAO_SYNCH_MUTEX," << be_nl
- << " mon," << be_nl
- << " this->" << port_name
- << "_lock_," << be_nl
- << " 0);" << be_nl << be_nl;
- }
-
- os_ << "::" << node_->full_name () << "::" << port_name
- << "Connections * tmp_retv = 0;" << be_nl
- << "ACE_NEW_THROW_EX (tmp_retv," << be_nl
- << " ::" << node_->full_name ()
- << "::" << port_name << "Connections (" << be_nl
- << " this->ciao_uses_"
- << port_name << "_.size ())," << be_nl
- << " ::CORBA::NO_MEMORY ());"
- << be_nl << be_nl
- << "::" << node_->full_name () << "::" << port_name
- << "Connections_var retv = tmp_retv;" << be_nl
- << "retv->length (this->ciao_uses_" << port_name
- << "_.size ());" << be_nl
- << "::CORBA::ULong i = 0UL;" << be_nl << be_nl
- << "for (" << tao_cg->upcase (port_name)
- << "_TABLE::const_iterator iter =" << be_nl
- << " this->ciao_uses_" << port_name << "_.begin ();"
- << be_nl
- << " iter != this->ciao_uses_"
- << port_name << "_.end ();" << be_nl
- << " ++iter, ++i)" << be_idt_nl
- << "{" << be_idt_nl
- << "retv[i].objref = iter->second;" << be_nl << be_nl
- << "ACE_NEW_THROW_EX (retv[i].ck.inout ()," << be_nl
- << " ::CIAO::Cookie_Impl (iter->first),"
- << be_nl
- << " ::CORBA::NO_MEMORY ());" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "return retv._retn (); " << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "::Components::Cookie *" << be_nl
- << node_->local_name () << "_Context::connect_"
- << port_name << " (" << be_idt_nl
- << "::" << fname << "_ptr c)" << be_uidt_nl
- << "{" << be_idt_nl
- << "if ( ::CORBA::is_nil (c))" << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::Components::InvalidConnection ();" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "std::pair<" << tao_cg->upcase (port_name)
- << "_TABLE::iterator, bool> result;" << be_nl
- << tao_cg->upcase (port_name)
- << "_TABLE::value_type entry;" << be_nl
- << "entry.first = reinterpret_cast<ptrdiff_t> (c);" << be_nl
- << "entry.second = ::" << fname
- << "::_duplicate (c);";
-
- if (! static_config)
- {
- os_ << be_nl << be_nl
- << "{" << be_idt_nl
- << "ACE_WRITE_GUARD_RETURN (TAO_SYNCH_MUTEX," << be_nl
- << " mon," << be_nl
- << " this->" << port_name
- << "_lock_," << be_nl
- << " 0);";
- }
-
- os_ << be_nl << be_nl
- << "result = this->ciao_uses_" << port_name
- << "_.insert (entry);";
-
- if (! static_config)
- {
- os_ << be_uidt_nl
- << "}";
- }
-
- os_ << be_nl << be_nl
- << "if (! result.second)" << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::Components::InvalidConnection ();"
- << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "::Components::Cookie * ck = 0;" << be_nl
- << "ACE_NEW_THROW_EX (ck," << be_nl
- << " ::CIAO::Cookie_Impl (entry.first),"
- << be_nl
- << " ::CORBA::NO_MEMORY ());"
- << be_nl << be_nl
- << "return ck;" << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "::" << fname << "_ptr" << be_nl
- << node_->local_name () << "_Context::disconnect_"
- << port_name << " (" << be_idt_nl
- << "::Components::Cookie * ck)" << be_uidt_nl
- << "{" << be_idt_nl
- << "::" << fname << "_var retv;" << be_nl
- << "ptrdiff_t key = 0UL;" << be_nl
- << tao_cg->upcase (port_name)
- << "_TABLE::size_type n = 0UL;" << be_nl << be_nl
- << "if (ck == 0 || ! ::CIAO::Cookie_Impl::extract (ck, key))"
- << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::Components::InvalidConnection ();" << be_uidt_nl
- << "}" << be_uidt;
-
- if (! static_config)
- {
- os_ << be_nl << be_nl
- << "{" << be_idt_nl
- << "ACE_WRITE_GUARD_RETURN (TAO_SYNCH_MUTEX," << be_nl
- << " mon," << be_nl
- << " this->" << port_name
- << "_lock_," << be_nl
- << " ::" << fname
- << "::_nil ());";
- }
-
- os_ << be_nl << be_nl
- << tao_cg->upcase (port_name)
- << "_TABLE::iterator iter =" << be_idt_nl
- << "this->ciao_uses_" << port_name
- << "_.find (key);" << be_uidt_nl << be_nl
- << "if (iter == this->ciao_uses_" << port_name
- << "_.end ())" << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::Components::InvalidConnection ();" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "retv = iter->second;" << be_nl
- << "n = this->ciao_uses_" << port_name
- << "_.erase (key);";
-
- if (! static_config)
- {
- os_ << be_uidt_nl
- << "}";
- }
-
- os_ << be_nl << be_nl
- << "if (n != 1UL)" << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::Components::InvalidConnection ();" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "return retv._retn ();" << be_uidt_nl
- << "}";
-}
-
-void
-be_visitor_component_svs::gen_uses_servant_top (void)
-{
- os_ << be_nl << be_nl
- << "::Components::Cookie *" << be_nl
- << node_->local_name () << "_Servant::connect (" << be_idt_nl
- << "const char * name," << be_nl
- << "::CORBA::Object_ptr connection)" << be_uidt_nl
- << "{" << be_idt_nl;
-
- if (swapping_)
- {
- os_ << "this->activate_component ();" << be_nl << be_nl;
- }
-
- os_ << "/// If the component has no receptacles, "
- << "arg will be unused." << be_nl
- << "ACE_UNUSED_ARG (connection);" << be_nl << be_nl
- << "if (name == 0)" << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::Components::InvalidName ();" << be_uidt_nl
- << "}" << be_uidt;
-
- AST_Component *node = node_;
-
- while (node != 0)
- {
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_uses)
- {
- continue;
- }
-
- AST_Uses *u =
- AST_Uses::narrow_from_decl (d);
-
- this->gen_connect_block (u);
- }
-
- node = node->base_component ();
- }
-
- os_ << be_nl << be_nl
- << "throw ::Components::InvalidName ();" << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "::CORBA::Object_ptr" << be_nl
- << node_->local_name () << "_Servant::disconnect ("
- << be_idt_nl
- << "const char * name," << be_nl
- << "::Components::Cookie * ck)" << be_uidt_nl
- << "{" << be_idt_nl;
-
- if (swapping_)
- {
- os_ << "this->activate_component ();" << be_nl << be_nl;
- }
-
- os_ << "ACE_UNUSED_ARG (ck);" << be_nl << be_nl
- << "if (name == 0)" << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::CORBA::BAD_PARAM ();" << be_uidt_nl
- << "}" << be_uidt;
-
- node = node_;
-
- while (node != 0)
- {
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_uses)
- {
- continue;
- }
-
- AST_Uses *u =
- AST_Uses::narrow_from_decl (d);
-
- this->gen_disconnect_block (u);
- }
-
- node = node->base_component ();
- }
-
- os_ << be_nl << be_nl
- << "throw ::Components::InvalidName ();" << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "::Components::ReceptacleDescriptions *" << be_nl
- << node_->local_name ()
- << "_Servant::get_all_receptacles (void)" << be_nl
- << "{" << be_idt_nl
- << "::Components::ReceptacleDescriptions * retval = 0;"
- << be_nl
- << "ACE_NEW_RETURN (retval," << be_nl
- << " ::Components::ReceptacleDescriptions,"
- << be_nl
- << " 0);" << be_nl
- << "::Components::ReceptacleDescriptions_var "
- << "safe_retval = retval;" << be_nl
- << "safe_retval->length (" << n_uses_
- << "UL);";
-
- node = node_;
- ACE_CDR::ULong slot = 0UL;
-
- while (node != 0)
- {
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_uses)
- {
- continue;
- }
-
- AST_Uses *u =
- AST_Uses::narrow_from_decl (d);
-
- this->gen_receptacle_description (u, slot++);
- }
-
- node = node->base_component ();
- }
-
- os_ << be_nl << be_nl
- << "return safe_retval._retn ();" << be_uidt_nl
- << "}";
-
- this->gen_uses_servant_r (node_);
-}
-
-void
-be_visitor_component_svs::gen_connect_block (AST_Uses *u)
-{
- const char *obj_name = u->uses_type ()->full_name ();
- const char *port_name = u->local_name ()->get_string ();
- bool is_multiple = u->is_multiple ();
-
- os_ << be_nl << be_nl
- << "if (ACE_OS::strcmp (name, \"" << port_name
- << "\") == 0)" << be_idt_nl
- << "{" << be_idt_nl
- << "::" << obj_name << "_var _ciao_conn =" << be_idt_nl
- << "::" << obj_name << "::_narrow (connection);"
- << be_uidt_nl << be_nl
- << "if ( ::CORBA::is_nil (_ciao_conn.in ()))" << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::Components::InvalidConnection ();" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl;
-
- if (! is_multiple)
- {
- os_ << "ACE_CString receptacle_name (\"" << port_name
- << "\");" << be_nl
- << "receptacle_name += \'_\';" << be_nl
- << "receptacle_name += "
- << "this->context_->_ciao_instance_id ();" << be_nl
- << "::CORBA::PolicyList_var policy_list =" << be_idt_nl
- << "this->container_->get_receptacle_policy "
- << "(receptacle_name.c_str ());" << be_uidt_nl << be_nl
- << "if (policy_list->length () != 0)" << be_idt_nl
- << "{" << be_idt_nl
- << "::CORBA::Object_var over_ridden_object ="
- << be_idt_nl
- << "_ciao_conn->_set_policy_overrides (policy_list.in (),"
- << be_nl
- << " CORBA::SET_OVERRIDE);"
- << be_uidt_nl
- << "_ciao_conn =" << be_idt_nl
- << "::" << obj_name << "::_narrow (over_ridden_object.in ());"
- << be_uidt << be_uidt_nl
- << "}" << be_uidt_nl << be_nl;
- }
-
- os_ << "/// " << (is_multiple ? "Multiplex" : "Simplex")
- << " connect." << be_nl
- << (is_multiple ? "return " : "") << "this->connect_"
- << port_name << " (_ciao_conn.in ());";
-
- if (! is_multiple)
- {
- os_ << be_nl << be_nl
- << "return 0;";
- }
-
- os_ << be_uidt_nl
- << "}" << be_uidt;
-}
-
-void
-be_visitor_component_svs::gen_disconnect_block (AST_Uses *u)
-{
- const char *port_name = u->local_name ()->get_string ();
- bool is_multiple = u->is_multiple ();
-
- os_ << be_nl << be_nl
- << "if (ACE_OS::strcmp (name, \"" << port_name
- << "\") == 0)" << be_idt_nl
- << "{" << be_idt_nl
- << "/// " << (is_multiple ? "Multiplex" : "Simplex")
- << " disconnect." << be_nl;
-
- if (is_multiple)
- {
- os_ << "if (ck == 0)" << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::Components::CookieRequired ();" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl;
- }
-
- os_ << "return this->disconnect_" << port_name
- << " (" << (is_multiple ? "ck" : "") << ");" << be_uidt_nl
- << "}" << be_uidt;
-}
-
-void
-be_visitor_component_svs::gen_uses_servant_r (
- AST_Component *node)
-{
- if (node == 0)
- {
- return;
- }
-
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_uses)
- {
- continue;
- }
-
- AST_Uses *u =
- AST_Uses::narrow_from_decl (d);
-
- this->gen_uses_servant (u);
- }
-
- node = node->base_component ();
- this->gen_uses_servant_r (node);
-}
-
-void
-be_visitor_component_svs::gen_uses_servant (AST_Uses *u)
-{
- const char *obj_name = u->uses_type ()->full_name ();
- const char *port_name = u->local_name ()->get_string ();
- bool is_multiple = u->is_multiple ();
-
- os_ << be_nl << be_nl
- << (is_multiple ? "::Components::Cookie *" : "void")
- << be_nl
- << node_->local_name () << "_Servant::connect_"
- << port_name << " (" << be_idt_nl
- << "::" << obj_name << "_ptr c)" << be_uidt_nl
- << "{" << be_idt_nl;
-
- if (is_multiple)
- {
- os_ << "::Components::Cookie * cookie =" << be_idt_nl;
- }
-
- os_ << "this->context_->connect_" << port_name
- << " (c);" << be_nl;
-
- if (is_multiple)
- {
- os_ << be_uidt_nl;
- }
-
- os_ << "this->add_receptacle (\"" << port_name
- << "\", c, " << (is_multiple ? "cookie" : "0")
- << ");";
-
- if (is_multiple)
- {
- os_ << be_nl << be_nl
- << "return cookie;";
- }
-
- os_ << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "::" << obj_name << "_ptr" << be_nl
- << node_->local_name () << "_Servant::disconnect_"
- << port_name << " (";
-
- if (is_multiple)
- {
- os_ << be_idt_nl
- << "::Components::Cookie * ck" << be_uidt;
- }
- else
- {
- os_ << "void";
- }
-
- os_ << ")" << be_nl
- << "{" << be_idt_nl
- << "return this->context_->disconnect_"
- << port_name << " (" << (is_multiple ? "ck" : "")
- << ");" << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "::";
-
- if (is_multiple)
- {
- os_ << node_->full_name () << "::" << port_name
- << "Connections *";
- }
- else
- {
- os_ << obj_name << "_ptr";
- }
-
- os_ << be_nl
- << node_->local_name () << "_Servant::get_connection"
- << (is_multiple ? "s" : "") << "_"
- << port_name << " (void)" << be_nl
- << "{" << be_idt_nl
- << "return this->context_->get_connection"
- << (is_multiple ? "s" : "") << "_"
- << port_name << " ();" << be_uidt_nl
- << "}";
-}
-
-void
-be_visitor_component_svs::gen_receptacle_description (
- AST_Uses *u,
- ACE_CDR::ULong slot)
-{
- AST_Type *obj = u->uses_type ();
- const char *port_name = u->local_name ()->get_string ();
- bool is_multiple = u->is_multiple ();
-
- os_ << be_nl << be_nl;
-
- bool gen_guard =
- is_multiple && ! be_global->gen_ciao_static_config ();
-
- if (gen_guard)
- {
- os_ << "{" << be_idt_nl
- << "ACE_READ_GUARD_RETURN (TAO_SYNCH_MUTEX," << be_nl
- << " mon," << be_nl
- << " this->context_->"
- << port_name << "_lock_," << be_nl
- << " 0);" << be_nl << be_nl;
- }
-
- os_ << "::CIAO::Servant::describe_"
- << (is_multiple ? "multiplex" : "simplex")
- << "_receptacle<" << be_idt_nl
- << "::" << obj->full_name () << "_var> (" << be_idt_nl
- << "\"" << port_name << "\"," << be_nl
- << "\"" << obj->repoID () << "\"," << be_nl
- << "this->context_->ciao_uses_"
- << port_name << "_," << be_nl
- << "safe_retval," << be_nl
- << slot << "UL);" << be_uidt << be_uidt;
-
- if (gen_guard)
- {
- os_ << be_uidt_nl
- << "}";
- }
-}
-
-void
-be_visitor_component_svs::gen_publishes_context_r (
- AST_Component *node)
-{
- if (node == 0)
- {
- return;
- }
-
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_publishes)
- {
- continue;
- }
-
- AST_Publishes *p =
- AST_Publishes::narrow_from_decl (d);
-
- this->gen_publishes_context (p);
- }
-
- node = node->base_component ();
- this->gen_publishes_context_r (node);
-}
-
-void
-be_visitor_component_svs::gen_publishes_context (
- AST_Publishes *p)
-{
- AST_Type *obj = p->publishes_type ();
- const char *port_name = p->local_name ()->get_string ();
- const char *fname = obj->full_name ();
- const char *lname = obj->local_name ()->get_string ();
- ACE_CString sname_str (
- ScopeAsDecl (obj->defined_in ())->full_name ());
- const char *sname = sname_str.c_str ();
- const char *global = (sname_str == "" ? "" : "::");
- bool static_config =
- be_global->gen_ciao_static_config ();
-
- os_ << be_nl << be_nl
- << "void" << be_nl
- << node_->local_name () << "_Context::push_"
- << port_name << " (" << be_idt_nl
- << "::" << fname << " * ev)" << be_uidt_nl
- << "{" << be_idt_nl;
-
- if (! static_config)
- {
- os_ << "ACE_READ_GUARD (TAO_SYNCH_MUTEX," << be_nl
- << " mon," << be_nl
- << " this->" << port_name
- << "_lock_);" << be_nl << be_nl;
- }
-
- os_ << "for (" << tao_cg->upcase (port_name)
- << "_TABLE::const_iterator iter =" << be_nl
- << " this->ciao_publishes_" << port_name
- << "_.begin ();" << be_nl
- << " iter != this->ciao_publishes_" << port_name
- << "_.end ();" << be_nl
- << " ++iter)" << be_idt_nl
- << "{" << be_idt_nl
- << "iter->second->push_" << lname << " (ev);"
- << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "ACE_CString source_id (this->_ciao_instance_id ());"
- << be_nl
- << "source_id += \"_" << port_name << "\";"
- << be_nl << be_nl
- << "for (" << tao_cg->upcase (port_name)
- << "_GENERIC_TABLE::const_iterator giter =" << be_nl
- << " this->ciao_publishes_" << port_name
- << "_generic_.begin ();" << be_nl
- << " giter != this->ciao_publishes_"
- << port_name << "_generic_.end ();" << be_nl
- << " ++giter)" << be_idt_nl
- << "{" << be_idt_nl
- << "giter->second->ciao_push_event (ev," << be_nl
- << " source_id.c_str (),"
- << be_nl
- << " " << global
- << sname << "::_tc_" << lname << ");" << be_uidt_nl
- << "}" << be_uidt << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "::Components::Cookie *" << be_nl
- << node_->local_name () << "_Context::subscribe_"
- << port_name << " (" << be_idt_nl
- << "::" << fname << "Consumer_ptr c)" << be_uidt_nl
- << "{" << be_idt_nl
- << "if ( ::CORBA::is_nil (c))" << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::CORBA::BAD_PARAM ();" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "std::pair<" << tao_cg->upcase (port_name)
- << "_TABLE::iterator, bool> result;" << be_nl
- << tao_cg->upcase (port_name)
- << "_TABLE::value_type entry;" << be_nl
- << "entry.first = reinterpret_cast<ptrdiff_t> (c);"
- << be_nl
- << "entry.second = ::" << fname
- << "Consumer::_duplicate (c);" << be_nl << be_nl;
-
- if (! static_config)
- {
- os_ << "{" << be_idt_nl
- << "ACE_WRITE_GUARD_RETURN (TAO_SYNCH_MUTEX," << be_nl
- << " mon," << be_nl
- << " this->" << port_name
- << "_lock_," << be_nl
- << " 0);" << be_nl << be_nl;
- }
-
- os_ << "result = this->ciao_publishes_" << port_name
- << "_.insert (entry);";
-
- if (! static_config)
- {
- os_ << be_uidt_nl
- << "}";
- }
-
- os_ << be_nl << be_nl
- << "if (! result.second)" << be_idt_nl
- << "{" << be_idt_nl
- << "ACE_ERROR_RETURN ((LM_ERROR," << be_nl
- << " ACE_TEXT (\"subscribe on %s failed\\n\"),"
- << be_nl
- << " ACE_TEXT (\"" << port_name
- << "\"))," << be_nl
- << " 0);" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "::Components::Cookie * retv = 0;" << be_nl
- << "ACE_NEW_THROW_EX (retv," << be_nl
- << " ::CIAO::Cookie_Impl (entry.first),"
- << be_nl
- << " ::CORBA::NO_MEMORY ());"
- << be_nl << be_nl
- << "return retv;" << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "::Components::Cookie *" << be_nl
- << node_->local_name () << "_Context::subscribe_"
- << port_name << "_generic (" << be_idt_nl
- << "::Components::EventConsumerBase_ptr c)" << be_uidt_nl
- << "{" << be_idt_nl
- << "if ( ::CORBA::is_nil (c))" << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::CORBA::BAD_PARAM ();" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "std::pair<" << tao_cg->upcase (port_name)
- << "_GENERIC_TABLE::iterator, bool> result;" << be_nl
- << tao_cg->upcase (port_name)
- << "_GENERIC_TABLE::value_type entry;" << be_nl
- << "entry.first = reinterpret_cast<ptrdiff_t> (c);"
- << be_nl
- << "entry.second =" << be_idt_nl
- << "::Components::EventConsumerBase::_duplicate (c);"
- << be_uidt_nl << be_nl;
-
- if (! static_config)
- {
- os_ << "{" << be_idt_nl
- << "ACE_WRITE_GUARD_RETURN (TAO_SYNCH_MUTEX," << be_nl
- << " mon," << be_nl
- << " this->" << port_name
- << "_lock_," << be_nl
- << " 0);" << be_nl << be_nl;
- }
-
- os_ << "result =" << be_idt_nl
- << "this->ciao_publishes_" << port_name
- << "_generic_.insert (entry);" << be_uidt;
-
- if (! static_config)
- {
- os_ << be_uidt_nl
- << "}";
- }
-
- os_ << be_nl << be_nl
- << "if (! result.second)" << be_idt_nl
- << "{" << be_idt_nl
- << "ACE_ERROR_RETURN ((LM_ERROR," << be_nl
- << " ACE_TEXT (\"generic subscribe \")"
- << be_nl
- << " ACE_TEXT (\"on %s failed\\n\"),"
- << be_nl
- << " ACE_TEXT (\"" << port_name
- << "\"))," << be_nl
- << " 0);" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "::Components::Cookie * retv = 0;" << be_nl
- << "ACE_NEW_THROW_EX (retv," << be_nl
- << " ::CIAO::Cookie_Impl (entry.first),"
- << be_nl
- << " ::CORBA::NO_MEMORY ());"
- << be_nl << be_nl
- << "return retv;" << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "::" << fname << "Consumer_ptr" << be_nl
- << node_->local_name () << "_Context::unsubscribe_"
- << port_name << " (" << be_idt_nl
- << "::Components::Cookie * ck)" << be_uidt_nl
- << "{" << be_idt_nl
- << "ptrdiff_t key = 0UL;" << be_nl
- << tao_cg->upcase (port_name)
- << "_TABLE::size_type n = 0UL;" << be_nl << be_nl
- << "if (ck == 0 || ! ::CIAO::Cookie_Impl::extract (ck, key))"
- << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::Components::InvalidConnection ();" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl;
-
- if (! static_config)
- {
- os_ << "{" << be_idt_nl
- << "ACE_WRITE_GUARD_RETURN (TAO_SYNCH_MUTEX," << be_nl
- << " mon," << be_nl
- << " this->" << port_name
- << "_lock_," << be_nl
- << " ::" << fname
- << "Consumer::_nil ());" << be_nl << be_nl;
- }
-
- os_ << tao_cg->upcase (port_name) << "_TABLE::iterator iter ="
- << be_idt_nl
- << "this->ciao_publishes_" << port_name << "_.find (key);"
- << be_uidt_nl << be_nl
- << "if (iter != this->ciao_publishes_" << port_name
- << "_.end ())" << be_idt_nl
- << "{" << be_idt_nl
- << "::" << fname
- << "Consumer_var retv = iter->second;" << be_nl
- << "n = this->ciao_publishes_" << port_name
- << "_.erase (key);" << be_nl << be_nl
- << "if (n == 1UL)" << be_idt_nl
- << "{" << be_idt_nl
- << "return retv._retn ();" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "throw ::Components::InvalidConnection ();" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << tao_cg->upcase (port_name)
- << "_GENERIC_TABLE::iterator giter =" << be_idt_nl
- << "this->ciao_publishes_" << port_name
- << "_generic_.find (key);" << be_uidt_nl << be_nl
- << "if (giter == this->ciao_publishes_" << port_name
- << "_generic_.end ())" << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::Components::InvalidConnection ();" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "n = this->ciao_publishes_" << port_name
- << "_generic_.erase (key);";
-
- if (! static_config)
- {
- os_ << be_uidt_nl
- << "}";
- }
-
- os_ << be_nl << be_nl
- << "if (n != 1UL)" << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::Components::InvalidConnection ();" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "return ::" << fname << "Consumer::_nil ();"
- << be_uidt_nl
- << "}";
-}
-
-void
-be_visitor_component_svs::gen_publishes_servant_top (void)
-{
- os_ << be_nl << be_nl
- << "::Components::Cookie *" << be_nl
- << node_->local_name () << "_Servant::subscribe ("
- << be_idt_nl
- << "const char * publisher_name," << be_nl
- << "::Components::EventConsumerBase_ptr subscribe)"
- << be_uidt_nl
- << "{" << be_idt_nl;
-
- if (swapping_)
- {
- os_ << "this->activate_component ();" << be_nl << be_nl;
- }
-
- os_ << "ACE_UNUSED_ARG (subscribe);" << be_nl << be_nl
- << "if (publisher_name == 0)" << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::Components::InvalidName ();" << be_uidt_nl
- << "}" << be_uidt;
-
- AST_Component *node = node_;
-
- while (node != 0)
- {
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_publishes)
- {
- continue;
- }
-
- AST_Publishes *p =
- AST_Publishes::narrow_from_decl (d);
-
- this->gen_subscribe_block (p);
- }
-
- node = node->base_component ();
- }
-
- os_ << be_nl << be_nl
- << "throw ::Components::InvalidName ();" << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "::Components::EventConsumerBase_ptr" << be_nl
- << node_->local_name () << "_Servant::unsubscribe ("
- << be_idt_nl
- << "const char * publisher_name," << be_nl
- << "::Components::Cookie * ck)" << be_uidt_nl
- << "{" << be_idt_nl;
-
- if (swapping_)
- {
- os_ << "this->activate_component ();" << be_nl << be_nl;
- }
-
- os_ << "ACE_UNUSED_ARG (ck);" << be_nl << be_nl
- << "if (publisher_name == 0)" << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::Components::InvalidName ();" << be_uidt_nl
- << "}" << be_uidt;
-
- node = node_;
-
- while (node != 0)
- {
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_publishes)
- {
- continue;
- }
-
- AST_Publishes *p =
- AST_Publishes::narrow_from_decl (d);
-
- this->gen_unsubscribe_block (p);
- }
-
- node = node->base_component ();
- }
-
- os_ << be_nl << be_nl
- << "throw ::Components::InvalidName ();" << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "::Components::PublisherDescriptions *" << be_nl
- << node_->local_name ()
- << "_Servant::get_all_publishers (void)" << be_nl
- << "{" << be_idt_nl
- << "::Components::PublisherDescriptions *retval = 0;"
- << be_nl
- << "ACE_NEW_RETURN (retval," << be_nl
- << " ::Components::PublisherDescriptions,"
- << be_nl
- << " 0);" << be_nl << be_nl
- << "::Components::PublisherDescriptions_var "
- << "safe_retval = retval;" << be_nl
- << "safe_retval->length (" << n_publishes_
- << "UL);";
-
- node = node_;
- ACE_CDR::ULong slot = 0UL;
-
- while (node != 0)
- {
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_publishes)
- {
- continue;
- }
-
- AST_Publishes *p =
- AST_Publishes::narrow_from_decl (d);
-
- this->gen_event_source_description (p, slot++);
- }
-
- node = node->base_component ();
- }
-
- os_ << be_nl << be_nl
- << "return safe_retval._retn ();" << be_uidt_nl
- << "}";
-
- this->gen_publishes_servant_r (node_);
-}
-
-void
-be_visitor_component_svs::gen_subscribe_block (
- AST_Publishes *p)
-{
- const char *obj_name = p->publishes_type ()->full_name ();
- const char *port_name = p->local_name ()->get_string ();
-
- os_ << be_nl << be_nl
- << "if (ACE_OS::strcmp (publisher_name, \""
- << port_name << "\") == 0)" << be_idt_nl
- << "{" << be_idt_nl
- << "::" << obj_name << "Consumer_var sub =" << be_idt_nl
- << "::" << obj_name << "Consumer::_narrow (subscribe);"
- << be_uidt_nl << be_nl
- << "if ( ::CORBA::is_nil (sub.in ()))" << be_idt_nl
- << "{" << be_idt_nl
- << "::CORBA::Boolean const substitutable =" << be_idt_nl
- << "subscribe->ciao_is_substitutable (" << be_idt_nl
- << "::" << obj_name
- << "::_tao_obv_static_repository_id ());"
- << be_uidt << be_uidt_nl << be_nl
- << "if (substitutable)" << be_idt_nl
- << "{" << be_idt_nl
- << "return this->subscribe_" << port_name
- << "_generic (subscribe);" << be_uidt_nl
- << "}" << be_uidt_nl
- << "else" << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::Components::InvalidConnection ();" << be_uidt_nl
- << "}" << be_uidt << be_uidt_nl
- << "}" << be_uidt_nl
- << "else" << be_idt_nl
- << "{" << be_idt_nl
- << "return this->subscribe_" << port_name
- << " (sub.in ());" << be_uidt_nl
- << "}" << be_uidt << be_uidt_nl
- << "}" << be_uidt;
-}
-
-void
-be_visitor_component_svs::gen_unsubscribe_block (
- AST_Publishes *p)
-{
- const char *port_name = p->local_name ()->get_string ();
-
- os_ << be_nl << be_nl
- << "if (ACE_OS::strcmp (publisher_name, \""
- << port_name << "\") == 0)" << be_idt_nl
- << "{" << be_idt_nl
- << "return this->unsubscribe_" << port_name
- << " (ck);" << be_uidt_nl
- << "}" << be_uidt;
-}
-
-void
-be_visitor_component_svs::gen_event_source_description (
- AST_Publishes *p,
- ACE_CDR::ULong slot)
-{
- AST_Type *obj = p->publishes_type ();
- const char *port_name = p->local_name ()->get_string ();
-
- os_ << be_nl << be_nl;
-
- if (! be_global->gen_ciao_static_config ())
- {
- os_ << "{" << be_idt_nl
- << "ACE_READ_GUARD_RETURN (TAO_SYNCH_MUTEX," << be_nl
- << " mon," << be_nl
- << " this->context_->"
- << port_name << "_lock_," << be_nl
- << " 0);" << be_nl << be_nl;
- }
-
- os_ << "::CIAO::Servant::describe_pub_event_source<"
- << be_idt_nl
- << "::" << obj->full_name () << "Consumer_var> ("
- << be_idt_nl
- << "\"" << port_name << "\"," << be_nl
- << "\"" << obj->repoID () << "\"," << be_nl
- << "this->context_->ciao_publishes_"
- << port_name << "_," << be_nl
- << "safe_retval," << be_nl
- << slot << "UL);" << be_uidt << be_uidt;
-
- if (! be_global->gen_ciao_static_config ())
- {
- os_ << be_uidt_nl
- << "}";
- }
-}
-
-void
-be_visitor_component_svs::gen_publishes_servant_r (AST_Component *node)
-{
- if (node == 0)
- {
- return;
- }
-
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_publishes)
- {
- continue;
- }
-
- AST_Publishes *p =
- AST_Publishes::narrow_from_decl (d);
-
- this->gen_publishes_servant (p);
- }
-
- node = node->base_component ();
- this->gen_publishes_servant_r (node);
-}
-
-void
-be_visitor_component_svs::gen_publishes_servant (
- AST_Publishes *p)
-{
- const char *obj_name = p->publishes_type ()->full_name ();
- const char *port_name = p->local_name ()->get_string ();
-
- os_ << be_nl << be_nl
- << "::Components::Cookie *" << be_nl
- << node_->local_name () << "_Servant::subscribe_"
- << port_name << " (" << be_idt_nl
- << "::" << obj_name << "Consumer_ptr c)" << be_uidt_nl
- << "{" << be_idt_nl;
-
- if (swapping_)
- {
- os_ << "this->activate_component ();" << be_nl;
- }
-
- os_ << "return this->context_->subscribe_" << port_name
- << " (c);" << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "::Components::Cookie *" << be_nl
- << node_->local_name () << "_Servant::subscribe_"
- << port_name << "_generic (" << be_idt_nl
- << "::Components::EventConsumerBase_ptr c)" << be_uidt_nl
- << "{" << be_idt_nl;
-
- if (swapping_)
- {
- os_ << "this->activate_component ();" << be_nl;
- }
-
- os_ << "return this->context_->subscribe_" << port_name
- << "_generic (c);" << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "::" << obj_name << "Consumer_ptr" << be_nl
- << node_->local_name () << "_Servant::unsubscribe_"
- << port_name << " (" << be_idt_nl
- << "::Components::Cookie * ck)" << be_uidt_nl
- << "{" << be_idt_nl;
-
- if (swapping_)
- {
- os_ << "this->activate_component ();" << be_nl;
- }
-
- os_ << "return this->context_->unsubscribe_" << port_name
- << " (ck);" << be_uidt_nl
- << "}";
-}
-
void
-be_visitor_component_svs::gen_consumes_r (AST_Component *node)
-{
- if (node == 0)
- {
- return;
- }
-
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_consumes)
- {
- continue;
- }
-
- AST_Consumes *c =
- AST_Consumes::narrow_from_decl (d);
-
- this->gen_consumes (c);
- }
-
- node = node->base_component ();
- this->gen_consumes_r (node);
-}
-
-void
-be_visitor_component_svs::gen_consumes (AST_Consumes *c)
-{
- AST_Type *obj = c->consumes_type ();
- const char *port_name = c->local_name ()->get_string ();
-
- const char *comp_lname = node_->local_name ();
- ACE_CString comp_sname_str (
- ScopeAsDecl (node_->defined_in ())->full_name ());
- const char *comp_sname = comp_sname_str.c_str ();
- const char *global = (comp_sname_str == "" ? "" : "::");
-
- const char *lname = obj->local_name ()->get_string ();
- const char *fname = obj->full_name ();
-
- os_ << be_nl << be_nl
- << comp_lname << "_Servant::" << lname << "Consumer_"
- << port_name << "_Servant::" << lname << "Consumer_"
- << port_name << "_Servant (" << be_idt << be_idt_nl
- << global << comp_sname << "::CCM_" << comp_lname
- << "_ptr executor," << be_nl
- << global << comp_sname << "::CCM_" << comp_lname
- << "_Context_ptr c)" << be_uidt_nl
- << ": executor_ ( " << global << comp_sname << "::CCM_"
- << comp_lname << "::_duplicate (executor))," << be_idt_nl
- << "ctx_ ( " << global << comp_sname
- << "::CCM_" << comp_lname
- << "_Context::_duplicate (c))" << be_uidt << be_uidt_nl
- << "{" << be_nl
- << "}";
-
- os_ << be_nl << be_nl
- << comp_lname << "_Servant::" << lname << "Consumer_"
- << port_name << "_Servant::~" << lname << "Consumer_"
- << port_name << "_Servant (void)" << be_nl
- << "{" << be_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "::CORBA::Object_ptr" << be_nl
- << comp_lname << "_Servant::" << lname << "Consumer_"
- << port_name << "_Servant::_get_component (void)" << be_nl
- << "{" << be_idt_nl
- << "return this->ctx_->get_CCM_object ();" << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "void" << be_nl
- << comp_lname << "_Servant::" << lname << "Consumer_"
- << port_name << "_Servant::push_" << lname
- << " (" << be_idt_nl
- << "::" << fname << " * evt)" << be_uidt_nl
- << "{" << be_idt_nl
- << "this->executor_->push_" << port_name
- << " (evt);" << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "/// Inherited from ::Components::EventConsumerBase."
- << be_nl
- << "void" << be_nl
- << comp_lname << "_Servant::" << lname << "Consumer_"
- << port_name << "_Servant::push_event (" << be_idt_nl
- << "::Components::EventBase * ev)" << be_uidt_nl
- << "{" << be_idt_nl
- << "::" << fname << " * ev_type =" << be_idt_nl
- << "::" << fname << "::_downcast (ev);"
- << be_uidt_nl << be_nl
- << "if (ev_type != 0)" << be_idt_nl
- << "{" << be_idt_nl
- << "this->push_" << lname << " (ev_type);" << be_nl
- << "return;" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "throw ::Components::BadEventType ();" << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "/// CIAO-specific."
- << be_nl
- << "void" << be_nl
- << comp_lname << "_Servant::" << lname << "Consumer_"
- << port_name << "_Servant::ciao_push_event (" << be_idt_nl
- << "::Components::EventBase * ev," << be_nl
- << "const char * /* source_id */," << be_nl
- << "::CORBA::TypeCode_ptr /* tc */)" << be_uidt_nl
- << "{" << be_idt_nl
- << "this->push_event (ev);" << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "/// CIAO-specific."
- << be_nl
- << "::CORBA::Boolean" << be_nl
- << comp_lname << "_Servant::" << lname << "Consumer_"
- << port_name << "_Servant::ciao_is_substitutable ("
- << be_idt_nl
- << "const char * event_repo_id)" << be_uidt_nl
- << "{" << be_idt_nl
- << "if (event_repo_id == 0)" << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::CORBA::BAD_PARAM ();" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "CORBA::ORB_ptr orb = TAO_ORB_Core_instance ()->orb ();"
- << be_nl << be_nl
- << "CORBA::ValueFactory f =" << be_idt_nl
- << "orb->lookup_value_factory (event_repo_id);"
- << be_uidt_nl << be_nl
- << "if (f == 0)" << be_idt_nl
- << "{" << be_idt_nl
- << "return false;" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "CORBA::ValueBase_var v = f->create_for_unmarshal ();"
- << be_nl
- << "f->_remove_ref ();" << be_nl << be_nl
- << "if (v.in () == 0)" << be_idt_nl
- << "{" << be_idt_nl
- << "return false;" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "return dynamic_cast< ::" << fname
- << " *> (v.in ()) != 0;" << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "::" << fname << "Consumer_ptr" << be_nl
- << node_->local_name () << "_Servant::get_consumer_"
- << port_name << " (void)" << be_nl
- << "{" << be_idt_nl
- << "if (! ::CORBA::is_nil (this->consumes_" << port_name
- << "_.in ()))" << be_idt_nl
- << "{" << be_idt_nl
- << "return ::" << fname
- << "Consumer::_duplicate (this->consumes_"
- << port_name << "_.in ());" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "::Components::EventConsumerBase_var obj =" << be_idt_nl
- << "this->get_consumer_" << port_name << "_i ();"
- << be_uidt_nl << be_nl
- << "::" << fname << "Consumer_var eco =" << be_idt_nl
- << "::" << fname << "Consumer::_narrow (obj.in ());"
- << be_uidt_nl << be_nl
- << "this->consumes_" << port_name << "_ = eco;" << be_nl
- << "return" << be_idt_nl
- << "::" << fname << "Consumer::_duplicate (" << be_idt_nl
- << "this->consumes_" << port_name << "_.in ());"
- << be_uidt << be_uidt << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "::Components::EventConsumerBase_ptr" << be_nl
- << node_->local_name () << "_Servant::get_consumer_"
- << port_name << "_i (void)" << be_nl
- << "{" << be_idt_nl
- << "::Components::EventConsumerBase_ptr ret =" << be_idt_nl
- << "this->lookup_consumer (\"" << port_name << "\");"
- << be_uidt_nl << be_nl
- << "if (! ::CORBA::is_nil (ret))" << be_idt_nl
- << "{" << be_idt_nl
- << "return ret;" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "typedef" << be_idt_nl
- << "::CIAO::Port_Activator_T<" << be_idt_nl
- << node_->local_name () << "_Servant::" << lname
- << "Consumer_" << port_name << "_Servant," << be_nl
- << global << comp_sname << "::CCM_" << comp_lname
- << "," << be_nl
- << global << comp_sname << "::CCM_" << comp_lname
- << "_Context," << be_nl
- << node_->local_name () << "_Servant>" << be_uidt_nl
- << "MACRO_MADNESS_TYPEDEF;" << be_uidt_nl << be_nl
- << "MACRO_MADNESS_TYPEDEF * tmp = 0;" << be_nl
- << "ACE_CString obj_id (this->ins_name_);" << be_nl
- << "obj_id += \"_" << port_name << "\";" << be_nl << be_nl
- << "ACE_NEW_THROW_EX (" << be_idt_nl
- << "tmp," << be_nl
- << "MACRO_MADNESS_TYPEDEF (" << be_idt_nl
- << "obj_id.c_str ()," << be_nl
- << "\"" << port_name << "\"," << be_nl
- << "::CIAO::Port_Activator_Types::SINK," << be_nl
- << "this->executor_.in ()," << be_nl
- << "this->context_," << be_nl
- << "this)," << be_uidt_nl
- << "::CORBA::NO_MEMORY ());" << be_uidt_nl << be_nl
- << "::CIAO::Port_Activator_var pa = tmp;" << be_nl << be_nl
- << "::CIAO::Servant_Activator_var sa =" << be_idt_nl
- << "this->container_->ports_servant_activator ();"
- << be_uidt_nl << be_nl
- << "if (! sa->register_port_activator (tmp))"
- << be_idt_nl
- << "{" << be_idt_nl
- << "return ::" << fname << "Consumer::_nil ();" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "::CORBA::Object_var obj =" << be_idt_nl
- << "this->container_->generate_reference (" << be_idt_nl
- << "obj_id.c_str ()," << be_nl
- << "\"";
-
- ACE_CString work (obj->repoID ());
- ACE_CString result (work.substr (0, work.rfind (':')));
- result += "Consumer:1.0";
-
- os_ << result.c_str ();
-
- os_ << "\"," << be_nl
- << "::CIAO::Container_Types::FACET_CONSUMER_t);"
- << be_uidt_nl << be_uidt_nl
- << "::Components::EventConsumerBase_var ecb =" << be_idt_nl
- << "::Components::EventConsumerBase::_narrow (obj.in ());"
- << be_uidt_nl << be_nl
- << "this->add_consumer (\"" << port_name << "\", ecb.in ());"
- << be_nl << be_nl
- << "return ecb._retn ();" << be_uidt_nl
- << "}";
-}
-
-void
-be_visitor_component_svs::gen_emits_context_r (AST_Component *node)
-{
- if (node == 0)
- {
- return;
- }
-
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_emits)
- {
- continue;
- }
-
- AST_Emits *e =
- AST_Emits::narrow_from_decl (d);
-
- this->gen_emits_context (e);
- }
-
- node = node->base_component ();
- this->gen_emits_context_r (node);
-}
-
-void
-be_visitor_component_svs::gen_emits_context (
- AST_Emits *e)
-{
- AST_Type *obj = e->emits_type ();
- const char *port_name = e->local_name ()->get_string ();
-
- const char *fname = obj->full_name ();
- const char *lname = obj->local_name ()->get_string ();
-
- os_ << be_nl << be_nl
- << "void" << be_nl
- << node_->local_name () << "_Context::push_" << port_name
- << " (" << be_idt_nl
- << "::" << fname << " * ev)" << be_uidt_nl
- << "{" << be_idt_nl
- << "if (! ::CORBA::is_nil (this->ciao_emits_"
- << port_name << "_consumer_.in ()))" << be_idt_nl
- << "{" << be_idt_nl
- << "this->ciao_emits_" << port_name << "_consumer_->push_"
- << lname << " (ev);" << be_uidt_nl
- << "}" << be_uidt << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "void" << be_nl
- << node_->local_name () << "_Context::connect_" << port_name
- << " (" << be_idt_nl
- << "::" << fname << "Consumer_ptr c)" << be_uidt_nl
- << "{" << be_idt_nl
- << "if ( ::CORBA::is_nil (c))" << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::CORBA::BAD_PARAM ();" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "if (! ::CORBA::is_nil (this->ciao_emits_"
- << port_name << "_consumer_.in ()))" << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::Components::AlreadyConnected ();" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "this->ciao_emits_" << port_name
- << "_consumer_ =" << be_idt_nl
- << "::" << fname << "Consumer::_duplicate (c);"
- << be_uidt << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "::" << fname << "Consumer_ptr" << be_nl
- << node_->local_name () << "_Context::disconnect_"
- << port_name << " (void)" << be_nl
- << "{" << be_idt_nl
- << "if ( ::CORBA::is_nil (this->ciao_emits_"
- << port_name << "_consumer_.in ()))" << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::Components::NoConnection ();" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "return this->ciao_emits_" << port_name
- << "_consumer_._retn ();" << be_uidt_nl
- << "}";
-}
-
-void
-be_visitor_component_svs::gen_emits_servant_top (void)
-{
- os_ << be_nl << be_nl
- << "void" << be_nl
- << node_->local_name () << "_Servant::connect_consumer ("
- << be_idt_nl
- << "const char * emitter_name," << be_nl
- << "::Components::EventConsumerBase_ptr consumer)"
- << be_uidt_nl
- << "{" << be_idt_nl;
-
- if (swapping_)
- {
- os_ << "this->activate_component ();" << be_nl << be_nl;
- }
-
- os_ << "if (emitter_name == 0)" << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::CORBA::BAD_PARAM ();" << be_uidt_nl
- << "}" << be_uidt;
-
- AST_Component *node = node_;
-
- while (node != 0)
- {
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_emits)
- {
- continue;
- }
-
- AST_Emits *e =
- AST_Emits::narrow_from_decl (d);
-
- this->gen_connect_consumer_block (e);
- }
-
- node = node->base_component ();
- }
-
- os_ << be_nl << be_nl
- << "ACE_UNUSED_ARG (consumer);" << be_nl
- << "throw ::Components::InvalidName ();" << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "::Components::EventConsumerBase_ptr" << be_nl
- << node_->local_name ()
- << "_Servant::disconnect_consumer (" << be_idt_nl
- << "const char * source_name)" << be_uidt_nl
- << "{" << be_idt_nl;
-
- if (swapping_)
- {
- os_ << "this->activate_component ();" << be_nl << be_nl;
- }
-
- os_ << "if (source_name == 0)" << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::CORBA::BAD_PARAM ();" << be_uidt_nl
- << "}" << be_uidt;
-
- node = node_;
-
- while (node != 0)
- {
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_emits)
- {
- continue;
- }
-
- AST_Emits *e =
- AST_Emits::narrow_from_decl (d);
-
- this->gen_disconnect_consumer_block (e);
- }
-
- node = node->base_component ();
- }
-
- os_ << be_nl << be_nl
- << "throw ::Components::InvalidName ();" << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "::Components::EmitterDescriptions *" << be_nl
- << node_->local_name ()
- << "_Servant::get_all_emitters (void)" << be_nl
- << "{" << be_idt_nl
- << "::Components::EmitterDescriptions *retval = 0;"
- << be_nl
- << "ACE_NEW_RETURN (retval," << be_nl
- << " ::Components::EmitterDescriptions,"
- << be_nl
- << " 0);" << be_nl << be_nl
- << "::Components::EmitterDescriptions_var "
- << "safe_retval = retval;" << be_nl
- << "safe_retval->length (" << n_emits_
- << "UL);";
-
- node = node_;
- ACE_CDR::ULong slot = 0UL;
-
- while (node != 0)
- {
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_emits)
- {
- continue;
- }
-
- AST_Emits *e =
- AST_Emits::narrow_from_decl (d);
-
- this->gen_emitter_description (e, slot++);
- }
-
- node = node->base_component ();
- }
-
- os_ << be_nl << be_nl
- << "return safe_retval._retn ();" << be_uidt_nl
- << "}";
-
- this->gen_emits_servant_r (node_);
-}
-
-void
-be_visitor_component_svs::gen_connect_consumer_block (
- AST_Emits *e)
-{
- const char *obj_name = e->emits_type ()->full_name ();
- const char *port_name = e->local_name ()->get_string ();
-
- os_ << be_nl << be_nl
- << "if (ACE_OS::strcmp (emitter_name, \""
- << port_name << "\") == 0)" << be_idt_nl
- << "{" << be_idt_nl
- << "::" << obj_name
- << "Consumer_var _ciao_consumer =" << be_idt_nl
- << "::" << obj_name
- << "Consumer::_narrow (consumer);" << be_uidt_nl << be_nl
- << "if ( ::CORBA::is_nil (_ciao_consumer.in ()))"
- << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::Components::InvalidConnection ();" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "this->connect_" << port_name
- << " (_ciao_consumer.in ());" << be_nl << be_nl
- << "return;" << be_uidt_nl
- << "}" << be_uidt;
-}
-
-void
-be_visitor_component_svs::gen_disconnect_consumer_block (
- AST_Emits *e)
-{
- const char *port_name = e->local_name ()->get_string ();
-
- os_ << be_nl << be_nl
- << "if (ACE_OS::strcmp (source_name, \""
- << port_name << "\") == 0)" << be_idt_nl
- << "{" << be_idt_nl
- << "return this->disconnect_" << port_name
- << " ();" << be_uidt_nl
- << "}" << be_uidt;
-}
-
-void
-be_visitor_component_svs::gen_emitter_description (
- AST_Emits *e,
- ACE_CDR::ULong slot)
-{
- AST_Type *obj = e->emits_type ();
- const char *port_name = e->local_name ()->get_string ();
-
- os_ << be_nl << be_nl
- << "::CIAO::Servant::describe_emit_event_source<"
- << be_idt_nl
- << "::" << obj->full_name () << "Consumer_var> ("
- << be_idt_nl
- << "\"" << port_name << "\"," << be_nl
- << "\"" << obj->repoID () << "\"," << be_nl
- << "this->context_->ciao_emits_" << port_name
- << "_consumer_," << be_nl
- << "safe_retval," << be_nl
- << slot << "UL);" << be_uidt << be_uidt;
-}
-
-void
-be_visitor_component_svs::gen_emits_servant_r (AST_Component *node)
-{
- if (node == 0)
- {
- return;
- }
-
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_emits)
- {
- continue;
- }
-
- AST_Emits *e =
- AST_Emits::narrow_from_decl (d);
-
- this->gen_emits_servant (e);
- }
-
- node = node->base_component ();
- this->gen_emits_context_r (node);
-}
-
-void
-be_visitor_component_svs::gen_emits_servant (AST_Emits *e)
-{
- const char *obj_name = e->emits_type ()->full_name ();
- const char *port_name = e->local_name ()->get_string ();
-
- os_ << be_nl << be_nl
- << "void" << be_nl
- << node_->local_name () << "_Servant::connect_"
- << port_name << " (" << be_idt_nl
- << "::" << obj_name << "Consumer_ptr c)" << be_uidt_nl
- << "{" << be_idt_nl
- << "this->context_->connect_" << port_name
- << " (c);" << be_uidt_nl
- << "}";
-
- os_ << be_nl << be_nl
- << "::" << obj_name << "Consumer_ptr" << be_nl
- << node_->local_name () << "_Servant::disconnect_"
- << port_name << " (void)" << be_nl
- << "{" << be_idt_nl
- << "return this->context_->disconnect_"
- << port_name << " ();" << be_uidt_nl
- << "}";
-}
-
-void
-be_visitor_component_svs::gen_attr_set_r (AST_Component *node)
-{
- if (node == 0)
- {
- return;
- }
-
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- // Get the next AST decl node
- AST_Decl *d = si.item ();
-
- if (d->node_type () == AST_Decl::NT_attr)
- {
- be_attribute *attr =
- be_attribute::narrow_from_decl (d);
-
- if (attr->readonly ())
- {
- continue;
- }
-
- be_visitor_attribute_component_init v (this->ctx_);
-
- if (v.visit_attribute (attr) == -1)
- {
- }
- }
- }
-
- node = node->base_component ();
- this->gen_attr_set_r (node);
-}
-
-void
-be_visitor_component_svs::gen_populate_r (AST_Component *node)
-{
- if (node == 0)
- {
- return;
- }
-
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- switch (d->node_type ())
- {
- case AST_Decl::NT_provides:
- os_ << be_nl
- << "obj_var = this->provide_"
- << d->local_name ()->get_string () << "_i ();";
-
- break;
- case AST_Decl::NT_consumes:
- os_ << be_nl
- << "ecb_var = this->get_consumer_"
- << d->local_name ()->get_string () << "_i ();";
-
- break;
- default:
- break;
- }
- }
-
- node = node->base_component ();
- this->gen_populate_r (node);
-}
-
-void
-be_visitor_component_svs::gen_entrypoint (void)
+be_visitor_component_svs::gen_entrypoint (AST_Component *node)
{
ACE_CString sname_str (
- ScopeAsDecl (node_->defined_in ())->full_name ());
+ ScopeAsDecl (node->defined_in ())->full_name ());
const char *sname = sname_str.c_str ();
- const char *lname = node_->local_name ();
+ const char *lname = node->local_name ()->get_string ();
const char *global = (sname_str == "" ? "" : "::");
os_ << be_nl << be_nl
<< "extern \"C\" " << export_macro_.c_str ()
<< " ::PortableServer::Servant" << be_nl
- << "create_" << node_->flat_name ()
+ << "create_" << node->flat_name ()
<< "_Servant (" << be_idt_nl
<< "::Components::EnterpriseComponent_ptr p," << be_nl
<< "::CIAO::Container_ptr c," << be_nl
@@ -2658,188 +131,3 @@ be_visitor_component_svs::gen_entrypoint (void)
<< "}";
}
-void
-be_visitor_component_svs::gen_all_factory_registration (void)
-{
- for (UTL_ScopeActiveIterator si (node_, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
- AST_Type *port_type = 0;
-
- switch (d->node_type ())
- {
- case AST_Decl::NT_publishes:
- case AST_Decl::NT_emits:
- case AST_Decl::NT_consumes:
- port_type =
- AST_Field::narrow_from_decl (d)->field_type ();
- this->gen_one_factory_registration (port_type);
- break;
- default:
- break;
- }
- }
-}
-
-void
-be_visitor_component_svs::gen_one_factory_registration (AST_Type *t)
-{
- os_ << be_nl << be_nl
- << "TAO_OBV_REGISTER_FACTORY (" << be_idt_nl
- << "::" << t->full_name () << "_init," << be_nl
- << "::" << t->full_name () << ");" << be_uidt;
-}
-
-void
-be_visitor_component_svs::gen_swapping_get_consumers_r (
- AST_Component *node)
-{
- if (node == 0)
- {
- return;
- }
-
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- if (d->node_type () != AST_Decl::NT_publishes)
- {
- continue;
- }
-
- this->gen_swapping_get_comsumer_block (d->local_name ()->get_string ());
- }
-
- node = node->base_component ();
- this->gen_swapping_get_consumers_r (node);
-}
-
-void
-be_visitor_component_svs::gen_swapping_get_comsumer_block (
- const char * port_name)
-{
- bool static_config =
- be_global->gen_ciao_static_config ();
-
- os_ << be_nl << be_nl
- << "if (ACE_OS::strcmp (publisher_name, \""
- << port_name << "\") == 0)" << be_idt_nl
- << "{" << be_idt_nl
- << "_ciao_size = this->_ciao_publishes_"
- << port_name << "_.size ();" << be_nl << be_nl
- << "ACE_NEW_THROW_EX (tmp," << be_nl
- << " ::Components::"
- << "ConsumerDescriptions (_ciao_size)," << be_nl
- << " ::CORBA::NO_MEMORY ());";
-
- if (! static_config)
- {
- os_ << be_nl << be_nl
- << "{" << be_idt_nl
- << "ACE_READ_GUARD_RETURN (TAO_SYNCH_MUTEX," << be_nl
- << " mon," << be_nl
- << " this->" << port_name
- << "_lock_," << be_nl
- << " 0);";
- }
-
- os_ << be_nl << be_nl
- << "for (" << tao_cg->upcase (port_name)
- << "_TABLE::const_iterator iter =" << be_idt_nl
- << " this->ciao_publishes_" << port_name
- << "_.begin ();" << be_uidt_nl
- << " iter != this->ciao_publishes_" << port_name
- << ".end ();" << be_nl
- << " ++iter, ++_ciao_index)" << be_idt_nl
- << "{" << be_idt_nl
- << "if ( ::CORBA::is_nil (iter->second.in ()))" << be_idt_nl
- << "{" << be_idt_nl
- << "throw ::Components::InvalidConnection ();" << be_uidt_nl
- << "}" << be_uidt_nl << be_nl
- << "::Components::ConsumerDescription * cd = 0;" << be_nl
- << "ACE_NEW_THROW_EX (cd," << be_nl
- << " OBV_Components::ConsumerDescription,"
- << be_nl
- << " ::CORBA::NO_MEMORY ());"
- << be_nl << be_nl
- << "::Components::ConsumerDescription_var safe = cd;"
- << be_nl
- << "safe->name (\"\");" << be_nl
- << "safe->type_id (\"\");" << be_nl
- << "safe->consumer (iter->second.in ());"
- << be_nl << be_nl
- << "retval[_ciao_index] = safe;" << be_uidt_nl
- << "}" << be_uidt;
-
- if (! static_config)
- {
- os_ << be_uidt_nl
- << "}";
- }
-
- os_ << be_uidt_nl << be_nl
- << "return retval._retn ();" << be_uidt_nl
- << "}";
-}
-
-void
-be_visitor_component_svs::compute_slots (AST_Component *node)
-{
- while (node != 0)
- {
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- AST_Decl *d = si.item ();
-
- switch (d->node_type ())
- {
- case AST_Decl::NT_provides:
- ++n_provides_;
- break;
- case AST_Decl::NT_uses:
- ++n_uses_;
- break;
- case AST_Decl::NT_publishes:
- ++n_publishes_;
- break;
- case AST_Decl::NT_emits:
- ++n_emits_;
- break;
- case AST_Decl::NT_consumes:
- ++n_consumes_;
- break;
- default:
- break;
- }
- }
-
- node = node->base_component ();
- }
-}
-
-Component_Op_Attr_Generator::Component_Op_Attr_Generator (
- be_visitor_scope * visitor)
- : visitor_ (visitor)
-{
-}
-
-int
-Component_Op_Attr_Generator::emit (be_interface * /* derived_interface */,
- TAO_OutStream * /* os */,
- be_interface * base_interface)
-{
- if (base_interface->node_type () == AST_Decl::NT_component)
- {
- return 0;
- }
-
- return visitor_->visit_scope (base_interface);
-}
-
diff --git a/TAO/TAO_IDL/be/be_visitor_component/context_ex_idl.cpp b/TAO/TAO_IDL/be/be_visitor_component/context_ex_idl.cpp
new file mode 100644
index 00000000000..caf3f4bcef6
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component/context_ex_idl.cpp
@@ -0,0 +1,146 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// context_ex_idl.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for the contect class
+// in the CIAO executor IDL.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+be_visitor_context_ex_idl::be_visitor_context_ex_idl (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
+{
+}
+
+be_visitor_context_ex_idl::~be_visitor_context_ex_idl (
+ void)
+{
+}
+
+int
+be_visitor_context_ex_idl::visit_component (
+ be_component *node)
+{
+ node_ = node;
+
+ os_ << be_nl << be_nl
+ << "local interface CCM_"
+ << node->original_local_name ()->get_string ()
+ << "_Context" << be_idt_nl
+ << ": ";
+
+ AST_Component *base = node->base_component ();
+
+ if (base == 0)
+ {
+ os_ << "::Components::SessionContext";
+ }
+ else
+ {
+ AST_Decl *scope =
+ ScopeAsDecl (base->defined_in ());
+
+ ACE_CString sname_str =
+ IdentifierHelper::orig_sn (scope->name ());
+ const char *sname = sname_str.c_str ();
+
+ const char *lname =
+ base->original_local_name ()->get_string ();
+
+ const char *global = (sname_str == "" ? "" : "::");
+
+ os_ << global << sname << "::CCM_"
+ << lname << "_Context";
+ }
+
+ os_ << be_uidt_nl
+ << "{" << be_idt;
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_context_ex_idl::")
+ ACE_TEXT ("visit_component - ")
+ ACE_TEXT ("visit_scope() failed\n")),
+ -1);
+ }
+
+ os_ << be_uidt_nl
+ << "};";
+
+ return 0;
+}
+
+int
+be_visitor_context_ex_idl::visit_uses (
+ be_uses *node)
+{
+ be_type *impl = node->uses_type ();
+
+ os_ << be_nl
+ << "::";
+
+ const char *lname = node->local_name ()->get_string ();
+
+ // Note that we don't strip off the possible '_cxx_' when
+ // adding the 'Connections' suffix. The front end will
+ // create this implied IDL node with the '_cxx_' so lookup
+ // will fail (when processing the *E.idl file) if we
+ // strip it off here.
+ if (node->is_multiple ())
+ {
+ os_ << IdentifierHelper::orig_sn (node_->name ()).c_str ()
+ << "::" << lname << "Connections get_connections_"
+ << lname << " ();";
+ }
+ else
+ {
+ os_ << IdentifierHelper::orig_sn (impl->name ()).c_str ()
+ << " get_connection_" << lname << " ();";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_context_ex_idl::visit_publishes (
+ be_publishes *node)
+{
+ be_eventtype *impl = node->publishes_type ();
+
+ os_ << be_nl
+ << "void push_" << node->local_name ()->get_string ()
+ << " (in ::"
+ << IdentifierHelper::orig_sn (impl->name ()).c_str ()
+ << " e);";
+
+ return 0;
+}
+
+int
+be_visitor_context_ex_idl::visit_emits (
+ be_emits *node)
+{
+ be_eventtype *impl = node->emits_type ();
+
+ os_ << be_nl
+ << "void push_" << node->local_name ()->get_string ()
+ << " (in ::"
+ << IdentifierHelper::orig_sn (impl->name ()).c_str ()
+ << " e);";
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_component/context_svh.cpp b/TAO/TAO_IDL/be/be_visitor_component/context_svh.cpp
new file mode 100644
index 00000000000..aac46513ee3
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component/context_svh.cpp
@@ -0,0 +1,282 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// context_svh.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for a context class in the
+// servant header.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+be_visitor_context_svh::be_visitor_context_svh (be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
+{
+}
+
+be_visitor_context_svh::~be_visitor_context_svh (void)
+{
+}
+
+int
+be_visitor_context_svh::visit_component (be_component *node)
+{
+ node_ = node;
+
+ AST_Decl *scope = ScopeAsDecl (node->defined_in ());
+ ACE_CString sname_str (scope->full_name ());
+ const char *sname = sname_str.c_str ();
+
+ // No '_cxx_' prefix.
+ const char *lname =
+ node->original_local_name ()->get_string ();
+
+ const char *global = (sname_str == "" ? "" : "::");
+
+ os_ << be_nl
+ << "class " << lname << "_Servant;"
+ << be_nl << be_nl;
+
+ os_ << "class " << export_macro_.c_str () << " " << lname
+ << "_Context" << be_idt_nl
+ << ": public virtual ::CIAO::"
+ << (swapping_ ? "Upgradeable_" : "")
+ << "Context_Impl<" << be_idt << be_idt_nl
+ << global << sname << "::CCM_" << lname
+ << "_Context," << be_nl
+ << lname << "_Servant," << be_nl
+ << "::" << node->name () << ">" << be_uidt << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "public:" << be_idt_nl;
+
+ os_ << "// Allow the servant to access our state." << be_nl
+ << "friend class " << lname << "_Servant;"
+ << be_nl << be_nl;
+
+ os_ << "// Some useful typedefs." << be_nl<< be_nl
+ << "typedef" << be_nl
+ << "::CIAO::Context_Impl<" << be_idt << be_idt_nl
+ << global << sname << "::CCM_"
+ << lname << "_Context," << be_nl
+ << lname << "_Servant," << be_nl
+ << "::" << node->name () << ">" << be_uidt_nl
+ << "base_type;" << be_uidt_nl << be_nl;
+
+ os_ << "typedef base_type::context_type context_type;" << be_nl
+ << "typedef base_type::servant_type servant_type;" << be_nl
+ << "typedef base_type::component_type component_type;"
+ << be_nl << be_nl;
+
+ os_ << lname << "_Context (" << be_idt_nl
+ << "::Components::CCMHome_ptr h," << be_nl
+ << "::CIAO::Container_ptr c," << be_nl
+ << lname << "_Servant *sv);" << be_uidt_nl << be_nl;
+
+ os_ << "virtual ~" << lname << "_Context (void);";
+
+ os_ << be_nl << be_nl
+ << "// CIAO-specific." << be_nl
+ << "static " << lname << "_Context *" << be_nl
+ << "_narrow ( ::Components::SessionContext_ptr p);";
+
+ os_ << be_nl << be_nl
+ << "// Operations for " << lname
+ << " receptacles and event sources,"
+ << be_nl
+ << "// defined in " << global << sname
+ << "::CCM_" << lname << "_Context.";
+
+ if (this->visit_component_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_context_svh")
+ ACE_TEXT ("::visit_component - ")
+ ACE_TEXT ("visit_component_scope() ")
+ ACE_TEXT ("failed\n")),
+ -1);
+ }
+
+ if (swapping_)
+ {
+ os_ << be_nl << be_nl
+ << "/// Operation defined in " << sname << "::CCM_"
+ << lname << "_Context" << be_nl
+ << "/// that enable component swapping in the container."
+ << be_nl
+ << "virtual ::Components::ConsumerDescriptions *" << be_nl
+ << "get_registered_consumers (const char * publisher_name);";
+ }
+
+ os_ << be_uidt_nl
+ << "};";
+
+ return 0;
+}
+
+int
+be_visitor_context_svh::visit_uses (be_uses *node)
+{
+ const char *obj_name = node->uses_type ()->full_name ();
+ const char *port_name = node->local_name ()->get_string ();
+ bool is_multiple = node->is_multiple ();
+
+ os_ << be_uidt_nl << be_nl
+ << "public:" << be_idt_nl
+ << "virtual ";
+
+ if (is_multiple)
+ {
+ os_ << "::" << node_->full_name () << "::"
+ << port_name << "Connections *" << be_nl
+ << "get_connections_" << port_name << " (void);";
+ }
+ else
+ {
+ os_ << "::" << obj_name << "_ptr" << be_nl
+ << "get_connection_" << port_name << " (void);";
+ }
+
+ os_ << be_nl << be_uidt_nl
+ << "protected:" << be_idt_nl
+ << "virtual "
+ << (is_multiple ? "::Components::Cookie *" : "void")
+ << be_nl
+ << "connect_" << port_name << " (" << be_idt_nl
+ << "::" << obj_name << "_ptr);"
+ << be_uidt_nl << be_nl;
+
+ os_ << "virtual ::" << obj_name << "_ptr" << be_nl
+ << "disconnect_" << port_name << " (";
+
+ if (is_multiple)
+ {
+ os_ << be_idt_nl
+ << "::Components::Cookie * ck);" << be_uidt;
+ }
+ else
+ {
+ os_ << "void);";
+ }
+
+ os_ << be_uidt_nl << be_nl
+ << "protected:" << be_idt_nl;
+
+ if (is_multiple)
+ {
+ os_ << "// Multiplex " << port_name << " connection." << be_nl
+ << "typedef ACE_Array_Map<ptrdiff_t," << be_nl
+ << " ::"
+ << obj_name << "_var>" << be_idt_nl
+ << tao_cg->upcase (port_name)
+ << "_TABLE;" << be_uidt_nl
+ << tao_cg->upcase (port_name) << "_TABLE "
+ << "ciao_uses_" << port_name << "_;" << be_nl
+ << "TAO_SYNCH_MUTEX " << port_name << "_lock_;";
+ }
+ else
+ {
+ os_ << "// Simplex " << port_name << " connection." << be_nl
+ << "::" << obj_name << "_var" << be_nl
+ << "ciao_uses_" << port_name << "_;";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_context_svh::visit_publishes (be_publishes *node)
+{
+ const char *obj_name = node->publishes_type ()->full_name ();
+ const char *port_name = node->local_name ()->get_string ();
+
+ os_ << be_uidt_nl << be_nl
+ << "public:" << be_idt_nl
+ << "virtual void" << be_nl
+ << "push_" << port_name << " (" << be_idt_nl
+ << "::" << obj_name << " * ev);" << be_uidt_nl;
+
+ os_ << be_uidt_nl
+ << "protected:" << be_idt_nl;
+
+ os_ << "virtual ::Components::Cookie *" << be_nl
+ << "subscribe_" << port_name << " (" << be_idt_nl
+ << "::" << obj_name << "Consumer_ptr c);" << be_uidt_nl;
+
+ os_ << be_nl
+ << "// CIAO-specific." << be_nl
+ << "::Components::Cookie *" << be_nl
+ << "subscribe_" << port_name << "_generic (" << be_idt_nl
+ << "::Components::EventConsumerBase_ptr c);" << be_uidt_nl;
+
+ os_ << be_nl
+ << "virtual ::" << obj_name << "Consumer_ptr" << be_nl
+ << "unsubscribe_" << port_name << " (" << be_idt_nl
+ << "::Components::Cookie * ck);" << be_uidt;
+
+ os_ << be_uidt_nl << be_nl
+ << "protected:" << be_idt_nl;
+
+ os_ << "typedef ACE_Array_Map<ptrdiff_t," << be_nl
+ << " ::" << obj_name
+ << "Consumer_var>" << be_idt_nl
+ << tao_cg->upcase (port_name) << "_TABLE;" << be_uidt_nl
+ << tao_cg->upcase (port_name) << "_TABLE ciao_publishes_"
+ << port_name << "_;" << be_nl
+ << "TAO_SYNCH_MUTEX " << port_name << "_lock_;"
+ << be_nl << be_nl;
+
+ os_ << "typedef ACE_Array_Map<ptrdiff_t," << be_nl
+ << " ::Components::EventConsumerBase_var>"
+ << be_idt_nl
+ << tao_cg->upcase (port_name)
+ << "_GENERIC_TABLE;" << be_uidt_nl
+ << tao_cg->upcase (port_name)
+ << "_GENERIC_TABLE ciao_publishes_"
+ << port_name << "_generic_;";
+
+ return 0;
+}
+
+int
+be_visitor_context_svh::visit_emits (be_emits *node)
+{
+ const char *obj_name = node->emits_type ()->full_name ();
+ const char *port_name = node->local_name ()->get_string ();
+
+ os_ << be_uidt_nl << be_nl
+ << "public:" << be_idt_nl;
+
+ os_ << "virtual void" << be_nl
+ << "push_" << port_name << " (" << be_idt_nl
+ << "::" << obj_name << " * ev);" << be_uidt;
+
+ os_ << be_uidt_nl << be_nl
+ << "protected:" << be_idt_nl;
+
+ os_ << "virtual void" << be_nl
+ << "connect_" << port_name << " (" << be_idt_nl
+ << "::" << obj_name << "Consumer_ptr c);" << be_uidt;
+
+ os_ << be_nl << be_nl
+ << "virtual ::" << obj_name << "Consumer_ptr" << be_nl
+ << "disconnect_" << port_name << " (void);";
+
+ os_ << be_uidt_nl << be_nl
+ << "protected:" << be_idt_nl
+ << "::" << obj_name << "Consumer_var" << be_nl
+ << "ciao_emits_" << port_name << "_consumer_;";
+
+ return 0;
+}
+
+
diff --git a/TAO/TAO_IDL/be/be_visitor_component/context_svs.cpp b/TAO/TAO_IDL/be/be_visitor_component/context_svs.cpp
new file mode 100644
index 00000000000..4e9d832e296
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component/context_svs.cpp
@@ -0,0 +1,774 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// context_svs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for a context class in the
+// servant sourece.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+be_visitor_context_svs::be_visitor_context_svs (be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
+{
+}
+
+be_visitor_context_svs::~be_visitor_context_svs (void)
+{
+}
+
+int
+be_visitor_context_svs::visit_component (be_component *node)
+{
+ node_ = node;
+
+ AST_Decl *scope = ScopeAsDecl (node->defined_in ());
+ ACE_CString sname_str (scope->full_name ());
+ const char *sname = sname_str.c_str ();
+ const char *lname = node_->local_name ();
+ const char *global = (sname_str == "" ? "" : "::");
+
+ os_ << be_nl
+ << lname <<"_Context::" << lname << "_Context ("
+ << be_idt << be_idt_nl
+ << "::Components::CCMHome_ptr h," << be_nl
+ << "::CIAO::Container_ptr c," << be_nl
+ << lname << "_Servant * sv)" << be_uidt_nl
+ << ": ::CIAO::Context_Impl_Base (h, c)," << be_idt_nl
+ << "::CIAO::Context_Impl<" << be_idt_nl
+ << global << sname << "::CCM_"
+ << lname << "_Context," << be_nl
+ << lname << "_Servant," << be_nl
+ << "::" << node->full_name () << "> (h, c, sv)";
+
+ if (swapping_)
+ {
+ os_ << "," << be_uidt_nl
+ << "::CIAO::Upgradeable_Context_Impl<" << be_idt_nl
+ << global << sname << "::CCM_" << lname
+ << "_Context," << be_nl
+ << lname << "_Servant," << be_nl
+ << "::" << node_->full_name ()
+ << "> (h, c, sv)";
+ }
+
+ os_ << be_uidt << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << lname << "_Context::~"
+ << lname << "_Context (void)" << be_nl
+ << "{" << be_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "/// CIAO-specific." << be_nl
+ << lname << "_Context *" << be_nl
+ << lname
+ << "_Context::_narrow ( ::Components::SessionContext_ptr p)"
+ << be_nl
+ << "{" << be_idt_nl
+ << "return dynamic_cast<" << lname
+ << "_Context *> (p);" << be_uidt_nl
+ << "}";
+
+ if (this->visit_component_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_context_svs")
+ ACE_TEXT ("::visit_component - ")
+ ACE_TEXT ("visit_component_scope() ")
+ ACE_TEXT ("failed\n")),
+ -1);
+ }
+
+ if (swapping_)
+ {
+ os_ << be_nl << be_nl
+ << "/// Operations defined in " << sname
+ << "::CCM_" << lname << "_Context" << be_nl
+ << "/// that enable component swapping in the container"
+ << be_nl << be_nl
+ << "::Components::ConsumerDescriptions *" << be_nl
+ << lname << "_Context::get_registered_consumers ("
+ << be_idt_nl
+ << "const char * publisher_name)" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "if (publisher_name == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::Components::InvalidName ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "::Components::ConsumerDescriptions * tmp = 0;"
+ << be_nl
+ << "::Components::ConsumerDescriptions_var retval;"
+ << be_nl
+ << "::CORBA::ULong _ciao_index = 0UL;" << be_nl
+ << "::CORBA::ULong _ciao_size = 0UL;" << be_nl
+ << "ACE_UNUSED_ARG (tmp);" << be_nl
+ << "ACE_UNUSED_ARG (retval);" << be_nl
+ << "ACE_UNUSED_ARG (_ciao_index);" << be_nl
+ << "ACE_UNUSED_ARG (_ciao_size);";
+
+ be_visitor_swapping_get_consumer v (this->ctx_);
+
+ if (v.visit_component_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_context_svs")
+ ACE_TEXT ("::visit_component - ")
+ ACE_TEXT ("swapping_get_consumer ")
+ ACE_TEXT ("visitor failed\n")),
+ -1);
+ }
+
+ os_ << be_nl << be_nl
+ << "throw ::Components::InvalidName ();" << be_uidt_nl
+ << "}";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_context_svs::visit_uses (be_uses *node)
+{
+ AST_Type *obj = node->uses_type ();
+ const char *port_name = node->local_name ()->get_string ();
+ bool is_multiple = node->is_multiple ();
+
+ if (is_multiple)
+ {
+ this->gen_uses_multiplex (obj, port_name);
+ }
+ else
+ {
+ this->gen_uses_simplex (obj, port_name);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_context_svs::visit_publishes (be_publishes *node)
+{
+ AST_Type *obj = node->publishes_type ();
+ const char *port_name =
+ node->local_name ()->get_string ();
+ const char *fname = obj->full_name ();
+ const char *lname = obj->local_name ()->get_string ();
+ ACE_CString sname_str (
+ ScopeAsDecl (obj->defined_in ())->full_name ());
+ const char *sname = sname_str.c_str ();
+ const char *global = (sname_str == "" ? "" : "::");
+
+ os_ << be_nl << be_nl
+ << "void" << be_nl
+ << node_->local_name () << "_Context::push_"
+ << port_name << " (" << be_idt_nl
+ << "::" << fname << " * ev)" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ if (! static_config_)
+ {
+ os_ << "ACE_READ_GUARD (TAO_SYNCH_MUTEX," << be_nl
+ << " mon," << be_nl
+ << " this->" << port_name
+ << "_lock_);" << be_nl << be_nl;
+ }
+
+ os_ << "for (" << tao_cg->upcase (port_name)
+ << "_TABLE::const_iterator iter =" << be_nl
+ << " this->ciao_publishes_" << port_name
+ << "_.begin ();" << be_nl
+ << " iter != this->ciao_publishes_" << port_name
+ << "_.end ();" << be_nl
+ << " ++iter)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "iter->second->push_" << lname << " (ev);"
+ << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "ACE_CString source_id (this->_ciao_instance_id ());"
+ << be_nl
+ << "source_id += \"_" << port_name << "\";"
+ << be_nl << be_nl
+ << "for (" << tao_cg->upcase (port_name)
+ << "_GENERIC_TABLE::const_iterator giter =" << be_nl
+ << " this->ciao_publishes_" << port_name
+ << "_generic_.begin ();" << be_nl
+ << " giter != this->ciao_publishes_"
+ << port_name << "_generic_.end ();" << be_nl
+ << " ++giter)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "giter->second->ciao_push_event (ev," << be_nl
+ << " source_id.c_str (),"
+ << be_nl
+ << " " << global
+ << sname << "::_tc_" << lname << ");" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "::Components::Cookie *" << be_nl
+ << node_->local_name () << "_Context::subscribe_"
+ << port_name << " (" << be_idt_nl
+ << "::" << fname << "Consumer_ptr c)" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "if ( ::CORBA::is_nil (c))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::CORBA::BAD_PARAM ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "std::pair<" << tao_cg->upcase (port_name)
+ << "_TABLE::iterator, bool> result;" << be_nl
+ << tao_cg->upcase (port_name)
+ << "_TABLE::value_type entry;" << be_nl
+ << "entry.first = reinterpret_cast<ptrdiff_t> (c);"
+ << be_nl
+ << "entry.second = ::" << fname
+ << "Consumer::_duplicate (c);" << be_nl << be_nl;
+
+ if (! static_config_)
+ {
+ os_ << "{" << be_idt_nl
+ << "ACE_WRITE_GUARD_RETURN (TAO_SYNCH_MUTEX," << be_nl
+ << " mon," << be_nl
+ << " this->" << port_name
+ << "_lock_," << be_nl
+ << " 0);" << be_nl << be_nl;
+ }
+
+ os_ << "result = this->ciao_publishes_" << port_name
+ << "_.insert (entry);";
+
+ if (! static_config_)
+ {
+ os_ << be_uidt_nl
+ << "}";
+ }
+
+ os_ << be_nl << be_nl
+ << "if (! result.second)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "ACE_ERROR_RETURN ((LM_ERROR," << be_nl
+ << " ACE_TEXT (\"subscribe on %s failed\\n\"),"
+ << be_nl
+ << " ACE_TEXT (\"" << port_name
+ << "\"))," << be_nl
+ << " 0);" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "::Components::Cookie * retv = 0;" << be_nl
+ << "ACE_NEW_THROW_EX (retv," << be_nl
+ << " ::CIAO::Cookie_Impl (entry.first),"
+ << be_nl
+ << " ::CORBA::NO_MEMORY ());"
+ << be_nl << be_nl
+ << "return retv;" << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "::Components::Cookie *" << be_nl
+ << node_->local_name () << "_Context::subscribe_"
+ << port_name << "_generic (" << be_idt_nl
+ << "::Components::EventConsumerBase_ptr c)" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "if ( ::CORBA::is_nil (c))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::CORBA::BAD_PARAM ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "std::pair<" << tao_cg->upcase (port_name)
+ << "_GENERIC_TABLE::iterator, bool> result;" << be_nl
+ << tao_cg->upcase (port_name)
+ << "_GENERIC_TABLE::value_type entry;" << be_nl
+ << "entry.first = reinterpret_cast<ptrdiff_t> (c);"
+ << be_nl
+ << "entry.second =" << be_idt_nl
+ << "::Components::EventConsumerBase::_duplicate (c);"
+ << be_uidt_nl << be_nl;
+
+ if (! static_config_)
+ {
+ os_ << "{" << be_idt_nl
+ << "ACE_WRITE_GUARD_RETURN (TAO_SYNCH_MUTEX," << be_nl
+ << " mon," << be_nl
+ << " this->" << port_name
+ << "_lock_," << be_nl
+ << " 0);" << be_nl << be_nl;
+ }
+
+ os_ << "result =" << be_idt_nl
+ << "this->ciao_publishes_" << port_name
+ << "_generic_.insert (entry);" << be_uidt;
+
+ if (! static_config_)
+ {
+ os_ << be_uidt_nl
+ << "}";
+ }
+
+ os_ << be_nl << be_nl
+ << "if (! result.second)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "ACE_ERROR_RETURN ((LM_ERROR," << be_nl
+ << " ACE_TEXT (\"generic subscribe \")"
+ << be_nl
+ << " ACE_TEXT (\"on %s failed\\n\"),"
+ << be_nl
+ << " ACE_TEXT (\"" << port_name
+ << "\"))," << be_nl
+ << " 0);" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "::Components::Cookie * retv = 0;" << be_nl
+ << "ACE_NEW_THROW_EX (retv," << be_nl
+ << " ::CIAO::Cookie_Impl (entry.first),"
+ << be_nl
+ << " ::CORBA::NO_MEMORY ());"
+ << be_nl << be_nl
+ << "return retv;" << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "::" << fname << "Consumer_ptr" << be_nl
+ << node_->local_name () << "_Context::unsubscribe_"
+ << port_name << " (" << be_idt_nl
+ << "::Components::Cookie * ck)" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "ptrdiff_t key = 0UL;" << be_nl
+ << tao_cg->upcase (port_name)
+ << "_TABLE::size_type n = 0UL;" << be_nl << be_nl
+ << "if (ck == 0 || ! ::CIAO::Cookie_Impl::extract (ck, key))"
+ << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::Components::InvalidConnection ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+
+ if (! static_config_)
+ {
+ os_ << "{" << be_idt_nl
+ << "ACE_WRITE_GUARD_RETURN (TAO_SYNCH_MUTEX," << be_nl
+ << " mon," << be_nl
+ << " this->" << port_name
+ << "_lock_," << be_nl
+ << " ::" << fname
+ << "Consumer::_nil ());" << be_nl << be_nl;
+ }
+
+ os_ << tao_cg->upcase (port_name) << "_TABLE::iterator iter ="
+ << be_idt_nl
+ << "this->ciao_publishes_" << port_name << "_.find (key);"
+ << be_uidt_nl << be_nl
+ << "if (iter != this->ciao_publishes_" << port_name
+ << "_.end ())" << be_idt_nl
+ << "{" << be_idt_nl
+ << "::" << fname
+ << "Consumer_var retv = iter->second;" << be_nl
+ << "n = this->ciao_publishes_" << port_name
+ << "_.erase (key);" << be_nl << be_nl
+ << "if (n == 1UL)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return retv._retn ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "throw ::Components::InvalidConnection ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << tao_cg->upcase (port_name)
+ << "_GENERIC_TABLE::iterator giter =" << be_idt_nl
+ << "this->ciao_publishes_" << port_name
+ << "_generic_.find (key);" << be_uidt_nl << be_nl
+ << "if (giter == this->ciao_publishes_" << port_name
+ << "_generic_.end ())" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::Components::InvalidConnection ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "n = this->ciao_publishes_" << port_name
+ << "_generic_.erase (key);";
+
+ if (! static_config_)
+ {
+ os_ << be_uidt_nl
+ << "}";
+ }
+
+ os_ << be_nl << be_nl
+ << "if (n != 1UL)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::Components::InvalidConnection ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "return ::" << fname << "Consumer::_nil ();"
+ << be_uidt_nl
+ << "}";
+
+ return 0;
+}
+
+int
+be_visitor_context_svs::visit_emits (be_emits *node)
+{
+ AST_Type *obj = node->emits_type ();
+ const char *port_name =
+ node->local_name ()->get_string ();
+
+ const char *fname = obj->full_name ();
+ const char *lname = obj->local_name ()->get_string ();
+
+ os_ << be_nl << be_nl
+ << "void" << be_nl
+ << node_->local_name () << "_Context::push_" << port_name
+ << " (" << be_idt_nl
+ << "::" << fname << " * ev)" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "if (! ::CORBA::is_nil (this->ciao_emits_"
+ << port_name << "_consumer_.in ()))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "this->ciao_emits_" << port_name << "_consumer_->push_"
+ << lname << " (ev);" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "void" << be_nl
+ << node_->local_name () << "_Context::connect_" << port_name
+ << " (" << be_idt_nl
+ << "::" << fname << "Consumer_ptr c)" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "if ( ::CORBA::is_nil (c))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::CORBA::BAD_PARAM ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "if (! ::CORBA::is_nil (this->ciao_emits_"
+ << port_name << "_consumer_.in ()))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::Components::AlreadyConnected ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "this->ciao_emits_" << port_name
+ << "_consumer_ =" << be_idt_nl
+ << "::" << fname << "Consumer::_duplicate (c);"
+ << be_uidt << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "::" << fname << "Consumer_ptr" << be_nl
+ << node_->local_name () << "_Context::disconnect_"
+ << port_name << " (void)" << be_nl
+ << "{" << be_idt_nl
+ << "if ( ::CORBA::is_nil (this->ciao_emits_"
+ << port_name << "_consumer_.in ()))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::Components::NoConnection ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "return this->ciao_emits_" << port_name
+ << "_consumer_._retn ();" << be_uidt_nl
+ << "}";
+
+ return 0;
+}
+
+void
+be_visitor_context_svs::gen_uses_simplex (
+ AST_Type *obj,
+ const char *port_name)
+{
+ const char *fname = obj->full_name ();
+
+ os_ << be_nl << be_nl
+ << "::" << fname << "_ptr" << be_nl
+ << node_->local_name () << "_Context::get_connection_"
+ << port_name << " (void)" << be_nl
+ << "{" << be_idt_nl
+ << "return ::" << fname << "::_duplicate (" << be_idt_nl
+ << "this->ciao_uses_" << port_name << "_.in ());"
+ << be_uidt << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "void" << be_nl
+ << node_->local_name () << "_Context::connect_"
+ << port_name << " (" << be_idt_nl
+ << "::" << fname << "_ptr c)" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "if (! ::CORBA::is_nil (this->ciao_uses_"
+ << port_name << "_.in ()))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::Components::AlreadyConnected ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "if ( ::CORBA::is_nil (c))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::Components::InvalidConnection ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "this->ciao_uses_" << port_name << "_ =" << be_idt_nl
+ << "::" << fname << "::_duplicate (c);"
+ << be_uidt << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "::" << fname << "_ptr" << be_nl
+ << node_->local_name () << "_Context::disconnect_"
+ << port_name << " (void)" << be_nl
+ << "{" << be_idt_nl
+ << "if ( ::CORBA::is_nil (this->ciao_uses_"
+ << port_name << "_.in ()))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::Components::NoConnection ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "return this->ciao_uses_" << port_name
+ << "_._retn ();" << be_uidt_nl
+ << "}";
+}
+
+void
+be_visitor_context_svs::gen_uses_multiplex (
+ AST_Type *obj,
+ const char *port_name)
+{
+ const char *fname = obj->full_name ();
+ bool static_config = be_global->gen_ciao_static_config ();
+
+ os_ << be_nl << be_nl
+ << "::" << node_->full_name () << "::" << port_name
+ << "Connections *" << be_nl
+ << node_->local_name () << "_Context::get_connections_"
+ << port_name << " (void)" << be_nl
+ << "{" << be_idt_nl;
+
+ if (! static_config)
+ {
+ os_ << "ACE_READ_GUARD_RETURN (TAO_SYNCH_MUTEX," << be_nl
+ << " mon," << be_nl
+ << " this->" << port_name
+ << "_lock_," << be_nl
+ << " 0);" << be_nl << be_nl;
+ }
+
+ os_ << "::" << node_->full_name () << "::" << port_name
+ << "Connections * tmp_retv = 0;" << be_nl
+ << "ACE_NEW_THROW_EX (tmp_retv," << be_nl
+ << " ::" << node_->full_name ()
+ << "::" << port_name << "Connections (" << be_nl
+ << " this->ciao_uses_"
+ << port_name << "_.size ())," << be_nl
+ << " ::CORBA::NO_MEMORY ());"
+ << be_nl << be_nl
+ << "::" << node_->full_name () << "::" << port_name
+ << "Connections_var retv = tmp_retv;" << be_nl
+ << "retv->length (this->ciao_uses_" << port_name
+ << "_.size ());" << be_nl
+ << "::CORBA::ULong i = 0UL;" << be_nl << be_nl
+ << "for (" << tao_cg->upcase (port_name)
+ << "_TABLE::const_iterator iter =" << be_nl
+ << " this->ciao_uses_" << port_name << "_.begin ();"
+ << be_nl
+ << " iter != this->ciao_uses_"
+ << port_name << "_.end ();" << be_nl
+ << " ++iter, ++i)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "retv[i].objref = iter->second;" << be_nl << be_nl
+ << "ACE_NEW_THROW_EX (retv[i].ck.inout ()," << be_nl
+ << " ::CIAO::Cookie_Impl (iter->first),"
+ << be_nl
+ << " ::CORBA::NO_MEMORY ());" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "return retv._retn (); " << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "::Components::Cookie *" << be_nl
+ << node_->local_name () << "_Context::connect_"
+ << port_name << " (" << be_idt_nl
+ << "::" << fname << "_ptr c)" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "if ( ::CORBA::is_nil (c))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::Components::InvalidConnection ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "std::pair<" << tao_cg->upcase (port_name)
+ << "_TABLE::iterator, bool> result;" << be_nl
+ << tao_cg->upcase (port_name)
+ << "_TABLE::value_type entry;" << be_nl
+ << "entry.first = reinterpret_cast<ptrdiff_t> (c);" << be_nl
+ << "entry.second = ::" << fname
+ << "::_duplicate (c);";
+
+ if (! static_config)
+ {
+ os_ << be_nl << be_nl
+ << "{" << be_idt_nl
+ << "ACE_WRITE_GUARD_RETURN (TAO_SYNCH_MUTEX," << be_nl
+ << " mon," << be_nl
+ << " this->" << port_name
+ << "_lock_," << be_nl
+ << " 0);";
+ }
+
+ os_ << be_nl << be_nl
+ << "result = this->ciao_uses_" << port_name
+ << "_.insert (entry);";
+
+ if (! static_config)
+ {
+ os_ << be_uidt_nl
+ << "}";
+ }
+
+ os_ << be_nl << be_nl
+ << "if (! result.second)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::Components::InvalidConnection ();"
+ << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "::Components::Cookie * ck = 0;" << be_nl
+ << "ACE_NEW_THROW_EX (ck," << be_nl
+ << " ::CIAO::Cookie_Impl (entry.first),"
+ << be_nl
+ << " ::CORBA::NO_MEMORY ());"
+ << be_nl << be_nl
+ << "return ck;" << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "::" << fname << "_ptr" << be_nl
+ << node_->local_name () << "_Context::disconnect_"
+ << port_name << " (" << be_idt_nl
+ << "::Components::Cookie * ck)" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "::" << fname << "_var retv;" << be_nl
+ << "ptrdiff_t key = 0UL;" << be_nl
+ << tao_cg->upcase (port_name)
+ << "_TABLE::size_type n = 0UL;" << be_nl << be_nl
+ << "if (ck == 0 || ! ::CIAO::Cookie_Impl::extract (ck, key))"
+ << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::Components::InvalidConnection ();" << be_uidt_nl
+ << "}" << be_uidt;
+
+ if (! static_config)
+ {
+ os_ << be_nl << be_nl
+ << "{" << be_idt_nl
+ << "ACE_WRITE_GUARD_RETURN (TAO_SYNCH_MUTEX," << be_nl
+ << " mon," << be_nl
+ << " this->" << port_name
+ << "_lock_," << be_nl
+ << " ::" << fname
+ << "::_nil ());";
+ }
+
+ os_ << be_nl << be_nl
+ << tao_cg->upcase (port_name)
+ << "_TABLE::iterator iter =" << be_idt_nl
+ << "this->ciao_uses_" << port_name
+ << "_.find (key);" << be_uidt_nl << be_nl
+ << "if (iter == this->ciao_uses_" << port_name
+ << "_.end ())" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::Components::InvalidConnection ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "retv = iter->second;" << be_nl
+ << "n = this->ciao_uses_" << port_name
+ << "_.erase (key);";
+
+ if (! static_config)
+ {
+ os_ << be_uidt_nl
+ << "}";
+ }
+
+ os_ << be_nl << be_nl
+ << "if (n != 1UL)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::Components::InvalidConnection ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "return retv._retn ();" << be_uidt_nl
+ << "}";
+}
+
+// ===============================================
+
+be_visitor_swapping_get_consumer::be_visitor_swapping_get_consumer (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
+{
+}
+
+be_visitor_swapping_get_consumer::~be_visitor_swapping_get_consumer (
+ void)
+{
+}
+
+int
+be_visitor_swapping_get_consumer::visit_publishes (
+ be_publishes *node)
+{
+ const char *port_name =
+ node->local_name ()->get_string ();
+
+ os_ << be_nl << be_nl
+ << "if (ACE_OS::strcmp (publisher_name, \""
+ << port_name << "\") == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "_ciao_size = this->_ciao_publishes_"
+ << port_name << "_.size ();" << be_nl << be_nl
+ << "ACE_NEW_THROW_EX (tmp," << be_nl
+ << " ::Components::"
+ << "ConsumerDescriptions (_ciao_size)," << be_nl
+ << " ::CORBA::NO_MEMORY ());";
+
+ if (! static_config_)
+ {
+ os_ << be_nl << be_nl
+ << "{" << be_idt_nl
+ << "ACE_READ_GUARD_RETURN (TAO_SYNCH_MUTEX," << be_nl
+ << " mon," << be_nl
+ << " this->" << port_name
+ << "_lock_," << be_nl
+ << " 0);";
+ }
+
+ os_ << be_nl << be_nl
+ << "for (" << tao_cg->upcase (port_name)
+ << "_TABLE::const_iterator iter =" << be_idt_nl
+ << " this->ciao_publishes_" << port_name
+ << "_.begin ();" << be_uidt_nl
+ << " iter != this->ciao_publishes_" << port_name
+ << ".end ();" << be_nl
+ << " ++iter, ++_ciao_index)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "if ( ::CORBA::is_nil (iter->second.in ()))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::Components::InvalidConnection ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "::Components::ConsumerDescription * cd = 0;" << be_nl
+ << "ACE_NEW_THROW_EX (cd," << be_nl
+ << " OBV_Components::ConsumerDescription,"
+ << be_nl
+ << " ::CORBA::NO_MEMORY ());"
+ << be_nl << be_nl
+ << "::Components::ConsumerDescription_var safe = cd;"
+ << be_nl
+ << "safe->name (\"\");" << be_nl
+ << "safe->type_id (\"\");" << be_nl
+ << "safe->consumer (iter->second.in ());"
+ << be_nl << be_nl
+ << "retval[_ciao_index] = safe;" << be_uidt_nl
+ << "}" << be_uidt;
+
+ if (! static_config_)
+ {
+ os_ << be_uidt_nl
+ << "}";
+ }
+
+ os_ << be_uidt_nl << be_nl
+ << "return retval._retn ();" << be_uidt_nl
+ << "}";
+
+ return 0;
+} \ No newline at end of file
diff --git a/TAO/TAO_IDL/be/be_visitor_component/executor_ex_idl.cpp b/TAO/TAO_IDL/be/be_visitor_component/executor_ex_idl.cpp
new file mode 100644
index 00000000000..025de3897bf
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component/executor_ex_idl.cpp
@@ -0,0 +1,240 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// executor_ex_idl.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for components
+// in the CIAO executor IDL.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+be_visitor_executor_ex_idl::be_visitor_executor_ex_idl (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
+{
+}
+
+be_visitor_executor_ex_idl::~be_visitor_executor_ex_idl (
+ void)
+{
+}
+
+int
+be_visitor_executor_ex_idl::visit_component (
+ be_component *node)
+{
+ node_ = node;
+
+ AST_Component *base = node->base_component ();
+
+ os_ << be_nl
+ << "local interface CCM_"
+ << node->original_local_name ()->get_string ()
+ << be_idt_nl
+ << ": ";
+
+ if (base == 0)
+ {
+ os_ << "::Components::EnterpriseComponent";
+
+ this->gen_supported ();
+ }
+ else
+ {
+ ACE_CString sname_str =
+ IdentifierHelper::orig_sn (
+ ScopeAsDecl (base->defined_in ())->name ());
+
+ const char *sname = sname_str.c_str ();
+ const char *global = (sname_str == "" ? "" : "::");
+
+ os_ << global << sname << "::CCM_"
+ << base->original_local_name ()->get_string ();
+ }
+
+ os_ << be_uidt_nl
+ << "{" << be_idt;
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_executor_ex_idl::")
+ ACE_TEXT ("visit_component - ")
+ ACE_TEXT ("visit_scope() failed\n")),
+ -1);
+ }
+
+ os_ << be_uidt_nl
+ << "};";
+
+ return 0;
+}
+
+int
+be_visitor_executor_ex_idl::visit_attribute (
+ be_attribute *node)
+{
+ bool rd_only = node->readonly ();
+
+ // Keep output statements separate because of side effects.
+ // No need to check for anonymous array - anonymous types not
+ // accepted by parser for attributes.
+ os_ << be_nl
+ << (rd_only ? "readonly " : "") << "attribute ";
+
+ be_type *ft = node->field_type ();
+
+ os_ << IdentifierHelper::type_name (ft, this);
+ os_ << " "
+ << IdentifierHelper::try_escape (node->original_local_name ()).c_str ();
+
+ this->gen_exception_list (node->get_get_exceptions (),
+ rd_only ? "" : "get");
+
+ this->gen_exception_list (node->get_set_exceptions (),
+ "set");
+
+ os_ << ";";
+
+ return 0;
+}
+
+int
+be_visitor_executor_ex_idl::visit_sequence (
+ be_sequence *node)
+{
+ // Keep output statements separate because of side effects.
+ os_ << "sequence<";
+
+ be_type *bt = node->base_type ();
+
+ os_ << IdentifierHelper::type_name (bt, this);
+
+ if (!node->unbounded ())
+ {
+ os_ << ", " << node->max_size ()->ev ()->u.ulval;
+ }
+
+ os_ << "> ";
+
+ return 0;
+}
+
+int
+be_visitor_executor_ex_idl::visit_string (be_string *node)
+{
+ bool wide =
+ static_cast<size_t> (node->width ()) > sizeof (char);
+
+ os_ << (wide ? "w" : "") << "string";
+
+ ACE_CDR::ULong const bound =
+ node->max_size ()->ev ()->u.ulval;
+
+ if (bound > 0UL)
+ {
+ os_ << "<" << bound << ">";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_executor_ex_idl::visit_provides (
+ be_provides *node)
+{
+ be_type *impl = node->provides_type ();
+
+ AST_Decl *scope = ScopeAsDecl (impl->defined_in ());
+
+ ACE_CString sname_str =
+ IdentifierHelper::orig_sn (scope->name ());
+ const char *sname = sname_str.c_str ();
+
+ const char *lname =
+ impl->original_local_name ()->get_string ();
+
+ const char *global = (sname_str == "" ? "" : "::");
+
+ os_ << be_nl
+ << global << sname << "::CCM_" << lname << " get_"
+ << node->local_name ()->get_string () << " ();";
+
+ return 0;
+}
+
+int
+be_visitor_executor_ex_idl::visit_consumes (
+ be_consumes *node)
+{
+ be_eventtype *impl = node->consumes_type ();
+
+ os_ << be_nl
+ << "void push_" << node->local_name ()->get_string ()
+ << " (in ::"
+ << IdentifierHelper::orig_sn (impl->name ()).c_str ()
+ << " e);";
+
+ return 0;
+}
+
+void
+be_visitor_executor_ex_idl::gen_supported (void)
+{
+ os_ << be_idt;
+
+ AST_Interface **supported = node_->supports ();
+
+ for (long i = 0; i < node_->n_supports (); ++i)
+ {
+ os_ << "," << be_nl
+ << "::"
+ << IdentifierHelper::orig_sn (supported[i]->name ()).c_str ();
+ }
+
+ os_ << be_uidt;
+}
+
+void
+be_visitor_executor_ex_idl::gen_exception_list (
+ UTL_ExceptList *exceptions,
+ const char *prefix,
+ bool closed)
+{
+ if (exceptions != 0 && exceptions->length () > 0)
+ {
+ os_ << be_idt_nl
+ << prefix << "raises ( ";
+
+ for (UTL_ExceptlistActiveIterator ei (exceptions);
+ !ei.is_done ();)
+ {
+ os_ << "::"
+ << IdentifierHelper::orig_sn (ei.item ()->name ()).c_str ();
+
+ ei.next ();
+
+ if (!ei.is_done () || !closed)
+ {
+ os_ << ", ";
+ }
+ }
+
+ if (closed)
+ {
+ os_ << ")" << be_uidt;
+ }
+ }
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_component/executor_exh.cpp b/TAO/TAO_IDL/be/be_visitor_component/executor_exh.cpp
new file mode 100644
index 00000000000..c0a39f30b43
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component/executor_exh.cpp
@@ -0,0 +1,171 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO_IDL_BE
+//
+// = FILENAME
+// executor_exh.cpp
+//
+// = DESCRIPTION
+// Visitor generating code in the exec impl header.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+be_visitor_executor_exh::be_visitor_executor_exh (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
+{
+ // This is initialized in the base class to svnt_export_macro()
+ // or skel_export_macro(), since there are many more visitor
+ // classes generating servant code. So we can just override
+ // all that here.
+ export_macro_ = be_global->exec_export_macro ();
+}
+
+be_visitor_executor_exh::~be_visitor_executor_exh (void)
+{
+}
+
+int
+be_visitor_executor_exh::visit_attribute (be_attribute *node)
+{
+ be_visitor_attribute v (this->ctx_);
+ return v.visit_attribute (node);
+}
+
+int
+be_visitor_executor_exh::visit_component (be_component *node)
+{
+ AST_Decl *scope = ScopeAsDecl (node->defined_in ());
+ ACE_CString sname_str (scope->full_name ());
+ const char *sname = sname_str.c_str ();
+
+ // No _cxx_ prefix.
+ const char *lname =
+ node->original_local_name ()->get_string ();
+
+ const char *global = (sname_str == "" ? "" : "::");
+
+ os_ << be_nl
+ << "class " << export_macro_.c_str () << " " << lname
+ << "_exec_i" << be_idt_nl
+ << ": public virtual " << lname << "_Exec," << be_idt_nl
+ << "public virtual ::CORBA::LocalObject"
+ << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "public:" << be_idt_nl;
+
+ os_ << lname << "_exec_i (void);";
+
+ os_ << be_nl
+ << "virtual ~" << lname << "_exec_i (void);";
+
+ os_ << be_nl << be_nl
+ << "// Supported operations and attributes.";
+
+ int status =
+ node->traverse_inheritance_graph (
+ be_interface::op_attr_decl_helper,
+ &os_,
+ false,
+ false);
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_executor_exh::")
+ ACE_TEXT ("visit_component - ")
+ ACE_TEXT ("traverse_inheritance_graph() ")
+ ACE_TEXT ("failed\n")),
+ -1);
+ }
+
+ os_ << be_nl << be_nl
+ << "// Component attributes and port operations.";
+
+ status = this->visit_component_scope (node);
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_facet_exh::")
+ ACE_TEXT ("visit_component - ")
+ ACE_TEXT ("visit_component_scope() ")
+ ACE_TEXT ("failed\n")),
+ -1);
+ }
+
+ os_ << be_nl << be_nl
+ << "// Operations from Components::SessionComponent.";
+
+ os_ << be_nl << be_nl
+ << "virtual void" << be_nl
+ << "set_session_context (" << be_idt_nl
+ << "::Components::SessionContext_ptr ctx);" << be_uidt;
+
+ os_ << be_nl << be_nl
+ << "virtual void configuration_complete (void);";
+
+ os_ << be_nl << be_nl
+ << "virtual void ccm_activate (void);" << be_nl
+ << "virtual void ccm_passivate (void);" << be_nl
+ << "virtual void ccm_remove (void);";
+
+ os_ << be_uidt_nl << be_nl
+ << "private:" << be_idt_nl
+ << global << sname << "::CCM_" << lname
+ << "_Context_var context_;"
+ << be_uidt_nl
+ << "};";
+
+ return 0;
+}
+
+int
+be_visitor_executor_exh::visit_provides (be_provides *node)
+{
+ be_type *impl = node->provides_type ();
+ const char *port_name = node->local_name ()->get_string ();
+
+ AST_Decl *scope = ScopeAsDecl (impl->defined_in ());
+ ACE_CString sname_str (scope->full_name ());
+ const char *sname = sname_str.c_str ();
+
+ // No '_cxx_' prefix.
+ const char *lname =
+ impl->original_local_name ()->get_string ();
+
+ const char *global = (sname_str == "" ? "" : "::");
+
+ os_ << be_nl << be_nl
+ << "virtual " << global << sname << "::CCM_"
+ << lname << "_ptr" << be_nl
+ << "get_" << port_name << " (void);";
+
+ return 0;
+}
+
+int
+be_visitor_executor_exh::visit_consumes (be_consumes *node)
+{
+ const char *obj_name =
+ node->consumes_type ()->full_name ();
+
+ const char *port_name =
+ node->local_name ()->get_string ();
+
+ os_ << be_nl << be_nl
+ << "virtual void" << be_nl
+ << "push_" << port_name << " (" << be_idt_nl
+ << "::" << obj_name << " * ev);" << be_uidt;
+
+ return 0;
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_component/executor_exs.cpp b/TAO/TAO_IDL/be/be_visitor_component/executor_exs.cpp
new file mode 100644
index 00000000000..ad4467628e8
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component/executor_exs.cpp
@@ -0,0 +1,240 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO_IDL_BE
+//
+// = FILENAME
+// executor_exs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code in the exec impl source.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+be_visitor_executor_exs::be_visitor_executor_exs (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx),
+ op_scope_ (0),
+ comment_border_ ("//=============================="
+ "=============================="),
+ your_code_here_ ("/* Your code here. */")
+{
+}
+
+be_visitor_executor_exs::~be_visitor_executor_exs (void)
+{
+}
+
+int
+be_visitor_executor_exs::visit_operation (be_operation *node)
+{
+ AST_Decl::NodeType nt =
+ ScopeAsDecl (node->defined_in ())->node_type ();
+
+ // Components have implied IDL operations added to the AST, but
+ // we are interested only in supported interface operations.
+ if (nt == AST_Decl::NT_component)
+ {
+ return 0;
+ }
+
+ be_visitor_operation_exs v (this->ctx_);
+ v.scope (op_scope_);
+ return v.visit_operation (node);
+}
+
+int
+be_visitor_executor_exs::visit_attribute (be_attribute *node)
+{
+ be_visitor_attribute v (this->ctx_);
+ v.op_scope (op_scope_);
+ return v.visit_attribute (node);
+}
+
+int
+be_visitor_executor_exs::visit_component (be_component *node)
+{
+ // In the interest of pretty formatting, if we have generated
+ // at least one facet executor impl class, add a linebreak.
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ AST_Decl *d = si.item ();
+
+ if (d->node_type () == AST_Decl::NT_provides)
+ {
+ os_ << be_nl;
+ break;
+ }
+ }
+
+ node_ = node;
+
+ const char *lname = node->local_name ();
+
+ os_ << be_nl
+ << comment_border_ << be_nl
+ << "// Component Executor Implementation Class: "
+ << lname << "_exec_i" << be_nl
+ << comment_border_;
+
+ os_ << be_nl << be_nl
+ << lname << "_exec_i::" << lname << "_exec_i (void)" << be_nl
+ << "{" << be_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << lname << "_exec_i::~" << lname << "_exec_i (void)" << be_nl
+ << "{" << be_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "// Supported operations and attributes.";
+
+ op_scope_ = node;
+
+ /// The overload of traverse_inheritance_graph() used here
+ /// doesn't automatically prime the queues.
+ node->get_insert_queue ().reset ();
+ node->get_del_queue ().reset ();
+ node->get_insert_queue ().enqueue_tail (node_);
+
+ Component_Exec_Op_Attr_Generator op_attr_gen (this);
+
+ int status =
+ node->traverse_inheritance_graph (op_attr_gen,
+ &os_,
+ false,
+ false);
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_executor_exs::")
+ ACE_TEXT ("visit_component - ")
+ ACE_TEXT ("traverse_inheritance_graph() ")
+ ACE_TEXT ("failed\n")),
+ -1);
+ }
+
+ os_ << be_nl << be_nl
+ << "// Component attributes and port operations.";
+
+ if (this->visit_component_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_component_exs::")
+ ACE_TEXT ("visit_component - ")
+ ACE_TEXT ("scope traversal failed\n")),
+ -1);
+ }
+
+ os_ << be_nl << be_nl
+ << "// Operations from Components::SessionComponent.";
+
+ AST_Decl *scope = ScopeAsDecl (node->defined_in ());
+ ACE_CString sname_str (scope->full_name ());
+ const char *sname = sname_str.c_str ();
+ const char *global = (sname_str == "" ? "" : "::");
+
+ os_ << be_nl << be_nl
+ << "void" << be_nl
+ << lname << "_exec_i::set_session_context (" << be_idt_nl
+ << "::Components::SessionContext_ptr ctx)" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "this->context_ =" << be_idt_nl
+ << global << sname << "::CCM_" << lname
+ << "_Context::_narrow (ctx);" << be_uidt_nl << be_nl
+ << "if ( ::CORBA::is_nil (this->context_.in ()))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::CORBA::INTERNAL ();" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "void" << be_nl
+ << lname << "_exec_i::configuration_complete (void)"
+ << be_nl
+ << "{" << be_idt_nl
+ << your_code_here_ << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "void" << be_nl
+ << lname << "_exec_i::ccm_activate (void)" << be_nl
+ << "{" << be_idt_nl
+ << your_code_here_ << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "void" << be_nl
+ << lname << "_exec_i::ccm_passivate (void)" << be_nl
+ << "{" << be_idt_nl
+ << your_code_here_ << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "void" << be_nl
+ << lname << "_exec_i::ccm_remove (void)" << be_nl
+ << "{" << be_idt_nl
+ << your_code_here_ << be_uidt_nl
+ << "}";
+
+ return 0;
+}
+
+int
+be_visitor_executor_exs::visit_provides (be_provides *node)
+{
+ be_type *obj = node->provides_type ();
+ const char *port_name = node->local_name ()->get_string ();
+
+ AST_Decl *scope = ScopeAsDecl (obj->defined_in ());
+ ACE_CString sname_str (scope->full_name ());
+ const char *sname = sname_str.c_str ();
+ const char *global = (sname_str == "" ? "" : "::");
+
+ // No '_cxx_' prefix.
+ const char *lname = obj->original_local_name ()->get_string ();
+
+ os_ << be_nl << be_nl
+ << global << sname << "::CCM_" << lname
+ << "_ptr" << be_nl
+ << node_->local_name () << "_exec_i::get_"
+ << port_name << " (void)" << be_nl
+ << "{" << be_idt_nl
+ << your_code_here_ << be_nl
+ << "return " << global << sname << "::CCM_"
+ << lname << "::_nil ();" << be_uidt_nl
+ << "}";
+
+ return 0;
+}
+
+int
+be_visitor_executor_exs::visit_consumes (be_consumes *node)
+{
+ be_eventtype *obj = node->consumes_type ();
+ const char *port_name = node->local_name ()->get_string ();
+
+ os_ << be_nl << be_nl
+ << "void" << be_nl
+ << node_->original_local_name () << "_exec_i::push_"
+ << port_name << " (" << be_idt_nl
+ << "::" << IdentifierHelper::orig_sn (obj->name (), false).c_str ()
+ << " * /* ev */)" << be_uidt_nl
+ << "{" << be_idt_nl
+ << your_code_here_ << be_uidt_nl
+ << "}";
+
+ return 0;
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_component/facet_ex_idl.cpp b/TAO/TAO_IDL/be/be_visitor_component/facet_ex_idl.cpp
new file mode 100644
index 00000000000..7bf8ebe2328
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component/facet_ex_idl.cpp
@@ -0,0 +1,60 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// facet_ex_idl.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for facets in the CIAO executor IDL.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+be_visitor_facet_ex_idl::be_visitor_facet_ex_idl (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
+{
+}
+
+be_visitor_facet_ex_idl::~be_visitor_facet_ex_idl (void)
+{
+}
+
+int
+be_visitor_facet_ex_idl::visit_provides (be_provides *node)
+{
+ be_type *impl = node->provides_type ();
+
+ if (impl->ex_idl_facet_gen ())
+ {
+ return 0;
+ }
+
+ be_util::gen_nesting_open (os_, impl);
+
+ os_ << be_nl
+ << "local interface CCM_"
+ << impl->original_local_name ()->get_string ()
+ << " : ::"
+ << IdentifierHelper::orig_sn (impl->name ()).c_str ()
+ << be_nl
+ << "{" << be_idt;
+
+ os_ << be_uidt_nl
+ << "};";
+
+ be_util::gen_nesting_close (os_, impl);
+
+ impl->ex_idl_facet_gen (true);
+
+ return 0;
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_component/facet_exh.cpp b/TAO/TAO_IDL/be/be_visitor_component/facet_exh.cpp
new file mode 100644
index 00000000000..5a38a9c7332
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component/facet_exh.cpp
@@ -0,0 +1,93 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO_IDL_BE
+//
+// = FILENAME
+// facet_exh.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for facets in the exec impl header.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+be_visitor_facet_exh::be_visitor_facet_exh (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
+{
+ // This is initialized in the base class to svnt_export_macro()
+ // or skel_export_macro(), since there are many more visitor
+ // classes generating servant code. So we can just override
+ // all that here.
+ export_macro_ = be_global->exec_export_macro ();
+}
+
+be_visitor_facet_exh::~be_visitor_facet_exh (void)
+{
+}
+
+int
+be_visitor_facet_exh::visit_provides (be_provides *node)
+{
+ be_type *impl = node->provides_type ();
+
+ // We don't want a '_cxx_' prefix here.
+ const char *lname =
+ impl->original_local_name ()->get_string ();
+
+ AST_Decl *s = ScopeAsDecl (impl->defined_in ());
+ ACE_CString sname_str =
+ IdentifierHelper::orig_sn (s->name (), false);
+ const char *sname = sname_str.c_str ();
+ const char *global = (sname_str == "" ? "" : "::");
+
+ os_ << be_nl
+ << "class " << export_macro_.c_str () << " "
+ << lname << "_exec_i" << be_idt_nl
+ << ": public virtual " << global << sname << "::CCM_"
+ << lname << "," << be_idt_nl
+ << "public virtual ::CORBA::LocalObject"
+ << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "public:" << be_idt_nl
+ << lname << "_exec_i (void);" << be_nl
+ << "virtual ~" << lname << "_exec_i (void);";
+
+ if (impl->node_type () == AST_Decl::NT_interface)
+ {
+ be_interface *intf =
+ be_interface::narrow_from_decl (impl);
+
+ os_ << be_nl << be_nl
+ << "// Operations and attributes from ::"
+ << intf->full_name ();
+
+ int status =
+ intf->traverse_inheritance_graph (
+ be_interface::op_attr_decl_helper,
+ &os_);
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_facet_exh::")
+ ACE_TEXT ("visit_provides - ")
+ ACE_TEXT ("traverse_inheritance_graph() ")
+ ACE_TEXT ("failed\n")),
+ -1);
+ }
+ }
+
+ os_ << be_uidt_nl
+ << "};" << be_nl;
+
+ return 0;
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_component/facet_exs.cpp b/TAO/TAO_IDL/be/be_visitor_component/facet_exs.cpp
new file mode 100644
index 00000000000..7e097ed3302
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component/facet_exs.cpp
@@ -0,0 +1,135 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO_IDL_BE
+//
+// = FILENAME
+// facet_exs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for facets in the exec impl source.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+be_visitor_facet_exs::be_visitor_facet_exs (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx),
+ op_scope_ (0),
+ comment_border_ ("//=============================="
+ "=============================="),
+ your_code_here_ ("/* Your code here. */")
+{
+}
+
+be_visitor_facet_exs::~be_visitor_facet_exs (void)
+{
+}
+
+int
+be_visitor_facet_exs::visit_operation (be_operation *node)
+{
+ AST_Decl::NodeType nt =
+ ScopeAsDecl (node->defined_in ())->node_type ();
+
+ // Components have implied IDL operations added to the AST, but
+ // we are interested only in supported interface operations.
+ if (nt == AST_Decl::NT_component)
+ {
+ return 0;
+ }
+
+ be_visitor_operation_exs v (this->ctx_);
+ v.scope (op_scope_);
+ return v.visit_operation (node);
+}
+
+int
+be_visitor_facet_exs::visit_attribute (be_attribute *node)
+{
+ AST_Decl::NodeType nt =
+ ScopeAsDecl (node->defined_in ())->node_type ();
+
+ // Components have implied IDL operations added to the AST, but
+ // we are interested only in supported interface operations.
+ if (nt == AST_Decl::NT_component)
+ {
+ return 0;
+ }
+
+ be_visitor_attribute v (this->ctx_);
+ v.op_scope (op_scope_);
+ return v.visit_attribute (node);
+}
+
+int
+be_visitor_facet_exs::visit_provides (be_provides *node)
+{
+ be_type *impl = node->provides_type ();
+
+ // We don't want any '_cxx_' prefix here.
+ const char *lname =
+ impl->original_local_name ()->get_string ();
+
+ os_ << be_nl
+ << comment_border_ << be_nl
+ << "// Facet Executor Implementation Class: "
+ << lname << "_exec_i" << be_nl
+ << comment_border_;
+
+ os_ << be_nl << be_nl
+ << lname << "_exec_i::" << lname
+ << "_exec_i (void)" << be_nl
+ << "{" << be_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << lname << "_exec_i::~" << lname
+ << "_exec_i (void)" << be_nl
+ << "{" << be_nl
+ << "}";
+
+ if (impl->node_type () == AST_Decl::NT_interface)
+ {
+ be_interface *intf =
+ be_interface::narrow_from_decl (impl);
+
+ op_scope_ = intf;
+
+ os_ << be_nl << be_nl
+ << "// Operations from ::" << intf->full_name ();
+
+ /// The overload of traverse_inheritance_graph() used here
+ /// doesn't automatically prime the queues.
+ intf->get_insert_queue ().reset ();
+ intf->get_del_queue ().reset ();
+ intf->get_insert_queue ().enqueue_tail (intf);
+
+ Component_Exec_Op_Attr_Generator op_attr_gen (this);
+
+ int status =
+ intf->traverse_inheritance_graph (op_attr_gen,
+ &os_,
+ false,
+ false);
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_facet_exs::")
+ ACE_TEXT ("visit_provides - ")
+ ACE_TEXT ("traverse_inheritance_graph() ")
+ ACE_TEXT ("failed\n")),
+ -1);
+ }
+ }
+
+ return 0;
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_component/facet_svh.cpp b/TAO/TAO_IDL/be/be_visitor_component/facet_svh.cpp
new file mode 100644
index 00000000000..f101db9a78b
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component/facet_svh.cpp
@@ -0,0 +1,46 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// facet_svh.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for a facet servant class in the
+// servant header.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+be_visitor_facet_svh::be_visitor_facet_svh (be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
+{
+}
+
+be_visitor_facet_svh::~be_visitor_facet_svh (void)
+{
+}
+
+int
+be_visitor_facet_svh::visit_provides (be_provides *node)
+{
+ if (node->gen_facet_svnt_decl (os_) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_facet_svh")
+ ACE_TEXT ("::visit_provides - ")
+ ACE_TEXT ("gen_facet_svnt_decl() ")
+ ACE_TEXT ("failed\n")),
+ -1);
+ }
+
+ return 0;
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_component/facet_svs.cpp b/TAO/TAO_IDL/be/be_visitor_component/facet_svs.cpp
new file mode 100644
index 00000000000..9df81807a4f
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component/facet_svs.cpp
@@ -0,0 +1,46 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// facet_svs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for a facet servant class in the
+// servant source.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+be_visitor_facet_svs::be_visitor_facet_svs (be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
+{
+}
+
+be_visitor_facet_svs::~be_visitor_facet_svs (void)
+{
+}
+
+int
+be_visitor_facet_svs::visit_provides (be_provides *node)
+{
+ if (node->gen_facet_svnt_defn (os_) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_facet_svs")
+ ACE_TEXT ("::visit_provides - ")
+ ACE_TEXT ("gen_facet_svnt_defn() ")
+ ACE_TEXT ("failed\n")),
+ -1);
+ }
+
+ return 0;
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_component/servant_svh.cpp b/TAO/TAO_IDL/be/be_visitor_component/servant_svh.cpp
new file mode 100644
index 00000000000..16a87f76e1e
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component/servant_svh.cpp
@@ -0,0 +1,411 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// servant_svh.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for a servant class in the
+// servant header.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+be_visitor_servant_svh::be_visitor_servant_svh (be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
+{
+}
+
+be_visitor_servant_svh::~be_visitor_servant_svh (void)
+{
+}
+
+int
+be_visitor_servant_svh::visit_component (be_component *node)
+{
+ node_ = node;
+
+ AST_Decl *scope = ScopeAsDecl (node_->defined_in ());
+ ACE_CString sname_str (scope->full_name ());
+ const char *sname = sname_str.c_str ();
+
+ // No '_cxx_' prefix.
+ const char *lname =
+ node_->original_local_name ()->get_string ();
+
+ const char *global = (sname_str == "" ? "" : "::");
+
+ os_ << be_nl << be_nl
+ << "class " << export_macro_.c_str () << " " << lname
+ << "_Servant" << be_idt_nl
+ << ": public virtual" << be_idt << be_idt_nl
+ << "::CIAO::Servant_Impl<" << be_idt_nl
+ << "::" << node_->full_skel_name () << "," << be_nl
+ << global << sname << "::CCM_" << lname << "," << be_nl
+ << lname << "_Context>"
+ << be_uidt << be_uidt << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "public:" << be_idt_nl;
+
+ os_ << "typedef " << global << sname << "::CCM_" << lname
+ << " _exec_type;" << be_nl;
+
+ os_ << be_nl
+ << lname << "_Servant (" << be_idt_nl
+ << global << sname << "::CCM_"
+ << lname << "_ptr executor," << be_nl
+ << "::Components::CCMHome_ptr h," << be_nl
+ << "const char * ins_name," << be_nl
+ << "::CIAO::Home_Servant_Impl_Base *hs," << be_nl
+ << "::CIAO::Container_ptr c);" << be_uidt_nl;
+
+ os_ << be_nl
+ << "virtual ~" << lname << "_Servant"
+ << " (void);" << be_nl;
+
+ os_ << be_nl
+ << "virtual void" << be_nl
+ << "set_attributes (const "
+ << "::Components::ConfigValues & descr);"
+ << be_nl;
+
+ os_ << be_nl
+ << "// Supported operations and attributes.";
+
+ int status =
+ node_->traverse_inheritance_graph (
+ be_interface::op_attr_decl_helper,
+ &os_,
+ false,
+ false);
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_servant_svh::"
+ "visit_component - "
+ "inheritance graph traversal failed\n"),
+ -1);
+ }
+
+ status = this->visit_component_scope (node);
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_servant_svh::"
+ "visit_component - "
+ "visit_component_scope() failed\n"),
+ -1);
+ }
+
+ this->gen_non_type_specific ();
+
+ os_ << be_uidt_nl
+ << "};";
+
+ return 0;
+}
+
+int
+be_visitor_servant_svh::visit_attribute (be_attribute *node)
+{
+ be_visitor_attribute v (this->ctx_);
+ return v.visit_attribute (node);
+}
+
+int
+be_visitor_servant_svh::visit_provides (be_provides *node)
+{
+ const char *obj_name = node->provides_type ()->full_name ();
+ const char *port_name = node->local_name ()->get_string ();
+
+ os_ << be_uidt_nl << be_nl
+ << "public:" << be_idt_nl
+ << "virtual ::" << obj_name << "_ptr" << be_nl
+ << "provide_" << port_name << " (void);"
+ << be_uidt_nl << be_nl;
+
+ os_ << "private:" << be_idt_nl
+ << "::CORBA::Object_ptr" << be_nl
+ << "provide_" << port_name << "_i (void);"
+ << be_uidt_nl << be_nl;
+
+ os_ << "private:" << be_idt_nl
+ << "::" << obj_name << "_var" << be_nl
+ << "provide_" << port_name << "_;";
+
+ return 0;
+}
+
+int
+be_visitor_servant_svh::visit_uses (be_uses *node)
+{
+ const char *obj_name = node->uses_type ()->full_name ();
+ const char *port_name = node->local_name ()->get_string ();
+ bool is_multiple = node->is_multiple ();
+
+ os_ << be_uidt_nl << be_nl
+ << "public:" << be_idt_nl
+ << "virtual ";
+
+ if (is_multiple)
+ {
+ os_ << "::" << node_->full_name () << "::"
+ << port_name << "Connections *" << be_nl
+ << "get_connections_" << port_name << " (void);";
+ }
+ else
+ {
+ os_ << "::" << obj_name << "_ptr" << be_nl
+ << "get_connection_" << port_name << " (void);";
+ }
+
+ os_ << be_nl << be_nl
+ << "virtual "
+ << (is_multiple ? "::Components::Cookie *" : "void")
+ << be_nl
+ << "connect_" << port_name << " (" << be_idt_nl
+ << "::" << obj_name << "_ptr);"
+ << be_uidt_nl << be_nl;
+
+ os_ << "virtual ::" << obj_name << "_ptr" << be_nl
+ << "disconnect_" << port_name << " (";
+
+ if (is_multiple)
+ {
+ os_ << be_idt_nl
+ << "::Components::Cookie * ck);" << be_uidt;
+ }
+ else
+ {
+ os_ << "void);";
+ }
+
+ return 0;
+}
+
+int
+be_visitor_servant_svh::visit_publishes (be_publishes *node)
+{
+ const char *obj_name = node->publishes_type ()->full_name ();
+ const char *port_name = node->local_name ()->get_string ();
+
+ os_ << be_uidt_nl << be_nl
+ << "public:" << be_idt_nl;
+
+ os_ << "virtual ::Components::Cookie *" << be_nl
+ << "subscribe_" << port_name << " (" << be_idt_nl
+ << "::" << obj_name << "Consumer_ptr c);" << be_uidt_nl;
+
+ os_ << be_nl
+ << "// CIAO-specific." << be_nl
+ << "::Components::Cookie *" << be_nl
+ << "subscribe_" << port_name << "_generic (" << be_idt_nl
+ << "::Components::EventConsumerBase_ptr c);" << be_uidt_nl;
+
+ os_ << be_nl
+ << "virtual ::" << obj_name << "Consumer_ptr" << be_nl
+ << "unsubscribe_" << port_name << " (" << be_idt_nl
+ << "::Components::Cookie * ck);" << be_uidt;
+
+ return 0;
+}
+
+int
+be_visitor_servant_svh::visit_emits (be_emits *node)
+{
+ const char *obj_name = node->emits_type ()->full_name ();
+ const char *port_name = node->local_name ()->get_string ();
+
+ os_ << be_nl << be_nl
+ << "virtual void" << be_nl
+ << "connect_" << port_name << " (" << be_idt_nl
+ << "::" << obj_name << "Consumer_ptr c);" << be_uidt;
+
+ os_ << be_nl << be_nl
+ << "virtual ::" << obj_name << "Consumer_ptr" << be_nl
+ << "disconnect_" << port_name << " (void);";
+
+ return 0;
+}
+
+int
+be_visitor_servant_svh::visit_consumes (be_consumes *node)
+{
+ const char *obj_name = node->consumes_type ()->full_name ();
+ const char *port_name = node->local_name ()->get_string ();
+
+ ACE_CString holder (obj_name);
+ ACE_CString::size_type pos = holder.rfind (':');
+ const char *ev_lname = 0;
+
+ if (pos == ACE_CString::npos)
+ {
+ ev_lname = obj_name;
+ }
+ else
+ {
+ holder = holder.substr (pos + 1);
+ ev_lname = holder.c_str ();
+ }
+
+ os_ << be_uidt_nl << be_nl
+ << "public:" << be_idt_nl;
+
+ os_ << "// Servant class for the " << port_name
+ << " consumer." << be_nl
+ << "class " << export_macro_.c_str () << " " << ev_lname
+ << "Consumer_" << port_name << "_Servant" << be_idt_nl
+ << ": public virtual ::POA_" << obj_name << "Consumer"
+ << be_uidt_nl
+ << "{" << be_nl
+ << "public:" << be_idt_nl;
+
+ ACE_CString sname_str (
+ ScopeAsDecl (node_->defined_in ())->full_name ());
+ const char *sname = sname_str.c_str ();
+ const char *lname = node_->local_name ();
+ const char *global = (sname_str == "" ? "" : "::");
+
+ os_ << ev_lname << "Consumer_" << port_name
+ << "_Servant (" << be_idt_nl
+ << global << sname << "::CCM_" << lname
+ << "_ptr executor," << be_nl
+ << global << sname << "::CCM_" << lname
+ << "_Context_ptr c);" << be_uidt_nl << be_nl;
+
+ os_ << "virtual ~" << ev_lname << "Consumer_" << port_name
+ << "_Servant (void);";
+
+ os_ << be_nl << be_nl
+ << "virtual void" << be_nl
+ << "push_" << ev_lname << " (" << be_idt_nl
+ << "::" << obj_name << " * evt);" << be_uidt;
+
+ os_ << be_nl << be_nl
+ << "// Inherited from ::Components::EventConsumerBase." << be_nl
+ << "virtual void" << be_nl
+ << "push_event ( ::Components::EventBase * ev);";
+
+ os_ << be_nl << be_nl
+ << "// CIAO-specific in ::Components::EventConsumerBase." << be_nl
+ << "virtual void" << be_nl
+ << "ciao_push_event ( ::Components::EventBase * ev," << be_nl
+ << " const char * source_id," << be_nl
+ << " ::CORBA::TypeCode_ptr tc);";
+
+ os_ << be_nl << be_nl
+ << "// CIAO-specific in ::Components::EventConsumerBase." << be_nl
+ << "virtual ::CORBA::Boolean" << be_nl
+ << "ciao_is_substitutable (const char * event_repo_id);";
+
+ os_ << be_nl << be_nl
+ << "// Get component implementation." << be_nl
+ << "virtual ::CORBA::Object_ptr" << be_nl
+ << "_get_component (void);";
+
+ os_ << be_uidt_nl << be_nl
+ << "protected:" << be_idt_nl;
+
+ os_ << global << sname << "::CCM_" << lname << "_var" << be_nl
+ << "executor_;";
+
+ os_ << be_nl << be_nl
+ << global << sname << "::CCM_"
+ << lname << "_Context_var" << be_nl
+ << "ctx_;";
+
+ os_ << be_uidt_nl
+ << "};";
+
+ os_ << be_nl << be_nl
+ << "virtual ::" << obj_name << "Consumer_ptr" << be_nl
+ << "get_consumer_" << port_name << " (void);";
+
+ os_ << be_uidt_nl << be_nl
+ << "private:" << be_idt_nl;
+
+ os_ << "::Components::EventConsumerBase_ptr" << be_nl
+ << "get_consumer_" << port_name << "_i (void);";
+
+ os_ << be_uidt_nl << be_nl
+ << "private:" << be_idt_nl;
+
+ os_ << "::" << obj_name << "Consumer_var" << be_nl
+ << "consumes_" << port_name << "_;";
+
+ return 0;
+}
+
+void
+be_visitor_servant_svh::gen_non_type_specific (void)
+{
+ os_ << be_nl << be_nl
+ << "// Base class overrides.";
+
+ os_ << be_uidt_nl << be_nl
+ << "public:" << be_idt_nl
+ << "virtual ::Components::Cookie *" << be_nl
+ << "connect (const char * name," << be_nl
+ << " ::CORBA::Object_ptr connection);";
+
+ os_ << be_nl << be_nl
+ << "virtual ::CORBA::Object_ptr" << be_nl
+ << "disconnect (const char * name," << be_nl
+ << " ::Components::Cookie * ck);";
+
+ os_ << be_nl << be_nl
+ << "virtual ::Components::ReceptacleDescriptions *" << be_nl
+ << "get_all_receptacles (void);";
+
+ os_ << be_nl << be_nl
+ << "virtual ::Components::Cookie *" << be_nl
+ << "subscribe (const char * publisher_name," << be_nl
+ << " ::Components::EventConsumerBase_ptr subscriber);";
+
+ os_ << be_nl << be_nl
+ << "virtual ::Components::EventConsumerBase_ptr" << be_nl
+ << "unsubscribe (const char * publisher_name," << be_nl
+ << " ::Components::Cookie * ck);";
+
+ os_ << be_nl << be_nl
+ << "virtual void" << be_nl
+ << "connect_consumer (const char * emitter_name," << be_nl
+ << " ::Components::EventConsumerBase_ptr consumer);";
+
+ os_ << be_nl << be_nl
+ << "virtual ::Components::EventConsumerBase_ptr" << be_nl
+ << "disconnect_consumer (const char * source_name);";
+
+ os_ << be_nl << be_nl
+ << "virtual ::Components::PublisherDescriptions *" << be_nl
+ << "get_all_publishers (void);";
+
+ os_ << be_nl << be_nl
+ << "virtual ::Components::EmitterDescriptions *" << be_nl
+ << "get_all_emitters (void);";
+
+ os_ << be_nl << be_nl
+ << "// CIAO-specific." << be_nl
+ << "::CORBA::Object_ptr" << be_nl
+ << "get_facet_executor (const char * name);";
+
+ os_ << be_uidt_nl << be_nl
+ << "private:" << be_idt_nl
+ << "void" << be_nl
+ << "populate_port_tables (void);";
+
+ os_ << be_uidt_nl << be_nl
+ << "private:" << be_idt_nl
+ << "const char * ins_name_;";
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_component/servant_svs.cpp b/TAO/TAO_IDL/be/be_visitor_component/servant_svs.cpp
new file mode 100644
index 00000000000..a0d07860624
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component/servant_svs.cpp
@@ -0,0 +1,1745 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// servant_svs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for a servant class in the
+// servant source file.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+be_visitor_servant_svs::be_visitor_servant_svs (be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx),
+ op_scope_ (0),
+ n_provides_ (0UL),
+ n_uses_ (0UL),
+ n_publishes_ (0UL),
+ n_emits_ (0UL),
+ n_consumes_ (0UL)
+{
+}
+
+be_visitor_servant_svs::~be_visitor_servant_svs (void)
+{
+}
+
+int
+be_visitor_servant_svs::visit_component (be_component *node)
+{
+ node_ = node;
+
+ n_provides_ = 0UL;
+ n_uses_ = 0UL;
+ n_publishes_ = 0UL;
+ n_emits_ = 0UL;
+ n_consumes_ = 0UL;
+
+ this->compute_slots (node_);
+
+ AST_Decl *scope = ScopeAsDecl (node_->defined_in ());
+ ACE_CString sname_str (scope->full_name ());
+ const char *sname = sname_str.c_str ();
+ const char *lname = node->local_name ();
+ const char *global = (sname_str == "" ? "" : "::");
+
+ os_ << be_nl << be_nl
+ << lname << "_Servant::"
+ << lname << "_Servant (" << be_idt << be_idt_nl
+ << global << sname << "::CCM_" << lname
+ << "_ptr exe," << be_nl
+ << "::Components::CCMHome_ptr h," << be_nl
+ << "const char * ins_name," << be_nl
+ << "::CIAO::Home_Servant_Impl_Base * hs,"
+ << be_nl
+ << "::CIAO::Container_ptr c)" << be_uidt_nl
+ << ": ::CIAO::Servant_Impl_Base (h, hs, c),"
+ << be_idt_nl
+ << "::CIAO::Servant_Impl<" << be_idt_nl
+ << "::" << node_->full_skel_name ()
+ << "," << be_nl
+ << global << sname << "::CCM_"
+ << lname << "," << be_nl
+ << lname << "_Context> (exe, h, hs, c)," << be_uidt_nl
+ << "ins_name_ (ins_name)" << be_uidt << be_uidt_nl
+ << "{" << be_idt_nl
+ << "ACE_NEW (this->context_," << be_nl
+ << " " << lname << "_Context (h, c, this));"
+ << be_nl << be_nl
+ << "/// Set the instance id of the component on the context."
+ << be_nl
+ << "this->context_->_ciao_instance_id (this->ins_name_);";
+
+ be_visitor_obv_factory_reg ofr_visitor (this->ctx_);
+
+ if (ofr_visitor.visit_component_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_component_svs::"
+ "visit_component - "
+ "OBV factory registration failed\n"),
+ -1);
+ }
+
+ os_ << be_nl << be_nl
+ << "try" << be_idt_nl
+ << "{" << be_idt_nl
+ << "::Components::SessionComponent_var scom =" << be_idt_nl
+ << "::Components::SessionComponent::_narrow (exe);"
+ << be_uidt_nl << be_nl
+ << "if (! ::CORBA::is_nil (scom.in ()))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "scom->set_session_context (this->context_);" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "this->populate_port_tables ();" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "catch (const ::CORBA::Exception &)" << be_idt_nl
+ << "{" << be_nl
+ << "}" << be_uidt << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << lname << "_Servant::~"
+ << lname << "_Servant (void)" << be_nl
+ << "{" << be_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "void" << be_nl
+ << lname << "_Servant::set_attributes (" << be_idt_nl
+ << "const ::Components::ConfigValues & descr)" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ if (swapping_)
+ {
+ os_ << "this->activate_component ();" << be_nl << be_nl;
+ }
+
+ os_ << "for ( ::CORBA::ULong i = 0; i < descr.length (); ++i)"
+ << be_idt_nl
+ << "{" << be_idt_nl
+ << "const char * descr_name = descr[i]->name ();" << be_nl
+ << "::CORBA::Any & descr_value = descr[i]->value ();";
+
+ be_visitor_attr_set as_visitor (this->ctx_);
+
+ if (as_visitor.visit_component_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_component_svs::"
+ "visit_component - "
+ "attr init visitor failed\n"),
+ -1);
+ }
+
+ os_ << be_nl << be_nl
+ << "ACE_UNUSED_ARG (descr_name);" << be_nl
+ << "ACE_UNUSED_ARG (descr_value);" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "/// Supported operations and attributes.";
+
+ this->op_scope_ = node;
+
+ /// The overload of traverse_inheritance_graph() used here
+ /// doesn't automatically prime the queues.
+ node_->get_insert_queue ().reset ();
+ node_->get_del_queue ().reset ();
+ node_->get_insert_queue ().enqueue_tail (node);
+
+ Component_Op_Attr_Generator op_attr_gen (this);
+
+ int status =
+ node->traverse_inheritance_graph (op_attr_gen,
+ &os_,
+ false,
+ false);
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_component_svs::"
+ "visit_component - "
+ "inheritance graph traversal failed\n"),
+ -1);
+ }
+
+ os_ << be_nl << be_nl
+ << "/// All ports and component attributes.";
+
+ // Port operations that require scope traversal to get all the
+ // possible string name matches.
+ this->gen_provides_top ();
+ this->gen_uses_top ();
+ this->gen_publishes_top ();
+ this->gen_emits_top ();
+
+ // This call will generate all other operations and attributes,
+ // including inherited ones.
+ if (this->visit_component_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_component_svs::"
+ "visit_component - "
+ "visit_component_scope() failed\n"),
+ -1);
+ }
+
+ os_ << be_nl << be_nl
+ << "/// Private method to trigger population of the port"
+ << be_nl
+ << "/// tables (facets and event consumers)." << be_nl
+ << "void" << be_nl
+ << node_->local_name ()
+ << "_Servant::populate_port_tables (void)" << be_nl
+ << "{" << be_idt_nl
+ << "::CORBA::Object_var obj_var;" << be_nl
+ << "::Components::EventConsumerBase_var ecb_var;"
+ << be_nl;
+
+ be_visitor_populate_port_tables ppt_visitor (this->ctx_);
+
+ if (ppt_visitor.visit_component_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_component_svs::"
+ "visit_component - "
+ "populate port tables visitor failed\n"),
+ -1);
+ }
+
+ os_ << be_uidt_nl
+ << "}";
+
+ return 0;
+}
+
+int
+be_visitor_servant_svs::visit_operation (be_operation *node)
+{
+ AST_Decl::NodeType nt =
+ ScopeAsDecl (node->defined_in ())->node_type ();
+
+ // Components have implied IDL operations added to the AST, but
+ // we are interested only in supported interface operations.
+ if (nt == AST_Decl::NT_component)
+ {
+ return 0;
+ }
+
+ be_visitor_operation_svs v (this->ctx_);
+ v.scope (this->op_scope_);
+
+ return v.visit_operation (node);
+}
+
+int
+be_visitor_servant_svs::visit_attribute (be_attribute *node)
+{
+ be_visitor_attribute v (this->ctx_);
+
+ v.for_facets (false);
+ v.op_scope (this->op_scope_);
+
+ return v.visit_attribute (node);
+}
+
+int
+be_visitor_servant_svs::visit_provides (be_provides *node)
+{
+ AST_Type *obj = node->provides_type ();
+ const char *obj_name = obj->full_name ();
+ const char *port_name = node->local_name ()->get_string ();
+ AST_Decl *scope = ScopeAsDecl (obj->defined_in ());
+ ACE_CString sname_str (scope->full_name ());
+ const char *sname = sname_str.c_str ();
+
+ // Avoid '_cxx_' prefix.
+ const char *lname =
+ obj->original_local_name ()->get_string ();
+
+ const char *global = (sname_str == "" ? "" : "::");
+ const char *prefix_connector = (sname_str == "" ? "" : "_");
+
+ os_ << be_nl << be_nl
+ << "::" << obj_name << "_ptr" << be_nl
+ << node_->local_name () << "_Servant::provide_"
+ << port_name << " (void)" << be_nl
+ << "{" << be_idt_nl;
+
+ if (swapping_)
+ {
+ os_ << "this->activate_component ();" << be_nl << be_nl;
+ }
+
+ os_ << "if ( ::CORBA::is_nil (this->provide_"
+ << port_name << "_.in ()))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "::CORBA::Object_var obj =" << be_idt_nl
+ << "this->provide_" << port_name << "_i ();"
+ << be_uidt_nl << be_nl
+ << "::" << obj_name << "_var fo =" << be_idt_nl
+ << "::" << obj_name << "::_narrow (obj.in ());"
+ << be_uidt_nl << be_nl
+ << "this->provide_" << port_name << "_ = fo;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "return" << be_idt_nl
+ << "::" << obj_name << "::_duplicate (this->provide_"
+ << port_name << "_.in ());" << be_uidt << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "::CORBA::Object_ptr" << be_nl
+ << node_->local_name () << "_Servant::provide_"
+ << port_name << "_i (void)" << be_nl
+ << "{" << be_idt_nl
+ << "::CORBA::Object_ptr ret =" << be_idt_nl
+ << "this->lookup_facet (\"" << port_name << "\");"
+ << be_uidt_nl << be_nl
+ << "if (! ::CORBA::is_nil (ret))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return ret;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "typedef" << be_idt_nl
+ << "::CIAO::Port_Activator_T<" << be_idt_nl
+ << "::CIAO_FACET" << prefix_connector
+ << scope->flat_name () << "::" << lname
+ << "_Servant," << be_nl
+ << global << sname << "::CCM_" << lname << "," << be_nl
+ << "::Components::CCMContext," << be_nl
+ << node_->local_name () << "_Servant>" << be_uidt_nl
+ << "MACRO_MADNESS_TYPEDEF;" << be_uidt_nl << be_nl
+ << "MACRO_MADNESS_TYPEDEF * tmp = 0;" << be_nl
+ << "ACE_CString obj_id (this->ins_name_);" << be_nl
+ << "obj_id += \"_" << port_name << "\";" << be_nl << be_nl
+ << "ACE_NEW_THROW_EX (" << be_idt_nl
+ << "tmp," << be_nl
+ << "MACRO_MADNESS_TYPEDEF (" << be_idt_nl
+ << "obj_id.c_str ()," << be_nl
+ << "\"" << port_name << "\"," << be_nl
+ << "::CIAO::Port_Activator_Types::FACET," << be_nl
+ << "0," << be_nl
+ << "this->context_," << be_nl
+ << "this)," << be_uidt_nl
+ << "::CORBA::NO_MEMORY ());" << be_uidt_nl << be_nl
+ << "::CIAO::Port_Activator_var pa = tmp;" << be_nl << be_nl
+ << "::CIAO::Servant_Activator_var sa =" << be_idt_nl
+ << "this->container_->ports_servant_activator ();"
+ << be_uidt_nl << be_nl
+ << "if (! sa->register_port_activator (pa._retn ()))"
+ << be_idt_nl
+ << "{" << be_idt_nl
+ << "return ::" << obj_name << "::_nil ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "::CORBA::Object_var obj =" << be_idt_nl
+ << "this->container_->generate_reference (" << be_idt_nl
+ << "obj_id.c_str ()," << be_nl
+ << "\"" << obj->repoID () << "\"," << be_nl
+ << "::CIAO::Container_Types::FACET_CONSUMER_t);"
+ << be_uidt_nl << be_uidt_nl
+ << "this->add_facet (\"" << port_name << "\", obj.in ());"
+ << be_nl << be_nl
+ << "return obj._retn ();" << be_uidt_nl
+ << "}";
+
+ return 0;
+}
+
+int
+be_visitor_servant_svs::visit_uses (be_uses *node)
+{
+ const char *obj_name = node->uses_type ()->full_name ();
+ const char *port_name = node->local_name ()->get_string ();
+ bool is_multiple = node->is_multiple ();
+
+ os_ << be_nl << be_nl
+ << (is_multiple ? "::Components::Cookie *" : "void")
+ << be_nl
+ << node_->local_name () << "_Servant::connect_"
+ << port_name << " (" << be_idt_nl
+ << "::" << obj_name << "_ptr c)" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ if (is_multiple)
+ {
+ os_ << "::Components::Cookie * cookie =" << be_idt_nl;
+ }
+
+ os_ << "this->context_->connect_" << port_name
+ << " (c);" << be_nl;
+
+ if (is_multiple)
+ {
+ os_ << be_uidt_nl;
+ }
+
+ os_ << "this->add_receptacle (\"" << port_name
+ << "\", c, " << (is_multiple ? "cookie" : "0")
+ << ");";
+
+ if (is_multiple)
+ {
+ os_ << be_nl << be_nl
+ << "return cookie;";
+ }
+
+ os_ << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "::" << obj_name << "_ptr" << be_nl
+ << node_->local_name () << "_Servant::disconnect_"
+ << port_name << " (";
+
+ if (is_multiple)
+ {
+ os_ << be_idt_nl
+ << "::Components::Cookie * ck" << be_uidt;
+ }
+ else
+ {
+ os_ << "void";
+ }
+
+ os_ << ")" << be_nl
+ << "{" << be_idt_nl
+ << "return this->context_->disconnect_"
+ << port_name << " (" << (is_multiple ? "ck" : "")
+ << ");" << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "::";
+
+ if (is_multiple)
+ {
+ os_ << node_->full_name () << "::" << port_name
+ << "Connections *";
+ }
+ else
+ {
+ os_ << obj_name << "_ptr";
+ }
+
+ os_ << be_nl
+ << node_->local_name () << "_Servant::get_connection"
+ << (is_multiple ? "s" : "") << "_"
+ << port_name << " (void)" << be_nl
+ << "{" << be_idt_nl
+ << "return this->context_->get_connection"
+ << (is_multiple ? "s" : "") << "_"
+ << port_name << " ();" << be_uidt_nl
+ << "}";
+
+ return 0;
+}
+
+int
+be_visitor_servant_svs::visit_publishes (be_publishes *node)
+{
+ const char *obj_name = node->publishes_type ()->full_name ();
+ const char *port_name = node->local_name ()->get_string ();
+
+ os_ << be_nl << be_nl
+ << "::Components::Cookie *" << be_nl
+ << node_->local_name () << "_Servant::subscribe_"
+ << port_name << " (" << be_idt_nl
+ << "::" << obj_name << "Consumer_ptr c)" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ if (swapping_)
+ {
+ os_ << "this->activate_component ();" << be_nl;
+ }
+
+ os_ << "return this->context_->subscribe_" << port_name
+ << " (c);" << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "::Components::Cookie *" << be_nl
+ << node_->local_name () << "_Servant::subscribe_"
+ << port_name << "_generic (" << be_idt_nl
+ << "::Components::EventConsumerBase_ptr c)" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ if (swapping_)
+ {
+ os_ << "this->activate_component ();" << be_nl;
+ }
+
+ os_ << "return this->context_->subscribe_" << port_name
+ << "_generic (c);" << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "::" << obj_name << "Consumer_ptr" << be_nl
+ << node_->local_name () << "_Servant::unsubscribe_"
+ << port_name << " (" << be_idt_nl
+ << "::Components::Cookie * ck)" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ if (swapping_)
+ {
+ os_ << "this->activate_component ();" << be_nl;
+ }
+
+ os_ << "return this->context_->unsubscribe_" << port_name
+ << " (ck);" << be_uidt_nl
+ << "}";
+
+ return 0;
+}
+
+int
+be_visitor_servant_svs::visit_emits (be_emits *node)
+{
+ const char *obj_name = node->emits_type ()->full_name ();
+ const char *port_name = node->local_name ()->get_string ();
+
+ os_ << be_nl << be_nl
+ << "void" << be_nl
+ << node_->local_name () << "_Servant::connect_"
+ << port_name << " (" << be_idt_nl
+ << "::" << obj_name << "Consumer_ptr c)" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "this->context_->connect_" << port_name
+ << " (c);" << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "::" << obj_name << "Consumer_ptr" << be_nl
+ << node_->local_name () << "_Servant::disconnect_"
+ << port_name << " (void)" << be_nl
+ << "{" << be_idt_nl
+ << "return this->context_->disconnect_"
+ << port_name << " ();" << be_uidt_nl
+ << "}";
+
+ return 0;
+}
+
+int
+be_visitor_servant_svs::visit_consumes (be_consumes *node)
+{
+ AST_Type *obj = node->consumes_type ();
+ const char *port_name = node->local_name ()->get_string ();
+
+ const char *comp_lname = node_->local_name ();
+ ACE_CString comp_sname_str (
+ ScopeAsDecl (node_->defined_in ())->full_name ());
+ const char *comp_sname = comp_sname_str.c_str ();
+ const char *global = (comp_sname_str == "" ? "" : "::");
+
+ const char *lname = obj->local_name ()->get_string ();
+ const char *fname = obj->full_name ();
+
+ os_ << be_nl << be_nl
+ << comp_lname << "_Servant::" << lname << "Consumer_"
+ << port_name << "_Servant::" << lname << "Consumer_"
+ << port_name << "_Servant (" << be_idt << be_idt_nl
+ << global << comp_sname << "::CCM_" << comp_lname
+ << "_ptr executor," << be_nl
+ << global << comp_sname << "::CCM_" << comp_lname
+ << "_Context_ptr c)" << be_uidt_nl
+ << ": executor_ ( " << global << comp_sname << "::CCM_"
+ << comp_lname << "::_duplicate (executor))," << be_idt_nl
+ << "ctx_ ( " << global << comp_sname
+ << "::CCM_" << comp_lname
+ << "_Context::_duplicate (c))" << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << comp_lname << "_Servant::" << lname << "Consumer_"
+ << port_name << "_Servant::~" << lname << "Consumer_"
+ << port_name << "_Servant (void)" << be_nl
+ << "{" << be_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "::CORBA::Object_ptr" << be_nl
+ << comp_lname << "_Servant::" << lname << "Consumer_"
+ << port_name << "_Servant::_get_component (void)" << be_nl
+ << "{" << be_idt_nl
+ << "return this->ctx_->get_CCM_object ();" << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "void" << be_nl
+ << comp_lname << "_Servant::" << lname << "Consumer_"
+ << port_name << "_Servant::push_" << lname
+ << " (" << be_idt_nl
+ << "::" << fname << " * evt)" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "this->executor_->push_" << port_name
+ << " (evt);" << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "/// Inherited from ::Components::EventConsumerBase."
+ << be_nl
+ << "void" << be_nl
+ << comp_lname << "_Servant::" << lname << "Consumer_"
+ << port_name << "_Servant::push_event (" << be_idt_nl
+ << "::Components::EventBase * ev)" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "::" << fname << " * ev_type =" << be_idt_nl
+ << "::" << fname << "::_downcast (ev);"
+ << be_uidt_nl << be_nl
+ << "if (ev_type != 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "this->push_" << lname << " (ev_type);" << be_nl
+ << "return;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "throw ::Components::BadEventType ();" << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "/// CIAO-specific."
+ << be_nl
+ << "void" << be_nl
+ << comp_lname << "_Servant::" << lname << "Consumer_"
+ << port_name << "_Servant::ciao_push_event (" << be_idt_nl
+ << "::Components::EventBase * ev," << be_nl
+ << "const char * /* source_id */," << be_nl
+ << "::CORBA::TypeCode_ptr /* tc */)" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "this->push_event (ev);" << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "/// CIAO-specific."
+ << be_nl
+ << "::CORBA::Boolean" << be_nl
+ << comp_lname << "_Servant::" << lname << "Consumer_"
+ << port_name << "_Servant::ciao_is_substitutable ("
+ << be_idt_nl
+ << "const char * event_repo_id)" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "if (event_repo_id == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::CORBA::BAD_PARAM ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "CORBA::ORB_ptr orb = TAO_ORB_Core_instance ()->orb ();"
+ << be_nl << be_nl
+ << "CORBA::ValueFactory f =" << be_idt_nl
+ << "orb->lookup_value_factory (event_repo_id);"
+ << be_uidt_nl << be_nl
+ << "if (f == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return false;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "CORBA::ValueBase_var v = f->create_for_unmarshal ();"
+ << be_nl
+ << "f->_remove_ref ();" << be_nl << be_nl
+ << "if (v.in () == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return false;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "return dynamic_cast< ::" << fname
+ << " *> (v.in ()) != 0;" << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "::" << fname << "Consumer_ptr" << be_nl
+ << node_->local_name () << "_Servant::get_consumer_"
+ << port_name << " (void)" << be_nl
+ << "{" << be_idt_nl
+ << "if (! ::CORBA::is_nil (this->consumes_" << port_name
+ << "_.in ()))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return ::" << fname
+ << "Consumer::_duplicate (this->consumes_"
+ << port_name << "_.in ());" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "::Components::EventConsumerBase_var obj =" << be_idt_nl
+ << "this->get_consumer_" << port_name << "_i ();"
+ << be_uidt_nl << be_nl
+ << "::" << fname << "Consumer_var eco =" << be_idt_nl
+ << "::" << fname << "Consumer::_narrow (obj.in ());"
+ << be_uidt_nl << be_nl
+ << "this->consumes_" << port_name << "_ = eco;" << be_nl
+ << "return" << be_idt_nl
+ << "::" << fname << "Consumer::_duplicate (" << be_idt_nl
+ << "this->consumes_" << port_name << "_.in ());"
+ << be_uidt << be_uidt << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "::Components::EventConsumerBase_ptr" << be_nl
+ << node_->local_name () << "_Servant::get_consumer_"
+ << port_name << "_i (void)" << be_nl
+ << "{" << be_idt_nl
+ << "::Components::EventConsumerBase_ptr ret =" << be_idt_nl
+ << "this->lookup_consumer (\"" << port_name << "\");"
+ << be_uidt_nl << be_nl
+ << "if (! ::CORBA::is_nil (ret))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return ret;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "typedef" << be_idt_nl
+ << "::CIAO::Port_Activator_T<" << be_idt_nl
+ << node_->local_name () << "_Servant::" << lname
+ << "Consumer_" << port_name << "_Servant," << be_nl
+ << global << comp_sname << "::CCM_" << comp_lname
+ << "," << be_nl
+ << global << comp_sname << "::CCM_" << comp_lname
+ << "_Context," << be_nl
+ << node_->local_name () << "_Servant>" << be_uidt_nl
+ << "MACRO_MADNESS_TYPEDEF;" << be_uidt_nl << be_nl
+ << "MACRO_MADNESS_TYPEDEF * tmp = 0;" << be_nl
+ << "ACE_CString obj_id (this->ins_name_);" << be_nl
+ << "obj_id += \"_" << port_name << "\";" << be_nl << be_nl
+ << "ACE_NEW_THROW_EX (" << be_idt_nl
+ << "tmp," << be_nl
+ << "MACRO_MADNESS_TYPEDEF (" << be_idt_nl
+ << "obj_id.c_str ()," << be_nl
+ << "\"" << port_name << "\"," << be_nl
+ << "::CIAO::Port_Activator_Types::SINK," << be_nl
+ << "this->executor_.in ()," << be_nl
+ << "this->context_," << be_nl
+ << "this)," << be_uidt_nl
+ << "::CORBA::NO_MEMORY ());" << be_uidt_nl << be_nl
+ << "::CIAO::Port_Activator_var pa = tmp;" << be_nl << be_nl
+ << "::CIAO::Servant_Activator_var sa =" << be_idt_nl
+ << "this->container_->ports_servant_activator ();"
+ << be_uidt_nl << be_nl
+ << "if (! sa->register_port_activator (tmp))"
+ << be_idt_nl
+ << "{" << be_idt_nl
+ << "return ::" << fname << "Consumer::_nil ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "::CORBA::Object_var obj =" << be_idt_nl
+ << "this->container_->generate_reference (" << be_idt_nl
+ << "obj_id.c_str ()," << be_nl
+ << "\"";
+
+ ACE_CString work (obj->repoID ());
+ ACE_CString result (work.substr (0, work.rfind (':')));
+ result += "Consumer:1.0";
+
+ os_ << result.c_str ();
+
+ os_ << "\"," << be_nl
+ << "::CIAO::Container_Types::FACET_CONSUMER_t);"
+ << be_uidt_nl << be_uidt_nl
+ << "::Components::EventConsumerBase_var ecb =" << be_idt_nl
+ << "::Components::EventConsumerBase::_narrow (obj.in ());"
+ << be_uidt_nl << be_nl
+ << "this->add_consumer (\"" << port_name << "\", ecb.in ());"
+ << be_nl << be_nl
+ << "return ecb._retn ();" << be_uidt_nl
+ << "}";
+
+ return 0;
+}
+
+void
+be_visitor_servant_svs::compute_slots (AST_Component *node)
+{
+ while (node != 0)
+ {
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ AST_Decl *d = si.item ();
+
+ switch (d->node_type ())
+ {
+ case AST_Decl::NT_provides:
+ ++n_provides_;
+ break;
+ case AST_Decl::NT_uses:
+ ++n_uses_;
+ break;
+ case AST_Decl::NT_publishes:
+ ++n_publishes_;
+ break;
+ case AST_Decl::NT_emits:
+ ++n_emits_;
+ break;
+ case AST_Decl::NT_consumes:
+ ++n_consumes_;
+ break;
+ default:
+ break;
+ }
+ }
+
+ node = node->base_component ();
+ }
+}
+
+void
+be_visitor_servant_svs::gen_provides_top (void)
+{
+ os_ << be_nl << be_nl
+ << "/// CIAO-specific." << be_nl
+ << "::CORBA::Object_ptr" << be_nl
+ << node_->local_name ()
+ << "_Servant::get_facet_executor (" << be_idt_nl
+ << "const char * name)" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ if (swapping_)
+ {
+ os_ << "this->activate_component ();" << be_nl << be_nl;
+ }
+
+ os_ << "if (name == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::CORBA::BAD_PARAM ();" << be_uidt_nl
+ << "}" << be_uidt;
+
+ be_visitor_facet_executor_block feb_visitor (this->ctx_);
+
+ if (feb_visitor.visit_component_scope (node_) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "be_visitor_component_svs::"
+ "gen_provides_top - "
+ "facet executor block visitor failed\n"));
+
+ return;
+ }
+
+ os_ << be_nl << be_nl
+ << "return ::CORBA::Object::_nil ();" << be_uidt_nl
+ << "}";
+}
+
+void
+be_visitor_servant_svs::gen_publishes_top (void)
+{
+ os_ << be_nl << be_nl
+ << "::Components::Cookie *" << be_nl
+ << node_->local_name () << "_Servant::subscribe ("
+ << be_idt_nl
+ << "const char * publisher_name," << be_nl
+ << "::Components::EventConsumerBase_ptr subscribe)"
+ << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ if (swapping_)
+ {
+ os_ << "this->activate_component ();" << be_nl << be_nl;
+ }
+
+ os_ << "ACE_UNUSED_ARG (subscribe);" << be_nl << be_nl
+ << "if (publisher_name == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::Components::InvalidName ();" << be_uidt_nl
+ << "}" << be_uidt;
+
+ be_visitor_subscribe_block sb_visitor (this->ctx_);
+
+ if (sb_visitor.visit_component_scope (node_) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "be_visitor_component_svs::"
+ "gen_publishes_top - "
+ "subscribe block visitor failed\n"));
+
+ return;
+ }
+
+ os_ << be_nl << be_nl
+ << "throw ::Components::InvalidName ();" << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "::Components::EventConsumerBase_ptr" << be_nl
+ << node_->local_name () << "_Servant::unsubscribe ("
+ << be_idt_nl
+ << "const char * publisher_name," << be_nl
+ << "::Components::Cookie * ck)" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ if (swapping_)
+ {
+ os_ << "this->activate_component ();" << be_nl << be_nl;
+ }
+
+ os_ << "ACE_UNUSED_ARG (ck);" << be_nl << be_nl
+ << "if (publisher_name == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::Components::InvalidName ();" << be_uidt_nl
+ << "}" << be_uidt;
+
+ be_visitor_unsubscribe_block ub_visitor (this->ctx_);
+
+ if (ub_visitor.visit_component_scope (node_) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "be_visitor_component_svs::"
+ "gen_publishes_top - "
+ "unsubscribe block visitor failed\n"));
+
+ return;
+ }
+
+ os_ << be_nl << be_nl
+ << "throw ::Components::InvalidName ();" << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "::Components::PublisherDescriptions *" << be_nl
+ << node_->local_name ()
+ << "_Servant::get_all_publishers (void)" << be_nl
+ << "{" << be_idt_nl
+ << "::Components::PublisherDescriptions *retval = 0;"
+ << be_nl
+ << "ACE_NEW_RETURN (retval," << be_nl
+ << " ::Components::PublisherDescriptions,"
+ << be_nl
+ << " 0);" << be_nl << be_nl
+ << "::Components::PublisherDescriptions_var "
+ << "safe_retval = retval;" << be_nl
+ << "safe_retval->length (" << n_publishes_
+ << "UL);";
+
+ be_visitor_event_source_desc esd_visitor (this->ctx_);
+
+ if (esd_visitor.visit_component_scope (node_) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "be_visitor_component_svs::"
+ "gen_publishes_top - "
+ "event source description visitor failed\n"));
+
+ return;
+ }
+
+ os_ << be_nl << be_nl
+ << "return safe_retval._retn ();" << be_uidt_nl
+ << "}";
+}
+
+void
+be_visitor_servant_svs::gen_uses_top (void)
+{
+ os_ << be_nl << be_nl
+ << "::Components::Cookie *" << be_nl
+ << node_->local_name () << "_Servant::connect (" << be_idt_nl
+ << "const char * name," << be_nl
+ << "::CORBA::Object_ptr connection)" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ if (swapping_)
+ {
+ os_ << "this->activate_component ();" << be_nl << be_nl;
+ }
+
+ os_ << "/// If the component has no receptacles, "
+ << "arg will be unused." << be_nl
+ << "ACE_UNUSED_ARG (connection);" << be_nl << be_nl
+ << "if (name == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::Components::InvalidName ();" << be_uidt_nl
+ << "}" << be_uidt;
+
+ be_visitor_connect_block cb_visitor (this->ctx_);
+
+ if (cb_visitor.visit_component_scope (node_) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "be_visitor_component_svs::"
+ "gen_uses_top - "
+ "connect block visitor failed\n"));
+
+ return;
+ }
+
+ os_ << be_nl << be_nl
+ << "throw ::Components::InvalidName ();" << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "::CORBA::Object_ptr" << be_nl
+ << node_->local_name () << "_Servant::disconnect ("
+ << be_idt_nl
+ << "const char * name," << be_nl
+ << "::Components::Cookie * ck)" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ if (swapping_)
+ {
+ os_ << "this->activate_component ();" << be_nl << be_nl;
+ }
+
+ os_ << "ACE_UNUSED_ARG (ck);" << be_nl << be_nl
+ << "if (name == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::CORBA::BAD_PARAM ();" << be_uidt_nl
+ << "}" << be_uidt;
+
+ be_visitor_disconnect_block db_visitor (this->ctx_);
+
+ if (db_visitor.visit_component_scope (node_) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "be_visitor_component_svs::"
+ "gen_uses_top - "
+ "disconnect block visitor failed\n"));
+
+ return;
+ }
+
+ os_ << be_nl << be_nl
+ << "throw ::Components::InvalidName ();" << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "::Components::ReceptacleDescriptions *" << be_nl
+ << node_->local_name ()
+ << "_Servant::get_all_receptacles (void)" << be_nl
+ << "{" << be_idt_nl
+ << "::Components::ReceptacleDescriptions * retval = 0;"
+ << be_nl
+ << "ACE_NEW_RETURN (retval," << be_nl
+ << " ::Components::ReceptacleDescriptions,"
+ << be_nl
+ << " 0);" << be_nl
+ << "::Components::ReceptacleDescriptions_var "
+ << "safe_retval = retval;" << be_nl
+ << "safe_retval->length (" << n_uses_
+ << "UL);";
+
+ be_visitor_receptacle_desc rd_visitor (this->ctx_);
+
+ if (rd_visitor.visit_component_scope (node_) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "be_visitor_component_svs::"
+ "gen_uses_top - "
+ "receptacle description visitor failed\n"));
+
+ return;
+ }
+
+ os_ << be_nl << be_nl
+ << "return safe_retval._retn ();" << be_uidt_nl
+ << "}";
+}
+
+void
+be_visitor_servant_svs::gen_emits_top (void)
+{
+ os_ << be_nl << be_nl
+ << "void" << be_nl
+ << node_->local_name () << "_Servant::connect_consumer ("
+ << be_idt_nl
+ << "const char * emitter_name," << be_nl
+ << "::Components::EventConsumerBase_ptr consumer)"
+ << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ if (swapping_)
+ {
+ os_ << "this->activate_component ();" << be_nl << be_nl;
+ }
+
+ os_ << "if (emitter_name == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::CORBA::BAD_PARAM ();" << be_uidt_nl
+ << "}" << be_uidt;
+
+ be_visitor_connect_consumer_block ccb_visitor (this->ctx_);
+
+ if (ccb_visitor.visit_component_scope (node_) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "be_visitor_component_svs::"
+ "gen_emits_top - "
+ "connect consumer block visitor failed\n"));
+
+ return;
+ }
+
+ os_ << be_nl << be_nl
+ << "ACE_UNUSED_ARG (consumer);" << be_nl
+ << "throw ::Components::InvalidName ();" << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "::Components::EventConsumerBase_ptr" << be_nl
+ << node_->local_name ()
+ << "_Servant::disconnect_consumer (" << be_idt_nl
+ << "const char * source_name)" << be_uidt_nl
+ << "{" << be_idt_nl;
+
+ if (swapping_)
+ {
+ os_ << "this->activate_component ();" << be_nl << be_nl;
+ }
+
+ os_ << "if (source_name == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::CORBA::BAD_PARAM ();" << be_uidt_nl
+ << "}" << be_uidt;
+
+ be_visitor_disconnect_consumer_block dcb_visitor (this->ctx_);
+
+ if (dcb_visitor.visit_component_scope (node_) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "be_visitor_component_svs::"
+ "gen_emits_top - "
+ "disconnect consumer block visitor failed\n"));
+
+ return;
+ }
+
+ os_ << be_nl << be_nl
+ << "throw ::Components::InvalidName ();" << be_uidt_nl
+ << "}";
+
+ os_ << be_nl << be_nl
+ << "::Components::EmitterDescriptions *" << be_nl
+ << node_->local_name ()
+ << "_Servant::get_all_emitters (void)" << be_nl
+ << "{" << be_idt_nl
+ << "::Components::EmitterDescriptions *retval = 0;"
+ << be_nl
+ << "ACE_NEW_RETURN (retval," << be_nl
+ << " ::Components::EmitterDescriptions,"
+ << be_nl
+ << " 0);" << be_nl << be_nl
+ << "::Components::EmitterDescriptions_var "
+ << "safe_retval = retval;" << be_nl
+ << "safe_retval->length (" << n_emits_
+ << "UL);";
+
+ be_visitor_emitter_desc ed_visitor (this->ctx_);
+
+ if (ed_visitor.visit_component_scope (node_) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "be_visitor_component_svs::"
+ "gen_emits_top - "
+ "emitter description visitor failed\n"));
+
+ return;
+ }
+
+ os_ << be_nl << be_nl
+ << "return safe_retval._retn ();" << be_uidt_nl
+ << "}";
+}
+
+// ==========================================================
+
+be_visitor_obv_factory_reg::be_visitor_obv_factory_reg (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
+{
+}
+
+be_visitor_obv_factory_reg::~be_visitor_obv_factory_reg (void)
+{
+}
+
+int
+be_visitor_obv_factory_reg::visit_publishes (be_publishes *node)
+{
+ this->gen_obv_factory_registration (node->field_type ());
+
+ return 0;
+}
+
+int
+be_visitor_obv_factory_reg::visit_emits (be_emits *node)
+{
+ this->gen_obv_factory_registration (node->field_type ());
+
+ return 0;
+}
+
+int
+be_visitor_obv_factory_reg::visit_consumes (be_consumes *node)
+{
+ this->gen_obv_factory_registration (node->field_type ());
+
+ return 0;
+}
+
+void
+be_visitor_obv_factory_reg::gen_obv_factory_registration (AST_Type *t)
+{
+ if (be_global->gen_ciao_valuefactory_reg ())
+ {
+ const char *fname = t->full_name ();
+
+ os_ << be_nl << be_nl
+ << "TAO_OBV_REGISTER_FACTORY (" << be_idt_nl
+ << "::" << fname << "_init," << be_nl
+ << "::" << fname << ");" << be_uidt;
+ }
+}
+
+// ==========================================================
+
+be_visitor_attr_set::be_visitor_attr_set (be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
+{
+}
+
+be_visitor_attr_set::~be_visitor_attr_set (void)
+{
+}
+
+int
+be_visitor_attr_set::visit_attribute (be_attribute *node)
+{
+ be_visitor_attribute_component_init v (this->ctx_);
+
+ if (v.visit_attribute (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_attr_set")
+ ACE_TEXT ("::visit_attribute - ")
+ ACE_TEXT ("component attr init visitor ")
+ ACE_TEXT ("failed\n")),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+be_visitor_attr_set::visit_extended_port (be_extended_port *)
+{
+ return 0;
+}
+
+int
+be_visitor_attr_set::visit_mirror_port (be_mirror_port *)
+{
+ return 0;
+}
+
+int
+be_visitor_attr_set::visit_porttype (be_porttype *)
+{
+ return 0;
+}
+
+// ==========================================================
+
+be_visitor_facet_executor_block::be_visitor_facet_executor_block (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
+{
+}
+
+be_visitor_facet_executor_block::~be_visitor_facet_executor_block (
+ void)
+{
+}
+
+int
+be_visitor_facet_executor_block::visit_provides (
+ be_provides *node)
+{
+ const char *port_name =
+ node->local_name ()->get_string ();
+
+ os_ << be_nl << be_nl
+ << "if (ACE_OS::strcmp (name, \"" << port_name
+ << "\") == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return this->executor_->get_" << port_name
+ << " ();" << be_uidt_nl
+ << "}" << be_uidt;
+
+ return 0;
+}
+
+// ======================================================
+
+be_visitor_connect_block::be_visitor_connect_block (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
+{
+}
+
+be_visitor_connect_block::~be_visitor_connect_block (void)
+{
+}
+
+int
+be_visitor_connect_block::visit_uses (be_uses *node)
+{
+ const char *obj_name = node->uses_type ()->full_name ();
+ const char *port_name = node->local_name ()->get_string ();
+ bool is_multiple = node->is_multiple ();
+
+ os_ << be_nl << be_nl
+ << "if (ACE_OS::strcmp (name, \"" << port_name
+ << "\") == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "::" << obj_name << "_var _ciao_conn =" << be_idt_nl
+ << "::" << obj_name << "::_narrow (connection);"
+ << be_uidt_nl << be_nl
+ << "if ( ::CORBA::is_nil (_ciao_conn.in ()))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::Components::InvalidConnection ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+
+ if (! is_multiple)
+ {
+ os_ << "ACE_CString receptacle_name (\"" << port_name
+ << "\");" << be_nl
+ << "receptacle_name += \'_\';" << be_nl
+ << "receptacle_name += "
+ << "this->context_->_ciao_instance_id ();" << be_nl
+ << "::CORBA::PolicyList_var policy_list =" << be_idt_nl
+ << "this->container_->get_receptacle_policy "
+ << "(receptacle_name.c_str ());" << be_uidt_nl << be_nl
+ << "if (policy_list->length () != 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "::CORBA::Object_var over_ridden_object ="
+ << be_idt_nl
+ << "_ciao_conn->_set_policy_overrides (policy_list.in (),"
+ << be_nl
+ << " CORBA::SET_OVERRIDE);"
+ << be_uidt_nl
+ << "_ciao_conn =" << be_idt_nl
+ << "::" << obj_name << "::_narrow (over_ridden_object.in ());"
+ << be_uidt << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+ }
+
+ os_ << "/// " << (is_multiple ? "Multiplex" : "Simplex")
+ << " connect." << be_nl
+ << (is_multiple ? "return " : "") << "this->connect_"
+ << port_name << " (_ciao_conn.in ());";
+
+ if (! is_multiple)
+ {
+ os_ << be_nl << be_nl
+ << "return 0;";
+ }
+
+ os_ << be_uidt_nl
+ << "}" << be_uidt;
+
+ return 0;
+}
+
+// ======================================================
+
+be_visitor_disconnect_block::be_visitor_disconnect_block (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
+{
+}
+
+be_visitor_disconnect_block::~be_visitor_disconnect_block (
+ void)
+{
+}
+
+int
+be_visitor_disconnect_block::visit_uses (be_uses *node)
+{
+ const char *port_name = node->local_name ()->get_string ();
+ bool is_multiple = node->is_multiple ();
+
+ os_ << be_nl << be_nl
+ << "if (ACE_OS::strcmp (name, \"" << port_name
+ << "\") == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "/// " << (is_multiple ? "Multiplex" : "Simplex")
+ << " disconnect." << be_nl;
+
+ if (is_multiple)
+ {
+ os_ << "if (ck == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::Components::CookieRequired ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
+ }
+
+ os_ << "return this->disconnect_" << port_name
+ << " (" << (is_multiple ? "ck" : "") << ");" << be_uidt_nl
+ << "}" << be_uidt;
+
+ return 0;
+}
+
+// ======================================================
+
+be_visitor_receptacle_desc::be_visitor_receptacle_desc (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx),
+ slot_ (0UL)
+{
+}
+
+be_visitor_receptacle_desc::~be_visitor_receptacle_desc (
+ void)
+{
+}
+
+int
+be_visitor_receptacle_desc::visit_uses (be_uses *node)
+{
+ AST_Type *obj = node->uses_type ();
+ const char *port_name = node->local_name ()->get_string ();
+ bool is_multiple = node->is_multiple ();
+
+ os_ << be_nl << be_nl;
+
+ bool gen_guard = is_multiple && ! static_config_;
+
+ if (gen_guard)
+ {
+ os_ << "{" << be_idt_nl
+ << "ACE_READ_GUARD_RETURN (TAO_SYNCH_MUTEX," << be_nl
+ << " mon," << be_nl
+ << " this->context_->"
+ << port_name << "_lock_," << be_nl
+ << " 0);" << be_nl << be_nl;
+ }
+
+ os_ << "::CIAO::Servant::describe_"
+ << (is_multiple ? "multiplex" : "simplex")
+ << "_receptacle<" << be_idt_nl
+ << "::" << obj->full_name () << "_var> (" << be_idt_nl
+ << "\"" << port_name << "\"," << be_nl
+ << "\"" << obj->repoID () << "\"," << be_nl
+ << "this->context_->ciao_uses_"
+ << port_name << "_," << be_nl
+ << "safe_retval," << be_nl
+ << slot_++ << "UL);" << be_uidt << be_uidt;
+
+ if (gen_guard)
+ {
+ os_ << be_uidt_nl
+ << "}";
+ }
+
+ return 0;
+}
+
+// ======================================================
+
+be_visitor_subscribe_block::be_visitor_subscribe_block (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
+{
+}
+
+be_visitor_subscribe_block::~be_visitor_subscribe_block (
+ void)
+{
+}
+
+int
+be_visitor_subscribe_block::visit_publishes (
+ be_publishes *node)
+{
+ const char *obj_name =
+ node->publishes_type ()->full_name ();
+ const char *port_name =
+ node->local_name ()->get_string ();
+
+ os_ << be_nl << be_nl
+ << "if (ACE_OS::strcmp (publisher_name, \""
+ << port_name << "\") == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "::" << obj_name << "Consumer_var sub =" << be_idt_nl
+ << "::" << obj_name << "Consumer::_narrow (subscribe);"
+ << be_uidt_nl << be_nl
+ << "if ( ::CORBA::is_nil (sub.in ()))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "::CORBA::Boolean const substitutable =" << be_idt_nl
+ << "subscribe->ciao_is_substitutable (" << be_idt_nl
+ << "::" << obj_name
+ << "::_tao_obv_static_repository_id ());"
+ << be_uidt << be_uidt_nl << be_nl
+ << "if (substitutable)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return this->subscribe_" << port_name
+ << "_generic (subscribe);" << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "else" << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::Components::InvalidConnection ();" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
+ << "}" << be_uidt_nl
+ << "else" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return this->subscribe_" << port_name
+ << " (sub.in ());" << be_uidt_nl
+ << "}" << be_uidt << be_uidt_nl
+ << "}" << be_uidt;
+
+ return 0;
+}
+
+// ==========================================================
+
+be_visitor_unsubscribe_block::be_visitor_unsubscribe_block (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
+{
+}
+
+be_visitor_unsubscribe_block::~be_visitor_unsubscribe_block (
+ void)
+{
+}
+
+int
+be_visitor_unsubscribe_block::visit_publishes (
+ be_publishes *node)
+{
+ const char *port_name =
+ node->local_name ()->get_string ();
+
+ os_ << be_nl << be_nl
+ << "if (ACE_OS::strcmp (publisher_name, \""
+ << port_name << "\") == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return this->unsubscribe_" << port_name
+ << " (ck);" << be_uidt_nl
+ << "}" << be_uidt;
+
+ return 0;
+}
+
+// ==========================================================
+
+be_visitor_event_source_desc::be_visitor_event_source_desc (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx),
+ slot_ (0UL)
+{
+}
+
+be_visitor_event_source_desc::~be_visitor_event_source_desc (
+ void)
+{
+}
+
+int
+be_visitor_event_source_desc::visit_publishes (
+ be_publishes *node)
+{
+ AST_Type *obj = node->publishes_type ();
+ const char *port_name =
+ node->local_name ()->get_string ();
+
+ os_ << be_nl << be_nl;
+
+ if (! static_config_)
+ {
+ os_ << "{" << be_idt_nl
+ << "ACE_READ_GUARD_RETURN (TAO_SYNCH_MUTEX," << be_nl
+ << " mon," << be_nl
+ << " this->context_->"
+ << port_name << "_lock_," << be_nl
+ << " 0);" << be_nl << be_nl;
+ }
+
+ os_ << "::CIAO::Servant::describe_pub_event_source<"
+ << be_idt_nl
+ << "::" << obj->full_name () << "Consumer_var> ("
+ << be_idt_nl
+ << "\"" << port_name << "\"," << be_nl
+ << "\"" << obj->repoID () << "\"," << be_nl
+ << "this->context_->ciao_publishes_"
+ << port_name << "_," << be_nl
+ << "safe_retval," << be_nl
+ << slot_++ << "UL);" << be_uidt << be_uidt;
+
+ if (! be_global->gen_ciao_static_config ())
+ {
+ os_ << be_uidt_nl
+ << "}";
+ }
+
+ return 0;
+}
+
+// ======================================================
+
+be_visitor_connect_consumer_block::be_visitor_connect_consumer_block (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
+{
+}
+
+be_visitor_connect_consumer_block::~be_visitor_connect_consumer_block (void)
+{
+}
+
+int
+be_visitor_connect_consumer_block::visit_emits (
+ be_emits *node)
+{
+ const char *obj_name =
+ node->emits_type ()->full_name ();
+ const char *port_name =
+ node->local_name ()->get_string ();
+
+ os_ << be_nl << be_nl
+ << "if (ACE_OS::strcmp (emitter_name, \""
+ << port_name << "\") == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "::" << obj_name
+ << "Consumer_var _ciao_consumer =" << be_idt_nl
+ << "::" << obj_name
+ << "Consumer::_narrow (consumer);" << be_uidt_nl << be_nl
+ << "if ( ::CORBA::is_nil (_ciao_consumer.in ()))"
+ << be_idt_nl
+ << "{" << be_idt_nl
+ << "throw ::Components::InvalidConnection ();" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "this->connect_" << port_name
+ << " (_ciao_consumer.in ());" << be_nl << be_nl
+ << "return;" << be_uidt_nl
+ << "}" << be_uidt;
+
+ return 0;
+}
+
+// ======================================================
+
+be_visitor_disconnect_consumer_block::be_visitor_disconnect_consumer_block (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
+{
+}
+
+be_visitor_disconnect_consumer_block::~be_visitor_disconnect_consumer_block (
+ void)
+{
+}
+
+int
+be_visitor_disconnect_consumer_block::visit_emits (
+ be_emits *node)
+{
+ const char *port_name =
+ node->local_name ()->get_string ();
+
+ os_ << be_nl << be_nl
+ << "if (ACE_OS::strcmp (source_name, \""
+ << port_name << "\") == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return this->disconnect_" << port_name
+ << " ();" << be_uidt_nl
+ << "}" << be_uidt;
+
+ return 0;
+}
+
+// ======================================================
+
+be_visitor_emitter_desc::be_visitor_emitter_desc (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx),
+ slot_ (0UL)
+{
+}
+
+be_visitor_emitter_desc::~be_visitor_emitter_desc (
+ void)
+{
+}
+
+int
+be_visitor_emitter_desc::visit_emits (be_emits *node)
+{
+ AST_Type *obj = node->emits_type ();
+ const char *port_name =
+ node->local_name ()->get_string ();
+
+ os_ << be_nl << be_nl
+ << "::CIAO::Servant::describe_emit_event_source<"
+ << be_idt_nl
+ << "::" << obj->full_name () << "Consumer_var> ("
+ << be_idt_nl
+ << "\"" << port_name << "\"," << be_nl
+ << "\"" << obj->repoID () << "\"," << be_nl
+ << "this->context_->ciao_emits_" << port_name
+ << "_consumer_," << be_nl
+ << "safe_retval," << be_nl
+ << slot_++ << "UL);" << be_uidt << be_uidt;
+
+ return 0;
+}
+
+// ======================================================
+
+be_visitor_populate_port_tables::be_visitor_populate_port_tables (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
+{
+}
+
+be_visitor_populate_port_tables::~be_visitor_populate_port_tables (
+ void)
+{
+}
+
+int
+be_visitor_populate_port_tables::visit_provides (
+ be_provides *node)
+{
+ os_ << be_nl
+ << "obj_var = this->provide_"
+ << node->local_name ()->get_string () << "_i ();";
+
+ return 0;
+}
+
+int
+be_visitor_populate_port_tables::visit_consumes (
+ be_consumes *node)
+{
+ os_ << be_nl
+ << "ecb_var = this->get_consumer_"
+ << node->local_name ()->get_string () << "_i ();";
+
+ return 0;
+}
+
+// ======================================================
+
+Component_Op_Attr_Generator::Component_Op_Attr_Generator (
+ be_visitor_scope * visitor)
+ : visitor_ (visitor)
+{
+}
+
+int
+Component_Op_Attr_Generator::emit (be_interface * /* derived_interface */,
+ TAO_OutStream * /* os */,
+ be_interface * base_interface)
+{
+ if (base_interface->node_type () == AST_Decl::NT_component)
+ {
+ return 0;
+ }
+
+ return visitor_->visit_scope (base_interface);
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_component_scope.cpp b/TAO/TAO_IDL/be/be_visitor_component_scope.cpp
new file mode 100644
index 00000000000..28af75ff4c3
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_component_scope.cpp
@@ -0,0 +1,289 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_component_scope.cpp
+//
+// = DESCRIPTION
+// Abstract visitor providing ancestor scope visitation.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#include "be_visitor_component_scope.h"
+#include "be_visitor_context.h"
+
+#include "be_mirror_port.h"
+#include "be_component.h"
+#include "be_provides.h"
+#include "be_uses.h"
+
+#include "be_helper.h"
+#include "be_extern.h"
+
+#include "utl_identifier.h"
+#include "nr_extern.h"
+
+be_visitor_component_scope::be_visitor_component_scope (
+ be_visitor_context *ctx)
+ : be_visitor_scope (ctx),
+ node_ (0),
+ os_ (*ctx->stream ()),
+ export_macro_ (be_global->svnt_export_macro ()),
+ swapping_ (be_global->gen_component_swapping ()),
+ static_config_ (be_global->gen_ciao_static_config ())
+{
+ /// All existing CIAO examples set the servant export values in the CIDL
+ /// compiler to equal the IDL compiler's skel export values. Below is a
+ /// partial effort to decouple them, should be completely decoupled
+ /// sometime. See comment in codegen.cpp, line 1173.
+ if (export_macro_ == "")
+ {
+ export_macro_ = be_global->skel_export_macro ();
+ }
+}
+
+be_visitor_component_scope::~be_visitor_component_scope (
+ void)
+{
+}
+
+int
+be_visitor_component_scope::visit_extended_port (
+ be_extended_port *node)
+{
+
+ AST_Decl::NodeType nt =
+ ScopeAsDecl (node->defined_in ())->node_type ();
+
+ // Store this to prefix to contained provides or uses node name.
+ if (nt == AST_Decl::NT_component || nt == AST_Decl::NT_connector)
+ {
+ this->current_port_name_ = node->local_name ()->get_string ();
+ }
+
+ return this->visit_porttype_scope (node->port_type ());
+}
+
+int
+be_visitor_component_scope::visit_mirror_port (
+ be_mirror_port *node)
+{
+ AST_Decl::NodeType nt =
+ ScopeAsDecl (node->defined_in ())->node_type ();
+
+ // Store this to prefix to contained provides or uses node name.
+ if (nt == AST_Decl::NT_component || nt == AST_Decl::NT_connector)
+ {
+ this->current_port_name_ = node->local_name ()->get_string ();
+ }
+
+ return this->visit_porttype_scope_mirror (node->port_type ());
+}
+
+int
+be_visitor_component_scope::visit_component_scope (
+ be_component *node)
+{
+ if (node == 0)
+ {
+ return 0;
+ }
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_component_scope")
+ ACE_TEXT ("::visit_component_scope - ")
+ ACE_TEXT ("visit_scope() ")
+ ACE_TEXT ("failed\n")),
+ -1);
+ }
+
+ return this->visit_component_scope (node->base_component ());
+}
+
+int
+be_visitor_component_scope::visit_porttype_scope (
+ be_porttype *node)
+{
+ return this->visit_scope (node);
+}
+
+int
+be_visitor_component_scope::visit_porttype_scope_mirror (be_porttype *node)
+{
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ be_decl *d = be_decl::narrow_from_decl (si.item ());
+
+ (void) this->pre_process (d);
+
+ switch (d->node_type ())
+ {
+ case AST_Decl::NT_provides:
+ {
+ be_provides *p =
+ be_provides::narrow_from_decl (d);
+
+ be_uses mirror_node (p->name (),
+ p->provides_type (),
+ false);
+
+ if (this->visit_uses (&mirror_node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_component_scope")
+ ACE_TEXT ("::visit_porttype_mirror - ")
+ ACE_TEXT ("visit_uses() failed\n")),
+ -1);
+ }
+
+ mirror_node.destroy ();
+ break;
+ }
+ case AST_Decl::NT_uses:
+ {
+ be_uses *u =
+ be_uses::narrow_from_decl (d);
+
+ be_provides mirror_node (u->name (),
+ u->uses_type ());
+
+ if (this->visit_provides (&mirror_node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("be_visitor_component_scope")
+ ACE_TEXT ("::visit_porttype_mirror - ")
+ ACE_TEXT ("visit_provides() failed\n")),
+ -1);
+ }
+
+ mirror_node.destroy ();
+ break;
+ }
+ default:
+ return d->accept (this);
+ }
+ }
+
+ return 0;
+}
+
+int
+be_visitor_component_scope::pre_process (be_decl *node)
+{
+ AST_Decl::NodeType nt = node->node_type ();
+
+ if (nt == AST_Decl::NT_provides || nt == AST_Decl::NT_uses)
+ {
+ AST_Decl *s = ScopeAsDecl (node->defined_in ());
+ AST_Decl::NodeType snt = s->node_type ();
+
+ if (snt == AST_Decl::NT_porttype)
+ {
+ ACE_CString new_name = current_port_name_;
+ new_name += '_';
+ new_name += node->local_name ()->get_string ();
+
+ Identifier *i = node->name ()->last_component ();
+ i->replace_string (new_name.c_str ());
+ }
+ }
+
+ return 0;
+}
+
+void
+be_visitor_component_scope::gen_svnt_entrypoint_decl (void)
+{
+ os_ << be_nl << be_nl
+ << "extern \"C\" " << export_macro_.c_str ()
+ << " ::PortableServer::Servant" << be_nl
+ << "create_" << node_->flat_name ()
+ << "_Servant (" << be_idt_nl
+ << "::Components::EnterpriseComponent_ptr p," << be_nl
+ << "::CIAO::Container_ptr c," << be_nl
+ << "const char * ins_name);" << be_uidt;
+}
+
+void
+be_visitor_component_scope::gen_svnt_entrypoint_defn (void)
+{
+ ACE_CString sname_str (
+ ScopeAsDecl (node_->defined_in ())->full_name ());
+ const char *sname = sname_str.c_str ();
+ const char *lname = node_->local_name ();
+ const char *global = (sname_str == "" ? "" : "::");
+
+ os_ << be_nl << be_nl
+ << "extern \"C\" " << export_macro_.c_str ()
+ << " ::PortableServer::Servant" << be_nl
+ << "create_" << node_->flat_name ()
+ << "_Servant (" << be_idt_nl
+ << "::Components::EnterpriseComponent_ptr p," << be_nl
+ << "::CIAO::Container_ptr c," << be_nl
+ << "const char * ins_name)" << be_uidt_nl
+ << "{" << be_idt_nl
+ << global << sname << "::CCM_" << lname
+ << "_var x =" << be_idt_nl
+ << global << sname << "::CCM_" << lname
+ << "::_narrow (p);" << be_uidt_nl << be_nl
+ << "if ( ::CORBA::is_nil (x.in ()))" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return 0;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "::PortableServer::Servant retval = 0;" << be_nl
+ << "ACE_NEW_RETURN (retval," << be_nl
+ << " " << lname << "_Servant (" << be_idt_nl
+ << " x.in ()," << be_nl
+ << " ::Components::CCMHome::_nil ()," << be_nl
+ << " ins_name," << be_nl
+ << " 0," << be_nl
+ << " c)," << be_uidt_nl
+ << " 0);" << be_nl << be_nl
+ << "return retval;" << be_uidt_nl
+ << "}";
+}
+
+void
+be_visitor_component_scope::gen_exec_entrypoint_decl (void)
+{
+ os_ << be_nl << be_nl
+ << "extern \"C\" " << export_macro_.c_str ()
+ << " ::Components::EnterpriseComponent_ptr" << be_nl
+ << "create_" << node_->flat_name ()
+ << "_Impl (void);";
+}
+
+void
+be_visitor_component_scope::gen_exec_entrypoint_defn (void)
+{
+ os_ << be_nl << be_nl
+ << "extern \"C\" " << export_macro_.c_str ()
+ << " ::Components::EnterpriseComponent_ptr" << be_nl
+ << "create_" << node_->flat_name ()
+ << "_Impl (void)" << be_nl
+ << "{" << be_idt_nl
+ << "::Components::EnterpriseComponent_ptr retval ="
+ << be_idt_nl
+ << "::Components::EnterpriseComponent::_nil ();"
+ << be_uidt_nl << be_nl
+ << "ACE_NEW_NORETURN (" << be_idt_nl
+ << "retval," << be_nl
+ << node_->local_name () << "_exec_i);"
+ << be_uidt_nl << be_nl
+ << "return retval;" << be_uidt_nl
+ << "}";
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_connector.cpp b/TAO/TAO_IDL/be/be_visitor_connector.cpp
new file mode 100644
index 00000000000..bff55072b91
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_connector.cpp
@@ -0,0 +1,27 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_connector.cpp
+//
+// = DESCRIPTION
+// Visitors for generation of code for Connector.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#include "be_connector.h"
+
+#include "be_visitor_connector.h"
+#include "be_visitor_context.h"
+
+#include "be_visitor_connector/connector_dds_exh.cpp"
+#include "be_visitor_connector/connector_dds_exs.cpp"
diff --git a/TAO/TAO_IDL/be/be_visitor_connector/connector_dds_exh.cpp b/TAO/TAO_IDL/be/be_visitor_connector/connector_dds_exh.cpp
new file mode 100644
index 00000000000..28640d3be6f
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_connector/connector_dds_exh.cpp
@@ -0,0 +1,57 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO_IDL_BE
+//
+// = FILENAME
+// connector_dds_exh.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for DDS Connectors in the exec impl header.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+be_visitor_connector_dds_exh::be_visitor_connector_dds_exh (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
+{
+ // This is initialized in the base class to svnt_export_macro()
+ // or skel_export_macro(), since there are many more visitor
+ // classes generating servant code. So we can just override
+ // all that here.
+ export_macro_ = be_global->exec_export_macro ();
+}
+
+be_visitor_connector_dds_exh::~be_visitor_connector_dds_exh (void)
+{
+}
+
+int
+be_visitor_connector_dds_exh::visit_connector (be_connector *node)
+{
+ node_ = node;
+
+ /// CIDL-generated namespace used 'CIDL_' + composition name.
+ /// Now we use 'CIAO_' + component's flat name.
+ os_ << be_nl << be_nl
+ << "namespace CIAO_" << node->flat_name ()
+ << "_Impl" << be_nl
+ << "{" << be_idt;
+
+ // TODO - template class declaration.
+
+ this->gen_exec_entrypoint_decl ();
+
+ os_ << be_uidt_nl
+ << "}";
+
+ return 0;
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_connector/connector_dds_exs.cpp b/TAO/TAO_IDL/be/be_visitor_connector/connector_dds_exs.cpp
new file mode 100644
index 00000000000..a85a638a54c
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_connector/connector_dds_exs.cpp
@@ -0,0 +1,57 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO_IDL_BE
+//
+// = FILENAME
+// connector_dds_exs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Connectors in the exec impl source.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+be_visitor_connector_dds_exs::be_visitor_connector_dds_exs (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx)
+{
+ // This is initialized in the base class to svnt_export_macro()
+ // or skel_export_macro(), since there are many more visitor
+ // classes generating servant code. So we can just override
+ // all that here.
+ export_macro_ = be_global->exec_export_macro ();
+}
+
+be_visitor_connector_dds_exs::~be_visitor_connector_dds_exs (void)
+{
+}
+
+int
+be_visitor_connector_dds_exs::visit_connector (be_connector *node)
+{
+ node_ = node;
+
+ /// CIDL-generated namespace used 'CIDL_' + composition name.
+ /// Now we use 'CIAO_' + component's flat name.
+ os_ << be_nl << be_nl
+ << "namespace CIAO_" << node->flat_name ()
+ << "_Impl" << be_nl
+ << "{" << be_idt;
+
+ // TODO - template class constructor and destructor.
+
+ this->gen_exec_entrypoint_defn ();
+
+ os_ << be_uidt_nl
+ << "}";
+
+ return 0;
+}
+
diff --git a/TAO/TAO_IDL/be/be_visitor_extended_port.cpp b/TAO/TAO_IDL/be/be_visitor_extended_port.cpp
deleted file mode 100644
index be34b780713..00000000000
--- a/TAO/TAO_IDL/be/be_visitor_extended_port.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-//
-// $Id$
-//
-
-// ============================================================================
-//
-// = LIBRARY
-// TAO IDL
-//
-// = FILENAME
-// be_visitor_extended_port.cpp
-//
-// = DESCRIPTION
-// Visitors for generation of code for extended ports.
-//
-// = AUTHOR
-// Jeff Parsons
-//
-// ============================================================================
-
-#include "be_visitor_extended_port.h"
-
-#include "be_visitor_extended_port/extended_port.cpp"
-#include "be_visitor_extended_port/extended_port_svh.cpp"
-#include "be_visitor_extended_port/extended_port_svs.cpp"
-
diff --git a/TAO/TAO_IDL/be/be_visitor_extended_port/extended_port.cpp b/TAO/TAO_IDL/be/be_visitor_extended_port/extended_port.cpp
deleted file mode 100644
index 2504968ab1d..00000000000
--- a/TAO/TAO_IDL/be/be_visitor_extended_port/extended_port.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// $Id$
-//
-
-// ============================================================================
-//
-// = LIBRARY
-// TAO IDL
-//
-// = FILENAME
-// extended_port.cpp
-//
-// = DESCRIPTION
-// Base class visitor generating code for extended ports.
-//
-// = AUTHOR
-// Jeff Parsons
-//
-// ============================================================================
-
-// ******************************************************
-// Base class extended port visitor
-// ******************************************************
-
-be_visitor_extended_port::be_visitor_extended_port (
- be_visitor_context *ctx)
- : be_visitor_scope (ctx),
- template_args_ (0),
- port_type_ (0)
-{
-}
-
-be_visitor_extended_port::~be_visitor_extended_port (void)
-{
-}
-
diff --git a/TAO/TAO_IDL/be/be_visitor_extended_port/extended_port_svh.cpp b/TAO/TAO_IDL/be/be_visitor_extended_port/extended_port_svh.cpp
deleted file mode 100644
index c8038cafbf1..00000000000
--- a/TAO/TAO_IDL/be/be_visitor_extended_port/extended_port_svh.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-//
-// $Id$
-//
-
-// ============================================================================
-//
-// = LIBRARY
-// TAO IDL
-//
-// = FILENAME
-// extended_port_svh.cpp
-//
-// = DESCRIPTION
-// Visitor generating code for extended ports in the servant header.
-//
-// = AUTHOR
-// Jeff Parsons
-//
-// ============================================================================
-
-// ******************************************************
-// Extended port visitor for server header
-// ******************************************************
-
-be_visitor_extended_port_facet_svh::be_visitor_extended_port_facet_svh (
- be_visitor_context *ctx)
- : be_visitor_extended_port (ctx)
-{
-}
-
-be_visitor_extended_port_facet_svh::~be_visitor_extended_port_facet_svh (
- void)
-{
-}
-
-int
-be_visitor_extended_port_facet_svh::visit_extended_port (
- be_extended_port *node)
-{
- be_porttype *pt =
- be_porttype::narrow_from_decl (node->port_type ());
-
- return this->visit_porttype (pt);
-}
-
-int
-be_visitor_extended_port_facet_svh::visit_porttype (
- be_porttype *node)
-{
- return this->visit_scope (node);
-}
-
-int
-be_visitor_extended_port_facet_svh::visit_provides (
- be_provides *node)
-{
- TAO_OutStream *os = this->ctx_->stream ();
-
- if (node->gen_facet_svnt_decl (*os) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_extended_port_facet_svh::")
- ACE_TEXT ("visit_provides - ")
- ACE_TEXT ("gen_facet_svnt_decl() failed\n")),
- -1);
- }
-
- return 0;
-}
-
diff --git a/TAO/TAO_IDL/be/be_visitor_extended_port/extended_port_svs.cpp b/TAO/TAO_IDL/be/be_visitor_extended_port/extended_port_svs.cpp
deleted file mode 100644
index 7a21808b2d3..00000000000
--- a/TAO/TAO_IDL/be/be_visitor_extended_port/extended_port_svs.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-//
-// $Id$
-//
-
-// ============================================================================
-//
-// = LIBRARY
-// TAO IDL
-//
-// = FILENAME
-// extended_port_svs.cpp
-//
-// = DESCRIPTION
-// Visitor generating code for extended ports in the servant source.
-//
-// = AUTHOR
-// Jeff Parsons
-//
-// ============================================================================
-
-// ******************************************************
-// Extended port visitor for facets in server source.
-// ******************************************************
-
-be_visitor_extended_port_facet_svs::be_visitor_extended_port_facet_svs (
- be_visitor_context *ctx)
- : be_visitor_extended_port (ctx)
-{
-}
-
-be_visitor_extended_port_facet_svs::~be_visitor_extended_port_facet_svs (
- void)
-{
-}
-
-int
-be_visitor_extended_port_facet_svs::visit_extended_port (
- be_extended_port *node)
-{
- be_porttype *pt =
- be_porttype::narrow_from_decl (node->port_type ());
-
- return this->visit_porttype (pt);
-}
-
-int
-be_visitor_extended_port_facet_svs::visit_porttype (
- be_porttype *node)
-{
- return this->visit_scope (node);
-}
-
-int
-be_visitor_extended_port_facet_svs::visit_provides (
- be_provides *node)
-{
- TAO_OutStream *os = this->ctx_->stream ();
-
- if (node->gen_facet_svnt_defn (*os) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("be_visitor_extended_port_facet_svh::")
- ACE_TEXT ("visit_provides - ")
- ACE_TEXT ("gen_facet_svnt_defn() failed\n")),
- -1);
- }
-
- return 0;
-}
-
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_svs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_svs.cpp
index eff1c1316ac..f249b93d711 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_svs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_svs.cpp
@@ -61,7 +61,6 @@ int
be_visitor_interface_svs::visit_operation (be_operation *node)
{
be_visitor_operation_svs v (this->ctx_);
- v.for_facets (true);
v.scope (be_interface::narrow_from_decl (this->ctx_->scope ()));
return v.visit_operation (node);
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_exs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_exs.cpp
index 450554e9e55..ca4b7c9f9da 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/operation_exs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_exs.cpp
@@ -18,14 +18,6 @@
//
// ============================================================================
-ACE_RCSID (be_visitor_operation,
- operation_exs,
- "$Id$")
-
-// ************************************************************
-// Operation visitor for CIAO executor implementations
-// ************************************************************
-
be_visitor_operation_exs::be_visitor_operation_exs (be_visitor_context *ctx)
: be_visitor_scope (ctx),
os_ (*ctx->stream ()),
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_svs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_svs.cpp
index 3a33a0f72e1..cce85a96209 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/operation_svs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_svs.cpp
@@ -18,18 +18,10 @@
//
// ============================================================================
-ACE_RCSID (be_visitor_operation,
- operation_svs,
- "$Id$")
-
-// ************************************************************
-// Operation visitor for CIAO servant implementations
-// ************************************************************
-
-be_visitor_operation_svs::be_visitor_operation_svs (be_visitor_context *ctx)
+be_visitor_operation_svs::be_visitor_operation_svs (
+ be_visitor_context *ctx)
: be_visitor_scope (ctx),
scope_ (0),
- for_facets_ (false),
swapping_ (be_global->gen_component_swapping ())
{
}
@@ -174,12 +166,6 @@ be_visitor_operation_svs::post_process (be_decl *bd)
}
void
-be_visitor_operation_svs::for_facets (bool val)
-{
- this->for_facets_ = val;
-}
-
-void
be_visitor_operation_svs::scope (be_interface *node)
{
this->scope_ = node;
diff --git a/TAO/TAO_IDL/be_include/be_attribute.h b/TAO/TAO_IDL/be_include/be_attribute.h
index d1a3526208a..64ccd06f370 100644
--- a/TAO/TAO_IDL/be_include/be_attribute.h
+++ b/TAO/TAO_IDL/be_include/be_attribute.h
@@ -34,15 +34,16 @@ class be_attribute : public virtual AST_Attribute,
{
public:
be_attribute (void);
- // Default constructor.
be_attribute (bool ro,
AST_Type *ft,
UTL_ScopedName *n,
bool local,
bool abstract);
- // Constructor.
+ // Non-virtual override of frontend method.
+ be_type *field_type (void) const;
+
// Visiting.
virtual int accept (be_visitor *visitor);
diff --git a/TAO/TAO_IDL/be_include/be_codegen.h b/TAO/TAO_IDL/be_include/be_codegen.h
index 2917397aba4..f939a1763ad 100644
--- a/TAO/TAO_IDL/be_include/be_codegen.h
+++ b/TAO/TAO_IDL/be_include/be_codegen.h
@@ -416,6 +416,12 @@ public:
void gen_export_files (void);
// Generates the export files selected on the command line.
+ void gen_standard_include (TAO_OutStream *stream,
+ const char *included_file,
+ bool add_comment = false);
+ // Generate file include, with optional empty comment to
+ // short-circuit DOxygen.
+
void destroy (void);
// Cleanup.
@@ -425,10 +431,6 @@ private:
const char *prefix,
const char *suffix);
- void gen_standard_include (TAO_OutStream *stream,
- const char *included_file,
- bool add_comment = false);
-
/// Utility methods for generating file includes.
void gen_stub_hdr_includes (void);
void gen_stub_src_includes (void);
diff --git a/TAO/TAO_IDL/be_include/be_component.h b/TAO/TAO_IDL/be_include/be_component.h
index 868f3ffc2f3..ff27ae29b08 100644
--- a/TAO/TAO_IDL/be_include/be_component.h
+++ b/TAO/TAO_IDL/be_include/be_component.h
@@ -43,6 +43,10 @@ public:
long n_supports_flat);
~be_component (void);
+
+ be_component *base_component (void) const;
+ // Override of the AST method to eliminate narrowing of
+ // the return value. Non-virtual.
virtual void redefine (AST_Interface *from);
// Catch BE-specific members before delegating to the base class.
diff --git a/TAO/TAO_IDL/be_include/be_consumes.h b/TAO/TAO_IDL/be_include/be_consumes.h
index a306d4dc385..d03f1bf61d9 100644
--- a/TAO/TAO_IDL/be_include/be_consumes.h
+++ b/TAO/TAO_IDL/be_include/be_consumes.h
@@ -20,8 +20,11 @@ public:
virtual ~be_consumes (void);
+ // Non-virtual override of frontend method.
+ be_eventtype *consumes_type (void) const;
+
// Narrowing.
- DEF_NARROW_FROM_DECL(be_consumes);
+ DEF_NARROW_FROM_DECL (be_consumes);
// Visiting.
virtual int accept (be_visitor *visitor);
diff --git a/TAO/TAO_IDL/be_include/be_emits.h b/TAO/TAO_IDL/be_include/be_emits.h
index 509ff5361de..370b5263954 100644
--- a/TAO/TAO_IDL/be_include/be_emits.h
+++ b/TAO/TAO_IDL/be_include/be_emits.h
@@ -20,8 +20,11 @@ public:
virtual ~be_emits (void);
+ // Non-virtual override of frontend method.
+ be_eventtype *emits_type (void) const;
+
// Narrowing.
- DEF_NARROW_FROM_DECL(be_emits);
+ DEF_NARROW_FROM_DECL (be_emits);
// Visiting.
virtual int accept (be_visitor *visitor);
diff --git a/TAO/TAO_IDL/be_include/be_extended_port.h b/TAO/TAO_IDL/be_include/be_extended_port.h
index 615e7e87c3d..a2bdf9045ac 100644
--- a/TAO/TAO_IDL/be_include/be_extended_port.h
+++ b/TAO/TAO_IDL/be_include/be_extended_port.h
@@ -25,6 +25,7 @@
#include "ast_extended_port.h"
#include "be_field.h"
+#include "be_porttype.h"
class be_visitor;
@@ -46,6 +47,8 @@ public:
virtual ~be_extended_port (void);
+ be_porttype *port_type (void) const;
+
virtual void destroy (void);
virtual int accept (be_visitor *visitor);
diff --git a/TAO/TAO_IDL/be_include/be_field.h b/TAO/TAO_IDL/be_include/be_field.h
index 610cd6e848c..9e06830d94a 100644
--- a/TAO/TAO_IDL/be_include/be_field.h
+++ b/TAO/TAO_IDL/be_include/be_field.h
@@ -38,6 +38,9 @@ public:
UTL_ScopedName *n,
Visibility vis = vis_NA);
+ // Non-virtual override of frontend method.
+ be_type *field_type (void) const;
+
// Generate debugging ostream operator for members.
void gen_member_ostream_operator (TAO_OutStream *os,
const char *instance_name,
diff --git a/TAO/TAO_IDL/be_include/be_global.h b/TAO/TAO_IDL/be_include/be_global.h
index 0cefc31c420..340a13d784d 100644
--- a/TAO/TAO_IDL/be_include/be_global.h
+++ b/TAO/TAO_IDL/be_include/be_global.h
@@ -199,6 +199,10 @@ public:
static const char *be_get_ciao_exec_idl (
UTL_String *idl_file_name,
bool base_name_only = false);
+
+ static const char *be_get_dds_typesupport_header (
+ UTL_String *idl_file_name,
+ bool base_name_only = false);
const char* skel_export_macro (void) const;
/// Returns the macro name for exporting server side classes in Win32
@@ -441,6 +445,10 @@ public:
const char* ciao_exec_idl_ending (void) const;
// Similar to above, but for CIAO servant and executor
// impl and executor IDL files, if generated.
+
+ void dds_typesupport_hdr_ending (const char* s);
+ const char* dds_typesupport_hdr_ending (void) const;
+ // For generating TypeSupport header file includes.
void use_clonable_in_args (bool clonable);
// Set the clonable_in_args.
@@ -846,6 +854,9 @@ private:
// CIAO executor IDL file name ending. Default is "E.idl".
char* ciao_exec_idl_ending_;
+
+ // DDS TypeSupport header file name ending. Default is "Support.h".
+ char* dds_typesupport_hdr_ending_;
char* output_dir_;
// Directory where all the IDL-Compiler-Generated files are to be
diff --git a/TAO/TAO_IDL/be_include/be_interface.h b/TAO/TAO_IDL/be_include/be_interface.h
index 1453c13461a..698601849c0 100644
--- a/TAO/TAO_IDL/be_include/be_interface.h
+++ b/TAO/TAO_IDL/be_include/be_interface.h
@@ -285,9 +285,9 @@ public:
/// Helper method passed to traverse_inheritance_graph(),
/// collects supported operations and attributes.
- static int facet_op_attr_decl_helper (be_interface *node,
- be_interface *base,
- TAO_OutStream *os);
+ static int op_attr_decl_helper (be_interface *node,
+ be_interface *base,
+ TAO_OutStream *os);
int gen_operation_table (const char *flat_name,
const char *skeleton_class_name);
diff --git a/TAO/TAO_IDL/be_include/be_provides.h b/TAO/TAO_IDL/be_include/be_provides.h
index 48078440ada..317f597f76a 100644
--- a/TAO/TAO_IDL/be_include/be_provides.h
+++ b/TAO/TAO_IDL/be_include/be_provides.h
@@ -21,6 +21,9 @@ public:
virtual ~be_provides (void);
+ // Non-virtual override of frontend method.
+ be_type *provides_type (void) const;
+
// Common code called by visitors.
int gen_facet_svnt_decl (TAO_OutStream &os);
int gen_facet_svnt_defn (TAO_OutStream &os);
diff --git a/TAO/TAO_IDL/be_include/be_publishes.h b/TAO/TAO_IDL/be_include/be_publishes.h
index 96579fb6697..b9ea0e185e6 100644
--- a/TAO/TAO_IDL/be_include/be_publishes.h
+++ b/TAO/TAO_IDL/be_include/be_publishes.h
@@ -20,6 +20,9 @@ public:
virtual ~be_publishes (void);
+ // Non-virtual override of frontend method.
+ be_eventtype *publishes_type (void) const;
+
// Narrowing.
DEF_NARROW_FROM_DECL(be_publishes);
diff --git a/TAO/TAO_IDL/be_include/be_sequence.h b/TAO/TAO_IDL/be_include/be_sequence.h
index 598f89a679e..70c27400f61 100644
--- a/TAO/TAO_IDL/be_include/be_sequence.h
+++ b/TAO/TAO_IDL/be_include/be_sequence.h
@@ -63,6 +63,9 @@ public:
bool local,
bool abstract);
+ // Non-virtual override of frontend method.
+ be_type *base_type (void) const;
+
virtual int create_name (be_typedef *node);
// Create a name for ourselves. If we are typedefed, then we get the name of
// the typedef node, else we generate a name for ourselves.
diff --git a/TAO/TAO_IDL/be_include/be_uses.h b/TAO/TAO_IDL/be_include/be_uses.h
index 3a0fa8b6460..ca8cc8c83ac 100644
--- a/TAO/TAO_IDL/be_include/be_uses.h
+++ b/TAO/TAO_IDL/be_include/be_uses.h
@@ -21,6 +21,9 @@ public:
virtual ~be_uses (void);
+ // Non-virtual override of frontend method.
+ be_type *uses_type (void) const;
+
// Narrowing.
DEF_NARROW_FROM_DECL(be_uses);
diff --git a/TAO/TAO_IDL/be_include/be_util.h b/TAO/TAO_IDL/be_include/be_util.h
index 66610d1c0b4..a9d8de6906d 100644
--- a/TAO/TAO_IDL/be_include/be_util.h
+++ b/TAO/TAO_IDL/be_include/be_util.h
@@ -13,16 +13,19 @@
// Static helper methods used by multiple visitors.
//
// = AUTHOR
-// Gary Maxey
+// Gary Maxey, Jeff Parsons
//
// ============================================================================
#ifndef TAO_BE_UTIL_H
#define TAO_BE_UTIL_H
-#include "be_helper.h"
-#include "be_module.h"
+class TAO_OutStream;
+class be_module;
+class AST_Decl;
+// (JP) Someday these should be consolidated, along with several
+// similar methods scattered throughout the backend.
class be_util
{
public:
@@ -31,6 +34,12 @@ public:
static void
gen_nested_namespace_end (TAO_OutStream *os, be_module *node);
+
+ static void
+ gen_nesting_open (TAO_OutStream &os, AST_Decl *node);
+
+ static void
+ gen_nesting_close (TAO_OutStream &os, AST_Decl *node);
};
diff --git a/TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h b/TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h
index b2502f0bb26..77d2a6bcafa 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h
@@ -25,7 +25,7 @@
#ifndef TAO_BE_VISITOR_CCM_PRE_PROC_H
#define TAO_BE_VISITOR_CCM_PRE_PROC_H
-#include "be_visitor_scope.h"
+#include "be_visitor_component_scope.h"
#include "ast_component.h"
#include "ast_template_common.h"
#include "utl_identifier.h"
@@ -35,7 +35,7 @@ class be_exception;
class UTL_ExceptList;
class AST_Template_Interface;
-class be_visitor_ccm_pre_proc : public be_visitor_scope
+class be_visitor_ccm_pre_proc : public be_visitor_component_scope
{
//
// = TITLE
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component.h b/TAO/TAO_IDL/be_include/be_visitor_component.h
index c51ae8c98cc..92a14b88dfe 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_component.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_component.h
@@ -23,6 +23,7 @@
#define TAO_BE_VISITOR_COMPONENT_H
#include "be_visitor_interface.h"
+#include "be_visitor_component_scope.h"
#include "be_visitor_component/component.h"
#include "be_visitor_component/component_ch.h"
@@ -34,10 +35,23 @@
#include "be_visitor_component/component_ih.h"
#include "be_visitor_component/component_is.h"
#include "be_visitor_component/component_svh.h"
+#include "be_visitor_component/facet_svh.h"
+#include "be_visitor_component/context_svh.h"
+#include "be_visitor_component/servant_svh.h"
#include "be_visitor_component/component_svs.h"
+#include "be_visitor_component/facet_svs.h"
+#include "be_visitor_component/context_svs.h"
+#include "be_visitor_component/servant_svs.h"
#include "be_visitor_component/component_ex_idl.h"
+#include "be_visitor_component/facet_ex_idl.h"
+#include "be_visitor_component/executor_ex_idl.h"
+#include "be_visitor_component/context_ex_idl.h"
#include "be_visitor_component/component_exh.h"
+#include "be_visitor_component/facet_exh.h"
+#include "be_visitor_component/executor_exh.h"
#include "be_visitor_component/component_exs.h"
+#include "be_visitor_component/facet_exs.h"
+#include "be_visitor_component/executor_exs.h"
#include "be_visitor_component/any_op_ch.h"
#include "be_visitor_component/any_op_cs.h"
#include "be_visitor_component/cdr_op_ch.h"
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/component.h b/TAO/TAO_IDL/be_include/be_visitor_component/component.h
index 1bb54989a6a..8991bb75fb4 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_component/component.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/component.h
@@ -36,10 +36,8 @@ class be_visitor_component : public be_visitor_interface
public:
be_visitor_component (be_visitor_context *ctx);
- // constructor
~be_visitor_component (void);
- // destructor
virtual int visit_attribute (be_attribute *node);
// This is the only type of declaration a component may contain.
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/component_ex_idl.h b/TAO/TAO_IDL/be_include/be_visitor_component/component_ex_idl.h
index 7abf9394af6..b6283d55ed4 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_component/component_ex_idl.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/component_ex_idl.h
@@ -22,7 +22,7 @@
#ifndef _BE_COMPONENT_COMPONENT_EX_IDL_H_
#define _BE_COMPONENT_COMPONENT_EX_IDL_H_
-class be_visitor_component_ex_idl : public be_visitor_scope
+class be_visitor_component_ex_idl : public be_visitor_decl
{
//
// = TITLE
@@ -40,40 +40,7 @@ public:
virtual int visit_component (be_component *node);
- /// To regenerate attribute declarations.
- virtual int visit_attribute (be_attribute *node);
-
- /// To regenerate the name of the attribute's referenced
- /// (anonymous) type. Anonymous arrays are not allowed.
- virtual int visit_string (be_string *node);
- virtual int visit_sequence (be_sequence *node);
-
-private:
- void gen_nesting_open (AST_Decl *node);
- void gen_nesting_close (AST_Decl *node);
-
- void gen_facets (void);
-
- void gen_component (void);
- void gen_executor_base (void);
- void gen_supported (void);
- void gen_executor_contents (void);
- void gen_facet_ops (void);
- void gen_consumer_ops (void);
-
- void gen_exception_list (UTL_ExceptList *exceptions,
- const char *prefix = "",
- bool closed = true);
-
- void gen_context (void);
- void gen_publisher_ops (void);
- void gen_emitter_ops (void);
- void gen_receptacle_ops (void);
-
- void gen_executor_derived (void);
-
private:
- be_component *node_;
TAO_OutStream &os_;
};
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/component_exh.h b/TAO/TAO_IDL/be_include/be_visitor_component/component_exh.h
index 6f97ad9725f..48020c07bca 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_component/component_exh.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/component_exh.h
@@ -22,14 +22,16 @@
#ifndef _BE_COMPONENT_COMPONENT_EXH_H_
#define _BE_COMPONENT_COMPONENT_EXH_H_
-class be_visitor_component_exh : public be_visitor_component
+class be_visitor_component_exh
+ : public be_visitor_component_scope
{
//
// = TITLE
// be_visitor_component_exh
//
// = DESCRIPTION
- // This is a concrete visitor to generate the servant header for component.
+ // This is a concrete visitor to generate
+ // the executor implementation header for components.
//
//
public:
@@ -38,43 +40,6 @@ public:
~be_visitor_component_exh (void);
virtual int visit_component (be_component *node);
- virtual int visit_operation (be_operation *node);
- virtual int visit_attribute (be_attribute *node);
-
-private:
- int gen_facets (void);
-
- int gen_facet_ops_attrs (be_interface *node);
-
- int gen_exec_class (void);
-
- int gen_component_attrs_r (AST_Component *node);
-
- void gen_provides_r (AST_Component *node);
-
- void gen_provides (AST_Type *obj,
- const char *port_name);
-
- void gen_consumes_r (AST_Component *node);
-
- void gen_consumes (const char *obj_name,
- const char *port_name);
-
- /// Base class overrides and CIAO-specific code.
- void gen_non_type_specific (void);
-
- void gen_entrypoint (void);
-
- /// Helper method passed to traverse_inheritance_graph(),
- /// collects supported operations and attributes.
- static int op_attr_decl_helper (be_interface *,
- be_interface *,
- TAO_OutStream *);
-
-private:
- be_component *node_;
- TAO_OutStream &os_;
- ACE_CString export_macro_;
};
#endif /* _BE_COMPONENT_COMPONENT_EXH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/component_exs.h b/TAO/TAO_IDL/be_include/be_visitor_component/component_exs.h
index f92b3fa6ed6..2f40c66ea7b 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_component/component_exs.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/component_exs.h
@@ -22,7 +22,8 @@
#ifndef _BE_COMPONENT_COMPONENT_EXS_H_
#define _BE_COMPONENT_COMPONENT_EXS_H_
-class be_visitor_component_exs : public be_visitor_component
+class be_visitor_component_exs
+ : public be_visitor_component_scope
{
//
// = TITLE
@@ -39,44 +40,14 @@ public:
~be_visitor_component_exs (void);
virtual int visit_component (be_component *node);
- virtual int visit_operation (be_operation *node);
- virtual int visit_attribute (be_attribute *node);
-
-private:
- int gen_facets (void);
-
- int gen_facet_ops_attrs (be_interface *node);
-
- int gen_exec_class (void);
-
- int gen_component_attrs_r (AST_Component *node);
-
- void gen_provides_r (AST_Component *node);
-
- void gen_provides (AST_Type *obj,
- Identifier *port_id);
-
- void gen_consumes_r (AST_Component *node);
-
- void gen_consumes (AST_Type *obj,
- Identifier *port_id);
-
- /// Base class overrides and CIAO-specific code.
- void gen_non_type_specific (void);
-
- void gen_entrypoint (void);
-
-private:
- be_component *node_;
- be_interface *op_scope_;
- TAO_OutStream &os_;
- const char *comment_border_;
- const char *your_code_here_;
- ACE_CString export_macro_;
};
+// =============================================
+
/// Worker class passed to traverse_inheritance_graph(),
-/// collects supported operations and attributes.
+/// collects supported operations and attributes. Not used
+/// by this visitor but by 2 visitors spawned from this one,
+/// hence the central location for the code.
class Component_Exec_Op_Attr_Generator
: public TAO_IDL_Inheritance_Hierarchy_Worker
{
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/component_svh.h b/TAO/TAO_IDL/be_include/be_visitor_component/component_svh.h
index 28d95dadfe6..935bcc0179c 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_component/component_svh.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/component_svh.h
@@ -38,51 +38,13 @@ public:
~be_visitor_component_svh (void);
virtual int visit_component (be_component *node);
- virtual int visit_operation (be_operation *node);
- virtual int visit_attribute (be_attribute *node);
- virtual int visit_extended_port (be_extended_port *node);
- virtual int visit_mirror_port (be_mirror_port *node);
private:
- int gen_facets (void);
-
- void gen_context_class (void);
-
- void gen_context_r (AST_Component *node);
-
- int gen_servant_class (void);
-
- int gen_servant_r (AST_Component *node);
-
- int gen_component_attrs (AST_Component *node);
-
- void gen_ports (AST_Component *node,
- AST_Decl::NodeType nt,
- bool in_servant);
-
- void gen_provides (AST_Provides *p);
-
- void gen_uses (AST_Uses *u,
- bool in_servant);
-
- void gen_publishes (AST_Publishes *p,
- bool in_servant);
-
- void gen_consumes (AST_Consumes *c);
-
- void gen_emits (AST_Emits *e,
- bool in_servant);
-
- /// Base class overrides and CIAO-specific code.
- void gen_non_type_specific (void);
-
- void gen_entrypoint (void);
+ void gen_entrypoint (be_component *node);
private:
- be_component *node_;
TAO_OutStream &os_;
ACE_CString export_macro_;
- bool in_ancestor_;
};
#endif /* _BE_COMPONENT_COMPONENT_SVH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/component_svs.h b/TAO/TAO_IDL/be_include/be_visitor_component/component_svs.h
index 7ab586b7111..8456b92b55f 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_component/component_svs.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/component_svs.h
@@ -39,134 +39,14 @@ public:
~be_visitor_component_svs (void);
virtual int visit_component (be_component *node);
- virtual int visit_operation (be_operation *node);
- virtual int visit_attribute (be_attribute *node);
private:
- int gen_facets (void);
+ void gen_entrypoint (AST_Component *node);
- int gen_facet_ops_attrs (be_interface *node);
-
- void gen_context_class (void);
-
- int gen_servant_class (void);
-
- int gen_component_attrs_r (AST_Component *node);
-
- int gen_component_attrs (AST_Component *node);
-
- void gen_provides_top (void);
-
- void gen_facet_executor_block (const char *port_name);
-
- void gen_provides_r (AST_Component *node);
-
- void gen_provides (AST_Provides *p);
-
- void gen_uses_context_r (AST_Component *node);
-
- void gen_uses_context (AST_Uses *u);
-
- void gen_uses_context_simplex (AST_Type *obj,
- const char *port_name);
-
- void gen_uses_context_multiplex (AST_Type *obj,
- const char *port_name);
-
- void gen_uses_servant_top (void);
-
- void gen_connect_block (AST_Uses *u);
-
- void gen_disconnect_block (AST_Uses *u);
-
- void gen_uses_servant_r (AST_Component *node);
-
- void gen_uses_servant (AST_Uses *u);
-
- void gen_receptacle_description (AST_Uses *u,
- ACE_CDR::ULong slot);
-
- void gen_publishes_context_r (AST_Component *node);
-
- void gen_publishes_context (AST_Publishes *p);
-
- void gen_publishes_servant_top (void);
-
- void gen_subscribe_block (AST_Publishes *p);
-
- void gen_unsubscribe_block (AST_Publishes *p);
-
- void gen_event_source_description (AST_Publishes *p,
- ACE_CDR::ULong slot);
-
- void gen_publishes_servant_r (AST_Component *node);
-
- void gen_publishes_servant (AST_Publishes *p);
-
- void gen_consumes_r (AST_Component *node);
-
- void gen_consumes (AST_Consumes *c);
-
- void gen_emits_context_r (AST_Component *node);
-
- void gen_emits_context (AST_Emits *e);
-
- void gen_emits_servant_top (void);
-
- void gen_connect_consumer_block (AST_Emits *e);
-
- void gen_disconnect_consumer_block (AST_Emits *e);
-
- void gen_emitter_description (AST_Emits *e,
- ACE_CDR::ULong slot);
-
- void gen_emits_servant_r (AST_Component *node);
-
- void gen_emits_servant (AST_Emits *e);
-
- void gen_attr_set_r (AST_Component *node);
-
- void gen_populate_r (AST_Component *node);
-
- void gen_entrypoint (void);
-
- void gen_all_factory_registration (void);
- void gen_one_factory_registration (AST_Type *t);
-
- void gen_swapping_get_consumers_r (AST_Component *node);
- void gen_swapping_get_comsumer_block (const char *port_name);
-
- void compute_slots (AST_Component *node);
-
private:
- be_component *node_;
- be_interface *op_scope_;
TAO_OutStream &os_;
ACE_CString export_macro_;
- static bool in_facets_;
- bool swapping_;
- ACE_CDR::ULong n_provides_;
- ACE_CDR::ULong n_uses_;
- ACE_CDR::ULong n_publishes_;
- ACE_CDR::ULong n_emits_;
- ACE_CDR::ULong n_consumes_;
-};
-
-/// Worker class passed to traverse_inheritance_graph(),
-/// collects supported operations and attributes.
-class Component_Op_Attr_Generator
- : public TAO_IDL_Inheritance_Hierarchy_Worker
-{
-public:
- Component_Op_Attr_Generator (be_visitor_scope * visitor);
-
- virtual int emit (be_interface * derived_interface,
- TAO_OutStream * os,
- be_interface * base_interface);
-
-private:
- be_visitor_scope * visitor_;
};
-
+
#endif /* _BE_COMPONENT_COMPONENT_SVS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/context_ex_idl.h b/TAO/TAO_IDL/be_include/be_visitor_component/context_ex_idl.h
new file mode 100644
index 00000000000..3faaf56c0f3
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/context_ex_idl.h
@@ -0,0 +1,49 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// context_ex_idl.h
+//
+// = DESCRIPTION
+// Provides code generation for the context class
+// in the CIAO executor IDL.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_COMPONENT_CONTEXT_EX_IDL_H_
+#define _BE_COMPONENT_CONTEXT_EX_IDL_H_
+
+class be_visitor_context_ex_idl
+ : public be_visitor_component_scope
+{
+ //
+ // = TITLE
+ // be_visitor_context_ex_idl
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the
+ // CIAO context IDL.
+ //
+ //
+public:
+ be_visitor_context_ex_idl (be_visitor_context *ctx);
+
+ ~be_visitor_context_ex_idl (void);
+
+ virtual int visit_component (be_component *node);
+ virtual int visit_uses (be_uses *node);
+ virtual int visit_publishes (be_publishes *node);
+ virtual int visit_emits (be_emits *node);
+};
+
+#endif /_BE_COMPONENT_CONTEXT_EX_IDL_H_ */
+
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/context_svh.h b/TAO/TAO_IDL/be_include/be_visitor_component/context_svh.h
new file mode 100644
index 00000000000..f8bdf732279
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/context_svh.h
@@ -0,0 +1,49 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// context_svh.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Component node.
+// This provides for code generation for the Context
+// class declaration
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_COMPONENT_CONTEXT_SVH_H_
+#define _BE_COMPONENT_CONTEXT_SVH_H_
+
+class be_visitor_context_svh : public be_visitor_component_scope
+{
+ //
+ // = TITLE
+ // be_visitor_context_svh
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the context class decl
+ // for a component.
+ //
+ //
+public:
+ be_visitor_context_svh (be_visitor_context *ctx);
+
+ ~be_visitor_context_svh (void);
+
+ virtual int visit_component (be_component *node);
+ virtual int visit_uses (be_uses *node);
+ virtual int visit_publishes (be_publishes *node);
+ virtual int visit_emits (be_emits *node);
+};
+
+#endif /* _BE_COMPONENT_CONTEXT_SVH_H_ */
+
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/context_svs.h b/TAO/TAO_IDL/be_include/be_visitor_component/context_svs.h
new file mode 100644
index 00000000000..5c540859839
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/context_svs.h
@@ -0,0 +1,77 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// context_svs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Component node.
+// This provides for code generation for the Context
+// class definition
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_COMPONENT_CONTEXT_SVS_H_
+#define _BE_COMPONENT_CONTEXT_SVS_H_
+
+class be_visitor_context_svs : public be_visitor_component_scope
+{
+ //
+ // = TITLE
+ // be_visitor_context_svs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the context class defn
+ // for a component.
+ //
+ //
+public:
+ be_visitor_context_svs (be_visitor_context *ctx);
+
+ ~be_visitor_context_svs (void);
+
+ virtual int visit_component (be_component *node);
+ virtual int visit_uses (be_uses *node);
+ virtual int visit_publishes (be_publishes *node);
+ virtual int visit_emits (be_emits *node);
+
+private:
+ void gen_uses_simplex (AST_Type *obj,
+ const char *port_name);
+ void gen_uses_multiplex (AST_Type *obj,
+ const char *port_name);
+};
+
+// ======================================================
+
+class be_visitor_swapping_get_consumer
+ : public be_visitor_component_scope
+{
+ //
+ // = TITLE
+ // be_visitor_swapping_get_comsumer
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate a block of code
+ // for each publishes port, including inherited ports.
+ //
+ //
+public:
+ be_visitor_swapping_get_consumer (be_visitor_context *ctx);
+
+ ~be_visitor_swapping_get_consumer (void);
+
+ virtual int visit_publishes (be_publishes *node);
+};
+
+#endif /* _BE_COMPONENT_CONTEXT_SVS_H_ */
+
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/executor_ex_idl.h b/TAO/TAO_IDL/be_include/be_visitor_component/executor_ex_idl.h
new file mode 100644
index 00000000000..04dc6a3e8f1
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/executor_ex_idl.h
@@ -0,0 +1,62 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// executor_ex_idl.h
+//
+// = DESCRIPTION
+// Provides code generation for components in the CIAO executor IDL.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_COMPONENT_EXECUTOR_EX_IDL_H_
+#define _BE_COMPONENT_EXECUTOR_EX_IDL_H_
+
+class be_visitor_executor_ex_idl
+ : public be_visitor_component_scope
+{
+ //
+ // = TITLE
+ // be_visitor_executor_ex_idl
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the
+ // CIAO executor class IDL.
+ //
+ //
+public:
+ be_visitor_executor_ex_idl (be_visitor_context *ctx);
+
+ ~be_visitor_executor_ex_idl (void);
+
+ virtual int visit_component (be_component *node);
+
+ /// To regenerate attribute declarations.
+ virtual int visit_attribute (be_attribute *node);
+
+ /// To regenerate the name of the attribute's referenced
+ /// (anonymous) type. Anonymous arrays are not allowed.
+ virtual int visit_string (be_string *node);
+ virtual int visit_sequence (be_sequence *node);
+
+ virtual int visit_provides (be_provides *node);
+ virtual int visit_consumes (be_consumes *node);
+
+private:
+ void gen_supported (void);
+ void gen_exception_list (UTL_ExceptList *exceptions,
+ const char *prefix = "",
+ bool closed = true);
+};
+
+#endif /_BE_COMPONENT_EXECUTOR_EX_IDL_H_ */
+
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/executor_exh.h b/TAO/TAO_IDL/be_include/be_visitor_component/executor_exh.h
new file mode 100644
index 00000000000..641d1c9cf74
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/executor_exh.h
@@ -0,0 +1,48 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO_IDL_BE
+//
+// = FILENAME
+// executor_exh.h
+//
+// = DESCRIPTION
+// This provides code generation in the exec impl header,
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_COMPONENT_EXECUTOR_EXH_H_
+#define _BE_COMPONENT_EXECUTOR_EXH_H_
+
+class be_visitor_executor_exh
+ : public be_visitor_component_scope
+{
+ //
+ // = TITLE
+ // be_visitor_executor_exh
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate
+ // the executor implementation class declaration.
+ //
+ //
+public:
+ be_visitor_executor_exh (be_visitor_context *ctx);
+
+ ~be_visitor_executor_exh (void);
+
+ virtual int visit_attribute (be_attribute *node);
+ virtual int visit_component (be_component *node);
+ virtual int visit_provides (be_provides *node);
+ virtual int visit_consumes (be_consumes *node);
+};
+
+#endif /* _BE_COMPONENT_EXECUTOR_EXH_H_ */
+
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/executor_exs.h b/TAO/TAO_IDL/be_include/be_visitor_component/executor_exs.h
new file mode 100644
index 00000000000..bd8c6871dfa
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/executor_exs.h
@@ -0,0 +1,54 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO_IDL_BE
+//
+// = FILENAME
+// executor_exs.h
+//
+// = DESCRIPTION
+// This provides code generation in the exec impl source.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_COMPONENT_EXECUTOR_EXS_H_
+#define _BE_COMPONENT_EXECUTOR_EXS_H_
+
+class be_visitor_executor_exs
+ : public be_visitor_component_scope
+{
+ //
+ // = TITLE
+ // be_visitor_executor_exs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate
+ // the executor implementation source.
+ //
+ //
+public:
+ be_visitor_executor_exs (be_visitor_context *ctx);
+
+ ~be_visitor_executor_exs (void);
+
+ virtual int visit_operation (be_operation *node);
+ virtual int visit_attribute (be_attribute *node);
+ virtual int visit_component (be_component *node);
+ virtual int visit_provides (be_provides *node);
+ virtual int visit_consumes (be_consumes *node);
+
+private:
+ be_interface *op_scope_;
+ const char *comment_border_;
+ const char *your_code_here_;
+};
+
+#endif /* _BE_COMPONENT_EXECUTOR_EXS_H_ */
+
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/facet_ex_idl.h b/TAO/TAO_IDL/be_include/be_visitor_component/facet_ex_idl.h
new file mode 100644
index 00000000000..cf2a3fa07ca
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/facet_ex_idl.h
@@ -0,0 +1,46 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// facet_ex_idl.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Component node.
+// Provides code generation for facets in the CIAO executor IDL
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_COMPONENT_FACET_EX_IDL_H_
+#define _BE_COMPONENT_FACET_EX_IDL_H_
+
+class be_visitor_facet_ex_idl
+ : public be_visitor_component_scope
+{
+ //
+ // = TITLE
+ // be_visitor_facet_ex_idl
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the
+ // CIAO executor IDL for facets.
+ //
+ //
+public:
+ be_visitor_facet_ex_idl (be_visitor_context *ctx);
+
+ ~be_visitor_facet_ex_idl (void);
+
+ virtual int visit_provides (be_provides *node);
+};
+
+#endif /_BE_COMPONENT_FACET_EX_IDL_H_ */
+
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/facet_exh.h b/TAO/TAO_IDL/be_include/be_visitor_component/facet_exh.h
new file mode 100644
index 00000000000..972ac12fcf3
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/facet_exh.h
@@ -0,0 +1,45 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO_IDL_BE
+//
+// = FILENAME
+// facet_exh.h
+//
+// = DESCRIPTION
+// This provides code generation for facets in the exec impl header,
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_COMPONENT_FACET_EXH_H_
+#define _BE_COMPONENT_FACET_EXH_H_
+
+class be_visitor_facet_exh
+ : public be_visitor_component_scope
+{
+ //
+ // = TITLE
+ // be_visitor_facet_exh
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate
+ // the executor implementation header for facets.
+ //
+ //
+public:
+ be_visitor_facet_exh (be_visitor_context *ctx);
+
+ ~be_visitor_facet_exh (void);
+
+ virtual int visit_provides (be_provides *node);
+};
+
+#endif /* _BE_COMPONENT_FACET_EXH_H_ */
+
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/facet_exs.h b/TAO/TAO_IDL/be_include/be_visitor_component/facet_exs.h
new file mode 100644
index 00000000000..4a0966f233f
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/facet_exs.h
@@ -0,0 +1,52 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO_IDL_BE
+//
+// = FILENAME
+// facet_exs.h
+//
+// = DESCRIPTION
+// This provides code generation for facets in the exec impl source.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_COMPONENT_FACET_EXS_H_
+#define _BE_COMPONENT_FACET_EXS_H_
+
+class be_visitor_facet_exs
+ : public be_visitor_component_scope
+{
+ //
+ // = TITLE
+ // be_visitor_facet_exs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate
+ // the executor implementation source for facets.
+ //
+ //
+public:
+ be_visitor_facet_exs (be_visitor_context *ctx);
+
+ ~be_visitor_facet_exs (void);
+
+ virtual int visit_operation (be_operation *node);
+ virtual int visit_attribute (be_attribute *node);
+ virtual int visit_provides (be_provides *node);
+
+private:
+ be_interface *op_scope_;
+ const char *comment_border_;
+ const char *your_code_here_;
+};
+
+#endif /* _BE_COMPONENT_FACET_EXS_H_ */
+
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/facet_svh.h b/TAO/TAO_IDL/be_include/be_visitor_component/facet_svh.h
new file mode 100644
index 00000000000..5c57ea3e0e6
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/facet_svh.h
@@ -0,0 +1,46 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// facet_svh.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Component node.
+// This provides for code generation for the facet servant
+// class declaration
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_COMPONENT_FACET_SVH_H_
+#define _BE_COMPONENT_FACET_SVH_H_
+
+class be_visitor_facet_svh : public be_visitor_component_scope
+{
+ //
+ // = TITLE
+ // be_visitor_facet_svh
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the facet servant decl
+ // for a component.
+ //
+ //
+public:
+ be_visitor_facet_svh (be_visitor_context *ctx);
+
+ ~be_visitor_facet_svh (void);
+
+ virtual int visit_provides (be_provides *node);
+};
+
+#endif /* _BE_COMPONENT_FACET_SVH_H_ */
+
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/facet_svs.h b/TAO/TAO_IDL/be_include/be_visitor_component/facet_svs.h
new file mode 100644
index 00000000000..9dbc7dc64f5
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/facet_svs.h
@@ -0,0 +1,46 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// facet_svs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Component node.
+// This provides for code generation for the facet servant
+// class definition
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_COMPONENT_FACET_SVS_H_
+#define _BE_COMPONENT_FACET_SVS_H_
+
+class be_visitor_facet_svs : public be_visitor_component_scope
+{
+ //
+ // = TITLE
+ // be_visitor_facet_svs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the facet servant defn
+ // for a component.
+ //
+ //
+public:
+ be_visitor_facet_svs (be_visitor_context *ctx);
+
+ ~be_visitor_facet_svs (void);
+
+ virtual int visit_provides (be_provides *node);
+};
+
+#endif /* _BE_COMPONENT_FACET_SVS_H_ */
+
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/servant_svh.h b/TAO/TAO_IDL/be_include/be_visitor_component/servant_svh.h
new file mode 100644
index 00000000000..1eb8267dca2
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/servant_svh.h
@@ -0,0 +1,56 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// servant_svh.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Component node.
+// This provides for code generation for the Servant
+// class declaration
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_COMPONENT_SERVANT_SVH_H_
+#define _BE_COMPONENT_SERVANT_SVH_H_
+
+class be_visitor_servant_svh : public be_visitor_component_scope
+{
+ //
+ // = TITLE
+ // be_visitor_servant_svh
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the servant class decl
+ // for a component.
+ //
+ //
+public:
+ be_visitor_servant_svh (be_visitor_context *ctx);
+
+ ~be_visitor_servant_svh (void);
+
+ virtual int visit_component (be_component *node);
+ virtual int visit_attribute (be_attribute *node);
+ virtual int visit_provides (be_provides *node);
+ virtual int visit_uses (be_uses *node);
+ virtual int visit_publishes (be_publishes *node);
+ virtual int visit_emits (be_emits *node);
+ virtual int visit_consumes (be_consumes *node);
+
+private:
+ /// Base class overrides and CIAO-specific code.
+ void gen_non_type_specific (void);
+};
+
+#endif /* _BE_COMPONENT_SERVANT_SVH_H_ */
+
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component/servant_svs.h b/TAO/TAO_IDL/be_include/be_visitor_component/servant_svs.h
new file mode 100644
index 00000000000..86492aaebf2
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component/servant_svs.h
@@ -0,0 +1,281 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// servant_svs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Component node.
+// This provides for code generation for the Servant
+// class definition
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_COMPONENT_SERVANT_SVS_H_
+#define _BE_COMPONENT_SERVANT_SVS_H_
+
+class be_visitor_servant_svs
+ : public be_visitor_component_scope
+{
+ //
+ // = TITLE
+ // be_visitor_servant_svs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the servant class decl
+ // for a component.
+ //
+ //
+public:
+ be_visitor_servant_svs (be_visitor_context *ctx);
+
+ ~be_visitor_servant_svs (void);
+
+ virtual int visit_component (be_component *node);
+ virtual int visit_operation (be_operation *node);
+ virtual int visit_attribute (be_attribute *node);
+ virtual int visit_provides (be_provides *node);
+ virtual int visit_uses (be_uses *node);
+ virtual int visit_publishes (be_publishes *node);
+ virtual int visit_emits (be_emits *node);
+ virtual int visit_consumes (be_consumes *node);
+
+private:
+ void compute_slots (AST_Component *node);
+
+ void gen_provides_top (void);
+ void gen_uses_top (void);
+ void gen_publishes_top (void);
+ void gen_emits_top (void);
+
+private:
+ be_interface *op_scope_;
+
+ // Not used for now, but might be useful if generated
+ // code is optimized.
+ ACE_CDR::ULong n_provides_;
+ ACE_CDR::ULong n_uses_;
+ ACE_CDR::ULong n_publishes_;
+ ACE_CDR::ULong n_emits_;
+ ACE_CDR::ULong n_consumes_;
+};
+
+// ======================================================
+
+class be_visitor_obv_factory_reg
+ : public be_visitor_component_scope
+{
+public:
+ be_visitor_obv_factory_reg (be_visitor_context *ctx);
+
+ ~be_visitor_obv_factory_reg (void);
+
+ virtual int visit_publishes (be_publishes *node);
+ virtual int visit_emits (be_emits *node);
+ virtual int visit_consumes (be_consumes *node);
+
+private:
+ void gen_obv_factory_registration (AST_Type *t);
+};
+
+// ======================================================
+
+class be_visitor_attr_set : public be_visitor_component_scope
+{
+public:
+ be_visitor_attr_set (be_visitor_context *ctx);
+
+ ~be_visitor_attr_set (void);
+
+ virtual int visit_attribute (be_attribute *node);
+
+ // This visitor has nothing to do with ports, so we
+ // can override these base class methods to be no-ops.
+ virtual int visit_extended_port (be_extended_port *node);
+ virtual int visit_mirror_port (be_mirror_port *node);
+ virtual int visit_porttype (be_porttype *node);
+};
+
+// ======================================================
+
+class be_visitor_facet_executor_block
+ : public be_visitor_component_scope
+{
+public:
+ be_visitor_facet_executor_block (be_visitor_context *ctx);
+
+ ~be_visitor_facet_executor_block (void);
+
+ virtual int visit_provides (be_provides *node);
+};
+
+// ======================================================
+
+class be_visitor_connect_block
+ : public be_visitor_component_scope
+{
+public:
+ be_visitor_connect_block (be_visitor_context *ctx);
+
+ ~be_visitor_connect_block (void);
+
+ virtual int visit_uses (be_uses *node);
+};
+
+// ======================================================
+
+class be_visitor_disconnect_block
+ : public be_visitor_component_scope
+{
+public:
+ be_visitor_disconnect_block (be_visitor_context *ctx);
+
+ ~be_visitor_disconnect_block (void);
+
+ virtual int visit_uses (be_uses *node);
+};
+
+// ======================================================
+
+class be_visitor_receptacle_desc
+ : public be_visitor_component_scope
+{
+public:
+ be_visitor_receptacle_desc (be_visitor_context *ctx);
+
+ ~be_visitor_receptacle_desc (void);
+
+ virtual int visit_uses (be_uses *node);
+
+private:
+ ACE_CDR::ULong slot_;
+};
+
+// ======================================================
+
+class be_visitor_subscribe_block
+ : public be_visitor_component_scope
+{
+public:
+ be_visitor_subscribe_block (be_visitor_context *ctx);
+
+ ~be_visitor_subscribe_block (void);
+
+ virtual int visit_publishes (be_publishes *node);
+};
+
+// ======================================================
+
+class be_visitor_unsubscribe_block
+ : public be_visitor_component_scope
+{
+public:
+ be_visitor_unsubscribe_block (be_visitor_context *ctx);
+
+ ~be_visitor_unsubscribe_block (void);
+
+ virtual int visit_publishes (be_publishes *node);
+};
+
+// ======================================================
+
+class be_visitor_event_source_desc
+ : public be_visitor_component_scope
+{
+public:
+ be_visitor_event_source_desc (be_visitor_context *ctx);
+
+ ~be_visitor_event_source_desc (void);
+
+ virtual int visit_publishes (be_publishes *node);
+
+private:
+ ACE_CDR::ULong slot_;
+};
+
+// ======================================================
+
+class be_visitor_connect_consumer_block
+ : public be_visitor_component_scope
+{
+public:
+ be_visitor_connect_consumer_block (be_visitor_context *ctx);
+
+ ~be_visitor_connect_consumer_block (void);
+
+ virtual int visit_emits (be_emits *node);
+};
+
+// ======================================================
+
+class be_visitor_disconnect_consumer_block
+ : public be_visitor_component_scope
+{
+public:
+ be_visitor_disconnect_consumer_block (be_visitor_context *ctx);
+
+ ~be_visitor_disconnect_consumer_block (void);
+
+ virtual int visit_emits (be_emits *node);
+};
+
+// ======================================================
+
+class be_visitor_emitter_desc
+ : public be_visitor_component_scope
+{
+public:
+ be_visitor_emitter_desc (be_visitor_context *ctx);
+
+ ~be_visitor_emitter_desc (void);
+
+ virtual int visit_emits (be_emits *node);
+
+private:
+ ACE_CDR::ULong slot_;
+};
+
+// ======================================================
+
+class be_visitor_populate_port_tables
+ : public be_visitor_component_scope
+{
+public:
+ be_visitor_populate_port_tables (be_visitor_context *ctx);
+
+ ~be_visitor_populate_port_tables (void);
+
+ virtual int visit_provides (be_provides *node);
+
+ virtual int visit_consumes (be_consumes *node);
+};
+
+// ======================================================
+
+/// Worker class passed to traverse_inheritance_graph(),
+/// collects supported operations and attributes.
+class Component_Op_Attr_Generator
+ : public TAO_IDL_Inheritance_Hierarchy_Worker
+{
+public:
+ Component_Op_Attr_Generator (be_visitor_scope * visitor);
+
+ virtual int emit (be_interface * derived_interface,
+ TAO_OutStream * os,
+ be_interface * base_interface);
+
+private:
+ be_visitor_scope * visitor_;
+};
+
+#endif /* _BE_COMPONENT_SERVANT_SVS_H_ */
+
diff --git a/TAO/TAO_IDL/be_include/be_visitor_component_scope.h b/TAO/TAO_IDL/be_include/be_visitor_component_scope.h
new file mode 100644
index 00000000000..e442b85ec8f
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_component_scope.h
@@ -0,0 +1,85 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_component_scope.h
+//
+// = DESCRIPTION
+// Base class for visitors that need to visit the scope of a
+// component and its ancestors, if any.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_COMPONENT_COMPONENT_SCOPE_H_
+#define _BE_COMPONENT_COMPONENT_SCOPE_H_
+
+#include "ace/SString.h"
+
+#include "be_visitor_scope.h"
+
+class be_visitor_component_scope : public be_visitor_scope
+{
+ //
+ // = TITLE
+ // be_visitor_component_scope
+ //
+ // = DESCRIPTION
+ // This is an abstract visitor providing a scope visitation
+ // method that traverses the base component recursively.
+ //
+protected:
+ be_visitor_component_scope (be_visitor_context *ctx);
+
+ virtual ~be_visitor_component_scope (void);
+
+public:
+ virtual int visit_extended_port (be_extended_port *node);
+ virtual int visit_mirror_port (be_mirror_port *node);
+
+ // Automatically recurses to the ancestor scopes, if any.
+ int visit_component_scope (be_component *node);
+
+ // These two methods are used instead of overriding
+ // visit_porttype so we can traverse a porttype only
+ // when it is referenced.
+
+ int visit_porttype_scope (be_porttype *node);
+
+ // Swaps uses for provides members and vice versa.S
+ int visit_porttype_scope_mirror (be_porttype *node);
+
+ // This override is used to prefix a provides or uses
+ // node's local name with the name of the port or
+ // mirrorport node that may contain reference the
+ // containing porttype.
+ // TODO - support nested ports, if they are allowed.
+ virtual int pre_process (be_decl *);
+
+protected:
+ void gen_svnt_entrypoint_decl (void);
+ void gen_svnt_entrypoint_defn (void);
+ void gen_exec_entrypoint_decl (void);
+ void gen_exec_entrypoint_defn (void);
+
+protected:
+ be_component *node_;
+ TAO_OutStream &os_;
+ ACE_CString export_macro_;
+ bool swapping_;
+ bool static_config_;
+
+private:
+ ACE_CString current_port_name_;
+};
+
+#endif /* _BE_COMPONENT_COMPONENT_SCOPE_H_ */
+
diff --git a/TAO/TAO_IDL/be_include/be_visitor_connector.h b/TAO/TAO_IDL/be_include/be_visitor_connector.h
new file mode 100644
index 00000000000..bd625551215
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_connector.h
@@ -0,0 +1,35 @@
+/* -*- c++ -*- */
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// be_visitor_connector.h
+//
+// = DESCRIPTION
+// Concrete visitors for the Connector
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef TAO_BE_VISITOR_CONNECTOR_H
+#define TAO_BE_VISITOR_CONNECTOR_H
+
+#include "ace/SString.h"
+
+#include "be_helper.h"
+#include "be_extern.h"
+
+#include "be_visitor_component_scope.h"
+
+#include "be_visitor_connector/connector_dds_exh.h"
+#include "be_visitor_connector/connector_dds_exs.h"
+
+#endif /* TAO_BE_VISITOR_CONNECTOR_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_connector/connector_dds_exh.h b/TAO/TAO_IDL/be_include/be_visitor_connector/connector_dds_exh.h
new file mode 100644
index 00000000000..2c7071d3f94
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_connector/connector_dds_exh.h
@@ -0,0 +1,48 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO_IDL_BE
+//
+// = FILENAME
+// connector_dds_exh.h
+//
+// = DESCRIPTION
+// Concrete visitor for the DDS Connector node.
+// This provides for code generation in the exec impl header
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_CONNECTOR_CONNECTOR_DDS_EXH_H_
+#define _BE_CONNECTOR_CONNECTOR_DDS_EXH_H_
+
+class be_visitor_context;
+
+class be_visitor_connector_dds_exh
+ : public be_visitor_component_scope
+{
+ //
+ // = TITLE
+ // be_visitor_connector_dds_exh
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate
+ // the executor implementation header for DDS connectors.
+ //
+ //
+public:
+ be_visitor_connector_dds_exh (be_visitor_context *ctx);
+
+ ~be_visitor_connector_dds_exh (void);
+
+ virtual int visit_connector (be_connector *node);
+};
+
+#endif /* _BE_CONNECTOR_CONNECTOR_DDS_EXH_H_ */
+
diff --git a/TAO/TAO_IDL/be_include/be_visitor_connector/connector_dds_exs.h b/TAO/TAO_IDL/be_include/be_visitor_connector/connector_dds_exs.h
new file mode 100644
index 00000000000..66a996ccc8a
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_connector/connector_dds_exs.h
@@ -0,0 +1,46 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO_IDL_BE
+//
+// = FILENAME
+// connector_dds_exs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the DDS Connector node.
+// This provides for code generation in the exec impl source.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_CONNECTOR_CONNECTOR_DDS_EXS_H_
+#define _BE_CONNECTOR_CONNECTOR_DDS_EXS_H_
+
+class be_visitor_connector_dds_exs
+ : public be_visitor_component_scope
+{
+ //
+ // = TITLE
+ // be_visitor_connector_dds_exs
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate
+ // the executor implementation source for connectors.
+ //
+ //
+public:
+ be_visitor_connector_dds_exs (be_visitor_context *ctx);
+
+ ~be_visitor_connector_dds_exs (void);
+
+ virtual int visit_connector (be_connector *node);
+};
+
+#endif /* _BE_CONNECTOR_CONNECTOR_DDS_EXS_H_ */
+
diff --git a/TAO/TAO_IDL/be_include/be_visitor_extended_port.h b/TAO/TAO_IDL/be_include/be_visitor_extended_port.h
deleted file mode 100644
index badcd3d50f5..00000000000
--- a/TAO/TAO_IDL/be_include/be_visitor_extended_port.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* -*- c++ -*- */
-//
-// $Id$
-//
-
-// ============================================================================
-//
-// = LIBRARY
-// TAO IDL
-//
-// = FILENAME
-// be_visitor_extended_port.h
-//
-// = DESCRIPTION
-// Concrete visitors for the extended port class
-//
-// = AUTHOR
-// Jeff Parsons
-//
-// ============================================================================
-
-#ifndef TAO_BE_VISITOR_EXTENDED_PORT_H
-#define TAO_BE_VISITOR_EXTENDED_PORT_H
-
-#include "ast_template_common.h"
-
-#include "be_porttype.h"
-#include "be_extended_port.h"
-#include "be_provides.h"
-
-#include "be_visitor_scope.h"
-#include "be_visitor_context.h"
-
-#include "be_visitor_extended_port/extended_port.h"
-#include "be_visitor_extended_port/extended_port_svh.h"
-#include "be_visitor_extended_port/extended_port_svs.h"
-
-#endif /* TAO_BE_VISITOR_EXTENDED_PORT_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_extended_port/extended_port.h b/TAO/TAO_IDL/be_include/be_visitor_extended_port/extended_port.h
deleted file mode 100644
index aa85d4ec558..00000000000
--- a/TAO/TAO_IDL/be_include/be_visitor_extended_port/extended_port.h
+++ /dev/null
@@ -1,48 +0,0 @@
-//
-// $Id$
-//
-/* -*- c++ -*- */
-// ============================================================================
-//
-// = LIBRARY
-// TAO IDL
-//
-// = FILENAME
-// extended_port.h
-//
-// = DESCRIPTION
-// Base class visitor for the extended port node.
-//
-// = AUTHOR
-// Jeff Parsons
-//
-// ============================================================================
-
-#ifndef _BE_VISITOR_EXTENDED_PORT_EXTENEDED_PORT_H_
-#define _BE_VISITOR_EXTENDED_PORT_EXTENEDED_PORT_H_
-
-class be_visitor_extended_port
- : public be_visitor_scope
-{
- //
- // = TITLE
- // be_visitor_extended_port
- //
- // = DESCRIPTION
- // This is a base class visitor for other extended port
- // visitors.
- //
- //
-protected:
- be_visitor_extended_port (be_visitor_context *ctx);
-
- ~be_visitor_extended_port (void);
-
-protected:
- AST_Template_Common::T_ARGLIST *template_args_;
- be_porttype *port_type_;
-};
-
-#endif /* _BE_VISITOR_EXTENDED_PORT_EXTENEDED_PORT_H_ */
-
-
diff --git a/TAO/TAO_IDL/be_include/be_visitor_extended_port/extended_port_svh.h b/TAO/TAO_IDL/be_include/be_visitor_extended_port/extended_port_svh.h
deleted file mode 100644
index e8b23a71c19..00000000000
--- a/TAO/TAO_IDL/be_include/be_visitor_extended_port/extended_port_svh.h
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-// $Id$
-//
-/* -*- c++ -*- */
-// ============================================================================
-//
-// = LIBRARY
-// TAO IDL
-//
-// = FILENAME
-// extended_port_svh.h
-//
-// = DESCRIPTION
-// Concrete visitor for the extended port node.
-// This provides for code generation in the servant header
-//
-// = AUTHOR
-// Jeff Parsons
-//
-// ============================================================================
-
-#ifndef _BE_VISITOR_EXTENDED_PORT_EXTENEDED_PORT_SVH_H_
-#define _BE_VISITOR_EXTENDED_PORT_EXTENEDED_PORT_SVH_H_
-
-class be_visitor_extended_port_facet_svh
- : public be_visitor_extended_port
-{
- //
- // = TITLE
- // be_visitor_extended_port_facet_svh
- //
- // = DESCRIPTION
- // This is a concrete visitor to generate the facet
- // classes for an extended port.
- //
- //
-public:
- be_visitor_extended_port_facet_svh (be_visitor_context *ctx);
-
- ~be_visitor_extended_port_facet_svh (void);
-
- virtual int visit_extended_port (be_extended_port *node);
- virtual int visit_porttype (be_porttype *node);
- virtual int visit_provides (be_provides *node);
-};
-
-#endif /* _BE_VISITOR_EXTENDED_PORT_EXTENEDED_PORT_SVH_H_ */
-
-
diff --git a/TAO/TAO_IDL/be_include/be_visitor_extended_port/extended_port_svs.h b/TAO/TAO_IDL/be_include/be_visitor_extended_port/extended_port_svs.h
deleted file mode 100644
index 3699d703551..00000000000
--- a/TAO/TAO_IDL/be_include/be_visitor_extended_port/extended_port_svs.h
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-// $Id$
-//
-/* -*- c++ -*- */
-// ============================================================================
-//
-// = LIBRARY
-// TAO IDL
-//
-// = FILENAME
-// extended_port_svs.h
-//
-// = DESCRIPTION
-// Concrete visitor for the extended port node.
-// This provides for code generation in the servant source
-//
-// = AUTHOR
-// Jeff Parsons
-//
-// ============================================================================
-
-#ifndef _BE_VISITOR_EXTENDED_PORT_EXTENEDED_PORT_SVS_H_
-#define _BE_VISITOR_EXTENDED_PORT_EXTENEDED_PORT_SVS_H_
-
-class be_visitor_extended_port_facet_svs
- : public be_visitor_extended_port
-{
- //
- // = TITLE
- // be_visitor_extended_port_facet_svs
- //
- // = DESCRIPTION
- // This is a concrete visitor to generate the facet
- // class implementations for an extended port.
- //
- //
-public:
- be_visitor_extended_port_facet_svs (be_visitor_context *ctx);
-
- ~be_visitor_extended_port_facet_svs (void);
-
- virtual int visit_extended_port (be_extended_port *node);
- virtual int visit_porttype (be_porttype *node);
- virtual int visit_provides (be_provides *node);
-};
-
-#endif /* _BE_VISITOR_EXTENDED_PORT_EXTENEDED_PORT_SVS_H_ */
-
-
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/operation_svs.h b/TAO/TAO_IDL/be_include/be_visitor_operation/operation_svs.h
index 7a75ecf2b39..80110eaa08d 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_operation/operation_svs.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/operation_svs.h
@@ -47,7 +47,6 @@ public:
virtual int post_process (be_decl *bd);
- void for_facets (bool val);
void scope (be_interface *node);
private:
@@ -55,7 +54,6 @@ private:
private:
be_interface *scope_;
- bool for_facets_;
bool swapping_;
};