Salome HOME
2) new Editing() method of Graph added.
[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     private:
41
42       SALOME_ModuleCatalog::Service _Service ;
43       int                           _Instance ;
44
45     public:   
46
47       Service( const SALOME_ModuleCatalog::Service aService ) {
48              SetService( aService ) ;
49 //             MESSAGE( "GraphBase::Service::Service : " << _Service ) ;
50 //             cout << "GraphBase::Service::Service : " << _Service << endl ;
51              cdebug << "GraphBase::Service::Service : " << _Service << endl ;
52              } ;
53       Service( const char * aServiceName ) {
54                _Service.ServiceName = CORBA::string_dup( aServiceName ) ;
55                cdebug << "GraphBase::Service::Service : " << _Service << endl ;
56                _Instance = 0 ; } ;
57       virtual ~Service() {
58               cdebug << "GraphBase::Service::~Service" << endl ; } ;
59
60       void SetService( const SALOME_ModuleCatalog::Service aService ) ;
61
62       const SALOME_ModuleCatalog::Service * GetService() const {
63             cdebug << "GraphBase::Service::GetService : " << _Service << endl ;
64             return &_Service ; } ;
65       const char * ServiceName() const {
66 //            cdebug << "ServiceName " << hex << (void *) _Service.ServiceName
67 //                   << dec << " = " << _Service.ServiceName << endl ;
68             return _Service.ServiceName ; } ;
69       const SALOME_ModuleCatalog::ListOfServicesParameter ServiceInParameter() const {
70             return _Service.ServiceinParameter ; } ;
71       const SALOME_ModuleCatalog::ListOfServicesParameter ServiceOutParameter() const {
72             return _Service.ServiceoutParameter ; } ;
73       const SALOME_ModuleCatalog::ListOfServicesDataStreamParameter ServiceInStreamParameter() const {
74             return _Service.ServiceinDataStreamParameter ; } ;
75       const SALOME_ModuleCatalog::ListOfServicesDataStreamParameter ServiceOutStreamParameter() const {
76             return _Service.ServiceoutDataStreamParameter ; } ;
77
78       const int Instances() const { return _Instance ; } ;
79       int NewInstance() { _Instance += 1 ;
80                           return _Instance ; } ;
81       void Instance( int Inst = 1 ) { if ( Inst == 1 )
82                                         _Instance += 1 ;
83                                       else
84                                         _Instance = Inst ; } ; } ;
85
86 } ;
87
88 #endif