1 // SUPERV GraphExecutor : contains classes that permit execution of graphs and particularly the execution automaton
3 // Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : DataFlowBase_DynInvoke.cxx
25 // Author : Marc Tajchman, CEA
33 #include "DataFlowExecutor_InNode.hxx"
35 using namespace CORBA ;
39 void GraphExecutor::InNode::DynInvoke(Engines::Component_ptr objComponent ,
41 ServicesAnyData * inParams , int nInParams ,
42 ServicesAnyData * outParams , int nOutParams ) {
43 Request_var req = objComponent->_request( method ) ;
47 NVList_ptr arguments = req->arguments() ;
51 int n_in = nInParams ;
52 int n_out = nOutParams ;
54 // char * aComponent = ObjectToString( objComponent ) ;
55 // MESSAGE( aComponent << "->" << method ) ;
56 for ( i = 0 ; i < n_in ; i++ ) {
57 CORBA::Any & data = inParams[i].Value ;
58 ArgName = inParams[i].Name.c_str() ;
59 Type = data.type()->kind() ;
60 arguments->add_value( ArgName , data , CORBA::ARG_IN ) ;
63 case CORBA::tk_string : {
66 MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << t << " (string)" ) ;
69 case CORBA::tk_boolean : {
71 data >>= (CORBA::Any::to_boolean ) b ;
72 MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << b << " (boolean)" ) ;
75 case CORBA::tk_char : {
77 data >>= (CORBA::Any::to_char ) c ;
78 MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << (int ) c << " (char)" ) ;
81 case CORBA::tk_short : {
84 MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << s << " (short)" ) ;
87 case CORBA::tk_long : {
90 MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << l << " (long)" ) ;
93 case CORBA::tk_float : {
96 MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << f << " (float)" ) ;
99 case CORBA::tk_double : {
102 MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << d << " (double)" ) ;
105 case CORBA::tk_objref : {
106 CORBA::Object_ptr obj ;
107 char * retstr = "Catched ERROR";
110 retstr = ObjectToString( obj ) ;
114 MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << retstr << "(object reference)" ) ;
118 MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << "(other ERROR) kind " << Type ) ;
125 for ( i = 0 ; i < n_out ; i++ ) {
126 CORBA::Any & data = outParams[i].Value ;
127 ArgName = outParams[i].Name.c_str() ;
128 Type = data.type()->kind() ;
129 arguments->add_value( ArgName , data , CORBA::ARG_OUT ) ;
132 case CORBA::tk_string : {
135 MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << t << " (string)" ) ;
138 case CORBA::tk_boolean : {
140 data >>= (CORBA::Any::to_boolean ) b ;
141 MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << b << " (boolean)" ) ;
144 case CORBA::tk_char : {
146 data >>= (CORBA::Any::to_char ) c ;
147 MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << (int ) c << " (char)" ) ;
150 case CORBA::tk_short : {
153 MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << s << " (short)" ) ;
156 case CORBA::tk_long : {
159 MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << l << " (long)" ) ;
162 case CORBA::tk_float : {
165 MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << f << " (float)" ) ;
168 case CORBA::tk_double : {
171 MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << d << " (double)" ) ;
174 case CORBA::tk_objref : {
175 CORBA::Object_ptr obj ;
176 char * retstr = "Catched ERROR";
179 retstr = ObjectToString( obj ) ;
183 MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << retstr << "(object reference)" ) ;
187 MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << "(other ERROR) kind " << Type ) ;
196 if( req->env()->exception() ) {
197 req->env()->exception()->_raise() ;
198 return ; // pas utile ?
201 for ( i = 0 ; i < n_out ; i++ ) {
203 outParams[i].Value = *( arguments->item( i + n_in )->value() ) ;
210 void GraphExecutor::InNode::DynInvoke( Engines::Component_ptr obj ,
212 const char * aGraphName ,
213 const char * aNodeName ) {
214 Request_var req = obj->_request( method ) ;
216 NVList_ptr arguments =req->arguments() ;
219 graph <<= aGraphName ;
220 arguments->add_value( "aGraphName" , graph , CORBA::ARG_IN ) ;
223 arguments->add_value( "aNodeName" , node , CORBA::ARG_IN ) ;
227 if( req->env()->exception() ) {
228 req->env()->exception()->_raise();