srcdir=@srcdir@
VPATH=.:@srcdir@
-SUBDIRS=html
+SUBDIRS= salome
-doc:
+@COMMENCE@
+
+docs:
@@SETX@; for d in $(SUBDIRS); do \
(cd $$d && $(MAKE) $@) || exit 1; \
done
@@SETX@; for d in $(SUBDIRS); do \
(cd $$d && $(MAKE) $@) || exit 1; \
done
+
+uninstall:
+ @@SETX@; for d in $(SUBDIRS); do \
+ (cd $$d && $(MAKE) $@) || exit 1; \
+ done
#---------------------------------------------------------------------------
# General configuration options
#---------------------------------------------------------------------------
-PROJECT_NAME = "SALOME - SUPERV - v.1.4.0"
+PROJECT_NAME = "SALOME - SUPERV - v.2.0.0"
PROJECT_NUMBER = id#1.0
OUTPUT_DIRECTORY = ../
OUTPUT_LANGUAGE = English
-foldersTree = gFld("<b>SALOME v.1.4.0 </b>", "", "")
+foldersTree = gFld("<b>SALOME v.2.0.0 </b>", "", "")
insDoc(foldersTree, gLnk("Main Page", "", "main.html"))
aux1 = insFld(foldersTree, gFld("TUI Reference Guide", ""))
--- /dev/null
+
+# -* Makefile *-
+#
+# Author : Patrick GOLDBRONN (CEA)
+# Date : 30/11/2001
+# $Header$
+#
+# source path
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@
+
+SUBDIRS= tui gui
+
+@COMMENCE@
+
+docs:
+ @@SETX@; for d in $(SUBDIRS); do \
+ (cd $$d && $(MAKE) $@) || exit 1; \
+ done; \
+ cp -f $(srcdir)/SUPERV_index.html SUPERV_index.html
+
+clean:
+ @@SETX@; for d in $(SUBDIRS); do \
+ (cd $$d && $(MAKE) $@) || exit 1; \
+ done
+
+distclean: clean
+ @@SETX@; for d in $(SUBDIRS); do \
+ (cd $$d && $(MAKE) $@) || exit 1; \
+ done
+
+install:
+ $(MAKE) docs
+ (cd tui && $(MAKE) install);
+ (cd gui && $(MAKE) install);
+ cp -f SUPERV_index.html $(docdir)
+
+uninstall:
+ @@SETX@; for d in $(SUBDIRS); do \
+ (cd $$d && $(MAKE) $@) || exit 1; \
+ done; \
+ rm -fr $(docdir)/SUPERV_index.html
--- /dev/null
+<!DOCTYPE doctype PUBLIC "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+
+ <meta http-equiv="Content-Type"
+ content="text/html; charset=iso-8859-1">
+
+ <meta name="GENERATOR"
+ content="Mozilla/4.73 [en] (WinNT; I) [Netscape]">
+ <title>Supervision Module Documentation</title>
+</head>
+ <body bgcolor="#cccccc" text="#000000" link="#0000ee" alink="#0000ee"
+ vlink="#551a8b">
+
+<div align="center">
+<center>
+<center>
+ </center>
+
+<table width="96%" align="center">
+ <tbody>
+ <tr>
+ <td><a href="http://www.opencascade.com"><img
+ src="tui/SUPERV/sources/logocorp.gif" border="0" height="46" width="122">
+ </a></td>
+ <td>
+
+ <div align="right"><a href="http://www.opencascade.org/SALOME/"><img
+ src="tui/SUPERV/sources/application.gif" border="0" height="46" width="108">
+ </a></div>
+ </td>
+ </tr>
+
+ </tbody>
+</table>
+
+<div align="center">
+<center>
+<hr width="100%" size="2">
+<h1>Supervision MODULE Documentation</h1>
+ </center>
+ </div>
+
+<table width="96%">
+ <tbody>
+
+ </tbody>
+</table>
+ </center>
+
+<div align="center">
+<p> <img src="tui/SUPERV/sources/Application-About.png"
+ alt="Application-About.png" width="30%" height="20%">
+ </p>
+ </div>
+
+<center>
+<table width="96%">
+ <tbody>
+
+ </tbody>
+</table>
+ <br>
+ <br>
+ <br>
+ </center>
+
+<address> </address>
+
+<center><big><a href="gui/SUPERV/supervision.html">GUI Documentation</a></big></center>
+
+<address> </address>
+
+<center></center>
+
+<center><br>
+ </center>
+
+<address> </address>
+
+<center><big><a href="tui/SUPERV/index.html">TUI Documentation</a></big></center>
+
+<address> </address>
+
+<center></center>
+
+<center><br>
+ <br>
+ </center>
+ </div>
+ <br>
+ <br>
+ <br>
+</body>
+</html>
--- /dev/null
+# Copyright (C) 2003 CEA/DEN, EDF R&D
+#
+#
+#
+# File : Makefile.in
+# Author : Vasily Rusyaev (Open Cascade NN)
+# Module : doc
+# $Header:
+
+top_srcdir=@top_srcdir@
+top_builddir=../../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@
+
+@COMMENCE@
+
+docs:
+ cp -fr $(srcdir)/SUPERV ./
+ -find $(PWD) -name CVS -exec rm -rf {} \;
+
+clean:
+ rm -fr `ls | grep -v "Makefile"`
+
+distclean: clean
+ rm -fr SUPERV
+
+install:
+ mkdir -p $(docdir)/gui
+ cp -rf SUPERV $(docdir)/gui
+ -find $(PWD) -name CVS -exec rm -rf {} \;
+
+uninstall:
+ rm -rf $(docdir)/gui/SUPERV
--- /dev/null
+// SuperVisionTest AddComponent : example of component that adds two numbers
+//
+// 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 : AddComponent_Impl.cxx
+// Author : Jean Rahuel, CEA
+// Module : SuperVisionTest
+
+using namespace std;
+#include <stdio.h>
+#include <unistd.h>
+#include <fstream>
+#include <sstream>
+#include <string>
+
+//#include "utilities.h"
+
+#include "AddComponent_Impl.hxx"
+#include "Adder_Impl.hxx"
+
+AddComponent_Impl::AddComponent_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("AddComponent_Impl::AddComponent_Impl this " << hex << this << dec
+ << "activate object instanceName("
+ << instanceName << ") interfaceName(" << interfaceName << ")" )
+ _thisObj = this ;
+ _id = _poa->activate_object(_thisObj);
+ LastAddition = 0 ;
+}
+
+AddComponent_Impl::AddComponent_Impl() {
+ LastAddition = 0 ;
+}
+
+AddComponent_Impl::~AddComponent_Impl() {
+}
+
+SuperVisionTest::Adder_ptr AddComponent_Impl::Addition() {
+ beginService( "AddComponent_Impl::Addition" );
+ sendMessage(NOTIF_STEP, "AddComponent_Impl creates Adder_Impl");
+ Adder_Impl * myAdder ;
+ myAdder = new Adder_Impl( _orb , _poa, _contId,
+ instanceName() , interfaceName() ,
+ graphName() , nodeName() ) ;
+ SuperVisionTest::Adder_var iobject ;
+ PortableServer::ObjectId * id = myAdder->getId() ;
+ CORBA::Object_var obj = _poa->id_to_reference(*id);
+ iobject = SuperVisionTest::Adder::_narrow(obj) ;
+ endService( "AddComponent_Impl::Addition" );
+ return SuperVisionTest::Adder::_duplicate(iobject) ;
+}
+
+double AddComponent_Impl::Add( double x , double y , double & z ) {
+ beginService( " AddComponent_Impl::Add" );
+ z = x + y ;
+ int S;
+
+ sendMessage(NOTIF_STEP, "AddComponent_Impl::Add is Computing");
+ S = 1+(int) (15.0*rand()/(RAND_MAX+1.0));
+ sleep(S);
+ MESSAGE( "AddComponent_Impl::Add( " << x << " , " << y << " , " << z
+ << " ) returns " << (x - y) << " after " << S << " seconds" )
+ LastAddition = z ;
+ endService( " AddComponent_Impl::Add" );
+ return (x - y) ;
+}
+
+long AddComponent_Impl::Sigma( long n ) {
+ long sigma = 0 ;
+ int i , j ;
+ beginService( " AddComponent_Impl::Sigma" );
+ for ( j = 0 ; j < 1000000 ; j++ ) {
+ sigma = 0 ;
+ for ( i = 1 ; i <= n ; i++ ) {
+ sigma = sigma + i ;
+ }
+ }
+ endService( " AddComponent_Impl::Sigma" );
+ return sigma ;
+}
+
+double AddComponent_Impl::LastResult() {
+ beginService( " 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);
+ endService( " AddComponent_Impl::LastResult" );
+ return LastAddition ;
+}
+
+extern "C"
+{
+ PortableServer::ObjectId * AddComponentEngine_factory
+ (CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
+ const char *interfaceName)
+ {
+ MESSAGE("AddComponentEngine_factory AddComponentEngine ("
+ << instanceName << "," << interfaceName << "," << getpid() << ")");
+ AddComponent_Impl * myAddComponent
+ = new AddComponent_Impl(orb, poa, contId, instanceName, interfaceName);
+ return myAddComponent->getId() ;
+ }
+}
+
+Adder_Impl::Adder_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("Adder_Impl::Adder_Impl activate object instanceName("
+ << instanceName << ") interfaceName(" << interfaceName << ") --> "
+ << hex << (void *) this << dec )
+ beginService( "Adder_Impl::Adder_Impl" );
+ _thisObj = this ;
+ _id = _poa->activate_object(_thisObj);
+ LastAddition = 0 ;
+ sendMessage(NOTIF_STEP, "Adder_Impl is Created");
+ endService( "Adder_Impl::Adder_Impl" );
+}
+
+Adder_Impl::Adder_Impl() {
+ LastAddition = 0 ;
+}
+
+Adder_Impl::~Adder_Impl() {
+ beginService( "Adder_Impl::~Adder_Impl" );
+ endService( "Adder_Impl::~Adder_Impl" );
+}
+
+double Adder_Impl::Add( double x , double y , double & z ) {
+ beginService( " Adder_Impl::Add" );
+ z = x + y ;
+ int S;
+
+ sendMessage(NOTIF_STEP, "Adder_Impl::Add is Computing");
+ S = 1+(int) (15.0*rand()/(RAND_MAX+1.0));
+ sleep(S);
+ MESSAGE( "Adder_Impl::Add( " << x << " , " << y << " , " << z
+ << " ) returns " << -(x - y) << " after " << S << " seconds" )
+ LastAddition = z ;
+ endService( " Adder_Impl::Add" );
+ return -(x - y) ;
+}
+
+double Adder_Impl::AddAndCompare( const double x , const double y ,
+ const SuperVisionTest::Adder_ptr anOtherAdder ,
+ double & z ) {
+ beginService( " Adder_Impl::AddAndCompare" );
+ z = x + y ;
+ int S;
+
+ sendMessage(NOTIF_STEP, "Adder_Impl::AddAndCompare is Computing");
+ S = 1+(int) (15.0*rand()/(RAND_MAX+1.0));
+ sleep(S);
+ MESSAGE( "Adder_Impl::AddAndCompare( " << x << " , " << y << " , " << z
+ << " ) returns " << -(x - y) << " after " << S << " seconds" )
+ LastAddition = z ;
+ double ValFunc ;
+ sendMessage(NOTIF_TRACE, "Adder_Impl::AddAndCompare will call anOtherAdder->LastValue()");
+ double RetVal ;
+ anOtherAdder->LastResult( RetVal ) ;
+ if ( RetVal > 0 ) {
+ ValFunc = (x - y) ;
+ }
+ else {
+ ValFunc = -(x - y) ;
+ }
+ sendMessage(NOTIF_TRACE, "Adder_Impl::AddAndCompare has called anOtherAdder->LastValue()");
+ sendMessage(NOTIF_STEP, "Adder_Impl::AddAndCompare is Finished");
+ endService( " Adder_Impl::AddAndCompare" );
+ return ValFunc ;
+}
+
+void Adder_Impl::SetLastResult( double z ) {
+ beginService( " Adder_Impl::SetLastResult" );
+ sendMessage(NOTIF_STEP, "Adder_Impl::SetLastResult is Computing");
+ int S;
+ S = 1+(int) (15.0*rand()/(RAND_MAX+1.0));
+ sleep(S);
+ LastAddition = z ;
+ endService( " Adder_Impl::SetLastResult" );
+ return ;
+}
+
+void Adder_Impl::LastResult( double & z ) {
+ beginService( " Adder_Impl::LastResult" );
+ sendMessage(NOTIF_STEP, "Adder_Impl::LastResult is Computing");
+ int S;
+ S = 1+(int) (15.0*rand()/(RAND_MAX+1.0));
+ sleep(S);
+ z = LastAddition ;
+ endService( " Adder_Impl::LastResult" );
+ return ;
+}
+
+
using namespace std;
#include "DataFlowBase_Base.hxx"
-char *SuperVision_Version = "1.05" ;
+char *SuperVision_Version = "2.0" ;
char *NULLSTRING = "" ;
_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 ;
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 ;
+}
+
+string KindOfDataStreamTraceToString( SUPERV::KindOfDataStreamTrace aDataStreamTrace ) {
+ string aTrace ;
+ switch ( aDataStreamTrace ) {
+ case SUPERV::WithoutTrace :
+ aTrace = "SANS";
+ break;
+ case SUPERV::SummaryTrace :
+ aTrace = "SUCCINT";
+ break;
+ case SUPERV::DetailedTrace :
+ aTrace = "DETAILLE";
+ break;
+ default :
+ aTrace = "UndefinedTrace";
+ break;
+ }
+ return aTrace ;
+}
+
+string DataStreamDependencyToString( const SALOME_ModuleCatalog::DataStreamDependency aDataStreamDependency ) {
+ string aDependency ;
+ switch ( aDataStreamDependency ) {
+ case SALOME_ModuleCatalog::DATASTREAM_UNDEFINED :
+ aDependency = "U" ;
+ break;
+ case SALOME_ModuleCatalog::DATASTREAM_TEMPORAL :
+ aDependency = "T" ;
+ break;
+ case SALOME_ModuleCatalog::DATASTREAM_ITERATIVE :
+ aDependency = "I" ;
+ break;
+ default :
+ aDependency = "?" ;
+ break;
+ }
+
+ return aDependency;
+}
+
+string DataStreamToString( const SALOME_ModuleCatalog::DataStreamType aDataStreamType ) {
+ string aStreamType ;
+ switch ( aDataStreamType ) {
+ case SALOME_ModuleCatalog::DATASTREAM_UNKNOWN : {
+ aStreamType = "Unknown" ;
+ break;
+ }
+ case SALOME_ModuleCatalog::DATASTREAM_INTEGER : {
+ aStreamType = "ENTIER" ;
+ break;
+ }
+ case SALOME_ModuleCatalog::DATASTREAM_FLOAT : {
+ aStreamType = "REEL" ;
+ break;
+ }
+ case SALOME_ModuleCatalog::DATASTREAM_DOUBLE : {
+ aStreamType = "DOUBLE" ;
+ break;
+ }
+ case SALOME_ModuleCatalog::DATASTREAM_STRING : {
+ aStreamType = "CHAINE" ;
+ break;
+ }
+ case SALOME_ModuleCatalog::DATASTREAM_BOOLEAN : {
+ aStreamType = "LOGIQUE" ;
+ break;
+ }
+ default: {
+ aStreamType = "?" ;
+ break;
+ }
+ }
+ return aStreamType ;
+}
+
+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;
+}
+
return t;
}
+string DataStreamTypeToString( const SALOME_ModuleCatalog::DataStreamType aDataStreamType ) ;
+SALOME_ModuleCatalog::DataStreamType StringToDataStreamType( const char * aIdlType ) ;
+
+string KindOfDataStreamTraceToString( SUPERV::KindOfDataStreamTrace aDataStreamTrace ) ;
+
+string DataStreamDependencyToString( const SALOME_ModuleCatalog::DataStreamDependency aDataStreamDependency ) ;
+
+string DataStreamToString( const SALOME_ModuleCatalog::DataStreamType aDataStreamType ) ;
+
enum StatusOfPort { NotConnected , PortConnected , PortAndDataConnected ,
DataConnected } ;
typedef vector<const SUPERV::ListOfStrings *> ListOfPythonFunctions ;
- struct NodeParameter {
- SALOME_ModuleCatalog::ServicesParameter theInParameter ;
- SALOME_ModuleCatalog::ServicesParameter theOutParameter ;
- };
+ typedef vector<SALOME_ModuleCatalog::ServicesParameter> ListOfParameters;
+
+ struct InDataStreamParameter {
+ SALOME_ModuleCatalog::ServicesDataStreamParameter theDataStreamParameter ;
+ SUPERV::KindOfSchema theKindOfSchema ;
+ SUPERV::KindOfInterpolation theKindOfInterpolation ;
+ SUPERV::KindOfExtrapolation theKindOfExtrapolation ;
+ };
+ typedef vector<InDataStreamParameter> ListOfInDataStreamParameters;
- typedef vector<NodeParameter> ListOfParameters;
+ struct OutDataStreamParameter {
+ SALOME_ModuleCatalog::ServicesDataStreamParameter theDataStreamParameter ;
+ long theNumberOfValues ;
+ };
+ typedef vector<OutDataStreamParameter> 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 ;
SALOME_ModuleCatalog::Service theService ;
- ListOfParameters theListOfParameters ;
+ ListOfInDataStreamParameters theListOfInDataStreams ;
+ ListOfOutDataStreamParameters theListOfOutDataStreams ;
ListOfFuncName theListOfFuncName ;
ListOfPythonFunctions theListOfPythonFunctions ;
SUPERV::SDate theFirstCreation ;
} ;
+ostream & operator<< (ostream &,const SALOME_ModuleCatalog::DataStreamType &);
+
#endif
//
//
//
-// File : DataFlowBase_Node.cxx
+// File : DataFlowBase_ComputingNode.cxx
// Author : Jean Rahuel, CEA
// Module : SUPERV
// $Header:
//#include <sstream>
//#include <iostream>
-#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 ,
char * &_Author ,
char * &_Comment ,
- bool &_HeadNode ,
+ //bool &_HeadNode ,
bool &_GeneratedName ,
+ //int &_DataStreamInPortsNumber ,
+ //int &_DataStreamOutPortsNumber ,
int &_ConnectedInPortsNumber ,
- int &_DecrConnectedInPortsNumber,
- int &_LinkedNodesSize ,
- int &_SubGraphNumber ) {
+ int &_DecrConnectedInPortsNumber ) {
+ //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;
// strcpy( _Computer , FACTORYSERVER ) ;
_Comment = NULLSTRING ;
- _SubGraphNumber = 0 ;
- _HeadNode = false ;
+// _SubGraphNumber = 0 ;
+// _HeadNode = false ;
_GeneratedName = false ;
+// _DataStreamInPortsNumber = 0 ;
+// _DataStreamOutPortsNumber = 0 ;
+
_ConnectedInPortsNumber = 0 ;
_DecrConnectedInPortsNumber = 0 ;
- _LinkedNodesSize = 0 ;
- _SubGraphNumber = 0 ;
+// _LinkedNodesSize = 0 ;
+// _SubGraphNumber = 0 ;
}
GraphBase::ComputingNode::ComputingNode() :
- GraphBase::PortsOfNode::PortsOfNode() {
+// GraphBase::PortsOfNode::PortsOfNode() {
+ GraphBase::StreamNode::StreamNode() {
- InitFields( _Kind ,
+ InitFields( //_Kind ,
_FirstCreation ,
_LastModification ,
_EditorRelease ,
_Author ,
_Comment ,
- _HeadNode ,
+ //_HeadNode ,
_GeneratedName ,
+ //_DataStreamInPortsNumber ,
+ //_DataStreamOutPortsNumber ,
_ConnectedInPortsNumber ,
- _DecrConnectedInPortsNumber ,
- _LinkedNodesSize ,
- _SubGraphNumber ) ;
+ _DecrConnectedInPortsNumber ) ;
+ //_LinkedNodesSize ,
+ //_SubGraphNumber ) ;
+ Kind( SUPERV::DataFlowGraph ) ;
_NamingService = NULL ;
_Node = SUPERV::CNode::_nil() ;
_InNode = NULL ;
_ThreadNo = pthread_self() ;
- _Name = NULL ;
cdebug << "GraphBase::Node::Node " << this << " " << endl ;
}
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 ,
_Author ,
_Comment ,
- _HeadNode ,
+ //_HeadNode ,
_GeneratedName ,
+ //_DataStreamInPortsNumber ,
+ //_DataStreamOutPortsNumber ,
_ConnectedInPortsNumber ,
- _DecrConnectedInPortsNumber ,
- _LinkedNodesSize ,
- _SubGraphNumber ) ;
+ _DecrConnectedInPortsNumber ) ;
+ //_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 ;
// cout << "GraphBase::ComputingNode::ComputingNode NO SetDebug" << endl ;
// }
cdebug << "GraphBase::ComputingNode::ComputingNode " << this
- << "' _Name "
- << (void *) _Name << " '" << _Name << " " << _FirstCreation
+ << " Name '" << Name() << "' " << _FirstCreation
<< " " << _LastModification << endl ;
}
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 ;
_InNode = NULL ;
_ThreadNo = pthread_self() ;
- _Kind = akind ;
+ Kind( akind ) ;
+// _Kind = akind ;
time_t T = time(NULL);
struct tm * Tm = localtime(&T);
_Comment = NULLSTRING ;
}
- _SubGraphNumber = 0 ;
- _HeadNode = false ;
+// _SubGraphNumber = 0 ;
+// _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 ;
_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;
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;
}
return _LastModification ;
}
-bool GraphBase::ComputingNode::Kind(const SUPERV::KindOfNode aKind) {
- _Kind = aKind ;
- return true ;
-}
-
void GraphBase::ComputingNode::FirstCreation(const SUPERV::SDate aDate ) {
_FirstCreation = aDate ;
}
// 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() ;
return Info ;
}
+void GraphBase::ComputingNode::DelInPort( const char * InputParameterName ) {
+ GraphBase::PortsOfNode::DelInPort( InputParameterName ) ;
+}
+void GraphBase::ComputingNode::DelOutPort( const char * OutputParameterName ) {
+ 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 ) ;
+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 ) ;
+ if ( aDependency == SALOME_ModuleCatalog::DATASTREAM_TEMPORAL ) {
+ aDataStreamPort->SetParams( SUPERV::TI , SUPERV::L1 , SUPERV::EXTRANULL ) ;
}
- cdebug_out << "GraphBase::ComputingNode::ReNameLink" << endl ;
+ 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 <sys/time.h>
#include <sys/resource.h>
const ListOfFuncName FuncNames ,
const ListOfPythonFunctions PythonFunctions ,
int XCoordinate , int YCoordinate ) const {
+ cdebug_in << "SaveXML Node " << Name() << endl ;
QDomElement node = Graph.createElement( "node" ) ;
info.appendChild( node ) ;
QDomElement componentname = Graph.createElement( "component-name" ) ;
// f << Tabs << "<kind>" << (int ) Kind() << "</kind>" << endl ;
QDomElement kind = Graph.createElement( "kind" ) ;
QString aKind ;
- aKind = aKind.setNum( Kind() ) ;
+
+ // san - Presumably, data stream graphs should be always saved with kind = DataStreamGraph
+// JR : the bug was at line 566 : && HasDataStream() != 0 was missing
+ 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() && HasDataStream() != 0 ) {
+ 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() ) {
service.appendChild(servicename) ;
servicename.appendChild( aField ) ;
-// f << Tabs << " <inParameter-list>" << endl ;
QDomElement inParameterlist = Graph.createElement("inParameter-list") ;
service.appendChild(inParameterlist) ;
unsigned int i;
+ GraphBase::ComputingNode * aNode = (GraphBase::ComputingNode * ) this ;
for ( i = 0 ; i < ServiceInParameter().length() ; i++ ) {
-// f << Tabs << " <inParameter>" << endl ;
- QDomElement inParameter = Graph.createElement("inParameter") ;
- inParameterlist.appendChild(inParameter) ;
-// f << Tabs << " <inParameter-type>"
-// << ServiceInParameter()[i].Parametertype << "</inParameter-type>"
-// << endl ;
- QDomElement inParametertype = Graph.createElement("inParameter-type") ;
- // mpv: Linux 8.0 compiler compatibility
-// aField = Graph.createTextNode( (char *)ServiceInParameter()[i].Parametertype ) ;
- if ( strlen( ServiceInParameter()[i].Parametertype ) ) {
- aField = Graph.createTextNode( strdup( ServiceInParameter()[i].Parametertype ) ) ;
- }
- else {
- aField = Graph.createTextNode( "?" ) ;
- }
- inParameter.appendChild(inParametertype) ;
- inParametertype.appendChild( aField ) ;
-// f << Tabs << " <inParameter-name>"
-// << ServiceInParameter()[i].Parametername << "</inParameter-name>"
-// << endl ;
- QDomElement inParametername = Graph.createElement("inParameter-name") ;
- // mpv: Linux 8.0 compiler compatibility
-// aField = Graph.createTextNode( (char *) ServiceInParameter()[i].Parametername ) ;
- if ( strlen( ServiceInParameter()[i].Parametername ) ) {
- aField = Graph.createTextNode( strdup(ServiceInParameter()[i].Parametername) ) ;
- }
- else {
- aField = Graph.createTextNode( "?" ) ;
+ const GraphBase::InPort * anInPort ;
+ anInPort = aNode->GetInPort( ServiceInParameter()[i].Parametername ) ;
+ if ( !anInPort->IsDataStream() ) {
+ cdebug << "SaveXML " << i << ". " << ServiceInParameter()[i].Parametername
+ << " InParameterPort " << anInPort->Kind() << endl ;
+ QDomElement inParameter = Graph.createElement("inParameter") ;
+ inParameterlist.appendChild(inParameter) ;
+ QDomElement inParametertype = Graph.createElement("inParameter-type") ;
+ if ( strlen( ServiceInParameter()[i].Parametertype ) ) {
+ aField = Graph.createTextNode( strdup( ServiceInParameter()[i].Parametertype ) ) ;
+ }
+ else {
+ aField = Graph.createTextNode( "?" ) ;
+ }
+ inParameter.appendChild(inParametertype) ;
+ inParametertype.appendChild( aField ) ;
+ QDomElement inParametername = Graph.createElement("inParameter-name") ;
+ if ( strlen( ServiceInParameter()[i].Parametername ) ) {
+ aField = Graph.createTextNode( strdup(ServiceInParameter()[i].Parametername) ) ;
+ }
+ else {
+ aField = Graph.createTextNode( "?" ) ;
+ }
+ inParameter.appendChild(inParametername) ;
+ inParametername.appendChild( aField ) ;
}
- inParameter.appendChild(inParametername) ;
- inParametername.appendChild( aField ) ;
-// f << Tabs << " </inParameter>" << endl ;
}
-// f << Tabs << " </inParameter-list>" << endl ;
-// f << Tabs << " <outParameter-list>" << endl ;
QDomElement outParameterlist = Graph.createElement("outParameter-list") ;
service.appendChild(outParameterlist) ;
for ( i = 0 ; i < ServiceOutParameter().length() ; i++ ) {
-// f << Tabs << " <outParameter>" << endl ;
- QDomElement outParameter = Graph.createElement("outParameter") ;
- outParameterlist.appendChild(outParameter) ;
-// f << Tabs << " <outParameter-type>"
-// << ServiceOutParameter()[i].Parametertype << "</outParameter-type>"
-// << endl ;
- QDomElement outParametertype = Graph.createElement("outParameter-type") ;
- // mpv: Linux 8.0 compiler compatibility
-// aField = Graph.createTextNode( (char *) ServiceOutParameter()[i].Parametertype ) ;
- if ( strlen( ServiceOutParameter()[i].Parametertype ) ) {
- aField = Graph.createTextNode( strdup(ServiceOutParameter()[i].Parametertype) ) ;
- }
- else {
- aField = Graph.createTextNode( "?" ) ;
- }
- outParameter.appendChild(outParametertype) ;
- outParametertype.appendChild( aField ) ;
-// f << Tabs << " <outParameter-name>"
-// << ServiceOutParameter()[i].Parametername << "</outParameter-name>"
-// << endl ;
- QDomElement outParametername = Graph.createElement("outParameter-name") ;
- // mpv: Linux 8.0 compiler compatibility
-// aField = Graph.createTextNode( (char *) ServiceOutParameter()[i].Parametername ) ;
- if ( strlen( ServiceOutParameter()[i].Parametername ) ) {
- aField = Graph.createTextNode( strdup(ServiceOutParameter()[i].Parametername) ) ;
- }
- else {
- aField = Graph.createTextNode( "?" ) ;
+ const GraphBase::OutPort * anOutPort ;
+ anOutPort = aNode->GetOutPort( ServiceOutParameter()[i].Parametername ) ;
+ if ( !anOutPort->IsDataStream() ) {
+ cdebug << "SaveXML " << i << ". " << ServiceOutParameter()[i].Parametername
+ << " OutParameterPort " << anOutPort->Kind() << endl ;
+ QDomElement outParameter = Graph.createElement("outParameter") ;
+ outParameterlist.appendChild(outParameter) ;
+ QDomElement outParametertype = Graph.createElement("outParameter-type") ;
+ if ( strlen( ServiceOutParameter()[i].Parametertype ) ) {
+ aField = Graph.createTextNode( strdup(ServiceOutParameter()[i].Parametertype) ) ;
+ }
+ else {
+ aField = Graph.createTextNode( "?" ) ;
+ }
+ outParameter.appendChild(outParametertype) ;
+ outParametertype.appendChild( aField ) ;
+ QDomElement outParametername = Graph.createElement("outParameter-name") ;
+ if ( strlen( ServiceOutParameter()[i].Parametername ) ) {
+ aField = Graph.createTextNode( strdup(ServiceOutParameter()[i].Parametername) ) ;
+ }
+ else {
+ aField = Graph.createTextNode( "?" ) ;
+ }
+ outParameter.appendChild(outParametername) ;
+ outParametername.appendChild( aField ) ;
}
- outParameter.appendChild(outParametername) ;
- outParametername.appendChild( aField ) ;
-// f << Tabs << " </outParameter>" << endl ;
}
-// f << Tabs << " </outParameter-list>" << endl ;
-// f << Tabs << "</service>" << endl ;
-// f << Tabs << "<Parameter-list>" << endl ;
- QDomElement Parameterlist = Graph.createElement("Parameter-list") ;
- node.appendChild( Parameterlist ) ;
-#if 0
- if ( IsInLineNode() || IsGOTONode() ||
- IsLoopNode() || IsEndLoopNode() ||
- IsSwitchNode() || IsEndSwitchNode() ) {
- unsigned int i;
- for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
- const InPort * anInPort = GetNodeInPort( i ) ;
- if ( anInPort->IsBus() ) {
- f << Tabs << " <inParameter>" << endl ;
- f << Tabs << " <inParameter-type>"
- << anInPort->PortType() << "</inParameter-type>"
- << endl ;
- f << Tabs << " <inParameter-name>"
- << anInPort->PortName() << "</inParameter-name>"
- << endl ;
- f << Tabs << " </inParameter>" << endl ;
- const OutPort * anOutPort = GetNodeOutPort( anInPort->PortIndex() ) ;
- f << Tabs << " <outParameter>" << endl ;
- f << Tabs << " <outParameter-type>"
- << anOutPort->PortType() << "</outParameter-type>"
- << endl ;
- f << Tabs << " <outParameter-name>"
- << anOutPort->PortName() << "</outParameter-name>"
- << endl ;
- f << Tabs << " </outParameter>" << endl ;
+ QDomElement DataStreamlist = Graph.createElement("DataStream-list") ;
+ node.appendChild( DataStreamlist ) ;
+ for ( i = 0 ; i < (unsigned int ) GetNodeInPortsSize() ; i++ ) {
+ const GraphBase::InPort * anInPort ;
+ anInPort = aNode->GetNodeInPort( i ) ;
+ if ( anInPort->IsDataStream() ) {
+ 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") ;
+ 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( 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 < (unsigned int ) GetNodeOutPortsSize() ; i++ ) {
+ const GraphBase::OutPort * anOutPort ;
+ anOutPort = aNode->GetNodeOutPort( i ) ;
+ if ( anOutPort->IsDataStream() ) {
+ 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") ;
+ 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( 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 ;
}
}
-#endif
// f << Tabs << "</Parameter-list>" << endl ;
// f << Tabs << "<PyFunction-list>" << endl ;
aField = Graph.createTextNode( aYCoordinate ) ;
node.appendChild( yposition ) ;
yposition.appendChild( aField ) ;
+ cdebug_out << "SaveXML Node " << Name() << endl ;
return true ;
}
const ListOfFuncName FuncNames ,
const ListOfPythonFunctions PythonFunctions ,
int XCoordinate , int YCoordinate ) const {
- if ( IsDataFlowNode() ) {
+ // san - Presumably, data stream graphs should be always saved with kind = DataStreamGraph
+// JR : the bug was at line 927 : && HasDataStream() != 0 was missing
+ if ( IsDataFlowNode() || ( IsDataStreamNode() && HasDataStream() == 0 ) ) {
f << Name() << " = Graph( '" << Name() << "' )" << endl ;
}
+ else if ( IsDataStreamNode() && HasDataStream() != 0 ) {
+ 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 ;
<< 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 ;
}
<< "' , '" << InterfaceName << "' , '" << ServiceName() << "' )"
<< endl ;
}
+ else if ( IsEndLoopNode() || IsEndSwitchNode() ) {
+// It is done with LoopNode or SwitchNode with CoupledNode()
+ }
else {
f << "Py" << Name() << " = []" << endl ;
int i ;
// 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 ;
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( '"
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() || anInPort->IsEndSwitch() ) {
+ 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() || anOutPort->IsSwitch() ) {
+ 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->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->IsInLine() || anOutPort->IsSwitch() ) {
- f << Name() << ".OutPort( '" << 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() || anInPort->IsEndSwitch() ) {
+ 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() || anOutPort->IsSwitch() ) {
+ 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 ;
}
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 ;
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 ) ;
// 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 ;
char * _Author ;
char * _Comment ;
- bool _HeadNode ;
- int _LevelNumber ;
- int _SubGraphNumber ;
+//->StreamNode bool _HeadNode ;
+//->StreamNode int _LevelNumber ;
+//->StreamNode int _SubGraphNumber ;
bool _GeneratedName ;
+//->StreamNode int _DataStreamInPortsNumber ;
+//->StreamNode int _DataStreamOutPortsNumber ;
+
int _ConnectedInPortsNumber ;
int _DecrConnectedInPortsNumber ;
// 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<ComputingNode * > _LinkedNodes ;
- vector<int > _LinkedInPortsNumber ;
+//->StreamNode map< string , int > _MapOfLinkedNodes ;
+//->StreamNode int _LinkedNodesSize ;
+//->StreamNode vector<ComputingNode * > _LinkedNodes ;
+//->StreamNode vector<int > _LinkedInPortsNumber ;
protected:
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 ; } ;
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 ;
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 ) ;
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 ; } ;
+// void HeadNode( bool aHeadNode ) { _HeadNode = aHeadNode ; } ;
+// const bool IsHeadNode() const { return _HeadNode ; } ;
bool RemovePorts( const char* aNodeName ) ;
+ void DelInPort( const char * InputParameterName ) ;
+ 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 ) ;
+ 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 AddLink( ComputingNode * aNode ) ;
- void RemoveLink( ComputingNode * aNode ) ;
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() << " -> "
}
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 ; } ;
- int SubGraph() { return _SubGraphNumber ; } ;
- void SubGraph( int SubGraphNumber ) {
- _SubGraphNumber = SubGraphNumber ; } ;
-
// const GraphBase::ListOfParameters * GetListOfParameters() const ;
const long CpuUsed() ;
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 ;
}
// 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() ,
_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 ;
}
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()
private:
- GraphBase::PortsOfNode * _DataFlowDataPorts ;
bool _Created ;
+ protected :
+
+ GraphBase::PortsOfNode * _DataFlowDataPorts ;
+
public:
DataNode() ;
#include <stdio.h>
#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() ) ;
}
}
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 ) {
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 ;
} ;
// $Header:
using namespace std;
-#include "DataFlowBase_Graph.hxx"
+#include "DataFlowBase_StreamGraph.hxx"
#include "SALOME_LifeCycleCORBA.hxx"
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 ;
}
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 ;
}
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 {
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() ;
GraphBase::ListOfNodes * _list_nodes =
new GraphBase::ListOfNodes;
+ cdebug_in << "GraphBase::Graph::GetNodes" << endl ;
// All the nodes from _InNodes are taken
// vector< InNode *> Nodes = InNodes() ;
else {
(*_list_nodes)[ind].theCoupledNode = CORBA::string_dup( "" ) ;
}
+// (*_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 ;
}
}
}
+ cdebug_out << "GraphBase::Graph::GetNodes" << endl ;
return _list_nodes ;
}
}
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 ;
+ if ( SetServiceOfMap( (GraphBase::Service * ) aNode ) ) {
+ cdebug << "Graph::AddNode SetServiceOfMap " << aNode->ServiceName() << " in MapOfServices" << endl ;
+ }
+ else {
+ cdebug << "Graph::AddNode SetServiceOfMap " << aNode->ServiceName()
+ << " was already in MapOfServices" << endl ;
+ }
+
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;
else {
GraphBase::ComputingNode * FromNode = GetChangeGraphNode( anOutPort->NodeName() ) ;
cdebug << " fromConnected " << FromNode->Name() << endl ;
- FromNode->ReNameLink( OldNodeName , NewNodeName ) ;
+ if ( anInPort->IsDataStream() ) {
+ FromNode->ReNameStreamLink( OldNodeName , NewNodeName ) ;
+ }
+ else {
+ FromNode->ReNameLink( OldNodeName , NewNodeName ) ;
+ }
}
char* OldNodePortName = new char[ strlen( OldNodeName ) +
strlen( aNode->GetChangeNodeInPort( i )->PortName() ) + 2 ] ;
else {
GraphBase::ComputingNode * FromNode = GetChangeGraphNode( anOutPort->NodeName() ) ;
cdebug << " fromConnected " << FromNode->Name() << endl ;
- FromNode->RemoveLink( aNode ) ;
+ if ( anInPort->IsDataStream() ) {
+ FromNode->RemoveStreamLink( aNode ) ;
+ }
+ else {
+ FromNode->RemoveLink( aNode ) ;
+ }
}
RetVal = anOutPort->RemoveInPort( anInPort ) ;
if ( !RetVal )
if ( !RetVal )
break ;
GraphBase::ComputingNode * ToNode = GetChangeGraphNode( anOutPort->InPorts( j )->NodeName() ) ;
- aNode->RemoveLink( ToNode ) ;
+ if ( anOutPort->IsDataStream() ) {
+ aNode->RemoveStreamLink( ToNode ) ;
+ }
+ else {
+ aNode->RemoveLink( ToNode ) ;
+ }
RetVal = anOutPort->RemoveInPort( anOutPort->ChangeInPorts( j ) ) ;
if ( !RetVal )
break ;
cdebug << "AddLink toPort not found." << endl ;
return false ;
}
+ if ( ( fromPort->IsDataStream() && !toPort->IsDataStream() ) ||
+ ( !fromPort->IsDataStream() && toPort->IsDataStream() ) ) {
+ cdebug << "AddLink fromPort/toPort Stream/Flow. ERROR" << endl ;
+ return false ;
+ }
+ if ( fromPort->IsDataStream() && fromPort->Dependency() == SALOME_ModuleCatalog::DATASTREAM_TEMPORAL &&
+ toPort->Dependency() == SALOME_ModuleCatalog::DATASTREAM_ITERATIVE ) {
+ cdebug << "AddLink fromPort/toPort Stream DATASTREAM_TEMPORAL --> DATASTREAM_ITERATIVE. ERROR" << endl ;
+ return false ;
+ }
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() ) ) {
cdebug << "Link already exists" << endl ;
- cdebug_out << "GraphBase::Graph::AddLink" << endl;
+ cdebug_out << "GraphBase::Graph::AddLink 1" << endl;
return true ;
}
else if ( toPort->IsDataConnected() ) {
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 ;
return false ;
}
- if ( fromNode->IsDataFlowNode() && toPort->IsDataConnected() ) {
+ if ( ( fromNode->IsDataFlowNode() || fromNode->IsDataStreamNode() ) &&
+ toPort->IsDataConnected() ) {
toPort->RemoveOutPort() ;
}
}
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 );
}
else {
cdebug << "AddLink fromPort->PortStatus( PortConnected ) & fromNode->toNode "
- << fromNode->Name() << " " << fromPort->PortName() << endl;
+ << fromNode->Name() << " " << fromPort->PortName() << " "
+ << fromPort->Kind() << " -> " << toNode->Name() << " " << " "
+ << toPort->PortName() << " " << toPort->Kind() << endl;
fromPort->PortStatus( PortConnected );
- fromNode->AddLink( toNode ) ;
+ if ( fromPort->IsDataStream() && toPort->IsDataStream() ) {
+ fromNode->AddStreamLink( toNode ) ;
+ }
+ else {
+ fromNode->AddLink( toNode ) ;
+ }
}
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 ;
}
}
// cdebug << fromNode->ServiceName() << " " << toNode->ServiceName() << endl ;
- cdebug_out << "GraphBase::Graph::AddLink" << endl;
+ cdebug_out << "GraphBase::Graph::AddLink 1" << endl;
return true ;
}
GraphBase::ComputingNode * fromNode = GetChangeGraphNode( FromNodeName ) ;
if ( RetVal ) {
if ( fromNode ) {
- fromNode->RemoveLink( toNode ) ;
+ if ( anInPort->IsDataStream() ) {
+ fromNode->RemoveStreamLink( toNode ) ;
+ }
+ else {
+ fromNode->RemoveLink( toNode ) ;
+ }
}
if ( fromNode->IsSwitchNode() && !anOutPort->IsGate() && !toNode->IsEndSwitchNode() ) {
anOutPort->Kind( SUPERV::InLineParameter ) ;
}
-#if 0
- if ( fromNode->IsEndLoopNode() ) {
- toNode = ((GraphBase::EndOfLoopNode * ) fromNode)->CoupledNode() ;
- if ( toNode ) {
- anInPort = toNode->GetChangeInPort( ToServiceParameterName ) ;
- RetVal = AddLink( fromNode , anOutPort , toNode , anInPort ) ;
- }
- else {
- RetVal = false ;
- }
- }
- if ( toNode->IsLoopNode() ) {
- fromNode = ((GraphBase::LoopNode * ) toNode)->CoupledNode() ;
- if ( fromNode ) {
- anOutPort = fromNode->GetChangeOutPort( FromServiceParameterName ) ;
- RetVal = AddLink( fromNode , anOutPort , toNode , toNode->GetChangeInPort( ToServiceParameterName ) ) ;
- }
- else {
- RetVal = false ;
- }
- }
-#endif
}
}
}
return RetVal ;
}
+map< string , GraphBase::Service * > GraphBase::Graph::MapOfServiceNames() {
+ return _MapOfServiceNames ; }
+
+GraphBase::Service * GraphBase::Graph::GetServiceOfMap( char * name ) {
+ return _MapOfServiceNames[ name ] ;
+}
+
+bool GraphBase::Graph::SetServiceOfMap( GraphBase::Service * aService ) {
+ GraphBase::Service * theService = _MapOfServiceNames[ aService->ServiceName() ] ;
+ if ( theService ) {
+ cdebug << "SetServiceOfMap of " << aService->ServiceName()
+ << " already in MapOfServiceNames : erase" << endl ;
+ _MapOfServiceNames.erase( aService->ServiceName() ) ;
+ }
+ _MapOfServiceNames[ (char * ) aService->ServiceName() ] = aService ;
+ cdebug << "SetServiceOfMap of " << aService->ServiceName() << " done" << endl ;
+ return true ;
+}
+
+int GraphBase::Graph::GetServiceNameNumber( SALOME_ModuleCatalog::Service aService ) {
+ GraphBase::Service * theService = _MapOfServiceNames[ (char * ) aService.ServiceName ] ;
+ if ( theService == NULL ) {
+ return 1 ;
+ }
+ return theService->NewInstance() ;
+}
+
bool GraphBase::Graph::CreateService() {
cdebug_in << "GraphBase::Graph::CreateService" << endl;
bool RetVal = true ;
GraphBase::ComputingNode * aToNode ;
int dostore ;
int innbr ;
+ int instreamnbr ;
int outnbr ;
- for ( dostore = 0 ; dostore <= 1 ; dostore++ ) {
+ 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() ;
aService.ServiceinParameter.length( 0 ) ;
aService.ServiceinParameter.length( innbr ) ;
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 ) {
+ innbr = 0 ;
+ outnbr = 0 ;
}
- innbr = 0 ;
- outnbr = 0 ;
for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
aToNode = GraphNodes( i ) ;
for ( j = 0 ; j < aToNode->GetNodeInPortsSize() ; j++ ) {
GraphBase::InPort *anInPort = aToNode->GetChangeNodeInPort(j) ;
-#if 0
- if ( dostore == 0 &&
- strcmp( anInPort->ServicesParameterType() , "string" ) &&
- strcmp( anInPort->ServicesParameterType() , "long" ) &&
- strcmp( anInPort->ServicesParameterType() , "double" ) &&
- strcmp( anInPort->ServicesParameterType() , "objref" ) ) {
- cdebug << "CreateService Node " << aToNode->Name() << ". Input port " << anInPort->PortName()
- << " has illegal type " << anInPort->ServicesParameterType() << endl ;
- RetVal = false ;
- }
-#endif
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 ) {
cdebug << "DataConnected from " << *(anInPort->GetOutPort() ) ;
}
cdebug << endl ;
- innbr += 1 ;
+ if ( anInPort->IsDataStream() ) {
+ instreamnbr += 1 ;
+ }
+ else {
+ innbr += 1 ;
+ }
}
- else {
+ 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() ) ;
+ aService.ServiceinParameter[innbr].Parametername = CORBA::string_dup( anInPort->NodePortName() ) ;
+ 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 " ;
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 ;
- }
-#if 0
- if ( dostore == 0 &&
- strcmp( anOutPort->ServicesParameterType() , "string" ) &&
- strcmp( anOutPort->ServicesParameterType() , "long" ) &&
- strcmp( anOutPort->ServicesParameterType() , "double" ) &&
- strcmp( anOutPort->ServicesParameterType() , "objref" ) ) {
- cdebug << "CreateService Node " << aFromNode->Name() << ". Output port " << anOutPort->PortName()
- << " has illegal type " << anOutPort->ServicesParameterType() << endl ;
- RetVal = false ;
- }
-#endif
+// 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 {
+ 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() ) ;
+ aService.ServiceoutParameter[outnbr].Parametername = CORBA::string_dup( anOutPort->NodePortName() ) ;
+ 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 ;
}
}
}
}
}
-// 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 ;
-// }
-
- DataService( _Orb , aService , Graph_prof_debug() , Graph_fdebug() ) ;
-
+ 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 , InPortsKind , OutPortsKind , Graph_prof_debug() , Graph_fdebug() ) ;
+ for ( i = 0 ; i < innbr ; i++ ) {
+ 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++ ) {
+ 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() ) {
cdebug_in << "GraphBase::Graph::InLineServices" << endl;
int i , j ;
+ ListPorts( *_Graph_fdebug , 0 ) ;
GraphBase::InLineNode * aINode ;
SALOME_ModuleCatalog::Service aService ;
for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
aINode = (GraphBase::InLineNode * ) GraphNodes( i ) ;
+// 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 ) ;
+ aINode->DataStreamInPortsNumber( 0 ) ;
+ aINode->DataStreamOutPortsNumber( 0 ) ;
int InService = 0 ;
+ int InStreamService = 0 ;
for ( j = 0 ; j < aINode->GetNodeInPortsSize() ; j++ ) {
- if ( aINode->GetChangeNodeInPort(j)->IsGate() ||
- aINode->GetChangeNodeInPort(j)->IsLoop() ) {
-// cdebug << "GraphBase::Graph::InLineServices In" << j << " "
-// << aINode->GetChangeNodeInPort(j)->Kind() << " "
-// << aINode->GetChangeNodeInPort(j)->PortType() << " "
-// << aINode->GetChangeNodeInPort(j)->PortName() << " ignored "
-// << aINode->GetChangeNodeInPort(j)->IsGate() << " "
-// << aINode->GetChangeNodeInPort(j)->IsLoop() << endl;
+// if ( aINode->GetChangeNodeInPort(j)->IsGate() || aINode->GetChangeNodeInPort(j)->IsLoop() || aINode->GetChangeNodeInPort(j)->IsDataStream() ) {
+ if ( aINode->GetChangeNodeInPort(j)->IsGate() || aINode->GetChangeNodeInPort(j)->IsLoop() ) {
+ cdebug << "GraphBase::Graph::InLineServices In" << j << " "
+ << aINode->GetChangeNodeInPort(j)->Kind() << " "
+ << aINode->GetChangeNodeInPort(j)->PortType() << " "
+ << aINode->GetChangeNodeInPort(j)->PortName() << " ignored "
+ << aINode->GetChangeNodeInPort(j)->IsGate() << " "
+ << aINode->GetChangeNodeInPort(j)->IsLoop() << endl;
+ }
+ else if ( aINode->GetChangeNodeInPort(j)->IsDataStream() ) {
+ aService.ServiceinDataStreamParameter.length( InStreamService+1 ) ;
+ aService.ServiceinDataStreamParameter[InStreamService].Parametertype = StringToDataStreamType( aINode->GetChangeNodeInPort(j)->PortType() ) ;
+ aService.ServiceinDataStreamParameter[InStreamService].Parametername = CORBA::string_dup( aINode->GetChangeNodeInPort(j)->PortName() ) ;
+ aService.ServiceinDataStreamParameter[InStreamService++].Parameterdependency = aINode->GetChangeNodeInPort(j)->Dependency() ;
+ aINode->IncrDataStreamInPorts() ;
+ cdebug << "GraphBase::Graph::InLineServices In" << j << " "
+ << aINode->GetChangeNodeInPort(j)->Kind() << " "
+ << aINode->GetChangeNodeInPort(j)->PortType() << " "
+ << aINode->GetChangeNodeInPort(j)->PortName() << " "
+ << aINode->GetChangeNodeInPort(j)->IsGate() << " "
+ << aINode->GetChangeNodeInPort(j)->IsLoop() << endl;
}
else {
aService.ServiceinParameter.length( InService+1 ) ;
aService.ServiceinParameter[InService].Parametertype = CORBA::string_dup( aINode->GetChangeNodeInPort(j)->PortType() ) ;
aService.ServiceinParameter[InService++].Parametername = CORBA::string_dup( aINode->GetChangeNodeInPort(j)->PortName() ) ;
-// cdebug << "GraphBase::Graph::InLineServices In" << j << " "
-// << aINode->GetChangeNodeInPort(j)->Kind() << " "
-// << aINode->GetChangeNodeInPort(j)->PortType() << " "
-// << aINode->GetChangeNodeInPort(j)->PortName() << " "
-// << aINode->GetChangeNodeInPort(j)->IsGate() << " "
-// << aINode->GetChangeNodeInPort(j)->IsLoop() << endl;
+ cdebug << "GraphBase::Graph::InLineServices In" << j << " "
+ << aINode->GetChangeNodeInPort(j)->Kind() << " "
+ << aINode->GetChangeNodeInPort(j)->PortType() << " "
+ << aINode->GetChangeNodeInPort(j)->PortName() << " "
+ << aINode->GetChangeNodeInPort(j)->IsGate() << " "
+ << aINode->GetChangeNodeInPort(j)->IsLoop() << endl;
}
}
int OutService = 0 ;
+ int OutStreamService = 0 ;
for ( j = 0 ; j < aINode->GetNodeOutPortsSize() ; j++ ) {
- if ( aINode->GetChangeNodeOutPort(j)->IsGate() ||
- aINode->GetChangeNodeOutPort(j)->IsLoop() ) {
-// cdebug << "GraphBase::Graph::InLineServices Out" << j << " "
-// << aINode->GetChangeNodeOutPort(j)->Kind() << " "
-// << aINode->GetChangeNodeOutPort(j)->PortType() << " "
-// << aINode->GetChangeNodeOutPort(j)->PortName() << " ignored "
-// << aINode->GetChangeNodeOutPort(j)->IsGate() << " "
-// << aINode->GetChangeNodeOutPort(j)->IsLoop() << endl;
+// if ( aINode->GetChangeNodeOutPort(j)->IsGate() || aINode->GetChangeNodeOutPort(j)->IsLoop() || aINode->GetChangeNodeOutPort(j)->IsDataStream() ) {
+ if ( aINode->GetChangeNodeOutPort(j)->IsGate() || aINode->GetChangeNodeOutPort(j)->IsLoop() ) {
+ cdebug << "GraphBase::Graph::InLineServices Out" << j << " "
+ << aINode->GetChangeNodeOutPort(j)->Kind() << " "
+ << aINode->GetChangeNodeOutPort(j)->PortType() << " "
+ << aINode->GetChangeNodeOutPort(j)->PortName() << " ignored "
+ << aINode->GetChangeNodeOutPort(j)->IsGate() << " "
+ << aINode->GetChangeNodeOutPort(j)->IsLoop() << endl;
+ }
+ else if ( aINode->GetChangeNodeOutPort(j)->IsDataStream() ) {
+ aService.ServiceoutDataStreamParameter.length( OutStreamService+1 ) ;
+ aService.ServiceoutDataStreamParameter[OutStreamService].Parametertype = StringToDataStreamType( aINode->GetChangeNodeOutPort(j)->PortType() ) ;
+ aService.ServiceoutDataStreamParameter[OutStreamService].Parametername = CORBA::string_dup( aINode->GetChangeNodeOutPort(j)->PortName() ) ;
+ aService.ServiceoutDataStreamParameter[OutStreamService++].Parameterdependency = aINode->GetChangeNodeOutPort(j)->Dependency() ;
+ aINode->IncrDataStreamOutPorts() ;
+ cdebug << "GraphBase::Graph::InLineServices Out" << j << " "
+ << aINode->GetChangeNodeOutPort(j)->Kind() << " "
+ << aINode->GetChangeNodeOutPort(j)->PortType() << " "
+ << aINode->GetChangeNodeOutPort(j)->PortName() << " "
+ << aINode->GetChangeNodeOutPort(j)->IsGate() << " "
+ << aINode->GetChangeNodeOutPort(j)->IsLoop() << endl;
}
else {
aService.ServiceoutParameter.length( OutService+1 ) ;
aService.ServiceoutParameter[OutService].Parametertype = CORBA::string_dup( aINode->GetChangeNodeOutPort(j)->PortType() ) ;
aService.ServiceoutParameter[OutService++].Parametername = CORBA::string_dup( aINode->GetChangeNodeOutPort(j)->PortName() ) ;
-// cdebug << "GraphBase::Graph::InLineServices Out" << j << " "
-// << aINode->GetChangeNodeOutPort(j)->Kind() << " "
-// << aINode->GetChangeNodeOutPort(j)->PortType() << " "
-// << aINode->GetChangeNodeOutPort(j)->PortName() << " "
-// << aINode->GetChangeNodeOutPort(j)->IsGate() << " "
-// << aINode->GetChangeNodeOutPort(j)->IsLoop() << endl;
+ cdebug << "GraphBase::Graph::InLineServices Out" << j << " "
+ << aINode->GetChangeNodeOutPort(j)->Kind() << " "
+ << aINode->GetChangeNodeOutPort(j)->PortType() << " "
+ << aINode->GetChangeNodeOutPort(j)->PortName() << " "
+ << aINode->GetChangeNodeOutPort(j)->IsGate() << " "
+ << aINode->GetChangeNodeOutPort(j)->IsLoop() << endl;
}
}
aINode->SetService( aService ) ;
+ if ( SetServiceOfMap( (GraphBase::Service * ) aINode ) ) {
+ cdebug << "InLineServices SetServiceOfMap " << aINode->ServiceName() << " in MapOfServices"
+ << " InStreamPort(" << aINode->DataStreamInPortsNumber()
+ << ") OutStreamPort(" << aINode->DataStreamOutPortsNumber() << ")" << endl ;
+ }
// cdebug << "GraphBase::Graph::InLineServices" << *aINode->GetService() << endl;
}
}
return true ;
}
-bool GraphBase::Graph::Sort() {
+bool GraphBase::Graph::Sort( int & SubStreamGraphsNumber ) {
int i ;
int j ;
int NotSortedNumber = GraphNodesSize() ;
bool NewSorted ;
+ cdebug_in << "GraphBase::Graph::Sort" << endl;
if ( NotSortedNumber ) {
_LevelsNumber = 0 ;
_ParallelExecutionNodes = false ;
_Sorted.resize( GraphNodesSize() ) ;
_CnxInPortsNumber.resize( GraphNodesSize() ) ;
_DecrInPortsNumber.resize( GraphNodesSize() ) ;
- if ( _NodesNumber.size() )
+ if ( _NodesNumber.size() ) {
_NodesNumber.resize( 0 ) ;
_SortedNodes.resize( 0 ) ;
+ }
+// This is a simulation of the computation of the graph :
+// The initial state of nodes is :
+// - Sorted = false : the node is not sorted
+// - CnxInPortsNumber = ConnectedInPortsNumber : the number of ports that wait for a value from a link
+// - DecrInPortsNumber = 0 : there is no value available.
+ cdebug << "GraphBase::Graph::Sort initial values :" << endl ;
+ for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
+ GraphBase::ComputingNode * aNode = GraphNodes( i ) ;
+ cdebug << aNode->Name() << " --> " << aNode->LinkedNodesSize() << " LinkedNodes :" << endl ;
+ for ( j = 0 ; j < aNode->LinkedNodesSize() ; j++ ) {
+ cdebug << " " << aNode->LinkedNodes( j )->Name() << endl ;
+ }
+ }
for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
_Sorted[ i ] = false ;
_CnxInPortsNumber[ i ] = GraphNodes( i )->ConnectedInPortsNumber() ;
_DecrInPortsNumber[ i ] = 0 ;
+ cdebug << "Sort Node [" << i << "] " << GraphNodes( i )->Name() << " initial count " << _CnxInPortsNumber[ i ] << endl ;
}
+// Nodes are linked ONLY if Ports are NOT DataStream for topological sort of node
+// ==============================================================================
while ( NotSortedNumber ) {
NewSorted = false ;
<< GraphNodes( i )->Name() << " count "
<< _CnxInPortsNumber[ i ] << endl ;
if ( !_Sorted[ i ] && _CnxInPortsNumber[ i ] == 0 ) {
-// All inputs of GraphNodes( i ) are available
+// All inputs of GraphNodes( i ) are available : "AllDataReady"
if ( (int ) _NodesNumber.size() != _LevelsNumber+1 ) {
_NodesNumber.resize( _LevelsNumber+1 ) ;
_SortedNodes.resize( _LevelsNumber+1 ) ;
_NodesNumber[ _LevelsNumber ] = -1 ;
}
+// There is one more node at that level
_NodesNumber[ _LevelsNumber ]++ ;
(_SortedNodes[ _LevelsNumber ]).resize( _NodesNumber[ _LevelsNumber ]+1 ) ;
(_SortedNodes[ _LevelsNumber ])[ _NodesNumber[ _LevelsNumber ] ] = GraphNodes( i ) ;
_Sorted[ i ] = true ;
NewSorted = true ;
+ NotSortedNumber -= 1 ;
cdebug << GraphNodes( i )->Name() << " belongs to level "
<< _LevelsNumber << "." << endl ;
+// GraphNodes( i ) has the state "AllDataReady". We simulate the end of its execution :
+// So we loop over all nodes that have a link from that node
+// And we increment the number of input ports of GraphNodes( i )->LinkedNodes( j ) that this
+// execution will give a value in DecrInPortsNumber : "SomeDataReady"
for ( j = 0 ; j < GraphNodes( i )->LinkedNodesSize() ; j++ ) {
-// Outputs of GraphNodes( i ) will satisfy
+// OutputPorts of GraphNodes( i ) will satisfy
// GraphNodes( i )->LinkedInPortsNumber( j ) InPorts of
// GraphNodes( i )->LinkedNodes( j )
- GraphBase::ComputingNode * aLinkedNode = GraphNodes( i )->LinkedNodes( j ) ;
+ GraphBase::StreamNode * 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() )
<< " ] = "
}
}
}
+// If no node was found, that FlowGraph is not valid : if we try to execute it, that FlowGraph
+// will wait for data(s) from node(s) not executed or not executing for ever
if ( !NewSorted ) {
cdebug << "Loop detected level " << _LevelsNumber << endl ;
return false ; // Loop in the Graph
}
cdebug << "Bilan level " << _LevelsNumber << " : " << endl ;
bool ChangeCount = false ;
+// We update now the number of InPorts with a link that are waiting for a value
for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
-// if ( GraphNodes( i )->DecrIncrDecrConnectedInPortsNumber() ) {
if ( _DecrInPortsNumber[ i ] ) {
int prevcount = _CnxInPortsNumber[ i ] ;
_CnxInPortsNumber[ i ] -= _DecrInPortsNumber[ i ] ;
<< " --> new count " << _CnxInPortsNumber[ i ] << endl ;
}
}
-
- if ( !ChangeCount )
- break ;
- _LevelsNumber += 1 ;
+// If there is no loop and if the number of InPorts with a link that are waiting for a value
+// does not change, the sort is finished. But there is also NotSortedNumber ...
+// if ( !ChangeCount )
+// break ;
+ if ( NotSortedNumber ) {
+ _LevelsNumber += 1 ;
+ }
}
_ThreadsMax = 0 ;
int AllSortedNodes = 0 ;
_HeadNodes = _SortedNodes[ 0 ] ;
_HeadNodesSize = _SortedNodes[ 0 ].size() ;
+// QueueNodes was used in the past in order to know if the execution of a graph is finished
+// But because of loop nodes that was changed. So that part of code is a "clutter"
+// Now a graph has finished its execution when the number of executing threads is zero
_QueueNodes = _SortedNodes[ _LevelsNumber ] ;
_QueueNodesSize = _SortedNodes[ _LevelsNumber ].size() ;
for ( i = 0 ; i < _QueueNodesSize ; i++ ) {
_QueueNodes = _SortedNodes[ _LevelsNumber - 1 ] ;
_QueueNodesSize = _SortedNodes[ _LevelsNumber - 1 ].size() ;
}
+// Computation of the maximum number of threads == the maximum number of nodes of all levels
for ( i = 0 ; i <= _LevelsNumber ; i++ ) {
AllSortedNodes += _NodesNumber[ i ]+1 ;
- if ( _NodesNumber[ i ] + 1 > _ThreadsMax )
+ if ( _NodesNumber[ i ] + 1 > _ThreadsMax ) {
_ThreadsMax = _NodesNumber[ i ] + 1 ;
+ }
cdebug << _NodesNumber[ i ]+1 << " Nodes of level " << i << " : "
<< (_SortedNodes[ i ])[ 0 ]->Name() << endl ;
for ( j = 1 ; j <= _NodesNumber[ i ] ; j++ ) {
(_SortedNodes[ 0 ])[ i ]->HeadNode( true ) ;
}
- for ( i = 0 ; i <= _NodesNumber[ 0 ] ; i++ ) {
- (_SortedNodes[ 0 ])[ i ]->Level( 0 ) ;
- (_SortedNodes[ 0 ])[ i ]->SubGraph( i + 1 ) ;
+// Give a subgraph/substreamgraph number > 0 to HeadNodes (level 0)
+// There is no substreamgraph for nodes without StreamPorts
+ for ( j = 0 ; j <= _NodesNumber[ 0 ] ; j++ ) {
+ (_SortedNodes[ 0 ])[ j ]->Level( 0 ) ;
+ (_SortedNodes[ 0 ])[ j ]->SortedIndex( j ) ;
+ (_SortedNodes[ 0 ])[ j ]->SubGraph( j + 1 ) ;
+ if ( (_SortedNodes[ 0 ])[ j ]->HasDataStream() ) {
+ (_SortedNodes[ 0 ])[ j ]->SubStreamGraph( j + 1 ) ;
+ }
+ else {
+ (_SortedNodes[ 0 ])[ j ]->SubStreamGraph( -1 ) ;
+ }
}
+// Give a subgraph/substreamgraph number = 0 to all other nodes :
+// the SubGraph of that nodes is unknown
+// There is no substreamgraph for nodes without StreamPorts
for ( i = 1 ; i <= _LevelsNumber ; i++ ) {
for ( j = 0 ; j <= _NodesNumber[ i ] ; j++ ) {
(_SortedNodes[ i ])[ j ]->Level( i ) ;
+ (_SortedNodes[ i ])[ j ]->SortedIndex( j ) ;
(_SortedNodes[ i ])[ j ]->SubGraph( 0 ) ;
+ if ( (_SortedNodes[ i ])[ j ]->HasDataStream() ) {
+ (_SortedNodes[ i ])[ j ]->SubStreamGraph( 0 ) ;
+ }
+ else {
+ (_SortedNodes[ i ])[ j ]->SubStreamGraph( -1 ) ;
+ }
}
}
+// Computation of independent SubGraphs which have NO link between them
+ cdebug << endl << "Computation of SubGraphs" << endl ;
bool Graphs = true ;
while ( Graphs ) {
for ( i = 0 ; i <= _LevelsNumber ; i++ ) {
for ( j = 0 ; j <= _NodesNumber[ i ] ; j++ ) {
GraphBase::ComputingNode * aNode = (_SortedNodes[ i ])[ j ] ;
- cdebug << "Graph " << aNode->SubGraph() << " " << aNode->Name()
+ cdebug << "SubGraph " << aNode->SubGraph() << " " << aNode->Name()
<< endl ;
int k ;
for ( k = 0 ; k < aNode->LinkedNodesSize() ; k++ ) {
aNode->LinkedNodes( k )->Level() == aNode->Level()+1 ) {
aNode->SubGraph( aNode->LinkedNodes( k )->SubGraph() ) ;
cdebug << " Linked " << aNode->LinkedNodes( k )->Name()
- << " Graph(" << aNode->LinkedNodes( k )->SubGraph()
+ << " SubGraph(" << aNode->LinkedNodes( k )->SubGraph()
<< ") ==>" << endl ;
- cdebug << " Graph " << aNode->SubGraph() << " for "
+ cdebug << " SubGraph " << aNode->SubGraph() << " for "
<< aNode->Name() << " ==> again" << endl ;
int l ;
for ( l = 0 ; l < aNode->LinkedNodesSize() ; l++ ) {
}
else {
cdebug << " Linked " << aNode->LinkedNodes( k )->Name()
- << " Graph(" << aNode->LinkedNodes( k )->SubGraph()
+ << " SubGraph(" << aNode->LinkedNodes( k )->SubGraph()
<< ") distance > 1 ignored" << endl ;
}
}
break ;
}
if ( Graphs ) {
- cdebug << endl << "Graphs result : " << endl ;
+ cdebug << endl << "SubGraphs result : " << endl ;
break ;
}
cdebug << endl << "One more time" << endl ;
Graphs = true ;
}
- _GraphsNumber = 0 ;
+// Make a sequential renumbering of SubGraphs :
+ _SubGraphsNumber = 0 ;
int CurrGraphsNumber = 0;
int k ;
for ( k = 0 ; k <= _NodesNumber[ 0 ] ; k++ ) {
if ( (_SortedNodes[ 0 ])[ k ]->SubGraph() > CurrGraphsNumber ) {
CurrGraphsNumber = (_SortedNodes[ 0 ])[ k ]->SubGraph() ;
- _GraphsNumber += 1 ;
+ _SubGraphsNumber += 1 ;
for ( i = 0 ; i <= _LevelsNumber ; i++ ) {
for ( j = 0 ; j <= _NodesNumber[ i ] ; j++ ) {
if ( (_SortedNodes[ i ])[ j ]->SubGraph() == CurrGraphsNumber ) {
- (_SortedNodes[ i ])[ j ]->SubGraph( _GraphsNumber ) ;
- cdebug << "GraphsNumber " << _GraphsNumber << " " << " Level "
+ (_SortedNodes[ i ])[ j ]->SubGraph( _SubGraphsNumber ) ;
+ cdebug << "SubGraphsNumber " << _SubGraphsNumber << " " << " Level "
<< i << " : " << (_SortedNodes[ i ])[ j ]->Name()
<< endl ;
}
}
}
}
+
+ cdebug << endl << "Computation of SubStreamGraphs" << endl ;
+ for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
+ GraphBase::ComputingNode * aNode = GraphNodes( i ) ;
+ if ( aNode->SubStreamGraph() < 0 ) {
+ cdebug << "Graph " << aNode->SubStreamGraph() << " " << aNode->Name()
+ << " has NO streamport" << endl ;
+ }
+ else {
+ cdebug << aNode->Name() << " SubGraph " << aNode->SubGraph() << " --> "
+ << aNode->LinkedStreamNodesSize() << " LinkedStreamNodes :" << endl ;
+ for ( j = 0 ; j < aNode->LinkedStreamNodesSize() ; j++ ) {
+ cdebug << " " << aNode->LinkedStreamNodes( j )->Name() << endl ;
+ }
+ }
+ }
+
+// Computation of independent SubStreamGraphs which have NO StreamLink between them
+ SubStreamGraphsNumber = 0 ;
+ int ilevel ;
+ for ( ilevel = 0 ; ilevel <= _LevelsNumber ; ilevel++ ) {
+// Loop for _NodesNumber[ ilevel ] nodes of the level ilevel
+ int jnode ;
+ for ( jnode = 0 ; jnode <= _NodesNumber[ ilevel ] ; jnode++ ) {
+ GraphBase::ComputingNode * aNode = (_SortedNodes[ ilevel ])[ jnode ] ;
+ if ( aNode->SubStreamGraph() < 0 ) {
+ cdebug << "Graph " << aNode->SubStreamGraph() << " " << aNode->Name()
+ << " has NO streamport" << endl ;
+ }
+ else {
+ int CurStreamGraphsNumber ;
+ if ( aNode->SubStreamGraph() > 0 ) {
+ cdebug << "SubStreamGraph " << aNode->SubStreamGraph() << " " << aNode->Name()
+ << " has streamport LinkedStreamNodesSize already in a SubStreamGraph" << endl ;
+ CurStreamGraphsNumber = aNode->SubStreamGraph() ;
+ }
+ else {
+ CurStreamGraphsNumber = SubStreamGraphsNumber+1 ;
+ }
+ int RetVal = 0 ;
+ while ( RetVal != CurStreamGraphsNumber ) {
+ RetVal = CurStreamGraphsNumber ;
+ aNode->SetSubStreamGraph( CurStreamGraphsNumber , RetVal ) ;
+ if ( RetVal != CurStreamGraphsNumber ) {
+ for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
+ GraphBase::ComputingNode * aNode = GraphNodes( i ) ;
+ if ( aNode->SubStreamGraph() == CurStreamGraphsNumber ) {
+ aNode->SubStreamGraph( RetVal ) ;
+ }
+ }
+ CurStreamGraphsNumber = RetVal ;
+ RetVal = 0 ;
+ }
+ if ( CurStreamGraphsNumber > SubStreamGraphsNumber ) {
+ SubStreamGraphsNumber = CurStreamGraphsNumber ;
+ }
+ }
+ }
+ }
+ }
+// Make a sequential renumbering of SubGraphs :
+ cdebug << endl << "Last SubStreamGraphsNumber : " << SubStreamGraphsNumber << endl ;
+ int CurrStreamGraphsNumber = 0 ;
+ int count = 0 ;
+ for ( CurrStreamGraphsNumber = 0 ; CurrStreamGraphsNumber <= SubStreamGraphsNumber ; CurrStreamGraphsNumber++ ) {
+ bool SearchCurrStreamGraphsNumber = true ;
+ for ( k = 0 ; k <= _LevelsNumber && SearchCurrStreamGraphsNumber ; k++ ) {
+ int l ;
+ for ( l = 0 ; l <= _NodesNumber[ k ] && SearchCurrStreamGraphsNumber ; l++ ) {
+ if ( (_SortedNodes[ k ])[ l ]->SubStreamGraph() == CurrStreamGraphsNumber ) {
+ SearchCurrStreamGraphsNumber = false ;
+ count = count + 1 ;
+ if ( CurrStreamGraphsNumber != count ) {
+ cdebug << "CurrStreamGraphsNumber " << CurrStreamGraphsNumber << " count " << count
+ << " Level " << k << " n " << l << endl ;
+ for ( i = k ; i <= _LevelsNumber ; i++ ) {
+ for ( j = 0 ; j <= _NodesNumber[ i ] ; j++ ) {
+ if ( (_SortedNodes[ i ])[ j ]->SubStreamGraph() == CurrStreamGraphsNumber ) {
+ (_SortedNodes[ i ])[ j ]->SubStreamGraph( count ) ;
+ cdebug << "SubStreamGraphsNumber " << CurrStreamGraphsNumber << " --> " << count << " "
+ << " Level " << i << " : " << (_SortedNodes[ i ])[ j ]->Name() << endl ;
+ }
+ else if ( (_SortedNodes[ i ])[ j ]->SubStreamGraph() > 0 ) {
+ cdebug << "SubStreamGraphsNumber " << (_SortedNodes[ i ])[ j ]->SubStreamGraph()
+ << " != " << CurrStreamGraphsNumber << " Level " << i << " : "
+ << (_SortedNodes[ i ])[ j ]->Name() << endl ;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ SubStreamGraphsNumber = count ;
+ cdebug << endl << "SubStreamGraphs result : " << SubStreamGraphsNumber << " SubStreamGraphs" << endl ;
+// int CurrStreamGraphsNumber ;
+// for ( CurrStreamGraphsNumber = 1 ; CurrStreamGraphsNumber <= SubStreamGraphsNumber ; CurrStreamGraphsNumber++ ) {
+// for ( ilevel = 0 ; ilevel <= _LevelsNumber ; ilevel++ ) {
+// for ( k = 0 ; k <= _NodesNumber[ ilevel ] ; k++ ) {
+// if ( (_SortedNodes[ ilevel ])[ k ]->SubStreamGraph() == CurrStreamGraphsNumber ) {
+// cdebug << "SubStreamGraphsNumber " << CurrStreamGraphsNumber << " : "
+// << (_SortedNodes[ ilevel ])[ k ]->Name() << endl ;
+// }
+// }
+// }
+// }
}
+ ListPorts( *_Graph_fdebug , 0 ) ;
+
+ cdebug_out << "GraphBase::Graph::Sort" << endl;
return true ;
}
}
for ( j = 0 ; j < aLoopNode->CoupledNode()->GetNodeInPortsSize() ; j++ ) {
GraphBase::InPort *anInPort = aLoopNode->CoupledNode()->GetChangeNodeInPort( j ) ;
- if ( !anInPort->IsConnected() ) {
+ if ( !anInPort->IsConnected() && !anInPort->IsGate() ) {
if ( !AddLink( aLoopNode , aLoopNode->GetChangeNodeOutPort( j ) ,
aLoopNode->CoupledNode() , anInPort ) ) {
cdebug << "GraphBase::Graph::CreateService AddLink ERROR " << aLoopNode->Name() << "( "
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() ) ) {
// For Outputs of the DataFlow :
for ( j = 0 ; j < aNode->GetNodeOutPortsSize() ; j++ ) {
if ( !aNode->GetNodeOutPort(j)->IsConnected() ) {
- aNode->AddLink( (GraphBase::ComputingNode *) this ) ;
+ if ( aNode->GetNodeOutPort(j)->IsDataStream() ) {
+ aNode->AddStreamLink( (GraphBase::ComputingNode *) this ) ;
+ }
+ else {
+ aNode->AddLink( (GraphBase::ComputingNode *) this ) ;
+ }
}
}
}
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<bool > _Sorted ;
vector<ComputingNode *> _GraphNodes ;
// _SortedNodes[ _LevelsNumber ] : topological sort from 0 to _LevelsNumber
-// _SortedNodes[ _level ][ _NodesNumber[ _level ] ] : _NodesNumber[ _level ] Nodes
+// _SortedNodes[ _level ][ _NodesNumber[ _level ] ] : _NodesNumber[ _level ] Nodes in the level
int _LevelsNumber ;
int _ThreadsMax ;
- int _GraphsNumber ;
vector<int > _NodesNumber ;
vector<vector<ComputingNode *> > _SortedNodes ;
vector<ComputingNode *> _QueueNodes ;
bool _ParallelExecutionNodes ;
+// 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 , GraphBase::Service * > _MapOfServiceNames ;
+
+// Total number of SubGraphs
+ int _SubGraphsNumber ;
+// _SubGraphs[ SubGraphNumero ] [ NodeNumero ]
+// SubGraphNumero : [ 0 , _SubGraphsSize [ ; NodeNumero : [ 0 , _SubGraphs[ SubGraphNumero ].size() [
+ int _SubGraphsSize ;
+ vector<vector<ComputingNode *> > _SubGraphs ;
+
+// _SubStreamGraphs[ SubStreamGraphNumero ] [ NodeNumero ]
+// SubStreamGraphNumero : [ 0 , _SubStreamGraphsSize [
+// NodeNumero : [ 0 , _SubStreamGraphs[ SubStreamGraphNumero ].size() [
+// int _SubStreamGraphsSize ;
+// vector<vector<ComputingNode *> > _SubStreamGraphs ;
+
bool AddLink( GraphBase::ComputingNode *fromNode ,
GraphBase::OutPort *fromPort ,
GraphBase::ComputingNode *toNode ,
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 ,
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 ) {
} ;
void DelGraphNodeIndex( const char *name ) {
_MapOfGraphNodes.erase( name ) ; } ;
+
const GraphBase::ComputingNode * GetGraphNode( const int index ) const {
const ComputingNode * aNode = GetChangeGraphNode( index ) ;
return aNode ; } ;
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 GraphBase::PortsOfNode::GetInPort( ToServiceParameterName ) ; } ;
+ GraphBase::InPort * GetChangeInPort( const char * ToServiceParameterName ) {
+ return GraphBase::PortsOfNode::GetChangeInPort( ToServiceParameterName ) ; } ;
+ const GraphBase::OutPort * GetOutPort( const char * FromServiceParameterName ) {
+ return GraphBase::PortsOfNode::GetOutPort( FromServiceParameterName ) ; } ;
+ GraphBase::OutPort * GetChangeOutPort( const char * FromServiceParameterName ) {
+ return GraphBase::PortsOfNode::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 ; } ;
+ 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 ) {
+ GraphBase::OutPort * GetChangeOutPort( const char * FromNodeName ,
+ const char * FromServiceParameterName ) {
ComputingNode * aNode = GetChangeGraphNode( FromNodeName ) ;
if ( aNode ) {
return aNode->GetChangeOutPort( FromServiceParameterName );
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 ) ;
bool CreateService() ;
bool InLineServices() ;
- bool Sort() ;
+ bool Sort( int & SubStreamGraphsNumber ) ;
bool ComputingNodes() const ;
bool LinkLoopNodes(bool & NewLink ) ;
bool DataServerNodes() const ;
long LevelMax() {
return _LevelsNumber + 1 ; } ;
+
+ map< string , GraphBase::Service * > MapOfServiceNames() ;
+ GraphBase::Service * GetServiceOfMap( char * name ) ;
+ bool SetServiceOfMap( GraphBase::Service * aService ) ;
+ int GetServiceNameNumber( SALOME_ModuleCatalog::Service aService ) ;
+
SUPERV::ListOfStrings * LevelNodes(long aLevel ) ;
long ThreadsMax() {
return _ThreadsMax ; } ;
- long GraphsNumber() {
- return _GraphsNumber ; } ;
+
+ long SubGraphsNumber() {
+ return _SubGraphsNumber ; } ;
int NodesNumber(const int aLevel ) {
return _NodesNumber[ aLevel ] ; } ;
--- /dev/null
+// 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;
+}
+
--- /dev/null
+// 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
+
+
+
+
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 ,
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() {
<< "type : " << P.PortType() << ", " ;
f << "from "
<< P.NodeName() << ", ";
+ f << "kind "
+ << P.Kind() << ", ";
return f;
}
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() {
--- /dev/null
+// 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 ;
+}
+
--- /dev/null
+// 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
+
+
+
+
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() {
case SUPERV::GOTOParameter :
f << "GOTOParameter";
break;
+ case SUPERV::DataStreamParameter :
+ f << "DataStreamParameter";
+ break;
default :
f << "UnknownKindOfPort";
break;
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 << "DATASTREAM_?";
+ break;
+ }
+
+ return f;
+}
+
class Port : public ServicesParameter {
- const char *const * _NodeName ;
- SUPERV::Port_var _Port ;
- SUPERV::KindOfPort _KindOfPort ;
+ private:
- vector<long > _X ;
- vector<long > _Y ;
+ const char *const * _NodeName ;
+ SUPERV::Port_var _Port ;
+ SUPERV::KindOfPort _KindOfPort ;
+
+ vector<long > _X ;
+ vector<long > _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 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 ;
} ;
ostream & operator<< (ostream &,const SUPERV::KindOfPort &);
+ostream & operator<< (ostream &,const SALOME_ModuleCatalog::DataStreamDependency &);
+
#endif
// cdebug << "GraphBase::PortsOfNode::PortsOfNode " << this << endl ;
_NodeInPortsSize = 0 ;
_NodeOutPortsSize = 0 ;
+ _DataStreamInPortsNumber = 0 ;
+ _DataStreamOutPortsNumber = 0 ;
}
GraphBase::PortsOfNode::PortsOfNode( const char *DataFlowName ) :
// cdebug << "GraphBase::PortsOfNode::PortsOfNode " << this << endl ;
_NodeInPortsSize = 0 ;
_NodeOutPortsSize = 0 ;
+ _DataStreamInPortsNumber = 0 ;
+ _DataStreamOutPortsNumber = 0 ;
}
GraphBase::PortsOfNode::~PortsOfNode() {
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) ||
- (aKind == SUPERV::InLineNode) || (aKind == SUPERV::LoopNode) ||
- (aKind == SUPERV::SwitchNode) || (aKind == SUPERV::EndSwitchNode) ||
- (aKind == SUPERV::GOTONode) ;
+ 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) ||
- (aKind == SUPERV::InLineNode) || (aKind == SUPERV::SwitchNode) ||
- (aKind == SUPERV::GOTONode) ;
+ 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 ;
if ( aKind == SUPERV::InLineNode ) {
aPortKind = SUPERV::InLineParameter ;
const char *aParametername = _aParametername.c_str() ;
if ( _MapOfNodeInPorts[ aParametername ] ) {
if ( !DataFlowOrComputing &&
- !strcmp( aParametername , "InGate" ) ) {
+ !strcmp( aParametername , "Gate" ) ) {
}
else {
cdebug << "Error, Parametername duplicated : " << aParametername
SALOME_ModuleCatalog::ServicesParameter anInGateParameter ;
_NodeInPortsSize = _NodeInPortsSize + 1 ;
iVec += 1 ;
- char *aParametername = "InGate" ;
+ char *aParametername = "Gate" ;
if ( aKind == SUPERV::EndSwitchNode ) {
aParametername = "Default" ;
}
const char *aParametername = _aParametername.c_str() ;
if ( _MapOfNodeOutPorts[ aParametername ] ) {
if ( !DataFlowOrComputing &&
- !strcmp( aParametername , "OutGate" ) ) {
+ !strcmp( aParametername , "Gate" ) ) {
}
else {
cdebug << "Error, Parametername duplicated : " << aParametername
}
}
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 );
SALOME_ModuleCatalog::ServicesParameter anOutGateParameter ;
_NodeOutPortsSize = _NodeOutPortsSize + 1 ;
iVec += 1 ;
- char *aParametername = "OutGate" ;
+ char *aParametername = "Gate" ;
if ( aKind == SUPERV::SwitchNode ) {
aParametername = "Default" ;
}
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 ;
- if ( aKind == SUPERV::InLineNode || aKind == SUPERV::LoopNode ||
- aKind == SUPERV::EndLoopNode || aKind == SUPERV::SwitchNode ||
- aKind == SUPERV::EndSwitchNode || aKind == SUPERV::GOTONode ) {
- SUPERV::KindOfPort aPortKind = SUPERV::InLineParameter ;
- if ( aKind == SUPERV::EndSwitchNode ) {
- aPortKind = SUPERV::EndSwitchParameter ;
- }
- anInPort = GetChangeInPort( InputParameterName ) ;
- if ( anInPort == NULL ) {
- _NodeInPortsSize = _NodeInPortsSize + 1 ;
- _NodeInPorts.resize(_NodeInPortsSize);
- SALOME_ModuleCatalog::ServicesParameter aServiceParameter ;
- aServiceParameter.Parametername = InputParameterName ;
- aServiceParameter.Parametertype = InputParameterType ;
- SUPERV::KindOfPort aPortKind = SUPERV::ServiceParameter ;
- 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 ) ;
-// MESSAGE( "GraphBase::PortsOfNode::DefPortsOfNode " << InputParameterName << " --> SetDebug" ) ;
- _NodeInPorts[_NodeInPortsSize-2]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
- anInPort = _NodeInPorts[_NodeInPortsSize-2] ;
- cdebug << "NodeInPorts[ " << _NodeInPortsSize-2 << " ]" << endl ;
+ int index = 0 ;
+ anInPort = GetChangeInPort( InputParameterName ) ;
+ if ( anInPort == NULL ) {
+ _NodeInPortsSize = _NodeInPortsSize + 1 ;
+ _NodeInPorts.resize(_NodeInPortsSize);
+ SALOME_ModuleCatalog::ServicesParameter aServiceParameter ;
+ 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 {
- _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" ) ;
- _NodeInPorts[_NodeInPortsSize-1]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
- anInPort = _NodeInPorts[_NodeInPortsSize-1] ;
- cdebug << "NodeInPorts[ " << _NodeInPortsSize-1 << " ]" << endl ;
+ _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 {
- cdebug << "InPort already exists" << endl ;
+// else { // EndLoopNode
+// _MapOfNodeInPorts[ InputParameterName ] = _NodeInPortsSize-1 + 1 ;
+// _NodeInPorts[_NodeInPortsSize-1] = new GraphBase::InPort( NodeName ,
+// aServiceParameter ,//
+// 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 << "GraphBase::PortsOfNode::AddInPort InPort already exists" << endl ;
+ anInPort->Kind( aKindOfPort ) ;
+ }
+ 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 << "DefPortsOfNode::AddInPort _NodeInPortsSize " << _NodeInPortsSize
+ 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 ;
- if ( aKind == SUPERV::InLineNode || aKind == SUPERV::LoopNode ||
- aKind == SUPERV::EndLoopNode || aKind == SUPERV::SwitchNode ||
- aKind == SUPERV::EndSwitchNode || aKind == SUPERV::GOTONode ) {
- SUPERV::KindOfPort aPortKind = SUPERV::InLineParameter ;
- 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::SwitchNode ) {
- _NodeOutPorts[ _NodeOutPortsSize-1 ] = _NodeOutPorts[ _NodeOutPortsSize-2 ] ; // 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 << "NodeInPorts[ " << _NodeInPortsSize-2 << " ]" << endl ;
- }
- else {
- _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 << "NodeInPorts[ " << _NodeInPortsSize-1 << " ]" << endl ;
- }
+ int index = 0 ;
+ anOutPort = GetChangeOutPort( OutputParameterName ) ;
+ if ( anOutPort == NULL ) {
+ _NodeOutPortsSize = _NodeOutPortsSize + 1 ;
+ _NodeOutPorts.resize(_NodeOutPortsSize);
+ SALOME_ModuleCatalog::ServicesParameter aServiceParameter ;
+ 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 {
- cdebug << "OutPort already exists" << endl ;
+ _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 << "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 ;
}
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 ;
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 ;
}
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;
}
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";
#include "DataFlowBase_Service.hxx"
-#include "DataFlowBase_InPort.hxx"
-#include "DataFlowBase_OutPort.hxx"
+#include "DataFlowBase_InDataStreamPort.hxx"
+#include "DataFlowBase_OutDataStreamPort.hxx"
namespace GraphBase {
int _NodeOutPortsSize ;
vector<OutPort *> _NodeOutPorts;
+ int _DataStreamInPortsNumber ;
+ int _DataStreamOutPortsNumber ;
+
public:
PortsOfNode() ;
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 ) ;
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 ,
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] ; } ;
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 ;
};
#include "DataFlowBase_Service.hxx"
void GraphBase::Service::SetService( const SALOME_ModuleCatalog::Service aService ) {
+
_Service.ServiceName = CORBA::string_dup( aService.ServiceName ) ;
_Service.ServiceinParameter.length( aService.ServiceinParameter.length() ) ;
_Service.ServiceoutParameter.length( aService.ServiceoutParameter.length() ) ;
_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 ;
}
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;
}
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 ; } ; } ;
} ;
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 ; } ;
} ;
--- /dev/null
+// 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 = 300 ;
+ _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 = 300 ;
+ _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 ;
+}
+
+bool GraphBase::StreamGraph::CreateStreamTopology( const char * aDirectory ) {
+ cdebug_in << "GraphBase::StreamGraph::CreateStreamTopology()" << endl;
+ int istream ;
+ for ( istream = 1 ; istream <= SubStreamGraphsNumber() ; istream++ ) {
+ ostringstream astr ;
+ astr << istream << ends ;
+ string filename = string( Name() ) + string( "_" ) + astr.str().c_str() ;
+ string fullfilename = aDirectory + filename + ".cpl" ;
+ ofstream f( fullfilename.c_str() ) ;
+ f << "DEBUT " << filename << endl ;
+ f << " TIMEOUT " << _Timeout << endl ;
+ f << " TRACE " << KindOfDataStreamTraceToString( _DataStreamTrace ) << endl ;
+ f << " DELTAT " << _DeltaTime << endl ;
+ f << endl ;
+ f << endl ;
+ f << "# Liste des codes" << endl ;
+ f << endl ;
+ map< string , GraphBase::Service * > aMapOfServiceNames = MapOfServiceNames() ;
+ map< string , GraphBase::Service * >::iterator aMapOfServiceNamesIterator ;
+ for ( aMapOfServiceNamesIterator = aMapOfServiceNames.begin() ;
+ aMapOfServiceNamesIterator != aMapOfServiceNames.end() ; aMapOfServiceNamesIterator++ ) {
+ GraphBase::Service * aService = aMapOfServiceNamesIterator->second ;
+ int n ;
+ for ( n = 0 ; n < GraphNodesSize() ; n++ ) {
+ if ( GetGraphNode( n )->HasDataStream() && GetChangeGraphNode( n )->SubStreamGraph() == istream ) {
+ if ( !strcmp( aService->ServiceName() , GetGraphNode( n )->ServiceName() ) ) {
+ f << " CODE " << aService->ServiceName() << endl ;
+ unsigned int j ;
+ cdebug << "CreateStreamTopology " << aService->ServiceName() << " InStreamParameter("
+ << aService->ServiceInStreamParameter().length() << ") OutStreamParameter("
+ << aService->ServiceOutStreamParameter().length() << ")" << endl ;
+ cdebug << aService->GetService() << endl ;
+ for ( j = 0 ; j < aService->ServiceInStreamParameter().length() ; j++ ) {
+ f << " " << aService->ServiceInStreamParameter()[ j ].Parametername << " "
+ << DataStreamDependencyToString( aService->ServiceInStreamParameter()[ j ].Parameterdependency ) << " IN "
+ << DataStreamToString( aService->ServiceInStreamParameter()[ j ].Parametertype ) << endl ;
+ }
+ for ( j = 0 ; j < aService->ServiceOutStreamParameter().length() ; j++ ) {
+ f << " " << aService->ServiceOutStreamParameter()[ j ].Parametername << " "
+ << DataStreamDependencyToString( aService->ServiceOutStreamParameter()[ j ].Parameterdependency ) << " OUT "
+ << DataStreamToString( aService->ServiceOutStreamParameter()[ j ].Parametertype ) << endl ;
+ }
+ f << " FIN #" << aService->ServiceName() << endl ;
+ f << endl ;
+ f << endl ;
+ break ;
+ }
+ }
+ }
+ }
+ f << endl ;
+ f << endl ;
+ f << "# Liste des instances" << endl ;
+ int j ;
+ for ( j = 0 ; j < GraphNodesSize() ; j++ ) {
+ if ( GetGraphNode( j )->HasDataStream() && GetChangeGraphNode( j )->SubStreamGraph() == istream ) {
+ f << endl ;
+ f << " INSTANCE " << GetGraphNode( j )->Name() << endl ;
+ f << " CODE " << GetGraphNode( j )->ServiceName() << endl ;
+ f << " EXEC \"" << GetGraphNode( j )->ServiceName() << "\"" << endl ;
+ f << " FIN" << endl ;
+ }
+ }
+ f << endl ;
+ f << endl ;
+ f << endl ;
+ f << endl ;
+ f << endl ;
+ f << "# Liste des liens" << endl ;
+ f << endl ;
+ f << " LIEN" << endl ;
+ for ( j = 0 ; j < GraphNodesSize() ; j++ ) {
+ if ( GetGraphNode( j )->HasDataStream() && GetChangeGraphNode( j )->SubStreamGraph() == istream ) {
+ int k ;
+ for ( k = 0 ; k < GetGraphNode( j )->GetNodeOutPortsSize() ; k++ ) {
+ if ( GetGraphNode( j )->GetNodeOutPort( k )->IsDataStream() ) {
+ long aNumberOfValues = ((GraphBase::OutDataStreamPort *) GetGraphNode( j )->GetNodeOutPort( k ))->NumberOfValues() ;
+ int n ;
+ for ( n = 0 ; n < GetGraphNode( j )->GetNodeOutPort( k )->InPortsSize() ; n++ ) {
+ SUPERV::KindOfSchema aKindOfSchema ;
+ SUPERV::KindOfInterpolation aKindOfInterpolation ;
+ SUPERV::KindOfExtrapolation aKindOfExtrapolation ;
+ ((GraphBase::InDataStreamPort *) GetGraphNode( j )->GetNodeOutPort( k )->InPorts( n ))->Params( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ;
+ f << " " << GetGraphNode( j )->Name() << "."
+ << GetGraphNode( j )->GetNodeOutPort( k )->PortName() ;
+ if ( aNumberOfValues != 0 ) {
+ f << " NIVEAU " << aNumberOfValues ;
+ }
+ f << " => "
+ << GetGraphNode( j )->GetNodeOutPort( k )->InPorts( n )->NodeName() << "."
+ << GetGraphNode( j )->GetNodeOutPort( k )->InPorts( n )->PortName()
+ << " " << aKindOfSchema << " " << aKindOfInterpolation ;
+ if ( aKindOfExtrapolation != SUPERV::EXTRANULL ) {
+ f << " " << aKindOfExtrapolation ;
+ }
+ f << " ;" << endl ;
+ }
+ }
+ }
+ }
+ }
+ f << " FIN" << endl ;
+ f << endl ;
+ f << "FIN" << endl ;
+ }
+ cdebug_out << "GraphBase::StreamGraph::CreateStreamTopology()" << endl;
+ return true ;
+}
+
+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;
+}
+
+
--- /dev/null
+// 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 ;
+
+// Total number of SubStreamGraphs
+ int _SubStreamGraphsNumber ;
+
+ protected:
+
+ public:
+
+ StreamGraph() ;
+
+ StreamGraph( CORBA::ORB_ptr ORB ,
+ SALOME_NamingService* ptrNamingService ,
+ const char * DataFlowName ,
+ int * Graph_prof_debug ,
+ ofstream * Graph_fdebug ) ;
+
+ 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 ) ;
+
+ ~StreamGraph() ;
+
+ bool SetStreamParams( const long Timeout ,
+ const SUPERV::KindOfDataStreamTrace DataStreamTrace ,
+ const double DeltaTime ) ;
+ void StreamParams( long & Timeout ,
+ SUPERV::KindOfDataStreamTrace & DataStreamTrace ,
+ double & DeltaTime ) const ;
+
+ bool CreateStreamTopology( const char * aDirectory ) ;
+
+ void SubStreamGraphsNumber( int SubStreamGraphsNumber ) {
+ _SubStreamGraphsNumber = SubStreamGraphsNumber ; } ;
+ long SubStreamGraphsNumber() const {
+ return _SubStreamGraphsNumber ; } ;
+
+ };
+
+};
+
+ostream & operator<< (ostream &,const SUPERV::KindOfDataStreamTrace &);
+
+#endif
--- /dev/null
+// 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 ;
+ _LinkedStreamNodesSize = 0 ;
+ _HeadNode = false ;
+ _SubGraphNumber = 0 ;
+ _SubStreamGraphNumber = 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 ;
+ _LinkedStreamNodesSize = 0 ;
+ _HeadNode = false ;
+ _SubGraphNumber = 0 ;
+ _SubStreamGraphNumber = 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::SetSubStreamGraph( int SubStreamGraphsNumber , int & RetVal ) {
+ int jnode ;
+ cdebug_in << Name() << " GraphBase::StreamNode::SetSubStreamGraph Level "<< Level() << " SortedIndex "
+ << SortedIndex() << " SubStreamGraphsNumber " << SubStreamGraphsNumber << " RetVal " << RetVal
+ << endl ;
+ if ( SubStreamGraph() == 0 || SubStreamGraph() == SubStreamGraphsNumber ) {
+ SubStreamGraph( SubStreamGraphsNumber ) ;
+ cdebug << Name() << " SubStreamGraph " << SubStreamGraph() << " SetSubStreamGraph LinkedStreamNodesSize "
+ << LinkedStreamNodesSize() << endl ;
+ for ( jnode = 0 ; jnode < LinkedStreamNodesSize() ; jnode++ ) {
+ if ( LinkedStreamNodes( jnode )->Level() > Level() ||
+ ( LinkedStreamNodes( jnode )->Level() == Level() &&
+ LinkedStreamNodes( jnode )->SortedIndex() > SortedIndex() ) ) {
+ LinkedStreamNodes( jnode )->SetSubStreamGraph( SubStreamGraphsNumber , RetVal ) ;
+ if ( RetVal != SubStreamGraphsNumber ) {
+ break ;
+ }
+ }
+ else if ( LinkedStreamNodes( jnode )->SubStreamGraph() == 0 ) {
+ LinkedStreamNodes( jnode )->SubStreamGraph( SubStreamGraphsNumber ) ;
+ cdebug << LinkedStreamNodes( jnode )->Name() << " SubStreamGraph "
+ << LinkedStreamNodes( jnode )->SubStreamGraph() << endl ;
+ }
+ else if ( LinkedStreamNodes( jnode )->SubStreamGraph() != SubStreamGraphsNumber ) {
+ cdebug << LinkedStreamNodes( jnode )->Name() << " SubStreamGraph "
+ << LinkedStreamNodes( jnode )->SubStreamGraph() << " != " << SubStreamGraphsNumber << endl ;
+ RetVal = LinkedStreamNodes( jnode )->SubStreamGraph() ;
+ break ;
+ }
+ }
+ }
+ else {
+ cdebug << Name() << " SubStreamGraph " << SubStreamGraph() << " != " << SubStreamGraphsNumber << endl ;
+ RetVal = SubStreamGraph() ;
+ }
+
+ cdebug_out << Name() << "->GraphBase::StreamNode::SetSubStreamGraph RetVal " << RetVal << endl ;
+ return ;
+}
+
+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 ;
+}
+
+void GraphBase::StreamNode::AddStreamLink( GraphBase::StreamNode * ToNode ) {
+ int index = GetLinkedStreamNodeIndex( ToNode->Name() ) ;
+ if ( index < 0 ) {
+ cdebug_in << Name() << "->GraphBase::StreamNode::AddStreamLink( " << ToNode->Name()
+ << " ) new LinkedNode " << endl ;
+ _LinkedStreamNodes.resize( _LinkedStreamNodesSize+1 ) ;
+ _LinkedInStreamPortsNumber.resize( _LinkedStreamNodesSize+1 ) ;
+ _LinkedStreamNodes[ _LinkedStreamNodesSize ] = ToNode ;
+ _LinkedInStreamPortsNumber[ _LinkedStreamNodesSize ] = 1 ;
+ SetLinkedStreamNodeIndex( ToNode->Name() , _LinkedStreamNodesSize ) ;
+ index = _LinkedStreamNodesSize ;
+ _LinkedStreamNodesSize++ ;
+ }
+ else {
+ cdebug_in << Name() << "->GraphBase::StreamNode::AddStreamLink( " << ToNode->Name()
+ << " ) old LinkedNode " << _LinkedStreamNodes[index ]->Name() << endl ;
+ _LinkedInStreamPortsNumber[ index ] += 1 ;
+ }
+ cdebug_out << Name() << "->GraphBase::StreamNode::AddStreamLinkedNode( " << ToNode->Name()
+ << " ) LinkedStreamNodesSize " << _LinkedStreamNodesSize << " [ " << index
+ << " ] _LinkedInStreamPortsNumber " << _LinkedInStreamPortsNumber[ index ] << endl ;
+}
+
+bool GraphBase::StreamNode::RemoveStreamLink( GraphBase::StreamNode * ToNode ) {
+ int index = GetLinkedStreamNodeIndex( ToNode->Name() ) ;
+ if ( index >= 0 ) {
+ cdebug << "GraphBase::StreamNode::RemoveStreamLink( to " << ToNode->Name() << " from "
+ << Name() << " index : " << index << " LinkedInStreamPortsNumber "
+ << _LinkedInStreamPortsNumber[ index ] << " - 1" << endl ;
+ _LinkedInStreamPortsNumber[ index ] -= 1 ;
+ if ( _LinkedInStreamPortsNumber[ index ] == 0 ) {
+ _LinkedStreamNodesSize-- ;
+ cdebug << "GraphBase::StreamNode::RemoveStreamLink new LinkedNodesSize "
+ << _LinkedStreamNodesSize << " " << ToNode->Name() << " removed from "
+ << " linkednodes of " << Name() << endl ;
+ int i ;
+ for ( i = index ; i < _LinkedStreamNodesSize ; i++ ) {
+ _LinkedStreamNodes[ i ] = _LinkedStreamNodes[ i+1 ] ;
+ _LinkedInStreamPortsNumber[ i ] = _LinkedInStreamPortsNumber[ i+1 ] ;
+ SetLinkedStreamNodeIndex( _LinkedStreamNodes[ i ]->Name() , i ) ;
+ }
+ DelLinkedStreamNodeIndex( ToNode->Name() ) ;
+ _LinkedStreamNodes.resize( _LinkedStreamNodesSize+1 ) ;
+ _LinkedInStreamPortsNumber.resize( _LinkedStreamNodesSize+1 ) ;
+ }
+ }
+ else {
+ cdebug << " Error index " << index << endl ;
+ }
+ return (index >= 0 ) ;
+}
+
+void GraphBase::StreamNode::ReNameStreamLink( const char* OldNodeName ,
+ const char* NewNodeName ) {
+ cdebug_in << "GraphBase::StreamNode::ReNameStreamLink (" << OldNodeName << " , "
+ << NewNodeName << ")" << endl;
+ int index = GetLinkedStreamNodeIndex( OldNodeName ) ;
+ if ( index >= 0 ) {
+// _MapOfLinkedNodes.erase( OldNodeName ) ;
+ DelLinkedStreamNodeIndex( OldNodeName ) ;
+ SetLinkedStreamNodeIndex( NewNodeName , index ) ;
+ }
+ cdebug_out << "GraphBase::StreamNode::ReNameStreamLink" << endl ;
+}
+
--- /dev/null
+// 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 ;
+
+// Nodes with LinkedInPortsNumber InPort(s) linked to Outport(s) of this node :
+ map< string , int > _MapOfLinkedNodes ;
+ int _LinkedNodesSize ;
+ vector<StreamNode * > _LinkedNodes ;
+ vector<int > _LinkedInPortsNumber ;
+
+// Nodes with InStreamPort(s) linked to OutStreamport(s) of this node :
+// NodeName <--> index of that linked node in _LinkedNodes
+ map< string , int > _MapOfLinkedStreamNodes ;
+ int _LinkedStreamNodesSize ;
+ vector<StreamNode * > _LinkedStreamNodes ;
+ vector<int > _LinkedInStreamPortsNumber ;
+
+ bool _HeadNode ;
+ int _LevelNumber ;
+ int _SortedIndex ;
+
+ int _SubGraphNumber ;
+ int _SubStreamGraphNumber ;
+
+ protected:
+
+ int * _Graph_prof_debug ;
+ ofstream * _Graph_fdebug ;
+
+ StreamNode() ;
+
+ StreamNode( const char * NodeName ) ;
+
+ StreamNode( int * Graph_prof_debug ,
+ ofstream * Graph_fdebug ) ;
+
+ virtual ~StreamNode() ;
+
+ public:
+
+ 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 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 ] ; } ;
+
+ int GetLinkedStreamNodeIndex( const char * name ) {
+ int index = _MapOfLinkedStreamNodes[ name ] -1 ;
+ if ( index >= 0 ) {
+ cdebug << "GetLinkedStreamNodeIndex of " << name
+ << " in _MapOfLinkedStreamNodes : "
+ << index << " Node " << hex << (void *) _LinkedStreamNodes[ index ]
+ << dec << " '" << _LinkedStreamNodes[ index ]->Name() << "'"
+ << endl ;
+ }
+ return index ; } ;
+ void SetLinkedStreamNodeIndex( const char * name , const int index ) {
+ _MapOfLinkedStreamNodes[ name ] = index +1 ;
+ cdebug << "SetLinkedStreamNodeIndex of " << name << " in _MapOfLinkedStreamNodes : "
+ << index << " Node " << hex << (void *) _LinkedStreamNodes[ index ]
+ << dec << " '" << _LinkedStreamNodes[ index ]->Name() << "'"
+ << " _MapOfLinkedStreamNodes " << _MapOfLinkedStreamNodes[ name ] - 1
+ << endl ;
+ } ;
+ void DelLinkedStreamNodeIndex( const char * name ) {
+ _MapOfLinkedStreamNodes.erase( name ) ; } ;
+
+ int LinkedStreamNodesSize() const { return _LinkedStreamNodesSize ; } ;
+
+ const int LinkedInStreamPortsNumber( int i ) const { return _LinkedInStreamPortsNumber[ i ] ; } ;
+
+ StreamNode * LinkedStreamNodes( int i ) const { return _LinkedStreamNodes[ i ] ; } ;
+
+ void HeadNode( bool aHeadNode ) { _HeadNode = aHeadNode ; } ;
+ const bool IsHeadNode() const { return _HeadNode ; } ;
+
+ int Level() { return _LevelNumber ; } ;
+ void Level( int LevelNumber ) {
+ _LevelNumber = LevelNumber ; } ;
+
+ void SortedIndex( int aSortedIndex ) {
+ _SortedIndex = aSortedIndex ; } ;
+ int SortedIndex() const {
+ return _SortedIndex ; } ;
+
+ void SetSubStreamGraph( int SubStreamGraphsNumber , int & RetVal ) ;
+
+ int SubGraph() { return _SubGraphNumber ; } ;
+ void SubGraph( int SubGraphNumber ) {
+ _SubGraphNumber = SubGraphNumber ; } ;
+
+ int SubStreamGraph() { return _SubStreamGraphNumber ; } ;
+ void SubStreamGraph( int SubStreamGraphNumber ) {
+ _SubStreamGraphNumber = SubStreamGraphNumber ; } ;
+
+ void AddLink( StreamNode * aNode ) ;
+ bool RemoveLink( StreamNode * aNode ) ;
+ void ReNameLink( const char* OldNodeName ,
+ const char* NewNodeName ) ;
+
+ void AddStreamLink( StreamNode * aNode ) ;
+ bool RemoveStreamLink( StreamNode * aNode ) ;
+ void ReNameStreamLink( const char* OldNodeName ,
+ const char* NewNodeName ) ;
+
+ };
+
+};
+
+#endif
depth -= 1 ;
#if TRACE
- MESSAGE( " ==========endElement step[" << depth << "]="
+ MESSAGE( " ====================endElement step[" << depth << "]="
<< step[depth] << " qName " << qName << " fieldvalue '"
<< fieldvalue[depth] << "'")
#endif
step[3] = 0 ;
aNode.theService.ServiceinParameter.length( 0 ) ;
aNode.theService.ServiceoutParameter.length( 0 ) ;
- aNode.theListOfParameters.resize( 0 ) ;
+ aNode.theListOfInDataStreams.resize( 0 ) ;
+ aNode.theListOfOutDataStreams.resize( 0 ) ;
aNode.theListOfFuncName.resize( 0 ) ;
aNode.theListOfPythonFunctions.resize( 0 ) ;
break ;
// 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 )
return returnfalse( this , "depth3-5" , qName ) ;
break ;
case 6 :
- if ( qName == "Parameter-list" ) {
+ if ( qName == "DataStream-list" || qName == "Parameter-list" ) {
if ( fieldvalue[depth] != NULLSTRING )
return returnfalse( this , "depth3-6" , qName ) ;
fieldvalue[depth] = NULLSTRING ;
if ( qName == "inParameter" ) {
if ( fieldvalue[depth] != NULLSTRING )
return returnfalse( this , "depth4-6" , qName ) ;
- int size = aNode.theListOfParameters.size() ;
- aNode.theListOfParameters.resize( size+1 ) ;
- aNode.theListOfParameters[size].theInParameter = aParameter ;
- step[depth]++ ;
+ int size = aNode.theListOfInDataStreams.size() ;
+ aNode.theListOfInDataStreams.resize( size+1 ) ;
+ aNode.theListOfInDataStreams[ size ] = anInDataStreamParameter ;
+ break ;
// One more aParameter input
}
else
- return returnfalse( this , "depth4-6" , qName ) ;
- break ;
+ step[depth]++ ;
+// return returnfalse( this , "depth4-6" , qName ) ;
+// break ;
case 7 :
if ( qName == "outParameter" ) {
if ( fieldvalue[depth] != NULLSTRING )
return returnfalse( this , "depth4-7" , qName ) ;
- int size = aNode.theListOfParameters.size() ;
- aNode.theListOfParameters[size-1].theOutParameter = aParameter ;
+ int size = aNode.theListOfOutDataStreams.size() ;
+ aNode.theListOfOutDataStreams.resize( size+1 ) ;
+ aNode.theListOfOutDataStreams[ size ] = anOutDataStreamParameter ;
// One more aParameter output
step[4] = 6 ;
step[5] = 4 ;
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
- return returnfalse( this , "depth5-4" , qName ) ;
- break ;
+ step[depth] = 6 ;
+// return returnfalse( this , "depth5-4" , qName ) ;
+// break ;
case 5 :
if ( qName == "inParameter-name" ) {
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 ;
- step[depth]++ ;
+#if TRACE
+ cout << "InDataStreamParameter.inParameter-name " << anInDataStreamParameter.theDataStreamParameter.Parametername << " step[" << depth << "]" << step[depth] << endl ;
+#endif
+// step[depth]++ ;
+// step[depth] = 4 ;
+ break ;
}
- else
- return returnfalse( this , "depth5-5" , qName ) ;
- 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
+// return returnfalse( this , "depth5-5" , qName ) ;
+// break ;
case 6 :
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 ) ;
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 ;
- step[depth]++ ;
+#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 ) ;
}
}
+#if TRACE
+ cout << "return from endElement " << qName << " step[" << depth << "]" << step[depth] << endl ;
+#endif
return TRUE;
}
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 ;
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 \
DataFlowBase_EndOfSwitchNode.hxx \
DataFlowBase_DataNode.hxx \
DataFlowBase_XmlHandler.hxx \
+ DataFlowBase_StreamGraph.hxx \
DataFlowBase_Graph.hxx
# Libraries targets
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 \
DataFlowBase_DataNode.cxx \
DataFlowBase_XmlHandler.cxx \
DataFlowBase_LoadXml.cxx \
+ DataFlowBase_StreamGraph.cxx \
DataFlowBase_Graph.cxx
LIB_CLIENT_IDL = Logger.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@
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 ) {
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 ,
long LevelMax() ;
SUPERV::ListOfStrings * LevelNodes(long aLevel ) ;
long ThreadsMax() ;
- long GraphsNumber() ;
+ long SubGraphsNumber() ;
+ long SubStreamGraphsNumber() ;
void Executor(GraphExecutor::DataFlow * DataFlowExecutor ) ;
GraphExecutor::DataFlow * GraphEditor::DataFlow::Executor() const ;
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() );
// 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(
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 ;
}
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 ,
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(
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 ,
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::SubGraphsNumber() {
+ if ( !IsValid() ) {
+ return 0 ;
+ }
+ return Graph()->SubGraphsNumber() ;
}
-inline long GraphEditor::DataFlow::GraphsNumber() {
+inline long GraphEditor::DataFlow::SubStreamGraphsNumber() {
if ( !IsValid() ) {
return 0 ;
}
- return GraphBase::Graph::GraphsNumber() ;
+ return StreamGraph()->SubStreamGraphsNumber() ;
}
inline void GraphEditor::DataFlow::Executor(
_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 ;
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 {
return _ComputingNode->GetInfo() ; } ;
GraphBase::InPort * AddInPort( const char * InputParameterName ,
- const char * InputParameterType ) {
- return _InLineNode->AddInPort( InputParameterName ,
- InputParameterType ) ; } ;
+ const char * InputParameterType ,
+ const SUPERV::KindOfPort aKindOfPort ) {
+ return _ComputingNode->AddInPort( InputParameterName ,
+ InputParameterType ,
+ aKindOfPort ) ; } ;
GraphBase::OutPort * AddOutPort( const char * OutputParameterName ,
- const char * OutputParameterType ) {
- return _InLineNode->AddOutPort( OutputParameterName ,
- OutputParameterType ) ; } ;
+ const char * OutputParameterType ,
+ const SUPERV::KindOfPort aKindOfPort ) {
+ return _ComputingNode->AddOutPort( OutputParameterName ,
+ OutputParameterType ,
+ aKindOfPort ) ; } ;
+ int IncrDataStreamInPorts() {
+ return _ComputingNode->IncrDataStreamInPorts() ;
+ } ;
+ int IncrDataStreamOutPorts() {
+ return _ComputingNode->IncrDataStreamOutPorts() ;
+ } ;
void DelInPort( const char * InputParameterName ) {
- _InLineNode->DelInPort( InputParameterName ) ; } ;
+ _ComputingNode->DelInPort( InputParameterName ) ; } ;
void DelOutPort( const char * OutputParameterName ) {
- _InLineNode->DelOutPort( OutputParameterName ) ; } ;
+ _ComputingNode->DelOutPort( OutputParameterName ) ; } ;
bool IsLinked(const char * ToServiceParameterName ) {
return _ComputingNode->IsLinked( ToServiceParameterName ) ; } ;
int SubGraph() {
return _ComputingNode->SubGraph() ; } ;
+ int SubStreamGraph() {
+ return _ComputingNode->SubStreamGraph() ; } ;
char * ComponentName() const {
return _FactoryNode->ComponentName() ; } ;
// Implementation de la classe GraphEditor::Graph
-GraphEditor::OutNode::OutNode() :
- Graph() {
+GraphEditor::OutNode::OutNode() {
+// Graph() {
cdebug_in << "GraphEditor::OutNode::OutNode()" << endl;
_Imported = false ;
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 ;
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 ;
// 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 ( Graph()->IsDataStreamNode() || aDataFlow->Info.theKind == SUPERV::DataFlowGraph ) {
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 ;
}
_Imported = true ;
RetVal = true ;
}
- else if ( GraphBase::Graph::LoadXml( _Orb , myFileName , aDataFlow ) ) {
- cdebug_in << "GraphEditor::OutNode::LoadXml() " << endl;
+ else if ( Graph()->LoadXml( _Orb , myFileName , aDataFlow ) ) {
+ cdebug_in << "GraphEditor::OutNode::LoadXml() " << myFileName << endl;
RetVal = LoadDataFlow( &aDataFlow ) ;
cdebug_out << "GraphEditor::OutNode::LoadXml " << RetVal << endl;
}
}
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() ) ) {
- aNodeName = NULL ;
+ if ( Graph()->GetGraphNode( aNode.theName.c_str() ) ) {
+ aNodeName = NULLSTRING ;
+ }
+
+ aNode.theService.ServiceinDataStreamParameter.length( aNode.theListOfInDataStreams.size() ) ;
+ aNode.theService.ServiceoutDataStreamParameter.length( aNode.theListOfOutDataStreams.size() ) ;
+ unsigned int j ;
+ for ( j = 0 ; j < aNode.theListOfInDataStreams.size() ; j++ ) {
+ aNode.theService.ServiceinDataStreamParameter[ j ].Parametername = aNode.theListOfInDataStreams[ j ].theDataStreamParameter.Parametername ,
+ aNode.theService.ServiceinDataStreamParameter[ j ].Parametertype = aNode.theListOfInDataStreams[ j ].theDataStreamParameter.Parametertype ,
+ aNode.theService.ServiceinDataStreamParameter[ j ].Parameterdependency = aNode.theListOfInDataStreams[ j ].theDataStreamParameter.Parameterdependency ;
+ }
+ for ( j = 0 ; j < aNode.theListOfOutDataStreams.size() ; j++ ) {
+ aNode.theService.ServiceoutDataStreamParameter[ j ].Parametername = aNode.theListOfOutDataStreams[ j ].theDataStreamParameter.Parametername ,
+ aNode.theService.ServiceoutDataStreamParameter[ j ].Parametertype = aNode.theListOfOutDataStreams[ j ].theDataStreamParameter.Parametertype ,
+ aNode.theService.ServiceoutDataStreamParameter[ j ].Parameterdependency = aNode.theListOfOutDataStreams[ j ].theDataStreamParameter.Parameterdependency ;
}
+
anInNode = AddNode( aNode.theService ,
aNode.theListOfFuncName ,
aNode.theListOfPythonFunctions ,
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() ) {
*aNode.theListOfPythonFunctions[ 0 ] ) ;
}
}
+
+ for ( j = 0 ; j < aNode.theListOfInDataStreams.size() ; j++ ) {
+ GraphBase::InPort * anInPort ;
+ if ( anInNode->IsOneOfInLineNodes() ) {
+ anInPort = anInNode->ComputingNode()->AddInDataStreamPort( aNode.theListOfInDataStreams[ j ].theDataStreamParameter.Parametername ,
+ aNode.theListOfInDataStreams[ j ].theDataStreamParameter.Parametertype ,
+ aNode.theListOfInDataStreams[ j ].theDataStreamParameter.Parameterdependency ,
+ SUPERV::DataStreamParameter ) ;
+ }
+ else {
+ anInPort = anInNode->ComputingNode()->GetChangeInPort( aNode.theListOfInDataStreams[ j ].theDataStreamParameter.Parametername ) ;
+ }
+ ((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 ;
+ if ( anInNode->IsOneOfInLineNodes() ) {
+ anOutPort = anInNode->ComputingNode()->AddOutDataStreamPort( aNode.theListOfOutDataStreams[ j ].theDataStreamParameter.Parametername ,
+ aNode.theListOfOutDataStreams[ j ].theDataStreamParameter.Parametertype ,
+ aNode.theListOfOutDataStreams[ j ].theDataStreamParameter.Parameterdependency ,
+ SUPERV::DataStreamParameter ) ;
+ }
+ else {
+ anOutPort = anInNode->ComputingNode()->GetChangeOutPort( aNode.theListOfOutDataStreams[ j ].theDataStreamParameter.Parametername ) ;
+ }
+ ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues( aNode.theListOfOutDataStreams[ j ].theNumberOfValues ) ;
+ }
delete aNodetheName ;
if ( !anInNode ) {
return false ;
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 ;
cdebug << "LoadLinks " << aLinkFromNodeName->c_str() << "( "
<< aLink.FromServiceParameterName.c_str() << " ) --> "
<< aLinkToNodeName->c_str() << "( "
- << aLink.FromServiceParameterName.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() ) ;
+ << aLink.ToServiceParameterName.c_str() << " )" << endl ;
+ 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 ;
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 ;
}
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() ) ;
// << 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 )
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 ;
}
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(
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 == NULL ) {
+ theNodeName = NULLSTRING ;
+ }
if ( theNodeName != NULLSTRING && strlen( theNodeName ) ) {
- cdebug << theNodeName << " )" << endl;
+ cdebug << theNodeName << "' )" ;
}
else {
- cdebug << "NodeName[NULL] )" << endl;
+ cdebug << "NodeName[NULLSTRING]' )" ;
}
+ cdebug << " " << NodeKindOfNode << endl ;
char * RetVal = NULLSTRING ;
GraphEditor::InNode *Nd = NULL ;
char * aNodeName = NULL ;
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 ) ;
ostringstream astr ;
astr << num << ends ;
const char * n_instance = astr.str().c_str() ;
}
}
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 ,
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()->IsDataStreamNode() && ( Nd->IsComputingNode() || Nd->IsFactoryNode() ) ) {
+ unsigned int i ;
+ for ( i = 0 ; i < NodeService.ServiceinDataStreamParameter.length() ; i++ ) {
+ GraphBase::InDataStreamPort * aDataStreamPort ;
+ aDataStreamPort = Nd->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 = Nd->ComputingNode()->AddOutDataStreamPort(
+ my_strdup( NodeService.ServiceoutDataStreamParameter[i].Parametername ) ,
+ NodeService.ServiceoutDataStreamParameter[i].Parametertype ,
+ NodeService.ServiceoutDataStreamParameter[i].Parameterdependency ,
+ SUPERV::DataStreamParameter ) ;
+ }
+ }
+
+ if ( Graph()->AddNode( Nd->ComputingNode() ) ) {
DateModification() ;
RetVal = Nd->Name() ;
}
}
}
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;
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 ) ;
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 ) ;
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 ) ;
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 ) ;
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() ;
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 ) ;
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 ) ;
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 ) ;
cdebug_in << "GraphEditor::OutNode::Valid" << endl;
_Executable = false ;
- CreateService() ;
+ Graph()->CreateService() ;
- if ( !Sort() ) {
+ int SubStreamGraphsNumber = 0 ;
+ if ( !Graph()->Sort( SubStreamGraphsNumber ) ) {
cdebug << "This DataFlow is not valid." << endl ;
return false ;
}
-
+ if ( Graph()->IsDataStreamNode() ) {
+ StreamGraph()->SubStreamGraphsNumber( SubStreamGraphsNumber ) ;
+ }
// CreateService() ;
- InLineServices() ;
+ Graph()->InLineServices() ;
- ComputingNodes() ;
+ Graph()->ComputingNodes() ;
_Valid = true ;
bool GraphEditor::OutNode::Executable() {
cdebug_in << "GraphEditor::OutNode::Executable" << endl;
bool NewLink ;
- if ( LinkLoopNodes( NewLink ) ) {
+ if ( Graph()->LinkLoopNodes( NewLink ) ) {
if ( NewLink ) {
_Valid = false ;
}
if ( !IsValid() ) {
return false ;
}
- if ( DataServerNodes() )
+ if ( Graph()->DataServerNodes() )
_Executable = true ;
else {
cdebug << "This DataFlow is not executable." << endl ;
_Executable = false ;
}
+ if ( _Executable && Graph()->IsDataStreamNode() ) {
+ StreamGraph()->CreateStreamTopology( "/tmp/" ) ;
+ }
+
cdebug_out << "GraphEditor::OutNode::Executable" << endl;
return _Executable ;
}
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 ;
}
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 ;
}
bool GraphEditor::OutNode::LinkSaveXML( QDomDocument & Graph , QDomElement & link ,
GraphBase::SLink aLink ,
bool wdata ) const {
+ cdebug_in << "GraphEditor::OutNode::LinkSaveXML " << aLink.FromNodeName
+ << "(" << aLink.FromServiceParameterName << ") --> "
+ << aLink.ToNodeName << "(" << aLink.ToServiceParameterName << ")" << endl ;
QDomElement fromnodename = Graph.createElement( "fromnode-name" ) ;
QDomText aField ;
if ( strlen( aLink.FromNodeName.c_str() ) ) {
// f << Tabs << " </coord>" << endl ;
}
// f << Tabs << "</coord-list>" << endl ;
+ cdebug_out << "GraphEditor::OutNode::LinkSaveXML " << aLink.FromNodeName
+ << "(" << aLink.FromServiceParameterName << ") --> "
+ << aLink.ToNodeName << "(" << aLink.ToServiceParameterName << ")"
+ << endl ;
return true ;
}
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 ;
+// 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() ;
+ if ( ((GraphBase::Graph *) Graph())->GetChangeGraphNode( aLink.FromNodeName.c_str() )->GetChangeOutPort( aLink.FromServiceParameterName.c_str() )->IsDataStream() ) {
+ f << " = " << aGraphName << ".StreamLink( " ;
}
- 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 ;
+ else {
+ f << " = " << 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 ;
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 ;
}
}
//bool GraphEditor::OutNode::SaveXML(ostream & f ) {
-bool GraphEditor::OutNode::SaveXML(QDomDocument & Graph ) {
+bool GraphEditor::OutNode::SaveXML(QDomDocument & GraphQDom ) {
int i ;
// f << "<?xml version='1.0' encoding='us-ascii' ?>" << endl << endl ;
// f << "<!-- XML Dataflow -->" << endl << endl ;
// f << "<!-- Dataflow information -->" << endl ;
QString Dataflow("Dataflow") ;
- Graph = QDomDocument(Dataflow) ;
+ GraphQDom = QDomDocument(Dataflow) ;
// f << "<dataflow>" << endl ;
- QDomElement dataflow = Graph.createElement( "dataflow" ) ;
- Graph.appendChild( dataflow ) ;
+ QDomElement dataflow = GraphQDom.createElement( "dataflow" ) ;
+ GraphQDom.appendChild( dataflow ) ;
// f << " <info-list>" << endl ;
- QDomElement info = Graph.createElement( "info-list" ) ;
+ QDomElement info = GraphQDom.createElement( "info-list" ) ;
dataflow.appendChild( info ) ;
// f << " <node>" << endl ;
// GraphBase::DataNode::SaveXML( f , " " , 0 , 0 ) ;
- GraphBase::DataNode::SaveXML( Graph , info , 0 , 0 ) ;
+ Graph()->SaveXML( GraphQDom , info , 0 , 0 ) ;
// f << " </node>" << endl ;
// f << " </info-list>" << endl << endl ;
// f << " <node-list>" << 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 << " <node>" << 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 << " </node>" << endl ;
// }
// f << " </node-list>" << endl << endl ;
// f << " <link-list>" << 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 << " <link>" << 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 << " </link>" << endl ;
}
// f << " </link-list>" << endl << endl ;
// f << " <data-list>" << 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 << " <data>" << 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 << " </data>" << endl ;
}
//#if 0
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 ;
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 ;
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 ;
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 ;
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 ;
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"
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() ;
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() ;
break ;
}
}
- f << aNodeName << aPortName << " = " << aNodeName << ".Port( '"
+ f << "#O" << aNodeName << aPortName << " = " << aNodeName << ".GetOutPort( '"
<< aPortName << "' )" << endl ;
delete [] aNodeName ;
delete [] aPortName ;
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 " ;
#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 ;
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 ) ;
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 * 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 ) ;
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()) ;
}
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 ,
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 ;
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 ,
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@
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 ;
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 ;
}
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() ;
}
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() ;
}
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() ;
}
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() ;
}
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() ;
}
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() ;
}
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() ;
}
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 ,
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 ;
}
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 ,
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 ;
_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 ;
RetVal = !CORBA::is_nil( _FactoryNode->Component() ) ;
if ( RetVal ) {
if ( State() != SUPERV::SuspendedExecutingState ) {
- _FactoryNode->Component()->ping() ;
+ try {
+ _FactoryNode->Component()->ping() ;
+ }
+ catch( ... ) {
+ cdebug << "InNode::Ping() catched" << endl ;
+ State( SUPERV::ErroredState ) ;
+ _OutNode->State( SUPERV::ErroredState ) ;
+ RetVal = false ;
+ }
}
else {
RetVal = false ;
ControlState( SUPERV::ToSuspendState ) ;
if ( IsFactoryNode() || IsComputingNode() ) {
if ( !CORBA::is_nil( Component() ) ) {
- RetVal = Component()->Suspend_impl() ;
+ try {
+ RetVal = Component()->Suspend_impl() ;
+ }
+ catch( ... ) {
+ cdebug << "InNode::Suspend() catched" << endl ;
+ State( SUPERV::ErroredState ) ;
+ _OutNode->State( SUPERV::ErroredState ) ;
+ RetVal = false ;
+ }
if ( RetVal ) {
if ( IsRunning() ) {
cdebug << pthread_self() << "GraphExecutor::InNode::Suspend_impl " << Name()
if ( IsRunning() ) {
if ( IsFactoryNode() || IsComputingNode() ) {
if ( !CORBA::is_nil( Component() ) ) {
- RetVal = Component()->Kill_impl() ;
+ try {
+ RetVal = Component()->Kill_impl() ;
+ }
+ catch( ... ) {
+ cdebug << "InNode::Suspend() catched" << endl ;
+ State( SUPERV::ErroredState ) ;
+ _OutNode->State( SUPERV::ErroredState ) ;
+ RetVal = false ;
+ }
cdebug << "Component()->Kill_impl() returns status " << RetVal << endl ;
RetVal = true ;
if ( IsRunning() ) {
if ( IsRunning() ) {
if ( IsFactoryNode() || IsComputingNode() ) {
if ( !CORBA::is_nil( Component() ) ) {
- RetVal = Component()->Stop_impl() ;
+ try {
+ RetVal = Component()->Stop_impl() ;
+ }
+ catch( ... ) {
+ cdebug << "InNode::Stop() catched" << endl ;
+ State( SUPERV::ErroredState ) ;
+ _OutNode->State( SUPERV::ErroredState ) ;
+ RetVal = false ;
+ }
if ( RetVal ) {
if ( IsRunning() ) {
SendEvent( GraphExecutor::StopEvent ) ;
}
else if ( State() == SUPERV::SuspendedExecutingState ) {
if ( IsFactoryNode() || IsComputingNode() ) {
- RetVal = Component()->Resume_impl() ;
+ try {
+ RetVal = Component()->Resume_impl() ;
+ }
+ catch( ... ) {
+ cdebug << "InNode::Resume() catched" << endl ;
+ State( SUPERV::ErroredState ) ;
+ _OutNode->State( SUPERV::ErroredState ) ;
+ RetVal = false ;
+ }
}
}
else if ( State() == SUPERV::SuspendedSuccessedState ) {
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
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 ) ;
}
if ( anInPort->IsGate() && anOutPort == NULL ) {
Pc-- ;
}
- else {
- if ( anOutPort->IsDataConnected() ) {
+ else if ( anOutPort ) {
+ if ( anOutPort->IsDataConnected() || anOutPort->IsDataStream() ) {
Pc-- ;
}
- if ( anOutPort->IsPortConnected() ) {
- anOutPort->State( SUPERV::WaitingState ) ;
- anOutPort->Done( false ) ;
- }
- else if ( anOutPort->IsDataConnected() ) {
+ if ( anOutPort->IsDataConnected() || anOutPort->IsDataStream() ) {
anOutPort->State( SUPERV::ReadyState ) ;
anOutPort->Done( true ) ;
}
+ else if ( anOutPort->IsPortConnected() ) {
+ anOutPort->State( SUPERV::WaitingState ) ;
+ anOutPort->Done( false ) ;
+ }
}
if ( anOutPort ) {
- GetChangeNodeInPort(i)->State( anOutPort->State() ) ;
+ 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 ) ;
+ }
}
if ( anOutPort ) {
cdebug << "InPort" << i << " : " << anInPort->PortName() << " from OutPort "
_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;
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() ;
}
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() ) {
}
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 ;
cdebug << " Error " << Err ;
}
cdebug << endl;
- return Err ;
+ return !Err ;
}
const long GraphExecutor::InNode::CpuUsed( bool tot ) {
}
catch ( ... ) {
cdebug << "CpuUsed " << Name() << " --> Component()->CpuUsed_impl() ERROR catched " << endl ;
+ State( SUPERV::ErroredState ) ;
+ _OutNode->State( SUPERV::ErroredState ) ;
cpu = 0 ;
}
}
#include "DataFlowExecutor_FiniteStateMachine.hxx"
+#define MAXSTACKTHREADSIZE 8191
+
void * run_function(void *p);
extern GraphExecutor::FiniteStateMachine * theAutomaton ;
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 ) ; } ;
int LinkedNodesSize() const {
return _ComputingNode->LinkedNodesSize() ; } ;
- GraphBase::ComputingNode * LinkedNodes( int i ) const {
- return _ComputingNode->LinkedNodes( i ) ; } ;
+// GraphBase::ComputingNode * LinkedNodes( int i ) const {
+ GraphBase::StreamNode * LinkedNodes( int i ) const {
+ return _ComputingNode->LinkedNodes( i ) ; } ;
const int LinkedInPortsNumber( int i ) const {
return _ComputingNode->LinkedInPortsNumber( i ) ; } ;
bool InitPython() ;
PyObject * InitPyDynInvoke( char * PyFuncName ,
- const SUPERV::ListOfStrings * aPythonFunction ) ;
+ const SUPERV::ListOfStrings * aPythonFunction ,
+ bool & Err ) ;
void LockDataWait() ;
void UnLockDataWait() ;
#include <SALOMEconfig.h>
#include CORBA_CLIENT_HEADER(SALOME_Component)
-//#include "SALOME_NamingService.hxx"
#include "SALOME_LifeCycleCORBA.hxx"
-//#include "DataFlowExecutor_InNode.hxx"
+//#include "StreamGraph_Impl.hxx"
#include "DataFlowExecutor_OutNode.hxx"
-//static char *containerName = "FactoryServer" ;
+
+static void UpperCase(std::string& rstr)
+{
+ std::transform(rstr.begin(), rstr.end(), rstr.begin(), towupper);
+}
+
int GraphExecutor::InNode::SendEvent( const GraphExecutor::NodeEvent anEvent ) {
}
int GraphExecutor::InNode::executeAction() {
- int oldRewindStack = ( _RewindStack > 101 ) ;
+ int oldRewindStack = ( _RewindStack > MAXSTACKTHREADSIZE ) ;
if ( !CreateNewThread() && oldRewindStack ) {
cdebug << pthread_self() << "/" << ThreadNo()
- << " executeAction start Thread _RewindStack " << _RewindStack << " > 101 CreateNewThread "
+ << " executeAction start Thread _RewindStack " << _RewindStack << " > "
+ << MAXSTACKTHREADSIZE << " CreateNewThread "
<< CreateNewThread() << " " << Automaton()->ActionName( _NextAction ) << "(" << Name() << ")"
<< endl;
CreateNewThread( true ) ;
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;
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 ) ;
}
}
else if ( CORBA::is_nil( Component() ) ) {
- Err = !_OutNode->StartComponent( ThreadNo() , Computer() ,
- my_strdup( ComponentName() ) ,
- myContainer , myObjComponent ) ;
+ ostringstream astr ;
+ astr << "Graph " << _OutNode->Graph()->Name() << " Node " << Name()
+ << " : load of component " << ComponentName() << " in container "
+ << Computer() ;
+// _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 ) ;
myObjComponent = Component() ;
// cdebug << ThreadNo() << "Component known : NO StartComponent & Ping"
// << endl ;
- myObjComponent->ping() ;
+ try {
+ myObjComponent->ping() ;
+ }
+ catch( ... ) {
+ cdebug << "ping() catched" << endl ;
+ Err = true ;
+ }
}
int nOutParams = GetNodeOutPortsSize() ;
}
else {
if ( !Err ) {
+ ostringstream astr ;
+ 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"
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 ;
}
- cdebug << ServiceInParameter().length() << " input parameters and "
- << ServiceOutParameter().length() << " output parameters" << endl ;
- if ( IsComputingNode() ) {
+// for DataStreamNodes : call of SetProperties ===> environment variables in the component/container
+ if ( ComputingNode()->HasDataStream() ) {
+ try {
+ cdebug << "DynInvoke -> SetProperties " << _OutNode->Graph()->Name() << " " << Name() << endl ;
+ Engines::FieldsDict_var dict = new Engines::FieldsDict;
+ dict->length( 4 );
+ dict[ 0 ].key = CORBA::string_dup( "CAL_MACHINE");
+ // myContainer->getHostName() ne renvoit pas le nom complet (avec domaine).
+ // dict[ 0 ].value <<= myContainer->getHostName() ;
+ char FullyQualifiedDomainName[256]="";
+ gethostname(FullyQualifiedDomainName,255);
+ dict[ 0 ].value <<= FullyQualifiedDomainName ;
+ dict[ 1 ].key = CORBA::string_dup( "CAL_REPERTOIRE");
+ dict[ 1 ].value <<= "/tmp" ;
+ dict[ 2 ].key = CORBA::string_dup( "CAL_COUPLAGE");
+ stringstream ofst1 ;
+ ofst1 << ComputingNode()->SubStreamGraph() ;
+ string cpl = string( "/tmp/" ) + string( _OutNode->Graph()->Name() ) + string( "_" ) +
+ ofst1.str() + string( ".cpl" );
+ dict[ 2 ].value <<= cpl.c_str() ;
+ dict[ 3 ].key = CORBA::string_dup( "SALOME_INSTANCE_NAME");
+ string uname = Name();
+ UpperCase( uname);
+ dict[ 3 ].value <<= uname.c_str() ;
+
+ myObjComponent->setProperties( dict ) ;
+ }
+ catch( ... ) {
+ cdebug << "DynInvoke setProperties catched ERROR" << endl ;
+ Err = true ;
+ }
+ }
+ if ( !Err && IsComputingNode() ) {
cdebug << ThreadNo() << " !ObjInterface " << Name()
<< " IsComputingNode DynInvoke" << endl ;
+ cdebug << ServiceInParameter().length()-1 << " input parameters and "
+ << ServiceOutParameter().length() << " output parameters" << endl ;
DynInvoke( myObjComponent,
ServiceName() ,
&InParametersList[1] , ServiceInParameter().length()-1 ,
&OutParametersList[0] , ServiceOutParameter().length() ) ;
}
- else if ( IsFactoryNode() ) {
+ else if ( !Err &&IsFactoryNode() ) {
cdebug << ThreadNo() << " !ObjInterface " << Name()
<< " IsFactoryNode DynInvoke" << endl ;
+ cdebug << ServiceInParameter().length() << " input parameters and "
+ << ServiceOutParameter().length() << " output parameters" << endl ;
DynInvoke( myObjComponent,
ServiceName() ,
&InParametersList[0] , ServiceInParameter().length() ,
// sleep( 1 ) ;
// }
+ ostringstream astr ;
+ astr << "Graph " << _OutNode->Graph()->Name() << " Node " << Name() << " is done : "
+ << Automaton()->StateName( State() ) ;
+// _OutNode->Graph()->ObjImpl()->sendMessage( NOTIF_STEP, astr.str().c_str() ) ;
if ( Err ) {
if ( ControlState() == SUPERV::ToKillState ||
ControlState() == SUPERV::ToKillDoneState ||
// << " --> GraphExecutor::InNodeThreads::SetWaitingStates " << Name() << endl;
docdebug = true ;
}
- anInPort->State( SUPERV::WaitingState ) ;
+ if ( !anInPort->IsDataStream() ) {
+ anInPort->State( SUPERV::WaitingState ) ;
+ }
}
}
for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
- for ( j = 0 ; j < GetChangeNodeOutPort( i )->InPortsSize() ; j++ ) {
- GraphBase::OutPort * anOutPort = GetChangeNodeOutPort( i ) ;
+ GraphBase::OutPort * anOutPort = GetChangeNodeOutPort( i ) ;
+ for ( j = 0 ; j < anOutPort->InPortsSize() ; j++ ) {
if ( !( IsGOTONode() && anOutPort->IsGate() ) &&
- !( IsEndLoopNode() && ( anOutPort->IsGate() || anOutPort->IsLoop() ) ) ) {
- GraphExecutor::InNode * aNode = (GraphExecutor::InNode * ) _OutNode->GetChangeGraphNode( anOutPort->ChangeInPorts( j )->NodeName() )->GetInNode() ;
+ !( IsEndLoopNode() && ( anOutPort->IsGate() ||
+ anOutPort->IsLoop() ) ) &&
+ !anOutPort->IsDataStream() &&
+ !anOutPort->ChangeInPorts( j )->IsDataStream() ) {
+// cdebug << ThreadNo()
+// << " GraphExecutor::InNodeThreads::SetWaitingStates "
+// << Name() << "( " << anOutPort->PortName() << " ) --> InPort "
+// << anOutPort->ChangeInPorts( j )->PortName() << " from Node "
+// << anOutPort->ChangeInPorts( j )->NodeName() << endl;
+ GraphExecutor::InNode * aNode = (GraphExecutor::InNode * ) _OutNode->Graph()->GetChangeGraphNode( anOutPort->ChangeInPorts( j )->NodeName() )->GetInNode() ;
if ( aNode != EndNode ) {
aNode->SetWaitingStates( EndNode ) ;
}
if ( IsGOTONode() ||
( IsEndLoopNode() && GetNodeInLoop()->GetOutPort()->BoolValue() ) ) {
+ cdebug << ThreadNo() << " Successed_SuccessAction " << Name()
+ << " SetWaitingStates " << endl ;
const GraphBase::OutPort * aGateOutPort ;
if ( IsGOTONode() ) {
aGateOutPort = GetNodeOutGate() ;
}
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 ) ;
// cdebug << endl;
for ( i = 0 ; i < LinkedNodesSize() ; i++ ) {
bool IgnoreForEndLoop = false ;
- toNode = (GraphExecutor::InNode *) LinkedNodes( i )->GetInNode() ;
+ GraphBase::ComputingNode * aComputingNode ;
+ aComputingNode = (GraphBase::ComputingNode * ) LinkedNodes( i ) ;
+ toNode = (GraphExecutor::InNode *) aComputingNode->GetInNode() ;
// cdebug << ThreadNo() << " Successed_SuccessAction of " << Name()
// << " [" << i << "] " << LinkedNodes( i )->Name() << endl ;
if ( toNode && !toNode->IsDataFlowNode() ) {
*anAny <<= (long ) 0 ;
theOutPort->Value( anAny ) ;
}
- anInPort->State( SUPERV::WaitingState ) ;
+ if ( !anInPort->IsDataStream() ) {
+ anInPort->State( SUPERV::WaitingState ) ;
+ }
D.Name = CORBA::string_dup( anInPort->GetServicesParameter().Parametername ) ;
cdebug << ThreadNo() << " ArgIn" << i << " " << anInPort->Kind() ;
cdebug << " " << D.Name << " " << anInPort->GetServicesParameter().Parametertype << " : " ;
}
}
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() ;
}
extern int _ArgC ;
extern char ** _ArgV ;
-GraphExecutor::OutNode::OutNode() :
- Graph() {
+GraphExecutor::OutNode::OutNode() {
+// Graph() {
_Valid = false ;
_Executable = false ;
_Done = false ;
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 ;
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 ;
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 ) ;
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() ) ;
}
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 ;
}
anInNode->GraphExecutor::InNode::InLineNode()->DefPortsOfNode(
_Orb , aNode.theService , anInNode->NamePtr() ,
anInNode->Kind() ,
- Graph_prof_debug() , Graph_fdebug() ) ;
-#if 0
- GraphBase::InLineNode * aINode = anInNode->InLineNode() ;
- GraphBase::LoopNode * aLNode = NULL ;
- if ( aINode->IsLoopNode() ) {
- aLNode = anInNode->LoopNode() ;
- aLNode->SetPythonFunction( aNode.theListOfFuncName[ 0 ].c_str() ,
- *aNode.theListOfPythonFunctions[ 0 ] ) ;
- aLNode->SetMorePythonFunction( aNode.theListOfFuncName[ 1 ].c_str() ,
- *aNode.theListOfPythonFunctions[ 1 ] ) ;
- aLNode->SetNextPythonFunction( aNode.theListOfFuncName[ 2 ].c_str() ,
- *aNode.theListOfPythonFunctions[ 2 ] ) ;
- }
- else if ( aINode->IsInLineNode() || aINode->IsGOTONode() ||
- aINode->IsSwitchNode() || aINode->IsEndSwitchNode() ) {
- aINode->SetPythonFunction( aNode.theListOfFuncName[ 0 ].c_str() ,
- *aNode.theListOfPythonFunctions[ 0 ] ) ;
- }
-#endif
+ _prof_debug , _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 ) ;
- }
+// 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 ) ;
}
-#endif
+ 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() ;
- cdebug << "GraphExecutor::OutNode::LoadNodes " << anInNode->Name() << "IsOneOfGOTONodes "
+ 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 ;
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 ;
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 ;
}
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 ;
}
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 ;
_Executable = false ;
- if ( !CreateService() ) {
+ if ( !Graph()->CreateService() ) {
cdebug << "This DataFlow has invalid type(s)." << endl ;
return false ;
}
-
- if ( !Sort() ) {
+ int SubStreamGraphsNumber = 0 ;
+ if ( !Graph()->Sort( SubStreamGraphsNumber ) ) {
cdebug << "This DataFlow is not valid." << endl ;
return false ;
}
+ if ( Graph()->IsDataStreamNode() ) {
+ StreamGraph()->SubStreamGraphsNumber( SubStreamGraphsNumber ) ;
+ }
// CreateService() ;
- InLineServices() ;
+ Graph()->InLineServices() ;
- ComputingNodes() ;
+ Graph()->ComputingNodes() ;
_Valid = true ;
if ( !IsValid() )
return false ;
- if ( DataServerNodes() )
+ if ( Graph()->DataServerNodes() )
_Executable = true ;
else {
cdebug << "This DataFlow is not executable." << endl ;
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() ;
}
}
// 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 ) ) {
+ anInNode->State( SUPERV::ErroredState ) ;
+ State( SUPERV::ErroredState ) ;
+ cdebug_out << "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 ;
// 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 ) ;
State( SUPERV::ExecutingState ) ;
};
}
-
+// ostringstream astr ;
+// astr << "Graph " << Graph()->Name() << " is running" ;
+// Graph()->ObjImpl()->sendMessage( NOTIF_STEP, astr.str().c_str() ) ;
RetVal = true ;
}
else {
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 ) ;
}
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 &&
}
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()
}
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 ;
- //cout << Name() << " IS DONE : " << theAutomaton->StateName( AutomatonState() ) << " EventQSize "
+// ostringstream astr ;
+// astr << "Graph " << Graph()->Name() << " is done : "
+// << theAutomaton->StateName( AutomatonState() ) ;
+// 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()
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() ;
}
_EventNodes.push_back( aNode->Name() ) ;
}
else {
- _EventNodes.push_back( Name() ) ;
+ _EventNodes.push_back( Graph()->Name() ) ;
}
_Events.push_back( anEvent ) ;
_States.push_back( aState ) ;
// << aNode->Automaton()->ControlStateName( aNode->ControlState() ) ;
}
else {
-// cdebug << "PushEvent " << Name() ;
+// cdebug << "PushEvent " << Graph()->Name() ;
// cdebug << " " << theAutomaton->EventName( anEvent ) << " "
// << theAutomaton->StateName( aState ) ;
}
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 ;
}
_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() << " "
}
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 ;
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 ) {
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 ;
}
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 ;
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 ;
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 ;
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() ;
}
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() ;
}
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() ;
}
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() ;
}
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() ;
}
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 ;
}
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 ;
}
}
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() ;
}
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 ;
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 ;
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() )
}
}
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 ;
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 ;
}
}
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() << "->"
State( SUPERV::KilledState ) ;
if ( RetVal ) {
MESSAGE("================================================================================") ;
- MESSAGE( Name() << " IS KILLED" ) ;
+ MESSAGE( Graph()->Name() << " IS KILLED" << theAutomaton->StateName( AutomatonState() ) << " EventQSize "
+ << EventQSize() ) ;
MESSAGE("================================================================================") ;
}
else {
MESSAGE("================================================================================") ;
- MESSAGE( Name() << " IS NOT KILLED" ) ;
+ MESSAGE( Graph()->Name() << " IS NOT KILLED" ) ;
MESSAGE("================================================================================") ;
}
- cdebug_out << "GraphExecutor::OutNode::Kill" << endl ;
+ cdebug_out << "GraphExecutor::OutNode::Kill " << RetVal << endl ;
return RetVal ;
}
cdebug_out << "GraphExecutor::OutNode::Stop" << endl ;
if ( RetVal ) {
MESSAGE("================================================================================") ;
- MESSAGE( Name() << " IS STOPPED" ) ;
+ MESSAGE( Graph()->Name() << " IS STOPPED" ) ;
MESSAGE("================================================================================") ;
}
return RetVal ;
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() ;
}
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() ;
}
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() ;
}
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() ;
}
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 ;
}
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 ;
}
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 ) {
#include "SALOME_Component_i.hxx"
-#include "DataFlowBase_Graph.hxx"
-
#include "DataFlowExecutor_InNode.hxx"
+#include "DataFlowBase_StreamGraph.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 ;
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 ,
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 ) ;
long SuspendedThreads() { return _SuspendedThreads ; } ;
void JoinedWait() ;
+ pthread_t ThreadNo() {
+ return _Graph->ThreadNo() ; } ;
long Thread( const char * NodeName ) ;
bool PushEvent( GraphExecutor::InNode * aNode ,
}
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 ;
if ( PyRun_SimpleString( (char *) aPyFunc.c_str() ) ) {
cdebug << ThreadNo() << " " << Name() << " PyRun_SimpleString ERROR " << endl << aPyFunc << endl ;
RetVal = false ;
+ Err = true ;
}
else {
PyFuncRunned( true ) ;
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@
--- /dev/null
+// SuperVisionTest MulComponent : example of component that multiplies two numbers
+//
+// 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 : MulComponentEngine.cxx
+// Author : MARC TAJCHMAN, CEA
+// Module : SuperVisionTest
+
+using namespace std;
+#include <stdio.h>
+#include <unistd.h>
+#include <fstream>
+#include <sstream>
+#include <string>
+
+//#include "utilities.h"
+#include "MulComponent.hxx"
+
+MulComponentEngine::MulComponentEngine( 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("MulComponentEngine::MulComponentEngine activate object instanceName("
+// << instanceName << ") interfaceName(" << interfaceName << ")" )
+ _thisObj = this ;
+ _id = _poa->activate_object(_thisObj);
+ _nexec = 0 ;
+}
+
+MulComponentEngine::MulComponentEngine()
+{
+}
+
+MulComponentEngine::~MulComponentEngine()
+{
+}
+
+void MulComponentEngine::Mul( double x , double y , double & z ) {
+ beginService( " MulComponentEngine::Mul" );
+ z = x * y ;
+ int S;
+
+ sendMessage(NOTIF_STEP, "Mul is Computing");
+ S = 1+(int) (15.0*rand()/(RAND_MAX+1.0));
+ sleep(S);
+ MESSAGE( "MulComponentEngine::Mul( " << x << " , " << y << " , " << z
+ << " ) after " << S << " seconds" )
+ endService( " MulComponentEngine::Mul" );
+}
+
+extern "C"
+{
+ PortableServer::ObjectId * MulComponentEngine_factory
+ (CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
+ const char *interfaceName)
+ {
+ MESSAGE("MulComponentEngine_factory MulComponentEngine ("
+ << instanceName << "," << interfaceName << ")");
+ MulComponentEngine * myMulComponent
+ = new MulComponentEngine(orb, poa, contId, instanceName, interfaceName);
+ return myMulComponent->getId() ;
+ }
+}
+
+
CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) \
-ftemplate-depth-42 -I${KERNEL_ROOT_DIR}/include/salome
LDFLAGS+=$(QT_MT_LIBS) $(VTK_LIBS) $(OGL_LIBS) $(PYTHON_LIBS)\
- -lSalomeGUI -lSalomeNS -lqsplitterP \
+ -lSalomeGUI -lSalomeNS -lqsplitterP -lEvent \
-lSalomeLifeCycleCORBA -lSalomeNotification -lSUPERVGraph \
-L${KERNEL_ROOT_DIR}/lib/salome
int SUPERVGUI::factory = 0;
-SUPERVGUI Supervision;
+SUPERVGUI Supervision("");
-SUPERVGUI::SUPERVGUI(): QObject(),
- desktop(0),
- study(0),
- browser(0)
+SUPERVGUI::SUPERVGUI(const QString& theName, QObject* theParent)
+ : SALOMEGUI( theName, theParent ),
+ desktop(0),
+ study(0),
+ browser(0)
//info(0)
{
Trace("SUPERVGUI::SUPERVGUI")
//info = new SUPERVGUI_Information();
cursor = desktop->cursor();
connect(desktop->getMainFrame(), SIGNAL(windowActivated(QWidget*)), this, SLOT(setMain(QWidget*)));
+
+ int anId = 300;
+ parent->menuBar()->changeItem(anId,parent->getComponentUserName("SUPERV"));
+
};
}
VIEW_GRAPHSUPERV, false);
if (aStudyFrame) {
connect(aStudyFrame,
- SIGNAL(sfBeforeStudyFrameClosing(QAD_StudyFrame*)),
+ SIGNAL(sfStudyFrameClosing(QAD_StudyFrame*)),
&Supervision,
SLOT(onGraphClosed(QAD_StudyFrame*)));
}
return;
}
- SUPERV_Graph aGraph = engine->GraphE(f);
+ SUPERV_Graph aGraph = engine->StreamGraphE(f);
//QFileInfo aFile(f);
//aGraph->SetName(aFile.baseName());
if (SUPERV_isNull(aGraph)) {
QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)
return;
}
- aDataFlow = engine->getGraph(ior);
+ aDataFlow = engine->getStreamGraph(ior);
if (SUPERV_isNull(aDataFlow)) {
QMessageBox::warning(0, tr("ERROR"), tr("MSG_ACCESS_BAD_IOR"));
return;
return;
}
- SUPERV_Graph aGraph = engine->Graph(f);
+ SUPERV_Graph aGraph = engine->StreamGraph(f);
//QFile aFile(f);
//aGraph->SetName(aFile.name());
if (SUPERV_isNull(aGraph)) {
}
}
-void SUPERVGUI::customPopup(QPopupMenu* popup) {
+
+bool SUPERVGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext, const QString& theParent, const QString& theObject) {
Trace("SUPERVGUI::customPopup");
+ Supervision.init(parent);
if(popup->count() > 3) {
// Temporary code: is to be deleted soon
popup->removeItem(QAD_Display_Popup_ID);
// Temporary code end
}
SALOME_Selection* Sel = SALOME_Selection::Selection(study->getSelection() );
- if ((Sel==NULL) || (Sel->IObjectCount() == 0)) return;
+ if ((Sel==NULL) || (Sel->IObjectCount() == 0)) return false;
if (Sel->IObjectCount() == 1) {
Handle(SALOME_InteractiveObject) anIObj = Sel->firstIObject();
if (aIObjCount == Sel->IObjectCount()) //all selected objects belong to Supervision
popup->insertItem(tr("MSG_DELETE"), this, SLOT(deleteObject()));
}
+ return(true);
}
SALOMEDS::GenericAttribute_var anAttr;
if (obj->FindAttribute(anAttr, "AttributeIOR")) {
SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- SUPERV_Graph aDataFlow = engine->getGraph(anIOR->Value());
+ SUPERV_Graph aDataFlow = engine->getStreamGraph(anIOR->Value());
if (!SUPERV_isNull(aDataFlow))
theIsDataflow = true;
}
Sel->ClearIObjects() ;
}
-
-
-void SUPERVGUI::activeStudyChanged() {
- Trace("SUPERVGUI::activeStudyChanged");
- study = desktop->getActiveStudy();
-}
-
-extern "C" bool OnGUIEvent(int command, QAD_Desktop* parent) {
- Supervision.init(parent);
- switch (command) {
- case 301:
- Supervision.importDataflow();
- return(false);
-
- case 302:
- Supervision.exportDataflow();
- return(false);
-
- case 303:
- Supervision.newDataflow();
- return(false);
-
- case 304:
- Supervision.modifyDataflow();
- return(false);
-
- case 305:
- Supervision.reloadDataflow();
- return(false);
-
- case 306:
- Supervision.runDataflow();
- return(false);
-
- case 307:
- Supervision.killDataflow();
- return(false);
-
- case 308:
- Supervision.suspendResumeDataflow();
- return(false);
-
- case 309:
- Supervision.showComponents();
- return(false);
-
- case 310:
- Supervision.stepByStep();
- return(false);
-
- default:
- QMessageBox::warning(QAD_Application::getDesktop(), "Supervision Error", "Unknown Command From Salome");
- return(false);
-
- }
-}
-
-extern "C" bool OnKeyPress(QKeyEvent* e, QAD_Desktop* parent, SUPERVGUI_Main* s) {
+bool SUPERVGUI::OnGUIEvent(int command, QAD_Desktop* parent) {
+ Supervision.init(parent);
+ switch (command) {
+ case 301:
+ Supervision.importDataflow();
return(false);
-}
-
-extern "C" bool OnMousePress(QMouseEvent* e, QAD_Desktop* parent, SUPERVGUI_Main* s) {
+
+ case 302:
+ Supervision.exportDataflow();
return(false);
-}
-
-extern "C" bool OnMouseMove(QMouseEvent* e, QAD_Desktop* parent, SUPERVGUI_Main* s) {
+
+ case 303:
+ Supervision.newDataflow();
return(false);
-}
-
-extern "C" bool OnPopupGUIEvent(int theCommandID, QAD_Desktop* parent) {
+
+ case 304:
+ Supervision.modifyDataflow();
return(false);
+
+ case 305:
+ Supervision.reloadDataflow();
+ return(false);
+
+ case 306:
+ Supervision.runDataflow();
+ return(false);
+
+ case 307:
+ Supervision.killDataflow();
+ return(false);
+
+ case 308:
+ Supervision.suspendResumeDataflow();
+ return(false);
+
+ case 309:
+ Supervision.showComponents();
+ return(false);
+
+ case 310:
+ Supervision.stepByStep();
+ return(false);
+
+ default:
+ QMessageBox::warning(QAD_Application::getDesktop(), "Supervision Error", "Unknown Command From Salome");
+ return(false);
+ }
}
-extern "C" bool SetSettings(QAD_Desktop* parent) {
- Trace("extern SUPERVGUI::SetSettings")
- Supervision.init(parent);
- return(true);
-}
-
-extern "C" void definePopup(QString& theContext, QString& theParent, QString& theObject) {
- theObject = "";
- theContext = "";
+bool SUPERVGUI::SetSettings(QAD_Desktop* parent) {
+ Trace("SUPERVGUI::SetSettings");
+ Supervision.init(parent);
+ return(true);
}
-extern "C" bool customPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext, const QString& theParent, const QString& theObject) {
- Supervision.init(parent);
- Supervision.customPopup(popup);
- return(true);
+void SUPERVGUI::DefinePopup(QString& theContext, QString& theParent, QString& theObject) {
+ theObject = "";
+ theContext = "";
}
-extern "C" void activeStudyChanged(QAD_Desktop* parent) {
- Supervision.activeStudyChanged();
+bool SUPERVGUI::ActiveStudyChanged(QAD_Desktop* parent) {
+ Trace("SUPERVGUI::activeStudyChanged");
+ study = desktop->getActiveStudy();
+ return true;
}
-extern "C" int supportedViewType()
+void SUPERVGUI::SupportedViewType (int* buffer, int bufferSize)
{
- return (int)VIEW_GRAPHSUPERV;
+ if (!buffer || !bufferSize) return;
+ buffer[0] = (int)VIEW_GRAPHSUPERV;
}
-extern "C" void buildPresentation ( const Handle(SALOME_InteractiveObject)& theIO )
+extern "C"
{
+ Standard_EXPORT SALOMEGUI* GetComponentGUI() {
+ return &Supervision;
+ }
}
#ifndef SUPERVGUI_H
#define SUPERVGUI_H
-// Acces a l'ihm de SALOME
+// Acces a l`ihm de SALOME
// -----------------------
#include "QAD_Desktop.h"
#include "SUPERVGUI_Main.h"
//#include "SUPERVGUI_Information.h"
+#include "SALOMEGUI.h"
// Definition de la classe principale du module de supervision
// -----------------------------------------------------------
-class SUPERVGUI: public QObject {
+class SUPERVGUI: public SALOMEGUI {
Q_OBJECT
public:
- SUPERVGUI();
+ SUPERVGUI( const QString&, QObject* = 0 );
virtual ~SUPERVGUI();
QAD_Desktop* getDesktop();
void init(QAD_Desktop* parent);
SUPERVGUI_Main* getMain();
- void customPopup(QPopupMenu* popup);
- void activeStudyChanged();
+
+ bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
+ bool SetSettings(QAD_Desktop* parent);
+ void DefinePopup(QString & theContext,
+ QString & theParent,
+ QString & theObject ) ;
+ bool CustomPopup(QAD_Desktop* parent,
+ QPopupMenu* popup,
+ const QString & theContext,
+ const QString & theParent,
+ const QString & theObject);
+ bool ActiveStudyChanged( QAD_Desktop* parent );
+ void SupportedViewType (int* buffer, int bufferSize);
bool isContains(QAD_Study* theStudy, const QString theKey);
// ----------------------------
#define LABEL_WIDTH 160
-#define LABEL_HEIGHT 20
+#define LABEL_HEIGHT 15
// Taille de la boite de filtre de notification
// --------------------------------------------
#define SUPERV_Engine SUPERV::SuperG_var
-#define SUPERV_Graph SUPERV::Graph_var
+#define SUPERV_Graph SUPERV::StreamGraph_var
#define SUPERV_CNode SUPERV::CNode_var
#define SUPERV_FNode SUPERV::FNode_var
#define SUPERV_Links SUPERV::ListOfLinks_var
#define SUPERV_Ports SUPERV::ListOfPorts_var
+#define SUPERV_StreamPorts SUPERV::ListOfStreamPorts_var
#define SUPERV_Nodes SUPERV::ListOfNodes_var
#define SUPERV_Strings SUPERV::ListOfStrings_var
#define SUPERV_Link SUPERV::Link_var
#define SUPERV_Date SUPERV::SDate
#define SUPERV_Port SUPERV::Port_var
+#define SUPERV_StreamPort SUPERV::StreamPort_var
#define SUPERV_Editing SUPERV::EditingState
#define SUPERV_Running SUPERV::RunningState
#include "SUPERVGUI_ControlNode.h"
#include "SUPERVGUI.h"
+#include <qapplication.h>
+#include <qlabel.h>
+#include <qgroupbox.h>
+#include <qlayout.h>
+#include <qvalidator.h>
//#define CHECKTIME
main->showPopup(myLinkPopup, e);
} else {
mySelectedLink = 0;
+ addDSPopupItem();
main->showPopup(myPopup, e);
}
}
void SUPERVGUI_Graph::deleteLink(SUPERVGUI_Link* theLink) {
- //update values of input ports of theLink if theLink is deleted
- if ( theLink->getInputPort() ) {
- //input port exist
+ if (getMain()->getDataflow()->IsDone()) {
+ //update values of input ports of theLink if theLink is deleted and dataflow has been executed any times
SUPERVGUI_PortIn* aInPort = theLink->getInputPort();
- if (aInPort->getPort()->IsParam() || aInPort->getPort()->IsInLine()) {
- QString aPortValue = QString(aInPort->getPort()->ToString());
- if (!aPortValue.isNull()) {
+ if ( aInPort ) {
+ //input port exist
+ QString aPortValue = QString(aInPort->getPort()->ToString());
+ if ( (aInPort->getPort()->IsParam() || aInPort->getPort()->IsInLine())
+ &&
+ !aPortValue.isNull()) {
//gives a value to an input port
theLink->destroyEngine();
aInPort->getPort()->Input( Supervision.getEngine()->StringValue( aPortValue ) );
aInPort->sync();
}
+ else
+ theLink->destroyEngine();
}
+ else
+ theLink->destroyEngine();
}
- else
+ else
theLink->destroyEngine();
myLinksList.removeRef(theLink);
if (aName != "Default")
myNewLink->setInputPortES(dynamic_cast<SUPERVGUI_PortInESNode*>(thePort));
}
- else{
+ else if (aPort->Kind() == SUPERV::DataStreamParameter){
+ myNewLink->setInputPort(dynamic_cast<SUPERVGUI_StreamPortIn*>(thePort));
+ } else {
if (aPort->IsLinked()) return;
if (aKind == SUPERV::GateParameter || aPort->Kind() == SUPERV::GateParameter) {
}
else
return;
- }
- else {
+ } else {
int aKind = myNewLink->getInputPort()->getPort()->Kind();
if (aKind == SUPERV::GateParameter || aPort->Kind() == SUPERV::GateParameter) {
- if (aKind != aPort->Kind() && aKind != SUPERV::InLineParameter
- && aPort->Kind() != SUPERV::InLineParameter) {
+ if (aKind != aPort->Kind() &&
+ aKind != SUPERV::InLineParameter &&
+ aPort->Kind() != SUPERV::InLineParameter) {
return;
- }
- else //connection like Gate <--> Gate
- myNewLink->setOutputPort(dynamic_cast<SUPERVGUI_PortOut*>(thePort));
- } else
+ } else //connection like Gate <--> Gate
+ myNewLink->setOutputPort(dynamic_cast<SUPERVGUI_PortOut*>(thePort));
+ } else if (aPort->Kind() == SUPERV::DataStreamParameter){
+ myNewLink->setOutputPort(dynamic_cast<SUPERVGUI_StreamPortOut*>(thePort));
+ } else
myNewLink->setOutputPort(dynamic_cast<SUPERVGUI_PortOut*>(thePort));
}
}
-
+
if (myNewLink->isCreationComplete()) { // if everything is defined
if (myNewLink->createEngine()) {
myLinksList.append(myNewLink);
draw();
}
+/*!
+ Constructor
+*/
+SUPERVGUI_DSGraphParameters::SUPERVGUI_DSGraphParameters(SUPERV_Graph theGraph, bool isReadOnly)
+ : QDialog( QAD_Application::getDesktop(), "", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+ Trace("SUPERVGUI_DSGraphParameters::SUPERVGUI_DSGraphParameters");
+ setCaption( tr( "TLT_DSGRAPHPARAMS" ) );
+ setSizeGripEnabled( true );
+ myGraph = theGraph;
+
+ QGridLayout* TopLayout = new QGridLayout( this );
+ TopLayout->setSpacing( 6 );
+ TopLayout->setMargin( 11 );
+
+ QGroupBox* TopGroup = new QGroupBox( this, "TopGroup" );
+ TopGroup->setColumnLayout(0, Qt::Vertical );
+ TopGroup->layout()->setSpacing( 0 );
+ TopGroup->layout()->setMargin( 0 );
+ QGridLayout* TopGroupLayout = new QGridLayout( TopGroup->layout() );
+ TopGroupLayout->setAlignment( Qt::AlignTop );
+ TopGroupLayout->setSpacing( 6 );
+ TopGroupLayout->setMargin( 11 );
+
+ // DeltaTime
+ QLabel* DeltaTimeL = new QLabel( tr( "DELTATIME_LBL" ), TopGroup );
+ TopGroupLayout->addWidget( DeltaTimeL, 0, 0 );
+
+ myDeltaTime = new QAD_SpinBoxDbl( TopGroup, 0.0, 1.0, 0.1);
+ myDeltaTime->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ TopGroupLayout->addWidget( myDeltaTime, 0, 1 );
+
+ // TimeOut
+ QLabel* TimeOutL = new QLabel( tr( "TIMEOUT_LBL" ), TopGroup);
+ TopGroupLayout->addWidget( TimeOutL, 1, 0 );
+
+ myTimeOut = new QLineEdit( TopGroup );
+ myTimeOut->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ myTimeOut->setValidator( new QIntValidator(this) );
+ myTimeOut->setMinimumSize( 100, 0 );
+ myTimeOut->setReadOnly( isReadOnly );
+ TopGroupLayout->addWidget( myTimeOut, 1, 1 );
+
+ // DataStreamTrace
+ QLabel* DataStreamTraceL = new QLabel( tr( "DATASTREAMTRACE_LBL" ), TopGroup);
+ TopGroupLayout->addWidget( DataStreamTraceL, 2, 0 );
+
+ myDataStreamTrace = new QComboBox( TopGroup );
+ myDataStreamTrace->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ myDataStreamTrace->insertItem("WithoutTrace");
+ myDataStreamTrace->insertItem("SummaryTrace");
+ myDataStreamTrace->insertItem("DetailedTrace");
+ TopGroupLayout->addWidget( myDataStreamTrace, 2, 1 );
+
+ QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
+ GroupButtons->setColumnLayout(0, Qt::Vertical );
+ GroupButtons->layout()->setSpacing( 0 );
+ GroupButtons->layout()->setMargin( 0 );
+ QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setSpacing( 6 );
+ GroupButtonsLayout->setMargin( 11 );
+
+ QPushButton* okB = new QPushButton( tr( "BUT_OK" ), GroupButtons );
+ QPushButton* cancelB = new QPushButton( tr( "BUT_CANCEL" ), GroupButtons );
+
+ GroupButtonsLayout->addWidget( okB, 0, 0 );
+ GroupButtonsLayout->addItem ( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
+ GroupButtonsLayout->addWidget( cancelB, 0, 2 );
+
+ TopLayout->addWidget( TopGroup, 0, 0 );
+ TopLayout->addWidget( GroupButtons, 1, 0 );
+
+ connect( okB, SIGNAL( clicked() ), this, SLOT( accept() ) );
+ connect( cancelB, SIGNAL( clicked() ), this, SLOT( reject() ) );
+
+ setData();
+}
+
+/*!
+ Destructor
+*/
+SUPERVGUI_DSGraphParameters::~SUPERVGUI_DSGraphParameters() {
+ Trace("SUPERVGUI_DSGraphParameters::~SUPERVGUI_DSGraphParameters");
+}
+
+/*!
+ Sets data function
+*/
+void SUPERVGUI_DSGraphParameters::setData() {
+ double aDeltaTime;
+ long aTimeOut;
+ SUPERV::KindOfDataStreamTrace aDataStreamTrace;
+
+ myGraph->StreamParams(aTimeOut, aDataStreamTrace, aDeltaTime);
+
+ myDeltaTime->setValue(aDeltaTime);
+ myTimeOut->setText(QString("%1").arg(aTimeOut));
+ myDataStreamTrace->setCurrentItem((int)aDataStreamTrace);
+}
+
+/*!
+ <OK> button slot
+*/
+void SUPERVGUI_DSGraphParameters::accept() {
+ myGraph->SetStreamParams( myTimeOut->text().toLong(),
+ (SUPERV::KindOfDataStreamTrace) myDataStreamTrace->currentItem(),
+ myDeltaTime->value());
+ QDialog::accept();
+}
#include "SUPERVGUI_Node.h"
#include "SUPERVGUI_Link.h"
#include "SUPERVGUI_CtrlLink.h"
+#include "SUPERVGUI_Def.h"
+#include "QAD_SpinBoxDbl.h"
#include <qmap.h>
+#include <qcombobox.h>
+#include <qspinbox.h>
class SUPERVGUI_Main;
QMap<QString, SUPERVGUI_CtrlLink> myCtrlLinks;
};
+//**************************************************************
+class SUPERVGUI_DSGraphParameters: public QDialog {
+ Q_OBJECT
+
+ public:
+ SUPERVGUI_DSGraphParameters(SUPERV_Graph theGraph, bool isReadOnly);
+ virtual ~SUPERVGUI_DSGraphParameters();
+
+ private slots:
+ void accept();
+
+ private:
+
+ void setData();
+
+ QAD_SpinBoxDbl* myDeltaTime;
+ QLineEdit* myTimeOut;
+ QComboBox* myDataStreamTrace;
+
+ SUPERV_Graph myGraph;
+};
+
#endif
myValuesBox = new QWidget(myPortsBox);
myPortLayout = new QGridLayout(myValuesBox, 0, 2, 0, 1);
+ SUPERV_StreamPorts aStreamPorts = myNode->StreamPorts();
+ int aStreamNb = aStreamPorts->length();
+ if (aStreamNb) {
+ myStreamBox = new QFrame(myPortsBox);
+ myStreamBox->setPaletteForegroundColor(red.dark());
+ myStreamBox->setPaletteBackgroundColor(paletteBackgroundColor());
+ myStreamBox->setFrameStyle( QFrame::Box | QFrame::Plain );
+ myStreamBox->setLineWidth(1);
+ myStreamLayout = new QGridLayout(myStreamBox, 0, 2, 2, 3);
+ } else {
+ myStreamBox = 0;
+ myStreamLayout = 0;
+ }
myGatesBox = new QFrame(myPortsBox);
myGatesBox->setFrameStyle( QFrame::Panel | QFrame::Raised );
myGatesBox->setLineWidth(2);
if (ports[i]->IsInput()) {
if (getComputingNode()->IsEndSwitch()) {
if (ports[i]->IsGate())
- myGatesLayout->addWidget(new SUPERVGUI_PortInESNode(myGatesBox, myMain, ports[i]),
+ myGatesLayout->addWidget(new SUPERVGUI_PortInESNode(myGatesBox, myMain, ports[i].in()),
0, 0);
else {
- myPortLayout->addWidget(new SUPERVGUI_PortInESNode(myValuesBox, myMain, ports[i]),
+ myPortLayout->addWidget(new SUPERVGUI_PortInESNode(myValuesBox, myMain, ports[i].in()),
myPIcount, 0);
myPIcount++;
}
} else {
if (ports[i]->IsGate())
- myGatesLayout->addWidget(new SUPERVGUI_PortIn(myGatesBox, myMain, ports[i]),
+ myGatesLayout->addWidget(new SUPERVGUI_PortIn(myGatesBox, myMain, ports[i].in()),
0, 0);
else {
- myPortLayout->addWidget(new SUPERVGUI_PortIn(myValuesBox, myMain, ports[i]),
+ myPortLayout->addWidget(new SUPERVGUI_PortIn(myValuesBox, myMain, ports[i].in()),
myPIcount, 0);
myPIcount++;
}
}
} else {
if (ports[i]->IsGate())
- myGatesLayout->addWidget(new SUPERVGUI_PortOut(myGatesBox, myMain, ports[i]),
+ myGatesLayout->addWidget(new SUPERVGUI_PortOut(myGatesBox, myMain, ports[i].in()),
0, 1, Qt::AlignRight);
else {
- myPortLayout->addWidget(new SUPERVGUI_PortOut(myValuesBox, myMain, ports[i]),
+ myPortLayout->addWidget(new SUPERVGUI_PortOut(myValuesBox, myMain, ports[i].in()),
myPOcount, 1, Qt::AlignRight);
myPOcount++;
}
}
}
-
+ myStrPIcount = 0;
+ myStrPOcount = 0;
+ for (int i=0; i < aStreamNb; i++) {
+ if (aStreamPorts[i]->IsInput()) {
+ myStreamLayout->addWidget(new SUPERVGUI_StreamPortIn(myStreamBox, myMain, aStreamPorts[i].in()),
+ myStrPIcount, 0);
+ myStrPIcount++;
+ } else {
+ myStreamLayout->addWidget(new SUPERVGUI_StreamPortOut(myStreamBox, myMain, aStreamPorts[i].in()),
+ myStrPOcount, 1, Qt::AlignRight);
+ myStrPOcount++;
+ }
+ }
}
if (aPort == NULL) return;
if (getNodeType() == SUPERV::EndSwitchNode) {
- SUPERVGUI_PortInESNode* aPortPrs = new SUPERVGUI_PortInESNode(myValuesBox, myMain, aPort);
+ SUPERVGUI_PortInESNode* aPortPrs = new SUPERVGUI_PortInESNode(myValuesBox, myMain, aPort.in());
myPortLayout->addWidget(aPortPrs, myPIcount, 0);
if (myPortsBox->isVisible()) {
}
}
else {
- SUPERVGUI_PortIn* aPortPrs = new SUPERVGUI_PortIn(myValuesBox, myMain, aPort);
+ SUPERVGUI_PortIn* aPortPrs = new SUPERVGUI_PortIn(myValuesBox, myMain, aPort.in());
myPortLayout->addWidget(aPortPrs, myPIcount, 0);
if (myPortsBox->isVisible()) {
SUPERV_Port aPort = createOutPort();
if (aPort == NULL) return;
- SUPERVGUI_PortOut* aPortPrs = new SUPERVGUI_PortOut(myValuesBox, myMain, aPort);
+ SUPERVGUI_PortOut* aPortPrs = new SUPERVGUI_PortOut(myValuesBox, myMain, aPort.in());
myPortLayout->addWidget(aPortPrs, myPOcount, 1, Qt::AlignRight);
myPOcount++;
if (myPortsBox->isVisible()) {
if (aPorts[i]->IsInput()) {
SUPERVGUI_PortIn* aPortIn;
if (aPorts[i]->IsGate()) {
- aPortIn = new SUPERVGUI_PortIn(myGatesBox, myMain, aPorts[i]);
+ aPortIn = new SUPERVGUI_PortIn(myGatesBox, myMain, aPorts[i].in());
myGatesLayout->addWidget(aPortIn, myPIcount, 0);
} else {
- aPortIn = new SUPERVGUI_PortIn(myValuesBox, myMain, aPorts[i]);
+ aPortIn = new SUPERVGUI_PortIn(myValuesBox, myMain, aPorts[i].in());
myPortLayout->addWidget(aPortIn, myPIcount, 0);
myPIcount++;
}
} else {
SUPERVGUI_PortOut* aPortOut;
if (aPorts[i]->IsGate()) {
- aPortOut = new SUPERVGUI_PortOut(myGatesBox, myMain, aPorts[i]);
+ aPortOut = new SUPERVGUI_PortOut(myGatesBox, myMain, aPorts[i].in());
myGatesLayout->addWidget(aPortOut, myPOcount, 1, Qt::AlignRight);
} else {
- aPortOut = new SUPERVGUI_PortOut(myValuesBox, myMain, aPorts[i]);
+ aPortOut = new SUPERVGUI_PortOut(myValuesBox, myMain, aPorts[i].in());
myPortLayout->addWidget(aPortOut, myPOcount, 1, Qt::AlignRight);
myPOcount++;
}
QFrame* myGatesBox;
QGridLayout* myGatesLayout;
+
+ QFrame * myStreamBox;
+ QGridLayout* myStreamLayout;
QTimer* myTimer;
int myPIcount;
int myPOcount;
+ int myStrPIcount;
+ int myStrPOcount;
+
private:
void StartTimer();
void StopTimer();
compnameV->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
compnameV->setMinimumSize( 200, 0 );
compnameV->setReadOnly( true/*isReadOnly*/ );
- compnameV->setText( SUPERV::FNode::_narrow(node)->GetComponentName() );
+ compnameV->setText( QAD_Application::getDesktop()->getComponentUserName(
+ SUPERV::FNode::_narrow(node)->GetComponentName()) );
intnameL = new QLabel( tr( "INTERFACE_NAME_LBL" ), TopGroup );
intnameV = new QLineEdit( TopGroup );
if (toErase) {
aDataPen.setColor(myGraph->viewport()->paletteBackgroundColor());
} else {
- if (strcmp(myEngine->InPort()->Name(), "InVoid")==0)
+ if ((strcmp(myEngine->InPort()->Name(), "InVoid")==0) ||
+ (myEngine->InPort()->Kind() == SUPERV::DataStreamParameter ))
aDataPen.setColor(CTRL_CLR);
else
aDataPen.setColor(DRAW_CLR);
if (toErase) {
aDataPen.setColor(myGraph->viewport()->paletteBackgroundColor());
} else {
- if (strcmp(myEngine->InPort()->Name(), "InVoid")==0)
+ if ((strcmp(myEngine->InPort()->Name(), "InVoid")==0)||
+ (myEngine->InPort()->Kind() == SUPERV::DataStreamParameter ))
aDataPen.setColor(CTRL_CLR);
else
aDataPen.setColor(DRAW_CLR);
bool SUPERVGUI_Link::isCreationComplete() {
bool aIsBoth = myPortIn && myPortOut;
if (myPortIn && myPortOut) {
+ // Check: is the same node?
SUPERV_Port aInPort = myPortIn->getPort();
QString aInNodeName(aInPort->Node()->Name());
SUPERV_Port aOutPort = myPortOut->getPort();
QString aOutNodeName(aOutPort->Node()->Name());
+
+ bool aCanCreate = true;
+ // Stream port can be connected only with stream port
+ if (myPortIn->getPort()->Kind() == SUPERV::DataStreamParameter)
+ aCanCreate = (myPortOut->getPort()->Kind() == SUPERV::DataStreamParameter);
+ else if (myPortOut->getPort()->Kind() == SUPERV::DataStreamParameter)
+ aCanCreate = (myPortIn->getPort()->Kind() == SUPERV::DataStreamParameter);
- return (aInNodeName != aOutNodeName);
+ return aCanCreate && (aInNodeName != aOutNodeName);
}
else if (myPortInES && myPortOut) {
SUPERV_Port aInPortES = myPortInES->getPort();
}
// Create engine
- if (!isESInputPort())
- myEngine = myGraph->getMain()->getDataflow()->
- Link(myPortOut->getPort(), myPortIn->getPort());
- else
+ if (!isESInputPort()) {
+ if (myStartPort->getPort()->Kind() == SUPERV::DataStreamParameter) {
+ SUPERVGUI_StreamPortOut* aOut = dynamic_cast<SUPERVGUI_StreamPortOut*>(myPortOut);
+ SUPERVGUI_StreamPortIn* aIn = dynamic_cast<SUPERVGUI_StreamPortIn*>(myPortIn);
+ myEngine = myGraph->getMain()->getDataflow()->
+ StreamLink(aOut->getStreamPort(), aIn->getStreamPort());
+ } else
+ myEngine = myGraph->getMain()->getDataflow()->
+ Link(myPortOut->getPort(), myPortIn->getPort());
+ } else
myEngine = myGraph->getMain()->getDataflow()->
Link(myPortOut->getPort(), myPortInES->getPort());
return;
}
if (theEvent->button() != Qt::LeftButton) {
+ SelectedLink = 0;
myHltPnt = -1;
return;
}
#include "QAD_Application.h"
#include "SUPERVGUI_Def.h"
#include "QAD_RightFrame.h"
+#include "SALOME_Event.hxx"
#include "SUPERVGraph_ViewFrame.h"
#include <qlayout.h>
#include <qfile.h>
if (obj->FindAttribute(anAttr, "AttributeIOR")) {
SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
Standard_CString ior = anIOR->Value();
- dataflow = Supervision.getEngine()->getGraph(ior);
+ dataflow = Supervision.getEngine()->getStreamGraph(ior);
if (SUPERV_isNull(dataflow)) {
QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_ACCESS_BAD_IOR"));
close();
close();
}
} else {
- dataflow = Supervision.getEngine()->Graph(MAIN_NEW);
+ dataflow = Supervision.getEngine()->StreamGraph(MAIN_NEW);
if (SUPERV_isNull(dataflow)) {
QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_CREATE_DF"));
close();
Trace("SUPERVGUI_Main::SUPERVGUI_Main (file)")
theParent->setViewWidget(this);
if (isModify) {
- dataflow = Supervision.getEngine()->Graph(f);
+ dataflow = Supervision.getEngine()->StreamGraph(f);
} else {
- dataflow = Supervision.getEngine()->GraphE(f);
+ dataflow = Supervision.getEngine()->StreamGraphE(f);
}
if (SUPERV_isNull(dataflow)) {
QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_BAD_FILE").arg(f));
myThread = new SUPERVGUI_Thread();
myThread->setMain(this);
+ connect(this, SIGNAL(KillMyThread(bool)), myThread, SLOT(KillThread(bool)));
myIsKilled = false;
//myIsRunned = false;
delete notification; // kloss : nota bene : quand un datalow est detruit : verifier que les canaux de notification sont aussi detruit
if (!SUPERV_isNull(dataflow)) {
if (dataflow->IsExecuting()) {
- if (QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"),
+ if (QMessageBox::warning(QAD_Application::getDesktop(),
+ tr("WARNING"),
tr("MSG_DF_RUNNING"),
tr("MSG_DF_EXECUTION"),
tr("MSG_DF_KILL")) == 1) {
- dataflow->Kill();
+ if (dataflow->Kill()) {
+ if (myThread->running())
+ myThread->wait();
+ }
+ }
+ else {
+ emit KillMyThread(true);
+ if (myThread->running())
+ myThread->wait();
}
}
+ else {
+ emit KillMyThread(true);
+ if (myThread->running())
+ myThread->wait();
+ }
}
}
}
}
+void SUPERVGUI_Main::changeDSGraphParameters() {
+ SUPERVGUI_DSGraphParameters* aDlg = new SUPERVGUI_DSGraphParameters(dataflow, dataflow->IsReadOnly());
+ if (aDlg->exec() )
+ sync();
+ delete aDlg;
+}
+
void SUPERVGUI_Main::syncAsync() {
Trace("SUPERVGUI_Main::syncAsync")
QTimer::singleShot(1, this, SLOT(sync()));
SUPERVGraph_ViewFrame* aViewFrame = dynamic_cast<SUPERVGraph_ViewFrame*>
(aStudyFrame->getRightFrame()->getViewFrame());
if(aViewFrame){
- SUPERV_Graph aNewGraph = dataflow->Copy();
+ SUPERV_Graph aNewGraph = dataflow->StreamCopy();
QString aNewName(tr("MSG_COPY_PREFIX").arg(++myCopyNum));
aNewName += dataflow->Name();
aNewGraph->SetName(aNewName);
//if (myIsRunned) {
if (!dataflow->ReRun()) {
QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_DF_BADEXECUTE"));
+ if (dataflow->State() == SUPERV::ErrorState) {
+ kill();
+ }
} else {
myThread->startThread(tr("MSG_GRAPH_STARTED"));
- //syncNotification();
sync();
}
} else {
if (!dataflow->Run()) {
QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_DF_BADEXECUTE"));
+ if (dataflow->State() == SUPERV::ErrorState) {
+ kill();
+ }
} else {
myThread->startThread(tr("MSG_GRAPH_STARTED"));
- //syncNotification();
- //myIsRunned = true;
sync();
}
}
QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_DF_BADEXECUTE"));
} else {
myThread->startThread(tr("MSG_GRAPH_STARTED"));
- //syncNotification();
}
}
else {
QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_DF_BADEXECUTE"));
} else {
myThread->startThread(tr("MSG_GRAPH_STARTED"));
- //syncNotification();
}
}
}
Trace("SUPERVGUI_Main::showPopup");
// To check is Supervision active?
if (myIsLocked) return;
+ //if (dataflow->IsExecuting()) return;
//if (QAD_Application::getDesktop()->getActiveComponent().compare(STUDY_SUPERVISION) !=0) return;
if (QAD_Application::getDesktop()->getActiveComponent().compare(QAD_Application::getDesktop()->getComponentUserName( "SUPERV" ) ) !=0) return;
}
}
-
-
/******************************* SUPERVGUI_Thread class ****************************************/
SUPERVGUI_Thread::SUPERVGUI_Thread()
:QThread()
void SUPERVGUI_Thread::stopThread(const char* m)
{
- //myIsActive = false;
- //myMain->sync();
myMain->getMessage()->setMessage(m);
}
myMain = theMain;
}
+void SUPERVGUI_Thread::KillThread(bool theValue)
+{
+ myMutex.lock();
+ myIsActive = !(theValue);
+ myMutex.unlock();
+}
+
+typedef TVoidMemFun2ArgEvent<SUPERVGUI_Main, char*, SUPERV::GraphState> TNodeSyncEvent;
+
void SUPERVGUI_Thread::run()
{
SUPERV_CNode aNode = NULL;
if (aEvent == SUPERV::UndefinedEvent && aState == SUPERV::UndefinedState
||
- aEvent == SUPERV::NoEvent && aState == SUPERV::NoState) {
+ aEvent == SUPERV::NoEvent && aState == SUPERV::NoState
+ ||
+ aEvent == SUPERV::KillEvent && aState == SUPERV::KillState) {
if (myMain->getEventNodes().count()) {
myMain->removeEventNodes();
}
case SUPERV_Error :
stopThread(tr("MSG_GRAPH_ABORTED"));
break;
+
+ case SUPERV_Kill:
+ stopThread(tr("MSG_GRAPH_KILLED"));
+ break;
}
break;
//if list not empty call execute() -> sync()
char * aNodeName = *(myMain->getEventNodes().getFirst());
SUPERV::GraphState aNodeState = *(myMain->getStates().getFirst());
- qApp->lock();
- myMain->execute(aNodeName,aNodeState); //this is from main
- qApp->unlock();
+
+ // It is PROHIBITED to deal with widgets in a secondary thread, so event posting is used here
+ ProcessVoidEvent( new TNodeSyncEvent( myMain, &SUPERVGUI_Main::execute, aNodeName, aNodeState ) );
+
myMain->removeFirstEN();
myMain->removeFirstS();
+
}
aPrevNode = aNode;
void lockedGraph(bool theLock) { myIsLocked = theLock; }
bool isLocked() { return myIsLocked; }
+ bool isKilled() { return myIsKilled; }
SUPERV::GraphState getNodeExecState();
void setNodeExecState(SUPERV::GraphState theNodeExecState);
void startTimer();
void executionFinished();
+ signals:
+ void KillMyThread(bool theValue);
+
public slots:
void execute(char * theNodeNode, SUPERV::GraphState theNodeState);
void sync();
void showFullGraph();
void showContolFlow();
void filterNotification();
+ void changeDSGraphParameters();
private slots:
void chooseData(QListViewItem* item);
void stopThread(const char* m);
void setMain(SUPERVGUI_Main* theMain);
+ public slots:
+ void KillThread(bool theValue);
+
protected:
void run();
private:
bool myIsActive;
SUPERVGUI_Main* myMain;
+ QMutex myMutex;
};
void SUPERVGUI_Node::mousePressEvent(QMouseEvent* e) {
- myMain->showPopup(myPopup, e);
+ if (!myMain->getDataflow()->IsExecuting())
+ myMain->showPopup(myPopup, e);
}
#include "QAD_LeftFrame.h"
#include "QAD_ObjectBrowser.h"
#include <qpoint.h>
+#include <qvalidator.h>
#include "SUPERVGUI_GraphNode.h"
// Port en general
// ---------------
-SUPERVGUI_Port::SUPERVGUI_Port(QWidget* parent, SUPERVGUI_Main* m, SUPERV_Port p):
+SUPERVGUI_Port::SUPERVGUI_Port(QWidget* parent, SUPERVGUI_Main* m, SUPERV::Port_ptr p):
SUPERVGUI_Label(parent, PORT_WIDTH, PORT_HEIGHT, "", QLabel::AlignLeft | QLabel::AlignVCenter),
- main(m),
- port(p)
+ main(m)
{
Trace("SUPERVGUI_Port::SUPERVGUI_Port");
+ port = SUPERV::Port::_duplicate(p);
myName = port->Name();
QString aName(port->Name());
aName += (port->IsInput())? "Input":"Output";
- setName(aName);
+ setName(aName);
- if (myName.compare(OUTVOID) == 0)
+ if (!port->IsInput() && port->IsGate())
setAlignment(QLabel::AlignRight | QLabel::AlignVCenter);
if (port->IsParam() || port->IsInLine())
( port->IsEndSwitch() && port->IsInput())) {
myDelItem = popup->insertItem(tr("ITM_DEL_PORT"), this, SLOT(deletePort()));
}
+ browser = popup->insertItem(tr("MSG_BROWSE"),this, SLOT(browse()));
+
connect(this, SIGNAL(MousePress(QMouseEvent*)), this, SLOT(showPopup(QMouseEvent*)));
connect(this, SIGNAL(MouseRelease(QMouseEvent*)), this, SLOT(endSketch()));
}
if (e->button() != RightButton) return;
if (main->getDataflow()->IsExecuting())
popup->setItemEnabled(mySketchItem, false);
- else
+ /* else
if (!port->IsInput() //output port
||
port->IsInput() && (!port->IsLinked() //not linked input port
port->Kind() == SUPERV::EndSwitchParameter)) { //input port of EndSwitch node
popup->setItemEnabled(mySketchItem, true);
}
-
+ */
main->showPopup(popup, e);
}
+void SUPERVGUI_Port::browse() {
+ Trace("SUPERVGUI_Port::browse")
+ QString mess = (port->IsInput())? (tr("MSG_IPORT_VAL")) : (tr("MSG_OPORT_VAL"));
+ mess += port->ToString();
+ QMessageBox::information(QAD_Application::getDesktop(), tr("MSG_INFO"), mess);
+}
+
+
QPoint SUPERVGUI_Port::getConnectPnt() {
return QPoint(0,0);
}
// Port d'entree
// -------------
-SUPERVGUI_PortIn::SUPERVGUI_PortIn(QWidget* parent, SUPERVGUI_Main* m, SUPERV_Port p)
+SUPERVGUI_PortIn::SUPERVGUI_PortIn(QWidget* parent, SUPERVGUI_Main* m, SUPERV::Port_ptr p)
: SUPERVGUI_Port(parent, m, p), myDlg( 0 )
{
Trace("SUPERVGUI_PortIn::SUPERVGUI_PortIn");
if ((!port->IsGate()) && editing ) {
psc = popup->insertItem(tr("MSG_SETVALUE"), this, SLOT(setInput()));
}
- browser = popup->insertItem(tr("MSG_BROWSE"), this, SLOT(browse()));
+ // browser = popup->insertItem(tr("MSG_BROWSE"), this, SLOT(browse()));
}
SUPERVGUI_PortIn::~SUPERVGUI_PortIn() {
return SUPERVGUI_Port::eventFilter( o, e );
}
+void SUPERVGUI_PortIn::showPopup(QMouseEvent* e){
+ if (e->button() != RightButton) return;
+ if (main->getDataflow()->IsExecuting())
+ popup->setItemEnabled(mySketchItem, false);
+ else {
+ popup->setItemEnabled(mySketchItem, !port->IsLinked());
+ popup->setItemEnabled(psc, !port->IsLinked());
+ }
+ main->showPopup(popup, e);
+}
void SUPERVGUI_PortIn::deleteLinks() {
if (myLinkPrs) {
void SUPERVGUI_PortIn::sync() {
SUPERVGUI_Port::sync();
- if (port->IsLinked()) {
- popup->setItemEnabled(browser, port->State() == SUPERV_Ready);
- } else {
+ // if (port->IsLinked()) {
+ // popup->setItemEnabled(browser, port->State() == SUPERV_Ready);
+ //} else {
+ if (!port->IsLinked()) {
if (port->HasInput()) {
- popup->setItemEnabled(browser, true);
+ // popup->setItemEnabled(browser, true);
setLineWidth(2);
} else {
- popup->setItemEnabled(browser, false);
+ //popup->setItemEnabled(browser, false);
setLineWidth(1);
}
}
}
}
-void SUPERVGUI_PortIn::browse() {
+/*void SUPERVGUI_PortIn::browse() {
Trace("SUPERVGUI_PortIn::browse")
QString mess(tr("MSG_IPORT_VAL"));
mess += port->ToString();
QMessageBox::information(QAD_Application::getDesktop(), tr("MSG_INFO"), mess);
-}
+ }*/
// Port de sortie
// --------------
-SUPERVGUI_PortOut::SUPERVGUI_PortOut(QWidget* parent, SUPERVGUI_Main* m, SUPERV_Port p):
+SUPERVGUI_PortOut::SUPERVGUI_PortOut(QWidget* parent, SUPERVGUI_Main* m, SUPERV::Port_ptr p):
SUPERVGUI_Port(parent, m, p),
study(false)
{
if (!port->IsGate()) {
pls = popup->insertItem(tr("MSG_PUT_INSTUDY"), this, SLOT(toStudy()));
}
- browser = popup->insertItem(tr("MSG_BROWSE"), this, SLOT(browse()));
+ //browser = popup->insertItem(tr("MSG_BROWSE"), this, SLOT(browse()));
if (!main->getDataflow()->IsReadOnly()) {
popup->setItemEnabled(mySketchItem, true);
SUPERVGUI_Port::sync();
bool ok = (port->State() == SUPERV_Ready);
- popup->setItemEnabled(browser, ok);
+ // popup->setItemEnabled(browser, ok);
if (study && ok) {
study = main->putDataStudy(port, STUDY_PORT_OUT);
}
sync();
}
-void SUPERVGUI_PortOut::browse() {
+/*void SUPERVGUI_PortOut::browse() {
Trace("SUPERVGUI_PortOut::browse")
QString mess(tr("MSG_OPORT_VAL"));
mess += port->ToString();
QMessageBox::information(QAD_Application::getDesktop(), tr("MSG_INFO"), mess);
-}
+ }*/
/**
// ----------------------------
// Input Port of EndSwitch Node
// ----------------------------
-SUPERVGUI_PortInESNode::SUPERVGUI_PortInESNode(QWidget* parent, SUPERVGUI_Main* m, SUPERV_Port p)
+SUPERVGUI_PortInESNode::SUPERVGUI_PortInESNode(QWidget* parent, SUPERVGUI_Main* m, SUPERV::Port_ptr p)
: SUPERVGUI_Port(parent, m, p), myDlg( 0 )
{
Trace("SUPERVGUI_PortInESNode::SUPERVGUI_PortInESNode");
if ((!port->IsGate()) && editing ) {
psc = popup->insertItem(tr("MSG_SETVALUE"),this, SLOT(setInput()));
}
- browser = popup->insertItem(tr("MSG_BROWSE"),this, SLOT(browse()));
+ // browser = popup->insertItem(tr("MSG_BROWSE"),this, SLOT(browse()));
}
SUPERVGUI_PortInESNode::~SUPERVGUI_PortInESNode() {
void SUPERVGUI_PortInESNode::sync() {
SUPERVGUI_Port::sync();
- if (port->IsLinked()) {
+ /* if (port->IsLinked()) {
popup->setItemEnabled(browser, port->State() == SUPERV_Ready);
- } else {
+ } else {*/
+ if (!port->IsLinked()) {
if (port->HasInput()) {
- popup->setItemEnabled(browser, true);
+ // popup->setItemEnabled(browser, true);
setLineWidth(2);
} else {
- popup->setItemEnabled(browser, false);
+ // popup->setItemEnabled(browser, false);
setLineWidth(1);
}
}
}
}
-void SUPERVGUI_PortInESNode::browse() {
+/*void SUPERVGUI_PortInESNode::browse() {
Trace("SUPERVGUI_PortInESNode::browse")
QString mess(tr("MSG_IPORT_VAL"));
mess += port->ToString();
QMessageBox::information(QAD_Application::getDesktop(), tr("MSG_INFO"), mess);
-}
+ }*/
void SUPERVGUI_PortInESNode::onDeleteLink(SUPERVGUI_Link* theLink) {
}
}
+
+
+// ----------------------------
+// Stream Ports
+// ----------------------------
+SUPERVGUI_StreamInDlg::SUPERVGUI_StreamInDlg(SUPERVGUI_StreamPortIn* thePort)
+ :QDialog( QAD_Application::getDesktop(), "", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+ myPort = thePort;
+ setSizeGripEnabled( true );
+ setCaption( tr( "MSG_STREAM_DLG_TIT" ) );
+
+ QVBoxLayout* TopLayout = new QVBoxLayout( this, 11, 6 );
+
+ QFrame* aCtrlPane = new QFrame(this);
+ QGridLayout* aCtrlLayout = new QGridLayout( aCtrlPane, 4, 10 );
+
+ // Schema
+ QLabel* aSchemaLbl = new QLabel(tr("MSG_STREAM_SCHEMA"),aCtrlPane);
+ aCtrlLayout->addWidget(aSchemaLbl, 0, 0);
+
+ mySchemaCombo = new QComboBox(aCtrlPane, "SchemaBox" );
+ mySchemaCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ mySchemaCombo->insertItem("SCHENULL");
+ mySchemaCombo->insertItem("TI");
+ mySchemaCombo->insertItem("TF");
+ mySchemaCombo->insertItem("DELTA");
+ aCtrlLayout->addWidget(mySchemaCombo, 0, 1);
+
+ // Interpolation
+ QLabel* aInterLbl = new QLabel(tr("MSG_STREAM_INTER"),aCtrlPane);
+ aCtrlLayout->addWidget(aInterLbl, 1, 0);
+
+ myInterCombo = new QComboBox(aCtrlPane, "InterBox" );
+ myInterCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ myInterCombo->insertItem("INTERNULL");
+ myInterCombo->insertItem("L0");
+ myInterCombo->insertItem("L1");
+ aCtrlLayout->addWidget(myInterCombo, 1, 1);
+
+ // Extrapolation
+ QLabel* aExtraLbl = new QLabel(tr("MSG_STREAM_EXTRA"),aCtrlPane);
+ aCtrlLayout->addWidget(aExtraLbl, 2, 0);
+
+ myExterCombo = new QComboBox(aCtrlPane, "ExtraBox" );
+ myExterCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ myExterCombo->insertItem("EXTRANULL");
+ myExterCombo->insertItem("E0");
+ myExterCombo->insertItem("E1");
+ aCtrlLayout->addWidget(myExterCombo, 2, 1);
+
+ TopLayout->addWidget( aCtrlPane );
+
+ // Buttons
+ QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
+ GroupButtons->setColumnLayout(0, Qt::Vertical );
+ GroupButtons->layout()->setSpacing( 0 );
+ GroupButtons->layout()->setMargin( 0 );
+ QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setSpacing( 5 );
+ GroupButtonsLayout->setMargin( 8 );
+
+ QPushButton* okB = new QPushButton( tr( "BUT_OK" ), GroupButtons );
+ QPushButton* cancelB = new QPushButton( tr( "BUT_CANCEL" ), GroupButtons );
+
+ GroupButtonsLayout->addWidget( okB, 0, 0 );
+ GroupButtonsLayout->addItem ( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
+ GroupButtonsLayout->addWidget( cancelB, 0, 2 );
+
+ TopLayout->addWidget( GroupButtons );
+
+ connect( okB, SIGNAL( clicked() ), this, SLOT( accept() ) );
+ connect( cancelB, SIGNAL( clicked() ), this, SLOT( reject() ) );
+ setData();
+}
+
+
+void SUPERVGUI_StreamInDlg::setData() {
+ SUPERV::KindOfSchema aSchema;
+ SUPERV::KindOfInterpolation aInterpolat;
+ SUPERV::KindOfExtrapolation aExtrapolat;
+
+ myPort->getStreamPort()->Params(aSchema, aInterpolat, aExtrapolat);
+
+ mySchemaCombo->setCurrentItem((int)aSchema);
+ myInterCombo->setCurrentItem((int)aInterpolat);
+ myExterCombo->setCurrentItem((int)aExtrapolat);
+}
+
+
+
+void SUPERVGUI_StreamInDlg::accept() {
+ myPort->getStreamPort()->SetParams((SUPERV::KindOfSchema) mySchemaCombo->currentItem(),
+ (SUPERV::KindOfInterpolation) myInterCombo->currentItem(),
+ (SUPERV::KindOfExtrapolation) myExterCombo->currentItem());
+ QDialog::accept();
+}
+
+//---------------------------------------------------------------------------------------
+
+
+SUPERVGUI_StreamPortIn::SUPERVGUI_StreamPortIn(QWidget* parent, SUPERVGUI_Main* m, SUPERV::StreamPort_ptr p):
+ SUPERVGUI_PortIn(parent, m, p)
+{
+ myPort = SUPERV::StreamPort::_duplicate(p);
+ myParamItem = popup->insertItem(tr("MSG_STREAM_PARAM"),this, SLOT(setParams()));
+}
+
+SUPERVGUI_StreamPortIn::~SUPERVGUI_StreamPortIn()
+{
+}
+
+
+void SUPERVGUI_StreamPortIn::setParams()
+{
+ SUPERVGUI_StreamInDlg* aDlg = new SUPERVGUI_StreamInDlg(this);
+ aDlg->exec();
+ delete aDlg;
+}
+
+
+void SUPERVGUI_StreamPortIn::sync()
+{
+ SUPERVGUI_PortIn::sync();
+ setText(myName + "=" + myPort->ToString());
+}
+
+//-------------------------------------------------------------------------
+
+SUPERVGUI_StreamOutDlg::SUPERVGUI_StreamOutDlg(SUPERVGUI_StreamPortOut* thePort)
+ :QDialog( QAD_Application::getDesktop(), "", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+ myPort = thePort;
+ setSizeGripEnabled( true );
+ setCaption( tr( "MSG_STREAM_DLG_TIT" ) );
+
+ QVBoxLayout* TopLayout = new QVBoxLayout( this, 11, 6 );
+
+ QFrame* aCtrlPane = new QFrame(this);
+ QGridLayout* aCtrlLayout = new QGridLayout( aCtrlPane, 4, 10 );
+
+ QLabel* aLbl = new QLabel(tr("MSG_STREAM_LEVEL"),aCtrlPane);
+ aCtrlLayout->addWidget(aLbl, 0, 0);
+
+ myValEdit = new QLineEdit( aCtrlPane, "ValEdit" );
+ myValEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ myValEdit->setValidator( new QIntValidator(this) );
+ myValEdit->setText(QString("%1").arg(myPort->getStreamPort()->NumberOfValues()));
+ aCtrlLayout->addWidget(myValEdit, 0, 1);
+ TopLayout->addWidget( aCtrlPane );
+
+ // Buttons
+ QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
+ GroupButtons->setColumnLayout(0, Qt::Vertical );
+ GroupButtons->layout()->setSpacing( 0 );
+ GroupButtons->layout()->setMargin( 0 );
+ QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setSpacing( 5 );
+ GroupButtonsLayout->setMargin( 8 );
+
+ QPushButton* okB = new QPushButton( tr( "BUT_OK" ), GroupButtons );
+ QPushButton* cancelB = new QPushButton( tr( "BUT_CANCEL" ), GroupButtons );
+
+ GroupButtonsLayout->addWidget( okB, 0, 0 );
+ GroupButtonsLayout->addItem ( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
+ GroupButtonsLayout->addWidget( cancelB, 0, 2 );
+
+ TopLayout->addWidget( GroupButtons );
+
+ connect( okB, SIGNAL( clicked() ), this, SLOT( accept() ) );
+ connect( cancelB, SIGNAL( clicked() ), this, SLOT( reject() ) );
+}
+
+void SUPERVGUI_StreamOutDlg::accept() {
+ int aRes = 0;
+ QString aStr = myValEdit->text();
+ if (!aStr.isEmpty())
+ aRes = aStr.toLong();
+ myPort->getStreamPort()->SetNumberOfValues(aRes);
+ QDialog::accept();
+}
+
+
+//------------------------------------------------------------------------------------------------
+
+SUPERVGUI_StreamPortOut::SUPERVGUI_StreamPortOut(QWidget* parent, SUPERVGUI_Main* m, SUPERV::StreamPort_ptr p):
+ SUPERVGUI_PortOut(parent, m, p)
+{
+ myPort = SUPERV::StreamPort::_duplicate(p);
+ myParamItem = popup->insertItem(tr("MSG_STREAM_PARAM"),this, SLOT(setParams()));
+}
+
+SUPERVGUI_StreamPortOut::~SUPERVGUI_StreamPortOut()
+{
+}
+
+void SUPERVGUI_StreamPortOut::setParams()
+{
+ SUPERVGUI_StreamOutDlg* aDlg = new SUPERVGUI_StreamOutDlg(this);
+ aDlg->exec();
+ delete aDlg;
+}
+
+
+void SUPERVGUI_StreamPortOut::sync()
+{
+ SUPERVGUI_PortOut::sync();
+ setText(myName + "=" + myPort->ToString());
+}
+
+
+//------------------------------------------------------------------------------------------------
Q_OBJECT
public:
- SUPERVGUI_Port(QWidget* parent, SUPERVGUI_Main* m, SUPERV_Port p);
+ SUPERVGUI_Port(QWidget* parent, SUPERVGUI_Main* m, SUPERV::Port_ptr p);
virtual ~SUPERVGUI_Port();
SUPERV_Port getPort();
void endSketch();
protected slots:
+ void browse();
virtual void deletePort();
protected:
SUPERVGUI_Main* main;
- SUPERV_Port port;
+ SUPERV_Port port;
QPopupMenu* popup;
int mySketchItem;
QString myName;
private slots:
- void showPopup(QMouseEvent* e);
+ virtual void showPopup(QMouseEvent* e);
};
Q_OBJECT
public:
- SUPERVGUI_PortIn(QWidget* parent, SUPERVGUI_Main* m, SUPERV_Port p);
+ SUPERVGUI_PortIn(QWidget* parent, SUPERVGUI_Main* m, SUPERV::Port_ptr p);
virtual ~SUPERVGUI_PortIn();
bool eventFilter( QObject* o, QEvent* e );
private slots:
void setInput();
- void browse();
+ // void browse();
void onDeleteLink(SUPERVGUI_Link*);
+ virtual void showPopup(QMouseEvent* e);
private:
Q_OBJECT
public:
- SUPERVGUI_PortOut(QWidget* parent, SUPERVGUI_Main* m, SUPERV_Port p);
+ SUPERVGUI_PortOut(QWidget* parent, SUPERVGUI_Main* m, SUPERV::Port_ptr p);
virtual ~SUPERVGUI_PortOut();
void sync();
private slots:
void toStudy();
- void browse();
+ // void browse();
void sketch(QMouseEvent* e);
void onDeleteLink(SUPERVGUI_Link*);
Q_OBJECT
public:
- SUPERVGUI_PortInESNode(QWidget* parent, SUPERVGUI_Main* m, SUPERV_Port p);
+ SUPERVGUI_PortInESNode(QWidget* parent, SUPERVGUI_Main* m, SUPERV::Port_ptr p);
virtual ~SUPERVGUI_PortInESNode();
bool eventFilter( QObject* o, QEvent* e );
private slots:
void setInput();
- void browse();
+ // void browse();
void onDeleteLink(SUPERVGUI_Link*);
SUPERVGUI_GetValueDlg* myDlg;
};
+
+
+
+
+
+
+
+//****************************************************************
+class SUPERVGUI_StreamPortIn;
+class SUPERVGUI_StreamInDlg: public QDialog
+{
+ Q_OBJECT
+public:
+ SUPERVGUI_StreamInDlg(SUPERVGUI_StreamPortIn* thePort);
+ virtual ~SUPERVGUI_StreamInDlg() {};
+
+protected slots:
+ void accept();
+
+private:
+ void setData();
+
+ SUPERVGUI_StreamPortIn* myPort;
+ QComboBox* mySchemaCombo;
+ QComboBox* myInterCombo;
+ QComboBox* myExterCombo;
+};
+
+class SUPERVGUI_StreamPortIn: public SUPERVGUI_PortIn
+{
+ Q_OBJECT
+public:
+ SUPERVGUI_StreamPortIn(QWidget* parent, SUPERVGUI_Main* m, SUPERV::StreamPort_ptr p);
+ virtual ~SUPERVGUI_StreamPortIn();
+
+ void sync();
+ SUPERV_StreamPort getStreamPort() { return myPort;}
+
+private slots:
+ void setParams();
+
+private:
+ SUPERV_StreamPort myPort;
+
+ int myParamItem;
+};
+
+
+//**************************************************************
+class SUPERVGUI_StreamPortOut;
+class SUPERVGUI_StreamOutDlg: public QDialog
+{
+ Q_OBJECT
+public:
+ SUPERVGUI_StreamOutDlg(SUPERVGUI_StreamPortOut* thePort);
+ virtual ~SUPERVGUI_StreamOutDlg() {};
+
+protected slots:
+ void accept();
+
+private:
+ SUPERVGUI_StreamPortOut* myPort;
+ QLineEdit* myValEdit;
+};
+
+class SUPERVGUI_StreamPortOut: public SUPERVGUI_PortOut
+{
+ Q_OBJECT
+public:
+ SUPERVGUI_StreamPortOut(QWidget* parent, SUPERVGUI_Main* m, SUPERV::StreamPort_ptr p);
+ virtual ~SUPERVGUI_StreamPortOut();
+
+ void sync();
+ SUPERV_StreamPort getStreamPort() { return myPort;}
+
+private slots:
+ void setParams();
+
+private:
+ SUPERV_StreamPort myPort;
+ int myParamItem;
+};
+
+
#endif
//QHGroupBox* aAddBox = new QHGroupBox(tr("TIT_ADDNODE"), aCorbaPane); //!!
//aAddBox->setInsideSpacing(20); //!!
- QPushButton* aComputeCBtn = new QPushButton(tr("TIT_ADDCNODE"), aCorbaPane); //!!
- connect(aComputeCBtn, SIGNAL(clicked()), this, SLOT(addComputeNode())); //!!
- aComputeCBtn->setDefault(false);
+//NRI QPushButton* aComputeCBtn = new QPushButton(tr("TIT_ADDCNODE"), aCorbaPane); //!!
+//NRI connect(aComputeCBtn, SIGNAL(clicked()), this, SLOT(addComputeNode())); //!!
+//NRI aComputeCBtn->setDefault(false);
QPushButton* aComputeBtn = new QPushButton(tr("TIT_ADDFNODE"), aCorbaPane);
connect(aComputeBtn, SIGNAL(clicked()), this, SLOT(addFactoryNode()));
aComputeBtn->setDefault(true);
aBaseLayout->addWidget(aComputeBtn);
- aBaseLayout->addWidget(aComputeCBtn); //!!
+ //NRI aBaseLayout->addWidget(aComputeCBtn); //!!
aBaseLayoutV->insertLayout(-1, aBaseLayout);
myTabPane->addTab(aCorbaPane, tr("MODULES_PANE"));
}
+char* getDataStreamParameterName(int aType)
+{
+ switch(aType) {
+ case 1:
+ return "integer";
+ case 2:
+ return "float";
+ case 3:
+ return "double";
+ case 4:
+ return "string";
+ case 6:
+ return "boolean";
+ default:
+ return "unknown";
+ }
+}
void SUPERVGUI_Service::initialise() {
CORBA::Object_ptr obj = naming->Resolve("/Kernel/ModulCatalog");
long nbComp = lComponents->length();
for (int i=0; i<nbComp; i++) {
SALOME_ModuleCatalog::Acomponent_ptr C = (*aModuleCatalog)->GetComponent((char *)lComponents[i]);
- QListViewItem* myComponentItem = new QListViewItem(components, (char*)lComponents[i]);
+ QListViewItem* myComponentItem = new QListViewItem(components, (char*)C->componentusername());
myComponentItem->setSelectable(false);
QString aIconName = C->component_icone();
if (!aIconName.isEmpty()) {
long nbPortsOut = Service->ServiceoutParameter.length();
for (int m=0; m<nbPortsOut; m++) {
SALOME_ModuleCatalog::ServicesParameter* PortOut = &(Service->ServiceoutParameter[m]);
- QListViewItem* myPortOutItem = new QListViewItem(myServiceItem, (char*)PortOut->Parametername, (char*)PortOut->Parametertype, "Out");
+ QListViewItem* myPortOutItem =
+ new QListViewItem(myServiceItem, (char*)PortOut->Parametername, (char*)PortOut->Parametertype, "Out");
+ myPortOutItem->setSelectable(false);
+ }
+
+ long nbStreamPortsOut = Service->ServiceoutDataStreamParameter.length();
+ for (int m=0; m<nbStreamPortsOut; m++) {
+ SALOME_ModuleCatalog::ServicesDataStreamParameter* PortOut = &(Service->ServiceoutDataStreamParameter[m]);
+ QListViewItem* myPortOutItem =
+ new QListViewItem(myServiceItem, (char*)PortOut->Parametername,
+ getDataStreamParameterName(PortOut->Parametertype), "DataStream Out");
myPortOutItem->setSelectable(false);
}
long nbPortsIn = Service->ServiceinParameter.length();
for (int l=0; l<nbPortsIn; l++) {
SALOME_ModuleCatalog::ServicesParameter* PortIn = &(Service->ServiceinParameter[l]);
- QListViewItem* myPortInItem = new QListViewItem(myServiceItem, (char*)PortIn->Parametername, (char*)PortIn->Parametertype, "In");
+ QListViewItem* myPortInItem =
+ new QListViewItem(myServiceItem, (char*)PortIn->Parametername, (char*)PortIn->Parametertype, "In");
+ myPortInItem->setSelectable(false);
+ }
+
+ long nbStreamPortsIn = Service->ServiceinDataStreamParameter.length();
+ for (int l=0; l<nbStreamPortsIn; l++) {
+ SALOME_ModuleCatalog::ServicesDataStreamParameter* PortIn = &(Service->ServiceinDataStreamParameter[l]);
+ QListViewItem* myPortInItem =
+ new QListViewItem(myServiceItem, (char*)PortIn->Parametername,
+ getDataStreamParameterName(PortIn->Parametertype), "DataStream In");
myPortInItem->setSelectable(false);
}
}
}
void SUPERVGUI_Service::addComputeNode() {
+ QAD_Desktop* aDesktop = QAD_Application::getDesktop();
SUPERVGUI_Main* aMain = Supervision.getMain();
if (aMain==0) {
- QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NO_SUPERVISION_WINDOW"));
+ QMessageBox::warning(aDesktop, tr("WARNING"), tr("MSG_NO_SUPERVISION_WINDOW"));
} else {
CORBA::Object_ptr obj = naming->Resolve("/Kernel/ModulCatalog");
SALOME_ModuleCatalog::ModuleCatalog_var* aModuleCatalog = new SALOME_ModuleCatalog::ModuleCatalog_var;
const char* service = item->text(0).latin1();
const char* interface = item->parent()->text(0).latin1();
const char* component = item->parent()->parent()->text(0).latin1();
- SALOME_ModuleCatalog::Acomponent_ptr myComponent = (*aModuleCatalog)->GetComponent(component);
+ SALOME_ModuleCatalog::Acomponent_ptr myComponent = (*aModuleCatalog)->GetComponent(aDesktop->getComponentName(component));
if (myComponent==NULL) {
- QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_CHOOSE_SERVICE"));
+ QMessageBox::warning(aDesktop, tr("ERROR"), tr("MSG_CANT_CHOOSE_SERVICE"));
} else {
const SALOME_ModuleCatalog::Service* myService = myComponent->GetService(interface, service);
b = true;
}
}
if (!b) {
- QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NONODE_TOADD"));
+ QMessageBox::warning(aDesktop, tr("WARNING"), tr("MSG_NONODE_TOADD"));
}
}
}
}
void SUPERVGUI_Service::addFactoryNode() {
+ QAD_Desktop* aDesktop = QAD_Application::getDesktop();
SUPERVGUI_Main* aMain = Supervision.getMain();
if (aMain==0) {
- QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NO_SUPERVISION_WINDOW"));
+ QMessageBox::warning(aDesktop, tr("WARNING"), tr("MSG_NO_SUPERVISION_WINDOW"));
} else {
CORBA::Object_ptr obj = naming->Resolve("/Kernel/ModulCatalog");
SALOME_ModuleCatalog::ModuleCatalog_var* aModuleCatalog = new SALOME_ModuleCatalog::ModuleCatalog_var;
if (item->isSelected()) {
const char* service = item->text(0).latin1();
const char* interface = item->parent()->text(0).latin1();
- const char* component = item->parent()->parent()->text(0).latin1();
+ const char* component = aDesktop->getComponentName(item->parent()->parent()->text(0).latin1());
SALOME_ModuleCatalog::Acomponent_ptr myComponent = (*aModuleCatalog)->GetComponent(component);
if (myComponent==NULL) {
- QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_CHOOSE_SERVICE"));
+ QMessageBox::warning(aDesktop, tr("ERROR"), tr("MSG_CANT_CHOOSE_SERVICE"));
} else {
const SALOME_ModuleCatalog::Service* myService = myComponent->GetService(interface, service);
b = true;
- SUPERV_FNode node = aMain->getDataflow()->FNode(component, interface, *myService);
- if (CORBA::is_nil(node)) {
- QMessageBox::warning(0, tr("ERROR"), tr("MSG_CANT_CREATE_NODE"));
- return;
+ MESSAGE ( " myService->TypeOfNode == " << myService->TypeOfNode )
+
+ if ( myService->TypeOfNode == 0 ) { // ComputeNode
+ SUPERV_CNode node = aMain->getDataflow()->CNode(*myService);
+ if (CORBA::is_nil(node)) {
+ QMessageBox::warning(0, tr("ERROR"), tr("MSG_CANT_CREATE_NODE"));
+ return;
+ }
+ node->Coords(myX, myY);
+ myX += NODE_DX;
+ myY += NODE_DY;
+ aMain->addComputeNode(SUPERV::CNode::_narrow(node));
+ } else { // Factory Node
+ SUPERV_FNode node = aMain->getDataflow()->FNode(component, interface, *myService);
+ if (CORBA::is_nil(node)) {
+ QMessageBox::warning(0, tr("ERROR"), tr("MSG_CANT_CREATE_NODE"));
+ return;
+ }
+ node->Coords(myX, myY);
+ myX += NODE_DX;
+ myY += NODE_DY;
+ aMain->addComputeNode(SUPERV::CNode::_narrow(node));
+
}
- node->Coords(myX, myY);
- myX += NODE_DX;
- myY += NODE_DY;
- aMain->addComputeNode(SUPERV::CNode::_narrow(node));
- }
+
+// SUPERV_FNode node = aMain->getDataflow()->FNode(component, interface, *myService);
+// if (CORBA::is_nil(node)) {
+// QMessageBox::warning(0, tr("ERROR"), tr("MSG_CANT_CREATE_NODE"));
+// return;
+// }
+// node->Coords(myX, myY);
+// myX += NODE_DX;
+// myY += NODE_DY;
+// aMain->addComputeNode(SUPERV::CNode::_narrow(node));
+ }
}
}
if (!b) {
#include "SUPERVGUI_View.h"
#include "SUPERVGUI_Main.h"
#include "QAD_Config.h"
-
+#include <qcolordialog.h>
#if QT_VERSION >= 0x030005
myLastY = 0;
myIsDragging = false;
myCursor = cursor();
+ myDSItemID = -1;
// myLastMinVisX = horizontalScrollBar()->value(); //viewport()->x();
// myLastMinVisY = verticalScrollBar()->value(); //viewport()->y();
myPopup->insertItem(tr("MSG_COPY_DATAFLOW"), main, SLOT(copy()));
myPopup->insertItem(tr("MSG_FILTER_NOTIFY"), main, SLOT(filterNotification()));
+ myPopup->insertSeparator();
+ myPopup->insertItem(tr("MSG_CHANGE_BACKGROUND"), this, SLOT(changeBackground()));
+
QString aRed = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorRed");
QString aGreen = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorGreen");
QString aBlue = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorBlue");
{
}
+bool SUPERVGUI_View::isHavingStreamPort()
+{
+ SUPERV::ListOfNodes* aNodesList = main->getDataflow()->Nodes();
+
+ //Computing Nodes
+ for ( int i = 0 ; i < (int) aNodesList->CNodes.length() ; i++ ) {
+ SUPERV::ListOfStreamPorts aStrPortsList = *( (aNodesList->CNodes)[i]->StreamPorts() );
+ if ((int) aStrPortsList.length() > 0) {
+ return true;
+ }
+ }
+
+ //FactoryNodes
+ for ( int i = 0 ; i < (int) aNodesList->FNodes.length() ; i++ ) {
+ SUPERV::ListOfStreamPorts aStrPortsList = *( (aNodesList->FNodes)[i]->StreamPorts() );
+ if ((int) aStrPortsList.length() > 0) {
+ return true;
+ }
+ }
+
+ //InLineNodes
+ for ( int i = 0 ; i < (int) aNodesList->INodes.length() ; i++ ) {
+ SUPERV::ListOfStreamPorts aStrPortsList = *( (aNodesList->INodes)[i]->StreamPorts() );
+ if ((int) aStrPortsList.length() > 0) {
+ return true;
+ }
+ }
+
+ //GOTONodes
+ for ( int i = 0 ; i < (int) aNodesList->GNodes.length() ; i++ ) {
+ SUPERV::ListOfStreamPorts aStrPortsList = *( (aNodesList->GNodes)[i]->StreamPorts() );
+ if ((int) aStrPortsList.length() > 0) {
+ return true;
+ }
+ }
+
+ //LoopNodes
+ for ( int i = 0 ; i < (int) aNodesList->LNodes.length() ; i++ ) {
+ SUPERV::ListOfStreamPorts aStrPortsList = *( (aNodesList->LNodes)[i]->StreamPorts() );
+ if ((int) aStrPortsList.length() > 0) {
+ return true;
+ }
+ }
+
+ //SwitchNodes
+ for ( int i = 0 ; i < (int) aNodesList->SNodes.length() ; i++ ) {
+ SUPERV::ListOfStreamPorts aStrPortsList = *( (aNodesList->SNodes)[i]->StreamPorts() );
+ if ((int) aStrPortsList.length() > 0) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void SUPERVGUI_View::addDSPopupItem()
+{
+ if (myDSItemID == -1) {
+ //Popupmenu items for user specification of parameters, if there are any DataStream ports in the graph
+ if (isHavingStreamPort()) {
+ myPopup->insertSeparator();
+ myDSItemID = myPopup->insertItem(tr("MSG_SET_GRAPHPARAMS"), main, SLOT(changeDSGraphParameters()));
+ }
+ }
+}
+
void SUPERVGUI_View::viewportMousePressEvent(QMouseEvent* theEvent)
{
myIsDragging = true;
int SUPERVGUI_View::getLastY() {
return myLastY;
}
+void SUPERVGUI_View::changeBackground()
+{
+ QColor selColor = QColorDialog::getColor(viewport()->paletteBackgroundColor(), this );
+ if ( selColor.isValid() ) {
+ setPaletteBackgroundColor( selColor );
+ }
+}
int getLastX();
int getLastY();
+ void addDSPopupItem();
+
public slots:
void addToStudy();
+ void changeBackground();
protected:
void viewportMouseMoveEvent(QMouseEvent* theEvent);
void viewportMouseReleaseEvent(QMouseEvent* theEvent);
void viewportMousePressEvent(QMouseEvent* theEvent);
+ bool isHavingStreamPort();
SUPERVGUI_Main* main;
QPopupMenu* myPopup;
int myAddStudyItem;
private:
+ int myDSItemID;
int myDx;
int myDy;
int myLastX;
msgid "MSG_BROWSE"
msgstr "Browse"
+msgid "MSG_STREAM_PARAM"
+msgstr "Parameters..."
+
+msgid "MSG_STREAM_DLG_TIT"
+msgstr "Stream Port Parameters"
+
+msgid "MSG_STREAM_DLG_TIT"
+msgstr "Stream Port Parameters"
+
+msgid "MSG_STREAM_SCHEMA"
+msgstr "Schema"
+
+msgid "MSG_STREAM_INTER"
+msgstr "Interpolation"
+
+msgid "MSG_STREAM_EXTRA"
+msgstr "Extrapolation"
+
+msgid "MSG_STREAM_LEVEL"
+msgstr "Level"
+
msgid "MSG_DELLINK"
msgstr "Delete Link"
msgid "MSG_INS_FILE"
msgstr "Insert File"
+msgid "MSG_SET_GRAPHPARAMS"
+msgstr "Stream Graph Parameters..."
+
msgid "MSG_COPY_DATAFLOW"
msgstr "Copy Dataflow"
msgid "MSG_FILTER_NOTIFY"
msgstr "Filter Notification"
+msgid "MSG_CHANGE_BACKGROUND"
+msgstr "Change background..."
+
msgid "MSG_SWITCH_GRAPH"
msgstr "Switch Graph"
msgid "TLT_INFORMATIONS"
msgstr "Informations"
+msgid "TLT_DSGRAPHPARAMS"
+msgstr "Data Stream Graph Parameters"
+
+msgid "DELTATIME_LBL"
+msgstr "DeltaTime (double):"
+
+msgid "TIMEOUT_LBL"
+msgstr "TimeOut (unsigned long):"
+
+msgid "DATASTREAMTRACE_LBL"
+msgstr "DataStreamTrace:"
+
msgid "NAME_LBL"
msgstr "Name:"
msgstr "Add Compute Node"
msgid "TIT_ADDFNODE"
-msgstr "Add Factory Node"
+msgstr "Add Node"
msgid "BTN_FACTORYNODE"
msgstr "Factory"
--- /dev/null
+// SuperVisionTest SubComponent : example of component that sunstracts one number from another
+//
+// 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 : SubComponentEngine.cxx
+// Author : MARC TAJCHMAN, CEA
+// Module : SuperVisionTest
+
+using namespace std;
+#include <stdio.h>
+#include <unistd.h>
+#include <fstream>
+#include <sstream>
+#include <string>
+
+//#include "utilities.h"
+#include "SubComponent.hxx"
+
+SubComponentEngine::SubComponentEngine( 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("SubComponentEngine::SubComponentEngine activate object instanceName("
+// << instanceName << ") interfaceName(" << interfaceName << ")" )
+ _thisObj = this ;
+ _id = _poa->activate_object(_thisObj);
+ _nexec = 0 ;
+}
+
+SubComponentEngine::SubComponentEngine()
+{
+}
+
+SubComponentEngine::~SubComponentEngine()
+{
+}
+
+void SubComponentEngine::Sub( double x , double y , double & z ) {
+ beginService( " SubComponentEngine::Sub" );
+ z = x - y ;
+ int S;
+
+ sendMessage(NOTIF_STEP, "Sub is Computing");
+ S = 1+(int) (15.0*rand()/(RAND_MAX+1.0));
+ sleep(S);
+ MESSAGE( "SubComponentEngine::Sub( " << x << " , " << y << " , " << z
+ << " ) after " << S << " seconds" )
+ endService( " SubComponentEngine::Sub" );
+}
+
+extern "C"
+{
+ PortableServer::ObjectId * SubComponentEngine_factory
+ (CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
+ const char *interfaceName)
+ {
+ MESSAGE("SubComponentEngine_factory SubComponentEngine ("
+ << instanceName << "," << interfaceName << ")");
+ SubComponentEngine * mySubComponent
+ = new SubComponentEngine(orb, poa, contId, instanceName, interfaceName);
+ return mySubComponent->getId() ;
+ }
+}
+
+
//#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 ,
_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 ;
_thisObj->_remove_ref();
}
}
- endService( "CNode_Impl::Destroy" );
+// endService( "CNode_Impl::Destroy" );
}
bool CNode_Impl::Delete() {
if ( _DataFlowEditor->IsEditing() ) {
RetVal = _DataFlowEditor->RemoveNode( Name() ) ;
if ( RetVal ) {
- RetVal = _DataFlowEditor->IsValid() ;
+ RetVal = _DataFlowEditor->UnValid() ;
}
}
endService( "CNode_Impl::Delete" );
RetVal = _DataFlowNode->Name() ;
}
else {
- RetVal = _DataFlowEditor->Name() ;
+ RetVal = _DataFlowEditor->Graph()->Name() ;
}
// endService( "CNode_Impl::Name" );
return CORBA::string_dup( RetVal );
aDataFlowName ) ;
}
else {
- RetVal = _DataFlowEditor->Name( aDataFlowName ) ;
+ RetVal = _DataFlowEditor->Graph()->Name( aDataFlowName ) ;
}
}
// endService( "CNode_Impl::SetName" );
RetVal = _DataFlowNode->Kind() ;
}
else {
- RetVal = _DataFlowEditor->Kind() ;
+ RetVal = _DataFlowEditor->Graph()->Kind() ;
}
// endService( "CNode_Impl::Kind" );
return RetVal ;
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 ;
RetVal = _DataFlowNode->IsComputingNode() ;
}
else {
- RetVal = _DataFlowEditor->IsComputingNode() ;
+ RetVal = _DataFlowEditor->Graph()->IsComputingNode() ;
}
// endService( "CNode_Impl::IsComputing" );
return RetVal ;
RetVal = _DataFlowNode->IsFactoryNode() ;
}
else {
- RetVal = _DataFlowEditor->IsFactoryNode() ;
+ RetVal = _DataFlowEditor->Graph()->IsFactoryNode() ;
}
// endService( "CNode_Impl::IsFactory" );
return RetVal ;
RetVal = _DataFlowNode->IsInLineNode() ;
}
else {
- RetVal = _DataFlowEditor->IsInLineNode() ;
+ RetVal = _DataFlowEditor->Graph()->IsInLineNode() ;
}
// endService( "CNode_Impl::IsInLine" );
return RetVal ;
RetVal = _DataFlowNode->IsGOTONode() ;
}
else {
- RetVal = _DataFlowEditor->IsGOTONode() ;
+ RetVal = _DataFlowEditor->Graph()->IsGOTONode() ;
}
// endService( "CNode_Impl::IsGOTO" );
return RetVal ;
RetVal = _DataFlowNode->IsLoopNode() ;
}
else {
- RetVal = _DataFlowEditor->IsLoopNode() ;
+ RetVal = _DataFlowEditor->Graph()->IsLoopNode() ;
}
// endService( "CNode_Impl::IsLoop" );
return RetVal ;
RetVal = _DataFlowNode->IsEndLoopNode() ;
}
else {
- RetVal = _DataFlowEditor->IsEndLoopNode() ;
+ RetVal = _DataFlowEditor->Graph()->IsEndLoopNode() ;
}
// endService( "CNode_Impl::IsEndLoop" );
return RetVal ;
RetVal = _DataFlowNode->IsSwitchNode() ;
}
else {
- RetVal = _DataFlowEditor->IsSwitchNode() ;
+ RetVal = _DataFlowEditor->Graph()->IsSwitchNode() ;
}
// endService( "CNode_Impl::IsSwitch" );
return RetVal ;
RetVal = _DataFlowNode->IsEndSwitchNode() ;
}
else {
- RetVal = _DataFlowEditor->IsEndSwitchNode() ;
+ RetVal = _DataFlowEditor->Graph()->IsEndSwitchNode() ;
}
// endService( "CNode_Impl::IsEndSwitch" );
return RetVal ;
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()) ;
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()) ;
RetVal = _DataFlowNode->EditorRelease() ;
}
else {
- RetVal = _DataFlowEditor->EditorRelease() ;
+ RetVal = _DataFlowEditor->Graph()->EditorRelease() ;
}
// endService( "CNode_Impl::Version" );
return CORBA::string_dup( RetVal ) ;
RetVal = _DataFlowNode->Author() ;
}
else {
- RetVal = _DataFlowEditor->Author() ;
+ RetVal = _DataFlowEditor->Graph()->Author() ;
}
// endService( "CNode_Impl::Author" );
return CORBA::string_dup( RetVal ) ;
RetVal = _DataFlowNode->Author( aDataFlowAuthor ) ;
}
else {
- RetVal = _DataFlowEditor->Author( aDataFlowAuthor ) ;
+ RetVal = _DataFlowEditor->Graph()->Author( aDataFlowAuthor ) ;
}
}
// endService( "CNode_Impl::SetAuthor" );
RetVal = _DataFlowNode->Comment() ;
}
else {
- RetVal = _DataFlowEditor->Comment() ;
+ RetVal = _DataFlowEditor->Graph()->Comment() ;
}
// endService( "CNode_Impl::Comment" );
return CORBA::string_dup( RetVal ) ;
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() ) {
((GraphEditor::InNode *) _DataFlowNode)->Coordinates( X , Y ) ;
}
else {
- _DataFlowEditor->Coordinates( X , Y ) ;
+ _DataFlowEditor->Graph()->Coordinates( X , Y ) ;
}
}
// endService( "CNode_Impl::Coords" );
RetVal = _DataFlowNode->XCoordinate() ;
}
else {
-// RetVal = _DataFlowEditor->XCoordinate() ;
- RetVal = 0 ;
+ RetVal = _DataFlowEditor->Graph()->XCoordinate() ;
}
// endService( "CNode_Impl::X" );
return RetVal ;
RetVal = _DataFlowNode->YCoordinate() ;
}
else {
-// RetVal = _DataFlowEditor->YCoordinate() ;
- RetVal = 0 ;
+ RetVal = _DataFlowEditor->Graph()->YCoordinate() ;
}
// endService( "CNode_Impl::Y" );
return RetVal ;
}
-#if 0
-SUPERV::Link_ptr CNode_Impl::Link( const char * ToServiceParameterName ,
- const SUPERV::Value_ptr aValue ) {
- beginService( "CNode_Impl::Link" );
- Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId ,
- instanceName() , interfaceName() ,
- _DataFlowEditor ,
- _DataFlowNode ,
- ToServiceParameterName ,
- aValue ) ;
- PortableServer::ObjectId * id = myLink->getId() ;
- CORBA::Object_var obj = _poa->id_to_reference(*id);
- SUPERV::Link_var iobject ;
- iobject = SUPERV::Link::_narrow(obj) ;
- endService( "CNode_Impl::Link" );
- return SUPERV::Link::_duplicate( iobject ) ;
-}
-#endif
-
SUPERV::Port_ptr CNode_Impl::Port( const char * ServiceParameterName ) {
bool begin = true ;
Port_Impl * myPort = NULL ;
}
else {
anoutport = _DataFlowEditor->GetOutPort( ServiceParameterName ) ;
- }
+ }
if ( aninport ) {
GraphBase::InPort * anInPort ;
if ( _IsNode ) {
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 ;
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 ;
if ( !begin ) {
endService( "CNode_Impl::Port" );
}
+ DataFlowEditor()->UnValid() ;
return SUPERV::Port::_duplicate( iobject ) ;
}
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() ) ) {
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() ) ) {
MESSAGE( "CNode_Impl::Input returns nil object _IsNode " << _IsNode << " sts " << sts << " anInPort "
<< anInPort ) ;
}
+ DataFlowEditor()->UnValid() ;
return SUPERV::Port::_duplicate( iobject ) ;
}
-SUPERV::ListOfPorts * CNode_Impl::Ports() {
- 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 ;
+SUPERV::Port_ptr CNode_Impl::GetInPort( const char *aParameterName ) {
+ SUPERV::Port_ptr Inobject = SUPERV::Port::_nil() ;
+ Port_Impl * myInPort = NULL ;
+ GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( aParameterName ) ;
+ if ( anInPort && !anInPort->IsDataStream() ) {
+ 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) ;
+ anInPort->ObjRef( SUPERV::Port::_duplicate( Inobject ) ) ;
}
- 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() ) ) ;
+ }
+ }
+ return SUPERV::Port::_duplicate( Inobject ) ;
+}
+
+SUPERV::Port_ptr CNode_Impl::GetOutPort( const char *aParameterName ) {
+ Port_Impl * myOutPort = NULL ;
+ SUPERV::Port_ptr Outobject = SUPERV::Port::_nil() ;
+ GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeOutPort( aParameterName ) ;
+ if ( anOutPort && !anOutPort->IsDataStream() ) {
+ 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) ;
+ anOutPort->ObjRef( SUPERV::Port::_duplicate( Outobject ) ) ;
}
- 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 ) ;
+ }
+ }
+ return SUPERV::Port::_duplicate( Outobject );
+}
+
+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 ( 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 ) ) ;
+ }
+ }
+ }
+ }
+ return SUPERV::StreamPort::_duplicate( Inobject ) ;
+}
+
+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 ( 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 = 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 ,
+ }
+ return SUPERV::StreamPort::_duplicate( Outobject );
+}
+
+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->IsDataStream() && anInPort->GetOutPort() ) {
+ GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
+ if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
+ if ( begin ) {
+ beginService( "CNode_Impl::GetLink" );
+ begin = false ;
+ }
+ bool Success ;
+ 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() ;
- 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 ) ) ;
+ ToServiceParameterName ,
+ (GraphEditor::InNode *) _DataFlowEditor->Graph()->GetChangeGraphNode( FromNodeName )->GetInNode() ,
+ FromServiceParameterName ,
+ true , false , Success ) ;
+ if ( Success ) {
+ 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 ) ) ;
+ }
}
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 ;
+ }
+ bool Success ;
+ StreamLink_Impl * myStreamLink = new StreamLink_Impl(
+ _Orb , _Poa , _ContId ,
+ instanceName() , interfaceName() ,
+ _DataFlowEditor ,
+ _DataFlowNode ,
+ ToServiceParameterName ,
+ (GraphEditor::InNode *) _DataFlowEditor->Graph()->GetChangeGraphNode( FromNodeName )->GetInNode() ,
+ FromServiceParameterName ,
+ true , Success ) ;
+ if ( Success ) {
+ 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 ) ;
}
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 if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
+ 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() {
return RetVal ;
}
+long CNode_Impl::SubStreamGraph() {
+// beginService( "CNode_Impl::SubStreamGraph" );
+ long RetVal = 0 ;
+ if ( _IsNode ) {
+ RetVal = _DataFlowNode->SubStreamGraph() ;
+ }
+// endService( "CNode_Impl::SubStreamGraph" );
+ return RetVal ;
+}
+
bool CNode_Impl::IsLinked(const char * ServiceParameterName ) {
beginService( "CNode_Impl::IsLinked" );
bool RetVal = _DataFlowNode->IsLinked( ServiceParameterName ) ;
return RetVal ;
}
bool CNode_Impl::Kill() {
-// beginService( "CNode_Impl::Kill" );
+ beginService( "CNode_Impl::Kill" );
bool RetVal = false ;
GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
if ( _DataFlowExecutor ) {
}
else {
RetVal = _DataFlowExecutor->Kill() ;
+ MESSAGE( "Graph execution was killed " << RetVal ) ;
}
}
-// endService( "CNode_Impl::Kill" );
+ endService( "CNode_Impl::Kill" );
return RetVal ;
}
bool CNode_Impl::KillDone() {
return RetVal ;
}
bool CNode_Impl::Suspend() {
-// beginService( "CNode_Impl::Suspend" );
+ beginService( "CNode_Impl::Suspend" );
bool RetVal = false ;
GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
if ( _DataFlowExecutor ) {
if ( _IsNode ) {
+ MESSAGE( "CNode_Impl::Suspend " << Name() ) ;
RetVal = _DataFlowExecutor->Suspend( Name() ) ;
}
else {
+ MESSAGE( "CNode_Impl::Suspend " << _DataFlowExecutor->Graph()->Name() ) ;
RetVal = _DataFlowExecutor->Suspend() ;
}
}
-// endService( "CNode_Impl::Suspend" );
+ endService( "CNode_Impl::Suspend" );
return RetVal ;
}
bool CNode_Impl::SuspendDone() {
return RetVal ;
}
bool CNode_Impl::Resume() {
-// beginService( "CNode_Impl::Resume" );
bool RetVal = false ;
+ beginService( "CNode_Impl::Resume" );
GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
if ( _DataFlowExecutor ) {
if ( _IsNode ) {
+ MESSAGE( "CNode_Impl::Resume " << Name() ) ;
RetVal = _DataFlowExecutor->Resume( Name() ) ;
}
else {
+ MESSAGE( "CNode_Impl::Resume " << _DataFlowExecutor->Graph()->Name() ) ;
RetVal = _DataFlowExecutor->Resume() ;
}
}
-// endService( "CNode_Impl::Resume" );
+ endService( "CNode_Impl::Resume" );
return RetVal ;
}
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 ) {
_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() ;
virtual SUPERV::Port_ptr Input( const char * ToServiceParameterName ,
const SUPERV::Value_ptr aValue ) ;
+ virtual SUPERV::Port_ptr GetInPort( const char * aParameterName ) ;
+ virtual SUPERV::Port_ptr GetOutPort( const char * aParameterName ) ;
+
+ 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() ;
virtual bool IsEndSwitch() ;
virtual long SubGraph() ;
+ virtual long SubStreamGraph() ;
virtual bool IsLinked(const char * ToServiceParameterName ) ;
virtual bool HasInput(const char * ToServiceParameterName ) ;
}
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() ) ;
aCoupled->destroy() ;
}
}
- endService( "ELNode_Impl::Destroy" );
- MESSAGE("--------> ELNode_Impl::destroy() END");
+// endService( "ELNode_Impl::Destroy" );
+// MESSAGE("--------> ELNode_Impl::destroy() END");
}
bool ELNode_Impl::Delete() {
aCoupled->destroy() ;
}
}
- endService( "ESNode_Impl::Destroy" );
+// endService( "ESNode_Impl::Destroy" );
}
bool ESNode_Impl::Delete() {
_thisObj->_remove_ref();
}
}
- endService( "FNode_Impl::Destroy" );
+// endService( "FNode_Impl::Destroy" );
}
bool FNode_Impl::Delete() {
}
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" );
_thisObj->_remove_ref();
}
}
- endService( "GNode_Impl::Destroy" );
+// endService( "GNode_Impl::Destroy" );
}
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() ) ) {
iobject = SUPERV::INode::_narrow( DataFlowNode()->CoupledNode()->ObjRef() ) ;
}
}
- endService( "GNode_Impl::Coupled" );
+// endService( "GNode_Impl::Coupled" );
return SUPERV::INode::_duplicate( iobject ) ;
}
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() &&
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 ;
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 ;
CORBA::release(_poa) ;
delete(_id) ;
_thisObj->_remove_ref();
- endService( "Graph_Impl::destroy" );
+// endService( "Graph_Impl::destroy" );
}
char* Graph_Impl::getIOR() {
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" );
}
bool Graph_Impl::Export(const char * anXmlFile ) {
-// beginService( "Graph_Impl::Export" );
+ beginService( "Graph_Impl::Export" );
char * aFile = new char [ strlen( anXmlFile ) + 5 ] ;
strcpy( aFile , anXmlFile ) ;
int len = strlen( aFile ) ;
RetVal = DataFlowEditor()->SavePy( aFile ) ;
}
delete [] aFile ;
-// endService( "Graph_Impl::Export" );
+ endService( "Graph_Impl::Export" );
return RetVal ;
}
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" ) ) ;
SUPERV::Port_ptr InPort ) {
beginService( "Graph_Impl::Link" );
SUPERV::Link_var iobject = SUPERV::Link::_nil() ;
- if ( DataFlowEditor()->IsEditing() &&
- !DataFlowEditor()->IsReadOnly() ) {
- const char * DataFlowOutNodeName = OutPort->Node()->Name() ;
- GraphEditor::InNode * DataFlowOutNode = DataFlowEditor()->GetNode( DataFlowOutNodeName ) ;
- const char * DataFlowInNodeName = InPort->Node()->Name() ;
- GraphEditor::InNode * DataFlowInNode = DataFlowEditor()->GetNode( DataFlowInNodeName ) ;
- if ( DataFlowOutNode && DataFlowInNode ) {
- Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId ,
- instanceName() , interfaceName() ,
- DataFlowEditor() ,
- DataFlowInNode ,
- InPort->Name() ,
- DataFlowOutNode ,
- OutPort->Name() ,
- true ) ;
- PortableServer::ObjectId * id = myLink->getId() ;
- CORBA::Object_var obj = _poa->id_to_reference(*id);
- iobject = SUPERV::Link::_narrow(obj) ;
-// iobject = InPort->Link() ;
+ if ( DataFlowEditor()->IsEditing() && !DataFlowEditor()->IsReadOnly() &&
+ !OutPort->IsDataStream() && !InPort->IsDataStream() ) {
+ GraphBase::InPort * anInPort = DataFlowEditor()->GetNode( InPort->Node()->Name() )->ComputingNode()->GetChangeInPort( InPort->Name() ) ;
+ GraphBase::OutPort * anOutPort = DataFlowEditor()->GetNode( OutPort->Node()->Name() )->ComputingNode()->GetChangeOutPort( OutPort->Name() ) ;
+ if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
+ const char * DataFlowOutNodeName = OutPort->Node()->Name() ;
+ GraphEditor::InNode * DataFlowOutNode = DataFlowEditor()->GetNode( DataFlowOutNodeName ) ;
+ const char * DataFlowInNodeName = InPort->Node()->Name() ;
+ GraphEditor::InNode * DataFlowInNode = DataFlowEditor()->GetNode( DataFlowInNodeName ) ;
+ if ( DataFlowOutNode && DataFlowInNode ) {
+ bool Success ;
+ Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId ,
+ instanceName() , interfaceName() ,
+ DataFlowEditor() ,
+ DataFlowInNode ,
+ InPort->Name() ,
+ DataFlowOutNode ,
+ OutPort->Name() ,
+ true , false , Success ) ;
+ if ( Success ) {
+ 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 ) ) ;
+ }
+ }
+ }
+ else {
+ iobject = anOutPort->InPortObjRef( anInPort ) ;
}
}
endService( "Graph_Impl::Link" );
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 );
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() ) ;
}
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 ;
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() ,
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 ) {
+ bool Success ;
Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId ,
instanceName() , interfaceName() ,
DataFlowEditor() ,
anInPort->PortName() ,
anOutNode ,
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 , Success ) ;
+ if ( Success ) {
+ 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( 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" ) ;
}
}
}
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 ;
+ }
+ bool Success ;
+ 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 , Success ) ;
+ if ( Success ) {
+ 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" ) ;
}
}
}
}
}
}
+#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_var RetVal = new SUPERV::ListOfGraphs ;
- MESSAGE( "Graph_Impl::Graphs not yet implemented" );
-// endService( "Graph_Impl::ListOfGraphs" );
- return ( RetVal._retn() ) ;
-}
-
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 ) ;
}
// 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" );
// 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 ,
// endService( "Graph_Impl::ThreadsMax" );
return RetVal ;
}
-long Graph_Impl::GraphsNumber() {
-// beginService( "Graph_Impl::GraphsNumber" );
- long RetVal = DataFlowEditor()->GraphsNumber() ;
-// endService( "Graph_Impl::GraphsNumber" );
- return RetVal ;
-}
long Graph_Impl::Threads() {
// beginService( "Node_Impl::Threads" );
long RetVal = _DataFlowExecutor->Threads() ;
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->Graph()->SetObjImpl( DataFlowEditor()->Graph()->ObjImpl() ) ;
DataFlowEditor()->Executor( _DataFlowExecutor ) ;
}
if ( pthread_mutex_unlock( &_MutexExecutorWait ) ) {
return RetVal ;
}
+long Graph_Impl::SubGraphsNumber() {
+// beginService( "Graph_Impl::SubGraphsNumber" );
+ long RetVal = 0 ;
+ if ( DataFlowEditor()->IsExecutable() ) {
+ RetVal = DataFlowEditor()->SubGraphsNumber() ;
+ }
+// endService( "Graph_Impl::SubGraphsNumber" );
+ return RetVal ;
+}
+
+SUPERV::ListOfNodes * Graph_Impl::SubGraphsNodes( const long aSubGraphNumber ) {
+ beginService( "Graph_Impl::SubGraphsNodes" );
+ SUPERV::ListOfNodes_var RetVal = new SUPERV::ListOfNodes ;
+ if ( DataFlowEditor()->IsEditing() ) {
+ SUPERV::ListOfNodes * aGraphNodes = Nodes() ;
+ int i ;
+// ComputingNodes
+ for ( i = 0 ; i < (int ) aGraphNodes->CNodes.length() ; i++ ) {
+ SUPERV::CNode_var aNode = (aGraphNodes->CNodes)[ i ] ;
+ if ( aNode->SubGraph() == aSubGraphNumber ) {
+ RetVal = SetNode( RetVal , DataFlowEditor()->Graph()->GetChangeGraphNode( aNode->Name() ) ) ;
+ }
+ }
+// FactoryNodes
+ for ( i = 0 ; i < (int ) aGraphNodes->FNodes.length() ; i++ ) {
+ SUPERV::FNode_var aNode = (aGraphNodes->FNodes)[ i ] ;
+ if ( aNode->SubGraph() == aSubGraphNumber ) {
+ RetVal = SetNode( RetVal , DataFlowEditor()->Graph()->GetChangeGraphNode( aNode->Name() ) ) ;
+ }
+ }
+// InLineNodes
+ for ( i = 0 ; i < (int ) aGraphNodes->INodes.length() ; i++ ) {
+ SUPERV::INode_var aNode = (aGraphNodes->INodes)[ i ] ;
+ if ( aNode->SubGraph() == aSubGraphNumber ) {
+ RetVal = SetNode( RetVal , DataFlowEditor()->Graph()->GetChangeGraphNode( aNode->Name() ) ) ;
+ }
+ }
+// GOTONodes
+ for ( i = 0 ; i < (int ) aGraphNodes->GNodes.length() ; i++ ) {
+ SUPERV::GNode_var aNode = (aGraphNodes->GNodes)[ i ] ;
+ if ( aNode->SubGraph() == aSubGraphNumber ) {
+ RetVal = SetNode( RetVal , DataFlowEditor()->Graph()->GetChangeGraphNode( aNode->Name() ) ) ;
+ }
+ }
+// LoopNodes
+ for ( i = 0 ; i < (int ) aGraphNodes->LNodes.length() ; i++ ) {
+ SUPERV::LNode_var aNode = (aGraphNodes->LNodes)[ i ] ;
+ if ( aNode->SubGraph() == aSubGraphNumber ) {
+ RetVal = SetNode( RetVal , DataFlowEditor()->Graph()->GetChangeGraphNode( aNode->Name() ) ) ;
+ }
+ }
+// EndLoopNodes
+ for ( i = 0 ; i < (int ) aGraphNodes->ELNodes.length() ; i++ ) {
+ SUPERV::ELNode_var aNode = (aGraphNodes->ELNodes)[ i ] ;
+ if ( aNode->SubGraph() == aSubGraphNumber ) {
+ RetVal = SetNode( RetVal , DataFlowEditor()->Graph()->GetChangeGraphNode( aNode->Name() ) ) ;
+ }
+ }
+// SwitchNodes
+ for ( i = 0 ; i < (int ) aGraphNodes->SNodes.length() ; i++ ) {
+ SUPERV::SNode_var aNode = (aGraphNodes->SNodes)[ i ] ;
+ if ( aNode->SubGraph() == aSubGraphNumber ) {
+ RetVal = SetNode( RetVal , DataFlowEditor()->Graph()->GetChangeGraphNode( aNode->Name() ) ) ;
+ }
+ }
+// EndSwitchNodes
+ for ( i = 0 ; i < (int ) aGraphNodes->ESNodes.length() ; i++ ) {
+ SUPERV::ESNode_var aNode = (aGraphNodes->ESNodes)[ i ] ;
+ if ( aNode->SubGraph() == aSubGraphNumber ) {
+ RetVal = SetNode( RetVal , DataFlowEditor()->Graph()->GetChangeGraphNode( aNode->Name() ) ) ;
+ }
+ }
+ }
+ endService( "Graph_Impl::SubGraphsNodes" );
+ return ( RetVal._retn() ) ;
+}
+
bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph ) {
+// beginService( "Graph_Impl::Merge" );
+ bool RetVal = true ;
+ map< string , int > aMapOfNodes ;
+ RetVal = Merge( aGraph , aMapOfNodes ) ;
+// endService( "Graph_Impl::Merge" );
+ return RetVal ;
+}
+
+bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph , map< string , int > & aMapOfNodes ) {
beginService( "Graph_Impl::Merge" );
bool RetVal = true ;
if ( DataFlowEditor()->IsEditing() ) {
SUPERV::ListOfNodes * aGraphNodes = aGraph->Nodes() ;
-
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()) ) ;
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 ;
}
RetVal = false ;
break ;
}
+// The following informations are now in the service from SALOME_ModuleCatalog
+// 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 ] ;
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 ;
}
RetVal = false ;
break ;
}
+// The following informations are now in the service from SALOME_ModuleCatalog
+// 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 ] ;
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() ) {
- myNode->InPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ;
+ aPort = myNode->InPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ;
}
else {
- myNode->OutPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ;
+ aPort = myNode->OutPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ;
+ }
+ }
+ if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
+ 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 ;
}
}
}
+// GOTONodes
if ( RetVal ) {
for ( i = 0 ; i < (int ) aGraphNodes->GNodes.length() ; i++ ) {
SUPERV::GNode_var aNode = (aGraphNodes->GNodes)[ i ] ;
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() ) {
- myNode->InPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ;
+ aPort = myNode->InPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ;
}
else {
- myNode->OutPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ;
+ aPort = myNode->OutPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ;
+ }
+ }
+ if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
+ 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 ;
}
}
}
+// LoopNodes
if ( RetVal ) {
for ( i = 0 ; i < (int ) aGraphNodes->LNodes.length() ; i++ ) {
SUPERV::LNode_var aNode = (aGraphNodes->LNodes)[ i ] ;
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() ) {
- myNode->InPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ;
+ aPort = myNode->InPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ;
+ }
+ else {
+ aPort = myNode->OutPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ;
+ }
+ }
+ if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
+ 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() ;
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() ) ;
+ if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
+ SUPERV::ListOfStreamPorts myStreamLoopPorts = *(myEndOfLoop->StreamPorts()) ;
+ for ( j = 0 ; j < (int ) myStreamLoopPorts.length() ; j++ ) {
+ if ( myStreamLoopPorts[ j ]->IsInput() ) {
+ aPort = myNode->InStreamPort( myStreamLoopPorts[ j ]->Name() , StringToDataStreamType( myStreamLoopPorts[ j ]->Type() ) , myStreamLoopPorts[ j ]->Dependency() ) ;
+ }
+ else {
+ aPort = myNode->OutStreamPort( myStreamLoopPorts[ j ]->Name() , StringToDataStreamType( myStreamLoopPorts[ j ]->Type() ) , myStreamLoopPorts[ j ]->Dependency() ) ;
+ }
+ }
+ }
delete aNodetheName ;
RetVal = true ;
}
}
}
}
+// SwitchNodes
if ( RetVal ) {
for ( i = 0 ; i < (int ) aGraphNodes->SNodes.length() ; i++ ) {
SUPERV::SNode_var aNode = (aGraphNodes->SNodes)[ i ] ;
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() ) {
- myNode->InPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ;
+ aPort = myNode->InPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ;
}
else {
- myNode->OutPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ;
+ aPort = myNode->OutPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ;
+ }
+ }
+ if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
+ 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->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() ) {
- anEndOfSwitch->InPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ;
+ aPort = myNode->InPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ;
}
else {
- anEndOfSwitch->OutPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ;
+ aPort = myNode->OutPort( myPorts[ j ]->Name() , myPorts[ j ]->Type() ) ;
+ }
+ }
+ if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) {
+ 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 ;
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 ;
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 ) {
if ( RetVal ) {
for ( i = 0 ; i < (int ) aGraphPorts->length() ; i++ ) {
SUPERV::Port_var aPort = (*aGraphPorts)[ i ] ;
- char * aPortName = aPort->Name() ;
- char * aNodeName = new char[ strlen( aPortName ) + 1 ] ;
- strcpy( aNodeName , aPortName ) ;
- char * thePortName = strchr( aNodeName , '\\' ) ;
- thePortName[ 0 ] = '\0' ;
- bool hasinput = aGraph->Node( aNodeName )->Port( thePortName + 1 )->HasInput() ;
-// cout << "Graph_Impl::Merge " << " aNodeName " << aNodeName << " aPort " << thePortName + 1
-// << " HasInput " << hasinput << endl ;
- if ( hasinput ) {
- RetVal = DataFlowEditor()->AddInputData( DataFlowEditor()->GetGraphNode( aMapOfNodes[ aNodeName ] )->Name() ,
- thePortName + 1 ,
- *(aPort->ToAny()) ) ;
- }
- delete [] aNodeName ;
- if ( !RetVal ) {
- break ;
+ if ( !aPort->IsGate() ) {
+ MESSAGE( "Graph_Impl::Merge " << i << ". " << aPort->Node()->Name() << " " << aPort->Name() ) ;
+ char * aPortName = aPort->Name() ;
+ char * aNodeName = new char[ strlen( aPortName ) + 1 ] ;
+ strcpy( aNodeName , aPortName ) ;
+ char * thePortName = strchr( aNodeName , '\\' ) ;
+ thePortName[ 0 ] = '\0' ;
+ bool hasinput = aGraph->Node( aNodeName )->Port( thePortName + 1 )->HasInput() ;
+// cout << "Graph_Impl::Merge " << " aNodeName " << aNodeName << " aPort " << thePortName + 1
+// << " HasInput " << hasinput << endl ;
+ if ( hasinput ) {
+ RetVal = DataFlowEditor()->AddInputData( DataFlowEditor()->Graph()->GetGraphNode( aMapOfNodes[ aNodeName ] )->Name() ,
+ thePortName + 1 ,
+ *(aPort->ToAny()) ) ;
+ }
+ delete [] aNodeName ;
+ if ( !RetVal ) {
+ break ;
+ }
}
}
}
}
}
+ MESSAGE( "Graph_Impl::Merge returns " << RetVal ) ;
endService( "Graph_Impl::Merge" );
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 ) ;
+}
+
+
#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"
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() ;
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(
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 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() ;
virtual long LevelMax() ;
virtual SUPERV::ListOfNodes * LevelNodes(long aLevel ) ;
virtual long ThreadsMax() ;
- virtual long GraphsNumber() ;
virtual long Threads() ;
virtual long SuspendedThreads() ;
SUPERV::GraphState & aState ) ;
virtual long EventQSize() ;
+ virtual long SubGraphsNumber() ;
+ virtual SUPERV::ListOfNodes * SubGraphsNodes( const long aSubGraphNumber ) ;
+
virtual bool Merge(const SUPERV::Graph_ptr aGraph ) ;
+ virtual bool Merge(const SUPERV::Graph_ptr aGraph , map< string , int > & aMapOfNodes ) ;
+
+ virtual SUPERV::StreamGraph_ptr ToStreamGraph() ;
};
if ( DataFlowEditor()->IsEditing() ) {
RetVal = DataFlowEditor()->RemoveNode( Name() ) ;
if ( RetVal )
- RetVal = DataFlowEditor()->IsValid() ;
+ RetVal = DataFlowEditor()->UnValid() ;
}
// endService( "INode_Impl::Delete" );
return RetVal ;
SUPERV::Port_ptr InEndobject = SUPERV::Port::_nil() ;
Port_Impl * myInPort = NULL ;
bool InPortCreated = false ;
- MESSAGE( "INode_Impl::InPort " << DataFlowNode()->Name() << "->AddInPort( " << aParameterName << " , "
- << aParameterType ) ;
+ MESSAGE( "CNode_Impl::InPort " << DataFlowNode()->Name() << "->AddInPort( " << aParameterName << " , "
+ << aParameterType << " )" ) ;
GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( aParameterName ) ;
- if ( anInPort == NULL && DataFlowNode()->IsOneOfInLineNodes() ) {
- anInPort = DataFlowNode()->AddInPort( aParameterName , aParameterType ) ;
+ if ( anInPort == NULL ) {
+ anInPort = DataFlowNode()->AddInPort( aParameterName , aParameterType , SUPERV::InLineParameter ) ;
InPortCreated = true ;
}
if ( anInPort ) {
}
if ( !CORBA::is_nil( Inobject ) && InPortCreated &&
- ( DataFlowNode()->IsLoopNode() || DataFlowNode()->IsEndLoopNode() ||
- DataFlowNode()->IsEndSwitchNode() ) ) {
+ ( DataFlowNode()->IsLoopNode() || DataFlowNode()->IsEndLoopNode() ) ) {
+// || DataFlowNode()->IsEndSwitchNode() ) ) {
Outobject = OutPort( aParameterName , aParameterType ) ;
if ( DataFlowNode()->IsLoopNode() ) {
LNode_Impl * myLoopNode = (LNode_Impl * ) this ;
const char *aParameterType ) {
Port_Impl * myOutPort = NULL ;
SUPERV::Port_ptr Outobject = SUPERV::Port::_nil() ;
- MESSAGE( "INode_Impl::OutPort " << DataFlowNode()->Name() << "->AddOutPort( " << aParameterName << " , "
- << aParameterType ) ;
+ MESSAGE( "CNode_Impl::OutPort " << DataFlowNode()->Name() << "->AddOutPort( " << aParameterName << " , "
+ << aParameterType << " )" ) ;
GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeOutPort( aParameterName ) ;
- if ( anOutPort == NULL && DataFlowNode()->IsOneOfInLineNodes() ) {
- anOutPort = DataFlowNode()->AddOutPort( aParameterName , aParameterType ) ;
+ if ( anOutPort == NULL ) {
+ anOutPort = DataFlowNode()->AddOutPort( aParameterName , aParameterType , SUPERV::InLineParameter ) ;
}
if ( anOutPort ) {
Outobject = anOutPort->ObjRef() ;
return SUPERV::Port::_duplicate( Outobject );
}
-#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::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 ;
+ }
-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 ;
- 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 ,
+ 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 " ) ;
}
- 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 ) ;
+ 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 ) ) ;
+ }
+ }
+ }
+ }
+ DataFlowEditor()->UnValid() ;
}
- endService( "INode_Impl::BusPorts" );
- return RetVal ;
+ return SUPERV::StreamPort::_duplicate( Outobject );
}
-#endif
+
#include "CNode_Impl.hxx"
-#include "Port_Impl.hxx"
+#include "StreamPort_Impl.hxx"
#include "DataFlowEditor_DataFlow.hxx"
#include "DataFlowExecutor_DataFlow.hxx"
virtual SUPERV::ListOfStrings * PyFunction() ;
virtual char * PyFuncName() ;
+ 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 GraphBase::InLineNode * BaseNode() {
- return DataFlowNode()->InLineNode() ; } ;
+ 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 ) ;
} ;
aCoupled->destroy() ;
}
}
- endService( "LNode_Impl::Destroy" );
+// endService( "LNode_Impl::Destroy" );
}
bool LNode_Impl::Delete() {
//#include "utilities.h"
-#include "Link_Impl.hxx"
+#include "StreamLink_Impl.hxx"
Link_Impl::Link_Impl( CORBA::ORB_ptr orb ,
PortableServer::POA_ptr poa ,
const char *InputParameterName ,
GraphEditor::InNode * DataFlowOutNode ,
const char *OutputParameterName ,
- const bool Create ) :
-// const SUPERV::Value_ptr aValue ) :
+ const bool Create ,
+ const bool Get ,
+ bool & Success ) :
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 ;
_OutputParameterName = new char[ strlen( OutputParameterName ) + 1 ] ;
strcpy( _OutputParameterName , OutputParameterName ) ;
if ( Create ) {
- linksts = _DataFlowEditor->AddLink( _DataFlowOutNode->Name() ,
+ Success = _DataFlowEditor->AddLink( _DataFlowOutNode->Name() ,
_OutputParameterName ,
_DataFlowNode->Name() ,
_InputParameterName ) ;
}
- else {
+ else if ( Get ) {
char * DataFlowOutNodeName = NULL ;
char * OutParamName = NULL ;
- linksts = _DataFlowEditor->GetLink( _DataFlowNode->Name() ,
+ Success = _DataFlowEditor->GetLink( _DataFlowNode->Name() ,
_InputParameterName ,
&DataFlowOutNodeName ,
&OutParamName ) ;
}
- _thisObj = this ;
- _id = _poa->activate_object(_thisObj);
- endService( "Link_Impl::Link_Impl" );
+ else {
+ Success = false ;
+ }
+ if ( Success ) {
+ _thisObj = this ;
+ _id = _poa->activate_object(_thisObj) ;
+ }
+// endService( "Link_Impl::Link_Impl" );
}
Link_Impl::Link_Impl() {
_OutputParameterName ,
_DataFlowNode->Name() ,
_InputParameterName ) ;
+ if ( RetVal ) {
+ DataFlowEditor()->UnValid() ;
+ }
// endService( "Link_Impl::Delete" );
return RetVal ;
}
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 ) ;
}
const char *InputParameterName ,
GraphEditor::InNode * DataFlowOutNode ,
const char *OutputParameterName ,
- const bool Create ) ;
+ const bool Create ,
+ const bool Get ,
+ bool & Success ) ;
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() ;
EXPORT_HEADERS = \
SuperV_Impl.hxx \
+ StreamGraph_Impl.hxx \
Graph_Impl.hxx \
CNode_Impl.hxx \
FNode_Impl.hxx \
ELNode_Impl.hxx \
SNode_Impl.hxx \
ESNode_Impl.hxx \
+ StreamLink_Impl.hxx \
Link_Impl.hxx \
- Value_Impl.hxx \
- Port_Impl.hxx
-# Input_Impl.hxx \
+ StreamPort_Impl.hxx \
+ Port_Impl.hxx \
+ Value_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 \
SNode_Impl.cxx \
ESNode_Impl.cxx \
Graph_Impl.cxx \
+ StreamGraph_Impl.cxx \
SuperV_Impl.cxx
-# Input_Impl.cxx \
LIB_CLIENT_IDL = SALOME_ModuleCatalog.idl \
SALOME_Component.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@
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 ) ;
}
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 ) ;
}
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" ) ;
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() ) ;
}
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 ] ;
}
beginService( "Port_Impl::Link" ) ;
begin = false ;
}
+ bool Success ;
Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId ,
instanceName() , interfaceName() ,
_DataFlowEditor ,
_DataFlowNode ,
_DataFlowPort->PortName() ,
- (GraphEditor::InNode * ) _DataFlowEditor->GetChangeGraphNode( FromNodeName )->GetInNode() ,
+ (GraphEditor::InNode * ) _DataFlowEditor->Graph()->GetChangeGraphNode( FromNodeName )->GetInNode() ,
FromServiceParameterName ,
- false ) ;
- 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 ) ) ;
+ false , true , Success ) ;
+ if ( Success ) {
+ 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 ) ) ;
+ }
}
else {
iobject = anOutPort->InPortObjRef( anInPort ) ;
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 ;
return RetVal ;
}
+void Port_Impl::SetKind( SUPERV::KindOfPort aKindOfPort ) {
+// beginService( "Port_Impl::SetKind" ) ;
+ _DataFlowPort->Kind( aKindOfPort ) ;
+// endService( "Port_Impl::SetKind" ) ;
+}
+
bool Port_Impl::IsParam() {
// beginService( "Port_Impl::IsParam" ) ;
bool RetVal = _DataFlowPort->IsParam() ;
return RetVal ;
}
+bool Port_Impl::IsDataStream() {
+// beginService( "Port_Impl::IsDataStream" ) ;
+ bool RetVal = _DataFlowPort->IsDataStream() ;
+// endService( "Port_Impl::IsDataStream" ) ;
+ return RetVal ;
+}
+
bool Port_Impl::HasInput() {
// beginService( "Port_Impl::" ) ;
bool RetVal = false ;
// endService( "Port_Impl::IsDone" );
return RetVal ;
}
+
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 void SetKind( SUPERV::KindOfPort ) ;
- virtual SUPERV::KindOfPort Kind() ;
- virtual bool IsParam() ;
- virtual bool IsGate() ;
- virtual bool IsInLine() ;
- virtual bool IsLoop() ;
- virtual bool IsSwitch() ;
- virtual bool IsEndSwitch() ;
+ 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() ;
} ;
aCoupled->destroy() ;
}
}
- endService( "SNode_Impl::Destroy" );
+// endService( "SNode_Impl::Destroy" );
}
bool SNode_Impl::Delete() {
--- /dev/null
+// SUPERV Supervision : contains the implementation of interfaces of SuperVision described in SUPERV.idl
+//
+// 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 : StreamGraph_Impl.cxx
+// Author : Jean Rahuel
+// Module : SUPERV
+// $Header:
+
+using namespace std;
+
+#include "StreamGraph_Impl.hxx"
+
+StreamGraph_Impl::StreamGraph_Impl( CORBA::ORB_ptr orb ,
+ PortableServer::POA_ptr poa ,
+ PortableServer::ObjectId * contId ,
+ const char *instanceName ,
+ const char *interfaceName ,
+ const char *aDataFlowName ) :
+ Graph_Impl(orb, poa, contId, instanceName, interfaceName, aDataFlowName , SUPERV::DataStreamGraph ) {
+// MESSAGE("StreamGraph_Impl::StreamGraph_Impl activate object instanceName("
+// << instanceName << ") interfaceName(" << interfaceName << ") --> "
+// << hex << (void *) this << dec )
+ beginService( "StreamGraph_Impl::StreamGraph_Impl" );
+ _thisObj = this ;
+ _id = _poa->activate_object(_thisObj);
+ _Orb = CORBA::ORB::_duplicate(orb);
+ _Poa = poa ;
+ _ContId = contId ;
+
+ endService( "StreamGraph_Impl::StreamGraph_Impl" );
+}
+
+StreamGraph_Impl::StreamGraph_Impl() {
+}
+
+StreamGraph_Impl::~StreamGraph_Impl() {
+ beginService( "StreamGraph_Impl::~StreamGraph_Impl" );
+ endService( "StreamGraph_Impl::~StreamGraph_Impl" );
+}
+
+void StreamGraph_Impl::destroy() {
+ beginService( "StreamGraph_Impl::destroy" );
+ _poa->deactivate_object(*_id) ;
+ CORBA::release(_poa) ;
+ delete(_id) ;
+ _thisObj->_remove_ref();
+ endService( "StreamGraph_Impl::destroy" );
+}
+
+SUPERV::StreamGraph_ptr StreamGraph_Impl::StreamCopy() {
+ beginService( "StreamGraph_Impl::StreamCopy" );
+ StreamGraph_Impl * myStreamGraph ;
+ myStreamGraph = new StreamGraph_Impl( _Orb , _Poa, _ContId,
+ instanceName() , interfaceName() ,
+ DataFlowEditor()->Graph()->Name() ) ;
+ PortableServer::ObjectId * id = myStreamGraph->getId() ;
+ CORBA::Object_var obj = _poa->id_to_reference(*id);
+ SUPERV::StreamGraph_var iobject ;
+ iobject = SUPERV::StreamGraph::_narrow(obj) ;
+ GraphBase::SGraph * aSGraph = GetGraph() ;
+ myStreamGraph->LoadGraph( aSGraph ) ;
+ endService( "StreamGraph_Impl::StreamCopy" );
+ return SUPERV::StreamGraph::_duplicate(iobject) ;
+}
+
+SUPERV::StreamLink_ptr StreamGraph_Impl::StreamLink( SUPERV::StreamPort_ptr OutStreamPort ,
+ SUPERV::StreamPort_ptr InStreamPort ) {
+ beginService( "StreamGraph_Impl::StreamLink" );
+ SUPERV::StreamLink_var iobject = SUPERV::StreamLink::_nil() ;
+ if ( DataFlowEditor()->IsEditing() && !DataFlowEditor()->IsReadOnly() &&
+ OutStreamPort->IsDataStream() && InStreamPort->IsDataStream() ) {
+ GraphBase::InPort * anInPort = DataFlowEditor()->GetNode( InStreamPort->Node()->Name() )->ComputingNode()->GetChangeInPort( InStreamPort->Name() ) ;
+ GraphBase::OutPort * anOutPort = DataFlowEditor()->GetNode( OutStreamPort->Node()->Name() )->ComputingNode()->GetChangeOutPort( OutStreamPort->Name() ) ;
+ if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
+ const char * DataFlowOutNodeName = OutStreamPort->Node()->Name() ;
+ GraphEditor::InNode * DataFlowOutNode = DataFlowEditor()->GetNode( DataFlowOutNodeName ) ;
+ const char * DataFlowInNodeName = InStreamPort->Node()->Name() ;
+ GraphEditor::InNode * DataFlowInNode = DataFlowEditor()->GetNode( DataFlowInNodeName ) ;
+ if ( DataFlowOutNode && DataFlowInNode ) {
+ bool Success ;
+ StreamLink_Impl * myStreamLink = new StreamLink_Impl( _Orb , _Poa , _ContId ,
+ instanceName() , interfaceName() ,
+ DataFlowEditor() ,
+ DataFlowInNode ,
+ InStreamPort->Name() ,
+ DataFlowOutNode ,
+ OutStreamPort->Name() ,
+ true , Success ) ;
+ if ( Success ) {
+ 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) ) ;
+ DataFlowEditor()->UnValid() ;
+ }
+ }
+ }
+ else {
+ iobject = SUPERV::StreamLink::_narrow( anOutPort->InPortObjRef( anInPort ) ) ;
+ }
+ }
+ endService( "StreamGraph_Impl::StreamLink" );
+ return SUPERV::StreamLink::_duplicate(iobject) ;
+}
+
+SUPERV::ListOfStreamLinks * StreamGraph_Impl::GStreamLinks() {
+ return StreamLinks( NULL , NULL ) ;
+}
+
+SUPERV::ListOfStreamLinks * StreamGraph_Impl::StreamLinks( GraphBase::ComputingNode * theNode ,
+ const char * anInputParam ) {
+ bool begin = true ;
+ SUPERV::ListOfStreamLinks_var RetVal = new SUPERV::ListOfStreamLinks ;
+ int i , j , countlink ;
+ countlink = 0 ;
+ for ( i = 0 ; i < DataFlowEditor()->Graph()->GraphNodesSize() ; i++ ) {
+ GraphEditor::InNode * aNode = NULL ;
+ aNode = (GraphEditor::InNode * ) DataFlowEditor()->Graph()->GraphNodes( i )->GetInNode() ;
+ bool ToProcess = false ;
+ if ( theNode == NULL ) {
+ ToProcess = true ;
+ }
+ else {
+ if ( !strcmp( theNode->Name() , aNode->Name() ) ) {
+ if ( !theNode->IsEndSwitchNode() ) {
+ ToProcess = true ;
+ }
+ }
+ else if ( theNode->IsEndSwitchNode() ) {
+ ToProcess = true ;
+ }
+ }
+ if ( ToProcess ) {
+ for ( j = 0 ; j < aNode->GetNodeInPortsSize() ; j++ ) {
+ GraphBase::InPort * anInPort = NULL ;
+ anInPort = aNode->GetChangeNodeInPort( j ) ;
+ if ( anInputParam == NULL ||
+ !strcmp( anInPort->PortName() , anInputParam ) ) {
+ GraphBase::OutPort * anOutPort = NULL ;
+ anOutPort = anInPort->GetOutPort() ;
+ if ( anOutPort && anOutPort->IsDataStream() ) {
+ if ( strcmp( anOutPort->NodeName() , Name() ) ) {
+ MESSAGE("StreamGraph_Impl::StreamLinks " << anOutPort->NodeName() << "("
+ << anOutPort->PortName() << ") --> " << aNode->Name() << "("
+ << anInPort->PortName() << ")" ) ;
+ if ( theNode == NULL ||
+ ( theNode != NULL && !theNode->IsEndSwitchNode() &&
+ !strcmp( theNode->Name() , aNode->Name() ) ) ) {
+ if ( anInPort->IsLoop() || anOutPort->IsLoop() ||
+ ( aNode->IsEndLoopNode() && !strcmp( aNode->CoupledNode()->Name() ,
+ anOutPort->NodeName() ) ) ) {
+ MESSAGE( "StreamLink " << anOutPort->NodeName() << "("
+ << anOutPort->PortName() << ") --> " << aNode->Name() << "("
+ << anInPort->PortName() << ")" << " ignored" ) ;
+ }
+ else if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
+ if ( begin ) {
+ beginService( "StreamGraph_Impl::StreamLinks" );
+ begin = false ;
+ }
+ GraphEditor::InNode * anOutNode = NULL ;
+ anOutNode = (GraphEditor::InNode * ) DataFlowEditor()->Graph()->GetChangeGraphNode( anOutPort->NodeName() )->GetInNode() ;
+ if ( anOutNode ) {
+ bool Success ;
+ StreamLink_Impl * myStreamLink = new StreamLink_Impl(
+ _Orb , _Poa , _ContId ,
+ instanceName() , interfaceName() ,
+ DataFlowEditor() ,
+ aNode ,
+ anInPort->PortName() ,
+ anOutNode ,
+ anOutPort->PortName() ,
+ false , Success ) ;
+ if ( Success ) {
+ PortableServer::ObjectId * id = myStreamLink->getId() ;
+ CORBA::Object_var obj = _poa->id_to_reference(*id);
+ SUPERV::StreamLink_var iobject ;
+ iobject = SUPERV::StreamLink::_narrow(obj) ;
+ RetVal->length( countlink + 1 ) ;
+ RetVal[ countlink++ ] = SUPERV::StreamLink::_duplicate( iobject ) ;
+ anOutPort->AddInPortObjRef( anInPort , SUPERV::StreamLink::_duplicate( iobject ) ) ;
+ MESSAGE( "Link" << countlink-1 << " "
+ << RetVal[countlink-1]->OutStreamPort()->Node()->Name() << "("
+ << RetVal[countlink-1]->OutStreamPort()->Name() << ") --> "
+ << RetVal[countlink-1]->InStreamPort()->Node()->Name() << "("
+ << RetVal[countlink-1]->InStreamPort()->Name() << ")" ) ;
+ }
+ }
+ }
+ else {
+ RetVal->length( countlink + 1 ) ;
+ RetVal[ countlink++ ] = SUPERV::StreamLink::_duplicate( SUPERV::StreamLink::_narrow( anOutPort->InPortObjRef( anInPort ) ) ) ;
+ MESSAGE( "Link" << countlink-1 << " "
+ << RetVal[countlink-1]->OutStreamPort()->Node()->Name() << "("
+ << RetVal[countlink-1]->OutStreamPort()->Name() << ") --> "
+ << RetVal[countlink-1]->InStreamPort()->Node()->Name() << "("
+ << RetVal[countlink-1]->InStreamPort()->Name() << ")" ) ;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ for ( j = 0 ; j < aNode->GetNodeOutPortsSize() ; j++ ) {
+ GraphBase::OutPort * anOutPort = aNode->GetChangeNodeOutPort( j ) ;
+ int k ;
+ for ( k = 0 ; k < anOutPort->InPortsSize() ; k++ ) {
+ GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( k ) ;
+ GraphEditor::InNode * toNode = (GraphEditor::InNode * ) DataFlowEditor()->Graph()->GetChangeGraphNode( anInPort->NodeName() )->GetInNode() ;
+ if ( theNode == NULL ||
+ !strcmp( theNode->Name() , aNode->Name() ) ) {
+ if ( anInPort->IsDataStream() ) {
+ if ( theNode || ( toNode->IsEndSwitchNode() && !aNode->IsSwitchNode() ) ) {
+ if ( anInputParam == NULL ||
+ !strcmp( anInPort->PortName() , anInputParam ) ) {
+ MESSAGE( "StreamLink " << anOutPort->NodeName() << "("
+ << anOutPort->PortName() << ") --> " << toNode->Name() << "("
+ << anInPort->PortName() << ")" ) ;
+ MESSAGE( " IOR " << DataFlowEditor()->ObjectToString( anOutPort->InPortObjRef( anInPort ) ) ) ;
+ if ( anInPort->IsLoop() || anOutPort->IsLoop() ||
+ ( toNode->IsEndLoopNode() && !strcmp( toNode->CoupledNode()->Name() ,
+ anOutPort->NodeName() ) ) ) {
+ MESSAGE( "StreamLink " << anOutPort->NodeName() << "("
+ << anOutPort->PortName() << ") --> " << toNode->Name() << "("
+ << anInPort->PortName() << ")" << " ignored" ) ;
+ }
+ else if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
+ if ( begin ) {
+ beginService( "Graph_Impl::StreamLinks" );
+ begin = false ;
+ }
+ bool Success ;
+ StreamLink_Impl * myStreamLink = new StreamLink_Impl(
+ _Orb , _Poa , _ContId ,
+ instanceName() , interfaceName() ,
+ DataFlowEditor() ,
+ toNode ,
+ anInPort->PortName() ,
+ aNode ,
+ anOutPort->PortName() ,
+ false , Success ) ;
+ if ( Success ) {
+ PortableServer::ObjectId * id = myStreamLink->getId() ;
+ CORBA::Object_var obj = _poa->id_to_reference(*id);
+ SUPERV::StreamLink_var iobject ;
+ iobject = SUPERV::StreamLink::_narrow(obj) ;
+ RetVal->length( countlink + 1 ) ;
+ RetVal[ countlink++ ] = SUPERV::StreamLink::_duplicate( iobject ) ;
+ anOutPort->AddInPortObjRef( anInPort , SUPERV::StreamLink::_duplicate( iobject ) ) ;
+ MESSAGE( "Link" << countlink-1 << " "
+ << RetVal[countlink-1]->OutStreamPort()->Node()->Name() << "("
+ << RetVal[countlink-1]->OutStreamPort()->Name() << ") --> "
+ << RetVal[countlink-1]->InStreamPort()->Node()->Name() << "("
+ << RetVal[countlink-1]->InStreamPort()->Name() << ")" ) ;
+ }
+ }
+ else {
+ RetVal->length( countlink + 1 ) ;
+ RetVal[ countlink++ ] = SUPERV::StreamLink::_duplicate( SUPERV::StreamLink::_narrow( anOutPort->InPortObjRef( anInPort ) ) ) ;
+ MESSAGE( "Link" << countlink-1 << " "
+ << RetVal[countlink-1]->OutStreamPort()->Node()->Name() << "("
+ << RetVal[countlink-1]->OutStreamPort()->Name() << ") --> "
+ << RetVal[countlink-1]->InStreamPort()->Node()->Name() << "("
+ << RetVal[countlink-1]->InStreamPort()->Name() << ")" ) ;
+ }
+ }
+ else {
+ MESSAGE( "StreamLink " << anOutPort->NodeName() << "("
+ << anOutPort->PortName() << ") --> " << toNode->Name() << "("
+ << anInPort->PortName() << ")" << " skipped" ) ;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+//#if 0
+ const char * NodeName = "" ;
+ const char * InputParamName = "" ;
+ if ( theNode ) {
+ NodeName = theNode->Name() ;
+ }
+ if ( anInputParam ) {
+ InputParamName = anInputParam ;
+ }
+ MESSAGE( RetVal->length() << " StreamLinks of Node " << NodeName << " and of InPort " << InputParamName ) ;
+ for ( i = 0 ; i < (int ) RetVal->length() ; i++ ) {
+ MESSAGE( "Link" << i << " " << RetVal[i]->OutStreamPort()->Node()->Name() << "("
+ << RetVal[i]->OutStreamPort()->Name() << ") --> "
+ << RetVal[i]->InStreamPort()->Node()->Name() << "("
+ << RetVal[i]->InStreamPort()->Name() << ")" ) ;
+ }
+//#endif
+ if ( !begin ) {
+ endService( "StreamGraph_Impl::StreamLinks" );
+ }
+ return ( RetVal._retn() ) ;
+}
+
+bool StreamGraph_Impl::SetStreamParams( const long Timeout ,
+ const SUPERV::KindOfDataStreamTrace DataStreamTrace ,
+ const double DeltaTime ) {
+ bool sts = DataFlowEditor()->StreamGraph()->SetStreamParams( Timeout , DataStreamTrace , DeltaTime ) ;
+ if ( sts ) {
+ DataFlowEditor()->UnValid() ;
+ }
+ return sts ;
+}
+
+void StreamGraph_Impl::StreamParams( long & Timeout ,
+ SUPERV::KindOfDataStreamTrace & DataStreamTrace ,
+ double & DeltaTime ) {
+ DataFlowEditor()->StreamGraph()->StreamParams( Timeout , DataStreamTrace , DeltaTime ) ;
+}
+
+long StreamGraph_Impl::SubStreamGraphsNumber() {
+// beginService( "StreamGraph_Impl::StreamGraphsNumber" );
+ long RetVal = 0 ;
+ if ( DataFlowEditor()->IsExecutable() ) {
+ RetVal = DataFlowEditor()->SubStreamGraphsNumber() ;
+ }
+// endService( "StreamGraph_Impl::SubStreamGraphsNumber" );
+ return RetVal ;
+}
+
+SUPERV::ListOfNodes * StreamGraph_Impl::SubStreamGraphsNodes( const long aSubStreamGraphNumber ) {
+ beginService( "StreamGraph_Impl::SubStreamGraphsNodes" );
+ SUPERV::ListOfNodes_var RetVal = new SUPERV::ListOfNodes ;
+ if ( DataFlowEditor()->IsEditing() ) {
+ SUPERV::ListOfNodes * aGraphNodes = Nodes() ;
+ int i ;
+// ComputingNodes
+ for ( i = 0 ; i < (int ) aGraphNodes->CNodes.length() ; i++ ) {
+ SUPERV::CNode_var aNode = (aGraphNodes->CNodes)[ i ] ;
+ if ( aNode->SubStreamGraph() == aSubStreamGraphNumber ) {
+ RetVal = SetNode( RetVal , DataFlowEditor()->Graph()->GetChangeGraphNode( aNode->Name() ) ) ;
+ }
+ }
+// FactoryNodes
+ for ( i = 0 ; i < (int ) aGraphNodes->FNodes.length() ; i++ ) {
+ SUPERV::FNode_var aNode = (aGraphNodes->FNodes)[ i ] ;
+ if ( aNode->SubStreamGraph() == aSubStreamGraphNumber ) {
+ RetVal = SetNode( RetVal , DataFlowEditor()->Graph()->GetChangeGraphNode( aNode->Name() ) ) ;
+ }
+ }
+// InLineNodes
+ for ( i = 0 ; i < (int ) aGraphNodes->INodes.length() ; i++ ) {
+ SUPERV::INode_var aNode = (aGraphNodes->INodes)[ i ] ;
+ if ( aNode->SubStreamGraph() == aSubStreamGraphNumber ) {
+ RetVal = SetNode( RetVal , DataFlowEditor()->Graph()->GetChangeGraphNode( aNode->Name() ) ) ;
+ }
+ }
+// GOTONodes
+ for ( i = 0 ; i < (int ) aGraphNodes->GNodes.length() ; i++ ) {
+ SUPERV::GNode_var aNode = (aGraphNodes->GNodes)[ i ] ;
+ if ( aNode->SubStreamGraph() == aSubStreamGraphNumber ) {
+ RetVal = SetNode( RetVal , DataFlowEditor()->Graph()->GetChangeGraphNode( aNode->Name() ) ) ;
+ }
+ }
+// LoopNodes
+ for ( i = 0 ; i < (int ) aGraphNodes->LNodes.length() ; i++ ) {
+ SUPERV::LNode_var aNode = (aGraphNodes->LNodes)[ i ] ;
+ if ( aNode->SubStreamGraph() == aSubStreamGraphNumber ) {
+ RetVal = SetNode( RetVal , DataFlowEditor()->Graph()->GetChangeGraphNode( aNode->Name() ) ) ;
+ }
+ }
+// EndLoopNodes
+ for ( i = 0 ; i < (int ) aGraphNodes->ELNodes.length() ; i++ ) {
+ SUPERV::ELNode_var aNode = (aGraphNodes->ELNodes)[ i ] ;
+ if ( aNode->SubStreamGraph() == aSubStreamGraphNumber ) {
+ RetVal = SetNode( RetVal , DataFlowEditor()->Graph()->GetChangeGraphNode( aNode->Name() ) ) ;
+ }
+ }
+// SwitchNodes
+ for ( i = 0 ; i < (int ) aGraphNodes->SNodes.length() ; i++ ) {
+ SUPERV::SNode_var aNode = (aGraphNodes->SNodes)[ i ] ;
+ if ( aNode->SubStreamGraph() == aSubStreamGraphNumber ) {
+ RetVal = SetNode( RetVal , DataFlowEditor()->Graph()->GetChangeGraphNode( aNode->Name() ) ) ;
+ }
+ }
+// EndSwitchNodes
+ for ( i = 0 ; i < (int ) aGraphNodes->ESNodes.length() ; i++ ) {
+ SUPERV::ESNode_var aNode = (aGraphNodes->ESNodes)[ i ] ;
+ if ( aNode->SubStreamGraph() == aSubStreamGraphNumber ) {
+ RetVal = SetNode( RetVal , DataFlowEditor()->Graph()->GetChangeGraphNode( aNode->Name() ) ) ;
+ }
+ }
+ }
+ endService( "StreamGraph_Impl::SubStreamGraphsNodes" );
+ return ( RetVal._retn() ) ;
+}
+
+SUPERV::Graph_ptr StreamGraph_Impl::ToFlowGraph() {
+ SUPERV::Graph_var iobject = SUPERV::Graph::_nil() ;
+ beginService( "StreamGraph_Impl::ToFlowGraph" );
+// Graph_Impl * myFlowGraph = new Graph_Impl( _Orb , _Poa , _ContId ,
+// instanceName() , interfaceName() ) ;
+// PortableServer::ObjectId * id = myFlowGraph->getId() ;
+// CORBA::Object_var obj = _poa->id_to_reference(*id);
+ if ( !CORBA::is_nil( DataFlowEditor()->StreamGraph()->ObjRef() ) ) {
+ iobject = SUPERV::Graph::_narrow( DataFlowEditor()->StreamGraph()->ObjRef() ) ;
+ }
+ endService( "StreamGraph_Impl::ToFlowGraph" );
+ return SUPERV::Graph::_duplicate( iobject ) ;
+}
+
+bool StreamGraph_Impl::StreamMerge(const SUPERV::StreamGraph_ptr aStreamGraph ) {
+ beginService( "StreamGraph_Impl::StreamMerge" );
+ map< string , int > aMapOfNodes ;
+ bool RetVal = Merge( aStreamGraph , aMapOfNodes ) ;
+ if ( RetVal ) {
+ SUPERV::ListOfStreamLinks * aGraphLinks = aStreamGraph->GStreamLinks() ;
+ SUPERV::ListOfStreamPorts * aGraphPorts = aStreamGraph->StreamPorts() ;
+ cout << "Graph_Impl::Merge " << aGraphLinks->length() << " links " << aGraphPorts->length() << " GraphPorts"
+ << endl ;
+ int i ;
+ for ( i = 0 ; i < (int ) aGraphLinks->length() ; i++ ) {
+ SUPERV::StreamLink_var aLink = (*aGraphLinks)[ i ] ;
+ SUPERV::StreamPort_var OutPort = aLink->OutStreamPort() ;
+ SUPERV::StreamPort_var InPort = aLink->InStreamPort() ;
+ string * aLinkFromNodeName = new string( OutPort->Node()->Name() ) ;
+ string * aLinkToNodeName = new string( InPort->Node()->Name() ) ;
+ cout << "Graph_Impl::Merge " << aLinkFromNodeName << "(" << OutPort->Name() << ") ---> "
+ << aLinkToNodeName << "(" << InPort->Name() << ")" << endl ;
+ RetVal = DataFlowEditor()->AddLink( DataFlowEditor()->Graph()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() ,
+ OutPort->Name() ,
+ DataFlowEditor()->Graph()->GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() ,
+ InPort->Name() ) ;
+ cout << "Graph_Impl::Merge " << aLinkFromNodeName << "(" << OutPort->Name() << ") ---> "
+ << aLinkToNodeName << "(" << InPort->Name() << ") RetVal" << RetVal << endl ;
+ if ( RetVal ) {
+ int j ;
+ for ( j = 1 ; j <= aLink->CoordsSize() ; j++ ) {
+ long X , Y ;
+ RetVal = aLink->Coords( j , X , Y ) ;
+ if ( !RetVal )
+ break ;
+ RetVal = DataFlowEditor()->AddLinkCoord( DataFlowEditor()->Graph()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() ,
+ OutPort->Name() ,
+ DataFlowEditor()->Graph()->GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() ,
+ InPort->Name() ,
+ j , X , Y ) ;
+ if ( !RetVal ) {
+ break ;
+ }
+ }
+ }
+ delete aLinkFromNodeName ;
+ delete aLinkToNodeName ;
+ if ( !RetVal ) {
+ break ;
+ }
+ }
+ if ( RetVal ) {
+ for ( i = 0 ; i < (int ) aGraphPorts->length() ; i++ ) {
+ SUPERV::StreamPort_var aPort = (*aGraphPorts)[ i ] ;
+ if ( !aPort->IsGate() ) {
+ MESSAGE( "Graph_Impl::Merge " << i << ". " << aPort->Node()->Name() << " " << aPort->Name() ) ;
+ char * aPortName = aPort->Name() ;
+ char * aNodeName = new char[ strlen( aPortName ) + 1 ] ;
+ strcpy( aNodeName , aPortName ) ;
+ char * thePortName = strchr( aNodeName , '\\' ) ;
+ thePortName[ 0 ] = '\0' ;
+ bool hasinput = aStreamGraph->Node( aNodeName )->Port( thePortName + 1 )->HasInput() ;
+// cout << "Graph_Impl::Merge " << " aNodeName " << aNodeName << " aPort " << thePortName + 1
+// << " HasInput " << hasinput << endl ;
+ if ( hasinput ) {
+ RetVal = DataFlowEditor()->AddInputData( DataFlowEditor()->StreamGraph()->GetGraphNode( aMapOfNodes[ aNodeName ] )->Name() ,
+ thePortName + 1 ,
+ *(aPort->ToAny()) ) ;
+ }
+ delete [] aNodeName ;
+ if ( !RetVal ) {
+ break ;
+ }
+ }
+ }
+ }
+ }
+ endService( "StreamGraph_Impl::StreamMerge" );
+ return RetVal ;
+}
+
--- /dev/null
+// SUPERV Supervision : contains the implementation of interfaces of SuperVision described in SUPERV.idl
+//
+// 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 : StreamGraph_Impl.hxx
+// Author : Jean Rahuel
+// Module : SUPERV
+// $Header:
+
+#ifndef _STREAMGRAPH_IMPL_HXX_
+#define _STREAMGRAPH_IMPL_HXX_
+
+//#include <iostream.h>
+
+#include "CORBA.h"
+
+#include <SALOMEconfig.h>
+#include "SALOME_Component_i.hxx"
+#include "SALOME_LifeCycleCORBA.hxx"
+
+#include "Graph_Impl.hxx"
+
+class StreamGraph_Impl : public Graph_Impl ,
+ public POA_SUPERV::StreamGraph {
+ private:
+
+ CORBA::ORB_ptr _Orb ;
+ PortableServer::POA_ptr _Poa ;
+ PortableServer::ObjectId * _ContId ;
+
+ public:
+ StreamGraph_Impl();
+ StreamGraph_Impl( CORBA::ORB_ptr orb ,
+ PortableServer::POA_ptr poa ,
+ PortableServer::ObjectId * contId ,
+ const char *instanceName ,
+ const char *interfaceName ,
+ const char *aDataFlowName ) ;
+
+ virtual ~StreamGraph_Impl() ;
+ virtual void destroy() ;
+
+ virtual SUPERV::StreamGraph_ptr StreamCopy() ;
+
+ virtual SUPERV::StreamLink_ptr StreamLink( SUPERV::StreamPort_ptr OutStreamPort ,
+ SUPERV::StreamPort_ptr InStreamPort ) ;
+
+ virtual SUPERV::ListOfStreamLinks * GStreamLinks() ;
+
+ virtual SUPERV::ListOfStreamLinks * StreamLinks( GraphBase::ComputingNode * aNode ,
+ const char * anInputParam ) ;
+
+ virtual bool SetStreamParams( const long Timeout ,
+ const SUPERV::KindOfDataStreamTrace DataStreamTrace ,
+ const double DeltaTime ) ;
+ virtual void StreamParams( long & Timeout ,
+ SUPERV::KindOfDataStreamTrace & DataStreamTrace ,
+ double & DeltaTime ) ;
+
+ virtual long SubStreamGraphsNumber() ;
+ virtual SUPERV::ListOfNodes * SubStreamGraphsNodes( const long aSubStreamGraphNumber ) ;
+
+ virtual SUPERV::Graph_ptr ToFlowGraph() ;
+
+ bool StreamMerge( const SUPERV::StreamGraph_ptr aStreamGraph ) ;
+
+};
+
+
+#endif
--- /dev/null
+// SUPERV Supervision : contains the implementation of interfaces of SuperVision described in SUPERV.idl
+//
+// 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 : StreamLink_Impl.cxx
+// Author : Jean Rahuel
+// Module : SUPERV
+// $Header:
+
+using namespace std;
+
+#include "StreamLink_Impl.hxx"
+
+StreamLink_Impl::StreamLink_Impl( CORBA::ORB_ptr orb ,
+ PortableServer::POA_ptr poa ,
+ PortableServer::ObjectId * contId ,
+ const char *instanceName ,
+ const char *interfaceName ,
+ GraphEditor::DataFlow * DataFlowEditor ,
+ GraphEditor::InNode * DataFlowNode ,
+ const char *InputParameterName ,
+ GraphEditor::InNode * DataFlowOutNode ,
+ const char *OutputParameterName ,
+ const bool Create ,
+ bool & Success ) :
+ Link_Impl( orb , poa , contId , instanceName , interfaceName , DataFlowEditor ,
+ DataFlowNode , InputParameterName , DataFlowOutNode ,
+ OutputParameterName , false , false , Success ) {
+// MESSAGE("StreamLink_Impl::StreamLink_Impl activate object instanceName("
+// << instanceName << ") interfaceName(" << interfaceName << ") --> "
+// << hex << (void *) this << dec )
+// bool linksts ;
+// beginService( "StreamLink_Impl::Link_Impl" );
+ _Orb = CORBA::ORB::_duplicate(orb);
+ _Poa = poa ;
+ _ContId = contId ;
+ if ( Create ) {
+ Success = DataFlowEditor->AddLink( DataFlowOutNode->Name() ,
+ OutputParameterName ,
+ DataFlowNode->Name() ,
+ InputParameterName ) ;
+ }
+ else {
+ char * DataFlowOutNodeName = NULL ;
+ char * OutParamName = NULL ;
+ Success = DataFlowEditor->GetLink( DataFlowNode->Name() ,
+ InputParameterName ,
+ &DataFlowOutNodeName ,
+ &OutParamName ) ;
+ }
+ _thisObj = this ;
+ _id = _poa->activate_object(_thisObj);
+// endService( "StreamLink_Impl::Link_Impl" );
+}
+
+StreamLink_Impl::StreamLink_Impl() {
+}
+
+StreamLink_Impl::~StreamLink_Impl() {
+ beginService( "Link_Impl::~Link_Impl" );
+ endService( "Link_Impl::~Link_Impl" );
+}
+
+void StreamLink_Impl::destroy() {
+ beginService( "StreamLink_Impl::destroy" );
+ Delete() ;
+ _poa->deactivate_object(*_id) ;
+ CORBA::release(_poa) ;
+ delete(_id) ;
+ _thisObj->_remove_ref();
+ endService( "StreamLink_Impl::destroy" );
+}
+
+bool StreamLink_Impl::Delete() {
+// beginService( "StreamLink_Impl::Delete" ) ;
+ bool RetVal = DataFlowEditor()->RemoveLink( DataFlowOutNode()->Name() ,
+ OutputParameterName() ,
+ DataFlowNode()->Name() ,
+ InputParameterName() ) ;
+ if ( RetVal ) {
+ DataFlowEditor()->UnValid() ;
+ }
+// endService( "StreamLink_Impl::Delete" );
+ return RetVal ;
+}
+
+SUPERV::StreamPort_ptr StreamLink_Impl::InStreamPort() {
+// beginService( "Link_Impl::InStreamPort" );
+ SUPERV::StreamPort_var iobject = SUPERV::StreamPort::_nil() ;
+ GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( InputParameterName() ) ;
+ if ( anInPort && anInPort->IsDataStream() ) {
+ iobject = SUPERV::StreamPort::_narrow( anInPort->ObjRef() ) ;
+ if ( CORBA::is_nil( iobject ) ) {
+// MESSAGE( "StreamLink_Impl::InStreamPort creates myStreamPort "
+// << DataFlowNode()->Name() << "( " << anInPort->PortName() << " )" ) ;
+ StreamPort_Impl * myStreamPort = new StreamPort_Impl(
+ _Orb , _Poa , _ContId ,
+ instanceName() , interfaceName() ,
+ DataFlowEditor() ,
+ DataFlowNode() ,
+ (GraphBase::Port * ) anInPort ,
+ true ) ;
+ PortableServer::ObjectId * id = myStreamPort->getId() ;
+ CORBA::Object_var obj = _poa->id_to_reference(*id);
+ iobject = SUPERV::StreamPort::_narrow(obj) ;
+ anInPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
+ }
+ else {
+// MESSAGE( "StreamLink_Impl::InStreamPort Gets ObjRef "
+// << iobject->Node()->Name() << "( " << iobject->Name() << " )" ) ;
+ }
+ }
+// endService( "StreamLink_Impl::InStreamPort" );
+ return SUPERV::StreamPort::_duplicate( iobject ) ;
+}
+
+SUPERV::StreamPort_ptr StreamLink_Impl::OutStreamPort() {
+// beginService( "StreamLink_Impl::OutStreamPort" );
+ SUPERV::StreamPort_var iobject ;
+ GraphBase::OutPort * anOutPort = DataFlowOutNode()->GetChangeOutPort( OutputParameterName() ) ;
+ if ( anOutPort && anOutPort->IsDataStream() ) {
+ iobject = SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ;
+ if ( CORBA::is_nil( iobject ) ) {
+// MESSAGE( "StreamLink_Impl::OutStreamPort creates myStreamPort "
+// << DataFlowNode()->Name() << "( " << anOutPort->PortName() << " )" ) ;
+ StreamPort_Impl * myStreamPort = new StreamPort_Impl(
+ _Orb , _Poa , _ContId ,
+ instanceName() , interfaceName() ,
+ DataFlowEditor() ,
+ DataFlowOutNode() ,
+ (GraphBase::Port * ) anOutPort ,
+ false ) ;
+ PortableServer::ObjectId * id = myStreamPort->getId() ;
+ CORBA::Object_var obj = _poa->id_to_reference(*id);
+ iobject = SUPERV::StreamPort::_narrow(obj) ;
+ anOutPort->ObjRef( SUPERV::StreamPort::_duplicate( iobject ) ) ;
+ }
+ else {
+// MESSAGE( "StreamLink_Impl::OutStreamPort Gets ObjRef "
+// << iobject->Node()->Name() << "( " << iobject->Name() << " )" ) ;
+ }
+ }
+// endService( "StreamLink_Impl::OutStreamPort" );
+ return SUPERV::StreamPort::_duplicate( iobject ) ;
+}
+
--- /dev/null
+// SUPERV Supervision : contains the implementation of interfaces of SuperVision described in SUPERV.idl
+//
+// 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 : StreamLink_Impl.hxx
+// Author : Jean Rahuel
+// Module : SUPERV
+// $Header:
+
+#ifndef _STREAMLINK_IMPL_HXX_
+#define _STREAMLINK_IMPL_HXX_
+
+#include "StreamPort_Impl.hxx"
+
+#include "Link_Impl.hxx"
+
+class StreamLink_Impl : public POA_SUPERV::StreamLink ,
+ public Link_Impl {
+ private:
+
+ CORBA::ORB_ptr _Orb ;
+ PortableServer::POA_ptr _Poa ;
+ PortableServer::ObjectId * _ContId ;
+
+ public:
+ StreamLink_Impl();
+ StreamLink_Impl( CORBA::ORB_ptr orb ,
+ PortableServer::POA_ptr poa ,
+ PortableServer::ObjectId * contId ,
+ const char *instanceName ,
+ const char *interfaceName ,
+ GraphEditor::DataFlow * DataFlowEditor ,
+ GraphEditor::InNode * DataFlowNode ,
+ const char *InputParameterName ,
+ GraphEditor::InNode * DataFlowOutNode ,
+ const char *OutputParameterName ,
+ const bool Create ,
+ bool & Success ) ;
+
+ virtual ~StreamLink_Impl() ;
+ virtual void destroy() ;
+ virtual bool Delete() ;
+
+ SUPERV::StreamPort_ptr OutStreamPort() ;
+ SUPERV::StreamPort_ptr InStreamPort() ;
+
+} ;
+
+#endif
--- /dev/null
+// SUPERV Supervision : contains the implementation of interfaces of SuperVision described in SUPERV.idl
+//
+// 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 : StreamPort_Impl.cxx
+// Author : Jean Rahuel
+// Module : SUPERV
+// $Header:
+
+using namespace std;
+
+#include "StreamPort_Impl.hxx"
+
+StreamPort_Impl::StreamPort_Impl( CORBA::ORB_ptr orb ,
+ PortableServer::POA_ptr poa ,
+ PortableServer::ObjectId * contId ,
+ const char *instanceName ,
+ const char *interfaceName ,
+ GraphEditor::DataFlow * DataFlowEditor ,
+ GraphEditor::InNode * DataFlowNode ,
+ GraphBase::Port * DataFlowPort ,
+ bool InputPort ,
+ const CORBA::Any * anAny ) :
+ Port_Impl( orb , poa , contId , instanceName , interfaceName ,
+ DataFlowEditor , DataFlowNode , DataFlowPort , InputPort , anAny ) {
+// MESSAGE("StreamPort_Impl::StreamPort_Impl activate object instanceName("
+// << instanceName << ") interfaceName(" << interfaceName << ") --> "
+// << hex << (void *) this << dec )
+ _Orb = CORBA::ORB::_duplicate(orb);
+ _Poa = poa ;
+ _ContId = contId ;
+ _thisObj = this ;
+ _id = _poa->activate_object(_thisObj);
+}
+
+StreamPort_Impl::StreamPort_Impl( CORBA::ORB_ptr orb ,
+ PortableServer::POA_ptr poa ,
+ PortableServer::ObjectId * contId ,
+ const char *instanceName ,
+ const char *interfaceName ,
+ GraphEditor::DataFlow * DataFlowEditor ,
+ GraphEditor::InNode * DataFlowNode ,
+ GraphBase::Port * DataFlowPort ,
+ bool InputPort ) :
+ Port_Impl( orb , poa , contId , instanceName , interfaceName ,
+ DataFlowEditor , DataFlowNode , DataFlowPort , InputPort ) {
+// MESSAGE("StreamPort_Impl::StreamPorte_Impl activate object instanceName("
+// << instanceName << ") interfaceName(" << interfaceName << ") --> "
+// << hex << (void *) this << dec )
+ _Orb = CORBA::ORB::_duplicate(orb);
+ _Poa = poa ;
+ _ContId = contId ;
+ _thisObj = this ;
+ _id = _poa->activate_object(_thisObj);
+}
+
+StreamPort_Impl::StreamPort_Impl() {
+}
+
+StreamPort_Impl::~StreamPort_Impl() {
+ beginService( "StreamPort_Impl::~StreamPort_Impl" );
+ endService( "StreamPort_Impl::~StreamPort_Impl" );
+}
+
+void StreamPort_Impl::destroy() {
+ beginService( "StreamPort_Impl::destroy" );
+ bool destroyed = false ;
+ if ( DataFlowNode()->IsOneOfInLineNodes() ) {
+ if ( IsInput() ) {
+ GraphBase::InPort * anInPort = (GraphBase::InPort * ) DataFlowPort() ;
+ if ( anInPort->GetOutPort() ) {
+ anInPort->GetOutPort()->RemoveInPort( anInPort ) ;
+ }
+ DataFlowNode()->DelInPort( DataFlowPort()->PortName() ) ;
+ destroyed = true ;
+ }
+ else {
+ DataFlowNode()->DelOutPort( DataFlowPort()->PortName() ) ;
+ destroyed = true ;
+ }
+ if ( destroyed ) {
+ DataFlowEditor()->UnValid() ;
+ }
+ }
+ if ( destroyed ) {
+ _poa->deactivate_object(*_id) ;
+ CORBA::release(_poa) ;
+ delete(_id) ;
+ _thisObj->_remove_ref();
+ }
+ endService( "StreamPort_Impl::destroy" );
+}
+
+
+SUPERV::StreamLink_ptr StreamPort_Impl::StreamLink() {
+ bool begin = true ;
+ SUPERV::StreamLink_var iobject = SUPERV::StreamLink::_nil() ;
+ char * FromNodeName = NULL ;
+ char * FromServiceParameterName = NULL ;
+ bool status = DataFlowEditor()->GetLink( DataFlowNode()->Name() ,
+ DataFlowPort()->PortName() ,
+ & FromNodeName ,
+ & FromServiceParameterName ) ;
+ if ( status ) {
+// cout << "Port_Impl::Link " << FromNodeName << "("
+// << FromServiceParameterName << ") --> " << _DataFlowNode->Name()
+// << "(" << _DataFlowPort->PortName() << ")" << endl ;
+// SUPERV::Port_ptr theOutPort = Port( FromServiceParameterName ) ;
+
+ GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( DataFlowPort()->PortName() ) ;
+ if ( anInPort->GetOutPort() ) {
+ GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
+ if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
+ if ( begin ) {
+ beginService( "Port_Impl::Link" ) ;
+ begin = false ;
+ }
+ bool Success ;
+ StreamLink_Impl * myStreamLink = new StreamLink_Impl( _Orb , _Poa , _ContId ,
+ instanceName() , interfaceName() ,
+ DataFlowEditor() ,
+ DataFlowNode() ,
+ DataFlowPort()->PortName() ,
+ (GraphEditor::InNode * ) DataFlowEditor()->Graph()->GetChangeGraphNode( FromNodeName )->GetInNode() ,
+ FromServiceParameterName ,
+ false , Success ) ;
+ if ( Success ) {
+ 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 ) {
+ MESSAGE( "Link " << iobject->OutPort()->Node()->Name() << "( " << iobject->OutPort()->Name() << " ) --> "
+ << iobject->InPort()->Node()->Name() << "( " << iobject->InPort()->Name() << " ) " ) ;
+ endService( "StreamPort_Impl::StreamLink" ) ;
+ }
+ return SUPERV::StreamLink::_duplicate( iobject ) ;
+}
+
+SALOME_ModuleCatalog::DataStreamDependency StreamPort_Impl::Dependency() {
+// beginService( "StreamPort_Impl::Dependency" );
+ SALOME_ModuleCatalog::DataStreamDependency RetVal = DataFlowPort()->Dependency() ;
+// endService( "StreamPort_Impl::Dependency" );
+ return RetVal ;
+}
+
+bool StreamPort_Impl::SetDependency( const SALOME_ModuleCatalog::DataStreamDependency aDependency ) {
+// beginService( "StreamPort_Impl::SetDependency" );
+ DataFlowPort()->Dependency( aDependency ) ;
+// endService( "StreamPort_Impl::SetDependency" );
+ return true ;
+}
+
+bool StreamPort_Impl::SetParams( const SUPERV::KindOfSchema aKindOfSchema ,
+ const SUPERV::KindOfInterpolation aKindOfInterpolation ,
+ const SUPERV::KindOfExtrapolation aKindOfExtrapolation ) {
+// beginService( "StreamPort_Impl::SetParams" );
+ bool RetVal = false ;
+ if ( IsInput() ) {
+ GraphBase::InDataStreamPort * anInStreamPort = (GraphBase::InDataStreamPort * ) DataFlowPort() ;
+ RetVal = anInStreamPort->SetParams( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ;
+ if ( RetVal ) {
+ MESSAGE( "OutStreamPort_Impl::SetParams( " << aKindOfSchema << " , " << aKindOfInterpolation
+ << " , " << aKindOfExtrapolation << " ) SUCCESS " ) ;
+ DataFlowEditor()->UnValid() ;
+ }
+ else {
+ MESSAGE( "OutStreamPort_Impl::SetParams( " << aKindOfSchema << " , " << aKindOfInterpolation
+ << " , " << aKindOfExtrapolation << " ) FAILED " ) ;
+ }
+ }
+ else {
+ MESSAGE( "OutStreamPort_Impl::SetParams( " << aKindOfSchema << " , " << aKindOfInterpolation
+ << " , " << aKindOfExtrapolation << " ) ERROR : OutPort" ) ;
+ }
+// endService( "StreamPort_Impl::SetParams" );
+ return RetVal ;
+}
+
+bool StreamPort_Impl::Params( SUPERV::KindOfSchema & aKindOfSchema ,
+ SUPERV::KindOfInterpolation & aKindOfInterpolation ,
+ SUPERV::KindOfExtrapolation & aKindOfExtrapolation ) {
+// beginService( "StreamPort_Impl::Params" );
+ bool RetVal = false ;
+ if ( IsInput() ) {
+ GraphBase::InDataStreamPort * anInStreamPort = (GraphBase::InDataStreamPort * ) DataFlowPort() ;
+ anInStreamPort->Params( aKindOfSchema , aKindOfInterpolation , aKindOfExtrapolation ) ;
+ MESSAGE( "InStreamPort_Impl::Params( " << aKindOfSchema << " , " << aKindOfInterpolation << " , " << aKindOfExtrapolation << " )" ) ;
+ RetVal = true ;
+ }
+ else {
+ aKindOfSchema = (SUPERV::KindOfSchema ) -1 ;
+ aKindOfInterpolation = (SUPERV::KindOfInterpolation ) -1 ;
+ aKindOfExtrapolation = (SUPERV::KindOfExtrapolation ) -1 ;
+ MESSAGE( "OutStreamPort_Impl::Params( " << aKindOfSchema << " , " << aKindOfInterpolation
+ << " , " << aKindOfExtrapolation << " ) ERROR: OutPort" ) ;
+ }
+// endService( "StreamPort_Impl::Params" );
+ return RetVal ;
+}
+
+bool StreamPort_Impl::SetNumberOfValues( const long aNumberOfValues ) {
+// beginService( "StreamPort_Impl::SetNumberOfValues" );
+ bool RetVal = false ;
+ if ( !IsInput() ) {
+ GraphBase::OutDataStreamPort * anOutStreamPort = (GraphBase::OutDataStreamPort * ) DataFlowPort() ;
+ anOutStreamPort->NumberOfValues( aNumberOfValues ) ;
+ DataFlowEditor()->UnValid() ;
+ RetVal = true ;
+ }
+ else {
+ MESSAGE( "OutStreamPort_Impl::SetNumberOfValues( " << aNumberOfValues << " ) ERROR : InPort" ) ;
+ }
+// endService( "StreamPort_Impl::SetNumberOfValues" );
+ return RetVal ;
+}
+
+long StreamPort_Impl::NumberOfValues() {
+// beginService( "StreamPort_Impl::NumberOfValues" );
+ long RetVal = -1 ;
+ if ( !IsInput() ) {
+ GraphBase::OutDataStreamPort * anOutStreamPort = (GraphBase::OutDataStreamPort * ) DataFlowPort() ;
+ RetVal = anOutStreamPort->NumberOfValues() ;
+ MESSAGE( "OutStreamPort_Impl::NumberOfValues() " << RetVal ) ;
+ }
+ else {
+ MESSAGE( "OutStreamPort_Impl::NumberOfValues() ERROR : InPort" ) ;
+ }
+// endService( "StreamPort_Impl::NumberOfValues" );
+ return RetVal ;
+}
+
--- /dev/null
+// SUPERV Supervision : contains the implementation of interfaces of SuperVision described in SUPERV.idl
+//
+// 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 : StreamPort_Impl.hxx
+// Author : Jean Rahuel
+// Module : SUPERV
+// $Header:
+
+#ifndef _STREAMPORT_IMPL_HXX_
+#define _STREAMPORT_IMPL_HXX_
+
+#include "Port_Impl.hxx"
+
+#include "StreamLink_Impl.hxx"
+
+class StreamPort_Impl : public Port_Impl ,
+ public POA_SUPERV::StreamPort {
+ private:
+
+ CORBA::ORB_ptr _Orb ;
+ PortableServer::POA_ptr _Poa ;
+ PortableServer::ObjectId * _ContId ;
+
+ public:
+ StreamPort_Impl();
+ StreamPort_Impl( CORBA::ORB_ptr orb ,
+ PortableServer::POA_ptr poa ,
+ PortableServer::ObjectId * contId ,
+ const char *instanceName ,
+ const char *interfaceName ,
+ GraphEditor::DataFlow * DataFlowEditor ,
+ GraphEditor::InNode * DataStreamNode ,
+ GraphBase::Port * DataStreamPort ,
+ bool InputPort ,
+ const CORBA::Any * anAny ) ;
+ StreamPort_Impl( CORBA::ORB_ptr orb ,
+ PortableServer::POA_ptr poa ,
+ PortableServer::ObjectId * contId ,
+ const char *instanceName ,
+ const char *interfaceName ,
+ GraphEditor::DataFlow * DataFlowEditor ,
+ GraphEditor::InNode * DataFlowNode ,
+ GraphBase::Port * DataStreamPort ,
+ bool InputPort ) ;
+ virtual ~StreamPort_Impl() ;
+ virtual void destroy() ;
+
+ virtual SUPERV::StreamLink_ptr StreamLink() ;
+
+ virtual SALOME_ModuleCatalog::DataStreamDependency Dependency() ;
+ virtual bool SetDependency( const SALOME_ModuleCatalog::DataStreamDependency aDependency ) ;
+
+ virtual bool SetParams( const SUPERV::KindOfSchema aKindOfSchema ,
+ const SUPERV::KindOfInterpolation aKindOfInterpolation ,
+ const SUPERV::KindOfExtrapolation aKindOfExtrapolation ) ;
+ virtual bool Params( SUPERV::KindOfSchema & aKindOfSchema ,
+ SUPERV::KindOfInterpolation & aKindOfInterpolation ,
+ SUPERV::KindOfExtrapolation & aKindOfExtrapolation ) ;
+
+ virtual bool SetNumberOfValues( const long aNumberOfValues ) ;
+ virtual long NumberOfValues() ;
+
+} ;
+
+#endif
from salome import CORBA
from salome import sg
import SALOME_ModuleCatalog
+ import SUPERV
+ import SUPERV_idl
except :
import curses
from LifeCycleCORBA import *
# print 'Supervision Component loaded'
SuperVision = lcc.FindOrLoadComponent("SuperVisionContainer","SUPERV")
-SuperVision.Swig = 0
+#SuperVision.Swig = 0
modulecatalog = naming_service.Resolve("/Kernel/ModulCatalog")
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 )
def Input( self , *args ):
types, realargs = getRealArgs(self.N,args)
fn = bs_AddInput_valuedict[types]
- print types,realargs,fn
anInput = apply( fn, realargs)
if anInput != None :
myInput = Port( anInput , self.N.Verbose )
if self.N.Verbose :
print ErrMsg
return anInput
-# 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 InStreamPort( self , aParameterName , aParameterType , aDependency ):
+ aPort = self.N.InStreamPort( aParameterName , aParameterType , aDependency )
+ 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 OutStreamPort( self , aParameterName , aParameterType , aDependency ):
+ aPort = self.N.OutStreamPort( aParameterName , aParameterType , aDependency )
+ 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 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 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 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
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('\\')
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()
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()
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 ):
return self.N.IsEndSwitch()
def SubGraph( self ):
return self.N.SubGraph()
+ def SubStreamGraph( self ):
+ return self.N.SubStreamGraph()
def Thread( self ):
return self.N.Thread()
def IsWaiting( self ):
return self.N.PyFunction()
def PyFuncName( self ):
return self.N.PyFuncName()
- def EPyFunc( self ):
- PyFunc = self.N.PyFunction()
- PyFunc = self.Edit( self.N.PyFuncName() , PyFunc )
- self.N.SetPyFunction( self.N.PyFuncName() , PyFunc )
def InPort( self , aParameterName , aParameterType ):
aPort = self.N.InPort( aParameterName ,
aParameterType )
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 )
+ self.N.SetPyFunction( self.N.PyFuncName() , PyFunc )
##########################################################
class GNode(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
print ErrMsg
return aNode
def Node( self , aComponent , anInterface , aService ):
- if SuperVision.Swig :
- aService = Service_Swig( aService )
+ #if SuperVision.Swig :
+ #aService = Service_Swig( aService )
return self.FNode( aComponent , anInterface , aService )
def FNode( self , aComponent , anInterface , aService ):
NodeComponent = modulecatalog.GetComponent( aComponent )
aService = NodeComponent.GetService( anInterface , aService )
- if SuperVision.Swig :
- aService = Service_Swig( aService )
+ #if SuperVision.Swig :
+ #aService = Service_Swig( aService )
aNode = self.G.FNode( aComponent , anInterface , aService )
if aNode != None :
myNode = FNode( aNode , self.G.Verbose )
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 )
return self.G.LevelMax()
def ThreadsMax( self ):
return self.G.ThreadsMax()
- def GraphsNumber( self ):
- return self.G.GraphsNumber()
+ def SubGraphsNumber( self ):
+ return self.G.SubGraphsNumber()
def LevelNodes( self , aLevel ):
nodes = self.G.LevelNodes( aLevel )
return self.nodesTuple( nodes )
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
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()
if self.G.Verbose :
print ErrMsg
return aCopy
+ def ToStreamGraph( self ):
+ aGraph = self.G.ToStreamGraph()
+ if aGraph != None :
+ return StreamGraph( aGraph )
+ return None
+ def SubGraphsNodes( self , aSubGraphsNumber ):
+ nodes = self.G.SubGraphsNodes( aSubGraphsNumber )
+ return self.nodesTuple( nodes )
def Merge( self , aGraph ):
return self.G.Merge( aGraph.G )
def Destroy( self ):
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()
+ def SubStreamGraphsNumber( self ):
+ return self.G.SubStreamGraphsNumber()
+ def SubStreamGraphsNodes( self , aSubStreamGraphsNumber ):
+ nodes = self.G.SubStreamGraphsNodes( aSubStreamGraphsNumber )
+ return self.nodesTuple( nodes )
+ def StreamMerge( self , aStreamGraph ):
+ return self.G.StreamMerge( aStreamGraph.G )
+
+##########################################################
+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:
return self.P.IsSwitch()
def IsEndSwitch( self ):
return self.P.IsEndSwitch()
+ def IsDataStream( self ):
+ return self.P.IsDataStream()
# def IsBus( self ):
# return self.P.IsBus()
def Done( self ):
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:
##########################################################
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 ):
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
string aStr(myStrURL);
aStr += myStudyName + string(aLocalPersistentID);
- SUPERV::Graph_ptr graph = Graph(aStr.c_str());
+ SUPERV::StreamGraph_ptr graph = StreamGraph(aStr.c_str());
if (graph->_is_nil())
THROW_SALOME_CORBA_EXCEPTION("Unable to find graph in the file",SALOME::BAD_PARAM);
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 ) ;
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) ;
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 ) ;
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) ;
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 {
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 ,
#include "SALOME_Component_i.hxx"
#include "SALOME_LifeCycleCORBA.hxx"
-#include "Graph_Impl.hxx"
+#include "StreamGraph_Impl.hxx"
#include "DataFlowEditor_DataFlow.hxx"
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);
};
name = _DataFlowNode->Name() ;
}
else {
- name = _DataFlowEditor->Name() ;
+ name = _DataFlowEditor->Graph()->Name() ;
}
if ( _InputPort ) {
if ( _DataFlowNode ) {
}
char * Value_Impl::ToString() {
- beginService( "Value_Impl::ToString" );
+// beginService( "Value_Impl::ToString" );
CORBA::Any anAny = *ToAny() ;
// cout << "Value_Impl::ToString " << _DataFlowNode->Name() << " "
// << _ParameterName << " " ;
name = _DataFlowNode->Name() ;
}
else {
- name = _DataFlowEditor->Name() ;
+ name = _DataFlowEditor->Graph()->Name() ;
}
if ( _InputPort ) {
if ( _DataFlowNode ) {
switch (anAny.type()->kind()) {
case CORBA::tk_string: {
anAny >>= retstr;
- MESSAGE( "ToString( string ) '" << retstr << "'" );
+// MESSAGE( "ToString( string ) '" << retstr << "'" );
break ;
}
case CORBA::tk_long: {
anAny >>= l;
astr << l << ends ;
retstr = astr.str().c_str() ;
- MESSAGE( "ToString( long ) '" << l << " " << retstr << "'" );
+// MESSAGE( "ToString( long ) '" << l << " " << retstr << "'" );
break ;
}
case CORBA::tk_double: {
while ( i < (int ) strlen( retstr ) && retstr[ i++ ] == ' ' ) {
startstr = i ;
}
- MESSAGE( "ToString( double ) '" << d << "' '" << retstr << "' '" << &retstr[ startstr ] << "'");
+// MESSAGE( "ToString( double ) '" << d << "' '" << retstr << "' '" << &retstr[ startstr ] << "'");
break ;
}
case CORBA::tk_objref: {
try {
anAny >>= obj ;
retstr = _Orb->object_to_string( obj );
- MESSAGE( "ToString( object ) '" << retstr << "'" );
+// MESSAGE( "ToString( object ) '" << retstr << "'" );
}
catch ( ... ) {
retstr = "object_to_string catched " ;
break ;
}
}
- endService( "Value_Impl::ToString" );
+// endService( "Value_Impl::ToString" );
return CORBA::string_dup( &retstr[ startstr ] ) ;
}
name = _DataFlowNode->Name() ;
}
else {
- name = _DataFlowEditor->Name() ;
+ name = _DataFlowEditor->Graph()->Name() ;
}
if ( _InputPort ) {
if ( _DataFlowNode ) {
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 ) ) {
--- /dev/null
+// SuperVisionTest SyrComponent : example of component performing some mathinatical operations
+//
+// 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 : SyrComponent_Impl.cxx
+// Author : Jean Rahuel, CEA
+// Module : SuperVisionTest
+
+using namespace std;
+#include <stdio.h>
+#include <unistd.h>
+#include <fstream>
+#include <sstream>
+#include <string>
+
+//#include "utilities.h"
+
+#include "SyrComponent_Impl.hxx"
+#include "Adder_Impl.hxx"
+
+SyrComponent_Impl::SyrComponent_Impl( CORBA::ORB_ptr orb ,
+ PortableServer::POA_ptr poa ,
+ PortableServer::ObjectId * contId ,
+ const char *instanceName ,
+ const char *interfaceName ,
+ const bool kactivate ) :
+ Engines_Component_i(orb, poa, contId, instanceName, interfaceName,1,true) {
+ MESSAGE("SyrComponent_Impl::SyrComponent_Impl this " << hex << this << dec
+ << "activate object instanceName("
+ << instanceName << ") interfaceName(" << interfaceName << ")" )
+ if ( kactivate ) {
+ _thisObj = this ;
+ _id = _poa->activate_object(_thisObj);
+ }
+}
+
+SyrComponent_Impl::SyrComponent_Impl() {
+}
+
+SyrComponent_Impl::~SyrComponent_Impl() {
+}
+
+long SyrComponent_Impl::C_ISEVEN( const long anInteger ) {
+ bool RetVal ;
+ 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);
+ RetVal = ( anInteger & 1 ) == 0 ;
+ endService( " SyrComponent_Impl::C_ISEVEN" );
+ return RetVal ;
+}
+
+long SyrComponent_Impl::C_ISONE( const long anOddInteger ) {
+ bool RetVal ;
+ 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);
+ RetVal = ( anOddInteger == 1 ) ;
+ endService( " SyrComponent_Impl::C_ISONE" );
+ return RetVal ;
+}
+
+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);
+ endService( " SyrComponent_Impl::C_M3" );
+ if ( C_ISEVEN( anOddInteger ) )
+ return 0 ;
+ return ( 3*anOddInteger ) ;
+}
+
+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);
+ endService( " SyrComponent_Impl::C_M3P1" );
+ if ( C_ISEVEN( anOddInteger ) )
+ return 0 ;
+ return ( 3*anOddInteger + 1 ) ;
+}
+
+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);
+ endService( " SyrComponent_Impl::C_DIV2" );
+ if ( !C_ISEVEN( anEvenInteger ) )
+ return 0 ;
+ return ( anEvenInteger >> 1 ) ;
+}
+
+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);
+ endService( " SyrComponent_Impl::C_INCR" );
+ return ( aCount + 1 ) ;
+}
+
+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);
+ int min = aMinVal ;
+ if ( anInteger < min || aMinVal == 0 ) {
+ min = anInteger ;
+ }
+ string trace = "SyrComponent_Impl::C_MIN : " ;
+ char cmin[ 30 ] ;
+ sprintf( cmin , "%d" , min ) ;
+ trace += cmin ;
+ sendMessage(NOTIF_TRACE, trace.c_str() );
+ endService( " SyrComponent_Impl::C_MIN" );
+ return min ;
+}
+
+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);
+ int max = aMaxVal ;
+ if ( anInteger > max ) {
+ max = anInteger ;
+ }
+ string trace = "SyrComponent_Impl::C_MAX : " ;
+ char cmax[ 30 ] ;
+ sprintf( cmax , "%d" , max ) ;
+ trace += cmax ;
+ sendMessage(NOTIF_TRACE, trace.c_str() );
+ endService( " SyrComponent_Impl::C_MAX" );
+ return max ;
+}
+
+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);
+ ListOfSyr_Impl * aNewListOfSyr = new ListOfSyr_Impl( _orb , _poa, _contId,
+ instanceName() , interfaceName() ,
+ graphName() , nodeName() ) ;
+ SuperVisionTest::ListOfSyr_var iobject = (SuperVisionTest::ListOfSyr_var ) NULL ;
+ PortableServer::ObjectId * id = aNewListOfSyr->getId() ;
+ CORBA::Object_var obj = _poa->id_to_reference(*id);
+ iobject = SuperVisionTest::ListOfSyr::_narrow(obj) ;
+ endService( " SyrComponent_Impl::C_LISTOFSYR" );
+ return SuperVisionTest::ListOfSyr::_duplicate( iobject ) ;
+// return ( aNewListOfSyr._retn() ) ;
+}
+
+SuperVisionTest::ListOfSyr_ptr SyrComponent_Impl::C_AVERAGE(
+ const SuperVisionTest::ListOfSyr_ptr aListOfSyr ,
+ const long anInteger ,
+ const long aCount ,
+ double & anAverage ) {
+ 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);
+ SuperVisionTest::SeqOfSyr * aSeqOfSyr = aListOfSyr->GetSeqOfSyr() ;
+ int len = aSeqOfSyr->length() ;
+ aSeqOfSyr->length( len + 1 ) ;
+ (*aSeqOfSyr)[ len ] = anInteger ;
+ aListOfSyr->SetSeqOfSyr( *aSeqOfSyr ) ;
+ anAverage = 0 ;
+ int i ;
+ for ( i = 0 ; i < len + 1 ; i++ ) {
+ anAverage += (*aSeqOfSyr)[ i ] ;
+ }
+ anAverage = anAverage / ( len + 1 ) ;
+ string end = " SyrComponent_Impl::C_AVERAGE " ;
+ char caverage[ 30 ] ;
+ sprintf( caverage , "%fd" , anAverage ) ;
+ end += caverage ;
+ endService( end.c_str() );
+ return SuperVisionTest::ListOfSyr::_duplicate( aListOfSyr ) ;
+}
+
+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);
+ Syr_Impl * mySyr ;
+ mySyr = new Syr_Impl( _orb , _poa, _contId,
+ instanceName() , interfaceName() ,
+ graphName() , nodeName() , anOddInteger ) ;
+ SuperVisionTest::Syr_var iobject = (SuperVisionTest::Syr_var ) NULL ;
+ PortableServer::ObjectId * id = mySyr->getId() ;
+ CORBA::Object_var obj = _poa->id_to_reference(*id);
+ iobject = SuperVisionTest::Syr::_narrow(obj) ;
+ endService( "SyrComponent_Impl::Init" );
+ return SuperVisionTest::Syr::_duplicate(iobject) ;
+}
+
+ListOfSyr_Impl::ListOfSyr_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("ListOfSyr_Impl::ListOfSyr_Impl activate object instanceName("
+ << instanceName << ") interfaceName(" << interfaceName << ") --> "
+ << hex << (void *) this << dec )
+ beginService( "ListOfSyr_Impl::ListOfSyr_Impl" );
+ _thisObj = this ;
+ _id = _poa->activate_object(_thisObj);
+ sendMessage(NOTIF_STEP, "ListOfSyr_Impl is Created");
+ endService( "ListOfSyr_Impl::ListOfSyr_Impl" );
+}
+
+ListOfSyr_Impl::ListOfSyr_Impl() {
+}
+
+ListOfSyr_Impl::~ListOfSyr_Impl() {
+ beginService( "ListOfSyr_Impl::~ListOfSyr_Impl" );
+ endService( "ListOfSyr_Impl::~ListOfSyr_Impl" );
+}
+
+SuperVisionTest::SeqOfSyr * ListOfSyr_Impl::GetSeqOfSyr() {
+ SuperVisionTest::SeqOfSyr_var aSeqOfSyr = new SuperVisionTest::SeqOfSyr( _SeqOfSyr ) ;
+ return ( aSeqOfSyr._retn() ) ;
+}
+
+void ListOfSyr_Impl::SetSeqOfSyr( const SuperVisionTest::SeqOfSyr & aSeqOfSyr ) {
+ _SeqOfSyr = aSeqOfSyr ;
+ return ;
+}
+
+extern "C"
+{
+ PortableServer::ObjectId * SyrComponentEngine_factory
+ (CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
+ const char *interfaceName)
+ {
+ MESSAGE("SyrComponentEngine_factory SyrComponentEngine ("
+ << instanceName << "," << interfaceName << "," << getpid() << ")");
+ SyrComponent_Impl * mySyrComponent
+ = new SyrComponent_Impl(orb, poa, contId, instanceName, interfaceName);
+ return mySyrComponent->getId() ;
+ }
+}
+
+Syr_Impl::Syr_Impl( CORBA::ORB_ptr orb ,
+ PortableServer::POA_ptr poa ,
+ PortableServer::ObjectId * contId ,
+ const char * instanceName ,
+ const char * interfaceName ,
+ const char * graphName ,
+ const char * nodeName ,
+ const long anOddInteger ) :
+ SyrComponent_Impl(orb, poa, contId, instanceName, interfaceName,false) {
+ Names( graphName , nodeName ) ;
+ MESSAGE("Syr_Impl::Syr_Impl activate object instanceName("
+ << instanceName << ") interfaceName(" << interfaceName << ") --> "
+ << hex << (void *) this << dec )
+ beginService( "Syr_Impl::Syr_Impl" );
+ _thisObj = this ;
+ _id = _poa->activate_object(_thisObj);
+ _InitialInteger = anOddInteger ;
+ _CurrentInteger = anOddInteger ;
+ _Count = 0 ;
+ sendMessage(NOTIF_STEP, "Syr_Impl is Created");
+ endService( "Syr_Impl::Syr_Impl" );
+}
+
+Syr_Impl::Syr_Impl() {
+}
+
+Syr_Impl::~Syr_Impl() {
+ beginService( "Syr_Impl::~Syr_Impl" );
+ endService( "Syr_Impl::~Syr_Impl" );
+}
+
+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);
+ endService( " Syr_Impl::Initial" );
+ return _InitialInteger ;
+}
+
+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);
+ endService( " Syr_Impl::Current" );
+ return _CurrentInteger ;
+}
+
+long Syr_Impl::IsEven() {
+ bool RetVal ;
+ 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);
+ RetVal = ( _CurrentInteger & 1 ) == 0 ;
+ MESSAGE( " Syr_Impl::IsEven " << _CurrentInteger << " " << RetVal );
+ endService( " Syr_Impl::IsEven" );
+ return RetVal ;
+}
+
+long Syr_Impl::IsOne() {
+ bool RetVal ;
+ 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);
+ RetVal = ( _CurrentInteger == 1 ) ;
+ MESSAGE( " Syr_Impl::IsOne " << _CurrentInteger << " " << RetVal );
+ endService( " Syr_Impl::IsOne" );
+ return RetVal ;
+}
+
+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);
+ MESSAGE( " Syr_Impl::Count " << _Count );
+ endService( " Syr_Impl::Count" );
+ return _Count ;
+}
+
+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);
+ if ( IsEven() )
+ _CurrentInteger = 0 ;
+ else
+ _CurrentInteger = 3*_CurrentInteger + 1 ;
+ MESSAGE( " Syr_Impl::M3p1 " << _CurrentInteger );
+ endService( " Syr_Impl::M3p1" );
+}
+
+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);
+ if ( !IsEven() )
+ _CurrentInteger = 0 ;
+ else
+ _CurrentInteger = ( _CurrentInteger >> 1 ) ;
+ MESSAGE( " Syr_Impl::Div2 " << _CurrentInteger );
+ endService( " Syr_Impl::Div2" );
+}
+
+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);
+ _Count = _Count + 1 ;
+ MESSAGE( " Syr_Impl::Incr " << _Count );
+ endService( " Syr_Impl::Incr" );
+}
+
+
+