summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL
diff options
context:
space:
mode:
authormayur <mayur@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2002-01-15 22:04:23 +0000
committermayur <mayur@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2002-01-15 22:04:23 +0000
commit811fa466ecdda7226255a345f18a57ea01b6dd9a (patch)
tree5010f1d3f5db972986e5adc691ee3ba98bc3f421 /TAO/TAO_IDL
parent2e216d8be458be8869acda4798089ca166ba64cf (diff)
downloadATCD-811fa466ecdda7226255a345f18a57ea01b6dd9a.tar.gz
Snapshot of IDl-compiler files changes to accomodate the new approach to generating AMH code
Diffstat (limited to 'TAO/TAO_IDL')
-rw-r--r--TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp1117
-rw-r--r--TAO/TAO_IDL/be/be_visitor_factory.cpp12
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface.cpp7
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/amh_ch.cpp144
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/amh_rh_sh.cpp118
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/amh_rh_ss.cpp103
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/amh_sh.cpp349
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp26
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface.cpp20
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp17
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp14
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/amh_rh_sh.cpp125
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/amh_rh_ss.cpp123
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/amh_sh.cpp108
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/amh_ss.cpp78
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_amh_pre_proc.h40
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface.h7
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/amh_ch.h45
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/amh_rh_sh.h29
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/amh_rh_ss.h28
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/amh_sh.h51
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/amh_ss.h23
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation.h8
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/amh_rh_sh.h33
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/amh_rh_ss.h36
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/amh_sh.h25
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_operation/amh_ss.h25
28 files changed, 1409 insertions, 1308 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp b/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp
index e03bdd4e6b4..43384c2efeb 100644
--- a/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp
@@ -62,149 +62,32 @@ be_visitor_amh_pre_proc::visit_interface (be_interface *node)
{
AST_Module *module =
AST_Module::narrow_from_scope (node->defined_in ());
-
+
if (!module)
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_amh_pre_proc::"
"visit_interface - module is null\n"),
-1);
-
- // Create the AMH-skeleton node
- be_interface *amh_class = this->create_amh_class (node);
-
- if (amh_class)
- {
- amh_class->set_defined_in (node->defined_in ());
-
- // Insert the new amh class after the node
- module->be_add_interface (amh_class, node);
-
- // Remember from whom we were cloned
- amh_class->original_interface (node);
- }
- else
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_amh_pre_proc::"
- "visit_interface - "
- "creating the amh_class failed\n"),
- -1);
- }
-
- // Since this is server side only, don't generate the client stuff.
- // We do this by pretending that all this stuff has already been
- // generated.
- amh_class->cli_hdr_gen (1);
- amh_class->cli_stub_gen (1);
- amh_class->cli_hdr_any_op_gen (1);
- amh_class->cli_stub_any_op_gen (1);
- amh_class->cli_hdr_cdr_op_gen (1);
- amh_class->cli_stub_cdr_op_gen (1);
- amh_class->cli_inline_cdr_op_gen (1);
- amh_class->cli_inline_gen (1);
-
- // Set the proper strategy
- be_interface_strategy *old_strategy =
- amh_class->set_strategy (new be_interface_amh_strategy (amh_class));
-
- if (old_strategy)
- delete old_strategy;
-/*
- be_valuetype *excep_holder = this->create_exception_holder (node);
- if (excep_holder)
- {
- excep_holder->set_defined_in (node->defined_in ());
- // Insert the exception holder after the original node,
- // this way we ensure that it is *before* the
- // ami handler, which is the way we want to have it.
- //module->be_add_interface (excep_holder, node);
- module->be_add_interface (excep_holder, amh_class);
- module->set_has_nested_valuetype ();
- // Remember from whom we were cloned
- excep_holder->original_interface (node);
-*/
- /*
- // Set the strategy
- be_interface_strategy *old_strategy =
- excep_holder->set_strategy (
- new be_interface_ami_exception_holder_strategy (excep_holder)
- );
- if (old_strategy)
- delete old_strategy;
- */
-/* }
- else
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_amh_pre_proc::"
- "visit_interface - "
- "creating the exception holder failed\n"),
- -1);
- }
-*/
-
- // Create the Server side ResponseHandler class
- be_interface *response_handler_s = this->create_skeleton_response_handler (node); //, excep_holder);
- if (response_handler_s)
- {
- response_handler_s->set_defined_in (node->defined_in ());
-
- // Insert the ami handler after the node, the
- // exception holder will be placed between these two later.
- module->be_add_interface (response_handler_s, amh_class);
-
- // Remember from whom we were cloned
- response_handler_s->original_interface (node);
-
- // Since this is server side only, don't generate the client stuff.
- // We do this by pretending that all this stuff has already been
- // generated.
- response_handler_s->cli_hdr_gen (1);
- response_handler_s->cli_stub_gen (1);
- response_handler_s->cli_hdr_any_op_gen (1);
- response_handler_s->cli_stub_any_op_gen (1);
- response_handler_s->cli_hdr_cdr_op_gen (1);
- response_handler_s->cli_stub_cdr_op_gen (1);
- response_handler_s->cli_inline_cdr_op_gen (1);
- response_handler_s->cli_inline_gen (1);
- }
- else
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_amh_pre_proc::"
- "visit_interface - "
- "creating the response handler failed\n"),
- -1);
- }
-
- // Create the Client side ResponseHandler class
- be_interface *response_handler_c = this->create_client_response_handler (node); //, excep_holder);
- if (response_handler_c)
+
+ // Create the ResponseHandler class
+ be_interface *response_handler = this->create_response_handler (node);
+ if (response_handler)
{
- response_handler_c->set_defined_in (node->defined_in ());
-
- // Insert the ami handler after the node, the
- // exception holder will be placed between these two later.
- module->be_add_interface (response_handler_c, amh_class);
-
+ response_handler->set_defined_in (node->defined_in ());
+
+ // Insert the response handler after the node.
+ module->be_add_interface (response_handler, node);
+
// Remember from whom we were cloned
- response_handler_c->original_interface (node);
-
- // Since this is client side only, don't generate the server side stuff.
- // We do this by pretending that all this stuff has already been
- // generated.
- response_handler_c->srv_hdr_gen (1);
- response_handler_c->srv_skel_gen (1);
- response_handler_c->srv_inline_gen (1);
- // We need to generate only client header; so we do not generate any of the
- // other client stuff
- response_handler_s->cli_stub_gen (1);
- response_handler_s->cli_hdr_any_op_gen (1);
- response_handler_s->cli_stub_any_op_gen (1);
- response_handler_s->cli_hdr_cdr_op_gen (1);
- response_handler_s->cli_stub_cdr_op_gen (1);
- response_handler_s->cli_inline_cdr_op_gen (1);
- response_handler_s->cli_inline_gen (1);
+ response_handler->original_interface (node);
+
+ // We don't need any code-generation in the client source files:
+ response_handler->cli_stub_gen (I_TRUE);
+ response_handler->cli_stub_any_op_gen (I_TRUE);
+ response_handler->cli_stub_cdr_op_gen (I_TRUE);
+ response_handler->cli_inline_gen (I_TRUE);
+ response_handler->cli_inline_cdr_op_gen (I_TRUE);
+ response_handler->cli_inline_cdr_decl_gen (I_TRUE);
}
else
{
@@ -214,168 +97,44 @@ be_visitor_amh_pre_proc::visit_interface (be_interface *node)
"creating the response handler failed\n"),
-1);
}
-
- /*
- // Set the proper strategy
- be_interface_strategy *old_strategy =
- node->set_strategy (new be_interface_ami_strategy (node,
- response_handler));
-
- if (old_strategy)
- delete old_strategy;
-
- */
- if (this->visit_scope (node) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_amh_pre_proc::"
- "visit_interface - visit scope failed\n"),
- -1);
}
-
return 0;
}
-
-int
-be_visitor_amh_pre_proc::visit_operation (be_operation *node)
+be_interface *
+be_visitor_amh_pre_proc::create_response_handler (be_interface *node)
{
- // We do nothing for oneways!
- if (node->flags () == AST_Operation::OP_oneway)
- return 0;
-
- // Set the proper strategy
- be_operation_strategy *old_strategy =
- node->set_strategy (new be_operation_amh_strategy (node));
-
- if (old_strategy)
- delete old_strategy;
-
- /* be_operation *sendc_marshaling =
- this->create_sendc_operation (node,
- 0); // for arguments = FALSE
-
- be_operation *sendc_arguments =
- this->create_sendc_operation (node,
- 1); // for arguments = TRUE
-
- if (sendc_marshaling && sendc_arguments)
- {
- sendc_marshaling->set_defined_in (node->defined_in ());
+ // Generate 'Module::AMH_InterfaceResponseHandler'
+ ACE_CString class_name (node->client_enclosing_scope ());
+ class_name += "AMH_";
+ class_name += node->local_name ();
+ class_name += "ResponseHandler";
+
+ UTL_ScopedName *utl_class_name =
+ new UTL_ScopedName (new Identifier (class_name.c_str ()), 0);
+
+ be_interface *response_handler =
+ new be_interface (utl_class_name, // name
+ 0, // list of inherited
+ 0, // number of inherited
+ 0, // list of ancestors
+ 0, // number of ancestors
+ 0, // local
+ 0); // non-abstract
- sendc_arguments->set_defined_in (node->defined_in ());
+ response_handler->set_name (utl_class_name);
- // We do not copy the exceptions because the exceptions
- // are delivered by the excep methods.
+ add_rh_node_members (node, response_handler);
- // Set the proper strategy, and store the specialized
- // marshaling and arguments operations in it.
- be_operation_strategy *old_strategy =
- node->set_strategy (new be_operation_ami_sendc_strategy (node,
- sendc_marshaling,
- sendc_arguments));
- if (old_strategy)
- delete old_strategy;
- }
- */
- return 0;
+ return response_handler;
}
-
int
-be_visitor_amh_pre_proc::visit_attribute (be_attribute *node)
-{
- // Temporarily generate the set operation.
- be_operation *set_operation =
- this->generate_set_operation (node);
-
- this->visit_operation (set_operation);
-
- // Retrieve the strategy set by the visit operation
- be_operation_strategy *set_operation_strategy =
- set_operation->set_strategy (
- new be_operation_default_strategy (set_operation)
- );
-
- // Assign it to the attribute as set_operation strategy
- if (set_operation_strategy)
- delete node->set_set_strategy (set_operation_strategy);
-
- // Temporerily generate the get operation.
- be_operation *get_operation =
- this->generate_get_operation (node);
-
- this->visit_operation (get_operation);
-
- be_operation_strategy *get_operation_strategy =
- get_operation->set_strategy (
- new be_operation_default_strategy (get_operation)
- );
-
- if (get_operation_strategy)
- delete node->set_get_strategy (get_operation_strategy);
-
-
- return 0;
-}
-
-
-
-be_valuetype *
-be_visitor_amh_pre_proc::create_exception_holder (be_interface *node)
+be_visitor_amh_pre_proc::add_rh_node_members ( be_interface *node,
+ be_interface *response_handler)
{
-
- // Create a virtual module named "Messaging" and a valuetype
- // "ExceptionHolder" from which we inherit.
- UTL_ScopedName *inherit_name =
- new UTL_ScopedName (new Identifier ("Messaging"),
- 0);
-
- inherit_name->nconc (new UTL_ScopedName (new Identifier ("ExceptionHolder"),
- 0));
-
- be_valuetype *inherit_vt = new be_valuetype (inherit_name,
- 0,
- 0,
- 0);
- inherit_vt->set_name (inherit_name);
-
-// be_module *msg = new be_module (new UTL_ScopedName (new Identifier ("Messaging"),
-// 0),
-// 0);
-
- be_module *msg =
- new be_module (new UTL_ScopedName (new Identifier ("Messaging"),
- 0));
-
- // Notice the valuetype "ExceptionHolder" that it is defined in the
- // "Messaging" module
- inherit_vt->set_defined_in (msg);
-
- // Create the excpetion holder name
- ACE_CString excep_holder_local_name;
- this->generate_name (excep_holder_local_name,
- "AMH_",
- node->name ()->last_component ()->get_string(),
- "");
-
- UTL_ScopedName *excep_holder_name =
- ACE_static_cast (UTL_ScopedName *, node->name ()->copy ());
- excep_holder_name->last_component ()->replace_string (
- excep_holder_local_name.rep ()
- );
-
- AST_Interface_ptr *p_intf = new AST_Interface_ptr[1];
- p_intf[0] = ACE_static_cast (AST_Interface *, inherit_vt);
-
- be_valuetype *excep_holder =
- new be_valuetype (excep_holder_name, // name
- p_intf, // list of inherited
- 1, // number of inherited
- 0); // set abstract
- excep_holder->set_name (excep_holder_name);
-
// Now our customized valuetype is created, we have to
// add now the operations and attributes to the scope.
@@ -387,11 +146,12 @@ be_visitor_amh_pre_proc::create_exception_holder (be_interface *node)
UTL_ScopeActiveIterator (node,
UTL_Scope::IK_decls),
0);
+
+ this->elem_number_ = 0;
// continue until each element is visited
while (!si->is_done ())
{
AST_Decl *d = si->item ();
-
if (!d)
{
delete si;
@@ -403,124 +163,14 @@ be_visitor_amh_pre_proc::create_exception_holder (be_interface *node)
}
- be_decl *op = be_decl::narrow_from_decl (d);
-
if (d->node_type () == AST_Decl::NT_attr)
{
- AST_Attribute *attribute = AST_Attribute::narrow_from_decl (d);
+ be_attribute *attribute = be_attribute::narrow_from_decl (d);
if (!attribute)
- return 0;
-
- this->create_raise_operation (op,
- excep_holder,
- GET_OPERATION);
-
- if (!attribute->readonly ())
{
- this->create_raise_operation (op,
- excep_holder,
- SET_OPERATION);
+ return 0;
}
-
- }
- else
- {
- this->create_raise_operation (op,
- excep_holder,
- NORMAL);
- }
- si->next ();
- } // end of while loop
- delete si;
- } // end of if
-
- return excep_holder;
-}
-
-
-be_interface *
-be_visitor_amh_pre_proc::create_amh_class (be_interface *node)
-{
- // Create the response handler name
- ACE_CString amh_class_local_name;
- this->generate_name (amh_class_local_name,
- "AMH_",
- node->name ()->last_component ()->get_string(),
- "");
-
- UTL_ScopedName *amh_class_name =
- ACE_static_cast (UTL_ScopedName *, node->name ()->copy ());
- amh_class_name->last_component ()->replace_string (
- amh_class_local_name.rep ()
- );
-
- // AST_Interface_ptr *p_intf = new AST_Interface_ptr[1];
-
- be_interface *amh_class =
- new be_interface (amh_class_name, // name
- 0, // list of inherited
- 0, // number of inherited
- 0, // list of ancestors
- 0, // number of ancestors
- 0, // non-local
- 0); // non-abstract
- amh_class->set_name (amh_class_name);
-
- // Now our customized valuetype is created, we have to
- // add now the operations and attributes to the scope.
-
- if (node->nmembers () > 0)
- {
- // initialize an iterator to iterate thru our scope
- UTL_ScopeActiveIterator *si;
- ACE_NEW_RETURN (si,
- UTL_ScopeActiveIterator (node,
- UTL_Scope::IK_decls),
- 0);
- this->elem_number_ = 0;
- // continue until each element is visited
- while (!si->is_done ())
- {
- AST_Decl *d = si->item ();
- if (!d)
- {
- delete si;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_amh_pre_proc::visit_interface - "
- "bad node in this scope\n"),
- 0);
-
- }
-
- if (d->node_type () == AST_Decl::NT_attr)
- {
- be_attribute *attribute = be_attribute::narrow_from_decl (d);
-
- if (!attribute)
- return 0;
-
- /*
- be_operation *get_operation = this->generate_get_operation (attribute);
-
- this->create_response_handler_operation (get_operation,
- response_handler);
-
- this->create_excep_operation (get_operation,
- response_handler,
- excep_holder);
-
- if (!attribute->readonly ())
- {
- be_operation *set_operation = this->generate_set_operation (attribute);
- this->create_response_handler_operation (set_operation,
- response_handler);
-
- this->create_excep_operation (set_operation,
- response_handler,
- excep_holder);
- }
- */
}
else
{
@@ -528,73 +178,36 @@ be_visitor_amh_pre_proc::create_amh_class (be_interface *node)
if (operation)
{
- this->create_amh_operation (operation, amh_class);
+ this->create_response_handler_operation (operation,
+ response_handler);
}
- /*
- if (operation)
- {
- this->create_response_handler_operation (operation,
- response_handler);
- this->create_excep_operation (be_operation::narrow_from_decl (d),
- response_handler,
- excep_holder);
- }
- */
}
+
si->next ();
} // end of while loop
+
delete si;
} // end of if
-
- return amh_class;
+ return 1;
}
-/*
- be_interface *
- be_visitor_amh_pre_proc::create_rh_skel_class (be_interface *node)
- {
- // Create the rh_class name
- ACE_CString rh_class_local_name;
- this->generate_name (rh_class_local_name,
- "TAO_AMH_",
- node->name ()->last_component ()->get_string(),
- "ResponseHandler");
-
- UTL_ScopedName *rh_class_name =
- ACE_static_cast (UTL_ScopedName *, node->name ()->copy ());
- rh_class_name->last_component ()->replace_string (
- rh_class_local_name.rep ()
- );
-
- // AST_Interface_ptr *p_intf = new AST_Interface_ptr[1];
-
- be_interface *rh_class =
- new be_interface (rh_class_name, // name
- 0, // list of inherited
- 0, // number of inherited
- 0, // list of ancestors
- 0, // number of ancestors
- 0, // non-local
- 0); // non-abstract
- rh_class->set_name (rh_class_name);
-
- return rh_class;
- }
-*/
-
-
int
-be_visitor_amh_pre_proc::create_amh_operation (be_operation *node,
- be_interface *amh_class)
+be_visitor_amh_pre_proc::create_response_handler_operation (be_operation *node,
+ be_interface *response_handler
+ )
{
if (!node)
- return -1;
+ {
+ return -1;
+ }
- // We do nothing for oneways!
if (node->flags () == AST_Operation::OP_oneway)
- return 0;
+ {
+ // We do nothing for oneways!
+ return 0;
+ }
// Create the return type, which is "void"
be_predefined_type *rt =
@@ -602,48 +215,38 @@ be_visitor_amh_pre_proc::create_amh_operation (be_operation *node,
new UTL_ScopedName (new Identifier ("void"),
0));
- ACE_CString original_op_name (
- node->name ()->last_component ()->get_string ()
- );
+ ACE_CString original_op_name (node->name ()->last_component ()->get_string ());
UTL_ScopedName *op_name =
- ACE_static_cast (UTL_ScopedName *, amh_class->name ()-> copy ());
+ ACE_static_cast (UTL_ScopedName *, response_handler->name ()-> copy ());
op_name->nconc (new UTL_ScopedName (new Identifier (original_op_name.rep ()),
0));
// Create the operation
- be_operation *operation = new be_operation (rt, //node->return_type (),
+ be_operation *operation = new be_operation (rt,
AST_Operation::OP_noflags,
op_name,
0,
0);
operation->set_name (op_name);
+ // If return type is non-void add it as first argument
- ACE_CString new_op_name = ACE_CString ("reply_") + original_op_name;
+ if (!node->void_return_type ())
+ {
+
+ // Create the argument
+ be_argument *arg =
+ new be_argument (AST_Argument::dir_IN,
+ node->return_type (),
+ new UTL_ScopedName (new Identifier ("return_value"),
+ 0));
- UTL_ScopedName *rtop_name =
- ACE_static_cast (UTL_ScopedName *, node->name ()-> copy ());
- op_name->last_component ()->replace_string (new_op_name.rep ());
+ // Add the response handler to the argument list
+ operation->add_argument_to_scope (arg);
+ }
- // Create the operation
- be_operation * rtoperation = new be_operation (rt, //node->return_type (),
- AST_Operation::OP_noflags,
- rtop_name,
- 0,
- 0);
-
- rtoperation->set_name (op_name);
-
- /* Add the response_handler as the first argument
- be_argument *rh_arg = new be_argument (Direction.dir_IN,
- thid->response_handler, original_arg->field_type (),
- original_arg->name (),
- 0);
- operation->add_argument_to_scope (rh_arg);
- */
-
- // Iterate over the arguments and put all the in and inout
+ // Iterate over the arguments and put all the out and inout arguments
// into the new method.
if (node->nmembers () > 0)
{
@@ -658,6 +261,7 @@ be_visitor_amh_pre_proc::create_amh_operation (be_operation *node,
while (!si->is_done ())
{
AST_Decl *d = si->item ();
+
if (!d)
{
delete si;
@@ -669,131 +273,150 @@ be_visitor_amh_pre_proc::create_amh_operation (be_operation *node,
}
+ //be_decl *arg = be_decl::narrow_from_decl (d);
AST_Argument *original_arg = AST_Argument::narrow_from_decl (d);
if (original_arg->direction () == AST_Argument::dir_INOUT ||
- original_arg->direction () == AST_Argument::dir_IN)
- {
- // Create the argument
- be_argument *arg = new be_argument (original_arg->direction (),
- original_arg->field_type (),
- original_arg->name ());
-
- operation->add_argument_to_scope (arg);
- }
- if (original_arg->direction () == AST_Argument::dir_INOUT ||
original_arg->direction () == AST_Argument::dir_OUT)
{
// Create the argument
- be_argument *arg = new be_argument (original_arg->direction (),
+ be_argument *arg = new be_argument (AST_Argument::dir_IN,
original_arg->field_type (),
original_arg->name ());
- rtoperation->add_argument_to_scope (arg);
+ operation->add_argument_to_scope (arg);
}
si->next ();
- }
+ } // end of while loop
+
delete si;
- }
+ } // end of if
- // Set the proper strategy
- //be_operation_strategy *old_strategy =
- // operation->set_strategy (new be_operation_amh_strategy (operation));
- //if (old_strategy)
- // delete old_strategy;
+ operation->set_defined_in (response_handler);
- operation->set_defined_in (amh_class);
+ // We do not copy the exceptions because the exceptions
+ // are delivered by the excep methods.
// After having generated the operation we insert it into the
- // AMH class interface.
- amh_class->be_add_operation (operation);
+ // response handler interface.
+ response_handler->be_add_operation (operation);
+
+ return 0;
+}
+
+
+int
+be_visitor_amh_pre_proc::visit_operation (be_operation *node)
+{
+ // We do nothing for oneways!
+ if (node->flags () == AST_Operation::OP_oneway)
+ return 0;
+
+ // Set the proper strategy
+ be_operation_strategy *old_strategy =
+ node->set_strategy (new be_operation_amh_strategy (node));
+
+ if (old_strategy)
+ delete old_strategy;
+
+ return 0;
+}
+
+
+int
+be_visitor_amh_pre_proc::visit_attribute (be_attribute *node)
+{
+ // Temporarily generate the set operation.
+ be_operation *set_operation =
+ this->generate_set_operation (node);
+
+ this->visit_operation (set_operation);
+
+ // Retrieve the strategy set by the visit operation
+ be_operation_strategy *set_operation_strategy =
+ set_operation->set_strategy (
+ new be_operation_default_strategy (set_operation)
+ );
+
+ // Assign it to the attribute as set_operation strategy
+ if (set_operation_strategy)
+ delete node->set_set_strategy (set_operation_strategy);
+
+ // Temporerily generate the get operation.
+ be_operation *get_operation =
+ this->generate_get_operation (node);
+
+ this->visit_operation (get_operation);
+
+ be_operation_strategy *get_operation_strategy =
+ get_operation->set_strategy (
+ new be_operation_default_strategy (get_operation)
+ );
- rtoperation->set_defined_in (amh_class);
+ if (get_operation_strategy)
+ delete node->set_get_strategy (get_operation_strategy);
- amh_class->be_add_operation (rtoperation);
return 0;
}
-be_interface *
-be_visitor_amh_pre_proc::create_skeleton_response_handler (be_interface *node)
- //, be_valuetype * /*excep_holder*/)
+be_valuetype *
+be_visitor_amh_pre_proc::create_exception_holder (be_interface *node)
{
- // Generate 'Stock::AMH_QuoterResponseHandler'
- ACE_CString class_name (node->client_enclosing_scope ());
- class_name += "AMH_";
- class_name += node->local_name ();
- class_name += "ResponseHandler";
+
+ // Create a virtual module named "Messaging" and a valuetype
+ // "ExceptionHolder" from which we inherit.
UTL_ScopedName *inherit_name =
- new UTL_ScopedName (new Identifier (class_name.rep ()),
- 0);
- be_interface *inherit_intf =
- new be_interface (inherit_name,
- 0, // inherited interfaces
- 0, // number of inherited interfaces
- 0, // ancestors
- 0, // number of ancestors
- 0, // not local
- 0); // not abstract
- inherit_intf->set_name (inherit_name);
-
- // Generate 'TAO_AMH_ResponseHandler': This is fixed and same for any RH.
- ACE_CString tao_rh_name ("TAO_AMH_ResponseHandler");
- UTL_ScopedName *tao_inherit_name =
- new UTL_ScopedName (new Identifier (tao_rh_name.rep ()),
+ new UTL_ScopedName (new Identifier ("Messaging"),
0);
- be_interface *tao_inherit_intf =
- new be_interface (tao_inherit_name,
- 0, // inherited interfaces
- 0, // number of inherited interfaces
- 0, // ancestors
- 0, // number of ancestors
- 1, // local
- 0); // not abstract
- tao_inherit_intf->set_name (tao_inherit_name);
-
-
-
- // Create the response handler name
- ACE_CString response_handler_local_name;
- this->generate_name (response_handler_local_name,
- "TAO_AMH_",
- node->name ()->last_component ()->get_string(),
- "ResponseHandler");
- UTL_ScopedName *response_handler_name =
- ACE_static_cast (UTL_ScopedName *, node->name ()->copy ());
- response_handler_name->last_component ()->replace_string (
- response_handler_local_name.rep ()
- );
+ inherit_name->nconc (new UTL_ScopedName (new Identifier ("ExceptionHolder"),
+ 0));
- AST_Interface_ptr *p_intf = new AST_Interface_ptr[2];
- p_intf[0] = ACE_static_cast (AST_Interface *, inherit_intf);
- p_intf[1] = ACE_static_cast (AST_Interface *, tao_inherit_intf);
+ be_valuetype *inherit_vt = new be_valuetype (inherit_name,
+ 0,
+ 0,
+ 0);
+ inherit_vt->set_name (inherit_name);
- be_interface *response_handler =
- new be_interface (response_handler_name, // name
- p_intf, // list of inherited
- 2, // number of inherited
- p_intf, // list of ancestors
- 1, // number of ancestors
- 1, // local
- 0); // non-abstract
- response_handler->set_name (response_handler_name);
+ // be_module *msg = new be_module (new UTL_ScopedName (new Identifier ("Messaging"),
+ // 0),
+ // 0);
- add_rh_node_members (node, response_handler);
+ be_module *msg =
+ new be_module (new UTL_ScopedName (new Identifier ("Messaging"),
+ 0));
- return response_handler;
+ // Notice the valuetype "ExceptionHolder" that it is defined in the
+ // "Messaging" module
+ inherit_vt->set_defined_in (msg);
-}
+ // Create the excpetion holder name
+ ACE_CString excep_holder_local_name;
+ this->generate_name (excep_holder_local_name,
+ "AMH_",
+ node->name ()->last_component ()->get_string(),
+ "");
-int
-be_visitor_amh_pre_proc::add_rh_node_members ( be_interface *node,
- be_interface *response_handler)
-{
- // Now our customized valuetype is created, we have to
+ UTL_ScopedName *excep_holder_name =
+ ACE_static_cast (UTL_ScopedName *, node->name ()->copy ());
+ excep_holder_name->last_component ()->replace_string (
+ excep_holder_local_name.rep ()
+ );
+
+ AST_Interface_ptr *p_intf = new AST_Interface_ptr[1];
+ p_intf[0] = ACE_static_cast (AST_Interface *, inherit_vt);
+
+ be_valuetype *excep_holder =
+ new be_valuetype (excep_holder_name, // name
+ p_intf, // list of inherited
+ 1, // number of inherited
+ 0); // set abstract
+ excep_holder->set_name (excep_holder_name);
+
+ // Now our customized valuetype is created, we have to
// add now the operations and attributes to the scope.
if (node->nmembers () > 0)
@@ -804,11 +427,11 @@ be_visitor_amh_pre_proc::add_rh_node_members ( be_interface *node,
UTL_ScopeActiveIterator (node,
UTL_Scope::IK_decls),
0);
- this->elem_number_ = 0;
// continue until each element is visited
while (!si->is_done ())
{
AST_Decl *d = si->item ();
+
if (!d)
{
delete si;
@@ -820,91 +443,43 @@ be_visitor_amh_pre_proc::add_rh_node_members ( be_interface *node,
}
+ be_decl *op = be_decl::narrow_from_decl (d);
+
if (d->node_type () == AST_Decl::NT_attr)
{
- be_attribute *attribute = be_attribute::narrow_from_decl (d);
+ AST_Attribute *attribute = AST_Attribute::narrow_from_decl (d);
if (!attribute)
- {
- return 0;
- }
-/*
- be_operation *get_operation =
- this->generate_get_operation (attribute);
- this->create_response_handler_operation (get_operation,
- response_handler);
+ return 0;
- this->create_excep_operation (get_operation,
- response_handler,
- excep_holder);
+ this->create_raise_operation (op,
+ excep_holder,
+ GET_OPERATION);
if (!attribute->readonly ())
{
- be_operation *set_operation = this->generate_set_operation (attribute);
- this->create_response_handler_operation (set_operation,
- response_handler);
-
- this->create_excep_operation (set_operation,
- response_handler,
- excep_holder);
+ this->create_raise_operation (op,
+ excep_holder,
+ SET_OPERATION);
}
-*/
+
}
else
{
- be_operation* operation = be_operation::narrow_from_decl (d);
-
- if (operation)
- {
- this->create_response_handler_operation (operation,
- response_handler);
-
- /*
- this->create_excep_operation (be_operation::narrow_from_decl (d),
- response_handler,
- excep_holder);
- */
- }
-
+ this->create_raise_operation (op,
+ excep_holder,
+ NORMAL);
}
-
si->next ();
} // end of while loop
-
delete si;
} // end of if
- return 1;
-}
-
-
-be_interface *
-be_visitor_amh_pre_proc::create_client_response_handler (be_interface *node)
-{
- // Generate 'AMH_QuoterResponseHandler'
- // Create the response handler name
- ACE_CString rh_local_name;
- this->generate_name (rh_local_name,
- "AMH_",
- node->name ()->last_component ()->get_string(),
- "ResponseHandler");
- UTL_ScopedName *rh_class_name = ACE_static_cast (UTL_ScopedName *, node->name ()->copy ());
- rh_class_name->last_component ()->replace_string (rh_local_name.rep ());
+ return excep_holder;
+}
- be_interface *rh_class =
- new be_interface (rh_class_name, // name
- 0, // list of inherited
- 0, // number of inherited
- 0, // list of ancestors
- 0, // number of ancestors
- 1, // local
- 1); // abstract
- rh_class->set_name (rh_class_name);
- add_rh_node_members (node, rh_class);
- return rh_class;
-}
int
be_visitor_amh_pre_proc::create_raise_operation (be_decl *node,
@@ -973,8 +548,8 @@ be_visitor_amh_pre_proc::create_raise_operation (be_decl *node,
// Set the proper strategy
be_operation_strategy *old_strategy =
operation->set_strategy (
- new be_operation_ami_exception_holder_raise_strategy (operation)
- );
+ new be_operation_ami_exception_holder_raise_strategy (operation)
+ );
if (old_strategy)
{
@@ -988,276 +563,6 @@ be_visitor_amh_pre_proc::create_raise_operation (be_decl *node,
return 0;
}
-int
-be_visitor_amh_pre_proc::create_response_handler_operation (
- be_operation *node,
- be_interface *response_handler
- )
-{
- if (!node)
- {
- return -1;
- }
-
- if (node->flags () == AST_Operation::OP_oneway)
- {
- // We do nothing for oneways!
- return 0;
- }
-
- // Create the return type, which is "void"
- be_predefined_type *rt =
- new be_predefined_type (AST_PredefinedType::PT_void,
- new UTL_ScopedName (new Identifier ("void"),
- 0));
-
- ACE_CString original_op_name (
- node->name ()->last_component ()->get_string ()
- );
-
- UTL_ScopedName *op_name =
- ACE_static_cast (UTL_ScopedName *, response_handler->name ()-> copy ());
- op_name->nconc (new UTL_ScopedName (new Identifier (original_op_name.rep ()),
- 0));
-
- // Create the operation
- be_operation *operation = new be_operation (rt,
- AST_Operation::OP_noflags,
- op_name,
- 0,
- 0);
- operation->set_name (op_name);
-
- // If return type is non-void add it as first argument
-
- if (!node->void_return_type ())
- {
-
- // Create the argument
- be_argument *arg =
- new be_argument (AST_Argument::dir_IN,
- node->return_type (),
- new UTL_ScopedName (new Identifier ("return_value"),
- 0));
-
- // Add the response handler to the argument list
- operation->add_argument_to_scope (arg);
- }
-
- // Iterate over the arguments and put all the out and inout arguments
- // into the new method.
- if (node->nmembers () > 0)
- {
- // initialize an iterator to iterate thru our scope
- UTL_ScopeActiveIterator *si;
- ACE_NEW_RETURN (si,
- UTL_ScopeActiveIterator (node,
- UTL_Scope::IK_decls),
- 0);
-
- // continue until each element is visited
- while (!si->is_done ())
- {
- AST_Decl *d = si->item ();
-
- if (!d)
- {
- delete si;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_amh_pre_proc::"
- "create_response_handler_operation - "
- "bad node in this scope\n"),
- -1);
-
- }
-
- //be_decl *arg = be_decl::narrow_from_decl (d);
- AST_Argument *original_arg = AST_Argument::narrow_from_decl (d);
-
- if (original_arg->direction () == AST_Argument::dir_INOUT ||
- original_arg->direction () == AST_Argument::dir_OUT)
- {
- // Create the argument
- be_argument *arg = new be_argument (AST_Argument::dir_IN,
- original_arg->field_type (),
- original_arg->name ());
-
- operation->add_argument_to_scope (arg);
- }
- si->next ();
- } // end of while loop
-
- delete si;
- } // end of if
-
- operation->set_defined_in (response_handler);
-
- // We do not copy the exceptions because the exceptions
- // are delivered by the excep methods.
-
- // After having generated the operation we insert it into the
- // response handler interface.
- response_handler->be_add_operation (operation);
-
- return 0;
-}
-
-
-/*
- int
- be_visitor_amh_pre_proc::create_excep_operation (be_operation *node,
- be_interface *response_handler,
- be_valuetype *excep_holder)
- {
- if (!node)
- return -1;
-
- if (node->flags () == AST_Operation::OP_oneway)
- // We do nothing for oneways!
- return 0;
-
- // Create the return type, which is "void"
- be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void,
- new UTL_ScopedName
- (new Identifier ("void", 1, 0, I_FALSE),
- 0),
- 0);
-
- // Create the argument
- be_argument *arg = new be_argument (AST_Argument::dir_IN,
- excep_holder, // is also a valuetype
- new UTL_ScopedName (
- new Identifier (
- "excep_holder", 1, 0, I_FALSE),
- 0),
- 0);
-
- // Create the new name
- // Append _execp to the name of the operation
- ACE_CString original_op_name (node
- ->name ()
- ->last_component ()
- ->get_string ());
- ACE_CString new_op_name = original_op_name + ACE_CString ("_excep");
-
- UTL_ScopedName *op_name = ACE_static_cast (UTL_ScopedName *, response_handler->name ()-> copy ());
- op_name->nconc (new UTL_ScopedName
- (new Identifier
- (new_op_name.rep (), 1, 0, I_FALSE),
- 0));
-
- // create the operation
- be_operation *operation = new be_operation (rt,
- AST_Operation::OP_noflags,
- op_name,
- 0,
- 0,
- 0);
- operation->set_name (op_name);
- operation->add_argument_to_scope (arg);
-
- operation->set_defined_in (response_handler);
-
- // We do not copy the exceptions because the exceptions
- // are delivered by the excep methods.
-
- // After having generated the operation we insert it into the
- // response handler interface.
- response_handler->be_add_operation (operation);
-
- return 0;
- }
-*/
-
-// visit the scope and its elements
-int
-be_visitor_amh_pre_proc::visit_scope (be_scope *node)
-{
-
- // proceed if the number of members in our scope is greater than 0
- if (node->nmembers () > 0)
- {
- int number_of_elements = 0;
-
- {
- // initialize an iterator to iterate thru our scope
- UTL_ScopeActiveIterator *si;
- ACE_NEW_RETURN (si,
- UTL_ScopeActiveIterator (node,
- UTL_Scope::IK_decls),
- -1);
-
- while (!si->is_done ())
- {
- number_of_elements++;
- si->next ();
- }
- delete si;
- }
-
- AST_Decl **elements = new AST_Decl *[number_of_elements];
-
- {
- int position = 0;
- // initialize an iterator to iterate thru our scope
- UTL_ScopeActiveIterator *si;
- ACE_NEW_RETURN (si,
- UTL_ScopeActiveIterator (node,
- UTL_Scope::IK_decls),
- -1);
-
- while (!si->is_done ())
- {
- elements[position++] = si->item ();
- si->next ();
- }
- delete si;
- }
-
-
- int elem_number = 0;
-
- // continue until each element is visited
- while (elem_number < number_of_elements)
- {
- AST_Decl *d = elements[elem_number];
- if (!d)
- {
- delete [] elements;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_scope::visit_scope - "
- "bad node in this scope\n"), -1);
-
- }
-
- be_decl *bd = be_decl::narrow_from_decl (d);
-
- // set the scope node as "node" in which the code is being
- // generated so that elements in the node's scope can use it
- // for code generation
- this->ctx_->scope (node->decl ());
-
- // set the node to be visited
- this->ctx_->node (bd);
- elem_number++;
-
-
- // Send the visitor.
- if (bd == 0 || bd->accept (this) == -1)
- {
- delete [] elements;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_scope::visit_scope - "
- "codegen for scope failed\n"), -1);
-
- }
- } // end of while loop
- delete [] elements;
- } // end of if
- return 0;
-}
-
-// Helper methods
int
be_visitor_amh_pre_proc::generate_name (ACE_CString &destination,
@@ -1302,8 +607,8 @@ be_operation *
be_visitor_amh_pre_proc::generate_set_operation (be_attribute *node)
{
ACE_CString original_op_name (
- node->name ()->last_component ()->get_string ()
- );
+ node->name ()->last_component ()->get_string ()
+ );
ACE_CString new_op_name = ACE_CString ("set_") + original_op_name;
UTL_ScopedName *set_name = ACE_static_cast (UTL_ScopedName *,
diff --git a/TAO/TAO_IDL/be/be_visitor_factory.cpp b/TAO/TAO_IDL/be/be_visitor_factory.cpp
index 7a20344fa03..a990d513956 100644
--- a/TAO/TAO_IDL/be/be_visitor_factory.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_factory.cpp
@@ -775,16 +775,7 @@ TAO_Compiled_Visitor_Factory::make_visitor (be_visitor_context *ctx)
case TAO_CodeGen::TAO_AMI_EXCEPTION_HOLDER_VALUETYPE_CS:
return new be_visitor_valuetype_ami_exception_holder_cs (new_ctx);
- // AMH next generation visitors
- case TAO_CodeGen::TAO_INTERFACE_AMH_SH:
- return new be_visitor_amh_interface_sh (new_ctx);
- case TAO_CodeGen::TAO_INTERFACE_AMH_SS:
- return new be_visitor_amh_interface_ss (new_ctx);
- case TAO_CodeGen::TAO_OPERATION_AMH_SH:
- return new be_visitor_amh_operation_sh (new_ctx);
- case TAO_CodeGen::TAO_OPERATION_AMH_SS:
- return new be_visitor_amh_operation_ss (new_ctx);
- // AMH ResponseHandler class visitors
+ /* // AMH ResponseHandler class visitors
case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SH:
return new be_visitor_amh_rh_interface_sh (new_ctx);
case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SS:
@@ -793,6 +784,7 @@ TAO_Compiled_Visitor_Factory::make_visitor (be_visitor_context *ctx)
return new be_visitor_amh_rh_operation_sh (new_ctx);
case TAO_CodeGen::TAO_OPERATION_AMH_RH_SS:
return new be_visitor_amh_rh_operation_ss (new_ctx);
+ */
default:
// cannot handle it; delegate it to the common visitor factory
diff --git a/TAO/TAO_IDL/be/be_visitor_interface.cpp b/TAO/TAO_IDL/be/be_visitor_interface.cpp
index 06cb2754599..6b7ac8818ba 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface.cpp
@@ -70,7 +70,10 @@
#include "be_visitor_interface/direct_proxy_impl_ss.cpp"
// AMH
-#include "be_visitor_interface/amh_ss.cpp"
-#include "be_visitor_interface/amh_sh.cpp"
+//#include "be_visitor_interface/amh_ch.cpp"
+#include "be_visitor_interface/amh_rh_ss.cpp"
+#include "be_visitor_interface/amh_rh_sh.cpp"
+//#include "be_visitor_interface/amh_ss.cpp"
+//#include "be_visitor_interface/amh_sh.cpp"
ACE_RCSID(be, be_visitor_interface, "$Id$")
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/amh_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/amh_ch.cpp
new file mode 100644
index 00000000000..cc633dc5b03
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/amh_ch.cpp
@@ -0,0 +1,144 @@
+//=============================================================================
+/**
+* @file amh_ch.cpp
+*
+* $Id$
+*
+* Specialized interface visitor for AMH-RH generates code that is
+* specific to AMH interfaces.
+*
+* @author Mayur Deshpande <mayur@ics.uci.edu>
+*/
+//=============================================================================
+
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
+#include "be_visitor_interface.h"
+
+ACE_RCSID(be_visitor_amh_interface, interface, "$Id$")
+
+be_visitor_amh_interface_ch::be_visitor_amh_interface_ch (be_visitor_context *ctx)
+ : be_visitor_interface (ctx)
+{
+}
+
+be_visitor_amh_interface_ch::~be_visitor_amh_interface_ch (void)
+{
+}
+
+int
+be_visitor_amh_interface_ch::visit_interface (be_interface *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ // If not already generated and not imported.
+ if (!node->cli_hdr_gen () && !node->imported ())
+ {
+ // == STEP 1: generate the class name and class names we inherit ==
+
+ // Generate the ifdefined macro for the _ptr type.
+ os->gen_ifdef_macro (node->flat_name (),
+ "_ptr");
+
+ // The following two are required to be under the ifdef macro to avoid
+ // multiple declarations.
+
+ // Forward declaration.
+ *os << "class " << node->local_name () << ";" << be_nl;
+ // Generate the _ptr declaration.
+ *os << "typedef " << node->local_name () << " *"
+ << node->local_name () << "_ptr;" << be_nl;
+
+ os->gen_endif ();
+
+ // Generate the ifdefined macro for the var type.
+ os->gen_ifdef_macro (node->flat_name (), "_var");
+
+ // Generate the _var declaration.
+ if (node->gen_var_defn () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_ch::"
+ "visit_interface - "
+ "codegen for _var failed\n"),
+ -1);
+ }
+
+ os->gen_endif ();
+
+ }
+
+ // The above code could have been executed by the forward declaration
+ // as long as it wasn't imported. The code below can only be
+ // executed by an interface definition, also non-imported.
+ if (node->imported ())
+ {
+ return 0;
+ }
+
+ // Now the interface definition itself.
+ os->gen_ifdef_macro (node->flat_name ());
+
+ // Now generate the class definition.
+ *os << "class " << be_global->stub_export_macro ()
+ << " " << node->local_name () << be_idt_nl
+ << ": " ;
+
+ // If node interface inherits from other interfaces.
+ if (node->n_inherits () > 0)
+ {
+ *os << be_idt;
+
+ for (int i = 0; i < node->n_inherits (); i++)
+ {
+ *os << "public virtual "
+ << node->inherits ()[i]->name ();
+
+ if (i < node->n_inherits () - 1)
+ {
+ // Node has multiple inheritance, so put a comma.
+ *os << "," << be_nl;
+ }
+ }
+
+ *os << be_uidt << be_uidt_nl;
+ }
+ else
+ {
+ // We do not inherit from anybody, hence we do so from the base
+ // CORBA::Object class.
+ *os << "public virtual CORBA_Object" << be_uidt_nl;
+ }
+
+ // Generate the body.
+
+ *os << "{" << be_nl
+ << "public:" << be_nl
+
+ // Generate the _ptr_type and _var_type typedefs
+ // but we must protect against certain versions of g++.
+ << "#if !defined(__GNUC__) || !defined (ACE_HAS_GNUG_PRE_2_8)"
+ << be_idt_nl
+ << "typedef " << node->local_name () << "_ptr _ptr_type;"
+ << be_nl
+ << "typedef " << node->local_name () << "_var _var_type;"
+ << be_uidt_nl
+ << "#endif /* ! __GNUC__ || g++ >= 2.8 */\n" << be_idt_nl;
+
+ // Generate code for the interface definition by traversing thru the
+ // elements of its scope. We depend on the front-end to have made sure
+ // that only legal syntactic elements appear in our scope.
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_interface_ch::"
+ "visit_interface - "
+ "codegen for scope failed\n"), -1);
+ }
+
+ node->cli_hdr_gen (I_TRUE);
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/amh_rh_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/amh_rh_sh.cpp
new file mode 100644
index 00000000000..1bdde546026
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/amh_rh_sh.cpp
@@ -0,0 +1,118 @@
+//=============================================================================
+/**
+* @file amh_rh_sh.cpp
+*
+* $Id$
+*
+* Specialized interface visitor for AMH-RH that generates code
+* for RH interfaces in skeleton source files
+*
+* @author Darrell Brunsch <brunsch@cs.wustl.edu>
+*/
+//=============================================================================
+
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
+#include "be_visitor_interface.h"
+
+
+be_visitor_amh_rh_interface_sh::be_visitor_amh_rh_interface_sh
+(be_visitor_context *ctx): be_visitor_interface_sh (ctx)
+{
+}
+
+be_visitor_amh_rh_interface_sh::~be_visitor_amh_rh_interface_sh (void)
+{
+}
+
+int
+be_visitor_amh_rh_interface_sh::visit_interface (be_interface *node)
+{
+ if (node->srv_hdr_gen () || node->imported () || node->is_local ())
+ return 0;
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ os->indent ();
+
+ // Generate the skeleton class name.
+ // this is AMH_intf_ResponseHandler
+ ACE_CString rh_base_class_name = node->local_name ();;
+ // and this is TAO_AMH_intf_ResponseHandler
+ ACE_CString rh_skel_class_name = "TAO_";
+ rh_skel_class_name += rh_base_class_name.c_str ();
+
+ *os << "class " << rh_skel_class_name.c_str () << ";" << be_nl;
+
+ // Generate the _ptr declaration.
+ *os << "typedef " << rh_skel_class_name.c_str () << " *"
+ << rh_skel_class_name.c_str()
+ << "_ptr;" << be_nl;
+
+ ACE_CString inherit_client_parent = node->client_enclosing_scope ();
+ inherit_client_parent += "::";
+ inherit_client_parent += rh_base_class_name;
+
+ ACE_CString inherit_tao_parent = "TAO_AMH_";
+ inherit_tao_parent += node->original_interface ()->local_name ();
+
+ // Now generate the class definition
+ *os << "class " << be_global->skel_export_macro ()
+ << " " << rh_base_class_name.c_str () << be_idt_nl << ": "
+ << "public " << inherit_client_parent.c_str () <<"," << be_idt_nl
+ << "public " << inherit_tao_parent.c_str () << be_nl;
+
+ long n_parents = node->n_inherits ();
+
+ if (n_parents > 0)
+ {
+ for (int i = 0; i < n_parents; ++i)
+ {
+ *os << "public virtual "
+ << node->inherits ()[i]->name ();
+
+ if (i < n_parents - 1)
+ {
+ *os << "," << be_nl;
+ }
+ }
+ }
+
+ *os << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "protected:" << be_idt_nl
+ << rh_skel_class_name.c_str () << " (void);\n" << be_uidt_nl
+ << "public:" << be_idt_nl;
+
+ // No copy constructor for locality constraint interface.
+ *os << rh_skel_class_name.c_str () << " (const "
+ << rh_skel_class_name.c_str () << "& rhs);" << be_nl
+ << "virtual ~" << rh_skel_class_name.c_str () << " (void);\n\n"
+ << be_nl;
+
+ // Generate code for elements in the scope (e.g., operations).
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_sh::"
+ "visit_interface - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ // Generate skeletons for operations of our base classes. These
+ // skeletons just cast the pointer to the appropriate type
+ // before invoking the call.
+ if (node->traverse_inheritance_graph (be_interface::gen_skel_helper, os) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_sh::"
+ "visit_interface - "
+ "inheritance graph traversal failed\n"),
+ -1);
+ }
+
+ *os << "\n";
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/amh_rh_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/amh_rh_ss.cpp
new file mode 100644
index 00000000000..56c016170ad
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/amh_rh_ss.cpp
@@ -0,0 +1,103 @@
+//=============================================================================
+/**
+* @file amh_rh_ss.cpp
+*
+* $Id$
+*
+* Specialized interface visitor for AMH-ResponseHandler that generates code for
+* RH in the skeleton source files.
+*
+* @author Mayur Deshpande <mayur@ics.uci.edu>
+*/
+//=============================================================================
+
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
+
+#include "be_visitor_interface.h"
+
+be_visitor_amh_rh_interface_ss::be_visitor_amh_rh_interface_ss (be_visitor_context *ctx)
+ : be_visitor_interface_ss (ctx)
+{
+}
+
+be_visitor_amh_rh_interface_ss::~be_visitor_amh_rh_interface_ss (void)
+{
+}
+
+int
+be_visitor_amh_rh_interface_ss::visit_interface (be_interface *node)
+{
+ if (node->srv_skel_gen () || node->imported () || node->is_local ())
+ return 0;
+
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ os->indent ();
+
+ // Generate the skeleton class name.
+ // this is AMH_intf_ResponseHandler
+ ACE_CString rh_base_class_name = node->local_name ();
+ // and this is TAO_AMH_intf_ResponseHandler
+ ACE_CString rh_skel_class_name = "TAO_";
+ rh_skel_class_name += rh_base_class_name.c_str ();
+
+ // constructor
+ *os << "// skeleton constructor\n";
+ // find if we are at the top scope or inside some module
+ if (!node->is_nested ())
+ {
+ // we are outermost. So the POA_ prefix is prepended to our name
+ *os << node->full_skel_name () << "::POA_" << node->local_name ()
+ << " (void)\n";
+ }
+ else
+ {
+ // the POA_ prefix is prepended to our outermost module name
+ *os << node->full_skel_name () << "::" << rh_skel_class_name.c_str()
+ << " (void)\n";
+ }
+
+ if (node->traverse_inheritance_graph
+ (be_interface::copy_ctor_helper, os) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_ss::visit_interface - "
+ " copy ctor generation failed\n"), -1);
+ *os << " TAO_ServantBase (rhs)" << be_uidt_nl
+ << "{}" << be_nl << be_nl;
+
+ *os << "// skeleton destructor" << be_nl;
+
+ if (!node->is_nested ())
+ {
+ // we are outermost. So the POA_ prefix is prepended to our name
+ *os << node->full_skel_name () << "::~POA_" << node->local_name () <<
+ " (void)" << be_nl;
+ }
+ else
+ {
+ // the POA_ prefix is prepended to our outermost module name
+ *os << node->full_skel_name () << "::~" << rh_skel_class_name.c_str() <<
+ " (void)" << be_nl;
+ }
+ *os << "{" << be_nl;
+ *os << "}\n\n";
+
+
+ // generate code for elements in the scope (e.g., operations)
+ // We'll rely on the base class (be_visitor_scope) to do the
+ // right thing for us.
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_ss::"
+ "visit_interface - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ *os << "\n\n";
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/amh_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/amh_sh.cpp
index 51c4ce682e2..26b6bec81ab 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/amh_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/amh_sh.cpp
@@ -4,7 +4,8 @@
*
* $Id$
*
-* Specialized interface visitor for AMH and AMH-RH.
+* Specialized interface visitor for AMH generates code that is
+* specific to AMH interfaces.
*
* @author Darrell Brunsch <brunsch@cs.wustl.edu>
*/
@@ -25,41 +26,347 @@ be_visitor_amh_interface_sh::~be_visitor_amh_interface_sh (void)
{
}
-void
-be_visitor_amh_interface_sh::this_method (be_interface *node)
+/** The node is the original interface node but we 'tweak' with the
+ local_name and the the operation signatures to generate the AMH
+ skeleton on the 'fly'
+*/
+int
+be_visitor_amh_interface_sh::visit_interface (be_interface *node)
{
- TAO_OutStream *os = this->ctx_->stream ();
+ TAO_OutStream *os = this->ctx_->stream (); // output stream
- ACE_CString non_amh_name = " ";
- non_amh_name += node->client_enclosing_scope ();
- non_amh_name += node->original_interface ()->local_name ();
+ ACE_CString class_name; // holds the class name
- // Print out the _this() method.
- *os << "// Special _this method for AMH! \n"
- << non_amh_name.c_str () << " *_this (" << be_idt << be_idt_nl
- << "CORBA::Environment &ACE_TRY_ENV = " << be_idt_nl
- << "TAO_default_environment ()"
- << be_uidt << be_uidt_nl
+ os->indent ();
+
+ // We shall have a POA_ prefix only if we are at the topmost level.
+ // In AMH, only interfaces are Asynchronous, not modules, so this
+ // should be unnecessary but we retain it anyways.
+ if (!node->is_nested ())
+ {
+ // We are outermost.
+ class_name += "POA_AMH_";
+ class_name += node->local_name ();
+ }
+ else
+ {
+ class_name += "AMH_";
+ class_name += node->local_name ();
+ }
+
+ // Generate the skeleton class name.
+ *os << "class " << class_name.c_str () << ";" << be_nl;
+
+ // Generate the _ptr declaration.
+ *os << "typedef " << class_name.c_str () << " *" << class_name.c_str ()
+ << "_ptr;" << be_nl;
+
+ // Now generate the class definition.
+ *os << "class " << be_global->skel_export_macro ()
+ << " " << class_name.c_str () << be_idt_nl << ": " << be_idt;
+
+ long n_parents = node->n_inherits ();
+
+ if (n_parents > 0)
+ {
+ for (int i = 0; i < n_parents; ++i)
+ {
+ *os << "public virtual " << "POA_"
+ << node->inherits ()[i]->name ();
+
+ if (i < n_parents - 1)
+ {
+ *os << "," << be_nl;
+ }
+ }
+ }
+ else
+ {
+ // We don't inherit from another user defined object, hence our
+ // base class is the ServantBase class.
+ *os << "public virtual PortableServer::ServantBase";
+ }
+
+ *os << be_uidt << be_uidt_nl
+ << "{" << be_nl
+ << "protected:" << be_idt_nl
+ << class_name.c_str () << " (void);\n" << be_uidt_nl
+ << "public:" << be_idt_nl;
+
+ // No copy constructor for locality constraint interface.
+ *os << class_name.c_str () << " (const " << class_name.c_str () << "& rhs);" << be_nl
+ << "virtual ~" << class_name.c_str () << " (void);\n\n"
+ << be_nl
+ << "virtual CORBA::Boolean _is_a (" << be_idt << be_idt_nl
+ << "const char* logical_type_id" << be_nl
+ << "TAO_ENV_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl
+ << ");\n" << be_uidt_nl;
+
+ *os << "virtual void* _downcast (" << be_idt << be_idt_nl
+ << "const char* logical_type_id" << be_uidt_nl
+ << ");\n" << be_uidt_nl;
+
+ // Add a skeleton for our _is_a method.
+ *os << "static void _is_a_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest &req," << be_nl
+ << "void *obj," << be_nl
+ << "void *servant_upcall" << be_nl
+ << "TAO_ENV_ARG_DECL" << be_uidt_nl
+ << ");\n" << be_uidt_nl;
+
+ // Add a skeleton for our _non_existent method.
+ *os << "static void _non_existent_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest &req," << be_nl
+ << "void *obj," << be_nl
+ << "void *servant_upcall" << be_nl
+ << "TAO_ENV_ARG_DECL" << be_uidt_nl
+ << ");\n" << be_uidt_nl;
+
+ // Add a skeleton for our _interface method.
+ *os << "static void _interface_skel (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest &req," << be_nl
+ << "void *obj," << be_nl
+ << "void *servant_upcall" << be_nl
+ << "TAO_ENV_ARG_DECL" << be_uidt_nl
<< ");\n" << be_uidt_nl;
+
+ // Add the dispatch method.
+ *os << "virtual void _dispatch (" << be_idt << be_idt_nl
+ << "TAO_ServerRequest &req," << be_nl
+ << "void *_servant_upcall" << be_nl
+ << "TAO_ENV_ARG_DECL" << be_uidt_nl
+ << ");\n" << be_uidt_nl;
+
+ this->this_method (node);
+
+ // The _interface_repository_id method.
+ *os << "virtual const char* _interface_repository_id "
+ << "(void) const;\n\n";
+
+ // Generate code for elements in the scope (e.g., operations).
+ // We have to generate AMH-operations here. Here is how we go
+ // about it:
+ // We create a new node 'on the fly' and for each corresponding
+ // operation in the original node, we add a new AMH-operation
+ // into the node and then call visit_scope on the new node.
+
+ // Step 1: Create the new AMH-node
+ be_interface *amh_node = this->create_amh_class (class_name);
+
+ // Step 2: Add the memebers of original node to new AMH-node
+ this->add_original_members (node, amh_node);
+
+ // Step 3: Generate the AMH-operations
+ if (this->visit_scope (amh_node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_sh::"
+ "visit_interface - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+ // Generate skeletons for operations of our base classes. These
+ // skeletons just cast the pointer to the appropriate type
+ // before invoking the call.
+ if (node->traverse_inheritance_graph (be_interface::gen_skel_helper, os) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_sh::"
+ "visit_interface - "
+ "inheritance graph traversal failed\n"),
+ -1);
+ }
+
+ delete amh_node;
+ *os << "\n";
+ return 0;
+
}
+int
+be_visitor_amh_interface_sh::add_original_members (be_interface *node,
+ be_interface *amh_node
+ )
+{
+ if (!node || !amh_node)
+ return -1;
+ if (node->nmembers () > 0)
+ {
+ // initialize an iterator to iterate thru our scope
+ UTL_ScopeActiveIterator *si;
+ ACE_NEW_RETURN (si,
+ UTL_ScopeActiveIterator (node, UTL_Scope::IK_decls),
+ 0);
+ this->elem_number_ = 0;
+
+ // continue until each element is visited
+ while (!si->is_done ())
+ {
+ AST_Decl *d = si->item ();
+ if (!d)
+ {
+ delete si;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_amh_pre_proc::visit_interface - "
+ "bad node in this scope\n"),
+ 0);
+
+ }
+
+ if (d->node_type () == AST_Decl::NT_attr)
+ {
+ be_attribute *attribute = be_attribute::narrow_from_decl (d);
+
+ if (!attribute)
+ return 0;
+ }
+ else
+ {
+ be_operation* operation = be_operation::narrow_from_decl (d);
+ if (operation)
+ {
+ this->add_amh_operation (operation, amh_node);
+ }
+ }
+ si->next ();
+ } // end of while loop
+ delete si;
+ } // end of if
+ return 0;
+}
-// ------------------- RH -----------------------------------------
-be_visitor_amh_rh_interface_sh::be_visitor_amh_rh_interface_sh (be_visitor_context *ctx)
- : be_visitor_interface_sh (ctx)
+int
+be_visitor_amh_interface_sh::add_amh_operation (be_operation *node,
+ be_interface *amh_node)
{
+ if (!node || !amh_node)
+ return -1;
+
+ // We do nothing for oneways!
+ if (node->flags () == AST_Operation::OP_oneway)
+ return 0;
+
+ // Create the return type, which is "void"
+ be_predefined_type *rt =
+ new be_predefined_type (AST_PredefinedType::PT_void,
+ new UTL_ScopedName (new Identifier ("void"),
+ 0));
+
+ ACE_CString original_op_name (
+ node->name ()->last_component ()->get_string ()
+ );
+
+ UTL_ScopedName *op_name =
+ ACE_static_cast (UTL_ScopedName *, amh_node->name ()-> copy ());
+ op_name->nconc (new UTL_ScopedName (new Identifier (original_op_name.rep ()),
+ 0));
+
+ // Create the operation
+ be_operation *operation = new be_operation (rt, //node->return_type (),
+ AST_Operation::OP_noflags,
+ op_name,
+ 0,
+ 0);
+ operation->set_name (op_name);
+
+ /* Add the response_handler as the first argument
+ be_argument *rh_arg = new be_argument (Direction.dir_IN,
+ thid->response_handler, original_arg->field_type (),
+ original_arg->name (),
+ 0);
+ operation->add_argument_to_scope (rh_arg);
+ */
+
+ // Iterate over the arguments and put all the in and inout
+ // into the new method.
+ if (node->nmembers () > 0)
+ {
+ // initialize an iterator to iterate thru our scope
+ UTL_ScopeActiveIterator *si;
+ ACE_NEW_RETURN (si,
+ UTL_ScopeActiveIterator (node,
+ UTL_Scope::IK_decls),
+ 0);
+
+ // continue until each element is visited
+ while (!si->is_done ())
+ {
+ AST_Decl *d = si->item ();
+ if (!d)
+ {
+ delete si;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_amh_pre_proc::"
+ "create_response_handler_operation - "
+ "bad node in this scope\n"),
+ -1);
+
+ }
+
+ AST_Argument *original_arg = AST_Argument::narrow_from_decl (d);
+
+ if (original_arg->direction () == AST_Argument::dir_INOUT ||
+ original_arg->direction () == AST_Argument::dir_IN)
+ {
+ // Create the argument
+ be_argument *arg = new be_argument (original_arg->direction (),
+ original_arg->field_type (),
+ original_arg->name ());
+
+ operation->add_argument_to_scope (arg);
+ }
+ si->next ();
+ }
+ delete si;
+ }
+
+ operation->set_defined_in (amh_node);
+
+ // After having generated the operation we insert it into the
+ // AMH node interface.
+ amh_node->be_add_operation (operation);
+
+ return 0;
}
-be_visitor_amh_rh_interface_sh::~be_visitor_amh_rh_interface_sh (void)
+
+be_interface *
+be_visitor_amh_interface_sh::create_amh_class (ACE_CString name)
{
+ UTL_ScopedName *amh_class_name =
+ new UTL_ScopedName (new Identifier (name.c_str ()), 0);
+
+ be_interface *amh_class =
+ new be_interface (amh_class_name, // name
+ 0, // list of inherited
+ 0, // number of inherited
+ 0, // list of ancestors
+ 0, // number of ancestors
+ 0, // non-local
+ 0); // non-abstract
+
+ amh_class->set_name (amh_class_name);
+
+ return amh_class;
}
-/*
void
-be_visitor_amh_rh_interface_sh::this_method (be_interface *node)
+be_visitor_amh_interface_sh::this_method (be_interface *node)
{
-// No need to generate anything
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ ACE_CString non_amh_name = " ";
+ non_amh_name += node->client_enclosing_scope ();
+ non_amh_name += node->original_interface ()->local_name ();
+
+ // Print out the _this() method.
+ *os << "// Special _this method for AMH! \n"
+ << non_amh_name.c_str () << " *_this (" << be_idt << be_idt_nl
+ << "CORBA::Environment &ACE_TRY_ENV = " << be_idt_nl
+ << "TAO_default_environment ()"
+ << be_uidt << be_uidt_nl
+ << ");\n" << be_uidt_nl;
}
-*/
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp
index b11b1beeeab..9c781355127 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp
@@ -80,29 +80,3 @@ be_visitor_amh_interface_ss::dispatch_method (be_interface *node)
// *os << "this->asynchronous_upcall_reply (req);" << be_uidt_nl;
*os << be_uidt_nl << "}" << be_nl;
}
-
-
-
-// ----------------------- RH -----------------------------
-
-be_visitor_amh_rh_interface_ss::be_visitor_amh_rh_interface_ss (be_visitor_context *ctx)
- : be_visitor_interface_ss (ctx)
-{
-}
-
-be_visitor_amh_rh_interface_ss::~be_visitor_amh_rh_interface_ss (void)
-{
-}
-
-/*void
-be_visitor_amh_rh_interface_ss::this_method (be_interface *node)
-{
-// No need to generate any code
-}
-
-void
-be_visitor_amh_rh_interface_ss::dispatch_method (be_interface *node)
-{
-// No need to generate any code
-}
-*/
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp
index 563f20dced9..3e94f58f720 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp
@@ -141,11 +141,9 @@ be_visitor_interface::visit_attribute (be_attribute *node)
break;
// AMH stuff
- case TAO_CodeGen::TAO_INTERFACE_AMH_SH:
case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SH:
ctx.state (TAO_CodeGen::TAO_ATTRIBUTE_SH);
break;
- case TAO_CodeGen::TAO_INTERFACE_AMH_SS:
case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SS:
ctx.state (TAO_CodeGen::TAO_ATTRIBUTE_SS);
break;
@@ -277,8 +275,6 @@ be_visitor_interface::visit_constant (be_constant *node)
case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SH:
case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SS:
- case TAO_CodeGen::TAO_INTERFACE_AMH_SH:
- case TAO_CodeGen::TAO_INTERFACE_AMH_SS:
case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SH:
case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SS:
return 0; // nothing to be done
@@ -395,8 +391,6 @@ be_visitor_interface::visit_enum (be_enum *node)
case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SH:
case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SS:
- case TAO_CodeGen::TAO_INTERFACE_AMH_SH:
- case TAO_CodeGen::TAO_INTERFACE_AMH_SS:
case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SH:
case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SS:
return 0; // nothing to be done
@@ -514,8 +508,6 @@ be_visitor_interface::visit_exception (be_exception *node)
case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SH:
case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SS:
- case TAO_CodeGen::TAO_INTERFACE_AMH_SH:
- case TAO_CodeGen::TAO_INTERFACE_AMH_SS:
case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SH:
case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SS:
return 0; // nothing to be done
@@ -633,12 +625,6 @@ be_visitor_interface::visit_operation (be_operation *node)
break;
// AMH stuff
- case TAO_CodeGen::TAO_INTERFACE_AMH_SH:
- ctx.state (TAO_CodeGen::TAO_OPERATION_AMH_SH);
- break;
- case TAO_CodeGen::TAO_INTERFACE_AMH_SS:
- ctx.state (TAO_CodeGen::TAO_OPERATION_AMH_SS);
- break;
case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SH:
ctx.state (TAO_CodeGen::TAO_OPERATION_AMH_RH_SH);
break;
@@ -818,8 +804,6 @@ be_visitor_interface::visit_structure (be_structure *node)
case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SH:
case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SS:
- case TAO_CodeGen::TAO_INTERFACE_AMH_SH:
- case TAO_CodeGen::TAO_INTERFACE_AMH_SS:
case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SH:
case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SS:
return 0; // nothing to be done
@@ -936,8 +920,6 @@ be_visitor_interface::visit_union (be_union *node)
case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SH:
case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SS:
- case TAO_CodeGen::TAO_INTERFACE_AMH_SH:
- case TAO_CodeGen::TAO_INTERFACE_AMH_SS:
case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SH:
case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SS:
return 0; // nothing to be done
@@ -1054,8 +1036,6 @@ be_visitor_interface::visit_typedef (be_typedef *node)
case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SH:
case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SS:
- case TAO_CodeGen::TAO_INTERFACE_AMH_SH:
- case TAO_CodeGen::TAO_INTERFACE_AMH_SS:
case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SH:
case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SS:
return 0; // nothing to be done
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp
index b413bbeddd2..7770ff379da 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp
@@ -43,16 +43,21 @@ be_visitor_interface_sh::~be_visitor_interface_sh (void)
int
be_visitor_interface_sh::visit_interface (be_interface *node)
{
- TAO_OutStream *os; // output stream
- long i; // loop index
- static char namebuf [NAMEBUFSIZE]; // holds the class name
-
if (node->srv_hdr_gen () || node->imported () || node->is_local ())
return 0;
+ // if we are to generate AMH classes, do it now
+ if (be_global->gen_amh_classes ())
+ {
+ //be_visitor_amh_interface_sh amh_intf (this->ctx_);
+ //amh_intf.visit_interface (node);
+ }
+
+ // Generate the normal skeleton as usual
+ static char namebuf [NAMEBUFSIZE]; // holds the class name
ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE);
- os = this->ctx_->stream ();
+ TAO_OutStream *os = this->ctx_->stream (); // output stream
// Generate the skeleton class name.
@@ -105,7 +110,7 @@ be_visitor_interface_sh::visit_interface (be_interface *node)
if (n_parents > 0)
{
- for (i = 0; i < n_parents; ++i)
+ for (long i = 0; i < n_parents; ++i)
{
*os << "public virtual " << "POA_"
<< node->inherits ()[i]->name ();
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp
index a8d8c28bb8a..274f7aebc85 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp
@@ -24,6 +24,7 @@
#include "be_visitor_interface.h"
+
ACE_RCSID(be_visitor_interface, interface_ss, "$Id$")
@@ -43,12 +44,19 @@ be_visitor_interface_ss::~be_visitor_interface_ss (void)
int
be_visitor_interface_ss::visit_interface (be_interface *node)
{
- TAO_OutStream *os; // output stream
-
if (node->srv_skel_gen () || node->imported () || node->is_local ())
return 0;
- os = this->ctx_->stream ();
+ // if we are to generate AMH classes, do it now
+ if (be_global->gen_amh_classes ())
+ {
+ //be_visitor_amh_interface_ss amh_intf (this->ctx_);
+ //amh_intf.visit_interface (node);
+ }
+
+ // Generate the normal skeleton as usual
+
+ TAO_OutStream *os = this->ctx_->stream ();
// generate the skeleton class name
diff --git a/TAO/TAO_IDL/be/be_visitor_operation.cpp b/TAO/TAO_IDL/be/be_visitor_operation.cpp
index 1c73eb4d5af..388e91b4f89 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation.cpp
@@ -77,7 +77,9 @@
#include "be_visitor_operation/direct_proxy_impl_ss.cpp"
// AMH
-#include "be_visitor_operation/amh_ss.cpp"
-#include "be_visitor_operation/amh_sh.cpp"
+//#include "be_visitor_operation/amh_ss.cpp"
+//#include "be_visitor_operation/amh_sh.cpp"
+#include "be_visitor_operation/amh_rh_ss.cpp"
+#include "be_visitor_operation/amh_rh_sh.cpp"
ACE_RCSID(be, be_visitor_operation, "$Id$")
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/amh_rh_sh.cpp b/TAO/TAO_IDL/be/be_visitor_operation/amh_rh_sh.cpp
new file mode 100644
index 00000000000..a15179a9152
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/amh_rh_sh.cpp
@@ -0,0 +1,125 @@
+//
+// $Id$
+//
+//
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// amh_rh_sh.cpp
+//
+// = DESCRIPTION
+// Visitor generating AMH-RH skeleton code for Operation node in the
+// skeleton header.
+//
+// = AUTHOR
+// Mayur Deshpande <mayur@ics.uci.edu>
+//
+// ============================================================================
+
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
+#include "ast_decl.h"
+#include "be_visitor_operation.h"
+
+ACE_RCSID(be_visitor_operation, operation_amh_rh_sh, "$Id$")
+
+
+// ******************************************************
+// Visitor for generating AMH-RH skeleton for "operation"
+// in skeleton header.
+// ******************************************************
+
+be_visitor_amh_rh_operation_sh::be_visitor_amh_rh_operation_sh (be_visitor_context *ctx)
+ : be_visitor_operation (ctx)
+{
+}
+
+be_visitor_amh_rh_operation_sh::~be_visitor_amh_rh_operation_sh (void)
+{
+}
+
+int
+be_visitor_amh_rh_operation_sh::visit_operation (be_operation *node)
+{
+ // Nothing to be done for oneway operations.
+ if (node->flags () == AST_Operation::OP_oneway)
+ {
+ return 0;
+ }
+
+ // Output stream.
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node);
+
+ *os << "\n// \t *** AMH-RH operation declaration starts here ***\n";
+
+ be_interface *intf;
+ intf = this->ctx_->attribute ()
+ ? be_interface::narrow_from_scope (this->ctx_->attribute()->defined_in ())
+ : be_interface::narrow_from_scope (node->defined_in ());
+
+ if (!intf)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_sh::"
+ "visit_operation - "
+ "bad interface scope\n"),
+ -1);
+ }
+
+ // Step 1 : Generate return type: always void
+ os->indent ();
+ *os << "virtual void ";
+ // only for source: *os << intf->full_skel_name () << "::";
+
+
+ // Step 2: Generate the method name
+ // Check if we are an attribute node in disguise.
+ if (this->ctx_->attribute ())
+ {
+ // Now check if we are a "get" or "set" operation.
+ if (node->nmembers () == 1)
+ {
+ *os << "set_";
+ }
+ else
+ {
+ *os << "get_";
+ }
+ }
+
+ *os << node->local_name();
+
+ be_visitor_context ctx (*this->ctx_);
+ ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_SH);
+ be_visitor *visitor = tao_cg->make_visitor (&ctx);
+
+ if (!visitor)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_operation_amh_sh::"
+ "visit_operation - "
+ "Bad visitor to return type\n"),
+ -1);
+ }
+
+ if (node->accept (visitor) == -1)
+ {
+ delete visitor;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_sh::"
+ "visit_operation - "
+ "codegen for argument list failed\n"),
+ -1);
+ }
+
+ delete visitor;
+
+ *os << be_nl;
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/amh_rh_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/amh_rh_ss.cpp
new file mode 100644
index 00000000000..e85d5c814c8
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/amh_rh_ss.cpp
@@ -0,0 +1,123 @@
+//=============================================================================
+/**
+* @file amh_ss.cpp
+*
+* $Id$
+*
+* Creates code for AMH-RH operations.
+*
+* @author Mayur Deshpande <mayur@ics.uci.edu>
+*/
+//=============================================================================
+
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
+
+#include "be_visitor_operation.h"
+
+be_visitor_amh_rh_operation_ss::be_visitor_amh_rh_operation_ss (be_visitor_context *ctx)
+ : be_visitor_operation (ctx)
+{
+}
+
+be_visitor_amh_rh_operation_ss::~be_visitor_amh_rh_operation_ss (void)
+{
+}
+
+int
+be_visitor_amh_rh_operation_ss::visit_operation (be_operation *node)
+{
+ // Nothing to be done for oneway operations.
+ if (node->flags () == AST_Operation::OP_oneway)
+ {
+ return 0;
+ }
+
+ // Output stream.
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ *os << "\n// \t *** AMH-RH operation definition starts here ***\n";
+
+ be_interface *intf;
+ intf = this->ctx_->attribute ()
+ ? be_interface::narrow_from_scope (this->ctx_->attribute()->defined_in ())
+ : be_interface::narrow_from_scope (node->defined_in ());
+
+ if (!intf)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_sh::"
+ "visit_operation - "
+ "bad interface scope\n"),
+ -1);
+ }
+
+ // Step 1 : Generate return type: always void
+ os->indent ();
+ *os << "virtual void "
+ << "TAO_" << intf->full_skel_name () << "::";
+
+ // Check if we are an attribute node in disguise
+ if (this->ctx_->attribute ())
+ {
+ // now check if we are a "get" or "set" operation
+ if (node->nmembers () == 1) // set
+ *os << "_set_";
+ else
+ *os << "_get_";
+ }
+
+ *os << node->local_name ();
+
+ // Step 2 : Generate the params of the method
+ be_visitor_context ctx (*this->ctx_);
+ ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_SH);
+ be_visitor *visitor = tao_cg->make_visitor (&ctx);
+
+ if (!visitor)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_operation_amh_sh::"
+ "visit_operation - "
+ "Bad visitor to return type\n"),
+ -1);
+ }
+
+ if (node->accept (visitor) == -1)
+ {
+ delete visitor;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_sh::"
+ "visit_operation - "
+ "codegen for argument list failed\n"),
+ -1);
+ }
+
+ delete visitor;
+
+ // Step 3: Generate actual code for the method
+ *os << "{" << be_idt_nl
+ << "init_reply ();" << be_idt_nl;
+
+ marshal_params (node);
+
+ *os << "send_reply ();" << be_uidt_nl
+ << "}" << be_nl;
+
+ return 0;
+
+}
+
+
+int
+be_visitor_amh_rh_operation_ss::marshal_params (be_operation *node)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_visitor *visitor;
+ be_visitor_context ctx;
+
+ // cut and paste code here that marshalls out and return parameters
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/amh_sh.cpp b/TAO/TAO_IDL/be/be_visitor_operation/amh_sh.cpp
index 6ace3481bea..3ea6e1ef449 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/amh_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/amh_sh.cpp
@@ -11,7 +11,7 @@
// amh_sh.cpp
//
// = DESCRIPTION
-// Visitor generating AMH and AMH-RH skeleton code for Operation node in the
+// Visitor generating AMH skeleton code for Operation node in the
// skeleton header.
//
// = AUTHOR
@@ -29,12 +29,12 @@
ACE_RCSID(be_visitor_operation, operation_amh_sh, "$Id$")
- // ******************************************************
- // Visitor for generating AMH skeleton for "operation" in skeleton header.
- // ******************************************************
+// ******************************************************
+// Visitor for generating AMH skeleton for "operation" in skeleton header.
+// ******************************************************
- be_visitor_amh_operation_sh::be_visitor_amh_operation_sh (be_visitor_context *ctx)
- : be_visitor_operation (ctx)
+be_visitor_amh_operation_sh::be_visitor_amh_operation_sh (be_visitor_context *ctx)
+ : be_visitor_operation (ctx)
{
}
@@ -149,99 +149,3 @@ be_visitor_amh_operation_sh::visit_operation (be_operation *node)
return 0;
}
-
-
-// ******************************************************
-// Visitor for generating AMH-RH skeleton for "operation"
-// in skeleton header.
-// ******************************************************
-
-be_visitor_amh_rh_operation_sh::be_visitor_amh_rh_operation_sh (be_visitor_context *ctx)
- : be_visitor_operation (ctx)
-{
-}
-
-be_visitor_amh_rh_operation_sh::~be_visitor_amh_rh_operation_sh (void)
-{
-}
-
-int
-be_visitor_amh_rh_operation_sh::visit_operation (be_operation *node)
-{
- // Nothing to be done for oneway operations.
- if (node->flags () == AST_Operation::OP_oneway)
- {
- return 0;
- }
-
- // Output stream.
- TAO_OutStream *os = this->ctx_->stream ();
- this->ctx_->node (node);
-
- *os << "\n// \t *** AMH-RH operation declaration starts here ***\n";
-
- be_interface *intf;
- intf = this->ctx_->attribute ()
- ? be_interface::narrow_from_scope (this->ctx_->attribute()->defined_in ())
- : be_interface::narrow_from_scope (node->defined_in ());
-
- if (!intf)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_sh::"
- "visit_operation - "
- "bad interface scope\n"),
- -1);
- }
-
- // Step 1 : Generate return type: always void
- os->indent ();
- *os << "virtual void ";
- // only for source: *os << intf->full_skel_name () << "::";
-
-
- // Step 2: Generate the method name
- // Check if we are an attribute node in disguise.
- if (this->ctx_->attribute ())
- {
- // Now check if we are a "get" or "set" operation.
- if (node->nmembers () == 1)
- {
- *os << "set_";
- }
- else
- {
- *os << "get_";
- }
- }
- *os << node->local_name();
-
- be_visitor_context ctx (*this->ctx_);
- ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_SH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
-
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_operation_amh_sh::"
- "visit_operation - "
- "Bad visitor to return type\n"),
- -1);
- }
-
- if (node->accept (visitor) == -1)
- {
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_sh::"
- "visit_operation - "
- "codegen for argument list failed\n"),
- -1);
- }
-
- delete visitor;
-
- *os << be_nl;
-
- return 0;
-}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/amh_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/amh_ss.cpp
index 4bff0fd7f96..6b24709c763 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/amh_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/amh_ss.cpp
@@ -210,81 +210,3 @@ be_visitor_amh_operation_ss::demarshal_params (be_operation *node)
return 0;
}
-
-
-// ------------------------- RH -------------------------------------------
-
-be_visitor_amh_rh_operation_ss::be_visitor_amh_rh_operation_ss (be_visitor_context *ctx)
- : be_visitor_operation (ctx)
-{
-}
-
-be_visitor_amh_rh_operation_ss::~be_visitor_amh_rh_operation_ss (void)
-{
-}
-
-int
-be_visitor_amh_rh_operation_ss::visit_operation (be_operation *node)
-{
- // Nothing to be done for oneway operations.
- if (node->flags () == AST_Operation::OP_oneway)
- {
- return 0;
- }
-
- // Output stream.
- TAO_OutStream *os = this->ctx_->stream ();
- this->ctx_->node (node);
-
- *os << "\n// \t *** AMH-RH operation definition starts here ***\n";
-
- be_interface *intf;
- intf = this->ctx_->attribute ()
- ? be_interface::narrow_from_scope (this->ctx_->attribute()->defined_in ())
- : be_interface::narrow_from_scope (node->defined_in ());
-
- if (!intf)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_sh::"
- "visit_operation - "
- "bad interface scope\n"),
- -1);
- }
-
- // Step 1 : Generate return type: always void
- os->indent ();
- *os << "virtual void ";
- // only for source: *os << intf->full_skel_name () << "::";
-
- *os << node->local_name();
-
- be_visitor_context ctx (*this->ctx_);
- ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_SH);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
-
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_operation_amh_sh::"
- "visit_operation - "
- "Bad visitor to return type\n"),
- -1);
- }
-
- if (node->accept (visitor) == -1)
- {
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_sh::"
- "visit_operation - "
- "codegen for argument list failed\n"),
- -1);
- }
-
- delete visitor;
-
- *os << be_nl;
-
- return 0;
-}
diff --git a/TAO/TAO_IDL/be_include/be_visitor_amh_pre_proc.h b/TAO/TAO_IDL/be_include/be_visitor_amh_pre_proc.h
index 4bd45ae7c08..ec8f0c5a9c5 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_amh_pre_proc.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_amh_pre_proc.h
@@ -4,9 +4,10 @@
*
* $Id$
*
-* This visitor creates for AMH implied IDL constructs the appropriate AST
+* This visitor creates for AMH implied IDL constructs for the ResponseHandler,
+* the appropriate AST
* (Abstract Syntax Tree) node, sets the corresponding interface or operation
-* strategy on it and enteres the nodes into the AST.
+* strategy on it and enters the node into the AST.
*
* @author Darrell Brunsch <brunsch@cs.wustl.edu>
*/
@@ -64,39 +65,16 @@ class be_visitor_amh_pre_proc : public be_visitor_scope
be_valuetype *excep_holder,
Operation_Kind operation_kind);
- /// Creates the AMH version of the interface
- be_interface *create_amh_class (be_interface *node);
-
- /// Create a method in the AMH tree
- int create_amh_operation (be_operation *node,
- be_interface *amh_class);
-
- /// Create the skeleton reponse handler interface
- be_interface *create_skeleton_response_handler (be_interface *node);
-
- /// Create the client reponse handler interface
- be_interface *create_client_response_handler (be_interface *node); //,
- //be_valuetype *excep_holder);
-
- /// method to add memebers to the response handler interfaces
- int add_rh_node_members ( be_interface *node,
- be_interface *response_handler);
+ /// Create the reponse handler interface
+ be_interface *create_response_handler (be_interface *node);
+ /// method to add memebers to the response handler interfaces
+ int add_rh_node_members ( be_interface *node,
+ be_interface *response_handler);
+
/// Create the exception holder valuetype
be_valuetype *create_exception_holder (be_interface *node);
- /// Create a method with "sendc_" prepended, if for_arguments
- /// equals one the sendc operation contains also the
- /// object reference to the response handler as the first argument,
- /// but this should not be marhaled, therefore we need the switch
- // be_operation *create_sendc_operation (be_operation *node,
- // int for_arguments);
-
- /// Create a method with "_excep" appended
- // int create_excep_operation (be_operation *node,
- // be_interface *response_handler,
- // be_valuetype *excep_holder);
-
/// Create an operation with return, OUT and INOUT arguments
int create_response_handler_operation (be_operation *node,
be_interface *response_handler);
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface.h b/TAO/TAO_IDL/be_include/be_visitor_interface.h
index 4f7a42cd533..a8cfe193293 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_interface.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface.h
@@ -70,7 +70,10 @@
#include "be_visitor_interface/direct_proxy_impl_ss.h"
// AMH
-#include "be_visitor_interface/amh_ss.h"
-#include "be_visitor_interface/amh_sh.h"
+//#include "be_visitor_interface/amh_ch.h"
+#include "be_visitor_interface/amh_rh_sh.h"
+#include "be_visitor_interface/amh_rh_ss.h"
+//#include "be_visitor_interface/amh_sh.h"
+//#include "be_visitor_interface/amh_ss.h"
#endif /* _BE_VISITOR_INTERFACE_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/amh_ch.h b/TAO/TAO_IDL/be_include/be_visitor_interface/amh_ch.h
new file mode 100644
index 00000000000..50ce5434034
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/amh_ch.h
@@ -0,0 +1,45 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// amh_ch.h
+//
+// = DESCRIPTION
+// Concrete visitor for the AMH-RH Interface node.
+// This one provides code generation for interfaces in the client header.
+//
+// = AUTHOR
+// Mayur Deshpande
+//
+// ============================================================================
+
+#ifndef _BE_INTERFACE_AMH_INTERFACE_CH_H_
+#define _BE_INTERFACE_AMH_INTERFACE_CH_H_
+
+class be_visitor_amh_interface_ch : be_visitor_interface
+{
+ //
+ // = TITLE
+ // be_visitor_amh_interface_ch
+ //
+ // = DESCRIPTION
+ // This is a concrete visitor to generate the client header for AMH interface
+ //
+public:
+ be_visitor_amh_interface_ch (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_amh_interface_ch (void);
+ // destructor
+
+ virtual int visit_interface (be_interface *node);
+ // set the right context and make a visitor
+};
+
+#endif /* _BE_INTERFACE_AMH_INTERFACE_CH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/amh_rh_sh.h b/TAO/TAO_IDL/be_include/be_visitor_interface/amh_rh_sh.h
new file mode 100644
index 00000000000..b92f3b08266
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/amh_rh_sh.h
@@ -0,0 +1,29 @@
+//=============================================================================
+/**
+ * @file amh_rh_sh.h
+ *
+ * $Id$
+ *
+ * Specialized visitor for AMH ResponseHandler (RH) that generates
+ * code for the RH interface in the skeleton header
+ *
+ * @author Mayur Deshpande <mayur@ics.uci.edu>
+ */
+//=============================================================================
+
+#ifndef AMH_RH_SH_H_
+#define AMH_RH_SH_H_
+
+class be_visitor_amh_rh_interface_sh : public be_visitor_interface_sh
+{
+public:
+ be_visitor_amh_rh_interface_sh (void);
+
+ be_visitor_amh_rh_interface_sh (be_visitor_context *ctx);
+
+ ~be_visitor_amh_rh_interface_sh (void);
+
+ int visit_interface (be_interface *node);
+};
+
+#endif /* AMH_RH_SH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/amh_rh_ss.h b/TAO/TAO_IDL/be_include/be_visitor_interface/amh_rh_ss.h
new file mode 100644
index 00000000000..124bcb334d4
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/amh_rh_ss.h
@@ -0,0 +1,28 @@
+//=============================================================================
+/**
+ * @file amh_rh_ss.h
+ *
+ * $Id$
+ *
+ * Specialized visitor for AMH-ResponseHandler that generates code for the
+ * RH in the skeleton source file
+ *
+ * @author Mayur Deshpande <mayur@ics.uci.edu>
+ */
+//=============================================================================
+
+#ifndef AMH_RH_INTERFACE_SS_H
+#define AMH_RH_INTERFACE_SS_H
+
+
+class be_visitor_amh_rh_interface_ss : public be_visitor_interface_ss
+{
+public:
+ be_visitor_amh_rh_interface_ss (be_visitor_context *ctx);
+
+ int visit_interface (be_interface *node);
+
+ ~be_visitor_amh_rh_interface_ss (void);
+};
+
+#endif /* AMH_RH_INTERFACE_SS_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/amh_sh.h b/TAO/TAO_IDL/be_include/be_visitor_interface/amh_sh.h
index c0b0f3726f8..41e8ad7d5a1 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_interface/amh_sh.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/amh_sh.h
@@ -4,7 +4,7 @@
*
* $Id$
*
- * Specialized interface visitor for AMH and ResponseHandler (RH)
+ * Specialized interface visitor for AMH
*
* @author Darrell Brunsch <brunsch@cs.wustl.edu>
*/
@@ -15,31 +15,30 @@
class be_visitor_amh_interface_sh : public be_visitor_interface_sh
{
-public:
- be_visitor_amh_interface_sh (be_visitor_context *ctx);
-
- ~be_visitor_amh_interface_sh (void);
-
-protected:
- virtual void this_method (be_interface *node);
+ public:
+ be_visitor_amh_interface_sh (be_visitor_context *ctx);
+
+ int visit_interface (be_interface *node);
+
+ ~be_visitor_amh_interface_sh (void);
+
+ protected:
+ virtual void this_method (be_interface *node);
+
+ private:
+ /// Create an AMH node 'on the fly' from the
+ /// original interface node
+ be_interface* create_amh_class (ACE_CString name);
+
+ /// Add attributes and operations from original-interface
+ /// into the newly created AMH-node
+ int add_original_members (be_interface *node,
+ be_interface *amh_node);
+
+ /// For every operation in the original-interface, create
+ /// an AMH-operation and add it to the newly created AMH-node
+ int add_amh_operation (be_operation *orig_operation,
+ be_interface *amh_node);
};
#endif /* AMH_SH_H_ */
-
-
-
-#ifndef AMH_RH_SH_H_
-#define AMH_RH_SH_H_
-
-class be_visitor_amh_rh_interface_sh : public be_visitor_interface_sh
-{
-public:
- be_visitor_amh_rh_interface_sh (be_visitor_context *ctx);
-
- ~be_visitor_amh_rh_interface_sh (void);
-
-protected:
- // virtual void this_method (be_interface *node);
-};
-
-#endif /* AMH_RH_SH_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/amh_ss.h b/TAO/TAO_IDL/be_include/be_visitor_interface/amh_ss.h
index 928031e3d2c..e9447cf4d44 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_interface/amh_ss.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_interface/amh_ss.h
@@ -4,7 +4,7 @@
*
* $Id$
*
- * Specialized interface visitor for AMH and AMH-ResponseHandler
+ * Specialized interface visitor for AMH
*
* @author Darrell Brunsch <brunsch@cs.wustl.edu>
*/
@@ -27,24 +27,3 @@ protected:
};
#endif /* AMH_INTERFACE_SS_H */
-
-
-
-#ifndef AMH_RH_INTERFACE_SS_RH_H
-#define AMH_RH_INTERFACE_SS_RH_H
-
-
-class be_visitor_amh_rh_interface_ss : public be_visitor_interface_ss
-{
-public:
- be_visitor_amh_rh_interface_ss (be_visitor_context *ctx);
-
- ~be_visitor_amh_rh_interface_ss (void);
-
-protected:
- // virtual void this_method (be_interface *node);
- // virtual void dispatch_method (be_interface *node);
-
-};
-
-#endif /* AMH_RH_INTERFACE_SS_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation.h b/TAO/TAO_IDL/be_include/be_visitor_operation.h
index 3e5796e0ee0..d9fd5858b7e 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_operation.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation.h
@@ -74,8 +74,10 @@
#include "be_visitor_operation/thru_poa_proxy_impl_ss.h"
#include "be_visitor_operation/direct_proxy_impl_ss.h"
-// AMH : added 12/12
-#include "be_visitor_operation/amh_sh.h"
-#include "be_visitor_operation/amh_ss.h"
+// AMH
+//#include "be_visitor_operation/amh_sh.h"
+//#include "be_visitor_operation/amh_ss.h"
+#include "be_visitor_operation/amh_rh_sh.h"
+#include "be_visitor_operation/amh_rh_ss.h"
#endif // TAO_BE_VISITOR_OPERATION_H
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/amh_rh_sh.h b/TAO/TAO_IDL/be_include/be_visitor_operation/amh_rh_sh.h
new file mode 100644
index 00000000000..a29f0f08cb5
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/amh_rh_sh.h
@@ -0,0 +1,33 @@
+//=============================================================================
+/**
+* @file amh_rh_sh.h
+*
+* $Id$
+*
+* Creates operation code for AMH-RH operations.
+*
+* @author Mayur Deshpande <mayur@ics.uci.edu>
+*/
+//=============================================================================
+
+#ifndef AMH_RH_OPERATION_SH_H
+#define AMH_RH_OPERATION_SH_H
+
+/**
+* @class be_visitor_operation_amh_rh_sh
+*
+* @brief This is a concrete visitor to generate the server header for
+* AMH operations
+*/
+class be_visitor_amh_rh_operation_sh : public be_visitor_operation
+{
+ public:
+ be_visitor_amh_rh_operation_sh (be_visitor_context *ctx);
+
+ ~be_visitor_amh_rh_operation_sh (void);
+
+ virtual int visit_operation (be_operation *node);
+
+};
+
+#endif /* AMH_OPERATION_SS_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/amh_rh_ss.h b/TAO/TAO_IDL/be_include/be_visitor_operation/amh_rh_ss.h
new file mode 100644
index 00000000000..759ad9da7b7
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/amh_rh_ss.h
@@ -0,0 +1,36 @@
+//=============================================================================
+/**
+* @file amh_ss.h
+*
+* $Id$
+*
+* Creates code for AMH-RH operations.
+*
+* @author Darrell Brunsch <brunsch@cs.wustl.edu>
+*/
+//=============================================================================
+
+#ifndef AMH_RH_OPERATION_SS_H
+#define AMH_RH_OPERATION_SS_H
+
+/**
+ * @class be_visitor_operation_amh_rh_ss
+ *
+ * @brief This is a concrete visitor to generate the server source for
+ * AMH operations
+ */
+class be_visitor_amh_rh_operation_ss : public be_visitor_operation
+{
+ public:
+ be_visitor_amh_rh_operation_ss (be_visitor_context *ctx);
+
+ ~be_visitor_amh_rh_operation_ss (void);
+
+ virtual int visit_operation (be_operation *node);
+
+ private:
+ int marshal_params (be_operation *node);
+
+};
+
+#endif /* AMH_RH_OPERATION_SS_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/amh_sh.h b/TAO/TAO_IDL/be_include/be_visitor_operation/amh_sh.h
index 37e5e8018e4..e9dc268fa55 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_operation/amh_sh.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/amh_sh.h
@@ -4,7 +4,7 @@
*
* $Id$
*
-* Creates code for AMH and AMH-RH operations.
+* Creates code for AMH operations.
*
* @author Mayur Deshpande <mayur@ics.uci.edu>
*/
@@ -31,26 +31,3 @@ class be_visitor_amh_operation_sh : public be_visitor_operation
};
#endif /* AMH_OPERATION_SS_H */
-
-
-#ifndef AMH_RH_OPERATION_SH_H
-#define AMH_RH_OPERATION_SH_H
-
-/**
-* @class be_visitor_operation_amh_rh_sh
-*
-* @brief This is a concrete visitor to generate the server header for
-* AMH operations
-*/
-class be_visitor_amh_rh_operation_sh : public be_visitor_operation
-{
- public:
- be_visitor_amh_rh_operation_sh (be_visitor_context *ctx);
-
- ~be_visitor_amh_rh_operation_sh (void);
-
- virtual int visit_operation (be_operation *node);
-
-};
-
-#endif /* AMH_OPERATION_SS_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/amh_ss.h b/TAO/TAO_IDL/be_include/be_visitor_operation/amh_ss.h
index 62ae8166ef1..dbe56f0d257 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_operation/amh_ss.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_operation/amh_ss.h
@@ -4,7 +4,7 @@
*
* $Id$
*
-* Creates code for AMH and AMH-RH operations.
+* Creates code for AMH operations.
*
* @author Darrell Brunsch <brunsch@cs.wustl.edu>
*/
@@ -33,26 +33,3 @@ class be_visitor_amh_operation_ss : public be_visitor_operation
};
#endif /* AMH_OPERATION_SS_H */
-
-
-#ifndef AMH_RH_OPERATION_SS_H
-#define AMH_RH_OPERATION_SS_H
-
-/**
- * @class be_visitor_operation_amh_rh_ss
- *
- * @brief This is a concrete visitor to generate the server source for
- * AMH operations
- */
-class be_visitor_amh_rh_operation_ss : public be_visitor_operation
-{
- public:
- be_visitor_amh_rh_operation_ss (be_visitor_context *ctx);
-
- ~be_visitor_amh_rh_operation_ss (void);
-
- virtual int visit_operation (be_operation *node);
-
-};
-
-#endif /* AMH_RH_OPERATION_SS_H */