diff options
author | kirthika <kirthika@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-07-13 00:52:19 +0000 |
---|---|---|
committer | kirthika <kirthika@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-07-13 00:52:19 +0000 |
commit | c1860f20a15e928369251bef36f3997142c796b3 (patch) | |
tree | 467876deeae24421c125aa7fe8fd10aaa8a2d4ac | |
parent | 6305ed5c6143564997b9ac233569d9c9f55ddb83 (diff) | |
download | ATCD-c1860f20a15e928369251bef36f3997142c796b3.tar.gz |
rectified attribute probs
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_operation/interceptors_sh.cpp | 342 |
1 files changed, 236 insertions, 106 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_sh.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_sh.cpp index 2eb92edd568..08cd5854289 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_sh.cpp @@ -27,12 +27,12 @@ ACE_RCSID(be_visitor_operation, operation_interceptors_sh, "$Id$") -// ****************************************************** -// primary visitor for "operation" in server header -// ****************************************************** + // ****************************************************** + // primary visitor for "operation" in server header + // ****************************************************** -be_visitor_operation_interceptors_sh::be_visitor_operation_interceptors_sh (be_visitor_context *ctx) - : be_visitor_operation (ctx) + be_visitor_operation_interceptors_sh::be_visitor_operation_interceptors_sh (be_visitor_context *ctx) + : be_visitor_operation (ctx) { } @@ -52,8 +52,33 @@ be_visitor_operation_interceptors_sh::visit_operation (be_operation *node) // Generate the ServerRequest_Info object per operation to be used by the interecptors os->indent (); // start with the current indentation level - *os << "class TAO_ServerRequest_Info_"<< node->flat_name () - << " : public TAO_ServerRequest_Info" << be_nl + *os << "class TAO_ServerRequest_Info_"<< node->flat_name (); + // We need the interface node in which this operation was defined. However, + // if this operation node was an attribute node in disguise, we get this + // information from the context and add a "_get"/"_set" to the flat + // name to get around the problem of overloaded methods which are + // generated for attributes. + if (this->ctx_->attribute ()) + { + bt = be_type::narrow_from_decl (node->return_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interceptors_ch::" + "visit_operation - " + "Bad return type\n"), + -1); + } + + // grab the right visitor to generate the return type if its not + // void it means it is not the accessor. + if (!this->void_return_type (bt)) + *os <<"_get"; + else + *os <<"_set"; + } + + *os << " : public TAO_ServerRequest_Info" << be_nl << "{" << be_nl << "public:"<< be_idt_nl // Need to declare the stub as a friend so that it can access the @@ -62,8 +87,34 @@ be_visitor_operation_interceptors_sh::visit_operation (be_operation *node) be_decl *parent = be_scope::narrow_from_scope (node->defined_in ())->decl (); *os << "POA_" << parent->full_name () << ";"<<be_nl; + *os << "TAO_ServerRequest_Info_"<< node->flat_name (); + // We need the interface node in which this operation was defined. However, + // if this operation node was an attribute node in disguise, we get this + // information from the context and add a "_get"/"_set" to the flat + // name to get around the problem of overloaded methods which are + // generated for attributes. + if (this->ctx_->attribute ()) + { + bt = be_type::narrow_from_decl (node->return_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interceptors_ch::" + "visit_operation - " + "Bad return type\n"), + -1); + } + + // grab the right visitor to generate the return type if its not + // void it means it is not the accessor. + if (!this->void_return_type (bt)) + *os <<"_get"; + else + *os <<"_set"; + } + - *os << "TAO_ServerRequest_Info_"<< node->flat_name () << " (" << be_idt_nl + *os << " (" << be_idt_nl << "const char * operation,"<< be_nl << "IOP::ServiceContextList &service_context_list" << be_uidt; @@ -91,138 +142,217 @@ be_visitor_operation_interceptors_sh::visit_operation (be_operation *node) } if (node->accept (visitor) == -1) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_interceptors_sh::" - "visit_operation - " - "codegen for argument list failed\n"), - -1); - } + { delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_interceptors_sh::" + "visit_operation - " + "codegen for argument list failed\n"), + -1); + } + delete visitor; - os->indent (); - // Here I still need to generate the other methods + private args - *os << " virtual Dynamic::ParameterList * arguments ("<<be_idt_nl - << "CORBA::Environment &ACE_TRY_ENV =" <<be_idt_nl - << " TAO_default_environment ())" << be_uidt_nl - << " ACE_THROW_SPEC ((CORBA::SystemException));" - << be_uidt_nl << be_nl; - os->indent (); - *os << "virtual Dynamic::ExceptionList * exceptions "<<be_idt_nl - <<"(CORBA::Environment &ACE_TRY_ENV = " <<be_idt_nl - << "TAO_default_environment ())"<< be_uidt_nl - <<"ACE_THROW_SPEC ((CORBA::SystemException));" - << be_uidt_nl << be_nl; - os->indent (); - *os << "virtual CORBA::Any * result ( "<< be_idt_nl - <<"CORBA::Environment &ACE_TRY_ENV ="<< be_idt_nl - << "TAO_default_environment ())"<< be_uidt_nl - << "ACE_THROW_SPEC ((CORBA::SystemException));" - << be_uidt_nl << be_nl; - os->indent (); - *os << be_uidt_nl << "private:" <<be_nl; - - *os << "TAO_ServerRequest_Info_"<< node->flat_name () - << " (const "<< "TAO_ServerRequest_Info_"<< node->flat_name () - << " &);" << be_nl - << "void operator= (const " - << "TAO_ServerRequest_Info_"<< node->flat_name () << " &);"<< be_nl; - // need to generate the args as reference memebers... - //generate the member list with the appropriate mapping. For these - // we grab a visitor that generates the parameter listing and - // modify it to generate reference members. - - ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_SH); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor) + os->indent (); + // Here I still need to generate the other methods + private args + *os << " virtual Dynamic::ParameterList * arguments ("<<be_idt_nl + << "CORBA::Environment &ACE_TRY_ENV =" <<be_idt_nl + << " TAO_default_environment ())" << be_uidt_nl + << " ACE_THROW_SPEC ((CORBA::SystemException));" + << be_uidt_nl << be_nl; + os->indent (); + *os << "virtual Dynamic::ExceptionList * exceptions "<<be_idt_nl + <<"(CORBA::Environment &ACE_TRY_ENV = " <<be_idt_nl + << "TAO_default_environment ())"<< be_uidt_nl + <<"ACE_THROW_SPEC ((CORBA::SystemException));" + << be_uidt_nl << be_nl; + os->indent (); + *os << "virtual CORBA::Any * result ( "<< be_idt_nl + <<"CORBA::Environment &ACE_TRY_ENV ="<< be_idt_nl + << "TAO_default_environment ())"<< be_uidt_nl + << "ACE_THROW_SPEC ((CORBA::SystemException));" + << be_uidt_nl << be_nl; + os->indent (); + *os << be_uidt_nl << "private:" <<be_nl; + + *os << "TAO_ServerRequest_Info_"<< node->flat_name () ; + // We need the interface node in which this operation was defined. However, + // if this operation node was an attribute node in disguise, we get this + // information from the context and add a "_get"/"_set" to the flat + // name to get around the problem of overloaded methods which are + // generated for attributes. + if (this->ctx_->attribute ()) + { + bt = be_type::narrow_from_decl (node->return_type ()); + if (!bt) { ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_interceptors_sh::" + "(%N:%l) be_visitor_interceptors_ch::" "visit_operation - " - "Bad visitor to return type\n"), + "Bad return type\n"), -1); } + + // grab the right visitor to generate the return type if its not + // void it means it is not the accessor. + if (!this->void_return_type (bt)) + *os <<"_get"; + else + *os <<"_set"; + } - if (node->accept (visitor) == -1) + + *os << " (const "<< "TAO_ServerRequest_Info_"<< node->flat_name (); + // We need the interface node in which this operation was defined. However, + // if this operation node was an attribute node in disguise, we get this + // information from the context and add a "_get"/"_set" to the flat + // name to get around the problem of overloaded methods which are + // generated for attributes. + if (this->ctx_->attribute ()) + { + bt = be_type::narrow_from_decl (node->return_type ()); + if (!bt) { - delete visitor; ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_interceptors_sh::" + "(%N:%l) be_visitor_interceptors_ch::" "visit_operation - " - "codegen for argument list failed\n"), + "Bad return type\n"), -1); } - delete visitor; + + // grab the right visitor to generate the return type if its not + // void it means it is not the accessor. + if (!this->void_return_type (bt)) + *os <<"_get"; + else + *os <<"_set"; + } + - // Store the result for later use. - // generate the return type + *os << " &);" << be_nl + << "void operator= (const " + << "TAO_ServerRequest_Info_"<< node->flat_name (); + // We need the interface node in which this operation was defined. However, + // if this operation node was an attribute node in disguise, we get this + // information from the context and add a "_get"/"_set" to the flat + // name to get around the problem of overloaded methods which are + // generated for attributes. + if (this->ctx_->attribute ()) + { bt = be_type::narrow_from_decl (node->return_type ()); if (!bt) { ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interceptors_ch::" + "(%N:%l) be_visitor_interceptors_ch::" "visit_operation - " "Bad return type\n"), -1); } // grab the right visitor to generate the return type if its not - // void since we cant have a private member to be of void type. + // void it means it is not the accessor. if (!this->void_return_type (bt)) - { - *os << "void result ("; - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_RETTYPE_CH); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (bt->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_cs::" - "visit_operation - " - "codegen for retval pre invoke failed\n"), - -1); - } - os->indent (); - *os << " result);" << be_uidt << be_uidt << be_uidt_nl - << " // update the result " << be_nl; - } + *os <<"_get"; + else + *os <<"_set"; + } + + + *os << " &);"<< be_nl; + // need to generate the args as reference memebers... + //generate the member list with the appropriate mapping. For these + // we grab a visitor that generates the parameter listing and + // modify it to generate reference members. - // Generate the result data member - // generate the return type + ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_SH); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_interceptors_sh::" + "visit_operation - " + "Bad visitor to return type\n"), + -1); + } - bt = be_type::narrow_from_decl (node->return_type ()); - if (!bt) + if (node->accept (visitor) == -1) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_interceptors_sh::" + "visit_operation - " + "codegen for argument list failed\n"), + -1); + } + delete visitor; + + // Store the result for later use. + // generate the return type + bt = be_type::narrow_from_decl (node->return_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interceptors_ch::" + "visit_operation - " + "Bad return type\n"), + -1); + } + + // grab the right visitor to generate the return type if its not + // void since we cant have a private member to be of void type. + if (!this->void_return_type (bt)) + { + *os << "void result ("; + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_RETTYPE_CH); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (bt->accept (visitor) == -1)) { + delete visitor; ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interceptors_sh::" + "(%N:%l) be_visitor_operation_cs::" "visit_operation - " - "Bad return type\n"), + "codegen for retval pre invoke failed\n"), -1); } + os->indent (); + *os << " result);" << be_uidt << be_uidt << be_uidt_nl + << " // update the result " << be_nl; + } - // grab the right visitor to generate the return type if its not - // void since we cant have a private member to be of void type. - if (!this->void_return_type (bt)) + // Generate the result data member + // generate the return type + + bt = be_type::narrow_from_decl (node->return_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interceptors_sh::" + "visit_operation - " + "Bad return type\n"), + -1); + } + + // grab the right visitor to generate the return type if its not + // void since we cant have a private member to be of void type. + if (!this->void_return_type (bt)) + { + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_RETTYPE_SH); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (bt->accept (visitor) == -1)) { - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_RETTYPE_SH); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (bt->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_cs::" - "visit_operation - " - "codegen for retval pre invoke failed\n"), - -1); - } - os->indent (); - *os << " result_;" << be_uidt << be_uidt << be_uidt_nl; + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_cs::" + "visit_operation - " + "codegen for retval pre invoke failed\n"), + -1); } - os->decr_indent (); - *os << "};\n\n"; - return 0; + os->indent (); + *os << " result_;" << be_uidt << be_uidt << be_uidt_nl; + } + os->decr_indent (); + *os << "};\n\n"; + return 0; } |