summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp')
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp476
1 files changed, 80 insertions, 396 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp
index 18a98dd2e62..3c83c5607c1 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp
@@ -128,7 +128,7 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
*os << "{\n" << be_idt;
// generate all the tables and other pre-skel info
- if (this->gen_pre_skel_info (node, bt) == -1)
+ if (this->gen_pre_skel_info (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_ss::"
@@ -222,19 +222,6 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
*os << "#endif /* TAO_HAS_INTERCEPTORS */\n\n";
- // do pre upcall processing if any
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_PRE_UPCALL_SS);
- visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
- {
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_ss::"
- "visit_operation - "
- "codegen for pre upcall failed\n"),
- -1);
- }
// make the upcall and assign to the return val
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_ASSIGN_SS);
@@ -306,20 +293,6 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
<< "ACE_CHECK;\n"
<< "#endif /* TAO_HAS_INTERCEPTORS */\n\n";
- // do any post processing for the arguments
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_POST_UPCALL_SS);
- visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
- {
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_ss::"
- "visit_operation - "
- "codegen for args in post upcall failed\n"),
- -1);
- }
-
// check if we are oneway in which case, we are done
if (node->flags () == AST_Operation::OP_oneway)
{
@@ -345,34 +318,6 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
-1);
}
- // do any post processing for the retval
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_POST_UPCALL_SS);
- visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || (bt->accept (visitor) == -1))
- {
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_ss::"
- "visit_operation - "
- "codegen for return type post upcall failed\n"),
- -1);
- }
-
- // do any post processing for the arguments
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_POST_MARSHAL_SS);
- visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
- {
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_ss::"
- "visit_operation - "
- "codegen for args in post marshal failed\n"),
- -1);
- }
-
os->decr_indent ();
*os << "}\n\n";
return 0;
@@ -417,340 +362,7 @@ be_visitor_operation_ss::visit_argument (be_argument *node)
}
int
-be_visitor_operation_ss::gen_raise_exception (be_type *,
- const char *excep,
- const char *completion_status,
- const char * /* env */)
-{
- TAO_OutStream *os = this->ctx_->stream ();
-
- os->indent ();
- *os << "ACE_THROW ("
- << excep << " (" << completion_status << ") "
- << ");\n";
- return 0;
-}
-
-int
-be_visitor_operation_ss::gen_check_exception (be_type *, const char * /* env */)
-{
- TAO_OutStream *os = this->ctx_->stream ();
-
- os->indent ();
- // check if there is an exception
- *os << "ACE_CHECK;\n";
- // << env << ");\n";
-
- return 0;
-}
-
-int
-be_visitor_operation_ss::gen_check_interceptor_exception (be_type *, const char * /* env */)
-{
- TAO_OutStream *os = this->ctx_->stream ();
-
- os->indent ();
- // check if there is an exception
- *os << "TAO_INTERCEPTOR_CHECK;\n";
- // << env << ");\n";
-
- return 0;
-}
-
-const char *
-be_visitor_operation_ss::compute_operation_name (be_operation *node)
-{
- if (this->operation_name_ == 0)
- {
- size_t len = 3; // the null termination char.
- if (this->ctx_->attribute ())
- len += 5; // "Added length for "_set_" or "_get_".
-
- len += ACE_OS::strlen (node->local_name ()->get_string ());
-
- ACE_NEW_RETURN (this->operation_name_,
- char [len],
- 0);
-
- ACE_OS::strcpy (this->operation_name_, "\"");
- if (this->ctx_->attribute ())
- {
- if (node->nmembers () == 1)
- ACE_OS::strcat (this->operation_name_, "_set_");
- else
- ACE_OS::strcat (this->operation_name_, "_get_");
- }
- ACE_OS::strcat (this->operation_name_,
- node->local_name ()->get_string ());
- ACE_OS::strcat (this->operation_name_, "\"");
- }
- return this->operation_name_;
-}
-
-// *********************************************************************
-// Operation visitor for server skeletons using interpretive marshaling
-// *********************************************************************
-
-be_interpretive_visitor_operation_ss::
-be_interpretive_visitor_operation_ss (be_visitor_context *ctx)
- : be_visitor_operation_ss (ctx)
-{
-}
-
-be_interpretive_visitor_operation_ss::
-~be_interpretive_visitor_operation_ss (void)
-{
-}
-
-int
-be_interpretive_visitor_operation_ss::gen_pre_skel_info (be_operation *node,
- be_type *bt)
-{
- TAO_OutStream *os = this->ctx_->stream ();
- be_visitor_context ctx;
-
- os->indent ();
- // generate the param_data and call_data tables. We generate these if and
- // only if none of our arguments is of "native" type. Native types cannot be
- // marshaled.
- // native type does not exist. Generate the static tables
-
- // generate the TAO_Param_Data_Skel table
- *os << "static const TAO_Param_Data_Skel ";
- // 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->flat_name () <<
- "_paramdata [] = " << be_nl;
- *os << "{\n";
- os->incr_indent ();
-
- // entry for the return type
- *os << "{" << bt->tc_name () << ", 0, 0}";
- if (node->nmembers () > 0)
- *os << ",\n";
-
- // generate entries for the param data table for arguments
- if (this->visit_scope (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_ss::"
- "visit_operation - "
- "visit scope failed\n"),
- -1);
- }
- *os << "\n";
- os->decr_indent ();
- *os << "}; // " << node->flat_name () << "_paramdata\n\n";
-
- // now generate the calldata table
- os->indent ();
- *os << "static const TAO_Call_Data_Skel ";
- // 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->flat_name ()
- << "_calldata = " << be_nl
- << "{"
- << "\"";
- // 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 () << "\", ";
-
- // are we oneway or two operation?
- if (node->flags () == AST_Operation::OP_oneway)
- {
- *os << "0, "; // for false
- }
- else
- {
- *os << "1, "; // for true
- }
- // insert the size of the paramdata table i.e., number of arguments + 1
- // for return type
- *os << (node->argument_count () + 1) << ", ";
-
- // insert the address of the paramdata table
- // 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->flat_name () << "_paramdata};\n\n";
-
- return 0;
-}
-
-int
-be_interpretive_visitor_operation_ss::gen_demarshal_params (be_operation *node,
- be_type *bt)
-{
- TAO_OutStream *os = this->ctx_->stream ();
- be_visitor *visitor;
- be_visitor_context ctx;
-
- // setup parameters for demarshaling and demarshal them
- os->indent ();
- *os << "_tao_server_request.demarshal (" << be_idt_nl
- << "ACE_TRY_ENV, " << be_nl
- << "&";
- // 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->flat_name () << "_calldata,\n";
-
- // pass the appropriate return value to the demarshal operation
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_DEMARSHAL_SS);
- visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || (bt->accept (visitor) == -1))
- {
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_ss::"
- "visit_operation - "
- "codegen for return var in demarshal failed\n"),
- -1);
- }
- // insert a comma after the return val if there are arguments
- if (node->argument_count () > 0)
- *os << ",\n";
-
- // pass each argument to the demarshal operation
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_DEMARSHAL_SS);
- visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
- {
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_ss::"
- "visit_operation - "
- "codegen for argument in demarshal failed\n"),
- -1);
- }
-
- // end the demarshal call
- *os << be_uidt_nl;
- *os << ");" << be_nl;
-
- *os << "ACE_CHECK;\n";
-
- return 0;
-}
-
-int
-be_interpretive_visitor_operation_ss::gen_marshal_params (be_operation *node,
- be_type *bt)
-{
- TAO_OutStream *os = this->ctx_->stream ();
- be_visitor *visitor;
- be_visitor_context ctx;
-
- // setup parameters for marshaling and marshal them into the
- // outgoing stream
- os->indent ();
- *os << "_tao_server_request.marshal (" << be_idt_nl
- << "ACE_TRY_ENV, " << be_nl
- // << "_tao_skel_environment, " << be_nl
- << "&";
- // 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->flat_name () << "_calldata,\n";
-
- // pass the appropriate return value to the marshal operation
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_MARSHAL_SS);
- visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || (bt->accept (visitor) == -1))
- {
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_ss::"
- "visit_operation - "
- "codegen for return var in marshal failed\n"),
- -1);
- }
- // insert a comma after the return val if there are arguments
- if (node->argument_count () > 0)
- {
- *os << ",\n";
- }
-
- // pass each argument to the marshal operation
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_MARSHAL_SS);
- visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
- {
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_ss::"
- "visit_operation - "
- "codegen for argument in marshal failed\n"),
- -1);
- }
- // end the marshal call
- *os << be_uidt_nl;
- *os << ");\n";
-
- return 0;
-}
-
-// *********************************************************************
-// Operation visitor for server skeletons using compiled marshaling
-// *********************************************************************
-
-be_compiled_visitor_operation_ss::
-be_compiled_visitor_operation_ss (be_visitor_context *ctx)
- : be_visitor_operation_ss (ctx)
-{
-}
-
-be_compiled_visitor_operation_ss::
-~be_compiled_visitor_operation_ss (void)
-{
-}
-
-int
-be_compiled_visitor_operation_ss::gen_pre_skel_info (be_operation *node,
- be_type *)
+be_visitor_operation_ss::gen_pre_skel_info (be_operation *node)
{
TAO_OutStream *os = this->ctx_->stream ();
@@ -768,8 +380,8 @@ be_compiled_visitor_operation_ss::gen_pre_skel_info (be_operation *node,
}
int
-be_compiled_visitor_operation_ss::gen_demarshal_params (be_operation *node,
- be_type *bt)
+be_visitor_operation_ss::gen_demarshal_params (be_operation *node,
+ be_type *bt)
{
TAO_OutStream *os = this->ctx_->stream ();
be_visitor *visitor;
@@ -820,8 +432,8 @@ be_compiled_visitor_operation_ss::gen_demarshal_params (be_operation *node,
}
int
-be_compiled_visitor_operation_ss::gen_marshal_params (be_operation *node,
- be_type *bt)
+be_visitor_operation_ss::gen_marshal_params (be_operation *node,
+ be_type *bt)
{
TAO_OutStream *os = this->ctx_->stream ();
be_visitor *visitor;
@@ -852,7 +464,7 @@ be_compiled_visitor_operation_ss::gen_marshal_params (be_operation *node,
ctx = *this->ctx_;
be_visitor_context *new_ctx =
new be_visitor_context (ctx);
- be_visitor_operation_compiled_rettype_post_upcall visitor (new_ctx);
+ be_visitor_operation_rettype_post_upcall_ss visitor (new_ctx);
if (bt->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -865,7 +477,7 @@ be_compiled_visitor_operation_ss::gen_marshal_params (be_operation *node,
// Generate any temporary variables to demarshal the arguments
ctx = *this->ctx_;
- be_visitor_compiled_args_post_upcall vis1 (new be_visitor_context (ctx));
+ be_visitor_args_post_upcall_ss vis1 (new be_visitor_context (ctx));
if (node->accept (&vis1) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -936,3 +548,75 @@ be_compiled_visitor_operation_ss::gen_marshal_params (be_operation *node,
return 0;
}
+
+int
+be_visitor_operation_ss::gen_raise_exception (be_type *,
+ const char *excep,
+ const char *completion_status,
+ const char * /* env */)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ os->indent ();
+ *os << "ACE_THROW ("
+ << excep << " (" << completion_status << ") "
+ << ");\n";
+ return 0;
+}
+
+int
+be_visitor_operation_ss::gen_check_exception (be_type *, const char * /* env */)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ os->indent ();
+ // check if there is an exception
+ *os << "ACE_CHECK;\n";
+ // << env << ");\n";
+
+ return 0;
+}
+
+int
+be_visitor_operation_ss::gen_check_interceptor_exception (be_type *, const char * /* env */)
+{
+ TAO_OutStream *os = this->ctx_->stream ();
+
+ os->indent ();
+ // check if there is an exception
+ *os << "TAO_INTERCEPTOR_CHECK;\n";
+ // << env << ");\n";
+
+ return 0;
+}
+
+const char *
+be_visitor_operation_ss::compute_operation_name (be_operation *node)
+{
+ if (this->operation_name_ == 0)
+ {
+ size_t len = 3; // the null termination char.
+ if (this->ctx_->attribute ())
+ len += 5; // "Added length for "_set_" or "_get_".
+
+ len += ACE_OS::strlen (node->local_name ()->get_string ());
+
+ ACE_NEW_RETURN (this->operation_name_,
+ char [len],
+ 0);
+
+ ACE_OS::strcpy (this->operation_name_, "\"");
+ if (this->ctx_->attribute ())
+ {
+ if (node->nmembers () == 1)
+ ACE_OS::strcat (this->operation_name_, "_set_");
+ else
+ ACE_OS::strcat (this->operation_name_, "_get_");
+ }
+ ACE_OS::strcat (this->operation_name_,
+ node->local_name ()->get_string ());
+ ACE_OS::strcat (this->operation_name_, "\"");
+ }
+ return this->operation_name_;
+}
+