Salome HOME
e6b7b057b55911b59014658b55d6186855522581
[modules/superv.git] / src / GraphBase / DataFlowBase_Service.hxx
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.hxx
25 //  Author : Jean Rahuel, CEA
26 //  Module : SUPERV
27 //  $Header:
28
29 #ifndef _DATAFLOWBASE_SERVICE_HXX
30 #define _DATAFLOWBASE_SERVICE_HXX
31
32 #include "DataFlowBase_ServicesParameter.hxx"
33
34 ostream & operator<< (ostream & f ,const SALOME_ModuleCatalog::Service & s ) ;
35
36 namespace GraphBase {
37
38   class Service : public Base {
39
40     SALOME_ModuleCatalog::Service _Service ;
41     int                           _Instance ;
42
43     public:   
44
45     Service( const SALOME_ModuleCatalog::Service aService ) {
46              SetService( aService ) ;
47 //             MESSAGE( "GraphBase::Service::Service : " << _Service ) ;
48 //             cout << "GraphBase::Service::Service : " << _Service << endl ;
49              cdebug << "GraphBase::Service::Service : " << _Service << endl ;
50              } ;
51     Service( const char * aServiceName ) {
52              _Service.ServiceName = CORBA::string_dup( aServiceName ) ;
53              cdebug << "GraphBase::Service::Service : " << _Service << endl ;
54              _Instance = 0 ; } ;
55     virtual ~Service() {
56              cdebug << "GraphBase::Service::~Service" << endl ;
57              } ;
58
59     void SetService( const SALOME_ModuleCatalog::Service aService ) ;
60
61     const SALOME_ModuleCatalog::Service * GetService() const {
62           cdebug << "GraphBase::Service::GetService : " << _Service << endl ;
63           return &_Service ; } ;
64     const char * ServiceName() const {
65 //          cdebug << "ServiceName " << hex << (void *) _Service.ServiceName
66 //                 << dec << " = " << _Service.ServiceName << endl ;
67           return _Service.ServiceName ; } ;
68     const SALOME_ModuleCatalog::ListOfServicesParameter ServiceInParameter() const {
69           return _Service.ServiceinParameter ; } ;
70     const SALOME_ModuleCatalog::ListOfServicesParameter ServiceOutParameter() const {
71           return _Service.ServiceoutParameter ; } ;
72
73     const int Instances() const { return _Instance ; } ;
74     int NewInstance() { _Instance += 1 ;
75                         return _Instance ; } ;
76     void Instance( int AddInst = 1 ) { if ( AddInst == 1 )
77                                          _Instance += 1 ;
78                                        else
79                                          _Instance = AddInst ; } ;
80
81   } ;
82
83 } ;
84
85 #endif