@COMMENCE@
-SUBDIRS = idl src
+SUBDIRS = idl src examples
RESOURCES_FILES = \
components.png \
--- /dev/null
+This file is only here for CVS:
+CVS does not always create empty directory, and adm_local/unix/config_file
+is needed by build_configure.
PYTHON_INCLUDES = @PYTHON_INCLUDES@
PYTHON_LIBS = @PYTHON_LIBS@
PYTHON_VERSION = @PYTHON_VERSION@
-PYTHON_SITE = @PYTHON_SITE@
-PYTHON_SITE_INSTALL = @PYTHON_SITE_INSTALL@
-
+PYTHON_SITE = $(prefix)/lib/python$(PYTHON_VERSION)/site-packages
+PYTHON_SITE_INSTALL = $(prefix)/lib/python$(PYTHON_VERSION)/site-packages/salome
# QT
QT_ROOT = @QT_ROOT@
OCC_INCLUDES=@CAS_CPPFLAGS@
OCC_CXXFLAGS=@CAS_CXXFLAGS@
-OCC_KERNEL_LIBS=@CAS_KERNEL@
-OCC_OCAF_LIBS=@CAS_OCAF@
-OCC_VIEWER_LIBS=@CAS_VIEWER@
-OCC_MODELER_LIBS=@CAS_MODELER@
-OCC_DATAEXCHANGE_LIBS=@CAS_DATAEXCHANGE@
-OCC_LIBS=@CAS_LDFLAGS@
-
+#OCC_KERNEL_LIBS=@CAS_KERNEL@
+#OCC_OCAF_LIBS=@CAS_OCAF@
+#OCC_VIEWER_LIBS=@CAS_VIEWER@
+#OCC_MODELER_LIBS=@CAS_MODELER@
+#OCC_DATAEXCHANGE_LIBS=@CAS_DATAEXCHANGE@
+#OCC_LIBS=@CAS_LDFLAGS@
+CAS_KERNEL=@CAS_KERNEL@
+CAS_OCAF=@CAS_OCAF@
+CAS_VIEWER=@CAS_VIEWER@
+CAS_MODELER=@CAS_MODELER@
+CAS_DATAEXCHANGE=@CAS_DATAEXCHANGE@
+CAS_LDPATH=@CAS_LDPATH@
# MPICH
MPICH_INCLUDES=@MPICH_INCLUDES@
#LDFLAGS+= $(CORBA_LIBS)
LIBS+=$(CORBA_LIBS)
+DOXYGEN = @DOXYGEN@
+
## Shared libraries
LT_STATIC_EXEC=@LT_STATIC_EXEC@
DYNAMIC_DIRS=@DYNAMIC_DIRS@
# warning : if user give this path in configure we could have salome/salome :-(
includedir=@includedir@/salome
datadir=@datadir@/salome
-idldir=$(prefix)/idl/salome
+idldir=${prefix}/idl/salome
sharedpydir=@libdir@/python$(PYTHON_VERSION)/site-packages/salome/shared_modules
+incmakedir=${prefix}/salome_adm/unix
docdir=$(datadir)/doc
# begin of package rules
#
-.PHONY: all lib bin inc resources tests install uninstall dep depend depend_idl cleandep mostlyclean clean distclean
+.PHONY: all lib bin inc resources data doc tests install uninstall dep depend depend_idl cleandep mostlyclean clean distclean
.SUFFIXES: .cxx .cc .c .f .o .lo .idl .py .i .ui .po .qm
$(MAKE) lib
$(MAKE) bin
$(MAKE) resources
+ $(MAKE) data
#
# add target to build administrative files
<td bgcolor= "lightgreen"><div align="center"><b>long Y ( )</b></div></td>
<td bgcolor= "lightgreen"><div align="center"><b>return_value = Y ( )</b></div></td>
</tr>
+<tr>
+<td bgcolor= "lightgreen"><div align="center"><b>long CpuUsed ( )</b></div></td>
+<td bgcolor= "lightgreen"><div align="center"><b>return_value = CpuUsed ( )</b></div></td>
+</tr>
</table><br>
<table width="100%" BORDER>
<tr bgcolor="#FFFFCC">
#---------------------------------------------------------------------------
# General configuration options
#---------------------------------------------------------------------------
-PROJECT_NAME = "SALOME PRO - SUPERV - v.1.2"
+PROJECT_NAME = "SALOME - SUPERV - v.1.2"
PROJECT_NUMBER = id#1.0
OUTPUT_DIRECTORY = ../
OUTPUT_LANGUAGE = English
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
-BINARY_TOC = NO
-TOC_EXPAND = NO
-DISABLE_INDEX = NO
+BINARY_TOC = YES
+TOC_EXPAND = YES
+DISABLE_INDEX = YES
ENUM_VALUES_PER_LINE = 4
-GENERATE_TREEVIEW = NO
+GENERATE_TREEVIEW = YES
TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
--- /dev/null
+H1 { text-align: center; }
+CAPTION { font-weight: bold }
+A.qindex {}
+A.qindexRef {}
+A.el { text-decoration: none; font-weight: bold }
+A.elRef { font-weight: bold }
+A.code { text-decoration: none; font-weight: normal; color: #4444ee }
+A.codeRef { font-weight: normal; color: #4444ee }
+A:hover { text-decoration: none; background-color: lightblue }
+DL.el { margin-left: -1cm }
+DIV.fragment { width: 100%; border: none; background-color: #CCCCCC }
+DIV.ah { background-color: #CCCCCC; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px }
+TD.md { background-color: lightblue; font-weight: bold; }
+TD.mdname1 { background-color: lightblue; font-weight: bold; color: #602020; }
+TD.mdname { background-color: lightblue; font-weight: bold; color: #602020; width: 600px; }
+DIV.groupHeader { margin-left: 16px; margin-top: 12px; margin-bottom: 6px; font-weight: bold }
+DIV.groupText { margin-left: 16px; font-style: italic; font-size: smaller }
+BODY { background: url(sources/bg_salome.gif) }
+TD.indexkey {
+ background-color: #CCCCCC;
+ font-weight: bold;
+ padding-right : 10px;
+ padding-top : 2px;
+ padding-left : 10px;
+ padding-bottom : 2px;
+ margin-left : 0px;
+ margin-right : 0px;
+ margin-top : 2px;
+ margin-bottom : 2px
+}
+TD.indexvalue {
+ background-color: #CCCCCC;
+ font-style: italic;
+ padding-right : 10px;
+ padding-top : 2px;
+ padding-left : 10px;
+ padding-bottom : 2px;
+ margin-left : 0px;
+ margin-right : 0px;
+ margin-top : 2px;
+ margin-bottom : 2px
+}
+span.keyword { color: #008000 }
+span.keywordtype { color: #604020 }
+span.keywordflow { color: #e08000 }
+span.comment { color: #800000 }
+span.preprocessor { color: #806020 }
+span.stringliteral { color: #002080 }
+span.charliteral { color: #008080 }
--- /dev/null
+<!DOCTYPE doctype PUBLIC "-//w3c//dtd html 4.0 transitional//en">\r
+<html>\r
+<head>\r
+ \r
+ <meta http-equiv="Content-Type"\r
+ content="text/html; charset=iso-8859-1">\r
+ \r
+ <meta name="GENERATOR"\r
+ content="Mozilla/4.73 [en] (WinNT; I) [Netscape]">\r
+ <title>Main Page</title>\r
+ \r
+ <link href="doxygen.css" rel="stylesheet" type="text/css">\r
+</head>\r
+ <body>\r
+ \r
+<center>\r
+<table width="96%">\r
+ <tbody>\r
+ <tr>\r
+ <td><a href="http://www.opencascade.com"><img\r
+ src="sources/logocorp.gif" border="0" height="46" width="122">\r
+ </a></td>\r
+ <td> \r
+ <div align="right"><a href="http://www.opencascade.org/SALOME/"><img\r
+ src="sources/application.gif" border="0" height="46" width="108">\r
+ </a></div>\r
+ </td>\r
+ </tr>\r
+ \r
+ </tbody>\r
+</table>\r
+</center>\r
+ \r
+<h1><a name="page2">Examples</a> </h1>\r
+ \r
+<h3><big><i><b>Interfaces:</b></i></big></h3>\r
+<br>\r
+<a href="#Graph"><big>SUPERV::Graph</big></a><br>\r
+<a href="#CNode"><big>SUPERV::CNode</big></a><br>\r
+<a href="#FNode"><big>SUPERV::FNode</big></a><big><br>\r
+<a href="#INode">SUPERV::INode</a></big><br>\r
+<a href="#LNode"><big>SUPERV::LNode</big></a><br>\r
+<a href="#Port"><big>SUPERV::Port</big></a><br>\r
+<a href="#Link"><big>SUPERV::Link</big></a><br>\r
+<b><br>\r
+<br>\r
+<br>\r
+</b><br>\r
+<div align="center"><big><big><b><u><br>\r
+</u></b></big></big></div>\r
+<div align="center"><big><u><b><big><a name="Graph"></a>SUPERV::Graph<br>\r
+</big></b></u></big><br>\r
+<div align="left"><big><b><a href="#CNode">CNode</a> CNode( in SALOME_ModuleCatalog::Service\r
+<i>aService</i> ) </b></big><br>\r
+<br>\r
+<u><i><big>Create a Computing Node in a Graph</big></i></u><br>\r
+<br>\r
+<a name="CreateCNode"></a>GraphEssai = Graph( 'GraphEssai' )<br>\r
+<br>\r
+AddAndCompare_ServiceinParameter = []<br>\r
+AddAndCompare_ServiceinParameter.append( SALOME_ModuleCatalog.ServicesParameter(\r
+'Adder' , 'Adder' ) )<br>\r
+AddAndCompare_ServiceinParameter.append( SALOME_ModuleCatalog.ServicesParameter(\r
+'double' , 'x' ) )<br>\r
+AddAndCompare_ServiceinParameter.append( SALOME_ModuleCatalog.ServicesParameter(\r
+'double' , 'y' ) )<br>\r
+AddAndCompare_ServiceinParameter.append( SALOME_ModuleCatalog.ServicesParameter(\r
+'Adder' , 'anOtherAdder' ) )<br>\r
+<br>\r
+AddAndCompare_ServiceoutParameter = []<br>\r
+AddAndCompare_ServiceoutParameter.append( SALOME_ModuleCatalog.ServicesParameter(\r
+'double' , 'FuncValue' ) )<br>\r
+AddAndCompare_ServiceoutParameter.append( SALOME_ModuleCatalog.ServicesParameter(\r
+'double' , 'z' ) )<br>\r
+AddAndCompare_Service = SALOME_ModuleCatalog.Service( 'AddAndCompare' , AddAndCompare_ServiceinParameter\r
+, AddAndCompare_ServiceoutParameter , 0 )<br>\r
+<br>\r
+AddAndCompare = GraphEssai.CNode( AddAndCompare_Service )<br>\r
+<br>\r
+<br>\r
+<br>\r
+</div>\r
+<div align="left"><big><b><a href="#FNode">FNode</a> FNode( in string <i>aComponentName</i>, \r
+in string <i>anInterfaceName</i>, in SALOME_ModuleCatalog::Service\r
+<i>aService</i> ) </b></big><br>\r
+<br>\r
+<u><i><big>Create a Factory Node in a Graph</big></i></u><br>\r
+<br>\r
+<a name="CreateFNode"></a>GraphEssai = Graph( 'GraphEssai' )<br>\r
+Add = GraphEssai.FNode( 'AddComponent' , 'AddComponent' , 'Add' )<br>\r
+<br>\r
+<br>\r
+<br>\r
+<b><big>INode INode( in string <i>FuncName</i>, in ListOfStrings <i>aPythonFunction</i>\r
+)</big></b><br>\r
+<br>\r
+<u><i><big>Create an InLine Node in a Graph</big></i></u><br>\r
+<br>\r
+<a name="CreateINode"></a>GraphEssai = Graph( 'GraphEssai' )<br>\r
+PyAdd = []<br>\r
+PyAdd.append( 'from time import * ' )<br>\r
+PyAdd.append( 'def Add(a,b) : \r
+' )<br>\r
+PyAdd.append( ' print "Add will wait 5 seconds" \r
+' )<br>\r
+PyAdd.append( ' d = dir() \r
+' )<br>\r
+PyAdd.append( ' print "Add",d \r
+' )<br>\r
+PyAdd.append( ' d = dir(sleep) \r
+' )<br>\r
+PyAdd.append( ' print "Add",d \r
+' )<br>\r
+PyAdd.append( ' sleep(5) \r
+' )<br>\r
+PyAdd.append( ' print "Add waited" \r
+' )<br>\r
+PyAdd.append( ' n = 0 ' )<br>\r
+PyAdd.append( ' while n < 10000 : \r
+' )<br>\r
+PyAdd.append( ' i = 0 \r
+' )<br>\r
+PyAdd.append( ' s = 0 \r
+' )<br>\r
+PyAdd.append( ' while i <= b\r
+: ' )<br>\r
+PyAdd.append( ' \r
+s = s + i ' )<br>\r
+PyAdd.append( ' \r
+i = i + 1 ' )<br>\r
+PyAdd.append( ' n = n + 1 \r
+' )<br>\r
+PyAdd.append( ' return s \r
+' )<br>\r
+PyAdd.append( '' )<br>\r
+Add = GraphEssai.INode( 'Add' , PyAdd )<br>\r
+<br>\r
+<br>\r
+<br>\r
+<b><big>GNode GNode( in string <i>FuncName</i> , in ListOfStrings <i>aPythonFunction</i>,\r
+in string <i>anINode</i> )</big></b><br>\r
+<br>\r
+<u><i><big>Create a GOTO node and link to the corresponding InLine node</big></i></u><br>\r
+<br>\r
+GraphEssai = Graph( 'GraphEssai' )<br>\r
+Pylabel_test = []<br>\r
+Pylabel_test.append( 'def label_test( ValEven , ValOne , NB , KB ):' )<br>\r
+Pylabel_test.append( ' print "label_begin",ValEven,ValOne,NB,KB'\r
+)<br>\r
+Pylabel_test.append( ' return ValEven,ValOne,NB,KB' )<br>\r
+label_test = GraphEssai.INode( 'label_test' , Pylabel_test )<br>\r
+Pycontrol = []<br>\r
+Pycontrol.append( 'def control_m3p1( N , K ):' )<br>\r
+Pycontrol.append( ' return 0,1,N,K' )<br>\r
+control = GraphEssai.GNode( 'control_m3p1' , Pycontrol , 'label_test' )<br>\r
+<br>\r
+<br>\r
+<br>\r
+<big><b>LNode LNode( in string <i>InitName</i> , in ListOfStrings <i>InitFunction</i>\r
+, in string <i>MoreName</i> , in ListOfStrings <i>MoreFunction</i> , in string\r
+<i>NextName</i> , in ListOfStrings <i>NextFunction</i> , out INode <i>anEndOfLoop</i>\r
+)</b></big><br>\r
+<br>\r
+<u><i><big>Create a "for" or "while" node and the corresponding end of loop\r
+node</big></i></u><br>\r
+<br>\r
+<a name="CreateLNode"></a>GraphEssai = Graph( 'GraphEssai' )<br>\r
+<br>\r
+PyforN = []<br>\r
+PyforN.append( 'def InitN( NN , K , SyrComponent , min , max ) :' )<br>\r
+PyforN.append( ' N = max' )<br>\r
+PyforN.append( ' if min > 0 :' )<br>\r
+PyforN.append( ' if max >= min\r
+:' )<br>\r
+PyforN.append( ' \r
+N = min' )<br>\r
+PyforN.append( ' return N,K,SyrComponent,min,max' )<br>\r
+<br>\r
+PyMoreforN = []<br>\r
+PyMoreforN.append( 'def MoreN( NN , KK , SyrComponent , min , max ) :' )<br>\r
+PyMoreforN.append( ' N = 0' )<br>\r
+PyMoreforN.append( ' OutLoop = 0' )<br>\r
+PyMoreforN.append( ' if max > NN :' )<br>\r
+PyMoreforN.append( ' N = NN' )<br>\r
+PyMoreforN.append( ' OutLoop =\r
+1' )<br>\r
+PyMoreforN.append( ' return OutLoop,N,0,SyrComponent,min,max'\r
+)<br>\r
+<br>\r
+PyNextforN = []<br>\r
+PyNextforN.append( 'def NextN( NN , KK , SyrComponent , min , max ) :' )<br>\r
+PyNextforN.append( ' N = NN + 1' )<br>\r
+PyNextforN.append( ' K = KK' )<br>\r
+PyNextforN.append( ' return N,K,SyrComponent,min,max' )<br>\r
+<br>\r
+forN,endforN = GraphEssai.LNode( 'InitN' , PyforN , 'MoreN' , PyMoreforN\r
+, 'NextN' , PyNextforN )<br>\r
+<br>\r
+<br>\r
+<b><big>SNode SNode( in string <i>FuncName,</i> in ListOfStrings <i>aPythonFunction,</i>\r
+out INode <i>anEndOfSwitch</i> )</big></b><br>\r
+<br>\r
+<u><i><big>Create a "if / elseif / else" or "switch" node and the corresponding\r
+end node</big></i></u><br>\r
+<br>\r
+GraphEssai = Graph( 'GraphEssai' )<br>\r
+ <br>\r
+PyifNotEven = []<br>\r
+PyifNotEven.append( 'import SyrComponent_idl' )<br>\r
+PyifNotEven.append( 'def ifNotEven( SyrComponent , N , K ) :' )<br>\r
+PyifNotEven.append( ' Even = SyrComponent.C_ISEVEN( N )'\r
+)<br>\r
+PyifNotEven.append( ' Odd = 1 - Even' )<br>\r
+PyifNotEven.append( ' return Odd,Even,SyrComponent,N,K'\r
+)<br>\r
+<br>\r
+ifNotEven,endifNotEven = GraphEssai.SNode( 'ifNotEven' , PyifNotEven )<br>\r
+<br>\r
+<br>\r
+<big><b>Link Link( in Port <i>OutputPort</i> , in Port <i>InputPort</i>\r
+)</b></big><br>\r
+<br>\r
+<u><i><big>Creates a link connecting two ports of the nodes in a Graph</big></i></u><br>\r
+<br>\r
+GraphEssai = Graph( 'GraphEssai' )<br>\r
+Add = GraphEssai.FNode( 'AddComponent' , 'AddComponent' , 'Add' )<br>\r
+Mul = GraphEssai.FNode( 'MulComponent' , 'MulComponent' , 'Mul' )<br>\r
+Link = GraphEssai.Link( Add.Port( 'FuncValue' ), Mul.Port( 'x' ) )<br>\r
+<br>\r
+<br>\r
+<b><big>boolean Run()</big></b><br>\r
+<br>\r
+<u><i><big>Starts asynchronous execution of the graph</big></i></u><br>\r
+<br>\r
+...<br>\r
+GraphEssai.Run()<br>\r
+<br>\r
+<br>\r
+<b><big>boolean Event( out CNode <i>aNode</i> , out GraphEvent <i>anEvent</i>\r
+, out GraphState <i>aState</i> )</big></b><br>\r
+<br>\r
+<u><i><big>Runs Graph and prints information about Graph performance</big></i></u><br>\r
+<br>\r
+...<br>\r
+<a name="RunandWait"></a>GraphEssai.Run()<br>\r
+aStatus,aNode,anEvent,aState = GraphEssai.Event()<br>\r
+while aStatus :<br>\r
+ print aNode.Thread(),aNode.SubGraph(),aNode.Name(),anEvent,aState<br>\r
+ aStatus,aNode,anEvent,aState = GraphEssai.Event()<br>\r
+<br>\r
+<br>\r
+<br>\r
+<br>\r
+<div align="center"><big><b><big><a name="CNode"></a>SUPERV::CNode</big></b></big><br>\r
+</div>\r
+<br>\r
+<big><b>string Name() <br>\r
+string Author()<br>\r
+string Comment()<br>\r
+boolean SetName(in string <i>aNewName</i> ) <br>\r
+boolean SetAuthor(in string <i>anAuthor</i> ) <br>\r
+boolean SetComment(in string <i>aComment</i> ) <br>\r
+<br>\r
+</b><u><i>Get / Set methods for Name, Author and Comment strings of the node.</i></u><br>\r
+<b><br>\r
+</b><a href="#CreateCNode"><small>#Create CNode</small></a><b><br>\r
+</b></big>AddAndCompare.SetName( 'AddAndCompare' )<br>\r
+AddAndCompare.SetAuthor( 'NoBody' )<br>\r
+AddAndCompare.SetComment( 'Python function' )<br>\r
+print "Name:", AddAndCompare.Name(), " Author:", AddAndCompare.Author(),\r
+" Comment:", AddAndCompare.Comment()<br>\r
+<br>\r
+<br>\r
+<br>\r
+<big><b>Port Port( in string <i>aParameterName</i> )</b></big><br>\r
+<br>\r
+<big><u><i>Returns Port instance from created node</i></u></big><br>\r
+<br>\r
+<a href="#CreateFNode">#Create FNode</a><br>\r
+Addz = Add.Port('z')<br>\r
+<br>\r
+<br>\r
+<big><b>Port Input( in string <i>InputParameterName</i> , in Value\r
+<i>aValue</i> ) </b></big><br>\r
+<br>\r
+<i><u><big>Sets value into Port by its name and returs correspondent port\r
+instance</big></u></i><br>\r
+<br>\r
+<a href="#CreateFNode">#Create FNode</a><br>\r
+Addx = Add.Input("x",3.)<br>\r
+<br>\r
+<br>\r
+<br>\r
+<b><big>void Coords( in long <i>X</i> , in long <i>Y</i> )<br>\r
+</big><big>long X()</big></b><br>\r
+<b><big>long Y()</big></b><br>\r
+<br>\r
+<big><u><i>Methods to sets position of the node and getting current coordinates</i></u></big><br>\r
+<br>\r
+<a\r
+ href="file:///vsv/salome/build/doc/html/html/examples_SUPERV.html#CreateFNode">#Create\r
+FNode</a><br>\r
+Add.Coords( 1 , 152 )<br>\r
+print "X=", Add.X(), " Y=", Add.Y()<br>\r
+<br>\r
+<br>\r
+<b><big>long CpuUsed()</big></b><br>\r
+<br>\r
+<u><i><big>Returns the Cpu used by a node in seconds</big></i></u><br>\r
+<br>\r
+<a href="#RunandWait">#Run Graph and wait for its finish</a><br>\r
+print "CPU used: ", Add.CpuUsed(), " sec"<br>\r
+<br>\r
+<br>\r
+<br>\r
+<br>\r
+<br>\r
+<div align="center"><big><b><big><a name="FNode"></a>SUPERV::FNode</big><br>\r
+</b></big></div>\r
+<br>\r
+<b><big>string GetContainer() <br>\r
+boolean SetContainer(in string <i>aContainer</i> ) <br>\r
+</big></b><br>\r
+<big><u><i>Get / Set method for container name</i></u></big><br>\r
+<br>\r
+<a\r
+ href="file:///vsv/salome/build/doc/html/html/examples_SUPERV.html#CreateFNode">#Create\r
+FNode</a><br>\r
+Add.SetContainer( 'localhost/FactoryServer' )<br>\r
+print "Container: ", Add.GetContainer()<br>\r
+<br>\r
+<br>\r
+<br>\r
+<div align="center"><big><b><big><a name="INode"></a>SUPERV::INode</big></b></big><br>\r
+</div>\r
+<br>\r
+<br>\r
+<big><b>void SetPyFunction( in string <i>FuncName</i> , in ListOfStrings\r
+<i>aPyInitFunction</i> )</b></big><br>\r
+<br>\r
+<u><i><big>Replaces Python function of inline node by new one</big></i></u><br>\r
+<br>\r
+<a href="#CreateINode">#Create INode</a><br>\r
+PyIsOdd = []<br>\r
+PyIsOdd.append( 'def IsOdd(a) : ' )<br>\r
+PyIsOdd.append( ' print a,"IsOdd" ' )<br>\r
+PyIsOdd.append( ' return a ' )<br>\r
+Add.SetPyFunction("IsOdd", PyIsOdd)<br>\r
+<br>\r
+<br>\r
+<b><big>string PyFuncName()</big></b><br>\r
+<br>\r
+<div align="left"><u><i><big>Returns Name of the Python function</big></i></u><br>\r
+<br>\r
+<a\r
+ href="file:///vsv/salome/build/doc/html/html/examples_SUPERV.html#CreateINode">#Create\r
+INode</a><br>\r
+print "Name:", Add.PyFuncName()<br>\r
+<br>\r
+<br>\r
+ </div>\r
+ <b><big>ListOfStrings PyFunction()<br>\r
+<br>\r
+</big></b><u><i><big>Returns Python function as a list of strings</big></i></u><br>\r
+<br>\r
+<a\r
+ href="file:///vsv/salome/build/doc/html/html/examples_SUPERV.html#CreateINode">#Create\r
+INode</a><br>\r
+PyFunc = Add.PyFunction()<br>\r
+<br>\r
+<br>\r
+<b><big>SUPERV::Port InPort( in string <i>aParameterName</i> , in string\r
+<i>aParameterType</i> ) <br>\r
+SUPERV::Port OutPort( in string <i>aParameterName</i> , in string <i>aParameterType</i>\r
+) <br>\r
+</big></b><br>\r
+<u><i><big>Creation of In and Out ports of Inline Node</big></i></u><br>\r
+<br>\r
+<a name="CreatePorts"></a><a\r
+ href="file:///vsv/salome/build/doc/html/html/examples_SUPERV.html#CreateINode">#Create\r
+INode</a><br>\r
+Add.InPort('a', 'long')<br>\r
+<div align="left">Add.InPort('b', 'long')<br>\r
+ \r
+<div align="left">Add.OutPort('s', 'long')<br>\r
+ <br>\r
+ </div>\r
+ <br>\r
+ </div>\r
+ <br>\r
+<div align="center"><big><b><big><a name="LNode"></a>SUPERV::LNode</big></b></big><br>\r
+</div>\r
+<br>\r
+<br>\r
+<b><big>void SetPyInit( in string <i>InitName</i> , in ListOfStrings\r
+<i>aPyInitFunction</i> )</big></b><br>\r
+<b><big>void SetPyMore( in string <i>MoreName</i> , in ListOfStrings\r
+<i>aPyMoreFunction</i> )<br>\r
+void SetPyNext( in string <i>NextName</i> , in ListOfStrings <i>aPyNextFunction</i>\r
+)<br>\r
+</big></b><br>\r
+<i><u><big>Sets (replaces) Python fonction of according clause (Init, More,\r
+Next) in Loop Node</big></u></i><br>\r
+<br>\r
+<a href="#CreateLNode">#Create Loop Node</a><br>\r
+Pyfori = []<br>\r
+Pyfori.append( 'def Initfori( ii , K ) :' )<br>\r
+Pyfori.append( ' return 1,0,K' )<br>\r
+PyMorefori = []<br>\r
+PyMorefori.append( 'def Morefori( ii , K ) :' )<br>\r
+PyMorefori.append( ' OutLoop = 0' )<br>\r
+PyMorefori.append( ' if 2 > ii :' )<br>\r
+PyMorefori.append( ' OutLoop =\r
+1' )<br>\r
+PyMorefori.append( ' return OutLoop,ii,K' )<br>\r
+PyNextfori = []<br>\r
+PyNextfori.append( 'def Nextfori( ii , K ) :' )<br>\r
+PyNextfori.append( ' ii = ii + 1' )<br>\r
+PyNextfori.append( ' return ii,K' )<br>\r
+forN.SetPyInit('Initfori', Pyfori)<br>\r
+<div align="left">forN.SetPyMore('Morefori', PyMorefori)<br>\r
+ \r
+<div align="left">forN.SetPyNext('Nextfori', PyNextfori)<br>\r
+ <br>\r
+<br>\r
+<br>\r
+<b><big>string PyInitName() <br>\r
+</big></b></div>\r
+<b><big>string PyMoreName()<br>\r
+string PyNextName()<br>\r
+</big></b> </div>\r
+ <b><big><br>\r
+</big></b><u><i><big>Returns Python function name of according clause</big></i></u><br>\r
+<br>\r
+<a\r
+ href="file:///vsv/salome/build/doc/html/html/examples_SUPERV.html#CreateLNode">#Create\r
+Loop Node</a><br>\r
+print "Init Name:", forN.PyInitName()<br>\r
+print "More Name:", forN.PyMoreName()<br>\r
+print "Next Name:", forN.PyNextName()<br>\r
+<br>\r
+<br>\r
+<b><big>ListOfStrings PyInit()<br>\r
+ListOfStrings PyMore()<br>\r
+ListOfStrings PyNext()<br>\r
+</big></b><br>\r
+<u><i><big>Returns Python function as a list of strings</big></i><i><big>\r
+from according clause</big></i></u><br>\r
+<br>\r
+<a\r
+ href="file:///vsv/salome/build/doc/html/html/examples_SUPERV.html#CreateLNode">#Create\r
+Loop Node</a><br>\r
+InitFunc = forN.PyInit()<br>\r
+<div align="left">MoreFunc = forN.PyMoret()<br>\r
+ \r
+<div align="left">NextFunc = forN.PyNext()<br>\r
+ <br>\r
+ <br>\r
+ </div>\r
+ <br>\r
+ \r
+<div align="center"><big><b><big><a name="Port"></a>SUPERV::Port</big></b></big><br>\r
+</div>\r
+<br>\r
+<b><big>boolean Input( in Value <i>aValue</i> )</big></b><br>\r
+<br>\r
+<u><i><big>Sets value to the input port instance</big></i></u><br>\r
+<br>\r
+<a href="#CreatePorts">#CreatePorts</a><br>\r
+aPort = Add.Port('a')<br>\r
+aPort.Input(10)<br>\r
+<br>\r
+<br>\r
+<b><big>CNode Node()</big></b><br>\r
+<br>\r
+<u><i><big>Returns Node - owner of the port</big></i></u><br>\r
+<br>\r
+Add = aPort.Node()<br>\r
+<br>\r
+<br>\r
+<b><big>string Name()</big></b><br>\r
+<br>\r
+<u><i><big>Returns Name of the Port</big></i></u><br>\r
+<br>\r
+print "Port Name:", aPort.Name()<br>\r
+<br>\r
+<br>\r
+<br>\r
+ \r
+ </div>\r
+</div>\r
+ </div>\r
+</div>\r
+</body>\r
+</html>\r
--- /dev/null
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">\r
+<html>\r
+<head>\r
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">\r
+ <meta name="GENERATOR" content="Mozilla/4.73 [en] (WinNT; I) [Netscape]">\r
+ <title>Main Page</title>\r
+<link href="doxygen.css" rel="stylesheet" type="text/css">\r
+</head>\r
+<body>\r
+ \r
+<center>\r
+ <table WIDTH="96%" >\r
+ <tr> \r
+ <td><a href="http://www.opencascade.com"><img src="sources/logocorp.gif" BORDER=0 height=46 width=122></a></td>\r
+ <td> \r
+ <div align=right><a href="http://www.opencascade.org/SALOME/"><img src="sources/application.gif" BORDER=0 height=46 width=108></a></div>\r
+ </td>\r
+ </tr>\r
+ </table>\r
+</center>\r
+<h1><a name="page2">General overview</a> </h1>\r
+<a name="cont"></a><h2>Table of contents </h2>\r
+<b><i>\r
+<ul>\r
+ <li><a href="#1">1. Introduction</a></li>\r
+ <li><a href="#2">2. Definitions </a></li>\r
+ <ul>\r
+ <li><a href="#2_1">2.1 Computing scheme of type DataFlow</a></li>\r
+ <li><a href="#2_2">2.2 Types of nodes </a></li>\r
+ <ul>\r
+ <li><a href="#2_2_1">2.2.1 Computation node </a></li>\r
+ <li><a href="#2_2_2">2.2.2 Loop node </a></li>\r
+ <li><a href="#2_2_3">2.2.3 Switch node </a></li>\r
+ <li><a href="#2_2_4">2.2.4 GOTO node </a></li>\r
+ </ul>\r
+ </ul>\r
+ <li><a href="#3">3. Services and features of the SUPERVISION component</a></li>\r
+ <ul>\r
+ <li><a href="#3_1">3.1 CNode class</a></li>\r
+ <li><a href="#3_2">3.2 FNode class </a></li>\r
+ <li><a href="#3_3">3.3 INode class </a></li>\r
+ <li><a href="#3_4">3.4 GNode class </a></li>\r
+ <li><a href="#3_5">3.5 LNode class </a></li>\r
+ <li><a href="#3_6">3.6 ELNode class </a></li>\r
+ <li><a href="#3_7">3.7 SNode class </a></li>\r
+ <li><a href="#3_8">3.8 ESNode class </a></li>\r
+ <li><a href="#3_9">3.9 Graph class </a></li>\r
+ <li><a href="#3_10">3.10 Link class </a></li>\r
+ <li><a href="#3_11">3.11 Value class </a></li>\r
+ <li><a href="#3_12">3.12 Port class </a></li>\r
+ <li><a href="#3_13">3.13 SuperG class </a></li>\r
+ </ul>\r
+</ul>\r
+</i> </b> <br>\r
+<a name="1"></a><h2>1. Introduction </h2>\r
+<p>The Supervision module of the SALOME platform allows to define and execute \r
+ a chain of distributed numeric components, as well as to control the progress \r
+ of this chain. The various calculations to be chained and the exchanged data \r
+ are specified in a computing scheme, which can be of two types : </p>\r
+<ul>\r
+ <li>Data flow computing schemes. <br>\r
+ These schemes are represented by graphs without loops, conditional branches \r
+ or any operation of control. The execution of theses schemes can be automatically \r
+ optimized by the supervision engine by detecting and executing simultaneously \r
+ independant branches and by managing in a optimal way the life cycle of components.</li>\r
+ <br>\r
+ <br>\r
+ <li>Script type computing schemes.<br>\r
+ These schemes allow to define chainings or complex couplings of components \r
+ using loops, conditional execution and control flow breaks by leaning on a \r
+ scripting language (parametric studies, multi-physical coupling). Contrary \r
+ in data flows, the specification of these schemes must define the sequence \r
+ of execution of components. Notably, the simultaneous execution of components \r
+ should be explicitly defined.</li>\r
+</ul>\r
+<p>Of simple conception, the data flow schemes can be built in a graphic way and \r
+ validated automatically by the supervision engine.</p>\r
+<p>The script type computing schemes, which offer the possibility of building \r
+ complex chains, should be conceived by warned users (developers) who master \r
+ the syntax and the use of the scripting language.</p>\r
+<p>Once specified and validated, certain computing schemes defined by scripts \r
+ can be made customizable (input and output data, parameter sets) and integrated \r
+ into the platform to form components. These components can be used to build \r
+ schemes of higher level. </p>\r
+<p>Besides the definition of computing schemes, the Supervision module must also \r
+ take care of their execution and follow-up (complete execution or step by step) \r
+ : </p>\r
+<ul>\r
+ <li> Asking of instanciation of the components (kernel calls) and data (data \r
+ servers calls),</li>\r
+ <li>Launching computations specified in the computing scheme, </li>\r
+ <li>Managing the events emitted or received by the supervision engine and the \r
+ component,</li>\r
+ <li> Recovering the results of computations and demand of filing for the data \r
+ service. </li>\r
+</ul>\r
+<p>The user can visualize the progress of the scheme and the exchanged data, be \r
+ informed about the evolution of the execution of a component (errors, warning, \r
+ tracks, ...), to intervene by stopping, pausing or by resuming the execution \r
+ of the scheme or a particular component. </p>\r
+ <i><a href="#cont">Back to the contents</a></i>\r
+<a name="2"></a><h2>2. Defintions </h2>\r
+<a name="2_1"></a><h3>2.1 Computing scheme of type DataFlow</h3>\r
+<p>The computing schemes of type dataflow, feasible by the Supervision module, \r
+ are directed acyclic graphs, described by a set of nodes and of directed links. \r
+ A node represents a service of an instance of a computation component.</p>\r
+<p>A node is provided with input port(s) and/or output port(s). The input port(s) \r
+ (resp. output port(s)) represent the input argument(s) (resp. output argument(s)) \r
+ of the service. Certain services can possibly require the use of parameters \r
+ which will be grouped together in configuration files (defined in the Data/Properties \r
+ module, and recorded in the study).</p>\r
+<p>The computing schemes of type data flow do not contain either loops, conditional \r
+ branches or any operation of control. They can thus be built easily in a graphic \r
+ way, by connecting output ports to input ports of nodes. Although the graphic \r
+ construction is the simplest way, these computing schemes can also be defined \r
+ in the language of script.</p>\r
+<p>A node represents a service (function, method) of an instance of a component. \r
+ If the component possesses a unique service (\93Run\94 method), one will omit the \r
+ term \93service of\94. Various services of the same component can be used in various \r
+ nodes of the graph, or the same service can be used several times.</p>\r
+<a name="2_2"></a><h3>2.2 Types of nodes </h3>\r
+<p>In the SUPERVISION module there are the following types of nodes: </p>\r
+<b>\r
+<ul>\r
+ <li>computation node,</li>\r
+ <li> loop node,</li>\r
+ <li> switch node,</li>\r
+ <li> GOTO node. </li>\r
+</ul>\r
+</b> \r
+<p>The dependance between different types of nodes is shown on the following picture: \r
+</p>\r
+<div align="center"><img src="nodestypes.jpg"> </div>\r
+<a name="2_2_1"></a><h4>2.2.1 Computation node </h4>\r
+<p>This node represents a computation algorithm in the graph structure. Nodes \r
+ of such type can present a service registered in the Component Catalog (<b>Factory \r
+ Node</b>) or an external service defined in Python script by user (<b>InLine node</b>). \r
+ Python function of InLine node can be edited in Supervision Graph edit mode. \r
+</p>\r
+<a name="2_2_2"></a><h4><b>2.2.2 Loop node</b> </h4>\r
+<p>Loop node is a kind of Control nodes. In fact two nodes represent Loop: \r
+<b>start</b> loop and <b>end</b> loop nodes. Nodes of such type are always InLine nodes. \r
+User have to supply this type of node by service, which will check conditions of end of loop. </p>\r
+\r
+<p>With that kind of nodes may be defined all kinds of loops:<br><br>\r
+\r
+\93for( initial condition(s) ; end condition(s) ; end loop code )\94 or <br><br>\r
+\r
+\93while( end condition )\94<br><br>\r
+\r
+etc\85</p>\r
+<p>Here you can see a simple example of Python functions set in a Loop node:</p>\r
+<pre><code>\r
+def Init(Index,Min,Max,Incr) : \r
+\r
+ if Min <= Max : \r
+\r
+ Index = Min \r
+\r
+ else : \r
+\r
+ Index = Max \r
+\r
+ return Index,Min,Max,Incr \r
+\r
+ \r
+\r
+def More(Index,Min,Max,Incr) : \r
+\r
+ if Index < Max : \r
+\r
+ DoLoop = 1 \r
+\r
+ else : \r
+\r
+ DoLoop = 0 \r
+\r
+ return DoLoop,Index,Min,Max,Incr \r
+\r
+ \r
+\r
+def Next(Index,Min,Max,Incr) : \r
+\r
+ Index = Index + Incr \r
+\r
+ return Index,Min,Max,Incr\r
+</code></pre>\r
+\r
+<a name="2_2_3"></a><h4>2.2.3 Switch node </h4>\r
+<p>Switch node is a kind of Control node. In fact two nodes present Switch: <b>start</b> Switch and <b>end</b> Switch.\r
+ Nodes of such type are always InLine nodes. You have to supply this type of node by service, which will perform switching. That's why nodes of such type can have at least two or more switch ports (Boolean), but only one switch port can have "True" value at a definite moment of graph execution.</p>\r
+ \r
+ <p> With that kind of node you can define all kinds of tests or switches :</p>\r
+\r
+<p>\93if( condition ) ; else if( condition ) \85 ; else\94 or<br><br>\r
+\r
+\93switch( variable ) ; case value \85; default\94.<br><br>\r
+\r
+Etc\85</p>\r
+<p>The associated Python function will have all input ports of the Switch node \r
+ as input arguments. And that function must return a value for all output ports. \r
+ A simple example of this Python function: </p>\r
+ <pre><code>\r
+ \r
+def Switch(x): \r
+\r
+ i1=0 \r
+\r
+ i2=0 \r
+\r
+ i3=0 \r
+\r
+ if x>13: \r
+\r
+ i1=1 \r
+\r
+ elif x==13: \r
+\r
+ i2=1 \r
+\r
+ else: \r
+\r
+ i3=1 \r
+\r
+ return i1,i2,i3 \r
+ </code></pre>\r
+<p>In this example <b>i1</b>, <b>i2</b>, <b>i3</b> parameters of the function correspond to Switch \r
+ ports of the node. So, depending on the result of execution of the initial condition \r
+ (in our case it's a comparison of the input parameter with an integer 13), one \r
+ of the switch ports will get the value 1. And this port will transmit further \r
+ dataflow to the corresponding node. </p>\r
+<a name="2_2_4"></a><h4>2.2.4 GOTO node </h4>\r
+<p>GOTO node represents a simple transmitter of data from one port into another. \r
+ This InLine node can be with service or without it. In the first case the data \r
+ received by a GOTO node will be processed by this function and only after that \r
+ it will be transferred to another node. GOTO nodes may have as many Input and \r
+ Output ports as it's necessary. </p>\r
+ <i><a href="#cont">Back to the contents</a></i>\r
+<a name="3"></a><h2>3. SUPERVISION module features and services </h2>\r
+<p>The functionality of the SUPERVISION module is provided by a set of classes which are combined into \r
+the <b>SUPERV</b> package.\r
+<p>The API reference of the SUPERVISION component can be found <a href="namespaceSUPERV.html">here</a>.</p>\r
+<a name="3_1"></a><h3>3.1 CNode class </h3>\r
+<p>This is a base class of the SUPERVISION module. It contains a set of methods allowing:</p>\r
+\r
+<ul>\r
+ <li>creating a <b>Computation node </b>and setting its parameters (Name, Author, Comments \r
+ etc.)</li>\r
+ <li>checking the current state of the node in the data flow</li>\r
+ <li>node execution follow-up</li>\r
+ <li>management of the components, which can be initialized for execution of calculations in the data flow. (For that purpose\r
+ CNode class inherits the methods of the <b>Engines:Container</b> class)</li>\r
+</ul>\r
+<p>The API reference for this class can be found <a href="interfaceSUPERV_1_1CNode.html">here</a>.</p>\r
+\r
+<a name="3_2"></a><h3>3.2 FNode class </h3>\r
+\r
+<p>This class is necessary for management of <b>Factory nodes</b> in the data flow. Besides the inherited methods it contains some methods allowing\r
+to define the component from the container, which will be called for execution of the calculation.</p>\r
+<p>The API reference for this class can be found <a href="interfaceSUPERV_1_1FNode.html">here</a>.</p>\r
+<a name="3_3"></a>\r
+<h3>3.3 INode class </h3>\r
+<p>This class is necessary for management of <b>Inline nodes</b> in the data flow. Besides the inherited methods it contains some methods allowing to set\r
+the Python function, which will be executed for performing calculations, as well as input and output parameters for the node.</p>\r
+<p>The API reference for this class can be found <a href="interfaceSUPERV_1_1INode.html">here</a>.</p>\r
+\r
+<a name="3_4"></a><h3>3.4 GNode class </h3>\r
+<p>This class is necessary for management of <b>GOTO nodes</b> in the data flow. Besides the inherited methods it contains some methods allowing to define\r
+the couple node, which will be linked to this one.</p>\r
+<p>The API reference for this class can be found <a href="interfaceSUPERV_1_1GNode.html">here</a>.</p>\r
+\r
+<a name="3_5"></a><h3>3.5 LNode class </h3>\r
+<p>This class is necessary for management of <b>Loop nodes</b> (or <b>Start Loop nodes</b>) in the data flow. Besides the inherited methods it contains some methods allowing to define\r
+the Python function, which will control the loop.</p>\r
+<p>The API reference for this class can be found <a href="interfaceSUPERV_1_1LNode.html">here</a>.</p>\r
+\r
+<a name="3_6"></a><h3>3.6 ELNode class </h3>\r
+<p>This class is necessary for management of <b>End Loop nodes</b> (or <b>start</b> Loop nodes) in the data flow.</p>\r
+<p>The API reference for this class can be found <a href="interfaceSUPERV_1_1ELNode.html">here</a>.</p>\r
+\r
+<a name="3_7"></a><h3>3.7 SNode class </h3>\r
+<p>This class is necessary for management of <b>Switch nodes</b> (or <b>Start Switch nodes</b>) in the data flow. </p>\r
+<p>The API reference for this class can be found <a href="interfaceSUPERV_1_1SNode.html">here</a>.</p>\r
+\r
+<a name="3_8"></a><h3>3.8 ESNode class </h3>\r
+<p>This class is necessary for management of <b>End Switch nodes</b> in the data flow. </p>\r
+<p>The API reference for this class can be found <a href="interfaceSUPERV_1_1ESNode.html">here</a>.</p>\r
+\r
+<a name="3_9"></a><h3>3.9 Graph class </h3>\r
+<p>This class is used for management of a data flow. It contains a set of methods, which allows:</p>\r
+<ul>\r
+ <li>creation of a data flow consisting of one or several different nodes</li>\r
+ <li>import/export of an existing data flow</li>\r
+ <li>execution of the data flow </li>\r
+ <li>follow-up of data flow execution</li>\r
+ <li>checking the state of the data flow</li>\r
+</ul>\r
+<p>The API reference for this class can be found <a href="interfaceSUPERV_1_1Graph.html">here</a>.</p>\r
+<a name="3_10"></a><h3>3.10 Link class </h3>\r
+<p>This class contains a set of methods used for representation and management of the links connecting nodes in a data flow. </p>\r
+<p>The API reference for this class can be found <a href="interfaceSUPERV_1_1Link.html">here</a>.</p>\r
+\r
+<a name="3_11"></a><h3>3.11 Value class </h3>\r
+<p>This class contains a set of methods used for management of the values which can be set in the ports of nodes. </p>\r
+<p>The API reference for this class can be found <a href="interfaceSUPERV_1_1Value.html">here</a>.</p>\r
+\r
+<a name="3_12"></a><h3>3.12 Port class </h3>\r
+<p>This class contains a set of methods used for management of the ports of the nodes in a data flow: </p>\r
+\r
+<ul>\r
+ <li>setting the attributes of a port</li>\r
+ <li>initialization of input ports with initial values</li>\r
+ <li>linking ports of different nodes</li>\r
+</ul>\r
+<p>The API reference for this class can be found <a href="interfaceSUPERV_1_1Port.html">here</a>.</p>\r
+\r
+<a name="3_13"></a><h3>3.13 SuperG class </h3>\r
+<p>The main class of the SUPERVISION ccomponent which is used for construction and initialization of a data flow. </p>\r
+<p>The API reference for this class can be found <a href="interfaceSUPERV_1_1SuperG.html">here</a>.</p>\r
+\r
+\r
+<i><a href="#cont">Back to the contents</a></i>\r
+</body>\r
+</html>\r
--- /dev/null
+<!doctype html 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>Main Page</title>
+<link href="doxygen.css" rel="stylesheet" type="text/css">
+</head>
+<body>
+
+<center><table WIDTH="96%" >
+<tr>
+<td><a href="http://www.opencascade.com"><img src="sources/logocorp.gif" BORDER=0 height=46 width=122></a></td>
+
+
+<td>
+<div align=right><a href="http://www.opencascade.org/SALOME/"><img src="sources/application.gif" BORDER=0 height=46 width=108></a></div>
+</td>
+</tr>
+</table></center>
+
+
+</body>
+</html>
+<!-- Generated by Doxygen 1.3-rc2 -->
+<ul>
+<li><b>SALOME SUPERVISION module</b><ul>
+<li><a href="HTML/SUPERV.html">Mapping of SUPERV functions</a></li></ul>
+</li></ul>
+</body>
+</html>
--- /dev/null
+foldersTree = gFld("<b>SALOME v.1.2 </b>", "", "")
+ insDoc(foldersTree, gLnk("Main Page", "", "main.html"))
+
+aux1 = insFld(foldersTree, gFld("TUI Reference Guide", ""))
+ aux2 = insFld(aux1, gFld("Modules", ""))
+ aux3 = insFld(aux2, gFld("SALOME SUPERVISION module", ""))
+ insDoc(aux3, gLnk("Overview", "", "overview_Supervision.html"))
+ aux4 = insFld(aux3, gFld("Packages", ""))
+ insDoc(aux4, gLnk("SUPERV", "", "namespaceSUPERV.html"))
+ insDoc(aux3, gLnk("Examples", "", "examples_SUPERV.html"))
+
+
+/*! Data structures
+*/
+ insDoc(aux1, gLnk("Data Structures", "", "annotated.html"))
+
+/*! insDoc(aux1, gLnk("SUPERV::CNode", "", "interfaceSUPERV_1_1CNode.html"))
+ insDoc(aux1, gLnk("SUPERV::ELNode", "", "interfaceSUPERV_1_1ELNode.html"))
+ insDoc(aux1, gLnk("SUPERV::ESNode", "", "interfaceSUPERV_1_1ESNode.html"))
+ insDoc(aux1, gLnk("SUPERV::FNode", "", "interfaceSUPERV_1_1FNode.html"))
+ insDoc(aux1, gLnk("SUPERV::GNode", "", "interfaceSUPERV_1_1GNode.html"))
+ insDoc(aux1, gLnk("SUPERV::Graph", "", "interfaceSUPERV_1_1Graph.html"))
+ insDoc(aux1, gLnk("SUPERV::INode", "", "interfaceSUPERV_1_1INode.html"))
+ insDoc(aux1, gLnk("SUPERV::Link", "", "interfaceSUPERV_1_1Link.html"))
+ insDoc(aux1, gLnk("SUPERV::ListOfNodes", "", "structSUPERV_1_1ListOfNodes.html"))
+ insDoc(aux1, gLnk("SUPERV::LNode", "", "interfaceSUPERV_1_1LNode.html"))
+ insDoc(aux1, gLnk("SUPERV::Port", "", "interfaceSUPERV_1_1Port.html"))
+ insDoc(aux1, gLnk("SUPERV::SDate", "", "structSUPERV_1_1SDate.html"))
+ insDoc(aux1, gLnk("SUPERV::SNode", "", "interfaceSUPERV_1_1SNode.html"))
+ insDoc(aux1, gLnk("SUPERV::SuperG", "", "interfaceSUPERV_1_1SuperG.html"))
+*/
+ insDoc(aux1, gLnk("Class Hierarchy", "", "hierarchy.html"))
+
+/*!
+ aux3 = insFld(aux2, gFld("SUPERV::CNode", "", "interfaceSUPERV_1_1CNode.html"))
+ insDoc(aux3, gLnk("SUPERV::FNode", "", "interfaceSUPERV_1_1FNode.html"))
+ aux4 = insFld(aux3, gFld("SUPERV::INode", "", "interfaceSUPERV_1_1INode.html"))
+ aux5 = insFld(aux4, gFld("SUPERV::GNode", "", "interfaceSUPERV_1_1GNode.html"))
+ insDoc(aux5, gLnk("SUPERV::ELNode", "", "interfaceSUPERV_1_1ELNode.html"))
+ insDoc(aux5, gLnk("SUPERV::ESNode", "", "interfaceSUPERV_1_1ESNode.html"))
+ insDoc(aux5, gLnk("SUPERV::LNode", "", "interfaceSUPERV_1_1LNode.html"))
+ insDoc(aux5, gLnk("SUPERV::SNode", "", "interfaceSUPERV_1_1SNode.html"))
+ insDoc(aux4, gLnk("SUPERV::Graph", "", "interfaceSUPERV_1_1Graph.html"))
+ insDoc(aux2, gLnk("SUPERV::Link", "", "interfaceSUPERV_1_1Link.html"))
+ insDoc(aux2, gLnk("SUPERV::SuperG", "", "interfaceSUPERV_1_1SuperG.html"))
+ aux3 = insFld(aux2, gFld("SUPERV::Value", "", "interfaceSUPERV_1_1Value.html"))
+ insDoc(aux3, gLnk("SUPERV::Port", "", "interfaceSUPERV_1_1Port.html"))
+ insDoc(aux2, gLnk("SUPERV::SuperG", "", "interfaceSUPERV_1_1SuperG.html"))
+ insDoc(aux1, gLnk("SUPERV::ListOfNodes", "", "structSUPERV_1_1ListOfNodes.html"))
+ insDoc(aux1, gLnk("SUPERV::SDate", "", "structSUPERV_1_1SDate.html"))
+*/
+ insDoc(aux1, gLnk("Class methods list", "", "functions.html"))
+/*!
+aux1 = insFld(foldersTree, gFld("Namespace List", "", "namespaces.html"))
+ insDoc(aux1, gLnk("SUPERV", "", "namespaceSUPERV.html"))
+*/
+ insDoc(aux1, gLnk("Namespace Members", "", "namespacemembers.html"))
+
+ insDoc(aux1, gLnk("File List", "", "files.html"))
+
+/*!
+
+ insDoc(aux1, gLnk("SUPERV.idl", "", "SUPERV_8idl.html"))
+*/
+
--- /dev/null
+//****************************************************************
+// You are free to copy the "Folder-Tree" script as long as you
+// keep this copyright notice:
+// Script found in: http://www.geocities.com/Paris/LeftBank/2178/
+// Author: Marcelino Alves Martins (martins@hks.com) December '97.
+//****************************************************************
+
+//Log of changes:
+// 17 Feb 98 - Fix initialization flashing problem with Netscape
+//
+// 27 Jan 98 - Root folder starts open; support for USETEXTLINKS;
+// make the ftien4 a js file
+//
+// DvH: Dec 2000 - Made some minor changes to support external
+// references
+
+// Definition of class Folder
+// *****************************************************************
+
+function Folder(folderDescription, tagName, hreference) //constructor
+{
+ //constant data
+ this.desc = folderDescription
+ this.tagName = tagName
+ this.hreference = hreference
+ this.id = -1
+ this.navObj = 0
+ this.iconImg = 0
+ this.nodeImg = 0
+ this.isLastNode = 0
+
+ //dynamic data
+ this.isOpen = true
+ this.iconSrc = "ftv2folderopen.png"
+ this.children = new Array
+ this.nChildren = 0
+
+ //methods
+ this.initialize = initializeFolder
+ this.setState = setStateFolder
+ this.addChild = addChild
+ this.createIndex = createEntryIndex
+ this.hide = hideFolder
+ this.display = display
+ this.renderOb = drawFolder
+ this.totalHeight = totalHeight
+ this.subEntries = folderSubEntries
+ this.outputLink = outputFolderLink
+}
+
+function setStateFolder(isOpen)
+{
+ var subEntries
+ var totalHeight
+ var fIt = 0
+ var i=0
+
+ if (isOpen == this.isOpen)
+ return
+
+ if (browserVersion == 2)
+ {
+ totalHeight = 0
+ for (i=0; i < this.nChildren; i++)
+ totalHeight = totalHeight + this.children[i].navObj.clip.height
+ subEntries = this.subEntries()
+ if (this.isOpen)
+ totalHeight = 0 - totalHeight
+ for (fIt = this.id + subEntries + 1; fIt < nEntries; fIt++)
+ indexOfEntries[fIt].navObj.moveBy(0, totalHeight)
+ }
+ this.isOpen = isOpen
+ propagateChangesInState(this)
+}
+
+function propagateChangesInState(folder)
+{
+ var i=0
+
+ if (folder.isOpen)
+ {
+ if (folder.nodeImg)
+ if (folder.isLastNode)
+ folder.nodeImg.src = "ftv2mlastnode.png"
+ else
+ folder.nodeImg.src = "ftv2mnode.png"
+ folder.iconImg.src = "ftv2folderopen.png"
+ for (i=0; i<folder.nChildren; i++)
+ folder.children[i].display()
+ }
+ else
+ {
+ if (folder.nodeImg)
+ if (folder.isLastNode)
+ folder.nodeImg.src = "ftv2plastnode.png"
+ else
+ folder.nodeImg.src = "ftv2pnode.png"
+ folder.iconImg.src = "ftv2folderclosed.png"
+ for (i=0; i<folder.nChildren; i++)
+ folder.children[i].hide()
+ }
+}
+
+function hideFolder()
+{
+ if (browserVersion == 1 || browserVersion == 3) {
+ if (this.navObj.style.display == "none")
+ return
+ this.navObj.style.display = "none"
+ } else {
+ if (this.navObj.visibility == "hidden")
+ return
+ this.navObj.visibility = "hidden"
+ }
+
+ this.setState(0)
+}
+
+function initializeFolder(level, lastNode, leftSide)
+{
+var j=0
+var i=0
+var numberOfFolders
+var numberOfDocs
+var nc
+
+ nc = this.nChildren
+
+ this.createIndex()
+
+ var auxEv = ""
+
+ if (browserVersion > 0)
+ auxEv = "<a href='javascript:clickOnNode("+this.id+")'>"
+ else
+ auxEv = "<a>"
+
+ if (level>0)
+ if (lastNode) //the last 'brother' in the children array
+ {
+ this.renderOb(leftSide + auxEv + "<img name='nodeIcon" + this.id + "' src='ftv2mlastnode.png' width=16 height=22 border=0></a>")
+// leftSide = leftSide + "<img src='ftv2blank.png' width=16 height=22>"
+ this.isLastNode = 1
+ }
+ else
+ {
+ this.renderOb(leftSide + auxEv + "<img name='nodeIcon" + this.id + "' src='ftv2mnode.png' width=16 height=22 border=0></a>")
+ leftSide = leftSide + "<img src='ftv2vertline.png' width=16 height=22>"
+ this.isLastNode = 0
+ }
+ else
+ this.renderOb("")
+
+ if (nc > 0)
+ {
+ level = level + 1
+ for (i=0 ; i < this.nChildren; i++)
+ {
+ if (i == this.nChildren-1)
+ this.children[i].initialize(level, 1, leftSide)
+ else
+ this.children[i].initialize(level, 0, leftSide)
+ }
+ }
+}
+
+function drawFolder(leftSide)
+{
+ if (browserVersion == 2) {
+ if (!doc.yPos)
+ doc.yPos=8
+ doc.write("<layer id='folder" + this.id + "' top=" + doc.yPos + " visibility=hidden>")
+ }
+ if (browserVersion == 3)
+ {
+ doc.write("<div id='folder" + this.id + "' style='visibility:hide;'>")
+ }
+
+ doc.write("\n<table ")
+ if (browserVersion == 1)
+ doc.write(" id='folder" + this.id + "' style='position:block;' ")
+ doc.write(" border=0 cellspacing=0 cellpadding=0>")
+ doc.write("\n<tr><td>")
+ doc.write(leftSide)
+ this.outputLink()
+ doc.write("<img name='folderIcon" + this.id + "' ")
+ doc.write("src='" + this.iconSrc+"' border=0></a>")
+ doc.write("</td>\n<td valign=middle nowrap>")
+ if (USETEXTLINKS)
+ {
+ this.outputLink()
+ doc.write(this.desc + "</a>")
+ }
+ else
+ doc.write(this.desc)
+
+/*!
+ if (this.tagName!="")
+ {
+ doc.write(" [external]")
+ }
+*/
+ doc.write("</td>")
+ doc.write("\n</table>\n")
+
+ if (browserVersion == 2) {
+ doc.write("</layer>")
+ }
+ if (browserVersion == 3) {
+ doc.write("</div>")
+ }
+
+ if (browserVersion == 1) {
+ this.navObj = doc.all["folder"+this.id]
+ this.iconImg = doc.all["folderIcon"+this.id]
+ this.nodeImg = doc.all["nodeIcon"+this.id]
+ } else if (browserVersion == 2) {
+ this.navObj = doc.layers["folder"+this.id]
+ this.iconImg = this.navObj.document.images["folderIcon"+this.id]
+ this.nodeImg = this.navObj.document.images["nodeIcon"+this.id]
+ doc.yPos=doc.yPos+this.navObj.clip.height
+ } else if (browserVersion == 3) {
+ this.navObj = doc.getElementById("folder"+this.id)
+ this.iconImg = doc.images.namedItem("folderIcon"+this.id)
+ this.nodeImg = doc.images.namedItem("nodeIcon"+this.id)
+ }
+}
+
+function outputFolderLink()
+{
+ if (this.hreference)
+ {
+ doc.write("<a ")
+ if (this.tagName)
+ {
+ doc.write("doxygen='" + this.tagName + "' ");
+ }
+ doc.write("href='" + this.hreference + "' TARGET=\"basefrm\" ")
+ if (browserVersion > 0)
+ doc.write("onClick='javascript:clickOnFolder("+this.id+")'")
+ doc.write(">")
+ }
+ else
+ doc.write("<a>")
+}
+
+function addChild(childNode)
+{
+ this.children[this.nChildren] = childNode
+ this.nChildren++
+ return childNode
+}
+
+function folderSubEntries()
+{
+ var i = 0
+ var se = this.nChildren
+
+ for (i=0; i < this.nChildren; i++){
+ if (this.children[i].children) //is a folder
+ se = se + this.children[i].subEntries()
+ }
+
+ return se
+}
+
+
+// Definition of class Item (a document or link inside a Folder)
+// *************************************************************
+
+function Item(itemDescription, tagName, itemLink) // Constructor
+{
+ // constant data
+ this.desc = itemDescription
+ this.tagName = tagName
+ this.link = itemLink
+ this.id = -1 //initialized in initalize()
+ this.navObj = 0 //initialized in render()
+ this.iconImg = 0 //initialized in render()
+ this.iconSrc = "ftv2doc.png"
+
+ // methods
+ this.initialize = initializeItem
+ this.createIndex = createEntryIndex
+ this.hide = hideItem
+ this.display = display
+ this.renderOb = drawItem
+ this.totalHeight = totalHeight
+}
+
+function hideItem()
+{
+ if (browserVersion == 1 || browserVersion == 3) {
+ if (this.navObj.style.display == "none")
+ return
+ this.navObj.style.display = "none"
+ } else {
+ if (this.navObj.visibility == "hidden")
+ return
+ this.navObj.visibility = "hidden"
+ }
+}
+
+function initializeItem(level, lastNode, leftSide)
+{
+ this.createIndex()
+
+ if (level>0)
+ if (lastNode) //the last 'brother' in the children array
+ {
+ this.renderOb(leftSide + "<img src='ftv2lastnode.png' width=16 height=22>")
+ leftSide = leftSide + "<img src='ftv2blank.png' width=16 height=22>"
+ }
+ else
+ {
+ this.renderOb(leftSide + "<img src='ftv2node.png' width=16 height=22>")
+ leftSide = leftSide + "<img src='ftv2vertline.png' width=16 height=22>"
+ }
+ else
+ this.renderOb("")
+}
+
+function drawItem(leftSide)
+{
+ if (browserVersion == 2)
+ doc.write("<layer id='item" + this.id + "' top=" + doc.yPos + " visibility=hidden>")
+ if (browserVersion == 3)
+ doc.write("<div id='item" + this.id + "' style='display:block;'>")
+
+ doc.write("\n<table ")
+ if (browserVersion == 1)
+ doc.write(" id='item" + this.id + "' style='position:block;' ")
+ doc.write(" border=0 cellspacing=0 cellpadding=0>\n")
+ doc.write("<tr><td>")
+ doc.write(leftSide)
+ if (this.link!="")
+ {
+ doc.write("<a href=" + this.link + ">")
+ }
+ doc.write("<img id='itemIcon"+this.id+"' ")
+ doc.write("src='"+this.iconSrc+"' border=0>")
+ if (this.link!="")
+ {
+ doc.write("</a>")
+ }
+ doc.write("</td>\n<td valign=middle nowrap>")
+ if (USETEXTLINKS && this.link!="")
+ doc.write("<a href=" + this.link + ">" + this.desc + "</a>")
+ else
+ doc.write(this.desc)
+/*!
+ if (this.tagName!="")
+ {
+ doc.write(" [external]");
+ }
+*/
+ doc.write("\n</table>\n")
+
+ if (browserVersion == 2)
+ doc.write("</layer>")
+ if (browserVersion == 3)
+ doc.write("</div>")
+
+ if (browserVersion == 1) {
+ this.navObj = doc.all["item"+this.id]
+ this.iconImg = doc.all["itemIcon"+this.id]
+ } else if (browserVersion == 2) {
+ this.navObj = doc.layers["item"+this.id]
+ this.iconImg = this.navObj.document.images["itemIcon"+this.id]
+ doc.yPos=doc.yPos+this.navObj.clip.height
+ } else if (browserVersion == 3) {
+ this.navObj = doc.getElementById("item"+this.id)
+ this.iconImg = doc.images.namedItem("itemIcon"+this.id)
+ }
+}
+
+
+// Methods common to both objects (pseudo-inheritance)
+// ********************************************************
+
+function display()
+{
+ if (browserVersion == 1 || browserVersion == 3)
+ this.navObj.style.display = "block"
+ else
+ this.navObj.visibility = "show"
+}
+
+function createEntryIndex()
+{
+ this.id = nEntries
+ indexOfEntries[nEntries] = this
+ nEntries++
+}
+
+// total height of subEntries open
+function totalHeight() //used with browserVersion == 2
+{
+ var h = this.navObj.clip.height
+ var i = 0
+
+ if (this.isOpen) //is a folder and _is_ open
+ for (i=0 ; i < this.nChildren; i++)
+ h = h + this.children[i].totalHeight()
+
+ return h
+}
+
+
+// Events
+// *********************************************************
+
+function clickOnFolder(folderId)
+{
+ var clicked = indexOfEntries[folderId]
+
+ if (!clicked.isOpen)
+ clickOnNode(folderId)
+
+ return
+
+ if (clicked.isSelected)
+ return
+}
+
+function clickOnNode(folderId)
+{
+ var clickedFolder = 0
+ var state = 0
+
+ clickedFolder = indexOfEntries[folderId]
+ state = clickedFolder.isOpen
+
+ clickedFolder.setState(!state) //open<->close
+}
+
+function initializeDocument()
+{
+ doc = document;
+ if (doc.all)
+ browserVersion = 1 //IE4
+ else
+ if (doc.layers)
+ browserVersion = 2 //NS4
+ else if(navigator.userAgent.toLowerCase().indexOf('gecko') != -1)
+ browserVersion = 3 //mozilla
+ else
+ browserVersion = 0 //other
+
+ foldersTree.initialize(0, 1, "")
+ foldersTree.display()
+
+ if (browserVersion > 0)
+ {
+ if(browserVersion != 3)
+ doc.write("<layer top="+indexOfEntries[nEntries-1].navObj.top+"> </layer>")
+
+ // close the whole tree
+ clickOnNode(0)
+ // open the root folder
+ clickOnNode(0)
+ }
+}
+
+// Auxiliary Functions for Folder-Treee backward compatibility
+// *********************************************************
+
+function gFld(description, tagName, hreference)
+{
+ folder = new Folder(description, tagName, hreference)
+ return folder
+}
+
+function gLnk(description, tagName, linkData)
+{
+ fullLink = ""
+
+ if (linkData!="")
+ {
+ fullLink = "'"+linkData+"' target=\"basefrm\""
+ }
+
+ linkItem = new Item(description, tagName, fullLink)
+ return linkItem
+}
+
+function insFld(parentFolder, childFolder)
+{
+ return parentFolder.addChild(childFolder)
+}
+
+function insDoc(parentFolder, document)
+{
+ parentFolder.addChild(document)
+}
+
+// Global variables
+// ****************
+
+USETEXTLINKS = 1
+indexOfEntries = new Array
+nEntries = 0
+doc = document
+browserVersion = 0
+selectedFolder=0
-# -* Makefile *-
+# Copyright (C) 2003 CEA/DEN, EDF R&D
#
-# Author : Vasily Rusyaev (Open Cascade NN)
-# Date : 13/02/2003
-# $Header:
#
-# source path
+#
+# File : Makefile.in
+# Author : Vasily Rusyaev (Open Cascade NN)
+# Module : doc
+# $Header:
+
top_srcdir=@top_srcdir@
+root_srcdir=@ROOT_SRCDIR@
top_builddir=../..
srcdir=@srcdir@
VPATH=.:@srcdir@
doc:
cp -fr $(srcdir)/INPUT ./; \
cd INPUT; \
- sed 's|../../../share/salome|../$(top_srcdir)|' doxyfile > doxyfile1; \
+ sed 's|../../../share/salome|$(root_srcdir)|' doxyfile > doxyfile1; \
mv -f doxyfile1 doxyfile; \
$(doxygen) ./doxyfile; \
cd ..; \
- cp -f $(srcdir)/INPUT/sources/doxygen.css ./html/doxygen.css
+ cp -fr $(srcdir)/INPUT/sources/static/*.* ./html/
cp -fr $(srcdir)/INPUT/sources/ html/
- cp -fr $(srcdir)/INPUT/exemple/ html/
cp -fr $(srcdir)/INPUT/HTML/ html/
clean:
--- /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@
+curdir = $(shell pwd)
+instdatadir=${prefix}/examples
+
+SUBDIRS=.
+
+@COMMENCE@
+
+data:
+ (cd $(srcdir) ; cp -fr `ls | grep -v "Makefile.in"` $(curdir))
+
+clean:
+ rm -rf `ls | grep -v "Makefile"`
+
+install:
+ rm -rf $(instdatadir)
+ mkdir $(instdatadir)
+ cp -rf `ls | grep -v "Makefile"` $(instdatadir)
+
+uninstall:
+ rm -rf $(instdatadir)
/*! \file SUPERV.idl This file contains a set of interfaces of the %SUPERVISION module
*/
-/*!
- \defgroup Supervision SALOME SUPERVISION module
-*/
+
#ifndef __SUPERV_IDL__
#define __SUPERV_IDL__
#include "SALOME_ModuleCatalog.idl"
#include "SALOME_Component.idl"
#include "SALOMEDS.idl"
-/*! \ingroup Supervision
+/*!
The main package of interfaces of %SUPERVISION module
*/
module SUPERV {
boolean Resume();
/*!
- Restarts execution of the node(graph).
+ Restarts execution of the node.
*/
boolean ReRun();
/*!
*/
boolean ReStart();
/*!
-Restarts and suspends execution of the graph beginning from a definite node.
+Restarts and suspends execution of the graph beginning from a defined node.
*/
boolean ReStartAt( in string aNodeName );
Returns the position of the node along Y-axis.
*/
long Y() ;
-
+/*!
+Returns the Cpu used by a node in seconds.
+*/
long CpuUsed() ;
} ;
using namespace std;
#include "DataFlowBase_Base.hxx"
-char *SuperVision_Version = "1.04" ;
+char *SuperVision_Version = "1.05" ;
char *NULLSTRING = "" ;
}
void GraphBase::Base::SetDebug( CORBA::ORB_ptr ORB ,
- int * theprof_debug , ostream * thefdebug ) {
- _Orb = CORBA::ORB::_duplicate( ORB ) ;
- _prof_debug = theprof_debug ;
- _fdebug = thefdebug ;
+ int * theprof_debug , ofstream * thefdebug ) {
+ if ( _prof_debug == NULL ) {
+// *thefdebug << "GraphBase::Base::SetDebug Done _fdebug " << _fdebug << " = thefdebug " << thefdebug
+// << endl ;
+ if ( theprof_debug ) {
+ _Orb = CORBA::ORB::_duplicate( ORB ) ;
+ _prof_debug = theprof_debug ;
+ _fdebug = thefdebug ;
+ }
+ }
+// cdebug_in << "GraphBase::Base::SetDebug" << endl ;
+// cdebug << "GraphBase::Base::SetDebug" << endl ;
+// cdebug_out << "GraphBase::Base::SetDebug" << endl ;
}
char * GraphBase::Base::ObjectToString( CORBA::Object_ptr obj ) const {
#ifndef _DATAFLOW_BASE_HXX
#define _DATAFLOW_BASE_HXX
+//#include <strstream>
#include <iostream>
#include <fstream>
-#include <strstream>
+#include <sstream>
#include <iomanip>
#include <string>
#include <map>
#include "utilities.h"
#include "OpUtil.hxx"
-#include "SALOME_NamingService.hxx"
-
extern char *SuperVision_Version ;
extern char *NULLSTRING ;
public:
- int * _prof_debug;
- ostream * _fdebug;
+ int * _prof_debug ;
+ ofstream * _fdebug ;
Base() ;
virtual ~Base() {} ;
void SetDebug( CORBA::ORB_ptr ORB ,
- int * prof_debug , ostream * fdebug ) ;
+ int * prof_debug , ofstream * fdebug ) ;
char * ObjectToString( CORBA::Object_ptr obj ) const ;
CORBA::Object_ptr StringToObject(char * obj ) const ;
} ;
# ifdef _DEBUG_
-# define cdebug \
- if ( GraphBase::Base::_prof_debug ) \
- *GraphBase::Base::_fdebug << " " /*<< setw(3*(*GraphBase::Base::_prof_debug)) */<< " "
+// *GraphBase::Base::_fdebug << " " /*<< setw(3*(*GraphBase::Base::_prof_debug)) */<< " "
+
+# define cdebug if ( GraphBase::Base::_fdebug ) *GraphBase::Base::_fdebug << " " << " "
+
+# define cdebug_in if ( GraphBase::Base::_fdebug ) *GraphBase::Base::_fdebug << endl << "-->" << " "
-# define cdebug_in \
- if ( GraphBase::Base::_prof_debug ) \
- *GraphBase::Base::_fdebug << endl << "-->" /*<< setw(3*((*GraphBase::Base::_prof_debug)++)) */<< " "
+# define cdebug_out if ( GraphBase::Base::_fdebug ) *GraphBase::Base::_fdebug << endl << "<--" << " "
-# define cdebug_out \
- if ( GraphBase::Base::_prof_debug ) \
- *GraphBase::Base::_fdebug << endl << "<--" /*<< setw(3*(--(*GraphBase::Base::_prof_debug)))*/ << " "
# else
# define cdebug while (false) std::cerr
// $Header:
using namespace std;
-#include <strstream>
-#include <iostream>
+//#include <sstream>
+//#include <iostream>
#include "DataFlowBase_InLineNode.hxx"
#include "DataFlowBase_LoopNode.hxx"
_InNode = NULL ;
_ThreadNo = pthread_self() ;
_Name = NULL ;
- cdebug << "GraphBase::Node::Node " << this
- << " _Name "
- << (void *) _Name << " " << _Name << " _Comment "
- << (void *) _Comment << " " << _Comment << " " << endl ;
+ cdebug << "GraphBase::Node::Node " << this << " " << endl ;
}
SALOME_NamingService* ptrNamingService ,
const char * aDataFlowName ,
int * Graph_prof_debug ,
- ostream * Graph_fdebug ) :
+ ofstream * Graph_fdebug ) :
GraphBase::PortsOfNode::PortsOfNode( aDataFlowName ) {
+ MESSAGE( "GraphBase::ComputingNode::ComputingNode( " << aDataFlowName << " Graph_fdebug " << Graph_fdebug ) ;
InitFields( _Kind ,
_FirstCreation ,
_LastModification ,
_ORB = CORBA::ORB::_duplicate( ORB ) ;
_NamingService = ptrNamingService ;
- _Graph_prof_debug = Graph_prof_debug ;
- _Graph_fdebug = Graph_fdebug ;
_Node = SUPERV::CNode::_nil() ;
_InNode = NULL ;
_ThreadNo = pthread_self() ;
- if ( aDataFlowName && strlen( aDataFlowName ) ) {
+ if ( aDataFlowName != NULLSTRING && strlen( aDataFlowName ) ) {
_Name = new char[ strlen( aDataFlowName )+1 ] ;
strcpy( _Name , aDataFlowName ) ;
}
- else
- _Name = NULL ;
+ else {
+ _Name = NULLSTRING ;
+ }
if ( Graph_prof_debug ) {
+// MESSAGE( "GraphBase::ComputingNode::ComputingNode --> SetDebug" ) ;
+// cout << "GraphBase::ComputingNode::ComputingNode --> SetDebug" << endl ;
+ _Graph_prof_debug = Graph_prof_debug ;
+ _Graph_fdebug = Graph_fdebug ;
SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
-// MESSAGE( "Invalid DataFlow Name." );
}
+// else {
+// cout << "GraphBase::ComputingNode::ComputingNode NO SetDebug" << endl ;
+// }
cdebug << "GraphBase::ComputingNode::ComputingNode " << this
<< "' _Name "
- << (void *) _Name << " '" << _Name << " _Comment "
- << (void *) _Comment << " " << _Comment << " " << _FirstCreation
+ << (void *) _Name << " '" << _Name << " " << _FirstCreation
<< " " << _LastModification << endl ;
}
const long X ,
const long Y ,
int * Graph_prof_debug ,
- ostream * Graph_fdebug ) :
+ ofstream * Graph_fdebug ) :
GraphBase::PortsOfNode::PortsOfNode() {
_ORB = CORBA::ORB::_duplicate( ORB ) ;
_NamingService = ptrNamingService ;
- _Graph_prof_debug = Graph_prof_debug ;
- _Graph_fdebug = Graph_fdebug ;
_Node = SUPERV::CNode::_nil() ;
_InNode = NULL ;
_ThreadNo = pthread_self() ;
_FirstCreation.Month = _LastModification.Month = Tm->tm_mon + 1;
_FirstCreation.Year = _LastModification.Year = Tm->tm_year + 1900;
- if ( NodeEditorRelease ) {
+ if ( NodeEditorRelease != NULLSTRING ) {
_EditorRelease = new char[ strlen( NodeEditorRelease ) + 1 ] ;
strcpy( _EditorRelease , NodeEditorRelease ) ;
}
strcpy( _EditorRelease , SuperVision_Version ) ;
}
- if ( NodeAuthor ) {
+ if ( NodeAuthor != NULLSTRING ) {
_Author = new char[ strlen( NodeAuthor ) + 1 ] ;
strcpy( _Author , NodeAuthor ) ;
}
- else
+ else {
_Author = NULLSTRING ;
+ }
- if ( NodeComment ) {
+ if ( NodeComment != NULLSTRING ) {
_Comment = new char[ strlen( NodeComment ) + 1 ] ;
strcpy( _Comment , NodeComment ) ;
}
- else
+ else {
_Comment = NULLSTRING ;
+ }
_SubGraphNumber = 0 ;
_HeadNode = false ;
_X = X ;
_Y = Y ;
- if ( Graph_prof_debug )
- SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
+// 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 ;
+ 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 << ","
+ << akind << ")" << endl;
+
- DefPortsOfNode( ORB , aService , NamePtr() , Kind() ,
- Graph_prof_debug , Graph_fdebug ) ;
+ DefPortsOfNode( ORB , aService , NamePtr() , Kind() , Graph_prof_debug , Graph_fdebug ) ;
- cdebug_in << "GraphBase::ComputingNode::ComputingNode(" << aService.ServiceName << ","
- << aNodeName << "," << akind
- << "," << NodeComment << ")" << endl;
-
cdebug << "GraphBase::ComputingNode::ComputingNode " << this
- << " _Name "
- << (void *) _Name << " '" << _Name << "' _Comment "
- << (void *) _Comment << " " << _Comment << " "
+ << " _Name " << (void *) _Name << " '" << _Name
<< " KindOfNode " << _Kind
<< " ServiceName " << ServiceName() << " In(" << ServiceInParameter().length()
<< ") Out(" << ServiceOutParameter().length() << ")" << endl ;
}
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 ;
}
SUPERV::SDate GraphBase::ComputingNode::FirstCreation () const {
- cdebug << "GraphBase::ComputingNode::FirstCreation "
- << "' _Name " << _Name << " " << _FirstCreation << " "
- << _LastModification << endl ;
+// cdebug << "GraphBase::ComputingNode::FirstCreation "
+// << "' _Name " << _Name << " " << _FirstCreation << " "
+// << _LastModification << endl ;
return _FirstCreation;
}
}
bool GraphBase::ComputingNode::Author(const char * a) {
+ cdebug_in << "GraphBase::ComputingNode::Author " << _Author << endl;
if ( _Author && _Author != NULLSTRING )
delete _Author;
_Author = my_strdup(a);
+ cdebug_out << "GraphBase::ComputingNode::Author " << _Author << endl;
return true ;
}
bool GraphBase::ComputingNode::Comment(const char *c) {
- cdebug_in << "GraphBase::ComputingNode::Comment" << endl;
+ cdebug_in << "GraphBase::ComputingNode::Comment " << _Comment << endl;
if ( _Comment != NULLSTRING )
delete [] _Comment;
_Comment = my_strdup(c);
- cdebug_out << "GraphBase::ComputingNode::Comment" << endl;
+ cdebug_out << "GraphBase::ComputingNode::Comment " << _Comment << endl;
return true ;
}
QDomElement inParametertype = Graph.createElement("inParameter-type") ;
// mpv: Linux 8.0 compiler compatibility
// aField = Graph.createTextNode( (char *)ServiceInParameter()[i].Parametertype ) ;
- aField = Graph.createTextNode( strdup(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>"
QDomElement inParametername = Graph.createElement("inParameter-name") ;
// mpv: Linux 8.0 compiler compatibility
// aField = Graph.createTextNode( (char *) ServiceInParameter()[i].Parametername ) ;
- aField = Graph.createTextNode( strdup(ServiceInParameter()[i].Parametername) ) ;
+ if ( strlen( ServiceInParameter()[i].Parametername ) ) {
+ aField = Graph.createTextNode( strdup(ServiceInParameter()[i].Parametername) ) ;
+ }
+ else {
+ aField = Graph.createTextNode( "?" ) ;
+ }
inParameter.appendChild(inParametername) ;
inParametername.appendChild( aField ) ;
// f << Tabs << " </inParameter>" << endl ;
QDomElement outParametertype = Graph.createElement("outParameter-type") ;
// mpv: Linux 8.0 compiler compatibility
// aField = Graph.createTextNode( (char *) ServiceOutParameter()[i].Parametertype ) ;
- aField = Graph.createTextNode( strdup(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>"
QDomElement outParametername = Graph.createElement("outParameter-name") ;
// mpv: Linux 8.0 compiler compatibility
// aField = Graph.createTextNode( (char *) ServiceOutParameter()[i].Parametername ) ;
- aField = Graph.createTextNode( strdup(ServiceOutParameter()[i].Parametername) ) ;
+ if ( strlen( ServiceOutParameter()[i].Parametername ) ) {
+ aField = Graph.createTextNode( strdup(ServiceOutParameter()[i].Parametername) ) ;
+ }
+ else {
+ aField = Graph.createTextNode( "?" ) ;
+ }
outParameter.appendChild(outParametername) ;
outParametername.appendChild( aField ) ;
// f << Tabs << " </outParameter>" << endl ;
QDomElement PyFunction = Graph.createElement("PyFunction") ;
PyFunctionlist.appendChild( PyFunction ) ;
int j ;
- for ( j = 0 ; j < (*PythonFunctions[i]).length() ; j++ ) {
+ for ( j = 0 ; j < (int ) (*PythonFunctions[i]).length() ; j++ ) {
if ( j == 0 ) {
// if ( i == 0 ) {
// f << Tabs << " <FuncName>" << FuncNames[i].c_str()
// char * aCDATAChar = (char *) (*PythonFunctions[i])[j] ;
char * aCDATAChar = strdup ((*PythonFunctions[i])[j]) ;
int i ;
- for ( i = 0 ; i < strlen( aCDATAChar ) ; i++ ) {
+ for ( i = 0 ; i < (int ) strlen( aCDATAChar ) ; i++ ) {
if ( aCDATAChar[ i ] != ' ' ) {
break ;
}
}
- if ( i == strlen( aCDATAChar ) ) {
+ if ( i == (int ) strlen( aCDATAChar ) ) {
aCDATA = Graph.createCDATASection( "?" ) ;
}
else {
else if ( IsComputingNode() ) {
int i ;
f << Name() << "_ServiceinParameter = []" << endl ;
- for ( i = 0 ; i < ServiceInParameter().length() ; i++ ) {
+ for ( i = 0 ; i < (int ) ServiceInParameter().length() ; i++ ) {
f << Name() << "_ServiceinParameter.append( SALOME_ModuleCatalog.ServicesParameter( '"
<< ServiceInParameter()[i].Parametertype << "' , '"
<< ServiceInParameter()[i].Parametername << "' ) )" << endl ;
}
f << Name() << "_ServiceoutParameter = []" << endl ;
- for ( i = 0 ; i < ServiceOutParameter().length() ; i++ ) {
+ for ( i = 0 ; i < (int ) ServiceOutParameter().length() ; i++ ) {
f << Name() << "_ServiceoutParameter.append( SALOME_ModuleCatalog.ServicesParameter( '"
<< ServiceOutParameter()[i].Parametertype << "' , '"
<< ServiceOutParameter()[i].Parametername << "' ) )" << endl ;
SUPERV::ListOfStrings aPyFunc ;
if ( PythonFunctions.size() ) {
aPyFunc = *PythonFunctions[0] ;
- for ( i = 0 ; i < aPyFunc.length() ; i++ ) {
+ for ( i = 0 ; i < (int ) aPyFunc.length() ; i++ ) {
f << "Py" << Name() << ".append( '" << aPyFunc[i] << "' )" << endl ;
}
}
SUPERV::ListOfStrings aPyMore = *PythonFunctions[1] ;
SUPERV::ListOfStrings aPyNext = *PythonFunctions[2] ;
f << "PyMore" << Name() << " = []" << endl ;
- for ( i = 0 ; i < aPyMore.length() ; i++ ) {
+ for ( i = 0 ; i < (int ) aPyMore.length() ; i++ ) {
f << "PyMore" << Name() << ".append( '" << aPyMore[i] << "' )" << endl ;
}
f << "PyNext" << Name() << " = []" << endl ;
- for ( i = 0 ; i < aPyNext.length() ; i++ ) {
+ for ( i = 0 ; i < (int ) aPyNext.length() ; i++ ) {
f << "PyNext" << Name() << ".append( '" << aPyNext[i] << "' )" << endl ;
}
f << Name() << "," << EndName << " = " << aGraphName << ".LNode( '"
<< aCoupledNode->YCoordinate() << " )" << endl ;
SUPERV::ListOfStrings aPyFunc = *aCoupledNode->PythonFunction() ;
f << "Py" << aCoupledNode->Name() << " = []" << endl ;
- for ( i = 0 ; i < aPyFunc.length() ; i++ ) {
+ for ( i = 0 ; i < (int ) aPyFunc.length() ; i++ ) {
f << "Py" << aCoupledNode->Name() << ".append( '" << aPyFunc[i] << "' )"
<< endl ;
}
}
delete [] EndName ;
}
+ }
+
+ 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() << ".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 0
if ( IsLoopNode() || IsSwitchNode() ) {
f << EndName << ".SetName( '" << CoupledNode
return true ;
}
-void GraphBase::ComputingNode::NodeInfo(ostrstream & s) const {
- int i ;
+void GraphBase::ComputingNode::NodeInfo(ostream & s) const {
s << *this ;
ListPorts( s , true ) ;
s << ends ;
#ifndef _DATAFLOWBASE_NODE_HXX
#define _DATAFLOWBASE_NODE_HXX
+#include "SALOME_NamingService.hxx"
+
#include "DataFlowBase_PortsOfNode.hxx"
namespace GraphBase {
CORBA::ORB_ptr _ORB ;
SALOME_NamingService * _NamingService ;
int * _Graph_prof_debug ;
- ostream * _Graph_fdebug ;
+ ofstream * _Graph_fdebug ;
SUPERV::CNode_var _Node ;
void * _InNode ; // From GraphExecutor:: or GraphEditor::
bool _ObjInterface ;
SALOME_NamingService* ptrNamingService ,
const char * DataFlowName ,
int * Graph_prof_debug = NULL ,
- ostream * Graph_fdebug = NULL ) ;
+ ofstream * Graph_fdebug = NULL ) ;
ComputingNode( CORBA::ORB_ptr ORB ,
SALOME_NamingService* ptrNamingService ,
const SALOME_ModuleCatalog::Service& NodeService ,
const long X ,
const long Y ,
int * Graph_prof_debug = NULL ,
- ostream * Graph_fdebug = NULL ) ;
+ ofstream * Graph_fdebug = NULL ) ;
virtual ~ComputingNode() ;
SALOME_NamingService * NamingService() const {
const GraphBase::ListOfPythonFunctions PythonFunctions ,
int X , int Y ) const ;
- void NodeInfo(ostrstream & s) const ;
+ void NodeInfo(ostream & s) const ;
void ListLinks(ostream &f ) const ;
CORBA::ORB_ptr ORB ,
SALOME_ModuleCatalog::Service aService ,
int * Graph_prof_debug ,
- ostream * Graph_fdebug ) {
-// cout << "GraphBase::DataNode::DataService : DataFlowPortsOfNode of "
-// << aService.ServiceName << endl ;
-// DefPortsOfNode( aService , aService.ServiceName ) ;
+ ofstream * Graph_fdebug ) {
+ cdebug << "GraphBase::DataNode::DataService : DataFlowPortsOfNode of "
+ << aService.ServiceName << endl ;
DefPortsOfNode( ORB , aService , NamePtr() , Kind() ,
-// true , false , false , false ,
Graph_prof_debug , Graph_fdebug ) ;
if ( _Created )
aReversedService.ServiceinParameter = aService.ServiceoutParameter ;
aReversedService.ServiceoutParameter = aService.ServiceinParameter ;
_DataFlowDataPorts = new PortsOfNode() ;
-// cout << "GraphBase::DataNode::DataService : Mirrored DataFlowPortsOfNode of "
-// << aReversedService.ServiceName << endl ;
+ cdebug << "GraphBase::DataNode::DataService : Mirrored DataFlowPortsOfNode of "
+ << aReversedService.ServiceName << endl ;
_DataFlowDataPorts->DefPortsOfNode( ORB , aReversedService , NamePtr() ,
Kind() ,
-// true , false , false , false ,
Graph_prof_debug , Graph_fdebug ) ;
_Created = true ;
}
return ierr ;
}
-void GraphBase::DataNode::ListDatas(ostrstream & f ) const {
+void GraphBase::DataNode::ListDatas(ostream & f ) const {
_DataFlowDataPorts->ListPorts( f , false ) ;
}
-void GraphBase::DataNode::DataNodeInfo(ostrstream & s ) const {
- int i ;
+void GraphBase::DataNode::DataNodeInfo(ostream & s ) const {
s << *this ;
s << "Ports :" << endl ;
ListPorts( s , true ) ;
void DataService( CORBA::ORB_ptr ORB ,
const SALOME_ModuleCatalog::Service aService ,
int * Graph_prof_debug ,
- ostream * Graph_fdebug ) ;
+ ofstream * Graph_fdebug ) ;
int CheckDataServerNodes() const ;
InPort * GetChangeOutDataNodePort( const char * DataFlowOutPortName ) {
return _DataFlowDataPorts->GetChangeInPort( DataFlowOutPortName ) ; } ;
- void DataNodeInfo(ostrstream & s ) const ;
+ void DataNodeInfo(ostream & s ) const ;
- void ListDatas(ostrstream & f) const ;
+ void ListDatas(ostream & f) const ;
// bool SaveXML( ostream &f , char *Tabs ,
bool SaveXML( QDomDocument & Graph , QDomElement & info ,
CORBA::Any InitialValue ;
cdebug << "InitialValues " << NodeName() << " " << PortName() << " " << PortType()
<< " : " ;
- if ( !strcmp( Type , "string" ) ) {
+ if ( !strcmp( Type , "" ) ) {
+ cdebug << "void" << endl ;
+ InitialValue <<= (void *) NULL ;
+ }
+ else if ( !strcmp( Type , "string" ) ) {
cdebug << "string" << endl ;
InitialValue <<= (char *) NULL ;
}
- else if ( !strcmp( Type , "double" ) ) {
- cdebug << "double" << endl ;
- InitialValue <<= 0. ;
+ else if ( !strcmp( Type , "boolean" ) ) {
+ cdebug << "boolean" << endl ;
+ InitialValue <<= (long ) 0 ;
+ }
+ else if ( !strcmp( Type , "char" ) ) {
+ cdebug << "char" << endl ;
+ InitialValue <<= (long ) 0 ;
+ }
+ else if ( !strcmp( Type , "short" ) ) {
+ cdebug << "short" << endl ;
+ InitialValue <<= (long ) 0 ;
+ }
+ else if ( !strcmp( Type , "int" ) ) {
+ cdebug << "long" << endl ;
+ InitialValue <<= (long ) 0 ;
}
else if ( !strcmp( Type , "long" ) ) {
cdebug << "long" << endl ;
InitialValue <<= (long ) 0 ;
}
- else if ( !strcmp( Type , "objref" ) ) {
+ else if ( !strcmp( Type , "float" ) ) {
+ cdebug << "float" << endl ;
+ InitialValue <<= (double ) 0. ;
+ }
+ else if ( !strcmp( Type , "double" ) ) {
+ cdebug << "double" << endl ;
+ InitialValue <<= (double ) 0. ;
+ }
+ else { // Default
cdebug << "objref" << endl ;
// InitialValue.replace(CORBA::_tc_Object, NULL);
InitialValue <<= CORBA::Object::_nil() ;
}
- else {
- cdebug << "InitialValues ERROR (other) " << Type << endl ;
- InitialValue <<= (long ) 0 ;
- }
+// else {
+// cdebug << "InitialValues ERROR (other) " << Type << endl ;
+// InitialValue <<= (long ) 0 ;
+// }
_InitialValue = new CORBA::Any( InitialValue ) ;
_Value = &_InitialValue ;
}
// << endl ;
delete _theValue ;
- _theValue = aDataValue ;
- *_Value = aDataValue ;
-// Done( true ) ;
-#if 0
- cdebug << "NewValue " << NodeName() << " " << PortName() << " " << PortType()
- << " : " << _Value << " *_Value " << *_Value << " " ;
- switch (_theValue->type()->kind()) {
- case CORBA::tk_string: {
+ string _Type = CORBA::string_dup( GetServicesParameter().Parametertype ) ;
+ const char * Type = _Type.c_str() ;
+ _Value = &_theValue ;
+// cdebug << "NewValue " << NodeName() << " " << PortName() << " " << PortType()
+// << " : " << aDataValue << " kind " << aDataValue->type()->kind() << " " ;
+ switch (aDataValue->type()->kind()) { // Input Value
+ case CORBA::tk_string: { // Input string Value
char * t;
- *_theValue >>= t;
- cdebug << "Value( " << t << ") (string)";
+ *aDataValue >>= t;
+ cdebug << t << " (string)" ;
+ if ( !strcmp( Type , "string" ) ) { // SuperVision Value
+ _theValue = aDataValue ;
+ *_theValue >>= t;
+// cdebug << " == Value( " << t << ") (string)";
+ }
+ else {
+ CORBA::Any * theValue = new CORBA::Any() ;
+ if ( !strcmp( Type , "boolean" ) || !strcmp( Type , "char" ) ||
+ !strcmp( Type , "short" ) || !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) {
+ long l ;
+ sscanf( t , "%ld" , &l ) ;
+ *theValue <<= l ;
+ *theValue >>= l;
+// cdebug << " --> Value( " << l << ") (long) kind " << theValue->type()->kind() ;
+ }
+ else if ( !strcmp( Type , "float" ) || !strcmp( Type , "double" ) ) {
+ double d ;
+ sscanf( t , "%lf" , &d ) ;
+ *theValue <<= d ;
+ *theValue >>= d;
+// cdebug << " --> Value( " << d << ") (double) kind " << theValue->type()->kind() ;
+ }
+ else { // Default
+ CORBA::Object_ptr ObjRef ;
+ try {
+ ObjRef = StringToObject( t ) ;
+ *theValue <<= ObjRef ;
+ }
+ catch( ... ) {
+ *theValue <<= CORBA::Object::_nil() ;
+ }
+ *theValue >>= ObjRef ;
+// cdebug << " --> Value( " << ObjectToString( ObjRef ) << ") (object reference) kind "
+// << theValue->type()->kind() ;
+ }
+ _theValue = theValue ;
+ *_Value = theValue ;
+ }
break;
}
- case CORBA::tk_double: {
- double d;
- *_theValue >>= d;
- cdebug << "Value( " << d << ") (double)";
+ case CORBA::tk_long: { // Input long Value
+ long l;
+ *aDataValue >>= l;
+// cdebug << "Value( " << l << ") (long)";
+ if ( !strcmp( Type , "boolean" ) || !strcmp( Type , "char" ) ||
+ !strcmp( Type , "short" ) || !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) { // SuperVision Value
+ _theValue = aDataValue ;
+ *_Value = aDataValue ;
+ *_theValue >>= l;
+// cdebug << " == Value( " << l << ") (long)";
+ }
+ else {
+ CORBA::Any * theValue = new CORBA::Any() ;
+ if ( !strcmp( Type , "string" ) ) {
+ char t[40] ;
+ sprintf( t , "%ld" , l ) ;
+ *theValue <<= t ;
+ char *tt ;
+ *theValue >>= tt ;
+// cdebug << " --> Value( " << t << ") (string) kind " << theValue->type()->kind() ;
+ }
+ else if ( !strcmp( Type , "float" ) || !strcmp( Type , "double" ) ) {
+ double d = l ;
+ *theValue <<= d ;
+ *theValue >>= d ;
+// cdebug << " --> Value( " << d << ") (double) kind " << theValue->type()->kind() ;
+ }
+ else { // Default
+ CORBA::Object_ptr ObjRef ;
+ *theValue <<= CORBA::Object::_nil() ;
+ *theValue >>= ObjRef ;
+// cdebug << " --> Value( " << ObjectToString( ObjRef ) << ") (object reference) kind "
+// << theValue->type()->kind() ;
+ }
+ _theValue = theValue ;
+ *_Value = theValue ;
+ }
break;
}
- case CORBA::tk_long: {
- long l;
- *_theValue >>= l;
- cdebug << "Value( " << l << ") (long)";
+ case CORBA::tk_double: { // Input double Value
+ double d;
+ *aDataValue >>= d;
+// cdebug << "Value( " << d << ") (double)";
+ if ( !strcmp( Type , "float" ) || !strcmp( Type , "double" ) ) { // SuperVision Value
+ _theValue = aDataValue ;
+ *_Value = aDataValue ;
+ *_theValue >>= d;
+// cdebug << " == Value( " << d << ") (double)";
+ }
+ else {
+ CORBA::Any * theValue = new CORBA::Any() ;
+ if ( !strcmp( Type , "string" ) ) {
+ char t[40] ;
+ sprintf( t , "%lf" , d ) ;
+ *theValue <<= t ;
+ char *tt ;
+ *theValue >>= tt ;
+// cdebug << " --> Value( " << t << ") (string) kind " << theValue->type()->kind() ;
+ }
+ else if ( !strcmp( Type , "boolean" ) || !strcmp( Type , "char" ) ||
+ !strcmp( Type , "short" ) || !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) {
+ long l = (long ) d ;
+ *theValue <<= l ;
+ *theValue >>= l;
+// cdebug << " --> Value( " << l << ") (long) kind " << theValue->type()->kind() ;
+ }
+ else { // Default
+ CORBA::Object_ptr ObjRef ;
+ *theValue <<= CORBA::Object::_nil() ;
+ *theValue >>= ObjRef ;
+// cdebug << " --> Value( " << ObjectToString( ObjRef ) << ") (object reference) kind "
+// << theValue->type()->kind() ;
+ }
+ _theValue = theValue ;
+ *_Value = theValue ;
+ }
break;
}
- case CORBA::tk_objref: {
- cdebug << "Value( " << ") (object reference)";
+ case CORBA::tk_objref: { // Input objref Value
+ CORBA::Object_ptr obj ;
+ *aDataValue >>= obj;
+// cdebug << "Value( " << ObjectToString( obj ) << ") (object reference)";
+ if ( strcmp( Type , "string" ) &&
+ strcmp( Type , "boolean" ) && strcmp( Type , "char" ) &&
+ strcmp( Type , "short" ) && strcmp( Type , "long" ) &&
+ strcmp( Type , "double" ) ) { // SuperVision Default Value
+ _theValue = aDataValue ;
+ *_Value = aDataValue ;
+ *_theValue >>= obj;
+// cdebug << " == Value( " << ObjectToString( obj ) << ") (object reference)";
+ }
+ else {
+ CORBA::Any * theValue = new CORBA::Any() ;
+ if ( !strcmp( Type , "string" ) ) {
+ *theValue <<= ObjectToString( obj ) ;
+ *theValue >>= obj ;
+// cdebug << " --> Value( " << ObjectToString( obj ) << ") (string) kind " << theValue->type()->kind() ;
+ }
+ else if ( !strcmp( Type , "boolean" ) || !strcmp( Type , "char" ) ||
+ !strcmp( Type , "short" ) || !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) {
+ long l = (long ) obj ;
+ *theValue <<= l ;
+ *theValue >>= l;
+// cdebug << " --> Value( " << l << ") (long) kind " << theValue->type()->kind() ;
+ }
+ else if ( !strcmp( Type , "float" ) || !strcmp( Type , "double" ) ) {
+ double d = (double ) 0. ;
+ *theValue <<= d ;
+ *theValue >>= d;
+// cdebug << " --> Value( " << d << ") (double) kind " << theValue->type()->kind() ;
+ }
+ _theValue = theValue ;
+ *_Value = theValue ;
+ }
break;
}
default: {
- cdebug << "Value" << " (other(tk_string,tk_double,tk_long,tk_objref)) ERROR";
+ cdebug << "Value" << " (other(tk_string,tk_double,tk_long,tk_objref)) ERROR kind "
+ << aDataValue->type()->kind() ;
break;
}
}
cdebug << endl ;
-#endif
if ( pthread_mutex_unlock( &_MutexWait ) ) {
perror( "unlock DataValue" ) ;
exit( 0 ) ;
const CORBA::Any *const Value = *_Value ;
CORBA::Any * theValue ;
// cdebug << pthread_self() << " Value " << NodeName() << " " << PortName() << " "
-// << PortType() << " _Value " << _Value << " *_Value " << *_Value << " kind "
-// << Value->type()->kind() << " :" << endl ;
+// << PortType() << " _Value " << _Value << " *_Value " << *_Value << " Value->type "
+// << Value->type() ;
+ if ( Value->type() ) {
+// cdebug << " kind " << Value->type()->kind() << " :" << endl ;
+ }
+ else {
+// cdebug << " Null" << endl ;
+ }
if ( Done() ) {
theValue = new CORBA::Any( *Value ) ;
switch ( theValue->type()->kind() ) {
break;
}
default: {
- cdebug << "GraphBase::DataPort::Value() : "
- << "(other(tk_string,tk_double,tk_long,tk_objref)) ERROR" << endl ;
+ cdebug << "GraphBase::DataPort::Value() : " << NodeName() << "( " << PortName() << " ) " << PortType()
+ << " (other(tk_string,tk_double,tk_long,tk_objref)) ERROR" << endl ;
break;
}
}
// $Header:
using namespace std;
-#include <strstream>
-#include <iostream>
+//#include <sstream>
+//#include <iostream>
#include "DataFlowBase_EndOfLoopNode.hxx"
const long X ,
const long Y ,
int * Graph_prof_debug ,
- ostream * Graph_fdebug ) :
+ ofstream * Graph_fdebug ) :
GraphBase::GOTONode::GOTONode( ORB , ptrNamingService , FuncName ,
anInitPythonFunction ,
NodeName , akind , NodeFirstCreation ,
const long X ,
const long Y ,
int * Graph_prof_debug = NULL ,
- ostream * Graph_fdebug = NULL ) ;
+ ofstream * Graph_fdebug = NULL ) ;
virtual ~EndOfLoopNode() ;
};
// $Header:
using namespace std;
-#include <strstream>
-#include <iostream>
+//#include <sstream>
+//#include <iostream>
#include "DataFlowBase_EndOfSwitchNode.hxx"
const long X ,
const long Y ,
int * Graph_prof_debug ,
- ostream * Graph_fdebug ) :
+ ofstream * Graph_fdebug ) :
GraphBase::GOTONode::GOTONode( ORB , ptrNamingService , FuncName ,
aPythonFunction ,
NodeName , akind , NodeFirstCreation ,
const long X ,
const long Y ,
int * Graph_prof_debug = NULL ,
- ostream * Graph_fdebug = NULL ) ;
+ ofstream * Graph_fdebug = NULL ) ;
virtual ~EndOfSwitchNode() ;
};
// $Header:
using namespace std;
-#include <strstream>
-#include <iostream>
+//#include <sstream>
+//#include <iostream>
#include "DataFlowBase_FactoryNode.hxx"
static void InitFields( char * &_ComponentName ,
char * &_InterfaceName ,
char * &_Computer ) {
- time_t T = time(NULL);
- struct tm * Tm = localtime(&T);
-
_ComponentName = NULLSTRING ;
_InterfaceName = NULLSTRING ;
SALOME_NamingService* ptrNamingService ,
const char * aDataFlowName ,
int * Graph_prof_debug ,
- ostream * Graph_fdebug ) :
+ ofstream * Graph_fdebug ) :
GraphBase::ComputingNode::ComputingNode( ORB , ptrNamingService , aDataFlowName ,
Graph_prof_debug , Graph_fdebug ) {
}
GraphBase::FactoryNode::FactoryNode( CORBA::ORB_ptr ORB ,
- SALOME_NamingService* ptrNamingService ,
+ SALOME_NamingService * ptrNamingService ,
const SALOME_ModuleCatalog::Service& aService ,
- const char *ComponentName ,
- const char* InterfaceName ,
- const char *NodeName ,
+ const char * ComponentName ,
+ const char * InterfaceName ,
+ const char * NodeName ,
const SUPERV::KindOfNode akind ,
const SUPERV::SDate NodeFirstCreation ,
const SUPERV::SDate NodeLastModification ,
const long X ,
const long Y ,
int * Graph_prof_debug ,
- ostream * Graph_fdebug ) :
+ ofstream * Graph_fdebug ) :
GraphBase::ComputingNode::ComputingNode( ORB , ptrNamingService , aService ,
NodeName , akind ,
NodeFirstCreation , NodeLastModification ,
_InterfaceName = new char[strlen(InterfaceName)+1];
strcpy(_InterfaceName , InterfaceName ) ;
- if ( NodeComputer ) {
+ if ( NodeComputer != NULLSTRING) {
_Computer = new char[ strlen( NodeComputer ) + 1 ] ;
strcpy( _Computer , NodeComputer ) ;
}
- else
+ else {
_Computer = FACTORYSERVER ;
+ }
- cdebug_in << "GraphBase::FactoryNode::FactoryNode(" << aService.ServiceName << ","
- << ComponentName << "," << Name() << "," << akind
- << "," << NodeComputer << "," << Comment() << ")" << endl;
+ cdebug_in << "GraphBase::FactoryNode::FactoryNode( '" << aService.ServiceName << "','"
+ << _ComponentName << "','" << Name() << "'," << akind << ",'" << _Computer << "'" << endl;
cdebug << "GraphBase::FactoryNode::FactoryNode " << this
<< " _ComponentName "
<< (void *) _InterfaceName << " '" << _InterfaceName << "' _Name "
<< (void *) Name() << " '" << Name() << "' _Computer "
<< (void *) _Computer << " " << _Computer << " _Comment "
- << (void *) Comment() << " " << Comment() << " "
- << " KindOfNode " << Kind()
+ << (void *) Comment() << " '" << Comment() << " "
+ << "' KindOfNode " << Kind()
<< " ServiceName " << ServiceName() << " In(" << ServiceInParameter().length()
<< ") Out(" << ServiceOutParameter().length() << ")" << endl ;
SALOME_NamingService* ptrNamingService ,
const char * DataFlowName ,
int * Graph_prof_debug = NULL ,
- ostream * Graph_fdebug = NULL ) ;
+ ofstream * Graph_fdebug = NULL ) ;
FactoryNode( CORBA::ORB_ptr ORB ,
SALOME_NamingService* ptrNamingService ,
const SALOME_ModuleCatalog::Service& NodeService ,
const long X ,
const long Y ,
int * Graph_prof_debug = NULL ,
- ostream * Graph_fdebug = NULL ) ;
+ ofstream * Graph_fdebug = NULL ) ;
virtual ~FactoryNode() ;
Engines::Container_var Container() const { return _Container ; } ;
// $Header:
using namespace std;
-#include <strstream>
-#include <iostream>
+//#include <sstream>
+//#include <iostream>
#include "DataFlowBase_GOTONode.hxx"
const long X ,
const long Y ,
int * Graph_prof_debug ,
- ostream * Graph_fdebug ) :
+ ofstream * Graph_fdebug ) :
GraphBase::InLineNode::InLineNode( ORB , ptrNamingService , FuncName , aPythonFunction ,
NodeName , akind , NodeFirstCreation ,
NodeLastModification , NodeEditorRelease ,
const long X ,
const long Y ,
int * Graph_prof_debug = NULL ,
- ostream * Graph_fdebug = NULL ) ;
+ ofstream * Graph_fdebug = NULL ) ;
virtual ~GOTONode() ;
void CoupledNode( InLineNode * aCoupledNode ) {
const char *DataFlowName ,
const char * DebugFileName ) :
DataNode( ORB ,ptrNamingService , DataFlowName ) {
- cdebug << "GraphBase::Graph::Graph" << endl ;
+ Set_prof_debug( ORB , DebugFileName ) ;
+ cdebug << "GraphBase::Graph::Graph( " << DataFlowName << ")" << endl ;
_Orb = CORBA::ORB::_duplicate( ORB ) ;
_GraphNodesSize = 0 ;
- Set_prof_debug( ORB , DebugFileName ) ;
}
GraphBase::Graph::Graph( 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 ,
- const char * DebugFileName ) :
+ 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 ,
+ const char * DebugFileName ) :
DataNode( ORB , ptrNamingService , DataFlowService ,
DataFlowName , DataFlowkind ,
DataFlowFirstCreation , DataFlowLastModification ,
if ( DebugFileName ) {
_Graph_fdebug = new ofstream( DebugFileName );
MESSAGE( endl << "Trace redirected to file " << DebugFileName << endl)
+ SetDebug( ORB , &_Graph_prof_debug , _Graph_fdebug ) ;
}
- else
- _Graph_fdebug = &(std::cerr);
- SetDebug( ORB , &_Graph_prof_debug , _Graph_fdebug ) ;
+ cdebug << "GraphBase::Graph::Set_prof_debug redirect Trace to file " << DebugFileName << endl ;
}
GraphBase::SNode * GraphBase::Graph::GetInfo() const {
// Function : GetLinks
// Purpose : get a links list
//----------------------------------------------------------------------
-GraphBase::ListOfLinks * GraphBase::Graph::GetLinks() const {
+GraphBase::ListOfLinks * GraphBase::Graph::GetLinks(bool AllLinks ) const {
GraphBase::ListOfLinks * _list_links =
new GraphBase::ListOfLinks;
int ind = 0 ;
int k ;
for ( k = 0 ; k < GraphNodesSize() ; k++ ) {
- GraphBase::ComputingNode * aNode = GraphNodes( k ) ;
+ GraphBase::ComputingNode * fromNode = GraphNodes( k ) ;
int i ;
- for ( i = 0 ; i < aNode->GetNodeOutPortsSize() ; i++ ) {
- const GraphBase::OutPort* fromPort = aNode->GetNodeOutPort( i ) ;
-// cout << "GraphBase::Graph::GetLinks " << aNode->Name() << " "
-// << fromPort->PortName() << " " << fromPort->IsPortConnected()
-// << " " << fromPort->InPortsSize() << endl ;
- if ( fromPort->IsPortConnected() ) {
+ for ( i = 0 ; i < fromNode->GetNodeOutPortsSize() ; i++ ) {
+ const GraphBase::OutPort* fromPort = fromNode->GetNodeOutPort( i ) ;
+// if ( fromPort->IsPortConnected() && ( !fromPort->IsLoop() || AllLinks ) ) {
int j ;
for ( j = 0 ; j < fromPort->InPortsSize() ; j++ ) {
- _list_links->resize( ind+1 );
- (*_list_links)[ind].FromNodeName = CORBA::string_dup( aNode->Name() );
- (*_list_links)[ind].FromServiceParameterName = fromPort->GetServicesParameter().Parametername;
const GraphBase::InPort* toPort = fromPort->InPorts( j ) ;
- (*_list_links)[ind].ToNodeName = CORBA::string_dup( toPort->NodeName() );
- (*_list_links)[ind].ToServiceParameterName = toPort->GetServicesParameter().Parametername;
- (*_list_links)[ind].aLinkValue = *fromPort->Value() ;
- if ( toPort->IsEndSwitch() ) {
- (*_list_links)[ind++].aListOfCoords = *(fromPort->Coords()) ;
+// Desole pour ce cast mais avec les maps difficile de faire const ...
+ const GraphBase::ComputingNode * toNode = ((GraphBase::Graph * ) this)->GetGraphNode( toPort->NodeName() ) ;
+ if ( !(fromPort->IsLoop() && toPort->IsLoop() ) || AllLinks ) {
+ cdebug << "GraphBase::Graph::GetLinks " << fromNode->Name() << " ("
+ << fromPort->PortName() << " ) IsPortConnected" << fromPort->IsPortConnected()
+ << " --> " << toNode->Name() << "( " << toPort->PortName() << " ) "
+ << " " << fromPort->InPortsSize() << " ports" << endl ;
+ _list_links->resize( ind+1 );
+ (*_list_links)[ind].FromNodeName = CORBA::string_dup( fromNode->Name() );
+ (*_list_links)[ind].FromServiceParameterName = fromPort->GetServicesParameter().Parametername;
+ (*_list_links)[ind].ToNodeName = CORBA::string_dup( toPort->NodeName() );
+ (*_list_links)[ind].ToServiceParameterName = toPort->GetServicesParameter().Parametername;
+ (*_list_links)[ind].aLinkValue = *fromPort->Value() ;
+ if ( toPort->IsEndSwitch() ) {
+ (*_list_links)[ind++].aListOfCoords = *(fromPort->Coords()) ;
+ }
+ else {
+ (*_list_links)[ind++].aListOfCoords = *(toPort->Coords()) ;
+ }
}
else {
- (*_list_links)[ind++].aListOfCoords = *(toPort->Coords()) ;
+ cdebug << "GraphBase::Graph::GetLinks " << fromNode->Name() << " "
+ << fromPort->PortName() << " ) IsPortConnected" << fromPort->IsPortConnected()
+ << " --> " << toNode->Name() << "( " << toPort->PortName() << " ) "
+ << " " << fromPort->InPortsSize() << " ports ignored" << endl ;
}
}
- }
+// }
}
}
const char* ToServiceParameterName ,
const CORBA::Any aValue ) {
bool RetVal ;
- int index ;
+// int index ;
cdebug_in << "GraphBase::Graph::AddLink(" << FromNodeName << "("
<< FromServiceParameterName << ") ---> " << ToNodeName << "("
<< ToServiceParameterName << ") )" << endl;
GraphBase::OutPort *fromPort ,
GraphBase::ComputingNode *toNode ,
GraphBase::InPort *toPort ) {
- bool RetVal ;
+// bool RetVal ;
if ( !fromNode ) {
cdebug << "AddLink fromNode not found." << endl ;
const char* FromServiceParameterName ,
const char* ToNodeName ,
const char* ToServiceParameterName ) {
- cdebug_in << "GraphBase::Graph::RemoveLink to " << ToNodeName << "("
- << ToServiceParameterName << ")" << endl;
+ cdebug_in << "GraphBase::Graph::RemoveLink from " << FromNodeName << "(" << FromServiceParameterName << ")"
+ << " to " << ToNodeName << "(" << ToServiceParameterName << ")" << endl;
bool RetVal = false ;
GraphBase::ComputingNode * toNode = GetChangeGraphNode( ToNodeName ) ;
if ( toNode ) {
anInPort->RemoveOutPort() ;
const char * FromNodeName = anOutPort->NodeName() ;
GraphBase::ComputingNode * fromNode = GetChangeGraphNode( FromNodeName ) ;
- if ( fromNode ) {
- fromNode->RemoveLink( toNode ) ;
- }
- if ( fromNode->IsSwitchNode() ) {
- anOutPort->Kind( SUPERV::InLineParameter ) ;
+ if ( RetVal ) {
+ if ( fromNode ) {
+ fromNode->RemoveLink( toNode ) ;
+ }
+ if ( fromNode->IsSwitchNode() ) {
+ 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 ;
}
-bool GraphBase::Graph::ChangeInputData( const char* ToNodeName ,
- const char* ToServiceParameterName ,
+bool GraphBase::Graph::ChangeInputData( const char * ToNodeName ,
+ const char * ToServiceParameterName ,
const CORBA::Any aValue ) {
bool RetVal = false ;
- cdebug_in << "GraphBase::Graph::ChangeInputData(" << ToNodeName << ","
- << ToServiceParameterName << " Any " ;
+ cdebug_in << "GraphBase::Graph::ChangeInputData( '" << ToNodeName << "' , '"
+ << ToServiceParameterName << "' , Any " ;
switch (aValue.type()->kind()) {
case CORBA::tk_string:
char * t;
}
}
else {
- cdebug << "ChangeInputData Node not found" << endl ;
+ cdebug << "ChangeInputData Node not found : " << ToNodeName << endl ;
}
cdebug_out << "GraphBase::Graph::ChangeInputData" << endl;
bool GraphBase::Graph::CreateService() {
cdebug_in << "GraphBase::Graph::CreateService" << endl;
-
+ bool RetVal = true ;
SALOME_ModuleCatalog::Service aService ;
int i , j ;
- GraphBase::ComputingNode * iN ;
+ GraphBase::ComputingNode * aToNode ;
int dostore ;
int innbr ;
int outnbr ;
innbr = 0 ;
outnbr = 0 ;
for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
- iN = GraphNodes( i ) ;
- for ( j = 0 ; j < iN->GetNodeInPortsSize() ; j++ ) {
- GraphBase::InPort *anInPort = iN->GetChangeNodeInPort(j) ;
- if ( !anInPort->IsConnected() && !anInPort->IsGate() ) {
-// !anInPort->IsLoop() ) {
-// if ( !anInPort->IsGate() && !anInPort->IsConnected() &&
-// !( iN->IsLoopNode() && anInPort->IsBus() && anInPort->IsParam() )) {
+ 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 ;
+ if ( anInPort->IsConnected() && anInPort->GetOutPort() ) {
+ GraphBase::ComputingNode * aFromNode = GetChangeGraphNode( anInPort->GetOutPort()->NodeName() ) ;
+ if ( aFromNode->IsEndLoopNode() && ((GraphBase::EndOfLoopNode * ) aFromNode)->CoupledNode() == aToNode ) {
+ isfromcouplednode = true ;
+ }
+ }
+ if ( !anInPort->IsGate() && !anInPort->IsLoop() &&
+ ( !anInPort->IsConnected() || ( anInPort->IsConnected() && isfromcouplednode ) ) ) {
if ( dostore == 0 ) {
- cdebug << "CreateService " << iN->Name() << " Input port "
- << anInPort->PortName() << " is NOT connected " ;
+ cdebug << "CreateService " << aToNode->Name() << " Input port "
+ << anInPort->PortName() << " " << anInPort->Kind() << " is NOT connected " ;
if ( anInPort->GetOutPort() ) {
- cdebug << *(anInPort->GetOutPort()) ;
+ cdebug << "DataConnected from " << *(anInPort->GetOutPort() ) ;
}
cdebug << endl ;
innbr += 1 ;
aService.ServiceinParameter[innbr++].Parametername = CORBA::string_dup( anInPort->NodePortName() ) ;
}
}
+ else {
+ cdebug << "CreateService " << aToNode->Name() << " Input port " << anInPort->PortName() ;
+ if ( anInPort->IsConnected() ) {
+ cdebug << " is connected " ;
+ }
+ else {
+ cdebug << " is NOT connected " ;
+ }
+ if ( anInPort->IsGate() ) {
+ cdebug << " IsGate " ;
+ }
+ if ( anInPort->GetOutPort() ) {
+ cdebug << "DataConnected from " << *(anInPort->GetOutPort()) ;
+ }
+ else {
+ cdebug << "NOT DataConnected" ;
+ }
+ cdebug << endl ;
+ }
}
- if ( !iN->IsGOTONode() ) {
- for ( j = 0 ; j < iN->GetNodeOutPortsSize() ; j++ ) {
- GraphBase::OutPort *anOutPort = iN->GetChangeNodeOutPort(j) ;
+ 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
+ if ( !aFromNode->IsGOTONode() ) {
if ( !anOutPort->IsGate() &&
-//!anOutPort->IsLoop() &&
-// !( iN->IsEndLoopNode() && anOutPort->IsBus() ) &&
( anOutPort->IsNotConnected() || anOutPort->IsDataConnected() ) ) {
if ( dostore == 0 ) {
+ cdebug << "CreateService " << aFromNode->Name() << " Output port "
+ << anOutPort->PortName() << endl ;
outnbr += 1 ;
}
else {
// Restore input datas :
for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
-// iN = (GraphEditor::InNode * ) GraphNodes( i ) ;
- iN = GraphNodes( i ) ;
- for ( j = 1 ; j < iN->GetNodeInPortsSize() ; j++ ) {
- GraphBase::InPort *anInPort = iN->GetChangeNodeInPort(j) ;
+ aToNode = GraphNodes( i ) ;
+ for ( j = 0 ; j < aToNode->GetNodeInPortsSize() ; j++ ) {
+ GraphBase::InPort *anInPort = aToNode->GetChangeNodeInPort(j) ;
if ( anInPort->IsDataConnected() ) {
-// GraphBase::Graph::AddInputData( anInPort->NodeName() ,
AddInputData( anInPort->NodeName() ,
anInPort->PortName() ,
anInPort->GetOutPort()->ValuePtr() ) ;
}
cdebug_out << "GraphBase::Graph::CreateService" << endl;
- return true ;
+ return RetVal ;
}
bool GraphBase::Graph::InLineServices() {
<< _CnxInPortsNumber[ i ] << endl ;
if ( !_Sorted[ i ] && _CnxInPortsNumber[ i ] == 0 ) {
// All inputs of GraphNodes( i ) are available
- if ( _NodesNumber.size() != _LevelsNumber+1 ) {
+ if ( (int ) _NodesNumber.size() != _LevelsNumber+1 ) {
_NodesNumber.resize( _LevelsNumber+1 ) ;
_SortedNodes.resize( _LevelsNumber+1 ) ;
_NodesNumber[ _LevelsNumber ] = -1 ;
cdebug << "GraphExecutor::GraphControl::ComputingNodes ()" << endl;
// list<GraphEditor::Node *> aComputingNodesList = _G->ComputingNodesList() ;
-// list<GraphEditor::Node *>::iterator iN = aComputingNodesList.begin();
+// list<GraphEditor::Node *>::iterator aNode = aComputingNodesList.begin();
// GraphEditor::Port * iP;
-// for (iN = _G->ComputingNodesList().begin(); iN !=_G->ComputingNodesList().end(); iN++) {
-// while ( iN != aComputingNodesList.end() ) {
+// for (aNode = _G->ComputingNodesList().begin(); aNode !=_G->ComputingNodesList().end(); aNode++) {
+// while ( aNode != aComputingNodesList.end() ) {
int i ;
- GraphBase::ComputingNode * iN ;
+ GraphBase::ComputingNode * aNode ;
for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
- iN = GraphNodes( i ) ;
+ aNode = GraphNodes( i ) ;
// Tous les ports d'entree de tous les noeuds de calcul sont bien connectes
// Enregistrement eventuel dans la liste des noeuds "tete" de graphe
-// if ((*iN)->GetNodeInPortsSize() == 0)
-// _headNodes.push_front(*iN);
+// if ((*aNode)->GetNodeInPortsSize() == 0)
+// _headNodes.push_front(*aNode);
int j ;
- for ( j = 1; j < iN->GetNodeInPortsSize() ; j++ ) {
- const GraphBase::InPort *iP = iN->GetNodeInPort(j);
+ for ( j = 1 ; j < aNode->GetNodeInPortsSize() ; j++ ) {
+ const GraphBase::InPort *iP = aNode->GetNodeInPort(j);
if ( !iP->IsConnected() ){
cdebug << "Le port d'entree " << iP->PortName()
- << " du noeud de calcul " << iN->Name() << " du graphe "
+ << " du noeud de calcul " << aNode->Name() << " du graphe "
<< Name() << " n'est pas connecte "<< endl;
RetVal = false ;
};
// Tous les noeuds de calcul ont au moins un port de sortie connecte
bool oneOutPortConnected = false;
- for ( j = 1; j < iN->GetNodeOutPortsSize() ; j++) {
- const GraphBase::OutPort *iP = iN->GetNodeOutPort(j);
+ for ( j = 1 ; j < aNode->GetNodeOutPortsSize() ; j++) {
+ const GraphBase::OutPort *iP = aNode->GetNodeOutPort(j);
if ( iP->IsPortConnected() || iP->IsDataConnected() ){
oneOutPortConnected = true ;
// break;
}
else {
cdebug << "Le port de sortie " << iP->PortName()
- << " du noeud de calcul " << iN->Name() << " du graphe "
+ << " du noeud de calcul " << aNode->Name() << " du graphe "
<< Name() << " n'est pas connecte "<< endl;
RetVal = false ;
}
};
if (!oneOutPortConnected) {
- cdebug << "Le noeud de calcul " << iN->Name() << " du graphe "
+ cdebug << "Le noeud de calcul " << aNode->Name() << " du graphe "
<< Name() << " n'a aucun port de sortie connecte "<< endl;
// _computingError.push_front(2);
}
return RetVal ;
}
+bool GraphBase::Graph::LinkLoopNodes(bool & NewLink ) {
+ bool RetVal = true ;
+ NewLink = false ;
+ int i , j ;
+ cdebug_in << "GraphBase::Graph::LinkLoopNodes()" << endl;
+ for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
+ GraphBase::ComputingNode * aNode = GraphNodes( i ) ;
+ if ( aNode->IsLoopNode() ) {
+ GraphBase::LoopNode * aLoopNode = (GraphBase::LoopNode * ) aNode ;
+ for ( j = 0 ; j < aLoopNode->GetNodeInPortsSize() ; j++ ) {
+ GraphBase::InPort *anInPort = aLoopNode->GetChangeNodeInPort(j) ;
+ if ( !anInPort->IsGate() && !anInPort->IsConnected() && !anInPort->IsDataConnected() ) {
+ if ( !AddLink( aLoopNode->CoupledNode() , aLoopNode->CoupledNode()->GetChangeNodeOutPort( j ) ,
+ aLoopNode , anInPort ) ) {
+ cdebug << "GraphBase::Graph::CreateService AddLink ERROR " << aLoopNode->CoupledNode()->Name()
+ << "( " << aLoopNode->CoupledNode()->GetChangeNodeOutPort( j )->PortName() << " ) --> "
+ << aLoopNode->Name() << "( " << anInPort->PortName() << " )" << endl ;
+ RetVal = false ;
+ }
+ else {
+ NewLink = true ;
+ }
+ }
+ }
+ for ( j = 0 ; j < aLoopNode->CoupledNode()->GetNodeInPortsSize() ; j++ ) {
+ GraphBase::InPort *anInPort = aLoopNode->CoupledNode()->GetChangeNodeInPort( j ) ;
+ if ( !anInPort->IsConnected() ) {
+ if ( !AddLink( aLoopNode , aLoopNode->GetChangeNodeOutPort( j ) ,
+ aLoopNode->CoupledNode() , anInPort ) ) {
+ cdebug << "GraphBase::Graph::CreateService AddLink ERROR " << aLoopNode->Name() << "( "
+ << aLoopNode->GetChangeNodeOutPort( j )->PortName() << " ) --> "
+ << aLoopNode->CoupledNode()->Name() << "( " << anInPort->PortName() << " )" << endl ;
+ RetVal = false ;
+ }
+ else {
+ NewLink = true ;
+ }
+ }
+ }
+ }
+ else if ( aNode->IsGOTONode() ) {
+ GraphBase::GOTONode * aGOTONode = (GraphBase::GOTONode * ) aNode ;
+ GraphBase::OutPort *anOutGate = aGOTONode->GetChangeNodeOutGate() ;
+ if ( !anOutGate->IsConnected() ) {
+ if ( !AddLink( aGOTONode , anOutGate ,
+ aGOTONode->CoupledNode() , aGOTONode->CoupledNode()->GetChangeNodeInGate() ) ) {
+ cdebug << "GraphBase::Graph::CreateService AddLink ERROR " << aGOTONode->Name() << "( "
+ << anOutGate->PortName() << " ) --> " << aGOTONode->CoupledNode()->Name() << "( "
+ << aGOTONode->CoupledNode()->GetChangeNodeInGate()->PortName() << " )" << endl ;
+ RetVal = false ;
+ }
+ else {
+ NewLink = true ;
+ }
+ }
+ }
+ }
+ cdebug_out << "GraphBase::Graph::LinkLoopNodes() " << RetVal << endl;
+ return RetVal ;
+}
+
// Controle de la coherence des noeuds de calcul
// Enregistrement dans la liste des noeuds "tete" de graphe
ierr = CheckDataServerNodes() ;
// list<GraphExecutor::InNode *> aComputingNodesList = _G->ComputingNodesList() ;
-// list<GraphExecutor::InNode *>::iterator iN = aComputingNodesList.begin();
+// list<GraphExecutor::InNode *>::iterator aNode = aComputingNodesList.begin();
if ( GraphNodesSize() == 0 ) {
ierr++ ;
}
else {
- GraphBase::ComputingNode * iN ;
+ GraphBase::ComputingNode * aNode ;
for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
- iN = GraphNodes( i ) ;
-// while ( iN != aComputingNodesList.end() ) {
- if ( iN->IsFactoryNode() ) {
- GraphBase::FactoryNode * FiN = (GraphBase::FactoryNode * ) iN ;
- if ( !strlen( FiN->Computer() ) ) {
- cdebug << "ComputerName missing for node " << FiN->Name() ;
- if ( !strlen( FiN->Computer() ) ) {
+ aNode = GraphNodes( i ) ;
+// while ( aNode != aComputingNodesList.end() ) {
+ if ( aNode->IsFactoryNode() ) {
+ GraphBase::FactoryNode * FaNode = (GraphBase::FactoryNode * ) aNode ;
+ if ( !strlen( FaNode->Computer() ) ) {
+ cdebug << "ComputerName missing for node " << FaNode->Name() ;
+ if ( !strlen( FaNode->Computer() ) ) {
ierr++ ;
cdebug << endl ;
}
else {
- cdebug << ". " << FiN->Computer() << " will be used." << endl ;
+ cdebug << ". " << FaNode->Computer() << " will be used." << endl ;
}
}
}
// For Outputs of the DataFlow :
- for ( j = 0 ; j < iN->GetNodeOutPortsSize() ; j++ ) {
- if ( !iN->GetNodeOutPort(j)->IsConnected() ) {
- iN->AddLink( (GraphBase::ComputingNode *) this ) ;
+ for ( j = 0 ; j < aNode->GetNodeOutPortsSize() ; j++ ) {
+ if ( !aNode->GetNodeOutPort(j)->IsConnected() ) {
+ aNode->AddLink( (GraphBase::ComputingNode *) this ) ;
}
}
}
private:
int _Graph_prof_debug;
- ostream * _Graph_fdebug;
+ ofstream * _Graph_fdebug;
CORBA::ORB_ptr _Orb ;
SUPERV::Graph_var _Graph ;
Graph_Impl * _GraphImpl ;
void Set_prof_debug( CORBA::ORB_ptr ORB ,
const char * DebugFileName ) ;
- int * Graph_prof_debug() { return &_Graph_prof_debug ; } ;
- ostream * Graph_fdebug() { return _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 ; } ;
SUPERV::Graph_var ObjRef() const { return _Graph ; } ;
void SetObjRef( SUPERV::Graph_var aGraph ) {
GraphBase::SNode * GetInfo() const ;
GraphBase::ListOfNodes * GetNodes() const ;
- GraphBase::ListOfLinks * GetLinks() const ;
+ GraphBase::ListOfLinks * GetLinks(bool AllLinks = false ) const ;
GraphBase::ListOfGraphs * GetGraphs() const ;
GraphBase::ListOfLinks * GetDatas() const ;
// SALOME_ModuleCatalog::Service * GetService() const ;
bool Sort() ;
bool ComputingNodes() const ;
+ bool LinkLoopNodes(bool & NewLink ) ;
bool DataServerNodes() const ;
long LevelMax() {
// $Header:
using namespace std;
-#include <strstream>
-#include <iostream>
+//#include <sstream>
+//#include <iostream>
#include "DataFlowBase_InLineNode.hxx"
SALOME_NamingService* ptrNamingService ,
const char * aDataFlowName ,
int * Graph_prof_debug ,
- ostream * Graph_fdebug ) :
+ ofstream * Graph_fdebug ) :
GraphBase::ComputingNode::ComputingNode( ORB , ptrNamingService , aDataFlowName ,
Graph_prof_debug , Graph_fdebug ) {
_PythonFunction = SUPERV::ListOfStrings() ;
const long X ,
const long Y ,
int * Graph_prof_debug ,
- ostream * Graph_fdebug ) :
+ ofstream * Graph_fdebug ) :
GraphBase::ComputingNode::ComputingNode( ORB , ptrNamingService ,
NodeService ,
NodeName , akind , NodeFirstCreation ,
const long X ,
const long Y ,
int * Graph_prof_debug ,
- ostream * Graph_fdebug ) :
+ ofstream * Graph_fdebug ) :
GraphBase::ComputingNode::ComputingNode( ORB , ptrNamingService ,
SALOME_ModuleCatalog::Service() ,
NodeName , akind , NodeFirstCreation ,
void GraphBase::InLineNode::SetPythonFunction( const char * FuncName ,
const SUPERV::ListOfStrings & aPythonFunction ) {
int i ;
- cdebug << "GraphBase::InLineNode::PythonFunction length " << aPythonFunction.length()
- << endl ;
+ cdebug << "GraphBase::InLineNode::PythonFunction length " << aPythonFunction.length() ;
+ if ( aPythonFunction.length() == 1 ) {
+ cdebug << " aPythonFunction[ 0 ] '" << aPythonFunction[ 0 ] << "'" ;
+ }
+ cdebug << endl ;
_FuncName = my_strdup( FuncName ) ;
if ( ( aPythonFunction.length() == 0 ) ||
( aPythonFunction.length() == 1 && strlen( aPythonFunction[ 0 ] ) == 0 ) ) {
}
else {
_PythonFunction.length( aPythonFunction.length() ) ;
- for ( i = 0 ; i < aPythonFunction.length() ; i++ ) {
+ for ( i = 0 ; i < (int ) aPythonFunction.length() ; i++ ) {
cdebug << aPythonFunction[ i ] << endl ;
_PythonFunction[ i ] = CORBA::string_dup( aPythonFunction[ i ] ) ;
}
SALOME_NamingService* ptrNamingService ,
const char * DataFlowName ,
int * Graph_prof_debug = NULL ,
- ostream * Graph_fdebug = NULL ) ;
+ ofstream * Graph_fdebug = NULL ) ;
InLineNode( CORBA::ORB_ptr ORB ,
SALOME_NamingService* ptrNamingService ,
const SALOME_ModuleCatalog::Service& NodeService ,
const long X ,
const long Y ,
int * Graph_prof_debug = NULL ,
- ostream * Graph_fdebug = NULL ) ;
+ ofstream * Graph_fdebug = NULL ) ;
InLineNode( CORBA::ORB_ptr ORB ,
SALOME_NamingService* ptrNamingService ,
const char * FuncName ,
const long X ,
const long Y ,
int * Graph_prof_debug = NULL ,
- ostream * Graph_fdebug = NULL ) ;
+ ofstream * Graph_fdebug = NULL ) ;
virtual ~InLineNode() ;
void SetPythonFunction( const char * FuncName ,
public:
InPort() {
- cout << "InPort()" << endl ;
+// cout << "InPort()" << endl ;
_State = SUPERV::UndefinedState ;
_OutPort = NULL ;
_InitialOutPort = NULL ;
// $Header:
using namespace std;
-#include <strstream>
-#include <iostream>
+//#include <sstream>
+//#include <iostream>
#include "DataFlowBase_LoopNode.hxx"
const long X ,
const long Y ,
int * Graph_prof_debug ,
- ostream * Graph_fdebug ) :
+ ofstream * Graph_fdebug ) :
GraphBase::GOTONode::GOTONode( ORB , ptrNamingService , InitName , anInitPythonFunction ,
NodeName , akind , NodeFirstCreation ,
NodeLastModification , NodeEditorRelease ,
const long X ,
const long Y ,
int * Graph_prof_debug = NULL ,
- ostream * Graph_fdebug = NULL ) ;
+ ofstream * Graph_fdebug = NULL ) ;
virtual ~LoopNode() ;
void SetMorePythonFunction( const char * MoreName ,
return false ;
}
else {
- if ( index <= 0 || index > _X.size()+1 )
+ if ( index <= 0 || index > (int ) _X.size()+1 )
return false ;
_X.resize( _X.size()+1 ) ;
_Y.resize( _Y.size()+1 ) ;
return false ;
}
else {
- if ( index <= 0 || index > _X.size() )
+ if ( index <= 0 || index > (int ) _X.size() )
return false ;
_X[ index - 1 ] = x ;
_Y[ index - 1 ] = y ;
return false ;
}
else {
- if ( index <= 0 || index > _X.size() )
+ if ( index <= 0 || index > (int ) _X.size() )
return false ;
int i ;
- for ( i = index - 1 ; i < _X.size() - 1 ; i++ ) {
+ for ( i = index - 1 ; i < (int ) _X.size() - 1 ; i++ ) {
_X[ i ] = _X[ i+1 ] ;
_Y[ i ] = _Y[ i+1 ] ;
}
return false ;
}
else {
- for ( i = 0 ; i < _X.size() ; i++ ) {
+ for ( i = 0 ; i < (int ) _X.size() ; i++ ) {
x[ i ] = _X[ i ] ;
y[ i ] = _Y[ i ] ;
}
int i ;
if ( !IsEndSwitch() ) {
_list_Coords->resize( _X.size() );
- for ( i = 0 ; i < _X.size() ; i++ ) {
+ for ( i = 0 ; i < (int ) _X.size() ; i++ ) {
(*_list_Coords)[ i ].theX = _X[ i ] ;
(*_list_Coords)[ i ].theY = _Y[ i ] ;
}
return false ;
}
else {
- if ( index <= 0 || index > _X.size() )
+ if ( index <= 0 || index > (int ) _X.size() )
return false ;
x = _X[ index - 1 ] ;
y = _Y[ index - 1 ] ;
ostream & operator<< (ostream & f ,const SUPERV::KindOfPort & s ) {
switch (s) {
+ case SUPERV::UndefinedParameter :
+ f << "UndefinedParameter";
+ break;
case SUPERV::ServiceParameter :
f << "ServiceParameter";
break;
case SUPERV::GateParameter :
f << "GateParameter";
break;
- case SUPERV::LoopParameter :
- f << "LoopParameter";
- break;
case SUPERV::InLineParameter :
f << "InLineParameter";
break;
+ case SUPERV::LoopParameter :
+ f << "LoopParameter";
+ break;
case SUPERV::SwitchParameter :
f << "SwitchParameter";
break;
case SUPERV::EndSwitchParameter :
f << "EndSwitchParameter";
break;
+ case SUPERV::GOTOParameter :
+ f << "GOTOParameter";
+ break;
default :
f << "UnknownKindOfPort";
break;
public:
Port() {
- cout << "Port()" << endl ;
+// cout << "Port()" << endl ;
_NodeName = NULL ;
_Port = SUPERV::Port::_nil() ;
_KindOfPort = SUPERV::UndefinedParameter ;
GraphBase::PortsOfNode::PortsOfNode() :
GraphBase::Service::Service( SALOME_ModuleCatalog::Service() ) {
- cdebug << "GraphBase::PortsOfNode::PortsOfNode " << this
- << endl ;
+// MESSAGE( "GraphBase::PortsOfNode::PortsOfNode " << this ) ;
+// cout << "GraphBase::PortsOfNode::PortsOfNode " << this << endl ;
+// cdebug << "GraphBase::PortsOfNode::PortsOfNode " << this << endl ;
_NodeInPortsSize = 0 ;
_NodeOutPortsSize = 0 ;
}
GraphBase::PortsOfNode::PortsOfNode( const char *DataFlowName ) :
GraphBase::Service::Service( SALOME_ModuleCatalog::Service() ) {
- cdebug << "GraphBase::PortsOfNode::PortsOfNode " << this
- << endl ;
+// MESSAGE( "GraphBase::PortsOfNode::PortsOfNode " << this ) ;
+// cout << "GraphBase::PortsOfNode::PortsOfNode " << this << endl ;
+// cdebug << "GraphBase::PortsOfNode::PortsOfNode " << this << endl ;
_NodeInPortsSize = 0 ;
_NodeOutPortsSize = 0 ;
}
const SALOME_ModuleCatalog::Service& aService ,
const char *const * NodeName ,
const SUPERV::KindOfNode aKind ,
-// const bool DataFlowOrComputing ,
-// const bool WithInLoop ,
-// const bool WithInGate ,
-// const bool WithOutGate ,
int * Graph_prof_debug ,
- ostream * Graph_fdebug ) {
+ ofstream * Graph_fdebug ) {
int i ;
cdebug_in << "DefPortsOfNode : " << *NodeName << endl ;
const bool DataFlowOrComputing = (aKind == SUPERV::DataFlowNode) ||
int iVec = 0 ;
_NodeInPortsSize = aService.ServiceinParameter.length() ;
- if ( WithInGate ) {
- SALOME_ModuleCatalog::ServicesParameter anInGateParameter ;
- _NodeInPortsSize = _NodeInPortsSize + 1 ;
- iVec += 1 ;
- char *aParametername = "InGate" ;
- if ( aKind == SUPERV::EndSwitchNode ) {
- aParametername = "Default" ;
- }
- anInGateParameter.Parametertype = CORBA::string_dup( "bool" ) ;
- anInGateParameter.Parametername = CORBA::string_dup( aParametername ) ;
- _NodeInPorts.resize( _NodeInPortsSize );
- _MapOfNodeInPorts[ aParametername ] = iVec ;
- _NodeInPorts[iVec-1] = new GraphBase::InPort( NodeName , anInGateParameter ,
- SUPERV::GateParameter );
-// _NodeInPorts[iVec-1]->Kind( SUPERV::GateParameter ) ;
- _NodeInPorts[iVec-1]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
- cdebug << "DefPortsOfNode : " << "_MapOfNodeInPorts[ " << aParametername
- << " ] = " << iVec << " " << _NodeInPorts[iVec-1]->Kind() << " "
- << _NodeInPorts[iVec-1] << endl ;
- }
if ( WithInLoop ) {
SALOME_ModuleCatalog::ServicesParameter anInLoopParameter ;
_NodeInPortsSize = _NodeInPortsSize + 1 ;
if ( aKind == SUPERV::EndLoopNode ) {
aParametername = "DoLoop" ;
}
- anInLoopParameter.Parametertype = CORBA::string_dup( "bool" ) ;
+ anInLoopParameter.Parametertype = CORBA::string_dup( "long" ) ;
anInLoopParameter.Parametername = CORBA::string_dup( aParametername ) ;
- if ( _NodeInPortsSize > _NodeInPorts.size() ) {
+ if ( _NodeInPortsSize > (int ) _NodeInPorts.size() ) {
_NodeInPorts.resize( _NodeInPortsSize );
}
_MapOfNodeInPorts[ aParametername ] = iVec ;
_NodeInPorts[iVec-1] = new GraphBase::InPort( NodeName , anInLoopParameter ,
SUPERV::LoopParameter );
-// _NodeInPorts[iVec-1]->Kind( SUPERV::LoopParameter ) ;
+// MESSAGE( "GraphBase::PortsOfNode::DefPortsOfNode " << aParametername << " --> SetDebug" ) ;
_NodeInPorts[iVec-1]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
cdebug << "DefPortsOfNode : " << "_MapOfNodeInPorts[ " << aParametername
<< " ] = " << iVec << " " << _NodeInPorts[iVec-1]->Kind() << " "
<< _NodeInPorts[iVec-1] << endl ;
}
- if ( _NodeInPortsSize > _NodeInPorts.size() ) {
+ if ( _NodeInPortsSize > (int ) _NodeInPorts.size() ) {
_NodeInPorts.resize(_NodeInPortsSize);
}
cdebug << "NodeInPortsSize " << _NodeInPortsSize << endl ;
const SALOME_ModuleCatalog::ServicesParameter aServiceParameter = aService.ServiceinParameter[i-iVec] ;
_NodeInPorts[i] = new GraphBase::InPort( NodeName , aServiceParameter ,
aPortKind );
+// MESSAGE( "GraphBase::PortsOfNode::DefPortsOfNode " << aParametername << " --> SetDebug" ) ;
_NodeInPorts[i]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
cdebug << i << ". " << *_NodeInPorts[i] << " " << _NodeInPorts[i]->Kind() << endl ;
}
}
-
- iVec = 0 ;
- _NodeOutPortsSize = aService.ServiceoutParameter.length() ;
- if ( WithOutGate ) {
- SALOME_ModuleCatalog::ServicesParameter anOutGateParameter ;
- _NodeOutPortsSize = _NodeOutPortsSize + 1 ;
+ iVec += aService.ServiceinParameter.length() ;
+ if ( WithInGate ) {
+ SALOME_ModuleCatalog::ServicesParameter anInGateParameter ;
+ _NodeInPortsSize = _NodeInPortsSize + 1 ;
iVec += 1 ;
- char *aParametername = "OutGate" ;
- if ( aKind == SUPERV::SwitchNode ) {
+ char *aParametername = "InGate" ;
+ if ( aKind == SUPERV::EndSwitchNode ) {
aParametername = "Default" ;
}
- anOutGateParameter.Parametertype = CORBA::string_dup( "bool" ) ;
- anOutGateParameter.Parametername = CORBA::string_dup( aParametername ) ;
- _NodeOutPorts.resize(_NodeOutPortsSize);
- _MapOfNodeOutPorts[ aParametername ] = iVec ;
- _NodeOutPorts[iVec-1] = new GraphBase::OutPort( NodeName , anOutGateParameter ,
- SUPERV::GateParameter );
-// _NodeOutPorts[iVec-1]->Kind( SUPERV::GateParameter ) ;
- _NodeOutPorts[iVec-1]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
- cdebug << "DefPortsOfNode : " << "_MapOfNodeOutPorts[ " << aParametername
- << " ] = " << iVec << " " << _NodeOutPorts[iVec-1]->Kind() << " "
- << _NodeOutPorts[iVec-1] << endl ;
+ anInGateParameter.Parametertype = CORBA::string_dup( "long" ) ;
+ anInGateParameter.Parametername = CORBA::string_dup( aParametername ) ;
+ _NodeInPorts.resize( _NodeInPortsSize );
+ _MapOfNodeInPorts[ aParametername ] = iVec ;
+ _NodeInPorts[iVec-1] = new GraphBase::InPort( NodeName , anInGateParameter ,
+ SUPERV::GateParameter );
+// MESSAGE( "GraphBase::PortsOfNode::DefPortsOfNode " << aParametername << " --> SetDebug" ) ;
+ _NodeInPorts[iVec-1]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
+ cdebug << "DefPortsOfNode : " << "_MapOfNodeInPorts[ " << aParametername
+ << " ] = " << iVec << " " << _NodeInPorts[iVec-1]->Kind() << " "
+ << _NodeInPorts[iVec-1] << endl ;
}
+
+ iVec = 0 ;
+ _NodeOutPortsSize = aService.ServiceoutParameter.length() ;
if ( WithInLoop ) {
SALOME_ModuleCatalog::ServicesParameter anOutLoopParameter ;
_NodeOutPortsSize = _NodeOutPortsSize + 1 ;
iVec += 1 ;
char *aParametername = "DoLoop" ;
- anOutLoopParameter.Parametertype = CORBA::string_dup( "bool" ) ;
+ anOutLoopParameter.Parametertype = CORBA::string_dup( "long" ) ;
anOutLoopParameter.Parametername = CORBA::string_dup( aParametername ) ;
- if ( _NodeOutPortsSize > _NodeOutPorts.size() ) {
+ if ( _NodeOutPortsSize > (int ) _NodeOutPorts.size() ) {
_NodeOutPorts.resize(_NodeOutPortsSize);
}
_MapOfNodeOutPorts[ aParametername ] = iVec ;
_NodeOutPorts[iVec-1] = new GraphBase::OutPort( NodeName , anOutLoopParameter ,
SUPERV::LoopParameter );
-// _NodeOutPorts[iVec-1]->Kind( SUPERV::LoopParameter ) ;
+// MESSAGE( "GraphBase::PortsOfNode::DefPortsOfNode " << aParametername << " --> SetDebug" ) ;
_NodeOutPorts[iVec-1]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
cdebug << "DefPortsOfNode : " << "_MapOfNodeOutPorts[ " << aParametername
<< " ] = " << iVec << " " << _NodeOutPorts[iVec-1]->Kind() << " "
<< _NodeOutPorts[iVec-1] << endl ;
}
- if ( _NodeOutPortsSize > _NodeOutPorts.size() ) {
+ if ( _NodeOutPortsSize > (int ) _NodeOutPorts.size() ) {
_NodeOutPorts.resize(_NodeOutPortsSize);
}
cdebug << "NodeOutPortsSize " << _NodeOutPortsSize << endl ;
const SALOME_ModuleCatalog::ServicesParameter aServiceParameter = aService.ServiceoutParameter[i-iVec] ;
_NodeOutPorts[i] = new GraphBase::OutPort( NodeName , aServiceParameter ,
aPortKind );
+// MESSAGE( "GraphBase::PortsOfNode::DefPortsOfNode " << aParametername << " --> SetDebug" ) ;
_NodeOutPorts[i]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
cdebug << i << ". " << *_NodeOutPorts[i] << " " << _NodeOutPorts[i]->Kind() << endl ;
}
}
+ iVec += aService.ServiceoutParameter.length() ;
+ if ( WithOutGate ) {
+ SALOME_ModuleCatalog::ServicesParameter anOutGateParameter ;
+ _NodeOutPortsSize = _NodeOutPortsSize + 1 ;
+ iVec += 1 ;
+ char *aParametername = "OutGate" ;
+ if ( aKind == SUPERV::SwitchNode ) {
+ aParametername = "Default" ;
+ }
+ anOutGateParameter.Parametertype = CORBA::string_dup( "long" ) ;
+ anOutGateParameter.Parametername = CORBA::string_dup( aParametername ) ;
+ _NodeOutPorts.resize(_NodeOutPortsSize);
+ _MapOfNodeOutPorts[ aParametername ] = iVec ;
+ _NodeOutPorts[iVec-1] = new GraphBase::OutPort( NodeName , anOutGateParameter ,
+ SUPERV::GateParameter );
+// MESSAGE( "GraphBase::PortsOfNode::DefPortsOfNode " << aParametername << " --> SetDebug" ) ;
+ _NodeOutPorts[iVec-1]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
+ cdebug << "DefPortsOfNode : " << "_MapOfNodeOutPorts[ " << aParametername
+ << " ] = " << iVec << " " << _NodeOutPorts[iVec-1]->Kind() << " "
+ << _NodeOutPorts[iVec-1] << endl ;
+ }
cdebug_out << "DefPortsOfNode : " << *NodeName << endl ;
}
-GraphBase::InPort * GraphBase::PortsOfNode::AddInPort(
- CORBA::ORB_ptr ORB ,
- const char *const * NodeName ,
- const SUPERV::KindOfNode aKind ,
- const char * InputParameterName ,
- const char * InputParameterType ,
- int * Graph_prof_debug ,
- ostream * Graph_fdebug ) {
- cdebug_in << "DefPortsOfNode::InPort : " << *NodeName << " " << aKind << " "
+GraphBase::InPort * GraphBase::PortsOfNode::AddInPort( CORBA::ORB_ptr ORB ,
+ const char *const * NodeName ,
+ const SUPERV::KindOfNode aKind ,
+ const char * InputParameterName ,
+ const char * InputParameterType ,
+ int * Graph_prof_debug ,
+ ofstream * Graph_fdebug ) {
+ cdebug_in << "DefPortsOfNode::AddInPort : " << *NodeName << " " << aKind << " "
<< InputParameterName << " " << InputParameterType << endl ;
GraphBase::InPort * anInPort = NULL ;
if ( aKind == SUPERV::InLineNode || aKind == SUPERV::LoopNode ||
if ( anInPort == NULL ) {
_NodeInPortsSize = _NodeInPortsSize + 1 ;
_NodeInPorts.resize(_NodeInPortsSize);
- _MapOfNodeInPorts[ InputParameterName ] = _NodeInPortsSize ;
SALOME_ModuleCatalog::ServicesParameter aServiceParameter ;
aServiceParameter.Parametername = InputParameterName ;
aServiceParameter.Parametertype = InputParameterType ;
SUPERV::KindOfPort aPortKind = SUPERV::ServiceParameter ;
- _NodeInPorts[_NodeInPortsSize-1] = new GraphBase::InPort( NodeName ,
- aServiceParameter ,
- aPortKind ) ;
- _NodeInPorts[_NodeInPortsSize-1]->Kind( SUPERV::InLineParameter ) ;
- _NodeInPorts[_NodeInPortsSize-1]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
- anInPort = _NodeInPorts[_NodeInPortsSize-1] ;
+ 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 ;
+ }
+ 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 ;
+ }
}
else {
cdebug << "InPort already exists" << endl ;
}
}
- cdebug_out << "DefPortsOfNode::InPort _NodeInPortsSize " << _NodeInPortsSize
+ cdebug_out << "DefPortsOfNode::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 char * OutputParameterName ,
- const char * OutputParameterType ,
- int * Graph_prof_debug ,
- ostream * Graph_fdebug ) {
- cdebug_in << "DefPortsOfNode::OutPort : " << *NodeName << " " << aKind << " "
+GraphBase::OutPort * GraphBase::PortsOfNode::AddOutPort( CORBA::ORB_ptr ORB ,
+ const char * const * NodeName ,
+ const SUPERV::KindOfNode aKind ,
+ const char * OutputParameterName ,
+ const char * OutputParameterType ,
+ int * Graph_prof_debug ,
+ ofstream * Graph_fdebug ) {
+ cdebug_in << "DefPortsOfNode::AddOutPort : " << *NodeName << " " << aKind << " "
<< OutputParameterName << " " << OutputParameterType << endl ;
GraphBase::OutPort * anOutPort = NULL ;
if ( aKind == SUPERV::InLineNode || aKind == SUPERV::LoopNode ||
if ( anOutPort == NULL ) {
_NodeOutPortsSize = _NodeOutPortsSize + 1 ;
_NodeOutPorts.resize(_NodeOutPortsSize);
- _MapOfNodeOutPorts[ OutputParameterName ] = _NodeOutPortsSize ;
SALOME_ModuleCatalog::ServicesParameter aServiceParameter ;
aServiceParameter.Parametername = OutputParameterName ;
aServiceParameter.Parametertype = OutputParameterType ;
- _NodeOutPorts[_NodeOutPortsSize-1] = new GraphBase::OutPort( NodeName ,
- aServiceParameter ,
- aPortKind );
- _NodeOutPorts[_NodeOutPortsSize-1]->Kind( SUPERV::InLineParameter ) ;
- _NodeOutPorts[_NodeOutPortsSize-1]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
- anOutPort = _NodeOutPorts[_NodeOutPortsSize-1] ;
+ 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 ;
+ }
}
else {
cdebug << "OutPort already exists" << endl ;
}
}
- cdebug_out << "DefPortsOfNode::OutPort _NodeOutPortsSize "
+ cdebug_out << "DefPortsOfNode::AddOutPort _NodeOutPortsSize "
<< _NodeOutPortsSize << " " << anOutPort->Kind() << endl ;
return anOutPort ;
}
_MapOfNodeOutPorts.erase( OutputParameterName ) ;
_NodeOutPorts[ index ]->destroy() ;
int i ;
- for ( i = index ; i < _NodeOutPortsSize ; i++ ) {
+ for ( i = index ; i < _NodeOutPortsSize - 1 ; i++ ) {
_MapOfNodeOutPorts.erase( _NodeOutPorts[ i+1 ]->PortName() ) ;
_MapOfNodeOutPorts[ _NodeOutPorts[ i+1 ]->PortName() ] = i+1 ;
_NodeOutPorts[ i ] = _NodeOutPorts[ i+1 ] ;
return GetChangeOutPort( name ) ;
}
-GraphBase::InPort *GraphBase::PortsOfNode::GetChangeInPort( const char *name) {
+GraphBase::InPort *GraphBase::PortsOfNode::GetChangeInPort( const char * name) {
// cdebug_in << "GraphBase::PortsOfNode::GetChangePort " << name <<" " << way
// << endl;
return pP;
}
-GraphBase::OutPort *GraphBase::PortsOfNode::GetChangeOutPort( const char *name ) {
+GraphBase::OutPort *GraphBase::PortsOfNode::GetChangeOutPort( const char * name ) {
// cdebug_in << "GraphBase::PortsOfNode::GetChangePort " << name <<" " << way
// << endl;
}
#endif
-void GraphBase::PortsOfNode::ListPorts( ostrstream & f,
+void GraphBase::PortsOfNode::ListPorts( ostream & f,
const bool klink ) const {
int i ;
// const bool WithInGate ,
// const bool WithOutGate ,
int * Graph_prof_debug ,
- ostream * Graph_fdebug ) ;
+ ofstream * Graph_fdebug ) ;
InPort * AddInPort( CORBA::ORB_ptr ORB ,
const char *const * NodeName ,
const char * InputParameterName ,
const char * InputParameterType ,
int * Graph_prof_debug ,
- ostream * Graph_fdebug ) ;
+ ofstream * Graph_fdebug ) ;
OutPort * AddOutPort( CORBA::ORB_ptr ORB ,
const char *const * NodeName ,
const SUPERV::KindOfNode aKind ,
const char * OutputParameterName ,
const char * InputParameterType ,
int * Graph_prof_debug ,
- ostream * Graph_fdebug ) ;
+ ofstream * Graph_fdebug ) ;
// void InOutPort( InPort * InputPort , OutPort * OutputPort ) ;
void DelInPort( const char * InputParameterName ) ;
void DelOutPort( const char * OutputParameterName ) ;
const int GetNodeInPortsSize() const { return _NodeInPortsSize ; } ;
- const InPort *GetNodeInPort(int i) const {
+ const InPort * GetNodeInLoop() const {
+ return _NodeInPorts[0] ; } ;
+ const InPort * GetNodeInGate() const {
+ return _NodeInPorts[GetNodeInPortsSize()-1] ; } ;
+ const InPort * GetNodeInPort(int i) const {
return _NodeInPorts[i] ; } ;
- InPort *GetChangeNodeInPort(int i) const {
+ InPort * GetChangeNodeInLoop() const {
+ return _NodeInPorts[0] ; } ;
+ InPort * GetChangeNodeInGate() const {
+ return _NodeInPorts[GetNodeInPortsSize()-1] ; } ;
+ InPort * GetChangeNodeInPort(int i) const {
return _NodeInPorts[i] ; } ;
const int GetNodeOutPortsSize() const { return _NodeOutPortsSize ; } ;
- const OutPort *GetNodeOutPort(int i) const {
+ const OutPort * GetNodeOutLoop() const {
+ return _NodeOutPorts[0] ; } ;
+ const OutPort * GetNodeOutGate() const {
+ return _NodeOutPorts[GetNodeOutPortsSize()-1] ; } ;
+ const OutPort * GetNodeOutPort(int i) const {
return _NodeOutPorts[i] ; } ;
- OutPort *GetChangeNodeOutPort(int i) const {
+ OutPort * GetChangeNodeOutLoop() const {
+ return _NodeOutPorts[0] ; } ;
+ OutPort * GetChangeNodeOutGate() const {
+ return _NodeOutPorts[GetNodeOutPortsSize()-1] ; } ;
+ OutPort * GetChangeNodeOutPort(int i) const {
return _NodeOutPorts[i] ; } ;
- const InPort *GetInPort( const char *name ) ;
- const OutPort *GetOutPort( const char *name ) ;
- InPort *GetChangeInPort( const char *name ) ;
- OutPort *GetChangeOutPort( const char *name ) ;
+ const InPort * GetInPort( const char *name ) ;
+ const OutPort * GetOutPort( const char *name ) ;
+ InPort * GetChangeInPort( const char *name ) ;
+ OutPort * GetChangeOutPort( const char *name ) ;
- void ListPorts( ostrstream & , const bool klink = true ) const ;
+// void ListPorts( ostream & , const bool klink = true ) const ;
+ void ListPorts( ostream & , const bool klink = true ) const ;
};
};
_Service.ServiceinParameter.length( aService.ServiceinParameter.length() ) ;
_Service.ServiceoutParameter.length( aService.ServiceoutParameter.length() ) ;
int i ;
- for ( i = 0 ; i < _Service.ServiceinParameter.length() ; i++ ) {
+ for ( i = 0 ; i < (int ) _Service.ServiceinParameter.length() ; i++ ) {
_Service.ServiceinParameter[ i ].Parametertype = CORBA::string_dup( aService.ServiceinParameter[ i ].Parametertype ) ;
_Service.ServiceinParameter[ i ].Parametername = CORBA::string_dup( aService.ServiceinParameter[ i ].Parametername ) ;
}
- for ( i = 0 ; i < _Service.ServiceoutParameter.length() ; i++ ) {
+ for ( i = 0 ; i < (int ) _Service.ServiceoutParameter.length() ; i++ ) {
_Service.ServiceoutParameter[ i ].Parametertype = CORBA::string_dup( aService.ServiceoutParameter[ i ].Parametertype ) ;
_Service.ServiceoutParameter[ i ].Parametername = CORBA::string_dup( aService.ServiceoutParameter[ i ].Parametername ) ;
}
ostream & operator<< (ostream & f ,const SALOME_ModuleCatalog::Service & s ) {
f << "Name " << s.ServiceName << endl ;
int i ;
- for ( i = 0 ; i < s.ServiceinParameter.length() ; i++ ) {
+ for ( i = 0 ; i < (int ) s.ServiceinParameter.length() ; i++ ) {
if ( i == 0 )
f << " Inparameters " << i ;
else
f << ". " << s.ServiceinParameter[i].Parametername
<< ". " << s.ServiceinParameter[i].Parametertype << endl ;
}
- for ( i = 0 ; i < s.ServiceoutParameter.length() ; i++ ) {
+ for ( i = 0 ; i < (int ) s.ServiceoutParameter.length() ; i++ ) {
if ( i == 0 )
f << " Outparameters " << i ;
else
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 ) {
cdebug << "GraphBase::Service::Service : " << _Service << endl ;
_Instance = 0 ; } ;
virtual ~Service() {
- MESSAGE( "GraphBase::Service::~Service" );
+ cdebug << "GraphBase::Service::~Service" << endl ;
} ;
void SetService( const SALOME_ModuleCatalog::Service aService ) ;
// $Header:
using namespace std;
-#include <strstream>
-#include <iostream>
+//#include <sstream>
+//#include <iostream>
#include "DataFlowBase_SwitchNode.hxx"
const long X ,
const long Y ,
int * Graph_prof_debug ,
- ostream * Graph_fdebug ) :
+ ofstream * Graph_fdebug ) :
GraphBase::GOTONode::GOTONode( ORB , ptrNamingService , FuncName , aPythonFunction ,
NodeName , akind , NodeFirstCreation ,
NodeLastModification , NodeEditorRelease ,
const long X ,
const long Y ,
int * Graph_prof_debug = NULL ,
- ostream * Graph_fdebug = NULL ) ;
+ ofstream * Graph_fdebug = NULL ) ;
virtual ~SwitchNode() ;
};
dataflowxml = TRUE;
}
if ( dataflowxml ) {
- fieldname[depth++] = qName ;
+ fieldname[depth++] = (const char * ) qName ;
}
if ( depth == maxlevel+1 )
return false ;
if ( fieldvalue[depth] == NULLSTRING )
return returnfalse( this , "depth3-3" , qName ) ;
// kind ok
- sscanf( fieldvalue[depth].c_str() ,"%d" , &aNode.theKind ) ;
+ sscanf( fieldvalue[depth].c_str() ,"%d" , (int * ) &aNode.theKind ) ;
fieldvalue[depth] = NULLSTRING ;
step[depth]++ ;
step[4] = 0 ;
char Date[23] ;
strcpy( Date , fieldvalue[depth].c_str() ) ;
int i ;
- for ( i = 0 ; i < strlen(Date) ; i++ ) {
+ for ( i = 0 ; i < (int ) strlen(Date) ; i++ ) {
if ( Date[i] == '/' || Date[i] == '-' || Date[i] == ':' )
Date[i] = ' ' ;
}
char Date[23] ;
strcpy( Date , fieldvalue[depth].c_str() ) ;
int i ;
- for ( i = 0 ; i < strlen(Date) ; i++ ) {
+ for ( i = 0 ; i < (int ) strlen(Date) ; i++ ) {
if ( Date[i] == '/' || Date[i] == '-' || Date[i] == ':' )
Date[i] = ' ' ;
}
if ( qName == "x-position" ) {
if ( fieldvalue[depth] == NULLSTRING )
return returnfalse( this , "depth3-14" , qName ) ;
- sscanf( fieldvalue[depth].c_str() , "%d" , &aNode.theCoords.theX ) ;
+ sscanf( fieldvalue[depth].c_str() , "%ld" , &aNode.theCoords.theX ) ;
fieldvalue[depth] = NULLSTRING ;
step[depth]++ ;
// x-position ok
if ( qName == "y-position" ) {
if ( fieldvalue[depth] == NULLSTRING )
return returnfalse( this , "depth3-15" , qName ) ;
- sscanf( fieldvalue[depth].c_str() , "%d" , &aNode.theCoords.theY ) ;
+ sscanf( fieldvalue[depth].c_str() , "%ld" , &aNode.theCoords.theY ) ;
fieldvalue[depth] = NULLSTRING ;
step[depth]++ ;
// y-position ok
if ( qName == "coord" ) {
if ( fieldvalue[depth] != NULLSTRING )
return returnfalse( this , "depth4-5" , qName ) ;
- if ( VXSize == VX.size() ) {
+ if ( VXSize == (int ) VX.size() ) {
VX.resize( VX.size() + 10 ) ;
VY.resize( VY.size() + 10 ) ;
}
if ( qName == "inParameter-type" ) {
if ( fieldvalue[depth] == NULLSTRING )
return returnfalse( this , "depth5-4" , qName ) ;
- aParameter.Parametertype = fieldvalue[depth].c_str() ;
+ if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
+ aParameter.Parametertype = fieldvalue[depth].c_str() ;
+ }
+ else {
+ aParameter.Parametertype = "" ;
+ }
fieldvalue[depth] = NULLSTRING ;
step[depth]++ ;
}
if ( qName == "inParameter-name" ) {
if ( fieldvalue[depth] == NULLSTRING )
return returnfalse( this , "depth5-5" , qName ) ;
- aParameter.Parametername = fieldvalue[depth].c_str() ;
+ if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
+ aParameter.Parametername = fieldvalue[depth].c_str() ;
+ }
+ else {
+ aParameter.Parametername = "" ;
+ }
fieldvalue[depth] = NULLSTRING ;
step[depth]++ ;
}
if ( qName == "outParameter-type" ) {
if ( fieldvalue[depth] == NULLSTRING )
return returnfalse( this , "depth5-6" , qName ) ;
- aParameter.Parametertype = fieldvalue[depth].c_str() ;
+ if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
+ aParameter.Parametertype = fieldvalue[depth].c_str() ;
+ }
+ else {
+ aParameter.Parametertype = "" ;
+ }
fieldvalue[depth] = NULLSTRING ;
step[depth]++ ;
}
if ( qName == "outParameter-name" ) {
if ( fieldvalue[depth] == NULLSTRING )
return returnfalse( this , "depth5-7" , qName ) ;
- aParameter.Parametername = fieldvalue[depth].c_str() ;
+ if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
+ aParameter.Parametername = fieldvalue[depth].c_str() ;
+ }
+ else {
+ aParameter.Parametername = "" ;
+ }
fieldvalue[depth] = NULLSTRING ;
step[depth]++ ;
}
if ( depth < 0 || fieldvalue[depth] != NULLSTRING )
return returnfalse( this , "characters " , ch ) ;
- fieldvalue[depth] = ch ;
+ fieldvalue[depth] = (const char * ) ch ;
return TRUE;
}
cdebug_out << "GraphEditor::DataFlow::DataFlowEditor()" << endl;
}
+//extern ostream * fdebug ;
+
GraphEditor::DataFlow::DataFlow( CORBA::ORB_ptr ORB,
SALOME_NamingService* ptrNamingService ,
const char *DataFlowName ,
const char * DebugFileName ) :
OutNode( ORB, ptrNamingService , DataFlowName , DebugFileName ) {
+// cout << "GraphEditor::DataFlow::DataFlow(" ;
cdebug_in << "GraphEditor::DataFlow::DataFlow(" ;
if ( DataFlowName ) {
- cdebug << DataFlowName ;
+// cout << DataFlowName << " , " << DebugFileName ;
+ cdebug << DataFlowName << " , " << DebugFileName;
}
+// cout << ")" << endl;
cdebug << ")" << endl;
_theNamingService = ptrNamingService ;
_Executing = false ;
cdebug_out << "GraphEditor::DataFlow::DataFlow" << endl;
+// fdebug = new ofstream( DebugFileName ); // GraphBase::Base::_fdebug ;
}
GraphEditor::DataFlow::DataFlow(
public:
DataFlow();
- DataFlow( CORBA::ORB_ptr ORB, SALOME_NamingService* ptrNamingService ,
+ DataFlow( CORBA::ORB_ptr ORB, SALOME_NamingService * ptrNamingService ,
const char * DataFlowName ,
const char * DebugFileName );
- DataFlow( CORBA::ORB_ptr ORB, SALOME_NamingService* ptrNamingService ,
+ DataFlow( CORBA::ORB_ptr ORB, SALOME_NamingService * ptrNamingService ,
const SALOME_ModuleCatalog::Service& DataFlowService ,
const char * DataFlowComponentName ,
const char * DataFlowInterfaceName ,
const SUPERV::KindOfNode DataFlowkind = SUPERV::ComputingNode ,
const SUPERV::SDate DataFlowFirstCreation = SUPERV::SDate() ,
const SUPERV::SDate DataFlowLastModification = SUPERV::SDate() ,
- const char * DataFlowEditorRelease = NULL ,
- const char * DataFlowAuthor = NULL ,
- const char * DataFlowComputer = NULL ,
- const char * DataFlowComment = NULL ,
- const char * DebugFileName = NULL ) ;
+ const char * DataFlowEditorRelease = NULLSTRING ,
+ const char * DataFlowAuthor = NULLSTRING ,
+ const char * DataFlowComputer = NULLSTRING ,
+ const char * DataFlowComment = NULLSTRING ,
+ const char * DebugFileName = NULLSTRING ) ;
virtual ~DataFlow();
void ReadOnly() ;
char * DataNodeInfo() ;
char * NodeInfo( const char * aNodeName ) ;
- bool LoadDataFlow( const GraphBase::SGraph *aDataFlow ) ;
- bool LoadXml( const char* myFileName ) ;
+ bool LoadDataFlow( const GraphBase::SGraph * aDataFlow ) ;
+ bool LoadXml( const char * myFileName ) ;
bool LoadInfo( const GraphBase::SNode &aDataFlowInfo ) ;
- bool SaveXml(const char* myFileName ) ;
- bool SavePy(const char* myFileName ) ;
+ bool SaveXml(const char * myFileName ) ;
+ bool SavePy(const char * myFileName ) ;
// void DateModification() ;
GraphEditor::InNode * AddService (
SALOME_ModuleCatalog::Service& aService ,
- const char *NodeComponentName ,
- const char* NodeInterfaceName ) {
+ const char * NodeComponentName ,
+ const char * NodeInterfaceName ) {
return AddNode( aService , NodeComponentName ,
NodeInterfaceName ) ; } ;
GraphEditor::InNode * AddNode(
const SALOME_ModuleCatalog::Service& NodeService ,
- const char* NodeComponentName ,
- const char* NodeInterfaceName ,
- const char* NodeName = NULL ,
+ const char * NodeComponentName ,
+ const char * NodeInterfaceName ,
+ const char * NodeName = NULLSTRING ,
const SUPERV::KindOfNode NodeKindOfNode = SUPERV::ComputingNode ,
GraphBase::ListOfFuncName aFuncName = GraphBase::ListOfFuncName() ,
GraphBase::ListOfPythonFunctions aPythonFunction = GraphBase::ListOfPythonFunctions() ,
const SUPERV::SDate NodeFirstCreation = SUPERV::SDate() ,
const SUPERV::SDate NodeLastModification = SUPERV::SDate() ,
- const char * NodeEditorRelease = NULL ,
- const char * NodeAuthor = NULL ,
- const char * NodeComputer = NULL ,
- const char * NodeComment = NULL ,
+ const char * NodeEditorRelease = NULLSTRING ,
+ const char * NodeAuthor = NULLSTRING ,
+ const char * NodeComputer = NULLSTRING ,
+ const char * NodeComment = NULLSTRING ,
const int NodeX = 0 ,
const int NodeY = 0 ) ;
GraphEditor::InNode * GetNode( const char* NodeName ) ;
- bool RemoveNode( const char* NodeName ) ;
- bool ReNameNode( const char* OldNodeName ,
- const char* NewNodeName ) ;
+ bool RemoveNode( const char * NodeName ) ;
+ bool ReNameNode( const char * OldNodeName ,
+ const char * NewNodeName ) ;
const SALOME_ModuleCatalog::Service * NodeService( const char * NodeName ) ;
void Coordinates( const int X , const int Y ) ;
const int XCoordinate() ;
const int YCoordinate() ;
- void Coordinates( const char* NodeName , const int X , const int Y ) ;
- const int XCoordinate( const char* NodeName ) ;
- const int YCoordinate( const char* NodeName ) ;
+ 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 ) ;
- const GraphBase::OutPort *GetOutPort( const char *name ) ;
- GraphBase::InPort *GetChangeInPort( const char *name ) ;
- GraphBase::OutPort *GetChangeOutPort( const char *name ) ;
+ const GraphBase::InPort * GetInPort( const char * name ) ;
+ const GraphBase::OutPort * GetOutPort( const char * name ) ;
+ GraphBase::InPort * GetChangeInPort( const char * name ) ;
+ GraphBase::OutPort * GetChangeOutPort( const char * name ) ;
bool HasInput(const char * ToServiceParameterName ) ;
- bool AddLinkValue( const char *FromNodeName ,
- const char *FromServiceParameterName ,
- const char *ToNodeName ,
- const char *ToServiceParameterName ,
+ bool AddLinkValue( const char * FromNodeName ,
+ const char * FromServiceParameterName ,
+ const char * ToNodeName ,
+ const char * ToServiceParameterName ,
const CORBA::Any aValue ) {
return AddLink( FromNodeName, FromServiceParameterName , ToNodeName ,
ToServiceParameterName , aValue ) ; } ;
- bool AddLink( const char* FromNodeName ,
- const char* FromServiceParameterName ,
- const char* ToNodeName ,
- const char* ToServiceParameterName ,
+ bool AddLink( const char * FromNodeName ,
+ const char * FromServiceParameterName ,
+ const char * ToNodeName ,
+ const char * ToServiceParameterName ,
const CORBA::Any aValue = CORBA::Any() ) ;
- bool RemoveLink( const char* FromNodeName ,
- const char* FromServiceParameterName ,
- const char* ToNodeName ,
- const char* ToServiceParameterName ) ;
+ bool RemoveLink( const char * FromNodeName ,
+ const char * FromServiceParameterName ,
+ const char * ToNodeName ,
+ const char * ToServiceParameterName ) ;
- bool GetLink(const char* ToNodeName ,
- const char* ToServiceParameterName ,
- char** FromNodeName ,
- char** FromServiceParameterName ) ;
+ bool GetLink(const char * ToNodeName ,
+ const char * ToServiceParameterName ,
+ char ** FromNodeName ,
+ char ** FromServiceParameterName ) ;
GraphBase::SLink * GetLink( GraphBase::ComputingNode * aNode ,
const char* ToServiceParameterName ) ;
- bool AddLinkCoord( const char* FromNodeName ,
- const char* FromServiceParameterName ,
- const char* ToNodeName ,
- const char* ToServiceParameterName ,
+ bool AddLinkCoord( const char * FromNodeName ,
+ const char * FromServiceParameterName ,
+ const char * ToNodeName ,
+ const char * ToServiceParameterName ,
const int nXY ,
- const int* X ,
- const int* Y ) ;
- bool AddLinkCoord( const char* FromNodeName ,
- const char* FromServiceParameterName ,
- const char* ToNodeName ,
- const char* ToServiceParameterName ,
+ const int * X ,
+ const int * Y ) ;
+ bool AddLinkCoord( const char * FromNodeName ,
+ const char * FromServiceParameterName ,
+ const char * ToNodeName ,
+ const char * ToServiceParameterName ,
const int index ,
const int X ,
const int Y ) ;
- bool ChangeLinkCoord( const char* FromNodeName ,
- const char* FromServiceParameterName ,
- const char* ToNodeName ,
- const char* ToServiceParameterName ,
+ bool ChangeLinkCoord( const char * FromNodeName ,
+ const char * FromServiceParameterName ,
+ const char * ToNodeName ,
+ const char * ToServiceParameterName ,
const int index ,
const int X ,
const int Y ) ;
- bool RemoveLinkCoord( const char* FromNodeName ,
- const char* FromServiceParameterName ,
- const char* ToNodeName ,
- const char* ToServiceParameterName ,
+ bool RemoveLinkCoord( const char * FromNodeName ,
+ const char * FromServiceParameterName ,
+ const char * ToNodeName ,
+ const char * ToServiceParameterName ,
const int index ) ;
- int GetLinkCoordSize( const char* FromNodeName ,
- const char* FromServiceParameterName ,
- const char* ToNodeName ,
- const char* ToServiceParameterName ) ;
- bool GetLinkCoord( const char* FromNodeName ,
- const char* FromServiceParameterName ,
- const char* ToNodeName ,
- const char* ToServiceParameterName ,
- int *X , int *Y ) ;
- bool GetLinkCoord( const char* FromNodeName ,
- const char* FromServiceParameterName ,
- const char* ToNodeName ,
- const char* ToServiceParameterName ,
+ int GetLinkCoordSize( const char * FromNodeName ,
+ const char * FromServiceParameterName ,
+ const char * ToNodeName ,
+ const char * ToServiceParameterName ) ;
+ bool GetLinkCoord( const char * FromNodeName ,
+ const char * FromServiceParameterName ,
+ const char * ToNodeName ,
+ const char * ToServiceParameterName ,
+ int * X , int * Y ) ;
+ bool GetLinkCoord( const char * FromNodeName ,
+ const char * FromServiceParameterName ,
+ const char * ToNodeName ,
+ const char * ToServiceParameterName ,
const int index , long &X , long &Y ) ;
- bool AddInputData( const char* ToNodeName ,
- const char* ToParameterName ,
+ bool AddInputData( const char * ToNodeName ,
+ const char * ToParameterName ,
const CORBA::Any aValue = CORBA::Any() ) ;
- bool AddInputSharedData( const char* ToNodeName1 ,
- const char* ToParameterName1 ,
- const char* ToNodeName2 ,
- const char* ToParameterName2 ) ;
-
- const CORBA::Any *GetInData( const char * ToNodeName ,
- const char * ToParameterName ) ;
- const CORBA::Any *GetOutData( const char * FromNodeName ,
- const char * FromParameterName ) ;
+ bool AddInputSharedData( const char * ToNodeName1 ,
+ const char * ToParameterName1 ,
+ const char * ToNodeName2 ,
+ const char * ToParameterName2 ) ;
+
+ const CORBA::Any * GetInData( const char * ToNodeName ,
+ const char * ToParameterName ) ;
+ const CORBA::Any * GetOutData( const char * FromNodeName ,
+ const char * FromParameterName ) ;
bool IsValid() ;
bool IsExecutable() ;
}
inline char * GraphEditor::DataFlow::DataFlowInfo() {
- ostrstream s;
+ ostringstream s;
IsValid() ;
GraphEditor::DataFlow::DataFlow aDataFlow = *this ;
s << aDataFlow << ends ;
- return CORBA::string_dup( s.str() );
+ return CORBA::string_dup( s.str().c_str() );
}
inline char * GraphEditor::DataFlow::DataNodeInfo() {
- ostrstream s;
+ ostringstream s;
IsValid() ;
GraphBase::DataNode::DataNodeInfo( s ) ;
- return CORBA::string_dup(s.str());
+ return CORBA::string_dup( s.str().c_str() );
}
inline char * GraphEditor::DataFlow::NodeInfo( const char * aNodeName ) {
- ostrstream s;
+ ostringstream s;
if ( GetGraphNode( aNodeName ) )
GetGraphNode( aNodeName )->NodeInfo( s ) ;
else
s << aNodeName << " not found" << ends ;
- return CORBA::string_dup( s.str() );
+ return CORBA::string_dup( s.str().c_str() );
}
-inline bool GraphEditor::DataFlow::LoadDataFlow(
- const GraphBase::SGraph *aDataFlow ) {
+inline bool GraphEditor::DataFlow::LoadDataFlow( const GraphBase::SGraph *aDataFlow ) {
if ( _ReadOnly )
return false ;
_EditedAfterExecution = true ;
const char * NodeComment,
const int NodeX,
const int NodeY) {
- if ( _ReadOnly )
+ if ( NodeName != NULLSTRING && strlen( NodeName ) ) {
+// MESSAGE( "--> GraphEditor::DataFlow::AddNode( " << NodeName << " )" ) ;
+// cout << "--> GraphEditor::DataFlow::AddNode( " << NodeName << " )" << endl ;
+ cdebug_in << "GraphEditor::DataFlow::AddNode( " << NodeName << " )" << endl ;
+ }
+ else {
+// MESSAGE( "--> GraphEditor::DataFlow::AddNode( NULL )" ) ;
+// cout << "--> GraphEditor::DataFlow::AddNode( NULL )" << endl ;
+ NodeName = NULLSTRING ;
+ cdebug_in << "GraphEditor::DataFlow::AddNode( NULL )" << endl ;
+ }
+ if ( _ReadOnly ) {
return (GraphEditor::InNode * ) NULL ;
+ }
_EditedAfterExecution = true ;
- return GraphEditor::OutNode::AddNode( NodeService ,
+ GraphEditor::InNode * aNode = GraphEditor::OutNode::AddNode( NodeService ,
aFuncName , aPythonFunction ,
NodeComponentName ,
NodeInterfaceName ,
NodeLastModification ,
NodeEditorRelease ,
NodeAuthor , NodeComputer ,
- NodeComment , NodeX , NodeY ) ;
+ NodeComment , NodeX , NodeY ) ;
+// MESSAGE( "<-- GraphEditor::DataFlow::AddNode( " << aNode->Name() << " )" ) ;
+// cout << "<-- GraphEditor::DataFlow::AddNode( " << aNode->Name() << " )" << endl ;
+ cdebug_out << "GraphEditor::DataFlow::AddNode( " << aNode->Name() << " )" << endl ;
+ return aNode ;
} ;
inline GraphEditor::InNode * GraphEditor::DataFlow::GetNode( const char* NodeName ) {
} ;
inline bool GraphEditor::DataFlow::RemoveNode( const char* NodeName ) {
- if ( _ReadOnly )
+ if ( _ReadOnly ) {
return false ;
+ }
_EditedAfterExecution = true ;
return GraphEditor::OutNode::RemoveNode( NodeName ) ;
} ;
inline bool GraphEditor::DataFlow::ReNameNode( const char* OldNodeName ,
const char* NewNodeName ) {
- if ( _ReadOnly )
+ if ( _ReadOnly ) {
return false ;
+ }
_EditedAfterExecution = true ;
return GraphEditor::OutNode::ReNameNode( OldNodeName , NewNodeName ) ;
} ;
inline const SALOME_ModuleCatalog::Service * GraphEditor::DataFlow::NodeService(
const char * aNodeName ) {
- if ( GetGraphNode( aNodeName ) )
+ if ( GetGraphNode( aNodeName ) ) {
return GetGraphNode( aNodeName )->GetService() ;
+ }
return NULL ;
}
const char* ToNodeName ,
const char* ToServiceParameterName ,
const CORBA::Any aValue ) {
- if ( _ReadOnly )
+ if ( _ReadOnly ) {
return false ;
+ }
CORBA::Any const * theValue = GetNode( FromNodeName )->GetOutPort( FromServiceParameterName )->Value() ; // Keep the type !
_EditedAfterExecution = true ;
return GraphEditor::OutNode::AddLink( FromNodeName ,
const char* FromServiceParameterName ,
const char* ToNodeName ,
const char* ToServiceParameterName ) {
- if ( _ReadOnly )
+ if ( _ReadOnly ) {
return false ;
+ }
_EditedAfterExecution = true ;
return GraphEditor::OutNode::RemoveLink( FromNodeName ,
FromServiceParameterName ,
delete aNode ;
delete aPort ;
#endif
- if ( !IsValid() )
+ if ( !IsValid() ) {
return false ;
+ }
return GraphBase::Graph::AddInputData( ToNodeName , ToParameterName ,
aValue ) ;
} ;
const char* ToParameterName1 ,
const char* ToNodeName2 ,
const char* ToParameterName2 ) {
- if ( !IsValid() )
+ if ( !IsValid() ) {
return false ;
+ }
return GraphEditor::OutNode::AddInputData( ToNodeName1 , ToParameterName1 ,
ToNodeName2 , ToParameterName2 ) ;
} ;
}
inline long GraphEditor::DataFlow::LevelMax() {
- if ( !IsValid() )
+ if ( !IsValid() ) {
return 0 ;
+ }
return GraphBase::Graph::LevelMax() ;
}
inline SUPERV::ListOfStrings * GraphEditor::DataFlow::LevelNodes(long aLevel ) {
- if ( !IsValid() )
+ if ( !IsValid() ) {
return ((SUPERV::ListOfStrings * ) NULL ) ;
+ }
return GraphBase::Graph::LevelNodes( aLevel ) ;
}
inline long GraphEditor::DataFlow::ThreadsMax() {
- if ( !IsValid() )
+ if ( !IsValid() ) {
return 0 ;
+ }
return GraphBase::Graph::ThreadsMax() ;
}
inline long GraphEditor::DataFlow::GraphsNumber() {
- if ( !IsValid() )
+ if ( !IsValid() ) {
return 0 ;
+ }
return GraphBase::Graph::GraphsNumber() ;
}
// Module : SUPERV
using namespace std;
-#include <string.h>
-#include <strstream>
-#include <iostream>
+//#include <string.h>
+//#include <sstream>
+//#include <iostream>
#include "DataFlowEditor_InNode.hxx"
GraphEditor::InNode::InNode() {
}
+//ostream * fdebug = NULL ;
GraphEditor::InNode::InNode( CORBA::ORB_ptr ORB,
- SALOME_NamingService* ptrNamingService ,
+ SALOME_NamingService * ptrNamingService ,
GraphBase::ListOfFuncName aFuncName ,
GraphBase::ListOfPythonFunctions aPythonFunction ,
const SALOME_ModuleCatalog::Service& aService ,
const char * ComponentName ,
- const char* NodeInterfaceName ,
+ const char * NodeInterfaceName ,
const char * NodeName ,
const SUPERV::KindOfNode akind ,
const SUPERV::SDate NodeFirstCreation ,
const int X ,
const int Y ,
int * Graph_prof_debug,
- ostream * Graph_fdebug) {
+ ofstream * Graph_fdebug) {
SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
-
+// cout << "GraphEditor::InNode::InNode GraphBase::Base::_fdebug " << GraphBase::Base::_fdebug << endl ;
+ cdebug_in << "GraphEditor::InNode::InNode" << endl ;
+// if ( GraphBase::Base::_fdebug )
+// *GraphBase::Base::_fdebug << endl << "xxx-->" << " " << "GraphEditor::InNode::InNode" << endl ;
+// if ( fdebug )
+// (*fdebug) << endl << "xxxxxx-->" << " " << "GraphEditor::InNode::InNode" << endl ;
+// cout << "GraphEditor::InNode::InNode GraphBase::Base::_fdebug " << GraphBase::Base::_fdebug << endl ;
_ComputingNode = NULL ;
_FactoryNode = NULL ;
_InLineNode = NULL ;
_EndOfSwitchNode = NULL ;
switch ( akind ) {
case SUPERV::ComputingNode : {
- cdebug << "GraphEditor::InNode::InNode SUPERV::ComputingNode : " << NodeName ;
+ cdebug << "GraphEditor::InNode::InNode SUPERV::ComputingNode : " << NodeName << endl ;
_ComputingNode = new GraphBase::ComputingNode( ORB , ptrNamingService , aService ,
NodeName , akind ,
NodeFirstCreation ,
break ;
}
case SUPERV::FactoryNode : {
- cdebug << "GraphEditor::InNode::InNode SUPERV::FactoryNode : " << NodeName ;
+// cout << "GraphEditor::InNode::InNode SUPERV::FactoryNode : " << NodeName << endl ;
+ cdebug << "GraphEditor::InNode::InNode SUPERV::FactoryNode : " << NodeName << endl ;
_FactoryNode = new GraphBase::FactoryNode( ORB , ptrNamingService , aService ,
ComponentName , NodeInterfaceName ,
NodeName , akind ,
NodeComputer , NodeComment ,
GeneratedName , X , Y ,
Graph_prof_debug , Graph_fdebug ) ;
+// cout << "GraphEditor::InNode::InNode SUPERV::FactoryNode : " << NodeName << endl ;
_ComputingNode = (GraphBase::ComputingNode *) _FactoryNode ;
break ;
}
case SUPERV::InLineNode : {
- cdebug << "GraphEditor::InNode::InNode SUPERV::InLineNode : " << NodeName ;
+ cdebug << "GraphEditor::InNode::InNode SUPERV::InLineNode : " << NodeName << endl ;
_InLineNode = new GraphBase::InLineNode( ORB , ptrNamingService ,
aFuncName[0].c_str() , *aPythonFunction[0] ,
NodeName , akind ,
break ;
}
case SUPERV::GOTONode : {
- cdebug << "GraphEditor::InNode::InNode SUPERV::GOTONode : " << NodeName ;
+ cdebug << "GraphEditor::InNode::InNode SUPERV::GOTONode : " << NodeName << endl ;
_GOTONode = new GraphBase::GOTONode( ORB , ptrNamingService ,
aFuncName[0].c_str() , *aPythonFunction[0] ,
NodeName , akind ,
X , Y ,
Graph_prof_debug , Graph_fdebug ) ;
_ComputingNode = (GraphBase::ComputingNode *) _GOTONode ;
+ _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
break ;
}
case SUPERV::LoopNode : {
- cdebug << "GraphEditor::InNode::InNode SUPERV::LoopNode : " << NodeName ;
+ cdebug << "GraphEditor::InNode::InNode SUPERV::LoopNode : " << NodeName << endl ;
_LoopNode = new GraphBase::LoopNode( ORB , ptrNamingService ,
aFuncName[0].c_str() , *aPythonFunction[0] ,
aFuncName[1].c_str() , *aPythonFunction[1] ,
Graph_prof_debug , Graph_fdebug ) ;
_ComputingNode = (GraphBase::ComputingNode *) _LoopNode ;
_GOTONode = (GraphBase::GOTONode *) _ComputingNode ;
+ _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
break ;
}
case SUPERV::EndLoopNode : {
- cdebug << "GraphEditor::InNode::InNode SUPERV::EndOfLoopNode : " << NodeName ;
+ cdebug << "GraphEditor::InNode::InNode SUPERV::EndOfLoopNode : " << NodeName << endl ;
_EndOfLoopNode = new GraphBase::EndOfLoopNode(
ORB , ptrNamingService ,
aFuncName[0].c_str() , *aPythonFunction[0] ,
Graph_prof_debug , Graph_fdebug ) ;
_ComputingNode = (GraphBase::ComputingNode *) _EndOfLoopNode ;
_GOTONode = (GraphBase::GOTONode *) _ComputingNode ;
+ _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
break ;
}
case SUPERV::SwitchNode : {
- cdebug << "GraphEditor::InNode::InNode SUPERV::SwitchNode : " << NodeName ;
+ cdebug << "GraphEditor::InNode::InNode SUPERV::SwitchNode : " << NodeName << endl ;
_SwitchNode = new GraphBase::SwitchNode( ORB , ptrNamingService ,
aFuncName[0].c_str() , *aPythonFunction[0] ,
NodeName , akind ,
Graph_prof_debug , Graph_fdebug ) ;
_ComputingNode = (GraphBase::ComputingNode *) _SwitchNode ;
_GOTONode = (GraphBase::GOTONode *) _ComputingNode ;
+ _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
break ;
}
case SUPERV::EndSwitchNode : {
- cdebug << "GraphEditor::InNode::InNode SUPERV::EndOfSwitchNode : " << NodeName ;
+ cdebug << "GraphEditor::InNode::InNode SUPERV::EndOfSwitchNode : " << NodeName << endl ;
_EndOfSwitchNode = new GraphBase::EndOfSwitchNode(
ORB , ptrNamingService ,
aFuncName[0].c_str() , *aPythonFunction[0] ,
Graph_prof_debug , Graph_fdebug ) ;
_ComputingNode = (GraphBase::ComputingNode *) _EndOfSwitchNode ;
_GOTONode = (GraphBase::GOTONode *) _ComputingNode ;
+ _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
break ;
}
+ case SUPERV::DataFlowNode : {
+ cdebug << "GraphEditor::InNode::InNode ERROR SUPERV::DataFlowNode : " << NodeName << endl ;
+ }
+ case SUPERV::UnknownNode : {
+ cdebug << "GraphEditor::InNode::InNode ERROR SUPERV::UnknownNode : " << NodeName << endl ;
+ }
}
- cdebug << "GraphEditor::InNode::InNode " << (void *) this
- << " _ComputingNode " << (void *) _ComputingNode ;
_ComputingNode->InNode( this ) ;
+ cdebug_out << "GraphEditor::InNode::InNode " << (void *) this
+ << " _ComputingNode " << (void *) _ComputingNode << endl ;
}
GraphEditor::InNode::~InNode() {
const int NodeX ,
const int NodeY ,
int * Graph_prof_debug = NULL ,
- ostream * Graph_fdebug = NULL ) ;
+ ofstream * Graph_fdebug = NULL ) ;
virtual ~InNode() ;
char * Name() const { return _ComputingNode->Name() ; } ;
GraphBase::InPort * AddInPort( const char * InputParameterName ,
const char * InputParameterType ) {
- return _ComputingNode->AddInPort( InputParameterName ,
+ return _InLineNode->AddInPort( InputParameterName ,
InputParameterType ) ; } ;
GraphBase::OutPort * AddOutPort( const char * OutputParameterName ,
const char * OutputParameterType ) {
- return _ComputingNode->AddOutPort( OutputParameterName ,
+ return _InLineNode->AddOutPort( OutputParameterName ,
OutputParameterType ) ; } ;
void DelInPort( const char * InputParameterName ) {
- _ComputingNode->DelInPort( InputParameterName ) ; } ;
+ _InLineNode->DelInPort( InputParameterName ) ; } ;
void DelOutPort( const char * OutputParameterName ) {
- _ComputingNode->DelOutPort( OutputParameterName ) ; } ;
+ _InLineNode->DelOutPort( OutputParameterName ) ; } ;
bool IsLinked(const char * ToServiceParameterName ) {
return _ComputingNode->IsLinked( ToServiceParameterName ) ; } ;
// Module : SUPERV
using namespace std;
+#include <sstream>
+#include <iostream>
#include "DataFlowEditor_OutNode.hxx"
#include "DataFlowBase_EndOfLoopNode.hxx"
#include "DataFlowBase_EndOfSwitchNode.hxx"
}
GraphEditor::OutNode::OutNode( CORBA::ORB_ptr ORB ,
- SALOME_NamingService* ptrNamingService ,
- const char *DataFlowName ,
+ SALOME_NamingService * ptrNamingService ,
+ const char * DataFlowName ,
const char * DebugFileName ) :
Graph( ORB , ptrNamingService , DataFlowName , DebugFileName ) {
cdebug_in << "GraphEditor::OutNode::OutNode(" ;
GraphEditor::OutNode::OutNode(
CORBA::ORB_ptr ORB ,
- SALOME_NamingService* ptrNamingService ,
+ SALOME_NamingService * ptrNamingService ,
const SALOME_ModuleCatalog::Service& DataFlowService ,
- const char *DataFlowComponentName ,
- const char *DataFlowInterfaceName ,
- const char *DataFlowName ,
+ const char * DataFlowComponentName ,
+ const char * DataFlowInterfaceName ,
+ const char * DataFlowName ,
const SUPERV::KindOfNode DataFlowkind ,
const SUPERV::SDate DataFlowFirstCreation ,
const SUPERV::SDate DataFlowLastModification ,
// delete _GT ;
}
-bool GraphEditor::OutNode::LoadDataFlow(
- const GraphBase::SGraph *aDataFlow ) {
+bool GraphEditor::OutNode::LoadDataFlow( const GraphBase::SGraph *aDataFlow ) {
bool RetVal = false ;
cdebug_in << "GraphEditor::OutNode::LoadDataFlow() " << aDataFlow->Info.theName.c_str()
<< endl;
-// if ( GraphBase::Service::ServiceName() == NULL ||
-// !strlen( GraphBase::Service::ServiceName() ) || !aConstructor ) {
if ( !_Imported ) {
RetVal = LoadInfo( aDataFlow->Info ) ;
_Imported = true ;
}
- else
+ else {
RetVal = true ;
+ }
- map< string , int > aMapOfNodes ;
- if ( RetVal )
- RetVal = LoadNodes( aMapOfNodes , aDataFlow->Nodes ) ;
- if ( RetVal )
- RetVal = LoadLinks( aMapOfNodes , aDataFlow->Links ) ;
- if ( RetVal ) {
- Valid() ;
- RetVal = LoadDatas( aMapOfNodes , aDataFlow->Datas ) ;
- }
-// }
-// else {
-// cdebug << "GraphEditor::OutNode::LoadDataFlow Error. ServiceName : "
-// << (void *) GraphBase::Service::ServiceName() << " '"
-// << GraphBase::Service::ServiceName() << "'" << endl ;
-// }
+ map< string , int > aMapOfNodes ;
+ if ( RetVal )
+ RetVal = LoadNodes( aMapOfNodes , aDataFlow->Nodes ) ;
+ if ( RetVal )
+ RetVal = LoadLinks( aMapOfNodes , aDataFlow->Links ) ;
+ if ( RetVal ) {
+ Valid() ;
+ RetVal = LoadDatas( aMapOfNodes , aDataFlow->Datas ) ;
+ }
cdebug_out << "GraphEditor::OutNode::LoadDataFlow" << endl;
return RetVal ;
}
bool GraphEditor::OutNode::LoadXml( const char* myFileName ) {
bool RetVal = false ;
GraphBase::SGraph aDataFlow ;
- cdebug_in << "GraphEditor::OutNode::LoadXml() " << endl;
if ( myFileName == NULL ) {
+ cdebug << "GraphEditor::OutNode::LoadXml() No file" << endl;
_Imported = true ;
RetVal = true ;
}
else if ( GraphBase::Graph::LoadXml( _Orb , myFileName , aDataFlow ) ) {
+ cdebug_in << "GraphEditor::OutNode::LoadXml() " << endl;
RetVal = LoadDataFlow( &aDataFlow ) ;
-// if ( RetVal )
-// RetVal = Name( aDataFlow.Info.theName.c_str() ) ;
+ cdebug_out << "GraphEditor::OutNode::LoadXml " << RetVal << endl;
}
- cdebug_out << "GraphEditor::OutNode::LoadXml" << endl;
return RetVal ;
}
GraphEditor::InNode * anInNode ;
cdebug_in << "GraphEditor::OutNode::LoadNodes" << endl ;
int i ;
- for ( i = 0 ; i < aListOfNodes.size() ; i++ ) {
+ for ( i = 0 ; i < (int ) aListOfNodes.size() ; i++ ) {
GraphBase::SNode aNode = aListOfNodes[ i ] ;
-// if ( aConstructor ) {
-// anInNode = AddNode( aNode.theService , aNode.theComponentName.c_str() ,
-// aNode.theInterfaceName.c_str() ,
-// aNode.theName.c_str() ,
-// aNode.theKind ,
-// aNode.theFirstCreation , aNode.theLastModification ,
-// aNode.theEditorRelease.c_str() ,
-// aNode.theAuthor.c_str() , aNode.theContainer.c_str() ,
-// aNode.theComment.c_str() ,
-// aNode.theCoords.theX , aNode.theCoords.theY ) ;
-// }
-// else {
- const char * aNodeName = aNode.theName.c_str() ;
- 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 ;
- anInNode = AddNode( aNode.theService ,
- aNode.theListOfFuncName ,
- aNode.theListOfPythonFunctions ,
- aNode.theComponentName.c_str() ,
- aNode.theInterfaceName.c_str() , aNodeName ,
- aNode.theKind ,
- aNode.theFirstCreation , aNode.theLastModification ,
- aNode.theEditorRelease.c_str() ,
- aNode.theAuthor.c_str() , aNode.theContainer.c_str() ,
- aNode.theComment.c_str() ,
- aNode.theCoords.theX , aNode.theCoords.theY ) ;
- string * aNodetheName = new string( aNode.theName ) ;
- aMapOfNodes[ *aNodetheName ] = GetGraphNodeIndex( anInNode->Name() ) ;
- if ( anInNode->IsOneOfInLineNodes() ) {
- anInNode->GraphEditor::InNode::InLineNode()->DefPortsOfNode(
- _Orb , aNode.theService , anInNode->NamePtr() ,
- anInNode->Kind() ,
-// false , // DataFlowOrComputing
-// anInNode->IsLoopNode() || anInNode->IsEndLoopNode() , // WithInLoop
-// anInNode->IsInLineNode() || anInNode->IsLoopNode() || anInNode->IsSwitchNode() || anInNode->IsEndSwitchNode() , // WithInGate
-// anInNode->IsInLineNode() || anInNode->IsSwitchNode() || anInNode->IsGOTONode() , // WithOutGate
+ const char * aNodeName = aNode.theName.c_str() ;
+ 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 ;
+ }
+ anInNode = AddNode( aNode.theService ,
+ aNode.theListOfFuncName ,
+ aNode.theListOfPythonFunctions ,
+ aNode.theComponentName.c_str() ,
+ aNode.theInterfaceName.c_str() , aNodeName ,
+ aNode.theKind ,
+ aNode.theFirstCreation , aNode.theLastModification ,
+ aNode.theEditorRelease.c_str() ,
+ aNode.theAuthor.c_str() , aNode.theContainer.c_str() ,
+ aNode.theComment.c_str() ,
+ aNode.theCoords.theX , aNode.theCoords.theY ) ;
+ string * aNodetheName = new string( aNode.theName ) ;
+ aMapOfNodes[ *aNodetheName ] = GetGraphNodeIndex( anInNode->Name() ) ;
+ if ( anInNode->IsOneOfInLineNodes() ) {
+ anInNode->GraphEditor::InNode::InLineNode()->DefPortsOfNode(
+ _Orb , aNode.theService , anInNode->NamePtr() ,
+ anInNode->Kind() ,
Graph_prof_debug() , Graph_fdebug() ) ;
- 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 ] ) ;
- }
+ 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 ] ) ;
}
-#if 0
- if ( aNode.theListOfParameters.size() ) {
- int j ;
- for ( j = 0 ; j < aNode.theListOfParameters.size() ; j++ ) {
- if ( IsInLineNode() ) {
- 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 ) ;
- }
- }
+ else if ( aINode->IsInLineNode() || aINode->IsGOTONode() ||
+ aINode->IsSwitchNode() || aINode->IsEndSwitchNode() ) {
+ aINode->SetPythonFunction( aNode.theListOfFuncName[ 0 ].c_str() ,
+ *aNode.theListOfPythonFunctions[ 0 ] ) ;
}
-#endif
-// cout << "LoadNodes " << aNodetheName << " "
-// << GetGraphNodeIndex( anInNode->Name() ) << endl ;
- delete aNodetheName ;
-// }
- if ( !anInNode )
+ }
+ delete aNodetheName ;
+ if ( !anInNode ) {
return false ;
+ }
}
- for ( i = 0 ; i < aListOfNodes.size() ; i++ ) {
+ for ( i = 0 ; i < (int ) aListOfNodes.size() ; i++ ) {
GraphBase::SNode aNode = aListOfNodes[ i ] ;
cdebug << "GraphEditor::OutNode::LoadNodes " << aNode.theName.c_str() << " Coupled to "
<< aNode.theCoupledNode.c_str() << endl ;
cdebug_in << "GraphEditor::OutNode::LoadLinks" << endl ;
// MESSAGE( "GraphEditor::OutNode::LoadLinks" );
int i , j ;
- for ( i = 0 ; i < aListOfLinks.size() ; i++ ) {
+ for ( i = 0 ; i < (int ) aListOfLinks.size() ; i++ ) {
GraphBase::SLink aLink = aListOfLinks[ i ] ;
string * aLinkFromNodeName = new string( aLink.FromNodeName.c_str() ) ;
string * aLinkToNodeName = new string( aLink.ToNodeName.c_str() ) ;
<< aLink.FromServiceParameterName.c_str() << " ) --> "
<< aLinkToNodeName->c_str() << "( "
<< aLink.FromServiceParameterName.c_str() << " )" << endl ;
- RetVal = AddLink( GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() ,
- aLink.FromServiceParameterName.c_str() ,
- GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() ,
- aLink.ToServiceParameterName.c_str() ,
- *((GraphBase::ComputingNode *) GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] ))->GetOutPort( aLink.FromServiceParameterName.c_str() )->Value() ) ;
+ if ( 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() ) ;
+ }
+ else {
+ RetVal = false ;
+ }
// aLink.aLinkValue ) ;
if ( !RetVal )
break ;
else {
- for ( j = 0 ; j < aLink.aListOfCoords.size() ; j++ ) {
+ 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() ,
cdebug_in << "GraphEditor::OutNode::LoadDatas" << endl ;
// MESSAGE( "GraphEditor::OutNode::LoadDatas" );
int i ;
- for ( i = 0 ; i < aListOfDatas.size() ; i++ ) {
+ for ( i = 0 ; i < (int ) aListOfDatas.size() ; i++ ) {
GraphBase::SLink aLink = aListOfDatas[ i ] ;
if ( !strcmp( aLink.FromNodeName.c_str() , Name() ) ) {
cdebug << "GraphEditor::OutNode::LoadDatas Warning "
GraphBase::SGraph * aDataFlow = new GraphBase::SGraph;
aDataFlow->Info = *GetInfo() ;
aDataFlow->Nodes = *GetNodes() ;
- aDataFlow->Links = *GetLinks() ;
+ aDataFlow->Links = *GetLinks( true ) ;
aDataFlow->Datas = *GetDatas() ;
return aDataFlow ;
}
return ((GraphEditor::InNode * ) GetChangeGraphNode( NodeName ))->YCoordinate() ;
}
-GraphEditor::InNode *GraphEditor::OutNode::AddNode(
+GraphEditor::InNode * GraphEditor::OutNode::AddNode(
const SALOME_ModuleCatalog::Service& NodeService ,
GraphBase::ListOfFuncName aFuncName ,
GraphBase::ListOfPythonFunctions aPythonFunction ,
- const char *NodeComponentName ,
- const char* NodeInterfaceName ,
- const char *theNodeName ,
+ const char * NodeComponentName ,
+ const char * NodeInterfaceName ,
+ const char * theNodeName ,
const SUPERV::KindOfNode NodeKindOfNode ,
const SUPERV::SDate NodeFirstCreation ,
const SUPERV::SDate NodeLastModification ,
const char * NodeComment ,
const int NodeX ,
const int NodeY ) {
- cdebug_in << "GraphEditor::OutNode::AddNode(" << NodeComponentName << " , "
- << theNodeName << ")" << endl;
+ cdebug_in << "GraphEditor::OutNode::AddNode( " ;
+ if ( NodeComponentName != NULLSTRING && strlen( NodeComponentName ) ) {
+ cdebug << NodeComponentName << " , " ;
+ }
+ else {
+ cdebug << "NodeComponentName[NULL] )" << endl;
+ }
+ if ( theNodeName != NULLSTRING && strlen( theNodeName ) ) {
+ cdebug << theNodeName << " )" << endl;
+ }
+ else {
+ cdebug << "NodeName[NULL] )" << endl;
+ }
char * RetVal = NULLSTRING ;
GraphEditor::InNode *Nd = NULL ;
char * aNodeName = NULL ;
NodeKindOfNode == SUPERV::SwitchNode ||
NodeKindOfNode == SUPERV::EndSwitchNode ||
NodeKindOfNode == SUPERV::GOTONode ) {
- if ( theNodeName == NULL || strlen( theNodeName ) == 0 ) {
+ if ( theNodeName == NULLSTRING || strlen( theNodeName ) == 0 ) {
if ( NodeKindOfNode == SUPERV::InLineNode ) {
((SALOME_ModuleCatalog::Service& ) NodeService).ServiceName = my_strdup( "InLine" ) ;
}
else {
((SALOME_ModuleCatalog::Service& ) NodeService).ServiceName = CORBA::string_dup( theNodeName ) ;
}
- theNodeName = NULL ;
+ theNodeName = NULLSTRING ;
}
- if ( theNodeName == NULL ) {
+ if ( theNodeName == NULLSTRING || strlen( theNodeName ) == 0 ) {
aNodeName = new char[ strlen( NodeService.ServiceName )+1 ] ;
strcpy( aNodeName , NodeService.ServiceName ) ;
if ( GetGraphNode( NodeService.ServiceName ) ) {
GeneratedName = true ;
while ( GetGraphNode( aNodeName ) ) {
- if ( aNodeName )
+ if ( aNodeName ) {
delete [] aNodeName ;
+ }
int num = GetServiceNameNumber( NodeService.ServiceName ) ;
- ostrstream s ;
- s << num << ends ;
- const char * n_instance = s.str() ;
+ ostringstream astr ;
+ astr << num << ends ;
+ const char * n_instance = astr.str().c_str() ;
int lname = strlen( NodeService.ServiceName ) + 1 +
strlen( n_instance ) + 1 ;
aNodeName = new char[lname] ;
strcpy( aNodeName , theNodeName ) ;
}
}
- if ( aNodeName != NULL ) {
+ if ( aNodeName != NULLSTRING ) {
Nd = new GraphEditor::InNode( _Orb , NamingService() ,
aFuncName , aPythonFunction , NodeService ,
NodeComponentName , NodeInterfaceName ,
}
bool GraphEditor::OutNode::Executable() {
-
cdebug_in << "GraphEditor::OutNode::Executable" << endl;
- if ( !IsValid() )
+ bool NewLink ;
+ if ( LinkLoopNodes( NewLink ) ) {
+ if ( NewLink ) {
+ _Valid = false ;
+ }
+ }
+ else {
+ cdebug << "This DataFlow is not executable." << endl ;
+ _Executable = false ;
+ }
+ if ( !IsValid() ) {
Valid() ;
- if ( !IsValid() )
+ }
+ if ( !IsValid() ) {
return false ;
-// if ( !_GT )
-// GraphExecutor::GraphControl _GT = new GraphExecutor::GraphControl( this );
-
+ }
if ( DataServerNodes() )
_Executable = true ;
else {
link.appendChild( coordlist ) ;
int i ;
- for ( i = 0 ; i < aLink.aListOfCoords.size() ; i++ ) {
+ for ( i = 0 ; i < (int ) aLink.aListOfCoords.size() ; i++ ) {
// f << Tabs << " <coord>" << endl ;
QDomElement coord = Graph.createElement( "coord" ) ;
coordlist.appendChild( coord ) ;
f << ")" << endl ;
}
int i ;
- for ( i = 0 ; i < aLink.aListOfCoords.size() ; i++ ) {
+ for ( i = 0 ; i < (int ) aLink.aListOfCoords.size() ; i++ ) {
f << aLink.ToNodeName.c_str()
<< aLink.ToServiceParameterName.c_str() << ".AddCoord( " << i+1 << " , "
<< aLink.aListOfCoords[ i ].theX << " , "
// f << " <link-list>" << endl ;
QDomElement linklist = Graph.createElement( "link-list" ) ;
dataflow.appendChild( linklist ) ;
- const GraphBase::ListOfLinks * Links = GetLinks() ;
- for ( i = 0 ; i < Links->size() ; i++ ) {
+ const GraphBase::ListOfLinks * Links = GetLinks( true ) ;
+ for ( i = 0 ; i < (int ) Links->size() ; i++ ) {
// f << " <link>" << endl ;
QDomElement link = Graph.createElement( "link" ) ;
linklist.appendChild( link ) ;
QDomElement datalist = Graph.createElement( "data-list" ) ;
dataflow.appendChild( datalist ) ;
const GraphBase::ListOfLinks * Datas = GetDatas() ;
- for ( i = 0 ; i < Datas->size() ; i++ ) {
+ for ( i = 0 ; i < (int ) Datas->size() ; i++ ) {
// f << " <data>" << endl ;
QDomElement data = Graph.createElement( "data" ) ;
datalist.appendChild( data ) ;
bool GraphEditor::OutNode::SavePY( ostream & f ) {
int i ;
+ int j ;
f << endl << "# Generated python file of Graph " << Name() << endl << endl ;
f << "from SuperV import *" << endl ;
f << endl << "# Creation of Factory Nodes" << endl ;
for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
if ( GraphNodes( i )->IsFactoryNode() ) {
+ f << endl ;
((GraphBase::FactoryNode * ) GraphNodes( i ))->SavePY( f , Name() ,
GraphNodes( i )->XCoordinate() ,
GraphNodes( i )->YCoordinate() ) ;
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() ) ;
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() ) ;
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() ) ;
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() ) ;
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() ) ;
const GraphBase::ListOfLinks * Links = GetLinks() ;
bool intervar ;
map< string , int > aMapOfOutPorts ;
- first = true ;
- for ( i = 0 ; i < Links->size() ; i++ ) {
- if ( GetGraphNode( (*Links)[ i ].FromNodeName.c_str() )->IsComputingNode() &&
- GetGraphNode( (*Links)[ i ].ToNodeName.c_str() )->IsComputingNode() ) {
- if ( first ) {
- f << endl
- << "# Creation of intermediate Output variables and of Computing 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 ;
- }
- }
-
-#if 0
first = true ;
for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
- if ( GraphNodes( i )->IsInLineNode() ||
- GraphNodes( i )->IsGOTONode() ) {
- int j ;
- for ( j = 0 ; j < GraphNodes( i )->GetNodeInPortsSize() ; j++ ) {
- if ( GraphNodes( i )->GetNodeInPort( j )->IsBus() ) {
- if ( first ) {
- f << endl
- << "# Creation of Output variables and of Bus Ports"
- << endl ;
- first = false ;
- }
- f << GraphNodes( i )->Name() << ".InOutPort( '"
- << GraphNodes( i )->GetNodeInPort( j )->PortName() << "' , '"
- << GraphNodes( i )->GetNodeInPort( j )->PortType() << "' , '"
- << GraphNodes( i )->GetNodeOutPort( GraphNodes( i )->GetNodeInPort( j )->PortIndex() )->PortName()
- << "' , '"
- << GraphNodes( i )->GetNodeOutPort( GraphNodes( i )->GetNodeInPort( j )->PortIndex() )->PortType()
- << "' )" << endl ;
- }
+ for ( j = 0 ; j < (int ) Links->size() ; j++ ) {
+ if ( !strcmp( GraphNodes( i )->Name() , (*Links)[ j ].FromNodeName.c_str() ) ) {
+ if ( first ) {
+ f << endl
+ << "# Creation of Links"
+ << endl ;
+ first = false ;
+ }
+ 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 ;
}
}
}
-#endif
+#if 0
first = true ;
for ( i = 0 ; i < Links->size() ; i++ ) {
- if ( !( GetGraphNode( (*Links)[ i ].FromNodeName.c_str() )->IsComputingNode() &&
- GetGraphNode( (*Links)[ i ].ToNodeName.c_str() )->IsComputingNode() ) &&
- !( GetGraphNode( (*Links)[ i ].FromNodeName.c_str() )->IsGOTONode() &&
- GetGraphNode( (*Links)[ i ].ToNodeName.c_str() )->IsInLineNode() ) ) {
+ 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 intermediate Output variables and of Control Links"
+ << "# Creation of Switch Links"
<< endl ;
first = false ;
}
delete [] NodePort ;
}
}
+#endif
const GraphBase::ListOfLinks * Datas = GetDatas() ;
first = true ;
- for ( i = 0 ; i < Datas->size() ; i++ ) {
+ for ( i = 0 ; i < (int ) Datas->size() ; i++ ) {
if ( first ) {
f << endl << "# Creation of Input datas" << endl ;
first = false ;
first = true ;
const SALOME_ModuleCatalog::ListOfServicesParameter ListOfInParam = ServiceInParameter() ;
- for ( i = 0 ; i < ListOfInParam.length() ; i++ ) {
+ for ( i = 0 ; i < (int ) ListOfInParam.length() ; i++ ) {
string _aParam = CORBA::string_dup(ListOfInParam[ i ].Parametername) ;
const char * aParam = _aParam.c_str() ;
char * aNodeName ;
char * aPortName ;
- int j , k ;
- for ( j = 0 ; j < strlen( aParam ) ; j++ ) {
+ int j ;
+ for ( j = 0 ; j < (int ) strlen( aParam ) ; j++ ) {
if ( aParam[ j ] == '\\' ) {
aNodeName = new char[ j+1 ] ;
strncpy( aNodeName , aParam , j ) ;
f << endl << "# Creation of Output variables" << endl ;
const SALOME_ModuleCatalog::ListOfServicesParameter ListOfOutParam = ServiceOutParameter() ;
- for ( i = 0 ; i < ListOfOutParam.length() ; i++ ) {
+ for ( i = 0 ; i < (int ) ListOfOutParam.length() ; i++ ) {
string _aParam = CORBA::string_dup(ListOfOutParam[ i ].Parametername) ;
const char * aParam = _aParam.c_str() ;
char * aNodeName ;
char * aPortName ;
- int j , k ;
- for ( j = 0 ; j < strlen( aParam ) ; j++ ) {
+ int j ;
+ for ( j = 0 ; j < (int ) strlen( aParam ) ; j++ ) {
if ( aParam[ j ] == '\\' ) {
aNodeName = new char[ j+1 ] ;
strncpy( aNodeName , aParam , j ) ;
-ostrstream & operator<< (ostrstream & f,const GraphEditor::OutNode & G) {
+ostream & operator<< (ostream & f,const GraphEditor::OutNode & G) {
f << (GraphBase::ComputingNode ) G ;
f << endl ;
};
-ostrstream & operator << (ostrstream &,const GraphEditor::OutNode & G);
+ostream & operator << (ostream &,const GraphEditor::OutNode & G);
ostream & operator << (ostream &,const SUPERV::SDate &);
#endif
const SUPERV::KindOfNode DataFlowkind = SUPERV::ComputingNode ,
const SUPERV::SDate DataFlowFirstCreation = SUPERV::SDate() ,
const SUPERV::SDate DataFlowLastModification = SUPERV::SDate() ,
- const char * DataFlowEditorRelease = NULL ,
- const char * DataFlowAuthor = NULL ,
- const char * DataFlowComputer = NULL ,
- const char * DataFlowComment = NULL ,
- const char * DebugFileName = NULL ) ;
+ const char * DataFlowEditorRelease = NULLSTRING ,
+ const char * DataFlowAuthor = NULLSTRING ,
+ const char * DataFlowComputer = NULLSTRING ,
+ const char * DataFlowComment = NULLSTRING ,
+ const char * DebugFileName = NULLSTRING ) ;
virtual ~DataFlow();
bool LoadDataFlow( const GraphBase::SGraph &aDataFlow ) ;
-void GraphExecutor::InNode::DynInvoke(Engines::Component_ptr obj ,
+void GraphExecutor::InNode::DynInvoke(Engines::Component_ptr objComponent ,
const char *method ,
ServicesAnyData * inParams , int nInParams ,
ServicesAnyData * outParams , int nOutParams ) {
- Request_var req = obj->_request( method ) ;
- const char *s ;
+ Request_var req = objComponent->_request( method ) ;
+ const char *ArgName ;
+ int Type ;
- NVList_ptr arguments =req->arguments() ;
+ NVList_ptr arguments = req->arguments() ;
int i ;
int n_in = nInParams ;
int n_out = nOutParams ;
+ char * aComponent = ObjectToString( objComponent ) ;
+ MESSAGE( aComponent << "->" << method ) ;
for ( i = 0 ; i < n_in ; i++ ) {
CORBA::Any & data = inParams[i].Value ;
- s = inParams[i].Name.c_str() ;
- arguments->add_value( s , data , CORBA::ARG_IN ) ;
-#if 0
- switch ( data.type()->kind() ) {
- case CORBA::tk_string :
+ ArgName = inParams[i].Name.c_str() ;
+ Type = data.type()->kind() ;
+ arguments->add_value( ArgName , data , CORBA::ARG_IN ) ;
+//#if 0
+ switch ( Type ) {
+ case CORBA::tk_string : {
char * t ;
data >>= t ;
- MESSAGE( "ArgIn" << i << " : " << s << " Value " << t << " (string)") ;
+ MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << t << " (string)" ) ;
break ;
- case CORBA::tk_double :
- double d ;
- data >>= d ;
- MESSAGE( "ArgIn" << i << " : " << s << " Value " << d << " (double)") ;
+ }
+ case CORBA::tk_boolean : {
+ bool b ;
+ data >>= (CORBA::Any::to_boolean ) b ;
+ MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << b << " (boolean)" ) ;
+ break ;
+ }
+ case CORBA::tk_char : {
+ unsigned char c ;
+ data >>= (CORBA::Any::to_char ) c ;
+ MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << (int ) c << " (char)" ) ;
+ break ;
+ }
+ case CORBA::tk_short : {
+ short s ;
+ data >>= s ;
+ MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << s << " (short)" ) ;
break ;
- case CORBA::tk_long :
+ }
+ case CORBA::tk_long : {
long l ;
data >>= l ;
- MESSAGE( "ArgIn" << i << " : " << s << " Value " << l << " (long)") ;
+ MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << l << " (long)" ) ;
break ;
- case CORBA::tk_objref :
- MESSAGE( "ArgIn" << i << " : " << s << " Value " << "(object reference)") ;
+ }
+ case CORBA::tk_float : {
+ float f ;
+ data >>= f ;
+ MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << f << " (float)" ) ;
break ;
- default :
- MESSAGE( "ArgIn" << i << " : " << s << " Value " << "(other ERROR)") ;
}
- MESSAGE() ;
-#endif
+ case CORBA::tk_double : {
+ double d ;
+ data >>= d ;
+ MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << d << " (double)" ) ;
+ break ;
+ }
+ case CORBA::tk_objref : {
+ CORBA::Object_ptr obj ;
+ char * retstr = "Catched ERROR";
+ try {
+ data >>= obj ;
+ retstr = ObjectToString( obj ) ;
+ }
+ catch( ... ) {
+ }
+ MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << retstr << "(object reference)" ) ;
+ break ;
+ }
+ default : {
+ MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << "(other ERROR) kind " << Type ) ;
+ }
+ }
+ MESSAGE("") ;
+//#endif
}
for ( i = 0 ; i < n_out ; i++ ) {
CORBA::Any & data = outParams[i].Value ;
- s = outParams[i].Name.c_str() ;
- arguments->add_value( s , data , CORBA::ARG_OUT ) ;
-#if 0
- switch ( data.type()->kind() ) {
- case CORBA::tk_string :
+ ArgName = outParams[i].Name.c_str() ;
+ Type = data.type()->kind() ;
+ arguments->add_value( ArgName , data , CORBA::ARG_OUT ) ;
+//#if 0
+ switch ( Type ) {
+ case CORBA::tk_string : {
char * t ;
data >>= t ;
- MESSAGE( "ArgOut" << i << " : " << s << " Value " << t << " (string)") ;
+ MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << t << " (string)" ) ;
break ;
- case CORBA::tk_double :
- double d ;
- data >>= d ;
- MESSAGE( "ArgOut" << i << " : " << s << " Value " << d << " (double)") ;
+ }
+ case CORBA::tk_boolean : {
+ bool b ;
+ data >>= (CORBA::Any::to_boolean ) b ;
+ MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << b << " (boolean)" ) ;
break ;
- case CORBA::tk_long :
+ }
+ case CORBA::tk_char : {
+ unsigned char c ;
+ data >>= (CORBA::Any::to_char ) c ;
+ MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << (int ) c << " (char)" ) ;
+ break ;
+ }
+ case CORBA::tk_short : {
+ short s ;
+ data >>= s ;
+ MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << s << " (short)" ) ;
+ break ;
+ }
+ case CORBA::tk_long : {
long l ;
data >>= l ;
- MESSAGE( "ArgOut" << i << " : " << s << " Value " << l << " (long)") ;
+ MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << l << " (long)" ) ;
break ;
- case CORBA::tk_objref :
- MESSAGE( "ArgOut" << i << " : " << s << " Value " << "(object reference)") ;
+ }
+ case CORBA::tk_float : {
+ float f ;
+ data >>= f ;
+ MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << f << " (float)" ) ;
+ break ;
+ }
+ case CORBA::tk_double : {
+ double d ;
+ data >>= d ;
+ MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << d << " (double)" ) ;
break ;
- default :
- MESSAGE( "ArgOut" << i << " : " << s << " Value " << "(other ERROR)") ;
}
- MESSAGE() ;
-#endif
+ case CORBA::tk_objref : {
+ CORBA::Object_ptr obj ;
+ char * retstr = "Catched ERROR";
+ try {
+ data >>= obj ;
+ retstr = ObjectToString( obj ) ;
+ }
+ catch( ... ) {
+ }
+ MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << retstr << "(object reference)" ) ;
+ break ;
+ }
+ default : {
+ MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << "(other ERROR) kind " << Type ) ;
+ }
+ }
+ MESSAGE("") ;
+//#endif
}
req->invoke();
const char * aGraphName ,
const char * aNodeName ) {
Request_var req = obj->_request( method ) ;
- const char *s;
NVList_ptr arguments =req->arguments() ;
+// SUPERV GraphExecutor : contains classes that permit execution of graphs and particularly the execution automaton
+//
+// 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 : DataFlowExecutor_InNode.cxx
+// Author : Jean Rahuel, CEA
+// Module : SUPERV
+// $Header:
+
using namespace std;
-//=============================================================================
-// File : DataFlowBase_InNode.cxx
-// Created : 2002
-// Author : Jean Rahuel, CEA
-// Project : SALOME
-// $Header:
-//=============================================================================
#include <stdlib.h>
#include <iostream>
#include <SALOMEconfig.h>
#include CORBA_CLIENT_HEADER(SALOME_Component)
-#include "SALOME_NamingService.hxx"
+//#include "SALOME_NamingService.hxx"
#include "SALOME_LifeCycleCORBA.hxx"
#include "DataFlowBase_FactoryNode.hxx"
#include "DataFlowExecutor_OutNode.hxx"
-static void InitInNode( SUPERV::ControlState &_ControlState ,
+static void InitInNode( int &_RewindStack ,
+ SUPERV::ControlState &_ControlState ,
SUPERV::AutomatonState &_currentState ,
GraphExecutor::InNode ** _aReStartNode ,
bool & _PyFuncRunned ,
GraphExecutor::FiniteStateMachine * theAutomaton ,
CORBA::ORB_ptr * _Orb ,
CORBA::ORB_ptr ORB ) {
+ _RewindStack = 0 ;
_ControlState = SUPERV::VoidState ;
_currentState = SUPERV::UnKnownState ;
*_aReStartNode = NULL ;
//GraphExecutor::InNode::InNode() :
// GraphBase::FactoryNode() {
GraphExecutor::InNode::InNode() {
- InitInNode( _ControlState ,
+ InitInNode( _RewindStack ,
+ _ControlState ,
_currentState ,
&_aReStartNode ,
_PyFuncRunned ,
const int NodeX ,
const int NodeY ,
int * Graph_prof_debug,
- ostream * Graph_fdebug) {
+ ofstream * Graph_fdebug) {
// ostream * Graph_fdebug = NULL ) :
// GraphBase::FactoryNode( ORB , ptrNamingService , aService ,
// ComponentName , NodeInterfaceName ,
// NodeComputer , NodeComment , GeneratedName ,
// 0 , 0 ,
// Graph_prof_debug , Graph_fdebug ) {
- InitInNode( _ControlState ,
+ InitInNode( _RewindStack ,
+ _ControlState ,
_currentState ,
&_aReStartNode ,
_PyFuncRunned ,
NodeX , NodeY ,
Graph_prof_debug , Graph_fdebug ) ;
_ComputingNode = (GraphBase::ComputingNode *) _GOTONode ;
+ _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
break ;
}
case SUPERV::LoopNode : {
Graph_prof_debug , Graph_fdebug ) ;
_ComputingNode = (GraphBase::ComputingNode *) _LoopNode ;
_GOTONode = (GraphBase::GOTONode *) _ComputingNode ;
+ _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
break ;
}
case SUPERV::EndLoopNode : {
Graph_prof_debug , Graph_fdebug ) ;
_ComputingNode = (GraphBase::ComputingNode *) _EndOfLoopNode ;
_GOTONode = (GraphBase::GOTONode *) _ComputingNode ;
+ _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
break ;
}
case SUPERV::SwitchNode : {
Graph_prof_debug , Graph_fdebug ) ;
_ComputingNode = (GraphBase::ComputingNode *) _SwitchNode ;
_GOTONode = (GraphBase::GOTONode *) _ComputingNode ;
+ _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
break ;
}
case SUPERV::EndSwitchNode : {
Graph_prof_debug , Graph_fdebug ) ;
_ComputingNode = (GraphBase::ComputingNode *) _EndOfSwitchNode ;
_GOTONode = (GraphBase::GOTONode *) _ComputingNode ;
+ _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
break ;
}
+ case SUPERV::DataFlowNode : {
+ cdebug << "GraphEditor::InNode::InNode SUPERV::DataFlowNode ERROR : " << NodeName ;
+ }
+ case SUPERV::UnknownNode : {
+ cdebug << "GraphEditor::InNode::InNode SUPERV::UnknownNode ERROR : " << NodeName ;
+ }
}
cdebug << "GraphExecutor::InNode::InNode " << (void *) this
<< " _ComputingNode " << (void *) _ComputingNode ;
}
}
+Engines::Component_var GraphExecutor::InNode::Component() const {
+ if ( IsFactoryNode() ) {
+ return _FactoryNode->Component() ;
+ }
+ else {
+ CORBA::Any const * anAnyComponent = GetChangeNodeInPort( 0 )->GetOutPort()->Value() ; // this
+ CORBA::Object_ptr obj ;
+ try {
+ *anAnyComponent >>= obj ;
+ return Engines::Component::_narrow( obj ) ;
+ }
+ catch( ... ) {
+ cdebug << "GraphExecutor::InNode::Component Component catch" << endl ;
+ }
+ }
+ return Engines::Component::_nil() ;
+}
+
+Engines::Container_var GraphExecutor::InNode::Container() const {
+ if ( IsFactoryNode() ) {
+ return _FactoryNode->Container() ;
+ }
+ return Engines::Container::_nil() ;
+}
+
+
bool GraphExecutor::InNode::Ping() {
// cdebug_in << "GraphExecutor::InNode::Ping" << endl;
bool RetVal ;
}
}
// if ( ( anInPort->IsGate() || anInPort->IsBus() ) && anOutPort == NULL ) {
- if ( ( anInPort->IsGate() ) && anOutPort == NULL ) {
+ if ( anInPort->IsGate() && anOutPort == NULL ) {
Pc-- ;
}
else {
cdebug << "CurrentState = " << theAutomaton->StateName( _currentState )
<< endl;
-#if 0
- GraphExecutor::InNode * anInNode = (GraphExecutor::InNode *) _OutNode->GetGraphNode( "label_begin" ) ;
- const GraphBase::InPort * anInPort = anInNode->GetNodeInPort(0) ;
- GraphBase::OutPort * anOutPort = anInPort->GetLink() ;
- if ( anOutPort ) {
- cdebug << "InPort" << i << " : " << anInPort->PortName() << " from OutPort "
- << anOutPort->PortName() << " from Node " << anOutPort->NodeName()
- << " with state " ;
- if ( anOutPort->State() == SUPERV::WaitingState ) {
- cdebug << "WaitingState" ;
+ cdebug_out << "GraphExecutor::InNode::InitialState" << endl;
+}
+
+const long GraphExecutor::InNode::CpuUsed( bool tot ) {
+ CORBA::Long cpu = 0 ;
+// cdebug_in << "GraphExecutor::InNode::CpuUsed( " << tot << " )" << Name() << endl ;
+ if ( IsOneOfInLineNodes() ) {
+// cdebug << "CpuUsed " << Name() << " --> PyCpuUsed()" << endl ;
+// cout << "CpuUsed " << Name() << " --> PyCpuUsed()" << endl ;
+ cpu = PyCpuUsed( tot ) ;
+ }
+ else {
+ if ( !CORBA::is_nil( Component() ) ) {
+// cdebug << "CpuUsed " << Name() << " --> Component()->CpuUsed_impl()" << endl ;
+// cout << "CpuUsed " << Name() << " --> Component()->CpuUsed_impl()" << endl ;
+ try {
+ cpu = Component()->CpuUsed_impl() ;
+ }
+ catch ( ... ) {
+ cdebug << "CpuUsed " << Name() << " --> Component()->CpuUsed_impl() ERROR catched " << endl ;
+ cpu = 0 ;
+ }
}
- else if ( anOutPort->State() == SUPERV::ReadyState ) {
- cdebug << "ReadyState" ;
+ }
+// cdebug_out << "GraphExecutor::InNode::CpuUsed " << Name() << " CpuUsed : " << cpu << endl ;
+// cout << "CpuUsed " << Name() << " CpuUsed : " << cpu << endl ;
+ return cpu ;
+}
+
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <unistd.h>
+
+long GraphExecutor::InNode::PyCpu() {
+ struct rusage usage ;
+ long cpu ;
+ if ( getrusage( RUSAGE_SELF , &usage ) == -1 ) {
+ perror("GraphExecutor::InNode::PyCpu") ;
+ return 0 ;
+ }
+// return usage.ru_utime.__time_t tv_sec ;
+// cdebug << pthread_self() << "PyCpu " << Name() << " " << usage.ru_utime.tv_sec << " "
+// << usage.ru_utime.tv_usec << " " << usage.ru_stime.tv_sec << " " << usage.ru_stime.tv_usec
+// << endl ;
+ cpu = usage.ru_utime.tv_sec ;
+ return cpu ;
+}
+
+long GraphExecutor::InNode::PyCpuUsed( bool tot ) {
+ long cpu ;
+ if ( _PyTotCpuUsed == -1 ) {
+ if ( _Pythread == pthread_self() ) {
+// cdebug << pthread_self() << "GraphExecutor::InNode::PyCpuUsed(" << tot << ") " << Name()
+// << " _PyTotCpuUsed " << _PyTotCpuUsed << " PyCpu() " << PyCpu() << " - " << " _PyCpuUsed "
+// << _PyCpuUsed << endl ;
+ cpu = PyCpu() - _PyCpuUsed ;
+ if ( tot ) {
+ _PyTotCpuUsed = cpu ;
+ }
}
else {
- cdebug << "???" ;
+ cpu = 0 ;
}
- cdebug << " PortConnected("
- << anOutPort->IsPortConnected() << ") DataConnected("
- << anOutPort->IsDataConnected() << ")" << endl ;
}
-#endif
+ else {
+ cpu = _PyTotCpuUsed ;
+ }
+// cdebug << pthread_self() << "GraphExecutor::InNode::PyCpuUsed(" << tot << ") " << Name() << "_PyTotCpuUsed"
+// << _PyTotCpuUsed << " CpuUsed : " << cpu << endl ;
+ return cpu ;
+}
- cdebug_out << "GraphExecutor::InNode::InitialState" << endl;
+void GraphExecutor::InNode::SetPyCpuUsed() {
+ _PyTotCpuUsed = -1 ;
+ _PyCpuUsed = 0 ;
+ _Pythread = pthread_self() ;
+ _PyCpuUsed = PyCpu() ;
+// cdebug << pthread_self() << "GraphExecutor::InNode::SetPyCpuUsed " << Name() << " _PyCpuUsed : "
+// << _PyCpuUsed << endl ;
}
-//=============================================================================
-// File : DataFlowBase_InNode.hxx
-// Created : 2002
-// Author : Jean Rahuel, CEA
-// Project : SALOME
-// $Header:
-//=============================================================================
+// SUPERV GraphExecutor : contains classes that permit execution of graphs and particularly the execution automaton
+//
+// 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_InNode.hxx
+// Author : Jean Rahuel, CEA
+// Module : SUPERV
+// $Header:
#ifndef _DATAFLOWEXECUTOR_INNODE_HXX
#define _DATAFLOWEXECUTOR_INNODE_HXX
bool _createNewThread ;
bool _createNewThreadIf ;
+ int _RewindStack ;
+ SUPERV::AutomatonState _OldState ;
SUPERV::AutomatonState _currentState ;
+ GraphExecutor::NodeEvent _CurrentEvent ;
SUPERV::ControlState _ControlState ;
SUPERV::AutomatonState _NextState ;
GraphExecutor::StateEventAction _NextAction ;
bool _KillSync ;
pthread_cond_t _StopWait ;
+ pthread_t _Pythread ;
+ long _PyCpuUsed ;
+ long _PyTotCpuUsed ;
+
GraphExecutor::FiniteStateMachine * _Automaton ;
- CORBA::ORB_ptr _Orb;
+ CORBA::ORB_ptr _Orb;
- GraphExecutor::OutNode * _OutNode ;
+ GraphExecutor::OutNode * _OutNode ;
- char * _DataFromNode ;
+ char * _DataFromNode ;
public:
GraphBase::ListOfPythonFunctions aPythonFunction = GraphBase::ListOfPythonFunctions() ,
const SUPERV::SDate NodeFirstCreation = SUPERV::SDate() ,
const SUPERV::SDate NodeLastModification = SUPERV::SDate() ,
- const char * NodeEditorRelease = NULL ,
- const char * NodeAuthor = NULL ,
- const char * NodeComputer = NULL ,
- const char * NodeComment = NULL ,
+ const char * NodeEditorRelease = NULLSTRING ,
+ const char * NodeAuthor = NULLSTRING ,
+ const char * NodeComputer = NULLSTRING ,
+ const char * NodeComment = NULLSTRING ,
const bool GeneratedName = false ,
const int NodeX = 0 ,
const int NodeY = 0 ,
int * Graph_prof_debug = NULL ,
- ostream * Graph_fdebug = NULL ) ;
+ ofstream * Graph_fdebug = NULL ) ;
virtual ~InNode() ;
pthread_t ThreadNo() {
GraphBase::LoopNode * LoopNode() {
return _LoopNode ; } ;
- Engines::Component_var Component() const {
- return _FactoryNode->Component() ; } ;
- Engines::Container_var Container() const {
- return _FactoryNode->Container() ; } ;
+ Engines::Component_var Component() const ;
+ Engines::Container_var Container() const ;
void SetContainer(Engines::Container_var aContainer) {
_FactoryNode->SetContainer( aContainer ) ; } ;
void SetComponent(Engines::Component_var anObjComponent) {
const int GetNodeInPortsSize() const {
return _ComputingNode->GetNodeInPortsSize() ; } ;
+ const GraphBase::InPort *GetNodeInLoop() const {
+ return _ComputingNode->GetNodeInLoop() ; } ;
+ const GraphBase::InPort *GetNodeInGate() const {
+ return _ComputingNode->GetNodeInGate() ; } ;
const GraphBase::InPort *GetNodeInPort(int i) const {
return _ComputingNode->GetNodeInPort( i ) ; } ;
+ GraphBase::InPort *GetChangeNodeInLoop() const {
+ return _ComputingNode->GetChangeNodeInLoop() ; } ;
+ GraphBase::InPort *GetChangeNodeInGate() const {
+ return _ComputingNode->GetChangeNodeInGate() ; } ;
GraphBase::InPort *GetChangeNodeInPort(int i) const {
return _ComputingNode->GetChangeNodeInPort( i ) ; } ;
const int GetNodeOutPortsSize() const {
return _ComputingNode->GetNodeOutPortsSize() ; } ;
+ const GraphBase::OutPort *GetNodeOutLoop() const {
+ return _ComputingNode->GetNodeOutLoop() ; } ;
+ const GraphBase::OutPort *GetNodeOutGate() const {
+ return _ComputingNode->GetNodeOutGate() ; } ;
const GraphBase::OutPort *GetNodeOutPort(int i) const {
return _ComputingNode->GetNodeOutPort( i ) ; } ;
+ GraphBase::OutPort *GetChangeNodeOutLoop() const {
+ return _ComputingNode->GetChangeNodeOutLoop() ; } ;
+ GraphBase::OutPort *GetChangeNodeOutGate() const {
+ return _ComputingNode->GetChangeNodeOutGate() ; } ;
GraphBase::OutPort *GetChangeNodeOutPort(int i) const {
return _ComputingNode->GetChangeNodeOutPort( i ) ; } ;
bool CreateNewThread() { return _createNewThread ; } ;
bool CreateNewThreadIf() { return _createNewThreadIf ; } ;
void NewThread( pthread_t aThread ) ;
- void ExitThread() ;
+ void ExitThread() ;
+ void RewindStack( int aRewindStack ) { _RewindStack = aRewindStack ; } ;
+ int RewindStack() const { return _RewindStack ; } ;
SUPERV::AutomatonState State() const {
return _currentState; };
void State(SUPERV::AutomatonState aState ) {
- cdebug << "GraphExecutor::InNode::State( "
- << Automaton()->StateName( _currentState ) << " --> "
- << Automaton()->StateName( aState ) << " )" << endl ;
+// cdebug << "GraphExecutor::InNode::State( "
+// << Automaton()->StateName( _currentState ) << " --> "
+// << Automaton()->StateName( aState ) << " )" << endl ;
_currentState = aState ; } ;
SUPERV::ControlState ControlState() const {
return _ControlState; };
void InParametersSet( bool & Err ,
int nInParams ,
- ServicesAnyData * aListOfInParameters ) ;
- void InOutParameters( int nOutParams ,
- ServicesAnyData * aListOfOutParameters ) ;
- bool OutParameters( bool Err , SUPERV::GraphState NewState ,
- int nOutParams ,
- ServicesAnyData * aListOfOutParameters ) ;
+ ServicesAnyData * InParametersList ) ;
+ void InOutParametersSet( int nOutParams ,
+ ServicesAnyData * OutParametersList ) ;
+ bool OutParametersSet( bool Err , SUPERV::GraphState NewState ,
+ int nOutParams ,
+ ServicesAnyData * OutParametersList ) ;
void coutbegin() ;
void coutexit() ;
+
+ const long CpuUsed( bool tot = false ) ;
+
+ long PyCpuUsed( bool tot = false ) ;
+ void SetPyCpuUsed() ;
+ long PyCpu() ;
} ;
} ;
+// SUPERV GraphExecutor : contains classes that permit execution of graphs and particularly the execution automaton
+//
+// 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_InNodeThreads.cxx
+// Author : Jean Rahuel, CEA
+// Module : SUPERV
+// $Header:
+
using namespace std;
-//=============================================================================
-// File : DataFlowBase_InNodeThreads.cxx
-// Created : 2002
-// Author : Jean Rahuel, CEA
-// Project : SALOME
-// $Header:
-//=============================================================================
#include <stdlib.h>
#include <iostream>
#include <SALOMEconfig.h>
#include CORBA_CLIENT_HEADER(SALOME_Component)
-#include "SALOME_NamingService.hxx"
+//#include "SALOME_NamingService.hxx"
#include "SALOME_LifeCycleCORBA.hxx"
//#include "DataFlowExecutor_InNode.hxx"
#include "DataFlowExecutor_OutNode.hxx"
-static char *containerName = "FactoryServer" ;
+//static char *containerName = "FactoryServer" ;
int GraphExecutor::InNode::SendEvent(
const GraphExecutor::NodeEvent anEvent ) {
- SUPERV::AutomatonState old_state ;
+ _CurrentEvent = (GraphExecutor::NodeEvent ) anEvent ;
cdebug << pthread_self() << "/" << ThreadNo() << " -->SendEvent Node " << Name()
<< " ControlState : "
<< Automaton()->ControlStateName( ControlState() )
<< " Event : " << Automaton()->EventName( anEvent )
- << " State : " << Automaton()->StateName( State() ) << endl;
+ << " State : " << Automaton()->StateName( State() ) << " _RewindStack " << _RewindStack << endl;
- old_state = State() ;
- _NextState = Automaton()->NextState( old_state , anEvent ) ;
- if ( _NextState == old_state ) {
+ _OldState = State() ;
+ _NextState = Automaton()->NextState( _OldState , anEvent ) ;
+ if ( _NextState == _OldState ) {
cdebug << pthread_self() << "/" << ThreadNo()
<< " GraphExecutor::InNodeThreads::SendEvent SameStates "
- << old_state << endl ;
+ << _OldState << endl ;
_NextAction = GraphExecutor::VoidAction ;
}
else {
}
// State( _NextState ) ;
-// if ( old_state == SUPERV::SuccessedExecutingState ||
-// old_state == SUPERV::ErroredExecutingState ) {
+// if ( _OldState == SUPERV::SuccessedExecutingState ||
+// _OldState == SUPERV::ErroredExecutingState ) {
// DoneAction() ;
// }
cdebug << pthread_self() << "/" << ThreadNo() << " SendedEvent Node "
<< Name() << endl << " ControlState : "
<< Automaton()->ControlStateName( ControlState() ) << endl
- << " OldState : " << Automaton()->StateName( old_state ) << endl
+ << " OldState : " << Automaton()->StateName( _OldState ) << endl
<< " Event : " << Automaton()->EventName( anEvent ) << endl
<< " NextState : " << Automaton()->StateName( _NextState ) << endl
<< " Action : " << Automaton()->ActionName( _NextAction ) << endl
- << " CreateNewThread " << CreateNewThread() << endl ;
+ << " CreateNewThread " << CreateNewThread() << endl
+ << " _RewindStack " << _RewindStack << endl ;
#if 0
cout << pthread_self() << "/" << ThreadNo() << " SendedEvent Node " << Name()
<< endl << " ControlState : "
<< Automaton()->ControlStateName( ControlState() ) << endl
- << " OldState : " << Automaton()->StateName( old_state ) << endl
+ << " OldState : " << Automaton()->StateName( _OldState ) << endl
<< " Event : " << Automaton()->EventName( anEvent ) << endl
<< " NextState : " << Automaton()->StateName( _NextState ) << endl
<< " Action : " << Automaton()->ActionName( _NextAction ) << endl
int sts = executeAction() ;
- cdebug << pthread_self() << "/" << ThreadNo() << " <- SendEvent Node " << Name()
+ cdebug << pthread_self() << "/" << ThreadNo() << " <--- SendEvent Node " << Name()
<< " Event : " << Automaton()->EventName( anEvent )
<< " State : " << Automaton()->StateName( State() )
<< endl;
}
int GraphExecutor::InNode::executeAction() {
+ if ( !CreateNewThread() && _RewindStack > 101 ) {
+ CreateNewThread( true ) ;
+ ThreadNo( 0 ) ;
+ }
if ( CreateNewThread() ) {
CreateNewThread( false ) ;
if ( ThreadNo() == 0 ) {
+ _RewindStack = 1 ;
cdebug << pthread_self() << "/" << ThreadNo()
- << " executeAction start Thread "
+ << " executeAction start Thread _RewindStack " << _RewindStack << " "
<< Automaton()->ActionName( _NextAction ) << "(" << Name() << ")"
<< endl;
pthread_t T;
while ( (pthread_sts = pthread_create(&T, NULL, run_function, this )) ) {
char * msg = "Cannot pthread_create " ;
perror( msg ) ;
- cdebug << ThreadNo() << " " << msg << endl ;
+ cdebug << ThreadNo() << " " << msg << " --> sleep(5)" << endl ;
cdebug << ThreadNo() << " PTHREAD_THREADS_MAX : "
- << PTHREAD_THREADS_MAX << " " << pthread_sts << endl ;
-// sleep( 1 ) ;
+ << PTHREAD_THREADS_MAX << " pthread_create status : " ;
+ if ( pthread_sts == EAGAIN ) {
+ cdebug << "EAGAIN(" << pthread_sts << ")" << endl ;
+ cdebug << "It seems to me that with gdb we are limited to 256 threads because of defunct" << endl ;
+ }
+ else {
+ cdebug << pthread_sts << endl ;
+ }
+ string smsg = msg ;
+ delete [] msg ;
pthread_exit( msg ) ;
}
cdebug << pthread_self() << "/" << ThreadNo()
}
else {
cdebug << pthread_self() << "/" << ThreadNo()
- << " executeAction restart Thread "
+ << " executeAction restart Thread _RewindStack " << _RewindStack << " "
<< Automaton()->StateName( State() ) << " "
<< Automaton()->ActionName( _NextAction ) << "(" << Name()
<< ") ReStartAction ==>" << endl;
- SUPERV::AutomatonState oldstate = State() ;
State( SUPERV::SuspendedSuccessedState ) ;
if ( !ReStartAction( this , GraphExecutor::ReStartEvent ) ) {
-// State( oldstate ) ;
cdebug << pthread_self() << "/" << ThreadNo()
<< " executeAction STATE & CALLED "
<< Automaton()->ActionName( _NextAction ) << "(" << Name()
<< ") ERROR-DEBUG " << endl;
-// return ExecuteAction() ;
}
else {
cdebug << pthread_self() << "/" << ThreadNo() << " executeAction NO CALL "
}
}
else {
+ if ( _CurrentEvent == ExecuteEvent ) {
+ _RewindStack += 1 ;
+ }
cdebug << pthread_self() << "/" << ThreadNo() << " executeAction call "
- << Automaton()->ActionName( _NextAction ) << "(" << Name() << ")"
+ << Automaton()->ActionName( _NextAction ) << "(" << Name() << ") _RewindStack " << _RewindStack
<< endl;
return ExecuteAction() ;
}
- return 1;
+ return 1 ;
}
void GraphExecutor::InNode::coutbegin() {
cdebug << ThreadNo() << " " << pthread_self() << " run_function begin"
- << " " << Name() << " " << Automaton()->StateName( State() )
- << endl ;
+ << " " << Name() << " " << Automaton()->StateName( State() ) << endl ;
}
void GraphExecutor::InNode::coutexit() {
- cdebug << pthread_self() << "/" << ThreadNo() << " run_function pthread_exit"
- << " " << Name() << " " << Automaton()->StateName( State() )
- << endl ;
+ cdebug << pthread_self() << "/" << ThreadNo() << " run_function pthread_exit _RewindStack " << _RewindStack
+ << " " << Name() << " " << Automaton()->StateName( State() ) << endl ;
}
void * run_function(void *p) {
GraphExecutor::InNode *aNode = (GraphExecutor::InNode *) p;
}
aNode->ExecuteAction() ;
char * msg = new char[40] ;
- sprintf( msg , "%d" , aNode->ThreadNo() ) ;
+ sprintf( msg , "%d" , (int ) aNode->ThreadNo() ) ;
strcat( msg , " thread exit" ) ;
aNode->coutexit() ;
aNode->ExitThread() ;
string smsg = msg ;
+ delete [] msg ;
pthread_exit( (void * ) smsg.c_str() ) ;
return msg ;
}
bool LoopBeginning = false ;
bool SwitchFinished = false ;
- if ( IsEndLoopNode() && !GetChangeNodeInPort( 0 )->GetOutPort()->BoolValue() ) {
+ if ( IsEndLoopNode() && !GetChangeNodeInLoop()->GetOutPort()->BoolValue() ) {
LoopFinished = true ; // End of Loop
}
- if ( IsLoopNode() && GetChangeNodeInPort( 1 )->GetOutPort()->BoolValue() ) {
+ if ( IsLoopNode() && GetChangeNodeInLoop()->GetOutPort()->BoolValue() ) {
LoopBeginning = true ; // Beginning of Loop
}
- if ( IsEndSwitchNode() && !GetChangeNodeInPort( 0 )->GetOutPort()->BoolValue() ) {
+ if ( IsEndSwitchNode() && !GetChangeNodeInGate()->GetOutPort()->BoolValue() ) {
SwitchFinished = true ;
}
- for ( k = 0 ; k < GetNodeInPortsSize() ; k++ ) {
+ for ( k = 0 ; k < (unsigned int ) GetNodeInPortsSize() ; k++ ) {
GraphBase::InPort * anInPort = GetChangeNodeInPort(k) ;
GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
if ( anInPort->IsGate() && anOutPort == NULL ) {
#endif
cdebug << endl ;
}
-// else if ( LoopBeginning && anInPort->IsDataConnected() ) {
else if ( IsLoopNode() && anInPort->IsDataConnected() ) {
anInPort->State( SUPERV::ReadyState ) ;
InReady += 1 ;
bool Err = false ;
int nInParams = GetNodeInPortsSize() ;
- ServicesAnyData * aListOfInParameters = new ServicesAnyData[nInParams];
- InParametersSet( Err , nInParams , aListOfInParameters ) ;
+ ServicesAnyData * InParametersList = new ServicesAnyData[nInParams];
+ InParametersSet( Err , nInParams , InParametersList ) ;
Engines::Container_var myContainer ;
Engines::Component_var myObjComponent ;
if ( IsComputingNode() ) {
ObjInterface( true ) ;
CORBA::Object_ptr obj ;
- aListOfInParameters[1].Value >>= obj ;
+ InParametersList[0].Value >>= obj ;
CORBA::Object_var objvar = CORBA::Object_var( obj ) ;
myObjComponent = Engines::Component::_narrow( objvar ) ;
}
myContainer , myObjComponent ) ;
// if ( !Err && nInParams > 1 &&
// strcmp( ComponentName() , InterfaceName() ) &&
-// aListOfInParameters[ 1 ].Value.type()->kind() ==
+// InParametersList[ 1 ].Value.type()->kind() ==
// CORBA::tk_objref ) {
// }
// else {
}
int nOutParams = GetNodeOutPortsSize() ;
- ServicesAnyData * aListOfOutParameters = new ServicesAnyData[nOutParams];
- InOutParameters( nOutParams , aListOfOutParameters ) ;
+ ServicesAnyData * OutParametersList = new ServicesAnyData[nOutParams];
+ InOutParametersSet( nOutParams , OutParametersList ) ;
// if ( strlen( ComponentName() ) ) {
if ( Err || ControlState() == SUPERV::ToKillState ||
else {
if ( !Err ) {
cdebug << ThreadNo() << " Run( '" << ServiceName() << "'" ;
- for ( i = 0 ; i < nInParams ; i++ ) {
- cdebug << " , " << aListOfInParameters[ i ].Name ;
+ for ( i = 0 ; i < (int ) ServiceInParameter().length() ; i++ ) {
+ cdebug << " , " << InParametersList[ i ].Name << "[kind"
+ << InParametersList[ i ].Value.type()->kind() << "]" ;
+ }
+ for ( i = 0 ; i < (int ) ServiceOutParameter().length() ; i++ ) {
+ cdebug << " , " << OutParametersList[ i ].Name << "[kind"
+ << OutParametersList[ i ].Value.type()->kind() << "]" ;
}
cdebug << ")" << endl ;
if ( IsOneOfInLineNodes() ) {
bool StsPyDynInvoke = true ;
- _OutNode->PThreadLock() ;
+ _OutNode->PyThreadLock() ;
+ SetPyCpuUsed() ;
try {
if ( IsInLineNode() && (*InLineNode()->PythonFunction()).length() &&
strlen( InLineNode()->PyFuncName() ) ) {
<< "' IsInLineNode PyDynInvoke" << endl ;
StsPyDynInvoke = PyDynInvoke( InLineNode()->PyRunMethod() ,
InLineNode()->PyFuncName() ,
- &aListOfInParameters[1] , ServiceInParameter().length() ,
- &aListOfOutParameters[1] , ServiceOutParameter().length() ) ;
+ &InParametersList[0] , ServiceInParameter().length() ,
+ &OutParametersList[0] , ServiceOutParameter().length() ) ;
}
else if ( IsLoopNode() ) {
- if ( GetNodeInPort( 1 )->GetOutPort()->BoolValue() ) { // InLoop Port
+ if ( GetNodeInLoop()->GetOutPort()->BoolValue() ) { // InLoop Port
cdebug << ThreadNo() << " !ObjInterface " << Name()
<< " IsLoopNode PyDynInvoke '" << InLineNode()->PyFuncName()
<< "'" << endl ;
StsPyDynInvoke = PyDynInvoke( InLineNode()->PyRunMethod() ,
InLineNode()->PyFuncName() ,
- &aListOfInParameters[2] , ServiceInParameter().length() ,
- &aListOfOutParameters[1] , ServiceOutParameter().length() ) ;
+ &InParametersList[1] , ServiceInParameter().length() ,
+ &OutParametersList[1] , ServiceOutParameter().length() ) ;
}
else {
cdebug << ThreadNo() << " !ObjInterface " << Name()
<< "'" << endl ;
StsPyDynInvoke = PyDynInvoke( LoopNode()->PyNextMethod() ,
LoopNode()->PyNextName() ,
- &aListOfInParameters[2] , ServiceInParameter().length() ,
- &aListOfOutParameters[1] , ServiceOutParameter().length() ) ;
+ &InParametersList[1] , ServiceInParameter().length() ,
+ &OutParametersList[1] , ServiceOutParameter().length() ) ;
}
if ( StsPyDynInvoke ) {
cdebug << ThreadNo() << " !ObjInterface " << Name()
<< "' Copy of " << ServiceInParameter().length()
<< " OutParameters" << endl ;
int i ;
- for ( i = 0 ; i < ServiceInParameter().length() ; i++ ) {
- aListOfInParameters[2 + i].Value = aListOfOutParameters[1+ i].Value ;
- aListOfInParameters[2 + i].Name = aListOfOutParameters[1+ i].Name ;
- switch ( aListOfInParameters[2 + i].Value.type()->kind() ) {
+ for ( i = 1 ; i <= (int ) ServiceInParameter().length() ; i++ ) {
+ InParametersList[i].Value = OutParametersList[i].Value ;
+ InParametersList[i].Name = OutParametersList[i].Name ;
+//#if 0
+ switch ( InParametersList[i].Value.type()->kind() ) {
case CORBA::tk_string :
- cdebug << "Arg" << i << " : "
- << aListOfInParameters[2 + i].Name.c_str()
- << " Value(string) " << endl ;
+ char * t;
+ InParametersList[i].Value >>= t ;
+ cdebug << "ArgOut->In" << i << " : "
+ << InParametersList[i].Name.c_str()
+ << " Value(string) " << t << endl ;
break ;
case CORBA::tk_double :
- cdebug << "Arg" << i << " : "
- << aListOfInParameters[2 + i].Name.c_str()
- << " Value(double) " << endl ;
+ double d;
+ InParametersList[i].Value >>= d;
+ cdebug << "ArgOut->In" << i << " : "
+ << InParametersList[i].Name.c_str()
+ << " Value(double) " << d << endl ;
break ;
case CORBA::tk_long :
- cdebug << "Arg" << i << " : "
- << aListOfInParameters[2 + i].Name.c_str()
- << " Value(long) " << endl ;
+ long l;
+ InParametersList[i].Value >>= l;
+ cdebug << "ArgOut->In" << i << " : "
+ << InParametersList[i].Name.c_str()
+ << " Value(long) " << l << endl ;
break ;
case CORBA::tk_objref :
- cdebug << "Arg" << i << " : "
- << aListOfInParameters[2 + i].Name.c_str()
- << " Value(object reference) " << endl ;
+ CORBA::Object_ptr obj ;
+ char * retstr ;
+ try {
+ InParametersList[i].Value >>= obj ;
+ retstr = ObjectToString( obj );
+ cdebug << "ArgOut->In" << i << " : "
+ << InParametersList[i].Name.c_str()
+ << " Value(object reference) " << retstr << endl ;
+ }
+ catch ( ... ) {
+ cdebug << "ArgOut->In" << i << " : "
+ << InParametersList[i].Name.c_str()
+ << " Value(object reference) Catched ERROR" << endl ;
+ }
break ;
default :
- cdebug << "Arg" << i << " : "
- << aListOfInParameters[2 + i].Name.c_str()
+ cdebug << "ArgOut->In" << i << " : "
+ << InParametersList[i].Name.c_str()
<< " Value(other) ERROR" << endl ;
}
+//#endif
}
StsPyDynInvoke = PyDynInvoke( LoopNode()->PyMoreMethod() ,
LoopNode()->PyMoreName() ,
- &aListOfInParameters[2] , ServiceInParameter().length() ,
- &aListOfOutParameters[0] , ServiceOutParameter().length()+1 ) ;
+ &InParametersList[1] , ServiceInParameter().length() ,
+ &OutParametersList[0] , ServiceOutParameter().length()+1 ) ;
}
else {
Err = true ;
<< "' IsSwitchNode PyDynInvoke" << endl ;
StsPyDynInvoke = PyDynInvoke( InLineNode()->PyRunMethod() ,
InLineNode()->PyFuncName() ,
- &aListOfInParameters[1] , ServiceInParameter().length() ,
- &aListOfOutParameters[1] , ServiceOutParameter().length() ) ;
+ &InParametersList[0] , ServiceInParameter().length() ,
+ &OutParametersList[0] , ServiceOutParameter().length() ) ;
}
else if ( IsGOTONode() && (*GOTONode()->PythonFunction()).length() &&
strlen( InLineNode()->PyFuncName() ) ) {
<< "' IsGOTONode PyDynInvoke" << endl ;
StsPyDynInvoke = PyDynInvoke( InLineNode()->PyRunMethod() ,
InLineNode()->PyFuncName() ,
- &aListOfInParameters[1] , ServiceInParameter().length() ,
- &aListOfOutParameters[1] , ServiceOutParameter().length() ) ;
+ &InParametersList[0] , ServiceInParameter().length() ,
+ &OutParametersList[0] , ServiceOutParameter().length() ) ;
}
else if ( IsEndSwitchNode() && (*InLineNode()->PythonFunction()).length() &&
strlen( InLineNode()->PyFuncName() ) ) {
<< "' IsSwitchNode PyDynInvoke" << endl ;
StsPyDynInvoke = PyDynInvoke( InLineNode()->PyRunMethod() ,
InLineNode()->PyFuncName() ,
- &aListOfInParameters[1] , ServiceInParameter().length() ,
- &aListOfOutParameters[0] , ServiceOutParameter().length() ) ;
+ &InParametersList[0] , ServiceInParameter().length() ,
+ &OutParametersList[0] , ServiceOutParameter().length() ) ;
}
else if ( (*InLineNode()->PythonFunction()).length() == 0 ||
strlen( InLineNode()->PyFuncName() ) == 0 ) {
<< " Copy of " << ServiceInParameter().length()
<< " OutParameters" << endl ;
int i ;
- int argind0 = 0 ;
- if ( IsEndSwitchNode() ) {
- argind0 = 0 ;
+ int argout0 = 0 ;
+ int argin0 = 0 ;
+ if ( IsEndLoopNode() ) {
+ argout0 = 1 ;
+ argin0 = 1 ; // after DoLoop
}
- else if ( IsEndLoopNode() || IsGOTONode() ) {
- argind0 = 1 ;
- }
- for ( i = 0 ; i < ServiceInParameter().length() ; i++ ) {
- aListOfOutParameters[argind0 + i].Value = aListOfInParameters[ 1 + i].Value ;
-// aListOfOutParameters[argind0 + i].Name = aListOfInParameters[argind0 + i].Name ;
- switch ( aListOfInParameters[ 1 + i].Value.type()->kind() ) {
+ for ( i = 0 ; i < (int ) ServiceInParameter().length() ; i++ ) {
+ OutParametersList[argout0 + i].Value = InParametersList[argin0 + i].Value ;
+//#if 0
+ switch ( InParametersList[argin0 + i].Value.type()->kind() ) {
case CORBA::tk_string :
- cdebug << "Arg" << i << " : "
- << aListOfInParameters[ 1 + i].Name.c_str()
+ cdebug << "ArgOut->In" << argin0 + i << " : "
+ << InParametersList[argin0 + i].Name.c_str()
<< " Value(string) "
- << aListOfOutParameters[argind0 + i].Name.c_str() << endl ;
+ << OutParametersList[argin0 + i].Name.c_str() << endl ;
break ;
case CORBA::tk_double :
- cdebug << "Arg" << i << " : "
- << aListOfInParameters[ 1 + i].Name.c_str()
+ cdebug << "ArgOut->In" << argin0 + i << " : "
+ << InParametersList[argin0 + i].Name.c_str()
<< " Value(double) "
- << aListOfOutParameters[argind0 + i].Name.c_str() << endl ;
+ << OutParametersList[argin0 + i].Name.c_str() << endl ;
break ;
case CORBA::tk_long :
- cdebug << "Arg" << i << " : "
- << aListOfInParameters[ 1 + i].Name.c_str()
+ cdebug << "ArgOut->In" << argin0 + i << " : "
+ << InParametersList[argin0 + i].Name.c_str()
<< " Value(long) "
- << aListOfOutParameters[argind0 + i].Name.c_str() << endl ;
+ << OutParametersList[ i ].Name.c_str() << endl ;
break ;
case CORBA::tk_objref :
- cdebug << "Arg" << i << " : "
- << aListOfInParameters[ 1 + i].Name.c_str()
+ cdebug << "ArgOut->In" << argin0 + i << " : "
+ << InParametersList[argin0 + i].Name.c_str()
<< " Value(object reference) "
- << aListOfOutParameters[argind0 + i].Name.c_str() << endl ;
+ << OutParametersList[argin0 + i].Name.c_str() << endl ;
break ;
default :
- cdebug << "Arg" << i << " : "
- << aListOfInParameters[ 1 + i].Name.c_str()
+ cdebug << "ArgOut->In" << argin0 + i << " : "
+ << InParametersList[argin0 + i].Name.c_str()
<< " Value(other) ERROR "
- << aListOfOutParameters[argind0 + i].Name.c_str() << endl ;
+ << OutParametersList[argin0 + i].Name.c_str() << endl ;
}
+//#endif
}
}
if ( !StsPyDynInvoke ) {
<< " Python Dynamic Call Exception catched ERROR"
<< endl ;
}
- _OutNode->PThreadUnLock() ;
+ CpuUsed( true ) ;
+ _OutNode->PyThreadUnLock() ;
}
-// else if ( !ObjInterface() ) {
- else if ( IsFactoryNode() ) {
+ else {
try {
try {
DynInvoke( myObjComponent, "Names" ,
<< " IsComputingNode DynInvoke" << endl ;
DynInvoke( myObjComponent,
ServiceName() ,
- &aListOfInParameters[1] , ServiceInParameter().length() ,
- &aListOfOutParameters[1] , ServiceOutParameter().length() ) ;
+ &InParametersList[1] , ServiceInParameter().length()-1 ,
+ &OutParametersList[0] , ServiceOutParameter().length() ) ;
}
else if ( IsFactoryNode() ) {
cdebug << ThreadNo() << " !ObjInterface " << Name()
<< " IsFactoryNode DynInvoke" << endl ;
DynInvoke( myObjComponent,
ServiceName() ,
- &aListOfInParameters[1] , ServiceInParameter().length() ,
- &aListOfOutParameters[1] , ServiceOutParameter().length() ) ;
+ &InParametersList[0] , ServiceInParameter().length() ,
+ &OutParametersList[0] , ServiceOutParameter().length() ) ;
}
}
catch( ... ) {
<< endl ;
}
}
- else {
- try {
- try {
- DynInvoke( myObjComponent, "Names" ,
- _OutNode->Name() , Name() ) ;
- }
- catch( ... ) {
- }
- cdebug << ThreadNo() << " ObjInterface " << Name() << " DynInvoke"
- << endl ;
- DynInvoke( myObjComponent ,
- ServiceName() ,
- &aListOfInParameters[2] , ServiceInParameter().length()-1 ,
- &aListOfOutParameters[1] , ServiceOutParameter().length() ) ;
- }
- catch( ... ) {
- Err = true ;
- cdebug << ThreadNo() << " ObjInterface " << Name()
- << " Node(Interface) Dynamic Call Exception catched ERROR"
- << endl ;
- }
- }
}
}
// }
NewEvent = GraphExecutor::SuccessEvent ;
}
- bool ErrOut = OutParameters( Err , PortState , nOutParams , aListOfOutParameters ) ;
+ bool ErrOut = OutParametersSet( Err , PortState , nOutParams , OutParametersList ) ;
if ( !ErrOut ) {
NewEvent = GraphExecutor::ErrorEvent ;
}
- delete [] aListOfInParameters ;
- delete [] aListOfOutParameters ;
+ delete [] InParametersList ;
+ delete [] OutParametersList ;
SendEvent( NewEvent );
else if ( anInPort->State() != SUPERV::WaitingState ) {
if ( !docdebug ) {
cdebug << ThreadNo()
- << " --> GraphExecutor::InNodeThreads::SetWaitingStates "
- << Name() << endl;
+ << " --> GraphExecutor::InNodeThreads::SetWaitingStates " << Name() << endl;
docdebug = true ;
}
anInPort->State( SUPERV::WaitingState ) ;
}
}
for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
- if ( !( IsGOTONode() && i == 0 ) && !( IsEndLoopNode() && i <= 1 ) ) {
- for ( j = 0 ; j < GetChangeNodeOutPort( i )->InPortsSize() ; j++ ) {
- GraphExecutor::InNode * aNode = (GraphExecutor::InNode * ) _OutNode->GetChangeGraphNode( GetChangeNodeOutPort( i )->ChangeInPorts( j )->NodeName() )->GetInNode() ;
+ for ( j = 0 ; j < GetChangeNodeOutPort( i )->InPortsSize() ; j++ ) {
+ GraphBase::OutPort * anOutPort = GetChangeNodeOutPort( i ) ;
+// if ( !( IsGOTONode() && i == 0 ) && !( IsEndLoopNode() && i <= 1 ) ) {
+ if ( !( IsGOTONode() && anOutPort->IsGate() ) &&
+ !( IsEndLoopNode() && ( anOutPort->IsGate() || anOutPort->IsLoop() ) ) ) {
+ GraphExecutor::InNode * aNode = (GraphExecutor::InNode * ) _OutNode->GetChangeGraphNode( anOutPort->ChangeInPorts( j )->NodeName() )->GetInNode() ;
if ( aNode != EndNode ) {
aNode->SetWaitingStates( EndNode ) ;
}
DoneAction() ;
if ( IsGOTONode() ||
- ( IsEndLoopNode() && GetNodeInPort(0)->GetOutPort()->BoolValue() ) ) {
-// int index ;
-// if ( IsGOTONode() ) {
-// index = 0 ;
-// }
-// else {
-// index = 1 ;
-// CORBA::Any * anAny = new CORBA::Any() ;
-// *anAny <<= (long ) 0 ;
-// GetChangeNodeOutPort(1)->Value( anAny ) ; // Loop(InLoop) = false
-// }
-// const GraphBase::OutPort * GateOutPort = GetNodeOutPort(index) ;
- const GraphBase::OutPort * GateOutPort = GetNodeOutPort(0) ;
- for ( i = 0 ; i < GateOutPort->InPortsSize() ; i++ ) {
- const GraphBase::InPort * anInPort = GateOutPort->InPorts( i ) ;
+ ( IsEndLoopNode() && GetNodeInLoop()->GetOutPort()->BoolValue() ) ) {
+ const GraphBase::OutPort * aGateOutPort ;
+ if ( IsGOTONode() ) {
+ aGateOutPort = GetNodeOutGate() ;
+ }
+ else {
+ aGateOutPort = GetNodeOutLoop() ;
+ }
+ for ( i = 0 ; i < aGateOutPort->InPortsSize() ; i++ ) {
+ const GraphBase::InPort * anInPort = aGateOutPort->InPorts( i ) ;
GraphExecutor::InNode * aLabelNode = (GraphExecutor::InNode *) _OutNode->GetChangeGraphNode( anInPort->NodeName() )->GetInNode() ;
+ cdebug << ThreadNo() << " Successed_SuccessAction " << Name() << " will Loop to HeadNode "
+ << aLabelNode->Name() << " from port " << anInPort->PortName() << endl ;
aLabelNode->SetWaitingStates( this ) ;
- for ( j = 1 ; j < GetNodeOutPortsSize() ; j++ ) {
+ for ( j = 0 ; j < aLabelNode->GetNodeInPortsSize() ; j++ ) {
+ const GraphBase::InPort * anInPort = aLabelNode->GetNodeInPort( j ) ;
+ if ( anInPort->GetOutPort() ) {
+ cdebug << aLabelNode->Name() << "(" << anInPort->PortName() << ") value : "
+ << anInPort->GetOutPort()->NodeName() << "(" << anInPort->GetOutPort()->PortName() << ")"
+ << endl ;
+ }
+ }
+ for ( j = 0 ; j < GetNodeOutPortsSize() ; j++ ) {
GraphBase::OutPort * aBusParamOutPort = GetChangeNodeOutPort( j ) ;
- GraphBase::InPort * aBusParamChangeInPort = NULL ;
-// if ( aBusParamOutPort->IsLoop() ) {
-// aBusParamChangeInPort = aLabelNode->GetChangeInPort( "InitLoop" ) ;
-// }
-// else {
- aBusParamChangeInPort = aLabelNode->GetChangeInPort( aBusParamOutPort->PortName() ) ;
-// }
- if ( aBusParamChangeInPort ) {
- aBusParamChangeInPort->ChangeOutPort( aBusParamOutPort ) ;
- if ( !aLabelNode->IsLockedDataWait() ) {
- res = aLabelNode->SendSomeDataReady( Name() ) ;
- if ( res ) {
- if ( firsttoNode == NULL &&
- aLabelNode->ThreadNo() == pthread_self() ) {
- firsttoNode = aLabelNode ;
- cdebug << ThreadNo() << " Successed_SuccessAction firsttoNode "
- << aLabelNode->Name() << endl ;
- }
- else if ( firstzeroNode == NULL &&
- aLabelNode->ThreadNo() == 0 ) {
- firstzeroNode = aLabelNode ;
- }
- else {
- SomeDataNodes.push_back( aLabelNode ) ;
- cdebug << ThreadNo() << " Successed_SuccessAction push "
- << SomeDataNodes.size() << " " << aLabelNode->Name()
- << endl ;
+ if ( !aBusParamOutPort->IsGate() ) {
+ GraphBase::InPort * aBusParamChangeInPort = NULL ;
+ if ( aBusParamOutPort->IsLoop() ) {
+ aBusParamChangeInPort = aLabelNode->GetChangeNodeInLoop() ;
+ }
+ else {
+ aBusParamChangeInPort = aLabelNode->GetChangeInPort( aBusParamOutPort->PortName() ) ;
+ }
+ if ( aBusParamChangeInPort ) {
+ aBusParamChangeInPort->ChangeOutPort( aBusParamOutPort ) ;
+ cdebug << ThreadNo() << " Successed_SuccessAction " << Name() << " ChangeOutPort to HeadNode "
+ << aLabelNode->Name() << "(" << aBusParamChangeInPort->PortName() << ") from port "
+ << aBusParamOutPort->PortName() << endl ;
+ if ( !aLabelNode->IsLockedDataWait() ) {
+ res = aLabelNode->SendSomeDataReady( Name() ) ;
+ if ( res ) {
+ if ( firsttoNode == NULL &&
+ aLabelNode->ThreadNo() == pthread_self() ) {
+ firsttoNode = aLabelNode ;
+ cdebug << ThreadNo() << " Successed_SuccessAction firsttoNode "
+ << aLabelNode->Name() << endl ;
+ }
+ else if ( firstzeroNode == NULL &&
+ aLabelNode->ThreadNo() == 0 ) {
+ firstzeroNode = aLabelNode ;
+ }
+ else {
+ SomeDataNodes.push_back( aLabelNode ) ;
+ cdebug << ThreadNo() << " Successed_SuccessAction push "
+ << SomeDataNodes.size() << " " << aLabelNode->Name()
+ << endl ;
+ }
}
}
- }
+ else {
+ cdebug << ThreadNo()
+ << " Successed_SuccessAction Loop to HeadNode "
+ << aLabelNode->Name() << " with datas from " << Name() << "("
+ << aBusParamOutPort->PortName() << ") to port "
+ << aBusParamChangeInPort->PortName() << endl;
+ }
+ }
else {
- cdebug << ThreadNo()
- << " Successed_SuccessAction Loop to HeadNode "
- << aLabelNode->Name() << " with datas from "
- << aBusParamOutPort->PortName() << " to port "
- << aBusParamChangeInPort->PortName() << endl;
+ cdebug << ThreadNo() << " ERROR in Successed_SuccessAction of " << Name()
+ << " NO port " << aBusParamOutPort->PortName() << " in "
+ << aLabelNode->Name() << endl;
}
- }
- else {
- cdebug << ThreadNo() << " ERROR in Successed_SuccessAction of " << Name()
- << " NO port " << aBusParamOutPort->PortName() << " in "
- << aLabelNode->Name() << endl;
}
}
-// const GraphBase::OutPort * aGateOutPort = GetNodeOutPort( index ) ;
-// const GraphBase::InPort * aGateInPort = aLabelNode->GetNodeInPort( index ) ;
- const GraphBase::OutPort * aGateOutPort = GetNodeOutPort( 0 ) ; // DoLoop or OutGate
- const GraphBase::InPort * aGateInPort = aLabelNode->GetNodeInPort( 0 ) ;
+ for ( j = 0 ; j < aLabelNode->GetNodeInPortsSize() ; j++ ) {
+ const GraphBase::InPort * anInPort = aLabelNode->GetNodeInPort( j ) ;
+ if ( anInPort->GetOutPort() ) {
+ cdebug << aLabelNode->Name() << "(" << anInPort->PortName() << ") value : "
+ << anInPort->GetOutPort()->NodeName() << "(" << anInPort->GetOutPort()->PortName() << ")"
+ << endl ;
+ }
+ }
+// const GraphBase::OutPort * aGateOutPort = GetNodeOutPort( 0 ) ; // DoLoop or OutGate
+ const GraphBase::InPort * aGateInPort = aLabelNode->GetNodeInGate() ;
if ( aGateInPort ) {
if ( aGateInPort->GetOutPort() ) {
aGateInPort->GetOutPort()->Value( aGateOutPort->Value() ) ;
cdebug << " " << LinkedNodes( i )->Name() ;
}
cdebug << endl;
- SUPERV::ControlState aControl = ControlState() ;
+// SUPERV::ControlState aControl = ControlState() ;
for ( i = 0 ; i < LinkedNodesSize() ; i++ ) {
bool IgnoreForEndLoop = false ;
toNode = (GraphExecutor::InNode *) LinkedNodes( i )->GetInNode() ;
cdebug << ThreadNo() << " Successed_SuccessAction of " << Name()
<< " [" << i << "] " << LinkedNodes( i )->Name() << endl ;
if ( toNode && !toNode->IsDataFlowNode() ) {
- GraphBase::InPort * toGateInPort = toNode->GetChangeNodeInPort(0) ;
if ( IsComputingNode() && toNode->IsInLineNode() ) {
+ GraphBase::InPort * toGateInPort = toNode->GetChangeNodeInGate() ;
toGateInPort->State( SUPERV::ReadyState ) ;
GraphBase::OutPort * GateOutPort = toGateInPort->GetOutPort() ;
if ( GateOutPort ) {
}
}
if ( toNode && IsLoopNode() ) {
- GraphBase::OutPort * fromLoopOutPort = GetChangeNodeOutPort(0) ;
- if ( !fromLoopOutPort->BoolValue() ) {
+ GraphBase::OutPort * fromLoopOutPort = GetChangeNodeOutLoop() ;
+ if ( !fromLoopOutPort->BoolValue() ) { // Ne pas faire la boucle
if ( strcmp( toNode->Name() , CoupledNode()->Name() ) ) {
- IgnoreForEndLoop = true ; // toNode is the EndLoopNode
+ IgnoreForEndLoop = true ;
}
- else {
+ else { // toNode is the EndLoopNode
GraphBase::InPort * toLoopInPort ;
- toLoopInPort = toNode->GetChangeNodeInPort(1) ;
+// toLoopInPort = toNode->GetChangeNodeInPort(1) ;
+ toLoopInPort = toNode->GetChangeNodeInLoop() ;
if ( toLoopInPort->State() != SUPERV::ReadyState ) {
toLoopInPort->State( SUPERV::ReadyState ) ;
}
}
if ( toNode && !IgnoreForEndLoop ) {
if ( toNode && toNode->IsLoopNode() ) {
- GraphBase::InPort * toLoopInPort = toNode->GetChangeNodeInPort(1) ;
+// GraphBase::InPort * toLoopInPort = toNode->GetChangeNodeInPort(1) ;
+ GraphBase::InPort * toLoopInPort = toNode->GetChangeNodeInLoop() ;
toLoopInPort->State( SUPERV::ReadyState ) ;
GraphBase::OutPort * LoopOutPort = toLoopInPort->GetOutPort() ;
LoopOutPort->PortStatus( DataConnected );
<< " Successed_SuccessAction pop firsttoNode "
<< SomeDataNodes.size() << " " << firsttoNode->Name() << endl ;
firsttoNode->CreateNewThreadIf( false ) ;
+ firsttoNode->RewindStack( RewindStack() ) ;
if ( firsttoNode->State() == SUPERV::SuccessedState ) {
cdebug << pthread_self() << "/" << ThreadNo() << " " << Name()
<< " : " << firsttoNode->Name() << " "
void GraphExecutor::InNode::InParametersSet(
bool & Err ,
int nInParams ,
- ServicesAnyData * aListOfInParameters ) {
+ ServicesAnyData * InParametersList ) {
int i ;
for ( i = 0 ; i < nInParams ; i++ ) {
- ServicesAnyData D = aListOfInParameters[i];
+ ServicesAnyData D = InParametersList[i];
GraphBase::InPort * anInPort = GetChangeNodeInPort(i) ;
GraphBase::OutPort * theOutPort = anInPort->GetOutPort() ;
if ( anInPort->IsGate() && theOutPort == NULL ) {
<< anInPort->GetServicesParameter().Parametertype
<< " is inactive. " << anInPort->Kind() << endl ;
}
-// else if ( theOutPort->State() == SUPERV::ReadyState ) {
else if ( anInPort->State() == SUPERV::ReadyState ) {
if ( anInPort->IsGate() ) {
CORBA::Any * anAny = new CORBA::Any() ;
theOutPort->Value( anAny ) ;
}
anInPort->State( SUPERV::WaitingState ) ;
-// const CORBA::Any * theValue = theOutPort->Value() ;
D.Name = CORBA::string_dup( anInPort->GetServicesParameter().Parametername ) ;
-// D.Value = *theValue ; // CORBA::Any
- D.Value = *theOutPort->Value() ; // CORBA::Any
cdebug << ThreadNo() << " ArgIn" << i << " " << anInPort->Kind() ;
- cdebug << D.Name << " " << anInPort->GetServicesParameter().Parametertype
- << " : " ;
+ cdebug << " " << D.Name << " " << anInPort->GetServicesParameter().Parametertype << " : " ;
+ D.Value = *theOutPort->Value() ; // CORBA::Any
string _Type = CORBA::string_dup( anInPort->GetServicesParameter().Parametertype ) ;
const char * Type = _Type.c_str() ;
- switch (D.Value.type()->kind()) {
+ switch ( D.Value.type()->kind() ) { // { string , long , double , objref }
case CORBA::tk_string:
char * t;
D.Value >>= t;
- cdebug << t << " (string)" << endl ;
+ cdebug << t << " (string)" ;
if ( !strcmp( Type , "string" ) ) {
}
- else if ( !strcmp( Type , "double" ) ) {
- double d ;
- sscanf( t , "%lf" , &d ) ;
- D.Value <<= d ;
- theOutPort->Value( D.Value ) ;
+ else if ( !strcmp( Type , "boolean" ) ) {
+ bool b ;
+ long d ;
+ sscanf( t , "%ld" , &d ) ;
+ b = (bool ) d ;
+ D.Value <<= (CORBA::Any::from_boolean ) b ;
+// theOutPort->Value( D.Value ) ;
+ }
+ else if ( !strcmp( Type , "char" ) ) {
+ unsigned char c ;
+ long d ;
+ sscanf( t , "%ld" , &d ) ;
+ c = (short ) d ;
+ D.Value <<= (CORBA::Any::from_char ) c ;
+ cdebug << "string '" << t << "' --> " << d << " --> char " << c ;
+// theOutPort->Value( D.Value ) ;
}
- else if ( !strcmp( Type , "long" ) || !strcmp( Type , "bool" ) ) {
+ else if ( !strcmp( Type , "short" ) ) {
+ short s ;
+ long d ;
+ sscanf( t , "%ld" , &d ) ;
+ s = (short ) d ;
+ D.Value <<= s ;
+ cdebug << "string '" << t << "' --> " << d << " --> short " << s ;
+// theOutPort->Value( D.Value ) ;
+ }
+ else if ( !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) {
long l ;
sscanf( t , "%ld" , &l ) ;
D.Value <<= l ;
- theOutPort->Value( D.Value ) ;
+ cdebug << "string '" << t << " --> long " << l ;
+// theOutPort->Value( D.Value ) ;
+ }
+ else if ( !strcmp( Type , "float" ) ) {
+ double d ;
+ sscanf( t , "%lf" , &d ) ;
+ float f = d ;
+ D.Value <<= f ;
+ cdebug << "string '" << t << "' --> " << setw(25) << setprecision(18) << d << " --> float " << " = "
+ << setw(25) << setprecision(18) << f ;
+// theOutPort->Value( D.Value ) ;
}
- else if ( !strcmp( Type , "objref" ) ) {
+ else if ( !strcmp( Type , "double" ) ) {
+ double d ;
+ sscanf( t , "%lf" , &d ) ;
+ D.Value <<= d ;
+ cdebug << "string '" << t << " --> double " << setw(25) << setprecision(18) << d ;
+// theOutPort->Value( D.Value ) ;
+ }
+// else if ( !strcmp( Type , "objref" ) ) {
+ else { // Default
CORBA::Object_ptr ObjRef ;
- ObjRef = StringToObject( t ) ;
- D.Value <<= ObjRef ;
- theOutPort->Value( D.Value ) ;
+ try {
+ ObjRef = StringToObject( t ) ;
+ D.Value <<= ObjRef ;
+ }
+ catch( ... ) {
+ D.Value <<= CORBA::Object::_nil() ;
+ }
+// theOutPort->Value( D.Value ) ;
}
- else {
+// else {
+// cdebug << " (other ERROR)" << endl ;
+// }
+ cdebug << " --> call_kind " << D.Value.type()->kind() << endl ;
+ break;
+ case CORBA::tk_long:
+ long l;
+ D.Value >>= l;
+ cdebug << l << " (long)" << endl ;
+ if ( !strcmp( Type , "string" ) ) {
+ char t[40] ;
+ sprintf( t , "%ld" , l ) ;
+ D.Value <<= t ;
+// theOutPort->Value( D.Value ) ;
+ }
+ else if ( !strcmp( Type , "boolean" ) ) {
+ bool b ;
+ b = (bool ) l ;
+ D.Value <<= (CORBA::Any::from_boolean ) b ;
+// theOutPort->Value( D.Value ) ;
+ }
+ else if ( !strcmp( Type , "char" ) ) {
+ unsigned char c ;
+ c = (unsigned char ) l ;
+ D.Value <<= (CORBA::Any::from_char ) c ;
+// theOutPort->Value( D.Value ) ;
}
+ else if ( !strcmp( Type , "short" ) ) {
+ short s ;
+ s = (short ) l ;
+ D.Value <<= s ;
+// theOutPort->Value( D.Value ) ;
+ }
+ else if ( !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) {
+ }
+ else if ( !strcmp( Type , "float" ) ) {
+ float f ;
+ f = (float ) l ;
+ D.Value <<= f ;
+// theOutPort->Value( D.Value ) ;
+ }
+ else if ( !strcmp( Type , "double" ) ) {
+ double d ;
+ d = (double ) l ;
+ D.Value <<= d ;
+// theOutPort->Value( D.Value ) ;
+ }
+// else if ( !strcmp( Type , "objref" ) ) {
+ else { // Default
+ D.Value <<= CORBA::Object::_nil() ;
+// theOutPort->Value( D.Value ) ;
+ }
+// else {
+// cdebug << " (other ERROR)" << endl ;
+// }
+ cdebug << " --> call_kind " << D.Value.type()->kind() << endl ;
break;
case CORBA::tk_double:
double d;
cdebug << d << " (double)" << endl ;
if ( !strcmp( Type , "string" ) ) {
char t[40] ;
- sprintf( t , "lf" , d ) ;
+ sprintf( t , "%lf" , d ) ;
D.Value <<= t ;
- theOutPort->Value( D.Value ) ;
+// theOutPort->Value( D.Value ) ;
}
- else if ( !strcmp( Type , "double" ) ) {
+ else if ( !strcmp( Type , "boolean" ) ) {
+ bool b ;
+ b = (bool ) d ;
+ D.Value <<= (CORBA::Any::from_boolean ) b ;
+// theOutPort->Value( D.Value ) ;
+ }
+ else if ( !strcmp( Type , "char" ) ) {
+ unsigned char c ;
+ c = (unsigned char ) d ;
+ D.Value <<= (CORBA::Any::from_char ) c ;
+// theOutPort->Value( D.Value ) ;
}
- else if ( !strcmp( Type , "long" ) || !strcmp( Type , "bool" ) ) {
+ else if ( !strcmp( Type , "short" ) ) {
+ short s ;
+ s = (short ) d ;
+ D.Value <<= s ;
+// theOutPort->Value( D.Value ) ;
+ }
+ else if ( !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) {
long l ;
l = (long ) d ;
D.Value <<= l ;
- theOutPort->Value( D.Value ) ;
+// theOutPort->Value( D.Value ) ;
}
- else if ( !strcmp( Type , "objref" ) ) {
+ else if ( !strcmp( Type , "float" ) ) {
+ float f ;
+ f = (float ) d ;
+ D.Value <<= f ;
+// theOutPort->Value( D.Value ) ;
}
- else {
+ else if ( !strcmp( Type , "double" ) ) {
}
+// else if ( !strcmp( Type , "objref" ) ) {
+ else { // Default
+ D.Value <<= CORBA::Object::_nil() ;
+// theOutPort->Value( D.Value ) ;
+ }
+// else {
+// cdebug << " (other ERROR)" << endl ;
+// }
+ cdebug << " --> call_kind " << D.Value.type()->kind() << endl ;
break;
- case CORBA::tk_long:
- long l;
- D.Value >>= l;
- cdebug << l << " (long)" << endl ;
+ case CORBA::tk_objref:
if ( !strcmp( Type , "string" ) ) {
- char t[40] ;
- sprintf( t , "lf" , l ) ;
- D.Value <<= t ;
- theOutPort->Value( D.Value ) ;
+ CORBA::Object_ptr ObjRef ;
+ char * retstr ;
+ try {
+ D.Value >>= ObjRef ;
+ retstr = ObjectToString( ObjRef ) ;
+ D.Value <<= retstr ;
+// theOutPort->Value( D.Value ) ;
+ }
+ catch( ... ) {
+ if ( i != 0 ) {
+ Err = true ;
+ }
+ cdebug << "ToString( object ) Catched ERROR" << endl ;
+ }
}
- else if ( !strcmp( Type , "double" ) ) {
- double d ;
- d = l ;
- D.Value <<= d ;
- theOutPort->Value( D.Value ) ;
+ else if ( !strcmp( Type , "boolean" ) ) {
+ bool b = 0 ;
+ D.Value <<= (CORBA::Any::from_boolean ) b ;
+// theOutPort->Value( D.Value ) ;
}
- else if ( !strcmp( Type , "long" ) || !strcmp( Type , "bool" ) ) {
+ else if ( !strcmp( Type , "char" ) ) {
+ unsigned char c = 0 ;
+ D.Value <<= (CORBA::Any::from_char ) c ;
+// theOutPort->Value( D.Value ) ;
}
- else if ( !strcmp( Type , "objref" ) ) {
+ else if ( !strcmp( Type , "short" ) ) {
+ short s = 0 ;
+ D.Value <<= s ;
+// theOutPort->Value( D.Value ) ;
}
- else {
+ else if ( !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) {
+ long l = 0 ;
+ D.Value <<= l ;
+// theOutPort->Value( D.Value ) ;
}
- break;
- case CORBA::tk_objref:
- CORBA::Object_ptr obj ;
- char * retstr ;
- try {
- D.Value >>= obj ;
-// retstr = _Orb->object_to_string(obj );
- retstr = ObjectToString( obj ) ;
- cdebug << retstr << endl ;
+ else if ( !strcmp( Type , "float" ) ) {
+ float f = 0 ;
+ D.Value <<= f ;
+// theOutPort->Value( D.Value ) ;
}
- catch( ... ) {
- if ( i != 0 ) {
- Err = true ;
- }
- cdebug << "ToString( object ) Catched ERROR" << endl ;
+ else if ( !strcmp( Type , "double" ) ) {
+ double d = 0 ;
+ D.Value <<= d ;
+// theOutPort->Value( D.Value ) ;
}
+// else if ( !strcmp( Type , "objref" ) ) {
+ else { // Default
+ CORBA::Object_ptr obj ;
+ char * retstr ;
+ try {
+ D.Value >>= obj ;
+ retstr = ObjectToString( obj ) ;
+ cdebug << retstr << endl ;
+ }
+ catch( ... ) {
+ if ( i != 0 ) {
+ Err = true ;
+ }
+ cdebug << "ToString( object ) Catched ERROR" << endl ;
+ }
+ }
+// else {
+// cdebug << " (other ERROR)" << endl ;
+// }
+ cdebug << " --> call_kind " << D.Value.type()->kind() << endl ;
break;
default:
- cdebug << " (other ERROR)" << endl ;
+ cdebug << " (other ERROR) " << D.Value.type()->kind() << endl ;
}
}
else {
<< anInPort->GetServicesParameter().Parametername << endl ;
Err = true ;
}
- aListOfInParameters[i] = D ;
+ InParametersList[i] = D ;
}
}
-void GraphExecutor::InNode::InOutParameters(
+void GraphExecutor::InNode::InOutParametersSet(
int nOutParams ,
- ServicesAnyData * aListOfOutParameters ) {
+ ServicesAnyData * OutParametersList ) {
int i ;
for ( i = 0 ; i < nOutParams ; i++ ) {
- ServicesAnyData D = aListOfOutParameters[i] ;
+ ServicesAnyData D = OutParametersList[i] ;
D.Name = GetChangeNodeOutPort(i)->GetServicesParameter().Parametername;
string _Type = CORBA::string_dup(GetChangeNodeOutPort(i)->GetServicesParameter().Parametertype) ;
if ( !strcmp( Type , "string" ) ) {
D.Value <<= (char *) NULL ;
}
- else if ( !strcmp( Type , "double" ) ) {
- D.Value <<= 0. ;
+ else if ( !strcmp( Type , "boolean" ) ) {
+ bool b = 0 ;
+ D.Value <<= (CORBA::Any::from_boolean ) b ;
+ }
+ else if ( !strcmp( Type , "char" ) ) {
+ unsigned char c = 0 ;
+ D.Value <<= (CORBA::Any::from_char ) c ;
+ }
+ else if ( !strcmp( Type , "short" ) ) {
+ short s = 0 ;
+ D.Value <<= s ;
}
- else if ( !strcmp( Type , "long" ) || !strcmp( Type , "bool" ) ) {
+ else if ( !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) {
D.Value <<= (long ) 0 ;
}
+ else if ( !strcmp( Type , "float" ) ) {
+ float f = 0 ;
+ D.Value <<= f ;
+ }
+ else if ( !strcmp( Type , "double" ) ) {
+ double d = 0 ;
+ D.Value <<= d ;
+ }
else {
-// D.Value.replace(CORBA::_tc_Object, NULL);
D.Value <<= CORBA::Object::_nil() ;
}
-// GetChangeNodeOutPort(i)->Value( D.Value ) ;
//#if 0
- switch (D.Value.type()->kind()) {
+ switch (D.Value.type()->kind()) { // { string , long , double , objref }
case CORBA::tk_string:
char * t;
D.Value >>= t;
cdebug << ThreadNo() << " " << t << "(string)" << endl ;
break;
- case CORBA::tk_double:
- double d;
- D.Value >>= d;
- cdebug << ThreadNo() << " " << d << "(double)" << endl ;
+ case CORBA::tk_boolean:
+ bool b ;
+ D.Value >>= (CORBA::Any::to_boolean ) b;
+ cdebug << ThreadNo() << " " << b << "(boolean)" << endl ;
+ break;
+ case CORBA::tk_char:
+ unsigned char c ;
+ D.Value >>= (CORBA::Any::to_char ) c;
+ cdebug << ThreadNo() << " " << c << "(char)" << endl ;
+ break;
+ case CORBA::tk_short:
+ short s;
+ D.Value >>= s;
+ cdebug << ThreadNo() << " " << s << "(short)" << endl ;
break;
case CORBA::tk_long:
long l;
D.Value >>= l;
cdebug << ThreadNo() << " " << l << "(long)" << endl ;
break;
+ case CORBA::tk_float:
+ float f;
+ D.Value >>= f;
+ cdebug << ThreadNo() << " " << f << "(float)" << endl ;
+ break;
+ case CORBA::tk_double:
+ double d;
+ D.Value >>= d;
+ cdebug << ThreadNo() << " " << d << "(double)" << endl ;
+ break;
case CORBA::tk_objref:
- cdebug << ThreadNo() << " " << "(object)" << endl ;
+ try {
+ CORBA::Object_ptr obj ;
+ char * retstr ;
+ D.Value >>= obj ;
+ retstr = ObjectToString( obj ) ;
+ cdebug << ThreadNo() << retstr << endl ;
+ }
+ catch( ... ) {
+ cdebug << "ToString( object ) Catched ERROR" << endl ;
+ }
break;
default:
cdebug << ThreadNo() << " " << "(other ERROR)" << endl ;
}
//#endif
- aListOfOutParameters[i] = D ;
+ OutParametersList[i] = D ;
}
}
-bool GraphExecutor::InNode::OutParameters(
+bool GraphExecutor::InNode::OutParametersSet(
bool Err ,
SUPERV::GraphState NewState ,
int nOutParams ,
- ServicesAnyData * aListOfOutParameters ) {
+ ServicesAnyData * OutParametersList ) {
bool RetVal = true ;
int i ;
GraphBase::OutPort * aGateOutPort = NULL ;
bool OrSwitch = false ;
- GraphBase::OutPort * anOutPort = GetChangeNodeOutPort(0) ;
- for ( i = 0 ; i < nOutParams ; i++ ) {
- anOutPort = GetChangeNodeOutPort(i) ;
- if ( Err ) {
- anOutPort->State( NewState ) ;
- anOutPort->Done( true ) ;
- }
- else {
- cdebug << ThreadNo() << " " << "Out" << i << " " << Name() << " "
- << anOutPort->PortName() << " " << anOutPort->Kind() ;
- if ( anOutPort->IsGate() ) {
- aGateOutPort = anOutPort ;
- cdebug << " Gate " ;
- long l = 1;
- aListOfOutParameters[i].Value <<= l;
- anOutPort->Value( aListOfOutParameters[i].Value );
- }
- else if ( anOutPort->IsLoop() ) {
- cdebug << " Loop " ;
- anOutPort->Value( aListOfOutParameters[i].Value );
-// InLoop Port of EndLoopNode is ready :
- anOutPort->ChangeInPorts(0)->State( SUPERV::ReadyState ) ;
- }
- else if ( anOutPort->IsSwitch() ) {
- cdebug << " Switch " ;
- anOutPort->Value( aListOfOutParameters[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 ;
-// RetVal = false ;
- }
- else {
- OrSwitch = OrSwitch | anOutPort->BoolValue() ;
- }
- }
- cdebug << "OrSwitch " << OrSwitch ;
+ if ( nOutParams ) {
+ GraphBase::OutPort * anOutPort ;
+ for ( i = 0 ; i < nOutParams ; i++ ) {
+ anOutPort = GetChangeNodeOutPort(i) ;
+ if ( Err ) {
+ anOutPort->State( NewState ) ;
+ anOutPort->Done( true ) ;
}
else {
- cdebug << " Param " ;
- anOutPort->Value( aListOfOutParameters[i].Value );
- }
-// else if ( anOutPort->IsBus() ) {
-// cdebug << " Bus " ;
-// anOutPort->Value( GetNodeInPort( anOutPort->PortIndex() )->GetOutPort()->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() )->GetChangeNodeInPort( 0 )->GetOutPort() ;
- if ( aGOTOPort ) {
- fromGOTO = aGOTOPort->IsGOTO() ;
+ cdebug << ThreadNo() << " " << "Out" << i << " " << Name() << " "
+ << anOutPort->PortName() << " " << anOutPort->Kind() ;
+ ServicesAnyData D = OutParametersList[i] ;
+ switch (D.Value.type()->kind()) { // { string , long , double , objref }
+ case CORBA::tk_string: {
+ char * t;
+ D.Value >>= t;
+ cdebug << ThreadNo() << " " << t << "(string)" << endl ;
+ break;
}
- if ( anOutPort->ChangeInPorts( j )->IsEndSwitch() || fromGOTO ) {
- cdebug << anOutPort->ChangeInPorts( j )->NodeName() << "("
- << anOutPort->ChangeInPorts( j )->PortName() << ","
- << anOutPort->ChangeInPorts( j )->Kind() << ") WILL BE changed from "
- << anOutPort->ChangeInPorts( j )->GetOutPort()->NodeName()
- << "("
- << anOutPort->ChangeInPorts( j )->GetOutPort()->PortName()
- << ") to " << anOutPort->NodeName() << "("
- << anOutPort->PortName() << ")" << endl ;
- anOutPort->ChangeInPorts( j )->ChangeOutPort( anOutPort ) ;
+ case CORBA::tk_boolean: {
+ bool b ;
+ D.Value >>= (CORBA::Any::to_boolean ) b;
+ long l = (long ) b ;
+ D.Value <<= l ;
+ cdebug << ThreadNo() << " " << b << "(boolean)" << endl ;
+ break;
}
- else {
- cdebug << anOutPort->ChangeInPorts( j )->NodeName() << "("
- << anOutPort->ChangeInPorts( j )->PortName() << ","
- << anOutPort->ChangeInPorts( j )->Kind() << ") NOT changed from "
- << anOutPort->ChangeInPorts( j )->GetOutPort()->NodeName()
- << "("
- << anOutPort->ChangeInPorts( j )->GetOutPort()->PortName()
- << ") to " << anOutPort->NodeName() << "("
- << anOutPort->PortName() << ")" << endl ;
+ case CORBA::tk_char: {
+ unsigned char c ;
+ D.Value >>= (CORBA::Any::to_char ) c;
+ long l = (long ) c ;
+ D.Value <<= l ;
+ cdebug << ThreadNo() << " " << c << "(char)" << endl ;
+ break;
}
- }
-#if 0
- switch (anOutPort->Value()->type()->kind()) {
- case CORBA::tk_string:
- char * t;
- (*anOutPort->Value()) >>= t;
- cdebug << ThreadNo() << " Out" << i << " : " << t << "(string)" << endl ;
- break;
- case CORBA::tk_double:
- double d;
- (*anOutPort->Value()) >>= d;
- cdebug << ThreadNo() << " Out" << i << " : " << d << "(double)" << endl ;
- break;
- case CORBA::tk_long:
- long l;
- (*anOutPort->Value()) >>= l;
- cdebug << ThreadNo() << " Out" << i << " : " << l << "(long)" << endl ;
- break;
- case CORBA::tk_objref:
- CORBA::Object_ptr obj ;
- char * retstr ;
- try {
- (*anOutPort->Value()) >>= obj ;
- retstr = _Orb->object_to_string(obj );
- cdebug << ThreadNo() << " Out" << i << " : " << "ToString( object ) "
- << retstr << endl ;
+ case CORBA::tk_short: {
+ short s;
+ D.Value >>= s;
+ long l = (long ) s ;
+ D.Value <<= l ;
+ cdebug << ThreadNo() << " " << s << "(short)" << endl ;
+ break;
}
- catch ( ... ) {
- cdebug << ThreadNo() << " Out" << i << " : " << "ToString( object ) "
- << "Catched ERROR" << endl ;
+ case CORBA::tk_long: {
+ long l;
+ D.Value >>= l;
+ cdebug << ThreadNo() << " " << l << "(long)" << endl ;
+ break;
}
- break;
- default:
- cdebug << ThreadNo() << " Out" << i << " : " << "(other ERROR)" << endl ;
- RetVal = false ;
+ case CORBA::tk_float: {
+ float f;
+ D.Value >>= f;
+ double d = (double ) f ;
+ D.Value <<= d ;
+ cdebug << ThreadNo() << " " << f << "(float)" << endl ;
+ break;
+ }
+ case CORBA::tk_double: {
+ double d;
+ D.Value >>= d;
+ cdebug << ThreadNo() << " " << d << "(double)" << endl ;
+ break;
+ }
+ case CORBA::tk_objref: {
+ try {
+ CORBA::Object_ptr obj ;
+ char * retstr ;
+ D.Value >>= obj ;
+ retstr = ObjectToString( obj ) ;
+ cdebug << ThreadNo() << retstr << endl ;
+ }
+ catch( ... ) {
+ cdebug << "ToString( object ) Catched ERROR" << endl ;
+ }
+ break;
+ }
+ default: {
+ cdebug << ThreadNo() << " " << "(other ERROR)" << endl ;
+ }
+ }
+ 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 );
+// 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 ) ;
+ int j ;
+ for ( j = 0 ; j < anOutPort->InPortsSize() ; j++ ) {
+ bool fromGOTO = false ;
+ GraphBase::OutPort * aGOTOPort = _OutNode->GetChangeGraphNode( anOutPort->ChangeInPorts( j )->NodeName() )->GetChangeNodeInGate()->GetOutPort() ;
+ if ( aGOTOPort ) {
+ fromGOTO = aGOTOPort->IsGOTO() ;
+ }
+ if ( anOutPort->ChangeInPorts( j )->IsEndSwitch() || fromGOTO ) {
+ cdebug << anOutPort->ChangeInPorts( j )->NodeName() << "("
+ << anOutPort->ChangeInPorts( j )->PortName() << ","
+ << anOutPort->ChangeInPorts( j )->Kind() << ") WILL BE changed from "
+ << anOutPort->ChangeInPorts( j )->GetOutPort()->NodeName()
+ << "("
+ << anOutPort->ChangeInPorts( j )->GetOutPort()->PortName()
+ << ") to " << anOutPort->NodeName() << "("
+ << anOutPort->PortName() << ")" << endl ;
+ anOutPort->ChangeInPorts( j )->ChangeOutPort( anOutPort ) ;
+ }
+ else {
+ cdebug << anOutPort->ChangeInPorts( j )->NodeName() << "("
+ << anOutPort->ChangeInPorts( j )->PortName() << ","
+ << anOutPort->ChangeInPorts( j )->Kind() << ") NOT changed from "
+ << anOutPort->ChangeInPorts( j )->GetOutPort()->NodeName()
+ << "("
+ << anOutPort->ChangeInPorts( j )->GetOutPort()->PortName()
+ << ") to " << anOutPort->NodeName() << "("
+ << anOutPort->PortName() << ")" << endl ;
+ }
+ }
+//#if 0
+ switch (anOutPort->Value()->type()->kind()) {
+ case CORBA::tk_string:
+ char * t;
+ (*anOutPort->Value()) >>= t;
+ cdebug << ThreadNo() << " Out" << i << " : " << t << "(string)" << endl ;
+ break;
+ case CORBA::tk_boolean:
+ bool b ;
+ (*anOutPort->Value()) >>= (CORBA::Any::to_boolean ) b;
+ cdebug << ThreadNo() << " Out" << i << " : " << b << "(boolean)" << endl ;
+ break;
+ case CORBA::tk_char:
+ unsigned char c ;
+ (*anOutPort->Value()) >>= (CORBA::Any::to_char ) c;
+ cdebug << ThreadNo() << " Out" << i << " : " << c << "(char)" << endl ;
+ break;
+ case CORBA::tk_short:
+ short s;
+ (*anOutPort->Value()) >>= s;
+ cdebug << ThreadNo() << " Out" << i << " : " << s << "(short)" << endl ;
+ break;
+ case CORBA::tk_long:
+ long l;
+ (*anOutPort->Value()) >>= l;
+ cdebug << ThreadNo() << " Out" << i << " : " << l << "(long)" << endl ;
+ break;
+ case CORBA::tk_float:
+ float f;
+ (*anOutPort->Value()) >>= f;
+ cdebug << ThreadNo() << " Out" << i << " : " << f << "(float)" << endl ;
+ break;
+ case CORBA::tk_double:
+ double d;
+ (*anOutPort->Value()) >>= d;
+ cdebug << ThreadNo() << " Out" << i << " : " << d << "(double)" << endl ;
+ break;
+ case CORBA::tk_objref:
+ CORBA::Object_ptr obj ;
+ char * retstr ;
+ try {
+ (*anOutPort->Value()) >>= obj ;
+ retstr = ObjectToString( obj );
+ cdebug << ThreadNo() << " Out" << i << " : " << "ToString( object ) "
+ << retstr << endl ;
+ }
+ catch ( ... ) {
+ cdebug << ThreadNo() << " Out" << i << " : " << "ToString( object ) "
+ << "Catched ERROR" << endl ;
+ }
+ break;
+ default:
+ cdebug << ThreadNo() << " Out" << i << " : " << "(other ERROR)" << endl ;
+ RetVal = false ;
+ }
+//#endif
}
-#endif
- }
- }
- if ( aGateOutPort && IsSwitchNode() ) {
- if ( OrSwitch ) {
- cdebug << ThreadNo() << " " << "Out0 " << Name() << " Close of "
- << aGateOutPort->PortName() << " " << aGateOutPort->Kind() ;
- long l = 0;
- aListOfOutParameters[0].Value <<= l ;
- aGateOutPort->Value( aListOfOutParameters[0].Value ) ;
}
- else {
- cdebug << ThreadNo() << " " << "Out0 " << Name() << " Open of "
- << aGateOutPort->PortName() << " " << aGateOutPort->Kind() ;
- long l = 1;
- aListOfOutParameters[0].Value <<= l ;
- aGateOutPort->Value( aListOfOutParameters[0].Value ) ;
- int i ;
- for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
- GraphBase::InPort * anInPort ;
- anInPort = CoupledNode()->GetChangeInPort( GetNodeOutPort( i )->PortName() ) ;
- if ( anInPort ) {
- anInPort->ChangeOutPort( GetChangeNodeOutPort( i ) ) ;
- }
+ if ( aGateOutPort && IsSwitchNode() ) {
+ if ( OrSwitch ) {
+// cdebug << ThreadNo() << " " << "Out0 " << Name() << " Close of "
+// << aGateOutPort->PortName() << " " << aGateOutPort->Kind() ;
+ long l = 0;
+ OutParametersList[0].Value <<= l ;
+ aGateOutPort->Value( OutParametersList[0].Value ) ;
+ }
+ else {
+// cdebug << ThreadNo() << " " << "Out0 " << Name() << " Open of "
+// << aGateOutPort->PortName() << " " << aGateOutPort->Kind() ;
+ long l = 1;
+ OutParametersList[0].Value <<= l ;
+ aGateOutPort->Value( OutParametersList[0].Value ) ;
+ int i ;
+ for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
+ GraphBase::InPort * anInPort ;
+ anInPort = CoupledNode()->GetChangeInPort( GetNodeOutPort( i )->PortName() ) ;
+ if ( anInPort ) {
+ anInPort->ChangeOutPort( GetChangeNodeOutPort( i ) ) ;
+ }
+ }
}
}
}
+// SUPERV GraphExecutor : contains classes that permit execution of graphs and particularly the execution automaton
+//
+// 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_OutNode.cxx
+// Author : Jean Rahuel, CEA
+// Module : SUPERV
+// $Header:
+
using namespace std;
-//=============================================================================
-// File : DataFlowBase_OutNode.cxx
-// Created : 2002
-// Author : Jean Rahuel, CEA
-// Project : SALOME
-// $Header:
-//=============================================================================
#include "DataFlowExecutor_OutNode.hxx"
extern GraphExecutor::FiniteStateMachine * theAutomaton ;
-static const char *ComponentName = "SalomeSuperVisionComponent" ;
+// static const char *ComponentName = "SalomeSuperVisionComponent" ;
extern int _ArgC ;
extern char ** _ArgV ;
_State = SUPERV::UnKnownState ;
_PyInitialized = false ;
pthread_mutex_init( &_MutexWait , NULL ) ;
+ pthread_mutex_init( &_PyMutexWait , NULL ) ;
if ( pthread_cond_init( &_EventWait , NULL ) ) {
perror("pthread_cond_init( &_EventWait , NULL )") ;
exit( 0 ) ;
_PyInitialized = false ;
_Orb = CORBA::ORB::_duplicate( ORB ) ;
pthread_mutex_init( &_MutexWait , NULL ) ;
+ pthread_mutex_init( &_PyMutexWait , NULL ) ;
if ( pthread_cond_init( &_EventWait , NULL ) ) {
perror("pthread_cond_init( &_EventWait , NULL )") ;
exit( 0 ) ;
_PyInitialized = false ;
_Orb = CORBA::ORB::_duplicate( ORB ) ;
pthread_mutex_init( &_MutexWait , NULL ) ;
+ pthread_mutex_init( &_PyMutexWait , NULL ) ;
if ( pthread_cond_init( &_EventWait , NULL ) ) {
perror("pthread_cond_init( &_EventWait , NULL )") ;
exit( 0 ) ;
GraphExecutor::InNode * anInNode ;
cdebug << "GraphExecutor::OutNode::LoadNodes" << endl ;
int i ;
- for ( i = 0 ; i < aListOfNodes.size() ; i++ ) {
+ for ( i = 0 ; i < (int ) aListOfNodes.size() ; i++ ) {
GraphBase::SNode aNode = aListOfNodes[ i ] ;
anInNode = AddNode( aNode.theService ,
aNode.theListOfFuncName ,
}
#endif
}
- for ( i = 0 ; i < aListOfNodes.size() ; i++ ) {
+ 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 "
cdebug << "GraphExecutor::OutNode::LoadLinks " << aListOfLinks.size()
<< endl ;
int i ;
- for ( i = 0 ; i < aListOfLinks.size() ; i++ ) {
+ for ( i = 0 ; i < (int ) aListOfLinks.size() ; i++ ) {
GraphBase::SLink aLink = aListOfLinks[ i ] ;
RetVal = AddLink( aLink.FromNodeName.c_str() ,
aLink.FromServiceParameterName.c_str() ,
cdebug << "GraphExecutor::OutNode::LoadDatas " << aListOfDatas.size()
<< endl ;
int i ;
- for ( i = 0 ; i < aListOfDatas.size() ; 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() ,
_Executable = false ;
- CreateService() ;
+ if ( !CreateService() ) {
+ cdebug << "This DataFlow has invalid type(s)." << endl ;
+ return false ;
+ }
if ( !Sort() ) {
cdebug << "This DataFlow is not valid." << endl ;
anInNode->State( SUPERV::DataWaitingState ) ;
anInNode->ControlState( SUPERV::ToSuspendStartState ) ;
if ( !anInNode->SendEvent( GraphExecutor::SomeDataReadyEvent ) ) {
- cdebug << "InNode::SendEvent( SomeDataReadyEvent ) Node "
+ cdebug << "InNode::SendEvent( SomeDataReadyEvent ) ERROR Node "
<< anInNode->Name() << endl ;
return false ;
}
anInNode->SuspendedWait() ;
}
else if ( !anInNode->SendEvent( GraphExecutor::ExecuteEvent ) ) {
- cdebug << "InNode::SendEvent( RunningEvent ) Node "
+ cdebug << "InNode::SendEvent( ExecuteEvent ) ERROR Node "
<< anInNode->Name() << endl ;
return false ;
}
<< " GraphAutomatonState " << theAutomaton->StateName( AutomatonState() )
<< " State " << State() << " Threads " << _Threads << " SuspendedThreads "
<< _SuspendedThreads << endl ;
+ if ( _Done ) {
+ MESSAGE("================================================================================") ;
+ MESSAGE( Name() << " IS DONE" ) ;
+ MESSAGE("================================================================================") ;
+ }
}
void GraphExecutor::OutNode::PThreadLock( pthread_mutex_t * aMutex , char * errmsg ) {
}
}
-void GraphExecutor::OutNode::PThreadLock() {
- cout << " GraphExecutor::OutNode::PThreadLock " << pthread_self() << endl ;
- if ( pthread_mutex_lock( &_MutexWait ) ) {
- perror( "GraphExecutor::OutNode::PThreadLock" ) ;
+void GraphExecutor::OutNode::PyThreadLock() {
+// cout << " GraphExecutor::OutNode::PyThreadLock " << pthread_self() << endl ;
+ if ( pthread_mutex_lock( &_PyMutexWait ) ) {
+ perror( "GraphExecutor::OutNode::PyThreadLock" ) ;
exit( 0 ) ;
}
- cout << " GraphExecutor::OutNode::PThreadLocked " << pthread_self() << endl ;
+// cout << " GraphExecutor::OutNode::PyThreadLocked " << pthread_self() << endl ;
}
-void GraphExecutor::OutNode::PThreadUnLock() {
- cout << " GraphExecutor::OutNode::PThreadUnLock " << pthread_self() << endl ;
- if ( pthread_mutex_unlock( &_MutexWait ) ) {
- perror( "GraphExecutor::OutNode::PThreadUnLock" ) ;
+void GraphExecutor::OutNode::PyThreadUnLock() {
+// cout << " GraphExecutor::OutNode::PyThreadUnLock " << pthread_self() << endl ;
+ if ( pthread_mutex_unlock( &_PyMutexWait ) ) {
+ perror( "GraphExecutor::OutNode::PyThreadUnLock" ) ;
exit( 0 ) ;
}
- cout << " GraphExecutor::OutNode::PThreadUnLocked " << pthread_self() << endl ;
+// cout << " GraphExecutor::OutNode::PyThreadUnLocked " << pthread_self() << endl ;
}
void GraphExecutor::OutNode::NewThread() {
}
// cdebug_out << "PushEvent Threads " << Threads() << " SuspendedThreads "
// << SuspendedThreads() << endl ;
+ if ( _EventNodes.size() > 101 ) {
+ while ( _EventNodes.size() > 31 ) {
+ _EventNodes.pop_front() ;
+ _Events.pop_front() ;
+ _States.pop_front() ;
+ }
+ }
if ( pthread_mutex_unlock( &_MutexWait ) ) {
perror("PushEvent pthread_mutex_unlock ") ;
exit( 0 ) ;
}
+ return true ;
}
bool GraphExecutor::OutNode::StateWait( SUPERV::GraphState aState ) {
+ return false ;
}
bool GraphExecutor::OutNode::Event( char ** aNodeName ,
anEvent = SUPERV::UndefinedEvent ;
aState = SUPERV::UndefinedState ;
if ( ( IsDone() || IsKilled() || IsStopped() ) && _EventNodes.size() == 0 ) {
- cdebug << "EventLoop IsDone()/IsKilled()/IsStopped() && _EventNodes.size() == 0" << endl ;
+// cdebug << "EventLoop IsDone()/IsKilled()/IsStopped() && _EventNodes.size() == 0" << endl ;
RetVal = false ;
}
else if ( !WithWait && _EventNodes.size() == 0 ) {
}
else if ( RetVal ) {
while ( !IsSuspended() && _EventNodes.size() == 0 ) {
- cdebug << "EventLoop pthread_cond_wait _EventWait" << endl ;
+// cdebug << "EventLoop pthread_cond_wait _EventWait" << endl ;
pthread_cond_wait( &_EventWait , &_MutexWait );
- cdebug << "EventLoop pthread_cond_waited _EventWait"
- << " _EventNodes.size() " << _EventNodes.size() << endl ;
+// cdebug << "EventLoop pthread_cond_waited _EventWait"
+// << " _EventNodes.size() " << _EventNodes.size() << endl ;
}
if ( _EventNodes.size() ) {
ThreadsNumber = Threads() ;
RetVal = false ;
}
if ( anEvent != SUPERV::NoEvent ) {
- cdebug << pthread_self() << "EventLoop "
- << NodeName << " " << theAutomaton->StateName( theState )
- << " _EventNodes.size() " << _EventNodes.size()
- << " Threads " << Threads() << " SuspendedThreads "
- << SuspendedThreads() << " RetVal " << RetVal << endl ;
+// cdebug << pthread_self() << "EventLoop "
+// << NodeName << " " << theAutomaton->StateName( theState )
+// << " _EventNodes.size() " << _EventNodes.size()
+// << " Threads " << Threads() << " SuspendedThreads "
+// << SuspendedThreads() << " RetVal " << RetVal << endl ;
}
if ( pthread_mutex_unlock( &_MutexWait ) ) {
perror("EventLoop pthread_mutex_lock ") ;
GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *)aCNode->GetInNode() ;
if ( anInNode ) {
aret = anInNode->State() ;
- cdebug << "GraphExecutor::OutNode::State( " << NodeName << " ) "
- << theAutomaton->StateName( AutomatonGraphState( aret ) ) << endl ;
+// cdebug << "GraphExecutor::OutNode::State( " << NodeName << " ) "
+// << theAutomaton->StateName( AutomatonGraphState( aret ) ) << endl ;
}
}
// cdebug_out << "GraphExecutor::OutNode::State" << endl ;
}
State( SUPERV::SuspendedState ) ;
cdebug_out << "GraphExecutor::OutNode::Suspend" << endl ;
+ if ( RetVal ) {
+ MESSAGE("================================================================================") ;
+ MESSAGE( Name() << " IS SUSPENDED" ) ;
+ MESSAGE("================================================================================") ;
+ }
return RetVal ;
}
bool GraphExecutor::OutNode::Resume() {
bool RetVal = false ;
cdebug_in << "GraphExecutor::OutNode::Resume" << endl;
cdebug_out << "GraphExecutor::OutNode::Resume" << endl ;
+ if ( RetVal ) {
+ MESSAGE("================================================================================") ;
+ MESSAGE( Name() << " IS RESUMED" ) ;
+ MESSAGE("================================================================================") ;
+ }
return RetVal ;
}
}
State( SUPERV::KilledState ) ;
cdebug_out << "GraphExecutor::OutNode::Kill" << endl ;
+ if ( RetVal ) {
+ MESSAGE("================================================================================") ;
+ MESSAGE( Name() << " IS KILLED" ) ;
+ MESSAGE("================================================================================") ;
+ }
return RetVal ;
}
cdebug_in << "GraphExecutor::OutNode::Stop" << endl;
Kill() ;
cdebug_out << "GraphExecutor::OutNode::Stop" << endl ;
+ if ( RetVal ) {
+ MESSAGE("================================================================================") ;
+ MESSAGE( Name() << " IS STOPPED" ) ;
+ MESSAGE("================================================================================") ;
+ }
return RetVal ;
}
bool GraphExecutor::OutNode::ReRun() {
exit( 0 ) ;
}
aret = IsDone() ;
- while ( !aret && !IsSuspended() ) {
+ while ( !aret && !IsSuspended() && IsRunning() ) {
cdebug << "DoneWait pthread_cond_wait _EventWait" << endl;
pthread_cond_wait( &_EventWait , &_MutexWait );
aret = IsDone() ;
}
-const CORBA::Any *GraphExecutor::OutNode::GetInData(
- const char * NodeName ,
- const char * ServiceParameterName ) {
+const CORBA::Any *GraphExecutor::OutNode::GetInData( const char * NodeName ,
+ const char * ServiceParameterName ) {
// cdebug_in << "GraphExecutor::OutNode::GetInData " << NodeName << " "
// << ServiceParameterName << endl ;
const CORBA::Any * retdata = PortInData( NodeName , ServiceParameterName ) ;
return retdata ;
}
-const CORBA::Any *GraphExecutor::OutNode::GetOutData(
- const char * NodeName ,
- const char * ServiceParameterName ) {
+const CORBA::Any *GraphExecutor::OutNode::GetOutData( const char * NodeName ,
+ const char * ServiceParameterName ) {
// cdebug_in << "GraphExecutor::OutNode::GetOutData " << NodeName << " "
// << ServiceParameterName << endl ;
const CORBA::Any * retdata = PortOutData( NodeName , ServiceParameterName ) ;
return retdata ;
}
+const long GraphExecutor::OutNode::CpuUsed() {
+ return GraphBase::Graph::CpuUsed() ;
+}
+
+const long GraphExecutor::OutNode::CpuUsed( const char * aNodeName ) {
+ GraphBase::ComputingNode * aNode = GetChangeGraphNode( aNodeName ) ;
+ if ( aNode ) {
+ GraphExecutor::InNode * anInNode = (GraphExecutor::InNode * ) aNode->GetInNode() ;
+ if ( anInNode ) {
+ return anInNode->CpuUsed() ;
+ }
+ }
+ return 0 ;
+}
+
+
-//=============================================================================
-// File : DataFlowBase_OutNode.hxx
-// Created : 2002
-// Author : Jean Rahuel, CEA
-// Project : SALOME
-// $Header:
-//=============================================================================
+// SUPERV GraphExecutor : contains classes that permit execution of graphs and particularly the execution automaton
+//
+// 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_OutNode.hxx
+// Author : Jean Rahuel, CEA
+// Module : SUPERV
+// $Header:
#ifndef _DATAFLOWEXECUTOR_OUTNODE_HXX
#define _DATAFLOWEXECUTOR_OUTNODE_HXX
SUPERV::ControlState _ControlState ;
bool _Done ;
+ pthread_mutex_t _PyMutexWait ;
pthread_mutex_t _MutexWait ;
pthread_cond_t _EventWait ;
pthread_cond_t _JoinWait ;
const SUPERV::KindOfNode NodeKindOfNode = SUPERV::ComputingNode ,
const SUPERV::SDate NodeFirstCreation = SUPERV::SDate() ,
const SUPERV::SDate NodeLastModification = SUPERV::SDate() ,
- const char * NodeEditorRelease = NULL ,
- const char * NodeAuthor = NULL ,
- const char * NodeComputer = NULL ,
- const char * NodeComment = NULL ,
+ const char * NodeEditorRelease = NULLSTRING ,
+ const char * NodeAuthor = NULLSTRING ,
+ const char * NodeComputer = NULLSTRING ,
+ const char * NodeComment = NULLSTRING ,
const int NodeX = 0 ,
const int NodeY = 0 ) ;
void PThreadLock( pthread_mutex_t * aMutex , char * errmsg ) ;
void PThreadUnLock( pthread_mutex_t * aMutex , char * errmsg ) ;
- void PThreadLock() ;
- void PThreadUnLock() ;
+ void PyThreadLock() ;
+ void PyThreadUnLock() ;
void NewThread() ;
void ExitThread() ;
const char *ToParameterName ) ;
const CORBA::Any *GetOutData( const char *FromNodeName ,
const char *FromParameterName ) ;
+ const long CpuUsed() ;
+ const long CpuUsed( const char *aNodeName ) ;
};
};
+// SUPERV GraphExecutor : contains classes that permit execution of graphs and particularly the execution automaton
+//
+// Copyright (C) 2003 CEA/DEN, EDF R&D
+//
+//
+//
+// File : DataFlowExecutor_PyDynInvoke.cxx
+// Author : Jean Rahuel, CEA
+// Module : SUPERV
+// $Header:
+
using namespace std;
-//=============================================================================
-// File : DataFlowExecutor_PyDynInvoke.cxx
-// Created : 2003
-// Author : Jean Rahuel, CEA
-// Project : SALOME
-// $Header:
-//=============================================================================
#include <stdarg.h>
#include <map>
bool GraphExecutor::InNode::InitPython() {
cdebug_in << "InitPython" << endl ;
- PyObject * Module = Py_InitModule( "InitPyRunMethod" , MethodPyRunMethod ) ;
- PyObject * Dictionnary = PyModule_GetDict( Module ) ;
+// PyObject * Module = Py_InitModule( "InitPyRunMethod" , MethodPyRunMethod ) ;
+ Py_InitModule( "InitPyRunMethod" , MethodPyRunMethod ) ;
+// PyObject * Dictionnary = PyModule_GetDict( Module ) ;
// InitPyDynInvokeError = PyErr_NewException( "InitPyDynInvokeError" , NULL , NULL ) ;
// PyDict_SetItemString( Dictionnary , InitPyDynInvokeError ) ;
cdebug << ThreadNo() << "Py_Initialized() " << endl ;
string aPyFunc ;
- aPyFunc = "print 'InitPyRunMethod'\n" ;
- aPyFunc += "import InitPyRunMethod\n" ;
- aPyFunc += "print 'sys'\n" ;
+// aPyFunc = "print 'InitPyRunMethod'\n" ;
+ aPyFunc = "import InitPyRunMethod\n" ;
+// aPyFunc += "print 'sys'\n" ;
aPyFunc += "import sys\n" ;
- aPyFunc += "print 'CORBA'\n" ;
+// aPyFunc += "print 'CORBA'\n" ;
aPyFunc += "import CORBA\n" ;
- aPyFunc += "print 'omniORB'\n" ;
+// aPyFunc += "print 'omniORB'\n" ;
aPyFunc += "import omniORB\n" ;
- aPyFunc += "print 'PyObjRef'\n" ;
+// aPyFunc += "print 'PyObjRef'\n" ;
aPyFunc += "def PyObjRef( IORObjStr ) :\n" ;
- aPyFunc += " print 'PyObjRef',IORObjStr\n" ;
+// aPyFunc += " print 'PyObjRef',IORObjStr\n" ;
aPyFunc += " orb = CORBA.ORB_init( sys.argv , CORBA.ORB_ID )\n" ;
- aPyFunc += " print 'PyObjRef orb',orb\n" ;
+// aPyFunc += " print 'PyObjRef orb',orb\n" ;
aPyFunc += " objref = orb.string_to_object( IORObjStr )\n" ;
- aPyFunc += " print 'PyObjRef IORObjStr objref',IORObjStr,objref\n" ;
+// aPyFunc += " print 'PyObjRef IORObjStr objref',IORObjStr,objref\n" ;
aPyFunc += " return objref\n" ;
aPyFunc += "InitPyRunMethod.RunMethod( PyObjRef )\n" ;
if ( PyRun_SimpleString( (char *) aPyFunc.c_str() ) ) {
aPyFunc += "import CORBA\n" ;
aPyFunc += "import omniORB\n" ;
aPyFunc += "def PyObjIor( ObjRef ) :\n" ;
- aPyFunc += " print 'PyObjIor',ObjRef\n" ;
+// aPyFunc += " print 'PyObjIor',ObjRef\n" ;
aPyFunc += " orb = CORBA.ORB_init( sys.argv , CORBA.ORB_ID )\n" ;
- aPyFunc += " print 'PyObjIor orb',orb\n" ;
+// aPyFunc += " print 'PyObjIor orb',orb\n" ;
aPyFunc += " objIor = orb.object_to_string( ObjRef )\n" ;
- aPyFunc += " print 'PyObjIor ObjRef objIor',ObjRef,objIor\n" ;
+// aPyFunc += " print 'PyObjIor ObjRef objIor',ObjRef,objIor\n" ;
aPyFunc += " return objIor\n" ;
aPyFunc += "InitPyRunMethod.RunMethod( PyObjIor )\n" ;
if ( PyRun_SimpleString( (char *) aPyFunc.c_str() ) ) {
<< (*aPythonFunction).length() << endl ;
if ( (*aPythonFunction).length() ) {
- int i ;
+ unsigned int i ;
aPyFunc += "import InitPyRunMethod\n" ;
for ( i = 0 ; i < (*aPythonFunction).length() ; i++ ) {
aPyFunc += (*aPythonFunction)[ i ] ;
PyObject * ArgsList = NULL ;
PyObject * ArgValue = NULL ;
- PyObject * ArgResult = NULL ;
PyObject * Result = NULL ;
PyObject * MyPyObjRefList = NULL ;
PyObject * ResultObj = NULL ;
PyObject * MyPyObjIorList = NULL ;
PyObject * ResultIor = NULL ;
- ArgsList = PyTuple_New( n_in ) ;
CORBA::Object_ptr ObjRef ;
char * IORObjRef ;
+ ArgsList = PyTuple_New( n_in ) ;
+
for ( i = 0 ; i < n_in ; i++ ) {
data = inParams[i].Value ;
sname = inParams[i].Name.c_str() ;
ArgValue = Py_BuildValue( "s" , t ) ;
PyTuple_SetItem( ArgsList , i , ArgValue ) ;
cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value " << t << " (string) "
- << ArgsList->ob_refcnt << endl ;
+ << " ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt"
+ << ArgValue->ob_refcnt << endl ;
break ;
}
- case CORBA::tk_double : {
- double d ;
- data >>= d ;
- ArgValue = Py_BuildValue( "d" , d ) ;
+ case CORBA::tk_boolean : {
+ bool b ;
+ data >>= (CORBA::Any::to_boolean ) b ;
+ ArgValue = Py_BuildValue( "b" , b ) ;
+ PyTuple_SetItem( ArgsList , i , ArgValue ) ;
+ cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value " << b
+ << " (boolean) ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt"
+ << ArgValue->ob_refcnt << endl ;
+ break ;
+ }
+ case CORBA::tk_char : {
+ unsigned char c ;
+ data >>= (CORBA::Any::to_char ) c ;
+ ArgValue = Py_BuildValue( "c" , c ) ;
+ PyTuple_SetItem( ArgsList , i , ArgValue ) ;
+ cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value " << c
+ << " (char) ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt"
+ << ArgValue->ob_refcnt << endl ;
+ break ;
+ }
+ case CORBA::tk_short : {
+ short s ;
+ data >>= s ;
+ ArgValue = Py_BuildValue( "h" , s ) ;
PyTuple_SetItem( ArgsList , i , ArgValue ) ;
- cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value " << d << " (double) "
- << ArgsList->ob_refcnt << endl ;
+ cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value " << s
+ << " (short) ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt"
+ << ArgValue->ob_refcnt << endl ;
break ;
}
case CORBA::tk_long : {
ArgValue = Py_BuildValue( "l" , l ) ;
PyTuple_SetItem( ArgsList , i , ArgValue ) ;
cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value " << l
- << " (long) ArgsList->ob_refcnt" << ArgsList->ob_refcnt << endl ;
+ << " (long) ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt"
+ << ArgValue->ob_refcnt << endl ;
+ break ;
+ }
+ case CORBA::tk_float : {
+ float f ;
+ data >>= f ;
+ ArgValue = Py_BuildValue( "f" , f ) ;
+ PyTuple_SetItem( ArgsList , i , ArgValue ) ;
+ cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value " << f
+ << " (float) ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt"
+ << ArgValue->ob_refcnt << endl ;
+ break ;
+ }
+ case CORBA::tk_double : {
+ double d ;
+ data >>= d ;
+ ArgValue = Py_BuildValue( "d" , d ) ;
+ PyTuple_SetItem( ArgsList , i , ArgValue ) ;
+ cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value " << d
+ << " (double) ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt"
+ << ArgValue->ob_refcnt << endl ;
break ;
}
case CORBA::tk_objref : {
IORObjRef = ObjectToString( ObjRef ) ;
ObjValue = Py_BuildValue( "s" , IORObjRef ) ;
PyTuple_SetItem( MyPyObjRefList , 0 , ObjValue ) ;
- cdebug << "ArgIn" << i << " : " << sname << method << " " << " Value " << IORObjRef << " (objref) "
- << MyPyObjRefList->ob_refcnt << endl ;
+ cdebug << "ArgIn" << i << " : " << sname << " " << method << " " << " Value " << IORObjRef << " (objref) "
+ << MyPyObjRef->ob_refcnt << "/" << MyPyObjRefList->ob_refcnt << endl ;
ResultObj = PyEval_CallObject( MyPyObjRef , MyPyObjRefList ) ;
- cdebug << "MyPyObjRefList->ob_refcnt" << MyPyObjRefList->ob_refcnt << " "
- << "ResultObj->ob_refcnt" << ResultObj->ob_refcnt << endl ;
- PyObject_Print( ResultObj , stdout , 0 ) ;
- PyTuple_SetItem( ArgsList , i , ResultObj ) ;
+ cdebug << "ObjValue->ob_refcnt" << ObjValue->ob_refcnt << endl ;
+ ArgValue = Py_BuildValue( "O" , ResultObj ) ;
+ PyTuple_SetItem( ArgsList , i , ArgValue ) ;
cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value (objref) ArgsList->ob_refcnt"
- << ArgsList->ob_refcnt << " ResultObj->ob_refcnt" << ResultObj->ob_refcnt
- << endl ;
+ << ArgsList->ob_refcnt << " ArgValue->ob_refcnt" << ArgValue->ob_refcnt << endl ;
+ cdebug << "MyPyObjRefList->ob_refcnt " << MyPyObjRefList->ob_refcnt-1 << endl ;
+ Py_DECREF( MyPyObjRefList ) ;
+ if ( CORBA::is_nil( ObjRef ) ) {
+ ResultObj = NULL ;
+ }
+ else {
+ cdebug << "ResultObj->ob_refcnt " << ResultObj->ob_refcnt-1 << endl ;
+ Py_DECREF( ResultObj ) ;
+ }
break ;
}
default : {
}
}
- Result = PyEval_CallObject( MyPyRunMethod , ArgsList ) ;
- cdebug << "ArgsList->ob_refcnt" << ArgsList->ob_refcnt << endl ;
-
- if ( Result == NULL ) {
- cdebug_out << "GraphExecutor::InNode::PyDynInvoke Error Result == NULL" << endl ;
- RetVal = false ;
+ if (!PyCallable_Check( MyPyRunMethod )) {
+ RetVal = false;
+ return RetVal;
}
else {
- for ( i = 0 ; i < n_out ; i++ ) {
- data = outParams[i].Value ;
- sname = outParams[i].Name.c_str() ;
- switch ( data.type()->kind() ) {
- case CORBA::tk_string : {
- char * t ;
- ArgValue = PyTuple_GetItem( Result , i ) ;
- if ( ArgValue == NULL ) {
- ArgValue = Result ;
+ Result = PyEval_CallObject( MyPyRunMethod , ArgsList ) ;
+ cdebug << "ArgsList->ob_refcnt" << ArgsList->ob_refcnt << endl ;
+
+ if ( Result == NULL ) {
+ cdebug_out << "GraphExecutor::InNode::PyDynInvoke " << method << " Error Result == NULL" << endl ;
+ RetVal = false ;
+ }
+ else {
+ for ( i = 0 ; i < n_out ; i++ ) {
+ data = outParams[i].Value ;
+ sname = outParams[i].Name.c_str() ;
+ switch ( data.type()->kind() ) {
+ case CORBA::tk_string : {
+ char * t = "" ;
+ if ( PyTuple_Check( Result ) ) {
+ ArgValue = PyTuple_GetItem( Result , i ) ;
+ }
+ else {
+ ArgValue = Result ;
+ }
+ if ( !PyString_Check( ArgValue ) ) {
+ cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (string)" << endl ;
+ }
+ else {
+ t = PyString_AsString( ArgValue ) ;
+ }
+ data <<= t ;
+ cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << t << " (string)"
+ << " ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt"
+ << ArgValue->ob_refcnt << endl ;
+ break ;
}
- if ( !PyString_Check( ArgValue ) ) {
- cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (string)" << endl ;
+ case CORBA::tk_boolean : {
+ bool b = false ;
+ if ( PyTuple_Check( Result ) ) {
+ ArgValue = PyTuple_GetItem( Result , i ) ;
+ }
+ else {
+ ArgValue = Result ;
+ }
+ if ( !PyInt_Check( ArgValue ) ) {
+ cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (boolean)" << endl ;
+ }
+ else {
+ b = PyInt_AsLong( ArgValue ) ;
+ }
+ data <<= (CORBA::Any::from_boolean ) b ;
+ cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << b << " (boolean)"
+ << " ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt"
+ << ArgValue->ob_refcnt << endl ;
+ break ;
}
- t = PyString_AsString( ArgValue ) ;
- data <<= t ;
- cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << t << " (string)"
- << endl ;
- break ;
- }
- case CORBA::tk_double : {
- double d ;
- ArgValue = PyTuple_GetItem( Result , i ) ;
- if ( !PyFloat_Check( ArgValue ) ) {
- cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (double)" << endl ;
+ case CORBA::tk_char : {
+ unsigned char c = 0 ;
+ if ( PyTuple_Check( Result ) ) {
+ ArgValue = PyTuple_GetItem( Result , i ) ;
+ }
+ else {
+ ArgValue = Result ;
+ }
+ if ( !PyInt_Check( ArgValue ) ) {
+ cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (char)" << endl ;
+ }
+ else {
+ c = PyInt_AsLong( ArgValue ) ;
+ }
+ data <<= (CORBA::Any::from_char ) c ;
+ cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << c << " (char)"
+ << " ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt"
+ << ArgValue->ob_refcnt << endl ;
+ break ;
}
- if ( ArgValue == NULL ) {
- ArgValue = Result ;
+ case CORBA::tk_short : {
+ short s = 0 ;
+ if ( PyTuple_Check( Result ) ) {
+ ArgValue = PyTuple_GetItem( Result , i ) ;
+ }
+ else {
+ ArgValue = Result ;
+ }
+ if ( !PyInt_Check( ArgValue ) ) {
+ cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (short)" << endl ;
+ }
+ else {
+ s = PyInt_AsLong( ArgValue ) ;
+ }
+ data <<= s ;
+ cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << s << " (short)"
+ << " ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt"
+ << ArgValue->ob_refcnt << endl ;
+ break ;
}
- d = PyFloat_AsDouble( ArgValue ) ;
- data <<= d ;
- cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << d << " (double)"
- << endl ;
- break ;
- }
- case CORBA::tk_long : {
- long l ;
- ArgValue = PyTuple_GetItem( Result , i ) ;
- if ( ArgValue == NULL ) {
- ArgValue = Result ;
+ case CORBA::tk_long : {
+ long l = 0 ;
+ if ( PyTuple_Check( Result ) ) {
+ ArgValue = PyTuple_GetItem( Result , i ) ;
+ }
+ else {
+ ArgValue = Result ;
+ }
+ if ( PyLong_Check( ArgValue ) ) {
+ l = PyLong_AsLong( ArgValue ) ;
+ }
+ else if ( PyInt_Check( ArgValue ) ) {
+ l = PyInt_AsLong( ArgValue ) ;
+ }
+ else {
+ cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (CORBA::tk_long)" << endl ;
+ }
+ data <<= l ;
+ cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << l << " (long)"
+ << " ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt"
+ << ArgValue->ob_refcnt << endl ;
+ break ;
}
- if ( !PyInt_Check( ArgValue ) ) {
- cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (long)" << endl ;
+ case CORBA::tk_float : {
+ float f = 0 ;
+ if ( PyTuple_Check( Result ) ) {
+ ArgValue = PyTuple_GetItem( Result , i ) ;
+ }
+ else {
+ ArgValue = Result ;
+ }
+ if ( !PyFloat_Check( ArgValue ) ) {
+ cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (float)" << endl ;
+ }
+ else {
+ f = PyFloat_AsDouble( ArgValue ) ;
+ }
+ data <<= f ;
+ cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << f << " (float)"
+ << " ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt"
+ << ArgValue->ob_refcnt << endl ;
+ break ;
}
- l = PyInt_AsLong( ArgValue ) ;
- data <<= l ;
- cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << l << " (long)" << endl ;
- break ;
- }
- case CORBA::tk_objref : {
- MyPyObjIorList = PyTuple_New( 1 ) ;
- PyObject * ObjIor = PyTuple_GetItem( Result , i ) ;
- if ( ObjIor == NULL ) {
- ObjIor = Result ;
+ case CORBA::tk_double : {
+ double d = 0 ;
+ if ( PyTuple_Check( Result ) ) {
+ ArgValue = PyTuple_GetItem( Result , i ) ;
+ }
+ else {
+ ArgValue = Result ;
+ }
+ if ( !PyFloat_Check( ArgValue ) ) {
+ cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (double)" << endl ;
+ }
+ else {
+ d = PyFloat_AsDouble( ArgValue ) ;
+ }
+ data <<= d ;
+ cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << d << " (double)"
+ << " ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt"
+ << ArgValue->ob_refcnt << endl ;
+ break ;
}
- cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << "(object reference) "<< endl ;
- cout << "ArgOut" << i << " : " << sname << " " << method << " Value " << "(object reference) : " ;
- Py_INCREF( ObjIor ) ;
- PyObject_Print( ObjIor , stdout , 0 ) ;
- PyTuple_SetItem( MyPyObjIorList , 0 , ObjIor ) ;
- Py_DECREF( ObjIor ) ;
- ResultIor = PyEval_CallObject( MyPyObjIor , MyPyObjIorList ) ;
-// ObjRef = PyCObject_AsVoidPtr( ArgValue ) ;
-// ObjRef = (CORBA::Object_ptr ) PyLong_AsVoidPtr( ArgValue ) ;
- char * IOR = NULL ;
-// ArgValue = PyTuple_GetItem( Result , i ) ;
- if ( ResultIor ) {
- IOR = PyString_AsString( ResultIor ) ;
- ObjRef = StringToObject( IOR ) ;
- data <<= ObjRef ;
- IORObjRef = ObjectToString( ObjRef ) ;
- cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << "(object reference) "
- << IORObjRef << endl ;
+ case CORBA::tk_objref : {
+ PyObject * ObjIor ;
+ MyPyObjIorList = PyTuple_New( 1 ) ;
+ if ( PyTuple_Check( Result ) ) {
+ ObjIor = PyTuple_GetItem( Result , i ) ;
+ }
+ else {
+ ObjIor = Result ;
+ }
+ cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << "(object reference) "
+ << " ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ObjIor->ob_refcnt"
+ << ObjIor->ob_refcnt << endl ;
+ Py_INCREF( ObjIor ) ;
+// PyObject_Print( ObjIor , stdout , 0 ) ;
+ PyTuple_SetItem( MyPyObjIorList , 0 , ObjIor ) ;
+ ResultIor = PyEval_CallObject( MyPyObjIor , MyPyObjIorList ) ;
+ cdebug << "ObjIor->ob_refcnt " << ObjIor->ob_refcnt-1 << endl ;
+ Py_DECREF( ObjIor ) ;
+ cdebug << "MyPyObjIorList->ob_refcnt " << MyPyObjIorList->ob_refcnt-1 << endl ;
+ Py_DECREF( MyPyObjIorList ) ;
+ cdebug << "MyPyObjIor->ob_refcnt " << MyPyObjIor->ob_refcnt << endl ;
+ if ( ResultIor ) {
+ char * IOR = NULL ;
+ IOR = PyString_AsString( ResultIor ) ;
+ ObjRef = StringToObject( IOR ) ;
+ data <<= ObjRef ;
+ IORObjRef = ObjectToString( ObjRef ) ;
+ cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << IORObjRef << " (objref) "
+ << endl ;
+ if ( CORBA::is_nil( ObjRef ) ) {
+ ResultIor = NULL ;
+ }
+ else {
+ cdebug << "ResultIor->ob_refcnt " << ResultIor->ob_refcnt-1 << endl ;
+ Py_DECREF( ResultIor ) ;
+ }
+ }
+ else {
+ cdebug_out << "GraphExecutor::InNode::PyDynInvoke Error ResultIor == NULL"
+ << method << " " << endl ;
+ RetVal = false ;
+ }
+ break ;
}
- else {
- cdebug_out << "GraphExecutor::InNode::PyDynInvoke Error ResultIor == NULL"
- << method << " " << endl ;
- RetVal = false ;
+ default : {
+ cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << "(other ERROR)" << endl ;
+ }
}
- break ;
+ outParams[i].Value = data ;
}
- default : {
- cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << "(other ERROR)" << endl ;
- }
- }
- outParams[i].Value = data ;
- }
-
- if ( MyPyObjIorList ) {
- int cnt = MyPyObjIorList->ob_refcnt ;
- while ( cnt > 0 ) {
- cnt = MyPyObjIorList->ob_refcnt - 1 ;
- Py_DECREF( MyPyObjIorList ) ;
- cdebug << "MyPyObjIorList->ob_refcnt" << MyPyObjIorList->ob_refcnt << endl ;
- }
- }
- if ( ResultIor ) {
- int cnt = ResultIor->ob_refcnt ;
- while ( cnt > 0 ) {
- cnt = ResultIor->ob_refcnt - 1 ;
- Py_DECREF( ResultIor ) ;
- cdebug << "ResultIor->ob_refcnt" << ResultIor->ob_refcnt << endl ;
- }
- }
- Py_DECREF( Result ) ;
- }
-
- Py_DECREF( ArgsList ) ;
- if ( MyPyObjRefList ) {
- int cnt = MyPyObjRefList->ob_refcnt ;
- while ( cnt > 0 ) {
- cnt = MyPyObjRefList->ob_refcnt - 1 ;
- Py_DECREF( MyPyObjRefList ) ;
- cdebug << "MyPyObjRefList->ob_refcnt" << MyPyObjRefList->ob_refcnt << endl ;
- }
- }
- if ( ResultObj ) {
- int cnt = ResultObj->ob_refcnt ;
- while ( cnt > 0 ) {
- cnt = ResultObj->ob_refcnt - 1 ;
- Py_DECREF( ResultObj ) ;
- cdebug << "ResultObj->ob_refcnt" << ResultObj->ob_refcnt << endl ;
+
+ cdebug << "Result->ob_refcnt" << Result->ob_refcnt-1 << endl ;
+ Py_DECREF( Result ) ;
}
+
+ cdebug << "GraphExecutor::InNode::PyDynInvoke ArgsList->ob_refcnt"
+ << ArgsList->ob_refcnt-1 << endl ;
+ Py_DECREF( ArgsList ) ;
+
+ cdebug_out << "GraphExecutor::InNode::PyDynInvoke " << method << endl ;
+
+ return RetVal ;
}
- cdebug_out << "GraphExecutor::InNode::PyDynInvoke " << method << endl ;
-
- return RetVal ;
-
}
SUPERVGUI::SUPERVGUI(): QObject(),
- desktop(0),
- study(0),
- engine(0),
- browser(0)
- //info(0)
+ desktop(0),
+ study(0),
+ browser(0)
+ //info(0)
{
Trace("SUPERVGUI::SUPERVGUI")
if (factory==0) {
Trace("SUPERVGUI::~SUPERVGUI")
if (factory==1) {
factory = 0;
+ //if (!engine->_is_nil()) CORBA::release(engine);
//info->close();
- browser->close();
+ if (browser) browser->close();
MESSAGE("SUPERVGUI Info : factory destroy");
} else {
MESSAGE("SUPERVGUI Error : another call to factory destructor");
return;
};
- engine = new SUPERV::SuperG_var;
- *engine = aSuperVisionComponent;
+ // engine = new SUPERV::SuperG_var;
+ engine = aSuperVisionComponent;
}
/*
bool SUPERVGUI::information(SUPERV_CNode node, bool isReadOnly) {
return;
}
- SUPERV_Graph aGraph = (*Supervision.getEngine())->GraphE(f);
+ SUPERV_Graph aGraph = engine->GraphE(f);
//QFileInfo aFile(f);
//aGraph->SetName(aFile.baseName());
if (SUPERV_isNull(aGraph)) {
QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)
return;
}
- aDataFlow = (*Supervision.getEngine())->getGraph(ior);
+ aDataFlow = engine->getGraph(ior);
if (SUPERV_isNull(aDataFlow)) {
QMessageBox::warning(0, tr("ERROR"), tr("MSG_ACCESS_BAD_IOR"));
return;
return;
}
- SUPERV_Graph aGraph = (*Supervision.getEngine())->Graph(f);
+ SUPERV_Graph aGraph = engine->Graph(f);
//QFile aFile(f);
//aGraph->SetName(aFile.name());
if (SUPERV_isNull(aGraph)) {
SALOME_Selection* Sel = SALOME_Selection::Selection(study->getSelection() );
if ((Sel==NULL) || (Sel->IObjectCount() == 0)) return;
- Handle(SALOME_InteractiveObject) anIObj = Sel->firstIObject();
+ if (Sel->IObjectCount() == 1) {
+ Handle(SALOME_InteractiveObject) anIObj = Sel->firstIObject();
- // insert SUPERV-specific popup items here
+ // insert SUPERV-specific popup items here
- bool isDataflow, ownObj;
- whatIsSelected(anIObj, ownObj, isDataflow);
-
- if (isDataflow) {
- popup->insertItem(tr( "MSG_RENAME" ), this, SLOT(renameDataflow()));
- popup->insertItem("Display", this, SLOT(displayDataflow()));
- popup->insertSeparator();
+ bool isDataflow, ownObj;
+ whatIsSelected(anIObj, ownObj, isDataflow);
+
+ if (isDataflow) {
+ popup->insertItem(tr( "MSG_RENAME" ), this, SLOT(renameDataflow()));
+ popup->insertItem("Display", this, SLOT(displayDataflow()));
+ popup->insertSeparator();
+ }
+ if (ownObj)
+ popup->insertItem(tr("MSG_DELETE"), this, SLOT(deleteObject()));
+ }
+ if (Sel->IObjectCount() > 1) {
+ int aIObjCount = 0;
+ SALOME_ListIteratorOfListIO It_forCheckOwner(Sel->StoredIObjects());
+ for(;It_forCheckOwner.More();It_forCheckOwner.Next()) {
+ Handle(SALOME_InteractiveObject) anIObj = It_forCheckOwner.Value();
+ bool aIsOwner, aIsDataflow;
+ whatIsSelected(anIObj, aIsOwner, aIsDataflow);
+
+ if (aIsOwner) aIObjCount++;
+ }
+ if (aIObjCount == Sel->IObjectCount()) //all selected objects belong to Supervision
+ popup->insertItem(tr("MSG_DELETE"), this, SLOT(deleteObject()));
}
- if (ownObj)
- popup->insertItem(tr("MSG_DELETE"), this, SLOT(deleteObject()));
}
SALOMEDS::GenericAttribute_var anAttr;
if (obj->FindAttribute(anAttr, "AttributeIOR")) {
SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- SUPERV_Graph aDataFlow = (*Supervision.getEngine())->getGraph(anIOR->Value());
+ SUPERV_Graph aDataFlow = engine->getGraph(anIOR->Value());
if (!SUPERV_isNull(aDataFlow))
theIsDataflow = true;
}
void SUPERVGUI::deleteObject() {
SALOME_Selection* Sel = SALOME_Selection::Selection(study->getSelection() );
if ((Sel==NULL) || (Sel->IObjectCount() == 0)) return;
-
- Handle(SALOME_InteractiveObject) anIObj = Sel->firstIObject();
- bool aIsOwner, aIsDataflow;
- whatIsSelected(anIObj, aIsOwner, aIsDataflow);
-
- if (!aIsOwner) return;
-
+
if (QMessageBox::warning(QAD_Application::getDesktop(),
tr("WARNING"),
tr("MSG_ASK_DELETE"),
QMessageBox::No,
QMessageBox::Yes) == QMessageBox::No)
return;
-
- SALOMEDS::Study_var aStudy = study->getStudyDocument();
- SALOMEDS::SObject_var aObj = aStudy->FindObjectID( anIObj->getEntry() );
- if (!aObj->_is_nil()) {
- if (aIsDataflow) {
- SALOMEDS::GenericAttribute_var anAttr;
- if (aObj->FindAttribute(anAttr, "AttributeIOR")) {
- SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- QString ior = anIOR->Value();
-
- SUPERVGUI_Main* aMain;
- for (aMain = myGraphList.first(); aMain; aMain = myGraphList.next()) {
- if ((aMain->getStudy() == study) && (aMain->getHashCode() == ior)) {
- aMain->setAsFromStudy(false);
- break;
+
+ SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
+ for(;It.More();It.Next()) {
+ Handle(SALOME_InteractiveObject) anIObj = It.Value();
+ bool aIsOwner, aIsDataflow;
+ whatIsSelected(anIObj, aIsOwner, aIsDataflow);
+
+ SALOMEDS::Study_var aStudy = study->getStudyDocument();
+ SALOMEDS::SObject_var aObj = aStudy->FindObjectID( anIObj->getEntry() );
+ if (!aObj->_is_nil()) {
+ if (aIsDataflow) {
+ SALOMEDS::GenericAttribute_var anAttr;
+ if (aObj->FindAttribute(anAttr, "AttributeIOR")) {
+ SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ QString ior = anIOR->Value();
+
+ SUPERVGUI_Main* aMain;
+ for (aMain = myGraphList.first(); aMain; aMain = myGraphList.next()) {
+ if ((aMain->getStudy() == study) && (aMain->getHashCode() == ior)) {
+ aMain->setAsFromStudy(false);
+ break;
+ }
}
- }
+ }
}
+ QAD_Operation* op = new SALOMEGUI_ImportOperation( study );
+ SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
+ op->start();
+ aBuilder->RemoveObjectWithChildren(aObj);
+ op->finish();
}
- QAD_Operation* op = new SALOMEGUI_ImportOperation( study );
- SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
- op->start();
- aBuilder->RemoveObjectWithChildren(aObj);
- op->finish();
}
Sel->ClearIObjects() ;
}
QHBoxLayout* aBox = new QHBoxLayout(this);
aBox->setMargin(3);
aBox->setSpacing(3);
- component = new SUPERVGUI_Label(this, CELL_WIDTH_PART, LABEL_HEIGHT, myNode->Comment(), QLabel::AlignLeft);
+
+ QString aCommentVis;
+ if (getNodeType() == SUPERV::FactoryNode)
+ aCommentVis = QString(myNode->Service()->ServiceName) + QString(tr("COMMENT_FROM"))
+ + QString(getFactoryNode()->GetComponentName());
+ else
+ //aCommentVis = tr("COMMENT_PYTHON");
+ aCommentVis = tr("COMMENT_CNODE");
+
+ component = new SUPERVGUI_Label(this, CELL_WIDTH_PART, LABEL_HEIGHT, aCommentVis, QLabel::AlignLeft);
connect(component, SIGNAL(MousePress(QMouseEvent*)), this, SLOT(showPopup(QMouseEvent*)));
myTitle = new SUPERVGUI_Label(this, CELL_WIDTH_PART, LABEL_HEIGHT, name(), QLabel::AlignLeft);
Trace("SUPERVGUI_Cell::sync");
if (myMain == NULL) return;
myTitle->setText(myNode->Name());
- component->setText(myNode->Comment());
+ //component->setText(myNode->Comment());
if (guiNode != NULL) {
guiNode->sync();
if ( aTxt.isNull() || aTxt.isEmpty() ) return false;
if ( aTxt.find( "Unknown" ) < 0 ) {
- return myPort->Input( ( *Supervision.getEngine() )->StringValue( aTxt ) );
+ return myPort->Input( Supervision.getEngine()->StringValue( aTxt ) );
}
return false;
}
aGridLayout->addMultiCellWidget(myTitle, 0, 0, 0, 1);
QString aComment(theNode->Comment());
+
+ QString aCommentVis = aComment;
+ if (getNodeType() == SUPERV::FactoryNode)
+ aCommentVis = QString(myNode->Service()->ServiceName) + QString(tr("COMMENT_FROM"))
+ + QString(getFactoryNode()->GetComponentName());
+ else
+ //aCommentVis = tr("COMMENT_PYTHON");
+ aCommentVis = tr("COMMENT_CNODE");
+
if (aComment.isNull() || aComment.isEmpty()) {
- if (getNodeType() == SUPERV::FactoryNode)
- aComment = QString(myNode->Service()->ServiceName) + QString(tr("COMMENT_FROM"))
- + QString(getFactoryNode()->GetComponentName());
- else
- //aComment = tr("COMMENT_PYTHON");
- aComment = tr("COMMENT_CNODE");
- theNode->SetComment(aComment.latin1());
+ theNode->SetComment(aCommentVis.latin1());
}
-
+
myServiceBox = new QVBox(this, "service");
- myComment = new SUPERVGUI_Label(myServiceBox, LABEL_WIDTH, LABEL_HEIGHT, aComment, QLabel::AlignLeft);
+ myComment = new SUPERVGUI_Label(myServiceBox, LABEL_WIDTH, LABEL_HEIGHT, aCommentVis, QLabel::AlignLeft);
connect(myComment, SIGNAL(MousePress(QMouseEvent*)), this, SLOT(showPopup(QMouseEvent*)));
QToolTip::add(myTitle, myTitle->text());
QToolTip::add(myComment, myComment->text());
setName(myNode->Name());
myTitle->setText(name());
- myComment->setText(myNode->Comment());
-
+ //myComment->setText(myNode->Comment());
+
bool editing = myMain->getDataflow()->IsEditing();
myPopup->setItemEnabled(myKillItem, !editing);
if (myMain->isEditable()) {
myPortsBox->reparent(this, pos());
aGridLayout->addMultiCellWidget(myPortsBox, 1, 1, 0, 1);
+ // myGatesBox->setPaletteBackgroundColor(backgroundColor().dark(105));
myStatus->reparent(this, pos());
myTime->reparent(this, pos());
myTitle->setPaletteBackgroundColor(TITLECOLOR);
aGridLayout->addMultiCellWidget(myTitle, 0, 0, 0, 2);
- myPortsBox = new QFrame(this);
- myPortLayout = new QGridLayout(myPortsBox, 0, 2, 0, 1);
+ myPortsBox->reparent(this, pos());
myPIcount = 0;
myPOcount = 0;
for (int i=0; i<n; i++) {
if (ports[i]->IsInput()) {
- myPortLayout->addWidget(new SUPERVGUI_PortIn(myPortsBox, myMain, ports[i]),
- myPIcount, 0);
- myPIcount++;
+ if (getComputingNode()->IsEndSwitch()) {
+ if (ports[i]->IsGate())
+ myGatesLayout->addWidget(new SUPERVGUI_PortInESNode(myGatesBox, myMain, ports[i]),
+ 0, 0);
+ else {
+ myPortLayout->addWidget(new SUPERVGUI_PortInESNode(myValuesBox, myMain, ports[i]),
+ myPIcount, 0);
+ myPIcount++;
+ }
+ } else {
+ if (ports[i]->IsGate())
+ myGatesLayout->addWidget(new SUPERVGUI_PortIn(myGatesBox, myMain, ports[i]),
+ 0, 0);
+ else {
+ myPortLayout->addWidget(new SUPERVGUI_PortIn(myValuesBox, myMain, ports[i]),
+ myPIcount, 0);
+ myPIcount++;
+ }
+ }
} else {
- myPortLayout->addWidget(new SUPERVGUI_PortOut(myPortsBox, myMain, ports[i]),
- myPOcount, 1, Qt::AlignRight);
- myPOcount++;
+ if (ports[i]->IsGate())
+ myGatesLayout->addWidget(new SUPERVGUI_PortOut(myGatesBox, myMain, ports[i]),
+ 0, 1, Qt::AlignRight);
+ else {
+ myPortLayout->addWidget(new SUPERVGUI_PortOut(myValuesBox, myMain, ports[i]),
+ myPOcount, 1, Qt::AlignRight);
+ myPOcount++;
+ }
}
}
aGridLayout->addMultiCellWidget(myPortsBox, 1, 1, 1, 2);
#include CORBA_SERVER_HEADER(SALOMEDS)
#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
-#define SUPERV_Engine SUPERV::SuperG_var*
+#define SUPERV_Engine SUPERV::SuperG_var
#define SUPERV_Graph SUPERV::Graph_var
connect(myTitle, SIGNAL(MouseMove (QMouseEvent*)), this, SLOT(mouseTitleMove(QMouseEvent*)));
connect(myTitle, SIGNAL(MouseRelease(QMouseEvent*)), this, SLOT(mouseTitleRelease(QMouseEvent*)));
- myPortsBox = new QFrame(0);
- myPortLayout = new QGridLayout(myPortsBox, 0, 2, 0, 1);
+ myPortsBox = new QVBox(0);
+ myPortsBox->setSpacing(3);
+ myValuesBox = new QWidget(myPortsBox);
+ myPortLayout = new QGridLayout(myValuesBox, 0, 2, 0, 1);
+
+ myGatesBox = new QFrame(myPortsBox);
+ myGatesBox->setFrameStyle( QFrame::Panel | QFrame::Raised );
+ myGatesBox->setLineWidth(2);
+ // myGatesBox->setPaletteBackgroundColor(backgroundColor().dark(105));
+ myGatesBox->setPaletteBackgroundColor(green.light(170));
+ myGatesLayout = new QGridLayout(myGatesBox, 0, 2);
+ myGatesLayout->setMargin(3);
myTimer = new QTimer(this);
connect(myTimer, SIGNAL(timeout()), this, SLOT(movingNode(/*QMouseEvent* e*/)));
for (int i=0; i<n; i++) {
if (ports[i]->IsInput()) {
- myPortLayout->addWidget(new SUPERVGUI_PortIn(myPortsBox, myMain, ports[i]),
- myPIcount, 0);
- myPIcount++;
+ if (ports[i]->IsGate())
+ myGatesLayout->addWidget(new SUPERVGUI_PortIn(myGatesBox, myMain, ports[i]),
+ 0, 0);
+ else {
+ myPortLayout->addWidget(new SUPERVGUI_PortIn(myValuesBox, myMain, ports[i]),
+ myPIcount, 0);
+ myPIcount++;
+ }
} else {
- myPortLayout->addWidget(new SUPERVGUI_PortOut(myPortsBox, myMain, ports[i]),
- myPOcount, 1, Qt::AlignRight);
- myPOcount++;
+ if (ports[i]->IsGate())
+ myGatesLayout->addWidget(new SUPERVGUI_PortOut(myGatesBox, myMain, ports[i]),
+ 0, 1, Qt::AlignRight);
+ else {
+ myPortLayout->addWidget(new SUPERVGUI_PortOut(myValuesBox, myMain, ports[i]),
+ myPOcount, 1, Qt::AlignRight);
+ myPOcount++;
+ }
}
}
}
//check: is creation of link is complete
if (myMain->getGraph()->isAnyLinkCreating()) {
//not creation complete
- //cout<<" --- $$$ 1"<<endl;
myPopup->setItemEnabled(myDeleteItem, false);
}
else {
if (aPort == NULL) return;
if (getNodeType() == SUPERV::EndSwitchNode) {
- SUPERVGUI_PortInESNode* aPortPrs = new SUPERVGUI_PortInESNode(myPortsBox, myMain, aPort);
+ SUPERVGUI_PortInESNode* aPortPrs = new SUPERVGUI_PortInESNode(myValuesBox, myMain, aPort);
myPortLayout->addWidget(aPortPrs, myPIcount, 0);
if (myPortsBox->isVisible()) {
}
}
else {
- SUPERVGUI_PortIn* aPortPrs = new SUPERVGUI_PortIn(myPortsBox, myMain, aPort);
+ SUPERVGUI_PortIn* aPortPrs = new SUPERVGUI_PortIn(myValuesBox, myMain, aPort);
myPortLayout->addWidget(aPortPrs, myPIcount, 0);
if (myPortsBox->isVisible()) {
SUPERV_Port aPort = createOutPort();
if (aPort == NULL) return;
- SUPERVGUI_PortOut* aPortPrs = new SUPERVGUI_PortOut(myPortsBox, myMain, aPort);
+ SUPERVGUI_PortOut* aPortPrs = new SUPERVGUI_PortOut(myValuesBox, myMain, aPort);
myPortLayout->addWidget(aPortPrs, myPOcount, 1, Qt::AlignRight);
myPOcount++;
if (myPortsBox->isVisible()) {
aPortPrs = (SUPERVGUI_Port*) child(aName, "SUPERVGUI_Port");
if (aPortPrs == NULL) {
if (aPorts[i]->IsInput()) {
- SUPERVGUI_PortIn* aPortIn = new SUPERVGUI_PortIn(myPortsBox, myMain, aPorts[i]);
- myPortLayout->addWidget(aPortIn, myPIcount, 0);
+ SUPERVGUI_PortIn* aPortIn;
+ if (aPorts[i]->IsGate()) {
+ aPortIn = new SUPERVGUI_PortIn(myGatesBox, myMain, aPorts[i]);
+ myGatesLayout->addWidget(aPortIn, myPIcount, 0);
+ } else {
+ aPortIn = new SUPERVGUI_PortIn(myValuesBox, myMain, aPorts[i]);
+ myPortLayout->addWidget(aPortIn, myPIcount, 0);
+ myPIcount++;
+ }
if (aIsVisible) aPortIn->show();
- myPIcount++;
isAdded = true;
} else {
- SUPERVGUI_PortOut* aPortOut = new SUPERVGUI_PortOut(myPortsBox, myMain, aPorts[i]);
- myPortLayout->addWidget(aPortOut, myPOcount, 1, Qt::AlignRight);
+ SUPERVGUI_PortOut* aPortOut;
+ if (aPorts[i]->IsGate()) {
+ aPortOut = new SUPERVGUI_PortOut(myGatesBox, myMain, aPorts[i]);
+ myGatesLayout->addWidget(aPortOut, myPOcount, 1, Qt::AlignRight);
+ } else {
+ aPortOut = new SUPERVGUI_PortOut(myValuesBox, myMain, aPorts[i]);
+ myPortLayout->addWidget(aPortOut, myPOcount, 1, Qt::AlignRight);
+ myPOcount++;
+ }
if (aIsVisible) aPortOut->show();
- myPOcount++;
isAdded = true;
}
}
protected:
SUPERVGUI_Label* myTitle;
- QFrame* myPortsBox;
+ QVBox* myPortsBox;
+ QWidget* myValuesBox;
QGridLayout* myPortLayout;
+
+ QFrame* myGatesBox;
+ QGridLayout* myGatesLayout;
+
QTimer* myTimer;
int myPIcount;
int myPOcount;
contV = new QLineEdit( TopGroup );
contV->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
contV->setMinimumSize( 200, 0 );
- contV->setReadOnly( true/*isReadOnly*/ );
+ contV->setReadOnly( false/*isReadOnly*/ );
contV->setText( SUPERV::FNode::_narrow(node)->GetContainer() );
compnameL = new QLabel( tr( "COMPONENT_NAME_LBL" ), TopGroup );
Trace("SUPERVGUI_Information::okButton");
myNode->SetName( nameV->text().latin1());
myNode->SetAuthor( authV->text().latin1() );
- /*if (myNode->IsFactory()) {
+ if (myNode->IsFactory()) {
SUPERV_FNode aFNode = SUPERV::FNode::_narrow(myNode);
aFNode->SetContainer( contV->text().latin1() );
- }*/
+ }
myNode->SetComment( commV->text().latin1() );
accept();
}
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()->getGraph(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()->Graph(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()->Graph(f);
} else {
- dataflow = (*Supervision.getEngine())->GraphE(f);
+ dataflow = Supervision.getEngine()->GraphE(f);
}
if (SUPERV_isNull(dataflow)) {
QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_BAD_FILE").arg(f));
aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
aPixmap->SetPixMap( "ICON_OBJBROWSER_Supervision" );
- builder->DefineComponentInstance(father, *Supervision.getEngine());
+ builder->DefineComponentInstance(father, Supervision.getEngine());
op->finish();
};
anAttr = aBuilder->FindOrCreateAttribute(aComponent, "AttributePixMap");
aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
aPixmap->SetPixMap( "ICON_OBJBROWSER_Supervision" );
- aBuilder->DefineComponentInstance(aComponent, *Supervision.getEngine());
+ aBuilder->DefineComponentInstance(aComponent, Supervision.getEngine());
if (aLocked) aStudy->GetProperties()->SetLocked(true);
anOperation->finish();
}
anAttr = aBuilder->FindOrCreateAttribute(aComponent, "AttributePixMap");
aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
aPixmap->SetPixMap( "ICON_OBJBROWSER_Supervision" );
- aBuilder->DefineComponentInstance(aComponent, *Supervision.getEngine());
+ aBuilder->DefineComponentInstance(aComponent, Supervision.getEngine());
if (aLocked) aStudy->GetProperties()->SetLocked(true);
anOperation->finish();
}
break;
}
myTime->setPaletteBackgroundColor(myStatus->paletteBackgroundColor());
- long sec = 0; //myNode->CpuUsed();
+ long sec = myNode->CpuUsed();
// sec++;
char hms[9];
long s = sec/3600;
SUPERV_Port SUPERVGUI_Node::createInPort() {
SUPERVGUI_PortParamsDlg* aDlg = new SUPERVGUI_PortParamsDlg();
if (aDlg->exec()) {
+ if (aDlg->getName().isEmpty() || aDlg->getType().isEmpty()) {
+ QMessageBox::warning( QAD_Application::getDesktop(), tr( "ERROR" ), tr( "MSG_CANT_CREATE_PORT" ) );
+ return NULL;
+ }
SUPERV_INode aNode = getInlineNode();
if (SUPERV_isNull(aNode)) {
MESSAGE("SUPERVGUI_Node::createInPort: Node is wrong type");
* Port parameters dialog definition
*/
+static const char* MyTypeStrings[] =
+ {"string", "boolean", "char", "short", "int", "long", "float", "double", "objref"};
+
SUPERVGUI_PortParamsDlg::SUPERVGUI_PortParamsDlg()
: QDialog(QAD_Application::getDesktop(), 0, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
QLabel* aTypeLbl = new QLabel("Value Type", this );
aBaseLayout->addWidget(aTypeLbl, 1, 0);
- myTypeTxt = new QLineEdit( this );
+ myTypeTxt = new QComboBox( this );
aTypeLbl->setBuddy( myTypeTxt );
+ myTypeTxt->insertStrList( MyTypeStrings );
aBaseLayout->addWidget(myTypeTxt, 1, 1);
QGroupBox* aBtnBox = new QGroupBox( this );
#include "SUPERVGUI_Label.h"
#include <qvbox.h>
#include "SUPERVGUI_BrowseNodeDlg.h"
+#include <qcombobox.h>
+
class SUPERVGUI_Main;
~SUPERVGUI_PortParamsDlg() {};
QString getName() { return myNameTxt->text(); }
- QString getType() { return myTypeTxt->text(); }
+ QString getType() { return myTypeTxt->currentText(); }
private:
QLineEdit* myNameTxt;
- QLineEdit* myTypeTxt;
+ QComboBox* myTypeTxt;
};
void SUPERVGUI_PortIn::setValue(const char* d) {
Trace("SUPERVGUI_PortIn::setValue")
- if (port->Input((*Supervision.getEngine())->StringValue(d))) {
+ if (port->Input(Supervision.getEngine()->StringValue(d))) {
sync();
} else {
QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_SETVAL"));
QPoint SUPERVGUI_PortIn::getConnectPnt() {
// Parent widget is internal node frame
// parent of parent is node it self
- QWidget* aNode = parentWidget()->parentWidget();
+ QWidget* aNode = parentWidget()->parentWidget()->parentWidget();
QPoint aPnt(aNode->pos()); // position of the node
if (parentWidget()->isVisible()) {
+ aPnt += parentWidget()->parentWidget()->pos();
aPnt += parentWidget()->pos();
return QPoint(aPnt.x() + pos().x(),
aPnt.y() + (pos().y() + height()/2));
QPoint SUPERVGUI_PortOut::getConnectPnt() {
// Parent widget is internal node frame
// parent of parent is node it self
- QWidget* aNode = parentWidget()->parentWidget();
+ QWidget* aNode = parentWidget()->parentWidget()->parentWidget();
QPoint aPnt(aNode->pos()); // position of the node
if (parentWidget()->isVisible()) {
+ aPnt += parentWidget()->parentWidget()->pos();
aPnt += parentWidget()->pos();
return QPoint(aPnt.x() + pos().x() + width(),
aPnt.y() + (pos().y() + height()/2));
void SUPERVGUI_PortInESNode::setValue(const char* d) {
Trace("SUPERVGUI_PortIn::setValue")
- if (port->Input((*Supervision.getEngine())->StringValue(d))) {
+ if (port->Input(Supervision.getEngine()->StringValue(d))) {
sync();
} else {
QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_SETVAL"));
* Returns coordinates of connection point in content coordinates
*/
QPoint SUPERVGUI_PortInESNode::getConnectPnt() {
- QWidget* aNode = parentWidget()->parentWidget();
+ QWidget* aNode = parentWidget()->parentWidget()->parentWidget();
QPoint aPnt(aNode->pos());
if (parentWidget()->isVisible()) {
+ aPnt += parentWidget()->parentWidget()->pos();
aPnt += parentWidget()->pos();
return QPoint(aPnt.x() + pos().x(),
aPnt.y() + (pos().y() + height()/2));
msgstr "Show"
msgid "POP_SHOWTITLES"
-msgstr "Comment"
+msgstr "Label"
msgid "POP_SHOWPORTS"
msgstr "Ports"
msgid "MSG_PORT_EXIST"
msgstr "Port with such name already exists"
+msgid "MSG_CANT_CREATE_PORT"
+msgstr "Port with empty Name and empty Type can not be created"
using namespace std;
#include <stdio.h>
#include <fstream>
-#include <strstream>
+//#include <sstream>
#include <string>
-#include "utilities.h"
+//#include "utilities.h"
#include "Graph_Impl.hxx"
// << hex << (void *) this << dec )
// _thisObj = this ;
// _id = _poa->activate_object(_thisObj);
- MESSAGE( "CNode_Impl::CNode_Impl " << aDataFlowName << " " );
+// MESSAGE( "CNode_Impl::CNode_Impl " << aDataFlowName << " " );
beginService( "CNode_Impl::CNode_Impl" );
_Orb = CORBA::ORB::_duplicate(orb);
_Poa = poa ;
const char * FuncName ,
const SUPERV::ListOfStrings & PythonFunction ) :
Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
-// beginService( "CNode_Impl::CNode_Impl" );
- if ( FuncName && NodeName ) {
- cout << "CNode_Impl::CNode_Impl " << (void *) NodeName << " " << NodeName
- << " " << strlen(NodeName) << " " << (void *) FuncName << " " << FuncName
- << " " << strlen( FuncName ) << endl ;
- }
+ beginService( "CNode_Impl::CNode_Impl" );
+// cout << "CNode_Impl::CNode_Impl -->" << endl ;
+// if ( FuncName && NodeName ) {
+// cout << "CNode_Impl::CNode_Impl " << (void *) NodeName << " " << NodeName
+// << " " << strlen(NodeName) << " " << (void *) FuncName << " " << FuncName
+// << " " << strlen( FuncName ) << endl ;
+// }
if ( NodeKindOfNode == SUPERV::ComputingNode ) {
MESSAGE( "CNode_Impl::CNode_Impl " << FuncName << " _poa->activate_object" );
_thisObj = this ;
aFuncName ,
aPythonFunction ) ;
_IsNode = true ;
-// endService( "CNode_Impl::CNode_Impl" );
+ endService( "CNode_Impl::CNode_Impl" );
+// cout << "<-- CNode_Impl::CNode_Impl" << endl ;
}
CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
bool sts = false ;
GraphBase::InPort * anInPort ;
if ( _IsNode ) {
- sts = _DataFlowExecutor->ChangeInputData( _DataFlowEditor->Name() ,
+ sts = _DataFlowExecutor->ChangeInputData( _DataFlowNode->Name() ,
ToServiceParameterName ,
*aValue->ToAny() ) ;
anInPort = _DataFlowNode->GetChangeInPort( ToServiceParameterName ) ;
SUPERV::ListOfPorts * CNode_Impl::Ports() {
bool begin = true ;
SUPERV::ListOfPorts_var RetVal = new SUPERV::ListOfPorts ;
-// if ( !_DataFlowNode->IsDataFlowNode() ) {
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 ( CORBA::is_nil( anInPort->ObjRef() ) ) {
- if ( begin ) {
- beginService( "CNode_Impl::Ports" );
- begin = false ;
- }
+ if ( begin ) {
+ beginService( "CNode_Impl::Ports" );
+ begin = false ;
+ }
+ if ( anInPort->IsLoop() || ( anInPort->IsGate() && !anInPort->IsConnected() &&
+ ( _DataFlowEditor->IsExecuting() || _DataFlowEditor->IsReadOnly() ) ) ) {
+ MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " ignored" ) ;
+ RetVal[ i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ;
+ }
+ else if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
+ MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsExecuting "
+ << _DataFlowEditor->IsExecuting() << " IsGate/IsConnected " << anInPort->IsGate()
+ << "/" << anInPort->IsConnected() ) ;
Port_Impl * myPort ;
if ( _DataFlowNode->HasInput( anInPort->PortName() ) ) {
const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
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 ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
- if ( begin ) {
- beginService( "CNode_Impl::Ports" );
- begin = false ;
- }
+ 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() ,
anOutPort->ObjRef( SUPERV::Port::_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-- ;
+ }
+ }
}
else {
if ( _DataFlowEditor->IsValid() ) {
}
bool CNode_Impl::IsLinked(const char * ServiceParameterName ) {
-// beginService( "CNode_Impl::IsLinked" );
+ beginService( "CNode_Impl::IsLinked" );
bool RetVal = _DataFlowNode->IsLinked( ServiceParameterName ) ;
-// endService( "CNode_Impl::IsLinked" );
+ MESSAGE( Name() << "->IsLinked( '" << ServiceParameterName << "' )" ) ;
+ endService( "CNode_Impl::IsLinked" );
return RetVal ;
}
}
void CNode_Impl::ControlClear() {
// beginService( "CNode_Impl::ControlClear" );
- SUPERV::ControlState RetVal = SUPERV::VoidState ;
+// SUPERV::ControlState RetVal = SUPERV::VoidState ;
GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
if ( _DataFlowExecutor ) {
if ( _IsNode ) {
GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
if ( _DataFlowExecutor ) {
if ( _IsNode ) {
-// RetVal = _DataFlowExecutor->CpuUsed( Name() ) ;
+ RetVal = _DataFlowExecutor->CpuUsed( Name() ) ;
}
else {
-// RetVal = _DataFlowExecutor->CpuUsed() ;
+ RetVal = _DataFlowExecutor->CpuUsed() ;
}
}
- else {
- return 0 ;
- }
return RetVal ;
}
#ifndef _CNODE_IMPL_HXX_
#define _CNODE_IMPL_HXX_
-#include <iostream.h>
+#include <iostream>
#include "CORBA.h"
const char *interfaceName ,
GraphEditor::DataFlow * DataFlowEditor ,
const SALOME_ModuleCatalog::Service &NodeService ,
- const char * NodeName = NULL ,
+ const char * NodeName = NULLSTRING ,
const SUPERV::KindOfNode NodeKindOfNode = SUPERV::ComputingNode ,
- const char * aFuncName = NULL ,
+ const char * aFuncName = NULLSTRING ,
const SUPERV::ListOfStrings & aPythonFunction = SUPERV::ListOfStrings() ) ;
CNode_Impl( CORBA::ORB_ptr orb ,
PortableServer::POA_ptr poa ,
const char *interfaceName ,
GraphEditor::DataFlow * DataFlowEditor ,
const SALOME_ModuleCatalog::Service &NodeService ,
- const char * NodeName = NULL ,
+ const char * NodeName = NULLSTRING ,
const SUPERV::KindOfNode NodeKindOfNode = SUPERV::InLineNode ,
const GraphBase::ListOfFuncName & aFuncName = GraphBase::ListOfFuncName() ,
const GraphBase::ListOfPythonFunctions & aPythonFunction = GraphBase::ListOfPythonFunctions() ) ;
using namespace std;
#include <stdio.h>
#include <fstream>
-#include <strstream>
+//#include <sstream>
#include <string>
-#include "utilities.h"
+//#include "utilities.h"
#include "ELNode_Impl.hxx"
#ifndef _ELNODE_IMPL_HXX_
#define _ELNODE_IMPL_HXX_
-#include <iostream.h>
+//#include <iostream.h>
#include "CORBA.h"
using namespace std;
#include <stdio.h>
#include <fstream>
-#include <strstream>
+//#include <sstream>
#include <string>
-#include "utilities.h"
+//#include "utilities.h"
#include "ESNode_Impl.hxx"
GNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , FuncName , SUPERV::ListOfStrings() , NodeKindOfNode ) {
// MESSAGE( NodeName << " " );
beginService( "ESNode_Impl::ESNode_Impl" );
- if ( FuncName ) {
- cout << "ESNode_Impl::GNode_Impl " << (void *) FuncName << " " << FuncName
- << " " << strlen( FuncName ) << endl ;
- }
+// if ( FuncName ) {
+// cout << "ESNode_Impl::GNode_Impl " << (void *) FuncName << " " << FuncName
+// << " " << strlen( FuncName ) << endl ;
+// }
_thisObj = this ;
_id = _poa->activate_object(_thisObj);
_Orb = CORBA::ORB::_duplicate(orb);
#ifndef _ESNODE_IMPL_HXX_
#define _ESNODE_IMPL_HXX_
-#include <iostream.h>
+//#include <iostream.h>
#include "CORBA.h"
using namespace std;
#include <stdio.h>
#include <fstream>
-#include <strstream>
+//#include <sstream>
#include <string>
-#include "utilities.h"
+//#include "utilities.h"
#include "FNode_Impl.hxx"
}
FNode_Impl::FNode_Impl( CORBA::ORB_ptr orb ,
- PortableServer::POA_ptr poa ,
- PortableServer::ObjectId * contId ,
- const char *instanceName ,
- const char *interfaceName ,
- GraphEditor::DataFlow * aDataFlowEditor ,
- const SALOME_ModuleCatalog::Service &NodeService ,
- const char * NodeComponentName ,
- const char * NodeInterfaceName ,
- const char * NodeName ,
- const SUPERV::KindOfNode NodeKindOfNode ) :
+ PortableServer::POA_ptr poa ,
+ PortableServer::ObjectId * contId ,
+ const char * instanceName ,
+ const char * interfaceName ,
+ GraphEditor::DataFlow * aDataFlowEditor ,
+ const SALOME_ModuleCatalog::Service &NodeService ,
+ const char * NodeComponentName ,
+ const char * NodeInterfaceName ,
+ const char * NodeName ,
+ const SUPERV::KindOfNode NodeKindOfNode ) :
// Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
- CNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , NodeService , NodeName , NodeKindOfNode , (char * ) NULL ) {
- MESSAGE( NodeName << " " );
-// beginService( "FNode_Impl::FNode_Impl" );
+ CNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , NodeService , NodeName , NodeKindOfNode , NULLSTRING ) {
+// MESSAGE( NodeName << " " );
+ beginService( "FNode_Impl::FNode_Impl" );
+// cout << "FNode_Impl::FNode_Impl -->" << endl ;
_thisObj = this ;
_id = _poa->activate_object(_thisObj);
_Orb = CORBA::ORB::_duplicate(orb);
// NodeKindOfNode ) ) ;
DataFlowNode()->ComponentName( NodeComponentName ) ;
DataFlowNode()->InterfaceName( NodeInterfaceName ) ;
-// endService( "FNode_Impl::FNode_Impl" );
+ endService( "FNode_Impl::FNode_Impl" );
+// cout << "<-- FNode_Impl::FNode_Impl" << endl ;
}
FNode_Impl::FNode_Impl( CORBA::ORB_ptr orb ,
- PortableServer::POA_ptr poa ,
- PortableServer::ObjectId * contId ,
- const char *instanceName ,
- const char *interfaceName ,
- GraphEditor::DataFlow * aDataFlowEditor ,
- GraphEditor::InNode * aDataFlowNode ) :
+ PortableServer::POA_ptr poa ,
+ PortableServer::ObjectId * contId ,
+ const char * instanceName ,
+ const char * interfaceName ,
+ GraphEditor::DataFlow * aDataFlowEditor ,
+ GraphEditor::InNode * aDataFlowNode ) :
// Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
CNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , aDataFlowNode ) {
MESSAGE( DataFlowNode()->Name() << " " );
#ifndef _FNODE_IMPL_HXX_
#define _FNODE_IMPL_HXX_
-#include <iostream.h>
+//#include <iostream.h>
#include "CORBA.h"
FNode_Impl( CORBA::ORB_ptr orb ,
PortableServer::POA_ptr poa ,
PortableServer::ObjectId * contId ,
- const char *instanceName ,
- const char *interfaceName ,
- const char *aDataFlowName ) ;
+ const char * instanceName ,
+ const char * interfaceName ,
+ const char * aDataFlowName ) ;
FNode_Impl( CORBA::ORB_ptr orb ,
PortableServer::POA_ptr poa ,
PortableServer::ObjectId * contId ,
- const char *instanceName ,
- const char *interfaceName ,
+ const char * instanceName ,
+ const char * interfaceName ,
GraphEditor::DataFlow * DataFlowEditor ,
const SALOME_ModuleCatalog::Service &NodeService ,
const char * NodeComponentName ,
const char * NodeInterfaceName ,
- const char * NodeName = NULL ,
+ const char * NodeName = NULLSTRING ,
const SUPERV::KindOfNode NodeKindOfNode = SUPERV::FactoryNode ) ;
FNode_Impl( CORBA::ORB_ptr orb ,
PortableServer::POA_ptr poa ,
PortableServer::ObjectId * contId ,
- const char *instanceName ,
- const char *interfaceName ,
+ const char * instanceName ,
+ const char * interfaceName ,
GraphEditor::DataFlow * DataFlowEditor ,
GraphEditor::InNode * DataFlowNode ) ;
virtual ~FNode_Impl() ;
using namespace std;
#include <stdio.h>
#include <fstream>
-#include <strstream>
+//#include <sstream>
#include <string>
-#include "utilities.h"
+//#include "utilities.h"
#include "GNode_Impl.hxx"
// MESSAGE( NodeName << " " );
beginService( "GNode_Impl::GNode_Impl" );
if ( FuncName ) {
- cout << "GNode_Impl::GNode_Impl " << (void *) FuncName << " " << FuncName
- << " " << strlen( FuncName ) << endl ;
+// cout << "GNode_Impl::GNode_Impl " << (void *) FuncName << " " << FuncName
+// << " " << strlen( FuncName ) << endl ;
}
if ( NodeKindOfNode == SUPERV::GOTONode ) {
_thisObj = this ;
#ifndef _GNODE_IMPL_HXX_
#define _GNODE_IMPL_HXX_
-#include <iostream.h>
+//#include <iostream.h>
#include "CORBA.h"
virtual bool SetCoupled( const char * anInLineNode ) {
GraphBase::InLineNode * CoupledINode = (GraphBase::InLineNode * ) DataFlowEditor()->GetGraphNode( anInLineNode ) ;
- cout << Name() << ".SetCoupled " << anInLineNode << endl ;
+// cout << Name() << ".SetCoupled " << anInLineNode << endl ;
if ( CoupledINode && ( IsGOTO() &&
( CoupledINode->IsInLineNode() || CoupledINode->IsLoopNode() ||
CoupledINode->IsSwitchNode() ) ) ||
DataFlowEditor()->AddLink( Name() , "OutGate" ,
CoupledINode->Name() , "InGate" ) ;
}
- cout << "SetCoupled " << CoupledINode->Name() << endl ;
+// cout << "SetCoupled " << CoupledINode->Name() << endl ;
return true ;
}
- cout << Name() << ".SetCoupled ERROR " << anInLineNode << " " << CoupledINode
- << " of " << Kind() ;
- if ( CoupledINode ) {
- cout << " kinfOkCoupled " << CoupledINode->Kind() ;
- }
- cout << endl ;
+// cout << Name() << ".SetCoupled ERROR " << anInLineNode << " " << CoupledINode
+// << " of " << Kind() ;
+// if ( CoupledINode ) {
+// cout << " kinfOkCoupled " << CoupledINode->Kind() ;
+// }
+// cout << endl ;
return false ; } ;
virtual SUPERV::INode_ptr Coupled() ;
using namespace std;
#include <stdio.h>
#include <fstream>
-#include <strstream>
+//#include <sstream>
#include <string>
-#include "utilities.h"
+//#include "utilities.h"
#include "Graph_Impl.hxx"
_DebugFileName = new char[ strlen( dbgfile.c_str() )+1 ] ;
strcpy( _DebugFileName , dbgfile.c_str() ) ;
- _NamingService = new SALOME_NamingService(orb);
-// _DataFlowEditor = new SALOME_DataFlowEditor_impl( NS ) ;
- GraphEditor::DataFlow * aDataFlowEditor = new GraphEditor::DataFlow(
- _Orb , _NamingService ,
- theDataFlowName ,
- _DebugFileName ) ;
+ _NamingService = new SALOME_NamingService( orb ) ;
+ GraphEditor::DataFlow * aDataFlowEditor = new GraphEditor::DataFlow( _Orb , _NamingService ,
+ theDataFlowName ,
+ _DebugFileName ) ;
DataFlowEditor( aDataFlowEditor ) ;
DataFlowEditor()->SetObjImpl( this ) ;
_DataFlowExecutor = NULL ;
-// _DataFlowDataNode = DataFlowEditor() ;
delete [] theDataFlowName ;
endService( "Graph_Impl::Graph_Impl" );
}
CNode_Impl * myNode = new CNode_Impl( _Orb , _Poa , _ContId ,
instanceName() , interfaceName() ,
DataFlowEditor() ,
- NodeService , (char * ) NULL ,
- SUPERV::ComputingNode , (char * ) NULL ) ;
+ NodeService , NULLSTRING ,
+ SUPERV::ComputingNode , NULLSTRING ) ;
if ( myNode->DataFlowNode() ) {
PortableServer::ObjectId * id = myNode->getId() ;
CORBA::Object_var obj = _poa->id_to_reference(*id);
const char * NodeComponentName ,
const char * NodeInterfaceName ,
const SALOME_ModuleCatalog::Service &NodeService ) {
- beginService( "Graph_Impl::Node" );
+ beginService( "Graph_Impl::FNode" );
SUPERV::FNode_var iobject = SUPERV::FNode::_nil() ;
if ( DataFlowEditor()->IsEditing() && !DataFlowEditor()->IsReadOnly() ) {
FNode_Impl * myNode = new FNode_Impl( _Orb , _Poa , _ContId ,
myNode->SetObjRef( SUPERV::FNode::_duplicate( iobject ) ) ;
}
}
- endService( "Graph_Impl::Node" );
+ endService( "Graph_Impl::FNode" );
return SUPERV::FNode::_duplicate( iobject ) ;
}
else {
anEndName += "Switch" ;
}
- cout << "Graph_Impl::SNode anEndName " << (void *) FuncName << " " << FuncName
- << " " << strlen(FuncName) << " " << (void *) anEndName.c_str() << " "
- << anEndName.c_str() << endl ;
+// cout << "Graph_Impl::SNode anEndName " << (void *) FuncName << " " << FuncName
+// << " " << strlen(FuncName) << " " << (void *) anEndName.c_str() << " "
+// << anEndName.c_str() << endl ;
ESNode_Impl * myEndNode = new ESNode_Impl( _Orb , _Poa , _ContId ,
instanceName() , interfaceName() ,
DataFlowEditor() ,
anEndName.c_str() ,
SUPERV::EndSwitchNode ) ;
- cout << "Graph_Impl::SNode returned anEndName " << (void *) FuncName << " "
- << FuncName << " " << strlen(FuncName) << " " << (void *) anEndName.c_str()
- << " " << anEndName.c_str() << endl ;
+// cout << "Graph_Impl::SNode returned anEndName " << (void *) FuncName << " "
+// << FuncName << " " << strlen(FuncName) << " " << (void *) anEndName.c_str()
+// << " " << anEndName.c_str() << endl ;
PortableServer::ObjectId * endid = myEndNode->getId() ;
CORBA::Object_var endobj = _poa->id_to_reference(*endid);
iendobject = SUPERV::ESNode::_narrow(endobj) ;
if ( theNode == NULL ||
( theNode != NULL && theNode->IsEndSwitchNode() &&
!strcmp( theNode->Name() , aNode->Name() ) ) ) {
- if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
+ if ( anInPort->IsLoop() || anOutPort->IsLoop() ||
+ ( aNode->IsEndLoopNode() && !strcmp( aNode->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::ListOfLinks" );
+ beginService( "Graph_Impl::Links" );
begin = false ;
}
GraphEditor::InNode * anOutNode = NULL ;
if ( theNode || ( toNode->IsEndSwitchNode() && !aNode->IsSwitchNode() ) ) {
if ( anInputParam == NULL ||
!strcmp( anInPort->PortName() , anInputParam ) ) {
- if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
+ 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::ListOfLinks" );
+ beginService( "Graph_Impl::Links" );
begin = false ;
}
Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId ,
}
}
if ( !begin ) {
- endService( "Graph_Impl::ListOfLinks" );
+ endService( "Graph_Impl::Links" );
}
return ( RetVal._retn() ) ;
}
int i ;
SUPERV::ListOfStrings_var Nodes = DataFlowEditor()->LevelNodes( aLevel ) ;
// RetVal->length( Nodes->length() );
- for ( i = 0 ; i < Nodes->length() ; i++ ) {
+ for ( i = 0 ; i < (int ) Nodes->length() ; i++ ) {
// char * aNode = Nodes[ i ] ;
GraphBase::ComputingNode * aNode = DataFlowEditor()->GetChangeGraphNode( Nodes[ i ] ) ;
RetVal = SetNode( RetVal , aNode ) ;
int i ;
map< string , int > aMapOfNodes ;
- for ( i = 0 ; i < aGraphNodes->CNodes.length() ; i++ ) {
+ for ( i = 0 ; i < (int ) aGraphNodes->CNodes.length() ; i++ ) {
SUPERV::CNode_var aNode = (aGraphNodes->CNodes)[ i ] ;
GraphEditor::InNode * myNode ;
GraphBase::ListOfFuncName aFuncName = GraphBase::ListOfFuncName() ;
myNode = DataFlowEditor()->AddNode( *(aNode->Service()) ,
"" ,
"" ,
- NULL ,
+ NULLSTRING ,
SUPERV::ComputingNode ,
aFuncName ,
aPythonFunction ,
break ;
}
}
- for ( i = 0 ; i < aGraphNodes->FNodes.length() ; i++ ) {
+ for ( i = 0 ; i < (int ) aGraphNodes->FNodes.length() ; i++ ) {
SUPERV::FNode_var aNode = (aGraphNodes->FNodes)[ i ] ;
GraphEditor::InNode * myNode ;
GraphBase::ListOfFuncName aFuncName = GraphBase::ListOfFuncName() ;
myNode = DataFlowEditor()->AddNode( *(aNode->Service()) ,
aNode->GetComponentName() ,
aNode->GetInterfaceName() ,
- NULL ,
+ NULLSTRING ,
SUPERV::ComputingNode ,
aFuncName ,
aPythonFunction ,
}
}
if ( RetVal ) {
- for ( i = 0 ; i < aGraphLinks->length() ; i++ ) {
+ for ( i = 0 ; i < (int ) aGraphLinks->length() ; i++ ) {
SUPERV::Link_var aLink = (*aGraphLinks)[ i ] ;
SUPERV::Port_var OutPort = aLink->OutPort() ;
SUPERV::Port_var InPort = aLink->InPort() ;
}
}
if ( RetVal ) {
- for ( i = 0 ; i < aGraphPorts->length() ; i++ ) {
+ for ( i = 0 ; i < (int ) aGraphPorts->length() ; i++ ) {
SUPERV::Port_var aPort = (*aGraphPorts)[ i ] ;
if ( aPort->HasInput() ) {
char * aNode = new char[ strlen( aPort->Name() + 1 ) ] ;
#ifndef _GRAPH_IMPL_HXX_
#define _GRAPH_IMPL_HXX_
-#include <iostream.h>
+//#include <iostream.h>
#include "CORBA.h"
using namespace std;
#include <stdio.h>
#include <fstream>
-#include <strstream>
+//#include <sstream>
#include <string>
-#include "utilities.h"
+//#include "utilities.h"
#include "LNode_Impl.hxx"
CNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , SALOME_ModuleCatalog::Service() , FuncName , NodeKindOfNode , FuncName , aPythonFunction ) {
beginService( "INode_Impl::INode_Impl" );
if ( FuncName ) {
- cout << "INode_Impl::CNode_Impl " << (void *) FuncName << " " << FuncName
- << " " << strlen( FuncName ) << endl ;
+// cout << "INode_Impl::CNode_Impl " << (void *) FuncName << " " << FuncName
+// << " " << strlen( FuncName ) << endl ;
}
if ( NodeKindOfNode == SUPERV::InLineNode ) {
MESSAGE( "INode_Impl::INode_Impl " << FuncName << " _poa->activate_object" );
SUPERV::Port_ptr InEndobject = SUPERV::Port::_nil() ;
Port_Impl * myInPort = NULL ;
bool InPortCreated = false ;
+ MESSAGE( "INode_Impl::InPort " << DataFlowNode()->Name() << "->AddInPort( " << aParameterName << " , "
+ << aParameterType ) ;
GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( aParameterName ) ;
if ( anInPort == NULL && DataFlowNode()->IsOneOfInLineNodes() ) {
anInPort = DataFlowNode()->AddInPort( aParameterName , aParameterType ) ;
const char *aParameterType ) {
Port_Impl * myOutPort = NULL ;
SUPERV::Port_ptr Outobject = SUPERV::Port::_nil() ;
+ MESSAGE( "INode_Impl::OutPort " << DataFlowNode()->Name() << "->AddOutPort( " << aParameterName << " , "
+ << aParameterType ) ;
GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeOutPort( aParameterName ) ;
if ( anOutPort == NULL && DataFlowNode()->IsOneOfInLineNodes() ) {
anOutPort = DataFlowNode()->AddOutPort( aParameterName , aParameterType ) ;
#ifndef _INODE_IMPL_HXX_
#define _INODE_IMPL_HXX_
-#include <iostream.h>
+//#include <iostream.h>
#include "CORBA.h"
using namespace std;
#include <stdio.h>
#include <fstream>
-#include <strstream>
+//#include <sstream>
#include <string>
-#include "utilities.h"
+//#include "utilities.h"
#include "LNode_Impl.hxx"
#ifndef _LNODE_IMPL_HXX_
#define _LNODE_IMPL_HXX_
-#include <iostream.h>
+//#include <iostream.h>
#include "CORBA.h"
using namespace std;
#include <stdio.h>
#include <fstream>
-#include <strstream>
+//#include <sstream>
#include <string>
-#include "utilities.h"
+//#include "utilities.h"
#include "Link_Impl.hxx"
GraphBase::SLink * Link_Impl::Info() {
// beginService( "Link_Impl::Info" );
- char* FromNodeName ;
- char* FromServiceParameterName ;
+// char* FromNodeName ;
+// char* FromServiceParameterName ;
GraphBase::SLink * RetVal = _DataFlowEditor->GetLink( _DataFlowNode->ComputingNode() ,
_InputParameterName ) ;
// endService( "Link_Impl::Info" );
#ifndef _LINK_IMPL_HXX_
#define _LINK_IMPL_HXX_
-#include <iostream.h>
+//#include <iostream.h>
#include "CORBA.h"
using namespace std;
#include <stdio.h>
#include <fstream>
-#include <strstream>
+//#include <sstream>
#include <string>
-#include "utilities.h"
+//#include "utilities.h"
#include "Graph_Impl.hxx"
#include "Port_Impl.hxx"
beginService( "Port_Impl::Link" ) ;
begin = false ;
SUPERV::ListOfLinks_var Links = new SUPERV::ListOfLinks ;
- cout << "Port_Impl::Link " << _DataFlowNode->Name() << " "
- << _DataFlowPort->PortName() << endl ;
+// cout << "Port_Impl::Link " << _DataFlowNode->Name() << " "
+// << _DataFlowPort->PortName() << endl ;
Links = _DataFlowEditor->ObjImpl()->Links(
_DataFlowNode->ComputingNode() ,
_DataFlowPort->PortName() ) ;
GraphBase::InPort * anInPort = _DataFlowNode->GetChangeInPort( _DataFlowPort->PortName() ) ;
if ( anInPort->GetOutPort() ) {
GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
- if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
+ if ( _DataFlowNode->IsEndLoopNode() && !strcmp( _DataFlowNode->CoupledNode()->Name() ,
+ anOutPort->NodeName() ) ) {
+// MESSAGE( "Link " << anOutPort->NodeName() << "("
+// << anOutPort->PortName() << ") --> " << _DataFlowNode->Name() << "("
+// << anInPort->PortName() << ")" << " ignored" ) ;
+ }
+ else if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
if ( begin ) {
beginService( "Port_Impl::Link" ) ;
begin = false ;
bool Port_Impl::IsInput() {
// beginService( "Port_Impl::IsInput" ) ;
bool RetVal = _InputPort ;
+// MESSAGE( Name() << "IsInput() " << _InputPort ) ;
// endService( "Port_Impl::IsInput" ) ;
return RetVal ;
}
bool Port_Impl::IsLinked() {
// beginService( "Port_Impl::IsLinked" ) ;
- bool RetVal = true ;
-#if 0
- if ( _DataFlowNode->IsEndSwitchNode() && _DataFlowPort->IsBus() ) {
+ 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 {
-#endif
RetVal = _DataFlowNode->IsLinked( _DataFlowPort->PortName() ) ;
-#if 0
}
-#endif
// endService( "Port_Impl::IsLinked" ) ;
return RetVal ;
}
#ifndef _PORT_IMPL_HXX_
#define _PORT_IMPL_HXX_
-#include <iostream.h>
+#include <sstream>
+#include <iostream>
#include "CORBA.h"
using namespace std;
#include <stdio.h>
#include <fstream>
-#include <strstream>
+//#include <sstream>
#include <string>
-#include "utilities.h"
+//#include "utilities.h"
#include "SNode_Impl.hxx"
#ifndef _SNODE_IMPL_HXX_
#define _SNODE_IMPL_HXX_
-#include <iostream.h>
+//#include <iostream.h>
#include "CORBA.h"
self.N = aNode
self.N.Verbose = Verbose
def Edit( self , FuncName , PyFunc ) :
- file = '/tmp/' + FuncName + '.py'
+ import os
+ import random
+ suf = str(random.randrange(1,10000))
+ file = '/tmp/' + FuncName + '_' + suf + '.py'
i = 0
try :
fd = os.open( file , os.O_CREAT | os.O_WRONLY | os.O_TRUNC )
#include <sys/stat.h>
#include <fstream>
-#include <strstream>
+//#include <sstream>
#include <string>
#include "Python.h"
-#include "utilities.h"
+//#include "utilities.h"
#include "SALOME_Container_i.hxx"
}
catch ( CORBA::BAD_PARAM ) {
+// JR : objref or string only ==> the eventual convertion to long or double is done in
+// the SuperVisionEngine with the real type of the argument
+#if 0
long l;
double d;
if ( strchr( aStrIOR , '.' ) != NULL &&
// return(anAny);
}
else {
+#endif
*anAny <<= aStrIOR ;
// MESSAGE( "Value( " << aStrIOR << " ) --> string " << aStrIOR );
+#if 0
}
+#endif
}
// endService( "SuperV_Impl::StringValue" );
#ifndef _SUPERV_IMPL_HXX_
#define _SUPERV_IMPL_HXX_
-#include <iostream.h>
+#include <iostream>
#include "CORBA.h"
using namespace std;
#include <stdio.h>
#include <fstream>
-#include <strstream>
+//#include <strstream>
+//#include <sstream>
#include <string>
-#include "utilities.h"
+//#include "utilities.h"
#include "Value_Impl.hxx"
}
char * Value_Impl::ToString() {
-// beginService( "Value_Impl::ToString" );
+ beginService( "Value_Impl::ToString" );
CORBA::Any anAny = *ToAny() ;
// cout << "Value_Impl::ToString " << _DataFlowNode->Name() << " "
// << _ParameterName << " " ;
}
}
}
- char* retstr ;
+ ostringstream astr ;
+ const char * retstr ;
+ int startstr = 0 ;
switch (anAny.type()->kind()) {
case CORBA::tk_string: {
anAny >>= retstr;
// MESSAGE( "ToString( string ) " << retstr );
break ;
}
- case CORBA::tk_double: {
- double d;
- anAny >>= d;
- retstr = new char[13];
- snprintf(retstr, 13, "%lf", d);
-// MESSAGE( "ToString( double ) " << retstr );
- break ;
- }
case CORBA::tk_long: {
long l;
anAny >>= l;
- retstr = new char[13];
- snprintf(retstr, 13, "%ld", l);
-// MESSAGE( "ToString( long ) " << retstr );
+ astr << l << ends ;
+ retstr = astr.str().c_str() ;
+// retstr = new char[13];
+// snprintf(retstr, 13, "%ld", l);
+// MESSAGE( "ToString( long ) " << l << " " << retstr );
+ break ;
+ }
+ case CORBA::tk_double: {
+ double d;
+ anAny >>= d;
+ astr << setw(25) << setprecision(18) << d << ends ;
+ retstr = astr.str().c_str() ;
+// retstr = new char[13];
+// snprintf(retstr, 13, "%lf", d);
+ int i = 0 ;
+ while ( i < (int ) strlen( retstr ) && retstr[ i++ ] == ' ' ) {
+ startstr = i - 1 ;
+ }
+ MESSAGE( "ToString( double ) '" << d << "' '" << retstr << "' '" << &retstr[ startstr ] << "'");
break ;
}
case CORBA::tk_objref: {
CORBA::Object_ptr obj ;
try {
anAny >>= obj ;
- retstr = _Orb->object_to_string(obj );
+ retstr = _Orb->object_to_string( obj );
// MESSAGE( "ToString( object ) " << retstr );
}
catch ( ... ) {
- retstr = "Unknown CORBA::Any Type" ;
+ retstr = "object_to_string catched " ;
}
break ;
}
default: {
retstr = "Unknown CORBA::Any Type" ;
-// MESSAGE( retstr );
+ MESSAGE( retstr );
break ;
}
}
-// endService( "Value_Impl::ToString" );
- return CORBA::string_dup( retstr ) ;
+ endService( "Value_Impl::ToString" );
+ return CORBA::string_dup( &retstr[ startstr ] ) ;
}
bool Value_Impl::IsIOR() {
#ifndef _VALUE_IMPL_HXX_
#define _VALUE_IMPL_HXX_
-#include <iostream.h>
+//#include <iostream.h>
#include "CORBA.h"
#include "SALOME_Component_i.hxx"
#include "SALOME_LifeCycleCORBA.hxx"
+#include "DataFlowBase_Base.hxx"
#include "DataFlowEditor_DataFlow.hxx"
class Value_Impl : public POA_SUPERV::Value ,
self.N = aNode
self.N.Verbose = Verbose
def Edit( self , FuncName , PyFunc ) :
+ import os
file = '/tmp/' + FuncName + '.py'
i = 0
fd = os.open( file , os.O_CREAT | os.O_WRONLY | os.O_TRUNC )