From 83fbeee783d2dfa97f514d4205b7fbffba047029 Mon Sep 17 00:00:00 2001 From: kirthika Date: Thu, 13 Jul 2000 00:59:41 +0000 Subject: atribute porbs resolved --- .../be/be_visitor_operation/interceptors_cs.cpp | 168 ++++++++++++++++++++- 1 file changed, 162 insertions(+), 6 deletions(-) diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_cs.cpp index 126a4ee1b8f..b61249dc02d 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_cs.cpp @@ -68,8 +68,60 @@ be_visitor_operation_interceptors_cs::visit_operation (be_operation *node) // *os << parents_parent->full_name () << "::"; *os << parent->full_name () << "::"; } - *os << "TAO_ClientRequest_Info_"<flat_name ()<< "::" - << "TAO_ClientRequest_Info_"<< node->flat_name () << " (const char * operation," << be_nl + *os << "TAO_ClientRequest_Info_"<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_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<< " (const char * operation," << be_nl << "IOP::ServiceContextList &service_context_list," << be_nl << "CORBA::Object * target"; @@ -135,7 +187,33 @@ be_visitor_operation_interceptors_cs::visit_operation (be_operation *node) } // The interceptors cant modify "in" and "out" parameters. - *os << "TAO_ClientRequest_Info_"<flat_name ()<< "::" + *os << "TAO_ClientRequest_Info_"<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<< "::" << "arguments (CORBA::Environment &)"<< be_nl << "{" << be_idt_nl << " // Generate the arg list on demand" << be_nl; @@ -183,7 +261,33 @@ be_visitor_operation_interceptors_cs::visit_operation (be_operation *node) *os << parent->full_name () << "::"; } - *os << "TAO_ClientRequest_Info_"<flat_name ()<< "::" + *os << "TAO_ClientRequest_Info_"<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<< "::" << "exceptions (CORBA::Environment &)"<< be_nl << "{" << be_idt_nl <<"// Generate the exception list on demand " << be_nl; @@ -227,7 +331,33 @@ be_visitor_operation_interceptors_cs::visit_operation (be_operation *node) *os << parent->full_name () << "::"; } - *os << "TAO_ClientRequest_Info_"<flat_name ()<< "::" + *os << "TAO_ClientRequest_Info_"<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<< "::" << "result (CORBA::Environment &)"<< be_nl << "{\n // Generate the result on demand :" << be_nl; @@ -288,7 +418,33 @@ be_visitor_operation_interceptors_cs::visit_operation (be_operation *node) *os << parent->full_name () << "::"; } - *os << "TAO_ClientRequest_Info_"<flat_name ()<< "::" + *os << "TAO_ClientRequest_Info_"<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<< "::" << "result ("; ctx = *this->ctx_; -- cgit v1.2.1