1 // Copyright (C) 2007-2014 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, or (at your option) any later version.
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
23 // SUPERV GraphExecutor : contains classes that permit execution of graphs and particularly the execution automaton
24 // File : DataFlowBase_DynInvoke.cxx
25 // Author : Marc Tajchman, CEA
40 #include <SALOMEconfig.h>
41 #include CORBA_CLIENT_HEADER(SALOME_Component)
43 #include "DynInvoke.hxx"
48 using namespace CORBA ;
50 void DynInvoke( Engines::EngineComponent_ptr objComponent ,
52 ServicesAnyData * inParams , int nInParams ,
53 ServicesAnyData * outParams , int nOutParams ) {
54 Request_var req = objComponent->_request( method ) ;
58 NVList_ptr arguments = req->arguments() ;
62 int n_in = nInParams ;
63 int n_out = nOutParams ;
65 // char * aComponent = ObjectToString( objComponent ) ;
66 // MESSAGE( aComponent << "->" << method ) ;
67 for ( i = 0 ; i < n_in ; i++ ) {
68 CORBA::Any & data = inParams[i].Value ;
69 ArgName = inParams[i].Name.c_str() ;
70 Type = data.type()->kind() ;
71 arguments->add_value( ArgName , data , CORBA::ARG_IN ) ;
74 case CORBA::tk_string : {
77 MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << t << " (string)" ) ;
80 case CORBA::tk_boolean : {
82 data >>= (CORBA::Any::to_boolean ) b ;
83 MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << b << " (boolean)" ) ;
86 case CORBA::tk_char : {
88 data >>= (CORBA::Any::to_char ) c ;
89 MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << (int ) c << " (char)" ) ;
92 case CORBA::tk_short : {
95 MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << s << " (short)" ) ;
98 case CORBA::tk_long : {
101 MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << l << " (long)" ) ;
104 case CORBA::tk_float : {
107 MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << f << " (float)" ) ;
110 case CORBA::tk_double : {
113 MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << d << " (double)" ) ;
116 case CORBA::tk_objref : {
117 CORBA::Object_ptr obj ;
118 char * retstr = "Catched ERROR";
121 retstr = ObjectToString( obj ) ;
125 MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << retstr << "(object reference)" ) ;
129 MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << "(other ERROR) kind " << Type ) ;
136 for ( i = 0 ; i < n_out ; i++ ) {
137 CORBA::Any & data = outParams[i].Value ;
138 ArgName = outParams[i].Name.c_str() ;
139 Type = data.type()->kind() ;
140 arguments->add_value( ArgName , data , CORBA::ARG_OUT ) ;
143 case CORBA::tk_string : {
146 MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << t << " (string)" ) ;
149 case CORBA::tk_boolean : {
151 data >>= (CORBA::Any::to_boolean ) b ;
152 MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << b << " (boolean)" ) ;
155 case CORBA::tk_char : {
157 data >>= (CORBA::Any::to_char ) c ;
158 MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << (int ) c << " (char)" ) ;
161 case CORBA::tk_short : {
164 MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << s << " (short)" ) ;
167 case CORBA::tk_long : {
170 MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << l << " (long)" ) ;
173 case CORBA::tk_float : {
176 MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << f << " (float)" ) ;
179 case CORBA::tk_double : {
182 MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << d << " (double)" ) ;
185 case CORBA::tk_objref : {
186 CORBA::Object_ptr obj ;
187 char * retstr = "Catched ERROR";
190 retstr = ObjectToString( obj ) ;
194 MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << retstr << "(object reference)" ) ;
198 MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << "(other ERROR) kind " << Type ) ;
207 if( req->env()->exception() ) {
208 req->env()->exception()->_raise() ;
209 return ; // pas utile ?
212 for ( i = 0 ; i < n_out ; i++ ) {
214 outParams[i].Value = *( arguments->item( i + n_in )->value() ) ;