]> SALOME platform Git repositories - modules/superv.git/blob - src/GraphBase/DataFlowBase_Service.cxx
Salome HOME
*** empty log message ***
[modules/superv.git] / src / GraphBase / DataFlowBase_Service.cxx
1 //  SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
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. 
10 // 
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. 
15 // 
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 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : DataFlowBase_Service.cxx
25 //  Author : Jean Rahuel, CEA
26 //  Module : SUPERV
27 //  $Header:
28
29 using namespace std;
30 #include "DataFlowBase_Service.hxx"
31
32 void GraphBase::Service::SetService( const SALOME_ModuleCatalog::Service aService ) {
33   
34   _Service.ServiceName = CORBA::string_dup( aService.ServiceName ) ;
35   _Service.ServiceinParameter.length( aService.ServiceinParameter.length() ) ;
36   _Service.ServiceoutParameter.length( aService.ServiceoutParameter.length() ) ;
37   int i ;
38   for ( i = 0 ; i < (int ) _Service.ServiceinParameter.length() ; i++ ) {
39     _Service.ServiceinParameter[ i ].Parametertype = CORBA::string_dup( aService.ServiceinParameter[ i ].Parametertype ) ;
40     _Service.ServiceinParameter[ i ].Parametername = CORBA::string_dup( aService.ServiceinParameter[ i ].Parametername ) ;
41   }
42   for ( i = 0 ; i < (int ) _Service.ServiceoutParameter.length() ; i++ ) {
43     _Service.ServiceoutParameter[ i ].Parametertype = CORBA::string_dup( aService.ServiceoutParameter[ i ].Parametertype ) ;
44     _Service.ServiceoutParameter[ i ].Parametername = CORBA::string_dup( aService.ServiceoutParameter[ i ].Parametername ) ;
45   }
46   cdebug << "GraphBase::Service::SetService : " << _Service << endl ;
47   _Instance = 0 ;
48 }
49
50 ostream & operator<< (ostream & f ,const SALOME_ModuleCatalog::Service & s ) {
51   f << "Name          " << s.ServiceName << endl ;
52   int i ;
53   for ( i = 0 ; i < (int ) s.ServiceinParameter.length() ; i++ ) {
54     if ( i == 0 )
55       f << "                 Inparameters  " << i ;
56     else
57       f << "                               " << i ;
58     f << ". " << s.ServiceinParameter[i].Parametername
59       << ". " << s.ServiceinParameter[i].Parametertype << endl ;
60   }
61   for ( i = 0 ; i < (int ) s.ServiceoutParameter.length() ; i++ ) {
62     if ( i == 0 )
63       f << "                 Outparameters " << i ;
64     else
65       f << "                               " << i ;
66     f << ". " << s.ServiceoutParameter[i].Parametername
67       << ". " << s.ServiceoutParameter[i].Parametertype << endl ;
68   }
69   return f;
70 }
71