diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-04-02 21:24:46 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-04-02 21:24:46 +0000 |
commit | 9cea1cbd25541f0cecdfc289d1deb61f4b2e94da (patch) | |
tree | e658c198f2b42b76aa996ddbc3793c454f058787 | |
parent | d54c5a93acda4daa77af7da3264747c06269a4b3 (diff) | |
download | ATCD-9cea1cbd25541f0cecdfc289d1deb61f4b2e94da.tar.gz |
ChangeLogTag: Tue Apr 2 15:23:17 2002 Jeff Parsons <parsons@cs.wustl.edu>
51 files changed, 1785 insertions, 64 deletions
diff --git a/TAO/TAO_IDL/Makefile.BE b/TAO/TAO_IDL/Makefile.BE index 85324c19c06..afd1bbb015e 100644 --- a/TAO/TAO_IDL/Makefile.BE +++ b/TAO/TAO_IDL/Makefile.BE @@ -26,6 +26,8 @@ SHLIB = $(LIBNAME).$(SOEXT) FILES = be/be_array \ be/be_argument \ be/be_attribute \ + be/be_component \ + be/be_component_fwd \ be/be_constant \ be/be_enum \ be/be_enum_val \ @@ -34,6 +36,7 @@ FILES = be/be_array \ be/be_factory \ be/be_field \ be/be_global \ + be/be_home \ be/be_interface \ be/be_interface_strategy \ be/be_interface_fwd \ @@ -70,12 +73,15 @@ FILES = be/be_array \ be/be_visitor_argument \ be/be_visitor_array \ be/be_visitor_attribute \ + be/be_visitor_component \ + be/be_visitor_component_fwd \ be/be_visitor_constant \ be/be_visitor_context \ be/be_visitor_decl \ be/be_visitor_enum \ be/be_visitor_exception \ be/be_visitor_field \ + be/be_visitor_home \ be/be_visitor_interface \ be/be_visitor_interface_fwd \ be/be_visitor_valuetype \ diff --git a/TAO/TAO_IDL/Makefile.FE b/TAO/TAO_IDL/Makefile.FE index 2bf15cf0436..af520959d68 100644 --- a/TAO/TAO_IDL/Makefile.FE +++ b/TAO/TAO_IDL/Makefile.FE @@ -34,6 +34,8 @@ FILES = fe/fe_declarator \ ast/ast_argument \ ast/ast_attribute \ ast/ast_check \ + ast/ast_component \ + ast/ast_component_fwd \ ast/ast_concrete_type \ ast/ast_constant \ ast/ast_decl \ @@ -43,6 +45,7 @@ FILES = fe/fe_declarator \ ast/ast_expression \ ast/ast_factory \ ast/ast_field \ + ast/ast_home \ ast/ast_interface \ ast/ast_interface_fwd \ ast/ast_module \ diff --git a/TAO/TAO_IDL/TAO_IDL_BE.bor b/TAO/TAO_IDL/TAO_IDL_BE.bor index 715fb7e87cd..39ff741cbc5 100644 --- a/TAO/TAO_IDL/TAO_IDL_BE.bor +++ b/TAO/TAO_IDL/TAO_IDL_BE.bor @@ -9,6 +9,8 @@ OBJFILES = \ $(OBJDIR)\be_array.obj \ $(OBJDIR)\be_attribute.obj \ $(OBJDIR)\be_codegen.obj \ + $(OBJDIR)\be_component.obj \ + $(OBJDIR)\be_component_fwd.obj \ $(OBJDIR)\be_constant.obj \ $(OBJDIR)\be_decl.obj \ $(OBJDIR)\be_enum.obj \ @@ -20,6 +22,7 @@ OBJFILES = \ $(OBJDIR)\be_generator.obj \ $(OBJDIR)\be_global.obj \ $(OBJDIR)\be_helper.obj \ + $(OBJDIR)\be_home.obj \ $(OBJDIR)\be_interface.obj \ $(OBJDIR)\be_interface_fwd.obj \ $(OBJDIR)\be_interface_strategy.obj \ @@ -51,6 +54,8 @@ OBJFILES = \ $(OBJDIR)\be_visitor_argument.obj \ $(OBJDIR)\be_visitor_array.obj \ $(OBJDIR)\be_visitor_attribute.obj \ + $(OBJDIR)\be_visitor_component.obj \ + $(OBJDIR)\be_visitor_component_fwd.obj \ $(OBJDIR)\be_visitor_constant.obj \ $(OBJDIR)\be_visitor_context.obj \ $(OBJDIR)\be_visitor_decl.obj \ @@ -58,6 +63,7 @@ OBJFILES = \ $(OBJDIR)\be_visitor_exception.obj \ $(OBJDIR)\be_visitor_factory.obj \ $(OBJDIR)\be_visitor_field.obj \ + $(OBJDIR)\be_visitor_home.obj \ $(OBJDIR)\be_visitor_interface.obj \ $(OBJDIR)\be_visitor_interface_fwd.obj \ $(OBJDIR)\be_visitor_module.obj \ diff --git a/TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp b/TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp index 136cbffa81b..c6c71116985 100644 --- a/TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp +++ b/TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp @@ -118,6 +118,14 @@ SOURCE=.\be\be_codegen.cpp # End Source File
# Begin Source File
+SOURCE=.\be\be_component.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\be\be_component_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_constant.cpp
# End Source File
# Begin Source File
@@ -162,6 +170,10 @@ SOURCE=.\be\be_helper.cpp # End Source File
# Begin Source File
+SOURCE=.\be\be_home.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_interface.cpp
# End Source File
# Begin Source File
@@ -290,6 +302,14 @@ SOURCE=.\be\be_visitor_attribute.cpp # End Source File
# Begin Source File
+SOURCE=.\be\be_visitor_component.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\be\be_visitor_component_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_visitor_constant.cpp
# End Source File
# Begin Source File
@@ -318,6 +338,10 @@ SOURCE=.\be\be_visitor_field.cpp # End Source File
# Begin Source File
+SOURCE=.\be\be_visitor_home.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_visitor_interface.cpp
# End Source File
# Begin Source File
@@ -402,6 +426,14 @@ SOURCE=.\be_include\be_codegen.h # End Source File
# Begin Source File
+SOURCE=.\be_include\be_component.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\be_include\be_component_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_constant.h
# End Source File
# Begin Source File
@@ -450,6 +482,10 @@ SOURCE=.\be_include\be_helper.h # End Source File
# Begin Source File
+SOURCE=.\be_include\be_home.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_interface.h
# End Source File
# Begin Source File
@@ -570,6 +606,14 @@ SOURCE=.\be_include\be_visitor_attribute.h # End Source File
# Begin Source File
+SOURCE=.\be_include\be_visitor_component.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\be_include\be_visitor_component_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_visitor_constant.h
# End Source File
# Begin Source File
@@ -598,6 +642,10 @@ SOURCE=.\be_include\be_visitor_field.h # End Source File
# Begin Source File
+SOURCE=.\be_include\be_visitor_home.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_visitor_interface.h
# End Source File
# Begin Source File
diff --git a/TAO/TAO_IDL/TAO_IDL_BE_LIB.dsp b/TAO/TAO_IDL/TAO_IDL_BE_LIB.dsp index 1f041117a56..05f0996d0a1 100644 --- a/TAO/TAO_IDL/TAO_IDL_BE_LIB.dsp +++ b/TAO/TAO_IDL/TAO_IDL_BE_LIB.dsp @@ -111,6 +111,14 @@ SOURCE=.\be\be_codegen.cpp # End Source File
# Begin Source File
+SOURCE=.\be\be_component.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\be\be_component_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_constant.cpp
# End Source File
# Begin Source File
@@ -155,6 +163,10 @@ SOURCE=.\be\be_helper.cpp # End Source File
# Begin Source File
+SOURCE=.\be\be_home.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_interface.cpp
# End Source File
# Begin Source File
@@ -283,6 +295,14 @@ SOURCE=.\be\be_visitor_attribute.cpp # End Source File
# Begin Source File
+SOURCE=.\be\be_visitor_component.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\be\be_visitor_component_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_visitor_constant.cpp
# End Source File
# Begin Source File
@@ -311,6 +331,10 @@ SOURCE=.\be\be_visitor_field.cpp # End Source File
# Begin Source File
+SOURCE=.\be\be_visitor_home.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_visitor_interface.cpp
# End Source File
# Begin Source File
@@ -395,6 +419,14 @@ SOURCE=.\be_include\be_codegen.h # End Source File
# Begin Source File
+SOURCE=.\be_include\be_component.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\be_include\be_component_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_constant.h
# End Source File
# Begin Source File
@@ -443,6 +475,10 @@ SOURCE=.\be_include\be_helper.h # End Source File
# Begin Source File
+SOURCE=.\be_include\be_home.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_interface.h
# End Source File
# Begin Source File
@@ -559,6 +595,14 @@ SOURCE=.\be_include\be_visitor_attribute.h # End Source File
# Begin Source File
+SOURCE=.\be_include\be_visitor_component.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\be_include\be_visitor_component_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_visitor_constant.h
# End Source File
# Begin Source File
@@ -587,6 +631,10 @@ SOURCE=.\be_include\be_visitor_field.h # End Source File
# Begin Source File
+SOURCE=.\be_include\be_visitor_home.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_visitor_interface.h
# End Source File
# Begin Source File
diff --git a/TAO/TAO_IDL/TAO_IDL_FE.bor b/TAO/TAO_IDL/TAO_IDL_FE.bor index 11e97596cfd..a5982e45717 100644 --- a/TAO/TAO_IDL/TAO_IDL_FE.bor +++ b/TAO/TAO_IDL/TAO_IDL_FE.bor @@ -9,6 +9,8 @@ OBJFILES = \ $(OBJDIR)\ast_array.obj \ $(OBJDIR)\ast_attribute.obj \ $(OBJDIR)\ast_check.obj \ + $(OBJDIR)\ast_component.obj \ + $(OBJDIR)\ast_component_fwd.obj \ $(OBJDIR)\ast_concrete_type.obj \ $(OBJDIR)\ast_constant.obj \ $(OBJDIR)\ast_decl.obj \ @@ -19,6 +21,7 @@ OBJFILES = \ $(OBJDIR)\ast_factory.obj \ $(OBJDIR)\ast_field.obj \ $(OBJDIR)\ast_generator.obj \ + $(OBJDIR)\ast_home.obj \ $(OBJDIR)\ast_interface.obj \ $(OBJDIR)\ast_interface_fwd.obj \ $(OBJDIR)\ast_module.obj \ diff --git a/TAO/TAO_IDL/TAO_IDL_FE_DLL.dsp b/TAO/TAO_IDL/TAO_IDL_FE_DLL.dsp index 224706cea4f..d1f06f15c41 100644 --- a/TAO/TAO_IDL/TAO_IDL_FE_DLL.dsp +++ b/TAO/TAO_IDL/TAO_IDL_FE_DLL.dsp @@ -122,6 +122,10 @@ SOURCE=.\ast\ast_component.cpp # End Source File
# Begin Source File
+SOURCE=.\ast\ast_component_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\ast\ast_concrete_type.cpp
# End Source File
# Begin Source File
@@ -162,6 +166,10 @@ SOURCE=.\ast\ast_generator.cpp # End Source File
# Begin Source File
+SOURCE=.\ast\ast_home.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\ast\ast_interface.cpp
# End Source File
# Begin Source File
@@ -374,6 +382,10 @@ SOURCE=.\include\ast_component.h # End Source File
# Begin Source File
+SOURCE=.\include\ast_component_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\include\ast_concrete_type.h
# End Source File
# Begin Source File
@@ -418,6 +430,10 @@ SOURCE=.\include\ast_generator.h # End Source File
# Begin Source File
+SOURCE=.\include\ast_home.h
+# End Source File
+# Begin Source File
+
SOURCE=.\include\ast_interface.h
# End Source File
# Begin Source File
diff --git a/TAO/TAO_IDL/TAO_IDL_FE_LIB.dsp b/TAO/TAO_IDL/TAO_IDL_FE_LIB.dsp index 6c405b4a07e..1e4e4e9e7bd 100644 --- a/TAO/TAO_IDL/TAO_IDL_FE_LIB.dsp +++ b/TAO/TAO_IDL/TAO_IDL_FE_LIB.dsp @@ -111,6 +111,14 @@ SOURCE=.\ast\ast_check.cpp # End Source File
# Begin Source File
+SOURCE=.\ast\ast_component.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ast\ast_component_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\ast\ast_concrete_type.cpp
# End Source File
# Begin Source File
@@ -151,6 +159,10 @@ SOURCE=.\ast\ast_generator.cpp # End Source File
# Begin Source File
+SOURCE=.\ast\ast_home.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\ast\ast_interface.cpp
# End Source File
# Begin Source File
@@ -359,6 +371,14 @@ SOURCE=.\include\ast_attribute.h # End Source File
# Begin Source File
+SOURCE=.\include\ast_component.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\include\ast_component_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\include\ast_concrete_type.h
# End Source File
# Begin Source File
@@ -403,6 +423,10 @@ SOURCE=.\include\ast_generator.h # End Source File
# Begin Source File
+SOURCE=.\include\ast_home.h
+# End Source File
+# Begin Source File
+
SOURCE=.\include\ast_interface.h
# End Source File
# Begin Source File
diff --git a/TAO/TAO_IDL/ast/Makefile.am b/TAO/TAO_IDL/ast/Makefile.am index 2df04da5765..da994a9d775 100644 --- a/TAO/TAO_IDL/ast/Makefile.am +++ b/TAO/TAO_IDL/ast/Makefile.am @@ -22,6 +22,8 @@ libast_la_SOURCES = \ ast_array.cpp \ ast_attribute.cpp \ ast_check.cpp \ + ast_component.cpp \ + ast_component_fwd.cpp \ ast_concrete_type.cpp \ ast_constant.cpp \ ast_decl.cpp \ @@ -31,6 +33,7 @@ libast_la_SOURCES = \ ast_expression.cpp \ ast_field.cpp \ ast_generator.cpp \ + ast_home.cpp \ ast_interface.cpp \ ast_interface_fwd.cpp \ ast_module.cpp \ diff --git a/TAO/TAO_IDL/ast/ast_component.cpp b/TAO/TAO_IDL/ast/ast_component.cpp index 43034dff6cc..6a292c338f1 100644 --- a/TAO/TAO_IDL/ast/ast_component.cpp +++ b/TAO/TAO_IDL/ast/ast_component.cpp @@ -1,20 +1,22 @@ // $Id$ #include "ast_component.h" +#include "ast_visitor.h" +#include "utl_identifier.h" +#include "utl_indenter.h" +#include "global_extern.h" ACE_RCSID (ast, ast_component, "$Id$") -// Constructor(s) and destructor. - AST_Component::AST_Component (void) - : parent_ (0) + : pd_base_component (0) { } AST_Component::AST_Component (UTL_ScopedName *n, - AST_Component *parent, + AST_Component *base_component, AST_Interface **supports, long n_supports, AST_Interface **supports_flat, @@ -24,16 +26,16 @@ AST_Component::AST_Component (UTL_ScopedName *n, n_supports, supports_flat, n_supports_flat, - I_FALSE, + I_TRUE, I_FALSE), AST_Type (AST_Decl::NT_component, n), AST_Decl (AST_Decl::NT_component, n), UTL_Scope (AST_Decl::NT_component), - COMMON_Base (I_FALSE, + COMMON_Base (I_TRUE, I_FALSE), - parent_ (parent) + pd_base_component (base_component) { } @@ -42,7 +44,134 @@ AST_Component::~AST_Component (void) } AST_Component * -AST_Component::parent (void) +AST_Component::base_component (void) const +{ + return this->pd_base_component; +} + +AST_Interface ** +AST_Component::supports (void) const +{ + return this->inherits (); +} + +long +AST_Component::n_supports (void) const +{ + return this->n_inherits (); +} + +ACE_Unbounded_Queue<AST_Interface *> & +AST_Component::provides (void) +{ + return this->pd_provides; +} + +void +AST_Component::provides (AST_Interface *d) +{ + this->pd_provides.enqueue_tail (d); +} + +ACE_Unbounded_Queue<AST_Component::uses_description *> & +AST_Component::uses (void) +{ + return this->pd_uses; +} + +void +AST_Component::uses (AST_Component::uses_description *d) +{ + this->pd_uses.enqueue_tail (d); +} + +ACE_Unbounded_Queue<AST_ValueType *> & +AST_Component::emits (void) +{ + return this->pd_emits; +} + +void +AST_Component::emits (AST_ValueType *d) +{ + this->pd_emits.enqueue_tail (d); +} + +ACE_Unbounded_Queue<AST_ValueType *> & +AST_Component::publishes (void) { - return this->parent_; + return this->pd_publishes; } + +void +AST_Component::publishes (AST_ValueType *d) +{ + this->pd_publishes.enqueue_tail (d); +} + +ACE_Unbounded_Queue<AST_ValueType *> & +AST_Component::consumes (void) +{ + return this->pd_consumes; +} + +void +AST_Component::consumes (AST_ValueType *d) +{ + this->pd_consumes.enqueue_tail (d); +} + +void +AST_Component::destroy (void) +{ + this->AST_Interface::destroy (); +} + +void +AST_Component::dump (ACE_OSTREAM_TYPE &o) +{ + o << "component "; + + this->local_name ()->dump (o); + + o << " "; + + if (this->pd_base_component != 0) + { + o << ": "; + this->pd_base_component->local_name ()->dump (o); + } + + if (this->pd_n_inherits > 0) + { + o << "supports "; + + for (long i = 0; i < this->pd_n_inherits; ++i) + { + this->pd_inherits[i]->local_name ()->dump (o); + + if (i < this->pd_n_inherits - 1) + { + o << ", "; + } + } + } + + o << " {\n"; + + UTL_Scope::dump (o); + idl_global->indent ()->skip_to (o); + + o << "}"; +} + +int +AST_Component::ast_accept (ast_visitor *visitor) +{ + return visitor->visit_component (this); +} + +// Narrowing methods. +IMPL_NARROW_METHODS1(AST_Component, AST_Interface) +IMPL_NARROW_FROM_DECL(AST_Component) +IMPL_NARROW_FROM_SCOPE(AST_Component) diff --git a/TAO/TAO_IDL/ast/ast_component_fwd.cpp b/TAO/TAO_IDL/ast/ast_component_fwd.cpp new file mode 100644 index 00000000000..6dfcf57dbb8 --- /dev/null +++ b/TAO/TAO_IDL/ast/ast_component_fwd.cpp @@ -0,0 +1,57 @@ +// $Id$ + +#include "ast_component_fwd.h" +#include "ast_visitor.h" +#include "utl_identifier.h" + +ACE_RCSID( ast, + ast_component_fwd, + "$Id$") + +AST_ComponentFwd::AST_ComponentFwd (void) +{ +} + +AST_ComponentFwd::AST_ComponentFwd (AST_Interface *dummy, + UTL_ScopedName *n) + : AST_InterfaceFwd (dummy, + n), + AST_Type (AST_Decl::NT_component_fwd, + n), + AST_Decl (AST_Decl::NT_component_fwd, + n), + COMMON_Base (I_TRUE, + I_FALSE) +{ +} + +AST_ComponentFwd::~AST_ComponentFwd (void) +{ +} + +// Redefinition of inherited virtual operations. + +// Dump this AST_InterfaceFwd node to the ostream o. +void +AST_ComponentFwd::dump (ACE_OSTREAM_TYPE &o) +{ + o << "component "; + + this->local_name ()->dump (o); +} + +int +AST_ComponentFwd::ast_accept (ast_visitor *visitor) +{ + return visitor->visit_component_fwd (this); +} + +void +AST_ComponentFwd::destroy (void) +{ + this->AST_InterfaceFwd::destroy (); +} + +// Narrowing methods. +IMPL_NARROW_METHODS1 (AST_ComponentFwd, AST_InterfaceFwd) +IMPL_NARROW_FROM_DECL (AST_ComponentFwd) diff --git a/TAO/TAO_IDL/ast/ast_generator.cpp b/TAO/TAO_IDL/ast/ast_generator.cpp index 55aae1c2f2b..f61a4f9f4d6 100644 --- a/TAO/TAO_IDL/ast/ast_generator.cpp +++ b/TAO/TAO_IDL/ast/ast_generator.cpp @@ -73,6 +73,9 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "ast_root.h" #include "ast_valuetype.h" #include "ast_valuetype_fwd.h" +#include "ast_component.h" +#include "ast_component_fwd.h" +#include "ast_home.h" #include "ast_exception.h" #include "ast_enum.h" #include "ast_attribute.h" @@ -282,9 +285,6 @@ AST_ValueTypeFwd * AST_Generator::create_valuetype_fwd (UTL_ScopedName *n, idl_bool abstract) { - // See note in create_valuetype(). - // Dummy placeholder must return true from is_valuetype(). - AST_ValueType *dummy = this->create_valuetype (n, 0, -1, @@ -306,6 +306,62 @@ AST_Generator::create_valuetype_fwd (UTL_ScopedName *n, return retval; } +AST_Component * +AST_Generator::create_component (UTL_ScopedName *n, + AST_Component *base_component, + AST_Interface **supports, + long n_supports, + AST_Interface **supports_flat, + long n_supports_flat) +{ + AST_Component *retval = 0; + ACE_NEW_RETURN (retval, + AST_Component (n, + base_component, + supports, + n_supports, + supports_flat, + n_supports_flat), + 0); + + return retval; +} + +AST_ComponentFwd * +AST_Generator::create_component_fwd (UTL_ScopedName *n) +{ + AST_Component *dummy = this->create_component (n, + 0, + 0, + -1, + 0, + 0); + + AST_ComponentFwd *retval = 0; + ACE_NEW_RETURN (retval, + AST_ComponentFwd (dummy, + n), + 0); + + return retval; +} + +AST_Home * +AST_Generator::create_home (UTL_ScopedName *n, + AST_Home *base_home, + AST_Component *managed_component, + AST_ValueType *primary_key) +{ + AST_Home *retval = 0; + ACE_NEW_RETURN (retval, + AST_Home (n, + base_home, + managed_component, + primary_key), + 0); + + return retval; +} AST_Exception * AST_Generator::create_exception (UTL_ScopedName *n, diff --git a/TAO/TAO_IDL/ast/ast_home.cpp b/TAO/TAO_IDL/ast/ast_home.cpp new file mode 100644 index 00000000000..69a44d98bf3 --- /dev/null +++ b/TAO/TAO_IDL/ast/ast_home.cpp @@ -0,0 +1,145 @@ +// $Id$ + +#include "ast_home.h" +#include "ast_component.h" +#include "ast_valuetype.h" +#include "ast_visitor.h" +#include "utl_identifier.h" +#include "utl_indenter.h" +#include "global_extern.h" + +ACE_RCSID (ast, + ast_home, + "$Id$") + +AST_Home::AST_Home (void) + : pd_base_home (0), + pd_managed_component (0), + pd_primary_key (0) +{ +} + +AST_Home::AST_Home (UTL_ScopedName *n, + AST_Home *base_home, + AST_Component *managed_component, + AST_ValueType *primary_key) + : AST_Interface (n, + 0, + 0, + 0, + 0, + I_TRUE, + I_FALSE), + AST_Type (AST_Decl::NT_home, + n), + AST_Decl (AST_Decl::NT_home, + n), + UTL_Scope (AST_Decl::NT_home), + COMMON_Base (I_TRUE, + I_FALSE), + pd_base_home (base_home), + pd_managed_component (managed_component), + pd_primary_key (primary_key) +{ +} + +AST_Home::~AST_Home (void) +{ +} + +AST_Home * +AST_Home::base_home (void) const +{ + return this->pd_base_home; +} + +AST_Component * +AST_Home::managed_component (void) const +{ + return this->pd_managed_component; +} + +AST_ValueType * +AST_Home::primary_key (void) const +{ + return this->pd_primary_key; +} + +ACE_Unbounded_Queue<AST_Operation *> & +AST_Home::factories (void) +{ + return this->pd_factories; +} + +void +AST_Home::factories (AST_Operation *d) +{ + this->pd_factories.enqueue_tail (d); +} + +ACE_Unbounded_Queue<AST_Operation *> & +AST_Home::finders (void) +{ + return this->pd_finders; +} + +void +AST_Home::finders (AST_Operation *d) +{ + this->pd_finders.enqueue_tail (d); +} + +void +AST_Home::destroy (void) +{ + this->AST_Interface::destroy (); +} + +void +AST_Home::dump (ACE_OSTREAM_TYPE &o) +{ + o << "home "; + + this->local_name ()->dump (o); + + o << " "; + + if (this->pd_base_home != 0) + { + o << ": "; + this->pd_base_home->local_name ()->dump (o); + } + + if (this->pd_managed_component != 0) + { + o << "\n"; + o << "manages "; + this->pd_managed_component->local_name ()->dump (o); + } + + if (this->pd_primary_key != 0) + { + o << "\n"; + o << "primary key "; + this->pd_primary_key->local_name ()->dump (o); + } + + o << " {\n"; + + UTL_Scope::dump (o); + idl_global->indent ()->skip_to (o); + + o << "}"; +} + +int +AST_Home::ast_accept (ast_visitor *visitor) +{ + return visitor->visit_home (this); +} + + // Narrowing. +IMPL_NARROW_METHODS1(AST_Home, AST_Interface); +IMPL_NARROW_FROM_DECL(AST_Home); +IMPL_NARROW_FROM_SCOPE(AST_Home); + diff --git a/TAO/TAO_IDL/ast/ast_module.cpp b/TAO/TAO_IDL/ast/ast_module.cpp index cbfc2b9b858..0965bfd1456 100644 --- a/TAO/TAO_IDL/ast/ast_module.cpp +++ b/TAO/TAO_IDL/ast/ast_module.cpp @@ -72,6 +72,9 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "ast_predefined_type.h" #include "ast_valuetype.h" #include "ast_valuetype_fwd.h" +#include "ast_component.h" +#include "ast_component_fwd.h" +#include "ast_home.h" #include "ast_constant.h" #include "ast_exception.h" #include "ast_union.h" @@ -397,6 +400,134 @@ AST_Module::fe_add_valuetype (AST_ValueType *t) return t; } +// Add this AST_Component node (a value type declaration) to this scope. +AST_Component * +AST_Module::fe_add_component (AST_Component *t) +{ + AST_Decl *predef = 0; + AST_Component *fwd = 0; + + // Already defined? + if ((predef = this->lookup_for_add (t, I_FALSE)) != 0) + { + // Treat fwd declared interfaces specially + if (predef->node_type () == AST_Decl::NT_component) + { + fwd = AST_Component::narrow_from_decl (predef); + + if (fwd == 0) + { + return 0; + } + + // Forward declared and not defined yet. + if (!fwd->is_defined ()) + { + if (fwd->defined_in () != this) + { + idl_global->err ()->error3 (UTL_Error::EIDL_SCOPE_CONFLICT, + fwd, + t, + this); + + return 0; + } + } + // OK, not illegal redef of forward declaration. Now check whether. + // it has been referenced already. + else if (this->referenced (predef, t->local_name ())) + { + idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE, + t, + this, + predef); + + return 0; + } + } + else if (!can_be_redefined (predef)) + { + idl_global->err ()->error3 (UTL_Error::EIDL_REDEF, + t, + this, + predef); + + return 0; + } + else if (referenced (predef, t->local_name ()) && !t->is_defined ()) + { + idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE, + t, + this, + predef); + + return 0; + } + else if (t->has_ancestor (predef)) + { + idl_global->err ()->redefinition_in_scope (t, + predef); + + return 0; + } + } + + // Add it to scope + this->add_to_scope (t); + + // Add it to set of locally referenced symbols + this->add_to_referenced (t, + I_FALSE, + t->local_name ()); + return t; +} + +// Add this AST_Home node (a value type declaration) to this scope. +AST_Home * +AST_Module::fe_add_home (AST_Home *t) +{ + AST_Decl *d = 0; + + // Already defined and cannot be redefined? Or already used? + if ((d = this->lookup_for_add (t, I_FALSE)) != 0) + { + if (!can_be_redefined (d)) + { + idl_global->err ()->error3 (UTL_Error::EIDL_REDEF, + t, + this, + d); + return 0; + } + + if (this->referenced (d, t->local_name ())) + { + idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE, + t, + this, + d); + return 0; + } + + if (t->has_ancestor (d)) + { + idl_global->err ()->redefinition_in_scope (t, + d); + return 0; + } + } + + // Add it to scope. + this->add_to_scope (t); + + // Add it to set of locally referenced symbols. + this->add_to_referenced (t, + I_FALSE, + t->local_name ()); + + return t; +} + // Add this AST_InterfaceFwd node (a forward declaration of an IDL // interface) to this scope. AST_InterfaceFwd * @@ -545,6 +676,80 @@ AST_Module::fe_add_valuetype_fwd (AST_ValueTypeFwd *v) return v; } +// Add this AST_ComponentFwd node (a forward declaration of an IDL +// value type) to this scope. +AST_ComponentFwd * +AST_Module::fe_add_component_fwd (AST_ComponentFwd *c) +{ + AST_Decl *d = 0; + AST_Component *cf = 0; + + // Already defined and cannot be redefined? Or already used? + if ((d = this->lookup_for_add (c, I_FALSE)) != 0) + { + // There used to be another check here ANDed with the one below: + // d->defined_in () == this. But lookup_for_add calls only + // lookup_by_name_local(), which does not bump up the scope, + // and look_in_previous() for modules. If look_in_previous() + // finds something, the scopes will NOT be the same pointer + // value, but the result is what we want. + if (d->node_type () == AST_Decl::NT_component) + { + cf = AST_Component::narrow_from_decl (d); + + if (cf == 0) + { + return 0; + } + + if (c->added () == 0) + { + c->set_added (1); + this->add_to_scope (c); + } + + // @@ Redefinition of forward. Type check not implemented. + c->set_full_definition (cf); // @@ Memory leak. + return c; + } + + if (!can_be_redefined (d)) { + + idl_global->err ()->error3 (UTL_Error::EIDL_REDEF, + c, + this, + d); + return 0; + } + + if (this->referenced (d, c->local_name ())) + { + idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE, + c, + this, + d); + return 0; + } + + if (c->has_ancestor (d)) + { + idl_global->err ()->redefinition_in_scope (c, + d); + return 0; + } + } + + // Add it to scope + this->add_to_scope (c); + + // Add it to set of locally referenced symbols + this->add_to_referenced (c, + I_FALSE, + c->local_name ()); + + return c; +} + // Add this AST_Constant node (a constant declaration) to this scope. AST_Constant * AST_Module::fe_add_constant (AST_Constant *t) diff --git a/TAO/TAO_IDL/ast/ast_redef.cpp b/TAO/TAO_IDL/ast/ast_redef.cpp index 7310ca8a8db..ce59b52ea0c 100644 --- a/TAO/TAO_IDL/ast/ast_redef.cpp +++ b/TAO/TAO_IDL/ast/ast_redef.cpp @@ -82,6 +82,9 @@ can_be_redefined (AST_Decl *d) case AST_Decl::NT_interface_fwd: case AST_Decl::NT_valuetype: case AST_Decl::NT_valuetype_fwd: + case AST_Decl::NT_component: + case AST_Decl::NT_component_fwd: + case AST_Decl::NT_home: case AST_Decl::NT_const: case AST_Decl::NT_except: case AST_Decl::NT_argument: diff --git a/TAO/TAO_IDL/ast/ast_valuetype.cpp b/TAO/TAO_IDL/ast/ast_valuetype.cpp index 00725591849..bfcf3e426c7 100644 --- a/TAO/TAO_IDL/ast/ast_valuetype.cpp +++ b/TAO/TAO_IDL/ast/ast_valuetype.cpp @@ -102,6 +102,7 @@ AST_ValueType::truncatable (void) const void AST_ValueType::destroy (void) { + this->AST_Interface::destroy (); } void @@ -140,7 +141,7 @@ AST_ValueType::dump (ACE_OSTREAM_TYPE &o) if (this->pd_n_supports > 0) { - o << ": "; + o << "supports "; for (long i = 0; i < this->pd_n_supports; ++i) { diff --git a/TAO/TAO_IDL/be/Makefile.am b/TAO/TAO_IDL/be/Makefile.am index 0eb1656f442..cf8ebeea9ae 100644 --- a/TAO/TAO_IDL/be/Makefile.am +++ b/TAO/TAO_IDL/be/Makefile.am @@ -24,6 +24,8 @@ libbe_la_SOURCES = \ be_array.cpp \ be_attribute.cpp \ be_codegen.cpp \ + be_component.cpp \ + be_component_fwd.cpp \ be_constant.cpp \ be_decl.cpp \ be_enum.cpp \ @@ -33,6 +35,7 @@ libbe_la_SOURCES = \ be_field.cpp \ be_generator.cpp \ be_helper.cpp \ + be_home.cpp \ be_init.cpp \ be_interface.cpp \ be_interface_fwd.cpp \ @@ -64,6 +67,8 @@ libbe_la_SOURCES = \ be_visitor_argument.cpp \ be_visitor_array.cpp \ be_visitor_attribute.cpp \ + be_visitor_component.cpp \ + be_visitor_component_fwd.cpp \ be_visitor_constant.cpp \ be_visitor_context.cpp \ be_visitor_decl.cpp \ @@ -71,6 +76,7 @@ libbe_la_SOURCES = \ be_visitor_exception.cpp \ be_visitor_factory.cpp \ be_visitor_field.cpp \ + be_visitor_home.cpp \ be_visitor_interface.cpp \ be_visitor_interface_fwd.cpp \ be_visitor_module.cpp \ diff --git a/TAO/TAO_IDL/be/be_component.cpp b/TAO/TAO_IDL/be/be_component.cpp new file mode 100644 index 00000000000..96d6ee8ebcf --- /dev/null +++ b/TAO/TAO_IDL/be/be_component.cpp @@ -0,0 +1,91 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_component.cpp +// +// = DESCRIPTION +// Extension of class AST_Component that provides additional means for C++ +// mapping of an interface. +// +// = AUTHOR +// Jeff Parsons +// +// ============================================================================ + +#include "be_component.h" +#include "be_visitor.h" + +ACE_RCSID (be, + be_component, + "$Id$") + +be_component::be_component (void) +{ + this->size_type (AST_Type::VARIABLE); + this->has_constructor (I_TRUE); +} + +be_component::be_component (UTL_ScopedName *n, + AST_Component *base_component, + AST_Interface **supports, + long n_supports, + AST_Interface **supports_flat, + long n_supports_flat) + : be_interface (n, + supports, + n_supports, + supports_flat, + n_supports_flat, + I_TRUE, + I_FALSE), + AST_Component (n, + base_component, + supports, + n_supports, + supports_flat, + n_supports_flat), + AST_Interface (n, + supports, + n_supports, + supports_flat, + n_supports_flat, + I_TRUE, + I_FALSE), + AST_Type (AST_Decl::NT_component, + n), + AST_Decl (AST_Decl::NT_component, + n), + UTL_Scope (AST_Decl::NT_component), + COMMON_Base (I_TRUE, + I_FALSE) +{ + this->size_type (AST_Type::VARIABLE); + this->has_constructor (I_TRUE); +} + +be_component::~be_component (void) +{ +} + +void +be_component::destroy () +{ + this->be_interface::destroy (); + this->AST_Component::destroy (); +} + +int +be_component::accept (be_visitor *visitor) +{ + return visitor->visit_component (this); +} + +// Narrowing. +IMPL_NARROW_METHODS2 (be_component, be_interface, AST_Component); +IMPL_NARROW_FROM_DECL (be_component); +IMPL_NARROW_FROM_SCOPE (be_component); diff --git a/TAO/TAO_IDL/be/be_component_fwd.cpp b/TAO/TAO_IDL/be/be_component_fwd.cpp new file mode 100644 index 00000000000..4b0f4b289b0 --- /dev/null +++ b/TAO/TAO_IDL/be/be_component_fwd.cpp @@ -0,0 +1,64 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_component_fwd.cpp +// +// = DESCRIPTION +// Extension of class AST_ComponentFwd that provides additional means for C++ +// mapping of a forward declared component. +// +// = AUTHOR +// Jeff Parsons +// +// ============================================================================ + +#include "be_component_fwd.h" +#include "be_visitor.h" + +ACE_RCSID (be, + be_component_fwd, + "$Id$") + +be_component_fwd::be_component_fwd (void) +{ + this->size_type (AST_Type::VARIABLE); +} + +be_component_fwd::be_component_fwd (AST_Interface *dummy, + UTL_ScopedName *n) + : be_interface_fwd (dummy, + n), + AST_ComponentFwd (dummy, + n), + AST_InterfaceFwd (dummy, + n), + AST_Decl (AST_Decl::NT_component_fwd, + n) +{ + this->size_type (AST_Type::VARIABLE); +} + +be_component_fwd::~be_component_fwd (void) +{ +} + +void +be_component_fwd::destroy (void) +{ + this->AST_ComponentFwd::destroy (); +} + +int +be_component_fwd::accept (be_visitor *visitor) +{ + return visitor->visit_component_fwd (this); +} + +// Narrowing +IMPL_NARROW_METHODS2 (be_component_fwd, AST_ComponentFwd, be_interface_fwd) +IMPL_NARROW_FROM_DECL (be_component_fwd) diff --git a/TAO/TAO_IDL/be/be_generator.cpp b/TAO/TAO_IDL/be/be_generator.cpp index 031057968c1..f9f8acb541c 100644 --- a/TAO/TAO_IDL/be/be_generator.cpp +++ b/TAO/TAO_IDL/be/be_generator.cpp @@ -73,10 +73,11 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "be_root.h" #include "be_predefined_type.h" #include "be_module.h" -#include "be_interface.h" -#include "be_interface_fwd.h" #include "be_valuetype.h" #include "be_valuetype_fwd.h" +#include "be_component.h" +#include "be_component_fwd.h" +#include "be_home.h" #include "be_union.h" #include "be_union_fwd.h" #include "be_structure.h" @@ -230,15 +231,17 @@ be_generator::create_interface_fwd (UTL_ScopedName *n, idl_bool local, idl_bool abstract) { + AST_Interface *dummy = this->create_interface (n, + 0, + -1, + 0, + 0, + local, + abstract); + be_interface_fwd *retval = 0; ACE_NEW_RETURN (retval, - be_interface_fwd (this->create_interface (n, - 0, - -1, - 0, - 0, - local, - abstract), + be_interface_fwd (dummy, n), 0); @@ -280,25 +283,84 @@ AST_ValueTypeFwd * be_generator::create_valuetype_fwd (UTL_ScopedName *n, idl_bool abstract) { + AST_ValueType *dummy = this->create_valuetype (n, + 0, + -1, + 0, + 0, + 0, + 0, + 0, + 0, + abstract, + 0); + be_valuetype_fwd *retval = 0; ACE_NEW_RETURN (retval, - be_valuetype_fwd (this->create_valuetype (n, - 0, - -1, - 0, - 0, - 0, - 0, - 0, - 0, - abstract, - 0), + be_valuetype_fwd (dummy, n), 0); return retval; } +AST_Component * +be_generator::create_component (UTL_ScopedName *n, + AST_Component *base_component, + AST_Interface **supports, + long n_supports, + AST_Interface **supports_flat, + long n_supports_flat) +{ + be_component *retval = 0; + ACE_NEW_RETURN (retval, + be_component (n, + base_component, + supports, + n_supports, + supports_flat, + n_supports_flat), + 0); + + return retval; +} + +AST_ComponentFwd * +be_generator::create_component_fwd (UTL_ScopedName *n) +{ + AST_Component *dummy = this->create_component (n, + 0, + 0, + -1, + 0, + 0); + + be_component_fwd *retval = 0; + ACE_NEW_RETURN (retval, + be_component_fwd (dummy, + n), + 0); + + return retval; +} + +AST_Home * +be_generator::create_home (UTL_ScopedName *n, + AST_Home *base_home, + AST_Component *managed_component, + AST_ValueType *primary_key) +{ + be_home *retval = 0; + ACE_NEW_RETURN (retval, + be_home (n, + base_home, + managed_component, + primary_key), + 0); + + return retval; +} + AST_Exception * be_generator::create_exception (UTL_ScopedName *n, idl_bool local, diff --git a/TAO/TAO_IDL/be/be_home.cpp b/TAO/TAO_IDL/be/be_home.cpp new file mode 100644 index 00000000000..25a75156378 --- /dev/null +++ b/TAO/TAO_IDL/be/be_home.cpp @@ -0,0 +1,85 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_home.cpp +// +// = DESCRIPTION +// Extension of class AST_Home that provides additional means for C++ +// mapping of a component home. +// +// = AUTHOR +// Jeff Parsons +// +// ============================================================================ + +#include "be_home.h" +#include "be_visitor.h" + +ACE_RCSID (be, + be_home, + "$Id$") + +be_home::be_home (void) +{ + this->size_type (AST_Type::VARIABLE); +} + +be_home::be_home (UTL_ScopedName *n, + AST_Home *base_home, + AST_Component *managed_component, + AST_ValueType *primary_key) + : be_interface (n, + 0, + 0, + 0, + 0, + I_TRUE, + I_FALSE), + AST_Home (n, + base_home, + managed_component, + primary_key), + AST_Interface (n, + 0, + 0, + 0, + 0, + I_TRUE, + I_FALSE), + AST_Type (AST_Decl::NT_home, + n), + AST_Decl (AST_Decl::NT_home, + n), + UTL_Scope (AST_Decl::NT_home), + COMMON_Base (I_TRUE, + I_FALSE) +{ + this->size_type (AST_Type::VARIABLE); +} + +be_home::~be_home (void) +{ +} + +void +be_home::destroy (void) +{ + this->be_interface::destroy (); + this->AST_Home::destroy (); +} + +int +be_home::accept (be_visitor *visitor) +{ + return visitor->visit_home (this); +} + +// Narrowing +IMPL_NARROW_METHODS2 (be_home, be_interface, AST_Home); +IMPL_NARROW_FROM_DECL (be_home); +IMPL_NARROW_FROM_SCOPE (be_home); diff --git a/TAO/TAO_IDL/be/be_scope.cpp b/TAO/TAO_IDL/be/be_scope.cpp index 326200a43b8..128ae41716d 100644 --- a/TAO/TAO_IDL/be/be_scope.cpp +++ b/TAO/TAO_IDL/be/be_scope.cpp @@ -3,6 +3,8 @@ // #include "be_scope.h" #include "be_valuetype.h" +#include "be_component.h" +#include "be_home.h" #include "be_module.h" #include "be_exception.h" #include "be_union.h" @@ -58,6 +60,10 @@ be_scope::decl (void) return be_interface::narrow_from_scope (this); case AST_Decl::NT_valuetype: return be_valuetype::narrow_from_scope (this); + case AST_Decl::NT_component: + return be_component::narrow_from_scope (this); + case AST_Decl::NT_home: + return be_home::narrow_from_scope (this); case AST_Decl::NT_module: return be_module::narrow_from_scope (this); case AST_Decl::NT_root: diff --git a/TAO/TAO_IDL/be/be_valuetype.cpp b/TAO/TAO_IDL/be/be_valuetype.cpp index d83ad98d746..40aa06d18a4 100644 --- a/TAO/TAO_IDL/be/be_valuetype.cpp +++ b/TAO/TAO_IDL/be/be_valuetype.cpp @@ -762,6 +762,7 @@ be_valuetype::accept (be_visitor *visitor) void be_valuetype::destroy (void) { + this->be_interface::destroy (); } ACE_CDR::ULong diff --git a/TAO/TAO_IDL/be/be_valuetype_fwd.cpp b/TAO/TAO_IDL/be/be_valuetype_fwd.cpp index 3460d54c5e8..b62641c922b 100644 --- a/TAO/TAO_IDL/be/be_valuetype_fwd.cpp +++ b/TAO/TAO_IDL/be/be_valuetype_fwd.cpp @@ -59,6 +59,7 @@ be_valuetype_fwd::accept (be_visitor *visitor) void be_valuetype_fwd::destroy (void) { + this->be_interface_fwd::destroy (); } // Narrowing. diff --git a/TAO/TAO_IDL/be/be_visitor.cpp b/TAO/TAO_IDL/be/be_visitor.cpp index 2c609167b15..b25f89f7914 100644 --- a/TAO/TAO_IDL/be/be_visitor.cpp +++ b/TAO/TAO_IDL/be/be_visitor.cpp @@ -82,6 +82,21 @@ int be_visitor::visit_valuetype_fwd (be_valuetype_fwd *) return 0; } +int be_visitor::visit_component (be_component *) +{ + return 0; +} + +int be_visitor::visit_component_fwd (be_component_fwd *) +{ + return 0; +} + +int be_visitor::visit_home (be_home *) +{ + return 0; +} + int be_visitor::visit_factory (be_factory *) { return 0; diff --git a/TAO/TAO_IDL/be/be_visitor_component.cpp b/TAO/TAO_IDL/be/be_visitor_component.cpp new file mode 100644 index 00000000000..baa86583374 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_component.cpp @@ -0,0 +1,27 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_component.cpp +// +// = DESCRIPTION +// Visitors for generation of code for Component +// +// = AUTHOR +// Jeff Parsons +// +// ============================================================================ + +#include "be_visitor_component.h" +#include "be_visitor_context.h" + +ACE_RCSID (be, + be_visitor_component, + "$Id$") + diff --git a/TAO/TAO_IDL/be/be_visitor_component_fwd.cpp b/TAO/TAO_IDL/be/be_visitor_component_fwd.cpp new file mode 100644 index 00000000000..97746d88aa2 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_component_fwd.cpp @@ -0,0 +1,27 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_component_fwd.cpp +// +// = DESCRIPTION +// Visitors for generation of code for forward declared Component +// +// = AUTHOR +// Jeff Parsons +// +// ============================================================================ + +#include "be_visitor_component_fwd.h" +#include "be_visitor_context.h" + +ACE_RCSID (be, + be_visitor_component_fwd, + "$Id$") + diff --git a/TAO/TAO_IDL/be/be_visitor_home.cpp b/TAO/TAO_IDL/be/be_visitor_home.cpp new file mode 100644 index 00000000000..4d887c5377f --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_home.cpp @@ -0,0 +1,27 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_home.cpp +// +// = DESCRIPTION +// Visitors for generation of code for a component home. +// +// = AUTHOR +// Jeff Parsons +// +// ============================================================================ + +#include "be_visitor_home.h" +#include "be_visitor_context.h" + +ACE_RCSID (be, + be_visitor_home, + "$Id$") + diff --git a/TAO/TAO_IDL/be_include/Makefile.am b/TAO/TAO_IDL/be_include/Makefile.am index 95fe395700a..769844880bc 100644 --- a/TAO/TAO_IDL/be_include/Makefile.am +++ b/TAO/TAO_IDL/be_include/Makefile.am @@ -18,6 +18,8 @@ noinst_HEADERS = \ be_array.h \ be_attribute.h \ be_codegen.h \ + be_component.h \ + be_component_fwd.h \ be_constant.h \ be_decl.h \ be_enum.h \ @@ -27,6 +29,7 @@ noinst_HEADERS = \ be_field.h \ be_generator.h \ be_helper.h \ + be_home.h \ be_interface.h \ be_interface_fwd.h \ be_interface_strategy.h \ @@ -56,6 +59,8 @@ noinst_HEADERS = \ be_visitor_argument.h \ be_visitor_array.h \ be_visitor_attribute.h \ + be_visitor_component.h \ + be_visitor_component_fwd.h \ be_visitor_constant.h \ be_visitor_context.h \ be_visitor_decl.h \ @@ -63,6 +68,7 @@ noinst_HEADERS = \ be_visitor_exception.h \ be_visitor_factory.h \ be_visitor_field.h \ + be_visitor_home.h \ be_visitor_interface.h \ be_visitor_interface_fwd.h \ be_visitor_module.h \ diff --git a/TAO/TAO_IDL/be_include/be_component.h b/TAO/TAO_IDL/be_include/be_component.h new file mode 100644 index 00000000000..c9a5f96891d --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_component.h @@ -0,0 +1,59 @@ +/* -*- c++ -*- */ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_component.h +// +// = DESCRIPTION +// Extension of class AST_Component that provides additional means for C++ +// mapping of an interface. +// +// = AUTHOR +// Jeff Parsons +// +// ============================================================================ + +#ifndef TAO_BE_COMPONENT_H +#define TAO_BE_COMPONENT_H + +#include "be_interface.h" +#include "ast_component.h" + +class be_component : public virtual AST_Component, + public virtual be_interface +{ + // = TITLE + // The back end extension of the AST_Component class + // + // = DESCRIPTION + // +public: + be_component (void); + + be_component (UTL_ScopedName *n, + AST_Component *base_component, + AST_Interface **supports, + long n_supports, + AST_Interface **supports_flat, + long n_supports_flat); + + ~be_component (void); + + virtual void destroy (void); + // Cleanup function. + + // Visiting. + virtual int accept (be_visitor *visitor); + + // Narrowing. + DEF_NARROW_METHODS2 (be_component, be_interface, AST_Component); + DEF_NARROW_FROM_DECL (be_component); + DEF_NARROW_FROM_SCOPE (be_component); +}; + +#endif // if !defined diff --git a/TAO/TAO_IDL/be_include/be_component_fwd.h b/TAO/TAO_IDL/be_include/be_component_fwd.h new file mode 100644 index 00000000000..8fedc996740 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_component_fwd.h @@ -0,0 +1,54 @@ +/* -*- c++ -*- */ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_component_fwd.h +// +// = DESCRIPTION +// Extension of class AST_ComponentFwd that provides additional +// means for C++ mapping of a forward declared component. +// +// = AUTHOR +// Jeff Parsons +// +// ============================================================================ + +#ifndef BE_COMPONENT_FWD_H +#define BE_COMPONENT_FWD_H + +#include "be_interface_fwd.h" +#include "ast_component_fwd.h" + +class be_component_fwd : public virtual AST_ComponentFwd, + public virtual be_interface_fwd +{ + // =TITLE + // be_component_fwd + // + // =DESCRIPTION + // Extensions to the AST_ComponentFwd class +public: + be_component_fwd (void); + + be_component_fwd (AST_Interface *dummy, + UTL_ScopedName *n); + + virtual ~be_component_fwd (void); + + // Cleanup function. + virtual void destroy (void); + + // Visiting. + virtual int accept (be_visitor* visitor); + + // Narrowing. + DEF_NARROW_METHODS2 (be_component_fwd, AST_ComponentFwd, be_interface_fwd); + DEF_NARROW_FROM_DECL (be_component_fwd); +}; + +#endif // if !defined diff --git a/TAO/TAO_IDL/be_include/be_generator.h b/TAO/TAO_IDL/be_include/be_generator.h index 1815a129786..323857b5059 100644 --- a/TAO/TAO_IDL/be_include/be_generator.h +++ b/TAO/TAO_IDL/be_include/be_generator.h @@ -117,6 +117,20 @@ public: virtual AST_ValueTypeFwd *create_valuetype_fwd (UTL_ScopedName *n, idl_bool abstract); + virtual AST_Component *create_component (UTL_ScopedName *n, + AST_Component *base_component, + AST_Interface **supports, + long n_supports, + AST_Interface **supports_flat, + long n_supports_flat); + + virtual AST_ComponentFwd *create_component_fwd (UTL_ScopedName *n); + + virtual AST_Home *create_home (UTL_ScopedName *n, + AST_Home *base_home, + AST_Component *managed_component, + AST_ValueType *primary_key); + virtual AST_Exception *create_exception (UTL_ScopedName *n, idl_bool local, idl_bool abstract); diff --git a/TAO/TAO_IDL/be_include/be_home.h b/TAO/TAO_IDL/be_include/be_home.h new file mode 100644 index 00000000000..05231951924 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_home.h @@ -0,0 +1,57 @@ +/* -*- c++ -*- */ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_home.h +// +// = DESCRIPTION +// Extension of class AST_Home that provides additional +// means for C++ mapping of a component home. +// +// = AUTHOR +// Jeff Parsons +// +// ============================================================================ + +#ifndef TAO_BE_HOME_H +#define TAO_BE_HOME_H + +#include "be_interface.h" +#include "ast_home.h" + +class be_home : public virtual AST_Home, + public virtual be_interface +{ + // =TITLE + // be_home + // + // =DESCRIPTION + // Extensions to the AST_Home class +public: + be_home (void); + + be_home (UTL_ScopedName *n, + AST_Home *base_home, + AST_Component *managed_component, + AST_ValueType *primary_key); + + virtual ~be_home (void); + + // Cleanup function. + virtual void destroy (void); + + // Visiting. + virtual int accept (be_visitor* visitor); + + // Narrowing. + DEF_NARROW_METHODS2 (be_home, be_interface, AST_Home); + DEF_NARROW_FROM_DECL (be_home); + DEF_NARROW_FROM_SCOPE (be_home); +}; + +#endif // if !defined diff --git a/TAO/TAO_IDL/be_include/be_interface_fwd.h b/TAO/TAO_IDL/be_include/be_interface_fwd.h index 9e9399b595b..34822128d63 100644 --- a/TAO/TAO_IDL/be_include/be_interface_fwd.h +++ b/TAO/TAO_IDL/be_include/be_interface_fwd.h @@ -11,7 +11,7 @@ // // = DESCRIPTION // Extension of class AST_InterfaceFwd that provides additional -// means for C++ mapping of an interface. +// means for C++ mapping of a forward declared interface. // // = AUTHOR // Copyright 1994-1995 by Sun Microsystems, Inc. diff --git a/TAO/TAO_IDL/be_include/be_visitor.h b/TAO/TAO_IDL/be_include/be_visitor.h index 4224847778c..e326965ddc8 100644 --- a/TAO/TAO_IDL/be_include/be_visitor.h +++ b/TAO/TAO_IDL/be_include/be_visitor.h @@ -34,6 +34,9 @@ class be_interface; class be_interface_fwd; class be_valuetype; class be_valuetype_fwd; +class be_component; +class be_component_fwd; +class be_home; class be_factory; class be_structure; class be_structure_fwd; @@ -102,6 +105,15 @@ public: virtual int visit_valuetype_fwd (be_valuetype_fwd *node); // visit valuetype_fwd + virtual int visit_component (be_component *node); + // visit component + + virtual int visit_component_fwd (be_component_fwd *node); + // visit component_fwd + + virtual int visit_home (be_home *node); + // visit component home + virtual int visit_factory (be_factory *node); // Visit a OBV factory construct. diff --git a/TAO/TAO_IDL/be_include/be_visitor_component.h b/TAO/TAO_IDL/be_include/be_visitor_component.h new file mode 100644 index 00000000000..67e63e73cda --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_component.h @@ -0,0 +1,27 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_component.h +// +// = DESCRIPTION +// Concrete visitor for the Component class +// +// = AUTHOR +// Jeff Parsons +// +// ============================================================================ + +#ifndef TAO_BE_VISITOR_COMPONENT_H +#define TAO_BE_VISITOR_COMPONENT_H + +#include "be_visitor_scope.h" + +#endif diff --git a/TAO/TAO_IDL/be_include/be_visitor_component_fwd.h b/TAO/TAO_IDL/be_include/be_visitor_component_fwd.h new file mode 100644 index 00000000000..cf2c856aac2 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_component_fwd.h @@ -0,0 +1,27 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_component_fwd.h +// +// = DESCRIPTION +// Concrete visitor for the forward declared component class. +// +// = AUTHOR +// Jeff Parsons +// +// ============================================================================ + +#ifndef TAO_BE_VISITOR_COMPONENT_FWD_H +#define TAO_BE_VISITOR_COMPONENT_FWD_H + +#include "be_visitor_decl.h" + +#endif diff --git a/TAO/TAO_IDL/be_include/be_visitor_home.h b/TAO/TAO_IDL/be_include/be_visitor_home.h new file mode 100644 index 00000000000..195d0e95b3a --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_home.h @@ -0,0 +1,27 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_home.h +// +// = DESCRIPTION +// Concrete visitor for the Home class +// +// = AUTHOR +// Jeff Parsons +// +// ============================================================================ + +#ifndef TAO_BE_VISITOR_HOME_H +#define TAO_BE_VISITOR_HOME_H + +#include "be_visitor_scope.h" + +#endif diff --git a/TAO/TAO_IDL/fe/fe_tmplinst.cpp b/TAO/TAO_IDL/fe/fe_tmplinst.cpp index f9440f2bd45..e1cef6d420f 100644 --- a/TAO/TAO_IDL/fe/fe_tmplinst.cpp +++ b/TAO/TAO_IDL/fe/fe_tmplinst.cpp @@ -1,23 +1,45 @@ // $Id$ +#include "ast_component.h" #include "ace/ACE.h" #include "ace/Hash_Map_Manager_T.h" #include "ace/Containers_T.h" class AST_Decl; class AST_Field; +class AST_Interface; +class AST_ValueType; class Identifier; #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Hash_Map_Entry<ACE_CString, int>; -template class ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Entry<ACE_CString, + int>; +template class ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, + int, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Ex<ACE_CString, + int, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex>; template class ACE_Equal_To<ACE_CString>; -template class ACE_Hash_Map_Reverse_Iterator_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Reverse_Iterator_Ex<ACE_CString, + int, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex>; template class ACE_Hash<ACE_CString>; -template class ACE_Hash_Map_Manager_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Manager<ACE_CString, int, ACE_Null_Mutex>; +template class ACE_Hash_Map_Manager_Ex<ACE_CString, + int, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex>; +template class ACE_Hash_Map_Manager<ACE_CString, + int, + ACE_Null_Mutex>; template class ACE_Node<AST_Decl *>; template class ACE_Unbounded_Set<AST_Decl *>; @@ -27,6 +49,22 @@ template class ACE_Node<AST_Field *>; template class ACE_Unbounded_Queue<AST_Field *>; template class ACE_Unbounded_Queue_Iterator<AST_Field *>; +template class ACE_Node<AST_Interface *>; +template class ACE_Unbounded_Queue<AST_Interface *>; +template class ACE_Unbounded_Queue_Iterator<AST_Interface *>; + +template class ACE_Node<AST_ValueType *>; +template class ACE_Unbounded_Queue<AST_ValueType *>; +template class ACE_Unbounded_Queue_Iterator<AST_ValueType *>; + +template class ACE_Node<AST_Component::uses_description *>; +template class ACE_Unbounded_Queue<AST_Component::uses_description *>; +template class ACE_Unbounded_Queue_Iterator<AST_Component::uses_description *>; + +template class ACE_Node<AST_Operation *>; +template class ACE_Unbounded_Queue<AST_Operation *>; +template class ACE_Unbounded_Queue_Iterator<AST_Operation *>; + template class ACE_Node<Identifier *>; template class ACE_Unbounded_Queue<Identifier *>; template class ACE_UnboundedQueue_Iterator<Identifier *>; @@ -36,22 +74,57 @@ template class ACE_Unbounded_Stack_Iterator<char *>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Hash_Map_Entry<ACE_CString, int> -#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Entry<ACE_CString, + int> +#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, + int, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Iterator_Ex<ACE_CString, + int, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> #pragma instantiate ACE_Equal_To<ACE_CString> -#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<ACE_CString, + int, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> #pragma instantiate ACE_Hash<ACE_CString> -#pragma instantiate ACE_Hash_Map_Manager_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Manager<ACE_CString, int, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Manager_Ex<ACE_CString, + int, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Manager<ACE_CString, + int, + ACE_Null_Mutex> #pragma instantiate ACE_Node<AST_Decl *> #pragma instantiate ACE_Unbounded_Set<AST_Decl *> #pragma instantiate ACE_Unbounded_Set_Iterator<AST_Decl *> -#pragma instantiate ACE_Node<AST_Decl *> -#pragma instantiate ACE_Unbounded_Queue<AST_Decl *> -#pragma instantiate ACE_Unbounded_Queue_Iterator<AST_Decl *> +#pragma instantiate ACE_Node<AST_Field *>; +#pragma instantiate ACE_Unbounded_Queue<AST_Field *>; +#pragma instantiate ACE_Unbounded_Queue_Iterator<AST_Field *>; + +#pragma instantiate ACE_Node<AST_Interface *>; +#pragma instantiate ACE_Unbounded_Queue<AST_Interface *>; +#pragma instantiate ACE_Unbounded_Queue_Iterator<AST_Interface *>; + +#pragma instantiate ACE_Node<AST_ValueType *>; +#pragma instantiate ACE_Unbounded_Queue<AST_ValueType *>; +#pragma instantiate ACE_Unbounded_Queue_Iterator<AST_ValueType *>; + +#pragma instantiate ACE_Node<AST_Operation *>; +#pragma instantiate ACE_Unbounded_Queue<AST_Operation *>; +#pragma instantiate ACE_Unbounded_Queue_Iterator<AST_Operation *>; + +#pragma instantiate ACE_Node<Identifier *>; +#pragma instantiate ACE_Unbounded_Queue<Identifier *>; +#pragma instantiate ACE_UnboundedQueue_Iterator<Identifier *>; #pragma instantiate ACE_Unbounded_Stack<char *> #pragma instantiate ACE_Unbounded_Stack_Iterator<char *> diff --git a/TAO/TAO_IDL/include/Makefile.am b/TAO/TAO_IDL/include/Makefile.am index 6887949dd8c..3bfd920dbfb 100644 --- a/TAO/TAO_IDL/include/Makefile.am +++ b/TAO/TAO_IDL/include/Makefile.am @@ -19,6 +19,8 @@ noinst_HEADERS = \ ast_argument.h \ ast_array.h \ ast_attribute.h \ + ast_component.h \ + ast_component_fwd.h \ ast_concrete_type.h \ ast_constant.h \ ast_decl.h \ @@ -29,6 +31,7 @@ noinst_HEADERS = \ ast_extern.h \ ast_field.h \ ast_generator.h \ + ast_home.h \ ast_interface.h \ ast_interface_fwd.h \ ast_module.h \ diff --git a/TAO/TAO_IDL/include/ast_component.h b/TAO/TAO_IDL/include/ast_component.h index 750f44981b2..de6fd16bb0c 100644 --- a/TAO/TAO_IDL/include/ast_component.h +++ b/TAO/TAO_IDL/include/ast_component.h @@ -1,10 +1,11 @@ // This may look like C, but it's really -*- C++ -*- // $Id$ -#ifndef _AST_INTERFACE_AST_COMPONENT_HH -#define _AST_INTERFACE_AST_COMPONENT_HH +#ifndef _AST_COMPONENT_AST_COMPONENT_HH +#define _AST_COMPONENT_AST_COMPONENT_HH #include "ast_interface.h" +#include "ace/Unbounded_Queue.h" class TAO_IDL_FE_Export AST_Component : public virtual AST_Interface { @@ -12,7 +13,7 @@ public: AST_Component (void); AST_Component (UTL_ScopedName *n, - AST_Component *parent, + AST_Component *base_component, AST_Interface **supports, long n_supports, AST_Interface **supports_flat, @@ -20,20 +21,57 @@ public: virtual ~AST_Component (void); + // Utility data structure for a 'uses' declaration. + struct uses_description + { + AST_Interface *receptacle; + idl_bool is_multiple; + }; + // Accessors. - AST_Component *parent (void) const; + AST_Component *base_component (void) const; + AST_Interface **supports (void) const; + long n_supports (void) const; - AST_Interface **supports_flat (void) const; - long n_supports_flat (void) const; + + ACE_Unbounded_Queue<AST_Interface *> &provides (void); + void provides (AST_Interface *d); + + ACE_Unbounded_Queue<uses_description *> &uses (void); + void uses (uses_description *d); + + ACE_Unbounded_Queue<AST_ValueType *> &emits (void); + void emits (AST_ValueType *d); + + ACE_Unbounded_Queue<AST_ValueType *> &publishes (void); + void publishes (AST_ValueType *d); + + ACE_Unbounded_Queue<AST_ValueType *> &consumes (void); + void consumes (AST_ValueType *d); + + // Cleanup function. + virtual void destroy (void); + + // Narrowing. + DEF_NARROW_METHODS1(AST_Component, AST_Interface); + DEF_NARROW_FROM_DECL(AST_Component); + DEF_NARROW_FROM_SCOPE(AST_Component); + + // AST Dumping. + virtual void dump (ACE_OSTREAM_TYPE &); + + // Visiting. + virtual int ast_accept (ast_visitor *visitor); private: - AST_Component *pd_parent; - AST_Interface **pd_supports; - long pd_n_supports; - AST_Interface **pd_supports_flat; - long pd_n_supports_flat; + AST_Component *pd_base_component; + ACE_Unbounded_Queue<AST_Interface *> pd_provides; + ACE_Unbounded_Queue<uses_description *> pd_uses; + ACE_Unbounded_Queue<AST_ValueType *> pd_emits; + ACE_Unbounded_Queue<AST_ValueType *> pd_publishes; + ACE_Unbounded_Queue<AST_ValueType *> pd_consumes; }; -#endif // _AST_INTERFACE_AST_COMPONENT_HH +#endif // _AST_COMPONENT_AST_COMPONENT_HH diff --git a/TAO/TAO_IDL/include/ast_component_fwd.h b/TAO/TAO_IDL/include/ast_component_fwd.h new file mode 100644 index 00000000000..244a06757b4 --- /dev/null +++ b/TAO/TAO_IDL/include/ast_component_fwd.h @@ -0,0 +1,35 @@ +// This may look like C, but it's really -*- C++ -*- +// $Id$ + +#ifndef _AST_COMPONENT_FWD_AST_COMPONENT_FWD_HH +#define _AST_COMPONENT_FWD_AST_COMPONENT_FWD_HH + +#include "ast_interface_fwd.h" + +// Representation of a forward component declaration. + +class TAO_IDL_FE_Export AST_ComponentFwd : public virtual AST_InterfaceFwd +{ +public: + AST_ComponentFwd (void); + + AST_ComponentFwd (AST_Interface *dummy, + UTL_ScopedName *n); + + virtual ~AST_ComponentFwd (void); + + // Cleanup function. + virtual void destroy (void); + + // Narrowing. + DEF_NARROW_METHODS1(AST_ComponentFwd, AST_InterfaceFwd); + DEF_NARROW_FROM_DECL(AST_ComponentFwd); + + // AST Dumping. + virtual void dump (ACE_OSTREAM_TYPE &); + + // Visiting. + virtual int ast_accept (ast_visitor *visitor); +}; + +#endif // _AST_COMPONENT_FWD_AST_COMPONENT_FWD_HH diff --git a/TAO/TAO_IDL/include/ast_decl.h b/TAO/TAO_IDL/include/ast_decl.h index 16b38868f91..d44d0d936c2 100644 --- a/TAO/TAO_IDL/include/ast_decl.h +++ b/TAO/TAO_IDL/include/ast_decl.h @@ -146,6 +146,7 @@ public: // language , NT_factory // Denotes a OBV factory construct , NT_component // Denotes a CORBA component + , NT_component_fwd // Denotes a forward declared component , NT_home // Denotes a CORBA component home , NT_finder // Denotes a home finder , NT_eventtype // Denotes a CCM event source or sink diff --git a/TAO/TAO_IDL/include/ast_generator.h b/TAO/TAO_IDL/include/ast_generator.h index a6cbcfde62c..5d90e19706b 100644 --- a/TAO/TAO_IDL/include/ast_generator.h +++ b/TAO/TAO_IDL/include/ast_generator.h @@ -78,6 +78,9 @@ class UTL_ExprList; class AST_StructureFwd; class AST_UnionFwd; class AST_ValueTypeFwd; +class AST_Component; +class AST_ComponentFwd; +class AST_Home; // Defines base class for node generators. @@ -138,6 +141,29 @@ public: idl_bool abstract ); + // Create a node representing a component. + virtual AST_Component *create_component ( + UTL_ScopedName *n, + AST_Component *base_component, + AST_Interface **supports, + long n_supports, + AST_Interface **supports_flat, + long n_supports_flat + ); + + // Create a node representing a forward declaration of a component. + virtual AST_ComponentFwd *create_component_fwd ( + UTL_ScopedName *n + ); + + // Create a node representing a component home. + virtual AST_Home *create_home ( + UTL_ScopedName *n, + AST_Home *base_home, + AST_Component *managed_component, + AST_ValueType *primary_key + ); + // Create a node representing an exception. virtual AST_Exception *create_exception ( UTL_ScopedName *n, diff --git a/TAO/TAO_IDL/include/ast_home.h b/TAO/TAO_IDL/include/ast_home.h new file mode 100644 index 00000000000..712783903bc --- /dev/null +++ b/TAO/TAO_IDL/include/ast_home.h @@ -0,0 +1,62 @@ +// This may look like C, but it's really -*- C++ -*- +// $Id$ + +#ifndef _AST_HOME_AST_HOME_HH +#define _AST_HOME_AST_HOME_HH + +#include "ast_interface.h" +#include "ace/Unbounded_Queue.h" + +class AST_Home; +class AST_Component; +class AST_ValueType; + +class TAO_IDL_FE_Export AST_Home : public virtual AST_Interface +{ +public: + AST_Home (void); + + AST_Home (UTL_ScopedName *n, + AST_Home *base_home, + AST_Component *managed_component, + AST_ValueType *primary_key); + + virtual ~AST_Home (void); + + // Accessors. + + AST_Home *base_home (void) const; + + AST_Component *managed_component (void) const; + + AST_ValueType *primary_key (void) const; + + ACE_Unbounded_Queue<AST_Operation *> &factories (void); + void factories (AST_Operation *d); + + ACE_Unbounded_Queue<AST_Operation *> &finders (void); + void finders (AST_Operation *d); + + // Cleanup function. + virtual void destroy (void); + + // Narrowing. + DEF_NARROW_METHODS1(AST_Home, AST_Interface); + DEF_NARROW_FROM_DECL(AST_Home); + DEF_NARROW_FROM_SCOPE(AST_Home); + + // AST Dumping. + virtual void dump (ACE_OSTREAM_TYPE &o); + + // Visiting. + virtual int ast_accept (ast_visitor *visitor); + +private: + AST_Home *pd_base_home; + AST_Component *pd_managed_component; + AST_ValueType *pd_primary_key; + ACE_Unbounded_Queue<AST_Operation *> pd_factories; + ACE_Unbounded_Queue<AST_Operation *> pd_finders; +}; + +#endif // _AST_HOME_AST_HOME_HH diff --git a/TAO/TAO_IDL/include/ast_module.h b/TAO/TAO_IDL/include/ast_module.h index 5998808cfd0..1b5cf150164 100644 --- a/TAO/TAO_IDL/include/ast_module.h +++ b/TAO/TAO_IDL/include/ast_module.h @@ -144,6 +144,12 @@ private: virtual AST_ValueTypeFwd *fe_add_valuetype_fwd (AST_ValueTypeFwd *i); + virtual AST_Component *fe_add_component (AST_Component *i); + + virtual AST_ComponentFwd *fe_add_component_fwd (AST_ComponentFwd *i); + + virtual AST_Home *fe_add_home (AST_Home *i); + virtual AST_Constant *fe_add_constant (AST_Constant *c); virtual AST_Exception *fe_add_exception (AST_Exception *e); diff --git a/TAO/TAO_IDL/include/ast_valuetype_fwd.h b/TAO/TAO_IDL/include/ast_valuetype_fwd.h index b3906ae49b7..3f9affdf93f 100644 --- a/TAO/TAO_IDL/include/ast_valuetype_fwd.h +++ b/TAO/TAO_IDL/include/ast_valuetype_fwd.h @@ -1,5 +1,6 @@ // This may look like C, but it's really -*- C++ -*- // $Id$ + #ifndef _AST_INTERFACE_FWD_AST_VALUETYPE_FWD_HH #define _AST_INTERFACE_FWD_AST_VALUETYPE_FWD_HH diff --git a/TAO/TAO_IDL/include/ast_visitor.h b/TAO/TAO_IDL/include/ast_visitor.h index 0e7b2fbad89..2859b9a33e3 100644 --- a/TAO/TAO_IDL/include/ast_visitor.h +++ b/TAO/TAO_IDL/include/ast_visitor.h @@ -29,6 +29,11 @@ class AST_PredefinedType; class AST_Module; class AST_Interface; class AST_InterfaceFwd; +class AST_ValueType; +class AST_ValueTypeFwd; +class AST_Component; +class AST_ComponentFwd; +class AST_Home; class AST_Factory; class AST_Structure; class AST_StructureFwd; @@ -94,10 +99,19 @@ public: virtual int visit_interface_fwd (AST_InterfaceFwd *node) = 0; // Visit interface_fwd - virtual int visit_valuetype (AST_Interface *node) = 0; + virtual int visit_valuetype (AST_ValueType *node) = 0; // Visit valuetype. - virtual int visit_valuetype_fwd (AST_InterfaceFwd *node) = 0; + virtual int visit_valuetype_fwd (AST_ValueTypeFwd *node) = 0; + // Visit valuetype_fwd + + virtual int visit_component (AST_Component *node) = 0; + // Visit valuetype. + + virtual int visit_home (AST_Home *node) = 0; + // Visit valuetype. + + virtual int visit_component_fwd (AST_ComponentFwd *node) = 0; // Visit valuetype_fwd virtual int visit_factory (AST_Factory *node) = 0; diff --git a/TAO/TAO_IDL/include/utl_scope.h b/TAO/TAO_IDL/include/utl_scope.h index 7751cdfe26e..b6acdea3da1 100644 --- a/TAO/TAO_IDL/include/utl_scope.h +++ b/TAO/TAO_IDL/include/utl_scope.h @@ -95,6 +95,9 @@ class AST_Interface; class AST_InterfaceFwd; class AST_ValueType; class AST_ValueTypeFwd; +class AST_Component; +class AST_ComponentFwd; +class AST_Home; class AST_Constant; class AST_Exception; class AST_Attribute; diff --git a/TAO/TAO_IDL/narrow/narrow.cpp b/TAO/TAO_IDL/narrow/narrow.cpp index ac5d36211b0..8d4529547d7 100644 --- a/TAO/TAO_IDL/narrow/narrow.cpp +++ b/TAO/TAO_IDL/narrow/narrow.cpp @@ -67,6 +67,8 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "ast_module.h" #include "ast_root.h" #include "ast_valuetype.h" +#include "ast_component.h" +#include "ast_home.h" #include "ast_operation.h" #include "ast_factory.h" #include "ast_exception.h" @@ -96,6 +98,10 @@ ScopeAsDecl (UTL_Scope *s) return AST_Interface::narrow_from_scope (s); case AST_Decl::NT_valuetype: return AST_ValueType::narrow_from_scope (s); + case AST_Decl::NT_component: + return AST_Component::narrow_from_scope (s); + case AST_Decl::NT_home: + return AST_Home::narrow_from_scope (s); case AST_Decl::NT_op: return AST_Operation::narrow_from_scope (s); case AST_Decl::NT_factory: @@ -136,6 +142,10 @@ DeclAsScope (AST_Decl *d) return AST_Interface::narrow_from_decl (d); case AST_Decl::NT_valuetype: return AST_ValueType::narrow_from_decl (d); + case AST_Decl::NT_component: + return AST_Component::narrow_from_decl (d); + case AST_Decl::NT_home: + return AST_Home::narrow_from_decl (d); case AST_Decl::NT_module: return AST_Module::narrow_from_decl (d); case AST_Decl::NT_root: diff --git a/TAO/TAO_IDL/util/utl_scope.cpp b/TAO/TAO_IDL/util/utl_scope.cpp index 20e635f5023..48d0a746726 100644 --- a/TAO/TAO_IDL/util/utl_scope.cpp +++ b/TAO/TAO_IDL/util/utl_scope.cpp @@ -1379,7 +1379,8 @@ UTL_Scope::lookup_by_name_local (Identifier *e, // In this case, we want to return // the full definition member, whether defined yet or not if (nt == AST_Decl::NT_interface_fwd - || nt == AST_Decl::NT_valuetype_fwd) + || nt == AST_Decl::NT_valuetype_fwd + || nt == AST_Decl::NT_component_fwd) { d = AST_InterfaceFwd::narrow_from_decl (d)->full_definition (); } |