1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // SUPERV GraphExecutor : contains classes that permit execution of graphs and particularly the execution automaton
23 // File : DataFlowBase_DynInvoke.cxx
24 // Author : Marc Tajchman, CEA
37 #include <SALOMEconfig.h>
38 #include CORBA_CLIENT_HEADER(SALOME_Component)
40 #include "DynInvoke.hxx"
45 using namespace CORBA ;
47 void DynInvoke( Engines::Component_ptr objComponent ,
49 ServicesAnyData * inParams , int nInParams ,
50 ServicesAnyData * outParams , int nOutParams ) {
51 Request_var req = objComponent->_request( method ) ;
55 NVList_ptr arguments = req->arguments() ;
59 int n_in = nInParams ;
60 int n_out = nOutParams ;
62 // char * aComponent = ObjectToString( objComponent ) ;
63 // MESSAGE( aComponent << "->" << method ) ;
64 for ( i = 0 ; i < n_in ; i++ ) {
65 CORBA::Any & data = inParams[i].Value ;
66 ArgName = inParams[i].Name.c_str() ;
67 Type = data.type()->kind() ;
68 arguments->add_value( ArgName , data , CORBA::ARG_IN ) ;
71 case CORBA::tk_string : {
74 MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << t << " (string)" ) ;
77 case CORBA::tk_boolean : {
79 data >>= (CORBA::Any::to_boolean ) b ;
80 MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << b << " (boolean)" ) ;
83 case CORBA::tk_char : {
85 data >>= (CORBA::Any::to_char ) c ;
86 MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << (int ) c << " (char)" ) ;
89 case CORBA::tk_short : {
92 MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << s << " (short)" ) ;
95 case CORBA::tk_long : {
98 MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << l << " (long)" ) ;
101 case CORBA::tk_float : {
104 MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << f << " (float)" ) ;
107 case CORBA::tk_double : {
110 MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << d << " (double)" ) ;
113 case CORBA::tk_objref : {
114 CORBA::Object_ptr obj ;
115 char * retstr = "Catched ERROR";
118 retstr = ObjectToString( obj ) ;
122 MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << retstr << "(object reference)" ) ;
126 MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << "(other ERROR) kind " << Type ) ;
133 for ( i = 0 ; i < n_out ; i++ ) {
134 CORBA::Any & data = outParams[i].Value ;
135 ArgName = outParams[i].Name.c_str() ;
136 Type = data.type()->kind() ;
137 arguments->add_value( ArgName , data , CORBA::ARG_OUT ) ;
140 case CORBA::tk_string : {
143 MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << t << " (string)" ) ;
146 case CORBA::tk_boolean : {
148 data >>= (CORBA::Any::to_boolean ) b ;
149 MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << b << " (boolean)" ) ;
152 case CORBA::tk_char : {
154 data >>= (CORBA::Any::to_char ) c ;
155 MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << (int ) c << " (char)" ) ;
158 case CORBA::tk_short : {
161 MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << s << " (short)" ) ;
164 case CORBA::tk_long : {
167 MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << l << " (long)" ) ;
170 case CORBA::tk_float : {
173 MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << f << " (float)" ) ;
176 case CORBA::tk_double : {
179 MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << d << " (double)" ) ;
182 case CORBA::tk_objref : {
183 CORBA::Object_ptr obj ;
184 char * retstr = "Catched ERROR";
187 retstr = ObjectToString( obj ) ;
191 MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << retstr << "(object reference)" ) ;
195 MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << "(other ERROR) kind " << Type ) ;
204 if( req->env()->exception() ) {
205 req->env()->exception()->_raise() ;
206 return ; // pas utile ?
209 for ( i = 0 ; i < n_out ; i++ ) {
211 outParams[i].Value = *( arguments->item( i + n_in )->value() ) ;