diff options
author | kirthika <kirthika@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-07-13 00:46:33 +0000 |
---|---|---|
committer | kirthika <kirthika@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-07-13 00:46:33 +0000 |
commit | 6305ed5c6143564997b9ac233569d9c9f55ddb83 (patch) | |
tree | cc4000ab3f1bfd7ade64a7986f1cdbcde81d1137 | |
parent | be5ae6454c02f4c012b29a05ad8998658971ac5a (diff) | |
download | ATCD-6305ed5c6143564997b9ac233569d9c9f55ddb83.tar.gz |
took care of attributes
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_operation/interceptors_ch.cpp | 310 |
1 files changed, 205 insertions, 105 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ch.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ch.cpp index b5369d55e75..6d7d8febbf1 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_ch.cpp @@ -27,12 +27,12 @@ ACE_RCSID(be_visitor_operation, operation_interceptors_ch, "$Id$") -// ****************************************************** -// primary visitor for "operation" in client header -// ****************************************************** + // ****************************************************** + // primary visitor for "operation" in client header + // ****************************************************** -be_visitor_operation_interceptors_ch::be_visitor_operation_interceptors_ch (be_visitor_context *ctx) - : be_visitor_operation (ctx) + be_visitor_operation_interceptors_ch::be_visitor_operation_interceptors_ch (be_visitor_context *ctx) + : be_visitor_operation (ctx) { } @@ -52,8 +52,32 @@ be_visitor_operation_interceptors_ch::visit_operation (be_operation *node) // Generate the ClientRequest_Info object per operation to be used by the interecptors os->indent (); // start with the current indentation level - *os << "class TAO_ClientRequest_Info_"<< node->flat_name () - << " : public TAO_ClientRequest_Info" << be_nl + *os << "class TAO_ClientRequest_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_ClientRequest_Info" << be_nl << "{" << be_nl << "public:"<< be_idt_nl // Need to declare the stub as a friend so that it can access the @@ -92,139 +116,215 @@ be_visitor_operation_interceptors_ch::visit_operation (be_operation *node) } if (node->accept (visitor) == -1) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_interceptors_ch::" - "visit_operation - " - "codegen for argument list failed\n"), - -1); - } + { delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_interceptors_ch::" + "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 (); + // 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_ClientRequest_Info_"<< node->flat_name () - << " (const "<< "TAO_ClientRequest_Info_"<< node->flat_name () - << " &);" << be_nl - << "void operator= (const " - << "TAO_ClientRequest_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_CH); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor) + os->indent (); + *os << be_uidt_nl << "private:" <<be_nl; + + *os << "TAO_ClientRequest_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_ch::" + "(%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_ClientRequest_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_ch::" + "(%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_ClientRequest_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_CH); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_interceptors_ch::" + "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_ch::" + "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_ch::" + "(%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_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)) + { + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_OPERATION_RETTYPE_CH); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (bt->accept (visitor) == -1)) { - 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; + 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; } |