From eb3b0e21783f4db21b0e1f976d6a6630f19e6a24 Mon Sep 17 00:00:00 2001 From: rahuel Date: Mon, 26 Apr 2004 12:41:11 +0000 Subject: [PATCH] *** empty log message *** --- src/AddComponent/AddComponent_Impl.cxx | 12 +- .../DataStreamComponent_CheckOfUndefined.cxx | 37 + .../DataStreamComponent_Impl.cxx | 160 +++ .../DataStreamComponent_Impl.hxx | 106 ++ src/DataStreamComponent/Makefile.in | 59 ++ src/DivComponent/DivComponent.cxx | 2 +- src/GraphBase/DataFlowBase_Base.cxx | 98 +- src/GraphBase/DataFlowBase_Base.hxx | 30 +- src/GraphBase/DataFlowBase_ComputingNode.cxx | 733 +++++++++----- src/GraphBase/DataFlowBase_ComputingNode.hxx | 197 ++-- src/GraphBase/DataFlowBase_DataNode.cxx | 24 +- src/GraphBase/DataFlowBase_DataPort.cxx | 15 +- src/GraphBase/DataFlowBase_DataPort.hxx | 55 +- src/GraphBase/DataFlowBase_Graph.cxx | 405 ++++++-- src/GraphBase/DataFlowBase_Graph.hxx | 59 +- .../DataFlowBase_InDataStreamPort.cxx | 140 +++ .../DataFlowBase_InDataStreamPort.hxx | 65 ++ src/GraphBase/DataFlowBase_InLineNode.cxx | 2 +- src/GraphBase/DataFlowBase_InPort.cxx | 14 +- src/GraphBase/DataFlowBase_InPort.hxx | 18 +- .../DataFlowBase_OutDataStreamPort.cxx | 35 + .../DataFlowBase_OutDataStreamPort.hxx | 50 + src/GraphBase/DataFlowBase_OutPort.cxx | 2 - src/GraphBase/DataFlowBase_OutPort.hxx | 10 +- src/GraphBase/DataFlowBase_Port.cxx | 19 + src/GraphBase/DataFlowBase_Port.hxx | 184 ++-- src/GraphBase/DataFlowBase_PortsOfNode.cxx | 296 ++++-- src/GraphBase/DataFlowBase_PortsOfNode.hxx | 49 +- src/GraphBase/DataFlowBase_Service.cxx | 31 + src/GraphBase/DataFlowBase_Service.hxx | 65 +- .../DataFlowBase_ServicesParameter.hxx | 25 +- src/GraphBase/DataFlowBase_StreamGraph.cxx | 126 +++ src/GraphBase/DataFlowBase_StreamGraph.hxx | 74 ++ src/GraphBase/DataFlowBase_StreamNode.cxx | 117 +++ src/GraphBase/DataFlowBase_StreamNode.hxx | 137 +++ src/GraphBase/DataFlowBase_XmlHandler.cxx | 163 ++- src/GraphBase/DataFlowBase_XmlHandler.hxx | 3 + src/GraphBase/Makefile.in | 11 +- src/GraphEditor/DataFlowEditor_DataFlow.cxx | 5 +- src/GraphEditor/DataFlowEditor_DataFlow.hxx | 3 +- src/GraphEditor/DataFlowEditor_DataFlow.lxx | 64 +- src/GraphEditor/DataFlowEditor_InNode.cxx | 7 +- src/GraphEditor/DataFlowEditor_InNode.hxx | 14 +- src/GraphEditor/DataFlowEditor_OutNode.cxx | 662 +++++++------ src/GraphEditor/DataFlowEditor_OutNode.hxx | 81 +- src/GraphEditor/Makefile.in | 3 +- .../DataFlowExecutor_DataFlow.cxx | 23 +- .../DataFlowExecutor_DataFlow.hxx | 3 +- .../DataFlowExecutor_DataFlow.lxx | 7 +- .../DataFlowExecutor_FiniteStateMachine.cxx | 2 +- src/GraphExecutor/DataFlowExecutor_InNode.cxx | 82 +- src/GraphExecutor/DataFlowExecutor_InNode.hxx | 15 +- .../DataFlowExecutor_InNodeThreads.cxx | 123 +-- .../DataFlowExecutor_OutNode.cxx | 396 ++++---- .../DataFlowExecutor_OutNode.hxx | 25 +- .../DataFlowExecutor_PyDynInvoke.cxx | 5 +- src/GraphExecutor/Makefile.in | 3 +- src/Makefile.in | 2 +- src/MulComponent/MulComponent.cxx | 2 +- src/SubComponent/SubComponent.cxx | 2 +- src/Supervision/CNode_Impl.cxx | 928 ++++++++++++------ src/Supervision/CNode_Impl.hxx | 23 +- src/Supervision/ELNode_Impl.cxx | 8 +- src/Supervision/ESNode_Impl.cxx | 2 +- src/Supervision/FNode_Impl.cxx | 6 +- src/Supervision/GNode_Impl.cxx | 6 +- src/Supervision/GNode_Impl.hxx | 2 +- src/Supervision/Graph_Impl.cxx | 358 ++++--- src/Supervision/Graph_Impl.hxx | 18 +- src/Supervision/INode_Impl.cxx | 224 +++-- src/Supervision/INode_Impl.hxx | 14 +- src/Supervision/LNode_Impl.cxx | 2 +- src/Supervision/Link_Impl.cxx | 102 +- src/Supervision/Link_Impl.hxx | 18 +- src/Supervision/Makefile.in | 13 +- src/Supervision/Port_Impl.cxx | 226 +++-- src/Supervision/Port_Impl.hxx | 43 +- src/Supervision/SNode_Impl.cxx | 2 +- src/Supervision/SuperV.py | 416 +++++--- src/Supervision/SuperV_Impl.cxx | 94 +- src/Supervision/SuperV_Impl.hxx | 7 +- src/Supervision/Value_Impl.cxx | 8 +- src/SyrComponent/SyrComponent_Impl.cxx | 38 +- 83 files changed, 5479 insertions(+), 2236 deletions(-) create mode 100644 src/DataStreamComponent/DataStreamComponent_CheckOfUndefined.cxx create mode 100644 src/DataStreamComponent/DataStreamComponent_Impl.cxx create mode 100644 src/DataStreamComponent/DataStreamComponent_Impl.hxx create mode 100644 src/DataStreamComponent/Makefile.in create mode 100644 src/GraphBase/DataFlowBase_InDataStreamPort.cxx create mode 100644 src/GraphBase/DataFlowBase_InDataStreamPort.hxx create mode 100644 src/GraphBase/DataFlowBase_OutDataStreamPort.cxx create mode 100644 src/GraphBase/DataFlowBase_OutDataStreamPort.hxx create mode 100644 src/GraphBase/DataFlowBase_StreamGraph.cxx create mode 100644 src/GraphBase/DataFlowBase_StreamGraph.hxx create mode 100644 src/GraphBase/DataFlowBase_StreamNode.cxx create mode 100644 src/GraphBase/DataFlowBase_StreamNode.hxx diff --git a/src/AddComponent/AddComponent_Impl.cxx b/src/AddComponent/AddComponent_Impl.cxx index 491e79b..3574c08 100644 --- a/src/AddComponent/AddComponent_Impl.cxx +++ b/src/AddComponent/AddComponent_Impl.cxx @@ -80,7 +80,7 @@ double AddComponent_Impl::Add( double x , double y , double & z ) { sendMessage(NOTIF_STEP, "AddComponent_Impl::Add is Computing"); S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); MESSAGE( "AddComponent_Impl::Add( " << x << " , " << y << " , " << z << " ) returns " << (x - y) << " after " << S << " seconds" ) LastAddition = z ; @@ -107,7 +107,7 @@ double AddComponent_Impl::LastResult() { sendMessage(NOTIF_STEP, "AddComponent_Impl::LastResult is Computing"); int S; S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); endService( " AddComponent_Impl::LastResult" ); return LastAddition ; } @@ -165,7 +165,7 @@ double Adder_Impl::Add( double x , double y , double & z ) { sendMessage(NOTIF_STEP, "Adder_Impl::Add is Computing"); S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); MESSAGE( "Adder_Impl::Add( " << x << " , " << y << " , " << z << " ) returns " << -(x - y) << " after " << S << " seconds" ) LastAddition = z ; @@ -182,7 +182,7 @@ double Adder_Impl::AddAndCompare( const double x , const double y , sendMessage(NOTIF_STEP, "Adder_Impl::AddAndCompare is Computing"); S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); MESSAGE( "Adder_Impl::AddAndCompare( " << x << " , " << y << " , " << z << " ) returns " << -(x - y) << " after " << S << " seconds" ) LastAddition = z ; @@ -207,7 +207,7 @@ void Adder_Impl::SetLastResult( double z ) { sendMessage(NOTIF_STEP, "Adder_Impl::SetLastResult is Computing"); int S; S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); LastAddition = z ; endService( " Adder_Impl::SetLastResult" ); return ; @@ -218,7 +218,7 @@ void Adder_Impl::LastResult( double & z ) { sendMessage(NOTIF_STEP, "Adder_Impl::LastResult is Computing"); int S; S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); z = LastAddition ; endService( " Adder_Impl::LastResult" ); return ; diff --git a/src/DataStreamComponent/DataStreamComponent_CheckOfUndefined.cxx b/src/DataStreamComponent/DataStreamComponent_CheckOfUndefined.cxx new file mode 100644 index 0000000..05cfb16 --- /dev/null +++ b/src/DataStreamComponent/DataStreamComponent_CheckOfUndefined.cxx @@ -0,0 +1,37 @@ +// SuperVisionTest DataStreamComponent : example of component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : DataStreamComponent_CheckOfUndefined.cxx +// Module : SuperVisionTest + +using namespace std; +#include +#include +#include + +#include "DataStreamComponent_Impl.hxx" + +int main(int argc, char **argv) { + return 0; +} + diff --git a/src/DataStreamComponent/DataStreamComponent_Impl.cxx b/src/DataStreamComponent/DataStreamComponent_Impl.cxx new file mode 100644 index 0000000..0cfff2a --- /dev/null +++ b/src/DataStreamComponent/DataStreamComponent_Impl.cxx @@ -0,0 +1,160 @@ +// SuperVisionTest DataStreamComponent : example +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : DataStreamComponent_Impl.cxx +// Author : Jean Rahuel +// Module : SuperVisionTest + +using namespace std; +#include +#include +#include +#include +#include + +#include "DataStreamComponent_Impl.hxx" + +DataStreamFactory_Impl::DataStreamFactory_Impl( CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName) : + Engines_Component_i(orb, poa, contId, instanceName, interfaceName,1,true) { + MESSAGE("DataStreamFactory_Impl::DataStreamFactory_Impl this " << hex << this << dec + << "activate object instanceName(" + << instanceName << ") interfaceName(" << interfaceName << ")" ) + _thisObj = this ; + _id = _poa->activate_object(_thisObj); +} + +DataStreamFactory_Impl::DataStreamFactory_Impl() { +} + +DataStreamFactory_Impl::~DataStreamFactory_Impl() { +} + +void DataStreamFactory_Impl::Setxy( const long x , const long y ) { + _x = x ; + _y = y ; +} + +void DataStreamFactory_Impl::Getxy( long & x , long & y ) { + x = _x ; + y = _y ; +} + +void DataStreamFactory_Impl::Add( const long x , const long y , long & z ) { + z = x+y ; +} +void DataStreamFactory_Impl::Sub( const long x , const long y , long & z ) { + z = x-y ; +} +void DataStreamFactory_Impl::Mul( const long x , const long y , long & z ) { + z = x*y ; +} +void DataStreamFactory_Impl::Div( const long x , const long y , long & z ) { + z = x/y ; +} + +DataStreamComponent::DataStream_ptr DataStreamFactory_Impl::NewDataStream() { + beginService( "DataStreamFactory_Impl::NewDataStream" ); + sendMessage(NOTIF_STEP, "DataStreamFactory_Impl creates DataStream_Impl"); + DataStream_Impl * myDataStream ; + myDataStream = new DataStream_Impl( _orb , _poa, _contId, + instanceName() , interfaceName() , + graphName() , nodeName() ) ; + DataStreamComponent::DataStream_var iobject ; + PortableServer::ObjectId * id = myDataStream->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + iobject = DataStreamComponent::DataStream::_narrow(obj) ; + endService( "DataStreamFactory_Impl::NewDataStream" ); + return DataStreamComponent::DataStream::_duplicate(iobject) ; +} + +extern "C" +{ + PortableServer::ObjectId * DataStreamFactoryEngine_factory + (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName) + { + MESSAGE("DataStreamFactoryEngine_factory DataStreamFactoryEngine (" + << instanceName << "," << interfaceName << "," << getpid() << ")"); + DataStreamFactory_Impl * myDataStreamFactory + = new DataStreamFactory_Impl(orb, poa, contId, instanceName, interfaceName); + return myDataStreamFactory->getId() ; + } +} + +DataStream_Impl::DataStream_Impl( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char * instanceName , + const char * interfaceName , + const char * graphName , + const char * nodeName ) : + Engines_Component_i(orb, poa, contId, instanceName, interfaceName,1,true) { + Names( graphName , nodeName ) ; + MESSAGE("DataStream_Impl::DataStream_Impl activate object instanceName(" + << instanceName << ") interfaceName(" << interfaceName << ") --> " + << hex << (void *) this << dec ) + beginService( "DataStream_Impl::DataStream_Impl" ); + _thisObj = this ; + _id = _poa->activate_object(_thisObj); + sendMessage(NOTIF_STEP, "DataStream_Impl is Created"); + endService( "DataStream_Impl::DataStream_Impl" ); +} + +DataStream_Impl::DataStream_Impl() { +} + +DataStream_Impl::~DataStream_Impl() { + beginService( "DataStream_Impl::~DataStream_Impl" ); + endService( "DataStream_Impl::~DataStream_Impl" ); +} + +void DataStream_Impl::StreamSetxy( const long x , const long y ) { + _x = x ; + _y = y ; +} + +void DataStream_Impl::StreamGetxy( long & x , long & y ) { + x = _x ; + y = _y ; +} + +void DataStream_Impl::StreamAdd( const long x , const long y , long & z ) { + z = x+y ; +} +void DataStream_Impl::StreamSub( const long x , const long y , long & z ) { + z = x-y ; +} +void DataStream_Impl::StreamMul( const long x , const long y , long & z ) { + z = x*y ; +} +void DataStream_Impl::StreamDiv( const long x , const long y , long & z ) { + z = x/y ; +} + diff --git a/src/DataStreamComponent/DataStreamComponent_Impl.hxx b/src/DataStreamComponent/DataStreamComponent_Impl.hxx new file mode 100644 index 0000000..6998143 --- /dev/null +++ b/src/DataStreamComponent/DataStreamComponent_Impl.hxx @@ -0,0 +1,106 @@ +// SuperVisionTest DataStreamComponent : example of component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : DataStreamComponent_Impl.hxx +// Author : Jean Rahuel +// Module : SuperVisionTest +// $Header: + +#ifndef _DATASTREAMINTERFACE_IMPL_HXX_ +#define _DATASTREAMINTERFACE_IMPL_HXX_ + +#include +#include CORBA_SERVER_HEADER(DataStreamComponent) +#include CORBA_SERVER_HEADER(SALOME_Component) +#include "SALOME_Component_i.hxx" + +class DataStreamFactory_Impl : public POA_DataStreamComponent::DataStreamFactory , + public Engines_Component_i { +public: + DataStreamFactory_Impl() ; + DataStreamFactory_Impl( CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName); + + virtual ~DataStreamFactory_Impl(); + + virtual void Setxy( const long x , const long y ) ; + + virtual void Getxy( long & x , long & y ) ; + + virtual void Add( const long x , const long y , long & z ) ; + virtual void Sub( const long x , const long y , long & z ) ; + virtual void Mul( const long x , const long y , long & z ) ; + virtual void Div( const long x , const long y , long & z ) ; + + virtual DataStreamComponent::DataStream_ptr NewDataStream() ; + +private: + + long _x ; + long _y ; + +}; + +extern "C" + PortableServer::ObjectId * DataStreamFactoryEngine_factory + ( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName ) ; + + +class DataStream_Impl : public POA_DataStreamComponent::DataStream , + public Engines_Component_i { +public: + DataStream_Impl() ; + DataStream_Impl( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName , + const char * graphName , + const char * nodeName ); + + virtual ~DataStream_Impl(); + + virtual void StreamSetxy( const long x , const long y ) ; + + virtual void StreamGetxy( long & x , long & y ) ; + + virtual void StreamAdd( const long x , const long y , long & z ) ; + virtual void StreamSub( const long x , const long y , long & z ) ; + virtual void StreamMul( const long x , const long y , long & z ) ; + virtual void StreamDiv( const long x , const long y , long & z ) ; + +private: + + long _x ; + long _y ; + +}; + +#endif diff --git a/src/DataStreamComponent/Makefile.in b/src/DataStreamComponent/Makefile.in new file mode 100644 index 0000000..447bfb9 --- /dev/null +++ b/src/DataStreamComponent/Makefile.in @@ -0,0 +1,59 @@ +# SUPERV DataStreamComponent : example of component +# +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +# +# +# +# File : Makefile.in +# Author : Jean Rahuel +# Module : SUPERV +# $Header: + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +EXPORT_HEADERS = \ + DataStreamComponent_Impl.hxx + +# Libraries targets +LIB = libDataStreamFactoryEngine.la +LIB_SRC = \ + DataStreamComponent_Impl.cxx + +LIB_SERVER_IDL = SALOME_Component.idl \ + DataStreamComponent.idl + +# Executables targets +BIN = DataStreamComponent_CheckOfUndefined +BIN_SRC = +BIN_SERVER_IDL = + +CPPFLAGS+= $(PYTHON_INCLUDES) \ + -I${KERNEL_ROOT_DIR}/include/salome +LDFLAGS+= -lSalomeContainer -lSalomeNS -lOpUtil -lRegistry -lSalomeNotification -lSalomeLoggerServer \ + -L${KERNEL_ROOT_DIR}/lib/salome + +@CONCLUDE@ + diff --git a/src/DivComponent/DivComponent.cxx b/src/DivComponent/DivComponent.cxx index 4a4522f..ab84e79 100644 --- a/src/DivComponent/DivComponent.cxx +++ b/src/DivComponent/DivComponent.cxx @@ -64,7 +64,7 @@ void DivComponentEngine::Div( double x , double y , double & z ) { sendMessage(NOTIF_STEP, "Div is Computing"); S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); sendMessage(NOTIF_TRACE, "Div is Much More Difficult Operation"); MESSAGE("DivComponentEngine::Div( " << x << " , " << y << " , " << z << " ) after " << S << " seconds" ) diff --git a/src/GraphBase/DataFlowBase_Base.cxx b/src/GraphBase/DataFlowBase_Base.cxx index 7853f57..d7016cf 100644 --- a/src/GraphBase/DataFlowBase_Base.cxx +++ b/src/GraphBase/DataFlowBase_Base.cxx @@ -29,7 +29,7 @@ using namespace std; #include "DataFlowBase_Base.hxx" -char *SuperVision_Version = "1.05" ; +char *SuperVision_Version = "2.0" ; char *NULLSTRING = "" ; @@ -50,6 +50,12 @@ void GraphBase::Base::SetDebug( CORBA::ORB_ptr ORB , _prof_debug = theprof_debug ; _fdebug = thefdebug ; } + else { + MESSAGE( "GraphBase::Base::SetDebug with theprof_debug == NULL" ) ; + } + } + else { + cdebug << "GraphBase::Base::SetDebug already done" << endl ; } // cdebug_in << "GraphBase::Base::SetDebug" << endl ; // cdebug << "GraphBase::Base::SetDebug" << endl ; @@ -63,3 +69,93 @@ char * GraphBase::Base::ObjectToString( CORBA::Object_ptr obj ) const { CORBA::Object_ptr GraphBase::Base::StringToObject( char * obj ) const { return _Orb->string_to_object( obj ); } + +string DataStreamTypeToString( const SALOME_ModuleCatalog::DataStreamType aDataStreamType ) { + string aIdlType ; + switch ( aDataStreamType ) { + case SALOME_ModuleCatalog::DATASTREAM_UNKNOWN : { + aIdlType = "Unknown" ; + break; + } + case SALOME_ModuleCatalog::DATASTREAM_INTEGER : { + aIdlType = "int" ; + break; + } + case SALOME_ModuleCatalog::DATASTREAM_FLOAT : { + aIdlType = "float" ; + break; + } + case SALOME_ModuleCatalog::DATASTREAM_DOUBLE : { + aIdlType = "double" ; + break; + } + case SALOME_ModuleCatalog::DATASTREAM_STRING : { + aIdlType = "string" ; + break; + } + case SALOME_ModuleCatalog::DATASTREAM_BOOLEAN : { + aIdlType = "bool" ; + break; + } + default: { + aIdlType = "Unknown" ; + break; + } + } + return aIdlType ; +} + +SALOME_ModuleCatalog::DataStreamType StringToDataStreamType( const char * aIdlType ) { + SALOME_ModuleCatalog::DataStreamType aDataStreamType ; + if ( !strcmp( aIdlType , "Unknown" ) ) { + aDataStreamType = SALOME_ModuleCatalog::DATASTREAM_UNKNOWN ; + } + else if ( !strcmp( aIdlType , "int" ) ) { + aDataStreamType = SALOME_ModuleCatalog::DATASTREAM_INTEGER ; + } + else if ( !strcmp( aIdlType , "float" ) ) { + aDataStreamType = SALOME_ModuleCatalog::DATASTREAM_FLOAT ; + } + else if ( !strcmp( aIdlType , "double" ) ) { + aDataStreamType = SALOME_ModuleCatalog::DATASTREAM_DOUBLE ; + } + else if ( !strcmp( aIdlType , "string" ) ) { + aDataStreamType = SALOME_ModuleCatalog::DATASTREAM_STRING ; + } + else if ( !strcmp( aIdlType , "bool" ) ) { + aDataStreamType = SALOME_ModuleCatalog::DATASTREAM_BOOLEAN ; + } + else { + aDataStreamType = SALOME_ModuleCatalog::DATASTREAM_UNKNOWN ; + } + return aDataStreamType ; +} + +ostream & operator<< (ostream & f ,const SALOME_ModuleCatalog::DataStreamType & s ) { + switch (s) { + case SALOME_ModuleCatalog::DATASTREAM_UNKNOWN : + f << "DATASTREAM_UNKNOWN"; + break; + case SALOME_ModuleCatalog::DATASTREAM_INTEGER : + f << "DATASTREAM_INTEGER"; + break; + case SALOME_ModuleCatalog::DATASTREAM_FLOAT : + f << "DATASTREAM_FLOAT"; + break; + case SALOME_ModuleCatalog::DATASTREAM_DOUBLE : + f << "DATASTREAM_DOUBLE"; + break; + case SALOME_ModuleCatalog::DATASTREAM_STRING : + f << "DATASTREAM_STRING"; + break; + case SALOME_ModuleCatalog::DATASTREAM_BOOLEAN : + f << "DATASTREAM_BOOLEAN"; + break; + default : + f << "DATASTREAM_UNKNOWN"; + break; + } + + return f; +} + diff --git a/src/GraphBase/DataFlowBase_Base.hxx b/src/GraphBase/DataFlowBase_Base.hxx index 49843c3..55d653d 100644 --- a/src/GraphBase/DataFlowBase_Base.hxx +++ b/src/GraphBase/DataFlowBase_Base.hxx @@ -81,6 +81,9 @@ inline char * my_strblkdup( const char * s ) { return t; } +string DataStreamTypeToString( const SALOME_ModuleCatalog::DataStreamType aDataStreamType ) ; +SALOME_ModuleCatalog::DataStreamType StringToDataStreamType( const char * aIdlType ) ; + enum StatusOfPort { NotConnected , PortConnected , PortAndDataConnected , DataConnected } ; @@ -101,17 +104,34 @@ namespace GraphBase { typedef vector ListOfParameters; + struct InDataStreamParameter { + SALOME_ModuleCatalog::ServicesDataStreamParameter theDataStreamParameter ; + SUPERV::KindOfSchema theKindOfSchema ; + SUPERV::KindOfInterpolation theKindOfInterpolation ; + SUPERV::KindOfExtrapolation theKindOfExtrapolation ; + }; + typedef vector ListOfInDataStreamParameters; + + struct OutDataStreamParameter { + SALOME_ModuleCatalog::ServicesDataStreamParameter theDataStreamParameter ; + long theNumberOfValues ; + }; + typedef vector ListOfOutDataStreamParameters; + struct SNode { string theComponentName ; string theInterfaceName ; string theName ; SUPERV::KindOfNode theKind ; + long theTimeout ; + SUPERV::KindOfDataStreamTrace theDataStreamTrace ; + double theDeltaTime ; string theCoupledNode ; - int theDataStreamInArgsNumber ; - int theDataStreamOutArgsNumber ; +// int theDataStreamInArgsNumber ; +// int theDataStreamOutArgsNumber ; SALOME_ModuleCatalog::Service theService ; - ListOfParameters theListOfInDataStreams ; - ListOfParameters theListOfOutDataStreams ; + ListOfInDataStreamParameters theListOfInDataStreams ; + ListOfOutDataStreamParameters theListOfOutDataStreams ; ListOfFuncName theListOfFuncName ; ListOfPythonFunctions theListOfPythonFunctions ; SUPERV::SDate theFirstCreation ; @@ -194,4 +214,6 @@ namespace GraphBase { } ; +ostream & operator<< (ostream &,const SALOME_ModuleCatalog::DataStreamType &); + #endif diff --git a/src/GraphBase/DataFlowBase_ComputingNode.cxx b/src/GraphBase/DataFlowBase_ComputingNode.cxx index 4e689ef..c09fda1 100644 --- a/src/GraphBase/DataFlowBase_ComputingNode.cxx +++ b/src/GraphBase/DataFlowBase_ComputingNode.cxx @@ -4,7 +4,7 @@ // // // -// File : DataFlowBase_Node.cxx +// File : DataFlowBase_ComputingNode.cxx // Author : Jean Rahuel, CEA // Module : SUPERV // $Header: @@ -13,10 +13,10 @@ using namespace std; //#include //#include -#include "DataFlowBase_InLineNode.hxx" -#include "DataFlowBase_LoopNode.hxx" +#include "DataFlowBase_StreamGraph.hxx" +//#include "DataFlowBase_LoopNode.hxx" -static void InitFields( SUPERV::KindOfNode &_Kind , +static void InitFields( //SUPERV::KindOfNode &_Kind , SUPERV::SDate &_FirstCreation , SUPERV::SDate &_LastModification , char * &_EditorRelease , @@ -24,16 +24,16 @@ static void InitFields( SUPERV::KindOfNode &_Kind , char * &_Comment , bool &_HeadNode , bool &_GeneratedName , - int &_DataStreamInPortsNumber , - int &_DataStreamOutPortsNumber , + //int &_DataStreamInPortsNumber , + //int &_DataStreamOutPortsNumber , int &_ConnectedInPortsNumber , int &_DecrConnectedInPortsNumber, - int &_LinkedNodesSize , + //int &_LinkedNodesSize , int &_SubGraphNumber ) { time_t T = time(NULL); struct tm * Tm = localtime(&T); - _Kind = SUPERV::DataFlowNode ; +// _Kind = SUPERV::DataFlowGraph ; _FirstCreation.Second = _LastModification.Second = Tm->tm_sec; _FirstCreation.Minute = _LastModification.Minute = Tm->tm_min; @@ -53,19 +53,20 @@ static void InitFields( SUPERV::KindOfNode &_Kind , _HeadNode = false ; _GeneratedName = false ; - _DataStreamInPortsNumber = 0 ; - _DataStreamOutPortsNumber = 0 ; +// _DataStreamInPortsNumber = 0 ; +// _DataStreamOutPortsNumber = 0 ; _ConnectedInPortsNumber = 0 ; _DecrConnectedInPortsNumber = 0 ; - _LinkedNodesSize = 0 ; +// _LinkedNodesSize = 0 ; _SubGraphNumber = 0 ; } GraphBase::ComputingNode::ComputingNode() : - GraphBase::PortsOfNode::PortsOfNode() { +// GraphBase::PortsOfNode::PortsOfNode() { + GraphBase::StreamNode::StreamNode() { - InitFields( _Kind , + InitFields( //_Kind , _FirstCreation , _LastModification , _EditorRelease , @@ -73,17 +74,17 @@ GraphBase::ComputingNode::ComputingNode() : _Comment , _HeadNode , _GeneratedName , - _DataStreamInPortsNumber , - _DataStreamOutPortsNumber , + //_DataStreamInPortsNumber , + //_DataStreamOutPortsNumber , _ConnectedInPortsNumber , _DecrConnectedInPortsNumber , - _LinkedNodesSize , + //_LinkedNodesSize , _SubGraphNumber ) ; + Kind( SUPERV::DataFlowGraph ) ; _NamingService = NULL ; _Node = SUPERV::CNode::_nil() ; _InNode = NULL ; _ThreadNo = pthread_self() ; - _Name = NULL ; cdebug << "GraphBase::Node::Node " << this << " " << endl ; } @@ -93,10 +94,11 @@ GraphBase::ComputingNode::ComputingNode( CORBA::ORB_ptr ORB , const char * aDataFlowName , int * Graph_prof_debug , ofstream * Graph_fdebug ) : - GraphBase::PortsOfNode::PortsOfNode( aDataFlowName ) { +// GraphBase::PortsOfNode::PortsOfNode( aDataFlowName ) { + GraphBase::StreamNode::StreamNode( aDataFlowName ) { - MESSAGE( "GraphBase::ComputingNode::ComputingNode( " << aDataFlowName << " Graph_fdebug " << Graph_fdebug ) ; - InitFields( _Kind , +// MESSAGE( "GraphBase::ComputingNode::ComputingNode " << aDataFlowName << " Graph_prof_debug " << Graph_prof_debug ) ; + InitFields( //_Kind , _FirstCreation , _LastModification , _EditorRelease , @@ -104,26 +106,20 @@ GraphBase::ComputingNode::ComputingNode( CORBA::ORB_ptr ORB , _Comment , _HeadNode , _GeneratedName , - _DataStreamInPortsNumber , - _DataStreamOutPortsNumber , + //_DataStreamInPortsNumber , + //_DataStreamOutPortsNumber , _ConnectedInPortsNumber , _DecrConnectedInPortsNumber , - _LinkedNodesSize , + //_LinkedNodesSize , _SubGraphNumber ) ; + Kind( SUPERV::DataFlowGraph ) ; _ORB = CORBA::ORB::_duplicate( ORB ) ; _NamingService = ptrNamingService ; _Node = SUPERV::CNode::_nil() ; _InNode = NULL ; _ThreadNo = pthread_self() ; - if ( aDataFlowName != NULLSTRING && strlen( aDataFlowName ) ) { - _Name = new char[ strlen( aDataFlowName )+1 ] ; - strcpy( _Name , aDataFlowName ) ; - } - else { - _Name = NULLSTRING ; - } if ( Graph_prof_debug ) { // MESSAGE( "GraphBase::ComputingNode::ComputingNode --> SetDebug" ) ; // cout << "GraphBase::ComputingNode::ComputingNode --> SetDebug" << endl ; @@ -135,8 +131,7 @@ GraphBase::ComputingNode::ComputingNode( CORBA::ORB_ptr ORB , // cout << "GraphBase::ComputingNode::ComputingNode NO SetDebug" << endl ; // } cdebug << "GraphBase::ComputingNode::ComputingNode " << this - << "' _Name " - << (void *) _Name << " '" << _Name << " " << _FirstCreation + << " Name '" << Name() << "' " << _FirstCreation << " " << _LastModification << endl ; } @@ -155,7 +150,8 @@ GraphBase::ComputingNode::ComputingNode( CORBA::ORB_ptr ORB , const long Y , int * Graph_prof_debug , ofstream * Graph_fdebug ) : - GraphBase::PortsOfNode::PortsOfNode() { +// GraphBase::PortsOfNode::PortsOfNode() { + GraphBase::StreamNode::StreamNode( NodeName ) { _ORB = CORBA::ORB::_duplicate( ORB ) ; _NamingService = ptrNamingService ; @@ -163,7 +159,8 @@ GraphBase::ComputingNode::ComputingNode( CORBA::ORB_ptr ORB , _InNode = NULL ; _ThreadNo = pthread_self() ; - _Kind = akind ; + Kind( akind ) ; +// _Kind = akind ; time_t T = time(NULL); struct tm * Tm = localtime(&T); @@ -204,43 +201,35 @@ GraphBase::ComputingNode::ComputingNode( CORBA::ORB_ptr ORB , _HeadNode = false ; _GeneratedName = GeneratedName ; - const char *aNodeName = NodeName ; - _Name = new char[strlen(aNodeName)+1]; - strcpy(_Name , aNodeName); +// const char *aNodeName = NodeName ; +// _Name = new char[strlen(aNodeName)+1]; +// strcpy(_Name , aNodeName); - _DataStreamInPortsNumber = 0 ; - _DataStreamOutPortsNumber = 0 ; +// _DataStreamInPortsNumber = 0 ; +// _DataStreamOutPortsNumber = 0 ; _ConnectedInPortsNumber = 0 ; _DecrConnectedInPortsNumber = 0 ; - _LinkedNodesSize = 0 ; +// _LinkedNodesSize = 0 ; _X = X ; _Y = Y ; -// MESSAGE( "GraphBase::ComputingNode::ComputingNode --> SetDebug " << Graph_prof_debug << " Graph_fdebug " -// << Graph_fdebug ) ; -// cout << "GraphBase::ComputingNode::ComputingNode --> SetDebug " << Graph_prof_debug << " Graph_fdebug " -// << Graph_fdebug << endl ; _Graph_prof_debug = Graph_prof_debug ; _Graph_fdebug = Graph_fdebug ; +// MESSAGE( "GraphBase::ComputingNode::ComputingNode " << NodeName +// << " _Graph_prof_debug " << _Graph_prof_debug ) ; SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ; -// MESSAGE( "GraphBase::ComputingNode::ComputingNode SetDebug Done " << Graph_prof_debug << " Graph_fdebug " -// << Graph_fdebug << " aService.ServiceName " << aService.ServiceName ) ; -// cout << "GraphBase::ComputingNode::ComputingNode SetDebug Done " << Graph_prof_debug << " Graph_fdebug " -// << Graph_fdebug << endl ; -// cout << "GraphBase::ComputingNode::ComputingNode(" << aService.ServiceName << "," << aNodeName << "," -// << akind << ")" << endl; - cdebug_in << "GraphBase::ComputingNode::ComputingNode(" << aService.ServiceName << "," << aNodeName << "," + cdebug_in << "GraphBase::ComputingNode::ComputingNode(" << aService.ServiceName << "," << NodeName << "," << akind << ")" << endl; DefPortsOfNode( ORB , aService , NamePtr() , Kind() , Graph_prof_debug , Graph_fdebug ) ; cdebug << "GraphBase::ComputingNode::ComputingNode " << this - << " _Name " << (void *) _Name << " '" << _Name - << " KindOfNode " << _Kind - << " ServiceName " << ServiceName() << " In(" << ServiceInParameter().length() + << " Name '" << Name() + << "' KindOfNode " << Kind() + << " ServiceName '" << ServiceName() << "' In(" << ServiceInParameter().length() << ") Out(" << ServiceOutParameter().length() << ")" << endl ; cdebug_out << "GraphBase::ComputingNode::ComputingNode" << endl; @@ -248,36 +237,25 @@ GraphBase::ComputingNode::ComputingNode( CORBA::ORB_ptr ORB , GraphBase::ComputingNode::~ComputingNode() { cdebug << "GraphBase::ComputingNode::~ComputingNode " << this - << " _Name " - << (void *) _Name << " " << _Name << " _Comment " + << " Name() "<< Name() << " _Comment " << (void *) _Comment << " " << _Comment << " " << endl ; -// if ( _ComponentName != NULLSTRING ) -// delete [] _ComponentName ; -// delete [] _Name ; -// delete [] _EditorRelease ; -// if ( _Author != NULLSTRING ) -// delete [] _Author ; -// if ( _Computer != FACTORYSERVER ) -// delete [] _Computer; -// if ( _Comment != NULLSTRING ) -// delete [] _Comment; } -bool GraphBase::ComputingNode::Name( const char * aName) { - cdebug_in << "GraphBase::ComputingNode::Name " << _Name << endl; - if ( _Name ) { - cdebug << "GraphBase::ComputingNode::ReName " << _Name << " --> " << aName << endl ; - delete [] _Name ; - } - _Name = new char[strlen(aName)+1] ; - strcpy( _Name , aName ) ; - cdebug_out << "GraphBase::ComputingNode::Name " << _Name << endl; - return true ; -} +//->StreamNode bool GraphBase::ComputingNode::Name( const char * aName) { +//->StreamNode cdebug_in << "GraphBase::ComputingNode::Name " << _Name << endl; +//->StreamNode if ( _Name ) { +//->StreamNode cdebug << "GraphBase::ComputingNode::ReName " << _Name << " --> " << aName << endl ; +//->StreamNode delete [] _Name ; +//->StreamNode } +//->StreamNode _Name = new char[strlen(aName)+1] ; +//->StreamNode strcpy( _Name , aName ) ; +//->StreamNode cdebug_out << "GraphBase::ComputingNode::Name " << _Name << endl; +//->StreamNode return true ; +//->StreamNode } SUPERV::SDate GraphBase::ComputingNode::FirstCreation () const { // cdebug << "GraphBase::ComputingNode::FirstCreation " -// << "' _Name " << _Name << " " << _FirstCreation << " " +// << " Name '" << Name() << "' " << _FirstCreation << " " // << _LastModification << endl ; return _FirstCreation; } @@ -286,11 +264,6 @@ SUPERV::SDate GraphBase::ComputingNode::LastModification () const { return _LastModification ; } -bool GraphBase::ComputingNode::Kind(const SUPERV::KindOfNode aKind) { - _Kind = aKind ; - return true ; -} - void GraphBase::ComputingNode::FirstCreation(const SUPERV::SDate aDate ) { _FirstCreation = aDate ; } @@ -390,6 +363,15 @@ GraphBase::SNode * GraphBase::ComputingNode::GetInfo() { // Info->theInterfaceName = InterfaceName() ; Info->theName = Name() ; Info->theKind = Kind() ; + if ( IsDataStreamNode() ) { + long Timeout ; + SUPERV::KindOfDataStreamTrace DataStreamTrace ; + double DeltaTime ; + ((GraphBase::StreamGraph * ) this)->StreamParams( Timeout , DataStreamTrace , DeltaTime ) ; + Info->theTimeout = Timeout ; + Info->theDataStreamTrace = DataStreamTrace ; + Info->theDeltaTime = DeltaTime ; + } Info->theService = *GetService() ; // Info->theListOfParameters = *GetListOfParameters() ; Info->theFirstCreation = FirstCreation() ; @@ -405,103 +387,78 @@ GraphBase::SNode * GraphBase::ComputingNode::GetInfo() { } void GraphBase::ComputingNode::DelInPort( const char * InputParameterName ) { - if ( GetChangeInPort( InputParameterName )->IsDataStream() ) { - _DataStreamInPortsNumber-- ; - } GraphBase::PortsOfNode::DelInPort( InputParameterName ) ; } void GraphBase::ComputingNode::DelOutPort( const char * OutputParameterName ) { - if ( GetChangeOutPort( OutputParameterName )->IsDataStream() ) { - _DataStreamOutPortsNumber-- ; - } GraphBase::PortsOfNode::DelOutPort( OutputParameterName ) ; } GraphBase::InPort * GraphBase::ComputingNode::AddInPort( const char * InputParameterName , - const char * InputParameterType ) { + const char * InputParameterType , + const SUPERV::KindOfPort aKindOfPort ) { + cdebug << "AddInPort " << Name() << " ConnectedInPortsNumber " << ConnectedInPortsNumber() << endl ; return GraphBase::PortsOfNode::AddInPort( _ORB , NamePtr() , Kind() , InputParameterName , InputParameterType , + aKindOfPort , +// DataStreamInPortsNumber() , _Graph_prof_debug , _Graph_fdebug ) ; } GraphBase::OutPort * GraphBase::ComputingNode::AddOutPort( const char * OutputParameterName , - const char * OutputParameterType ) { + const char * OutputParameterType , + const SUPERV::KindOfPort aKindOfPort ) { + cdebug << "AddOutPort " << Name() << " ConnectedInPortsNumber " << ConnectedInPortsNumber() << endl ; return GraphBase::PortsOfNode::AddOutPort( _ORB , NamePtr() , Kind() , OutputParameterName , OutputParameterType , + aKindOfPort , +// DataStreamOutPortsNumber() , _Graph_prof_debug , _Graph_fdebug ) ; } -void GraphBase::ComputingNode::AddLink( GraphBase::ComputingNode * ToNode ) { - int index = GetLinkedNodeIndex( ToNode->Name() ) ; - if ( index < 0 ) { - cdebug << Name() << "->GraphBase::ComputingNode::AddLinkedNode( " << ToNode->Name() - << " ) new LinkedNode " << endl ; - _LinkedNodes.resize( _LinkedNodesSize+1 ) ; - _LinkedInPortsNumber.resize( _LinkedNodesSize+1 ) ; - _LinkedNodes[ _LinkedNodesSize ] = ToNode ; - _LinkedInPortsNumber[ _LinkedNodesSize ] = 1 ; - SetLinkedNodeIndex( ToNode->Name() , _LinkedNodesSize ) ; - index = _LinkedNodesSize ; - _LinkedNodesSize++ ; - } - else { - cdebug << Name() << "->GraphBase::ComputingNode::AddLinkedNode( " << ToNode->Name() - << " ) old LinkedNode " << _LinkedNodes[index ]->Name() << endl ; - _LinkedInPortsNumber[ index ] += 1 ; - } - cdebug << Name() << "->GraphBase::ComputingNode::AddLinkedNode( " << ToNode->Name() - << " ) LinkedNodesSize " << _LinkedNodesSize << " [ " << index - << " ] _LinkedInPortsNumber " << _LinkedInPortsNumber[ index ] - << " ConnectedInPortsNumber " << ToNode->ConnectedInPortsNumber() - << " + 1 Service " << ServiceName() << endl ; - ToNode->IncrConnectedInPortsNumber() ; +void GraphBase::ComputingNode::DelInDataStreamPort( const char * InputParameterName ) { + GraphBase::PortsOfNode::DelInPort( InputParameterName ) ; } - -void GraphBase::ComputingNode::RemoveLink( GraphBase::ComputingNode * ToNode ) { - int index = GetLinkedNodeIndex( ToNode->Name() ) ; - if ( index >= 0 ) { - cdebug << "GraphBase::ComputingNode::RemoveLink( to " << ToNode->Name() << " from " - << Name() << " index : " << index << " ConnectedInPortsNumber " - << ToNode->ConnectedInPortsNumber() - 1 << " LinkedInPortsNumber " - << _LinkedInPortsNumber[ index ] << " - 1" << endl ; - ToNode->DecrConnectedInPortsNumber() ; - _LinkedInPortsNumber[ index ] -= 1 ; - if ( _LinkedInPortsNumber[ index ] == 0 ) { - _LinkedNodesSize-- ; - cdebug << "GraphBase::ComputingNode::RemoveLink new LinkedNodesSize " - << _LinkedNodesSize << " " << ToNode->Name() << " removed from " - << " linkednodes of " << Name() << endl ; - int i ; - for ( i = index ; i < _LinkedNodesSize ; i++ ) { - _LinkedNodes[ i ] = _LinkedNodes[ i+1 ] ; - _LinkedInPortsNumber[ i ] = _LinkedInPortsNumber[ i+1 ] ; - SetLinkedNodeIndex( _LinkedNodes[ i ]->Name() , i ) ; - } - DelLinkedNodeIndex( ToNode->Name() ) ; - _LinkedNodes.resize( _LinkedNodesSize+1 ) ; - _LinkedInPortsNumber.resize( _LinkedNodesSize+1 ) ; - } - } - else { - cdebug << " Error index " << index << endl ; - } +void GraphBase::ComputingNode::DelOutDataStreamPort( const char * OutputParameterName ) { + GraphBase::PortsOfNode::DelOutPort( OutputParameterName ) ; } -void GraphBase::ComputingNode::ReNameLink( const char* OldNodeName , - const char* NewNodeName ) { - cdebug_in << "GraphBase::ComputingNode::ReNameLink (" << OldNodeName << " , " - << NewNodeName << ")" << endl; - int index = GetLinkedNodeIndex( OldNodeName ) ; - if ( index >= 0 ) { - _MapOfLinkedNodes.erase( OldNodeName ) ; - SetLinkedNodeIndex( NewNodeName , index ) ; - } - cdebug_out << "GraphBase::ComputingNode::ReNameLink" << endl ; +GraphBase::InDataStreamPort * GraphBase::ComputingNode::AddInDataStreamPort( const char * InputParameterName , + const SALOME_ModuleCatalog::DataStreamType InputParameterType , + const SALOME_ModuleCatalog::DataStreamDependency aDependency , + const SUPERV::KindOfPort aKindOfPort ) { +// IncrDataStreamInPorts() ; + GraphBase::InDataStreamPort * aDataStreamPort ; + aDataStreamPort = (GraphBase::InDataStreamPort * ) GraphBase::PortsOfNode::AddInPort( _ORB , NamePtr() , + Kind() , + InputParameterName , + DataStreamTypeToString( InputParameterType ).c_str() , + aKindOfPort , +// DataStreamInPortsNumber() , + _Graph_prof_debug , _Graph_fdebug ) ; + aDataStreamPort->Dependency( aDependency ) ; + return aDataStreamPort ; +} +GraphBase::OutDataStreamPort * GraphBase::ComputingNode::AddOutDataStreamPort( const char * OutputParameterName , + const SALOME_ModuleCatalog::DataStreamType OutputParameterType , + const SALOME_ModuleCatalog::DataStreamDependency aDependency , + const SUPERV::KindOfPort aKindOfPort ) { +// IncrDataStreamOutPorts() ; + GraphBase::OutDataStreamPort * aDataStreamPort ; + aDataStreamPort = (GraphBase::OutDataStreamPort * ) GraphBase::PortsOfNode::AddOutPort( _ORB , NamePtr() , + Kind() , + OutputParameterName , + DataStreamTypeToString( OutputParameterType ).c_str() , + aKindOfPort , +// DataStreamOutPortsNumber() , + _Graph_prof_debug , _Graph_fdebug ) ; + aDataStreamPort->Dependency( aDependency ) ; + return aDataStreamPort ; } + #include #include #include @@ -591,11 +548,44 @@ bool GraphBase::ComputingNode::SaveXML( QDomDocument & Graph , QDomElement & inf // f << Tabs << "" << (int ) Kind() << "" << endl ; QDomElement kind = Graph.createElement( "kind" ) ; QString aKind ; - aKind = aKind.setNum( Kind() ) ; + if ( IsDataFlowNode() || ( IsDataStreamNode() && HasDataStream() == 0 ) ) { + aKind = aKind.setNum( SUPERV::DataFlowGraph ) ; + } + else { + aKind = aKind.setNum( Kind() ) ; + } aField = Graph.createTextNode( aKind ) ; node.appendChild( kind ) ; kind.appendChild( aField ) ; + if ( IsDataStreamNode() ) { + long Timeout ; + SUPERV::KindOfDataStreamTrace DataStreamTrace ; + double DeltaTime ; + ((GraphBase::StreamGraph * ) this)->StreamParams( Timeout , DataStreamTrace , DeltaTime ) ; + + QDomElement timeout = Graph.createElement("streamgraph-timeout") ; + QString aTimeout ; + aTimeout = aTimeout.setNum( Timeout ) ; + aField = Graph.createTextNode( aTimeout ) ; + node.appendChild( timeout ) ; + timeout.appendChild( aField ) ; + + QDomElement datastreamtrace = Graph.createElement("streamgraph-datastreamtrace") ; + QString aDataStreamTrace ; + aDataStreamTrace = aDataStreamTrace.setNum( DataStreamTrace ) ; + aField = Graph.createTextNode( aDataStreamTrace ) ; + node.appendChild( datastreamtrace ) ; + datastreamtrace.appendChild( aField ) ; + + QDomElement deltatime = Graph.createElement("streamgraph-deltatime") ; + QString aDeltaTime ; + aDeltaTime = aDeltaTime.setNum( DeltaTime ) ; + aField = Graph.createTextNode( aDeltaTime ) ; + node.appendChild( deltatime ) ; + deltatime.appendChild( aField ) ; + } + QDomElement couplednode = Graph.createElement("coupled-node") ; if ( IsGOTONode() || IsLoopNode() || IsEndLoopNode() || IsSwitchNode() || IsEndSwitchNode() ) { @@ -690,60 +680,108 @@ bool GraphBase::ComputingNode::SaveXML( QDomDocument & Graph , QDomElement & inf QDomElement DataStreamlist = Graph.createElement("DataStream-list") ; node.appendChild( DataStreamlist ) ; - for ( i = 0 ; i < ServiceInParameter().length() ; i++ ) { + for ( i = 0 ; i < (unsigned int ) GetNodeInPortsSize() ; i++ ) { const GraphBase::InPort * anInPort ; - anInPort = aNode->GetInPort( ServiceInParameter()[i].Parametername ) ; + anInPort = aNode->GetNodeInPort( i ) ; if ( anInPort->IsDataStream() ) { - cdebug << "SaveXML " << ServiceInParameter()[i].Parametername + cdebug << "SaveXML " << i << " " << Name() << " " << anInPort->PortName() << " " << anInPort->PortType() << " InDataStreamPort " << anInPort->Kind() << endl ; QDomElement inParameter = Graph.createElement("inParameter") ; DataStreamlist.appendChild(inParameter) ; QDomElement inParametertype = Graph.createElement("inParameter-type") ; - if ( strlen( ServiceInParameter()[i].Parametertype ) ) { - aField = Graph.createTextNode( strdup( ServiceInParameter()[i].Parametertype ) ) ; - } - else { - aField = Graph.createTextNode( "?" ) ; - } + QString aType ; + aType = aType.setNum( StringToDataStreamType( anInPort->PortType() ) ) ; + cdebug << "SaveXML " << anInPort->PortType() << " --> " << StringToDataStreamType( anInPort->PortType() ) + << " " << aType << endl ; + aField = Graph.createTextNode( aType ) ; inParameter.appendChild(inParametertype) ; inParametertype.appendChild( aField ) ; QDomElement inParametername = Graph.createElement("inParameter-name") ; - if ( strlen( ServiceInParameter()[i].Parametername ) ) { - aField = Graph.createTextNode( strdup(ServiceInParameter()[i].Parametername) ) ; + if ( strlen( anInPort->PortName() ) ) { + aField = Graph.createTextNode( strdup(anInPort->PortName()) ) ; } else { aField = Graph.createTextNode( "?" ) ; } inParameter.appendChild(inParametername) ; inParametername.appendChild( aField ) ; + cdebug << "SaveXML " << anInPort->PortName() << endl ; + QDomElement inParameterdependency = Graph.createElement("inParameter-dependency") ; + QString aDependency ; + aDependency = aDependency.setNum( anInPort->Dependency() ) ; + aField = Graph.createTextNode( aDependency ) ; + inParameter.appendChild(inParameterdependency) ; + inParameterdependency.appendChild( aField ) ; + cdebug << "SaveXML Dependency " << anInPort->Dependency() << endl ; + SUPERV::KindOfSchema aKindOfSchema ; + SUPERV::KindOfInterpolation aKindOfInterpolation ; + SUPERV::KindOfExtrapolation aKindOfExtrapolation ; + ((GraphBase::InDataStreamPort * ) anInPort)->Params( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ; + QDomElement inParameterKindOfSchema = Graph.createElement("inParameter-schema") ; + QString aSchema ; + aSchema = aSchema.setNum( aKindOfSchema ) ; + aField = Graph.createTextNode( aSchema ) ; + inParameter.appendChild(inParameterKindOfSchema) ; + inParameterKindOfSchema.appendChild( aField ) ; + cdebug << "SaveXML aKindOfSchema " << aKindOfSchema << endl ; + QDomElement inParameterKindOfInterpolation = Graph.createElement("inParameter-interpolation") ; + QString anInterpolation ; + anInterpolation = anInterpolation.setNum( aKindOfInterpolation ) ; + aField = Graph.createTextNode( anInterpolation ) ; + inParameter.appendChild(inParameterKindOfInterpolation) ; + inParameterKindOfInterpolation.appendChild( aField ) ; + cdebug << "SaveXML aKindOfInterpolation " << aKindOfInterpolation << endl ; + QDomElement inParameterKindOfExtrapolation = Graph.createElement("inParameter-extrapolation") ; + QString anExtrapolation ; + anExtrapolation = anExtrapolation.setNum( aKindOfExtrapolation ) ; + aField = Graph.createTextNode( anExtrapolation ) ; + inParameter.appendChild(inParameterKindOfExtrapolation) ; + inParameterKindOfExtrapolation.appendChild( aField ) ; + cdebug << "SaveXML aKindOfExtrapolation " << aKindOfExtrapolation << endl ; } } - for ( i = 0 ; i < ServiceOutParameter().length() ; i++ ) { + for ( i = 0 ; i < (unsigned int ) GetNodeOutPortsSize() ; i++ ) { const GraphBase::OutPort * anOutPort ; - anOutPort = aNode->GetOutPort( ServiceOutParameter()[i].Parametername ) ; + anOutPort = aNode->GetNodeOutPort( i ) ; if ( anOutPort->IsDataStream() ) { - cdebug << "SaveXML " << ServiceOutParameter()[i].Parametername + cdebug << "SaveXML " << i << " " << Name() << " " << anOutPort->PortName() << " " << anOutPort->PortType() << " OutDataStreamPort " << anOutPort->Kind() << endl ; QDomElement outParameter = Graph.createElement("outParameter") ; DataStreamlist.appendChild(outParameter) ; QDomElement outParametertype = Graph.createElement("outParameter-type") ; - if ( strlen( ServiceOutParameter()[i].Parametertype ) ) { - aField = Graph.createTextNode( strdup(ServiceOutParameter()[i].Parametertype) ) ; - } - else { - aField = Graph.createTextNode( "?" ) ; - } + QString aType ; + aType = aType.setNum( StringToDataStreamType( anOutPort->PortType() ) ) ; + cdebug << "SaveXML " << anOutPort->PortType() << " --> " << StringToDataStreamType( anOutPort->PortType() ) + << " " << aType << endl ; + aField = Graph.createTextNode( aType ) ; outParameter.appendChild(outParametertype) ; outParametertype.appendChild( aField ) ; QDomElement outParametername = Graph.createElement("outParameter-name") ; - if ( strlen( ServiceOutParameter()[i].Parametername ) ) { - aField = Graph.createTextNode( strdup(ServiceOutParameter()[i].Parametername) ) ; + if ( strlen( anOutPort->PortName() ) ) { + aField = Graph.createTextNode( strdup(anOutPort->PortName() ) ) ; } else { aField = Graph.createTextNode( "?" ) ; } outParameter.appendChild(outParametername) ; outParametername.appendChild( aField ) ; + cdebug << "SaveXML " << anOutPort->PortName() << endl ; + QDomElement outParameterdependency = Graph.createElement("outParameter-dependency") ; + QString aDependency ; + aDependency = aDependency.setNum( anOutPort->Dependency() ) ; + aField = Graph.createTextNode( aDependency ) ; + outParameter.appendChild(outParameterdependency) ; + outParameterdependency.appendChild( aField ) ; + cdebug << "SaveXML Dependency " << anOutPort->Dependency() << endl ; + long aNumberOfValues ; + aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ; + QDomElement outParameterNumberOfValues = Graph.createElement("outParameter-values") ; + QString aValues ; + aValues = aValues.setNum( aNumberOfValues ) ; + aField = Graph.createTextNode( aValues ) ; + outParameter.appendChild(outParameterNumberOfValues) ; + outParameterNumberOfValues.appendChild( aField ) ; + cdebug << "SaveXML NumberOfValues " << ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() << endl ; } } // f << Tabs << "" << endl ; @@ -876,9 +914,18 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName , const ListOfFuncName FuncNames , const ListOfPythonFunctions PythonFunctions , int XCoordinate , int YCoordinate ) const { - if ( IsDataFlowNode() ) { + if ( IsDataFlowNode() || ( IsDataStreamNode() && HasDataStream() == 0 ) ) { f << Name() << " = Graph( '" << Name() << "' )" << endl ; } + else if ( IsDataStreamNode() ) { + f << Name() << " = StreamGraph( '" << Name() << "' )" << endl ; + long Timeout ; + SUPERV::KindOfDataStreamTrace DataStreamTrace ; + double DeltaTime ; + ((GraphBase::StreamGraph * ) this)->StreamParams( Timeout , DataStreamTrace , DeltaTime ) ; + f << aGraphName << ".SetStreamParams( " << Timeout << " , SUPERV." << DataStreamTrace + << " , " << DeltaTime << " )" << endl ; + } else if ( IsComputingNode() ) { int i ; f << Name() << "_ServiceinParameter = []" << endl ; @@ -893,9 +940,26 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName , << ServiceOutParameter()[i].Parametertype << "' , '" << ServiceOutParameter()[i].Parametername << "' ) )" << endl ; } + f << Name() << "_ServiceinStreamParameter = []" << endl ; + for ( i = 0 ; i < (int ) ServiceInStreamParameter().length() ; i++ ) { + f << Name() << "_ServiceinStreamParameter.append( SALOME_ModuleCatalog.ServicesDataStreamParameter( SALOME_ModuleCatalog." + << ServiceInStreamParameter()[i].Parametertype << " , '" + << ServiceInStreamParameter()[i].Parametername << "' , SALOME_ModuleCatalog." + << ServiceInStreamParameter()[i].Parameterdependency << " ) )" << endl ; + } + f << Name() << "_ServiceoutStreamParameter = []" << endl ; + for ( i = 0 ; i < (int ) ServiceOutStreamParameter().length() ; i++ ) { + f << Name() << "_ServiceoutStreamParameter.append( SALOME_ModuleCatalog.ServicesDataStreamParameter( SALOME_ModuleCatalog." + << ServiceOutStreamParameter()[i].Parametertype << " , '" + << ServiceOutStreamParameter()[i].Parametername << "' , SALOME_ModuleCatalog." + << ServiceOutStreamParameter()[i].Parameterdependency << " ) )" << endl ; + } f << Name() << "_Service = SALOME_ModuleCatalog.Service( '" << ServiceName() - << "' , " << Name() << "_ServiceinParameter" << " , " - << Name() << "_ServiceoutParameter" << " , 0 )" << endl ; + << "' , " << Name() << "_ServiceinParameter" + << " , " << Name() << "_ServiceoutParameter" + << " , " << Name() << "_ServiceinStreamParameter" + << " , " << Name() << "_ServiceoutStreamParameter" + << " , 0 , 0 )" << endl ; f << Name() << " = " << aGraphName << ".CNode( " << Name() << "_Service" << " )" << endl ; } @@ -904,6 +968,9 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName , << "' , '" << InterfaceName << "' , '" << ServiceName() << "' )" << endl ; } + else if ( IsEndLoopNode() || IsEndSwitchNode() ) { +// It is done with LoopNode or SwitchNode with CoupledNode() + } else { f << "Py" << Name() << " = []" << endl ; int i ; @@ -935,6 +1002,7 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName , // strcat( EndName , Name() ) ; char * EndName = aCoupledNode->Name() ; if ( IsLoopNode() ) { + int i ; SUPERV::ListOfStrings aPyMore = *PythonFunctions[1] ; SUPERV::ListOfStrings aPyNext = *PythonFunctions[2] ; f << "PyMore" << Name() << " = []" << endl ; @@ -961,7 +1029,96 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName , f << "Py" << aCoupledNode->Name() << ".append( '" << aPyFunc[i] << "' )" << endl ; } - f << EndName << ".SetPyFunction( 'End" << FuncNames[0].c_str() << "' , Py" << aCoupledNode->Name() << " )" << endl ; + f << EndName << ".SetPyFunction( '" << aCoupledNode->PyFuncName() << "' , Py" << aCoupledNode->Name() << " )" << endl ; + for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) { + const GraphBase::InPort * anInPort = GetNodeInPort(i) ; + cdebug << "Node " << Name() << " InPort " << anInPort->PortName() + << " " << anInPort->Kind() << endl ; + if ( anInPort->IsLoop() ) { + f << "I" << Name() << anInPort->PortName() << " = " + << Name() << ".GetInPort( '" << anInPort->PortName() << "' )" << endl ; + } + else if ( anInPort->IsInLine() ) { + f << "I" << Name() << anInPort->PortName() << " = " + << Name() << ".InPort( '" << anInPort->PortName() << "' , '" + << anInPort->PortType() << "' )" << endl ; + } + else if ( anInPort->IsDataStream() ) { + f << "I" << Name() << anInPort->PortName() << " = " << Name() + << ".InStreamPort( '" << anInPort->PortName() + << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anInPort->PortType() ) + << " , SALOME_ModuleCatalog." << anInPort->Dependency() << " )" << endl ; + SUPERV::KindOfSchema aKindOfSchema ; + SUPERV::KindOfInterpolation aKindOfInterpolation ; + SUPERV::KindOfExtrapolation aKindOfExtrapolation ; + ((GraphBase::InDataStreamPort * ) anInPort)->Params( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ; + f << "I" << Name() << anInPort->PortName() << ".SetParams( SUPERV." << aKindOfSchema << " , SUPERV." + << aKindOfInterpolation << " , SUPERV." << aKindOfExtrapolation << " )" << endl ; + } + else if ( anInPort->IsGate() ) { + f << "I" << Name() << anInPort->PortName() << " = " + << Name() << ".GetInPort( '" << anInPort->PortName() << "' )" << endl ; + } + } + for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) { + const GraphBase::OutPort * anOutPort = GetNodeOutPort(i) ; + cdebug << "Node " << Name() << " OutPort " << anOutPort->PortName() + << " " << anOutPort->Kind() << endl ; + if ( anOutPort->IsInLine() || anOutPort->IsLoop() ) { + f << "O" << Name() << anOutPort->PortName() << " = " + << Name() << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ; + } + else if ( anOutPort->IsDataStream() ) { + f << "O" << Name() << anOutPort->PortName() << " = " << Name() + << ".OutStreamPort( '" << anOutPort->PortName() + << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anOutPort->PortType() ) + << " , SALOME_ModuleCatalog." << anOutPort->Dependency() << " )" << endl ; + long aNumberOfValues ; + aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ; + f << "O" << Name() << anOutPort->PortName() << ".SetNumberOfValues( " << aNumberOfValues << " )" + << endl ; + } + } + for ( i = 0 ; i < aCoupledNode->GetNodeInPortsSize() ; i++ ) { + const GraphBase::InPort * anInPort = aCoupledNode->GetNodeInPort(i) ; + cdebug << "Node " << aCoupledNode->Name() << " InPort " << anInPort->PortName() + << " " << anInPort->Kind() << endl ; + if ( anInPort->IsInLine() || anInPort->IsLoop() || anInPort->IsGate() ) { + f << "I" << EndName << anInPort->PortName() << " = " << EndName + << ".GetInPort( '" << anInPort->PortName() << "' )" << endl ; + } + else if ( anInPort->IsDataStream() ) { + f << "I" << EndName << anInPort->PortName() << " = " << EndName + << ".InStreamPort( '" << anInPort->PortName() + << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anInPort->PortType() ) + << " , SALOME_ModuleCatalog." << anInPort->Dependency() << " )" << endl ; + SUPERV::KindOfSchema aKindOfSchema ; + SUPERV::KindOfInterpolation aKindOfInterpolation ; + SUPERV::KindOfExtrapolation aKindOfExtrapolation ; + ((GraphBase::InDataStreamPort * ) anInPort)->Params( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ; + f << "I" << EndName << anInPort->PortName() << ".SetParams( SUPERV." << aKindOfSchema << " , SUPERV." + << aKindOfInterpolation << " , SUPERV." << aKindOfExtrapolation << " )" << endl ; + } + } + for ( i = 0 ; i < aCoupledNode->GetNodeOutPortsSize() ; i++ ) { + const GraphBase::OutPort * anOutPort = aCoupledNode->GetNodeOutPort(i) ; + cdebug << "Node " << aCoupledNode->Name() << " OutPort " << anOutPort->PortName() + << " " << anOutPort->Kind() << endl ; + if ( anOutPort->IsInLine() || anOutPort->IsLoop() || anOutPort->IsGate() ) { + f << "O" << EndName << anOutPort->PortName() << " = " << EndName + << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ; + } + else if ( anOutPort->IsDataStream() ) { + f << "O" << EndName << anOutPort->PortName() << " = " << EndName + << ".OutStreamPort( '" << anOutPort->PortName() + << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anOutPort->PortType() ) + << " , SALOME_ModuleCatalog." << anOutPort->Dependency() << " )" << endl ; + long aNumberOfValues ; + aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ; + f << "O" << EndName << anOutPort->PortName() << ".SetNumberOfValues( " << aNumberOfValues << " )" + << endl ; + } + } } else if ( IsSwitchNode() ) { f << Name() << "," << EndName << " = " << aGraphName << ".SNode( '" @@ -977,91 +1134,176 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName , f << "Py" << aCoupledNode->Name() << ".append( '" << aPyFunc[i] << "' )" << endl ; } - f << EndName << ".SetPyFunction( 'End" << FuncNames[0].c_str() << "' , Py" << aCoupledNode->Name() << " )" << endl ; + f << EndName << ".SetPyFunction( '" << aCoupledNode->PyFuncName() << "' , Py" << aCoupledNode->Name() << " )" << endl ; for ( i = 0 ; i < aCoupledNode->GetNodeInPortsSize() ; i++ ) { const GraphBase::InPort * anInPort = aCoupledNode->GetNodeInPort(i) ; - if ( anInPort->IsInLine() || anInPort->IsEndSwitch() ) { - f << EndName << ".InPort( '" << anInPort->PortName() + cdebug << "Node " << aCoupledNode->Name() << " InPort " << anInPort->PortName() + << " " << anInPort->Kind() << endl ; +// if ( anInPort->IsGate() || anInPort->IsEndSwitch() ) { + if ( anInPort->IsGate() ) { + f << "I" << EndName << anInPort->PortName() << " = " << EndName + << ".GetInPort( '" << anInPort->PortName() << "' )" << endl ; + } + else if ( anInPort->IsInLine() ) { + f << "I" << EndName << anInPort->PortName() << " = " << EndName + << ".InPort( '" << anInPort->PortName() << "' , '" << anInPort->PortType() << "' )" << endl ; } + else if ( anInPort->IsDataStream() ) { + f << "I" << EndName << anInPort->PortName() << " = " << EndName + << ".InStreamPort( '" << anInPort->PortName() + << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anInPort->PortType() ) + << " , SALOME_ModuleCatalog." << anInPort->Dependency() << " )" << endl ; + SUPERV::KindOfSchema aKindOfSchema ; + SUPERV::KindOfInterpolation aKindOfInterpolation ; + SUPERV::KindOfExtrapolation aKindOfExtrapolation ; + ((GraphBase::InDataStreamPort * ) anInPort)->Params( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ; + f << "I" << EndName << anInPort->PortName() << ".SetParams( SUPERV." << aKindOfSchema << " , SUPERV." + << aKindOfInterpolation << " , SUPERV." << aKindOfExtrapolation << " )" << endl ; + } } for ( i = 0 ; i < aCoupledNode->GetNodeOutPortsSize() ; i++ ) { const GraphBase::OutPort * anOutPort = aCoupledNode->GetNodeOutPort(i) ; - if ( anOutPort->IsInLine() ) { - f << EndName << ".OutPort( '" << anOutPort->PortName() + cdebug << "Node " << aCoupledNode->Name() << " OutPort " << anOutPort->PortName() + << " " << anOutPort->Kind() << endl ; +// if ( anOutPort->IsGate() || anOutPort->IsEndSwitch() ) { + if ( anOutPort->IsGate() ) { + f << "O" << EndName << anOutPort->PortName() << " = " << EndName + << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ; + } + else if ( anOutPort->IsInLine() ) { + f << "O" << EndName << anOutPort->PortName() << " = " << EndName + << ".OutPort( '" << anOutPort->PortName() << "' , '" << anOutPort->PortType() << "' )" << endl ; } + else if ( anOutPort->IsDataStream() ) { + f << "O" << EndName << anOutPort->PortName() << " = " << EndName + << ".OutStreamPort( '" << anOutPort->PortName() + << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anOutPort->PortType() ) + << " , SALOME_ModuleCatalog." << anOutPort->Dependency() << " )" << endl ; + long aNumberOfValues ; + aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ; + f << "O" << EndName << anOutPort->PortName() << ".SetNumberOfValues( " << aNumberOfValues << " )" + << endl ; + } } } delete [] EndName ; } } - f << Name() << ".SetName( '" << Name() << "' )" << endl ; - f << Name() << ".SetAuthor( '" << Author() << "' )" << endl ; - if ( IsFactoryNode() ) { - f << Name() << ".SetContainer( '" << Computer << "' )" << endl ; + if ( IsEndLoopNode() || IsEndSwitchNode() ) { +// It is done with LoopNode or SwitchNode with CoupledNode() } - f << Name() << ".SetComment( '" << Comment() << "' )" << endl ; - f << Name() << ".Coords( " << XCoordinate << " , " << YCoordinate << " )" << endl ; + else { + f << Name() << ".SetName( '" << Name() << "' )" << endl ; + f << Name() << ".SetAuthor( '" << Author() << "' )" << endl ; + if ( IsFactoryNode() ) { + f << Name() << ".SetContainer( '" << Computer << "' )" << endl ; + } + f << Name() << ".SetComment( '" << Comment() << "' )" << endl ; + f << Name() << ".Coords( " << XCoordinate << " , " << YCoordinate << " )" << endl ; - if ( IsOneOfInLineNodes() ) { - int i ; - for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) { - const GraphBase::InPort * anInPort = GetNodeInPort(i) ; - if ( anInPort->IsInLine() ) { - f << Name() << ".InPort( '" << anInPort->PortName() << "' , '" - << anInPort->PortType() << "' )" << endl ; + if ( IsComputingNode() || IsFactoryNode() ) { + int i ; + for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) { + const GraphBase::InPort * anInPort = GetNodeInPort(i) ; + if ( !anInPort->IsDataStream() ) { + cdebug << "Node " << Name() << " InPort " << anInPort->PortName() + << " " << anInPort->Kind() << endl ; + f << "I" << Name() << anInPort->PortName() << " = " + << Name() << ".GetInPort( '" << anInPort->PortName() << "' )" << endl ; + } } - } -// for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) { -// const GraphBase::OutPort * anOutPort = GetNodeOutPort(i) ; -// if ( anOutPort->IsInLine() || anOutPort->IsSwitch() ) { -// f << Name() << ".OutPort( '" << anOutPort->PortName() -// << "' , '" << anOutPort->PortType() << "' )" << endl ; -// } -// } - } - if ( !IsDataFlowNode() ) { - int i ; - for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) { - const GraphBase::InPort * anInPort = GetNodeInPort(i) ; - if ( anInPort->IsDataStream() ) { - f << Name() << ".InDataStreamPort( '" << anInPort->PortName() << "' , '" - << anInPort->PortType() << "' )" << endl ; + for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) { + const GraphBase::OutPort * anOutPort = GetNodeOutPort(i) ; + if ( !anOutPort->IsDataStream() ) { + cdebug << "Node " << Name() << " OutPort " << anOutPort->PortName() + << " " << anOutPort->Kind() << endl ; + f << "O" << Name() << anOutPort->PortName() << " = " + << Name() << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ; + } } } - for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) { - const GraphBase::OutPort * anOutPort = GetNodeOutPort(i) ; - if ( anOutPort->IsDataStream() ) { - f << Name() << ".OutDataStreamPort( '" << anOutPort->PortName() - << "' , '" << anOutPort->PortType() << "' )" << endl ; + else if ( IsOneOfInLineNodes() && !IsLoopNode() ) { + int i ; + for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) { + const GraphBase::InPort * anInPort = GetNodeInPort(i) ; + cdebug << "Node " << Name() << " InPort " << anInPort->PortName() + << " " << anInPort->Kind() << endl ; + if ( anInPort->IsInLine() ) { + f << "I" << Name() << anInPort->PortName() << " = " + << Name() << ".InPort( '" << anInPort->PortName() << "' , '" + << anInPort->PortType() << "' )" << endl ; + } + else if ( anInPort->IsGate() ) { + f << "I" << Name() << anInPort->PortName() << " = " + << Name() << ".GetInPort( '" << anInPort->PortName() << "' )" << endl ; + } + } + for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) { + const GraphBase::OutPort * anOutPort = GetNodeOutPort(i) ; + cdebug << "Node " << Name() << " OutPort " << anOutPort->PortName() + << " " << anOutPort->Kind() << endl ; + if ( anOutPort->IsInLine() ) { + f << "O" << Name() << anOutPort->PortName() << " = " + << Name() << ".OutPort( '" << anOutPort->PortName() + << "' , '" << anOutPort->PortType() << "' )" << endl ; + } + else if ( anOutPort->IsGate() ) { + f << "O" << Name() << anOutPort->PortName() << " = " + << Name() << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ; + } } } - } - -#if 0 - if ( IsLoopNode() || IsSwitchNode() ) { - f << EndName << ".SetName( '" << CoupledNode - << "' )" << endl ; - f << EndName << ".SetAuthor( '" << CoupledNode->Author() - << "' )" << endl ; - f << EndName << ".SetComment( '" << CoupledNode->Comment() - << "' )" << endl ; - f << EndName << ".Coords( " << CoupledNode->XCoordinate() << " , " - << CoupledNode->YCoordinate() << " )" << endl ; - unsigned int i; - for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) { - const InPort * anInPort = GetNodeInPort( i ) ; - if ( anInPort->IsBus() ) { - const OutPort * anOutPort = GetNodeOutPort( anInPort->PortIndex() ) ; - f << Name() << ".BusPorts( '" << anInPort->PortName() << "' , '" - << anInPort->PortType() << "' , '" << anOutPort->PortName() - << "' , '" << anOutPort->PortType() << "' )" << endl ; + if ( !IsDataFlowNode() && !IsDataStreamNode() ) { + int i ; + for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) { + const GraphBase::InPort * anInPort = GetNodeInPort(i) ; + cdebug << "Node " << Name() << " InPort " << anInPort->PortName() + << " " << anInPort->Kind() << endl ; + if ( anInPort->IsDataStream() ) { + if ( IsOneOfInLineNodes() ) { + f << "I" << Name() << anInPort->PortName() << " = " + << Name() << ".InStreamPort( '" << anInPort->PortName() << "' , SALOME_ModuleCatalog." + << StringToDataStreamType( anInPort->PortType() ) << " , SALOME_ModuleCatalog." + << anInPort->Dependency() << " )" << endl ; + } + else { + f << "I" << Name() << anInPort->PortName() << " = " + << Name() << ".GetInStreamPort( '" << anInPort->PortName() << "' )" << endl ; + } + SUPERV::KindOfSchema aKindOfSchema ; + SUPERV::KindOfInterpolation aKindOfInterpolation ; + SUPERV::KindOfExtrapolation aKindOfExtrapolation ; + ((GraphBase::InDataStreamPort * ) anInPort)->Params( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ; + f << "I" << Name() << anInPort->PortName() << ".SetParams( SUPERV." << aKindOfSchema << " , SUPERV." + << aKindOfInterpolation << " , SUPERV." << aKindOfExtrapolation << " )" << endl ; + } + } + for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) { + const GraphBase::OutPort * anOutPort = GetNodeOutPort(i) ; + cdebug << "Node " << Name() << " OutPort " << anOutPort->PortName() + << " " << anOutPort->Kind() << endl ; + if ( anOutPort->IsDataStream() ) { + if ( IsOneOfInLineNodes() ) { + f << "O" << Name() << anOutPort->PortName() << " = " + << Name() << ".OutStreamPort( '" << anOutPort->PortName() << "' , SALOME_ModuleCatalog." + << StringToDataStreamType( anOutPort->PortType() ) << " , SALOME_ModuleCatalog." + << anOutPort->Dependency() << " )" << endl ; + } + else { + f << "O" << Name() << anOutPort->PortName() << " = " + << Name() << ".GetOutStreamPort( '" << anOutPort->PortName() << "' )" << endl ; + } + long aNumberOfValues ; + aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ; + f << "O" << Name() << anOutPort->PortName() << ".SetNumberOfValues( " << aNumberOfValues << " )" << endl ; + } } } } -#endif + return true ; } @@ -1073,10 +1315,12 @@ void GraphBase::ComputingNode::NodeInfo(ostream & s) const { ostream & operator<< (ostream & f,const GraphBase::ComputingNode & G) { // f << "ComponentName " << G.ComponentName() << endl ; - if ( G.IsComputingNode() ) + if ( G.IsComputingNode() ) { f << "NodeName " << G.Name() << endl ; - else + } + else { f << "DataFlowName " << G.Name() << endl ; + } f << "Kind " << G.Kind() << endl ; f << "Service " << *G.GetService() ; f << "FirstCreation " << G.FirstCreation () << endl ; @@ -1097,8 +1341,9 @@ void GraphBase::ComputingNode::ListLinks(ostream &f ) const { if ( fromPort->IsPortConnected() ) { int j ; for ( j = 0 ; j < fromPort->InPortsSize() ; j++ ) { - if ( j == 0 ) + if ( j == 0 ) { f << "FromNode " << Name() << endl ; + } f << " FromServiceParameterName " << fromPort->GetServicesParameter().Parametername ; const GraphBase::InPort* toPort = fromPort->InPorts( j ) ; diff --git a/src/GraphBase/DataFlowBase_ComputingNode.hxx b/src/GraphBase/DataFlowBase_ComputingNode.hxx index da66380..094f4ef 100644 --- a/src/GraphBase/DataFlowBase_ComputingNode.hxx +++ b/src/GraphBase/DataFlowBase_ComputingNode.hxx @@ -9,33 +9,33 @@ // Module : SUPERV // $Header: -#ifndef _DATAFLOWBASE_NODE_HXX -#define _DATAFLOWBASE_NODE_HXX +#ifndef _DATAFLOWBASE_COMPUTINGNODE_HXX +#define _DATAFLOWBASE_COMPUTINGNODE_HXX #include "SALOME_NamingService.hxx" -#include "DataFlowBase_PortsOfNode.hxx" +#include "DataFlowBase_StreamNode.hxx" namespace GraphBase { class InLineNode ; - class ComputingNode : public PortsOfNode { + class ComputingNode : public StreamNode { private: CORBA::ORB_ptr _ORB ; SALOME_NamingService * _NamingService ; - int * _Graph_prof_debug ; - ofstream * _Graph_fdebug ; +//->StreamNode int * _Graph_prof_debug ; +//->StreamNode ofstream * _Graph_fdebug ; SUPERV::CNode_var _Node ; void * _InNode ; // From GraphExecutor:: or GraphEditor:: bool _ObjInterface ; pthread_t _ThreadNo ; - char * _Name ; - SUPERV::KindOfNode _Kind ; +//->StreamNode char * _Name ; +//->StreamNode SUPERV::KindOfNode _Kind ; SUPERV::SDate _FirstCreation ; SUPERV::SDate _LastModification ; char * _EditorRelease ; @@ -47,8 +47,8 @@ namespace GraphBase { int _SubGraphNumber ; bool _GeneratedName ; - int _DataStreamInPortsNumber ; - int _DataStreamOutPortsNumber ; +//->StreamNode int _DataStreamInPortsNumber ; +//->StreamNode int _DataStreamOutPortsNumber ; int _ConnectedInPortsNumber ; int _DecrConnectedInPortsNumber ; @@ -56,13 +56,13 @@ namespace GraphBase { // For generated NodeNames with ServiceName : number of Nodes using // the same ServiceName. It is not the same Service if it belongs to // a different Interface and/or a different Component ... - map< string , int > _MapOfServiceNames ; +//->StreamNode map< string , int > _MapOfServiceNames ; // Nodes with LinkedInPortsNumber InPort(s) linked to Outport(s) of this node : - map< string , int > _MapOfLinkedNodes ; - int _LinkedNodesSize ; - vector _LinkedNodes ; - vector _LinkedInPortsNumber ; +//->StreamNode map< string , int > _MapOfLinkedNodes ; +//->StreamNode int _LinkedNodesSize ; +//->StreamNode vector _LinkedNodes ; +//->StreamNode vector _LinkedInPortsNumber ; protected: @@ -97,9 +97,37 @@ namespace GraphBase { SALOME_NamingService * NamingService() const { return _NamingService ; } ; - SUPERV::CNode_var ObjRef() const { return _Node ; } ; + SUPERV::CNode_var ObjRef() const { +// char * _NodeName ; +// cdebug << "ComputingNode::ObjRef() " << _Node << " " << Name() +// << " " << endl ; +// SUPERV::CNode_var _NodeObjRef = SUPERV::CNode::_narrow( _Node ) ; +// if ( CORBA::is_nil( _NodeObjRef ) ) { +// _NodeName = "NilRef" ; +// } +// else { +// try { +// _NodeName = _NodeObjRef->Name() ; +// } +// catch ( ... ) { +// _NodeName = "Catch Error" ; +// } +// } +// cdebug << _NodeName << " " << Name() << endl ; + return _Node ; } ; void SetObjRef(SUPERV::CNode_var aNode) { - _Node = aNode ; } ; +// char * _NodeName ; +// if ( CORBA::is_nil( _Node ) ) { +// _NodeName = "NilRef" ; +// } +// else { +// _NodeName = _Node->Name() ; +// } +// cdebug << "ComputingNode::SetObjRef( " << _Node << " " +// << _NodeName << " ) " << Name() << " --> " ; + _Node = aNode ; +// cdebug << _Node << " " << _Node->Name() << " ) " << Name() << endl ; + } ; void InNode( void * anInNode ) { // cdebug << "GraphBase::ComputingNode::InNode " << Name() << endl ; _InNode = anInNode ; } ; @@ -112,10 +140,8 @@ namespace GraphBase { pthread_t ThreadNo() { return _ThreadNo ; } ; void ThreadNo( pthread_t aThread ) { _ThreadNo = aThread ; } ; - char * Name() const { return my_strdup( _Name ) ; } ; - const char *const * NamePtr() const { return &_Name ; } ; - SUPERV::KindOfNode Kind() const { - return _Kind; } ; +//->StreamNode char * Name() const { return my_strdup( _Name ) ; } ; +//->StreamNode const char *const * NamePtr() const { return &_Name ; } ; // const SALOME_ModuleCatalog::Service * Service() const ; SUPERV::SDate FirstCreation() const ; SUPERV::SDate LastModification() const ; @@ -125,8 +151,7 @@ namespace GraphBase { int XCoordinate() const { return _X ; } ; int YCoordinate() const { return _Y ; } ; - bool Name( const char * aName ) ; - bool Kind( SUPERV::KindOfNode aKind) ; +//->StreamNode bool Name( const char * aName ) ; // void Service( const SALOME_ModuleCatalog::Service aService ) ; void FirstCreation( const SUPERV::SDate aFirstCreation ) ; void LastModification( const SUPERV::SDate aLastModification ) ; @@ -145,32 +170,6 @@ namespace GraphBase { GraphBase::SNode * GetInfo() ; - const bool IsComputingNode() const { - return (_Kind == SUPERV::ComputingNode ) ; } ; - const bool IsFactoryNode() const { - return (_Kind == SUPERV::FactoryNode ) ; } ; - const bool IsOneOfGOTONodes() const { - return (_Kind == SUPERV::LoopNode || - _Kind == SUPERV::EndLoopNode || - _Kind == SUPERV::SwitchNode || - _Kind == SUPERV::EndSwitchNode || - _Kind == SUPERV::GOTONode ) ; } ; - const bool IsOneOfInLineNodes() const { - return (_Kind == SUPERV::InLineNode || IsOneOfGOTONodes() ) ; } ; - const bool IsInLineNode() const { - return (_Kind == SUPERV::InLineNode ) ; } ; - const bool IsDataFlowNode() const { - return (_Kind == SUPERV::DataFlowNode ) ; } ; - const bool IsLoopNode() const { - return (_Kind == SUPERV::LoopNode ) ; } ; - const bool IsEndLoopNode() const { - return (_Kind == SUPERV::EndLoopNode ) ; } ; - const bool IsSwitchNode() const { - return (_Kind == SUPERV::SwitchNode ) ; } ; - const bool IsEndSwitchNode() const { - return (_Kind == SUPERV::EndSwitchNode ) ; } ; - const bool IsGOTONode() const { - return (_Kind == SUPERV::GOTONode ) ; } ; void HeadNode( bool aHeadNode ) { _HeadNode = aHeadNode ; } ; const bool IsHeadNode() const { return _HeadNode ; } ; @@ -180,48 +179,44 @@ namespace GraphBase { void DelOutPort( const char * OutputParameterName ) ; InPort * AddInPort( const char * InputParameterName , - const char * InputParameterType ) ; + const char * InputParameterType , + const SUPERV::KindOfPort aKindOfPort ) ; OutPort * AddOutPort( const char * OutputParameterName , - const char * OutputParameterType ) ; - int IncrDataStreamInPorts() { - _DataStreamInPortsNumber++ ; - return _DataStreamInPortsNumber ; - } ; - int IncrDataStreamOutPorts() { - _DataStreamOutPortsNumber++ ; - return _DataStreamOutPortsNumber ; - } ; - int DataStreamInPortsNumber() { - return _DataStreamInPortsNumber ; - } ; - int DataStreamOutPortsNumber() { - return _DataStreamOutPortsNumber ; - } ; - void DataStreamInPortsNumber( int aDataStreamInPortsNumber ) { - _DataStreamInPortsNumber = aDataStreamInPortsNumber ; - } ; - void DataStreamOutPortsNumber(int aDataStreamOutPortsNumber ) { - _DataStreamOutPortsNumber = aDataStreamOutPortsNumber ; - } ; - int HasDataStream() { - return _DataStreamInPortsNumber + _DataStreamOutPortsNumber ; - } ; - - - void AddLink( ComputingNode * aNode ) ; - void RemoveLink( ComputingNode * aNode ) ; + const char * OutputParameterType , + const SUPERV::KindOfPort aKindOfPort ) ; + + void DelInDataStreamPort( const char * InputParameterName ) ; + void DelOutDataStreamPort( const char * OutputParameterName ) ; + + InDataStreamPort * AddInDataStreamPort( const char * InputParameterName , + const SALOME_ModuleCatalog::DataStreamType InputParameterType , + const SALOME_ModuleCatalog::DataStreamDependency aDependency , + const SUPERV::KindOfPort aKindOfPort ) ; + OutDataStreamPort * AddOutDataStreamPort( const char * OutputParameterName , + const SALOME_ModuleCatalog::DataStreamType OutputParameterType , + const SALOME_ModuleCatalog::DataStreamDependency aDependency , + const SUPERV::KindOfPort aKindOfPort ) ; + + ComputingNode * LinkedNodes( int i ) const { return (GraphBase::ComputingNode *) GraphBase::StreamNode::LinkedNodes( i ) ; } ; + + void AddLink( GraphBase::ComputingNode * ToNode ) { + GraphBase::StreamNode::AddLink( ToNode ) ; + cdebug << Name() << "->GraphBase::ComputingNode::AddLinkedNode( " << ToNode->Name() + << " ConnectedInPortsNumber " << ToNode->ConnectedInPortsNumber() + << " + 1 Service " << ServiceName() << endl ; + ToNode->IncrConnectedInPortsNumber() ; } ; + + void RemoveLink( GraphBase::ComputingNode * ToNode ) { + if ( GraphBase::StreamNode::RemoveLink( ToNode ) ) { + cdebug << "GraphBase::StreamNode::RemoveLink( to " << ToNode->Name() << " from " + << Name() << " ConnectedInPortsNumber " + << ToNode->ConnectedInPortsNumber() - 1 << endl ; + ToNode->DecrConnectedInPortsNumber() ; } } ; + void ReNameLink( const char* OldNodeName , - const char* NewNodeName ) ; - - int GetServiceNameNumber( const char * name ) { - int num = _MapOfServiceNames[ name ] ; - if ( num == 0 ) { - _MapOfServiceNames[ name ] = 1 ; - } - else { - _MapOfServiceNames[ name ] = num + 1 ; - } - return _MapOfServiceNames[ name ] ; } ; + const char* NewNodeName ) { + GraphBase::StreamNode::ReNameLink( OldNodeName , NewNodeName ) ; } ; + void IncrConnectedInPortsNumber() { cdebug << "IncrConnectedInPortsNumber " << Name() << " -> " @@ -246,30 +241,6 @@ namespace GraphBase { } return false ; } ; - int GetLinkedNodeIndex( const char * name ) { - int index = _MapOfLinkedNodes[ name ] -1 ; - if ( index >= 0 ) { - cdebug << "GetLinkedNodeIndex of " << name - << " in _MapOfLinkedNodes : " - << index << " Node " << hex << (void *) _LinkedNodes[ index ] - << dec << " '" << _LinkedNodes[ index ]->Name() << "'" - << endl ; - } - return index ; } ; - void SetLinkedNodeIndex( const char * name , const int index ) { - _MapOfLinkedNodes[ name ] = index +1 ; - cdebug << "SetLinkedNodeIndex of " << name << " in _MapOfLinkedNodes : " - << index << " Node " << hex << (void *) _LinkedNodes[ index ] - << dec << " '" << _LinkedNodes[ index ]->Name() << "'" - << " _MapOfLinkedNodes " << _MapOfLinkedNodes[ name ] - 1 - << endl ; - } ; - void DelLinkedNodeIndex( const char * name ) { - _MapOfLinkedNodes.erase( name ) ; } ; - int LinkedNodesSize() const { return _LinkedNodesSize ; } ; - ComputingNode * LinkedNodes( int i ) const { return _LinkedNodes[ i ] ; } ; - const int LinkedInPortsNumber( int i ) const { return _LinkedInPortsNumber[ i ] ; } ; - int Level() { return _LevelNumber ; } ; void Level( int LevelNumber ) { _LevelNumber = LevelNumber ; } ; diff --git a/src/GraphBase/DataFlowBase_DataNode.cxx b/src/GraphBase/DataFlowBase_DataNode.cxx index 96cf474..8c4eecc 100644 --- a/src/GraphBase/DataFlowBase_DataNode.cxx +++ b/src/GraphBase/DataFlowBase_DataNode.cxx @@ -39,7 +39,8 @@ GraphBase::DataNode::DataNode( CORBA::ORB_ptr ORB , SALOME_NamingService* ptrNamingService , const char *DataFlowName ) : InLineNode( ORB , ptrNamingService , DataFlowName ) { - MESSAGE( "GraphBase::DataNode::DataNode" ); +// MESSAGE( "GraphBase::DataNode::DataNode" ); + cdebug << "GraphBase::DataNode::DataNode" << endl ; _Created = false ; } @@ -66,11 +67,10 @@ GraphBase::DataNode::~DataNode() { // MESSAGE( "GraphBase::DataNode::~DataNode" ); } -void GraphBase::DataNode::DataService( - CORBA::ORB_ptr ORB , - SALOME_ModuleCatalog::Service aService , - int * Graph_prof_debug , - ofstream * Graph_fdebug ) { +void GraphBase::DataNode::DataService( CORBA::ORB_ptr ORB , + SALOME_ModuleCatalog::Service aService , + int * Graph_prof_debug , + ofstream * Graph_fdebug ) { cdebug << "GraphBase::DataNode::DataService : DataFlowPortsOfNode of " << aService.ServiceName << endl ; DefPortsOfNode( ORB , aService , NamePtr() , Kind() , @@ -85,8 +85,7 @@ void GraphBase::DataNode::DataService( _DataFlowDataPorts = new PortsOfNode() ; cdebug << "GraphBase::DataNode::DataService : Mirrored DataFlowPortsOfNode of " << aReversedService.ServiceName << endl ; - _DataFlowDataPorts->DefPortsOfNode( ORB , aReversedService , NamePtr() , - Kind() , + _DataFlowDataPorts->DefPortsOfNode( ORB , aReversedService , NamePtr() , Kind() , Graph_prof_debug , Graph_fdebug ) ; _Created = true ; } @@ -98,13 +97,16 @@ int GraphBase::DataNode::CheckDataServerNodes() const { int i , ierr = 0 ; for ( i = 0 ; i < _DataFlowDataPorts->GetNodeOutPortsSize() ; i++ ) { - if ( !_DataFlowDataPorts->GetNodeOutPort(i)->IsDataConnected() ) { - cdebug << "InPort " << _DataFlowDataPorts->GetNodeOutPort(i)->PortName() +// Not a BUG : Reversed Service of the graph + const GraphBase::OutPort * anOutPort = _DataFlowDataPorts->GetNodeOutPort(i) ; +// if ( !anOutPort->IsGate() && !anOutPort->IsDataStream() && !anOutPort->IsDataConnected() ) { + if ( !anOutPort->IsGate() && !anOutPort->IsDataConnected() ) { + cdebug << "InPort " << anOutPort->PortName() << " " << anOutPort->PortType() << " of DataFlow " << Name() << " has NO Data." << endl ; ierr++ ; } else { - cdebug << "InPort " << _DataFlowDataPorts->GetNodeOutPort(i)->PortName() + cdebug << "InPort " << anOutPort->PortName() << " " << anOutPort->PortType() << " of DataFlow " << Name() << " has Data : " // << _DataFlowDataPorts->GetNodeOutPort(i)->Value() << " kind " // << _DataFlowDataPorts->GetNodeOutPort(i)->Kind() diff --git a/src/GraphBase/DataFlowBase_DataPort.cxx b/src/GraphBase/DataFlowBase_DataPort.cxx index a623fdf..a4c3663 100644 --- a/src/GraphBase/DataFlowBase_DataPort.cxx +++ b/src/GraphBase/DataFlowBase_DataPort.cxx @@ -30,10 +30,18 @@ using namespace std; #include #include "DataFlowBase_DataPort.hxx" +GraphBase::DataPort::DataPort() : + Port() { + pthread_mutex_init( &_MutexWait , NULL ) ; + InitialValues( CORBA::Any() ) ; +} + GraphBase::DataPort::DataPort( const char *const * NodeName , - const SALOME_ModuleCatalog::ServicesParameter aserviceParameter ) : - Port( NodeName , aserviceParameter ) { + const SALOME_ModuleCatalog::ServicesParameter aserviceParameter , + const SUPERV::KindOfPort aKind , + const SALOME_ModuleCatalog::DataStreamDependency aDependency ) : + Port( NodeName , aserviceParameter , aKind , aDependency ) { pthread_mutex_init( &_MutexWait , NULL ) ; InitialValues( CORBA::Any() ) ; } @@ -98,7 +106,8 @@ void GraphBase::DataPort::InitialValues(CORBA::Any aValue ) { } void GraphBase::DataPort::Value( const CORBA::Any & aDataValue ) { - Value( new CORBA::Any( aDataValue ) ) ; + CORBA::Any * aValue = new CORBA::Any( aDataValue ) ; + Value( aValue ) ; } void GraphBase::DataPort::Value( const CORBA::Any * aDataValue ) { diff --git a/src/GraphBase/DataFlowBase_DataPort.hxx b/src/GraphBase/DataFlowBase_DataPort.hxx index 08ed859..0dd2c29 100644 --- a/src/GraphBase/DataFlowBase_DataPort.hxx +++ b/src/GraphBase/DataFlowBase_DataPort.hxx @@ -35,38 +35,43 @@ namespace GraphBase { class DataPort : public Port { - CORBA::Any const * _InitialValue ; - CORBA::Any const * _theValue ; - CORBA::Any const * * _Value ; - SUPERV::GraphState _State ; - bool _Done ; - pthread_mutex_t _MutexWait ; + private: + + CORBA::Any const * _InitialValue ; + CORBA::Any const * _theValue ; + CORBA::Any const * * _Value ; + SUPERV::GraphState _State ; + bool _Done ; + pthread_mutex_t _MutexWait ; public : - DataPort( const char *const * NodeName , - const SALOME_ModuleCatalog::ServicesParameter aserviceParameter ) ; - virtual ~DataPort() ; + DataPort() ; + DataPort( const char *const * NodeName , + const SALOME_ModuleCatalog::ServicesParameter aserviceParameter , + const SUPERV::KindOfPort aKind = SUPERV::ServiceParameter , + const SALOME_ModuleCatalog::DataStreamDependency aDependency = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED ) ; + virtual ~DataPort() ; - void InitialValues(CORBA::Any aValue ) ; - void Value (const CORBA::Any & aValue ) ; - void Value( const CORBA::Any * aValue ) ; - void Value( const CORBA::Any ** aValue ) ; - CORBA::Any const * Value() const ; - bool BoolValue() const ; - const CORBA::Any ** ValuePtr() const ; + void InitialValues(CORBA::Any aValue ) ; + void Value (const CORBA::Any & aValue ) ; + void Value( const CORBA::Any * aValue ) ; + void Value( const CORBA::Any ** aValue ) ; + CORBA::Any const * Value() const ; + bool BoolValue() const ; + const CORBA::Any ** ValuePtr() const ; - void State( SUPERV::GraphState aState ) { - _State = aState ; } ; - SUPERV::GraphState State() { return _State ; } ; + void State( SUPERV::GraphState aState ) { + _State = aState ; } ; + SUPERV::GraphState State() { return _State ; } ; - void Done( bool aDone ) { -// cdebug << "ChgDone(.) " << NodeName() << " " << PortName() << " " -// << _Done << " -> " << aDone << endl ; - _Done = aDone ; } ; - const bool Done() const { return ( _Done ) ; } ; + void Done( bool aDone ) { +// cdebug << "ChgDone(.) " << NodeName() << " " << PortName() << " " +// << _Done << " -> " << aDone << endl ; + _Done = aDone ; } ; + const bool Done() const { return ( _Done ) ; } ; - void StringValue(ostream & f) const ; + void StringValue(ostream & f) const ; } ; diff --git a/src/GraphBase/DataFlowBase_Graph.cxx b/src/GraphBase/DataFlowBase_Graph.cxx index 81c0fe9..427db40 100644 --- a/src/GraphBase/DataFlowBase_Graph.cxx +++ b/src/GraphBase/DataFlowBase_Graph.cxx @@ -27,7 +27,7 @@ // $Header: using namespace std; -#include "DataFlowBase_Graph.hxx" +#include "DataFlowBase_StreamGraph.hxx" #include "SALOME_LifeCycleCORBA.hxx" @@ -40,11 +40,13 @@ GraphBase::Graph::Graph() : GraphBase::Graph::Graph( CORBA::ORB_ptr ORB , SALOME_NamingService* ptrNamingService , const char *DataFlowName , - const char * DebugFileName ) : + int * Graph_prof_debug , + ofstream * Graph_fdebug ) : +// const char * DebugFileName ) : DataNode( ORB ,ptrNamingService , DataFlowName ) { - Set_prof_debug( ORB , DebugFileName ) ; - cdebug << "GraphBase::Graph::Graph( " << DataFlowName << ")" << endl ; _Orb = CORBA::ORB::_duplicate( ORB ) ; + Set_prof_debug( Graph_prof_debug , Graph_fdebug ) ; + cdebug << "GraphBase::Graph::Graph( " << DataFlowName << ") GraphNodesSize() " << GraphNodesSize() << endl ; _GraphNodesSize = 0 ; } @@ -61,16 +63,18 @@ GraphBase::Graph::Graph( CORBA::ORB_ptr ORB , const char * DataFlowAuthor , const char * DataFlowComputer , const char * DataFlowComment , - const char * DebugFileName ) : + int * Graph_prof_debug , + ofstream * Graph_fdebug ) : +// const char * DebugFileName ) : DataNode( ORB , ptrNamingService , DataFlowService , DataFlowName , DataFlowkind , DataFlowFirstCreation , DataFlowLastModification , DataFlowEditorRelease , DataFlowAuthor , DataFlowComment ) { _Orb = CORBA::ORB::_duplicate( ORB ) ; _GraphNodesSize = 0 ; - Set_prof_debug( ORB , DebugFileName ) ; + Set_prof_debug( Graph_prof_debug , Graph_fdebug ) ; cdebug_in << "GraphBase::Graph::Graph" << endl ; - DataService( ORB , DataFlowService , Graph_prof_debug() , Graph_fdebug() ) ; + DataService( ORB , DataFlowService , Graph_prof_debug , Graph_fdebug ) ; cdebug_out << "GraphBase::Graph::Graph" << endl ; } @@ -78,15 +82,11 @@ GraphBase::Graph::~Graph() { cdebug << "GraphBase::Graph::~Graph" << endl ; } -void GraphBase::Graph::Set_prof_debug( CORBA::ORB_ptr ORB , - const char * DebugFileName ) { - _Graph_prof_debug = 0 ; - if ( DebugFileName ) { - _Graph_fdebug = new ofstream( DebugFileName ); - MESSAGE( endl << "Trace redirected to file " << DebugFileName << endl) - SetDebug( ORB , &_Graph_prof_debug , _Graph_fdebug ) ; - } - cdebug << "GraphBase::Graph::Set_prof_debug redirect Trace to file " << DebugFileName << endl ; +void GraphBase::Graph::Set_prof_debug( int * Graph_prof_debug , + ofstream * Graph_fdebug ) { + SetDebug( _Orb , Graph_prof_debug , Graph_fdebug ) ; + _Graph_prof_debug = Graph_prof_debug ; + _Graph_fdebug = Graph_fdebug ; } GraphBase::SNode * GraphBase::Graph::GetInfo() const { @@ -95,6 +95,15 @@ GraphBase::SNode * GraphBase::Graph::GetInfo() const { Info->theInterfaceName = "" ; Info->theName = Name() ; Info->theKind = Kind() ; + if ( IsDataStreamNode() ) { + long Timeout ; + SUPERV::KindOfDataStreamTrace DataStreamTrace ; + double DeltaTime ; + ((GraphBase::StreamGraph * ) this)->StreamParams( Timeout , DataStreamTrace , DeltaTime ) ; + Info->theTimeout = Timeout ; + Info->theDataStreamTrace = DataStreamTrace ; + Info->theDeltaTime = DeltaTime ; + } Info->theService = *GetService() ; Info->theFirstCreation = FirstCreation() ; Info->theLastModification = LastModification() ; @@ -115,6 +124,7 @@ GraphBase::ListOfNodes * GraphBase::Graph::GetNodes() const { GraphBase::ListOfNodes * _list_nodes = new GraphBase::ListOfNodes; + cdebug_in << "GraphBase::Graph::GetNodes" << endl ; // All the nodes from _InNodes are taken // vector< InNode *> Nodes = InNodes() ; @@ -192,10 +202,100 @@ GraphBase::ListOfNodes * GraphBase::Graph::GetNodes() const { else { (*_list_nodes)[ind].theCoupledNode = CORBA::string_dup( "" ) ; } - (*_list_nodes)[ind].theDataStreamInArgsNumber = aCNode->DataStreamInPortsNumber() ; - (*_list_nodes)[ind].theDataStreamOutArgsNumber = aCNode->DataStreamOutPortsNumber() ; +// (*_list_nodes)[ind].theDataStreamInArgsNumber = aCNode->DataStreamInPortsNumber() ; +// (*_list_nodes)[ind].theDataStreamOutArgsNumber = aCNode->DataStreamOutPortsNumber() ; + + (*_list_nodes)[ind].theListOfInDataStreams.resize( aCNode->DataStreamInPortsNumber() ) ; + cdebug << "GraphBase::Graph::GetNodes " << aCNode->Name() << " " << aCNode->DataStreamInPortsNumber() << " DataStreamInPortsNumber" << endl ; + int iostream ; + int streamind = 0 ; + for ( iostream = 0 ; iostream < aCNode->GetNodeInPortsSize() ; iostream++ ) { + const GraphBase::InPort * anInPort ; + anInPort = aCNode->GetNodeInPort( iostream ) ; + if ( anInPort->IsDataStream() ) { + cdebug << "GraphBase::Graph::GetNodes In" << iostream << " " << aCNode->Name() << " " << anInPort->NodeName() << " " << anInPort->PortName() + << endl ; + (*_list_nodes)[ind].theListOfInDataStreams[streamind].theDataStreamParameter.Parametertype = StringToDataStreamType( anInPort->PortType() ) ; + (*_list_nodes)[ind].theListOfInDataStreams[streamind].theDataStreamParameter.Parametername = CORBA::string_dup( anInPort->PortName() ) ; + (*_list_nodes)[ind].theListOfInDataStreams[streamind].theDataStreamParameter.Parameterdependency = anInPort->Dependency() ; + SUPERV::KindOfSchema aKindOfSchema ; + SUPERV::KindOfInterpolation aKindOfInterpolation ; + SUPERV::KindOfExtrapolation aKindOfExtrapolation ; + ((GraphBase::InDataStreamPort * ) anInPort)->Params( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ; + (*_list_nodes)[ind].theListOfInDataStreams[streamind].theKindOfSchema = aKindOfSchema ; + (*_list_nodes)[ind].theListOfInDataStreams[streamind].theKindOfInterpolation = aKindOfInterpolation ; + (*_list_nodes)[ind].theListOfInDataStreams[streamind].theKindOfExtrapolation = aKindOfExtrapolation ; + cdebug << "GraphBase::Graph::GetNodes " << aCNode->Name() << " " << anInPort->NodeName() << " " << anInPort->PortName() << " " + << anInPort->Dependency() << " " << aKindOfSchema << " " << aKindOfInterpolation << " " << aKindOfExtrapolation << " list_nodes " + << (*_list_nodes)[ind].theListOfInDataStreams[streamind].theDataStreamParameter.Parametername << " " + << (*_list_nodes)[ind].theListOfInDataStreams[streamind].theDataStreamParameter.Parametertype << " " + << (*_list_nodes)[ind].theListOfInDataStreams[streamind].theDataStreamParameter.Parameterdependency << " " + << (*_list_nodes)[ind].theListOfInDataStreams[streamind].theKindOfSchema << " " + << (*_list_nodes)[ind].theListOfInDataStreams[streamind].theKindOfInterpolation << " " + << (*_list_nodes)[ind].theListOfInDataStreams[streamind].theKindOfExtrapolation << " " << endl ; + streamind += 1 ; + } + else { + cdebug << "GraphBase::Graph::GetNodes " << aCNode->Name() << " " << anInPort->NodeName() << " " << anInPort->PortName() << " " + << anInPort->Kind() << " IsDataStream " << anInPort->IsDataStream() << endl ; + } + } + + (*_list_nodes)[ind].theListOfOutDataStreams.resize( aCNode->DataStreamOutPortsNumber() ) ; + cdebug << "GraphBase::Graph::GetNodes " << aCNode->Name() << " " << aCNode->DataStreamOutPortsNumber() << " DataStreamOutPortsNumber" << endl ; + streamind = 0 ; + for ( iostream = 0 ; iostream < aCNode->GetNodeOutPortsSize() ; iostream++ ) { + const GraphBase::OutPort * anOutPort ; + anOutPort = aCNode->GetNodeOutPort( iostream ) ; + if ( anOutPort->IsDataStream() ) { + cdebug << "GraphBase::Graph::GetNodes Out" << iostream << " " << aCNode->Name() << " " << anOutPort->NodeName() << " " << anOutPort->PortName() << " " + << endl ; + (*_list_nodes)[ind].theListOfOutDataStreams[streamind].theDataStreamParameter.Parametertype = StringToDataStreamType( anOutPort->PortType() ) ; + (*_list_nodes)[ind].theListOfOutDataStreams[streamind].theDataStreamParameter.Parametername = CORBA::string_dup( anOutPort->PortName() ) ; + (*_list_nodes)[ind].theListOfOutDataStreams[streamind].theDataStreamParameter.Parameterdependency = anOutPort->Dependency() ; + long aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ; + (*_list_nodes)[ind].theListOfOutDataStreams[streamind].theNumberOfValues = aNumberOfValues ; + cdebug << "GraphBase::Graph::GetNodes " << aCNode->Name() << " " << anOutPort->NodeName() << " " << anOutPort->PortName() << " " + << anOutPort->Dependency() << " " << aNumberOfValues << " list_nodes " + << (*_list_nodes)[ind].theListOfOutDataStreams[streamind].theDataStreamParameter.Parametername << " " + << (*_list_nodes)[ind].theListOfOutDataStreams[streamind].theDataStreamParameter.Parametertype << " " + << (*_list_nodes)[ind].theListOfOutDataStreams[streamind].theDataStreamParameter.Parameterdependency << " " + << (*_list_nodes)[ind].theListOfOutDataStreams[streamind].theNumberOfValues << endl ; + streamind += 1 ; + } + else { + cdebug << "GraphBase::Graph::GetNodes " << aCNode->Name() << " " << anOutPort->NodeName() << " " << anOutPort->PortName() << " " + << anOutPort->Kind() << " IsDataStream " << anOutPort->IsDataStream() << endl ; + } + } + (*_list_nodes)[ind].theService = *aCNode->GetService(); -// (*_list_nodes)[ind].theListOfParameters = *aCNode->GetListOfParameters() ; + cdebug << "GraphBase::Graph::GetNodes theService " << &(*_list_nodes)[ind].theService.ServiceName << endl ; + unsigned int i ; + for ( i = 0 ; i < (*_list_nodes)[ind].theService.ServiceinParameter.length() ; i++ ) { + cdebug << " In" << i << " " << &(*_list_nodes)[ind].theService.ServiceinParameter[i].Parametername + << " " << (*_list_nodes)[ind].theService.ServiceinParameter[i].Parametername + << " " << &(*_list_nodes)[ind].theService.ServiceinParameter[i].Parametertype + << " " << (*_list_nodes)[ind].theService.ServiceinParameter[i].Parametertype << endl ; + } + for ( i = 0 ; i < (*_list_nodes)[ind].theService.ServiceoutParameter.length() ; i++ ) { + cdebug << " Out" << i << " " << &(*_list_nodes)[ind].theService.ServiceoutParameter[i].Parametername + << " " << (*_list_nodes)[ind].theService.ServiceoutParameter[i].Parametername + << " " << &(*_list_nodes)[ind].theService.ServiceoutParameter[i].Parametertype + << " " << (*_list_nodes)[ind].theService.ServiceoutParameter[i].Parametertype << endl ; + } + for ( i = 0 ; i < (*_list_nodes)[ind].theService.ServiceinDataStreamParameter.length() ; i++ ) { + cdebug << " InDataStream" << i << " " << &(*_list_nodes)[ind].theService.ServiceinDataStreamParameter[i].Parametername + << " " << (*_list_nodes)[ind].theService.ServiceinDataStreamParameter[i].Parametername + << " " << &(*_list_nodes)[ind].theService.ServiceinDataStreamParameter[i].Parametertype + << " " << (*_list_nodes)[ind].theService.ServiceinDataStreamParameter[i].Parametertype << endl ; + } + for ( i = 0 ; i < (*_list_nodes)[ind].theService.ServiceoutDataStreamParameter.length() ; i++ ) { + cdebug << " OutDataStream" << i << " " << &(*_list_nodes)[ind].theService.ServiceoutDataStreamParameter[i].Parametername + << " " << (*_list_nodes)[ind].theService.ServiceoutDataStreamParameter[i].Parametername + << " " << &(*_list_nodes)[ind].theService.ServiceoutDataStreamParameter[i].Parametertype + << " " << (*_list_nodes)[ind].theService.ServiceoutDataStreamParameter[i].Parametertype << endl ; + } if ( aCNode->IsOneOfInLineNodes() ) { GraphBase::InLineNode * aINode = (GraphBase::InLineNode * ) aCNode ; GraphBase::LoopNode * aLNode = NULL ; @@ -244,6 +344,7 @@ GraphBase::ListOfNodes * GraphBase::Graph::GetNodes() const { } } } + cdebug_out << "GraphBase::Graph::GetNodes" << endl ; return _list_nodes ; } @@ -380,24 +481,27 @@ GraphBase::ListOfLinks * GraphBase::Graph::GetDatas() const { } bool GraphBase::Graph::AddNode( GraphBase::ComputingNode * aNode ) { - cdebug_in << "GraphBase::Graph::AddNode " << (void *) aNode << " " - << aNode->Name() << " " << aNode->ServiceName() << endl; + cdebug_in << "GraphBase::Graph::AddNode " << (void *) aNode << " " << aNode->Name() << " " << aNode->ServiceName() << endl; bool RetVal = false ; int index = GetGraphNodeIndex( aNode->Name() ) ; if ( index < 0 ) { + cdebug << "GraphBase::Graph::AddNode " << _GraphNodesSize << " nodes + 1" << endl ; _GraphNodes.resize( _GraphNodesSize+1 ) ; _GraphNodes[ _GraphNodesSize ] = aNode ; SetGraphNodeIndex( aNode->Name() , _GraphNodesSize ) ; _GraphNodesSize += 1 ; RetVal = true ; - } -// cout << "GraphBase::Graph::AddNode(" << aNode->ComponentName() << " , " -// << aNode->Name() << ")" << endl; - int i ; - cdebug << "GraphBase::Graph::AddNode Known nodes :" << endl ; - for ( i = 0 ; i < _GraphNodesSize ; i++ ) { - cdebug << i << ". " << GetGraphNode( i )->Name() << " " - << _MapOfGraphNodes[ GetGraphNode( i )->Name() ] - 1 << endl ; + int i ; + cdebug << "GraphBase::Graph::AddNode " << _GraphNodesSize << " Known nodes :" << endl ; + for ( i = 0 ; i < _GraphNodesSize ; i++ ) { + const GraphBase::ComputingNode * aKnownNode = GetGraphNode( i ) ; + if ( aKnownNode ) { + cdebug << i << ". " << aKnownNode->Name() << " " << _MapOfGraphNodes[ GetGraphNode( i )->Name() ] - 1 << endl ; + } + else { + cdebug << i << ". ERROR" << endl ; + } + } } cdebug_out << "GraphBase::Graph::AddNode " << _GraphNodesSize << " Nodes. " << aNode->ServiceName() << endl; @@ -659,7 +763,8 @@ bool GraphBase::Graph::AddLink( GraphBase::ComputingNode *fromNode , cdebug_in << "GraphBase::Graph::AddLink(" << fromNode->Name() << "(" << fromPort->PortName() << ") ---> " << toNode->Name() << "(" << toPort->PortName() << ") )" << endl; - if ( !fromNode->IsDataFlowNode() && !toNode->IsDataFlowNode() && + if ( !fromNode->IsDataFlowNode() && !fromNode->IsDataStreamNode() && + !toNode->IsDataFlowNode() && !toNode->IsDataStreamNode() && toPort->GetOutPort() ) { if ( !strcmp( toPort->GetOutPort()->NodePortName() , fromPort->NodePortName() ) ) { @@ -717,7 +822,9 @@ bool GraphBase::Graph::AddLink( GraphBase::ComputingNode *fromNode , cdebug_out << "GraphBase::Graph::AddLink" << endl; return false ; } - toPort->Kind( SUPERV::EndSwitchParameter ) ; + if ( !toPort->IsDataStream() ) { + toPort->Kind( SUPERV::EndSwitchParameter ) ; + } } else if ( !fromPort->AddInPort( toPort ) ) { // --> MapOfInports in the OutPort cdebug << "!fromPort->AddLink Error." << endl ; @@ -725,7 +832,8 @@ bool GraphBase::Graph::AddLink( GraphBase::ComputingNode *fromNode , return false ; } - if ( fromNode->IsDataFlowNode() && toPort->IsDataConnected() ) { + if ( ( fromNode->IsDataFlowNode() || fromNode->IsDataStreamNode() ) && + toPort->IsDataConnected() ) { toPort->RemoveOutPort() ; } @@ -763,7 +871,8 @@ bool GraphBase::Graph::AddLink( GraphBase::ComputingNode *fromNode , } fromPort->PortStatus( PortConnected ); // GOTO - Loop } - else if ( fromNode->IsDataFlowNode() || toNode->IsDataFlowNode() ) { + else if ( fromNode->IsDataFlowNode() || fromNode->IsDataStreamNode() || + toNode->IsDataFlowNode() || toNode->IsDataStreamNode() ) { cdebug << "AddLink IsDataFlowNode fromPort->PortStatus( DataConnected ) " << fromNode->Name() << " " << fromPort->PortName() << endl ; fromPort->PortStatus( DataConnected ); @@ -779,11 +888,13 @@ bool GraphBase::Graph::AddLink( GraphBase::ComputingNode *fromNode , } } if ( fromNode->IsSwitchNode() ) { - if ( fromPort->IsInLine() && toPort->IsGate() && !toNode->IsEndSwitchNode() ) { - fromPort->Kind( SUPERV::SwitchParameter ) ; - } - else if ( !fromPort->IsGate() && !toPort->IsGate() ){ - fromPort->Kind( SUPERV::InLineParameter ) ; + if ( !fromPort->IsDataStream() ) { + if ( fromPort->IsInLine() && toPort->IsGate() && !toNode->IsEndSwitchNode() ) { + fromPort->Kind( SUPERV::SwitchParameter ) ; + } + else if ( !fromPort->IsGate() && !toPort->IsGate() ){ + fromPort->Kind( SUPERV::InLineParameter ) ; + } } if ( fromPort->IsGate() && !toNode->IsEndSwitchNode() ) { GraphBase::InLineNode * anEndSwitchNode ; @@ -1171,9 +1282,17 @@ bool GraphBase::Graph::CreateService() { GraphBase::ComputingNode * aToNode ; int dostore ; int innbr ; + int instreamnbr ; int outnbr ; + int outstreamnbr ; vector< SUPERV::KindOfPort > InPortsKind ; + vector< SALOME_ModuleCatalog::DataStreamDependency > InDataStreamDependency ; + vector< SUPERV::KindOfSchema > InKindOfSchema ; + vector< SUPERV::KindOfInterpolation > InKindOfInterpolation ; + vector< SUPERV::KindOfExtrapolation > InKindOfExtrapolation ; vector< SUPERV::KindOfPort > OutPortsKind ; + vector< SALOME_ModuleCatalog::DataStreamDependency > OutDataStreamDependency ; + vector< long > OutNumberOfValues ; for ( dostore = 0 ; dostore <= 2 ; dostore++ ) { if ( dostore == 1 ) { aService.ServiceName = Name() ; @@ -1182,9 +1301,36 @@ bool GraphBase::Graph::CreateService() { aService.ServiceoutParameter.length( 0 ) ; aService.ServiceoutParameter.length( outnbr ) ; InPortsKind.resize( innbr ) ; + InDataStreamDependency.resize( innbr ) ; + InKindOfSchema.resize( innbr ) ; + InKindOfInterpolation.resize( innbr ) ; + InKindOfExtrapolation.resize( innbr ) ; OutPortsKind.resize( outnbr ) ; + OutDataStreamDependency.resize( outnbr ) ; + OutNumberOfValues.resize( outnbr ) ; + } + else if ( dostore == 2 ) { + cdebug << "GraphBase::Graph::CreateService ->DataService innbr " << innbr << " instreamnbr " << instreamnbr << " outnbr " << outnbr + << " outstreamnbr " << outstreamnbr << endl ; + DataService( _Orb , aService , Graph_prof_debug() , Graph_fdebug() ) ; + aService.ServiceinParameter.length( innbr + instreamnbr ) ; + aService.ServiceoutParameter.length( outnbr + outstreamnbr ) ; + InPortsKind.resize( innbr + instreamnbr ) ; + InDataStreamDependency.resize( innbr + instreamnbr ) ; + InKindOfSchema.resize( innbr + instreamnbr ) ; + InKindOfInterpolation.resize( innbr + instreamnbr ) ; + InKindOfExtrapolation.resize( innbr + instreamnbr ) ; + OutPortsKind.resize( outnbr + outstreamnbr ) ; + OutDataStreamDependency.resize( outnbr + outstreamnbr ) ; + OutNumberOfValues.resize( outnbr + outstreamnbr ) ; + } + if ( dostore == 0 ) { + innbr = 0 ; + instreamnbr = 0 ; + outnbr = 0 ; + outstreamnbr = 0 ; } - if ( dostore <= 1 ) { + if ( dostore == 1 ) { innbr = 0 ; outnbr = 0 ; } @@ -1193,6 +1339,7 @@ bool GraphBase::Graph::CreateService() { for ( j = 0 ; j < aToNode->GetNodeInPortsSize() ; j++ ) { GraphBase::InPort *anInPort = aToNode->GetChangeNodeInPort(j) ; bool isfromcouplednode = false ; + cdebug << "GraphBase::Graph::CreateService aToNode " << aToNode->Name() << " InPort" << j << endl ; if ( anInPort->IsConnected() && anInPort->GetOutPort() ) { GraphBase::ComputingNode * aFromNode = GetChangeGraphNode( anInPort->GetOutPort()->NodeName() ) ; if ( aFromNode->IsEndLoopNode() && ((GraphBase::EndOfLoopNode * ) aFromNode)->CoupledNode() == aToNode ) { @@ -1208,17 +1355,30 @@ bool GraphBase::Graph::CreateService() { cdebug << "DataConnected from " << *(anInPort->GetOutPort() ) ; } cdebug << endl ; - innbr += 1 ; + if ( anInPort->IsDataStream() ) { + instreamnbr += 1 ; + } + else { + innbr += 1 ; + } } else if ( ( dostore == 1 && !anInPort->IsDataStream() ) || ( dostore == 2 && anInPort->IsDataStream() ) ) { aService.ServiceinParameter[innbr].Parametertype = CORBA::string_dup( anInPort->PortType() ) ; aService.ServiceinParameter[innbr].Parametername = CORBA::string_dup( anInPort->NodePortName() ) ; - InPortsKind[ innbr++ ] = anInPort->Kind() ; - cdebug << "In " << aService.ServiceinParameter[ innbr - 1 ].Parametername << " " << anInPort->Kind() << endl ; + InPortsKind[ innbr ] = anInPort->Kind() ; + InDataStreamDependency[ innbr ] = anInPort->Dependency() ; + if ( dostore == 2 && anInPort->IsDataStream() ) { + ((GraphBase::InDataStreamPort * ) anInPort)->Params( InKindOfSchema[ innbr ] , + InKindOfInterpolation[ innbr ] , + InKindOfExtrapolation[ innbr ] ) ; + } + cdebug << "In" << innbr << " " << aService.ServiceinParameter[ innbr ].Parametername << " " + << anInPort->Kind() << endl ; + innbr += 1 ; } } - else { + else if ( dostore == 0 ) { cdebug << "CreateService " << aToNode->Name() << " Input port " << anInPort->PortName() ; if ( anInPort->IsConnected() ) { cdebug << " is connected " ; @@ -1241,27 +1401,38 @@ bool GraphBase::Graph::CreateService() { GraphBase::ComputingNode * aFromNode = aToNode ; for ( j = 0 ; j < aFromNode->GetNodeOutPortsSize() ; j++ ) { GraphBase::OutPort *anOutPort = aFromNode->GetChangeNodeOutPort(j) ; - cdebug << "CreateService Node " << aFromNode->Name() << ". Output port[" << j << "] "; - if ( anOutPort ) { - cdebug << anOutPort->PortName() << " " << anOutPort->ServicesParameterType() << endl ; - } - else { - cdebug << " NULL" << endl ; - } +// cdebug << "CreateService Node " << aFromNode->Name() << ". Output port[" << j << "] "; +// if ( anOutPort ) { +// cdebug << anOutPort->PortName() << " " << anOutPort->ServicesParameterType() << endl ; +// } +// else { +// cdebug << " NULL" << endl ; +// } if ( !aFromNode->IsGOTONode() ) { if ( !anOutPort->IsGate() && ( anOutPort->IsNotConnected() || anOutPort->IsDataConnected() ) ) { if ( dostore == 0 ) { - cdebug << "CreateService " << aFromNode->Name() << " Output port " - << anOutPort->PortName() << endl ; - outnbr += 1 ; +// cdebug << "CreateService " << aFromNode->Name() << " Output port " +// << anOutPort->PortName() << endl ; + if ( anOutPort->IsDataStream() ) { + outstreamnbr += 1 ; + } + else { + outnbr += 1 ; + } } else if ( ( dostore == 1 && !anOutPort->IsDataStream() ) || ( dostore == 2 && anOutPort->IsDataStream() ) ) { aService.ServiceoutParameter[outnbr].Parametertype = CORBA::string_dup( anOutPort->PortType() ) ; aService.ServiceoutParameter[outnbr].Parametername = CORBA::string_dup( anOutPort->NodePortName() ) ; - OutPortsKind[ outnbr++ ] = anOutPort->Kind() ; - cdebug << "Out " << aService.ServiceoutParameter[ outnbr - 1 ].Parametername << " " << anOutPort->Kind() << endl ; + OutPortsKind[ outnbr ] = anOutPort->Kind() ; + OutDataStreamDependency[ outnbr ] = anOutPort->Dependency() ; + if ( dostore == 2 && anOutPort->IsDataStream() ) { + OutNumberOfValues[ outnbr ] = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ; + } + cdebug << "Out" << outnbr << " " << aService.ServiceoutParameter[ outnbr ].Parametername << " " + << anOutPort->Kind() << endl ; + outnbr += 1 ; } } } @@ -1269,36 +1440,102 @@ bool GraphBase::Graph::CreateService() { } } -// MESSAGE( "DataFlowNode ServiceName " << aService.ServiceName ); -// for ( i = 0 ; i < innbr ; i++ ) { -// cout << "aService.ServiceinParameter[" << i << "].Parametertype " -// << aService.ServiceinParameter[i].Parametertype << endl ; -// cout << "aService.ServiceinParameter[" << i << "].Parametername " -// << aService.ServiceinParameter[i].Parametername << endl ; -// } -// for ( i = 0 ; i < outnbr ; i++ ) { -// cout << "aService.ServiceoutParameter[" << i << "].Parametertype " -// << aService.ServiceoutParameter[i].Parametertype << endl ; -// cout << "aService.ServiceoutParameter[" << i << "].Parametername " -// << aService.ServiceoutParameter[i].Parametername << endl ; -// } + MESSAGE( "DataFlowNode ServiceName " << aService.ServiceName ); + for ( i = 0 ; i < innbr ; i++ ) { + cdebug << "aService.ServiceinParameter[" << i << "].Parametertype " + << aService.ServiceinParameter[i].Parametertype << " Parametername " + << aService.ServiceinParameter[i].Parametername << " " << InPortsKind[ i ] << endl ; + if ( InPortsKind[ i ] != SUPERV::DataStreamParameter ) { + cdebug << "NodeInPort[" << i << "] " << *GetChangeNodeInPort( i ) << endl ; + } + } + for ( i = 0 ; i < outnbr ; i++ ) { + cdebug << "aService.ServiceoutParameter[" << i << "].Parametertype " + << aService.ServiceoutParameter[i].Parametertype << " Parametername " + << aService.ServiceoutParameter[i].Parametername << " " << OutPortsKind[ i ] << endl ; + if ( OutPortsKind[ i ] != SUPERV::DataStreamParameter ) { + cdebug << "NodeOutPort[" << i << "] " << *GetChangeNodeOutPort( i ) << endl ; + } + } - DataService( _Orb , aService , Graph_prof_debug() , Graph_fdebug() ) ; +// DataService( _Orb , aService , InPortsKind , OutPortsKind , Graph_prof_debug() , Graph_fdebug() ) ; for ( i = 0 ; i < innbr ; i++ ) { - GetChangeNodeInPort( i )->Kind( InPortsKind[ i ] ) ; - cdebug << "In " << GetChangeNodeInPort( i )->PortName() << " " << GetChangeNodeInPort( i )->Kind() << endl ; - _DataFlowDataPorts->GetChangeNodeOutPort( i )->Kind( InPortsKind[ i ] ) ; - cdebug << "ReversedIn " << _DataFlowDataPorts->GetChangeNodeOutPort( i )->PortName() << " " << _DataFlowDataPorts->GetChangeNodeOutPort( i )->Kind() << endl ; + if ( InPortsKind[ i ] == SUPERV::DataStreamParameter ) { + GraphBase::InDataStreamPort * anInPort = AddInDataStreamPort( aService.ServiceinParameter[ i ].Parametername , + StringToDataStreamType( aService.ServiceinParameter[ i ].Parametertype ) , + InDataStreamDependency[ i ] , + SUPERV::DataStreamParameter ) ; + anInPort->SetParams( InKindOfSchema[ i ] , + InKindOfInterpolation[ i ] , + InKindOfExtrapolation[ i ] ) ; +// NOT A BUG : AddOutPort for an inport (Reversed service) + anInPort = (GraphBase::InDataStreamPort * ) _DataFlowDataPorts->AddOutPort( _Orb , NamePtr() , + Kind() , + aService.ServiceinParameter[ i ].Parametername , + aService.ServiceinParameter[ i ].Parametertype , + SUPERV::DataStreamParameter , +// _DataFlowDataPorts->DataStreamOutPortsNumber() , + _Graph_prof_debug , _Graph_fdebug ) ; + anInPort->Dependency( InDataStreamDependency[ i ] ) ; +// Attention : revoir les reversed DataStreamPorts +// anInPort->SetParams( InKindOfSchema[ i ] , +// InKindOfInterpolation[ i ] , +// InKindOfExtrapolation[ i ] ) ; + cdebug << "InStreamPort " << GetChangeNodeInPort( i )->PortName() << " " << GetChangeNodeInPort( i )->Kind() << endl ; + cdebug << "ReversedInStreamPort " << _DataFlowDataPorts->GetChangeNodeOutPort( i )->PortName() << " " << _DataFlowDataPorts->GetChangeNodeOutPort( i )->Kind() + << endl ; + } + else { + GetChangeNodeInPort( i )->Kind( InPortsKind[ i ] ) ; + _DataFlowDataPorts->GetChangeNodeOutPort( i )->Kind( InPortsKind[ i ] ) ; + GetChangeNodeInPort( i )->Dependency( InDataStreamDependency[ i ] ) ; + _DataFlowDataPorts->GetChangeNodeOutPort( i )->Dependency( InDataStreamDependency[ i ] ) ; + cdebug << "InPort " << GetChangeNodeInPort( i )->PortName() << " " << GetChangeNodeInPort( i )->Kind() << endl ; + cdebug << "ReversedInPort " << _DataFlowDataPorts->GetChangeNodeOutPort( i )->PortName() << " " << _DataFlowDataPorts->GetChangeNodeOutPort( i )->Kind() + << endl ; + } } for ( i = 0 ; i < outnbr ; i++ ) { - GetChangeNodeOutPort( i )->Kind( OutPortsKind[ i ] ) ; - cdebug << "Out " << GetChangeNodeOutPort( i )->PortName() << " " << GetChangeNodeOutPort( i )->Kind() << endl ; - _DataFlowDataPorts->GetChangeNodeInPort( i )->Kind( OutPortsKind[ i ] ) ; - cdebug << "ReversedOut " << _DataFlowDataPorts->GetChangeNodeInPort( i )->PortName() << " " << _DataFlowDataPorts->GetChangeNodeInPort( i )->Kind() << endl ; + if ( OutPortsKind[ i ] == SUPERV::DataStreamParameter ) { + GraphBase::OutDataStreamPort * anOutPort = AddOutDataStreamPort( aService.ServiceoutParameter[ i ].Parametername , + StringToDataStreamType( aService.ServiceoutParameter[ i ].Parametertype ) , + OutDataStreamDependency[ i ] , + SUPERV::DataStreamParameter ) ; + anOutPort->NumberOfValues( OutNumberOfValues[ i ] ) ; +// NOT A BUG : AddInPort for an outport (Reversed service) + anOutPort = (GraphBase::OutDataStreamPort * ) _DataFlowDataPorts->AddInPort( _Orb , NamePtr() , + Kind() , + aService.ServiceoutParameter[ i ].Parametername , + aService.ServiceoutParameter[ i ].Parametertype , + SUPERV::DataStreamParameter , +// _DataFlowDataPorts->DataStreamInPortsNumber() , + _Graph_prof_debug , _Graph_fdebug ) ; + anOutPort->Dependency( OutDataStreamDependency[ i ] ) ; +// Attention : revoir les reversed DataStreamPorts +// anOutPort->NumberOfValues( OutNumberOfValues[ i ] ) ; + cdebug << "OutStreamPort " << GetChangeNodeOutPort( i )->PortName() << " " << GetChangeNodeOutPort( i )->Kind() << endl ; + cdebug << "ReversedOutStreamPort " << _DataFlowDataPorts->GetChangeNodeInPort( i )->PortName() << " " << _DataFlowDataPorts->GetChangeNodeInPort( i )->Kind() + << endl ; + } + else { + GetChangeNodeOutPort( i )->Kind( OutPortsKind[ i ] ) ; + _DataFlowDataPorts->GetChangeNodeInPort( i )->Kind( OutPortsKind[ i ] ) ; + GetChangeNodeOutPort( i )->Dependency( OutDataStreamDependency[ i ] ) ; + _DataFlowDataPorts->GetChangeNodeInPort( i )->Dependency( OutDataStreamDependency[ i ] ) ; + GetChangeNodeOutPort( i )->Dependency( OutDataStreamDependency[ i ] ) ; + _DataFlowDataPorts->GetChangeNodeInPort( i )->Dependency( OutDataStreamDependency[ i ] ) ; + cdebug << "OutPort " << GetChangeNodeOutPort( i )->PortName() << " " << GetChangeNodeOutPort( i )->Kind() << endl ; + cdebug << "ReversedOutPort " << _DataFlowDataPorts->GetChangeNodeInPort( i )->PortName() << " " << _DataFlowDataPorts->GetChangeNodeInPort( i )->Kind() + << endl ; + } } // Restore input datas : + DataStreamInPortsNumber( 0 ) ; + DataStreamOutPortsNumber( 0 ) ; for ( i = 0 ; i < GraphNodesSize() ; i++ ) { aToNode = GraphNodes( i ) ; + DataStreamInPortsNumber( DataStreamInPortsNumber() + aToNode->DataStreamInPortsNumber() ) ; + DataStreamOutPortsNumber( DataStreamOutPortsNumber() + aToNode->DataStreamOutPortsNumber() ) ; for ( j = 0 ; j < aToNode->GetNodeInPortsSize() ; j++ ) { GraphBase::InPort *anInPort = aToNode->GetChangeNodeInPort(j) ; if ( anInPort->IsDataConnected() ) { @@ -1322,15 +1559,15 @@ bool GraphBase::Graph::InLineServices() { SALOME_ModuleCatalog::Service aService ; for ( i = 0 ; i < GraphNodesSize() ; i++ ) { aINode = (GraphBase::InLineNode * ) GraphNodes( i ) ; - if ( aINode->IsOneOfInLineNodes() || aINode->HasDataStream() ) { +// if ( aINode->IsOneOfInLineNodes() || aINode->HasDataStream() ) { + if ( aINode->IsOneOfInLineNodes() ) { cdebug << "GraphBase::Graph::InLineServices " << aINode->Name() << endl; aService.ServiceName = aINode->ServiceName() ; aService.ServiceinParameter.length( 0 ) ; aService.ServiceoutParameter.length( 0 ) ; int InService = 0 ; for ( j = 0 ; j < aINode->GetNodeInPortsSize() ; j++ ) { - if ( aINode->GetChangeNodeInPort(j)->IsGate() || - aINode->GetChangeNodeInPort(j)->IsLoop() ) { + if ( aINode->GetChangeNodeInPort(j)->IsGate() || aINode->GetChangeNodeInPort(j)->IsLoop() || aINode->GetChangeNodeInPort(j)->IsDataStream() ) { cdebug << "GraphBase::Graph::InLineServices In" << j << " " << aINode->GetChangeNodeInPort(j)->Kind() << " " << aINode->GetChangeNodeInPort(j)->PortType() << " " @@ -1352,8 +1589,7 @@ bool GraphBase::Graph::InLineServices() { } int OutService = 0 ; for ( j = 0 ; j < aINode->GetNodeOutPortsSize() ; j++ ) { - if ( aINode->GetChangeNodeOutPort(j)->IsGate() || - aINode->GetChangeNodeOutPort(j)->IsLoop() ) { + if ( aINode->GetChangeNodeOutPort(j)->IsGate() || aINode->GetChangeNodeOutPort(j)->IsLoop() || aINode->GetChangeNodeOutPort(j)->IsDataStream() ) { cdebug << "GraphBase::Graph::InLineServices Out" << j << " " << aINode->GetChangeNodeOutPort(j)->Kind() << " " << aINode->GetChangeNodeOutPort(j)->PortType() << " " @@ -1401,6 +1637,7 @@ bool GraphBase::Graph::Sort() { _Sorted[ i ] = false ; _CnxInPortsNumber[ i ] = GraphNodes( i )->ConnectedInPortsNumber() ; _DecrInPortsNumber[ i ] = 0 ; + cdebug << "Sort Node [" << i << "] " << GraphNodes( i )->Name() << " initial count " << _CnxInPortsNumber[ i ] << endl ; } while ( NotSortedNumber ) { @@ -1431,7 +1668,7 @@ bool GraphBase::Graph::Sort() { GraphBase::ComputingNode * aLinkedNode = GraphNodes( i )->LinkedNodes( j ) ; int aLinkedInPortsNumber = GraphNodes( i )->LinkedInPortsNumber( j ) ; cdebug << j << ". LinkedNode " << aLinkedNode->Name() ; - if ( !aLinkedNode->IsDataFlowNode() ) { + if ( !aLinkedNode->IsDataFlowNode() && !aLinkedNode->IsDataStreamNode() ) { cdebug << " _DecrInPortsNumber[ " << GetGraphNodeIndex( aLinkedNode->Name() ) << " ] = " @@ -1749,7 +1986,7 @@ bool GraphBase::Graph::DataServerNodes() const { aNode = GraphNodes( i ) ; // while ( aNode != aComputingNodesList.end() ) { if ( aNode->IsFactoryNode() ) { - GraphBase::FactoryNode * FaNode = (GraphBase::FactoryNode * ) aNode ; + GraphBase::FactoryNode * FaNode = (GraphBase::FactoryNode * ) aNode ; if ( !strlen( FaNode->Computer() ) ) { cdebug << "ComputerName missing for node " << FaNode->Name() ; if ( !strlen( FaNode->Computer() ) ) { diff --git a/src/GraphBase/DataFlowBase_Graph.hxx b/src/GraphBase/DataFlowBase_Graph.hxx index 9b585d4..d3b640a 100644 --- a/src/GraphBase/DataFlowBase_Graph.hxx +++ b/src/GraphBase/DataFlowBase_Graph.hxx @@ -44,13 +44,13 @@ namespace GraphBase { private: - int _Graph_prof_debug; - ofstream * _Graph_fdebug; +// int _Graph_prof_debug; +// ofstream * _Graph_fdebug; CORBA::ORB_ptr _Orb ; SUPERV::Graph_var _Graph ; Graph_Impl * _GraphImpl ; -// Map of InNodes of the OutNode +// Map of Nodes of the Graph map< string , int > _MapOfGraphNodes ; long _GraphNodesSize ; vector _Sorted ; @@ -84,7 +84,9 @@ namespace GraphBase { Graph( CORBA::ORB_ptr ORB , SALOME_NamingService* ptrNamingService , const char *DataFlowName , - const char * DebugFileName ) ; + int * Graph_prof_debug , + ofstream * Graph_fdebug ) ; +// const char * DebugFileName ) ; Graph( CORBA::ORB_ptr ORB , SALOME_NamingService* ptrNamingService , const SALOME_ModuleCatalog::Service& DataFlowService , @@ -98,16 +100,18 @@ namespace GraphBase { const char * DataFlowAuthor , const char * DataFlowComputer , const char * DataFlowComment , - const char * DebugFileName ) ; + int * Graph_prof_debug , + ofstream * Graph_fdebug ) ; +// const char * DebugFileName ) ; virtual ~Graph() ; - void Set_prof_debug( CORBA::ORB_ptr ORB , - const char * DebugFileName ) ; +// void Set_prof_debug( CORBA::ORB_ptr ORB , +// const char * DebugFileName ) ; + void Set_prof_debug( int * Graph_prof_debug , + ofstream * Graph_fdebug ) ; int * Graph_prof_debug() { -// MESSAGE( "Graph_prof_debug _Graph_prof_debug " << &_Graph_prof_debug << " _Graph_fdebug " -// << _Graph_fdebug ) ; - return &_Graph_prof_debug ; } ; - ofstream * Graph_fdebug() { return _Graph_fdebug ; } ; + return _prof_debug ; } ; + ofstream * Graph_fdebug() { return _fdebug ; } ; SUPERV::Graph_var ObjRef() const { return _Graph ; } ; void SetObjRef( SUPERV::Graph_var aGraph ) { @@ -171,25 +175,41 @@ namespace GraphBase { ComputingNode * QueueNodes( int i ) const { return _QueueNodes[ i ] ; } ; - const GraphBase::InPort *GetInPort( const char* ToNodeName , - const char* ToServiceParameterName ) { + const GraphBase::InPort * GetInPort( const char * ToServiceParameterName ) { + return GetInPort( ToServiceParameterName ) ; } ; + GraphBase::InPort * GetChangeInPort( const char * ToServiceParameterName ) { + return GetChangeInPort( ToServiceParameterName ) ; } ; + const GraphBase::OutPort * GetOutPort( const char * FromServiceParameterName ) { + return GetOutPort( FromServiceParameterName ) ; } ; + GraphBase::OutPort * GetChangeOutPort( const char * FromServiceParameterName ) { + return GetChangeOutPort( FromServiceParameterName ); } ; + + const GraphBase::InPort * GetInPort( const char * ToNodeName , + const char * ToServiceParameterName ) { ComputingNode * aNode = GetChangeGraphNode( ToNodeName ) ; if ( aNode ) { return aNode->GetInPort(ToServiceParameterName); } else return NULL ; } ; - GraphBase::InPort *GetChangeInPort( const char* ToNodeName , - const char* ToServiceParameterName ) { + GraphBase::InPort * GetChangeInPort( const char * ToNodeName , + const char * ToServiceParameterName ) { ComputingNode * aNode = GetChangeGraphNode( ToNodeName ) ; if ( aNode ) { - return aNode->GetChangeInPort(ToServiceParameterName); + return aNode->GetChangeInPort( ToServiceParameterName ) ; } else return NULL ; } ; - GraphBase::OutPort *GetChangeOutPort( - const char* FromNodeName , - const char* FromServiceParameterName ) { + const GraphBase::OutPort * GetOutPort( const char * FromNodeName , + const char * FromServiceParameterName ) { + ComputingNode * aNode = GetChangeGraphNode( FromNodeName ) ; + if ( aNode ) { + return aNode->GetOutPort( FromServiceParameterName ) ; + } + else + return NULL ; } ; + GraphBase::OutPort * GetChangeOutPort( const char * FromNodeName , + const char * FromServiceParameterName ) { ComputingNode * aNode = GetChangeGraphNode( FromNodeName ) ; if ( aNode ) { return aNode->GetChangeOutPort( FromServiceParameterName ); @@ -220,7 +240,6 @@ namespace GraphBase { GraphBase::ListOfLinks * GetLinks(bool AllLinks = false ) const ; GraphBase::ListOfGraphs * GetGraphs() const ; GraphBase::ListOfLinks * GetDatas() const ; -// SALOME_ModuleCatalog::Service * GetService() const ; bool AddNode( ComputingNode * aNode ) ; bool RemoveNode( const char* NodeName ) ; diff --git a/src/GraphBase/DataFlowBase_InDataStreamPort.cxx b/src/GraphBase/DataFlowBase_InDataStreamPort.cxx new file mode 100644 index 0000000..84049ff --- /dev/null +++ b/src/GraphBase/DataFlowBase_InDataStreamPort.cxx @@ -0,0 +1,140 @@ +// SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes. +// +// Copyright (C) 2003 CEA/DEN, EDF R&D +// +// +// +// File : DataFlowBase_InDataStreamPort.cxx +// Author : Jean Rahuel +// Module : SUPERV +// $Header: + +using namespace std; + +#include "DataFlowBase_InDataStreamPort.hxx" + +GraphBase::InDataStreamPort::InDataStreamPort() : + GraphBase::InPort::InPort() { + _KindOfSchema = SUPERV::SCHENULL ; + _KindOfInterpolation = SUPERV::INTERNULL ; + _KindOfExtrapolation = SUPERV::EXTRANULL ; + cdebug << "GraphBase::InDataStreamPort::InDataStreamPort " << this << " " << PortName() << " " << _KindOfSchema << " " << _KindOfInterpolation + << " " << _KindOfExtrapolation << endl ; +} + +GraphBase::InDataStreamPort::InDataStreamPort( + const char *const * NodeName , + const SALOME_ModuleCatalog::ServicesParameter aserviceParameter , + const SALOME_ModuleCatalog::DataStreamDependency aDependency , + const SUPERV::KindOfSchema aKindOfSchema , + const SUPERV::KindOfInterpolation aKindOfInterpolation , + const SUPERV::KindOfExtrapolation aKindOfExtrapolation ) : + InPort( NodeName , aserviceParameter , SUPERV::DataStreamParameter , aDependency ) { + if ( aDependency == SALOME_ModuleCatalog::DATASTREAM_TEMPORAL ) { + _KindOfSchema = aKindOfSchema ; + _KindOfInterpolation = aKindOfInterpolation ; + _KindOfExtrapolation = aKindOfExtrapolation ; + } + else { + _KindOfSchema = SUPERV::SCHENULL ; + _KindOfInterpolation = SUPERV::INTERNULL ; + _KindOfExtrapolation = SUPERV::EXTRANULL ; + } + cdebug << "GraphBase::InDataStreamPort::InDataStreamPort " << this << " " << PortName() << " " << _KindOfSchema << " " << _KindOfInterpolation + << " " << _KindOfExtrapolation << endl ; +} + +GraphBase::InDataStreamPort::~InDataStreamPort() { + cdebug << "GraphBase::InDataStreamPort::~InDataStreamPort " << this << endl ; +} + +bool GraphBase::InDataStreamPort::SetParams( const SUPERV::KindOfSchema aKindOfSchema , + const SUPERV::KindOfInterpolation aKindOfInterpolation , + const SUPERV::KindOfExtrapolation aKindOfExtrapolation ) { + bool RetVal = true ; + if ( Dependency() == SALOME_ModuleCatalog::DATASTREAM_TEMPORAL ) { + _KindOfSchema = aKindOfSchema ; + _KindOfInterpolation = aKindOfInterpolation ; + _KindOfExtrapolation = aKindOfExtrapolation ; + } + else { + _KindOfSchema = SUPERV::SCHENULL ; + _KindOfInterpolation = SUPERV::INTERNULL ; + _KindOfExtrapolation = SUPERV::EXTRANULL ; + RetVal = false ; + } + cdebug << "GraphBase::InDataStreamPort::SetParams RetVal " << RetVal << " " << PortName() << " " << _KindOfSchema << " " + << _KindOfInterpolation << " " << _KindOfExtrapolation << endl ; + return RetVal ; +} + +void GraphBase::InDataStreamPort::Params( SUPERV::KindOfSchema & aKindOfSchema , + SUPERV::KindOfInterpolation & aKindOfInterpolation , + SUPERV::KindOfExtrapolation & aKindOfExtrapolation ) const { + aKindOfSchema = _KindOfSchema ; + aKindOfInterpolation = _KindOfInterpolation ; + aKindOfExtrapolation = _KindOfExtrapolation ; + cdebug << "GraphBase::InDataStreamPort::Params " << PortName() << " " << _KindOfSchema << " " << _KindOfInterpolation << " " + << _KindOfExtrapolation << endl ; +} + +ostream & operator<< (ostream & f ,const SUPERV::KindOfSchema & s ) { + switch (s) { + case SUPERV::SCHENULL : + f << "SCHENULL"; + break; + case SUPERV::TI : + f << "TI"; + break; + case SUPERV::TF : + f << "TF"; + break; + case SUPERV::DELTA : + f << "DELTA"; + break; + default : + f << "UndefinedKindOfSchema"; + break; + } + + return f; +} + +ostream & operator<< (ostream & f ,const SUPERV::KindOfInterpolation & s ) { + switch (s) { + case SUPERV::INTERNULL : + f << "INTERNULL"; + break; + case SUPERV::L0 : + f << "L0"; + break; + case SUPERV::L1 : + f << "L1"; + break; + default : + f << "UndefinedKindOfInterpolation"; + break; + } + + return f; +} + +ostream & operator<< (ostream & f ,const SUPERV::KindOfExtrapolation & s ) { + switch (s) { + case SUPERV::EXTRANULL : + f << "EXTRANULL"; + break; + case SUPERV::E0 : + f << "E0"; + break; + case SUPERV::E1 : + f << "E1"; + break; + default : + f << "UndefinedKindOfExtrapolation"; + break; + } + + return f; +} + diff --git a/src/GraphBase/DataFlowBase_InDataStreamPort.hxx b/src/GraphBase/DataFlowBase_InDataStreamPort.hxx new file mode 100644 index 0000000..54ecdde --- /dev/null +++ b/src/GraphBase/DataFlowBase_InDataStreamPort.hxx @@ -0,0 +1,65 @@ +// SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes. +// +// Copyright (C) 2003 CEA/DEN, EDF R&D +// +// +// +// File : DataFlowBase_InDataStreamPort.hxx +// Author : Jean Rahuel +// Module : SUPERV +// $Header: + +#ifndef _DATAFLOWBASE_INDATASTREAMPORT_HXX +#define _DATAFLOWBASE_INDATASTREAMPORT_HXX + +#include "DataFlowBase_OutPort.hxx" + +namespace GraphBase { + + class InDataStreamPort : public InPort { + + private: + +// if TimeDependency : + SUPERV::KindOfSchema _KindOfSchema ; + SUPERV::KindOfInterpolation _KindOfInterpolation ; + SUPERV::KindOfExtrapolation _KindOfExtrapolation ; + + protected: + + public: + + InDataStreamPort() ; + + InDataStreamPort( const char *const * NodeName , + const SALOME_ModuleCatalog::ServicesParameter aserviceParameter , + const SALOME_ModuleCatalog::DataStreamDependency aDependency = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED , + const SUPERV::KindOfSchema aKindOfSchema = SUPERV::SCHENULL , + const SUPERV::KindOfInterpolation aKindOfInterpolation = SUPERV::INTERNULL , + const SUPERV::KindOfExtrapolation aKindOfExtrapolation = SUPERV::EXTRANULL ) ; + + virtual ~InDataStreamPort() ; + + bool SetParams( const SUPERV::KindOfSchema aKindOfSchema , + const SUPERV::KindOfInterpolation aKindOfInterpolation , + const SUPERV::KindOfExtrapolation aKindOfExtrapolation ) ; + + void Params( SUPERV::KindOfSchema & aKindOfSchema , + SUPERV::KindOfInterpolation & aKindOfInterpolation , + SUPERV::KindOfExtrapolation & aKindOfExtrapolation ) const ; + + }; + +}; + +ostream & operator<< (ostream &,const SUPERV::KindOfSchema &); + +ostream & operator<< (ostream &,const SUPERV::KindOfInterpolation &); + +ostream & operator<< (ostream &,const SUPERV::KindOfExtrapolation &); + +#endif + + + + diff --git a/src/GraphBase/DataFlowBase_InLineNode.cxx b/src/GraphBase/DataFlowBase_InLineNode.cxx index 315e6ed..d602ecf 100644 --- a/src/GraphBase/DataFlowBase_InLineNode.cxx +++ b/src/GraphBase/DataFlowBase_InLineNode.cxx @@ -31,7 +31,7 @@ GraphBase::InLineNode::InLineNode( CORBA::ORB_ptr ORB , cdebug << "GraphBase::InLineNode::Node " << this << "' _Name " << (void *) Name() << " '" << Name() << " _Comment " - << (void *) Comment() << " " << Comment() << " " << endl ; + << (void *) Comment() << " " << Comment() << endl ; } GraphBase::InLineNode::InLineNode( CORBA::ORB_ptr ORB , diff --git a/src/GraphBase/DataFlowBase_InPort.cxx b/src/GraphBase/DataFlowBase_InPort.cxx index 02b7ab0..3089f38 100644 --- a/src/GraphBase/DataFlowBase_InPort.cxx +++ b/src/GraphBase/DataFlowBase_InPort.cxx @@ -32,14 +32,22 @@ using namespace std; char ** _PortStateName ; +GraphBase::InPort::InPort() : + Port() { + _State = SUPERV::UndefinedState ; + _OutPort = NULL ; + _InitialOutPort = NULL ; +} + GraphBase::InPort::InPort( const char *const * Name , const SALOME_ModuleCatalog::ServicesParameter aserviceParameter , - const SUPERV::KindOfPort aKind) : - Port( Name , aserviceParameter ) { + const SUPERV::KindOfPort aKind , + const SALOME_ModuleCatalog::DataStreamDependency aDependency ) : + Port( Name , aserviceParameter , aKind , aDependency ) { + _State = SUPERV::UndefinedState ; _OutPort = NULL ; _InitialOutPort = NULL ; - Kind( aKind ) ; } //GraphBase::InPort::~InPort() { diff --git a/src/GraphBase/DataFlowBase_InPort.hxx b/src/GraphBase/DataFlowBase_InPort.hxx index 6aa2f79..51224a3 100644 --- a/src/GraphBase/DataFlowBase_InPort.hxx +++ b/src/GraphBase/DataFlowBase_InPort.hxx @@ -37,21 +37,19 @@ namespace GraphBase { class InPort : public Port { - SUPERV::GraphState _State ; - OutPort * _OutPort ; - OutPort * _InitialOutPort ; + private: + + SUPERV::GraphState _State ; + OutPort * _OutPort ; + OutPort * _InitialOutPort ; public: - InPort() { -// cout << "InPort()" << endl ; - _State = SUPERV::UndefinedState ; - _OutPort = NULL ; - _InitialOutPort = NULL ; - } ; + InPort() ; InPort( const char *const * NodeName , const SALOME_ModuleCatalog::ServicesParameter aserviceParameter , - const SUPERV::KindOfPort aKind = SUPERV::ServiceParameter ) ; + const SUPERV::KindOfPort aKind = SUPERV::ServiceParameter , + const SALOME_ModuleCatalog::DataStreamDependency aDependency = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED ) ; virtual ~InPort() { cdebug << "GraphBase::InPort::~InPort " << PortName() << endl ; } ; virtual void destroy() { diff --git a/src/GraphBase/DataFlowBase_OutDataStreamPort.cxx b/src/GraphBase/DataFlowBase_OutDataStreamPort.cxx new file mode 100644 index 0000000..15187ae --- /dev/null +++ b/src/GraphBase/DataFlowBase_OutDataStreamPort.cxx @@ -0,0 +1,35 @@ +// SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes. +// +// Copyright (C) 2003 CEA/DEN, EDF R&D +// +// +// +// File : DataFlowBase_OutDataStreamPort.cxx +// Author : Jean Rahuel +// Module : SUPERV +// $Header: + +using namespace std; + +#include "DataFlowBase_OutDataStreamPort.hxx" + +GraphBase::OutDataStreamPort::OutDataStreamPort() : + OutPort() { + _NumberOfValues = 0 ; + cdebug << "GraphBase::OutDataStreamPort::OutDataStreamPort " << this << " " << endl ; +} + +GraphBase::OutDataStreamPort::OutDataStreamPort( + const char *const * NodeName , + const SALOME_ModuleCatalog::ServicesParameter aserviceParameter , + const SALOME_ModuleCatalog::DataStreamDependency aDependency , + const long aNumberOfValues ) : + OutPort( NodeName , aserviceParameter , SUPERV::DataStreamParameter , aDependency ) { + _NumberOfValues = aNumberOfValues ; + cdebug << "GraphBase::OutDataStreamPort::OutDataStreamPort " << this << " " << endl ; +} + +GraphBase::OutDataStreamPort::~OutDataStreamPort() { + cdebug << "GraphBase::OutDataStreamPort::~OutDataStreamPort " << this << endl ; +} + diff --git a/src/GraphBase/DataFlowBase_OutDataStreamPort.hxx b/src/GraphBase/DataFlowBase_OutDataStreamPort.hxx new file mode 100644 index 0000000..83010d5 --- /dev/null +++ b/src/GraphBase/DataFlowBase_OutDataStreamPort.hxx @@ -0,0 +1,50 @@ +// SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes. +// +// Copyright (C) 2003 CEA/DEN, EDF R&D +// +// +// +// File : DataFlowBase_OutDataStreamPort.hxx +// Author : Jean Rahuel +// Module : SUPERV +// $Header: + +#ifndef _DATAFLOWBASE_OUTDATASTREAMPORT_HXX +#define _DATAFLOWBASE_OUTDATASTREAMPORT_HXX + +#include "DataFlowBase_OutPort.hxx" + +namespace GraphBase { + + class OutDataStreamPort : public OutPort { + + private: + + long _NumberOfValues ; // Values Keeped in links ("Niveau") + + protected: + + public: + + OutDataStreamPort() ; + OutDataStreamPort( const char *const * NodeName , + const SALOME_ModuleCatalog::ServicesParameter aserviceParameter , + const SALOME_ModuleCatalog::DataStreamDependency aDependency = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED , + const long aNumberOfValues = 0 ) ; + + virtual ~OutDataStreamPort() ; + + void NumberOfValues( const long aNumberOfValues ) { + _NumberOfValues = aNumberOfValues ; } ; + long NumberOfValues() const { + return _NumberOfValues ; } ; + + }; + +}; + +#endif + + + + diff --git a/src/GraphBase/DataFlowBase_OutPort.cxx b/src/GraphBase/DataFlowBase_OutPort.cxx index 93b93c1..751d0df 100644 --- a/src/GraphBase/DataFlowBase_OutPort.cxx +++ b/src/GraphBase/DataFlowBase_OutPort.cxx @@ -159,8 +159,6 @@ ostream & operator<< (ostream &f ,const GraphBase::OutPort &P) << P.Kind() << ", "; f << "from " << P.NodeName() << ", "; - f << "kind " - << P.Kind() << ", "; return f; } diff --git a/src/GraphBase/DataFlowBase_OutPort.hxx b/src/GraphBase/DataFlowBase_OutPort.hxx index 92253d4..a6363d0 100644 --- a/src/GraphBase/DataFlowBase_OutPort.hxx +++ b/src/GraphBase/DataFlowBase_OutPort.hxx @@ -48,13 +48,15 @@ namespace GraphBase { public: + OutPort() { + }; OutPort( const char *const * NodeName , const SALOME_ModuleCatalog::ServicesParameter aserviceParameter , - const SUPERV::KindOfPort aKind = SUPERV::ServiceParameter ) : - DataPort( NodeName , aserviceParameter ) { + const SUPERV::KindOfPort aKind = SUPERV::ServiceParameter , + const SALOME_ModuleCatalog::DataStreamDependency aDependency = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED ) : + DataPort( NodeName , aserviceParameter , aKind , aDependency) { _Connected = NotConnected ; - _InPortsSize = 0 ; - Kind( aKind ) ; } ; + _InPortsSize = 0 ; } ; virtual ~OutPort() { cdebug << "GraphBase::OutPort::~OutPort " << PortName() << endl ; } ; virtual void destroy() { diff --git a/src/GraphBase/DataFlowBase_Port.cxx b/src/GraphBase/DataFlowBase_Port.cxx index bf96b7f..ed22d70 100644 --- a/src/GraphBase/DataFlowBase_Port.cxx +++ b/src/GraphBase/DataFlowBase_Port.cxx @@ -203,3 +203,22 @@ ostream & operator<< (ostream & f ,const SUPERV::KindOfPort & s ) { return f; } +ostream & operator<< (ostream & f ,const SALOME_ModuleCatalog::DataStreamDependency & s ) { + switch (s) { + case SALOME_ModuleCatalog::DATASTREAM_UNDEFINED : + f << "DATASTREAM_UNDEFINED"; + break; + case SALOME_ModuleCatalog::DATASTREAM_TEMPORAL : + f << "DATASTREAM_TEMPORAL"; + break; + case SALOME_ModuleCatalog::DATASTREAM_ITERATIVE : + f << "DATASTREAM_ITERATIVE"; + break; + default : + f << ""; + break; + } + + return f; +} + diff --git a/src/GraphBase/DataFlowBase_Port.hxx b/src/GraphBase/DataFlowBase_Port.hxx index 5b1f750..c944750 100644 --- a/src/GraphBase/DataFlowBase_Port.hxx +++ b/src/GraphBase/DataFlowBase_Port.hxx @@ -38,98 +38,108 @@ namespace GraphBase { class Port : public ServicesParameter { - const char *const * _NodeName ; - SUPERV::Port_var _Port ; - SUPERV::KindOfPort _KindOfPort ; + private: - vector _X ; - vector _Y ; + const char *const * _NodeName ; + SUPERV::Port_var _Port ; + SUPERV::KindOfPort _KindOfPort ; + + vector _X ; + vector _Y ; + + SALOME_ModuleCatalog::DataStreamDependency _Dependency ; // Time or Iteration only for DataStreamPorts public: - Port() { -// cout << "Port()" << endl ; - _NodeName = NULL ; - _Port = SUPERV::Port::_nil() ; - _KindOfPort = SUPERV::UndefinedParameter ; - } ; - Port( const char *const * NodeName , - const SALOME_ModuleCatalog::ServicesParameter aserviceParameter , - const SUPERV::KindOfPort aKindOfPort = SUPERV::ServiceParameter ) : - ServicesParameter( aserviceParameter ) { - _NodeName = NodeName ; - _Port = SUPERV::Port::_nil() ; - _KindOfPort = aKindOfPort ; - } ; - virtual ~Port() { + Port() { + _NodeName = NULL ; + _Port = SUPERV::Port::_nil() ; + _KindOfPort = SUPERV::UndefinedParameter ; + _Dependency = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED ; } ; + Port( const char *const * NodeName , + const SALOME_ModuleCatalog::ServicesParameter aserviceParameter , + const SUPERV::KindOfPort aKindOfPort = SUPERV::ServiceParameter , + const SALOME_ModuleCatalog::DataStreamDependency aDependency = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED ) : + ServicesParameter( aserviceParameter ) { + _NodeName = NodeName ; + _Port = SUPERV::Port::_nil() ; + _KindOfPort = aKindOfPort ; + if ( IsDataStream() ) { + _Dependency = aDependency ; + } + else { + _Dependency = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED ; + } } ; + virtual ~Port() { cdebug << "~Port" << endl ; } ; - SUPERV::Port_var ObjRef() const { return _Port ; } ; - void ObjRef(SUPERV::Port_var aPort) { - _Port = aPort ; } ; - - const char * NodeName() const { return *_NodeName ; } ; - const char * NodePortName() const { -// cout << "NodePortName " << hex << (void *) _NodeName << " " -// << dec << _NodeName << endl ; - char * _NodePortName = new char [ strlen( *_NodeName ) + - strlen( ServicesParameterName() ) + 3 ] ; - strcpy( _NodePortName , *_NodeName ) ; - strcat( _NodePortName , "\\" ) ; - strcat( _NodePortName , ServicesParameterName() ) ; -// strcat( _NodePortName , "\\" ) ; - return _NodePortName ; } ; - - const char * PortName() const { - if ( this == NULL ) - return NULLSTRING ; - return ServicesParameterName() ; } ; - const char * PortType() const { return ServicesParameterType() ; } ; - - void Kind( SUPERV::KindOfPort aKindOfPort ) { - if ( _KindOfPort == SUPERV::GateParameter && aKindOfPort == SUPERV::InLineParameter ) { - cdebug << "GraphBase::Port::Kind " << _KindOfPort << " --> " << aKindOfPort - << endl ; - } - _KindOfPort = aKindOfPort ; } ; - const SUPERV::KindOfPort Kind() const { return _KindOfPort ; } ; - bool IsParam() const { - return _KindOfPort == SUPERV::ServiceParameter ; } ; - bool IsGate() const { - return _KindOfPort == SUPERV::GateParameter || - _KindOfPort == SUPERV::GOTOParameter ; } ; - bool IsInLine() const { - return _KindOfPort == SUPERV::InLineParameter ; } ; - bool IsLoop() const { - return _KindOfPort == SUPERV::LoopParameter ; } ; - bool IsSwitch() const { - return _KindOfPort == SUPERV::SwitchParameter ; } ; - bool IsEndSwitch() const { - return _KindOfPort == SUPERV::EndSwitchParameter ; } ; - bool IsGOTO() const { - return _KindOfPort == SUPERV::GOTOParameter ; } ; - bool IsDataStream() const { - return _KindOfPort == SUPERV::DataStreamParameter ; } ; -// bool IsBus() const { return ( ( _KindOfPort == SUPERV::InLineParameter ) || -// ( _PortIndex != -1 ) ) ; } ; - -// void PortIndex( const int anIndex ) { -// _PortIndex = anIndex ; } ; -// const int PortIndex() const { -// return _PortIndex ; } ; - - - bool AddCoord( const int nxy , const int *x , const int *y ) ; - bool AddCoord( const int index , const int x , const int y ) ; - bool ChangeCoord( const int index , - const int x , - const int y ) ; - bool RemoveCoord( const int index ) ; - bool RemoveCoords() ; - int GetCoord() const ; - bool GetCoord( int *x , int *y ) const ; - const GraphBase::ListOfCoords * Coords() const ; - bool GetCoord( const int index , long &x , long &y ) const ; + SUPERV::Port_var ObjRef() const { return _Port ; } ; + void ObjRef(SUPERV::Port_var aPort) { + _Port = aPort ; } ; + + const char * NodeName() const { return *_NodeName ; } ; + const char * NodePortName() const { +// cout << "NodePortName " << hex << (void *) _NodeName << " " +// << dec << _NodeName << endl ; + char * _NodePortName = new char [ strlen( *_NodeName ) + + strlen( ServicesParameterName() ) + 3 ] ; + strcpy( _NodePortName , *_NodeName ) ; + strcat( _NodePortName , "\\" ) ; + strcat( _NodePortName , ServicesParameterName() ) ; + return _NodePortName ; } ; + + const char * PortName() const { + if ( this == NULL ) + return NULLSTRING ; + return ServicesParameterName() ; } ; + const char * PortType() const { return ServicesParameterType() ; } ; + + void Kind( SUPERV::KindOfPort aKindOfPort ) { + if ( _KindOfPort == SUPERV::GateParameter && aKindOfPort == SUPERV::InLineParameter ) { + cdebug << "GraphBase::Port::Kind " << _KindOfPort << " --> " << aKindOfPort + << endl ; + } + _KindOfPort = aKindOfPort ; } ; + const SUPERV::KindOfPort Kind() const { + return _KindOfPort ; } ; + bool IsParam() const { + return _KindOfPort == SUPERV::ServiceParameter ; } ; + bool IsGate() const { + return _KindOfPort == SUPERV::GateParameter || + _KindOfPort == SUPERV::GOTOParameter ; } ; + bool IsInLine() const { + return _KindOfPort == SUPERV::InLineParameter ; } ; + bool IsLoop() const { + return _KindOfPort == SUPERV::LoopParameter ; } ; + bool IsSwitch() const { + return _KindOfPort == SUPERV::SwitchParameter ; } ; + bool IsEndSwitch() const { + return _KindOfPort == SUPERV::EndSwitchParameter ; } ; + bool IsGOTO() const { + return _KindOfPort == SUPERV::GOTOParameter ; } ; + bool IsDataStream() const { + return _KindOfPort == SUPERV::DataStreamParameter ; } ; + + const SALOME_ModuleCatalog::DataStreamDependency Dependency() const { + return _Dependency ; } ; + bool Dependency( SALOME_ModuleCatalog::DataStreamDependency aDependency ) { + if ( IsDataStream() ) { + _Dependency = aDependency ; + return true ; + } + return false ; } ; + + bool AddCoord( const int nxy , const int *x , const int *y ) ; + bool AddCoord( const int index , const int x , const int y ) ; + bool ChangeCoord( const int index , + const int x , + const int y ) ; + bool RemoveCoord( const int index ) ; + bool RemoveCoords() ; + int GetCoord() const ; + bool GetCoord( int *x , int *y ) const ; + const GraphBase::ListOfCoords * Coords() const ; + bool GetCoord( const int index , long &x , long &y ) const ; } ; @@ -137,4 +147,6 @@ namespace GraphBase { ostream & operator<< (ostream &,const SUPERV::KindOfPort &); +ostream & operator<< (ostream &,const SALOME_ModuleCatalog::DataStreamDependency &); + #endif diff --git a/src/GraphBase/DataFlowBase_PortsOfNode.cxx b/src/GraphBase/DataFlowBase_PortsOfNode.cxx index b8dcc3e..93ed3fb 100644 --- a/src/GraphBase/DataFlowBase_PortsOfNode.cxx +++ b/src/GraphBase/DataFlowBase_PortsOfNode.cxx @@ -36,6 +36,8 @@ GraphBase::PortsOfNode::PortsOfNode() : // cdebug << "GraphBase::PortsOfNode::PortsOfNode " << this << endl ; _NodeInPortsSize = 0 ; _NodeOutPortsSize = 0 ; + _DataStreamInPortsNumber = 0 ; + _DataStreamOutPortsNumber = 0 ; } GraphBase::PortsOfNode::PortsOfNode( const char *DataFlowName ) : @@ -45,6 +47,8 @@ GraphBase::PortsOfNode::PortsOfNode( const char *DataFlowName ) : // cdebug << "GraphBase::PortsOfNode::PortsOfNode " << this << endl ; _NodeInPortsSize = 0 ; _NodeOutPortsSize = 0 ; + _DataStreamInPortsNumber = 0 ; + _DataStreamOutPortsNumber = 0 ; } GraphBase::PortsOfNode::~PortsOfNode() { @@ -67,19 +71,24 @@ void GraphBase::PortsOfNode::DefPortsOfNode( int * Graph_prof_debug , ofstream * Graph_fdebug ) { int i ; - cdebug_in << "DefPortsOfNode : " << *NodeName << endl ; - const bool DataFlowOrComputing = (aKind == SUPERV::DataFlowNode) || + SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ; +// MESSAGE( "DefPortsOfNode " << NodeName << " Graph_prof_debug " +// << Graph_prof_debug << " _prof_debug " << _prof_debug ) ; + cdebug_in << "DefPortsOfNode : " << *NodeName << " ServiceName " << aService.ServiceName << endl ; + const bool DataFlowOrComputing = (aKind == SUPERV::DataFlowGraph) || (aKind == SUPERV::ComputingNode) || (aKind == SUPERV::FactoryNode) ; // WithInLoop : InitLoop or DoLoop const bool WithInLoop = (aKind == SUPERV::LoopNode) || (aKind == SUPERV::EndLoopNode) ; // WithInGate : InGate or Default - const bool WithInGate = (aKind == SUPERV::ComputingNode) || (aKind == SUPERV::FactoryNode) || + const bool WithInGate = (aKind == SUPERV::DataFlowGraph) || (aKind == SUPERV::DataStreamGraph) || + (aKind == SUPERV::ComputingNode) || (aKind == SUPERV::FactoryNode) || (aKind == SUPERV::InLineNode) || (aKind == SUPERV::GOTONode) || (aKind == SUPERV::LoopNode) || (aKind == SUPERV::EndLoopNode) || (aKind == SUPERV::SwitchNode) || (aKind == SUPERV::EndSwitchNode) ; // WithOutGate : OutGate or Default - const bool WithOutGate = (aKind == SUPERV::ComputingNode) || (aKind == SUPERV::FactoryNode) || + const bool WithOutGate = (aKind == SUPERV::DataFlowGraph) || (aKind == SUPERV::DataStreamGraph) || + (aKind == SUPERV::ComputingNode) || (aKind == SUPERV::FactoryNode) || (aKind == SUPERV::InLineNode) || (aKind == SUPERV::GOTONode) || (aKind == SUPERV::SwitchNode) || (aKind == SUPERV::EndSwitchNode) ; SUPERV::KindOfPort aPortKind = SUPERV::ServiceParameter ; @@ -145,7 +154,7 @@ void GraphBase::PortsOfNode::DefPortsOfNode( const char *aParametername = _aParametername.c_str() ; if ( _MapOfNodeInPorts[ aParametername ] ) { if ( !DataFlowOrComputing && - !strcmp( aParametername , "InGate" ) ) { + !strcmp( aParametername , "Gate" ) ) { } else { cdebug << "Error, Parametername duplicated : " << aParametername @@ -169,7 +178,7 @@ void GraphBase::PortsOfNode::DefPortsOfNode( SALOME_ModuleCatalog::ServicesParameter anInGateParameter ; _NodeInPortsSize = _NodeInPortsSize + 1 ; iVec += 1 ; - char *aParametername = "InGate" ; + char *aParametername = "Gate" ; if ( aKind == SUPERV::EndSwitchNode ) { aParametername = "Default" ; } @@ -216,7 +225,7 @@ void GraphBase::PortsOfNode::DefPortsOfNode( const char *aParametername = _aParametername.c_str() ; if ( _MapOfNodeOutPorts[ aParametername ] ) { if ( !DataFlowOrComputing && - !strcmp( aParametername , "OutGate" ) ) { + !strcmp( aParametername , "Gate" ) ) { } else { cdebug << "Error, Parametername duplicated : " << aParametername @@ -224,9 +233,9 @@ void GraphBase::PortsOfNode::DefPortsOfNode( } } else { - _MapOfNodeOutPorts[ aParametername ] = i+1 ; cdebug << "DefPortsOfNode : " << "_MapOfNodeOutPorts[ " << aParametername << " ] = " << i+1 << endl ; + _MapOfNodeOutPorts[ aParametername ] = i+1 ; const SALOME_ModuleCatalog::ServicesParameter aServiceParameter = aService.ServiceoutParameter[i-iVec] ; _NodeOutPorts[i] = new GraphBase::OutPort( NodeName , aServiceParameter , aPortKind ); @@ -240,7 +249,7 @@ void GraphBase::PortsOfNode::DefPortsOfNode( SALOME_ModuleCatalog::ServicesParameter anOutGateParameter ; _NodeOutPortsSize = _NodeOutPortsSize + 1 ; iVec += 1 ; - char *aParametername = "OutGate" ; + char *aParametername = "Gate" ; if ( aKind == SUPERV::SwitchNode ) { aParametername = "Default" ; } @@ -261,104 +270,172 @@ void GraphBase::PortsOfNode::DefPortsOfNode( GraphBase::InPort * GraphBase::PortsOfNode::AddInPort( CORBA::ORB_ptr ORB , const char *const * NodeName , - const SUPERV::KindOfNode aKind , + const SUPERV::KindOfNode aKindOfNode , const char * InputParameterName , const char * InputParameterType , + SUPERV::KindOfPort aKindOfPort , +// const int DataStreamInPortsNumber , int * Graph_prof_debug , ofstream * Graph_fdebug ) { - cdebug_in << "DefPortsOfNode::AddInPort : " << *NodeName << " " << aKind << " " - << InputParameterName << " " << InputParameterType << endl ; +// MESSAGE( "DefPortsOfNode " << *NodeName << " Graph_prof_debug " +// << Graph_prof_debug << " _prof_debug " << _prof_debug ) ; + cdebug_in << "PortsOfNode::AddInPort : " << *NodeName << " " << aKindOfNode << " InputParameterName " << InputParameterName << " InputParameterType " + << InputParameterType << " aKindOfPort " << aKindOfPort << " DataStreamInPortsNumber " << DataStreamInPortsNumber() << " _NodeInPortsSize " + << _NodeInPortsSize << endl ; GraphBase::InPort * anInPort = NULL ; - SUPERV::KindOfPort aPortKind = SUPERV::InLineParameter ; + int index = 0 ; anInPort = GetChangeInPort( InputParameterName ) ; if ( anInPort == NULL ) { _NodeInPortsSize = _NodeInPortsSize + 1 ; _NodeInPorts.resize(_NodeInPortsSize); SALOME_ModuleCatalog::ServicesParameter aServiceParameter ; - aServiceParameter.Parametername = InputParameterName ; - aServiceParameter.Parametertype = InputParameterType ; -// if ( aKind != SUPERV::EndLoopNode ) { - _NodeInPorts[ _NodeInPortsSize-1 ] = _NodeInPorts[ _NodeInPortsSize-2 ] ; // Gate - Default - _MapOfNodeInPorts.erase( _NodeInPorts[ _NodeInPortsSize-1 ]->PortName() ) ; - _MapOfNodeInPorts[ _NodeInPorts[ _NodeInPortsSize-1 ]->PortName() ] = _NodeInPortsSize-1 + 1 ; - _MapOfNodeInPorts[ InputParameterName ] = _NodeInPortsSize-2 + 1 ; - _NodeInPorts[_NodeInPortsSize-2] = new GraphBase::InPort( NodeName , - aServiceParameter , - aPortKind ) ; - _NodeInPorts[_NodeInPortsSize-2]->Kind( SUPERV::InLineParameter ) ; - _NodeInPorts[_NodeInPortsSize-2]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ; - anInPort = _NodeInPorts[_NodeInPortsSize-2] ; - cdebug << "NodeInPorts[ " << _NodeInPortsSize-2 << " ]" << endl ; + aServiceParameter.Parametername = CORBA::string_dup( InputParameterName ) ; + aServiceParameter.Parametertype = CORBA::string_dup( InputParameterType ) ; + if ( aKindOfPort == SUPERV::DataStreamParameter ) { + index = _NodeInPortsSize-2 ; + IncrDataStreamInPorts() ; + } + else { + index = _NodeInPortsSize-2 - DataStreamInPortsNumber() ; + } +// if ( aKindOfNode != SUPERV::EndLoopNode ) { + int i ; + for ( i = _NodeInPortsSize - 2 ; i >= index ; i-- ) { + _NodeInPorts[ i + 1 ] = _NodeInPorts[ i ] ; // Gate - Default + _MapOfNodeInPorts.erase( _NodeInPorts[ i + 1 ]->PortName() ) ; + _MapOfNodeInPorts[ _NodeInPorts[ i + 1 ]->PortName() ] = i + 2 ; + } + _MapOfNodeInPorts[ InputParameterName ] = index + 1 ; + if ( aKindOfPort == SUPERV::DataStreamParameter ) { + _NodeInPorts[index] = new GraphBase::InDataStreamPort( NodeName , + aServiceParameter ) ; + } + else { + _NodeInPorts[index] = new GraphBase::InPort( NodeName , + aServiceParameter , + aKindOfPort ) ; + } + _NodeInPorts[index]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ; + anInPort = _NodeInPorts[index] ; + cdebug << "NodeInPorts[ " << index << " ]" << endl ; } // else { // EndLoopNode // _MapOfNodeInPorts[ InputParameterName ] = _NodeInPortsSize-1 + 1 ; // _NodeInPorts[_NodeInPortsSize-1] = new GraphBase::InPort( NodeName , // aServiceParameter ,// -// aPortKind ) ; -// _NodeInPorts[_NodeInPortsSize-1]->Kind( SUPERV::InLineParameter ) ; -// MESSAGE( "GraphBase::PortsOfNode::DefPortsOfNode " << InputParameterName << " --> SetDebug" ) ; +// aKindOfPort ) ; +// MESSAGE( "GraphBase::PortsOfNode::AddInPort " << InputParameterName << " --> SetDebug" ) ; // _NodeInPorts[_NodeInPortsSize-1]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ; // anInPort = _NodeInPorts[_NodeInPortsSize-1] ; // cdebug << "NodeInPorts[ " << _NodeInPortsSize-1 << " ]" << endl ; // } // } else { - cdebug << "InPort already exists" << endl ; + cdebug << "GraphBase::PortsOfNode::AddInPort InPort already exists" << endl ; + anInPort->Kind( aKindOfPort ) ; } - cdebug_out << "DefPortsOfNode::AddInPort _NodeInPortsSize " << _NodeInPortsSize + cdebug << "GraphBase::PortsOfNode::AddInPort index " << index << " _NodeInPortsSize " << _NodeInPortsSize << endl ; + int i ; + for ( i = 0 ; i < _NodeInPortsSize ; i++ ) { + cdebug << *NodeName << " _NodeInPorts[ " << i << " ] = " << _NodeInPorts[ i ]->PortName() + << " _MapOfNodeInPorts[ " << _NodeInPorts[ i ]->PortName() << " ] = " + << _MapOfNodeInPorts[ _NodeInPorts[ i ]->PortName() ] - 1 << " " + << _NodeInPorts[ i ]->Kind() << " Dependency " << _NodeInPorts[ i ]->Dependency() ; + if ( _NodeInPorts[ i ]->IsDataStream() ) { + SUPERV::KindOfSchema aKindOfSchema ; + SUPERV::KindOfInterpolation aKindOfInterpolation ; + SUPERV::KindOfExtrapolation aKindOfExtrapolation ; + ((GraphBase::InDataStreamPort * ) _NodeInPorts[ i ])->Params( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ; + cdebug << " " << aKindOfSchema << " " << aKindOfInterpolation << " " << aKindOfExtrapolation ; + } + cdebug << endl ; + } + cdebug_out << "GraphBase::PortsOfNode::AddInPort _NodeInPortsSize " << _NodeInPortsSize << " " << anInPort->Kind() << endl ; return anInPort ; } GraphBase::OutPort * GraphBase::PortsOfNode::AddOutPort( CORBA::ORB_ptr ORB , const char * const * NodeName , - const SUPERV::KindOfNode aKind , + const SUPERV::KindOfNode aKindOfNode , const char * OutputParameterName , const char * OutputParameterType , + SUPERV::KindOfPort aKindOfPort , +// const int DataStreamOutPortsNumber , int * Graph_prof_debug , ofstream * Graph_fdebug ) { - cdebug_in << "DefPortsOfNode::AddOutPort : " << *NodeName << " " << aKind << " " - << OutputParameterName << " " << OutputParameterType << endl ; + cdebug_in << "GraphBase::PortsOfNode::AddOutPort : " << *NodeName << " " << aKindOfNode << " OutputParameterName " << OutputParameterName + << " OutputParameterType " << OutputParameterType << " aKindOfPort " << aKindOfPort << " DataStreamOutPortsNumber " << DataStreamOutPortsNumber() + << " _NodeOutPortsSize " << _NodeOutPortsSize << endl ; GraphBase::OutPort * anOutPort = NULL ; - SUPERV::KindOfPort aPortKind = SUPERV::InLineParameter ; + int index = 0 ; anOutPort = GetChangeOutPort( OutputParameterName ) ; if ( anOutPort == NULL ) { _NodeOutPortsSize = _NodeOutPortsSize + 1 ; _NodeOutPorts.resize(_NodeOutPortsSize); SALOME_ModuleCatalog::ServicesParameter aServiceParameter ; - aServiceParameter.Parametername = OutputParameterName ; - aServiceParameter.Parametertype = OutputParameterType ; - if ( aKind != SUPERV::LoopNode && aKind != SUPERV::EndLoopNode ) { -// && aKind != SUPERV::EndSwitchNode ) { - _NodeOutPorts[ _NodeOutPortsSize-1 ] = _NodeOutPorts[ _NodeOutPortsSize-2 ] ; // Gate - Default - _MapOfNodeOutPorts.erase( _NodeOutPorts[ _NodeOutPortsSize-1 ]->PortName() ) ; - _MapOfNodeOutPorts[ _NodeOutPorts[ _NodeOutPortsSize-1 ]->PortName() ] = _NodeOutPortsSize-1 + 1 ; - _MapOfNodeOutPorts[ OutputParameterName ] = _NodeOutPortsSize - 1 ; - _NodeOutPorts[_NodeOutPortsSize-2] = new GraphBase::OutPort( NodeName , - aServiceParameter , - aPortKind ); - _NodeOutPorts[_NodeOutPortsSize-2]->Kind( SUPERV::InLineParameter ) ; -// MESSAGE( "GraphBase::PortsOfNode::DefPortsOfNode " << OutputParameterName << " --> SetDebug" ) ; - _NodeOutPorts[_NodeOutPortsSize-2]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ; - anOutPort = _NodeOutPorts[_NodeOutPortsSize-2] ; - cdebug << "NodeOutPorts[ " << _NodeOutPortsSize-2 << " ]" << endl ; - } - else { // LoopNode || EndLoopNode - _MapOfNodeOutPorts[ OutputParameterName ] = _NodeOutPortsSize ; - _NodeOutPorts[_NodeOutPortsSize-1] = new GraphBase::OutPort( NodeName , - aServiceParameter , - aPortKind ); - _NodeOutPorts[_NodeOutPortsSize-1]->Kind( SUPERV::InLineParameter ) ; -// MESSAGE( "GraphBase::PortsOfNode::DefPortsOfNode " << OutputParameterName << " --> SetDebug" ) ; - _NodeOutPorts[_NodeOutPortsSize-1]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ; - anOutPort = _NodeOutPorts[_NodeOutPortsSize-1] ; - cdebug << "NodeOutPorts[ " << _NodeOutPortsSize-1 << " ]" << endl ; + aServiceParameter.Parametername = CORBA::string_dup( OutputParameterName ) ; + aServiceParameter.Parametertype = CORBA::string_dup( OutputParameterType ) ; + if ( aKindOfPort == SUPERV::DataStreamParameter ) { + index = _NodeOutPortsSize-2 ; + IncrDataStreamOutPorts() ; + } + else { + index = _NodeOutPortsSize-2 - DataStreamOutPortsNumber() ; + } + if ( aKindOfNode == SUPERV::LoopNode || aKindOfNode == SUPERV::EndLoopNode ) { + index += 1 ; + } +// if ( aKindOfNode != SUPERV::LoopNode && aKindOfNode != SUPERV::EndLoopNode ) { + int i ; + for ( i = _NodeOutPortsSize - 2 ; i >= index ; i-- ) { + _NodeOutPorts[ i + 1 ] = _NodeOutPorts[ i ] ; // Gate - Default + _MapOfNodeOutPorts.erase( _NodeOutPorts[ i + 1 ]->PortName() ) ; + _MapOfNodeOutPorts[ _NodeOutPorts[ i + 1 ]->PortName() ] = i + 2 ; + } + _MapOfNodeOutPorts[ OutputParameterName ] = index + 1 ; + if ( aKindOfPort == SUPERV::DataStreamParameter ) { + _NodeOutPorts[index] = new GraphBase::OutDataStreamPort( NodeName , + aServiceParameter ) ; + } + else { + _NodeOutPorts[index] = new GraphBase::OutPort( NodeName , + aServiceParameter , + aKindOfPort ); } +// MESSAGE( "GraphBase::PortsOfNode::AddOutPort " << OutputParameterName << " --> SetDebug" ) ; + _NodeOutPorts[index]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ; + anOutPort = _NodeOutPorts[index] ; + cdebug << "NodeOutPorts[ " << index << " ]" << endl ; } +// else { // LoopNode || EndLoopNode +// _MapOfNodeOutPorts[ OutputParameterName ] = index + 2 ; +// _NodeOutPorts[index + 1] = new GraphBase::OutPort( NodeName , +// aServiceParameter , +// aKindOfPort ); +// MESSAGE( "GraphBase::PortsOfNode::AddOutPort " << OutputParameterName << " --> SetDebug" ) ; +// _NodeOutPorts[index + 1]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ; +// anOutPort = _NodeOutPorts[index + 1] ; +// cdebug << "NodeOutPorts[ " << index + 1 << " ]" << endl ; +// } +// } else { - cdebug << "OutPort already exists" << endl ; + cdebug << "GraphBase::PortsOfNode::AddOutPort OutPort already exists" << endl ; + anOutPort->Kind( aKindOfPort ) ; } - cdebug_out << "DefPortsOfNode::AddOutPort _NodeOutPortsSize " + cdebug << "GraphBase::PortsOfNode::AddOutPort index " << index << " _NodeOutPortsSize " << _NodeOutPortsSize << endl ; + int i ; + for ( i = 0 ; i < _NodeOutPortsSize ; i++ ) { + cdebug << *NodeName << " _NodeOutPorts[ " << i << " ] = " << _NodeOutPorts[ i ]->PortName() + << " _MapOfNodeOutPorts[ " << _NodeOutPorts[ i ]->PortName() << " ] = " + << _MapOfNodeOutPorts[ _NodeOutPorts[ i ]->PortName() ] - 1 << " " + << _NodeOutPorts[ i ]->Kind() << " Dependency " << _NodeOutPorts[ i ]->Dependency() ; + if ( _NodeOutPorts[ i ]->IsDataStream() ) { + cdebug << " NumberOfValues " << ((GraphBase::OutDataStreamPort * ) _NodeOutPorts[ i ])->NumberOfValues() ; + } + cdebug << endl ; + } + cdebug_out << "GraphBase::PortsOfNode::AddOutPort _NodeOutPortsSize " << _NodeOutPortsSize << " " << anOutPort->Kind() << endl ; return anOutPort ; } @@ -370,6 +447,9 @@ void GraphBase::PortsOfNode::DelInPort( const char * InputParameterName ) { cdebug << "DefPortsOfNode::DelInPort : _NodeInPorts[" << index << "] " << _NodeInPorts[ index ]->PortName() << " " << _NodeInPorts[ index ]->NodeName() << endl ; + if ( _NodeInPorts[ index ]->IsDataStream() ) { + DecrDataStreamInPorts() ; + } _MapOfNodeInPorts.erase( InputParameterName ) ; _NodeInPorts[ index ]->destroy() ; int i ; @@ -399,6 +479,9 @@ void GraphBase::PortsOfNode::DelOutPort( const char * OutputParameterName ) { cdebug << "DefPortsOfNode::DelOutPort : _NodeOutPorts[" << index << "] " << _NodeOutPorts[ index ]->PortName() << " " << _NodeOutPorts[ index ]->NodeName() << endl ; + if ( _NodeOutPorts[ index ]->IsDataStream() ) { + DecrDataStreamOutPorts() ; + } _MapOfNodeOutPorts.erase( OutputParameterName ) ; _NodeOutPorts[ index ]->destroy() ; int i ; @@ -442,38 +525,86 @@ const GraphBase::OutPort *GraphBase::PortsOfNode::GetOutPort( const char *name) } GraphBase::InPort *GraphBase::PortsOfNode::GetChangeInPort( const char * name) { -// cdebug_in << "GraphBase::PortsOfNode::GetChangePort " << name <<" " << way -// << endl; +// cdebug_in << "GraphBase::PortsOfNode::GetChangeInPort " << name << endl; GraphBase::InPort * pP = NULL; if ( !_MapOfNodeInPorts.empty() ) { - int i = _MapOfNodeInPorts[ name ] ; -// cout << "GraphBase::PortsOfNode::GetChangeInPort _MapOfNodeInPorts[ " -// << name << " ] : " << i-1 << " " << _NodeInPorts[ i-1 ]->NodeName() -// << endl ; - if ( i > 0 ) + int i = 0 ; + if ( !strcmp( name , "InGate" ) ) { + i = _MapOfNodeInPorts[ "Gate" ] ; + } + else { + i = _MapOfNodeInPorts[ name ] ; + } + if ( i > 0 ) { + cdebug << "GraphBase::PortsOfNode::GetChangeInPort _MapOfNodeInPorts[ " + << name << " ] : " << i-1 << " " << _NodeInPorts[ i-1 ]->NodeName() + << endl ; pP = _NodeInPorts[ i-1 ] ; + } } +// if ( pP == NULL ) { +// int i ; +// for ( i = 0 ; i < _NodeInPortsSize ; i++ ) { +// cdebug << " _NodeInPorts[ " << i << " ] = " << _NodeInPorts[ i ]->PortName() +// << " _MapOfNodeInPorts[ " << _NodeInPorts[ i ]->PortName() << " ] = " +// << _MapOfNodeInPorts[ _NodeInPorts[ i ]->PortName() ] - 1 << " " +// << _NodeInPorts[ i ]->Kind() << " Dependency " << _NodeInPorts[ i ]->Dependency() ; +// if ( _NodeInPorts[ i ]->IsDataStream() ) { +// SUPERV::KindOfSchema aKindOfSchema ; +// SUPERV::KindOfInterpolation aKindOfInterpolation ; +// SUPERV::KindOfExtrapolation aKindOfExtrapolation ; +// ((GraphBase::InDataStreamPort * ) _NodeInPorts[ i ])->Params( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ; +// cdebug << " " << aKindOfSchema << " " << aKindOfInterpolation << " " << aKindOfExtrapolation ; +// } +// if ( !strcmp( _NodeInPorts[ i ]->PortName() , name ) ) { +// cdebug << " ERROR" ; +// } +// cdebug << endl ; +// } +// } // cdebug_out << "GraphBase::PortsOfNode::GetChangeInPort " << endl; return pP; } GraphBase::OutPort *GraphBase::PortsOfNode::GetChangeOutPort( const char * name ) { -// cdebug_in << "GraphBase::PortsOfNode::GetChangePort " << name <<" " << way -// << endl; +// cdebug_in << "GraphBase::PortsOfNode::GetChangeOutPort " << name << endl; GraphBase::OutPort * pP = NULL; if ( !_MapOfNodeOutPorts.empty() ) { - int i = _MapOfNodeOutPorts[ name ] ; -// cout << "GraphBase::PortsOfNode::GetChangeOutPort _MapOfNodeOutPorts[ " -// << name << " ] : " << i-1 << " " << _NodeOutPorts[ i-1 ]->NodeName() -// << endl ; - if ( i > 0 ) + int i = 0 ; + if ( !strcmp( name , "OutGate" ) ) { + i = _MapOfNodeOutPorts[ "Gate" ] ; + } + else { + i = _MapOfNodeOutPorts[ name ] ; + } + if ( i > 0 ) { + cdebug << "GraphBase::PortsOfNode::GetChangeOutPort _MapOfNodeOutPorts[ " + << name << " ] : " << i-1 << " " << _NodeOutPorts[ i-1 ]->NodeName() + << endl ; pP = _NodeOutPorts[ i-1 ] ; + } } // cdebug_out << "GraphBase::PortsOfNode::GetChangeOutPort " << endl; +// if ( pP == NULL ) { +// int i ; +// for ( i = 0 ; i < _NodeOutPortsSize ; i++ ) { +// cdebug << " _NodeOutPorts[ " << i << " ] = " << _NodeOutPorts[ i ]->PortName() +// << " _MapOfNodeOutPorts[ " << _NodeOutPorts[ i ]->PortName() << " ] = " +// << _MapOfNodeOutPorts[ _NodeOutPorts[ i ]->PortName() ] - 1 << " " +// << _NodeOutPorts[ i ]->Kind() << " Dependency " << _NodeOutPorts[ i ]->Dependency() ; +// if ( _NodeOutPorts[ i ]->IsDataStream() ) { +// cdebug << " NumberOfValues " << ((GraphBase::OutDataStreamPort * ) _NodeOutPorts[ i ])->NumberOfValues() ; +// } +// if ( !strcmp( _NodeOutPorts[ i ]->PortName() , name ) ) { +// cdebug << " ERROR" ; +// } +// cdebug << endl ; +// } +// } return pP; } @@ -568,8 +699,11 @@ ostream & operator<< (ostream & f ,const SUPERV::KindOfNode & s ) { case SUPERV::InLineNode : f << "InLineNode"; break; - case SUPERV::DataFlowNode : - f << "DataFlowNode"; + case SUPERV::DataFlowGraph : + f << "DataFlowGraph"; + break; + case SUPERV::DataStreamGraph : + f << "DataStreamGraph"; break; case SUPERV::LoopNode : f << "LoopNode"; diff --git a/src/GraphBase/DataFlowBase_PortsOfNode.hxx b/src/GraphBase/DataFlowBase_PortsOfNode.hxx index 395c81a..de75d7c 100644 --- a/src/GraphBase/DataFlowBase_PortsOfNode.hxx +++ b/src/GraphBase/DataFlowBase_PortsOfNode.hxx @@ -31,8 +31,8 @@ #include "DataFlowBase_Service.hxx" -#include "DataFlowBase_InPort.hxx" -#include "DataFlowBase_OutPort.hxx" +#include "DataFlowBase_InDataStreamPort.hxx" +#include "DataFlowBase_OutDataStreamPort.hxx" namespace GraphBase { @@ -49,6 +49,9 @@ namespace GraphBase { int _NodeOutPortsSize ; vector _NodeOutPorts; + int _DataStreamInPortsNumber ; + int _DataStreamOutPortsNumber ; + public: PortsOfNode() ; @@ -59,10 +62,6 @@ namespace GraphBase { const SALOME_ModuleCatalog::Service& NodeService , const char *const * NodeName , const SUPERV::KindOfNode aKind , -// const bool DataFlowOrComputing , -// const bool WithGateArg , -// const bool WithInGate , -// const bool WithOutGate , int * Graph_prof_debug , ofstream * Graph_fdebug ) ; @@ -71,6 +70,8 @@ namespace GraphBase { const SUPERV::KindOfNode aKind , const char * InputParameterName , const char * InputParameterType , + SUPERV::KindOfPort aKindOfPort , +// const int DataStreamInPortsNumber , int * Graph_prof_debug , ofstream * Graph_fdebug ) ; OutPort * AddOutPort( CORBA::ORB_ptr ORB , @@ -78,13 +79,46 @@ namespace GraphBase { const SUPERV::KindOfNode aKind , const char * OutputParameterName , const char * InputParameterType , + SUPERV::KindOfPort aKindOfPort , +// const int DataStreamOutPortsNumber , int * Graph_prof_debug , ofstream * Graph_fdebug ) ; -// void InOutPort( InPort * InputPort , OutPort * OutputPort ) ; void DelInPort( const char * InputParameterName ) ; void DelOutPort( const char * OutputParameterName ) ; + int IncrDataStreamInPorts() { + _DataStreamInPortsNumber++ ; + return _DataStreamInPortsNumber ; + } ; + int DecrDataStreamInPorts() { + _DataStreamInPortsNumber-- ; + return _DataStreamInPortsNumber ; + } ; + int IncrDataStreamOutPorts() { + _DataStreamOutPortsNumber++ ; + return _DataStreamOutPortsNumber ; + } ; + int DecrDataStreamOutPorts() { + _DataStreamOutPortsNumber-- ; + return _DataStreamOutPortsNumber ; + } ; + int DataStreamInPortsNumber() { + return _DataStreamInPortsNumber ; + } ; + int DataStreamOutPortsNumber() { + return _DataStreamOutPortsNumber ; + } ; + void DataStreamInPortsNumber( int aDataStreamInPortsNumber ) { + _DataStreamInPortsNumber = aDataStreamInPortsNumber ; + } ; + void DataStreamOutPortsNumber(int aDataStreamOutPortsNumber ) { + _DataStreamOutPortsNumber = aDataStreamOutPortsNumber ; + } ; + int HasDataStream() const { + return _DataStreamInPortsNumber + _DataStreamOutPortsNumber ; + } ; + const int GetNodeInPortsSize() const { return _NodeInPortsSize ; } ; const InPort * GetNodeInLoop() const { return _NodeInPorts[0] ; } ; @@ -117,7 +151,6 @@ namespace GraphBase { InPort * GetChangeInPort( const char *name ) ; OutPort * GetChangeOutPort( const char *name ) ; -// void ListPorts( ostream & , const bool klink = true ) const ; void ListPorts( ostream & , const bool klink = true ) const ; }; diff --git a/src/GraphBase/DataFlowBase_Service.cxx b/src/GraphBase/DataFlowBase_Service.cxx index e2c6d00..9bc5788 100644 --- a/src/GraphBase/DataFlowBase_Service.cxx +++ b/src/GraphBase/DataFlowBase_Service.cxx @@ -43,6 +43,19 @@ void GraphBase::Service::SetService( const SALOME_ModuleCatalog::Service aServic _Service.ServiceoutParameter[ i ].Parametertype = CORBA::string_dup( aService.ServiceoutParameter[ i ].Parametertype ) ; _Service.ServiceoutParameter[ i ].Parametername = CORBA::string_dup( aService.ServiceoutParameter[ i ].Parametername ) ; } + + _Service.ServiceinDataStreamParameter.length( aService.ServiceinDataStreamParameter.length() ) ; + _Service.ServiceoutDataStreamParameter.length( aService.ServiceoutDataStreamParameter.length() ) ; + for ( i = 0 ; i < (int ) _Service.ServiceinDataStreamParameter.length() ; i++ ) { + _Service.ServiceinDataStreamParameter[ i ].Parametertype = aService.ServiceinDataStreamParameter[ i ].Parametertype ; + _Service.ServiceinDataStreamParameter[ i ].Parametername = CORBA::string_dup( aService.ServiceinDataStreamParameter[ i ].Parametername ) ; + _Service.ServiceinDataStreamParameter[ i ].Parameterdependency = aService.ServiceinDataStreamParameter[ i ].Parameterdependency ; + } + for ( i = 0 ; i < (int ) _Service.ServiceoutDataStreamParameter.length() ; i++ ) { + _Service.ServiceoutDataStreamParameter[ i ].Parametertype = aService.ServiceoutDataStreamParameter[ i ].Parametertype ; + _Service.ServiceoutDataStreamParameter[ i ].Parametername = CORBA::string_dup( aService.ServiceoutDataStreamParameter[ i ].Parametername ) ; + _Service.ServiceoutDataStreamParameter[ i ].Parameterdependency = aService.ServiceoutDataStreamParameter[ i ].Parameterdependency ; + } cdebug << "GraphBase::Service::SetService : " << _Service << endl ; _Instance = 0 ; } @@ -66,6 +79,24 @@ ostream & operator<< (ostream & f ,const SALOME_ModuleCatalog::Service & s ) { f << ". " << s.ServiceoutParameter[i].Parametername << ". " << s.ServiceoutParameter[i].Parametertype << endl ; } + for ( i = 0 ; i < (int ) s.ServiceinDataStreamParameter.length() ; i++ ) { + if ( i == 0 ) + f << " InStreamparameters " << i ; + else + f << " " << i ; + f << ". " << s.ServiceinDataStreamParameter[i].Parametername + << ". " << s.ServiceinDataStreamParameter[i].Parametertype + << ". " << s.ServiceinDataStreamParameter[i].Parameterdependency << endl ; + } + for ( i = 0 ; i < (int ) s.ServiceoutDataStreamParameter.length() ; i++ ) { + if ( i == 0 ) + f << " OutStreamparameters " << i ; + else + f << " " << i ; + f << ". " << s.ServiceoutDataStreamParameter[i].Parametername + << ". " << s.ServiceoutDataStreamParameter[i].Parametertype + << ". " << s.ServiceoutDataStreamParameter[i].Parameterdependency << endl ; + } return f; } diff --git a/src/GraphBase/DataFlowBase_Service.hxx b/src/GraphBase/DataFlowBase_Service.hxx index e6b7b05..0c4f57a 100644 --- a/src/GraphBase/DataFlowBase_Service.hxx +++ b/src/GraphBase/DataFlowBase_Service.hxx @@ -37,48 +37,51 @@ namespace GraphBase { class Service : public Base { - SALOME_ModuleCatalog::Service _Service ; - int _Instance ; + private: + + SALOME_ModuleCatalog::Service _Service ; + int _Instance ; public: - Service( const SALOME_ModuleCatalog::Service aService ) { + Service( const SALOME_ModuleCatalog::Service aService ) { SetService( aService ) ; // MESSAGE( "GraphBase::Service::Service : " << _Service ) ; // cout << "GraphBase::Service::Service : " << _Service << endl ; cdebug << "GraphBase::Service::Service : " << _Service << endl ; } ; - Service( const char * aServiceName ) { - _Service.ServiceName = CORBA::string_dup( aServiceName ) ; - cdebug << "GraphBase::Service::Service : " << _Service << endl ; - _Instance = 0 ; } ; - virtual ~Service() { - cdebug << "GraphBase::Service::~Service" << endl ; - } ; - - void SetService( const SALOME_ModuleCatalog::Service aService ) ; + Service( const char * aServiceName ) { + _Service.ServiceName = CORBA::string_dup( aServiceName ) ; + cdebug << "GraphBase::Service::Service : " << _Service << endl ; + _Instance = 0 ; } ; + virtual ~Service() { + cdebug << "GraphBase::Service::~Service" << endl ; } ; - const SALOME_ModuleCatalog::Service * GetService() const { - cdebug << "GraphBase::Service::GetService : " << _Service << endl ; - return &_Service ; } ; - const char * ServiceName() const { -// cdebug << "ServiceName " << hex << (void *) _Service.ServiceName -// << dec << " = " << _Service.ServiceName << endl ; - return _Service.ServiceName ; } ; - const SALOME_ModuleCatalog::ListOfServicesParameter ServiceInParameter() const { - return _Service.ServiceinParameter ; } ; - const SALOME_ModuleCatalog::ListOfServicesParameter ServiceOutParameter() const { - return _Service.ServiceoutParameter ; } ; + void SetService( const SALOME_ModuleCatalog::Service aService ) ; - const int Instances() const { return _Instance ; } ; - int NewInstance() { _Instance += 1 ; - return _Instance ; } ; - void Instance( int AddInst = 1 ) { if ( AddInst == 1 ) - _Instance += 1 ; - else - _Instance = AddInst ; } ; + const SALOME_ModuleCatalog::Service * GetService() const { + cdebug << "GraphBase::Service::GetService : " << _Service << endl ; + return &_Service ; } ; + const char * ServiceName() const { +// cdebug << "ServiceName " << hex << (void *) _Service.ServiceName +// << dec << " = " << _Service.ServiceName << endl ; + return _Service.ServiceName ; } ; + const SALOME_ModuleCatalog::ListOfServicesParameter ServiceInParameter() const { + return _Service.ServiceinParameter ; } ; + const SALOME_ModuleCatalog::ListOfServicesParameter ServiceOutParameter() const { + return _Service.ServiceoutParameter ; } ; + const SALOME_ModuleCatalog::ListOfServicesDataStreamParameter ServiceInStreamParameter() const { + return _Service.ServiceinDataStreamParameter ; } ; + const SALOME_ModuleCatalog::ListOfServicesDataStreamParameter ServiceOutStreamParameter() const { + return _Service.ServiceoutDataStreamParameter ; } ; - } ; + const int Instances() const { return _Instance ; } ; + int NewInstance() { _Instance += 1 ; + return _Instance ; } ; + void Instance( int Inst = 1 ) { if ( Inst == 1 ) + _Instance += 1 ; + else + _Instance = Inst ; } ; } ; } ; diff --git a/src/GraphBase/DataFlowBase_ServicesParameter.hxx b/src/GraphBase/DataFlowBase_ServicesParameter.hxx index 786cab9..a14b68a 100644 --- a/src/GraphBase/DataFlowBase_ServicesParameter.hxx +++ b/src/GraphBase/DataFlowBase_ServicesParameter.hxx @@ -33,26 +33,29 @@ namespace GraphBase { class ServicesParameter : public Base { - SALOME_ModuleCatalog::ServicesParameter _ServicesParameter ; + private: + + SALOME_ModuleCatalog::ServicesParameter _ServicesParameter ; public: - ServicesParameter() { + ServicesParameter() { //cout << "ServicesParameter()" << endl ; _ServicesParameter.Parametername = (char *) NULL ; _ServicesParameter.Parametertype = (char *) NULL ; } ; - ServicesParameter( const SALOME_ModuleCatalog::ServicesParameter aserviceParameter ) { - _ServicesParameter = aserviceParameter ; } ; - virtual ~ServicesParameter() { + ServicesParameter( const SALOME_ModuleCatalog::ServicesParameter aserviceParameter ) { + _ServicesParameter.Parametertype = CORBA::string_dup( aserviceParameter.Parametertype ) ; + _ServicesParameter.Parametername = CORBA::string_dup( aserviceParameter.Parametername ) ; } ; + virtual ~ServicesParameter() { // cout << "ServicesParameter::~ServicesParameter()" << endl ; } ; - const SALOME_ModuleCatalog::ServicesParameter & GetServicesParameter() const { - return _ServicesParameter ; } ; - const char * ServicesParameterName() const { - return _ServicesParameter.Parametername ; } ; - const char * ServicesParameterType() const { - return _ServicesParameter.Parametertype ; } ; + const SALOME_ModuleCatalog::ServicesParameter & GetServicesParameter() const { + return _ServicesParameter ; } ; + const char * ServicesParameterName() const { + return _ServicesParameter.Parametername ; } ; + const char * ServicesParameterType() const { + return _ServicesParameter.Parametertype ; } ; } ; diff --git a/src/GraphBase/DataFlowBase_StreamGraph.cxx b/src/GraphBase/DataFlowBase_StreamGraph.cxx new file mode 100644 index 0000000..ff9aaa1 --- /dev/null +++ b/src/GraphBase/DataFlowBase_StreamGraph.cxx @@ -0,0 +1,126 @@ +// SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes. +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : DataFlowBase_StreamGraph.cxx +// Author : Jean Rahuel +// Module : SUPERV +// $Header: + +using namespace std; +#include "DataFlowBase_StreamGraph.hxx" + +#include "SALOME_LifeCycleCORBA.hxx" + +GraphBase::StreamGraph::StreamGraph() : + Graph() { + cdebug << "GraphBase::StreamGraph::StreamGraph" << endl ; +} + +GraphBase::StreamGraph::StreamGraph( CORBA::ORB_ptr ORB , + SALOME_NamingService* ptrNamingService , + const char *DataFlowName , + int * Graph_prof_debug , + ofstream * Graph_fdebug ) : +// const char * DebugFileName ) : +// Graph( ORB ,ptrNamingService , DataFlowName , DebugFileName ) { + Graph( ORB ,ptrNamingService , DataFlowName , Graph_prof_debug , Graph_fdebug ) { + _Timeout = 0 ; + _DataStreamTrace = SUPERV::WithoutTrace ; + _DeltaTime = 0 ; + Kind( SUPERV::DataStreamGraph ) ; + cdebug << "GraphBase::StreamGraph::StreamGraph" << endl ; +} + +GraphBase::StreamGraph::StreamGraph( CORBA::ORB_ptr ORB , + SALOME_NamingService* ptrNamingService , + const SALOME_ModuleCatalog::Service& DataFlowService , + const char *DataFlowComponentName , + const char *DataFlowInterfaceName , + const char *DataFlowName , + const SUPERV::KindOfNode DataFlowkind , + const SUPERV::SDate DataFlowFirstCreation , + const SUPERV::SDate DataFlowLastModification , + const char * DataFlowEditorRelease , + const char * DataFlowAuthor , + const char * DataFlowComputer , + const char * DataFlowComment , + int * Graph_prof_debug , + ofstream * Graph_fdebug ) : +// const char * DebugFileName ) : + Graph( ORB ,ptrNamingService , DataFlowService , DataFlowComponentName , + DataFlowInterfaceName , DataFlowName , DataFlowkind , + DataFlowFirstCreation , DataFlowLastModification , + DataFlowEditorRelease , DataFlowAuthor , DataFlowComputer , + DataFlowComment , Graph_prof_debug , Graph_fdebug ) { +// DataFlowComment , DebugFileName ) { + _Timeout = 0 ; + _DataStreamTrace = SUPERV::WithoutTrace ; + _DeltaTime = 0 ; + cdebug << "GraphBase::StreamGraph::StreamGraph" << endl ; +} + +GraphBase::StreamGraph::~StreamGraph() { + cdebug << "GraphBase::StreamGraph::~StreamGraph" << endl ; +} + +bool GraphBase::StreamGraph::SetStreamParams( const long Timeout , + const SUPERV::KindOfDataStreamTrace DataStreamTrace , + const double DeltaTime ) { + _Timeout = Timeout ; + _DataStreamTrace = DataStreamTrace ; + _DeltaTime = DeltaTime ; + cdebug << "GraphBase::StreamGraph:::SetStreamGraph _Timeout " << _Timeout << " _DataStreamTrace " << _DataStreamTrace << " _DeltaTime " << _DeltaTime + << endl ; + return true ; +} + +void GraphBase::StreamGraph::StreamParams( long & Timeout , + SUPERV::KindOfDataStreamTrace & DataStreamTrace , + double & DeltaTime ) const { + Timeout = _Timeout ; + DataStreamTrace = _DataStreamTrace ; + DeltaTime = _DeltaTime ; + cdebug << "GraphBase::StreamGraph:::StreamGraph _Timeout " << _Timeout << " _DataStreamTrace " << _DataStreamTrace << " _DeltaTime " << _DeltaTime + << endl ; +} + +ostream & operator<< (ostream & f ,const SUPERV::KindOfDataStreamTrace & s ) { + switch (s) { + case SUPERV::WithoutTrace : + f << "WithoutTrace"; + break; + case SUPERV::SummaryTrace : + f << "SummaryTrace"; + break; + case SUPERV::DetailedTrace : + f << "DetailedTrace"; + break; + default : + f << "UndefinedKindOfDataStreamTrace"; + break; + } + + return f; +} + + diff --git a/src/GraphBase/DataFlowBase_StreamGraph.hxx b/src/GraphBase/DataFlowBase_StreamGraph.hxx new file mode 100644 index 0000000..0d7d22f --- /dev/null +++ b/src/GraphBase/DataFlowBase_StreamGraph.hxx @@ -0,0 +1,74 @@ +// SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes. +// +// Copyright (C) 2003 CEA/DEN, EDF R&D +// +// +// +// File : DataFlowBase_StreamGraph.hxx +// Author : Jean Rahuel +// Module : SUPERV +// $Header: + +#ifndef _DATAFLOWBASE_STREAMGRAPH_HXX +#define _DATAFLOWBASE_STREAMGRAPH_HXX + +#include "DataFlowBase_Graph.hxx" + +namespace GraphBase { + + class StreamGraph : public Graph { + + private: + +// Configuration : +// The name is the name of the graph + long _Timeout ; + SUPERV::KindOfDataStreamTrace _DataStreamTrace ; + double _DeltaTime ; + + protected: + + public: + + StreamGraph() ; + + StreamGraph( CORBA::ORB_ptr ORB , + SALOME_NamingService* ptrNamingService , + const char * DataFlowName , + int * Graph_prof_debug , + ofstream * Graph_fdebug ) ; +// const char * DebugFileName ) ; + + StreamGraph( CORBA::ORB_ptr ORB , + SALOME_NamingService * ptrNamingService , + const SALOME_ModuleCatalog::Service & DataFlowService , + const char * DataFlowComponentName , + const char * DataFlowInterfaceName , + const char * DataFlowName , + const SUPERV::KindOfNode DataFlowkind , + const SUPERV::SDate DataFlowFirstCreation , + const SUPERV::SDate DataFlowLastModification , + const char * DataFlowEditorRelease , + const char * DataFlowAuthor , + const char * DataFlowComputer , + const char * DataFlowComment , + int * Graph_prof_debug , + ofstream * Graph_fdebug ) ; +// const char * DebugFileName ) ; + + virtual ~StreamGraph() ; + + virtual bool SetStreamParams( const long Timeout , + const SUPERV::KindOfDataStreamTrace DataStreamTrace , + const double DeltaTime ) ; + virtual void StreamParams( long & Timeout , + SUPERV::KindOfDataStreamTrace & DataStreamTrace , + double & DeltaTime ) const ; + + }; + +}; + +ostream & operator<< (ostream &,const SUPERV::KindOfDataStreamTrace &); + +#endif diff --git a/src/GraphBase/DataFlowBase_StreamNode.cxx b/src/GraphBase/DataFlowBase_StreamNode.cxx new file mode 100644 index 0000000..23f8dec --- /dev/null +++ b/src/GraphBase/DataFlowBase_StreamNode.cxx @@ -0,0 +1,117 @@ +// SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes. +// +// Copyright (C) 2003 CEA/DEN, EDF R&D +// +// +// +// File : DataFlowBase_StreamNode.cxx +// Author : Jean Rahuel +// Module : SUPERV +// $Header: + +using namespace std; + +#include "DataFlowBase_StreamNode.hxx" + +GraphBase::StreamNode::StreamNode() : + GraphBase::PortsOfNode::PortsOfNode() { + _Name = NULL ; + _LinkedNodesSize = 0 ; + cdebug << "GraphBase::StreamNode::StreamNode " << this << " " << endl ; +} + +GraphBase::StreamNode::StreamNode( const char * NodeName ) : + GraphBase::PortsOfNode::PortsOfNode( NodeName ) { + if ( NodeName != NULLSTRING && strlen( NodeName ) ) { + _Name = new char[ strlen( NodeName )+1 ] ; + strcpy( _Name , NodeName ) ; + } + else { + _Name = NULLSTRING ; + } + _LinkedNodesSize = 0 ; + cdebug << "GraphBase::StreamNode::StreamNode " << NodeName << " " + << this << " " << endl ; +} + +GraphBase::StreamNode::~StreamNode() { + cdebug << "GraphBase::StreamNode::~StreamNode " << this << endl ; +} + +bool GraphBase::StreamNode::Name( const char * aName) { + cdebug_in << "GraphBase::StreamNode::Name " << _Name << endl; + if ( _Name ) { + cdebug << "GraphBase::StreamNode::ReName " << _Name << " --> " << aName << endl ; + delete [] _Name ; + } + _Name = new char[strlen(aName)+1] ; + strcpy( _Name , aName ) ; + cdebug_out << "GraphBase::StreamNode::Name " << _Name << endl; + return true ; +} + +void GraphBase::StreamNode::AddLink( GraphBase::StreamNode * ToNode ) { + int index = GetLinkedNodeIndex( ToNode->Name() ) ; + if ( index < 0 ) { + cdebug << Name() << "->GraphBase::StreamNode::AddLinkedNode( " << ToNode->Name() + << " ) new LinkedNode " << endl ; + _LinkedNodes.resize( _LinkedNodesSize+1 ) ; + _LinkedInPortsNumber.resize( _LinkedNodesSize+1 ) ; + _LinkedNodes[ _LinkedNodesSize ] = ToNode ; + _LinkedInPortsNumber[ _LinkedNodesSize ] = 1 ; + SetLinkedNodeIndex( ToNode->Name() , _LinkedNodesSize ) ; + index = _LinkedNodesSize ; + _LinkedNodesSize++ ; + } + else { + cdebug << Name() << "->GraphBase::StreamNode::AddLinkedNode( " << ToNode->Name() + << " ) old LinkedNode " << _LinkedNodes[index ]->Name() << endl ; + _LinkedInPortsNumber[ index ] += 1 ; + } + cdebug << Name() << "->GraphBase::StreamNode::AddLinkedNode( " << ToNode->Name() + << " ) LinkedNodesSize " << _LinkedNodesSize << " [ " << index + << " ] _LinkedInPortsNumber " << _LinkedInPortsNumber[ index ] << endl ; +} + +bool GraphBase::StreamNode::RemoveLink( GraphBase::StreamNode * ToNode ) { + int index = GetLinkedNodeIndex( ToNode->Name() ) ; + if ( index >= 0 ) { + cdebug << "GraphBase::StreamNode::RemoveLink( to " << ToNode->Name() << " from " + << Name() << " index : " << index << " LinkedInPortsNumber " + << _LinkedInPortsNumber[ index ] << " - 1" << endl ; + _LinkedInPortsNumber[ index ] -= 1 ; + if ( _LinkedInPortsNumber[ index ] == 0 ) { + _LinkedNodesSize-- ; + cdebug << "GraphBase::StreamNode::RemoveLink new LinkedNodesSize " + << _LinkedNodesSize << " " << ToNode->Name() << " removed from " + << " linkednodes of " << Name() << endl ; + int i ; + for ( i = index ; i < _LinkedNodesSize ; i++ ) { + _LinkedNodes[ i ] = _LinkedNodes[ i+1 ] ; + _LinkedInPortsNumber[ i ] = _LinkedInPortsNumber[ i+1 ] ; + SetLinkedNodeIndex( _LinkedNodes[ i ]->Name() , i ) ; + } + DelLinkedNodeIndex( ToNode->Name() ) ; + _LinkedNodes.resize( _LinkedNodesSize+1 ) ; + _LinkedInPortsNumber.resize( _LinkedNodesSize+1 ) ; + } + } + else { + cdebug << " Error index " << index << endl ; + } + return (index >= 0 ) ; +} + +void GraphBase::StreamNode::ReNameLink( const char* OldNodeName , + const char* NewNodeName ) { + cdebug_in << "GraphBase::StreamNode::ReNameLink (" << OldNodeName << " , " + << NewNodeName << ")" << endl; + int index = GetLinkedNodeIndex( OldNodeName ) ; + if ( index >= 0 ) { +// _MapOfLinkedNodes.erase( OldNodeName ) ; + DelLinkedNodeIndex( OldNodeName ) ; + SetLinkedNodeIndex( NewNodeName , index ) ; + } + cdebug_out << "GraphBase::StreamNode::ReNameLink" << endl ; +} + diff --git a/src/GraphBase/DataFlowBase_StreamNode.hxx b/src/GraphBase/DataFlowBase_StreamNode.hxx new file mode 100644 index 0000000..f4efee8 --- /dev/null +++ b/src/GraphBase/DataFlowBase_StreamNode.hxx @@ -0,0 +1,137 @@ +// SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes. +// +// Copyright (C) 2003 CEA/DEN, EDF R&D +// +// +// +// File : DataFlowBase_StreamNode.hxx +// Author : Jean Rahuel +// Module : SUPERV +// $Header: + +#ifndef _DATAFLOWBASE_STREAMNODE_HXX +#define _DATAFLOWBASE_STREAMNODE_HXX + +#include "DataFlowBase_PortsOfNode.hxx" + +namespace GraphBase { + + class StreamNode : public PortsOfNode { + + private: + + char * _Name ; + SUPERV::KindOfNode _Kind ; + +// For generated NodeNames with ServiceName : number of Nodes using +// the same ServiceName. It is not the same Service if it belongs to +// a different Interface and/or a different Component ... + map< string , int > _MapOfServiceNames ; + +// Nodes with LinkedInPortsNumber InPort(s) linked to Outport(s) of this node : + map< string , int > _MapOfLinkedNodes ; + int _LinkedNodesSize ; + vector _LinkedNodes ; + vector _LinkedInPortsNumber ; + + protected: + + int * _Graph_prof_debug ; + ofstream * _Graph_fdebug ; + + public: + + StreamNode() ; + + StreamNode( const char * NodeName ) ; + + StreamNode( int * Graph_prof_debug , + ofstream * Graph_fdebug ) ; + + virtual ~StreamNode() ; + + char * Name() const { return my_strdup( _Name ) ; } ; + const char *const * NamePtr() const { return &_Name ; } ; + bool Name( const char * aName ) ; + + SUPERV::KindOfNode Kind() const { + return _Kind; } ; + bool Kind( SUPERV::KindOfNode aKind) { + _Kind = aKind ; + return true ; } ; + const bool IsComputingNode() const { + return (Kind() == SUPERV::ComputingNode ) ; } ; + const bool IsFactoryNode() const { + return (Kind() == SUPERV::FactoryNode ) ; } ; + const bool IsOneOfGOTONodes() const { + return (Kind() == SUPERV::LoopNode || + Kind() == SUPERV::EndLoopNode || + Kind() == SUPERV::SwitchNode || + Kind() == SUPERV::EndSwitchNode || + Kind() == SUPERV::GOTONode ) ; } ; + const bool IsOneOfInLineNodes() const { + return (Kind() == SUPERV::InLineNode || IsOneOfGOTONodes() ) ; } ; + const bool IsInLineNode() const { + return (Kind() == SUPERV::InLineNode ) ; } ; + const bool IsDataFlowNode() const { + return (Kind() == SUPERV::DataFlowGraph ) ; } ; + const bool IsDataStreamNode() const { + return (Kind() == SUPERV::DataStreamGraph ) ; } ; + const bool IsLoopNode() const { + return (Kind() == SUPERV::LoopNode ) ; } ; + const bool IsEndLoopNode() const { + return (Kind() == SUPERV::EndLoopNode ) ; } ; + const bool IsSwitchNode() const { + return (Kind() == SUPERV::SwitchNode ) ; } ; + const bool IsEndSwitchNode() const { + return (Kind() == SUPERV::EndSwitchNode ) ; } ; + const bool IsGOTONode() const { + return (Kind() == SUPERV::GOTONode ) ; } ; + + int GetServiceNameNumber( const char * name ) { + int num = _MapOfServiceNames[ name ] ; + if ( num == 0 ) { + _MapOfServiceNames[ name ] = 1 ; + } + else { + _MapOfServiceNames[ name ] = num + 1 ; + } + return _MapOfServiceNames[ name ] ; } ; + + int GetLinkedNodeIndex( const char * name ) { + int index = _MapOfLinkedNodes[ name ] -1 ; + if ( index >= 0 ) { + cdebug << "GetLinkedNodeIndex of " << name + << " in _MapOfLinkedNodes : " + << index << " Node " << hex << (void *) _LinkedNodes[ index ] + << dec << " '" << _LinkedNodes[ index ]->Name() << "'" + << endl ; + } + return index ; } ; + void SetLinkedNodeIndex( const char * name , const int index ) { + _MapOfLinkedNodes[ name ] = index +1 ; + cdebug << "SetLinkedNodeIndex of " << name << " in _MapOfLinkedNodes : " + << index << " Node " << hex << (void *) _LinkedNodes[ index ] + << dec << " '" << _LinkedNodes[ index ]->Name() << "'" + << " _MapOfLinkedNodes " << _MapOfLinkedNodes[ name ] - 1 + << endl ; + } ; + void DelLinkedNodeIndex( const char * name ) { + _MapOfLinkedNodes.erase( name ) ; } ; + + int LinkedNodesSize() const { return _LinkedNodesSize ; } ; + + const int LinkedInPortsNumber( int i ) const { return _LinkedInPortsNumber[ i ] ; } ; + + StreamNode * LinkedNodes( int i ) const { return _LinkedNodes[ i ] ; } ; + + void AddLink( StreamNode * aNode ) ; + bool RemoveLink( StreamNode * aNode ) ; + void ReNameLink( const char* OldNodeName , + const char* NewNodeName ) ; + + }; + +}; + +#endif diff --git a/src/GraphBase/DataFlowBase_XmlHandler.cxx b/src/GraphBase/DataFlowBase_XmlHandler.cxx index c0c98da..01a298c 100644 --- a/src/GraphBase/DataFlowBase_XmlHandler.cxx +++ b/src/GraphBase/DataFlowBase_XmlHandler.cxx @@ -115,7 +115,7 @@ bool GraphBase::XmlHandler::endElement( const QString&, depth -= 1 ; #if TRACE - MESSAGE( " ==========endElement step[" << depth << "]=" + MESSAGE( " ====================endElement step[" << depth << "]=" << step[depth] << " qName " << qName << " fieldvalue '" << fieldvalue[depth] << "'") #endif @@ -300,12 +300,45 @@ bool GraphBase::XmlHandler::endElement( const QString&, // kind ok sscanf( fieldvalue[depth].c_str() ,"%d" , (int * ) &aNode.theKind ) ; fieldvalue[depth] = NULLSTRING ; + if ( aNode.theKind != SUPERV::DataStreamGraph ) { + step[depth]++ ; + step[4] = 0 ; + } + break ; + } + else if ( qName == "streamgraph-timeout" ) { + if ( fieldvalue[depth] == NULLSTRING ) + return returnfalse( this , "depth3-3" , qName ) ; + sscanf( fieldvalue[depth].c_str() ,"%d" , (int * ) &aNode.theTimeout ) ; + fieldvalue[depth] = NULLSTRING ; +// step[depth]++ ; +// step[4] = 0 ; + break ; + } + else if ( qName == "streamgraph-datastreamtrace" ) { + if ( fieldvalue[depth] == NULLSTRING ) + return returnfalse( this , "depth3-3" , qName ) ; + sscanf( fieldvalue[depth].c_str() ,"%d" , (int * ) &aNode.theDataStreamTrace ) ; + fieldvalue[depth] = NULLSTRING ; +// step[depth]++ ; +// step[4] = 0 ; + break ; + } + else if ( qName == "streamgraph-deltatime" ) { + if ( fieldvalue[depth] == NULLSTRING ) + return returnfalse( this , "depth3-3" , qName ) ; + sscanf( fieldvalue[depth].c_str() ,"%lf" , (int * ) &aNode.theDeltaTime ) ; + fieldvalue[depth] = NULLSTRING ; step[depth]++ ; step[4] = 0 ; + break ; } - else - return returnfalse( this , "depth3-3" , qName ) ; - break ; + else { + step[depth]++ ; + step[4] = 0 ; + } +// return returnfalse( this , "depth3-3" , qName ) ; +// break ; case 4 : if ( qName == "coupled-node" ) { if ( fieldvalue[depth] == NULLSTRING ) @@ -775,7 +808,7 @@ bool GraphBase::XmlHandler::endElement( const QString&, return returnfalse( this , "depth4-6" , qName ) ; int size = aNode.theListOfInDataStreams.size() ; aNode.theListOfInDataStreams.resize( size+1 ) ; - aNode.theListOfInDataStreams[ size ] = aParameter ; + aNode.theListOfInDataStreams[ size ] = anInDataStreamParameter ; break ; // One more aParameter input } @@ -789,7 +822,7 @@ bool GraphBase::XmlHandler::endElement( const QString&, return returnfalse( this , "depth4-7" , qName ) ; int size = aNode.theListOfOutDataStreams.size() ; aNode.theListOfOutDataStreams.resize( size+1 ) ; - aNode.theListOfOutDataStreams[ size ] = aParameter ; + aNode.theListOfOutDataStreams[ size ] = anOutDataStreamParameter ; // One more aParameter output step[4] = 6 ; step[5] = 4 ; @@ -871,14 +904,12 @@ bool GraphBase::XmlHandler::endElement( const QString&, if ( qName == "inParameter-type" ) { if ( fieldvalue[depth] == NULLSTRING ) return returnfalse( this , "depth5-4" , qName ) ; - if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) { - aParameter.Parametertype = fieldvalue[depth].c_str() ; - } - else { - aParameter.Parametertype = "" ; - } + sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theDataStreamParameter.Parametertype ) ; fieldvalue[depth] = NULLSTRING ; step[depth]++ ; +#if TRACE + cout << "InDataStreamParameter.inParameter-type " << anInDataStreamParameter.theDataStreamParameter.Parametertype << " step[" << depth << "]" << step[depth] << endl ; +#endif break ; } else @@ -890,14 +921,69 @@ bool GraphBase::XmlHandler::endElement( const QString&, if ( fieldvalue[depth] == NULLSTRING ) return returnfalse( this , "depth5-5" , qName ) ; if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) { - aParameter.Parametername = fieldvalue[depth].c_str() ; + anInDataStreamParameter.theDataStreamParameter.Parametername = fieldvalue[depth].c_str() ; } else { - aParameter.Parametername = "" ; + anInDataStreamParameter.theDataStreamParameter.Parametername = "" ; } fieldvalue[depth] = NULLSTRING ; +#if TRACE + cout << "InDataStreamParameter.inParameter-name " << anInDataStreamParameter.theDataStreamParameter.Parametername << " step[" << depth << "]" << step[depth] << endl ; +#endif +// step[depth]++ ; +// step[depth] = 4 ; + break ; + } + else if ( qName == "inParameter-dependency" ) { + if ( fieldvalue[depth] == NULLSTRING ) + return returnfalse( this , "depth5-5" , qName ) ; + sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theDataStreamParameter.Parameterdependency ) ; + fieldvalue[depth] = NULLSTRING ; +#if TRACE + cout << "InDataStreamParameter.inParameter-dependency " << anInDataStreamParameter.theDataStreamParameter.Parameterdependency << " step[" << depth << "]" + << step[depth] << endl ; +#endif +// step[depth]++ ; +// step[depth] = 4 ; + break ; + } + else if ( qName == "inParameter-schema" ) { + if ( fieldvalue[depth] == NULLSTRING ) + return returnfalse( this , "depth5-5" , qName ) ; + sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theKindOfSchema ) ; + fieldvalue[depth] = NULLSTRING ; +#if TRACE + cout << "InDataStreamParameter.inParameter-schema " << anInDataStreamParameter.theKindOfSchema << " step[" << depth << "]" + << step[depth] << endl ; +#endif +// step[depth]++ ; +// step[depth] = 4 ; + break ; + } + else if ( qName == "inParameter-interpolation" ) { + if ( fieldvalue[depth] == NULLSTRING ) + return returnfalse( this , "depth5-5" , qName ) ; + sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theKindOfInterpolation ) ; + fieldvalue[depth] = NULLSTRING ; +#if TRACE + cout << "InDataStreamParameter.inParameter-interpolation " << anInDataStreamParameter.theKindOfInterpolation << " step[" << depth << "]" + << step[depth] << endl ; +#endif +// step[depth]++ ; +// step[depth] = 4 ; + break ; + } + else if ( qName == "inParameter-extrapolation" ) { + if ( fieldvalue[depth] == NULLSTRING ) + return returnfalse( this , "depth5-5" , qName ) ; + sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theKindOfExtrapolation ) ; + fieldvalue[depth] = NULLSTRING ; // step[depth]++ ; step[depth] = 4 ; +#if TRACE + cout << "InDataStreamParameter.inParameter-extrapolation " << anInDataStreamParameter.theKindOfExtrapolation << " step[" << depth << "]" + << step[depth] << endl ; +#endif break ; } // else @@ -907,14 +993,14 @@ bool GraphBase::XmlHandler::endElement( const QString&, if ( qName == "outParameter-type" ) { if ( fieldvalue[depth] == NULLSTRING ) return returnfalse( this , "depth5-6" , qName ) ; - if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) { - aParameter.Parametertype = fieldvalue[depth].c_str() ; - } - else { - aParameter.Parametertype = "" ; - } + sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anOutDataStreamParameter.theDataStreamParameter.Parametertype ) ; fieldvalue[depth] = NULLSTRING ; - step[depth]++ ; +// step[depth]++ ; + step[depth] = 7 ; +#if TRACE + cout << "OutDataStreamParameter.outParameter-type " << anOutDataStreamParameter.theDataStreamParameter.Parametertype << " step[" << depth << "]" + << step[depth] << endl ; +#endif } else return returnfalse( this , "depth5-6" , qName ) ; @@ -924,14 +1010,42 @@ bool GraphBase::XmlHandler::endElement( const QString&, if ( fieldvalue[depth] == NULLSTRING ) return returnfalse( this , "depth5-7" , qName ) ; if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) { - aParameter.Parametername = fieldvalue[depth].c_str() ; + anOutDataStreamParameter.theDataStreamParameter.Parametername = fieldvalue[depth].c_str() ; } else { - aParameter.Parametername = "" ; + anOutDataStreamParameter.theDataStreamParameter.Parametername = "" ; } fieldvalue[depth] = NULLSTRING ; +#if TRACE + cout << "OutDataStreamParameter.outParameter-name " << anOutDataStreamParameter.theDataStreamParameter.Parametername << " step[" << depth << "]" + << step[depth] << endl ; +#endif +// step[depth]++ ; +// step[depth] = 6 ; + } + else if ( qName == "outParameter-dependency" ) { + if ( fieldvalue[depth] == NULLSTRING ) + return returnfalse( this , "depth5-7" , qName ) ; + sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anOutDataStreamParameter.theDataStreamParameter.Parameterdependency ) ; + fieldvalue[depth] = NULLSTRING ; +#if TRACE + cout << "OutDataStreamParameter.outParameter-dependency " << anOutDataStreamParameter.theDataStreamParameter.Parameterdependency << " step[" << depth << "]" + << step[depth] << endl ; +#endif +// step[depth]++ ; +// step[depth] = 6 ; + } + else if ( qName == "outParameter-values" ) { + if ( fieldvalue[depth] == NULLSTRING ) + return returnfalse( this , "depth5-7" , qName ) ; + sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anOutDataStreamParameter.theNumberOfValues ) ; + fieldvalue[depth] = NULLSTRING ; // step[depth]++ ; step[depth] = 6 ; +#if TRACE + cout << "OutDataStreamParameter.outParameter-values " << anOutDataStreamParameter.theNumberOfValues << " step[" << depth << "]" + << step[depth] << endl ; +#endif } else return returnfalse( this , "depth5-7" , qName ) ; @@ -1050,6 +1164,9 @@ bool GraphBase::XmlHandler::endElement( const QString&, } } +#if TRACE + cout << "return from endElement " << qName << " step[" << depth << "]" << step[depth] << endl ; +#endif return TRUE; } diff --git a/src/GraphBase/DataFlowBase_XmlHandler.hxx b/src/GraphBase/DataFlowBase_XmlHandler.hxx index 9d00b72..5bfcdb9 100755 --- a/src/GraphBase/DataFlowBase_XmlHandler.hxx +++ b/src/GraphBase/DataFlowBase_XmlHandler.hxx @@ -54,6 +54,9 @@ namespace GraphBase { bool constructor ; GraphBase::SNode aNode ; SALOME_ModuleCatalog::ServicesParameter aParameter ; + GraphBase::InDataStreamParameter anInDataStreamParameter ; + GraphBase::OutDataStreamParameter anOutDataStreamParameter ; +// SALOME_ModuleCatalog::ServicesDataStreamParameter aDataStreamParameter ; SUPERV::ListOfStrings aPythonFunction ; GraphBase::SLink aLink ; // SALOME_SuperVisionBase::ServicesParameterValue aLinkValue ; diff --git a/src/GraphBase/Makefile.in b/src/GraphBase/Makefile.in index 17aec82..ba02798 100644 --- a/src/GraphBase/Makefile.in +++ b/src/GraphBase/Makefile.in @@ -40,9 +40,12 @@ EXPORT_HEADERS = \ DataFlowBase_Port.hxx \ DataFlowBase_DataPort.hxx \ DataFlowBase_InPort.hxx \ + DataFlowBase_InDataStreamPort.hxx \ DataFlowBase_OutPort.hxx \ + DataFlowBase_OutDataStreamPort.hxx \ DataFlowBase_Service.hxx \ DataFlowBase_PortsOfNode.hxx \ + DataFlowBase_StreamNode.hxx \ DataFlowBase_ComputingNode.hxx \ DataFlowBase_FactoryNode.hxx \ DataFlowBase_InLineNode.hxx \ @@ -53,6 +56,7 @@ EXPORT_HEADERS = \ DataFlowBase_EndOfSwitchNode.hxx \ DataFlowBase_DataNode.hxx \ DataFlowBase_XmlHandler.hxx \ + DataFlowBase_StreamGraph.hxx \ DataFlowBase_Graph.hxx # Libraries targets @@ -62,9 +66,12 @@ LIB_SRC = \ DataFlowBase_Port.cxx \ DataFlowBase_DataPort.cxx \ DataFlowBase_InPort.cxx \ + DataFlowBase_InDataStreamPort.cxx \ DataFlowBase_OutPort.cxx \ + DataFlowBase_OutDataStreamPort.cxx \ DataFlowBase_Service.cxx \ DataFlowBase_PortsOfNode.cxx \ + DataFlowBase_StreamNode.cxx \ DataFlowBase_ComputingNode.cxx \ DataFlowBase_FactoryNode.cxx \ DataFlowBase_InLineNode.cxx \ @@ -76,6 +83,7 @@ LIB_SRC = \ DataFlowBase_DataNode.cxx \ DataFlowBase_XmlHandler.cxx \ DataFlowBase_LoadXml.cxx \ + DataFlowBase_StreamGraph.cxx \ DataFlowBase_Graph.cxx LIB_CLIENT_IDL = Logger.idl \ @@ -92,12 +100,11 @@ BIN_SERVER_IDL = CPPFLAGS+= $(PYTHON_INCLUDES) $(QT_MT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) \ -I${KERNEL_ROOT_DIR}/include/salome -#CXXFLAGS= -g -D_DEBUG_ -D__x86__ -D__linux__ -ftemplate-depth-42 CXXFLAGS= -g -D_DEBUG_ -D__x86__ -D__linux__ -ftemplate-depth-42 -Wall \ -I${KERNEL_ROOT_DIR}/include/salome LDFLAGS= -L../../lib/salome $(CORBA_LIBS) -lSalomeNS -lSalomeLifeCycleCORBA -lOpUtil -lSALOMELocalTrace \ -lc $(PYTHON_LIBS) $(QT_MT_LIBS) $(OGL_LIBS) \ -L${KERNEL_ROOT_DIR}/lib/salome -#LDFLAGS= -L../../../lib $(CORBA_LIBS) -lomniORB4 -lomniDynamic4 -lomnithread -lCOS4 -lCOSDynamic4 -lSalomeNS -lSalomeLifeCycleCORBA -lOpUtil -lSalomeLoggerServer -lc $(QT_MT_LIBS) +//LIBS += -Xlinker -export-dynamic $(PYTHON_LIBS) @CONCLUDE@ diff --git a/src/GraphEditor/DataFlowEditor_DataFlow.cxx b/src/GraphEditor/DataFlowEditor_DataFlow.cxx index 73654b3..a02e77d 100644 --- a/src/GraphEditor/DataFlowEditor_DataFlow.cxx +++ b/src/GraphEditor/DataFlowEditor_DataFlow.cxx @@ -46,8 +46,9 @@ GraphEditor::DataFlow::DataFlow() : GraphEditor::DataFlow::DataFlow( CORBA::ORB_ptr ORB, SALOME_NamingService* ptrNamingService , const char *DataFlowName , - const char * DebugFileName ) : - OutNode( ORB, ptrNamingService , DataFlowName , DebugFileName ) { + const char * DebugFileName , + const SUPERV::KindOfNode aKindOfNode ) : + OutNode( ORB, ptrNamingService , DataFlowName , DebugFileName , aKindOfNode ) { // cout << "GraphEditor::DataFlow::DataFlow(" ; cdebug_in << "GraphEditor::DataFlow::DataFlow(" ; if ( DataFlowName ) { diff --git a/src/GraphEditor/DataFlowEditor_DataFlow.hxx b/src/GraphEditor/DataFlowEditor_DataFlow.hxx index 23e65b1..f5bd037 100644 --- a/src/GraphEditor/DataFlowEditor_DataFlow.hxx +++ b/src/GraphEditor/DataFlowEditor_DataFlow.hxx @@ -49,7 +49,8 @@ namespace GraphEditor { DataFlow(); DataFlow( CORBA::ORB_ptr ORB, SALOME_NamingService * ptrNamingService , const char * DataFlowName , - const char * DebugFileName ); + const char * DebugFileName , + const SUPERV::KindOfNode aKindOfNode ); DataFlow( CORBA::ORB_ptr ORB, SALOME_NamingService * ptrNamingService , const SALOME_ModuleCatalog::Service& DataFlowService , const char * DataFlowComponentName , diff --git a/src/GraphEditor/DataFlowEditor_DataFlow.lxx b/src/GraphEditor/DataFlowEditor_DataFlow.lxx index 1a783e8..46575c6 100644 --- a/src/GraphEditor/DataFlowEditor_DataFlow.lxx +++ b/src/GraphEditor/DataFlowEditor_DataFlow.lxx @@ -44,14 +44,14 @@ inline char * GraphEditor::DataFlow::DataFlowInfo() { inline char * GraphEditor::DataFlow::DataNodeInfo() { ostringstream s; IsValid() ; - GraphBase::DataNode::DataNodeInfo( s ) ; + Graph()->DataNodeInfo( s ) ; return CORBA::string_dup( s.str().c_str() ); } inline char * GraphEditor::DataFlow::NodeInfo( const char * aNodeName ) { ostringstream s; - if ( GetGraphNode( aNodeName ) ) - GetGraphNode( aNodeName )->NodeInfo( s ) ; + if ( Graph()->GetGraphNode( aNodeName ) ) + Graph()->GetGraphNode( aNodeName )->NodeInfo( s ) ; else s << aNodeName << " not found" << ends ; return CORBA::string_dup( s.str().c_str() ); @@ -93,29 +93,29 @@ inline GraphBase::SGraph * GraphEditor::DataFlow::GetDataFlow() { // void DateModification() ; -inline GraphBase::SNode * GraphEditor::DataFlow::GetInfo() const { - return GraphEditor::OutNode::GetInfo() ; -} ; +//inline GraphBase::SNode * GraphEditor::DataFlow::GetInfo() const { +// return GraphEditor::OutNode::GetInfo() ; +//} ; inline GraphBase::ListOfNodes * GraphEditor::DataFlow::GetNodes() const { - return GraphEditor::OutNode::GetNodes() ; + return Graph()->GetNodes() ; } ; inline GraphBase::ListOfLinks * GraphEditor::DataFlow::GetLinks() const { - return GraphEditor::OutNode::GetLinks() ; + return Graph()->GetLinks() ; } ; inline GraphBase::ListOfGraphs * GraphEditor::DataFlow::GetGraphs() const { - return GraphEditor::OutNode::GetGraphs() ; + return Graph()->GetGraphs() ; } ; inline GraphBase::ListOfLinks * GraphEditor::DataFlow::GetDatas() const { - return GraphEditor::OutNode::GetDatas() ; + return Graph()->GetDatas() ; } ; inline const SALOME_ModuleCatalog::Service * GraphEditor::DataFlow::GetService() { IsValid() ; - return GraphEditor::OutNode::GetService() ; + return Graph()->GetService() ; } ; inline GraphEditor::InNode * GraphEditor::DataFlow::AddNode( @@ -188,8 +188,8 @@ inline bool GraphEditor::DataFlow::ReNameNode( const char* OldNodeName , inline const SALOME_ModuleCatalog::Service * GraphEditor::DataFlow::NodeService( const char * aNodeName ) { - if ( GetGraphNode( aNodeName ) ) { - return GetGraphNode( aNodeName )->GetService() ; + if ( Graph()->GetGraphNode( aNodeName ) ) { + return Graph()->GetGraphNode( aNodeName )->GetService() ; } return NULL ; } @@ -242,16 +242,22 @@ inline bool GraphEditor::DataFlow::AddLink( const char* FromNodeName , const char* ToNodeName , const char* ToServiceParameterName , const CORBA::Any aValue ) { - if ( _ReadOnly ) { - return false ; + if ( !_ReadOnly ) { + GraphEditor::InNode * aFromNode = GetNode( FromNodeName ) ; + if ( aFromNode ) { + GraphBase::OutPort * anOutPort = aFromNode->GetChangeOutPort( FromServiceParameterName ) ; + if ( anOutPort ) { + CORBA::Any const * theValue = anOutPort->Value() ; // Keep the type ! + _EditedAfterExecution = true ; + return GraphEditor::OutNode::AddLink( FromNodeName , + FromServiceParameterName , + ToNodeName , + ToServiceParameterName , + *theValue ) ; + } + } } - CORBA::Any const * theValue = GetNode( FromNodeName )->GetOutPort( FromServiceParameterName )->Value() ; // Keep the type ! - _EditedAfterExecution = true ; - return GraphEditor::OutNode::AddLink( FromNodeName , - FromServiceParameterName , - ToNodeName , - ToServiceParameterName , - *theValue ) ; + return false ; } ; inline bool GraphEditor::DataFlow::GetLink(const char* ToNodeName , @@ -266,8 +272,7 @@ inline bool GraphEditor::DataFlow::GetLink(const char* ToNodeName , inline GraphBase::SLink * GraphEditor::DataFlow::GetLink( GraphBase::ComputingNode * aNode , const char* ToServiceParameterName ) { - return GraphBase::Graph::GetLink( aNode , - aNode->GetChangeInPort( ToServiceParameterName ) ) ; + return Graph()->GetLink( aNode , aNode->GetChangeInPort( ToServiceParameterName ) ) ; } inline bool GraphEditor::DataFlow::AddLinkCoord( @@ -410,8 +415,7 @@ inline bool GraphEditor::DataFlow::AddInputData( const char* ToNodeName , if ( !IsValid() ) { return false ; } - return GraphBase::Graph::AddInputData( ToNodeName , ToParameterName , - aValue ) ; + return Graph()->AddInputData( ToNodeName , ToParameterName , aValue ) ; } ; inline bool GraphEditor::DataFlow::AddInputSharedData(const char* ToNodeName1 , @@ -481,28 +485,28 @@ inline long GraphEditor::DataFlow::LevelMax() { if ( !IsValid() ) { return 0 ; } - return GraphBase::Graph::LevelMax() ; + return Graph()->LevelMax() ; } inline SUPERV::ListOfStrings * GraphEditor::DataFlow::LevelNodes(long aLevel ) { if ( !IsValid() ) { return ((SUPERV::ListOfStrings * ) NULL ) ; } - return GraphBase::Graph::LevelNodes( aLevel ) ; + return Graph()->LevelNodes( aLevel ) ; } inline long GraphEditor::DataFlow::ThreadsMax() { if ( !IsValid() ) { return 0 ; } - return GraphBase::Graph::ThreadsMax() ; + return Graph()->ThreadsMax() ; } inline long GraphEditor::DataFlow::GraphsNumber() { if ( !IsValid() ) { return 0 ; } - return GraphBase::Graph::GraphsNumber() ; + return Graph()->GraphsNumber() ; } inline void GraphEditor::DataFlow::Executor( diff --git a/src/GraphEditor/DataFlowEditor_InNode.cxx b/src/GraphEditor/DataFlowEditor_InNode.cxx index 28044aa..4dee936 100644 --- a/src/GraphEditor/DataFlowEditor_InNode.cxx +++ b/src/GraphEditor/DataFlowEditor_InNode.cxx @@ -191,8 +191,11 @@ GraphEditor::InNode::InNode( CORBA::ORB_ptr ORB, _InLineNode = (GraphBase::InLineNode *) _ComputingNode ; break ; } - case SUPERV::DataFlowNode : { - cdebug << "GraphEditor::InNode::InNode ERROR SUPERV::DataFlowNode : " << NodeName << endl ; + case SUPERV::DataFlowGraph : { + cdebug << "GraphEditor::InNode::InNode ERROR SUPERV::DataFlowGraph : " << NodeName << endl ; + } + case SUPERV::DataStreamGraph : { + cdebug << "GraphEditor::InNode::InNode ERROR SUPERV::DataStreamGraph : " << NodeName << endl ; } case SUPERV::UnknownNode : { cdebug << "GraphEditor::InNode::InNode ERROR SUPERV::UnknownNode : " << NodeName << endl ; diff --git a/src/GraphEditor/DataFlowEditor_InNode.hxx b/src/GraphEditor/DataFlowEditor_InNode.hxx index fb6fbe8..69c0ea1 100644 --- a/src/GraphEditor/DataFlowEditor_InNode.hxx +++ b/src/GraphEditor/DataFlowEditor_InNode.hxx @@ -92,6 +92,8 @@ namespace GraphEditor { return _ComputingNode->IsOneOfGOTONodes() ; } ; const bool IsDataFlowNode() const { return _ComputingNode->IsDataFlowNode() ; } ; + const bool IsDataStreamNode() const { + return _ComputingNode->IsDataStreamNode() ; } ; const bool IsGOTONode() const { return _ComputingNode->IsGOTONode() ; } ; const bool IsLoopNode() const { @@ -183,13 +185,17 @@ namespace GraphEditor { return _ComputingNode->GetInfo() ; } ; GraphBase::InPort * AddInPort( const char * InputParameterName , - const char * InputParameterType ) { + const char * InputParameterType , + const SUPERV::KindOfPort aKindOfPort ) { return _ComputingNode->AddInPort( InputParameterName , - InputParameterType ) ; } ; + InputParameterType , + aKindOfPort ) ; } ; GraphBase::OutPort * AddOutPort( const char * OutputParameterName , - const char * OutputParameterType ) { + const char * OutputParameterType , + const SUPERV::KindOfPort aKindOfPort ) { return _ComputingNode->AddOutPort( OutputParameterName , - OutputParameterType ) ; } ; + OutputParameterType , + aKindOfPort ) ; } ; int IncrDataStreamInPorts() { return _ComputingNode->IncrDataStreamInPorts() ; } ; diff --git a/src/GraphEditor/DataFlowEditor_OutNode.cxx b/src/GraphEditor/DataFlowEditor_OutNode.cxx index 191ea06..35f240a 100644 --- a/src/GraphEditor/DataFlowEditor_OutNode.cxx +++ b/src/GraphEditor/DataFlowEditor_OutNode.cxx @@ -33,8 +33,8 @@ using namespace std; // Implementation de la classe GraphEditor::Graph -GraphEditor::OutNode::OutNode() : - Graph() { +GraphEditor::OutNode::OutNode() { +// Graph() { cdebug_in << "GraphEditor::OutNode::OutNode()" << endl; _Imported = false ; @@ -47,14 +47,28 @@ GraphEditor::OutNode::OutNode() : GraphEditor::OutNode::OutNode( CORBA::ORB_ptr ORB , SALOME_NamingService * ptrNamingService , const char * DataFlowName , - const char * DebugFileName ) : - Graph( ORB , ptrNamingService , DataFlowName , DebugFileName ) { + const char * DebugFileName , + const SUPERV::KindOfNode aKindOfNode ) { +// Graph( ORB , ptrNamingService , DataFlowName , DebugFileName ) { + Set_prof_debug( ORB , DebugFileName ) ; cdebug_in << "GraphEditor::OutNode::OutNode(" ; if ( DataFlowName ) { cdebug << DataFlowName ; } cdebug << ")" << endl; + if ( aKindOfNode == SUPERV::DataFlowGraph ) { + _StreamGraph = NULL ; +// _Graph = new GraphBase::Graph( ORB , ptrNamingService , DataFlowName , DebugFileName ) ; + _Graph = new GraphBase::Graph( ORB , ptrNamingService , DataFlowName , + _prof_debug , _fdebug ) ; + } + else if ( aKindOfNode == SUPERV::DataStreamGraph ) { +// _StreamGraph = new GraphBase::StreamGraph( ORB , ptrNamingService , DataFlowName , DebugFileName ) ;; + _StreamGraph = new GraphBase::StreamGraph( ORB , ptrNamingService , DataFlowName , + _prof_debug , _fdebug ) ; + _Graph = _StreamGraph ; + } _Orb = CORBA::ORB::_duplicate( ORB ) ; _Imported = false ; _Valid = false ; @@ -77,13 +91,34 @@ GraphEditor::OutNode::OutNode( const char * DataFlowAuthor , const char * DataFlowComputer , const char * DataFlowComment , - const char * DebugFileName ) : - Graph( ORB , ptrNamingService , DataFlowService , DataFlowComponentName , - DataFlowInterfaceName , DataFlowName , DataFlowkind , - DataFlowFirstCreation , DataFlowLastModification , - DataFlowEditorRelease , DataFlowAuthor , - DataFlowComputer , DataFlowComment , DebugFileName ) { - + const char * DebugFileName ) { +// Graph( ORB , ptrNamingService , DataFlowService , DataFlowComponentName , +// DataFlowInterfaceName , DataFlowName , DataFlowkind , +// DataFlowFirstCreation , DataFlowLastModification , +// DataFlowEditorRelease , DataFlowAuthor , +// DataFlowComputer , DataFlowComment , DebugFileName ) { + Set_prof_debug( ORB , DebugFileName ) ; + + if ( DataFlowkind == SUPERV::DataFlowGraph ) { + _StreamGraph = NULL ; + _Graph = new GraphBase::Graph( ORB , ptrNamingService , DataFlowService , DataFlowComponentName , + DataFlowInterfaceName , DataFlowName , DataFlowkind , + DataFlowFirstCreation , DataFlowLastModification , + DataFlowEditorRelease , DataFlowAuthor , + DataFlowComputer , DataFlowComment , + _prof_debug , _fdebug ) ; +// DataFlowComputer , DataFlowComment , DebugFileName ) ; + } + else if ( DataFlowkind == SUPERV::DataStreamGraph ) { + _StreamGraph = new GraphBase::StreamGraph( ORB , ptrNamingService , DataFlowService , DataFlowComponentName , + DataFlowInterfaceName , DataFlowName , DataFlowkind , + DataFlowFirstCreation , DataFlowLastModification , + DataFlowEditorRelease , DataFlowAuthor , + DataFlowComputer , DataFlowComment , + _prof_debug , _fdebug ) ; +// DataFlowComputer , DataFlowComment , DebugFileName ) ; + _Graph = _StreamGraph ; + } _Orb = CORBA::ORB::_duplicate( ORB ) ; _Imported = false ; _Valid = false ; @@ -97,28 +132,45 @@ GraphEditor::OutNode::~OutNode() { // delete _GT ; } +void GraphEditor::OutNode::Set_prof_debug( CORBA::ORB_ptr ORB , + const char * DebugFileName ) { + _Graph_prof_debug = 0 ; + _prof_debug = 0 ; + if ( DebugFileName ) { + _fdebug = new ofstream( DebugFileName ); + SetDebug( ORB , &_Graph_prof_debug , _fdebug ) ; + MESSAGE( endl << "Trace redirected to file " << DebugFileName << endl) + } +} + bool GraphEditor::OutNode::LoadDataFlow( const GraphBase::SGraph *aDataFlow ) { bool RetVal = false ; cdebug_in << "GraphEditor::OutNode::LoadDataFlow() " << aDataFlow->Info.theName.c_str() - << endl; + << " GraphNodesSize " << Graph()->GraphNodesSize() << endl; if ( !_Imported ) { RetVal = LoadInfo( aDataFlow->Info ) ; _Imported = true ; } - else { + else if ( aDataFlow->Info.theKind == Graph()->Kind() ) { RetVal = true ; } + cdebug << "GraphEditor::OutNode::LoadDataFlow() _Imported " << _Imported << " RetVal " << RetVal << endl; map< string , int > aMapOfNodes ; - if ( RetVal ) + if ( RetVal ) { + cdebug << "GraphEditor::OutNode::LoadDataFlow() LoadNodes GraphNodesSize " << Graph()->GraphNodesSize() << endl; RetVal = LoadNodes( aMapOfNodes , aDataFlow->Nodes ) ; - if ( RetVal ) + } + if ( RetVal ) { + cdebug << "GraphEditor::OutNode::LoadDataFlow() LoadLinks GraphNodesSize " << Graph()->GraphNodesSize() << endl; RetVal = LoadLinks( aMapOfNodes , aDataFlow->Links ) ; + } if ( RetVal ) { Valid() ; + cdebug << "GraphEditor::OutNode::LoadDataFlow() LoadDatas GraphNodesSize " << Graph()->GraphNodesSize() << endl; RetVal = LoadDatas( aMapOfNodes , aDataFlow->Datas ) ; } - cdebug_out << "GraphEditor::OutNode::LoadDataFlow" << endl; + cdebug_out << "GraphEditor::OutNode::LoadDataFlow done GraphNodesSize " << Graph()->GraphNodesSize() << endl; return RetVal ; } @@ -130,7 +182,7 @@ bool GraphEditor::OutNode::LoadXml( const char* myFileName ) { _Imported = true ; RetVal = true ; } - else if ( GraphBase::Graph::LoadXml( _Orb , myFileName , aDataFlow ) ) { + else if ( Graph()->LoadXml( _Orb , myFileName , aDataFlow ) ) { cdebug_in << "GraphEditor::OutNode::LoadXml() " << endl; RetVal = LoadDataFlow( &aDataFlow ) ; cdebug_out << "GraphEditor::OutNode::LoadXml " << RetVal << endl; @@ -139,41 +191,67 @@ bool GraphEditor::OutNode::LoadXml( const char* myFileName ) { } bool GraphEditor::OutNode::LoadInfo(const GraphBase::SNode &aDataFlowInfo ) { + bool RetVal = false ; cdebug_in << "GraphEditor::OutNode::LoadInfo " << aDataFlowInfo.theName.c_str() << endl ; // MESSAGE( "GraphEditor::OutNode::LoadDataFlow" ); // ComponentName( aDataFlowInfo.theComponentName.c_str() ) ; // InterfaceName( aDataFlowInfo.theInterfaceName.c_str() ) ; - Name( aDataFlowInfo.theName.c_str() ) ; - Kind( aDataFlowInfo.theKind ) ; - Service( aDataFlowInfo.theService ) ; - FirstCreation( aDataFlowInfo.theFirstCreation ) ; - LastModification( aDataFlowInfo.theLastModification ) ; - EditorRelease( aDataFlowInfo.theEditorRelease.c_str() ) ; - Author( aDataFlowInfo.theAuthor.c_str() ) ; -// Computer( aDataFlowInfo.theContainer.c_str() ) ; - Comment( aDataFlowInfo.theComment.c_str() ) ; + if ( Graph()->IsDataStreamNode() || aDataFlowInfo.theKind == SUPERV::DataFlowGraph ) { + Graph()->Name( aDataFlowInfo.theName.c_str() ) ; +// Graph()->Kind( aDataFlowInfo.theKind ) ; + cdebug << "GraphEditor::OutNode::LoadInfo aDataFlowInfo.Kind " << aDataFlowInfo.theKind + << " Kind() " << Graph()->Kind() << endl ; + if ( Graph()->IsDataStreamNode() ) { + Graph()->Kind( SUPERV::DataStreamGraph ) ; + StreamGraph()->SetStreamParams( aDataFlowInfo.theTimeout , aDataFlowInfo.theDataStreamTrace , aDataFlowInfo.theDeltaTime ) ; + } + else { + Graph()->Kind( SUPERV::DataFlowGraph ) ; + } + Graph()->SetService( aDataFlowInfo.theService ) ; + Graph()->FirstCreation( aDataFlowInfo.theFirstCreation ) ; + Graph()->LastModification( aDataFlowInfo.theLastModification ) ; + Graph()->EditorRelease( aDataFlowInfo.theEditorRelease.c_str() ) ; + Graph()->Author( aDataFlowInfo.theAuthor.c_str() ) ; +// Graph()->Computer( aDataFlowInfo.theContainer.c_str() ) ; + Graph()->Comment( aDataFlowInfo.theComment.c_str() ) ; // Not in OutNode/DataFlow but in InNode/DataFlow_in_an_other_DataFlow -// Coordinates( aDataFlowInfo.theX , aDataFlowInfo.theY ) ; - cdebug_out << "GraphEditor::OutNode::LoadInfo" << endl ; - return true ; +// Graph()->Coordinates( aDataFlowInfo.theX , aDataFlowInfo.theY ) ; + RetVal = true ; + } + else { + Graph()->Kind( aDataFlowInfo.theKind ) ; + cdebug << "GraphEditor::OutNode::LoadInfo aDataFlowInfo.Kind " << aDataFlowInfo.theKind + << " != IsDataStreamNode() " << Graph()->IsDataStreamNode() << endl ; + } + cdebug_out << "GraphEditor::OutNode::LoadInfo " << RetVal << endl ; + return RetVal ; } bool GraphEditor::OutNode::LoadNodes(map< string , int > & aMapOfNodes , const GraphBase::ListOfNodes &aListOfNodes ) { GraphEditor::InNode * anInNode ; - cdebug_in << "GraphEditor::OutNode::LoadNodes" << endl ; + cdebug_in << "GraphEditor::OutNode::LoadNodes " << endl ; int i ; for ( i = 0 ; i < (int ) aListOfNodes.size() ; i++ ) { GraphBase::SNode aNode = aListOfNodes[ i ] ; const char * aNodeName = aNode.theName.c_str() ; + cout << "GraphEditor::OutNode::LoadNodes " << aNodeName << " " + << aNode.theListOfInDataStreams.size() << " InDataStreams " + << aNode.theListOfOutDataStreams.size() << " OutDataStreams " + << " _prof_debug " << _prof_debug << endl ; + cdebug << "GraphEditor::OutNode::LoadNodes " << aNodeName << " " + << aNode.theListOfInDataStreams.size() << " InDataStreams " + << aNode.theListOfOutDataStreams.size() << " OutDataStreams " + << endl ; if ( aNode.theListOfFuncName.size() == 0 ) { aNode.theListOfFuncName.resize( 1 ) ; aNode.theListOfFuncName[ 0 ] = "" ; aNode.theListOfPythonFunctions.resize( 1 ) ; aNode.theListOfPythonFunctions[ 0 ] = new SUPERV::ListOfStrings() ; } - if ( GetGraphNode( aNode.theName.c_str() ) ) { + if ( Graph()->GetGraphNode( aNode.theName.c_str() ) ) { aNodeName = NULL ; } anInNode = AddNode( aNode.theService , @@ -188,12 +266,12 @@ bool GraphEditor::OutNode::LoadNodes(map< string , int > & aMapOfNodes , aNode.theComment.c_str() , aNode.theCoords.theX , aNode.theCoords.theY ) ; string * aNodetheName = new string( aNode.theName ) ; - aMapOfNodes[ *aNodetheName ] = GetGraphNodeIndex( anInNode->Name() ) ; + aMapOfNodes[ *aNodetheName ] = Graph()->GetGraphNodeIndex( anInNode->Name() ) ; if ( anInNode->IsOneOfInLineNodes() ) { anInNode->GraphEditor::InNode::InLineNode()->DefPortsOfNode( _Orb , aNode.theService , anInNode->NamePtr() , anInNode->Kind() , - Graph_prof_debug() , Graph_fdebug() ) ; + _prof_debug , _fdebug ) ; GraphBase::InLineNode * aINode = anInNode->InLineNode() ; GraphBase::LoopNode * aLNode = NULL ; if ( aINode->IsLoopNode() ) { @@ -214,17 +292,21 @@ bool GraphEditor::OutNode::LoadNodes(map< string , int > & aMapOfNodes , unsigned int j ; for ( j = 0 ; j < aNode.theListOfInDataStreams.size() ; j++ ) { GraphBase::InPort * anInPort ; - anInPort = anInNode->AddInPort( aNode.theListOfInDataStreams[ j ].Parametername , - aNode.theListOfInDataStreams[ j ].Parametertype ) ; - anInPort->Kind( SUPERV::DataStreamParameter ) ; - anInNode->IncrDataStreamInPorts() ; + anInPort = anInNode->ComputingNode()->AddInDataStreamPort( aNode.theListOfInDataStreams[ j ].theDataStreamParameter.Parametername , + aNode.theListOfInDataStreams[ j ].theDataStreamParameter.Parametertype , + aNode.theListOfInDataStreams[ j ].theDataStreamParameter.Parameterdependency , + SUPERV::DataStreamParameter ) ; + ((GraphBase::InDataStreamPort * ) anInPort)->SetParams( aNode.theListOfInDataStreams[ j ].theKindOfSchema , + aNode.theListOfInDataStreams[ j ].theKindOfInterpolation , + aNode.theListOfInDataStreams[ j ].theKindOfExtrapolation ) ; } for ( j = 0 ; j < aNode.theListOfOutDataStreams.size() ; j++ ) { GraphBase::OutPort * anOutPort ; - anOutPort = anInNode->AddOutPort( aNode.theListOfOutDataStreams[ j ].Parametername , - aNode.theListOfOutDataStreams[ j ].Parametertype ) ; - anOutPort->Kind( SUPERV::DataStreamParameter ) ; - anInNode->IncrDataStreamOutPorts() ; + anOutPort = anInNode->ComputingNode()->AddOutDataStreamPort( aNode.theListOfOutDataStreams[ j ].theDataStreamParameter.Parametername , + aNode.theListOfOutDataStreams[ j ].theDataStreamParameter.Parametertype , + aNode.theListOfOutDataStreams[ j ].theDataStreamParameter.Parameterdependency , + SUPERV::DataStreamParameter ) ; + ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues( aNode.theListOfOutDataStreams[ j ].theNumberOfValues ) ; } delete aNodetheName ; if ( !anInNode ) { @@ -235,11 +317,11 @@ bool GraphEditor::OutNode::LoadNodes(map< string , int > & aMapOfNodes , GraphBase::SNode aNode = aListOfNodes[ i ] ; cdebug << "GraphEditor::OutNode::LoadNodes " << aNode.theName.c_str() << " Coupled to " << aNode.theCoupledNode.c_str() << endl ; - anInNode = (GraphEditor::InNode * ) GetChangeGraphNode( aNode.theName.c_str() )->GetInNode() ; + anInNode = (GraphEditor::InNode * ) Graph()->GetChangeGraphNode( aNode.theName.c_str() )->GetInNode() ; if ( anInNode->IsOneOfGOTONodes() && strlen( aNode.theCoupledNode.c_str() ) ) { GraphBase::GOTONode * aCoupledNode ; - aCoupledNode = (GraphBase::GOTONode * ) GetGraphNode( aNode.theName.c_str() ) ; - aCoupledNode->CoupledNode( (GraphBase::GOTONode * ) GetChangeGraphNode( aNode.theCoupledNode.c_str() ) ) ; + aCoupledNode = (GraphBase::GOTONode * ) Graph()->GetGraphNode( aNode.theName.c_str() ) ; + aCoupledNode->CoupledNode( (GraphBase::GOTONode * ) Graph()->GetChangeGraphNode( aNode.theCoupledNode.c_str() ) ) ; } } cdebug_out << "GraphEditor::OutNode::LoadNodes" << endl ; @@ -260,13 +342,15 @@ bool GraphEditor::OutNode::LoadLinks(map< string , int > & aMapOfNodes , << aLink.FromServiceParameterName.c_str() << " ) --> " << aLinkToNodeName->c_str() << "( " << aLink.ToServiceParameterName.c_str() << " )" << endl ; - if ( GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] ) && - GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] ) ) { - RetVal = AddLink( GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() , - aLink.FromServiceParameterName.c_str() , - GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() , - aLink.ToServiceParameterName.c_str() , - *((GraphBase::ComputingNode *) GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] ))->GetOutPort( aLink.FromServiceParameterName.c_str() )->Value() ) ; + if ( Graph()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] ) && + Graph()->GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] ) ) { + GraphBase::ComputingNode * aFromNode = (GraphBase::ComputingNode * ) Graph()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] ) ; + const GraphBase::OutPort * anOutPort = aFromNode->GetOutPort( aLink.FromServiceParameterName.c_str() ) ; + RetVal = AddLink( Graph()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() , + aLink.FromServiceParameterName.c_str() , + Graph()->GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() , + aLink.ToServiceParameterName.c_str() , + *anOutPort->Value() ) ; } else { RetVal = false ; @@ -276,13 +360,13 @@ bool GraphEditor::OutNode::LoadLinks(map< string , int > & aMapOfNodes , break ; else { for ( j = 0 ; j < (int ) aLink.aListOfCoords.size() ; j++ ) { - RetVal = AddLinkCoord( GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() , - aLink.FromServiceParameterName.c_str() , - GetGraphNode( aMapOfNodes[ aLink.ToNodeName.c_str() ] )->Name() , - aLink.ToServiceParameterName.c_str() , - j + 1 , - aLink.aListOfCoords[j].theX , - aLink.aListOfCoords[j].theY ) ; + RetVal = AddLinkCoord( Graph()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() , + aLink.FromServiceParameterName.c_str() , + Graph()->GetGraphNode( aMapOfNodes[ aLink.ToNodeName.c_str() ] )->Name() , + aLink.ToServiceParameterName.c_str() , + j + 1 , + aLink.aListOfCoords[j].theX , + aLink.aListOfCoords[j].theY ) ; if ( !RetVal ) break ; } @@ -302,10 +386,10 @@ bool GraphEditor::OutNode::LoadDatas(map< string , int > & aMapOfNodes , int i ; for ( i = 0 ; i < (int ) aListOfDatas.size() ; i++ ) { GraphBase::SLink aLink = aListOfDatas[ i ] ; - if ( !strcmp( aLink.FromNodeName.c_str() , Name() ) ) { + if ( !strcmp( aLink.FromNodeName.c_str() , Graph()->Name() ) ) { cdebug << "GraphEditor::OutNode::LoadDatas Warning " << aLink.FromNodeName.c_str() - << " and " << aLink.ToNodeName.c_str() << " differents from " << Name() + << " and " << aLink.ToNodeName.c_str() << " differents from " << Graph()->Name() << endl ; } string * aLinkFromNodeName = new string( aLink.FromNodeName.c_str() ) ; @@ -314,9 +398,9 @@ bool GraphEditor::OutNode::LoadDatas(map< string , int > & aMapOfNodes , // << aMapOfNodes[ aLinkFromNodeName->c_str() ] << endl ; // cout << " " << aLink.ToNodeName.c_str() << " " // << aMapOfNodes[ aLinkToNodeName->c_str() ] << endl ; - RetVal = GraphBase::Graph::AddInputData( GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() , - aLink.ToServiceParameterName.c_str() , - aLink.aLinkValue ) ; + RetVal = Graph()->AddInputData( Graph()->GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() , + aLink.ToServiceParameterName.c_str() , + aLink.aLinkValue ) ; delete aLinkFromNodeName ; delete aLinkToNodeName ; if ( !RetVal ) @@ -356,10 +440,18 @@ bool GraphEditor::OutNode::SavePy( const char* filename ) { GraphBase::SGraph * GraphEditor::OutNode::GetDataFlow() { GraphBase::SGraph * aDataFlow = new GraphBase::SGraph; - aDataFlow->Info = *GetInfo() ; - aDataFlow->Nodes = *GetNodes() ; - aDataFlow->Links = *GetLinks( true ) ; - aDataFlow->Datas = *GetDatas() ; + if ( Graph()->IsDataFlowNode() ) { + aDataFlow->Info = *Graph()->GetInfo() ; + aDataFlow->Nodes = *Graph()->GetNodes() ; + aDataFlow->Links = *Graph()->GetLinks( true ) ; + aDataFlow->Datas = *Graph()->GetDatas() ; + } + else { + aDataFlow->Info = *StreamGraph()->GetInfo() ; + aDataFlow->Nodes = *StreamGraph()->GetNodes() ; + aDataFlow->Links = *StreamGraph()->GetLinks( true ) ; + aDataFlow->Datas = *StreamGraph()->GetDatas() ; + } return aDataFlow ; } @@ -374,21 +466,21 @@ void GraphEditor::OutNode::DateModification() { aLastModificationDate.Day = Tm->tm_mday; aLastModificationDate.Month = Tm->tm_mon + 1; aLastModificationDate.Year = Tm->tm_year + 1900; - LastModification( aLastModificationDate ) ; + Graph()->LastModification( aLastModificationDate ) ; } void GraphEditor::OutNode::Coordinates( const char* NodeName , const int X , const int Y ) { - ((GraphEditor::InNode * ) GetChangeGraphNode( NodeName ))->Coordinates( X , Y ) ; + ((GraphEditor::InNode * ) Graph()->GetChangeGraphNode( NodeName ))->Coordinates( X , Y ) ; } const int GraphEditor::OutNode::XCoordinate( const char* NodeName ) { - return ((GraphEditor::InNode * ) GetChangeGraphNode( NodeName ))->XCoordinate() ; + return ((GraphEditor::InNode * ) Graph()->GetChangeGraphNode( NodeName ))->XCoordinate() ; } const int GraphEditor::OutNode::YCoordinate( const char* NodeName ) { - return ((GraphEditor::InNode * ) GetChangeGraphNode( NodeName ))->YCoordinate() ; + return ((GraphEditor::InNode * ) Graph()->GetChangeGraphNode( NodeName ))->YCoordinate() ; } GraphEditor::InNode * GraphEditor::OutNode::AddNode( @@ -409,17 +501,18 @@ GraphEditor::InNode * GraphEditor::OutNode::AddNode( const int NodeY ) { cdebug_in << "GraphEditor::OutNode::AddNode( " ; if ( NodeComponentName != NULLSTRING && strlen( NodeComponentName ) ) { - cdebug << NodeComponentName << " , " ; + cdebug << "Component('" << NodeComponentName << "') , Node('" ; } else { cdebug << "NodeComponentName[NULL] )" << endl; } if ( theNodeName != NULLSTRING && strlen( theNodeName ) ) { - cdebug << theNodeName << " )" << endl; + cdebug << theNodeName << "' )" ; } else { - cdebug << "NodeName[NULL] )" << endl; + cdebug << "NodeName[NULL]' )" ; } + cdebug << " " << NodeKindOfNode << endl ; char * RetVal = NULLSTRING ; GraphEditor::InNode *Nd = NULL ; char * aNodeName = NULL ; @@ -458,13 +551,13 @@ GraphEditor::InNode * GraphEditor::OutNode::AddNode( if ( theNodeName == NULLSTRING || strlen( theNodeName ) == 0 ) { aNodeName = new char[ strlen( NodeService.ServiceName )+1 ] ; strcpy( aNodeName , NodeService.ServiceName ) ; - if ( GetGraphNode( NodeService.ServiceName ) ) { + if ( Graph()->GetGraphNode( NodeService.ServiceName ) ) { GeneratedName = true ; - while ( GetGraphNode( aNodeName ) ) { + while ( Graph()->GetGraphNode( aNodeName ) ) { if ( aNodeName ) { delete [] aNodeName ; } - int num = GetServiceNameNumber( NodeService.ServiceName ) ; + int num = Graph()->GetServiceNameNumber( NodeService.ServiceName ) ; ostringstream astr ; astr << num << ends ; const char * n_instance = astr.str().c_str() ; @@ -478,13 +571,13 @@ GraphEditor::InNode * GraphEditor::OutNode::AddNode( } } else { - if ( GetGraphNode( theNodeName ) == NULL ) { + if ( Graph()->GetGraphNode( theNodeName ) == NULL ) { aNodeName = new char[ strlen( theNodeName )+1 ] ; strcpy( aNodeName , theNodeName ) ; } } if ( aNodeName != NULLSTRING ) { - Nd = new GraphEditor::InNode( _Orb , NamingService() , + Nd = new GraphEditor::InNode( _Orb , Graph()->NamingService() , aFuncName , aPythonFunction , NodeService , NodeComponentName , NodeInterfaceName , aNodeName , NodeKindOfNode , @@ -492,10 +585,10 @@ GraphEditor::InNode * GraphEditor::OutNode::AddNode( NodeEditorRelease , NodeAuthor , NodeComputer , NodeComment , GeneratedName , NodeX , NodeY , - Graph_prof_debug() , Graph_fdebug() ) ; + _prof_debug , _fdebug ) ; // MESSAGE( "GraphEditor::OutNode::AddNode " << hex << (void *) Nd << dec ); // if ( GraphBase::Graph::AddNode( Nd ) ) { - if ( GraphBase::Graph::AddNode( Nd->ComputingNode() ) ) { + if ( Graph()->AddNode( Nd->ComputingNode() ) ) { DateModification() ; RetVal = Nd->Name() ; } @@ -504,7 +597,7 @@ GraphEditor::InNode * GraphEditor::OutNode::AddNode( } } else { - cdebug << "NodeName is NULL or already exists." << endl ; + cdebug << "ERROR NodeName is NULL or already exists." << endl ; } // delete [] aNodeName ; cdebug_out << "GraphEditor::OutNode::AddNode" << endl; @@ -519,15 +612,15 @@ bool GraphEditor::OutNode::AddLinkCoord( const char* FromNodeName , const int nXY , const int* X , const int* Y ) { - GraphBase::InPort * anInPort = GraphBase::Graph::GetChangeInPort( ToNodeName , - ToServiceParameterName ) ; + GraphBase::InPort * anInPort = Graph()->GetChangeInPort( ToNodeName , + ToServiceParameterName ) ; // cdebug << "GraphEditor::OutNode::AddLinkCoord " << ToNodeName << "( " << ToServiceParameterName // << " ) " << anInPort << " IsEndSwitch " << anInPort->IsEndSwitch() << endl ; if ( anInPort ) { if ( anInPort->IsEndSwitch() ) { // cdebug << "GraphEditor::OutNode::AddLinkCoord " << FromNodeName << "( " << FromServiceParameterName // << " )" << endl ; - return GraphBase::Graph::GetChangeOutPort( FromNodeName , FromServiceParameterName )->AddCoord( nXY , X , Y ) ; + return Graph()->GetChangeOutPort( FromNodeName , FromServiceParameterName )->AddCoord( nXY , X , Y ) ; } else { return anInPort->AddCoord( nXY , X , Y ) ; @@ -543,15 +636,15 @@ bool GraphEditor::OutNode::AddLinkCoord( const char* FromNodeName , const int index , const int X , const int Y ) { - GraphBase::InPort * anInPort = GraphBase::Graph::GetChangeInPort( ToNodeName , - ToServiceParameterName ) ; + GraphBase::InPort * anInPort = Graph()->GetChangeInPort( ToNodeName , + ToServiceParameterName ) ; // cdebug << "GraphEditor::OutNode::AddLinkCoord " << ToNodeName << "( " << ToServiceParameterName // << " ) " << anInPort << " IsEndSwitch " << anInPort->IsEndSwitch() << endl ; if ( anInPort ) { if ( anInPort->IsEndSwitch() ) { // cdebug << "GraphEditor::OutNode::AddLinkCoord " << FromNodeName << "( " << FromServiceParameterName // << " )" << endl ; - return GraphBase::Graph::GetChangeOutPort( FromNodeName , FromServiceParameterName )->AddCoord( index , X , Y ) ; + return Graph()->GetChangeOutPort( FromNodeName , FromServiceParameterName )->AddCoord( index , X , Y ) ; } else { return anInPort->AddCoord( index , X , Y ) ; @@ -567,15 +660,15 @@ bool GraphEditor::OutNode::ChangeLinkCoord( const char* FromNodeName , const int index , const int X , const int Y ) { - GraphBase::InPort * anInPort = GraphBase::Graph::GetChangeInPort( ToNodeName , - ToServiceParameterName ) ; + GraphBase::InPort * anInPort = Graph()->GetChangeInPort( ToNodeName , + ToServiceParameterName ) ; // cdebug << "GraphEditor::OutNode::ChangeLinkCoord " << ToNodeName << "( " << ToServiceParameterName // << " ) " << anInPort << " IsEndSwitch " << anInPort->IsEndSwitch() << endl ; if ( anInPort ) { if ( anInPort->IsEndSwitch() ) { // cdebug << "GraphEditor::OutNode::ChangeLinkCoord " << FromNodeName << "( " << FromServiceParameterName // << " )" << endl ; - return GraphBase::Graph::GetChangeOutPort( FromNodeName , FromServiceParameterName )->ChangeCoord( index , X , Y ) ; + return Graph()->GetChangeOutPort( FromNodeName , FromServiceParameterName )->ChangeCoord( index , X , Y ) ; } else { return anInPort->ChangeCoord( index , X , Y ) ; @@ -589,15 +682,15 @@ bool GraphEditor::OutNode::RemoveLinkCoord( const char* FromNodeName , const char* ToNodeName , const char* ToServiceParameterName , const int index ) { - GraphBase::InPort * anInPort = GraphBase::Graph::GetChangeInPort( ToNodeName , - ToServiceParameterName ) ; + GraphBase::InPort * anInPort = Graph()->GetChangeInPort( ToNodeName , + ToServiceParameterName ) ; // cdebug << "GraphEditor::OutNode::RemoveLinkCoord " << ToNodeName << "( " << ToServiceParameterName // << " ) " << anInPort << " IsEndSwitch " << anInPort->IsEndSwitch() << endl ; if ( anInPort ) { if ( anInPort->IsEndSwitch() ) { // cdebug << "GraphEditor::OutNode::RemoveLinkCoord " << FromNodeName << "( " << FromServiceParameterName // << " )" << endl ; - return GraphBase::Graph::GetChangeOutPort( FromNodeName , FromServiceParameterName )->RemoveCoord( index ) ; + return Graph()->GetChangeOutPort( FromNodeName , FromServiceParameterName )->RemoveCoord( index ) ; } else { return anInPort->RemoveCoord( index ) ; @@ -610,14 +703,14 @@ int GraphEditor::OutNode::GetLinkCoordSize( const char* FromNodeName , const char* FromServiceParameterName , const char* ToNodeName , const char* ToServiceParameterName ) { - const GraphBase::InPort * anInPort = GraphBase::Graph::GetInPort( ToNodeName , ToServiceParameterName ) ; + const GraphBase::InPort * anInPort = Graph()->GetInPort( ToNodeName , ToServiceParameterName ) ; // cdebug << "GraphEditor::OutNode::GetLinkCoordSize " << ToNodeName << "( " << ToServiceParameterName // << " ) " << anInPort << " IsEndSwitch " << anInPort->IsEndSwitch() << endl ; if ( anInPort ) { if ( anInPort->IsEndSwitch() ) { // cdebug << "GraphEditor::OutNode::GetLinkCoordSize " << FromNodeName << "( " << FromServiceParameterName // << " )" << endl ; - return GraphBase::Graph::GetChangeOutPort( FromNodeName , FromServiceParameterName )->GetCoord() ; + return Graph()->GetChangeOutPort( FromNodeName , FromServiceParameterName )->GetCoord() ; } else { return anInPort->GetCoord() ; @@ -631,14 +724,14 @@ bool GraphEditor::OutNode::GetLinkCoord( const char* FromNodeName , const char* ToNodeName , const char* ToServiceParameterName , int *X , int *Y ) { - const GraphBase::InPort * anInPort = GraphBase::Graph::GetInPort( ToNodeName , ToServiceParameterName ) ; + const GraphBase::InPort * anInPort = Graph()->GetInPort( ToNodeName , ToServiceParameterName ) ; // cdebug << "GraphEditor::OutNode::GetLinkCoord " << ToNodeName << "( " << ToServiceParameterName // << " ) " << anInPort << " IsEndSwitch " << anInPort->IsEndSwitch() << endl ; if ( anInPort ) { if ( anInPort->IsEndSwitch() ) { // cdebug << "GraphEditor::OutNode::GetLinkCoord " << FromNodeName << "( " << FromServiceParameterName // << " )" << endl ; - return GraphBase::Graph::GetChangeOutPort( FromNodeName , FromServiceParameterName )->GetCoord( X , Y ) ; + return Graph()->GetChangeOutPort( FromNodeName , FromServiceParameterName )->GetCoord( X , Y ) ; } else { return anInPort->GetCoord( X , Y ) ; @@ -652,15 +745,15 @@ bool GraphEditor::OutNode::GetLinkCoord( const char* FromNodeName , const char* ToNodeName , const char* ToServiceParameterName , const int index , long &X , long &Y ) { - GraphBase::InPort * anInPort = GraphBase::Graph::GetChangeInPort( ToNodeName , - ToServiceParameterName ) ; + GraphBase::InPort * anInPort = Graph()->GetChangeInPort( ToNodeName , + ToServiceParameterName ) ; // cdebug << "GraphEditor::OutNode::GetLinkCoord " << ToNodeName << "( " << ToServiceParameterName // << " ) " << anInPort << " IsEndSwitch " << anInPort->IsEndSwitch() << endl ; if ( anInPort ) { if ( anInPort->IsEndSwitch() ) { // cdebug << "GraphEditor::OutNode::GetLinkCoord " << FromNodeName << "( " << FromServiceParameterName // << " )" << endl ; - return GraphBase::Graph::GetChangeOutPort( FromNodeName , FromServiceParameterName )->GetCoord( index , X , Y ) ; + return Graph()->GetChangeOutPort( FromNodeName , FromServiceParameterName )->GetCoord( index , X , Y ) ; } else { return anInPort->GetCoord( index , X , Y ) ; @@ -674,7 +767,7 @@ bool GraphEditor::OutNode::AddInputData( const char* ToNodeName1 , const char* ToNodeName2 , const char* ToParameterName2 ) { cdebug_in << "GraphEditor::OutNode::AddInputData" << endl; - bool RetVal = GraphBase::Graph::AddInputData( ToNodeName1 , + bool RetVal = Graph()->AddInputData( ToNodeName1 , ToParameterName1 , ToNodeName2 , ToParameterName2 ) ; @@ -690,9 +783,9 @@ bool GraphEditor::OutNode::Valid() { cdebug_in << "GraphEditor::OutNode::Valid" << endl; _Executable = false ; - CreateService() ; + Graph()->CreateService() ; - if ( !Sort() ) { + if ( !Graph()->Sort() ) { cdebug << "This DataFlow is not valid." << endl ; return false ; } @@ -700,9 +793,9 @@ bool GraphEditor::OutNode::Valid() { // CreateService() ; - InLineServices() ; + Graph()->InLineServices() ; - ComputingNodes() ; + Graph()->ComputingNodes() ; _Valid = true ; @@ -713,7 +806,7 @@ bool GraphEditor::OutNode::Valid() { bool GraphEditor::OutNode::Executable() { cdebug_in << "GraphEditor::OutNode::Executable" << endl; bool NewLink ; - if ( LinkLoopNodes( NewLink ) ) { + if ( Graph()->LinkLoopNodes( NewLink ) ) { if ( NewLink ) { _Valid = false ; } @@ -728,7 +821,7 @@ bool GraphEditor::OutNode::Executable() { if ( !IsValid() ) { return false ; } - if ( DataServerNodes() ) + if ( Graph()->DataServerNodes() ) _Executable = true ; else { cdebug << "This DataFlow is not executable." << endl ; @@ -744,7 +837,7 @@ const CORBA::Any *GraphEditor::OutNode::GetInData( const char * ToParameterName ) { // cdebug_in << "GraphEditor::OutNode::GetInData " << ToNodeName // << " " << ToParameterName << endl ; - const CORBA::Any * retdata = PortInData( ToNodeName , ToParameterName ) ; + const CORBA::Any * retdata = Graph()->PortInData( ToNodeName , ToParameterName ) ; // cdebug_out << "GraphEditor::OutNode::GetInData" << endl ; return retdata ; } @@ -754,7 +847,7 @@ const CORBA::Any *GraphEditor::OutNode::GetOutData( const char * FromParameterName ) { // cdebug_in << "GraphEditor::OutNode::GetOutData " << FromNodeName // << " " << FromParameterName << endl ; - const CORBA::Any * retdata = PortOutData( FromNodeName , FromParameterName ) ; + const CORBA::Any * retdata = Graph()->PortOutData( FromNodeName , FromParameterName ) ; // cdebug_out << "GraphEditor::OutNode::GetOutData" << endl ; return retdata ; } @@ -919,25 +1012,33 @@ bool GraphEditor::OutNode::LinkSaveXML( QDomDocument & Graph , QDomElement & lin bool GraphEditor::OutNode::LinkSavePY( ostream &f , const char * aGraphName , GraphBase::SLink aLink , - bool intervar , bool wdata ) const { + bool fromparam , bool toparam , + bool wdata ) const { if ( !wdata ) { - if ( intervar ) { - f << aLink.FromNodeName.c_str() << aLink.FromServiceParameterName.c_str() - << " = " - << aLink.FromNodeName.c_str() << ".Port( '" - << aLink.FromServiceParameterName.c_str() - << "' )" << endl ; - } - f << aLink.ToNodeName.c_str() << aLink.ToServiceParameterName.c_str() - << " = " << aGraphName << ".Link( " << aLink.FromNodeName.c_str() - << aLink.FromServiceParameterName.c_str() << " , " - << aLink.ToNodeName.c_str() << ".Port( '" - << aLink.ToServiceParameterName.c_str() << "' ) )" << endl ; +// if ( intervar ) { +// f << "O" << aLink.FromNodeName.c_str() << aLink.FromServiceParameterName.c_str() +// << " = " +// << aLink.FromNodeName.c_str() << ".GetOutPort( '" +// << aLink.FromServiceParameterName.c_str() +// << "' )" << endl ; +// } + f << "L" << aLink.FromNodeName.c_str() << aLink.FromServiceParameterName.c_str() + << aLink.ToNodeName.c_str() << aLink.ToServiceParameterName.c_str() + << " = " << aGraphName << ".Link( " ; +// if ( !fromparam ) { + f << "O" ; +// } + f << aLink.FromNodeName.c_str() << aLink.FromServiceParameterName.c_str() << " , " ; +// if ( !toparam ) { + f << "I" ; +// } + f << aLink.ToNodeName.c_str() << aLink.ToServiceParameterName.c_str() << " )" << endl ; } else { - f << aLink.ToNodeName.c_str() << aLink.ToServiceParameterName.c_str() - << " = " << aLink.ToNodeName.c_str() << ".Input( '" - << aLink.ToServiceParameterName.c_str() << "' , " ; + f << "I"<< aLink.ToNodeName.c_str() << aLink.ToServiceParameterName.c_str() +// << " = " << aLink.ToNodeName.c_str() << ".Input( '" +// << aLink.ToServiceParameterName.c_str() << "' , " ; + << ".Input( " ; switch (aLink.aLinkValue.type()->kind()) { case CORBA::tk_string: { char* retstr ; @@ -971,12 +1072,12 @@ bool GraphEditor::OutNode::LinkSavePY( ostream &f , const char * aGraphName , break ; } } - f << ")" << endl ; + f << " )" << endl ; } int i ; for ( i = 0 ; i < (int ) aLink.aListOfCoords.size() ; i++ ) { - f << aLink.ToNodeName.c_str() - << aLink.ToServiceParameterName.c_str() << ".AddCoord( " << i+1 << " , " + f << "L" << aLink.FromNodeName.c_str() << aLink.FromServiceParameterName.c_str() + << aLink.ToNodeName.c_str() << aLink.ToServiceParameterName.c_str() << ".AddCoord( " << i+1 << " , " << aLink.aListOfCoords[ i ].theX << " , " << aLink.aListOfCoords[ i ].theY << " )" << endl ; } @@ -984,89 +1085,89 @@ bool GraphEditor::OutNode::LinkSavePY( ostream &f , const char * aGraphName , } //bool GraphEditor::OutNode::SaveXML(ostream & f ) { -bool GraphEditor::OutNode::SaveXML(QDomDocument & Graph ) { +bool GraphEditor::OutNode::SaveXML(QDomDocument & GraphQDom ) { int i ; // f << "" << endl << endl ; // f << "" << endl << endl ; // f << "" << endl ; QString Dataflow("Dataflow") ; - Graph = QDomDocument(Dataflow) ; + GraphQDom = QDomDocument(Dataflow) ; // f << "" << endl ; - QDomElement dataflow = Graph.createElement( "dataflow" ) ; - Graph.appendChild( dataflow ) ; + QDomElement dataflow = GraphQDom.createElement( "dataflow" ) ; + GraphQDom.appendChild( dataflow ) ; // f << " " << endl ; - QDomElement info = Graph.createElement( "info-list" ) ; + QDomElement info = GraphQDom.createElement( "info-list" ) ; dataflow.appendChild( info ) ; // f << " " << endl ; // GraphBase::DataNode::SaveXML( f , " " , 0 , 0 ) ; - GraphBase::DataNode::SaveXML( Graph , info , 0 , 0 ) ; + Graph()->SaveXML( GraphQDom , info , 0 , 0 ) ; // f << " " << endl ; // f << " " << endl << endl ; // f << " " << endl ; - QDomElement nodelist = Graph.createElement( "node-list" ) ; + QDomElement nodelist = GraphQDom.createElement( "node-list" ) ; dataflow.appendChild( nodelist ) ; - for ( i = 0 ; i < GraphNodesSize() ; i++ ) { + for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) { // f << " " << endl ; - if ( GraphNodes( i )->IsComputingNode() ) { + if ( Graph()->GraphNodes( i )->IsComputingNode() ) { // ((GraphBase::ComputingNode *)GraphNodes( i ))->SaveXML( f , // " " , - ((GraphBase::ComputingNode *)GraphNodes( i ))->SaveXML( Graph , nodelist , - GraphNodes( i )->XCoordinate() , - GraphNodes( i )->YCoordinate() ) ; + ((GraphBase::ComputingNode *) Graph()->GraphNodes( i ))->SaveXML( GraphQDom , nodelist , + Graph()->GraphNodes( i )->XCoordinate() , + Graph()->GraphNodes( i )->YCoordinate() ) ; } - else if ( GraphNodes( i )->IsFactoryNode() ) { + else if ( Graph()->GraphNodes( i )->IsFactoryNode() ) { // ((GraphBase::FactoryNode * ) GraphNodes( i ))->SaveXML( f , // " " , - ((GraphBase::FactoryNode * ) GraphNodes( i ))->SaveXML( Graph , nodelist , - GraphNodes( i )->XCoordinate() , - GraphNodes( i )->YCoordinate() ) ; + ((GraphBase::FactoryNode * ) Graph()->GraphNodes( i ))->SaveXML( GraphQDom , nodelist , + Graph()->GraphNodes( i )->XCoordinate() , + Graph()->GraphNodes( i )->YCoordinate() ) ; } - else if ( GraphNodes( i )->IsInLineNode() ) { + else if ( Graph()->GraphNodes( i )->IsInLineNode() ) { // ((GraphBase::InLineNode * ) GraphNodes( i ))->SaveXML( f , // " " , - ((GraphBase::InLineNode * ) GraphNodes( i ))->SaveXML( Graph , nodelist , - GraphNodes( i )->XCoordinate() , - GraphNodes( i )->YCoordinate() ) ; + ((GraphBase::InLineNode * ) Graph()->GraphNodes( i ))->SaveXML( GraphQDom , nodelist , + Graph()->GraphNodes( i )->XCoordinate() , + Graph()->GraphNodes( i )->YCoordinate() ) ; } - else if ( GraphNodes( i )->IsGOTONode() ) { + else if ( Graph()->GraphNodes( i )->IsGOTONode() ) { // ((GraphBase::GOTONode * ) GraphNodes( i ))->SaveXML( f , // " " , - ((GraphBase::GOTONode * ) GraphNodes( i ))->SaveXML( Graph , nodelist , - GraphNodes( i )->XCoordinate() , - GraphNodes( i )->YCoordinate() ) ; + ((GraphBase::GOTONode * ) Graph()->GraphNodes( i ))->SaveXML( GraphQDom , nodelist , + Graph()->GraphNodes( i )->XCoordinate() , + Graph()->GraphNodes( i )->YCoordinate() ) ; } - else if ( GraphNodes( i )->IsLoopNode() ) { + else if ( Graph()->GraphNodes( i )->IsLoopNode() ) { // ((GraphBase::LoopNode * ) GraphNodes( i ))->SaveXML( f , // " " , - ((GraphBase::LoopNode * ) GraphNodes( i ))->SaveXML( Graph , nodelist , - GraphNodes( i )->XCoordinate() , - GraphNodes( i )->YCoordinate() ) ; + ((GraphBase::LoopNode * ) Graph()->GraphNodes( i ))->SaveXML( GraphQDom , nodelist , + Graph()->GraphNodes( i )->XCoordinate() , + Graph()->GraphNodes( i )->YCoordinate() ) ; } - else if ( GraphNodes( i )->IsEndLoopNode() ) { + else if ( Graph()->GraphNodes( i )->IsEndLoopNode() ) { // ((GraphBase::EndOfLoopNode * ) GraphNodes( i ))->SaveXML( f , // " " , - ((GraphBase::EndOfLoopNode * ) GraphNodes( i ))->SaveXML( Graph , nodelist , - GraphNodes( i )->XCoordinate() , - GraphNodes( i )->YCoordinate() ) ; + ((GraphBase::EndOfLoopNode * ) Graph()->GraphNodes( i ))->SaveXML( GraphQDom , nodelist , + Graph()->GraphNodes( i )->XCoordinate() , + Graph()->GraphNodes( i )->YCoordinate() ) ; } - else if ( GraphNodes( i )->IsSwitchNode() ) { + else if ( Graph()->GraphNodes( i )->IsSwitchNode() ) { // ((GraphBase::SwitchNode * ) GraphNodes( i ))->SaveXML( f , // " " , - ((GraphBase::SwitchNode * ) GraphNodes( i ))->SaveXML( Graph , nodelist , - GraphNodes( i )->XCoordinate() , - GraphNodes( i )->YCoordinate() ) ; + ((GraphBase::SwitchNode * ) Graph()->GraphNodes( i ))->SaveXML( GraphQDom , nodelist , + Graph()->GraphNodes( i )->XCoordinate() , + Graph()->GraphNodes( i )->YCoordinate() ) ; } - else if ( GraphNodes( i )->IsEndSwitchNode() ) { + else if ( Graph()->GraphNodes( i )->IsEndSwitchNode() ) { // ((GraphBase::EndOfSwitchNode * ) GraphNodes( i ))->SaveXML( f , // " " , - ((GraphBase::EndOfSwitchNode * ) GraphNodes( i ))->SaveXML( Graph , nodelist , - GraphNodes( i )->XCoordinate() , - GraphNodes( i )->YCoordinate() ) ; + ((GraphBase::EndOfSwitchNode * ) Graph()->GraphNodes( i ))->SaveXML( GraphQDom , nodelist , + Graph()->GraphNodes( i )->XCoordinate() , + Graph()->GraphNodes( i )->YCoordinate() ) ; } // f << " " << endl ; // } @@ -1074,29 +1175,29 @@ bool GraphEditor::OutNode::SaveXML(QDomDocument & Graph ) { // f << " " << endl << endl ; // f << " " << endl ; - QDomElement linklist = Graph.createElement( "link-list" ) ; + QDomElement linklist = GraphQDom.createElement( "link-list" ) ; dataflow.appendChild( linklist ) ; - const GraphBase::ListOfLinks * Links = GetLinks( true ) ; + const GraphBase::ListOfLinks * Links = Graph()->GetLinks( true ) ; for ( i = 0 ; i < (int ) Links->size() ; i++ ) { // f << " " << endl ; - QDomElement link = Graph.createElement( "link" ) ; + QDomElement link = GraphQDom.createElement( "link" ) ; linklist.appendChild( link ) ; // LinkSaveXML( f , " " , (*Links)[ i ] , false ) ; - LinkSaveXML( Graph , link , (*Links)[ i ] , false ) ; + LinkSaveXML( GraphQDom , link , (*Links)[ i ] , false ) ; // f << " " << endl ; } // f << " " << endl << endl ; // f << " " << endl ; - QDomElement datalist = Graph.createElement( "data-list" ) ; + QDomElement datalist = GraphQDom.createElement( "data-list" ) ; dataflow.appendChild( datalist ) ; - const GraphBase::ListOfLinks * Datas = GetDatas() ; + const GraphBase::ListOfLinks * Datas = Graph()->GetDatas() ; for ( i = 0 ; i < (int ) Datas->size() ; i++ ) { // f << " " << endl ; - QDomElement data = Graph.createElement( "data" ) ; + QDomElement data = GraphQDom.createElement( "data" ) ; datalist.appendChild( data ) ; // LinkSaveXML( f , " " , (*Datas)[ i ] , true ) ; - LinkSaveXML( Graph , data , (*Datas)[ i ] , true ) ; + LinkSaveXML( GraphQDom , data , (*Datas)[ i ] , true ) ; // f << " " << endl ; } //#if 0 @@ -1133,26 +1234,26 @@ bool GraphEditor::OutNode::SaveXML(QDomDocument & Graph ) { bool GraphEditor::OutNode::SavePY( ostream & f ) { int i ; int j ; - f << endl << "# Generated python file of Graph " << Name() << endl << endl ; + f << endl << "# Generated python file of Graph " << Graph()->Name() << endl << endl ; f << "from SuperV import *" << endl ; f << "# Graph creation " << endl ; - GraphBase::DataNode::SavePY( f , Name() , 0 , 0 ) ; + Graph()->SavePY( f , Graph()->Name() , 0 , 0 ) ; f << endl << "# Creation of Factory Nodes" << endl ; - for ( i = 0 ; i < GraphNodesSize() ; i++ ) { - if ( GraphNodes( i )->IsFactoryNode() ) { + for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) { + if ( Graph()->GraphNodes( i )->IsFactoryNode() ) { f << endl ; - ((GraphBase::FactoryNode * ) GraphNodes( i ))->SavePY( f , Name() , - GraphNodes( i )->XCoordinate() , - GraphNodes( i )->YCoordinate() ) ; + ((GraphBase::FactoryNode * ) Graph()->GraphNodes( i ))->SavePY( f , Graph()->Name() , + Graph()->GraphNodes( i )->XCoordinate() , + Graph()->GraphNodes( i )->YCoordinate() ) ; } } bool first = true ; - for ( i = 0 ; i < GraphNodesSize() ; i++ ) { - if ( GraphNodes( i )->IsComputingNode() ) { + for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) { + if ( Graph()->GraphNodes( i )->IsComputingNode() ) { if ( first ) { f << endl << "# Creation of Computing Nodes" << endl ; first = false ; @@ -1160,15 +1261,15 @@ bool GraphEditor::OutNode::SavePY( ostream & f ) { else { f << endl ; } - ((GraphBase::ComputingNode * ) GraphNodes( i ))->SavePY( f , Name() , - GraphNodes( i )->XCoordinate() , - GraphNodes( i )->YCoordinate() ) ; + ((GraphBase::ComputingNode * ) Graph()->GraphNodes( i ))->SavePY( f , Graph()->Name() , + Graph()->GraphNodes( i )->XCoordinate() , + Graph()->GraphNodes( i )->YCoordinate() ) ; } } first = true ; - for ( i = 0 ; i < GraphNodesSize() ; i++ ) { - if ( GraphNodes( i )->IsInLineNode() ) { + for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) { + if ( Graph()->GraphNodes( i )->IsInLineNode() ) { if ( first ) { f << endl << "# Creation of InLine Nodes" << endl ; first = false ; @@ -1176,15 +1277,15 @@ bool GraphEditor::OutNode::SavePY( ostream & f ) { else { f << endl ; } - ((GraphBase::InLineNode * ) GraphNodes( i ))->SavePY( f , Name() , - GraphNodes( i )->XCoordinate() , - GraphNodes( i )->YCoordinate() ) ; + ((GraphBase::InLineNode * ) Graph()->GraphNodes( i ))->SavePY( f , Graph()->Name() , + Graph()->GraphNodes( i )->XCoordinate() , + Graph()->GraphNodes( i )->YCoordinate() ) ; } } first = true ; - for ( i = 0 ; i < GraphNodesSize() ; i++ ) { - if ( GraphNodes( i )->IsLoopNode() ) { + for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) { + if ( Graph()->GraphNodes( i )->IsLoopNode() ) { if ( first ) { f << endl << "# Creation of Loop Nodes" << endl ; first = false ; @@ -1192,15 +1293,15 @@ bool GraphEditor::OutNode::SavePY( ostream & f ) { else { f << endl ; } - ((GraphBase::LoopNode * ) GraphNodes( i ))->SavePY( f , Name() , - GraphNodes( i )->XCoordinate() , - GraphNodes( i )->YCoordinate() ) ; + ((GraphBase::LoopNode * ) Graph()->GraphNodes( i ))->SavePY( f , Graph()->Name() , + Graph()->GraphNodes( i )->XCoordinate() , + Graph()->GraphNodes( i )->YCoordinate() ) ; } } first = true ; - for ( i = 0 ; i < GraphNodesSize() ; i++ ) { - if ( GraphNodes( i )->IsSwitchNode() ) { + for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) { + if ( Graph()->GraphNodes( i )->IsSwitchNode() ) { if ( first ) { f << endl << "# Creation of Switch Nodes" << endl ; first = false ; @@ -1208,15 +1309,15 @@ bool GraphEditor::OutNode::SavePY( ostream & f ) { else { f << endl ; } - ((GraphBase::SwitchNode * ) GraphNodes( i ))->SavePY( f , Name() , - GraphNodes( i )->XCoordinate() , - GraphNodes( i )->YCoordinate() ) ; + ((GraphBase::SwitchNode * ) Graph()->GraphNodes( i ))->SavePY( f , Graph()->Name() , + Graph()->GraphNodes( i )->XCoordinate() , + Graph()->GraphNodes( i )->YCoordinate() ) ; } } first = true ; - for ( i = 0 ; i < GraphNodesSize() ; i++ ) { - if ( GraphNodes( i )->IsGOTONode() ) { + for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) { + if ( Graph()->GraphNodes( i )->IsGOTONode() ) { if ( first ) { f << endl << "# Creation of GOTO Nodes" << endl ; first = false ; @@ -1224,19 +1325,19 @@ bool GraphEditor::OutNode::SavePY( ostream & f ) { else { f << endl ; } - ((GraphBase::GOTONode * ) GraphNodes( i ))->SavePY( f , Name() , - GraphNodes( i )->XCoordinate() , - GraphNodes( i )->YCoordinate() ) ; + ((GraphBase::GOTONode * ) Graph()->GraphNodes( i ))->SavePY( f , Graph()->Name() , + Graph()->GraphNodes( i )->XCoordinate() , + Graph()->GraphNodes( i )->YCoordinate() ) ; } } - const GraphBase::ListOfLinks * Links = GetLinks() ; - bool intervar ; - map< string , int > aMapOfOutPorts ; + const GraphBase::ListOfLinks * Links = Graph()->GetLinks() ; +// bool intervar ; +// map< string , int > aMapOfOutPorts ; first = true ; - for ( i = 0 ; i < GraphNodesSize() ; i++ ) { + for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) { for ( j = 0 ; j < (int ) Links->size() ; j++ ) { - if ( !strcmp( GraphNodes( i )->Name() , (*Links)[ j ].FromNodeName.c_str() ) ) { + if ( !strcmp( Graph()->GraphNodes( i )->Name() , (*Links)[ j ].FromNodeName.c_str() ) ) { if ( first ) { f << endl << "# Creation of Links" @@ -1246,91 +1347,45 @@ bool GraphEditor::OutNode::SavePY( ostream & f ) { else { f << endl ; } - char * NodePort = new char [ strlen( (*Links)[ j ].FromNodeName.c_str() ) + - strlen( (*Links)[ j ].FromServiceParameterName.c_str() ) + 1 ] ; - strcpy( NodePort , (*Links)[ j ].FromNodeName.c_str() ) ; - strcat( NodePort , (*Links)[ j ].FromServiceParameterName.c_str() ) ; - if ( aMapOfOutPorts[ NodePort ] == 0 ) { - aMapOfOutPorts[ NodePort ] = j + 1 ; - intervar = true ; - } - else { - intervar = false ; - } - LinkSavePY( f , Name() , (*Links)[ j ] , intervar , false ) ; - delete [] NodePort ; - } - } - } - -#if 0 - first = true ; - for ( i = 0 ; i < Links->size() ; i++ ) { - if ( GetGraphNode( (*Links)[ i ].FromNodeName.c_str() )->IsSwitchNode() || - GetGraphNode( (*Links)[ i ].ToNodeName.c_str() )->IsSwitchNode() || - GetGraphNode( (*Links)[ i ].FromNodeName.c_str() )->IsEndSwitchNode() || - GetGraphNode( (*Links)[ i ].ToNodeName.c_str() )->IsEndSwitchNode() ) { - if ( first ) { - f << endl - << "# Creation of Switch Links" - << endl ; - first = false ; - } - char * NodePort = new char [ strlen( (*Links)[ i ].FromNodeName.c_str() ) + - strlen( (*Links)[ i ].FromServiceParameterName.c_str() ) + 1 ] ; - strcpy( NodePort , (*Links)[ i ].FromNodeName.c_str() ) ; - strcat( NodePort , (*Links)[ i ].FromServiceParameterName.c_str() ) ; - if ( aMapOfOutPorts[ NodePort ] == 0 ) { - aMapOfOutPorts[ NodePort ] = i + 1 ; - intervar = true ; - } - else { - intervar = false ; - } - LinkSavePY( f , Name() , (*Links)[ i ] , intervar , false ) ; - delete [] NodePort ; - } - } - - first = true ; - for ( i = 0 ; i < Links->size() ; i++ ) { - if ( GetGraphNode( (*Links)[ i ].FromNodeName.c_str() )->IsGOTONode() && - GetGraphNode( (*Links)[ i ].ToNodeName.c_str() )->IsInLineNode() ) { - if ( first ) { - f << endl - << "# Creation of intermediate Output variables and of Loop Links" - << endl ; - first = false ; - } - char * NodePort = new char [ strlen( (*Links)[ i ].FromNodeName.c_str() ) + - strlen( (*Links)[ i ].FromServiceParameterName.c_str() ) + 1 ] ; - strcpy( NodePort , (*Links)[ i ].FromNodeName.c_str() ) ; - strcat( NodePort , (*Links)[ i ].FromServiceParameterName.c_str() ) ; - if ( aMapOfOutPorts[ NodePort ] == 0 ) { - aMapOfOutPorts[ NodePort ] = i + 1 ; - intervar = true ; - } - else { - intervar = false ; +// char * NodePort = new char [ strlen( (*Links)[ j ].FromNodeName.c_str() ) + +// strlen( (*Links)[ j ].FromServiceParameterName.c_str() ) + 1 ] ; +// strcpy( NodePort , (*Links)[ j ].FromNodeName.c_str() ) ; +// strcat( NodePort , (*Links)[ j ].FromServiceParameterName.c_str() ) ; +// if ( aMapOfOutPorts[ NodePort ] == 0 ) { +// aMapOfOutPorts[ NodePort ] = j + 1 ; +// intervar = true ; +// } +// else { +// intervar = false ; +// } + bool fromparam = false ; + if ( Graph()->GraphNodes( i )->GetOutPort( (*Links)[ j ].FromServiceParameterName.c_str() )->IsParam() ) { + fromparam = true ; + } + bool toparam = false ; + if ( Graph()->GetChangeGraphNode( (*Links)[ j ].ToNodeName.c_str() )->GetInPort( (*Links)[ j ].ToServiceParameterName.c_str() )->IsParam() ) { + toparam = true ; + } + LinkSavePY( f , Graph()->Name() , (*Links)[ j ] , fromparam , toparam , false ) ; +// delete [] NodePort ; } - LinkSavePY( f , Name() , (*Links)[ i ] , intervar , false ) ; - delete [] NodePort ; } } -#endif - const GraphBase::ListOfLinks * Datas = GetDatas() ; + const GraphBase::ListOfLinks * Datas = Graph()->GetDatas() ; first = true ; for ( i = 0 ; i < (int ) Datas->size() ; i++ ) { if ( first ) { - f << endl << "# Creation of Input datas" << endl ; + f << endl << "# Input datas" << endl ; first = false ; } - LinkSavePY( f , Name() , (*Datas)[ i ] , false , true ) ; + bool fromparam = true ; + bool toparam = true ; + LinkSavePY( f , Graph()->Name() , (*Datas)[ i ] , fromparam , toparam , true ) ; } first = true ; - const SALOME_ModuleCatalog::ListOfServicesParameter ListOfInParam = ServiceInParameter() ; + const SALOME_ModuleCatalog::ListOfServicesParameter ListOfInParam = Graph()->ServiceInParameter() ; for ( i = 0 ; i < (int ) ListOfInParam.length() ; i++ ) { string _aParam = CORBA::string_dup(ListOfInParam[ i ].Parametername) ; const char * aParam = _aParam.c_str() ; @@ -1347,20 +1402,21 @@ bool GraphEditor::OutNode::SavePY( ostream & f ) { break ; } } - if ( !GetChangeGraphNode( aNodeName )->GetInPort( aPortName )->IsDataConnected() ) { + const GraphBase::InPort * anInPort = Graph()->GetChangeGraphNode( aNodeName )->GetInPort( aPortName ) ; + if ( !anInPort->IsDataConnected() ) { if ( first ) { - f << endl << "# Missing Input datas" << endl ; + f << endl << "# Input Ports of the graph" << endl ; first = false ; } - f << aNodeName << aPortName << " = " << aNodeName << ".Port( '" + f << "#I" << aNodeName << aPortName << " = " << aNodeName << ".GetInPort( '" << aPortName << "' )" << endl ; } delete [] aNodeName ; delete [] aPortName ; } - f << endl << "# Creation of Output variables" << endl ; - const SALOME_ModuleCatalog::ListOfServicesParameter ListOfOutParam = ServiceOutParameter() ; + f << endl << "# Output Ports of the graph" << endl ; + const SALOME_ModuleCatalog::ListOfServicesParameter ListOfOutParam = Graph()->ServiceOutParameter() ; for ( i = 0 ; i < (int ) ListOfOutParam.length() ; i++ ) { string _aParam = CORBA::string_dup(ListOfOutParam[ i ].Parametername) ; const char * aParam = _aParam.c_str() ; @@ -1377,7 +1433,7 @@ bool GraphEditor::OutNode::SavePY( ostream & f ) { break ; } } - f << aNodeName << aPortName << " = " << aNodeName << ".Port( '" + f << "#O" << aNodeName << aPortName << " = " << aNodeName << ".GetOutPort( '" << aPortName << "' )" << endl ; delete [] aNodeName ; delete [] aPortName ; @@ -1388,28 +1444,28 @@ bool GraphEditor::OutNode::SavePY( ostream & f ) { ostream & operator<< (ostream & f,const GraphEditor::OutNode & G) { - f << (GraphBase::ComputingNode ) G ; + f << (GraphBase::ComputingNode ) *(G.Graph()) ; f << endl ; - f << " Nodes : " << G.GraphNodesSize() << " node" - << (G.GraphNodesSize() > 1 ? "s" : "") << endl; + f << " Nodes : " << (G.Graph())->GraphNodesSize() << " node" + << ((G.Graph())->GraphNodesSize() > 1 ? "s" : "") << endl; int i ; - for ( i = 0 ; i < G.GraphNodesSize() ; i++ ) { + for ( i = 0 ; i < (G.Graph())->GraphNodesSize() ; i++ ) { f -// << hex << (void *) G.GraphNodes( i ) << dec << " " - << *G.GraphNodes( i ) << endl; +// << hex << (void *) G.Graph().GraphNodes( i ) << dec << " " + << (G.Graph())->GraphNodes( i ) << endl; } f << " Links : " << endl ; - for ( i = 0 ; i < G.GraphNodesSize() ; i++ ) { - G.GraphNodes( i )->ListLinks( f ) ; + for ( i = 0 ; i < (G.Graph())->GraphNodesSize() ; i++ ) { + (G.Graph())->GraphNodes( i )->ListLinks( f ) ; } f << " Datas : " << endl ; - G.ListDatas( f ) ; + (G.Graph())->ListDatas( f ) ; - f << "DataFlow " << G.Name() << " is " ; + f << "DataFlow " << (G.Graph())->Name() << " is " ; if ( G.IsNotValid() ) f << "not " ; f << "valid and is " ; diff --git a/src/GraphEditor/DataFlowEditor_OutNode.hxx b/src/GraphEditor/DataFlowEditor_OutNode.hxx index c36b243..351707d 100644 --- a/src/GraphEditor/DataFlowEditor_OutNode.hxx +++ b/src/GraphEditor/DataFlowEditor_OutNode.hxx @@ -27,16 +27,22 @@ #ifndef _DATAFLOWEDITOR_OUTNODE_HXX #define _DATAFLOWEDITOR_OUTNODE_HXX -#include "DataFlowBase_Graph.hxx" +#include "DataFlowBase_StreamGraph.hxx" #include "DataFlowEditor_InNode.hxx" namespace GraphEditor { - class OutNode : public GraphBase::Graph { +// class OutNode : public GraphBase::Graph { + class OutNode : public GraphBase::Base { private : + GraphBase::StreamGraph * _StreamGraph ; + GraphBase::Graph * _Graph ; + + int _Graph_prof_debug ; + bool _Imported ; bool _Valid ; @@ -65,7 +71,8 @@ namespace GraphEditor { bool GraphEditor::OutNode::LinkSavePY( ostream &f , const char *aGraphName , GraphBase::SLink aLink , - bool intervar , + bool fromparam , + bool toparam , bool wdata ) const; bool SavePY(ostream &f ) ; @@ -77,7 +84,8 @@ namespace GraphEditor { OutNode( CORBA::ORB_ptr ORB, SALOME_NamingService* ptrNamingService , const char *DataFlowName , - const char * DebugFileName ); + const char * DebugFileName , + const SUPERV::KindOfNode aKindOfNode ); OutNode( CORBA::ORB_ptr ORB, SALOME_NamingService* ptrNamingService , const SALOME_ModuleCatalog::Service& DataFlowService , @@ -94,8 +102,15 @@ namespace GraphEditor { const char * DebugFileName ) ; virtual ~OutNode(); -// SALOME_NamingService* NamingService() const { -// return _theNamingService ; } ; + void Set_prof_debug( CORBA::ORB_ptr ORB , const char * DebugFileName ) ; + GraphBase::StreamGraph * StreamGraph() { + return _StreamGraph ; } ; + GraphBase::StreamGraph * StreamGraph() const { + return _StreamGraph ; } ; + GraphBase::Graph * Graph() { + return _Graph ; } ; + const GraphBase::Graph * Graph() const { + return _Graph ; } ; bool LoadDataFlow( const GraphBase::SGraph *aDataFlow ) ; bool LoadXml( const char* myFileName ) ; @@ -127,7 +142,7 @@ namespace GraphEditor { const int NodeX , const int NodeY ) ; GraphEditor::InNode * GetNode( const char* NodeName ) { - const GraphBase::Graph::ComputingNode * aNode = GraphBase::Graph::GetGraphNode( NodeName ) ; + const GraphBase::Graph::ComputingNode * aNode = _Graph->GetGraphNode( NodeName ) ; if ( aNode ) { return (GraphEditor::InNode * ) (aNode->GetInNode()) ; } @@ -137,34 +152,34 @@ namespace GraphEditor { bool RemoveNode( const char* NodeName ) { DateModification() ; _Valid = false ; - return GraphBase::Graph::RemoveNode( NodeName ) ; } ; + return _Graph->RemoveNode( NodeName ) ; } ; bool ReNameNode( const char* OldNodeName , const char* NewNodeName ) { DateModification() ; _Valid = false ; - return GraphBase::Graph::ReNameNode( OldNodeName , NewNodeName ) ; } ; + return _Graph->ReNameNode( OldNodeName , NewNodeName ) ; } ; void Coordinates( const int X , const int Y ) { - return GraphBase::Graph::Coordinates( X , Y ) ; } ; + return _Graph->Coordinates( X , Y ) ; } ; const int XCoordinate() { - return GraphBase::Graph::XCoordinate() ; } ; + return _Graph->XCoordinate() ; } ; const int YCoordinate() { - return GraphBase::Graph::YCoordinate() ; } ; + return _Graph->YCoordinate() ; } ; void Coordinates( const char* NodeName , const int X , const int Y ) ; const int XCoordinate( const char* NodeName ) ; const int YCoordinate( const char* NodeName ) ; - const GraphBase::InPort *GetInPort( const char *name ) { - return GraphBase::PortsOfNode::GetInPort( name ) ; } ; - const GraphBase::OutPort *GetOutPort( const char *name ) { - return GraphBase::PortsOfNode::GetOutPort( name ) ; } ; - GraphBase::InPort *GetChangeInPort( const char *name ) { - return GraphBase::PortsOfNode::GetChangeInPort( name ) ; } ; - GraphBase::OutPort *GetChangeOutPort( const char *name ) { - return GraphBase::PortsOfNode::GetChangeOutPort( name ) ; } ; + const GraphBase::InPort *GetInPort( const char * InPortName ) { + return _Graph->GetInPort( InPortName ) ; } ; + const GraphBase::OutPort *GetOutPort( const char * OutPortName ) { + return _Graph->GetOutPort( OutPortName ) ; } ; + GraphBase::InPort *GetChangeInPort( const char * InPortName ) { + return _Graph->GetChangeInPort( InPortName ) ; } ; + GraphBase::OutPort *GetChangeOutPort( const char * OutPortName ) { + return _Graph->GetChangeOutPort( OutPortName ) ; } ; bool HasInput(const char * ToServiceParameterName ) { - return GraphBase::ComputingNode::HasInput( ToServiceParameterName ) ; + return _Graph->HasInput( ToServiceParameterName ) ; } bool AddLink( const char* FromNodeName , @@ -174,20 +189,18 @@ namespace GraphEditor { const CORBA::Any aValue ) { DateModification() ; _Valid = false ; - return GraphBase::Graph::AddLink( - FromNodeName , FromServiceParameterName , - ToNodeName , ToServiceParameterName , - aValue ) ; } ; + return _Graph->AddLink( FromNodeName , FromServiceParameterName , + ToNodeName , ToServiceParameterName , + aValue ) ; } ; bool RemoveLink( const char* FromNodeName , const char* FromServiceParameterName , const char* ToNodeName , const char* ToServiceParameterName ) { - bool RetVal = GraphBase::Graph::RemoveLink( - FromNodeName , - FromServiceParameterName , - ToNodeName , - ToServiceParameterName ) ; + bool RetVal = _Graph->RemoveLink( FromNodeName , + FromServiceParameterName , + ToNodeName , + ToServiceParameterName ) ; if ( RetVal ) DateModification() ; _Valid = false ; @@ -197,10 +210,10 @@ namespace GraphEditor { const char* ToServiceParameterName , char** FromNodeName , char** FromServiceParameterName ) { - return GraphBase::Graph::GetLink( ToNodeName , - ToServiceParameterName , - FromNodeName , - FromServiceParameterName ) ; } ; + return _Graph->GetLink( ToNodeName , + ToServiceParameterName , + FromNodeName , + FromServiceParameterName ) ; } ; bool AddLinkCoord( const char* FromNodeName , const char* FromServiceParameterName , diff --git a/src/GraphEditor/Makefile.in b/src/GraphEditor/Makefile.in index d1acd91..6bd73f7 100644 --- a/src/GraphEditor/Makefile.in +++ b/src/GraphEditor/Makefile.in @@ -60,12 +60,11 @@ BIN_SERVER_IDL = CPPFLAGS+= $(PYTHON_INCLUDES) $(QT_MT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) \ -I${KERNEL_ROOT_DIR}/include/salome -#CXXFLAGS= -g -D_DEBUG_ -D__x86__ -D__linux__ -ftemplate-depth-42 -Wno-deprecated CXXFLAGS= -g -D_DEBUG_ -D__x86__ -D__linux__ -ftemplate-depth-42 -Wall \ -I${KERNEL_ROOT_DIR}/include/salome -#LDFLAGS+= -lSalomeNS -lSalomeLifeCycleCORBA -lSalomeSuperVisionBase -lSalomeSuperVisionExecutor -lOpUtil -lSalomeLoggerServer -lc $(PYTHON_LIBS) $(QT_MT_LIBS) $(OGL_LIBS) LDFLAGS+= -lSalomeNS -lSalomeLifeCycleCORBA -lSalomeSuperVisionBase -lSalomeSuperVisionExecutor -lOpUtil -lSALOMELocalTrace \ -lc $(QT_MT_LIBS) $(OGL_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome +#LIBS += -Xlinker -export-dynamic $(PYTHON_LIBS) @CONCLUDE@ diff --git a/src/GraphExecutor/DataFlowExecutor_DataFlow.cxx b/src/GraphExecutor/DataFlowExecutor_DataFlow.cxx index ce71218..36d198c 100644 --- a/src/GraphExecutor/DataFlowExecutor_DataFlow.cxx +++ b/src/GraphExecutor/DataFlowExecutor_DataFlow.cxx @@ -41,8 +41,9 @@ GraphExecutor::DataFlow::DataFlow() : GraphExecutor::DataFlow::DataFlow( CORBA::ORB_ptr ORB, SALOME_NamingService* ptrNamingService , const char *DataFlowName , - const char * DebugFileName ) : - OutNode( ORB, ptrNamingService , DataFlowName , DebugFileName ) { + const char * DebugFileName , + const SUPERV::KindOfNode aKindOfNode ) : + OutNode( ORB, ptrNamingService , DataFlowName , DebugFileName , aKindOfNode ) { cdebug_in << "GraphExecutor::DataFlow::DataFlow(" ; if ( DataFlowName ) { cdebug << DataFlowName ; @@ -90,8 +91,8 @@ GraphExecutor::DataFlow::~DataFlow() { bool GraphExecutor::DataFlow::Ping( const char *aNodeName ) { cdebug_in << "GraphExecutor::DataFlow::Ping" << aNodeName << " )" << endl; bool RetVal = false ; - if ( GetGraphNode( aNodeName ) ) - RetVal = ((GraphExecutor::InNode *) GetGraphNode( aNodeName )->GetInNode())->Ping() ; + if ( Graph()->GetGraphNode( aNodeName ) ) + RetVal = ((GraphExecutor::InNode *) Graph()->GetGraphNode( aNodeName )->GetInNode())->Ping() ; cdebug_out << "GraphExecutor::DataFlow::Ping" << endl; return RetVal ; } @@ -106,7 +107,7 @@ bool GraphExecutor::DataFlow::ContainerKill() { bool GraphExecutor::DataFlow::ContainerKill( const char *aNodeName ) { // cdebug_in << "GraphExecutor::DataFlow::ContainerKill( " << aNodeName << " )"<< endl; bool RetVal = false ; - GraphExecutor::InNode * aNode = ((GraphExecutor::InNode *) GetGraphNode( aNodeName )->GetInNode()) ; + GraphExecutor::InNode * aNode = ((GraphExecutor::InNode *) Graph()->GetGraphNode( aNodeName )->GetInNode()) ; if ( aNode ) { RetVal = aNode->ContainerKill() ; } @@ -124,7 +125,7 @@ bool GraphExecutor::DataFlow::Kill() { bool GraphExecutor::DataFlow::Kill( const char *aNodeName ) { // cdebug_in << "GraphExecutor::DataFlow::Kill( " << aNodeName << " )"<< endl; bool RetVal = false ; - GraphExecutor::InNode * aNode = ((GraphExecutor::InNode *) GetGraphNode( aNodeName )->GetInNode()) ; + GraphExecutor::InNode * aNode = ((GraphExecutor::InNode *) Graph()->GetGraphNode( aNodeName )->GetInNode()) ; if ( aNode ) { RetVal = aNode->Kill() ; } @@ -135,7 +136,7 @@ bool GraphExecutor::DataFlow::Kill( const char *aNodeName ) { bool GraphExecutor::DataFlow::KillDone( const char *aNodeName ) { // cdebug_in << "GraphExecutor::DataFlow::KillDone( " << aNodeName << " )"<< endl; bool RetVal = false ; - GraphExecutor::InNode * aNode = ((GraphExecutor::InNode *) GetGraphNode( aNodeName )->GetInNode()) ; + GraphExecutor::InNode * aNode = ((GraphExecutor::InNode *) Graph()->GetGraphNode( aNodeName )->GetInNode()) ; if ( aNode ) { RetVal = aNode->KillDone() ; } @@ -153,7 +154,7 @@ bool GraphExecutor::DataFlow::Suspend() { bool GraphExecutor::DataFlow::Suspend( const char *aNodeName ) { // cdebug_in << "GraphExecutor::DataFlow::Suspend( " << aNodeName << " )"<< endl; bool RetVal = false ; - GraphExecutor::InNode * aNode = ((GraphExecutor::InNode *) GetGraphNode( aNodeName )->GetInNode()) ; + GraphExecutor::InNode * aNode = ((GraphExecutor::InNode *) Graph()->GetGraphNode( aNodeName )->GetInNode()) ; if ( aNode ) { RetVal = aNode->Suspend() ; } @@ -172,7 +173,7 @@ bool GraphExecutor::DataFlow::SuspendDone() { bool GraphExecutor::DataFlow::SuspendDone( const char *aNodeName ) { // cdebug_in << "GraphExecutor::DataFlow::SuspendDone( " << aNodeName << " )"<< endl; bool RetVal = false ; - GraphExecutor::InNode * aNode = ((GraphExecutor::InNode *) GetGraphNode( aNodeName )->GetInNode()) ; + GraphExecutor::InNode * aNode = ((GraphExecutor::InNode *) Graph()->GetGraphNode( aNodeName )->GetInNode()) ; if ( aNode ) { RetVal = aNode->SuspendDone() ; } @@ -190,7 +191,7 @@ bool GraphExecutor::DataFlow::Resume() { bool GraphExecutor::DataFlow::Resume( const char *aNodeName ) { // cdebug_in << "GraphExecutor::DataFlow::Resume( " << aNodeName << " )"<< endl; bool RetVal = false ; - GraphExecutor::InNode * aNode = ((GraphExecutor::InNode *) GetGraphNode( aNodeName )->GetInNode()) ; + GraphExecutor::InNode * aNode = ((GraphExecutor::InNode *) Graph()->GetGraphNode( aNodeName )->GetInNode()) ; if ( aNode ) { RetVal = aNode->Resume() ; } @@ -208,7 +209,7 @@ bool GraphExecutor::DataFlow::Stop() { bool GraphExecutor::DataFlow::Stop( const char *aNodeName ) { // cdebug_in << "GraphExecutor::DataFlow::Stop( " << aNodeName << " )"<< endl; bool RetVal = false ; - GraphExecutor::InNode * aNode = ((GraphExecutor::InNode *) GetGraphNode( aNodeName )->GetInNode()) ; + GraphExecutor::InNode * aNode = ((GraphExecutor::InNode *) Graph()->GetGraphNode( aNodeName )->GetInNode()) ; if ( aNode ) { RetVal = aNode->Stop() ; } diff --git a/src/GraphExecutor/DataFlowExecutor_DataFlow.hxx b/src/GraphExecutor/DataFlowExecutor_DataFlow.hxx index 5f1f153..b5774e7 100644 --- a/src/GraphExecutor/DataFlowExecutor_DataFlow.hxx +++ b/src/GraphExecutor/DataFlowExecutor_DataFlow.hxx @@ -42,7 +42,8 @@ namespace GraphExecutor { DataFlow(); DataFlow( CORBA::ORB_ptr ORB, SALOME_NamingService* ptrNamingService , const char * DataFlowName , - const char * DebugFileName ); + const char * DebugFileName , + const SUPERV::KindOfNode aKindOfNode ); DataFlow( CORBA::ORB_ptr ORB, SALOME_NamingService* ptrNamingService , const SALOME_ModuleCatalog::Service& DataFlowService , const char *DataFlowComponentName , diff --git a/src/GraphExecutor/DataFlowExecutor_DataFlow.lxx b/src/GraphExecutor/DataFlowExecutor_DataFlow.lxx index ce3c606..2cf8cf4 100644 --- a/src/GraphExecutor/DataFlowExecutor_DataFlow.lxx +++ b/src/GraphExecutor/DataFlowExecutor_DataFlow.lxx @@ -40,8 +40,8 @@ inline bool GraphExecutor::DataFlow::LoadXml( const char* myFileName ) { inline const SALOME_ModuleCatalog::Service * GraphExecutor::DataFlow::NodeService( const char * aNodeName ) { - if ( GetGraphNode( aNodeName ) ) - return GetGraphNode( aNodeName )->GetService() ; + if ( Graph()->GetGraphNode( aNodeName ) ) + return Graph()->GetGraphNode( aNodeName )->GetService() ; return NULL ; } @@ -50,8 +50,7 @@ inline bool GraphExecutor::DataFlow::ChangeInputData( const char* ToNodeName , const CORBA::Any aValue ) { if ( !IsValid() ) return false ; - return GraphBase::Graph::ChangeInputData( ToNodeName , ToParameterName , - aValue ) ; + return Graph()->ChangeInputData( ToNodeName , ToParameterName , aValue ) ; } ; inline bool GraphExecutor::DataFlow::AddInputSharedData(const char* ToNodeName1 , diff --git a/src/GraphExecutor/DataFlowExecutor_FiniteStateMachine.cxx b/src/GraphExecutor/DataFlowExecutor_FiniteStateMachine.cxx index 448ad16..e63271f 100644 --- a/src/GraphExecutor/DataFlowExecutor_FiniteStateMachine.cxx +++ b/src/GraphExecutor/DataFlowExecutor_FiniteStateMachine.cxx @@ -570,7 +570,7 @@ bool GraphExecutor::FiniteStateMachine::PyFunction( const char * aPyFuncName , P bool RetVal = false ; if ( _MapOfPyFunctions[ aPyFuncName ] != NULL ) { - //PyObject * aPyFunc = _MapOfPyFunctions[ aPyFuncName ] ; + PyObject * aPyFunc = _MapOfPyFunctions[ aPyFuncName ] ; //cout << "GraphExecutor::FiniteStateMachine::PyFunction( '" << aPyFuncName << "' , " << aPyFunction // << " ) ob_refcnt " << aPyFunction->ob_refcnt << " already mapped : " << aPyFunc << " ob_refcnt " // << aPyFunc->ob_refcnt << endl ; diff --git a/src/GraphExecutor/DataFlowExecutor_InNode.cxx b/src/GraphExecutor/DataFlowExecutor_InNode.cxx index 678dc48..1e12de8 100644 --- a/src/GraphExecutor/DataFlowExecutor_InNode.cxx +++ b/src/GraphExecutor/DataFlowExecutor_InNode.cxx @@ -345,8 +345,11 @@ GraphExecutor::InNode::InNode( CORBA::ORB_ptr ORB, _InLineNode = (GraphBase::InLineNode *) _ComputingNode ; break ; } - case SUPERV::DataFlowNode : { - cdebug << "GraphEditor::InNode::InNode SUPERV::DataFlowNode ERROR : " << NodeName ; + case SUPERV::DataFlowGraph : { + cdebug << "GraphEditor::InNode::InNode SUPERV::DataFlowGraph ERROR : " << NodeName ; + } + case SUPERV::DataStreamGraph : { + cdebug << "GraphEditor::InNode::InNode SUPERV::DataStreamGraph ERROR : " << NodeName ; } case SUPERV::UnknownNode : { cdebug << "GraphEditor::InNode::InNode SUPERV::UnknownNode ERROR : " << NodeName ; @@ -793,7 +796,7 @@ bool GraphExecutor::InNode::Resume() { bool GraphExecutor::InNode::ReStart( const char * AtNodeName , const bool AndSuspend ) { bool RetVal = false ; - GraphExecutor::InNode * aRestartNode = (GraphExecutor::InNode *) _OutNode->GetGraphNode( AtNodeName )->GetInNode() ; + GraphExecutor::InNode * aRestartNode = (GraphExecutor::InNode *) _OutNode->Graph()->GetGraphNode( AtNodeName )->GetInNode() ; cdebug_in << pthread_self() << "/" << ThreadNo() << " --> GraphExecutor::InNode::ReStartAt( " << AtNodeName << " , " << AndSuspend << ") " << endl @@ -1058,7 +1061,11 @@ void GraphExecutor::InNode::InitialState( GraphExecutor::OutNode * theOutNode ) ThreadNo( 0 ) ; for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) { - if ( i != 0 || !IsGOTONode() ) { + if ( GetNodeOutPort(i)->IsDataStream() ) { + GetChangeNodeOutPort(i)->State( SUPERV::ReadyState ) ; + GetChangeNodeOutPort(i)->Done( true ) ; + } + else if ( i != 0 || !IsGOTONode() ) { GetChangeNodeOutPort(i)->State( SUPERV::WaitingState ) ; GetChangeNodeOutPort(i)->Done( false ) ; } @@ -1091,7 +1098,7 @@ void GraphExecutor::InNode::InitialState( GraphExecutor::OutNode * theOutNode ) if ( anInPort->IsGate() && anOutPort == NULL ) { Pc-- ; } - else { + else if ( anOutPort ) { if ( anOutPort->IsDataConnected() || anOutPort->IsDataStream() ) { Pc-- ; } @@ -1106,9 +1113,15 @@ void GraphExecutor::InNode::InitialState( GraphExecutor::OutNode * theOutNode ) } if ( anOutPort ) { if ( !anOutPort->IsDataStream() || anInPort->IsDataStream() ) { + cdebug << "InPort" << i << " state change : " << anInPort->PortName() << " from OutPort " + << anOutPort->PortName() << " from Node " << anOutPort->NodeName() + << " with state " << theAutomaton->StateName( anOutPort->State() ) << endl ; GetChangeNodeInPort(i)->State( anOutPort->State() ) ; } else { + cdebug << "InPort" << i << " state change : " << anInPort->PortName() << " from OutPort " + << anOutPort->PortName() << " from Node " << anOutPort->NodeName() + << " with state ReadyState" << endl ; GetChangeNodeInPort(i)->State( SUPERV::ReadyState ) ; } } @@ -1145,6 +1158,13 @@ void GraphExecutor::InNode::InitialState( GraphExecutor::OutNode * theOutNode ) _OutNode->PushEvent( this , GraphExecutor::AllDataReadyEvent , _currentState ) ; } + + for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) { + cdebug << "OutPort" << i << " : " << GetNodeOutPort(i)->PortName() << " " + << theAutomaton->StateName( GetChangeNodeOutPort(i)->State() ) + << " " << GetNodeOutPort(i)->Kind() << endl ; + } + cdebug << "CurrentState = " << theAutomaton->StateName( _currentState ) << endl; @@ -1157,32 +1177,40 @@ bool GraphExecutor::InNode::InitPythonFunctions(bool WithErr ) { if ( !PyFuncRunned() && IsOneOfInLineNodes() ) { if ( IsLoopNode() ) { PyObject * PyRunMethod = InLineNode()->PyRunMethod() ; + PyObject * PyMoreMethod = NULL ; + PyObject * PyNextMethod = NULL ; if ( PyRunMethod ) { } else { - PyObject * PyRunMethod = InitPyDynInvoke( InLineNode()->PyFuncName() , - InLineNode()->PythonFunction() ) ; + PyRunMethod = InitPyDynInvoke( InLineNode()->PyFuncName() , + InLineNode()->PythonFunction() , + Err ) ; InLineNode()->PyRunMethod( PyRunMethod ) ; } - PyObject * PyMoreMethod = LoopNode()->PyMoreMethod() ; - if ( PyMoreMethod ) { - } - else { - PyMoreMethod = InitPyDynInvoke( LoopNode()->PyMoreName() , - LoopNode()->MorePythonFunction() ) ; - LoopNode()->PyMoreMethod( PyMoreMethod ) ; - } - PyObject * PyNextMethod = LoopNode()->PyNextMethod() ; - if ( PyNextMethod ) { + if ( !Err ) { + PyMoreMethod = LoopNode()->PyMoreMethod() ; + if ( PyMoreMethod ) { + } + else { + PyMoreMethod = InitPyDynInvoke( LoopNode()->PyMoreName() , + LoopNode()->MorePythonFunction() , + Err ) ; + LoopNode()->PyMoreMethod( PyMoreMethod ) ; + } } - else { - PyNextMethod = InitPyDynInvoke( LoopNode()->PyNextName() , - LoopNode()->NextPythonFunction() ) ; - LoopNode()->PyNextMethod( PyNextMethod ) ; + if ( !Err ) { + PyNextMethod = LoopNode()->PyNextMethod() ; + if ( PyNextMethod ) { + } + else { + PyNextMethod = InitPyDynInvoke( LoopNode()->PyNextName() , + LoopNode()->NextPythonFunction() , + Err ) ; + LoopNode()->PyNextMethod( PyNextMethod ) ; + } } cdebug << "GraphExecutor::InNode::InitPythonFunctions " << Name() << " PyRunMethod(Init) " << PyRunMethod << " PyMoreMethod " << PyMoreMethod << " PyNextMethod " << PyNextMethod << endl; - Err = !PyRunMethod || !PyMoreMethod || !PyNextMethod ; } else if ( IsInLineNode() || IsSwitchNode() ) { PyObject * PyRunMethod = InLineNode()->PyRunMethod() ; @@ -1190,11 +1218,11 @@ bool GraphExecutor::InNode::InitPythonFunctions(bool WithErr ) { } else { PyRunMethod = InitPyDynInvoke( InLineNode()->PyFuncName() , - InLineNode()->PythonFunction() ) ; + InLineNode()->PythonFunction() , + Err ) ; InLineNode()->PyRunMethod( PyRunMethod ) ; } cdebug << "GraphExecutor::InNode::InitPythonFunctions " << Name() << " PyRunMethod " << PyRunMethod << endl; - Err = !PyRunMethod ; } else if ( ( IsEndLoopNode() || IsEndSwitchNode() || IsGOTONode() ) && (*InLineNode()->PythonFunction()).length() ) { @@ -1203,11 +1231,11 @@ bool GraphExecutor::InNode::InitPythonFunctions(bool WithErr ) { } else { PyRunMethod = InitPyDynInvoke( InLineNode()->PyFuncName() , - InLineNode()->PythonFunction() ) ; + InLineNode()->PythonFunction() , + Err ) ; InLineNode()->PyRunMethod( PyRunMethod ) ; } cdebug << "GraphExecutor::InNode::InitPythonFunctions " << Name() << " PyRunMethod " << PyRunMethod << endl; - Err = !PyRunMethod ; } } Err = WithErr && Err ; @@ -1216,7 +1244,7 @@ bool GraphExecutor::InNode::InitPythonFunctions(bool WithErr ) { cdebug << " Error " << Err ; } cdebug << endl; - return Err ; + return !Err ; } const long GraphExecutor::InNode::CpuUsed( bool tot ) { diff --git a/src/GraphExecutor/DataFlowExecutor_InNode.hxx b/src/GraphExecutor/DataFlowExecutor_InNode.hxx index 6351e1f..681f082 100644 --- a/src/GraphExecutor/DataFlowExecutor_InNode.hxx +++ b/src/GraphExecutor/DataFlowExecutor_InNode.hxx @@ -232,13 +232,17 @@ namespace GraphExecutor { return GOTONode()->CoupledNode() ; } ; GraphBase::InPort * AddInPort( const char * InputParameterName , - const char * InputParameterType ) { + const char * InputParameterType , + const SUPERV::KindOfPort aKindOfPort ) { return _ComputingNode->AddInPort( InputParameterName , - InputParameterType ) ; } ; + InputParameterType , + aKindOfPort ) ; } ; GraphBase::OutPort * AddOutPort( const char * OutputParameterName , - const char * OutputParameterType ) { + const char * OutputParameterType , + const SUPERV::KindOfPort aKindOfPort ) { return _ComputingNode->AddOutPort( OutputParameterName , - OutputParameterType ) ; } ; + OutputParameterType , + aKindOfPort ) ; } ; // void InOutPort( GraphBase::InPort * InputPort , // GraphBase::OutPort * OutputPort ) { // return _ComputingNode->InOutPort( InputPort , OutputPort ) ; } ; @@ -294,7 +298,8 @@ namespace GraphExecutor { bool InitPython() ; PyObject * InitPyDynInvoke( char * PyFuncName , - const SUPERV::ListOfStrings * aPythonFunction ) ; + const SUPERV::ListOfStrings * aPythonFunction , + bool & Err ) ; void LockDataWait() ; void UnLockDataWait() ; diff --git a/src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx b/src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx index 7f7094b..e9936b6 100644 --- a/src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx +++ b/src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx @@ -756,9 +756,9 @@ int GraphExecutor::InNode::VoidAction() { int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() { -// cdebug << pthread_self() << "/" << ThreadNo() -// << " --> DataWaiting_SomeDataReadyAction from " << DataFromNode() -// << " to " << Name() << endl; + cdebug << pthread_self() << "/" << ThreadNo() + << " --> DataWaiting_SomeDataReadyAction from " << DataFromNode() + << " to " << Name() << endl; unsigned int k; int InReady = 0 ; int res = 1; @@ -780,6 +780,7 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() { for ( k = 0 ; k < (unsigned int ) GetNodeInPortsSize() ; k++ ) { GraphBase::InPort * anInPort = GetChangeNodeInPort(k) ; GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ; + cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort " << anInPort->PortName() << endl ; if ( anInPort->IsGate() && anOutPort == NULL ) { InReady += 1 ; anInPort->State( SUPERV::ReadyState ) ; @@ -1074,13 +1075,13 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { } else if ( CORBA::is_nil( Component() ) ) { ostringstream astr ; - astr << "Graph " << _OutNode->Name() << " Node " << Name() + astr << "Graph " << _OutNode->Graph()->Name() << " Node " << Name() << " : load of component " << ComponentName() << " in container " << Computer() ; - _OutNode->ObjImpl()->sendMessage( NOTIF_STEP, astr.str().c_str() ) ; - Err = !_OutNode->StartComponent( ThreadNo() , Computer() , - my_strdup( ComponentName() ) , - myContainer , myObjComponent ) ; + _OutNode->Graph()->ObjImpl()->sendMessage( NOTIF_STEP, astr.str().c_str() ) ; + Err = !_OutNode->Graph()->StartComponent( ThreadNo() , Computer() , + my_strdup( ComponentName() ) , + myContainer , myObjComponent ) ; ObjInterface( false ) ; SetContainer( myContainer ) ; SetComponent( myObjComponent ) ; @@ -1106,8 +1107,8 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { else { if ( !Err ) { ostringstream astr ; - astr << "Graph " << _OutNode->Name() << " Run of Node " << Name() ; - _OutNode->ObjImpl()->sendMessage( NOTIF_STEP, astr.str().c_str() ) ; + astr << "Graph " << _OutNode->Graph()->Name() << " Run of Node " << Name() ; + _OutNode->Graph()->ObjImpl()->sendMessage( NOTIF_STEP, astr.str().c_str() ) ; cdebug << ThreadNo() << " Run( '" << ServiceName() << "'" ; for ( i = 0 ; i < (int ) ServiceInParameter().length() ; i++ ) { cdebug << " , " << InParametersList[ i ].Name << "[kind" @@ -1137,8 +1138,8 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { // << "' IsInLineNode PyDynInvoke" << endl ; StsPyDynInvoke = PyDynInvoke( InLineNode()->PyRunMethod() , InLineNode()->PyFuncName() , - &InParametersList[0] , ServiceInParameter().length() - ComputingNode()->DataStreamInPortsNumber() , - &OutParametersList[0] , ServiceOutParameter().length() - ComputingNode()->DataStreamOutPortsNumber() ) ; + &InParametersList[0] , ServiceInParameter().length() , + &OutParametersList[0] , ServiceOutParameter().length() ) ; } else if ( IsLoopNode() ) { bool CopyOutIn = false ; @@ -1351,9 +1352,9 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { else { try { try { - cdebug << "DynInvoke -> Names " << _OutNode->Name() << " " << Name() << endl ; + cdebug << "DynInvoke -> Names " << _OutNode->Graph()->Name() << " " << Name() << endl ; DynInvoke( myObjComponent, "Names" , - _OutNode->Name() , Name() ) ; + _OutNode->Graph()->Name() , Name() ) ; } catch( ... ) { cdebug << "DynInvoke Names catched ERROR" << endl ; @@ -1361,22 +1362,22 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { if ( IsComputingNode() ) { cdebug << ThreadNo() << " !ObjInterface " << Name() << " IsComputingNode DynInvoke" << endl ; - cdebug << ServiceInParameter().length()-1 - ComputingNode()->DataStreamInPortsNumber() << " input parameters and " - << ServiceOutParameter().length() - ComputingNode()->DataStreamOutPortsNumber() << " output parameters" << endl ; + cdebug << ServiceInParameter().length()-1 << " input parameters and " + << ServiceOutParameter().length() << " output parameters" << endl ; DynInvoke( myObjComponent, ServiceName() , - &InParametersList[1] , ServiceInParameter().length()-1 - ComputingNode()->DataStreamInPortsNumber() , - &OutParametersList[0] , ServiceOutParameter().length() - ComputingNode()->DataStreamOutPortsNumber() ) ; + &InParametersList[1] , ServiceInParameter().length()-1 , + &OutParametersList[0] , ServiceOutParameter().length() ) ; } else if ( IsFactoryNode() ) { cdebug << ThreadNo() << " !ObjInterface " << Name() << " IsFactoryNode DynInvoke" << endl ; - cdebug << ServiceInParameter().length() - ComputingNode()->DataStreamInPortsNumber() << " input parameters and " - << ServiceOutParameter().length() - ComputingNode()->DataStreamOutPortsNumber() << " output parameters" << endl ; + cdebug << ServiceInParameter().length() << " input parameters and " + << ServiceOutParameter().length() << " output parameters" << endl ; DynInvoke( myObjComponent, ServiceName() , - &InParametersList[0] , ServiceInParameter().length() - ComputingNode()->DataStreamInPortsNumber() , - &OutParametersList[0] , ServiceOutParameter().length() - ComputingNode()->DataStreamOutPortsNumber() ) ; + &InParametersList[0] , ServiceInParameter().length() , + &OutParametersList[0] , ServiceOutParameter().length() ) ; } // cdebug << ThreadNo() << " Component::CpuUsed " << Name() << " " // << myObjComponent->CpuUsed_impl() << endl ; @@ -1396,9 +1397,9 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { // } ostringstream astr ; - astr << "Graph " << _OutNode->Name() << " Node " << Name() << " is done : " + astr << "Graph " << _OutNode->Graph()->Name() << " Node " << Name() << " is done : " << Automaton()->StateName( State() ) ; - _OutNode->ObjImpl()->sendMessage( NOTIF_STEP, astr.str().c_str() ) ; + _OutNode->Graph()->ObjImpl()->sendMessage( NOTIF_STEP, astr.str().c_str() ) ; if ( Err ) { if ( ControlState() == SUPERV::ToKillState || ControlState() == SUPERV::ToKillDoneState || @@ -1618,7 +1619,7 @@ void GraphExecutor::InNode::SetWaitingStates(GraphExecutor::InNode * EndNode ) { // << Name() << "( " << anOutPort->PortName() << " ) --> InPort " // << anOutPort->ChangeInPorts( j )->PortName() << " from Node " // << anOutPort->ChangeInPorts( j )->NodeName() << endl; - GraphExecutor::InNode * aNode = (GraphExecutor::InNode * ) _OutNode->GetChangeGraphNode( anOutPort->ChangeInPorts( j )->NodeName() )->GetInNode() ; + GraphExecutor::InNode * aNode = (GraphExecutor::InNode * ) _OutNode->Graph()->GetChangeGraphNode( anOutPort->ChangeInPorts( j )->NodeName() )->GetInNode() ; if ( aNode != EndNode ) { aNode->SetWaitingStates( EndNode ) ; } @@ -1642,6 +1643,8 @@ int GraphExecutor::InNode::Successed_SuccessAction() { if ( IsGOTONode() || ( IsEndLoopNode() && GetNodeInLoop()->GetOutPort()->BoolValue() ) ) { + cdebug << ThreadNo() << " Successed_SuccessAction " << Name() + << " SetWaitingStates " << endl ; const GraphBase::OutPort * aGateOutPort ; if ( IsGOTONode() ) { aGateOutPort = GetNodeOutGate() ; @@ -1651,7 +1654,7 @@ int GraphExecutor::InNode::Successed_SuccessAction() { } for ( i = 0 ; i < aGateOutPort->InPortsSize() ; i++ ) { const GraphBase::InPort * anInPort = aGateOutPort->InPorts( i ) ; - GraphExecutor::InNode * aLabelNode = (GraphExecutor::InNode *) _OutNode->GetChangeGraphNode( anInPort->NodeName() )->GetInNode() ; + GraphExecutor::InNode * aLabelNode = (GraphExecutor::InNode *) _OutNode->Graph()->GetChangeGraphNode( anInPort->NodeName() )->GetInNode() ; // cdebug << ThreadNo() << " Successed_SuccessAction " << Name() << " will Loop to HeadNode " // << aLabelNode->Name() << " from port " << anInPort->PortName() << endl ; aLabelNode->SetWaitingStates( this ) ; @@ -2606,43 +2609,45 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err , } } OutParametersList[i] = D ; - if ( anOutPort->IsGate() ) { - aGateOutPort = anOutPort ; - cdebug << " Gate " ; - long l = 1; - OutParametersList[i].Value <<= l; - anOutPort->Value( OutParametersList[i].Value ); - } - else if ( anOutPort->IsLoop() ) { - cdebug << " Loop " ; - anOutPort->Value( OutParametersList[i].Value ); + if ( !anOutPort->IsDataStream() ) { + if ( anOutPort->IsGate() ) { + aGateOutPort = anOutPort ; + cdebug << " Gate " ; + long l = 1; + OutParametersList[i].Value <<= l; + anOutPort->Value( OutParametersList[i].Value ); + } + else if ( anOutPort->IsLoop() ) { + cdebug << " Loop " ; + anOutPort->Value( OutParametersList[i].Value ); // InLoop Port of EndLoopNode is ready : - anOutPort->ChangeInPorts(0)->State( SUPERV::ReadyState ) ; - } - else if ( anOutPort->IsSwitch() ) { - cdebug << " Switch " ; - anOutPort->Value( OutParametersList[i].Value ); - if ( anOutPort->InPortsSize() && anOutPort->ChangeInPorts( 0 )->IsGate() ) { - if ( OrSwitch && anOutPort->BoolValue() ) { - cdebug << "GraphExecutor::InNodeThreads::OutParameters more than one switch is true WARNING" - << endl ; - } - else { - OrSwitch = OrSwitch | anOutPort->BoolValue() ; - } - } - cdebug << "OrSwitch " << OrSwitch ; - } - else { - cdebug << " Param " ; - anOutPort->Value( OutParametersList[i].Value ); - } - anOutPort->State( NewState ) ; - anOutPort->Done( true ) ; + anOutPort->ChangeInPorts(0)->State( SUPERV::ReadyState ) ; + } + else if ( anOutPort->IsSwitch() ) { + cdebug << " Switch " ; + anOutPort->Value( OutParametersList[i].Value ); + if ( anOutPort->InPortsSize() && anOutPort->ChangeInPorts( 0 )->IsGate() ) { + if ( OrSwitch && anOutPort->BoolValue() ) { + cdebug << "GraphExecutor::InNodeThreads::OutParameters more than one switch is true WARNING" + << endl ; + } + else { + OrSwitch = OrSwitch | anOutPort->BoolValue() ; + } + } + cdebug << "OrSwitch " << OrSwitch ; + } + else { + cdebug << " Param " ; + anOutPort->Value( OutParametersList[i].Value ); + } + anOutPort->State( NewState ) ; + anOutPort->Done( true ) ; + } int j ; for ( j = 0 ; j < anOutPort->InPortsSize() ; j++ ) { bool fromGOTO = false ; - GraphBase::OutPort * aGOTOPort = _OutNode->GetChangeGraphNode( anOutPort->ChangeInPorts( j )->NodeName() )->GetChangeNodeInGate()->GetOutPort() ; + GraphBase::OutPort * aGOTOPort = _OutNode->Graph()->GetChangeGraphNode( anOutPort->ChangeInPorts( j )->NodeName() )->GetChangeNodeInGate()->GetOutPort() ; if ( aGOTOPort ) { fromGOTO = aGOTOPort->IsGOTO() ; } diff --git a/src/GraphExecutor/DataFlowExecutor_OutNode.cxx b/src/GraphExecutor/DataFlowExecutor_OutNode.cxx index 81dba0d..32f4f72 100644 --- a/src/GraphExecutor/DataFlowExecutor_OutNode.cxx +++ b/src/GraphExecutor/DataFlowExecutor_OutNode.cxx @@ -41,8 +41,8 @@ extern GraphExecutor::FiniteStateMachine * theAutomaton ; extern int _ArgC ; extern char ** _ArgV ; -GraphExecutor::OutNode::OutNode() : - Graph() { +GraphExecutor::OutNode::OutNode() { +// Graph() { _Valid = false ; _Executable = false ; _Done = false ; @@ -65,9 +65,23 @@ GraphExecutor::OutNode::OutNode() : GraphExecutor::OutNode::OutNode( CORBA::ORB_ptr ORB, SALOME_NamingService* ptrNamingService , const char *DataFlowName , - const char * DebugFileName ) : - Graph( ORB , ptrNamingService , DataFlowName , DebugFileName ) { - cdebug_in << "GraphEditor::OutNode::OutNode(" << DataFlowName << ")" << endl; + const char * DebugFileName , + const SUPERV::KindOfNode aKindOfNode ) { +// Graph( ORB , ptrNamingService , DataFlowName , DebugFileName ) { + Set_prof_debug( ORB , DebugFileName ) ; + cdebug_in << "GraphEditor::OutNode::OutNode(" << DataFlowName << " , " << aKindOfNode << ")" << endl; + if ( aKindOfNode == SUPERV::DataFlowGraph ) { + _StreamGraph = NULL ; +// _Graph = new GraphBase::Graph( ORB , ptrNamingService , DataFlowName , DebugFileName ) ; + _Graph = new GraphBase::Graph( ORB , ptrNamingService , DataFlowName , + _prof_debug , _fdebug ) ; + } + else if ( aKindOfNode == SUPERV::DataStreamGraph ) { +// _StreamGraph = new GraphBase::StreamGraph( ORB , ptrNamingService , DataFlowName , DebugFileName ) ;; + _StreamGraph = new GraphBase::StreamGraph( ORB , ptrNamingService , DataFlowName , + _prof_debug , _fdebug ) ; + _Graph = _StreamGraph ; + } _Valid = false ; _Executable = false ; _Done = false ; @@ -103,12 +117,34 @@ GraphExecutor::OutNode::OutNode( const char * DataFlowAuthor , const char * DataFlowComputer , const char * DataFlowComment , - const char * DebugFileName ) : - Graph( ORB , ptrNamingService , DataFlowService , DataFlowComponentName , - DataFlowInterfaceName , DataFlowName , DataFlowkind , - DataFlowFirstCreation , DataFlowLastModification , - DataFlowEditorRelease , DataFlowAuthor , - DataFlowComputer , DataFlowComment , DebugFileName ) { + const char * DebugFileName ) { +// Graph( ORB , ptrNamingService , DataFlowService , DataFlowComponentName , +// DataFlowInterfaceName , DataFlowName , DataFlowkind , +// DataFlowFirstCreation , DataFlowLastModification , +// DataFlowEditorRelease , DataFlowAuthor , +// DataFlowComputer , DataFlowComment , DebugFileName ) { + Set_prof_debug( ORB , DebugFileName ) ; + + cdebug_in << "GraphEditor::OutNode::OutNode(" << DataFlowName << " , " << DataFlowkind << ")" << endl; + if ( DataFlowkind == SUPERV::DataFlowGraph ) { + _StreamGraph = NULL ; + _Graph = new GraphBase::Graph( ORB , ptrNamingService , DataFlowService , DataFlowComponentName , + DataFlowInterfaceName , DataFlowName , DataFlowkind , + DataFlowFirstCreation , DataFlowLastModification , + DataFlowEditorRelease , DataFlowAuthor , + DataFlowComputer , DataFlowComment , + _prof_debug , _fdebug ) ; +// DataFlowComputer , DataFlowComment , DebugFileName ) ; + } + else if ( DataFlowkind == SUPERV::DataStreamGraph ) { + _StreamGraph = new GraphBase::StreamGraph( ORB , ptrNamingService , DataFlowService , DataFlowComponentName , + DataFlowInterfaceName , DataFlowName , DataFlowkind , + DataFlowFirstCreation , DataFlowLastModification , + DataFlowEditorRelease , DataFlowAuthor , + DataFlowComputer , DataFlowComment , + _prof_debug , _fdebug ) ; + _Graph = _StreamGraph ; + } _Valid = false ; _Executable = false ; _Done = false ; @@ -132,10 +168,20 @@ GraphExecutor::OutNode::OutNode( GraphExecutor::OutNode::~OutNode() { } +void GraphExecutor::OutNode::Set_prof_debug( CORBA::ORB_ptr ORB , + const char * DebugFileName ) { + _Graph_prof_debug = 0 ; + if ( DebugFileName ) { + _fdebug = new ofstream( DebugFileName ); + SetDebug( ORB , &_Graph_prof_debug , _fdebug ) ; + MESSAGE( endl << "Trace redirected to file " << DebugFileName << endl) + } +} + bool GraphExecutor::OutNode::LoadDataFlow(const GraphBase::SGraph &aDataFlow ) { bool RetVal = false ; RetVal = LoadInfo( aDataFlow.Info ) ; - if ( GraphBase::Service::ServiceName() != NULL ) { + if ( Graph()->ServiceName() != NULL ) { // MESSAGE( "GraphExecutor::OutNode::LoadDataFlow" ); if ( RetVal ) { RetVal = LoadNodes( aDataFlow.Nodes ) ; @@ -174,7 +220,7 @@ bool GraphExecutor::OutNode::LoadDataFlow(const GraphBase::SGraph &aDataFlow ) { bool GraphExecutor::OutNode::LoadXml( const char* myFileName ) { bool RetVal = false ; GraphBase::SGraph aDataFlow ; - if ( GraphBase::Graph::LoadXml( _Orb , myFileName , aDataFlow ) ) { + if ( Graph()->LoadXml( _Orb , myFileName , aDataFlow ) ) { RetVal = LoadDataFlow( aDataFlow ) ; // if ( aConstructor && RetVal ) // RetVal = Name( aDataFlow.Info.theName.c_str() ) ; @@ -183,19 +229,22 @@ bool GraphExecutor::OutNode::LoadXml( const char* myFileName ) { } bool GraphExecutor::OutNode::LoadInfo(const GraphBase::SNode &aDataFlowInfo ) { - cdebug << "GraphExecutor::OutNode::LoadInfo" << endl ; + cdebug << "GraphExecutor::OutNode::LoadInfo _StreamGraph " << _StreamGraph << endl ; // ComponentName( aDataFlowInfo.theComponentName.c_str() ) ; - Name( aDataFlowInfo.theName.c_str() ) ; - Kind( aDataFlowInfo.theKind ) ; - DataService( _Orb , aDataFlowInfo.theService , Graph_prof_debug() , Graph_fdebug() ) ; - FirstCreation( aDataFlowInfo.theFirstCreation ) ; - LastModification( aDataFlowInfo.theLastModification ) ; - EditorRelease( aDataFlowInfo.theEditorRelease.c_str() ) ; - Author( aDataFlowInfo.theAuthor.c_str() ) ; -// Computer( aDataFlowInfo.theContainer.c_str() ) ; - Comment( aDataFlowInfo.theComment.c_str() ) ; + Graph()->Name( aDataFlowInfo.theName.c_str() ) ; + Graph()->Kind( aDataFlowInfo.theKind ) ; + if ( Graph()->IsDataStreamNode() ) { + StreamGraph()->SetStreamParams( aDataFlowInfo.theTimeout , aDataFlowInfo.theDataStreamTrace , aDataFlowInfo.theDeltaTime ) ; + } + Graph()->DataService( _Orb , aDataFlowInfo.theService , _prof_debug , _fdebug ) ; + Graph()->FirstCreation( aDataFlowInfo.theFirstCreation ) ; + Graph()->LastModification( aDataFlowInfo.theLastModification ) ; + Graph()->EditorRelease( aDataFlowInfo.theEditorRelease.c_str() ) ; + Graph()->Author( aDataFlowInfo.theAuthor.c_str() ) ; +// Graph()->Computer( aDataFlowInfo.theContainer.c_str() ) ; + Graph()->Comment( aDataFlowInfo.theComment.c_str() ) ; // Not in OutNode/DataFlow but in InNode/DataFlow_in_an_other_DataFlow -// Coordinates( aDataFlowInfo.theX , aDataFlowInfo.theY ) ; +// Graph()->Coordinates( aDataFlowInfo.theX , aDataFlowInfo.theY ) ; return true ; } @@ -225,58 +274,70 @@ bool GraphExecutor::OutNode::LoadNodes(const GraphBase::ListOfNodes &aListOfNode anInNode->GraphExecutor::InNode::InLineNode()->DefPortsOfNode( _Orb , aNode.theService , anInNode->NamePtr() , anInNode->Kind() , - Graph_prof_debug() , Graph_fdebug() ) ; - } -#if 0 - if ( aNode.theListOfParameters.size() ) { // BusPorts ... - int j ; - for ( j = 0 ; j < aNode.theListOfParameters.size() ; j++ ) { - GraphBase::InPort * InputPort = anInNode->AddInPort( - aNode.theListOfParameters[ j ].theInParameter.Parametername , - aNode.theListOfParameters[ j ].theInParameter.Parametertype ) ; - GraphBase::OutPort * OutputPort = anInNode->AddOutPort( - aNode.theListOfParameters[ j ].theOutParameter.Parametername , - aNode.theListOfParameters[ j ].theOutParameter.Parametertype ) ; - anInNode->InOutPort( InputPort , OutputPort ) ; - } + _prof_debug , _fdebug ) ; } -#endif - GraphBase::ComputingNode * theNode = GetChangeGraphNode( aNode.theName.c_str() ) ; - theNode->DataStreamInPortsNumber( aNode.theDataStreamInArgsNumber ) ; - theNode->DataStreamOutPortsNumber( aNode.theDataStreamOutArgsNumber ) ; - cdebug << "GraphExecutor::OutNode::LoadNodes " << anInNode->Name() - << " InPortsSize " << theNode->GetNodeInPortsSize() - << " OutPortsSize " << theNode->GetNodeOutPortsSize() - << " DataStreamInPortsNumber " << aNode.theDataStreamInArgsNumber - << " DataStreamOutPortsNumber " << aNode.theDataStreamOutArgsNumber - << endl ; - int j ; - if ( aNode.theDataStreamInArgsNumber ) { // -1 because of Gates - for ( j = theNode->GetNodeInPortsSize() - aNode.theDataStreamInArgsNumber - 1 ; j < theNode->GetNodeInPortsSize() - 1 ; j++ ) { - cdebug << "GraphExecutor::OutNode::LoadNodes " << anInNode->Name() - << " InPort " << theNode->GetChangeNodeInPort( j )->PortName() - << " Kind( DataStreamParameter)" << endl ; - theNode->GetChangeNodeInPort( j )->Kind( SUPERV::DataStreamParameter ) ; - } +// GraphBase::ComputingNode * theNode = Graph()->GetChangeGraphNode( aNode.theName.c_str() ) ; + + unsigned int j ; + for ( j = 0 ; j < aNode.theListOfInDataStreams.size() ; j++ ) { + GraphBase::InPort * anInPort ; + anInPort = anInNode->ComputingNode()->AddInDataStreamPort( aNode.theListOfInDataStreams[ j ].theDataStreamParameter.Parametername , + aNode.theListOfInDataStreams[ j ].theDataStreamParameter.Parametertype , + aNode.theListOfInDataStreams[ j ].theDataStreamParameter.Parameterdependency , + SUPERV::DataStreamParameter ) ; + ((GraphBase::InDataStreamPort * ) anInPort)->SetParams( aNode.theListOfInDataStreams[ j ].theKindOfSchema , + aNode.theListOfInDataStreams[ j ].theKindOfInterpolation , + aNode.theListOfInDataStreams[ j ].theKindOfExtrapolation ) ; } - if ( aNode.theDataStreamOutArgsNumber ) { - for ( j = theNode->GetNodeOutPortsSize() - aNode.theDataStreamOutArgsNumber - 1 ; j < theNode->GetNodeOutPortsSize() - 1 ; j++ ) { - cdebug << "GraphExecutor::OutNode::LoadNodes " << anInNode->Name() - << " OutPort " << theNode->GetChangeNodeOutPort( j )->PortName() - << " Kind( DataStreamParameter)" << endl ; - theNode->GetChangeNodeOutPort( j )->Kind( SUPERV::DataStreamParameter ) ; - } + for ( j = 0 ; j < aNode.theListOfOutDataStreams.size() ; j++ ) { + GraphBase::OutPort * anOutPort ; + anOutPort = anInNode->ComputingNode()->AddOutDataStreamPort( aNode.theListOfOutDataStreams[ j ].theDataStreamParameter.Parametername , + aNode.theListOfOutDataStreams[ j ].theDataStreamParameter.Parametertype , + aNode.theListOfOutDataStreams[ j ].theDataStreamParameter.Parameterdependency , + SUPERV::DataStreamParameter ) ; + ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues( aNode.theListOfOutDataStreams[ j ].theNumberOfValues ) ; } + + +// theNode->DataStreamInPortsNumber( aNode.theDataStreamInArgsNumber ) ; +// theNode->DataStreamOutPortsNumber( aNode.theDataStreamOutArgsNumber ) ; +// cdebug << "GraphExecutor::OutNode::LoadNodes " << anInNode->Name() +// << " InPortsSize " << theNode->GetNodeInPortsSize() +// << " OutPortsSize " << theNode->GetNodeOutPortsSize() +// << " DataStreamInPortsNumber " << aNode.theDataStreamInArgsNumber +// << " DataStreamOutPortsNumber " << aNode.theDataStreamOutArgsNumber +// << endl ; +// int j ; +// if ( aNode.theDataStreamInArgsNumber ) { // -1 because of Gates +// for ( j = theNode->GetNodeInPortsSize() - aNode.theDataStreamInArgsNumber - 1 ; j < theNode->GetNodeInPortsSize() - 1 ; j++ ) { +// cdebug << "GraphExecutor::OutNode::LoadNodes " << anInNode->Name() +// << " InPort " << theNode->GetChangeNodeInPort( j )->PortName() +// << " Kind( DataStreamParameter)" << endl ; +// theNode->GetChangeNodeInPort( j )->Kind( SUPERV::DataStreamParameter ) ; +// } +// } +// if ( aNode.theDataStreamOutArgsNumber ) { +// int withgate = 1 ; +// if ( theNode->IsLoopNode() || theNode->IsEndLoopNode() ) { +// withgate = 0 ; +// } +// for ( j = theNode->GetNodeOutPortsSize() - aNode.theDataStreamOutArgsNumber - withgate ; j < theNode->GetNodeOutPortsSize() - withgate ; j++ ) { +// cdebug << "GraphExecutor::OutNode::LoadNodes " << anInNode->Name() +// << " OutPort " << theNode->GetChangeNodeOutPort( j )->PortName() +// << " Kind( DataStreamParameter)" << endl ; +// theNode->GetChangeNodeOutPort( j )->Kind( SUPERV::DataStreamParameter ) ; +// } +// } } for ( i = 0 ; i < (int ) aListOfNodes.size() ; i++ ) { GraphBase::SNode aNode = aListOfNodes[ i ] ; - anInNode = (GraphExecutor::InNode * ) GetChangeGraphNode( aNode.theName.c_str() )->GetInNode() ; + anInNode = (GraphExecutor::InNode * ) Graph()->GetChangeGraphNode( aNode.theName.c_str() )->GetInNode() ; cdebug << "GraphExecutor::OutNode::LoadNodes " << anInNode->Name() << " IsOneOfGOTONodes " << anInNode->IsOneOfGOTONodes() << " " << aNode.theCoupledNode.c_str() << endl ; if ( anInNode->IsOneOfGOTONodes() && strlen( aNode.theCoupledNode.c_str() ) ) { GraphBase::GOTONode * aCoupledNode ; - aCoupledNode = (GraphBase::GOTONode * ) GetGraphNode( aNode.theName.c_str() ) ; - aCoupledNode->CoupledNode( (GraphBase::GOTONode * ) GetChangeGraphNode( aNode.theCoupledNode.c_str() ) ) ; + aCoupledNode = (GraphBase::GOTONode * ) Graph()->GetGraphNode( aNode.theName.c_str() ) ; + aCoupledNode->CoupledNode( (GraphBase::GOTONode * ) Graph()->GetChangeGraphNode( aNode.theCoupledNode.c_str() ) ) ; } } return RetVal ; @@ -289,11 +350,11 @@ bool GraphExecutor::OutNode::LoadLinks(const GraphBase::ListOfLinks &aListOfLink int i ; for ( i = 0 ; i < (int ) aListOfLinks.size() ; i++ ) { GraphBase::SLink aLink = aListOfLinks[ i ] ; - RetVal = AddLink( aLink.FromNodeName.c_str() , - aLink.FromServiceParameterName.c_str() , - aLink.ToNodeName.c_str() , - aLink.ToServiceParameterName.c_str() , - aLink.aLinkValue ) ; + RetVal = Graph()->AddLink( aLink.FromNodeName.c_str() , + aLink.FromServiceParameterName.c_str() , + aLink.ToNodeName.c_str() , + aLink.ToServiceParameterName.c_str() , + aLink.aLinkValue ) ; // aLink.aLinkValue.Value , aLink.aLinkValue.Kind ) ; if ( !RetVal ) break ; @@ -308,22 +369,22 @@ bool GraphExecutor::OutNode::LoadDatas(const GraphBase::ListOfLinks &aListOfData int i ; for ( i = 0 ; i < (int ) aListOfDatas.size() ; i++ ) { GraphBase::SLink aLink = aListOfDatas[ i ] ; - if ( !strcmp( aLink.FromNodeName.c_str() , Name() ) ) - RetVal = GraphBase::Graph::AddInputData( aLink.ToNodeName.c_str() , - aLink.ToServiceParameterName.c_str() , - aLink.aLinkValue ) ; + if ( !strcmp( aLink.FromNodeName.c_str() , Graph()->Name() ) ) + RetVal = Graph()->AddInputData( aLink.ToNodeName.c_str() , + aLink.ToServiceParameterName.c_str() , + aLink.aLinkValue ) ; // aLink.aLinkValue.Value , aLink.aLinkValue.Kind ) ; - else if ( !strcmp( aLink.ToNodeName.c_str() , Name() ) ) { - RetVal = AddOutputData( aLink.FromNodeName.c_str() , - aLink.FromServiceParameterName.c_str() , - aLink.aLinkValue ) ; + else if ( !strcmp( aLink.ToNodeName.c_str() , Graph()->Name() ) ) { + RetVal = Graph()->AddOutputData( aLink.FromNodeName.c_str() , + aLink.FromServiceParameterName.c_str() , + aLink.aLinkValue ) ; // aLink.aLinkValue.Value , // aLink.aLinkValue.Kind ) ; - AddLink( aLink.FromNodeName.c_str() , (GraphBase::ComputingNode *) this ) ; + Graph()->AddLink( aLink.FromNodeName.c_str() , (GraphBase::ComputingNode *) this ) ; } else { cdebug << "GraphExecutor::OutNode::LoadDatas Error " << aLink.FromNodeName - << " and " << aLink.ToNodeName << " differents from " << Name() + << " and " << aLink.ToNodeName << " differents from " << Graph()->Name() << endl ; RetVal = false ; } @@ -352,15 +413,15 @@ GraphExecutor::InNode *GraphExecutor::OutNode::AddNode( cdebug_in << "GraphExecutor::OutNode::AddNode(" << NodeComponentName << " , " << NodeName << ")" << endl; GraphExecutor::InNode *Nd = NULL ; - Nd = new GraphExecutor::InNode( _Orb, NamingService() , NodeService , + Nd = new GraphExecutor::InNode( _Orb, Graph()->NamingService() , NodeService , NodeComponentName , NodeInterfaceName , NodeName , NodeKindOfNode , aFuncName , aPythonFunction , NodeFirstCreation , NodeLastModification , NodeEditorRelease , NodeAuthor , NodeComputer , NodeComment , false , NodeX , NodeY , - Graph_prof_debug() , Graph_fdebug() ) ; - GraphBase::Graph::AddNode( Nd->ComputingNode() ) ; + _prof_debug , _fdebug ) ; + Graph()->AddNode( Nd->ComputingNode() ) ; cdebug_out << "GraphExecutor::OutNode::AddNode" << endl; return Nd ; } @@ -371,10 +432,10 @@ bool GraphExecutor::OutNode::AddInputData( const char* ToNodeName1 , const char* ToNodeName2 , const char* ToParameterName2 ) { cdebug_in << "GraphExecutor::OutNode::AddInputData" << endl; - bool RetVal = GraphBase::Graph::AddInputData( ToNodeName1 , - ToParameterName1 , - ToNodeName2 , - ToParameterName2 ) ; + bool RetVal = Graph()->AddInputData( ToNodeName1 , + ToParameterName1 , + ToNodeName2 , + ToParameterName2 ) ; cdebug_out << "GraphExecutor::OutNode::AddInputData" << endl; _Valid = false ; return RetVal ; @@ -388,21 +449,21 @@ bool GraphExecutor::OutNode::Valid() { _Executable = false ; - if ( !CreateService() ) { + if ( !Graph()->CreateService() ) { cdebug << "This DataFlow has invalid type(s)." << endl ; return false ; } - if ( !Sort() ) { + if ( !Graph()->Sort() ) { cdebug << "This DataFlow is not valid." << endl ; return false ; } // CreateService() ; - InLineServices() ; + Graph()->InLineServices() ; - ComputingNodes() ; + Graph()->ComputingNodes() ; _Valid = true ; @@ -417,7 +478,7 @@ bool GraphExecutor::OutNode::Executable() { if ( !IsValid() ) return false ; - if ( DataServerNodes() ) + if ( Graph()->DataServerNodes() ) _Executable = true ; else { cdebug << "This DataFlow is not executable." << endl ; @@ -435,12 +496,12 @@ bool GraphExecutor::OutNode::Run( const bool AndSuspend ) { if ( Executable() ) { _ControlState = SUPERV::VoidState ; _SuspendedThreads = 0 ; - ThreadNo( pthread_self() ) ; + Graph()->ThreadNo( pthread_self() ) ; Done( false ) ; _JustStarted = true ; int i ; - for ( i = 0 ; i < GraphNodesSize() ; i++ ) { - GraphExecutor::InNode * anInNode = (GraphExecutor::InNode *) GraphNodes( i )->GetInNode() ; + for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) { + GraphExecutor::InNode * anInNode = (GraphExecutor::InNode *) Graph()->GraphNodes( i )->GetInNode() ; if ( !PyInitialized() && anInNode->IsOneOfInLineNodes() ) { if ( !Py_IsInitialized() ) { // Py_Initialize() ; @@ -455,23 +516,26 @@ bool GraphExecutor::OutNode::Run( const bool AndSuspend ) { } } // One more time because inline nodes may share one definition of the same function - for ( i = 0 ; i < GraphNodesSize() ; i++ ) { - GraphExecutor::InNode * anInNode = (GraphExecutor::InNode *) GraphNodes( i )->GetInNode() ; + for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) { + GraphExecutor::InNode * anInNode = (GraphExecutor::InNode *) Graph()->GraphNodes( i )->GetInNode() ; if ( anInNode->IsOneOfInLineNodes() ) { - if ( anInNode->InitPythonFunctions( true ) ) { + if ( !anInNode->InitPythonFunctions( true ) ) { + cdebug << "GraphExecutor::OutNode::Run InitPythonFunctions ERROR " + << anInNode->Name() << endl ; + return false ; } } } cdebug << "Execution starting GraphExecutor::Action_DataOk_RunService Node " - << Name() << endl ; + << Graph()->Name() << endl ; PushEvent( NULL , GraphExecutor::ReadyEvent , SUPERV::DataReadyState ) ; State( SUPERV::DataReadyState ) ; - for ( i = 0 ; i < HeadNodesSize() ; i++ ) { - GraphExecutor::InNode * anInNode = (GraphExecutor::InNode *) HeadNodes( i )->GetInNode() ; + for ( i = 0 ; i < Graph()->HeadNodesSize() ; i++ ) { + GraphExecutor::InNode * anInNode = (GraphExecutor::InNode *) Graph()->HeadNodes( i )->GetInNode() ; if ( anInNode->State() != SUPERV::DataReadyState ) { cdebug << "GraphExecutor::OutNode::Run inconsistency State of Node " << anInNode->Name() << " : " << anInNode->State() << endl ; @@ -481,7 +545,7 @@ bool GraphExecutor::OutNode::Run( const bool AndSuspend ) { // PushEvent( anInNode , GraphExecutor::ReadyEvent , // SUPERV::DataReadyState ) ; anInNode->CreateNewThread( true ) ; - anInNode->DataFromNode( Name() ) ; + anInNode->DataFromNode( Graph()->Name() ) ; if ( AndSuspend ) { anInNode->State( SUPERV::DataWaitingState ) ; anInNode->ControlState( SUPERV::ToSuspendStartState ) ; @@ -516,8 +580,8 @@ bool GraphExecutor::OutNode::Run( const bool AndSuspend ) { }; } ostringstream astr ; - astr << "Graph " << Name() << " is running" ; - ObjImpl()->sendMessage( NOTIF_STEP, astr.str().c_str() ) ; + astr << "Graph " << Graph()->Name() << " is running" ; + Graph()->ObjImpl()->sendMessage( NOTIF_STEP, astr.str().c_str() ) ; RetVal = true ; } else { @@ -535,7 +599,7 @@ bool GraphExecutor::OutNode::Run( const char * aNodeName , bool RetVal = false ; cdebug_in << "GraphExecutor::OutNode::Run( " << aNodeName << " , " << AtNodeName << " , " << AndSuspend << ")" << endl; - GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) GetGraphNode( aNodeName )->GetInNode() ; + GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) Graph()->GetGraphNode( aNodeName )->GetInNode() ; if ( anInNode ) { RetVal = anInNode->ReStart( AtNodeName , AndSuspend ) ; } @@ -550,10 +614,10 @@ void GraphExecutor::OutNode::CheckAllDone() { SUPERV::AutomatonState InNodeState ; bool AllDone = true ; if ( !Done() ) { - for ( j = 0 ; j < QueueNodesSize() ; j++ ) { - InNodeState = ( (GraphExecutor::InNode * ) QueueNodes( j )->GetInNode() )->State() ; + for ( j = 0 ; j < Graph()->QueueNodesSize() ; j++ ) { + InNodeState = ( (GraphExecutor::InNode * ) Graph()->QueueNodes( j )->GetInNode() )->State() ; cdebug << j << ". " - << ( (GraphExecutor::InNode * ) QueueNodes( j )->GetInNode() )->Name() + << ( (GraphExecutor::InNode * ) Graph()->QueueNodes( j )->GetInNode() )->Name() << " " << theAutomaton->StateName( InNodeState ) << endl ; if ( InNodeState != SUPERV::SuccessedState && InNodeState != SUPERV::ErroredState && @@ -578,9 +642,9 @@ void GraphExecutor::OutNode::CheckAllDone() { } if ( AllDone ) { int alivenodes = 0 ; - for ( j = 0 ; j < GraphNodesSize() ; j++ ) { + for ( j = 0 ; j < Graph()->GraphNodesSize() ; j++ ) { GraphExecutor::InNode * aNode ; - aNode = (GraphExecutor::InNode * ) GraphNodes( j )->GetInNode() ; + aNode = (GraphExecutor::InNode * ) Graph()->GraphNodes( j )->GetInNode() ; SUPERV::GraphState aState = AutomatonGraphState( aNode->State() ) ; cdebug << "GraphExecutor::OutNode::CheckAllDone " << aNode->Name() << " " << theAutomaton->StateName( aNode->State() ) << " CreateNewThread " << aNode->CreateNewThread() @@ -619,18 +683,18 @@ void GraphExecutor::OutNode::CheckAllDone() { } if ( IsDone() ) { MESSAGE("================================================================================") ; - MESSAGE( Name() << " IS DONE : " << theAutomaton->StateName( AutomatonState() ) << " EventQSize " + MESSAGE( Graph()->Name() << " IS DONE : " << theAutomaton->StateName( AutomatonState() ) << " EventQSize " << EventQSize() ) ; MESSAGE("================================================================================") ; cdebug << "================================================================================" << endl ; - cdebug << Name() << " IS DONE : " << theAutomaton->StateName( AutomatonState() ) << " EventQSize " + cdebug << Graph()->Name() << " IS DONE : " << theAutomaton->StateName( AutomatonState() ) << " EventQSize " << EventQSize() << endl ; cdebug << "================================================================================" << endl ; ostringstream astr ; - astr << "Graph " << Name() << " is done : " + astr << "Graph " << Graph()->Name() << " is done : " << theAutomaton->StateName( AutomatonState() ) ; - ObjImpl()->sendMessage( NOTIF_STEP, astr.str().c_str() ) ; - //cout << Name() << " IS DONE : " << theAutomaton->StateName( AutomatonState() ) << " EventQSize " + Graph()->ObjImpl()->sendMessage( NOTIF_STEP, astr.str().c_str() ) ; + //cout << Graph()->Name() << " IS DONE : " << theAutomaton->StateName( AutomatonState() ) << " EventQSize " // << EventQSize() << endl ; } cdebug_out << "GraphExecutor::OutNode::CheckAllDone " << IsDone() @@ -774,7 +838,7 @@ void GraphExecutor::OutNode::ResumeThread() { long GraphExecutor::OutNode::Thread( const char * aNodeName ) { long RetVal = 0 ; - GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) GetGraphNode( aNodeName )->GetInNode() ; + GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) Graph()->GetGraphNode( aNodeName )->GetInNode() ; if ( anInNode ) { RetVal = anInNode->ThreadNo() ; } @@ -1086,7 +1150,7 @@ bool GraphExecutor::OutNode::PushEvent( GraphExecutor::InNode * aNode , _EventNodes.push_back( aNode->Name() ) ; } else { - _EventNodes.push_back( Name() ) ; + _EventNodes.push_back( Graph()->Name() ) ; } _Events.push_back( anEvent ) ; _States.push_back( aState ) ; @@ -1099,7 +1163,7 @@ bool GraphExecutor::OutNode::PushEvent( GraphExecutor::InNode * aNode , // << aNode->Automaton()->ControlStateName( aNode->ControlState() ) ; } else { -// cdebug << "PushEvent " << Name() ; +// cdebug << "PushEvent " << Graph()->Name() ; // cdebug << " " << theAutomaton->EventName( anEvent ) << " " // << theAutomaton->StateName( aState ) ; } @@ -1208,8 +1272,8 @@ bool GraphExecutor::OutNode::EventW( char ** aNodeName , aState != SUPERV::RunningState && aState != SUPERV::SuspendDoneState && aState != SUPERV::SuspendErroredState ) { - NodeName = Name() ; - while ( sts && !strcmp( NodeName , Name() ) ) { + NodeName = Graph()->Name() ; + while ( sts && !strcmp( NodeName , Graph()->Name() ) ) { sts = EventWait( aNodeName , anEvent , aState ) ; NodeName = *aNodeName ; } @@ -1258,7 +1322,7 @@ bool GraphExecutor::OutNode::EventWait( char ** aNodeName , _States.pop_front() ; } - aNode = ((GraphExecutor::InNode *) GetGraphNode( NodeName )->GetInNode()) ; + aNode = ((GraphExecutor::InNode *) Graph()->GetGraphNode( NodeName )->GetInNode()) ; cdebug << "EventW Previous Node " << NodeName << " ThreadsNumber " << ThreadsNumber << " _EventNodes.size() " << _EventNodes.size() << " " @@ -1371,7 +1435,7 @@ void GraphExecutor::OutNode::EventList() { } void GraphExecutor::OutNode::State(SUPERV::AutomatonState aState ) { -// cdebug << "GraphExecutor::OutNode::State " << Name() << " " +// cdebug << "GraphExecutor::OutNode::State " << Graph()->Name() << " " // << theAutomaton->StateName( AutomatonGraphState( _State ) ) << " ---> " // << theAutomaton->StateName( AutomatonGraphState( aState ) ) << endl ; _State = aState ; @@ -1388,7 +1452,7 @@ SUPERV::GraphState GraphExecutor::OutNode::State() { SUPERV::GraphState GraphExecutor::OutNode::State( const char * NodeName ) { // cdebug_in << "GraphExecutor::OutNode::State " << NodeName << endl; SUPERV::AutomatonState aret = SUPERV::UnKnownState ; - const GraphBase::ComputingNode * aCNode = GetGraphNode( NodeName ) ; + const GraphBase::ComputingNode * aCNode = Graph()->GetGraphNode( NodeName ) ; if ( aCNode ) { GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *)aCNode->GetInNode() ; if ( anInNode ) { @@ -1405,7 +1469,7 @@ SUPERV::GraphState GraphExecutor::OutNode::State( const char * NodeName , const char * ServiceParameterName ) { // cdebug_in << "GraphExecutor::OutNode::State " << NodeName << " " // << ServiceParameterName<< endl; - SUPERV::GraphState aret = PortState( NodeName , ServiceParameterName ) ; + SUPERV::GraphState aret = Graph()->PortState( NodeName , ServiceParameterName ) ; // cdebug_out << "GraphExecutor::OutNode::State" << endl ; return aret ; } @@ -1419,7 +1483,7 @@ SUPERV::AutomatonState GraphExecutor::OutNode::AutomatonState() { SUPERV::AutomatonState GraphExecutor::OutNode::AutomatonState( const char * NodeName ) { // cdebug_in << "GraphExecutor::OutNode::AutomatonState " << NodeName << endl; SUPERV::AutomatonState aret = SUPERV::UnKnownState ; - GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) GetGraphNode( NodeName )->GetInNode() ; + GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) Graph()->GetGraphNode( NodeName )->GetInNode() ; if ( anInNode ) aret = anInNode->State() ; // cdebug_out << "GraphExecutor::OutNode::AutomatonState" << endl ; @@ -1435,7 +1499,7 @@ SUPERV::ControlState GraphExecutor::OutNode::ControlState() { SUPERV::ControlState GraphExecutor::OutNode::ControlState( const char * NodeName ) { // cdebug_in << "GraphExecutor::OutNode::ControlState " << NodeName << endl; SUPERV::ControlState aret = SUPERV::VoidState ; - GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) GetGraphNode( NodeName )->GetInNode() ; + GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) Graph()->GetGraphNode( NodeName )->GetInNode() ; if ( anInNode ) aret = anInNode->ControlState() ; // cdebug_out << "GraphExecutor::OutNode::ControlState" << endl ; @@ -1450,7 +1514,7 @@ void GraphExecutor::OutNode::ControlClear() { void GraphExecutor::OutNode::ControlClear( const char * NodeName ) { // cdebug_in << "GraphExecutor::OutNode::ControlClear " << NodeName << endl; - GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) GetGraphNode( NodeName )->GetInNode() ; + GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) Graph()->GetGraphNode( NodeName )->GetInNode() ; if ( anInNode ) anInNode->ControlClear() ; // cdebug_out << "GraphExecutor::OutNode::ControlClear" << endl ; @@ -1513,7 +1577,7 @@ bool GraphExecutor::OutNode::IsStopped() { bool GraphExecutor::OutNode::IsWaiting( const char * NodeName ) { bool aret = false ; // cdebug_in << "GraphExecutor::OutNode::IsWaiting " << NodeName << endl; - GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) GetGraphNode( NodeName )->GetInNode() ; + GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) Graph()->GetGraphNode( NodeName )->GetInNode() ; if ( anInNode ) { aret = anInNode->IsWaiting() ; } @@ -1524,7 +1588,7 @@ bool GraphExecutor::OutNode::IsWaiting( const char * NodeName ) { bool GraphExecutor::OutNode::IsReady( const char * NodeName ) { bool aret = false ; // cdebug_in << "GraphExecutor::OutNode::IsReady " << NodeName << endl; - GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) GetGraphNode( NodeName )->GetInNode() ; + GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) Graph()->GetGraphNode( NodeName )->GetInNode() ; if ( anInNode ) { aret = anInNode->IsReady() ; } @@ -1535,7 +1599,7 @@ bool GraphExecutor::OutNode::IsReady( const char * NodeName ) { bool GraphExecutor::OutNode::IsRunning( const char * NodeName ) { bool aret = false ; // cdebug_in << "GraphExecutor::OutNode::IsRunning " << NodeName << endl; - GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) GetGraphNode( NodeName )->GetInNode() ; + GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) Graph()->GetGraphNode( NodeName )->GetInNode() ; if ( anInNode ) { aret = anInNode->IsRunning() ; } @@ -1546,7 +1610,7 @@ bool GraphExecutor::OutNode::IsRunning( const char * NodeName ) { bool GraphExecutor::OutNode::IsDone( const char * NodeName ) { bool aret = false ; // cdebug_in << "GraphExecutor::OutNode::IsDone " << NodeName << endl; - GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) GetGraphNode( NodeName )->GetInNode() ; + GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) Graph()->GetGraphNode( NodeName )->GetInNode() ; if ( anInNode ) { aret = anInNode->IsDone() ; } @@ -1557,7 +1621,7 @@ bool GraphExecutor::OutNode::IsDone( const char * NodeName ) { bool GraphExecutor::OutNode::IsSuspended( const char * NodeName ) { bool aret = false ; // cdebug_in << "GraphExecutor::OutNode::IsSuspended " << NodeName << endl; - GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) GetGraphNode( NodeName )->GetInNode() ; + GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) Graph()->GetGraphNode( NodeName )->GetInNode() ; if ( anInNode ) { aret = anInNode->IsSuspended() ; } @@ -1569,7 +1633,7 @@ bool GraphExecutor::OutNode::IsDone( const char * NodeName , const char * ServiceParameterName ) { // cdebug_in << "GraphExecutor::OutNode::IsDone " << NodeName << " " // << ServiceParameterName<< endl; - bool aret = PortDone( NodeName , ServiceParameterName ) ; + bool aret = Graph()->PortDone( NodeName , ServiceParameterName ) ; // cdebug_out << "GraphExecutor::OutNode::IsDone" << endl ; return aret ; } @@ -1579,8 +1643,8 @@ bool GraphExecutor::OutNode::ContainerKill() { cdebug_in << "GraphExecutor::OutNode::ContainerKill" << endl; _ControlState = SUPERV::ToSuspendState ; int i ; - for ( i = 0 ; i < GraphNodesSize() ; i++ ) { - GraphExecutor::InNode * aNode = (GraphExecutor::InNode * ) GraphNodes( i )->GetInNode() ; + for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) { + GraphExecutor::InNode * aNode = (GraphExecutor::InNode * ) Graph()->GraphNodes( i )->GetInNode() ; bool sts = aNode->ContainerKill() ; if ( sts && aNode->IsKilled() ) { cdebug << aNode->Name() << " killed" << endl ; @@ -1596,8 +1660,8 @@ bool GraphExecutor::OutNode::ContainerKill() { } } if ( !RetVal || Threads() != 0 ) { - for ( i = 0 ; i < GraphNodesSize() ; i++ ) { - GraphExecutor::InNode * aNode = (GraphExecutor::InNode * ) GraphNodes( i )->GetInNode() ; + for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) { + GraphExecutor::InNode * aNode = (GraphExecutor::InNode * ) Graph()->GraphNodes( i )->GetInNode() ; if ( !aNode->IsKilled() && !aNode->IsWaiting() && !aNode->IsDone() ) { aNode->KilledAction() ; } @@ -1614,8 +1678,8 @@ bool GraphExecutor::OutNode::Suspend() { cdebug_in << "GraphExecutor::OutNode::Suspend" << endl; // _ControlState = SUPERV::ToSuspendState ; int i ; - for ( i = 0 ; i < GraphNodesSize() ; i++ ) { - GraphExecutor::InNode * aNode = (GraphExecutor::InNode * ) GraphNodes( i )->GetInNode() ; + for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) { + GraphExecutor::InNode * aNode = (GraphExecutor::InNode * ) Graph()->GraphNodes( i )->GetInNode() ; bool sts = aNode->Suspend() ; if ( sts && aNode->IsSuspended() ) { RetVal += 1 ; @@ -1634,12 +1698,12 @@ bool GraphExecutor::OutNode::Suspend() { if ( RetVal ) { State( SUPERV::SuspendedState ) ; MESSAGE("================================================================================") ; - MESSAGE( Name() << " IS SUSPENDED" ) ; + MESSAGE( Graph()->Name() << " IS SUSPENDED" ) ; MESSAGE("================================================================================") ; } else { MESSAGE("================================================================================") ; - MESSAGE( Name() << " IS NOT SUSPENDED" ) ; + MESSAGE( Graph()->Name() << " IS NOT SUSPENDED" ) ; MESSAGE("================================================================================") ; } cdebug_out << "GraphExecutor::OutNode::Suspend" << theAutomaton->StateName( State() ) << endl ; @@ -1652,8 +1716,8 @@ bool GraphExecutor::OutNode::Resume() { if ( IsSuspended() ) { State( SUPERV::ExecutingState ) ; int i ; - for ( i = 0 ; i < GraphNodesSize() ; i++ ) { - GraphExecutor::InNode * aNode = (GraphExecutor::InNode * ) GraphNodes( i )->GetInNode() ; + for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) { + GraphExecutor::InNode * aNode = (GraphExecutor::InNode * ) Graph()->GraphNodes( i )->GetInNode() ; aNode->ControlState( SUPERV::VoidState ) ; if ( aNode->IsSuspended() ) { cdebug << aNode->Name() << "->Resume " << theAutomaton->StateName( aNode->State() ) @@ -1675,16 +1739,16 @@ bool GraphExecutor::OutNode::Resume() { } } else { - cdebug << Name() << " not suspended " << theAutomaton->StateName( State() ) << endl ; + cdebug << Graph()->Name() << " not suspended " << theAutomaton->StateName( State() ) << endl ; } if ( RetVal ) { MESSAGE("================================================================================") ; - MESSAGE( Name() << " IS RESUMED" ) ; + MESSAGE( Graph()->Name() << " IS RESUMED" ) ; MESSAGE("================================================================================") ; } else { MESSAGE("================================================================================") ; - MESSAGE( Name() << " IS NOT RESUMED" ) ; + MESSAGE( Graph()->Name() << " IS NOT RESUMED" ) ; MESSAGE("================================================================================") ; } cdebug_out << "GraphExecutor::OutNode::Resume" << theAutomaton->StateName( State() ) << " " << RetVal << endl ; @@ -1696,8 +1760,8 @@ bool GraphExecutor::OutNode::Kill() { cdebug_in << "GraphExecutor::OutNode::Kill" << endl; _ControlState = SUPERV::ToSuspendState ; int i ; - for ( i = 0 ; i < GraphNodesSize() ; i++ ) { - GraphExecutor::InNode * aNode = (GraphExecutor::InNode * ) GraphNodes( i )->GetInNode() ; + for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) { + GraphExecutor::InNode * aNode = (GraphExecutor::InNode * ) Graph()->GraphNodes( i )->GetInNode() ; bool sts = aNode->Kill() ; if ( sts && aNode->IsKilled() ) { cdebug << aNode->Name() << " killed" << endl ; @@ -1713,8 +1777,8 @@ bool GraphExecutor::OutNode::Kill() { } } if ( !RetVal || Threads() != 0 ) { - for ( i = 0 ; i < GraphNodesSize() ; i++ ) { - GraphExecutor::InNode * aNode = (GraphExecutor::InNode * ) GraphNodes( i )->GetInNode() ; + for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) { + GraphExecutor::InNode * aNode = (GraphExecutor::InNode * ) Graph()->GraphNodes( i )->GetInNode() ; if ( !aNode->IsKilled() && !aNode->IsWaiting() && !aNode->IsDone() ) { cdebug << aNode->Name() << " not killed : " << theAutomaton->StateName( aNode->State() ) << " " << aNode->Name() << "->" @@ -1727,12 +1791,12 @@ bool GraphExecutor::OutNode::Kill() { State( SUPERV::KilledState ) ; if ( RetVal ) { MESSAGE("================================================================================") ; - MESSAGE( Name() << " IS KILLED" ) ; + MESSAGE( Graph()->Name() << " IS KILLED" ) ; MESSAGE("================================================================================") ; } else { MESSAGE("================================================================================") ; - MESSAGE( Name() << " IS NOT KILLED" ) ; + MESSAGE( Graph()->Name() << " IS NOT KILLED" ) ; MESSAGE("================================================================================") ; } cdebug_out << "GraphExecutor::OutNode::Kill" << endl ; @@ -1746,7 +1810,7 @@ bool GraphExecutor::OutNode::Stop() { cdebug_out << "GraphExecutor::OutNode::Stop" << endl ; if ( RetVal ) { MESSAGE("================================================================================") ; - MESSAGE( Name() << " IS STOPPED" ) ; + MESSAGE( Graph()->Name() << " IS STOPPED" ) ; MESSAGE("================================================================================") ; } return RetVal ; @@ -1856,7 +1920,7 @@ bool GraphExecutor::OutNode::SuspendedWait() { bool GraphExecutor::OutNode::ReadyWait( const char * NodeName ) { bool aret = false ; cdebug_in << "GraphExecutor::OutNode::ReadyWait " << NodeName << endl; - GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) GetGraphNode( NodeName )->GetInNode() ; + GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) Graph()->GetGraphNode( NodeName )->GetInNode() ; if ( anInNode ) { aret = anInNode->ReadyWait() ; } @@ -1867,7 +1931,7 @@ bool GraphExecutor::OutNode::ReadyWait( const char * NodeName ) { bool GraphExecutor::OutNode::RunningWait( const char * NodeName ) { bool aret = false ; cdebug_in << "GraphExecutor::OutNode::RunningWait " << NodeName << endl; - GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) GetGraphNode( NodeName )->GetInNode() ; + GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) Graph()->GetGraphNode( NodeName )->GetInNode() ; if ( anInNode ) { aret = anInNode->RunningWait() ; } @@ -1878,7 +1942,7 @@ bool GraphExecutor::OutNode::RunningWait( const char * NodeName ) { bool GraphExecutor::OutNode::DoneWait( const char * NodeName ) { bool aret = false ; cdebug_in << "GraphExecutor::OutNode::DoneWait " << NodeName << endl; - GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) GetGraphNode( NodeName )->GetInNode() ; + GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) Graph()->GetGraphNode( NodeName )->GetInNode() ; if ( anInNode ) { aret = anInNode->DoneWait() ; } @@ -1889,7 +1953,7 @@ bool GraphExecutor::OutNode::DoneWait( const char * NodeName ) { bool GraphExecutor::OutNode::SuspendedWait( const char * NodeName ) { bool aret = false ; cdebug_in << "GraphExecutor::OutNode::SuspendedWait " << NodeName << endl; - GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) GetGraphNode( NodeName )->GetInNode() ; + GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) Graph()->GetGraphNode( NodeName )->GetInNode() ; if ( anInNode ) { aret = anInNode->SuspendedWait() ; } @@ -1900,14 +1964,14 @@ bool GraphExecutor::OutNode::SuspendedWait( const char * NodeName ) { long GraphExecutor::OutNode::LastLevelDone() { int RetVal = -1 ; int i , j ; - for ( i = 0 ; i <= LevelMax() ; i++ ) { - for ( j = 0 ; j <= NodesNumber( i ) ; j++ ) { - GraphBase::ComputingNode * aNode = SortedNodes( i , j ) ; + for ( i = 0 ; i <= Graph()->LevelMax() ; i++ ) { + for ( j = 0 ; j <= Graph()->NodesNumber( i ) ; j++ ) { + GraphBase::ComputingNode * aNode = Graph()->SortedNodes( i , j ) ; if ( !IsDone( aNode->Name() ) ) { break ; } } - if ( j != NodesNumber( i ) + 1 ) + if ( j != Graph()->NodesNumber( i ) + 1 ) break ; RetVal = i ; } @@ -1919,7 +1983,7 @@ const CORBA::Any *GraphExecutor::OutNode::GetInData( const char * NodeName , const char * ServiceParameterName ) { // cdebug_in << "GraphExecutor::OutNode::GetInData " << NodeName << " " // << ServiceParameterName << endl ; - const CORBA::Any * retdata = PortInData( NodeName , ServiceParameterName ) ; + const CORBA::Any * retdata = Graph()->PortInData( NodeName , ServiceParameterName ) ; // cdebug_out << "GraphExecutor::OutNode::GetInData" << endl ; return retdata ; } @@ -1928,17 +1992,17 @@ const CORBA::Any *GraphExecutor::OutNode::GetOutData( const char * NodeName , const char * ServiceParameterName ) { // cdebug_in << "GraphExecutor::OutNode::GetOutData " << NodeName << " " // << ServiceParameterName << endl ; - const CORBA::Any * retdata = PortOutData( NodeName , ServiceParameterName ) ; + const CORBA::Any * retdata = Graph()->PortOutData( NodeName , ServiceParameterName ) ; // cdebug_out << "GraphExecutor::OutNode::GetOutData" << endl ; return retdata ; } const long GraphExecutor::OutNode::CpuUsed() { - return GraphBase::Graph::CpuUsed() ; + return Graph()->CpuUsed() ; } const long GraphExecutor::OutNode::CpuUsed( const char * aNodeName ) { - GraphBase::ComputingNode * aNode = GetChangeGraphNode( aNodeName ) ; + GraphBase::ComputingNode * aNode = Graph()->GetChangeGraphNode( aNodeName ) ; if ( aNode ) { GraphExecutor::InNode * anInNode = (GraphExecutor::InNode * ) aNode->GetInNode() ; if ( anInNode ) { diff --git a/src/GraphExecutor/DataFlowExecutor_OutNode.hxx b/src/GraphExecutor/DataFlowExecutor_OutNode.hxx index 1f764f5..16fd6f0 100644 --- a/src/GraphExecutor/DataFlowExecutor_OutNode.hxx +++ b/src/GraphExecutor/DataFlowExecutor_OutNode.hxx @@ -31,16 +31,22 @@ #include "SALOME_Component_i.hxx" -#include "DataFlowBase_Graph.hxx" +#include "DataFlowBase_StreamGraph.hxx" #include "DataFlowExecutor_InNode.hxx" namespace GraphExecutor { - class OutNode : public GraphBase::Graph { +// class OutNode : public GraphBase::Graph { + class OutNode : public GraphBase::Base { private : + GraphBase::StreamGraph * _StreamGraph ; + GraphBase::Graph * _Graph ; + + int _Graph_prof_debug ; + bool _PyInitialized ; bool _Valid ; bool _Executable ; @@ -74,7 +80,8 @@ namespace GraphExecutor { OutNode() ; OutNode( CORBA::ORB_ptr ORB, SALOME_NamingService* ptrNamingService , const char *DataFlowName , - const char * DebugFileName ); + const char * DebugFileName , + const SUPERV::KindOfNode aKindOfNode ); OutNode( CORBA::ORB_ptr ORB, SALOME_NamingService* ptrNamingService , const SALOME_ModuleCatalog::Service& DataFlowService , const char *DataFlowComponentName , @@ -90,6 +97,16 @@ namespace GraphExecutor { const char * DebugFileName ) ; virtual ~OutNode() ; + void Set_prof_debug( CORBA::ORB_ptr ORB , const char * DebugFileName ) ; + GraphBase::StreamGraph * StreamGraph() { + return _StreamGraph ; } ; + GraphBase::StreamGraph * StreamGraph() const { + return _StreamGraph ; } ; + GraphBase::Graph * Graph() { + return _Graph ; } ; + GraphBase::Graph * Graph() const { + return _Graph ; } ; + bool LoadDataFlow( const GraphBase::SGraph &aDataFlow ) ; bool LoadXml( const char* myFileName ) ; bool LoadInfo( const GraphBase::SNode &aDataFlowInfo ) ; @@ -147,6 +164,8 @@ namespace GraphExecutor { long SuspendedThreads() { return _SuspendedThreads ; } ; void JoinedWait() ; + pthread_t ThreadNo() { + return _Graph->ThreadNo() ; } ; long Thread( const char * NodeName ) ; bool PushEvent( GraphExecutor::InNode * aNode , diff --git a/src/GraphExecutor/DataFlowExecutor_PyDynInvoke.cxx b/src/GraphExecutor/DataFlowExecutor_PyDynInvoke.cxx index 03fe20f..22ac4d0 100644 --- a/src/GraphExecutor/DataFlowExecutor_PyDynInvoke.cxx +++ b/src/GraphExecutor/DataFlowExecutor_PyDynInvoke.cxx @@ -104,8 +104,10 @@ bool GraphExecutor::InNode::InitPython() { } PyObject * GraphExecutor::InNode::InitPyDynInvoke( char * PyFuncName , - const SUPERV::ListOfStrings * aPythonFunction ) { + const SUPERV::ListOfStrings * aPythonFunction , + bool & Err ) { bool RetVal = true ; + Err = false ; string aPyFunc ; PyObject * thePyRunMethod = NULL ; @@ -129,6 +131,7 @@ PyObject * GraphExecutor::InNode::InitPyDynInvoke( char * PyFuncName , if ( PyRun_SimpleString( (char *) aPyFunc.c_str() ) ) { cdebug << ThreadNo() << " " << Name() << " PyRun_SimpleString ERROR " << endl << aPyFunc << endl ; RetVal = false ; + Err = true ; } else { PyFuncRunned( true ) ; diff --git a/src/GraphExecutor/Makefile.in b/src/GraphExecutor/Makefile.in index 6582602..2786b4f 100644 --- a/src/GraphExecutor/Makefile.in +++ b/src/GraphExecutor/Makefile.in @@ -47,13 +47,12 @@ BIN_SERVER_IDL = CPPFLAGS+= $(PYTHON_INCLUDES) $(QT_MT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) \ -I${KERNEL_ROOT_DIR}/include/salome -#CXXFLAGS= -g -D_DEBUG_ -D__x86__ -D__linux__ -ftemplate-depth-42 -Wno-deprecated CXXFLAGS= -g -D_DEBUG_ -D__x86__ -D__linux__ -ftemplate-depth-42 -Wall \ -I${KERNEL_ROOT_DIR}/include/salome -#LDFLAGS+= -lSalomeNS -lSalomeLifeCycleCORBA -lSalomeSuperVisionBase -lOpUtil -lSalomeLoggerServer -lc $(PYTHON_LIBS) $(QT_MT_LIBS) $(OGL_LIBS) LDFLAGS+= -export-dynamic -lSalomeNS -lSalomeLifeCycleCORBA -lSalomeSuperVisionBase -lOpUtil -lSALOMELocalTrace \ -lc $(QT_MT_LIBS) $(OGL_LIBS) \ -L${KERNEL_ROOT_DIR}/lib/salome +#LIBS += -Xlinker -export-dynamic $(PYTHON_LIBS) @CONCLUDE@ diff --git a/src/Makefile.in b/src/Makefile.in index ba255af..fd10177 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -31,6 +31,6 @@ VPATH=.:@srcdir@ @COMMENCE@ -SUBDIRS = GraphBase GraphExecutor GraphEditor Supervision SUPERVGUI AddComponent DivComponent FactorialComponent MulComponent SubComponent SyrControlComponent SyrComponent TypesCheck +SUBDIRS = GraphBase GraphExecutor GraphEditor Supervision SUPERVGUI AddComponent DivComponent FactorialComponent MulComponent SubComponent SyrControlComponent SyrComponent TypesCheck DataStreamComponent @MODULE@ diff --git a/src/MulComponent/MulComponent.cxx b/src/MulComponent/MulComponent.cxx index 1b4c41f..32d0bcd 100644 --- a/src/MulComponent/MulComponent.cxx +++ b/src/MulComponent/MulComponent.cxx @@ -64,7 +64,7 @@ void MulComponentEngine::Mul( double x , double y , double & z ) { sendMessage(NOTIF_STEP, "Mul is Computing"); S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); MESSAGE( "MulComponentEngine::Mul( " << x << " , " << y << " , " << z << " ) after " << S << " seconds" ) endService( " MulComponentEngine::Mul" ); diff --git a/src/SubComponent/SubComponent.cxx b/src/SubComponent/SubComponent.cxx index 76ed6e1..e5cd824 100644 --- a/src/SubComponent/SubComponent.cxx +++ b/src/SubComponent/SubComponent.cxx @@ -64,7 +64,7 @@ void SubComponentEngine::Sub( double x , double y , double & z ) { sendMessage(NOTIF_STEP, "Sub is Computing"); S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); MESSAGE( "SubComponentEngine::Sub( " << x << " , " << y << " , " << z << " ) after " << S << " seconds" ) endService( " SubComponentEngine::Sub" ); diff --git a/src/Supervision/CNode_Impl.cxx b/src/Supervision/CNode_Impl.cxx index a6d19de..05efc85 100644 --- a/src/Supervision/CNode_Impl.cxx +++ b/src/Supervision/CNode_Impl.cxx @@ -17,11 +17,11 @@ using namespace std; //#include "utilities.h" -#include "Graph_Impl.hxx" +#include "StreamGraph_Impl.hxx" #include "CNode_Impl.hxx" -#include "Port_Impl.hxx" +#include "StreamPort_Impl.hxx" CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb , PortableServer::POA_ptr poa , @@ -88,6 +88,26 @@ CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb , NodeKindOfNode , aFuncName , aPythonFunction ) ; + if ( _DataFlowEditor->Graph()->IsDataStreamNode() && + ( _DataFlowNode->IsComputingNode() || _DataFlowNode->IsFactoryNode() ) ) { + unsigned int i ; + for ( i = 0 ; i < NodeService.ServiceinDataStreamParameter.length() ; i++ ) { + GraphBase::InDataStreamPort * aDataStreamPort ; + aDataStreamPort = _DataFlowNode->ComputingNode()->AddInDataStreamPort( + my_strdup( NodeService.ServiceinDataStreamParameter[i].Parametername ) , + NodeService.ServiceinDataStreamParameter[i].Parametertype , + NodeService.ServiceinDataStreamParameter[i].Parameterdependency , + SUPERV::DataStreamParameter ) ; + } + for ( i = 0 ; i < NodeService.ServiceoutDataStreamParameter.length() ; i++ ) { + GraphBase::OutDataStreamPort * aDataStreamPort ; + aDataStreamPort = _DataFlowNode->ComputingNode()->AddOutDataStreamPort( + my_strdup( NodeService.ServiceoutDataStreamParameter[i].Parametername ) , + NodeService.ServiceoutDataStreamParameter[i].Parametertype , + NodeService.ServiceoutDataStreamParameter[i].Parameterdependency , + SUPERV::DataStreamParameter ) ; + } + } _IsNode = true ; endService( "CNode_Impl::CNode_Impl" ); // cout << "<-- CNode_Impl::CNode_Impl" << endl ; @@ -123,6 +143,26 @@ CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb , NodeKindOfNode , aFuncName , aPythonFunction ) ; + if ( _DataFlowEditor->Graph()->IsDataStreamNode() && + ( _DataFlowNode->IsComputingNode() || _DataFlowNode->IsFactoryNode() ) ) { + unsigned int i ; + for ( i = 0 ; i < NodeService.ServiceinDataStreamParameter.length() ; i++ ) { + GraphBase::InDataStreamPort * aDataStreamPort ; + aDataStreamPort = _DataFlowNode->ComputingNode()->AddInDataStreamPort( + my_strdup( NodeService.ServiceinDataStreamParameter[i].Parametername ) , + NodeService.ServiceinDataStreamParameter[i].Parametertype , + NodeService.ServiceinDataStreamParameter[i].Parameterdependency , + SUPERV::DataStreamParameter ) ; + } + for ( i = 0 ; i < NodeService.ServiceoutDataStreamParameter.length() ; i++ ) { + GraphBase::OutDataStreamPort * aDataStreamPort ; + aDataStreamPort = _DataFlowNode->ComputingNode()->AddOutDataStreamPort( + my_strdup( NodeService.ServiceoutDataStreamParameter[i].Parametername ) , + NodeService.ServiceoutDataStreamParameter[i].Parametertype , + NodeService.ServiceoutDataStreamParameter[i].Parameterdependency , + SUPERV::DataStreamParameter ) ; + } + } _IsNode = true ; endService( "CNode_Impl::CNode_Impl" ); } @@ -142,6 +182,9 @@ CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb , _thisObj = this ; _id = _poa->activate_object(_thisObj); } + else { + MESSAGE( "CNode_Impl::CNode_Impl NO _poa->activate_object " ); + } _Orb = CORBA::ORB::_duplicate(orb); _Poa = poa ; _ContId = contId ; @@ -167,7 +210,7 @@ void CNode_Impl::destroy() { _thisObj->_remove_ref(); } } - endService( "CNode_Impl::Destroy" ); +// endService( "CNode_Impl::Destroy" ); } bool CNode_Impl::Delete() { @@ -203,7 +246,7 @@ char * CNode_Impl::Name() { RetVal = _DataFlowNode->Name() ; } else { - RetVal = _DataFlowEditor->Name() ; + RetVal = _DataFlowEditor->Graph()->Name() ; } // endService( "CNode_Impl::Name" ); return CORBA::string_dup( RetVal ); @@ -217,7 +260,7 @@ bool CNode_Impl::SetName( const char * aDataFlowName ) { aDataFlowName ) ; } else { - RetVal = _DataFlowEditor->Name( aDataFlowName ) ; + RetVal = _DataFlowEditor->Graph()->Name( aDataFlowName ) ; } } // endService( "CNode_Impl::SetName" ); @@ -230,7 +273,7 @@ SUPERV::KindOfNode CNode_Impl::Kind() { RetVal = _DataFlowNode->Kind() ; } else { - RetVal = _DataFlowEditor->Kind() ; + RetVal = _DataFlowEditor->Graph()->Kind() ; } // endService( "CNode_Impl::Kind" ); return RetVal ; @@ -242,11 +285,23 @@ bool CNode_Impl::IsGraph() { RetVal = _DataFlowNode->IsDataFlowNode() ; } else { - RetVal = _DataFlowEditor->IsDataFlowNode() ; + RetVal = _DataFlowEditor->Graph()->IsDataFlowNode() ; } // endService( "CNode_Impl::IsGraph" ); return RetVal ; } +bool CNode_Impl::IsStreamGraph() { +// beginService( "CNode_Impl::IsStreamGraph" ); + bool RetVal = false ; + if ( _IsNode ) { + RetVal = _DataFlowNode->IsDataStreamNode() ; + } + else { + RetVal = _DataFlowEditor->Graph()->IsDataStreamNode() ; + } +// endService( "CNode_Impl::IsStreamGraph" ); + return RetVal ; +} bool CNode_Impl::IsComputing() { // beginService( "CNode_Impl::IsComputing" ); bool RetVal = SUPERV::UnknownNode ; @@ -254,7 +309,7 @@ bool CNode_Impl::IsComputing() { RetVal = _DataFlowNode->IsComputingNode() ; } else { - RetVal = _DataFlowEditor->IsComputingNode() ; + RetVal = _DataFlowEditor->Graph()->IsComputingNode() ; } // endService( "CNode_Impl::IsComputing" ); return RetVal ; @@ -266,7 +321,7 @@ bool CNode_Impl::IsFactory() { RetVal = _DataFlowNode->IsFactoryNode() ; } else { - RetVal = _DataFlowEditor->IsFactoryNode() ; + RetVal = _DataFlowEditor->Graph()->IsFactoryNode() ; } // endService( "CNode_Impl::IsFactory" ); return RetVal ; @@ -278,7 +333,7 @@ bool CNode_Impl::IsInLine() { RetVal = _DataFlowNode->IsInLineNode() ; } else { - RetVal = _DataFlowEditor->IsInLineNode() ; + RetVal = _DataFlowEditor->Graph()->IsInLineNode() ; } // endService( "CNode_Impl::IsInLine" ); return RetVal ; @@ -290,7 +345,7 @@ bool CNode_Impl::IsGOTO() { RetVal = _DataFlowNode->IsGOTONode() ; } else { - RetVal = _DataFlowEditor->IsGOTONode() ; + RetVal = _DataFlowEditor->Graph()->IsGOTONode() ; } // endService( "CNode_Impl::IsGOTO" ); return RetVal ; @@ -302,7 +357,7 @@ bool CNode_Impl::IsLoop() { RetVal = _DataFlowNode->IsLoopNode() ; } else { - RetVal = _DataFlowEditor->IsLoopNode() ; + RetVal = _DataFlowEditor->Graph()->IsLoopNode() ; } // endService( "CNode_Impl::IsLoop" ); return RetVal ; @@ -314,7 +369,7 @@ bool CNode_Impl::IsEndLoop() { RetVal = _DataFlowNode->IsEndLoopNode() ; } else { - RetVal = _DataFlowEditor->IsEndLoopNode() ; + RetVal = _DataFlowEditor->Graph()->IsEndLoopNode() ; } // endService( "CNode_Impl::IsEndLoop" ); return RetVal ; @@ -326,7 +381,7 @@ bool CNode_Impl::IsSwitch() { RetVal = _DataFlowNode->IsSwitchNode() ; } else { - RetVal = _DataFlowEditor->IsSwitchNode() ; + RetVal = _DataFlowEditor->Graph()->IsSwitchNode() ; } // endService( "CNode_Impl::IsSwitch" ); return RetVal ; @@ -338,7 +393,7 @@ bool CNode_Impl::IsEndSwitch() { RetVal = _DataFlowNode->IsEndSwitchNode() ; } else { - RetVal = _DataFlowEditor->IsEndSwitchNode() ; + RetVal = _DataFlowEditor->Graph()->IsEndSwitchNode() ; } // endService( "CNode_Impl::IsEndSwitch" ); return RetVal ; @@ -353,7 +408,7 @@ SUPERV::SDate CNode_Impl::CreationDate() { else { // cout << " CNode_Impl::CreationDate " << _DataFlowEditor->FirstCreation() // << endl ; - RetVal = new SUPERV::SDate( _DataFlowEditor->FirstCreation() ) ; + RetVal = new SUPERV::SDate( _DataFlowEditor->Graph()->FirstCreation() ) ; } // endService( "CNode_Impl::CreationDate" ); return (RetVal._retn()) ; @@ -365,7 +420,7 @@ SUPERV::SDate CNode_Impl::LastUpdateDate() { RetVal = new SUPERV::SDate( _DataFlowNode->LastModification() ) ; } else { - RetVal = new SUPERV::SDate( _DataFlowEditor->LastModification() ) ; + RetVal = new SUPERV::SDate( _DataFlowEditor->Graph()->LastModification() ) ; } // endService( "CNode_Impl::LastUpdateDate" ); return (RetVal._retn()) ; @@ -377,7 +432,7 @@ char * CNode_Impl::Version() { RetVal = _DataFlowNode->EditorRelease() ; } else { - RetVal = _DataFlowEditor->EditorRelease() ; + RetVal = _DataFlowEditor->Graph()->EditorRelease() ; } // endService( "CNode_Impl::Version" ); return CORBA::string_dup( RetVal ) ; @@ -389,7 +444,7 @@ char * CNode_Impl::Author() { RetVal = _DataFlowNode->Author() ; } else { - RetVal = _DataFlowEditor->Author() ; + RetVal = _DataFlowEditor->Graph()->Author() ; } // endService( "CNode_Impl::Author" ); return CORBA::string_dup( RetVal ) ; @@ -402,7 +457,7 @@ bool CNode_Impl::SetAuthor( const char * aDataFlowAuthor ) { RetVal = _DataFlowNode->Author( aDataFlowAuthor ) ; } else { - RetVal = _DataFlowEditor->Author( aDataFlowAuthor ) ; + RetVal = _DataFlowEditor->Graph()->Author( aDataFlowAuthor ) ; } } // endService( "CNode_Impl::SetAuthor" ); @@ -415,7 +470,7 @@ char * CNode_Impl::Comment() { RetVal = _DataFlowNode->Comment() ; } else { - RetVal = _DataFlowEditor->Comment() ; + RetVal = _DataFlowEditor->Graph()->Comment() ; } // endService( "CNode_Impl::Comment" ); return CORBA::string_dup( RetVal ) ; @@ -428,23 +483,13 @@ bool CNode_Impl::SetComment( const char * aDataFlowComment ) { RetVal = _DataFlowNode->Comment( aDataFlowComment ) ; } else { - RetVal = _DataFlowEditor->Comment( aDataFlowComment ) ; + RetVal = _DataFlowEditor->Graph()->Comment( aDataFlowComment ) ; } } // endService( "CNode_Impl::SetComment" ); return RetVal ; } -SUPERV::ListOfLinks * CNode_Impl::Links() { - beginService( "CNode_Impl::Links" ) ; - SUPERV::ListOfLinks_var RetVal = new SUPERV::ListOfLinks ; - if ( _DataFlowNode ) { - RetVal = DataFlowEditor()->ObjImpl()->Links( _DataFlowNode->ComputingNode() , NULL ) ; - } - endService( "CNode_Impl::Links" ) ; - return ( RetVal._retn() ) ; -} - void CNode_Impl::Coords(long X , long Y ) { // beginService( "CNode_Impl::Coords" ); if ( _DataFlowEditor->IsEditing() ) { @@ -452,7 +497,7 @@ void CNode_Impl::Coords(long X , long Y ) { ((GraphEditor::InNode *) _DataFlowNode)->Coordinates( X , Y ) ; } else { - _DataFlowEditor->Coordinates( X , Y ) ; + _DataFlowEditor->Graph()->Coordinates( X , Y ) ; } } // endService( "CNode_Impl::Coords" ); @@ -464,8 +509,7 @@ long CNode_Impl::X() { RetVal = _DataFlowNode->XCoordinate() ; } else { -// RetVal = _DataFlowEditor->XCoordinate() ; - RetVal = 0 ; + RetVal = _DataFlowEditor->Graph()->XCoordinate() ; } // endService( "CNode_Impl::X" ); return RetVal ; @@ -477,8 +521,7 @@ long CNode_Impl::Y() { RetVal = _DataFlowNode->YCoordinate() ; } else { -// RetVal = _DataFlowEditor->YCoordinate() ; - RetVal = 0 ; + RetVal = _DataFlowEditor->Graph()->YCoordinate() ; } // endService( "CNode_Impl::Y" ); return RetVal ; @@ -520,7 +563,7 @@ SUPERV::Port_ptr CNode_Impl::Port( const char * ServiceParameterName ) { } else { anoutport = _DataFlowEditor->GetOutPort( ServiceParameterName ) ; - } + } if ( aninport ) { GraphBase::InPort * anInPort ; if ( _IsNode ) { @@ -529,7 +572,10 @@ SUPERV::Port_ptr CNode_Impl::Port( const char * ServiceParameterName ) { else { anInPort = _DataFlowEditor->GetChangeInPort( ServiceParameterName ) ; } - if ( CORBA::is_nil( anInPort->ObjRef() ) ) { + if ( anInPort->IsDataStream() ) { + MESSAGE( "CNode_Impl::Port ERROR IsDataStream " ) ; + } + else if ( CORBA::is_nil( anInPort->ObjRef() ) ) { if ( begin ) { beginService( "CNode_Impl::Port" ); begin = false ; @@ -578,7 +624,10 @@ SUPERV::Port_ptr CNode_Impl::Port( const char * ServiceParameterName ) { else { anOutPort = _DataFlowEditor->GetChangeOutPort( ServiceParameterName ) ; } - if ( CORBA::is_nil( anOutPort->ObjRef() ) ) { + if ( anOutPort->IsDataStream() ) { + MESSAGE( "CNode_Impl::Port ERROR IsDataStream " ) ; + } + else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) { if ( begin ) { beginService( "CNode_Impl::Port" ); begin = false ; @@ -622,10 +671,10 @@ SUPERV::Port_ptr CNode_Impl::Input( const char * ToServiceParameterName , anInPort = _DataFlowNode->GetChangeInPort( ToServiceParameterName ) ; } else { - sts = _DataFlowEditor->AddInputData( _DataFlowEditor->Name() , + sts = _DataFlowEditor->AddInputData( _DataFlowEditor->Graph()->Name() , ToServiceParameterName , *aValue->ToAny() ) ; - anInPort = _DataFlowEditor->GetChangeInPort( ToServiceParameterName ) ; + anInPort = _DataFlowEditor->Graph()->GetChangeInPort( ToServiceParameterName ) ; } if ( sts && anInPort ) { if ( CORBA::is_nil( anInPort->ObjRef() ) ) { @@ -660,10 +709,10 @@ SUPERV::Port_ptr CNode_Impl::Input( const char * ToServiceParameterName , anInPort = _DataFlowNode->GetChangeInPort( ToServiceParameterName ) ; } else { - sts = _DataFlowExecutor->ChangeInputData( _DataFlowEditor->Name() , + sts = _DataFlowExecutor->ChangeInputData( _DataFlowEditor->Graph()->Name() , ToServiceParameterName , *aValue->ToAny() ) ; - anInPort = _DataFlowEditor->GetChangeInPort( ToServiceParameterName ) ; + anInPort = _DataFlowEditor->Graph()->GetChangeInPort( ToServiceParameterName ) ; } if ( sts && anInPort ) { if ( CORBA::is_nil( anInPort->ObjRef() ) ) { @@ -700,21 +749,11 @@ SUPERV::Port_ptr CNode_Impl::Input( const char * ToServiceParameterName , return SUPERV::Port::_duplicate( iobject ) ; } -SUPERV::Port_ptr CNode_Impl::InPort( const char *aParameterName , - const char *aParameterType ) { +SUPERV::Port_ptr CNode_Impl::GetInPort( const char *aParameterName ) { SUPERV::Port_ptr Inobject = SUPERV::Port::_nil() ; - SUPERV::Port_ptr Outobject = SUPERV::Port::_nil() ; - SUPERV::Port_ptr InEndobject = SUPERV::Port::_nil() ; Port_Impl * myInPort = NULL ; - bool InPortCreated = false ; - MESSAGE( "INode_Impl::InPort " << DataFlowNode()->Name() << "->AddInPort( " << aParameterName << " , " - << aParameterType ) ; GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( aParameterName ) ; - if ( anInPort == NULL ) { - anInPort = DataFlowNode()->AddInPort( aParameterName , aParameterType ) ; - InPortCreated = true ; - } - if ( anInPort ) { + if ( anInPort && !anInPort->IsDataStream() ) { Inobject = anInPort->ObjRef() ; if ( CORBA::is_nil( Inobject ) ) { myInPort = new Port_Impl( _Orb , _Poa , _ContId , @@ -727,36 +766,18 @@ SUPERV::Port_ptr CNode_Impl::InPort( const char *aParameterName , PortableServer::ObjectId * id = myInPort->getId() ; CORBA::Object_var obj = _poa->id_to_reference(*id) ; Inobject = SUPERV::Port::_narrow(obj) ; - } + anInPort->ObjRef( SUPERV::Port::_duplicate( Inobject ) ) ; + } } } - - if ( !CORBA::is_nil( Inobject ) && InPortCreated && - ( DataFlowNode()->IsLoopNode() || DataFlowNode()->IsEndLoopNode() || - DataFlowNode()->IsEndSwitchNode() ) ) { - Outobject = OutPort( aParameterName , aParameterType ) ; - if ( DataFlowNode()->IsLoopNode() ) { - LNode_Impl * myLoopNode = (LNode_Impl * ) this ; - InEndobject = myLoopNode->Coupled()->InPort( aParameterName , aParameterType ) ; - DataFlowEditor()->AddLink( Outobject->Node()->Name() , Outobject->Name() , - InEndobject->Node()->Name() , InEndobject->Name() ) ; - } - } - DataFlowEditor()->UnValid() ; return SUPERV::Port::_duplicate( Inobject ) ; } -SUPERV::Port_ptr CNode_Impl::OutPort( const char *aParameterName , - const char *aParameterType ) { +SUPERV::Port_ptr CNode_Impl::GetOutPort( const char *aParameterName ) { Port_Impl * myOutPort = NULL ; SUPERV::Port_ptr Outobject = SUPERV::Port::_nil() ; - MESSAGE( "INode_Impl::OutPort " << DataFlowNode()->Name() << "->AddOutPort( " << aParameterName << " , " - << aParameterType ) ; GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeOutPort( aParameterName ) ; - if ( anOutPort == NULL ) { - anOutPort = DataFlowNode()->AddOutPort( aParameterName , aParameterType ) ; - } - if ( anOutPort ) { + if ( anOutPort && !anOutPort->IsDataStream() ) { Outobject = anOutPort->ObjRef() ; if ( CORBA::is_nil( Outobject ) ) { const CORBA::Any * anAny = anOutPort->Value() ; @@ -771,219 +792,186 @@ SUPERV::Port_ptr CNode_Impl::OutPort( const char *aParameterName , PortableServer::ObjectId * id = myOutPort->getId() ; CORBA::Object_var obj = _poa->id_to_reference(*id) ; Outobject = SUPERV::Port::_narrow(obj) ; + anOutPort->ObjRef( SUPERV::Port::_duplicate( Outobject ) ) ; } } } - DataFlowEditor()->UnValid() ; return SUPERV::Port::_duplicate( Outobject ); } -SUPERV::Port_ptr CNode_Impl::InDataStreamPort( const char *aParameterName , - const char *aParameterType ) { - SUPERV::Port_ptr Inobject = SUPERV::Port::_nil() ; - SUPERV::Port_ptr Outobject = SUPERV::Port::_nil() ; - SUPERV::Port_ptr InEndobject = SUPERV::Port::_nil() ; - Port_Impl * myInPort = NULL ; - bool InPortCreated = false ; - MESSAGE( "INode_Impl::InPort " << DataFlowNode()->Name() << "->AddInPort( " << aParameterName << " , " - << aParameterType ) ; - GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( aParameterName ) ; - if ( anInPort == NULL ) { - anInPort = DataFlowNode()->AddInPort( aParameterName , aParameterType ) ; - InPortCreated = true ; - } - if ( anInPort ) { - Inobject = anInPort->ObjRef() ; - if ( CORBA::is_nil( Inobject ) ) { - myInPort = new Port_Impl( _Orb , _Poa , _ContId , +SUPERV::StreamPort_ptr CNode_Impl::GetInStreamPort( const char *aParameterName ) { + SUPERV::StreamPort_ptr Inobject = SUPERV::StreamPort::_nil() ; + if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) { + StreamPort_Impl * myInStreamPort = NULL ; + GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( aParameterName ) ; + if ( anInPort && anInPort->IsDataStream() ) { + Inobject = SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ; + if ( CORBA::is_nil( Inobject ) ) { + myInStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , DataFlowEditor() , DataFlowNode() , (GraphBase::Port * ) anInPort , true ) ; - if ( myInPort ) { - PortableServer::ObjectId * id = myInPort->getId() ; - CORBA::Object_var obj = _poa->id_to_reference(*id) ; - Inobject = SUPERV::Port::_narrow(obj) ; + if ( myInStreamPort ) { + PortableServer::ObjectId * id = myInStreamPort->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id) ; + Inobject = SUPERV::StreamPort::_narrow(obj) ; + anInPort->ObjRef( SUPERV::StreamPort::_duplicate( Inobject ) ) ; + } } } } - - if ( !CORBA::is_nil( Inobject ) && InPortCreated && - ( DataFlowNode()->IsLoopNode() || DataFlowNode()->IsEndLoopNode() || - DataFlowNode()->IsEndSwitchNode() ) ) { - Outobject = OutPort( aParameterName , aParameterType ) ; - if ( DataFlowNode()->IsLoopNode() ) { - LNode_Impl * myLoopNode = (LNode_Impl * ) this ; - InEndobject = myLoopNode->Coupled()->InPort( aParameterName , aParameterType ) ; - DataFlowEditor()->AddLink( Outobject->Node()->Name() , Outobject->Name() , - InEndobject->Node()->Name() , InEndobject->Name() ) ; - } - } - DataFlowEditor()->UnValid() ; - if ( myInPort ) { - myInPort->SetKind( SUPERV::DataStreamParameter ) ; - } - DataFlowNode()->IncrDataStreamInPorts() ; - return SUPERV::Port::_duplicate( Inobject ) ; + return SUPERV::StreamPort::_duplicate( Inobject ) ; } -SUPERV::Port_ptr CNode_Impl::OutDataStreamPort( const char *aParameterName , - const char *aParameterType ) { - Port_Impl * myOutPort = NULL ; - SUPERV::Port_ptr Outobject = SUPERV::Port::_nil() ; - MESSAGE( "INode_Impl::OutPort " << DataFlowNode()->Name() << "->AddOutPort( " << aParameterName << " , " - << aParameterType ) ; - GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeOutPort( aParameterName ) ; - if ( anOutPort == NULL ) { - anOutPort = DataFlowNode()->AddOutPort( aParameterName , aParameterType ) ; - } - if ( anOutPort ) { - Outobject = anOutPort->ObjRef() ; - if ( CORBA::is_nil( Outobject ) ) { - const CORBA::Any * anAny = anOutPort->Value() ; - myOutPort = new Port_Impl( _Orb , _Poa , _ContId , +SUPERV::StreamPort_ptr CNode_Impl::GetOutStreamPort( const char *aParameterName ) { + StreamPort_Impl * myOutStreamPort = NULL ; + SUPERV::StreamPort_ptr Outobject = SUPERV::StreamPort::_nil() ; + if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) { + GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeOutPort( aParameterName ) ; + if ( anOutPort && anOutPort->IsDataStream() ) { + Outobject = SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ; + if ( CORBA::is_nil( Outobject ) ) { + const CORBA::Any * anAny = anOutPort->Value() ; + myOutStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , DataFlowEditor() , DataFlowNode() , (GraphBase::Port * ) anOutPort , false , anAny ) ; - if ( myOutPort ) { - PortableServer::ObjectId * id = myOutPort->getId() ; - CORBA::Object_var obj = _poa->id_to_reference(*id) ; - Outobject = SUPERV::Port::_narrow(obj) ; + if ( myOutStreamPort ) { + PortableServer::ObjectId * id = myOutStreamPort->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id) ; + Outobject = SUPERV::StreamPort::_narrow(obj) ; + anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( Outobject ) ) ; + } } } } - DataFlowEditor()->UnValid() ; - if ( myOutPort ) { - myOutPort->SetKind( SUPERV::DataStreamParameter ) ; - } - DataFlowNode()->IncrDataStreamOutPorts() ; - return SUPERV::Port::_duplicate( Outobject ); + return SUPERV::StreamPort::_duplicate( Outobject ); } -SUPERV::ListOfPorts * CNode_Impl::Ports() { +SUPERV::Link_ptr CNode_Impl::GetLink(const char * ToServiceParameterName ) { bool begin = true ; - SUPERV::ListOfPorts_var RetVal = new SUPERV::ListOfPorts ; - if ( _IsNode ) { - int i , j ; - RetVal->length( _DataFlowNode->GetNodeInPortsSize() + - _DataFlowNode->GetNodeOutPortsSize() ) ; - for ( i = 0 ; i < _DataFlowNode->GetNodeInPortsSize() ; i++ ) { - GraphBase::InPort * anInPort = _DataFlowNode->GetChangeNodeInPort( i ) ; - if ( begin ) { - beginService( "CNode_Impl::Ports" ); - begin = false ; - } - if ( anInPort->IsLoop() || ( anInPort->IsGate() && !anInPort->IsConnected() && - ( _DataFlowEditor->IsExecuting() || _DataFlowEditor->IsReadOnly() ) ) ) { -// MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " ignored" ) ; - RetVal[ i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ; - } - else if ( CORBA::is_nil( anInPort->ObjRef() ) ) { -// MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsExecuting " -// << _DataFlowEditor->IsExecuting() << " IsGate/IsConnected " << anInPort->IsGate() -// << "/" << anInPort->IsConnected() ) ; - Port_Impl * myPort ; - if ( _DataFlowNode->HasInput( anInPort->PortName() ) ) { - const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ; - myPort = new Port_Impl( _Orb , _Poa , _ContId , - instanceName() , interfaceName() , - _DataFlowEditor , - _DataFlowNode , -// anInPort->PortName() , - (GraphBase::Port * ) anInPort , - true , - anAny ) ; - } - else { - myPort = new Port_Impl( _Orb , _Poa , _ContId , - instanceName() , interfaceName() , - _DataFlowEditor , - _DataFlowNode , -// anInPort->PortName() ) ; - (GraphBase::Port * ) anInPort , - true ) ; - } - PortableServer::ObjectId * id = myPort->getId() ; - CORBA::Object_var obj = _poa->id_to_reference(*id); - SUPERV::Port_var iobject ; - iobject = SUPERV::Port::_narrow(obj) ; - RetVal[ i ] = SUPERV::Port::_duplicate( iobject ) ; - anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ; - } - else { -// MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() ) ; - RetVal[ i ] = SUPERV::Port::_duplicate( anInPort->ObjRef() ) ; - } - } - for ( i = 0 ; i < _DataFlowNode->GetNodeOutPortsSize() ; i++ ) { - GraphBase::OutPort * anOutPort = _DataFlowNode->GetChangeNodeOutPort( i ) ; - if ( begin ) { - beginService( "CNode_Impl::Ports" ); - begin = false ; - } - if ( anOutPort->IsLoop() || ( anOutPort->IsGate() && !anOutPort->IsConnected() && - ( _DataFlowEditor->IsExecuting() || _DataFlowEditor->IsReadOnly() ) ) ) { -// MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " ignored" ) ; - RetVal[ _DataFlowNode->GetNodeInPortsSize() + i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ; - } - else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) { -// MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ; - const CORBA::Any * anAny = anOutPort->Value() ; - Port_Impl * myPort = new Port_Impl( _Orb , _Poa , _ContId , + SUPERV::Link_var iobject = SUPERV::Link::_nil() ; + char* FromNodeName ; + char* FromServiceParameterName ; + bool status = _DataFlowEditor->GetLink( _DataFlowNode->Name() , + ToServiceParameterName , + & FromNodeName , + & FromServiceParameterName ) ; + if ( status ) { + GraphBase::InPort * anInPort = _DataFlowNode->GetChangeInPort( ToServiceParameterName ) ; + if ( !anInPort->IsDataStream() && anInPort->GetOutPort() ) { + GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ; + if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) { + if ( begin ) { + beginService( "CNode_Impl::GetLink" ); + begin = false ; + } + Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , _DataFlowEditor , _DataFlowNode , -// anOutPort->PortName() , - (GraphBase::Port * ) anOutPort , - false , - anAny ) ; - PortableServer::ObjectId * id = myPort->getId() ; + ToServiceParameterName , + (GraphEditor::InNode *) _DataFlowEditor->Graph()->GetChangeGraphNode( FromNodeName )->GetInNode() , + FromServiceParameterName , + true , false ) ; + PortableServer::ObjectId * id = myLink->getId() ; CORBA::Object_var obj = _poa->id_to_reference(*id); - SUPERV::Port_var iobject ; - iobject = SUPERV::Port::_narrow(obj) ; - RetVal[ _DataFlowNode->GetNodeInPortsSize() + i ] = SUPERV::Port::_duplicate( iobject ) ; - anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ; + iobject = SUPERV::Link::_narrow(obj) ; + anOutPort->AddInPortObjRef( anInPort , SUPERV::Link::_duplicate( iobject ) ) ; } else { -// MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ; - RetVal[ _DataFlowNode->GetNodeInPortsSize() + i ] = SUPERV::Port::_duplicate( anOutPort->ObjRef() ) ; - } - } - for ( i = 0 ; i < (int ) RetVal->length() ; i++ ) { - if ( CORBA::is_nil( RetVal[ i ] ) ) { - for ( j = i ; j < (int ) RetVal->length() - 1 ; j++ ) { - RetVal[ j ] = RetVal[ j + 1 ] ; - } - RetVal->length( RetVal->length() - 1 ) ; - i-- ; + iobject = anOutPort->InPortObjRef( anInPort ) ; } } } - else { - if ( _DataFlowEditor->IsValid() ) { - int i , j ; - RetVal->length( _DataFlowEditor->GetNodeInDataNodePortsSize() + - _DataFlowEditor->GetNodeOutDataNodePortsSize() ) ; - for ( i = 0 ; i < _DataFlowEditor->GetNodeInDataNodePortsSize() ; i++ ) { - GraphBase::OutPort * anOutPort = _DataFlowEditor->GetChangeNodeInDataNodePort(i) ; - if ( CORBA::is_nil( anOutPort->ObjRef() ) ) { + if ( !begin ) { + endService( "CNode_Impl::GetLink" ); + } + return SUPERV::Link::_duplicate( iobject ) ; +} + +SUPERV::StreamLink_ptr CNode_Impl::GetStreamLink(const char * ToServiceParameterName ) { + bool begin = true ; + SUPERV::StreamLink_var iobject = SUPERV::StreamLink::_nil() ; + char* FromNodeName ; + char* FromServiceParameterName ; + if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) { + bool status = _DataFlowEditor->GetLink( _DataFlowNode->Name() , + ToServiceParameterName , + & FromNodeName , + & FromServiceParameterName ) ; + if ( status ) { + GraphBase::InPort * anInPort = _DataFlowNode->GetChangeInPort( ToServiceParameterName ) ; + if ( anInPort->IsDataStream() && anInPort->GetOutPort() ) { + GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ; + if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) { if ( begin ) { - beginService( "CNode_Impl::Ports" ); + beginService( "CNode_Impl::GetLink" ); begin = false ; - } + } + StreamLink_Impl * myStreamLink = new StreamLink_Impl( + _Orb , _Poa , _ContId , + instanceName() , interfaceName() , + _DataFlowEditor , + _DataFlowNode , + ToServiceParameterName , + (GraphEditor::InNode *) _DataFlowEditor->Graph()->GetChangeGraphNode( FromNodeName )->GetInNode() , + FromServiceParameterName , + true ) ; + PortableServer::ObjectId * id = myStreamLink->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + iobject = SUPERV::StreamLink::_narrow(obj) ; + anOutPort->AddInPortObjRef( anInPort , SUPERV::StreamLink::_duplicate( iobject ) ) ; + } + else { + iobject = SUPERV::StreamLink::_narrow( anOutPort->InPortObjRef( anInPort ) ) ; + } + } + } + } + if ( !begin ) { + endService( "CNode_Impl::GetLink" ); + } + return SUPERV::StreamLink::_duplicate( iobject ) ; +} + +SUPERV::ListOfPorts * CNode_Impl::Ports() { + bool begin = true ; + int i , j ; + int PortCount = 0 ; + SUPERV::ListOfPorts_var RetVal = new SUPERV::ListOfPorts ; + if ( _IsNode ) { +// RetVal->length( _DataFlowNode->GetNodeInPortsSize() + +// _DataFlowNode->GetNodeOutPortsSize() ) ; + for ( i = 0 ; i < _DataFlowNode->GetNodeInPortsSize() ; i++ ) { + GraphBase::InPort * anInPort = _DataFlowNode->GetChangeNodeInPort( i ) ; + if ( !anInPort->IsDataStream() ) { + if ( begin ) { + beginService( "CNode_Impl::Ports" ); + begin = false ; + } + if ( anInPort->IsLoop() || ( anInPort->IsGate() && !anInPort->IsConnected() && + ( _DataFlowEditor->IsExecuting() || _DataFlowEditor->IsReadOnly() ) ) ) { + MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " ignored" ) ; +// RetVal[ i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ; + } + else if ( CORBA::is_nil( anInPort->ObjRef() ) ) { + MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsExecuting " + << _DataFlowEditor->IsExecuting() << " IsGate/IsConnected " << anInPort->IsGate() + << "/" << anInPort->IsConnected() ) ; Port_Impl * myPort ; - if ( anOutPort->IsDataConnected() ) { - const CORBA::Any * anAny = anOutPort->Value() ; + if ( _DataFlowNode->HasInput( anInPort->PortName() ) ) { + const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ; myPort = new Port_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , _DataFlowEditor , _DataFlowNode , -// anOutPort->PortName() , - (GraphBase::Port * ) anOutPort , + (GraphBase::Port * ) anInPort , true , anAny ) ; } @@ -992,109 +980,427 @@ SUPERV::ListOfPorts * CNode_Impl::Ports() { instanceName() , interfaceName() , _DataFlowEditor , _DataFlowNode , -// anOutPort->PortName() ) ; - (GraphBase::Port * ) anOutPort , + (GraphBase::Port * ) anInPort , true ) ; } PortableServer::ObjectId * id = myPort->getId() ; CORBA::Object_var obj = _poa->id_to_reference(*id); SUPERV::Port_var iobject ; iobject = SUPERV::Port::_narrow(obj) ; - RetVal[ i ] = SUPERV::Port::_duplicate( iobject ) ; + PortCount += 1 ; + RetVal->length( PortCount ) ; + RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ; + anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ; + } + else { + MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() ) ; + PortCount += 1 ; + RetVal->length( PortCount ) ; + RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anInPort->ObjRef() ) ; + } + } + else { + MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsDataStream" ) ; +// RetVal[ i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ; + } + } + for ( i = 0 ; i < _DataFlowNode->GetNodeOutPortsSize() ; i++ ) { + GraphBase::OutPort * anOutPort = _DataFlowNode->GetChangeNodeOutPort( i ) ; + if ( !anOutPort->IsDataStream() ) { + if ( begin ) { + beginService( "CNode_Impl::Ports" ); + begin = false ; + } + if ( anOutPort->IsLoop() || ( anOutPort->IsGate() && !anOutPort->IsConnected() && + ( _DataFlowEditor->IsExecuting() || _DataFlowEditor->IsReadOnly() ) ) ) { + MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " ignored" ) ; +// RetVal[ _DataFlowNode->GetNodeInPortsSize() + i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ; + } + else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) { + MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ; + const CORBA::Any * anAny = anOutPort->Value() ; + Port_Impl * myPort = new Port_Impl( _Orb , _Poa , _ContId , + instanceName() , interfaceName() , + _DataFlowEditor , + _DataFlowNode , + (GraphBase::Port * ) anOutPort , + false , + anAny ) ; + PortableServer::ObjectId * id = myPort->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + SUPERV::Port_var iobject ; + iobject = SUPERV::Port::_narrow(obj) ; + PortCount += 1 ; + RetVal->length( PortCount ) ; + RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ; anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ; } else { - RetVal[ i ] = SUPERV::Port::_duplicate( anOutPort->ObjRef() ) ; + MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ; + PortCount += 1 ; + RetVal->length( PortCount ) ; + RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anOutPort->ObjRef() ) ; } } - j = _DataFlowEditor->GetNodeInDataNodePortsSize() ; - for ( i = 0 ; i < _DataFlowEditor->GetNodeOutDataNodePortsSize() ; i++ ) { - GraphBase::InPort * anInPort = _DataFlowEditor->GetChangeNodeOutDataNodePort(i) ; - if ( CORBA::is_nil( anInPort->ObjRef() ) ) { - if ( begin ) { - beginService( "CNode_Impl::Ports" ); - begin = false ; + else { + MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " IsDataStream" ) ; +// RetVal[ _DataFlowNode->GetNodeInPortsSize() + i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ; + } + } + } + else { + if ( _DataFlowEditor->IsValid() ) { + RetVal->length( _DataFlowEditor->Graph()->GetNodeInDataNodePortsSize() + + _DataFlowEditor->Graph()->GetNodeOutDataNodePortsSize() ) ; + for ( i = 0 ; i < _DataFlowEditor->Graph()->GetNodeInDataNodePortsSize() ; i++ ) { + GraphBase::OutPort * anOutPort = _DataFlowEditor->Graph()->GetChangeNodeInDataNodePort(i) ; + if ( !anOutPort->IsDataStream() ) { + if ( CORBA::is_nil( anOutPort->ObjRef() ) ) { + if ( begin ) { + beginService( "CNode_Impl::Ports" ); + begin = false ; + } + Port_Impl * myPort ; + if ( anOutPort->IsDataConnected() ) { + const CORBA::Any * anAny = anOutPort->Value() ; + myPort = new Port_Impl( _Orb , _Poa , _ContId , + instanceName() , interfaceName() , + _DataFlowEditor , + _DataFlowNode , + (GraphBase::Port * ) anOutPort , + true , + anAny ) ; + } + else { + myPort = new Port_Impl( _Orb , _Poa , _ContId , + instanceName() , interfaceName() , + _DataFlowEditor , + _DataFlowNode , + (GraphBase::Port * ) anOutPort , + true ) ; + } + PortableServer::ObjectId * id = myPort->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + SUPERV::Port_var iobject ; + iobject = SUPERV::Port::_narrow(obj) ; + PortCount += 1 ; + RetVal->length( PortCount ) ; + RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ; + anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ; + } + else { + PortCount += 1 ; + RetVal->length( PortCount ) ; + RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anOutPort->ObjRef() ) ; } - Port_Impl * myPort ; - if ( anInPort->IsDataConnected() ) { + } + else { +// RetVal[ i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ; + } + } + j = _DataFlowEditor->Graph()->GetNodeInDataNodePortsSize() ; + for ( i = 0 ; i < _DataFlowEditor->Graph()->GetNodeOutDataNodePortsSize() ; i++ ) { + GraphBase::InPort * anInPort = _DataFlowEditor->Graph()->GetChangeNodeOutDataNodePort(i) ; + if ( !anInPort->IsDataStream() ) { + if ( CORBA::is_nil( anInPort->ObjRef() ) ) { + if ( begin ) { + beginService( "CNode_Impl::Ports" ); + begin = false ; + } + Port_Impl * myPort ; + if ( anInPort->IsDataConnected() ) { + const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ; + myPort = new Port_Impl( _Orb , _Poa , _ContId , + instanceName() , interfaceName() , + _DataFlowEditor , + _DataFlowNode , + (GraphBase::Port * ) anInPort , + false , + anAny ) ; + } + else { + myPort = new Port_Impl( _Orb , _Poa , _ContId , + instanceName() , interfaceName() , + _DataFlowEditor , + _DataFlowNode , + anInPort , + false ) ; + } + PortableServer::ObjectId * id = myPort->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + SUPERV::Port_var iobject ; + iobject = SUPERV::Port::_narrow(obj) ; + PortCount += 1 ; + RetVal->length( PortCount ) ; + RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( iobject ) ; + anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ; + } + else { + PortCount += 1 ; + RetVal->length( PortCount ) ; + RetVal[ PortCount - 1 ] = SUPERV::Port::_duplicate( anInPort->ObjRef() ) ; + } + } + else { +// RetVal[ j + i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ; + } + } + } + } +// int RetVallength = (unsigned int ) RetVal->length() ; +// for ( i = 0 ; i < RetVallength ; i++ ) { +// MESSAGE( "Port " << i << " " << RetVal[i]->Name() << " of Node " << Name() ) ; +// } + if ( !begin ) { + endService( "CNode_Impl::Ports " ) ; + } + return ( RetVal._retn() ) ; +} + +SUPERV::ListOfStreamPorts * CNode_Impl::StreamPorts() { + bool begin = true ; + int i , j ; + int PortCount = 0 ; + SUPERV::ListOfStreamPorts_var RetVal = new SUPERV::ListOfStreamPorts ; + if ( !DataFlowEditor()->Graph()->IsDataStreamNode() ) { +// MESSAGE("CNode_Impl::StreamPorts NOT a DataStreamNode" ) ; + } + else if ( _IsNode ) { +// RetVal->length( _DataFlowNode->GetNodeInPortsSize() + +// _DataFlowNode->GetNodeOutPortsSize() ) ; + for ( i = 0 ; i < _DataFlowNode->GetNodeInPortsSize() ; i++ ) { + GraphBase::InPort * anInPort = _DataFlowNode->GetChangeNodeInPort( i ) ; + if ( anInPort->IsDataStream() ) { + if ( begin ) { + beginService( "CNode_Impl::StreamPorts" ); + begin = false ; + } + if ( anInPort->IsLoop() || ( anInPort->IsGate() && !anInPort->IsConnected() && + ( _DataFlowEditor->IsExecuting() || _DataFlowEditor->IsReadOnly() ) ) ) { + MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " ignored" ) ; +// RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ; + } + else if ( CORBA::is_nil( anInPort->ObjRef() ) ) { + MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsExecuting " + << _DataFlowEditor->IsExecuting() << " IsGate/IsConnected " << anInPort->IsGate() + << "/" << anInPort->IsConnected() ) ; + StreamPort_Impl * myStreamPort ; + if ( _DataFlowNode->HasInput( anInPort->PortName() ) ) { const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ; - myPort = new Port_Impl( _Orb , _Poa , _ContId , + myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , _DataFlowEditor , _DataFlowNode , -// anInPort->PortName() , (GraphBase::Port * ) anInPort , - false , + true , anAny ) ; } else { - myPort = new Port_Impl( _Orb , _Poa , _ContId , + myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , _DataFlowEditor , _DataFlowNode , -// anInPort->PortName() ) ; - anInPort , - false ) ; + (GraphBase::Port * ) anInPort , + true ) ; } - PortableServer::ObjectId * id = myPort->getId() ; + PortableServer::ObjectId * id = myStreamPort->getId() ; CORBA::Object_var obj = _poa->id_to_reference(*id); - SUPERV::Port_var iobject ; - iobject = SUPERV::Port::_narrow(obj) ; - RetVal[ j + i ] = SUPERV::Port::_duplicate( iobject ) ; - anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ; + SUPERV::StreamPort_var iobject ; + iobject = SUPERV::StreamPort::_narrow(obj) ; + PortCount += 1 ; + RetVal->length( PortCount ) ; + RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ; + anInPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ; } else { - RetVal[ j + i ] = SUPERV::Port::_duplicate( anInPort->ObjRef() ) ; + MESSAGE( "InStreamPort " << i << " " << anInPort->PortName() << " of Node " << Name() ) ; + PortCount += 1 ; + RetVal->length( PortCount ) ; + RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ) ; } } + else { +// RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ; + } } - } - if ( !begin ) { - endService( "CNode_Impl::Ports" ); - } - return ( RetVal._retn() ) ; -} - -SUPERV::Link_ptr CNode_Impl::GetLink(const char * ToServiceParameterName ) { - bool begin = true ; - SUPERV::Link_var iobject = SUPERV::Link::_nil() ; - char* FromNodeName ; - char* FromServiceParameterName ; - bool status = _DataFlowEditor->GetLink( _DataFlowNode->Name() , - ToServiceParameterName , - & FromNodeName , - & FromServiceParameterName ) ; - if ( status ) { - GraphBase::InPort * anInPort = _DataFlowNode->GetChangeInPort( ToServiceParameterName ) ; - if ( anInPort->GetOutPort() ) { - GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ; - if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) { + for ( i = 0 ; i < _DataFlowNode->GetNodeOutPortsSize() ; i++ ) { + GraphBase::OutPort * anOutPort = _DataFlowNode->GetChangeNodeOutPort( i ) ; + if ( anOutPort->IsDataStream() ) { if ( begin ) { - beginService( "CNode_Impl::GetLink" ); + beginService( "CNode_Impl::StreamPorts" ); begin = false ; - } - Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId , - instanceName() , interfaceName() , - _DataFlowEditor , - _DataFlowNode , - ToServiceParameterName , - (GraphEditor::InNode *) _DataFlowEditor->GetChangeGraphNode( FromNodeName )->GetInNode() , - FromServiceParameterName , - true ) ; - PortableServer::ObjectId * id = myLink->getId() ; - CORBA::Object_var obj = _poa->id_to_reference(*id); - iobject = SUPERV::Link::_narrow(obj) ; - anOutPort->AddInPortObjRef( anInPort , SUPERV::Link::_duplicate( iobject ) ) ; + } + if ( anOutPort->IsLoop() || ( anOutPort->IsGate() && !anOutPort->IsConnected() && + ( _DataFlowEditor->IsExecuting() || _DataFlowEditor->IsReadOnly() ) ) ) { + MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " ignored" ) ; +// RetVal[ _DataFlowNode->GetNodeInPortsSize() + i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ; + } + else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) { + MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ; + const CORBA::Any * anAny = anOutPort->Value() ; + StreamPort_Impl * myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId , + instanceName() , interfaceName() , + _DataFlowEditor , + _DataFlowNode , + (GraphBase::Port * ) anOutPort , + false , + anAny ) ; + PortableServer::ObjectId * id = myStreamPort->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + SUPERV::StreamPort_var iobject ; + iobject = SUPERV::StreamPort::_narrow(obj) ; + PortCount += 1 ; + RetVal->length( PortCount ) ; + RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ; + anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ; + } + else { + MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ; + PortCount += 1 ; + RetVal->length( PortCount ) ; + RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ) ; + } } else { - iobject = anOutPort->InPortObjRef( anInPort ) ; +// RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ; } } } + else { + if ( _DataFlowEditor->IsValid() ) { +// RetVal->length( _DataFlowEditor->Graph()->GetNodeInDataNodePortsSize() + +// _DataFlowEditor->Graph()->GetNodeOutDataNodePortsSize() ) ; + for ( i = 0 ; i < _DataFlowEditor->Graph()->GetNodeInDataNodePortsSize() ; i++ ) { + GraphBase::OutPort * anOutPort = _DataFlowEditor->Graph()->GetChangeNodeInDataNodePort(i) ; + if ( anOutPort->IsDataStream() ) { + if ( CORBA::is_nil( anOutPort->ObjRef() ) ) { + if ( begin ) { + beginService( "CNode_Impl::StreamPorts" ); + begin = false ; + } + StreamPort_Impl * myStreamPort ; + if ( anOutPort->IsDataConnected() ) { + const CORBA::Any * anAny = anOutPort->Value() ; + myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId , + instanceName() , interfaceName() , + _DataFlowEditor , + _DataFlowNode , + (GraphBase::Port * ) anOutPort , + true , + anAny ) ; + } + else { + myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId , + instanceName() , interfaceName() , + _DataFlowEditor , + _DataFlowNode , + (GraphBase::Port * ) anOutPort , + true ) ; + } + PortableServer::ObjectId * id = myStreamPort->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + SUPERV::StreamPort_var iobject ; + iobject = SUPERV::StreamPort::_narrow(obj) ; + PortCount += 1 ; + RetVal->length( PortCount ) ; + RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ; + anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ; + } + else { + PortCount += 1 ; + RetVal->length( PortCount ) ; + RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ) ; + } + } + else { +// RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ; + } + } + j = _DataFlowEditor->Graph()->GetNodeInDataNodePortsSize() ; + for ( i = 0 ; i < _DataFlowEditor->Graph()->GetNodeOutDataNodePortsSize() ; i++ ) { + GraphBase::InPort * anInPort = _DataFlowEditor->Graph()->GetChangeNodeOutDataNodePort(i) ; + if ( anInPort->IsDataStream() ) { + if ( CORBA::is_nil( anInPort->ObjRef() ) ) { + if ( begin ) { + beginService( "CNode_Impl::StreamPorts" ); + begin = false ; + } + StreamPort_Impl * myStreamPort ; + if ( anInPort->IsDataConnected() ) { + const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ; + myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId , + instanceName() , interfaceName() , + _DataFlowEditor , + _DataFlowNode , + (GraphBase::Port * ) anInPort , + false , + anAny ) ; + } + else { + myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId , + instanceName() , interfaceName() , + _DataFlowEditor , + _DataFlowNode , + anInPort , + false ) ; + } + PortableServer::ObjectId * id = myStreamPort->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + SUPERV::StreamPort_var iobject ; + iobject = SUPERV::StreamPort::_narrow(obj) ; + PortCount += 1 ; + RetVal->length( PortCount ) ; + RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( iobject ) ; + anInPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ; + } + else { + PortCount += 1 ; + RetVal->length( PortCount ) ; + RetVal[ PortCount - 1 ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ) ; + } + } + else { +// RetVal[ i ] = SUPERV::StreamPort::_duplicate( SUPERV::StreamPort::_narrow( CORBA::Object::_nil() ) ) ; + } + } + } + } +// int RetVallength = (unsigned int ) RetVal->length() ; +// for ( i = 0 ; i < RetVallength ; i++ ) { +// MESSAGE( "StreamPort " << i << " " << RetVal[i]->Name() << " of Node " << Name() ) ; +// } if ( !begin ) { - endService( "CNode_Impl::GetLink" ); + endService( "CNode_Impl::StreamPorts " ) ; } - return SUPERV::Link::_duplicate( iobject ) ; + return ( RetVal._retn() ) ; +} + +SUPERV::ListOfLinks * CNode_Impl::Links() { + beginService( "CNode_Impl::Links" ) ; + SUPERV::ListOfLinks_var RetVal = new SUPERV::ListOfLinks ; + if ( _DataFlowNode ) { + RetVal = DataFlowEditor()->Graph()->ObjImpl()->Links( _DataFlowNode->ComputingNode() , NULL ) ; + } + else { + RetVal = DataFlowEditor()->Graph()->ObjImpl()->Links( NULL , NULL ) ; + } + MESSAGE( "CNode_Impl::Links " << RetVal->length() << " Links" ) ; + endService( "CNode_Impl::Links" ) ; + return ( RetVal._retn() ) ; +} + +SUPERV::ListOfStreamLinks * CNode_Impl::StreamLinks() { + beginService( "CNode_Impl::StreamLinks" ) ; + SUPERV::ListOfStreamLinks_var RetVal = new SUPERV::ListOfStreamLinks ; + if ( _DataFlowNode && DataFlowEditor()->Graph()->IsDataStreamNode() ) { + RetVal = ((StreamGraph_Impl *) (DataFlowEditor()->StreamGraph()->ObjImpl()))->StreamLinks( _DataFlowNode->ComputingNode() , NULL ) ; + } + else { + RetVal = ((StreamGraph_Impl *) (DataFlowEditor()->StreamGraph()->ObjImpl()))->StreamLinks( NULL , NULL ) ; + } + MESSAGE( "CNode_Impl::StreamLinks " << RetVal->length() << " StreamLinks" ) ; + endService( "CNode_Impl::StreamLinks" ) ; + return ( RetVal._retn() ) ; } long CNode_Impl::SubGraph() { diff --git a/src/Supervision/CNode_Impl.hxx b/src/Supervision/CNode_Impl.hxx index 1dbcf40..0dd483a 100644 --- a/src/Supervision/CNode_Impl.hxx +++ b/src/Supervision/CNode_Impl.hxx @@ -108,7 +108,7 @@ class CNode_Impl : public POA_SUPERV::CNode , iobject = SUPERV::CNode::_narrow( _DataFlowNode->ObjRef() ) ; } else { - iobject = SUPERV::CNode::_narrow( _DataFlowEditor->ObjRef() ) ; + iobject = SUPERV::CNode::_narrow( _DataFlowEditor->Graph()->ObjRef() ) ; } return iobject ; } ; virtual void SetObjRef(SUPERV::CNode_var aNode ) { @@ -116,8 +116,9 @@ class CNode_Impl : public POA_SUPERV::CNode , _DataFlowNode->SetObjRef( aNode ) ; } else { - _DataFlowEditor->SetObjRef( SUPERV::Graph::_narrow( aNode ) ) ; - } } ; + _DataFlowEditor->Graph()->SetObjRef( SUPERV::Graph::_narrow( aNode ) ) ; + } + } ; virtual void Coords( const long X , const long Y ) ; virtual long X() ; @@ -138,22 +139,22 @@ class CNode_Impl : public POA_SUPERV::CNode , virtual SUPERV::Port_ptr Input( const char * ToServiceParameterName , const SUPERV::Value_ptr aValue ) ; - virtual SUPERV::Port_ptr InPort( const char * aParameterName , - const char * aParameterType ) ; - virtual SUPERV::Port_ptr OutPort( const char * aParameterName , - const char * aParameterType ) ; + virtual SUPERV::Port_ptr GetInPort( const char * aParameterName ) ; + virtual SUPERV::Port_ptr GetOutPort( const char * aParameterName ) ; - virtual SUPERV::Port_ptr InDataStreamPort( const char * aParameterName , - const char * aParameterType ) ; - virtual SUPERV::Port_ptr OutDataStreamPort( const char * aParameterName , - const char * aParameterType ) ; + virtual SUPERV::StreamPort_ptr GetInStreamPort( const char * aParameterName ) ; + virtual SUPERV::StreamPort_ptr GetOutStreamPort( const char * aParameterName ) ; virtual SUPERV::ListOfPorts * Ports() ; + virtual SUPERV::ListOfStreamPorts * StreamPorts() ; virtual SUPERV::ListOfLinks * Links() ; + virtual SUPERV::ListOfStreamLinks * StreamLinks() ; virtual SUPERV::Link_ptr GetLink( const char * ToServiceParameterName ) ; + virtual SUPERV::StreamLink_ptr GetStreamLink( const char * ToServiceParameterName ) ; + virtual bool IsStreamGraph() ; virtual bool IsGraph() ; virtual bool IsComputing() ; virtual bool IsFactory() ; diff --git a/src/Supervision/ELNode_Impl.cxx b/src/Supervision/ELNode_Impl.cxx index d0d4c86..86290ca 100644 --- a/src/Supervision/ELNode_Impl.cxx +++ b/src/Supervision/ELNode_Impl.cxx @@ -72,8 +72,8 @@ ELNode_Impl::~ELNode_Impl() { } void ELNode_Impl::destroy() { - MESSAGE("--------> ELNode_Impl::destroy() BEGIN"); - beginService( "ELNode_Impl::Destroy" ); +// MESSAGE("--------> ELNode_Impl::destroy() BEGIN"); +// beginService( "ELNode_Impl::Destroy" ); if ( DataFlowEditor()->IsEditing() ) { MESSAGE("--------> Editing dataflow"); SUPERV::GNode_ptr aCoupled = SUPERV::GNode::_narrow( Coupled() ) ; @@ -89,8 +89,8 @@ void ELNode_Impl::destroy() { aCoupled->destroy() ; } } - endService( "ELNode_Impl::Destroy" ); - MESSAGE("--------> ELNode_Impl::destroy() END"); +// endService( "ELNode_Impl::Destroy" ); +// MESSAGE("--------> ELNode_Impl::destroy() END"); } bool ELNode_Impl::Delete() { diff --git a/src/Supervision/ESNode_Impl.cxx b/src/Supervision/ESNode_Impl.cxx index ee2230f..0329f2d 100644 --- a/src/Supervision/ESNode_Impl.cxx +++ b/src/Supervision/ESNode_Impl.cxx @@ -91,7 +91,7 @@ void ESNode_Impl::destroy() { aCoupled->destroy() ; } } - endService( "ESNode_Impl::Destroy" ); +// endService( "ESNode_Impl::Destroy" ); } bool ESNode_Impl::Delete() { diff --git a/src/Supervision/FNode_Impl.cxx b/src/Supervision/FNode_Impl.cxx index 49e6e5c..d5c9f0c 100644 --- a/src/Supervision/FNode_Impl.cxx +++ b/src/Supervision/FNode_Impl.cxx @@ -86,7 +86,7 @@ void FNode_Impl::destroy() { _thisObj->_remove_ref(); } } - endService( "FNode_Impl::Destroy" ); +// endService( "FNode_Impl::Destroy" ); } bool FNode_Impl::Delete() { @@ -146,8 +146,8 @@ bool FNode_Impl::SetContainer( const char * aDataFlowContainer ) { } else if ( _DataFlowExecutor && ( _DataFlowExecutor->IsSuspended() || _DataFlowExecutor->IsSuspended( DataFlowNode()->Name() ) ) ) { - if ( _DataFlowExecutor->GetChangeGraphNode( DataFlowNode()->Name() ) ) { - RetVal = ((GraphEditor::InNode * ) _DataFlowExecutor->GetChangeGraphNode( DataFlowNode()->Name() )->GetInNode())->Computer( aDataFlowContainer ) ; + if ( _DataFlowExecutor->Graph()->GetChangeGraphNode( DataFlowNode()->Name() ) ) { + RetVal = ((GraphEditor::InNode * ) _DataFlowExecutor->Graph()->GetChangeGraphNode( DataFlowNode()->Name() )->GetInNode())->Computer( aDataFlowContainer ) ; } } // endService( "FNode_Impl::SetContainer" ); diff --git a/src/Supervision/GNode_Impl.cxx b/src/Supervision/GNode_Impl.cxx index 2612505..02fc37e 100644 --- a/src/Supervision/GNode_Impl.cxx +++ b/src/Supervision/GNode_Impl.cxx @@ -120,7 +120,7 @@ void GNode_Impl::destroy() { _thisObj->_remove_ref(); } } - endService( "GNode_Impl::Destroy" ); +// endService( "GNode_Impl::Destroy" ); } bool GNode_Impl::Delete() { @@ -136,7 +136,7 @@ bool GNode_Impl::Delete() { } SUPERV::INode_ptr GNode_Impl::Coupled() { - beginService( "GNode_Impl::Coupled" ); +// beginService( "GNode_Impl::Coupled" ); SUPERV::INode_var iobject = SUPERV::INode::_nil() ; if ( DataFlowNode()->CoupledNode() ) { if ( CORBA::is_nil( DataFlowNode()->CoupledNode()->ObjRef() ) ) { @@ -153,7 +153,7 @@ SUPERV::INode_ptr GNode_Impl::Coupled() { iobject = SUPERV::INode::_narrow( DataFlowNode()->CoupledNode()->ObjRef() ) ; } } - endService( "GNode_Impl::Coupled" ); +// endService( "GNode_Impl::Coupled" ); return SUPERV::INode::_duplicate( iobject ) ; } diff --git a/src/Supervision/GNode_Impl.hxx b/src/Supervision/GNode_Impl.hxx index 72eed81..3821296 100644 --- a/src/Supervision/GNode_Impl.hxx +++ b/src/Supervision/GNode_Impl.hxx @@ -66,7 +66,7 @@ class GNode_Impl : public INode_Impl , virtual bool Delete() ; virtual bool SetCoupled( const char * anInLineNode ) { - GraphBase::InLineNode * CoupledINode = (GraphBase::InLineNode * ) DataFlowEditor()->GetGraphNode( anInLineNode ) ; + GraphBase::InLineNode * CoupledINode = (GraphBase::InLineNode * ) DataFlowEditor()->Graph()->GetGraphNode( anInLineNode ) ; // cout << Name() << ".SetCoupled " << anInLineNode << endl ; // if ( CoupledINode && ( IsGOTO() && if ( ( IsGOTO() && diff --git a/src/Supervision/Graph_Impl.cxx b/src/Supervision/Graph_Impl.cxx index b09ebbd..79a0554 100644 --- a/src/Supervision/Graph_Impl.cxx +++ b/src/Supervision/Graph_Impl.cxx @@ -45,17 +45,20 @@ Graph_Impl::Graph_Impl( CORBA::ORB_ptr orb , PortableServer::ObjectId * contId , const char *instanceName , const char *interfaceName , - const char *aDataFlowName ) : - INode_Impl(orb, poa, contId, instanceName, interfaceName, aDataFlowName) { + const char *aDataFlowName , + const SUPERV::KindOfNode aKindOfNode ) : + INode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowName ) { // MESSAGE("Graph_Impl::Graph_Impl activate object instanceName(" // << instanceName << ") interfaceName(" << interfaceName << ") --> " // << hex << (void *) this << dec ) beginService( "Graph_Impl::Graph_Impl" ); - _thisObj = this ; - _id = _poa->activate_object(_thisObj); _Orb = CORBA::ORB::_duplicate(orb); _Poa = poa ; _ContId = contId ; + if ( aKindOfNode == SUPERV::DataFlowGraph ) { + _thisObj = this ; + _id = _poa->activate_object(_thisObj); + } string dbgfile = "/tmp/" ; dbgfile += instanceName ; @@ -86,11 +89,12 @@ Graph_Impl::Graph_Impl( CORBA::ORB_ptr orb , strcpy( _DebugFileName , dbgfile.c_str() ) ; _NamingService = new SALOME_NamingService( orb ) ; - GraphEditor::DataFlow * aDataFlowEditor = new GraphEditor::DataFlow( _Orb , _NamingService , - theDataFlowName , - _DebugFileName ) ; + GraphEditor::DataFlow * aDataFlowEditor ; + aDataFlowEditor = new GraphEditor::DataFlow( _Orb , _NamingService , + theDataFlowName , _DebugFileName , + aKindOfNode ) ; DataFlowEditor( aDataFlowEditor ) ; - DataFlowEditor()->SetObjImpl( this ) ; + DataFlowEditor()->Graph()->SetObjImpl( this ) ; pthread_mutex_init( &_MutexExecutorWait , NULL ) ; _DataFlowExecutor = NULL ; delete [] theDataFlowName ; @@ -111,7 +115,7 @@ void Graph_Impl::destroy() { CORBA::release(_poa) ; delete(_id) ; _thisObj->_remove_ref(); - endService( "Graph_Impl::destroy" ); +// endService( "Graph_Impl::destroy" ); } char* Graph_Impl::getIOR() { @@ -129,12 +133,11 @@ SUPERV::Graph_ptr Graph_Impl::Copy() { Graph_Impl * myGraph ; myGraph = new Graph_Impl( _Orb , _Poa, _ContId, instanceName() , interfaceName() , - Name() ) ; + DataFlowEditor()->Graph()->Name() , SUPERV::DataFlowGraph ) ; PortableServer::ObjectId * id = myGraph->getId() ; CORBA::Object_var obj = _poa->id_to_reference(*id); SUPERV::Graph_var iobject ; iobject = SUPERV::Graph::_narrow(obj) ; -// GraphBase::SGraph * aSGraph = aGraph->GetGraph() ; GraphBase::SGraph * aSGraph = GetGraph() ; myGraph->LoadGraph( aSGraph ) ; endService( "Graph_Impl::Copy" ); @@ -330,7 +333,7 @@ SUPERV::GNode_ptr Graph_Impl::GNode( const char * FuncName , iobject = SUPERV::GNode::_narrow(obj) ; myNode->SetObjRef( SUPERV::GNode::_duplicate( iobject ) ) ; if ( strlen( anInLineNode ) ) { - GraphBase::InLineNode * CoupledINode = (GraphBase::InLineNode * ) DataFlowEditor()->GetGraphNode( anInLineNode ) ; + GraphBase::InLineNode * CoupledINode = (GraphBase::InLineNode * ) DataFlowEditor()->Graph()->GetGraphNode( anInLineNode ) ; if ( anInLineNode ) { myNode->SetCoupled( anInLineNode ) ; Link( myNode->Port( "OutGate" ) , CoupledINode->ObjRef()->Port( "InGate" ) ) ; @@ -508,7 +511,7 @@ SUPERV::Link_ptr Graph_Impl::Link( SUPERV::Port_ptr OutPort , InPort->Name() , DataFlowOutNode , OutPort->Name() , - true ) ; + true , false ) ; PortableServer::ObjectId * id = myLink->getId() ; CORBA::Object_var obj = _poa->id_to_reference(*id); iobject = SUPERV::Link::_narrow(obj) ; @@ -606,14 +609,13 @@ void Graph_Impl::SetNodeObjRef( GraphEditor::InNode * anInNode ) { SUPERV::ListOfNodes_var Graph_Impl::SetNode( SUPERV::ListOfNodes_var RetVal , GraphBase::ComputingNode * aNode ) { int index = 0 ; -// MESSAGE("Graph_Impl::SetNode " << aNode->Name() << " " << aNode->Kind() ) ; -// if ( _DataFlowExecutor ) { -// MESSAGE("Graph_Impl::SetNode " << aNode->Name() << " " << aNode->Kind() << " " -// << _DataFlowExecutor->StateName( _DataFlowExecutor->AutomatonState( aNode->Name() ) ) ) ; -// } -// else { -// MESSAGE("Graph_Impl::SetNode " << aNode->Name() << " " << aNode->Kind() ) ; -// } + if ( _DataFlowExecutor ) { + MESSAGE("Graph_Impl::SetNode " << aNode->Name() << " " << aNode->Kind() << " " + << _DataFlowExecutor->StateName( _DataFlowExecutor->AutomatonState( aNode->Name() ) ) ) ; + } + else { + MESSAGE("Graph_Impl::SetNode " << aNode->Name() << " " << aNode->Kind() ) ; + } if ( aNode->IsComputingNode() ) { index = RetVal->CNodes.length() ; RetVal->CNodes.length( index+1 ); @@ -687,26 +689,28 @@ SUPERV::ListOfNodes * Graph_Impl::Nodes() { RetVal->SNodes.length(0) ; RetVal->GNodes.length(0) ; int i ; - for ( i = 0 ; i < DataFlowEditor()->GraphNodesSize() ; i++ ) { - GraphBase::ComputingNode * aNode = DataFlowEditor()->GraphNodes( i ) ; + for ( i = 0 ; i < DataFlowEditor()->Graph()->GraphNodesSize() ; i++ ) { + GraphBase::ComputingNode * aNode = DataFlowEditor()->Graph()->GraphNodes( i ) ; RetVal = SetNode( RetVal , aNode ) ; } +#if 0 char * aStateG = "" ; if ( _DataFlowExecutor ) { aStateG = (char *) _DataFlowExecutor->StateName( _DataFlowExecutor->AutomatonState() ) ; } -// MESSAGE("Graph_Impl::Nodes GraphState " << aStateG -// << " CNodes " << RetVal->CNodes.length() -// << " FNodes " << RetVal->FNodes.length() -// << " INodes " << RetVal->INodes.length() -// << " GNodes " << RetVal->GNodes.length() -// << " LNodes " << RetVal->LNodes.length() -// << " ELNodes " << RetVal->ELNodes.length() -// << " SNodes " << RetVal->SNodes.length() -// << " ESNodes " << RetVal->ESNodes.length() ) ; -// if ( _DataFlowExecutor ) { -// _DataFlowExecutor->EventList() ; -// } + MESSAGE("Graph_Impl::Nodes GraphState " << aStateG + << " CNodes " << RetVal->CNodes.length() + << " FNodes " << RetVal->FNodes.length() + << " INodes " << RetVal->INodes.length() + << " GNodes " << RetVal->GNodes.length() + << " LNodes " << RetVal->LNodes.length() + << " ELNodes " << RetVal->ELNodes.length() + << " SNodes " << RetVal->SNodes.length() + << " ESNodes " << RetVal->ESNodes.length() ) ; + if ( _DataFlowExecutor ) { + _DataFlowExecutor->EventList() ; + } +#endif endService( "Graph_Impl::Nodes" ); return ( RetVal._retn() ) ; } @@ -719,11 +723,12 @@ SUPERV::ListOfLinks * Graph_Impl::Links( GraphBase::ComputingNode * theNode , const char * anInputParam ) { bool begin = true ; SUPERV::ListOfLinks_var RetVal = new SUPERV::ListOfLinks ; + RetVal->length( 0 ) ; int i , j , countlink ; countlink = 0 ; - for ( i = 0 ; i < DataFlowEditor()->GraphNodesSize() ; i++ ) { + for ( i = 0 ; i < DataFlowEditor()->Graph()->GraphNodesSize() ; i++ ) { GraphEditor::InNode * aNode = NULL ; - aNode = (GraphEditor::InNode * ) DataFlowEditor()->GraphNodes( i )->GetInNode() ; + aNode = (GraphEditor::InNode * ) DataFlowEditor()->Graph()->GraphNodes( i )->GetInNode() ; bool ToProcess = false ; if ( theNode == NULL ) { ToProcess = true ; @@ -744,15 +749,15 @@ SUPERV::ListOfLinks * Graph_Impl::Links( GraphBase::ComputingNode * theNode , anInPort = aNode->GetChangeNodeInPort( j ) ; if ( anInputParam == NULL || !strcmp( anInPort->PortName() , anInputParam ) ) { - if ( anInPort->GetOutPort() ) { - GraphBase::OutPort * anOutPort = NULL ; - anOutPort = anInPort->GetOutPort() ; + GraphBase::OutPort * anOutPort = NULL ; + anOutPort = anInPort->GetOutPort() ; + if ( anOutPort && !anOutPort->IsDataStream() ) { if ( strcmp( anOutPort->NodeName() , Name() ) ) { // MESSAGE("Graph_Impl::Links " << anOutPort->NodeName() << "(" // << anOutPort->PortName() << ") --> " << aNode->Name() << "(" // << anInPort->PortName() << ")" ) ; if ( theNode == NULL || - ( theNode != NULL && theNode->IsEndSwitchNode() && + ( theNode != NULL && !theNode->IsEndSwitchNode() && !strcmp( theNode->Name() , aNode->Name() ) ) ) { if ( anInPort->IsLoop() || anOutPort->IsLoop() || ( aNode->IsEndLoopNode() && !strcmp( aNode->CoupledNode()->Name() , @@ -767,7 +772,7 @@ SUPERV::ListOfLinks * Graph_Impl::Links( GraphBase::ComputingNode * theNode , begin = false ; } GraphEditor::InNode * anOutNode = NULL ; - anOutNode = (GraphEditor::InNode * ) DataFlowEditor()->GetChangeGraphNode( anOutPort->NodeName() )->GetInNode() ; + anOutNode = (GraphEditor::InNode * ) DataFlowEditor()->Graph()->GetChangeGraphNode( anOutPort->NodeName() )->GetInNode() ; if ( anOutNode ) { Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , @@ -776,7 +781,7 @@ SUPERV::ListOfLinks * Graph_Impl::Links( GraphBase::ComputingNode * theNode , anInPort->PortName() , anOutNode , anOutPort->PortName() , - false ) ; + false , true ) ; PortableServer::ObjectId * id = myLink->getId() ; CORBA::Object_var obj = _poa->id_to_reference(*id); SUPERV::Link_var iobject ; @@ -790,6 +795,14 @@ SUPERV::ListOfLinks * Graph_Impl::Links( GraphBase::ComputingNode * theNode , RetVal->length( countlink + 1 ) ; RetVal[ countlink++ ] = SUPERV::Link::_duplicate( anOutPort->InPortObjRef( anInPort ) ) ; } +// MESSAGE( "Link " << anOutPort->NodeName() << "(" +// << anOutPort->PortName() << ") --> " << aNode->Name() << "(" +// << anInPort->PortName() << ")" << " selected" ) ; + } + else { +// MESSAGE( "Link " << anOutPort->NodeName() << "(" +// << anOutPort->PortName() << ") --> " << aNode->Name() << "(" +// << anInPort->PortName() << ")" << " skipped" ) ; } } } @@ -801,44 +814,53 @@ SUPERV::ListOfLinks * Graph_Impl::Links( GraphBase::ComputingNode * theNode , int k ; for ( k = 0 ; k < anOutPort->InPortsSize() ; k++ ) { GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( k ) ; - GraphEditor::InNode * toNode = (GraphEditor::InNode * ) DataFlowEditor()->GetChangeGraphNode( anInPort->NodeName() )->GetInNode() ; + GraphEditor::InNode * toNode = (GraphEditor::InNode * ) DataFlowEditor()->Graph()->GetChangeGraphNode( anInPort->NodeName() )->GetInNode() ; if ( theNode == NULL || - !strcmp( theNode->Name() , toNode->Name() ) || !strcmp( theNode->Name() , aNode->Name() ) ) { - if ( theNode || ( toNode->IsEndSwitchNode() && !aNode->IsSwitchNode() ) ) { - if ( anInputParam == NULL || - !strcmp( anInPort->PortName() , anInputParam ) ) { - if ( anInPort->IsLoop() || anOutPort->IsLoop() || - ( toNode->IsEndLoopNode() && !strcmp( toNode->CoupledNode()->Name() , - anOutPort->NodeName() ) ) ) { -// MESSAGE( "Link " << anOutPort->NodeName() << "(" -// << anOutPort->PortName() << ") --> " << aNode->Name() << "(" -// << anInPort->PortName() << ")" << " ignored" ) ; - } - else if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) { - if ( begin ) { - beginService( "Graph_Impl::Links" ); - begin = false ; - } - Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId , + if ( !anInPort->IsDataStream() ) { + if ( theNode || ( toNode->IsEndSwitchNode() && !aNode->IsSwitchNode() ) ) { + if ( anInputParam == NULL || + !strcmp( anInPort->PortName() , anInputParam ) ) { + if ( anInPort->IsLoop() || anOutPort->IsLoop() || + ( toNode->IsEndLoopNode() && !strcmp( toNode->CoupledNode()->Name() , + anOutPort->NodeName() ) ) ) { +// MESSAGE( "Link " << anOutPort->NodeName() << "(" +// << anOutPort->PortName() << ") --> " << toNode->Name() << "(" +// << anInPort->PortName() << ")" << " ignored" ) ; + } + else if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) { + if ( begin ) { + beginService( "Graph_Impl::Links" ); + begin = false ; + } + Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , DataFlowEditor() , toNode , anInPort->PortName() , aNode , anOutPort->PortName() , - false ) ; - PortableServer::ObjectId * id = myLink->getId() ; - CORBA::Object_var obj = _poa->id_to_reference(*id); - SUPERV::Link_var iobject ; - iobject = SUPERV::Link::_narrow(obj) ; - RetVal->length( countlink + 1 ) ; - RetVal[ countlink++ ] = SUPERV::Link::_duplicate( iobject ) ; - anOutPort->AddInPortObjRef( anInPort , SUPERV::Link::_duplicate( iobject ) ) ; + false , true ) ; + PortableServer::ObjectId * id = myLink->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + SUPERV::Link_var iobject ; + iobject = SUPERV::Link::_narrow(obj) ; + RetVal->length( countlink + 1 ) ; + RetVal[ countlink++ ] = SUPERV::Link::_duplicate( iobject ) ; + anOutPort->AddInPortObjRef( anInPort , SUPERV::Link::_duplicate( iobject ) ) ; + } + else { + RetVal->length( countlink + 1 ) ; + RetVal[ countlink++ ] = SUPERV::Link::_duplicate( SUPERV::Link::_narrow( anOutPort->InPortObjRef( anInPort ) ) ) ; + } +// MESSAGE( "Link " << anOutPort->NodeName() << "(" +// << anOutPort->PortName() << ") --> " << toNode->Name() << "(" +// << anInPort->PortName() << ")" << " selected" ) ; } else { - RetVal->length( countlink + 1 ) ; - RetVal[ countlink++ ] = SUPERV::Link::_duplicate( anOutPort->InPortObjRef( anInPort ) ) ; +// MESSAGE( "Link " << anOutPort->NodeName() << "(" +// << anOutPort->PortName() << ") --> " << toNode->Name() << "(" +// << anInPort->PortName() << ")" << " skipped" ) ; } } } @@ -846,17 +868,34 @@ SUPERV::ListOfLinks * Graph_Impl::Links( GraphBase::ComputingNode * theNode , } } } +#if 0 + const char * NodeName = "" ; + const char * InputParamName = "" ; + if ( theNode ) { + NodeName = theNode->Name() ; + } + if ( anInputParam ) { + InputParamName = anInputParam ; + } + MESSAGE( RetVal->length() << " Links of Node " << NodeName << " and of InPort " << InputParamName ) ; + for ( i = 0 ; i < (int ) RetVal->length() ; i++ ) { + MESSAGE( "Link " << RetVal[i]->OutPort()->Node()->Name() << "(" + << RetVal[i]->OutPort()->Name() << ") --> " + << RetVal[i]->InPort()->Node()->Name() << "(" + << RetVal[i]->InPort()->Name() << ")" ) ; + } +#endif if ( !begin ) { endService( "Graph_Impl::Links" ); } return ( RetVal._retn() ) ; } -SUPERV::ListOfGraphs * Graph_Impl::Graphs() { -// beginService( "Graph_Impl::ListOfGraphs" ); +SUPERV::ListOfGraphs * Graph_Impl::SubGraphs() { +// beginService( "Graph_Impl::SubGraphs" ); SUPERV::ListOfGraphs_var RetVal = new SUPERV::ListOfGraphs ; - MESSAGE( "Graph_Impl::Graphs not yet implemented" ); -// endService( "Graph_Impl::ListOfGraphs" ); + MESSAGE( "Graph_Impl::SubGraphs not yet implemented" ); +// endService( "Graph_Impl::SubGraphs" ); return ( RetVal._retn() ) ; } @@ -864,7 +903,7 @@ Engines::Component_ptr Graph_Impl::ComponentRef( const char * aComputerContainer const char * aComponentName ) { Engines::Container_var myContainer ; Engines::Component_var objComponent ; - DataFlowEditor()->StartComponent( 0 , aComputerContainer , aComponentName , + DataFlowEditor()->Graph()->StartComponent( 0 , aComputerContainer , aComponentName , myContainer , objComponent ) ; return Engines::Component::_duplicate( objComponent ) ; } @@ -881,12 +920,6 @@ bool Graph_Impl::IsExecutable() { // endService( "Graph_Impl::IsExecutable" ); return RetVal ; } -bool Graph_Impl::IsDataFlow() { -// beginService( "Graph_Impl::IsDataFlow" ); - bool RetVal = false ; // = DataFlowEditor()->IsDataFlow() ; -// endService( "Graph_Impl::IsDataFlow" ); - return RetVal ; -} bool Graph_Impl::IsEditing() { // beginService( "Graph_Impl::IsEditing" ); @@ -922,7 +955,7 @@ SUPERV::ListOfNodes * Graph_Impl::LevelNodes(long aLevel ) { // RetVal->length( Nodes->length() ); for ( i = 0 ; i < (int ) Nodes->length() ; i++ ) { // char * aNode = Nodes[ i ] ; - GraphBase::ComputingNode * aNode = DataFlowEditor()->GetChangeGraphNode( Nodes[ i ] ) ; + GraphBase::ComputingNode * aNode = DataFlowEditor()->Graph()->GetChangeGraphNode( Nodes[ i ] ) ; RetVal = SetNode( RetVal , aNode ) ; // cout << "Graph_Impl::LevelNodes( " << aLevel << " ) " << aNode->Name() << endl ; // CNode_Impl * myNode = new CNode_Impl( _Orb , _Poa , _ContId , @@ -992,11 +1025,11 @@ bool Graph_Impl::Begin() { GraphBase::SGraph * myGraph = DataFlowEditor()->GetDataFlow() ; _DataFlowExecutor = new GraphExecutor::DataFlow( _Orb , _NamingService , myGraph->Info.theName.c_str() , - DebugFileName ) ; + DebugFileName , Kind() ) ; MESSAGE( "Graph_Impl::Begin : DataFlowExecutor created" ); RetVal = _DataFlowExecutor->LoadDataFlow( *myGraph ) ; if ( RetVal ) { - _DataFlowExecutor->SetObjImpl( DataFlowEditor()->ObjImpl() ) ; + _DataFlowExecutor->Graph()->SetObjImpl( DataFlowEditor()->Graph()->ObjImpl() ) ; DataFlowEditor()->Executor( _DataFlowExecutor ) ; } if ( pthread_mutex_unlock( &_MutexExecutorWait ) ) { @@ -1200,6 +1233,8 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph ) { int i ; map< string , int > aMapOfNodes ; SUPERV::Port_ptr aPort ; +// SUPERV::StreamPort_ptr aStreamPort ; +// ComputingNodes for ( i = 0 ; i < (int ) aGraphNodes->CNodes.length() ; i++ ) { SUPERV::CNode_var aNode = (aGraphNodes->CNodes)[ i ] ; SUPERV::CNode_ptr myNode = CNode( *(aNode->Service()) ) ; @@ -1209,7 +1244,7 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph ) { myNode->SetComment( aNode->Comment() ) ; myNode->Coords( aNode->X() , aNode->Y() ) ; string * aNodetheName = new string( aNode->Name() ) ; - aMapOfNodes[ *aNodetheName ] = DataFlowEditor()->GetGraphNodeIndex( myNode->Name() ) ; + aMapOfNodes[ *aNodetheName ] = DataFlowEditor()->Graph()->GetGraphNodeIndex( myNode->Name() ) ; delete aNodetheName ; RetVal = true ; } @@ -1217,19 +1252,18 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph ) { RetVal = false ; break ; } - SUPERV::ListOfPorts myPorts = *(aNode->Ports()) ; - int j ; - for ( j = 0 ; j < (int ) myPorts.length() ; j++ ) { - if ( myPorts[ j ]->IsInput() && myPorts[ j ]->IsDataStream() ) { - aPort = myNode->InPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ; - aPort->SetKind( SUPERV::DataStreamParameter ) ; - } - else if ( myPorts[ j ]->IsDataStream() ) { - aPort = myNode->OutPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ; - aPort->SetKind( SUPERV::DataStreamParameter ) ; - } - } +// SUPERV::ListOfStreamPorts myStreamPorts = *(aNode->StreamPorts()) ; +// int j ; +// for ( j = 0 ; j < (int ) myStreamPorts.length() ; j++ ) { +// if ( myStreamPorts[ j ]->IsInput() && myStreamPorts[ j ]->IsDataStream() ) { +// aStreamPort = myNode->InStreamPort( myStreamPorts[ j ]->Name() , myStreamPorts[ j ]->Type() ) ; +// } +// else if ( myStreamPorts[ j ]->IsDataStream() ) { +// aStreamPort = myNode->OutStreamPort( myStreamPorts[ j ]->Name() , myStreamPorts[ j ]->Type() ) ; +// } +// } } +// FactoryNodes if ( RetVal ) { for ( i = 0 ; i < (int ) aGraphNodes->FNodes.length() ; i++ ) { SUPERV::FNode_var aNode = (aGraphNodes->FNodes)[ i ] ; @@ -1242,7 +1276,7 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph ) { myNode->SetComment( aNode->Comment() ) ; myNode->Coords( aNode->X() , aNode->Y() ) ; string * aNodetheName = new string( aNode->Name() ) ; - aMapOfNodes[ *aNodetheName ] = DataFlowEditor()->GetGraphNodeIndex( myNode->Name() ) ; + aMapOfNodes[ *aNodetheName ] = DataFlowEditor()->Graph()->GetGraphNodeIndex( myNode->Name() ) ; delete aNodetheName ; RetVal = true ; } @@ -1250,20 +1284,19 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph ) { RetVal = false ; break ; } - SUPERV::ListOfPorts myPorts = *(aNode->Ports()) ; - int j ; - for ( j = 0 ; j < (int ) myPorts.length() ; j++ ) { - if ( myPorts[ j ]->IsInput() && myPorts[ j ]->IsDataStream() ) { - aPort = myNode->InPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ; - aPort->SetKind( SUPERV::DataStreamParameter ) ; - } - else if ( myPorts[ j ]->IsDataStream() ) { - aPort = myNode->OutPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ; - aPort->SetKind( SUPERV::DataStreamParameter ) ; - } - } +// SUPERV::ListOfStreamPorts myStreamPorts = *(aNode->StreamPorts()) ; +// int j ; +// for ( j = 0 ; j < (int ) myStreamPorts.length() ; j++ ) { +// if ( myStreamPorts[ j ]->IsInput() && myStreamPorts[ j ]->IsDataStream() ) { +// aStreamPort = myNode->InStreamPort( myStreamPorts[ j ]->Name() , myStreamPorts[ j ]->Type() ) ; +// } +// else if ( myStreamPorts[ j ]->IsDataStream() ) { +// aStreamPort = myNode->OutStreamPort( myStreamPorts[ j ]->Name() , myStreamPorts[ j ]->Type() ) ; +// } +// } } } +// InLineNodes if ( RetVal ) { for ( i = 0 ; i < (int ) aGraphNodes->INodes.length() ; i++ ) { SUPERV::INode_var aNode = (aGraphNodes->INodes)[ i ] ; @@ -1274,19 +1307,27 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph ) { myNode->SetComment( aNode->Comment() ) ; myNode->Coords( aNode->X() , aNode->Y() ) ; string * aNodetheName = new string( aNode->Name() ) ; - aMapOfNodes[ *aNodetheName ] = DataFlowEditor()->GetGraphNodeIndex( myNode->Name() ) ; + aMapOfNodes[ *aNodetheName ] = DataFlowEditor()->Graph()->GetGraphNodeIndex( myNode->Name() ) ; delete aNodetheName ; SUPERV::ListOfPorts myPorts = *(aNode->Ports()) ; int j ; for ( j = 0 ; j < (int ) myPorts.length() ; j++ ) { if ( myPorts[ j ]->IsInput() ) { aPort = myNode->InPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ; - aPort->SetKind( aNode->InPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() )->Kind() ) ; } else { aPort = myNode->OutPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ; } } + SUPERV::ListOfStreamPorts myStreamPorts = *(aNode->StreamPorts()) ; + for ( j = 0 ; j < (int ) myStreamPorts.length() ; j++ ) { + if ( myStreamPorts[ j ]->IsInput() ) { + aPort = myNode->InStreamPort( myStreamPorts[ j ]->Name() , StringToDataStreamType( myStreamPorts[ j ]->Type() ) , myStreamPorts[ j ]->Dependency() ) ; + } + else { + aPort = myNode->OutStreamPort( myStreamPorts[ j ]->Name() , StringToDataStreamType( myStreamPorts[ j ]->Type() ) , myStreamPorts[ j ]->Dependency() ) ; + } + } RetVal = true ; } else { @@ -1295,6 +1336,7 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph ) { } } } +// GOTONodes if ( RetVal ) { for ( i = 0 ; i < (int ) aGraphNodes->GNodes.length() ; i++ ) { SUPERV::GNode_var aNode = (aGraphNodes->GNodes)[ i ] ; @@ -1305,19 +1347,27 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph ) { myNode->SetComment( aNode->Comment() ) ; myNode->Coords( aNode->X() , aNode->Y() ) ; string * aNodetheName = new string( aNode->Name() ) ; - aMapOfNodes[ *aNodetheName ] = DataFlowEditor()->GetGraphNodeIndex( myNode->Name() ) ; + aMapOfNodes[ *aNodetheName ] = DataFlowEditor()->Graph()->GetGraphNodeIndex( myNode->Name() ) ; delete aNodetheName ; SUPERV::ListOfPorts myPorts = *(aNode->Ports()) ; int j ; for ( j = 0 ; j < (int ) myPorts.length() ; j++ ) { if ( myPorts[ j ]->IsInput() ) { aPort = myNode->InPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ; - aPort->SetKind( aNode->InPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() )->Kind() ) ; } else { aPort = myNode->OutPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ; } } + SUPERV::ListOfStreamPorts myStreamPorts = *(aNode->StreamPorts()) ; + for ( j = 0 ; j < (int ) myStreamPorts.length() ; j++ ) { + if ( myStreamPorts[ j ]->IsInput() ) { + aPort = myNode->InStreamPort( myStreamPorts[ j ]->Name() , StringToDataStreamType( myStreamPorts[ j ]->Type() ) , myStreamPorts[ j ]->Dependency() ) ; + } + else { + aPort = myNode->OutStreamPort( myStreamPorts[ j ]->Name() , StringToDataStreamType( myStreamPorts[ j ]->Type() ) , myStreamPorts[ j ]->Dependency() ) ; + } + } RetVal = true ; } else { @@ -1326,6 +1376,7 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph ) { } } } +// LoopNodes if ( RetVal ) { for ( i = 0 ; i < (int ) aGraphNodes->LNodes.length() ; i++ ) { SUPERV::LNode_var aNode = (aGraphNodes->LNodes)[ i ] ; @@ -1343,14 +1394,25 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph ) { myNode->SetComment( aNode->Comment() ) ; myNode->Coords( aNode->X() , aNode->Y() ) ; string * aNodetheName = new string( aNode->Name() ) ; - aMapOfNodes[ *aNodetheName ] = DataFlowEditor()->GetGraphNodeIndex( myNode->Name() ) ; + aMapOfNodes[ *aNodetheName ] = DataFlowEditor()->Graph()->GetGraphNodeIndex( myNode->Name() ) ; delete aNodetheName ; SUPERV::ListOfPorts myPorts = *(aNode->Ports()) ; int j ; for ( j = 0 ; j < (int ) myPorts.length() ; j++ ) { if ( myPorts[ j ]->IsInput() ) { aPort = myNode->InPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ; - aPort->SetKind( aNode->InPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() )->Kind() ) ; + } + else { + aPort = myNode->OutPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ; + } + } + SUPERV::ListOfStreamPorts myStreamPorts = *(aNode->StreamPorts()) ; + for ( j = 0 ; j < (int ) myStreamPorts.length() ; j++ ) { + if ( myStreamPorts[ j ]->IsInput() ) { + aPort = myNode->InStreamPort( myStreamPorts[ j ]->Name() , StringToDataStreamType( myStreamPorts[ j ]->Type() ) , myStreamPorts[ j ]->Dependency() ) ; + } + else { + aPort = myNode->OutStreamPort( myStreamPorts[ j ]->Name() , StringToDataStreamType( myStreamPorts[ j ]->Type() ) , myStreamPorts[ j ]->Dependency() ) ; } } SUPERV::INode_ptr myEndOfLoop = aNode->Coupled() ; @@ -1360,7 +1422,7 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph ) { anEndOfLoop->Coords( myEndOfLoop->X() , myEndOfLoop->Y() ) ; anEndOfLoop->SetPyFunction( myEndOfLoop->PyFuncName() , *(myEndOfLoop->PyFunction()) ) ; aNodetheName = new string( myEndOfLoop->Name() ) ; - aMapOfNodes[ *aNodetheName ] = DataFlowEditor()->GetGraphNodeIndex( anEndOfLoop->Name() ) ; + aMapOfNodes[ *aNodetheName ] = DataFlowEditor()->Graph()->GetGraphNodeIndex( anEndOfLoop->Name() ) ; delete aNodetheName ; RetVal = true ; } @@ -1370,6 +1432,7 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph ) { } } } +// SwitchNodes if ( RetVal ) { for ( i = 0 ; i < (int ) aGraphNodes->SNodes.length() ; i++ ) { SUPERV::SNode_var aNode = (aGraphNodes->SNodes)[ i ] ; @@ -1381,19 +1444,27 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph ) { myNode->SetComment( aNode->Comment() ) ; myNode->Coords( aNode->X() , aNode->Y() ) ; string * aNodetheName = new string( aNode->Name() ) ; - aMapOfNodes[ *aNodetheName ] = DataFlowEditor()->GetGraphNodeIndex( myNode->Name() ) ; + aMapOfNodes[ *aNodetheName ] = DataFlowEditor()->Graph()->GetGraphNodeIndex( myNode->Name() ) ; delete aNodetheName ; SUPERV::ListOfPorts myPorts = *(aNode->Ports()) ; int j ; for ( j = 0 ; j < (int ) myPorts.length() ; j++ ) { if ( myPorts[ j ]->IsInput() ) { aPort = myNode->InPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ; - aPort->SetKind( aNode->InPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() )->Kind() ) ; } else { aPort = myNode->OutPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ; } } + SUPERV::ListOfStreamPorts myStreamPorts = *(aNode->StreamPorts()) ; + for ( j = 0 ; j < (int ) myStreamPorts.length() ; j++ ) { + if ( myStreamPorts[ j ]->IsInput() ) { + aPort = myNode->InStreamPort( myStreamPorts[ j ]->Name() , StringToDataStreamType( myStreamPorts[ j ]->Type() ) , myStreamPorts[ j ]->Dependency() ) ; + } + else { + aPort = myNode->OutStreamPort( myStreamPorts[ j ]->Name() , StringToDataStreamType( myStreamPorts[ j ]->Type() ) , myStreamPorts[ j ]->Dependency() ) ; + } + } SUPERV::INode_ptr myEndOfSwitch = aNode->Coupled() ; anEndOfSwitch->SetName( myEndOfSwitch->Name() ) ; anEndOfSwitch->SetAuthor( myEndOfSwitch->Author() ) ; @@ -1401,16 +1472,24 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph ) { anEndOfSwitch->Coords( myEndOfSwitch->X() , myEndOfSwitch->Y() ) ; anEndOfSwitch->SetPyFunction( myEndOfSwitch->PyFuncName() , *(myEndOfSwitch->PyFunction()) ) ; aNodetheName = new string( myEndOfSwitch->Name() ) ; - aMapOfNodes[ *aNodetheName ] = DataFlowEditor()->GetGraphNodeIndex( anEndOfSwitch->Name() ) ; + aMapOfNodes[ *aNodetheName ] = DataFlowEditor()->Graph()->GetGraphNodeIndex( anEndOfSwitch->Name() ) ; delete aNodetheName ; myPorts = *(myEndOfSwitch->Ports()) ; for ( j = 0 ; j < (int ) myPorts.length() ; j++ ) { if ( myPorts[ j ]->IsInput() ) { - aPort = anEndOfSwitch->InPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ; - aPort->SetKind( aNode->InPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() )->Kind() ) ; + aPort = myNode->InPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ; } else { - aPort = anEndOfSwitch->OutPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ; + aPort = myNode->OutPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ; + } + } + SUPERV::ListOfStreamPorts myStreamSwitchPorts = *(myEndOfSwitch->StreamPorts()) ; + for ( j = 0 ; j < (int ) myStreamSwitchPorts.length() ; j++ ) { + if ( myStreamSwitchPorts[ j ]->IsInput() ) { + aPort = myNode->InStreamPort( myStreamSwitchPorts[ j ]->Name() , StringToDataStreamType( myStreamSwitchPorts[ j ]->Type() ) , myStreamSwitchPorts[ j ]->Dependency() ) ; + } + else { + aPort = myNode->OutStreamPort( myStreamSwitchPorts[ j ]->Name() , StringToDataStreamType( myStreamSwitchPorts[ j ]->Type() ) , myStreamSwitchPorts[ j ]->Dependency() ) ; } } RetVal = true ; @@ -1432,9 +1511,9 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph ) { SUPERV::Port_var InPort = aLink->InPort() ; string * aLinkFromNodeName = new string( OutPort->Node()->Name() ) ; string * aLinkToNodeName = new string( InPort->Node()->Name() ) ; - RetVal = DataFlowEditor()->AddLink( DataFlowEditor()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() , + RetVal = DataFlowEditor()->AddLink( DataFlowEditor()->Graph()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() , OutPort->Name() , - DataFlowEditor()->GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() , + DataFlowEditor()->Graph()->GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() , InPort->Name() ) ; if ( RetVal ) { int j ; @@ -1443,9 +1522,9 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph ) { RetVal = aLink->Coords( j , X , Y ) ; if ( !RetVal ) break ; - RetVal = DataFlowEditor()->AddLinkCoord( DataFlowEditor()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() , + RetVal = DataFlowEditor()->AddLinkCoord( DataFlowEditor()->Graph()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() , OutPort->Name() , - DataFlowEditor()->GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() , + DataFlowEditor()->Graph()->GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() , InPort->Name() , j , X , Y ) ; if ( !RetVal ) { @@ -1471,7 +1550,7 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph ) { // cout << "Graph_Impl::Merge " << " aNodeName " << aNodeName << " aPort " << thePortName + 1 // << " HasInput " << hasinput << endl ; if ( hasinput ) { - RetVal = DataFlowEditor()->AddInputData( DataFlowEditor()->GetGraphNode( aMapOfNodes[ aNodeName ] )->Name() , + RetVal = DataFlowEditor()->AddInputData( DataFlowEditor()->Graph()->GetGraphNode( aMapOfNodes[ aNodeName ] )->Name() , thePortName + 1 , *(aPort->ToAny()) ) ; } @@ -1487,3 +1566,24 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph ) { return RetVal ; } +SUPERV::StreamGraph_ptr Graph_Impl::ToStreamGraph() { + SUPERV::StreamGraph_var iobject = SUPERV::StreamGraph::_nil() ; + beginService( "Graph_Impl::ToStreamGraph" ); + if ( IsStreamGraph() ) { +// StreamGraph_Impl * myStreamGraph = new StreamGraph_Impl( _Orb , _Poa , _ContId , +// instanceName() , interfaceName() ) ; +// PortableServer::ObjectId * id = myStreamGraph->getId() ; +// CORBA::Object_var obj = _poa->id_to_reference(*id); + iobject = SUPERV::StreamGraph::_narrow( ObjRef() ) ; + if ( CORBA::is_nil( iobject ) ) { + MESSAGE( "ToStreamGraph of " << Name() << " (IsStreamGraph) --> nil reference" ) ; + } + } + else { + MESSAGE( "ToStreamGraph of " << Name() << " (IsNOTStreamGraph) --> nil reference" ) ; + } + endService( "Graph_Impl::ToStreamGraph" ); + return SUPERV::StreamGraph::_duplicate( iobject ) ; +} + + diff --git a/src/Supervision/Graph_Impl.hxx b/src/Supervision/Graph_Impl.hxx index d7b8d9a..aeb58e0 100644 --- a/src/Supervision/Graph_Impl.hxx +++ b/src/Supervision/Graph_Impl.hxx @@ -37,7 +37,7 @@ #include "SALOME_Component_i.hxx" #include "SALOME_LifeCycleCORBA.hxx" -#include "Link_Impl.hxx" +#include "StreamLink_Impl.hxx" #include "FNode_Impl.hxx" #include "GNode_Impl.hxx" #include "LNode_Impl.hxx" @@ -71,7 +71,8 @@ class Graph_Impl :public INode_Impl , PortableServer::ObjectId * contId , const char *instanceName , const char *interfaceName , - const char *aDataFlowName ) ; + const char *aDataFlowName , + const SUPERV::KindOfNode aKindOfNode ) ; virtual SUPERV::Graph_ptr Copy() ; virtual ~Graph_Impl() ; @@ -94,12 +95,6 @@ class Graph_Impl :public INode_Impl , virtual bool Export(const char * aXmlFile ) ; -#if 0 - virtual GraphBase::ListOfNodes * GetNodes() ; - virtual GraphBase::ListOfLinks * GetLinks() ; - virtual GraphBase::ListOfLinks * GetDatas() ; -#endif - virtual SUPERV::CNode_ptr CNode( const SALOME_ModuleCatalog::Service &NodeService ) ; virtual SUPERV::FNode_ptr FNode( @@ -135,17 +130,18 @@ class Graph_Impl :public INode_Impl , GraphBase::ComputingNode * aNode ) ; virtual SUPERV::ListOfNodes * Nodes() ; virtual void SetNodeObjRef( GraphEditor::InNode * anInNode ) ; + virtual SUPERV::ListOfLinks * GLinks() ; virtual SUPERV::ListOfLinks * Links( GraphBase::ComputingNode * aNode , const char * anInputParam ) ; - virtual SUPERV::ListOfGraphs * Graphs() ; + + virtual SUPERV::ListOfGraphs * SubGraphs() ; virtual Engines::Component_ptr ComponentRef( const char * aComputerContainer , const char * aComponentName ) ; virtual bool IsValid() ; virtual bool IsExecutable() ; - virtual bool IsDataFlow() ; virtual bool IsEditing() ; virtual bool IsExecuting() ; @@ -177,6 +173,8 @@ class Graph_Impl :public INode_Impl , virtual bool Merge(const SUPERV::Graph_ptr aGraph ) ; + virtual SUPERV::StreamGraph_ptr ToStreamGraph() ; + }; diff --git a/src/Supervision/INode_Impl.cxx b/src/Supervision/INode_Impl.cxx index bbce38e..9bda5bf 100644 --- a/src/Supervision/INode_Impl.cxx +++ b/src/Supervision/INode_Impl.cxx @@ -177,80 +177,178 @@ char * INode_Impl::PyFuncName() { return CORBA::string_dup( DataFlowNode()->PyFuncName() ) ; } -#if 0 -bool INode_Impl::BusPort( const char * InOutParameterName , - const char * InOutParameterType , - SUPERV::Port_out InputPort , - SUPERV::Port_out OutputPort ) { - return BusPorts( InOutParameterName , InOutParameterType , - InOutParameterName , InOutParameterType , - InputPort , OutputPort ) ; +SUPERV::Port_ptr INode_Impl::InPort( const char *aParameterName , + const char *aParameterType ) { + SUPERV::Port_ptr Inobject = SUPERV::Port::_nil() ; + SUPERV::Port_ptr Outobject = SUPERV::Port::_nil() ; + SUPERV::Port_ptr InEndobject = SUPERV::Port::_nil() ; + Port_Impl * myInPort = NULL ; + bool InPortCreated = false ; + MESSAGE( "CNode_Impl::InPort " << DataFlowNode()->Name() << "->AddInPort( " << aParameterName << " , " + << aParameterType << " )" ) ; + GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( aParameterName ) ; + if ( anInPort == NULL ) { + anInPort = DataFlowNode()->AddInPort( aParameterName , aParameterType , SUPERV::InLineParameter ) ; + InPortCreated = true ; + } + if ( anInPort ) { + Inobject = anInPort->ObjRef() ; + if ( CORBA::is_nil( Inobject ) ) { + myInPort = new Port_Impl( _Orb , _Poa , _ContId , + instanceName() , interfaceName() , + DataFlowEditor() , + DataFlowNode() , + (GraphBase::Port * ) anInPort , + true ) ; + if ( myInPort ) { + PortableServer::ObjectId * id = myInPort->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id) ; + Inobject = SUPERV::Port::_narrow(obj) ; + } + } + } + + if ( !CORBA::is_nil( Inobject ) && InPortCreated && + ( DataFlowNode()->IsLoopNode() || DataFlowNode()->IsEndLoopNode() ) ) { +// || DataFlowNode()->IsEndSwitchNode() ) ) { + Outobject = OutPort( aParameterName , aParameterType ) ; + if ( DataFlowNode()->IsLoopNode() ) { + LNode_Impl * myLoopNode = (LNode_Impl * ) this ; + InEndobject = myLoopNode->Coupled()->InPort( aParameterName , aParameterType ) ; + DataFlowEditor()->AddLink( Outobject->Node()->Name() , Outobject->Name() , + InEndobject->Node()->Name() , InEndobject->Name() ) ; + } + } + DataFlowEditor()->UnValid() ; + return SUPERV::Port::_duplicate( Inobject ) ; } -bool INode_Impl::BusPorts( const char * InputParameterName , - const char * InputParameterType , - const char * OutputParameterName , - const char * OutputParameterType , - SUPERV::Port_out InputPort , - SUPERV::Port_out OutputPort ) { - beginService( "INode_Impl::BusPorts" ); - bool RetVal = false ; - Port_Impl * myInPort = NULL ; +SUPERV::Port_ptr INode_Impl::OutPort( const char *aParameterName , + const char *aParameterType ) { Port_Impl * myOutPort = NULL ; - SUPERV::Port_var Inobject = SUPERV::Port::_nil() ; - SUPERV::Port_var Outobject = SUPERV::Port::_nil() ; -// if ( DataFlowNode()->GetInPort( InputParameterName ) || -// DataFlowNode()->GetOutPort( OutputParameterName ) ) { -// } -// else { - GraphBase::InPort * anInPort = DataFlowNode()->AddInPort( InputParameterName , - InputParameterType ) ; - if ( anInPort ) { - myInPort = new Port_Impl( _Orb , _Poa , _ContId , + SUPERV::Port_ptr Outobject = SUPERV::Port::_nil() ; + MESSAGE( "CNode_Impl::OutPort " << DataFlowNode()->Name() << "->AddOutPort( " << aParameterName << " , " + << aParameterType << " )" ) ; + GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeOutPort( aParameterName ) ; + if ( anOutPort == NULL ) { + anOutPort = DataFlowNode()->AddOutPort( aParameterName , aParameterType , SUPERV::InLineParameter ) ; + } + if ( anOutPort ) { + Outobject = anOutPort->ObjRef() ; + if ( CORBA::is_nil( Outobject ) ) { + const CORBA::Any * anAny = anOutPort->Value() ; + myOutPort = new Port_Impl( _Orb , _Poa , _ContId , + instanceName() , interfaceName() , + DataFlowEditor() , + DataFlowNode() , + (GraphBase::Port * ) anOutPort , + false , + anAny ) ; + if ( myOutPort ) { + PortableServer::ObjectId * id = myOutPort->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id) ; + Outobject = SUPERV::Port::_narrow(obj) ; + } + } + } + DataFlowEditor()->UnValid() ; + return SUPERV::Port::_duplicate( Outobject ); +} + +SUPERV::StreamPort_ptr INode_Impl::InStreamPort( const char *aParameterName , + const SALOME_ModuleCatalog::DataStreamType aParameterType , + const SALOME_ModuleCatalog::DataStreamDependency aDependency ) { + SUPERV::StreamPort_ptr Inobject = SUPERV::StreamPort::_nil() ; + if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) { + StreamPort_Impl * myInStreamPort = NULL ; + bool InPortCreated = false ; + MESSAGE( "INode_Impl::InStreamPort " << DataFlowNode()->Name() << "->AddInPort( " << aParameterName << " , " + << aParameterType << " )" ) ; + GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( aParameterName ) ; + if ( anInPort && !anInPort->IsDataStream() ) { + MESSAGE( "INode_Impl::InStreamPort ERROR !IsDataStream " ) ; + } + else if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) { + if ( anInPort == NULL ) { + anInPort = DataFlowNode()->ComputingNode()->AddInDataStreamPort( aParameterName , aParameterType , aDependency , SUPERV::DataStreamParameter ) ; + InPortCreated = true ; + } + + if ( anInPort ) { + Inobject = SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ; + if ( CORBA::is_nil( Inobject ) ) { + myInStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , DataFlowEditor() , DataFlowNode() , -// InputParameterName ) ; (GraphBase::Port * ) anInPort , true ) ; - GraphBase::OutPort * anOutPort = DataFlowNode()->AddOutPort( OutputParameterName , - OutputParameterType ) ; - if ( anOutPort ) { - const CORBA::Any * anAny = anOutPort->Value() ; - myOutPort = new Port_Impl( _Orb , _Poa , _ContId , - instanceName() , interfaceName() , - DataFlowEditor() , - DataFlowNode() , -// OutputParameterName , - (GraphBase::Port * ) anOutPort , - false , - anAny ) ; - DataFlowNode()->InOutPort( anInPort , anOutPort ) ; - RetVal = true ; + if ( myInStreamPort ) { + PortableServer::ObjectId * id = myInStreamPort->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id) ; + Inobject = SUPERV::StreamPort::_narrow(obj) ; + anInPort->ObjRef( SUPERV::StreamPort::_duplicate( Inobject ) ) ; + } + } } } -// } - if ( RetVal && myInPort && myOutPort ) { - if ( DataFlowNode()->CoupledNode() ) { - GraphBase::InPort * anInPort ; - anInPort = DataFlowNode()->CoupledNode()->AddInPort( OutputParameterName , - OutputParameterType ) ; - GraphBase::OutPort * anOutPort ; - anOutPort = DataFlowNode()->CoupledNode()->AddOutPort( InputParameterName , - InputParameterType ) ; - DataFlowNode()->CoupledNode()->InOutPort( anInPort , anOutPort ) ; + +// if ( !CORBA::is_nil( Inobject ) && InPortCreated && +// ( DataFlowNode()->IsLoopNode() || DataFlowNode()->IsEndLoopNode() || +// DataFlowNode()->IsEndSwitchNode() ) ) { +// Outobject = OutPort( aParameterName , aParameterType ) ; +// if ( DataFlowNode()->IsLoopNode() ) { +// LNode_Impl * myLoopNode = (LNode_Impl * ) this ; +// InEndobject = myLoopNode->Coupled()->InPort( aParameterName , aParameterType ) ; +// DataFlowEditor()->AddLink( Outobject->Node()->Name() , Outobject->Name() , +// InEndobject->Node()->Name() , InEndobject->Name() ) ; +// } +// } + DataFlowEditor()->UnValid() ; + } + return SUPERV::StreamPort::_duplicate( Inobject ) ; +} + +SUPERV::StreamPort_ptr INode_Impl::OutStreamPort( const char * aParameterName , + const SALOME_ModuleCatalog::DataStreamType aParameterType , + const SALOME_ModuleCatalog::DataStreamDependency aDependency ) { + StreamPort_Impl * myOutStreamPort = NULL ; + SUPERV::StreamPort_ptr Outobject = SUPERV::StreamPort::_nil() ; + if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) { + MESSAGE( "INode_Impl::OutStreamPort " << DataFlowNode()->Name() << "->AddOutPort( " << aParameterName << " , " + << aParameterType << " )" ) ; + GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeOutPort( aParameterName ) ; + if ( anOutPort && !anOutPort->IsDataStream() ) { + MESSAGE( "INode_Impl::OutStreamPort ERROR !IsDataStream " ) ; + } + else if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) { + if ( anOutPort == NULL ) { + anOutPort = DataFlowNode()->ComputingNode()->AddOutDataStreamPort( aParameterName , aParameterType , aDependency , SUPERV::DataStreamParameter ) ; + } + + if ( anOutPort ) { + Outobject = SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ; + if ( CORBA::is_nil( Outobject ) ) { + const CORBA::Any * anAny = anOutPort->Value() ; + myOutStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId , + instanceName() , interfaceName() , + DataFlowEditor() , + DataFlowNode() , + (GraphBase::Port * ) anOutPort , + false , + anAny ) ; + if ( myOutStreamPort ) { + PortableServer::ObjectId * id = myOutStreamPort->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id) ; + Outobject = SUPERV::StreamPort::_narrow(obj) ; + anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( Outobject ) ) ; + } + } + } } - PortableServer::ObjectId * id = myInPort->getId() ; - CORBA::Object_var obj = _poa->id_to_reference(*id) ; - Inobject = SUPERV::Port::_narrow(obj) ; - InputPort = SUPERV::Port::_duplicate( Inobject ) ; - id = myOutPort->getId() ; - obj = _poa->id_to_reference(*id); - Outobject = SUPERV::Port::_narrow(obj) ; - OutputPort = SUPERV::Port::_duplicate( Outobject ) ; + DataFlowEditor()->UnValid() ; } - endService( "INode_Impl::BusPorts" ); - return RetVal ; + return SUPERV::StreamPort::_duplicate( Outobject ); } -#endif + diff --git a/src/Supervision/INode_Impl.hxx b/src/Supervision/INode_Impl.hxx index cb2a89f..fd7342f 100644 --- a/src/Supervision/INode_Impl.hxx +++ b/src/Supervision/INode_Impl.hxx @@ -22,7 +22,7 @@ #include "CNode_Impl.hxx" -#include "Port_Impl.hxx" +#include "StreamPort_Impl.hxx" #include "DataFlowEditor_DataFlow.hxx" #include "DataFlowExecutor_DataFlow.hxx" @@ -80,6 +80,18 @@ class INode_Impl : public CNode_Impl , virtual GraphBase::InLineNode * BaseNode() { return DataFlowNode()->InLineNode() ; } ; + virtual SUPERV::Port_ptr InPort( const char * aParameterName , + const char * aParameterType ) ; + virtual SUPERV::Port_ptr OutPort( const char * aParameterName , + const char * aParameterType ) ; + + virtual SUPERV::StreamPort_ptr InStreamPort( const char * aParameterName , + const SALOME_ModuleCatalog::DataStreamType aParameterType , + const SALOME_ModuleCatalog::DataStreamDependency aDependency ) ; + virtual SUPERV::StreamPort_ptr OutStreamPort( const char * aParameterName , + const SALOME_ModuleCatalog::DataStreamType aParameterType , + const SALOME_ModuleCatalog::DataStreamDependency aDependency ) ; + } ; #endif diff --git a/src/Supervision/LNode_Impl.cxx b/src/Supervision/LNode_Impl.cxx index 436a59e..5e20dd8 100644 --- a/src/Supervision/LNode_Impl.cxx +++ b/src/Supervision/LNode_Impl.cxx @@ -91,7 +91,7 @@ void LNode_Impl::destroy() { aCoupled->destroy() ; } } - endService( "LNode_Impl::Destroy" ); +// endService( "LNode_Impl::Destroy" ); } bool LNode_Impl::Delete() { diff --git a/src/Supervision/Link_Impl.cxx b/src/Supervision/Link_Impl.cxx index f20bd13..78a1e86 100644 --- a/src/Supervision/Link_Impl.cxx +++ b/src/Supervision/Link_Impl.cxx @@ -34,7 +34,7 @@ using namespace std; //#include "utilities.h" -#include "Link_Impl.hxx" +#include "StreamLink_Impl.hxx" Link_Impl::Link_Impl( CORBA::ORB_ptr orb , PortableServer::POA_ptr poa , @@ -46,14 +46,14 @@ Link_Impl::Link_Impl( CORBA::ORB_ptr orb , const char *InputParameterName , GraphEditor::InNode * DataFlowOutNode , const char *OutputParameterName , - const bool Create ) : -// const SUPERV::Value_ptr aValue ) : + const bool Create , + const bool Get ) : Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) { // MESSAGE("Link_Impl::Link_Impl activate object instanceName(" // << instanceName << ") interfaceName(" << interfaceName << ") --> " // << hex << (void *) this << dec ) bool linksts ; - beginService( "Link_Impl::Link_Impl" ); +// beginService( "Link_Impl::Link_Impl" ); _Orb = CORBA::ORB::_duplicate(orb); _Poa = poa ; _ContId = contId ; @@ -72,7 +72,7 @@ Link_Impl::Link_Impl( CORBA::ORB_ptr orb , _DataFlowNode->Name() , _InputParameterName ) ; } - else { + else if ( Get ) { char * DataFlowOutNodeName = NULL ; char * OutParamName = NULL ; linksts = _DataFlowEditor->GetLink( _DataFlowNode->Name() , @@ -80,9 +80,11 @@ Link_Impl::Link_Impl( CORBA::ORB_ptr orb , &DataFlowOutNodeName , &OutParamName ) ; } - _thisObj = this ; - _id = _poa->activate_object(_thisObj); - endService( "Link_Impl::Link_Impl" ); + if ( Create or Get ) { + _thisObj = this ; + _id = _poa->activate_object(_thisObj) ; + } +// endService( "Link_Impl::Link_Impl" ); } Link_Impl::Link_Impl() { @@ -115,36 +117,86 @@ bool Link_Impl::Delete() { SUPERV::Port_ptr Link_Impl::InPort() { // beginService( "Link_Impl::InPort" ); + SUPERV::Port_var iobject = SUPERV::Port::_nil() ; GraphBase::InPort * anInPort = _DataFlowNode->GetChangeInPort( _InputParameterName ) ; - Port_Impl * myPort = new Port_Impl( _Orb , _Poa , _ContId , + if ( anInPort ) { + iobject = anInPort->ObjRef() ; + if ( CORBA::is_nil( iobject ) ) { + if ( !anInPort->IsDataStream() ) { + Port_Impl * myPort = new Port_Impl( _Orb , _Poa , _ContId , + instanceName() , interfaceName() , + _DataFlowEditor , + _DataFlowNode , + (GraphBase::Port * ) anInPort , + true ) ; + PortableServer::ObjectId * id = myPort->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + iobject = SUPERV::Port::_narrow(obj) ; + anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ; + } + else { + StreamPort_Impl * myStreamPort = new StreamPort_Impl( + _Orb , _Poa , _ContId , instanceName() , interfaceName() , - _DataFlowEditor , - _DataFlowNode , -// _InputParameterName ) ; + DataFlowEditor() , + DataFlowOutNode() , (GraphBase::Port * ) anInPort , - true ) ; - PortableServer::ObjectId * id = myPort->getId() ; - CORBA::Object_var obj = _poa->id_to_reference(*id); - SUPERV::Port_var iobject ; - iobject = SUPERV::Port::_narrow(obj) ; + false ) ; + PortableServer::ObjectId * id = myStreamPort->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + SUPERV::StreamPort_var iStreamobject ; + iStreamobject = SUPERV::StreamPort::_narrow(obj) ; + anInPort->ObjRef( SUPERV::StreamPort::_duplicate( iStreamobject ) ) ; + iobject = SUPERV::Port::_narrow( iStreamobject ) ; + } + } + else { + iobject = anInPort->ObjRef() ; + } + } // endService( "Link_Impl::InPort" ); return SUPERV::Port::_duplicate( iobject ) ; } SUPERV::Port_ptr Link_Impl::OutPort() { // beginService( "Link_Impl::OutPort" ); + SUPERV::Port_var iobject = SUPERV::Port::_nil() ; GraphBase::OutPort * anOutPort = _DataFlowOutNode->GetChangeOutPort( _OutputParameterName ) ; - Port_Impl * myPort = new Port_Impl( _Orb , _Poa , _ContId , + if ( anOutPort ) { + iobject = anOutPort->ObjRef() ; + if ( CORBA::is_nil( iobject ) ) { + if ( !anOutPort->IsDataStream() ) { + Port_Impl * myPort = new Port_Impl( _Orb , _Poa , _ContId , + instanceName() , interfaceName() , + _DataFlowEditor , + _DataFlowOutNode , + (GraphBase::Port * ) anOutPort , + false ) ; + PortableServer::ObjectId * id = myPort->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + iobject = SUPERV::Port::_narrow(obj) ; + anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ; + } + else { + StreamPort_Impl * myStreamPort = new StreamPort_Impl( + _Orb , _Poa , _ContId , instanceName() , interfaceName() , - _DataFlowEditor , - _DataFlowOutNode , -// _OutputParameterName ) ; + DataFlowEditor() , + DataFlowOutNode() , (GraphBase::Port * ) anOutPort , false ) ; - PortableServer::ObjectId * id = myPort->getId() ; - CORBA::Object_var obj = _poa->id_to_reference(*id); - SUPERV::Port_var iobject ; - iobject = SUPERV::Port::_narrow(obj) ; + PortableServer::ObjectId * id = myStreamPort->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + SUPERV::StreamPort_var iStreamobject ; + iStreamobject = SUPERV::StreamPort::_narrow(obj) ; + anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( iStreamobject ) ) ; + iobject = SUPERV::Port::_narrow( iStreamobject ) ; + } + } + else { + iobject = anOutPort->ObjRef() ; + } + } // endService( "Link_Impl::OutPort" ); return SUPERV::Port::_duplicate( iobject ) ; } diff --git a/src/Supervision/Link_Impl.hxx b/src/Supervision/Link_Impl.hxx index b51245c..d0aa1df 100644 --- a/src/Supervision/Link_Impl.hxx +++ b/src/Supervision/Link_Impl.hxx @@ -70,12 +70,28 @@ class Link_Impl : public POA_SUPERV::Link , const char *InputParameterName , GraphEditor::InNode * DataFlowOutNode , const char *OutputParameterName , - const bool Create ) ; + const bool Create , + const bool Get ) ; virtual ~Link_Impl() ; virtual void destroy() ; virtual bool Delete() ; + GraphEditor::DataFlow * DataFlowEditor() { + return _DataFlowEditor ; } ; + GraphEditor::InNode * DataFlowNode() { + return _DataFlowNode ; } ; + char * DataFlowNodeName() { + return _DataFlowNodeName ; } ; + char * InputParameterName() { + return _InputParameterName ; } ; + GraphEditor::InNode * DataFlowOutNode() { + return _DataFlowOutNode ; } ; + char * DataFlowOutNodeName() { + return _DataFlowOutNodeName ; } ; + char * OutputParameterName() { + return _OutputParameterName ; } ; + SUPERV::Port_ptr OutPort() ; SUPERV::Port_ptr InPort() ; diff --git a/src/Supervision/Makefile.in b/src/Supervision/Makefile.in index 341019d..ce0b3ae 100755 --- a/src/Supervision/Makefile.in +++ b/src/Supervision/Makefile.in @@ -39,6 +39,7 @@ EXPORT_SHAREDPYSCRIPTS = SUPERV_shared_modules.py EXPORT_HEADERS = \ SuperV_Impl.hxx \ + StreamGraph_Impl.hxx \ Graph_Impl.hxx \ CNode_Impl.hxx \ FNode_Impl.hxx \ @@ -49,15 +50,19 @@ EXPORT_HEADERS = \ SNode_Impl.hxx \ ESNode_Impl.hxx \ Link_Impl.hxx \ + StreamLink_Impl.hxx \ Value_Impl.hxx \ - Port_Impl.hxx + Port_Impl.hxx \ + StreamPort_Impl.hxx # Input_Impl.hxx \ # Libraries targets LIB = libSUPERVEngine.la LIB_SRC = Value_Impl.cxx \ Port_Impl.cxx \ + StreamPort_Impl.cxx \ Link_Impl.cxx \ + StreamLink_Impl.cxx \ CNode_Impl.cxx \ FNode_Impl.cxx \ INode_Impl.cxx \ @@ -66,6 +71,7 @@ LIB_SRC = Value_Impl.cxx \ ELNode_Impl.cxx \ SNode_Impl.cxx \ ESNode_Impl.cxx \ + StreamGraph_Impl.cxx \ Graph_Impl.cxx \ SuperV_Impl.cxx # Input_Impl.cxx \ @@ -83,14 +89,13 @@ BIN_SERVER_IDL = CPPFLAGS+= $(PYTHON_INCLUDES) $(QT_MT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) \ -I${KERNEL_ROOT_DIR}/include/salome -#CXXFLAGS= -g -D_DEBUG_ -D__x86__ -D__linux__ -ftemplate-depth-42 -Wno-deprecated -#CXXFLAGS= -g -D_DEBUG_ -D__x86__ -D__linux__ -ftemplate-depth-42 -Wall ### mpv: D_DEBUG key must be set only on DEBUG compilation mode -CXXFLAGS += -g -D__x86__ -D__linux__ -ftemplate-depth-42 -Wall \ +CXXFLAGS += -g -D_DEBUG_ -D__x86__ -D__linux__ -ftemplate-depth-42 -Wall \ -I${KERNEL_ROOT_DIR}/include/salome LDFLAGS+= -lSalomeSuperVisionEditor -lSalomeSuperVisionExecutor -lSalomeSuperVisionBase \ -lSalomeContainer -lSalomeNotification -lSalomeNS -lSalomeLifeCycleCORBA \ -lOpUtil -lRegistry -lTOOLSDS -lSALOMELocalTrace \ $(QT_MT_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome +#LIBS += -Xlinker -export-dynamic $(PYTHON_LIBS) @CONCLUDE@ diff --git a/src/Supervision/Port_Impl.cxx b/src/Supervision/Port_Impl.cxx index 419adb3..4c64815 100644 --- a/src/Supervision/Port_Impl.cxx +++ b/src/Supervision/Port_Impl.cxx @@ -44,33 +44,26 @@ Port_Impl::Port_Impl( CORBA::ORB_ptr orb , const char *interfaceName , GraphEditor::DataFlow * DataFlowEditor , GraphEditor::InNode * DataFlowNode , -// const char *ParameterName , GraphBase::Port * DataFlowPort , bool InputPort , const CORBA::Any * anAny ) : -// const SUPERV::Value_ptr aValue ) : Value_Impl(orb, poa, contId, instanceName, interfaceName, -// DataFlowEditor , DataFlowNode , ParameterName, aValue->ToAny() , DataFlowEditor , DataFlowNode , DataFlowPort->PortName(), anAny , false ) { -// MESSAGE("Value_Impl::Value_Impl activate object instanceName(" -// << instanceName << ") interfaceName(" << interfaceName << ") --> " -// << hex << (void *) this << dec ) +// MESSAGE("Port_Impl::Port_Impl activate object instanceName(" +// << instanceName << ") interfaceName(" << interfaceName +// << ") IsDataStream " << DataFlowPort->IsDataStream() ) _Orb = CORBA::ORB::_duplicate(orb); _Poa = poa ; _ContId = contId ; - _thisObj = this ; - _id = _poa->activate_object(_thisObj); + if ( !DataFlowPort->IsDataStream() ) { + _thisObj = this ; + _id = _poa->activate_object(_thisObj) ; + } _DataFlowEditor = DataFlowEditor ; _DataFlowNode = DataFlowNode ; -// _DataFlowPort = _DataFlowNode->GetChangeInPort( ParameterName ) ; _DataFlowPort = DataFlowPort ; -// _InputPort = true ; _InputPort = InputPort ; -// if ( _DataFlowPort == NULL ) { -// _DataFlowPort = _DataFlowNode->GetChangeOutPort( ParameterName ) ; -// _InputPort = false ; -// } InPort( _InputPort ) ; } @@ -81,30 +74,29 @@ Port_Impl::Port_Impl( CORBA::ORB_ptr orb , const char *interfaceName , GraphEditor::DataFlow * DataFlowEditor , GraphEditor::InNode * DataFlowNode , -// const char *ParameterName ) : GraphBase::Port * DataFlowPort , bool InputPort ) : Value_Impl(orb, poa, contId, instanceName, interfaceName, DataFlowEditor , DataFlowNode , DataFlowPort->PortName() , false ) { -// DataFlowEditor , DataFlowNode , ParameterName , false ) { -// MESSAGE("Value_Impl::Value_Impl activate object instanceName(" -// << instanceName << ") interfaceName(" << interfaceName << ") --> " -// << hex << (void *) this << dec ) + char * nodename = DataFlowEditor->Graph()->Name() ; + if ( DataFlowNode ) { + nodename = DataFlowNode->Name() ; + } +// MESSAGE("Port_Impl::Port_Impl activate object instanceName(" +// << instanceName << ") interfaceName(" << interfaceName +// << ") " << nodename << "(" << DataFlowPort->PortName() +// << ") IsDataStream " << DataFlowPort->IsDataStream() ) ; _Orb = CORBA::ORB::_duplicate(orb); _Poa = poa ; _ContId = contId ; - _thisObj = this ; - _id = _poa->activate_object(_thisObj); + if ( !DataFlowPort->IsDataStream() ) { + _thisObj = this ; + _id = _poa->activate_object(_thisObj) ; + } _DataFlowEditor = DataFlowEditor ; _DataFlowNode = DataFlowNode ; -// _DataFlowPort = _DataFlowNode->GetChangeInPort( ParameterName ) ; _DataFlowPort = DataFlowPort ; -// _InputPort = true ; _InputPort = InputPort ; -// if ( _DataFlowPort == NULL ) { -// _DataFlowPort = _DataFlowNode->GetChangeOutPort( ParameterName ) ; -// _InputPort = false ; -// } InPort( _InputPort ) ; } @@ -199,24 +191,123 @@ char * Port_Impl::Type() { SUPERV::CNode_ptr Port_Impl::Node() { bool begin = true ; - SUPERV::CNode_var iobject = SUPERV::CNode::_nil() ; - if ( CORBA::is_nil( _DataFlowNode->ObjRef() ) ) { - if ( begin ) { - beginService( "Port_Impl::Node" ) ; - begin = false ; + SUPERV::CNode_var iobject ; + if ( _DataFlowNode ) { + MESSAGE( "Port_Impl::Node " << _DataFlowNode->Name() ) ; + iobject = SUPERV::CNode::_narrow( _DataFlowNode->ObjRef() ) ; + if ( CORBA::is_nil( iobject ) ) { + if ( begin ) { + beginService( "Port_Impl::Node" ) ; + begin = false ; + } + PortableServer::ObjectId * id ; + CORBA::Object_var obj ; + if ( _DataFlowNode->IsComputingNode() ) { + CNode_Impl * myNode = NULL ; + myNode = new CNode_Impl( _Orb , _Poa , _ContId , + instanceName() , interfaceName() , + _DataFlowEditor , + _DataFlowNode ) ; + id = myNode->getId() ; + obj = _poa->id_to_reference(*id); + iobject = SUPERV::CNode::_narrow( obj ) ; + myNode->SetObjRef( SUPERV::CNode::_duplicate( iobject ) ) ; + } + else if ( _DataFlowNode->IsFactoryNode() ) { + FNode_Impl * myNode = NULL ; + myNode = new FNode_Impl( _Orb , _Poa , _ContId , + instanceName() , interfaceName() , + _DataFlowEditor , + _DataFlowNode ) ; + id = myNode->getId() ; + obj = _poa->id_to_reference(*id); + SUPERV::FNode_var Fiobject = SUPERV::FNode::_narrow( obj ) ; + iobject = SUPERV::CNode::_narrow( Fiobject ) ; + myNode->SetObjRef( SUPERV::FNode::_duplicate( Fiobject ) ) ; + } + else if ( _DataFlowNode->IsInLineNode() ) { + INode_Impl * myNode = NULL ; + myNode = new INode_Impl( _Orb , _Poa , _ContId , + instanceName() , interfaceName() , + _DataFlowEditor , + _DataFlowNode ) ; + id = myNode->getId() ; + obj = _poa->id_to_reference(*id); + SUPERV::INode_var Iiobject = SUPERV::INode::_narrow( obj ) ; + iobject = SUPERV::CNode::_narrow( Iiobject ) ; + myNode->SetObjRef( SUPERV::INode::_duplicate( Iiobject ) ) ; + } + else if ( _DataFlowNode->IsGOTONode() ) { + GNode_Impl * myNode = NULL ; + myNode = new GNode_Impl( _Orb , _Poa , _ContId , + instanceName() , interfaceName() , + _DataFlowEditor , + _DataFlowNode ) ; + id = myNode->getId() ; + obj = _poa->id_to_reference(*id); + SUPERV::GNode_var Giobject = SUPERV::GNode::_narrow( obj ) ; + iobject = SUPERV::CNode::_narrow( Giobject ) ; + myNode->SetObjRef( SUPERV::GNode::_duplicate( Giobject ) ) ; + } + else if ( _DataFlowNode->IsLoopNode() ) { + LNode_Impl * myNode = NULL ; + myNode = new LNode_Impl( _Orb , _Poa , _ContId , + instanceName() , interfaceName() , + _DataFlowEditor , + _DataFlowNode ) ; + id = myNode->getId() ; + obj = _poa->id_to_reference(*id); + SUPERV::LNode_var Liobject = SUPERV::LNode::_narrow( obj ) ; + iobject = SUPERV::CNode::_narrow( Liobject ) ; + myNode->SetObjRef( SUPERV::LNode::_duplicate( Liobject ) ) ; + } + else if ( _DataFlowNode->IsEndLoopNode() ) { + ELNode_Impl * myNode = NULL ; + myNode = new ELNode_Impl( _Orb , _Poa , _ContId , + instanceName() , interfaceName() , + _DataFlowEditor , + _DataFlowNode ) ; + id = myNode->getId() ; + obj = _poa->id_to_reference(*id); + SUPERV::ELNode_var ELiobject = SUPERV::ELNode::_narrow( obj ) ; + iobject = SUPERV::CNode::_narrow( ELiobject ) ; + myNode->SetObjRef( SUPERV::ELNode::_duplicate( ELiobject ) ) ; + } + else if ( _DataFlowNode->IsSwitchNode() ) { + SNode_Impl * myNode = NULL ; + myNode = new SNode_Impl( _Orb , _Poa , _ContId , + instanceName() , interfaceName() , + _DataFlowEditor , + _DataFlowNode ) ; + id = myNode->getId() ; + obj = _poa->id_to_reference(*id); + SUPERV::SNode_var Siobject = SUPERV::SNode::_narrow( obj ) ; + iobject = SUPERV::CNode::_narrow( Siobject ) ; + myNode->SetObjRef( SUPERV::SNode::_duplicate( Siobject ) ) ; + } + else if ( _DataFlowNode->IsEndSwitchNode() ) { + ESNode_Impl * myNode = NULL ; + myNode = new ESNode_Impl( _Orb , _Poa , _ContId , + instanceName() , interfaceName() , + _DataFlowEditor , + _DataFlowNode ) ; + id = myNode->getId() ; + obj = _poa->id_to_reference(*id); + SUPERV::ESNode_var ESiobject = SUPERV::ESNode::_narrow( obj ) ; + iobject = SUPERV::CNode::_narrow( ESiobject ) ; + myNode->SetObjRef( SUPERV::ESNode::_duplicate( ESiobject ) ) ; + } + } + else { +// MESSAGE( "Port_Impl::Node known objref " << iobject->Name() ) ; } - CNode_Impl * myNode = new CNode_Impl( _Orb , _Poa , _ContId , - instanceName() , interfaceName() , - _DataFlowEditor , - _DataFlowNode ) ; - PortableServer::ObjectId * id = myNode->getId() ; - CORBA::Object_var obj = _poa->id_to_reference(*id); - SUPERV::CNode_var iobject ; - iobject = SUPERV::CNode::_narrow(obj) ; - myNode->SetObjRef( SUPERV::CNode::_duplicate( iobject ) ) ; } else { - iobject = _DataFlowNode->ObjRef() ; + MESSAGE( "Port_Impl::GraphNode " << _DataFlowEditor->Graph()->Name() ) ; + iobject = SUPERV::CNode::_narrow( _DataFlowEditor->Graph()->ObjRef() ) ; + if ( CORBA::is_nil( iobject ) ) { + MESSAGE( "Port_Impl::GraphNode NilRef" ) ; + } } if ( !begin ) { endService( "Port_Impl::Node" ) ; @@ -227,8 +318,18 @@ SUPERV::CNode_ptr Port_Impl::Node() { SUPERV::ListOfLinks * Port_Impl::Links() { beginService( "Port_Impl::Links" ) ; SUPERV::ListOfLinks_var RetVal = new SUPERV::ListOfLinks ; - RetVal = _DataFlowEditor->ObjImpl()->Links( _DataFlowNode->ComputingNode() , - _DataFlowPort->PortName() ) ; + RetVal = _DataFlowEditor->Graph()->ObjImpl()->Links( _DataFlowNode->ComputingNode() , + _DataFlowPort->PortName() ) ; + MESSAGE( "Links of Node " << _DataFlowNode->ComputingNode()->Name() + << " and of Port " << _DataFlowPort->PortName() + << " _InputPort " << _InputPort ) ; + int i ; + for ( i = 0 ; i < (int ) RetVal->length() ; i++ ) { + MESSAGE( "Link " << RetVal[i]->OutPort()->Node()->Name() << "(" + << RetVal[i]->OutPort()->Name() << ") --> " + << RetVal[i]->InPort()->Node()->Name() << "(" + << RetVal[i]->InPort()->Name() << ")" ) ; + } endService( "Port_Impl::Links" ) ; return ( RetVal._retn() ) ; } @@ -242,8 +343,8 @@ SUPERV::Link_ptr Port_Impl::Link() { SUPERV::ListOfLinks_var Links = new SUPERV::ListOfLinks ; // cout << "Port_Impl::Link " << _DataFlowNode->Name() << " " // << _DataFlowPort->PortName() << endl ; - Links = _DataFlowEditor->ObjImpl()->Links( _DataFlowNode->ComputingNode() , - _DataFlowPort->PortName() ) ; + Links = _DataFlowEditor->Graph()->ObjImpl()->Links( _DataFlowNode->ComputingNode() , + _DataFlowPort->PortName() ) ; if ( Links->length() ) { iobject = Links[ 0 ] ; } @@ -280,9 +381,9 @@ SUPERV::Link_ptr Port_Impl::Link() { _DataFlowEditor , _DataFlowNode , _DataFlowPort->PortName() , - (GraphEditor::InNode * ) _DataFlowEditor->GetChangeGraphNode( FromNodeName )->GetInNode() , + (GraphEditor::InNode * ) _DataFlowEditor->Graph()->GetChangeGraphNode( FromNodeName )->GetInNode() , FromServiceParameterName , - false ) ; + false , true ) ; PortableServer::ObjectId * id = myLink->getId() ; CORBA::Object_var obj = _poa->id_to_reference(*id); iobject = SUPERV::Link::_narrow(obj) ; @@ -313,19 +414,21 @@ bool Port_Impl::IsInput() { bool Port_Impl::IsLinked() { // beginService( "Port_Impl::IsLinked" ) ; bool RetVal = false ; - GraphBase::InPort * anInPort = _DataFlowNode->GetChangeInPort( _DataFlowPort->PortName() ) ; - GraphBase::OutPort * anOutPort = NULL ; - if ( anInPort) { - anOutPort = anInPort->GetOutPort() ; - } - if ( _DataFlowNode->IsEndLoopNode() && anOutPort && - !strcmp( _DataFlowNode->CoupledNode()->Name() , anOutPort->NodeName() ) ) { -// MESSAGE( "Link " << anOutPort->NodeName() << "(" -// << anOutPort->PortName() << ") --> " << _DataFlowNode->Name() << "(" -// << anInPort->PortName() << ")" << " ignored" ) ; - } - else { - RetVal = _DataFlowNode->IsLinked( _DataFlowPort->PortName() ) ; + if ( _DataFlowNode ) { + GraphBase::InPort * anInPort = _DataFlowNode->GetChangeInPort( _DataFlowPort->PortName() ) ; + GraphBase::OutPort * anOutPort = NULL ; + if ( anInPort) { + anOutPort = anInPort->GetOutPort() ; + } + if ( _DataFlowNode->IsEndLoopNode() && anOutPort && + !strcmp( _DataFlowNode->CoupledNode()->Name() , anOutPort->NodeName() ) ) { +// MESSAGE( "Link " << anOutPort->NodeName() << "(" +// << anOutPort->PortName() << ") --> " << _DataFlowNode->Name() << "(" +// << anInPort->PortName() << ")" << " ignored" ) ; + } + else { + RetVal = _DataFlowNode->IsLinked( _DataFlowPort->PortName() ) ; + } } // endService( "Port_Impl::IsLinked" ) ; return RetVal ; @@ -433,3 +536,4 @@ bool Port_Impl::IsDone() { // endService( "Port_Impl::IsDone" ); return RetVal ; } + diff --git a/src/Supervision/Port_Impl.hxx b/src/Supervision/Port_Impl.hxx index df2339e..eddd426 100644 --- a/src/Supervision/Port_Impl.hxx +++ b/src/Supervision/Port_Impl.hxx @@ -83,34 +83,41 @@ class Port_Impl : public Value_Impl , virtual ~Port_Impl() ; virtual void destroy() ; + GraphEditor::DataFlow * DataFlowEditor() { + return _DataFlowEditor ; } ; + GraphEditor::InNode * DataFlowNode() { + return _DataFlowNode ; } ; + GraphBase::Port * DataFlowPort() { + return _DataFlowPort ; } ; + virtual bool Input( const SUPERV::Value_ptr aValue ) ; virtual bool Input( const CORBA::Any * anAny ) ; - virtual char * Name() ; - virtual char * Type() ; + virtual char * Name() ; + virtual char * Type() ; - virtual SUPERV::CNode_ptr Node() ; + virtual SUPERV::CNode_ptr Node() ; - virtual SUPERV::Link_ptr Link() ; - virtual SUPERV::ListOfLinks * Links() ; + virtual SUPERV::Link_ptr Link() ; + virtual SUPERV::ListOfLinks * Links() ; - virtual bool IsInput() ; - virtual bool IsLinked() ; - virtual bool HasInput() ; + virtual bool IsInput() ; + virtual bool IsLinked() ; + virtual bool HasInput() ; - virtual SUPERV::KindOfPort Kind() ; + virtual SUPERV::KindOfPort Kind() ; virtual void SetKind( SUPERV::KindOfPort ) ; - virtual bool IsParam() ; - virtual bool IsGate() ; - virtual bool IsInLine() ; - virtual bool IsLoop() ; - virtual bool IsSwitch() ; - virtual bool IsEndSwitch() ; - virtual bool IsDataStream() ; + virtual bool IsParam() ; + virtual bool IsGate() ; + virtual bool IsInLine() ; + virtual bool IsLoop() ; + virtual bool IsSwitch() ; + virtual bool IsEndSwitch() ; + virtual bool IsDataStream() ; - virtual SUPERV::GraphState State() ; - virtual bool IsDone() ; + virtual SUPERV::GraphState State() ; + virtual bool IsDone() ; } ; diff --git a/src/Supervision/SNode_Impl.cxx b/src/Supervision/SNode_Impl.cxx index 79d244c..1d6b83e 100644 --- a/src/Supervision/SNode_Impl.cxx +++ b/src/Supervision/SNode_Impl.cxx @@ -88,7 +88,7 @@ void SNode_Impl::destroy() { aCoupled->destroy() ; } } - endService( "SNode_Impl::Destroy" ); +// endService( "SNode_Impl::Destroy" ); } bool SNode_Impl::Delete() { diff --git a/src/Supervision/SuperV.py b/src/Supervision/SuperV.py index e791ceb..82ca358 100644 --- a/src/Supervision/SuperV.py +++ b/src/Supervision/SuperV.py @@ -207,6 +207,11 @@ class CNode: if self.N.IsFactory() : print "ComponentName ",self.N.GetComponentName() print "InterfaceName ",self.N.GetInterfaceName() + if self.N.IsStreamGraph() : + Timeout,DataStreamTrace,DeltaTime = self.G.StreamParams() + print "Timeout",Timeout + print "DataStreamTrace",DataStreamTrace + print "DeltaTime",DeltaTime aService = self.N.Service() print "Service Name ",aService.ServiceName lenin = len( aService.ServiceinParameter ) @@ -252,57 +257,54 @@ class CNode: if self.N.Verbose : print ErrMsg return anInput - def InPort( self , aParameterName , aParameterType ): - aPort = self.N.InPort( aParameterName , - aParameterType ) + def InStreamPort( self , aParameterName , aParameterType , aDependency ): + aPort = self.N.InStreamPort( aParameterName , aParameterType , aDependency ) if aPort != None : - myPort = Port( aPort , self.N.Verbose ) + myPort = StreamPort( aPort , self.N.Verbose ) return myPort if self.N.Verbose : print "Error while creating the Port : ",aParameterName return None - def OutPort( self , aParameterName , aParameterType ): - aPort = self.N.OutPort( aParameterName , - aParameterType ) + def OutStreamPort( self , aParameterName , aParameterType , aDependency ): + aPort = self.N.OutStreamPort( aParameterName , aParameterType , aDependency ) if aPort != None : - myPort = Port( aPort , self.N.Verbose ) + myPort = StreamPort( aPort , self.N.Verbose ) return myPort if self.N.Verbose : print "Error while creating the Port : ",aParameterName return None - def InDataStreamPort( self , aParameterName , aParameterType ): - aPort = self.N.InDataStreamPort( aParameterName , - aParameterType ) + def GetInPort( self , aParameterName ): + aPort = self.N.GetInPort( aParameterName ) if aPort != None : myPort = Port( aPort , self.N.Verbose ) return myPort if self.N.Verbose : print "Error while creating the Port : ",aParameterName return None - def OutDataStreamPort( self , aParameterName , aParameterType ): - aPort = self.N.OutDataStreamPort( aParameterName , - aParameterType ) + def GetOutPort( self , aParameterName ): + aPort = self.N.GetOutPort( aParameterName ) if aPort != None : myPort = Port( aPort , self.N.Verbose ) return myPort if self.N.Verbose : print "Error while creating the Port : ",aParameterName return None -# def BusPort( self , InOutParameterName , InOutParameterType ): -# sts,inp,outp = self.N.BusPort( InOutParameterName , -# InOutParameterType ) -# inp = Port( inp , self.N.Verbose ) -# outp = Port( outp , self.N.Verbose ) -# return sts,inp,outp -# def BusPorts( self , InputParameterName , InputParameterType , -# OutputParameterName , OutputParameterType ): -# sts,inp,outp = self.N.BusPorts( InputParameterName , -# InputParameterType , -# OutputParameterName , -# OutputParameterType ) -# inp = Port( inp , self.N.Verbose ) -# outp = Port( outp , self.N.Verbose ) -# return sts,inp,outp + def GetInStreamPort( self , aParameterName ): + aPort = self.N.GetInStreamPort( aParameterName ) + if aPort != None : + myPort = StreamPort( aPort , self.N.Verbose ) + return myPort + if self.N.Verbose : + print "Error while creating the Port : ",aParameterName + return None + def GetOutStreamPort( self , aParameterName ): + aPort = self.N.GetOutStreamPort( aParameterName ) + if aPort != None : + myPort = StreamPort( aPort , self.N.Verbose ) + return myPort + if self.N.Verbose : + print "Error while creating the Port : ",aParameterName + return None def Ports( self ): ports = self.N.Ports() i = 0 @@ -310,13 +312,34 @@ class CNode: ports[ i ] = Port( ports[i] , self.N.Verbose ) i = i + 1 return ports + def StreamPorts( self ): + ports = self.N.StreamPorts() + i = 0 + while i < len( ports ) : + ports[ i ] = StreamPort( ports[i] , self.N.Verbose ) + i = i + 1 + return ports + def AllPorts( self ): + allports = self.N.Ports() + lenports = len( allports ) + i = 0 + while i < lenports : + allports[ i ] = Port( allports[i] , self.N.Verbose ) + i = i + 1 + ports = self.N.StreamPorts() + i = 0 + while i < len( ports ) : + allports.append( StreamPort( ports[i] , self.N.Verbose ) ) + i = i + 1 + return allports def ListPorts( self , *args ): if len( args ) == 0 : aName = self.N.Name() else : aName = args[ 0 ] - ports = self.N.Ports() + ports = self.AllPorts() listofports = "" + ilst = 0 if len( ports ) : portsname = ports[ 0 ].Name() bs = portsname.find('\\') @@ -324,9 +347,9 @@ class CNode: portsname1,portsname2 = portsname.split('\\') portsname = portsname1 + portsname2 if ports[ 0 ].IsInput(): - listofports = aName + 'In' + portsname + listofports = 'I' + aName + portsname else : - listofports = aName + 'Out' + portsname + listofports = 'O' + aName + portsname i = 1 while i < len( ports ) : portsname = ports[ i ].Name() @@ -335,24 +358,32 @@ class CNode: portsname1,portsname2 = portsname.split('\\') portsname = portsname1 + portsname2 if ports[ i ].IsInput(): - listofports = listofports + ',' + aName + 'In' + portsname + listofports = listofports + ',' + 'I' + aName + portsname else : - listofports = listofports + ',' + aName + 'Out' + portsname + listofports = listofports + ',' + 'O' + aName + portsname i = i + 1 print listofports if len( ports ) == 1 : - listofports = "[" + listofports + "] = " + aName + ".Ports()" + listofports = "[" + listofports + "] = " + aName + ".AllPorts()" else : - listofports = listofports + " = " + aName + ".Ports()" + listofports = listofports + " = " + aName + ".AllPorts()" return listofports def PrintPorts( self ): - ports = self.N.Ports() + ports = self.AllPorts() i = 0 while i < len( ports ) : Direction = "Out" if ports[ i ].IsInput() : Direction = "In" - print Direction,self.N.Name(),'(',ports[ i ].Name(),ports[ i ].Kind(),ports[ i ].Type(),') = ',ports[ i ].ToString() + if ( ports[ i ].IsDataStream() ) & ( self.N.IsStreamGraph() == 0 ) : + if ports[ i ].IsInput() : + sts,aKindOfSchema,aKindOfInterpolation,aKindOfExtrapolation = ports[ i ].Params() + print Direction,self.N.Name(),'(',ports[ i ].Name(),ports[ i ].Kind(),ports[ i ].Type(),') = ',ports[ i ].ToString(),ports[ i ].Dependency(),aKindOfSchema,aKindOfInterpolation,aKindOfExtrapolation + else : + numberofvalues = ports[ i ].NumberOfValues() + print Direction,self.N.Name(),'(',ports[ i ].Name(),ports[ i ].Kind(),ports[ i ].Type(),') = ',ports[ i ].ToString(),ports[ i ].Dependency(),'NumberOfValues',numberofvalues + else : + print Direction,self.N.Name(),'(',ports[ i ].Name(),ports[ i ].Kind(),ports[ i ].Type(),') = ',ports[ i ].ToString() i = i + 1 def Links( self ) : links = self.N.Links() @@ -361,12 +392,58 @@ class CNode: links[ i ] = Link( links[i] , self.N.Verbose ) i = i + 1 return links + def StreamLinks( self ) : + links = self.N.StreamLinks() + i = 0 + while i < len( links ) : + links[ i ] = StreamLink( links[i] , self.N.Verbose ) + i = i + 1 + return links + def AllLinks( self ) : + alllinks = self.N.Links() + lenlinks = len( alllinks ) + i = 0 + while i < lenlinks : + alllinks[ i ] = Link( alllinks[i] , self.N.Verbose ) + i = i + 1 + links = self.N.StreamLinks() + i = 0 + while i < len( links ) : + alllinks.append( StreamLink( links[i] , self.N.Verbose ) ) + i = i + 1 + return alllinks + def ListLinks( self , *args ): + links = self.AllLinks() + if len( links ) : + listoflinks = 'L' + links[ 0 ].OutPort().Node().Name() + listoflinks = listoflinks + links[ 0 ].OutPort().Name() + listoflinks = listoflinks + links[ 0 ].InPort().Node().Name() + listoflinks = listoflinks + links[ 0 ].InPort().Name() + i = 1 + while i < len( links ) : + listoflinks = listoflinks + ',' + 'L' + links[ i ].OutPort().Node().Name() + listoflinks = listoflinks + links[ i ].OutPort().Name() + listoflinks = listoflinks + links[ i ].InPort().Node().Name() + listoflinks = listoflinks + links[ i ].InPort().Name() + i = i + 1 + print listoflinks + if len( args ) == 0 : + aName = self.N.Name() + else : + aName = args[ 0 ] + if len( links ) == 1 : + listoflinks = "[" + listoflinks + "] = " + aName + ".AllLinks()" + else : + listoflinks = listoflinks + " = " + aName + ".AllLinks()" + return listoflinks def PrintLinks( self ): - links = self.Links() + links = self.AllLinks() i = 0 while i < len( links ) : links[i].Print() i = i + 1 + def IsStreamGraph( self ): + return self.N.IsStreamGraph() def IsGraph( self ): return self.N.IsGraph() def IsComputing( self ): @@ -511,6 +588,24 @@ class INode(CNode): return self.N.PyFunction() def PyFuncName( self ): return self.N.PyFuncName() + def InPort( self , aParameterName , aParameterType ): + aPort = self.N.InPort( aParameterName , + aParameterType ) + if aPort != None : + myPort = Port( aPort , self.N.Verbose ) + return myPort + if self.N.Verbose : + print "Error while creating the Port : ",aParameterName + return None + def OutPort( self , aParameterName , aParameterType ): + aPort = self.N.OutPort( aParameterName , + aParameterType ) + if aPort != None : + myPort = Port( aPort , self.N.Verbose ) + return myPort + if self.N.Verbose : + print "Error while creating the Port : ",aParameterName + return None def EPyFunc( self ): PyFunc = self.N.PyFunction() PyFunc = self.Edit( self.N.PyFuncName() , PyFunc ) @@ -620,6 +715,12 @@ class Graph(INode): except: graph = None if graph != None : + if graph.IsStreamGraph() : + aGraph = graph.ToStreamGraph() + if aGraph != None : + graph = StreamGraph( aGraph ) + else : + print "Graph creation failed" self.G = graph self.G.Verbose = 1 self.N = graph @@ -698,78 +799,6 @@ class Graph(INode): if self.G.Verbose : print ErrMsg return aNode -# def LoopNode( self , aComponent , anInterface , aService , aNodeName ): -# NodeComponent = modulecatalog.GetComponent( aComponent ) -# aService = NodeComponent.GetService( anInterface , aService ) -# aNode,anEndNode = self.G.LoopNode( aComponent , anInterface , aService , aNodeName ) -# myNode = aNode -# myEndNode = anEndNode -# if aNode != None : -# myNode = Node( aNode , self.G.Verbose ) -# if anEndNode != None : -# myEndNode = Node( anEndNode , self.G.Verbose ) -# if ( aNode != None ) & ( anEndNode != None ) : -# return myNode,myEndNode -# ErrMsg = "Failed to create a Node with Service " + aService.ServiceName -# if self.G.Verbose : -# print ErrMsg -# return aNode,anEndNode -# def SwitchNode( self , aComponent , anInterface , aService , aNodeName ): -# NodeComponent = modulecatalog.GetComponent( aComponent ) -# aService = NodeComponent.GetService( anInterface , aService ) -# aNode,anEndNode = self.G.SwitchNode( aComponent , anInterface , aService , aNodeName ) -# myNode = aNode -# myEndNode = anEndNode -# if aNode != None : -# myNode = Node( aNode , self.G.Verbose ) -# if anEndNode != None : -# myEndNode = Node( anEndNode , self.G.Verbose ) -# if ( aNode != None ) & ( anEndNode != None ) : -# return myNode,myEndNode -# ErrMsg = "Failed to create a Node with Service " + aService.ServiceName -# if self.G.Verbose : -# print ErrMsg -# return aNode,anEndNode -# def LNode( self , aNodeName ): -# aNode = self.G.LNode( aNodeName ) -# if aNode != None : -# myNode = Node( aNode , self.G.Verbose ) -# return myNode -# ErrMsg = "Failed to create a Node with Service " + aService.ServiceName -# if self.G.Verbose : -# print ErrMsg -# return aNode -# def LService( self , aComponent , anInterface , aService ): -# NodeComponent = modulecatalog.GetComponent( aComponent ) -# aService = NodeComponent.GetService( anInterface , aService ) -# aNode = self.G.LService( aComponent , anInterface , aService ) -# if aNode != None : -# myNode = Node( aNode , self.G.Verbose ) -# return myNode -# ErrMsg = "Failed to create a Node with Service " + aService.ServiceName -# if self.G.Verbose : -# print ErrMsg -# return aNode -# def CNode( self , aNodeName ): -# aNode = self.G.CNode( aNodeName ) -# if aNode != None : -# myNode = Node( aNode , self.G.Verbose ) -# return myNode -# ErrMsg = "Failed to create a Node with Service " + aService.ServiceName -# if self.G.Verbose : -# print ErrMsg -# return aNode -# def CService( self , aComponent , anInterface , aService ): -# NodeComponent = modulecatalog.GetComponent( aComponent ) -# aService = NodeComponent.GetService( anInterface , aService ) -# aNode = self.G.CService( aComponent , anInterface , aService ) -# if aNode != None : -# myNode = Node( aNode , self.G.Verbose ) -# return myNode -# ErrMsg = "Failed to create a Node with Service " + aService.ServiceName -# if self.G.Verbose : -# print ErrMsg -# return aNode def PrintService( self , aComponent , anInterface , aService ): NodeComponent = modulecatalog.GetComponent( aComponent ) aService = NodeComponent.GetService( anInterface , aService ) @@ -961,18 +990,45 @@ class Graph(INode): def GLinks( self ): links = self.G.GLinks() i = 0 - while i < len( links ) : + linkslen = len( links ) + #print 'GLinks ',linkslen,'Links' + while i < linkslen : links[ i ] = Link( links[i] , self.G.Verbose ) i = i + 1 - return links + def GStreamLinks( self ): + streamlinks = self.G.GStreamLinks() + i = 0 + #print 'GStreamLinks ',len( streamlinks ),'StreamLinks' + while i < len( streamlinks ) : + streamlinks[ i ] = StreamLink( streamlinks[i] , self.G.Verbose ) + i = i + 1 + return streamlinks + def GAllLinks( self ) : + alllinks = self.G.GLinks() + lenlinks = len( alllinks ) + i = 0 + while i < lenlinks : + alllinks[ i ] = Link( alllinks[i] , self.N.Verbose ) + i = i + 1 + links = self.G.StreamLinks() + j = 0 + while j < len(links) : + alllinks.append( StreamLink( links[j] , self.N.Verbose ) ) + i = i + 1 + j = j + 1 + return alllinks def ListLinks( self , *args ): - links = self.G.GLinks() + links = self.GAllLinks() if len( links ) : - listoflinks = links[ 0 ].InPort().Node().Name() + listoflinks = 'L' + links[ 0 ].OutPort().Node().Name() + listoflinks = listoflinks + links[ 0 ].OutPort().Name() + listoflinks = listoflinks + links[ 0 ].InPort().Node().Name() listoflinks = listoflinks + links[ 0 ].InPort().Name() i = 1 while i < len( links ) : - listoflinks = listoflinks + ',' + links[ i ].InPort().Node().Name() + listoflinks = listoflinks + ',' + 'L' + links[ i ].OutPort().Node().Name() + listoflinks = listoflinks + links[ i ].OutPort().Name() + listoflinks = listoflinks + links[ i ].InPort().Node().Name() listoflinks = listoflinks + links[ i ].InPort().Name() i = i + 1 print listoflinks @@ -981,15 +1037,15 @@ class Graph(INode): else : aName = args[ 0 ] if len( links ) == 1 : - listoflinks = "[" + listoflinks + "] = " + aName + ".GLinks()" + listoflinks = "[" + listoflinks + "] = " + aName + ".GAllLinks()" else : - listoflinks = listoflinks + " = " + aName + ".GLinks()" + listoflinks = listoflinks + " = " + aName + ".GAllLinks()" return listoflinks def PrintLinks( self ): - links = self.G.GLinks() + links = self.GAllLinks() i = 0 while i < len( links ) : - Link( links[ i ] , self.G.Verbose ).Print() + links[ i ].Print() i = i + 1 def Graphs( self ): graphs = self.G.Graphs() @@ -1009,6 +1065,11 @@ class Graph(INode): if self.G.Verbose : print ErrMsg return aCopy + def ToStreamGraph( self ): + aGraph = self.G.ToStreamGraph() + if aGraph != None : + return StreamGraph( aGraph ) + return None def Merge( self , aGraph ): return self.G.Merge( aGraph.G ) def Destroy( self ): @@ -1023,6 +1084,65 @@ class GraphE(Graph): self.G.Verbose = 1 self.N = graph self.N.Verbose = 1 + def ToStreamGraph( self ): + aGraph = self.G.ToStreamGraph() + if aGraph != None : + return StreamGraphE( aGraph ) + return None + +########################################################## +class StreamGraph(Graph): +########################################################## + def __init__( self , aName ): + try: + graph = SuperVision.StreamGraph( aName ) + except: + try: + graph = aName.G.StreamCopy() + except: + graph = aName + if graph != None : + self.G = graph + self.G.Verbose = 1 + self.N = graph + self.N.Verbose = 1 + else : + print "StreamGraph creation failed" + def StreamCopy( self ): + aCopy = self.G.StreamCopy() + if aCopy != None: + myCopy = StreamGraph( aCopy ) + return myCopy + ErrMsg = "Failed to get a Copy of " + self.G.Name() + if self.G.Verbose : + print ErrMsg + return aCopy + def StreamLink( self , anOutStreamPort , anInStreamPort ) : + aStreamLink = self.G.StreamLink( anOutStreamPort.P , anInStreamPort.P ) + if aStreamLink!= None: + myStreamLink = StreamLink( aStreamLink , self.G.Verbose ) + return myStreamLink + ErrMsg = "Failed to make a StreamLink in " + self.G.Name() + if self.G.Verbose : + print ErrMsg + return aStreamLink + def SetStreamParams( self , Timeout , DataStreamTrace , DeltaTime ): + return self.G.SetStreamParams( Timeout , DataStreamTrace , DeltaTime ) + def StreamParams( self ): + Timeout,DataStreamTrace,DeltaTime = self.G.StreamParams() + return Timeout,DataStreamTrace,DeltaTime + def ToFlowGraph( self ): + return self.G.ToFlowGraph() + +########################################################## +class StreamGraphE(StreamGraph): +########################################################## + def __init__( self , aName ): + graph = SuperVision.StreamGraphE( aName ) + self.G = graph + self.G.Verbose = 1 + self.N = graph + self.N.Verbose = 1 ########################################################## class Value: @@ -1140,6 +1260,28 @@ class Port: def Destroy( self ): self.P.destroy() +########################################################## +class StreamPort(Port): +########################################################## + def __init__( self , aPort , Verbose ): + self.P = aPort + self.P.Verbose = Verbose + def StreamLink( self ) : + return self.P.StreamLink() + def Dependency( self ) : + return self.P.Dependency() + def SetDependency( self , aDependency ) : + return self.P.SetDependency( aDependency ) + def Params( self ) : + sts,aKindOfSchema,aKindOfInterpolation,aKindOfExtrapolation = self.P.Params() + return sts,aKindOfSchema,aKindOfInterpolation,aKindOfExtrapolation + def SetParams( self , aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) : + return self.P.SetParams( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) + def NumberOfValues( self ) : + return self.P.NumberOfValues() + def SetNumberOfValues( self , aNumberOfValues ) : + return self.P.SetNumberOfValues( aNumberOfValues ) + ########################################################## class Link: ########################################################## @@ -1164,8 +1306,17 @@ class Link: return None def Print( self ): anOutPort = self.L.OutPort() + anOutPortName = anOutPort.Name() + anOutPortKind = anOutPort.Kind() + anOutPortValue = anOutPort.ToString() + anOutNode = anOutPort.Node() + anOutNodeName = anOutNode.Name() anInPort = self.L.InPort() - print anOutPort.Node().Name(),'(',anOutPort.Name(),' ',anOutPort.Kind(),') =',anOutPort.ToString(),' --> ',anInPort.Node().Name(),'(',anInPort.Name(),')',' ',anInPort.Kind() + anInPortName = anInPort.Name() + anInPortKind = anInPort.Kind() + anInNode = anInPort.Node() + anInNodeName = anInNode.Name() + print anOutNodeName,'(',anOutPortName,' ',anOutPortKind,') =',anOutPortValue,' --> ',anInNodeName,'(',anInPortName,')',' ',anInPortKind def CoordsSize( self ): return self.L.CoordsSize() def AddCoord( self , index , X , Y ): @@ -1180,3 +1331,26 @@ class Link: self.L.destroy() + +########################################################## +class StreamLink(Link): +########################################################## + def __init__( self , aLink , Verbose ): + self.L = aLink + self.L.Verbose = Verbose + def OutStreamPort( self ): + aPort = self.L.OutStreamPort() + if aPort != None : + myPort = StreamPort( aPort , self.L.Verbose ) + return myPort + if self.L.Verbose : + print "Error while getting the Port : " + return None + def InStreamPort( self ): + aPort = self.L.InStreamPort() + if aPort != None : + myPort = StreamPort( aPort , self.L.Verbose ) + return myPort + if self.L.Verbose : + print "Error while getting the Port : " + return None diff --git a/src/Supervision/SuperV_Impl.cxx b/src/Supervision/SuperV_Impl.cxx index 2c42ac0..a1ca9f2 100644 --- a/src/Supervision/SuperV_Impl.cxx +++ b/src/Supervision/SuperV_Impl.cxx @@ -612,9 +612,10 @@ SUPERV::Value_ptr SuperV_Impl::Value( CORBA::Any * anAny ) { SUPERV::Graph_ptr SuperV_Impl::Graph(const char * aGraphName ) { beginService( "SuperV_Impl::Graph" ); bool created = true ; + SUPERV::Graph_var iobject = SUPERV::Graph::_nil() ; Graph_Impl * myGraph ; - myGraph = new Graph_Impl( _Orb , _Poa, _ContId, - instanceName() , interfaceName() , aGraphName ) ; + myGraph = new Graph_Impl( _Orb , _Poa, _ContId, instanceName() , interfaceName() , + aGraphName , SUPERV::DataFlowGraph ) ; int lenname = strlen( aGraphName ) ; if ( lenname > 4 && !strcmp( &aGraphName[ lenname - 4 ] , ".xml" ) ) { created = myGraph->Import( aGraphName ) ; @@ -622,8 +623,16 @@ SUPERV::Graph_ptr SuperV_Impl::Graph(const char * aGraphName ) { else { myGraph->Import( (char * ) NULL ) ; } - SUPERV::Graph_var iobject = SUPERV::Graph::_nil() ; - if ( created ) { + if ( !created && myGraph->IsStreamGraph() ) { + MESSAGE( "SuperV_Impl::Graph " << aGraphName << " IsStreamGraph !" ) ; + myGraph->destroy() ; + SUPERV::StreamGraph_var streamiobject = StreamGraph( aGraphName ) ; + iobject = SUPERV::Graph::_narrow( streamiobject ) ; + if ( CORBA::is_nil( iobject ) ) { + created = false ; + } + } + else if ( created ) { PortableServer::ObjectId * id = myGraph->getId() ; CORBA::Object_var obj = _poa->id_to_reference(*id); iobject = SUPERV::Graph::_narrow(obj) ; @@ -636,9 +645,10 @@ SUPERV::Graph_ptr SuperV_Impl::Graph(const char * aGraphName ) { SUPERV::Graph_ptr SuperV_Impl::GraphE(const char * aGraphName ) { beginService( "SuperV_Impl::GraphE" ); bool created = true ; + SUPERV::Graph_var iobject = SUPERV::Graph::_nil() ; Graph_Impl * myGraph ; - myGraph = new Graph_Impl( _Orb , _Poa, _ContId, - instanceName() , interfaceName() , aGraphName ) ; + myGraph = new Graph_Impl( _Orb , _Poa, _ContId, instanceName() , interfaceName() , + aGraphName , SUPERV::DataFlowGraph ) ; int lenname = strlen( aGraphName ) ; if ( lenname > 4 && !strcmp( &aGraphName[ lenname - 4 ] , ".xml" ) ) { created = myGraph->Import( aGraphName ) ; @@ -646,8 +656,15 @@ SUPERV::Graph_ptr SuperV_Impl::GraphE(const char * aGraphName ) { else { myGraph->Import( (char * ) NULL ) ; } - SUPERV::Graph_var iobject = SUPERV::Graph::_nil() ; - if ( created ) { + if ( !created && myGraph->IsStreamGraph() ) { + myGraph->destroy() ; + SUPERV::StreamGraph_var streamiobject = StreamGraphE( aGraphName ) ; + iobject = SUPERV::Graph::_narrow( streamiobject ) ; + if ( CORBA::is_nil( iobject ) ) { + created = false ; + } + } + else if ( created ) { PortableServer::ObjectId * id = myGraph->getId() ; CORBA::Object_var obj = _poa->id_to_reference(*id); iobject = SUPERV::Graph::_narrow(obj) ; @@ -658,6 +675,55 @@ SUPERV::Graph_ptr SuperV_Impl::GraphE(const char * aGraphName ) { return SUPERV::Graph::_duplicate(iobject) ; } +SUPERV::StreamGraph_ptr SuperV_Impl::StreamGraph(const char * aGraphName ) { + beginService( "SuperV_Impl::StreamGraph" ); + bool created = true ; + StreamGraph_Impl * myStreamGraph ; + myStreamGraph = new StreamGraph_Impl( _Orb , _Poa, _ContId, instanceName() , + interfaceName() , aGraphName ) ; + int lenname = strlen( aGraphName ) ; + if ( lenname > 4 && !strcmp( &aGraphName[ lenname - 4 ] , ".xml" ) ) { + created = myStreamGraph->Import( aGraphName ) ; + } + else { + myStreamGraph->Import( (char * ) NULL ) ; + } + SUPERV::StreamGraph_var iobject = SUPERV::StreamGraph::_nil() ; + if ( created ) { + PortableServer::ObjectId * id = myStreamGraph->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + iobject = SUPERV::StreamGraph::_narrow(obj) ; + myStreamGraph->SetObjRef( SUPERV::StreamGraph::_duplicate( iobject ) ) ; + } + endService( "SuperV_Impl::StreamGraph" ); + return SUPERV::StreamGraph::_duplicate(iobject) ; +} + +SUPERV::StreamGraph_ptr SuperV_Impl::StreamGraphE(const char * aGraphName ) { + beginService( "SuperV_Impl::StreamGraphE" ); + bool created = true ; + StreamGraph_Impl * myStreamGraph ; + myStreamGraph = new StreamGraph_Impl( _Orb , _Poa, _ContId, instanceName() , + interfaceName() , aGraphName ) ; + int lenname = strlen( aGraphName ) ; + if ( lenname > 4 && !strcmp( &aGraphName[ lenname - 4 ] , ".xml" ) ) { + created = myStreamGraph->Import( aGraphName ) ; + } + else { + myStreamGraph->Import( (char * ) NULL ) ; + } + SUPERV::StreamGraph_var iobject = SUPERV::StreamGraph::_nil() ; + if ( created ) { + PortableServer::ObjectId * id = myStreamGraph->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + iobject = SUPERV::StreamGraph::_narrow(obj) ; + myStreamGraph->SetObjRef( SUPERV::StreamGraph::_duplicate( iobject ) ) ; + } + myStreamGraph->ReadOnly() ; + endService( "SuperV_Impl::StreamGraphE" ); + return SUPERV::StreamGraph::_duplicate(iobject) ; +} + SUPERV::Graph_ptr SuperV_Impl::getGraph(const char* ior) { SUPERV::Graph_var iobject = SUPERV::Graph::_nil(); try { @@ -670,6 +736,18 @@ SUPERV::Graph_ptr SuperV_Impl::getGraph(const char* ior) { return(SUPERV::Graph::_duplicate(iobject)); } +SUPERV::StreamGraph_ptr SuperV_Impl::getStreamGraph(const char* ior) { + SUPERV::StreamGraph_var iobject = SUPERV::StreamGraph::_nil(); + try { + CORBA::Object_ptr obj = _Orb->string_to_object(ior); + iobject = SUPERV::StreamGraph::_narrow(obj); + } catch ( ... ) { + return SUPERV::StreamGraph::_nil(); + // SUPERV::Graph_var iobject = (SUPERV::Graph_var)NULL; + }; + return(SUPERV::StreamGraph::_duplicate(iobject)); +} + PortableServer::ObjectId * SUPERVEngine_factory ( CORBA::ORB_ptr orb , PortableServer::POA_ptr poa , diff --git a/src/Supervision/SuperV_Impl.hxx b/src/Supervision/SuperV_Impl.hxx index bce58f1..6cfb02f 100644 --- a/src/Supervision/SuperV_Impl.hxx +++ b/src/Supervision/SuperV_Impl.hxx @@ -38,7 +38,7 @@ #include "SALOME_Component_i.hxx" #include "SALOME_LifeCycleCORBA.hxx" -#include "Graph_Impl.hxx" +#include "StreamGraph_Impl.hxx" #include "DataFlowEditor_DataFlow.hxx" @@ -119,6 +119,11 @@ class SuperV_Impl : public POA_SUPERV::SuperG , virtual SUPERV::Graph_ptr GraphE( const char * aDataFlowName ) ; + virtual SUPERV::StreamGraph_ptr StreamGraph( const char * aDataFlowName ) ; + + virtual SUPERV::StreamGraph_ptr StreamGraphE( const char * aDataFlowName ) ; + + virtual SUPERV::StreamGraph_ptr getStreamGraph(const char* ior); virtual SUPERV::Graph_ptr getGraph(const char* ior); }; diff --git a/src/Supervision/Value_Impl.cxx b/src/Supervision/Value_Impl.cxx index a7a150b..95a89a1 100644 --- a/src/Supervision/Value_Impl.cxx +++ b/src/Supervision/Value_Impl.cxx @@ -143,7 +143,7 @@ CORBA::Any * Value_Impl::ToAny() { name = _DataFlowNode->Name() ; } else { - name = _DataFlowEditor->Name() ; + name = _DataFlowEditor->Graph()->Name() ; } if ( _InputPort ) { if ( _DataFlowNode ) { @@ -201,7 +201,7 @@ char * Value_Impl::ToString() { name = _DataFlowNode->Name() ; } else { - name = _DataFlowEditor->Name() ; + name = _DataFlowEditor->Graph()->Name() ; } if ( _InputPort ) { if ( _DataFlowNode ) { @@ -295,7 +295,7 @@ bool Value_Impl::IsIOR() { name = _DataFlowNode->Name() ; } else { - name = _DataFlowEditor->Name() ; + name = _DataFlowEditor->Graph()->Name() ; } if ( _InputPort ) { if ( _DataFlowNode ) { @@ -335,7 +335,7 @@ bool Value_Impl::IsIOR() { char* Value_Impl::ComponentDataType() { GraphExecutor::DataFlow* _DataFlowExecutor = _DataFlowEditor->Executor(); - const GraphBase::ComputingNode* node = _DataFlowExecutor->GetGraphNode(_DataFlowNode->Name()); + const GraphBase::ComputingNode* node = _DataFlowExecutor->Graph()->GetGraphNode(_DataFlowNode->Name()); if ( node->IsFactoryNode() ) { Engines::Component_var compo = ((GraphBase::FactoryNode * ) node )->Component(); if ( CORBA::is_nil( compo ) ) { diff --git a/src/SyrComponent/SyrComponent_Impl.cxx b/src/SyrComponent/SyrComponent_Impl.cxx index 3c93ed7..c80e1b2 100755 --- a/src/SyrComponent/SyrComponent_Impl.cxx +++ b/src/SyrComponent/SyrComponent_Impl.cxx @@ -64,7 +64,7 @@ long SyrComponent_Impl::C_ISEVEN( const long anInteger ) { beginService( " SyrComponent_Impl::C_ISEVEN" ); sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_ISEVEN is Computing"); int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); RetVal = ( anInteger & 1 ) == 0 ; endService( " SyrComponent_Impl::C_ISEVEN" ); return RetVal ; @@ -75,7 +75,7 @@ long SyrComponent_Impl::C_ISONE( const long anOddInteger ) { beginService( " SyrComponent_Impl::C_ISONE" ); sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_ISONE is Computing"); int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); RetVal = ( anOddInteger == 1 ) ; endService( " SyrComponent_Impl::C_ISONE" ); return RetVal ; @@ -85,7 +85,7 @@ long SyrComponent_Impl::C_M3( const long anOddInteger ) { beginService( " SyrComponent_Impl::C_M3" ); sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_M3 is Computing"); int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); endService( " SyrComponent_Impl::C_M3" ); if ( C_ISEVEN( anOddInteger ) ) return 0 ; @@ -96,7 +96,7 @@ long SyrComponent_Impl::C_M3P1( const long anOddInteger ) { beginService( " SyrComponent_Impl::C_M3P1" ); sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_M3P1 is Computing"); int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); endService( " SyrComponent_Impl::C_M3P1" ); if ( C_ISEVEN( anOddInteger ) ) return 0 ; @@ -107,7 +107,7 @@ long SyrComponent_Impl::C_DIV2( const long anEvenInteger ) { beginService( " SyrComponent_Impl::C_DIV2" ); sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_DIV2 is Computing"); int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); endService( " SyrComponent_Impl::C_DIV2" ); if ( !C_ISEVEN( anEvenInteger ) ) return 0 ; @@ -118,7 +118,7 @@ long SyrComponent_Impl::C_INCR( const long aCount ) { beginService( " SyrComponent_Impl::C_INCR" ); sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_INCR is Computing"); int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); endService( " SyrComponent_Impl::C_INCR" ); return ( aCount + 1 ) ; } @@ -127,7 +127,7 @@ long SyrComponent_Impl::C_MIN( const long aMinVal , const long anInteger ) { beginService( " SyrComponent_Impl::C_MIN" ); sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_MIN is Computing"); int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); int min = aMinVal ; if ( anInteger < min || aMinVal == 0 ) { min = anInteger ; @@ -145,7 +145,7 @@ long SyrComponent_Impl::C_MAX( const long aMaxVal , const long anInteger ) { beginService( " SyrComponent_Impl::C_MAX" ); sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_MAX is Computing"); int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); int max = aMaxVal ; if ( anInteger > max ) { max = anInteger ; @@ -163,7 +163,7 @@ SuperVisionTest::ListOfSyr_ptr SyrComponent_Impl::C_LISTOFSYR() { beginService( " SyrComponent_Impl::C_LISTOFSYR" ); sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_LISTOFSYR is Computing"); int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); ListOfSyr_Impl * aNewListOfSyr = new ListOfSyr_Impl( _orb , _poa, _contId, instanceName() , interfaceName() , graphName() , nodeName() ) ; @@ -184,7 +184,7 @@ SuperVisionTest::ListOfSyr_ptr SyrComponent_Impl::C_AVERAGE( beginService( " SyrComponent_Impl::C_AVERAGE" ); sendMessage(NOTIF_STEP, "SyrComponent_Impl::C_AVERAGE is Computing"); int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); SuperVisionTest::SeqOfSyr * aSeqOfSyr = aListOfSyr->GetSeqOfSyr() ; int len = aSeqOfSyr->length() ; aSeqOfSyr->length( len + 1 ) ; @@ -208,7 +208,7 @@ SuperVisionTest::Syr_ptr SyrComponent_Impl::Init( const long anOddInteger ) { beginService( "SyrComponent_Impl::Init" ); sendMessage(NOTIF_STEP, "SyrComponent_Impl creates Syr_Impl"); int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); Syr_Impl * mySyr ; mySyr = new Syr_Impl( _orb , _poa, _contId, instanceName() , interfaceName() , @@ -310,7 +310,7 @@ long Syr_Impl::Initial() { beginService( " Syr_Impl::Initial" ); sendMessage(NOTIF_STEP, "Syr_Impl::Initial is Computing"); int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); endService( " Syr_Impl::Initial" ); return _InitialInteger ; } @@ -319,7 +319,7 @@ long Syr_Impl::Current() { beginService( " Syr_Impl::Current" ); sendMessage(NOTIF_STEP, "Syr_Impl::Current is Computing"); int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); endService( " Syr_Impl::Current" ); return _CurrentInteger ; } @@ -329,7 +329,7 @@ long Syr_Impl::IsEven() { beginService( " Syr_Impl::IsEven" ); sendMessage(NOTIF_STEP, "Syr_Impl::IsEven is Computing"); int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); RetVal = ( _CurrentInteger & 1 ) == 0 ; MESSAGE( " Syr_Impl::IsEven " << _CurrentInteger << " " << RetVal ); endService( " Syr_Impl::IsEven" ); @@ -341,7 +341,7 @@ long Syr_Impl::IsOne() { beginService( " Syr_Impl::IsOne" ); sendMessage(NOTIF_STEP, "Syr_Impl::IsOne is Computing"); int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); RetVal = ( _CurrentInteger == 1 ) ; MESSAGE( " Syr_Impl::IsOne " << _CurrentInteger << " " << RetVal ); endService( " Syr_Impl::IsOne" ); @@ -352,7 +352,7 @@ long Syr_Impl::Count() { beginService( " Syr_Impl::Count" ); sendMessage(NOTIF_STEP, "Syr_Impl::Count is Computing"); int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); MESSAGE( " Syr_Impl::Count " << _Count ); endService( " Syr_Impl::Count" ); return _Count ; @@ -362,7 +362,7 @@ void Syr_Impl::M3p1() { beginService( " Syr_Impl::M3p1" ); sendMessage(NOTIF_STEP, "Syr_Impl::M3p1 is Computing"); int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); if ( IsEven() ) _CurrentInteger = 0 ; else @@ -375,7 +375,7 @@ void Syr_Impl::Div2() { beginService( " Syr_Impl::Div2" ); sendMessage(NOTIF_STEP, "Syr_Impl::Div2 is Computing"); int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); if ( !IsEven() ) _CurrentInteger = 0 ; else @@ -388,7 +388,7 @@ void Syr_Impl::Incr() { beginService( " Syr_Impl::Incr" ); sendMessage(NOTIF_STEP, "Syr_Impl::Incr is Computing"); int S = 1+(int) (2.0*rand()/(RAND_MAX+1.0)); - sleep(S); + sleep(1); _Count = _Count + 1 ; MESSAGE( " Syr_Impl::Incr " << _Count ); endService( " Syr_Impl::Incr" ); -- 2.39.2