diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-09-02 16:08:55 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-09-02 16:08:55 +0000 |
commit | 26c9fa124eddc4b46bc24960d6df84d5872e35da (patch) | |
tree | 3e2818cc047efb81594a6e1f959bff79a9b53f36 | |
parent | e5f7ae0a1020a42c7ac28d7767917b59e478a83f (diff) | |
download | ATCD-26c9fa124eddc4b46bc24960d6df84d5872e35da.tar.gz |
ChangeLogTag: Wed Sep 2 16:06:59 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r-- | modules/CIAO/ChangeLog | 8 | ||||
-rw-r--r-- | modules/CIAO/tools/IDL3_to_IDL2/idl3_to_idl2_visitor.cpp | 351 | ||||
-rw-r--r-- | modules/CIAO/tools/IDL3_to_IDL2/idl3_to_idl2_visitor.h | 10 |
3 files changed, 167 insertions, 202 deletions
diff --git a/modules/CIAO/ChangeLog b/modules/CIAO/ChangeLog index 2ae151a569b..176165c9ddd 100644 --- a/modules/CIAO/ChangeLog +++ b/modules/CIAO/ChangeLog @@ -1,3 +1,11 @@ +Wed Sep 2 16:06:59 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu> + + * tools/IDL3_to_IDL2/idl3_to_idl2_visitor.cpp: + * tools/IDL3_to_IDL2/idl3_to_idl2_visitor.h: + + Replaced commented-out gen_* methods with + corresponding visit_* methods for component ports. + Wed Aug 26 18:29:14 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu> * tools/IDL3_to_IDL2/checking_visitor.h: diff --git a/modules/CIAO/tools/IDL3_to_IDL2/idl3_to_idl2_visitor.cpp b/modules/CIAO/tools/IDL3_to_IDL2/idl3_to_idl2_visitor.cpp index b4fc2b924d4..ed6accaacaf 100644 --- a/modules/CIAO/tools/IDL3_to_IDL2/idl3_to_idl2_visitor.cpp +++ b/modules/CIAO/tools/IDL3_to_IDL2/idl3_to_idl2_visitor.cpp @@ -7,6 +7,11 @@ #include "be_extern.h" #include "ast_component_fwd.h" +#include "ast_provides.h" +#include "ast_uses.h" +#include "ast_publishes.h" +#include "ast_emits.h" +#include "ast_consumes.h" #include "ast_eventtype.h" #include "ast_eventtype_fwd.h" #include "ast_home.h" @@ -157,12 +162,6 @@ idl3_to_idl2_visitor::visit_component (AST_Component *node) -1); } - this->gen_provides (node); - this->gen_uses (node); - this->gen_publishes (node); - this->gen_emits (node); - this->gen_consumes (node); - *os << be_uidt_nl << "};"; @@ -186,6 +185,155 @@ idl3_to_idl2_visitor::visit_component_fwd (AST_ComponentFwd *node) } int +idl3_to_idl2_visitor::visit_provides (AST_Provides *node) +{ + Identifier *orig_id = + IdentifierHelper::original_local_name (node->local_name ()); + + UTL_ScopedName *n = node->provides_type ()->name (); + const char *impl_name = + IdentifierHelper::orig_sn (n).c_str (); + + *os << be_nl << be_nl + << impl_name << " provide_" << orig_id << " ();"; + + orig_id->destroy (); + delete orig_id; + orig_id = 0; + + return 0; +} + +int +idl3_to_idl2_visitor::visit_uses (AST_Uses *node) +{ + *os << be_nl << be_nl; + + Identifier *orig_id = + IdentifierHelper::original_local_name (node->local_name ()); + + UTL_ScopedName *n = node->uses_type ()->name (); + const char *impl_name = + IdentifierHelper::orig_sn (n).c_str (); + + if (node->is_multiple ()) + { + *os << "struct " << orig_id << "Connection" << be_nl + << "{" << be_idt_nl + << impl_name << " objref;" << be_nl + << "Components::Cookie ck;" << be_uidt_nl + << "};" << be_nl << be_nl + << "typedef sequence<" << orig_id << "Connection> " + << orig_id << "Connections;" + << be_nl << be_nl + << "Components::Cookie connect_" << orig_id << " (in " + << impl_name << " connection)" << be_idt_nl + << "raises (Components::ExceededConnectionLimit, " + << "Components::InvalidConnection);" << be_uidt_nl << be_nl + << impl_name << " disconnect_" << orig_id + << " (in Components::Cookie ck)" << be_idt_nl + << "raises (Components::InvalidConnection);" + << be_uidt_nl << be_nl + << orig_id << "Connections get_connections_" << orig_id + << " ();"; + } + else + { + *os << "void connect_" << orig_id << " (in " + << impl_name << " conxn)" << be_idt_nl + << "raises (Components::AlreadyConnected, " + << "Components::InvalidConnection);" << be_uidt_nl << be_nl + << impl_name << " disconnect_" << orig_id + << " ()" << be_idt_nl + << "raises (Components::NoConnection);" << be_uidt_nl << be_nl + << impl_name << " get_connection_" << orig_id + << " ();"; + } + + orig_id->destroy (); + delete orig_id; + orig_id = 0; + + return 0; +} + +int +idl3_to_idl2_visitor::visit_publishes (AST_Publishes *node) +{ + Identifier *orig_id = + IdentifierHelper::original_local_name (node->local_name ()); + + UTL_ScopedName *n = node->publishes_type ()->name (); + const char *impl_name = + IdentifierHelper::orig_sn (n, true).c_str (); + + *os << be_nl << be_nl + << "Components::Cookie subscribe_" << orig_id + << " (in " + << impl_name << "Consumer consumer)" + << be_idt_nl + << "raises (Components::ExceededConnectionLimit);" + << be_uidt_nl << be_nl + << impl_name << "Consumer unsubscribe_" << orig_id + << " (in Components::Cookie ck)" << be_idt_nl + << "raises (Components::InvalidConnection);" << be_uidt; + + orig_id->destroy (); + delete orig_id; + orig_id = 0; + + return 0; +} + +int +idl3_to_idl2_visitor::visit_emits (AST_Emits *node) +{ + Identifier *orig_id = + IdentifierHelper::original_local_name (node->local_name ()); + + UTL_ScopedName *n = node->emits_type ()->name (); + const char *impl_name = + IdentifierHelper::orig_sn (n, true).c_str (); + + *os << be_nl << be_nl + << "void connect_" << orig_id + << " (in " + << impl_name << "Consumer consumer)" << be_idt_nl + << "raises (Components::AlreadyConnected);" + << be_uidt_nl << be_nl + << impl_name << "Consumer disconnect_" << orig_id + << " ()" << be_idt_nl + << "raises (Components::NoConnection);" << be_uidt; + + orig_id->destroy (); + delete orig_id; + orig_id = 0; + + return 0; +} + +int +idl3_to_idl2_visitor::visit_consumes (AST_Consumes *node) +{ + Identifier *orig_id = + IdentifierHelper::original_local_name (node->local_name ()); + + UTL_ScopedName *n = node->consumes_type ()->name (); + const char *impl_name = + IdentifierHelper::orig_sn (n, true).c_str (); + + *os << be_nl << be_nl + << impl_name << "Consumer get_consumer_" << orig_id + << " ();"; + + orig_id->destroy (); + delete orig_id; + orig_id = 0; + + return 0; +} + +int idl3_to_idl2_visitor::visit_extended_port (AST_Extended_Port *) { return 0; @@ -490,197 +638,6 @@ idl3_to_idl2_visitor::visit_root (AST_Root *node) return 0; } -void -idl3_to_idl2_visitor::gen_provides (AST_Component *) -{ -/* - ACE_Unbounded_Queue<AST_Component::port_description> &s = - node->provides (); - AST_Component::port_description *pd = 0; - - for (ACE_Unbounded_Queue_Iterator<AST_Component::port_description> iter (s); - ! iter.done (); - iter.advance ()) - { - iter.next (pd); - - Identifier *orig_id = IdentifierHelper::original_local_name (pd->id); - - *os << be_nl << be_nl - << IdentifierHelper::orig_sn (pd->impl->name ()).c_str () - << " provide_" << orig_id << " ();"; - - orig_id->destroy (); - delete orig_id; - orig_id = 0; - } - */ -} - -void -idl3_to_idl2_visitor::gen_uses (AST_Component *) -{ -/* - ACE_Unbounded_Queue<AST_Component::port_description> &s = - node->uses (); - AST_Component::port_description *pd = 0; - - for (ACE_Unbounded_Queue_Iterator<AST_Component::port_description> iter (s); - ! iter.done (); - iter.advance ()) - { - iter.next (pd); - - *os << be_nl << be_nl; - - Identifier *orig_id = IdentifierHelper::original_local_name (pd->id); - - if (pd->is_multiple) - { - *os << "struct " << orig_id << "Connection" << be_nl - << "{" << be_idt_nl - << IdentifierHelper::orig_sn (pd->impl->name ()).c_str () - << " objref;" << be_nl - << "Components::Cookie ck;" << be_uidt_nl - << "};" << be_nl << be_nl - << "typedef sequence<" << orig_id << "Connection> " - << orig_id << "Connections;" - << be_nl << be_nl - << "Components::Cookie connect_" << orig_id << " (in " - << IdentifierHelper::orig_sn (pd->impl->name ()).c_str () - << " connection)" << be_idt_nl - << "raises (Components::ExceededConnectionLimit, " - << "Components::InvalidConnection);" << be_uidt_nl << be_nl - << IdentifierHelper::orig_sn (pd->impl->name ()).c_str () - << " disconnect_" << orig_id - << " (in Components::Cookie ck)" << be_idt_nl - << "raises (Components::InvalidConnection);" - << be_uidt_nl << be_nl - << orig_id << "Connections get_connections_" << orig_id - << " ();"; - } - else - { - *os << "void connect_" << orig_id << " (in " - << IdentifierHelper::orig_sn (pd->impl->name ()).c_str () - << " conxn)" << be_idt_nl - << "raises (Components::AlreadyConnected, " - << "Components::InvalidConnection);" << be_uidt_nl << be_nl - << IdentifierHelper::orig_sn (pd->impl->name ()).c_str () - << " disconnect_" << orig_id - << " ()" << be_idt_nl - << "raises (Components::NoConnection);" << be_uidt_nl << be_nl - << IdentifierHelper::orig_sn (pd->impl->name ()).c_str () - << " get_connection_" << orig_id - << " ();"; - } - - orig_id->destroy (); - delete orig_id; - orig_id = 0; - } - */ -} - -void -idl3_to_idl2_visitor::gen_publishes (AST_Component *) -{ -/* - ACE_Unbounded_Queue<AST_Component::port_description> &s = - node->publishes (); - AST_Component::port_description *pd = 0; - - for (ACE_Unbounded_Queue_Iterator<AST_Component::port_description> iter (s); - ! iter.done (); - iter.advance ()) - { - iter.next (pd); - - Identifier *orig_id = IdentifierHelper::original_local_name (pd->id); - - *os << be_nl << be_nl - << "Components::Cookie subscribe_" << orig_id - << " (in " - << IdentifierHelper::orig_sn (pd->impl->name (), true).c_str () - << "Consumer consumer)" - << be_idt_nl - << "raises (Components::ExceededConnectionLimit);" - << be_uidt_nl << be_nl - << IdentifierHelper::orig_sn (pd->impl->name (), true).c_str () - << "Consumer unsubscribe_" << orig_id - << " (in Components::Cookie ck)" << be_idt_nl - << "raises (Components::InvalidConnection);" << be_uidt; - - orig_id->destroy (); - delete orig_id; - orig_id = 0; - } - */ -} - -void -idl3_to_idl2_visitor::gen_emits (AST_Component *) -{ -/* - ACE_Unbounded_Queue<AST_Component::port_description> &s = - node->emits (); - AST_Component::port_description *pd = 0; - - for (ACE_Unbounded_Queue_Iterator<AST_Component::port_description> iter (s); - ! iter.done (); - iter.advance ()) - { - iter.next (pd); - - Identifier *orig_id = IdentifierHelper::original_local_name (pd->id); - - *os << be_nl << be_nl - << "void connect_" << orig_id - << " (in " - << IdentifierHelper::orig_sn (pd->impl->name (), true).c_str () - << "Consumer consumer)" << be_idt_nl - << "raises (Components::AlreadyConnected);" - << be_uidt_nl << be_nl - << IdentifierHelper::orig_sn (pd->impl->name (), true).c_str () - << "Consumer disconnect_" << orig_id - << " ()" << be_idt_nl - << "raises (Components::NoConnection);" << be_uidt; - - orig_id->destroy (); - delete orig_id; - orig_id = 0; - } - */ -} - -void -idl3_to_idl2_visitor::gen_consumes (AST_Component *) -{ -/* - ACE_Unbounded_Queue<AST_Component::port_description> &s = - node->consumes (); - AST_Component::port_description *pd = 0; - - for (ACE_Unbounded_Queue_Iterator<AST_Component::port_description> iter (s); - ! iter.done (); - iter.advance ()) - { - iter.next (pd); - - Identifier *orig_id = IdentifierHelper::original_local_name (pd->id); - - *os << be_nl << be_nl - << IdentifierHelper::orig_sn (pd->impl->name (), true).c_str () - << "Consumer get_consumer_" << orig_id - << " ();"; - - orig_id->destroy (); - delete orig_id; - orig_id = 0; - } - */ -} - UTL_ScopedName * idl3_to_idl2_visitor::create_scoped_name (const char *prefix, const char *local_name, diff --git a/modules/CIAO/tools/IDL3_to_IDL2/idl3_to_idl2_visitor.h b/modules/CIAO/tools/IDL3_to_IDL2/idl3_to_idl2_visitor.h index 1b9edd6a674..b489a8b3cd9 100644 --- a/modules/CIAO/tools/IDL3_to_IDL2/idl3_to_idl2_visitor.h +++ b/modules/CIAO/tools/IDL3_to_IDL2/idl3_to_idl2_visitor.h @@ -48,6 +48,11 @@ public: virtual int visit_interface (AST_Interface *node); virtual int visit_component (AST_Component *node); virtual int visit_component_fwd (AST_ComponentFwd *node); + virtual int visit_provides (AST_Provides *node); + virtual int visit_uses (AST_Uses *node); + virtual int visit_publishes (AST_Publishes *node); + virtual int visit_emits (AST_Emits *node); + virtual int visit_consumes (AST_Consumes *node); virtual int visit_extended_port (AST_Extended_Port *node); virtual int visit_mirror_port (AST_Mirror_Port *node); virtual int visit_connector (AST_Connector *node); @@ -62,11 +67,6 @@ public: virtual int visit_root (AST_Root *node); private: - void gen_provides (AST_Component *node); - void gen_uses (AST_Component *node); - void gen_publishes (AST_Component *node); - void gen_emits (AST_Component *node); - void gen_consumes (AST_Component *node); UTL_ScopedName *create_scoped_name (const char *prefix, const char *local_name, const char *suffix, |