Salome HOME
e53073261686289b4d4782d416c8d2d761e4a501
[modules/superv.git] / src / GraphBase / DataFlowBase_DataPort.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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //
23 //
24 //  File   : DataFlowBase_DataPort.hxx
25 //  Author : Jean Rahuel, CEA
26 //  Module : SUPERV
27 //  $Header:
28
29 #ifndef _DATAFLOWBASE_DATAPORT_HXX
30 #define _DATAFLOWBASE_DATAPORT_HXX
31
32 #include "DataFlowBase_Port.hxx"
33
34 namespace GraphBase {
35
36   class DataPort : public Port {
37
38     private:
39
40       CORBA::Any const *    _InitialValue ;
41       CORBA::Any const *    _theValue ;
42       CORBA::Any const * *  _Value ;
43 //JR 08.03.2005 : the fields (and corresponding methods) _PortState and _Done are redundant
44 // probably. That should be clarified when I shall have time enough
45       SUPERV::GraphState    _PortState ;
46       bool                  _Done ;
47       pthread_mutex_t       _MutexWait ;
48
49       void SetValue( const CORBA::Any * aValue ) ;
50
51     public :
52
53       DataPort() ;
54       DataPort( const char *const * NodeName  ,
55                 const SALOME_ModuleCatalog::ServicesParameter aserviceParameter ,
56                 const SUPERV::KindOfPort aKind = SUPERV::ServiceParameter ,
57                 const SALOME_ModuleCatalog::DataStreamDependency aDependency = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED ) ;
58       virtual ~DataPort() ;
59
60       void InitialValues(CORBA::Any aValue ) ;
61 //SetValue is under the control of _MutexWait because of concurrent access with Value()
62       void SetValue (const CORBA::Any & aValue ) ;
63       const CORBA::Any Value() const ;
64       bool BoolValue() const ;
65
66 //PortState is NOT under the control of _MutexWait because there is no problem of concurrent access
67       void PortState( SUPERV::GraphState aPortState ) {
68            _PortState = aPortState ; } ;
69       SUPERV::GraphState PortState() { return _PortState ; } ;
70
71 //PortDone is NOT under the control of _MutexWait because there is no problem of concurrent access
72       void PortDone( bool aDone ) {
73 //           cdebug << "ChgDone(.) " << NodeName() << " " << PortName() << " "
74 //                  << _Done << " -> " << aDone << endl ;
75            _Done = aDone ; } ;
76       const bool PortDone() const { return ( _Done ) ; } ;
77
78       void StringValue(ostream & f) const ;
79
80   } ;
81
82 } ;
83 #endif