From: smh Date: Fri, 3 Jun 2005 13:11:53 +0000 (+0000) Subject: SMH: 3.0.0 preparation = merged version (POLYWORK + RTVDEBUG01) + adopation for new GUI X-Git-Tag: T3_0_0_a1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=787989820026cbd647c7bdb7159beed8e12e4944;p=modules%2Fsuperv.git SMH: 3.0.0 preparation = merged version (POLYWORK + RTVDEBUG01) + adopation for new GUI --- diff --git a/INSTALL b/INSTALL index 4bdad9a..07654c3 100644 --- a/INSTALL +++ b/INSTALL @@ -1,3 +1,4 @@ -This is the version 2.2.0 of SUPERV +This is the version 3.0.0 of SUPERV Compatible with : - - KERNEL 2.2.0 + - KERNEL 3.0.0 + - GUI 3.0.0 diff --git a/adm_local/unix/make_commence.in b/adm_local/unix/make_commence.in index 5b7ec8e..cb721ac 100644 --- a/adm_local/unix/make_commence.in +++ b/adm_local/unix/make_commence.in @@ -34,6 +34,10 @@ CXX = @CXX@ CXXFLAGS = @CXXFLAGS@ CXX_DEPEND_FLAG = @CXX_DEPEND_FLAG@ +# BOOST Library + +BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ + # JAVA JAVA_INCLUDES = @JAVA_INCLUDES@ @@ -59,7 +63,7 @@ QT_MT_LIBS = @QT_MT_LIBS@ MOC = @MOC@ UIC = @UIC@ - +MSG2QM = @MSG2QM@ #QWT diff --git a/bin/VERSION b/bin/VERSION index 5862390..dbb9d68 100755 --- a/bin/VERSION +++ b/bin/VERSION @@ -1 +1 @@ -THIS IS SALOME - SUPERV VERSION: 2.2.0 +THIS IS SALOME - SUPERV VERSION: 3.0.0 diff --git a/configure.in.base b/configure.in.base index 32846d9..b99be92 100644 --- a/configure.in.base +++ b/configure.in.base @@ -209,6 +209,14 @@ echo CHECK_QT +echo +echo --------------------------------------------- +echo testing MSG2QM +echo --------------------------------------------- +echo + +CHECK_MSG2QM + echo echo --------------------------------------------- echo testing VTK @@ -233,6 +241,14 @@ echo CHECK_MED2 +echo +echo --------------------------------------------- +echo BOOST Library +echo --------------------------------------------- +echo + +CHECK_BOOST + echo echo --------------------------------------------- echo Testing OpenCascade @@ -264,7 +280,7 @@ echo --------------------------------------------- echo echo Configure -variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok med2_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok" +variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok med2_ok omniORB_ok boost_ok occ_ok doxygen_ok graphviz_ok Kernel_ok" for var in $variables do diff --git a/doc/salome/gui/SUPERV/cshdat_robohelp.htm b/doc/salome/gui/SUPERV/cshdat_robohelp.htm index 6d945cc..b571ec7 100755 --- a/doc/salome/gui/SUPERV/cshdat_robohelp.htm +++ b/doc/salome/gui/SUPERV/cshdat_robohelp.htm @@ -1,9 +1,9 @@ SUPERVISION reference manual - + - + - - + - - - - - - -

About nodes

In general, - in SUPERVISION component Node  is + in SUPERVISOR component Node  is a graphical representation of a computation algorithm. The Data flow graph consists of several nodes of control and computation types. These nodes @@ -121,11 +94,10 @@ else

 

-

In SUPERVISION module +

In SUPERVISOR module there are the following types of nodes: computation - node, loop node, switch node -  and GOTO node.

+ node, loop node, switch node, + GOTO node and macro node.

 

@@ -138,7 +110,10 @@ else

 

-Related Topics

+Related Topics + + +

 

@@ -160,5 +135,4 @@ if (window.writeIntopicBar) //--> - diff --git a/doc/salome/gui/SUPERV/files/adding_information_about_graphs.htm b/doc/salome/gui/SUPERV/files/adding_information_about_graphs.htm index 2e0d2be..4056854 100755 --- a/doc/salome/gui/SUPERV/files/adding_information_about_graphs.htm +++ b/doc/salome/gui/SUPERV/files/adding_information_about_graphs.htm @@ -2,31 +2,11 @@ - - - - - Changing graph description - - - - - - - - - - - - - - - - - - - - + - - - - - - -

Changing graph description

@@ -116,7 +89,7 @@ else

 

-

Right-click on the SUPERVISION viewer window +

Right-click on the SUPERVISOR viewer window containing your graph and from the pop-up menu choose Change Informations option. The following dialog box will appear where you can change the name of @@ -137,7 +110,10 @@ else

 

-Related Topics

+Related Topics + + +

 

@@ -153,5 +129,4 @@ if (window.writeIntopicBar) //--> - diff --git a/doc/salome/gui/SUPERV/files/adding_links_from_an_output_port.htm b/doc/salome/gui/SUPERV/files/adding_links_from_an_output_port.htm index 1f63817..0de5d14 100755 --- a/doc/salome/gui/SUPERV/files/adding_links_from_an_output_port.htm +++ b/doc/salome/gui/SUPERV/files/adding_links_from_an_output_port.htm @@ -2,31 +2,11 @@ - - - - - Linking node ports - - - - - - - - - - - - - - - - - - - - + - - - - - - -

Linking node ports

-

In SUPERVISION you +

In SUPERVISOR you can link ONLY Input ports with Output ports and InGate ports with OutGate ports of different nodes. But you can sketch several links going from one definite port to the ports @@ -136,16 +109,23 @@ else

 

-

                      

+

                      

 

-

 

+

As you see, links connecting nodes do not + necessarily have to be straight lines. To improve the presentation of + your graph or for any other reason you can connect your nodes with zigzag + links from legs connected by points. Points have no algorithmic interpretation. +   

 

-Related Topics

+Related Topics + + +

 

@@ -163,5 +143,4 @@ if (window.writeIntopicBar) //--> - diff --git a/doc/salome/gui/SUPERV/files/adding_node_ports.htm b/doc/salome/gui/SUPERV/files/adding_node_ports.htm index cef2639..9967297 100755 --- a/doc/salome/gui/SUPERV/files/adding_node_ports.htm +++ b/doc/salome/gui/SUPERV/files/adding_node_ports.htm @@ -2,31 +2,11 @@ - - - - - Adding node ports - - - - - - - - - - - - - - - - - - - - + - - - - - - -

Adding node ports

@@ -118,16 +92,28 @@ else

 

Right-click on the Title - part of the node, and from Add node + part of the node, and from Add Port submenu select the type of the port for addition to your node (Input or Output).

 

+

Then the menu Port + parameters appears, where we can enter the Port + Name and specify the Value Type. +

+ +

 

+ +

+

 

-

-Related Topics

+

+Related Topics + + +

- diff --git a/doc/salome/gui/SUPERV/files/adding_nodes.htm b/doc/salome/gui/SUPERV/files/adding_nodes.htm index bda3180..feb0059 100755 --- a/doc/salome/gui/SUPERV/files/adding_nodes.htm +++ b/doc/salome/gui/SUPERV/files/adding_nodes.htm @@ -2,31 +2,11 @@ - - - - - Adding nodes - - - - - - - - - - - - - - - - - - - - + - - - - - - -

Adding nodes

@@ -128,7 +107,7 @@ else

Right-click on the background of the main window of this graph and in the pop-up menu choose  Add - Node option or click icon in the SUPERVISION + Node option or click icon in the SUPERVISOR toolbar. The following dialog box with two tabs will appear (the same dialog box opens when trying to create a new graph):

@@ -136,121 +115,126 @@ else

 

-

             

+

             

-

 

+

              

-

             

+

              

-

 

+

 

-

 

+

 

+ +

 

This dialog box allows to add one or several nodes to your graph.

 

-

This dialog box works as independent window. So you can move - it aside and simultaneously edit your graph in SUPERVISION viewer and - add new nodes into your graph.

+

This dialog box works as independent window. So you can move + it aside and simultaneously edit your graph in SUPERVISOR viewer and add + new nodes into your graph.

 

-

FACTORY NODES.

+

FACTORY NODES.

Factory nodes tab window consists of one column having the form of a tree with three open levels:

 

-

- The +

- The first level corresponds to the list of components which are currently integrated into SALOME platform

-

.

+

.

-

- The +

- The second level corresponds to the interfaces of one of the components.

-

 

+

 

-

- The +

- The third level represents a list of services (methods) provide by the component interface.

-

 

+

 

-

- The +

- The fourth level contains the signature of a service - a list of parameters. Opposite each parameter there are two indications: Port type (data type of the parameter) and Port way (type of the parameter - input or output).   

-

 

+

 

-

To add a factory node into your graph choose +

To add a factory node into your graph choose one of the factory services and click Add Factory Node.

-

 

+

 

-

 

+

 

-

INLINE NODES.

+

INLINE NODES.

-

Inline +

Inline nodes tab window consists of the following fields:

-

 

+

 

-

- Node +

- Node type choose box: here you can select the type of your future node (Computation, Switch, Loop, Goto)

-

 

+

 

-

- Main +

- Main field: here you can manually define a Python method which will be executed on your node. This window functions like a standard document - right-click on it gives access to Undo/Redo/Cut/Copy/Paste/SelectAll/Clear options.  

-

 

+

 

-

- Load +

- Load from file: this button allows to load a definite Python method from an existing *.py file. If your *.py file contains several defined methods, Next function button allows to list all methods of the upper level from this *.py file and select the necessary function.    

-

 

+

 

-

To add +

To add an inline node into your graph click Add Node button.   

-

 

+

 

+ +

 

-

 

+

 

-

 

+

+Related Topics -

-Related Topics            

-

 

+             

-

 

+

 

-

 

+

 

-

               

+

 

-

 

+

               

+ +

 

- diff --git a/doc/salome/gui/SUPERV/files/changing_node_description.htm b/doc/salome/gui/SUPERV/files/changing_node_description.htm index 0fe5d84..e6ca8e1 100755 --- a/doc/salome/gui/SUPERV/files/changing_node_description.htm +++ b/doc/salome/gui/SUPERV/files/changing_node_description.htm @@ -2,31 +2,11 @@ - - - - - Changing node description - - - - - - - - - - - - - - - - - - - - + - - - - - - -

Changing @@ -121,12 +94,12 @@ else part of the node and from the pop-up menu choose Change Informations option. The following dialog box will appear where you can edit the name of - your node, enter the name of the author and additional comments concerning - your graph, set the name of the container :

+ your node, enter the name of the author, set the name of the container, + component and interface and add comments concerning your graph,  :

 

-

                        

+

                        

 

@@ -135,12 +108,11 @@ else

 

-

 

+

+Related Topics -

 

-

-Related Topics

+

 

@@ -160,5 +132,4 @@ if (window.writeIntopicBar) //--> - diff --git a/doc/salome/gui/SUPERV/files/changing_view_mode.htm b/doc/salome/gui/SUPERV/files/changing_view_mode.htm index 7303fdf..f7a14c5 100755 --- a/doc/salome/gui/SUPERV/files/changing_view_mode.htm +++ b/doc/salome/gui/SUPERV/files/changing_view_mode.htm @@ -2,31 +2,11 @@ - - - - - Changing view mode - - - - - - - - - - - - - - - - - - - - + - - - - - - -

Changing view mode

-

In SUPERVISION +

In SUPERVISOR there are several modes of representation of the whole graph, as well as of each node of this graph.

@@ -144,7 +117,7 @@ else

 

-

- Comments check +

- Label check box - shows/hides description part of the node.

 

@@ -159,7 +132,7 @@ else

 

Right-click - on the background of the SUPERVISION viewer window containing your graph + on the background of the SUPERVISOR viewer window containing your graph and from the pop-up menu choose  View >

@@ -170,7 +143,7 @@ else

 

-

+

 

@@ -180,7 +153,7 @@ else

 

-

+

 

@@ -193,20 +166,29 @@ else

- Table mode (the nodes of the graph are displayed without ports and they are ranged into a table according - the threads of dataflow):

+ to the threads of dataflow):

 

-

+

+ +

 

 

+

You + also can change the zoom of your construction window; there are the fixed + positions: 200%, 100% and 50%, but you can also

+

 

 

-Related Topics

+Related Topics + + +

 

@@ -226,5 +208,4 @@ if (window.writeIntopicBar) //--> - diff --git a/doc/salome/gui/SUPERV/files/computation_nodes.htm b/doc/salome/gui/SUPERV/files/computation_nodes.htm index d619f68..c9a40e5 100755 --- a/doc/salome/gui/SUPERV/files/computation_nodes.htm +++ b/doc/salome/gui/SUPERV/files/computation_nodes.htm @@ -2,31 +2,11 @@ - - - - - Computation nodes - - - - - - - - - - - - - - - - - - - - + - - - - - - -

Computation nodes

@@ -158,7 +131,10 @@ else

 

-Related Topics

+Related Topics + + +

 

@@ -176,5 +152,4 @@ if (window.writeIntopicBar) //--> - diff --git a/doc/salome/gui/SUPERV/files/controlling_execution_of_the_graphs.htm b/doc/salome/gui/SUPERV/files/controlling_execution_of_the_graphs.htm index 3cdd730..1f8f7a0 100755 --- a/doc/salome/gui/SUPERV/files/controlling_execution_of_the_graphs.htm +++ b/doc/salome/gui/SUPERV/files/controlling_execution_of_the_graphs.htm @@ -2,31 +2,11 @@ - - - - - Controlling execution of the graphs - - - - - - - - - - - - - - - - - - - - + - - - - - - -

Controlling execution of the graphs

-

In SUPERVISION you can interactively control execution +

In SUPERVISOR you can interactively control execution of a graph.

 

@@ -174,7 +147,10 @@ else

 

-Related Topics

+Related Topics + + +

 

@@ -190,5 +166,4 @@ if (window.writeIntopicBar) //--> - diff --git a/doc/salome/gui/SUPERV/files/copying_graphs.htm b/doc/salome/gui/SUPERV/files/copying_graphs.htm index 82dc94b..6f4e838 100755 --- a/doc/salome/gui/SUPERV/files/copying_graphs.htm +++ b/doc/salome/gui/SUPERV/files/copying_graphs.htm @@ -2,31 +2,11 @@ - - - - - Copying graphs - - - - - - - - - - - - - - - - - - - - + - - - - - - -

Copying graphs

-

In SUPERVISION - there is another mean to get a new window of the SUPERVISION when you - copy an already open graph into a new window.

+

In SUPERVISOR + there is another mean to get a new window of the SUPERVISOR when you copy + an already open graph into a new window.

 

@@ -114,7 +87,7 @@ else

 

-

Right-click on the background of the SUPERVISION +

Right-click on the background of the SUPERVISOR viewer window containing your graph and from the pop-up menu choose Copy Dataflow option.

@@ -122,7 +95,7 @@ else

 

-

A new SUPERVISION window containing a copy +

A new SUPERVISOR window containing a copy of the graph will be created.

 

@@ -130,7 +103,10 @@ else

 

-Related Topics

+Related Topics + + +

 

@@ -146,5 +122,4 @@ if (window.writeIntopicBar) //--> - diff --git a/doc/salome/gui/SUPERV/files/creating_a_new_graph.htm b/doc/salome/gui/SUPERV/files/creating_a_new_graph.htm index 9314a90..53aa1e7 100755 --- a/doc/salome/gui/SUPERV/files/creating_a_new_graph.htm +++ b/doc/salome/gui/SUPERV/files/creating_a_new_graph.htm @@ -2,31 +2,11 @@ - - - - - Creating a new graph - - - - - - - - - - - - - - - - - - - - + - - - - - - -

Creating a new graph

@@ -123,8 +96,8 @@ else

 

Click icon  in - the SUPERVISION toolbar or form the main menu choose Edit - > New Dataflow. After it a new window with SUPERVISION viewer + the SUPERVISOR toolbar or form the main menu choose Edit + > New Dataflow. After it a new window with SUPERVISOR viewer will be automatically created and you will see the dialog box allowing to add nodes into your graph. (see also: Adding nodes)

@@ -145,7 +118,10 @@ else

 

-Related Topics

+Related Topics + + +

 

@@ -165,5 +141,4 @@ if (window.writeIntopicBar) //--> - diff --git a/doc/salome/gui/SUPERV/files/deleting_links.htm b/doc/salome/gui/SUPERV/files/deleting_links.htm index 6bb6cb1..8d144d4 100755 --- a/doc/salome/gui/SUPERV/files/deleting_links.htm +++ b/doc/salome/gui/SUPERV/files/deleting_links.htm @@ -2,31 +2,11 @@ - - - - - Deleting links - - - - - - - - - - - - - - - - - - - - + - - - - - - -

Deleting links

@@ -125,7 +98,10 @@ else

 

-Related Topics

+Related Topics + + +

- diff --git a/doc/salome/gui/SUPERV/files/deleting_nodes.htm b/doc/salome/gui/SUPERV/files/deleting_nodes.htm index 410e24e..c6537d3 100755 --- a/doc/salome/gui/SUPERV/files/deleting_nodes.htm +++ b/doc/salome/gui/SUPERV/files/deleting_nodes.htm @@ -2,31 +2,11 @@ - - - - - Deleting nodes - - - - - - - - - - - - - - - - - - - - + - - - - - - -

Deleting nodes

@@ -127,7 +100,10 @@ else

 

-Related Topics

+Related Topics + + +

- diff --git a/doc/salome/gui/SUPERV/files/directing_dataflow_between_nodes.htm b/doc/salome/gui/SUPERV/files/directing_dataflow_between_nodes.htm index 0587089..ca9e419 100755 --- a/doc/salome/gui/SUPERV/files/directing_dataflow_between_nodes.htm +++ b/doc/salome/gui/SUPERV/files/directing_dataflow_between_nodes.htm @@ -2,31 +2,11 @@ - - - - - Directing dataflow between nodes - - - - - - - - - - - - - - - - - - - - + - - - - - - -

Directing dataflow between nodes

-

SUPERVISION component +

SUPERVISOR component automatically defines for each node two special ports an Input Gate  and an Output Gate. They are managed - by  SUPERVISION + by  SUPERVISOR and are not arguments of services of nodes.

Sometimes the flow of @@ -167,7 +140,10 @@ else

 

-Related Topics

+Related Topics + + +

 

@@ -183,5 +159,4 @@ if (window.writeIntopicBar) //--> - diff --git a/doc/salome/gui/SUPERV/files/editing_imported_graphs.htm b/doc/salome/gui/SUPERV/files/editing_imported_graphs.htm index 06d476b..bf81d15 100755 --- a/doc/salome/gui/SUPERV/files/editing_imported_graphs.htm +++ b/doc/salome/gui/SUPERV/files/editing_imported_graphs.htm @@ -2,31 +2,11 @@ - - - - - Editing imported graphs - - - - - - - - - - - - - - - - - - - - + - - - - - - -

Editing imported graphs

@@ -131,5 +104,4 @@ if (window.writeIntopicBar) //--> - diff --git a/doc/salome/gui/SUPERV/files/editing_node_function.htm b/doc/salome/gui/SUPERV/files/editing_node_function.htm index 4527faa..8901304 100755 --- a/doc/salome/gui/SUPERV/files/editing_node_function.htm +++ b/doc/salome/gui/SUPERV/files/editing_node_function.htm @@ -2,31 +2,11 @@ - - - - - Editing node function - - - - - - - - - - - - - - - - - - - - + - - - - - - -

Editing node function

-

In SUPERVISION +

In SUPERVISOR there is a possibility to edit the service of an already created node.

@@ -138,14 +111,24 @@ else

Right-click on the Title part of the node and select Edit - function item.

+ function
item. In the Edit Function menu you can either enter the script manually + or upload an existing script from a Python file by clicking on the Load from File button and selecting the file the Load Script + menu.  

 

 

-Related Topics

+Related Topics + + +

- diff --git a/doc/salome/gui/SUPERV/files/exporting_graphs.htm b/doc/salome/gui/SUPERV/files/exporting_graphs.htm index 7c583b2..709e1d8 100755 --- a/doc/salome/gui/SUPERV/files/exporting_graphs.htm +++ b/doc/salome/gui/SUPERV/files/exporting_graphs.htm @@ -2,31 +2,11 @@ - - - - - Exporting graphs - - - - - - - - - - - - - - - - - - - - + - - - - - - -

Exporting graphs

The operation of exportation of a created graph allows to save it as *. xml  - file, which can be reloaded in future into the window of  SUPERVISION. + file, which can be reloaded in future into the window of  SUPERVISOR.

 

@@ -128,7 +101,7 @@ else

1. Click on the window of the graph to make it current and after it  click icon  in - the toolbar of SUPERVISION component or form the main menu select File > Export Dataflow.  

 

@@ -149,7 +122,10 @@ else

 

-Related Topics

+Related Topics + + +

- diff --git a/doc/salome/gui/SUPERV/files/filtering_and_storing_output_messages.htm b/doc/salome/gui/SUPERV/files/filtering_and_storing_output_messages.htm index 76eb438..0246b17 100755 --- a/doc/salome/gui/SUPERV/files/filtering_and_storing_output_messages.htm +++ b/doc/salome/gui/SUPERV/files/filtering_and_storing_output_messages.htm @@ -2,31 +2,11 @@ - - - - - Filtering and storing output messages - - - - - - - - - - - - - - - - - - - - + - - - - - - -

Filtering and logging output messages

-

In SUPERVISION +

In SUPERVISOR you can filter and save in a definite text file all output messages produced by the component during execution of your graph:

@@ -127,13 +100,13 @@ else

 

Before execution of your graph right-click - on the background of the SUPERVISION viewer window containing your graph + on the background of the SUPERVISOR viewer window containing your graph and from the pop-up menu choose Filter Notification option. The following dialog box will appear:

 

-

              

+

              

 

@@ -149,5 +122,4 @@ if (window.writeIntopicBar) //--> - diff --git a/doc/salome/gui/SUPERV/files/goto_nodes.htm b/doc/salome/gui/SUPERV/files/goto_nodes.htm index d7c1038..0fe5ec9 100755 --- a/doc/salome/gui/SUPERV/files/goto_nodes.htm +++ b/doc/salome/gui/SUPERV/files/goto_nodes.htm @@ -2,31 +2,11 @@ - - - - - GOTO nodes - - - - - - - - - - - - - - - - - - - - + - - - - - - -

GOTO nodes

@@ -113,17 +87,22 @@ else

 

-

But in comparison with a Computation - node it can't receive and transfer control flow    

+

 

+

But in comparison with a Computation + node it can't receive and transfer control flow    

+

 

 

-Related Topics

+Related Topics + + +

- diff --git a/doc/salome/gui/SUPERV/files/importing_graphs_from_file.htm b/doc/salome/gui/SUPERV/files/importing_graphs_from_file.htm index dc9a83e..67f15d7 100755 --- a/doc/salome/gui/SUPERV/files/importing_graphs_from_file.htm +++ b/doc/salome/gui/SUPERV/files/importing_graphs_from_file.htm @@ -2,31 +2,11 @@ - - - - - Importing graphs from file - - - - - - - - - - - - - - - - - - - - + - - - - - - -

Importing graphs from file

-

In SUPERVISION component +

In SUPERVISOR component graphs can be saved and stored in *.xml files.

 

@@ -129,7 +102,7 @@ else

 

1.  Click -  icon in the SUPERVISION toolbar or from the main menu choose +  icon in the SUPERVISOR toolbar or from the main menu choose File > Import Dataflow.

 

@@ -154,7 +127,7 @@ else

 

1.  Click -  icon in the SUPERVISION toolbar or from the main menu choose +  icon in the SUPERVISOR toolbar or from the main menu choose Edit > Modify Dataflow.

 

@@ -169,7 +142,10 @@ else

 

-Related Topics

+Related Topics + + +

 

@@ -185,5 +161,4 @@ if (window.writeIntopicBar) //--> - diff --git a/doc/salome/gui/SUPERV/files/inserting_graphs.htm b/doc/salome/gui/SUPERV/files/inserting_graphs.htm index fe5983f..521eb9a 100755 --- a/doc/salome/gui/SUPERV/files/inserting_graphs.htm +++ b/doc/salome/gui/SUPERV/files/inserting_graphs.htm @@ -2,31 +2,11 @@ - - - - - Inserting graphs - - - - - - - - - - - - - - - - - - - - + - - - - - - -

Inserting graphs

@@ -110,7 +83,7 @@ else

 

1. Right-click on the background of the - SUPERVISION viewer window containing your graph and from the pop-up menu + SUPERVISOR viewer window containing your graph and from the pop-up menu choose Insert File option.

 

@@ -129,7 +102,10 @@ else

 

-Related Topics

+Related Topics + + +

- diff --git a/doc/salome/gui/SUPERV/files/introduction_to_supervisor.htm b/doc/salome/gui/SUPERV/files/introduction_to_supervisor.htm index 120e4fc..0a66385 100755 --- a/doc/salome/gui/SUPERV/files/introduction_to_supervisor.htm +++ b/doc/salome/gui/SUPERV/files/introduction_to_supervisor.htm @@ -2,31 +2,11 @@ - - - - - Introduction to SUPERVISION - - - - - - - - - - - - - - - - - - - - + - - - - - - - -

Introduction to SUPERVISION

+

Introduction to SUPERVISOR

-

SUPERVISION module +

SUPERVISOR module of the SALOME platform allows to define and execute a chain of distributed numeric components, as well as to control the progress of this chain.

-

In SUPERVISION +

In SUPERVISOR module all calculations are executed with the help of graphs representing a graphical presentation of the chain of operations. Each graph consists of one or several linked nodes. @@ -132,7 +105,7 @@ else

 

 SUPERVISIONSUPERVISOR module in SALOME platform is destined for :

 

@@ -155,7 +128,7 @@ else

 SUPERVISION + style="font-weight: bold;">SUPERVISOR module allows to:

 

@@ -190,7 +163,10 @@ else

 

-Related Topics

+Related Topics + + +

 

@@ -204,5 +180,4 @@ if (window.writeIntopicBar) //--> - diff --git a/doc/salome/gui/SUPERV/files/loop_nodes.htm b/doc/salome/gui/SUPERV/files/loop_nodes.htm index eb95583..0c8a3ae 100755 --- a/doc/salome/gui/SUPERV/files/loop_nodes.htm +++ b/doc/salome/gui/SUPERV/files/loop_nodes.htm @@ -2,31 +2,11 @@ - - - - - Loop nodes - - - - - - - - - - - - - - - - - - - - + - - - - - - -

Loop nodes

@@ -198,7 +171,7 @@ else for the first time. That function will have to return as first output argument a boolean before output arguments (ports) defined by the user in the node. If that function value is true the body of the loop will - automatically be executed. If it is false SUPERVISION component will resume + automatically be executed. If it is false SUPERVISOR component will resume execution after the end of the loop. That first output argument will not be represented as an output port and will not be used in the graph.

@@ -209,7 +182,7 @@ else
  • NEXT: A “Next” function which is executed - each time that SUPERVISION component resume the execution from the end + each time that SUPERVISOR component resume the execution from the end of the loop to the beginning.

  • @@ -293,21 +266,21 @@ else
  • The input ports, which have been created in the Start Loop node are automatically - duplicated by SUPERVISION component as output ports of this node.

  • + duplicated by SUPERVISOR component as output ports of this node.

    -
  • SUPERVISION +

  • SUPERVISOR component automatically  adds the same input and output ports in the  End Loop node as in the Start Loop node.

  • If an output port of the Start Loop node has no link and if the corresponding - input port of the End Loop node has no link, SUPERVISION component automatically + input port of the End Loop node has no link, SUPERVISOR component automatically transmits its value to the corresponding End Loop node during execution. You shouldn't define such links.

  • When - SUPERVISION component executes the End Loop node, it automatically transmits + SUPERVISOR component executes the End Loop node, it automatically transmits the actual values of  the output ports of the End Loop node to the input ports of the Start Loop node.

  • @@ -327,7 +300,10 @@ else

     

    -Related Topics

    +Related Topics + + +

     

    @@ -347,5 +323,4 @@ if (window.writeIntopicBar) //--> - diff --git a/doc/salome/gui/SUPERV/files/modifying_links.htm b/doc/salome/gui/SUPERV/files/modifying_links.htm index 8fe2a37..e0b7057 100755 --- a/doc/salome/gui/SUPERV/files/modifying_links.htm +++ b/doc/salome/gui/SUPERV/files/modifying_links.htm @@ -2,31 +2,11 @@ - - - - - Modifying links - - - - - - - - - - - - - - - - - - - - + - - - - - - -

    Modifying links

    In SUPERVISION you can modify an already + style="font-weight: bold;">SUPERVISOR you can modify an already constructed link to make it look better in the structure of the whole graph.

    @@ -129,8 +102,7 @@ else

     

    1. Add a - point to this link (see also: Points in - links)

    + point to this link

     

    @@ -142,7 +114,7 @@ else

    Ortho mode of links construction allows to place points of a link under construction - in random positions in the viewer window - SPERVISION will automatically + in random positions in the viewer window - SUPERVISOR will automatically place this points in such a way that the broken line will consist of right angle corners.

    @@ -165,7 +137,10 @@ else

     

    -Related Topics

    +Related Topics + + +

     

    @@ -181,5 +156,4 @@ if (window.writeIntopicBar) //--> - diff --git a/doc/salome/gui/SUPERV/files/opening_graphs_referenced_in_the_study.htm b/doc/salome/gui/SUPERV/files/opening_graphs_referenced_in_the_study.htm index 005059a..714c87e 100755 --- a/doc/salome/gui/SUPERV/files/opening_graphs_referenced_in_the_study.htm +++ b/doc/salome/gui/SUPERV/files/opening_graphs_referenced_in_the_study.htm @@ -2,31 +2,11 @@ - - - - - Changing graph description - - - - - - - - - - - - - - - - - - - - + - - - - - - -

    Changing graph description

    @@ -116,7 +88,7 @@ else

     

    -

    Right-click on the SUPERVISION viewer window +

    Right-click on the SUPERVISOR viewer window containing your graph and from the pop-up menu choose Change Informations option. The following dialog box will appear where you can change the name of @@ -137,7 +109,10 @@ else

     

    -Related Topics

    +Related Topics + + +

     

    @@ -153,5 +128,4 @@ if (window.writeIntopicBar) //--> - diff --git a/doc/salome/gui/SUPERV/files/placing_nodes_in_the_window.htm b/doc/salome/gui/SUPERV/files/placing_nodes_in_the_window.htm index 970f60a..fdf55b7 100755 --- a/doc/salome/gui/SUPERV/files/placing_nodes_in_the_window.htm +++ b/doc/salome/gui/SUPERV/files/placing_nodes_in_the_window.htm @@ -2,31 +2,11 @@ - - - - - Placing nodes in the window - - - - - - - - - - - - - - - - - - - - + - - - - - - -

    Locating nodes in the window

    -

    In SUPERVISION you can locate - the nodes of your graph in any part of the SUPERVISION viewer window. -

    +

    In SUPERVISOR you can locate + the nodes of your graph in any part of the SUPERVISOR viewer window.

     

    @@ -129,7 +101,10 @@ else

                              

    -Related Topics

    +Related Topics + + +

    - diff --git a/doc/salome/gui/SUPERV/files/referencing_output_values_in_the_study.htm b/doc/salome/gui/SUPERV/files/referencing_output_values_in_the_study.htm index 62e6773..9c4387c 100755 --- a/doc/salome/gui/SUPERV/files/referencing_output_values_in_the_study.htm +++ b/doc/salome/gui/SUPERV/files/referencing_output_values_in_the_study.htm @@ -2,31 +2,11 @@ - - - - - Referencing output values in the study - - - - - - - - - - - - - - - - - - - - + - - - - - - -

    Referencing output values in the study

    -

    In SUPERVISION +

    In SUPERVISOR you can reference  in the study all data calculated in the nodes. This option allows to view and store output values of the graph in the study.

    @@ -147,13 +120,12 @@ else

     

    In - SUPERVISION you can create as many references to output values as it's - necessary. If you haven't yet launched execution of your graph, SUPERVISION - will create in the Object Browser a reference only to your graph (see - also: Referencing graphs  in - the study) and store the references to the output parameters in this - folder. After execution of your graph all of them will be displayed in - the Object Browser in the following way:

    + SUPERVISOR you can create as many references to output values as it's + necessary. If you haven't yet launched execution of your graph, SUPERVISOR + will create in the Object Browser a reference only to your graph and store + the references to the output parameters in this folder. After execution + of your graph all of them will be displayed in the Object Browser in the + following way:

     

    @@ -170,7 +142,10 @@ else

     

    -Related Topics

    +Related Topics + + +

     

    @@ -190,5 +165,4 @@ if (window.writeIntopicBar) //--> - diff --git a/doc/salome/gui/SUPERV/files/reloading_dataflow.htm b/doc/salome/gui/SUPERV/files/reloading_dataflow.htm index 9bfd06f..6084014 100755 --- a/doc/salome/gui/SUPERV/files/reloading_dataflow.htm +++ b/doc/salome/gui/SUPERV/files/reloading_dataflow.htm @@ -2,31 +2,11 @@ - - - - - Reloading dataflow - - - - - - - - - - - - - - - - - - - - + - - - - - - -

    Reloading dataflow

    -

    In SUPERVISION +

    In SUPERVISOR component graphs can be edited from Python console. All these modifications - are at first automatically registered in SUPERVISION Engine and after - it in the Graphical User Interface (in the SUPERVISION viewer window) - of SUPERVISION component. If some modifications of your graph, made from - Python console, hasn't been realized in GUI, you can manually reload your - graph from SUPERVISION Engine.

    + are at first automatically registered in SUPERVISOR Engine and after it + in the Graphical User Interface (in the SUPERVISOR viewer window) of SUPERVISOR + component. If some modifications of your graph, made from Python console, + hasn't been realized in GUI, you can manually reload your graph from SUPERVISOR + Engine.

     

    @@ -130,7 +103,7 @@ else

     

    In the SUPERVISION toolbar - click icon or from the main menu choose Supervision + click icon or from the main menu choose Supervisor > Reload item.

     

    @@ -138,7 +111,10 @@ else

     

    -Related Topics

    +Related Topics + + +

     

    @@ -154,5 +130,4 @@ if (window.writeIntopicBar) //--> - diff --git a/doc/salome/gui/SUPERV/files/renaming_nodes.htm b/doc/salome/gui/SUPERV/files/renaming_nodes.htm index a3f6339..6a3ad36 100755 --- a/doc/salome/gui/SUPERV/files/renaming_nodes.htm +++ b/doc/salome/gui/SUPERV/files/renaming_nodes.htm @@ -2,31 +2,11 @@ - - - - - Renaming nodes - - - - - - - - - - - - - - - - - - - - + - - - - - - -

    Renaming nodes

    @@ -132,7 +105,10 @@ else

     

    -Related Topics

    +Related Topics + + +

    - diff --git a/doc/salome/gui/SUPERV/files/running_dataflow.htm b/doc/salome/gui/SUPERV/files/running_dataflow.htm index 609d712..203938f 100755 --- a/doc/salome/gui/SUPERV/files/running_dataflow.htm +++ b/doc/salome/gui/SUPERV/files/running_dataflow.htm @@ -2,31 +2,11 @@ - - - - - Running dataflow - - - - - - - - - - - - - - - - - - - - + - - - - - - -

    Running dataflow

    @@ -126,7 +99,7 @@ else

     

    In the Execution - toolbar click icon or from the Supervision + toolbar click icon or from the Supervisor menu choose  Run.

    @@ -191,7 +164,7 @@ else

     

    -

    In the Execution toolbar click icon or from the Supervision +

    In the Execution toolbar click icon or from the Supervisor menu choose Kill.

     

    @@ -213,7 +186,10 @@ else

     

    -Related Topics

    +Related Topics + + +

     

    @@ -227,5 +203,4 @@ if (window.writeIntopicBar) //--> - diff --git a/doc/salome/gui/SUPERV/files/running_supervisor.htm b/doc/salome/gui/SUPERV/files/running_supervisor.htm index 27444cb..845b7d5 100755 --- a/doc/salome/gui/SUPERV/files/running_supervisor.htm +++ b/doc/salome/gui/SUPERV/files/running_supervisor.htm @@ -2,31 +2,11 @@ - - - - - Running SUPERVISION - - - - - - - - - - - - - - - - - - - - + - - - - - - - -

    Running SUPERVISION

    - -

    To start SUPERVISION module:

    - -

     

    - -

    1.  Launch - SALOME application and create a new study.

    - -

    2.  Choose - Supervision item in the choose - box or click icon, located among other icons at the bottom - of SALOME Desktop window. After it the following window will appear:

    +

    Running SUPERVISOR

    + +

    To start SUPERVISOR + module choose Supervisor + item in the choose box or click icon, located among other + icons at the bottom of SALOME Desktop window. After this the following + window will appear:

    + +

     

    + +

                            

    + +

     

    + +

    In this window the menus + have been updated according the functionality of SUPERVISOR module. All + these actions are available in the form of icons in SUPERVISOR toolbar. +

    -

     

    +

     

    -

                            

    +

    +Related Topics -

     

    -

    In this window the menus - have been updated according the functionality of SUPERVISION module. All - these actions are available in the form of icons in SUPERVISION toolbar.

    -

     

    - -

    -Related Topics

    - -

     

    +

     

    - diff --git a/doc/salome/gui/SUPERV/files/setting_input_parameters.htm b/doc/salome/gui/SUPERV/files/setting_input_parameters.htm index 2292c7e..0103d22 100755 --- a/doc/salome/gui/SUPERV/files/setting_input_parameters.htm +++ b/doc/salome/gui/SUPERV/files/setting_input_parameters.htm @@ -2,31 +2,11 @@ - - - - - Setting input parameters - - - - - - - - - - - - - - - - - - - - + - - - - - - -

    Setting input parameters

    @@ -165,7 +138,10 @@ else

     

    -Related Topics

    +Related Topics + + +

     

    @@ -183,5 +159,4 @@ if (window.writeIntopicBar) //--> - diff --git a/doc/salome/gui/SUPERV/files/step-by-step_execution.htm b/doc/salome/gui/SUPERV/files/step-by-step_execution.htm index a264203..b471bd0 100755 --- a/doc/salome/gui/SUPERV/files/step-by-step_execution.htm +++ b/doc/salome/gui/SUPERV/files/step-by-step_execution.htm @@ -2,31 +2,11 @@ - - - - - Step-by-Step execution - - - - - - - - - - - - - - - - - - - - + - - - - - - -

    Step-by-Step execution

    -

    In SUPERVISION +

    In SUPERVISOR there is an additional option allowing to launch Step-by-Step execution of your graph. This type of execution is based on the operations described in the chapter 'Controlling @@ -128,7 +101,7 @@ else

     

    -

    In the Execution toolbar click icon or from the main menu choose Supervision +

    In the Execution toolbar click icon or from the main menu choose Supervisor > Step by Step option.

     

    @@ -147,7 +120,10 @@ else

     

    -Related Topics

    +Related Topics + + +

     

    @@ -165,5 +141,4 @@ if (window.writeIntopicBar) //--> - diff --git a/doc/salome/gui/SUPERV/files/switch_nodes.htm b/doc/salome/gui/SUPERV/files/switch_nodes.htm index 8a5768d..06cc72f 100755 --- a/doc/salome/gui/SUPERV/files/switch_nodes.htm +++ b/doc/salome/gui/SUPERV/files/switch_nodes.htm @@ -2,31 +2,11 @@ - - - - - Switch nodes - - - - - - - - - - - - - - - - - - - - + - - - - - - -

    Switch nodes

    @@ -255,7 +228,10 @@ else

     

    -Related Topics

    +Related Topics + + +

     

    @@ -273,5 +249,4 @@ if (window.writeIntopicBar) //--> - diff --git a/doc/salome/gui/SUPERV/files/usage_of_supervisor_module.htm b/doc/salome/gui/SUPERV/files/usage_of_supervisor_module.htm index f85c0d2..7fc989b 100755 --- a/doc/salome/gui/SUPERV/files/usage_of_supervisor_module.htm +++ b/doc/salome/gui/SUPERV/files/usage_of_supervisor_module.htm @@ -2,31 +2,11 @@ - - - - - Usage of SUPERVISION module - - - - - - - - - - - - - - - - - - - - + - - - - - - - -

    In SUPERVISION you can:

    +

    In SUPERVISOR you can:

     

    Usage - of  SUPERVISION + of  SUPERVISOR consists of 3 phases:

     

    @@ -114,14 +87,17 @@ else
    1. Construction and edition of a graph
    2. Initialization of a graph
    3. Execution and control the activity of a graph
    @@ -144,7 +120,7 @@ else
  • Launch - SUPERVISION
  • + SUPERVISOR
  • Create @@ -230,7 +206,9 @@ else After initialization of the graph the main actions concerning execution and control the activity of a graph are the following : -
     
      +
       
      + +
      • Launch @@ -264,7 +242,13 @@ else
          -
        Related Topics
          +
        +Related Topics + + + + +
         
          @@ -280,5 +264,4 @@ if (window.writeIntopicBar) //--> - diff --git a/doc/salome/gui/SUPERV/files/viewing_output_vaues.htm b/doc/salome/gui/SUPERV/files/viewing_output_vaues.htm index 7b11332..948cea2 100755 --- a/doc/salome/gui/SUPERV/files/viewing_output_vaues.htm +++ b/doc/salome/gui/SUPERV/files/viewing_output_vaues.htm @@ -2,31 +2,11 @@ - - - - - Examiming calculated data - - - - - - - - - - - - - - - - - - - - + - - - - - - -

        Examining calculated @@ -163,7 +136,10 @@ else

         

        -Related Topics

        +Related Topics + + +

         

        @@ -179,5 +155,4 @@ if (window.writeIntopicBar) //--> - diff --git a/doc/salome/gui/SUPERV/image51.jpg b/doc/salome/gui/SUPERV/image51.jpg new file mode 100755 index 0000000..e44aee9 Binary files /dev/null and b/doc/salome/gui/SUPERV/image51.jpg differ diff --git a/doc/salome/gui/SUPERV/image52.jpg b/doc/salome/gui/SUPERV/image52.jpg new file mode 100755 index 0000000..b7c3545 Binary files /dev/null and b/doc/salome/gui/SUPERV/image52.jpg differ diff --git a/doc/salome/gui/SUPERV/image53.jpg b/doc/salome/gui/SUPERV/image53.jpg new file mode 100755 index 0000000..f6d4617 Binary files /dev/null and b/doc/salome/gui/SUPERV/image53.jpg differ diff --git a/doc/salome/gui/SUPERV/image54.jpg b/doc/salome/gui/SUPERV/image54.jpg new file mode 100755 index 0000000..a8b2199 Binary files /dev/null and b/doc/salome/gui/SUPERV/image54.jpg differ diff --git a/doc/salome/gui/SUPERV/image55.jpg b/doc/salome/gui/SUPERV/image55.jpg new file mode 100755 index 0000000..a9c1a61 Binary files /dev/null and b/doc/salome/gui/SUPERV/image55.jpg differ diff --git a/doc/salome/gui/SUPERV/image56.jpg b/doc/salome/gui/SUPERV/image56.jpg new file mode 100755 index 0000000..403740c Binary files /dev/null and b/doc/salome/gui/SUPERV/image56.jpg differ diff --git a/doc/salome/gui/SUPERV/image58.gif b/doc/salome/gui/SUPERV/image58.gif new file mode 100755 index 0000000..6d21a71 Binary files /dev/null and b/doc/salome/gui/SUPERV/image58.gif differ diff --git a/doc/salome/gui/SUPERV/image58.jpg b/doc/salome/gui/SUPERV/image58.jpg new file mode 100755 index 0000000..6a6699a Binary files /dev/null and b/doc/salome/gui/SUPERV/image58.jpg differ diff --git a/doc/salome/gui/SUPERV/image59.gif b/doc/salome/gui/SUPERV/image59.gif new file mode 100755 index 0000000..0cd319e Binary files /dev/null and b/doc/salome/gui/SUPERV/image59.gif differ diff --git a/doc/salome/gui/SUPERV/image59.jpg b/doc/salome/gui/SUPERV/image59.jpg new file mode 100755 index 0000000..6fa8958 Binary files /dev/null and b/doc/salome/gui/SUPERV/image59.jpg differ diff --git a/doc/salome/gui/SUPERV/image60.gif b/doc/salome/gui/SUPERV/image60.gif new file mode 100755 index 0000000..eca4167 Binary files /dev/null and b/doc/salome/gui/SUPERV/image60.gif differ diff --git a/doc/salome/gui/SUPERV/image60.jpg b/doc/salome/gui/SUPERV/image60.jpg new file mode 100755 index 0000000..1f34b7d Binary files /dev/null and b/doc/salome/gui/SUPERV/image60.jpg differ diff --git a/doc/salome/gui/SUPERV/image61.jpg b/doc/salome/gui/SUPERV/image61.jpg new file mode 100755 index 0000000..3f5ef9c Binary files /dev/null and b/doc/salome/gui/SUPERV/image61.jpg differ diff --git a/doc/salome/gui/SUPERV/image62.jpg b/doc/salome/gui/SUPERV/image62.jpg new file mode 100755 index 0000000..aa178ef Binary files /dev/null and b/doc/salome/gui/SUPERV/image62.jpg differ diff --git a/doc/salome/gui/SUPERV/macro_node.htm b/doc/salome/gui/SUPERV/macro_node.htm new file mode 100755 index 0000000..06dcd1f --- /dev/null +++ b/doc/salome/gui/SUPERV/macro_node.htm @@ -0,0 +1,101 @@ + + + + + +Macro Node + + + + + + + + + + + +

        Macro Nodes

        + +

        Macro Nodes are + actually a way of representation of graphs imported from  .xml + files. They are especially suitable for better presentation of complex + graphs, including many sub-graphs.  As + we see in the picture, a Macro Node + represents in the window only start and end ports of a sub-graph.

        + +

         

        + +

        + +

         

        + +

        In any time you can start editing this sub-graph by left double-clicking + on the Macro Node

        + +

        .

        + + + + diff --git a/doc/salome/gui/SUPERV/referencing_graphs_in_the_study.htm b/doc/salome/gui/SUPERV/referencing_graphs_in_the_study.htm new file mode 100755 index 0000000..a9d2e0f --- /dev/null +++ b/doc/salome/gui/SUPERV/referencing_graphs_in_the_study.htm @@ -0,0 +1,102 @@ + + + + + +Referencing graphs in the study + + + + + + + + + + + +

        Referencing graphs in the study

        + +

        Unlike other SALOME modules, in the Supervisor module the objects (graphs) + you create in the graphic window are not referenced in the study automatically.

        + +

         

        + +

        To put the result + of your calculation in study, right-click on the end node, containing + the result of your calculation, and select Put in study in the pop-up + box.

        + +

         

        + +

        + +

           

        + +

         

        + +

         

        + + + + diff --git a/doc/salome/gui/SUPERV/robohhre.lng b/doc/salome/gui/SUPERV/robohhre.lng new file mode 100755 index 0000000..297538b --- /dev/null +++ b/doc/salome/gui/SUPERV/robohhre.lng @@ -0,0 +1,101 @@ +[GlossaryTab] +TabCaption=&Glossary +TermCaption=&Term +DefinitionCaption=&Definition For: + +[BrowseSequence] +PreCaption=Previous +PreTooltip=Previous Topic +NextCaption=Next +NextTooltip=Next Topic +BlockTooltip=Select Block + +[Common] +Contents=Contents +Index=Index +Search=Search +Glossary=Glossary +Logo/Author=Powered By +Show=Show +Hide=Hide +SyncToc=SyncToc +Prev=<< +Next=>> +Disabled Prev=<< +Disabled Next=>> +Seperate = | + +[WebHelp] +Cancel=Cancel +CantOpenURLorFile=Can't open URL or file +CompletingContents=Completing Contents... +Display=Display +Term=Term: +Definition=Definition: +Done=Done +Find=Find +IndexInputPrompt=Type in the keyword to find: +RelateTopicListPrompt=Click a topic, then click Display. +LoadingData=Loading data, please wait... +LoadingContents=Loading contents, please wait... +LoadingContentsData=Loading, click here to cancel... +LoadingFTS=Reading Search Data... +LoadingIndex=Loading Index... +LoadingTOCItem=Loading Table of Contents: +Searching=Searching... +FtsInputPrompt=Type in the word(s) to search for: +TopicsFound=Topics Found +BrowserLimitedMessage=Your browser does not support frames. We recommend that you update your browser to a version that supports frames. +SuggestViewNoFrameMessage=To view the Help system without frames click on this +SuggestViewNoFrameMsg2=hyperlink. +TopicsNotFound=No Topics Found. +CantSearch=Cannot search for that phrase. +JS_alert_appletNotLoad = Unable to load applet. If you are using an old version of Netscape, the prefs.js file needs to be edited. +JS_alert_colorlimitation=WebHelp has detected that your display is set to 16 colors. For full WebHelp support, please set your display to use 256 or more colors. +Blank_topic_text=This topic was created by WinHelp Project Conversion Wizard, and is the destination of a missing topic or broken hyperlink. +JS_alert_ProjectLoadingFail=Could not load correctly, please click Refresh. +JS_alert_cantLoadProject=Can't load project: +JS_alert_ErrorInLoading=Error in Loading navigation component. Please regenerate WebHelp. +IndexBtnText=Go +FtsBtnText=Go +ToolBarSearchBtnText=Go +InTopicSearchBtnText=Go +SearchLabel=Search +SearchPrompt=- Search - +PreTooltip=Previous Topic +NextTooltip=Next Topic +WebSearch=WebSearch +SyncTocTooltip=Sync TOC +Book=Book +Page=Page +Remote_Page=Remote Page +Show_Navigation_Component=Show Navigation Component +Hide_Navigation_Component=Hide Navigation Component +nls_edit_label=Type in your question: +nls_button_go_hint=Go Search +nls_button_go_text=Go +nls_body_instruction=Enter your question in the text box above, then click GO. +nls_body_empty=Sorry, we were unable to find a good answer for your question. +IndexSelectTopicTitle=Select a Topic +IndexSelectTopicLabel=Select a topic, then click Display +IndexSelectTopicError=Please select a topic. +IndexAlphabetBookmarks=ABCDEFGHIJKLMNOPQRSTUVWXYZ +MergeError1=The merged Help system +MergeError2=is using a different language from the master Help system, which will cause the index and full-text search functionality to be disabled in the merged Help system. +PoweredBy=Powered by +GeneratedBy=Generated by +Author=Author +About=About +Print=Print + +[PrintedDoc] +TableOfContents=Table Of Contents +TitlePage=Title Page +ChapterFileNamePrefix=Chapter_ +TitlePageFileName=Chapter__Title_Page.doc +CrossReferencePrefix=See +GlossaryHeadingStyleName=Glossary Heading +GlossaryTermStyleName=Glossary Term +GlossaryDefinitionStyleName=Glossary Definition +TitlePageTitleStyleName=Title Page Title +TocPageTitleStyleName=Table of Contents Page Title diff --git a/doc/salome/gui/SUPERV/supervision.htm b/doc/salome/gui/SUPERV/supervision.htm new file mode 100755 index 0000000..f0bbba4 --- /dev/null +++ b/doc/salome/gui/SUPERV/supervision.htm @@ -0,0 +1,139 @@ + + + + SUPERVISION reference manual + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/doc/salome/gui/SUPERV/supervision_csh.htm b/doc/salome/gui/SUPERV/supervision_csh.htm new file mode 100755 index 0000000..0ec7e76 --- /dev/null +++ b/doc/salome/gui/SUPERV/supervision_csh.htm @@ -0,0 +1,106 @@ + + +SUPERVISION reference manual + + + + + + + + + + + + + \ No newline at end of file diff --git a/doc/salome/gui/SUPERV/supervision_rhc.htm b/doc/salome/gui/SUPERV/supervision_rhc.htm new file mode 100755 index 0000000..b0cfeb4 --- /dev/null +++ b/doc/salome/gui/SUPERV/supervision_rhc.htm @@ -0,0 +1,106 @@ + + +SUPERVISION reference manual + + + + + + + + + + + + + \ No newline at end of file diff --git a/doc/salome/gui/SUPERV/webhelp.cab b/doc/salome/gui/SUPERV/webhelp.cab index 1458608..b942f64 100755 Binary files a/doc/salome/gui/SUPERV/webhelp.cab and b/doc/salome/gui/SUPERV/webhelp.cab differ diff --git a/doc/salome/gui/SUPERV/webhelp.jar b/doc/salome/gui/SUPERV/webhelp.jar index d985cac..53b2666 100755 Binary files a/doc/salome/gui/SUPERV/webhelp.jar and b/doc/salome/gui/SUPERV/webhelp.jar differ diff --git a/doc/salome/gui/SUPERV/whcsh_home.htm b/doc/salome/gui/SUPERV/whcsh_home.htm new file mode 100755 index 0000000..c94fbfb --- /dev/null +++ b/doc/salome/gui/SUPERV/whcsh_home.htm @@ -0,0 +1,600 @@ + + + + + + \ No newline at end of file diff --git a/doc/salome/gui/SUPERV/whcshdata.htm b/doc/salome/gui/SUPERV/whcshdata.htm new file mode 100755 index 0000000..c7f832d --- /dev/null +++ b/doc/salome/gui/SUPERV/whcshdata.htm @@ -0,0 +1,87 @@ + + +SUPERVISION reference manual + + + + + + + + + + diff --git a/doc/salome/gui/SUPERV/whdata/whftdata.js b/doc/salome/gui/SUPERV/whdata/whftdata.js index 9e3b6ab..071ae6f 100755 --- a/doc/salome/gui/SUPERV/whdata/whftdata.js +++ b/doc/salome/gui/SUPERV/whdata/whftdata.js @@ -1,3 +1,4 @@ +// WebHelp 5.10.001 var gTEA = new Array(); function aTE(sTopicTitle, sTopicURL) { diff --git a/doc/salome/gui/SUPERV/whdata/whftdata0.htm b/doc/salome/gui/SUPERV/whdata/whftdata0.htm index 1aa68ed..eec0896 100755 --- a/doc/salome/gui/SUPERV/whdata/whftdata0.htm +++ b/doc/salome/gui/SUPERV/whdata/whftdata0.htm @@ -1,6 +1,8 @@ - + + + @@ -36,7 +38,6 @@ aTE("Loop nodes","files/loop_nodes.htm"); aTE("Modifying links","files/modifying_links.htm"); aTE("Changing graph description","files/opening_graphs_referenced_in_the_study.htm"); aTE("Placing nodes in the window","files/placing_nodes_in_the_window.htm"); -aTE("Placing nodes in the window","files/points_in_links.htm"); aTE("Referencing output values in the study","files/referencing_output_values_in_the_study.htm"); aTE("Reloading dataflow","files/reloading_dataflow.htm"); aTE("Renaming nodes","files/renaming_nodes.htm"); @@ -47,7 +48,9 @@ aTE("Step-by-Step execution","files/step-by-step_execution.htm"); aTE("Switch nodes","files/switch_nodes.htm"); aTE("Usage of SUPERVISION module","files/usage_of_supervisor_module.htm"); aTE("Examiming calculated data","files/viewing_output_vaues.htm"); +aTE("Macro Node","macro_node.htm"); +aTE("Referencing graphs in the study","referencing_graphs_in_the_study.htm"); //--> - + diff --git a/doc/salome/gui/SUPERV/whdata/whfts.htm b/doc/salome/gui/SUPERV/whdata/whfts.htm index 4454361..42b38a2 100755 --- a/doc/salome/gui/SUPERV/whdata/whfts.htm +++ b/doc/salome/gui/SUPERV/whdata/whfts.htm @@ -1,16 +1,18 @@ - + + + \ No newline at end of file diff --git a/doc/salome/gui/SUPERV/whdata/whfts.js b/doc/salome/gui/SUPERV/whdata/whfts.js index 2041512..2b66786 100755 --- a/doc/salome/gui/SUPERV/whdata/whfts.js +++ b/doc/salome/gui/SUPERV/whdata/whfts.js @@ -1,3 +1,4 @@ +// WebHelp 5.10.001 var gaFileMapping = new Array(); var gaFileTopicMapping = new Array(); diff --git a/doc/salome/gui/SUPERV/whdata/whfwdata.js b/doc/salome/gui/SUPERV/whdata/whfwdata.js index 463bfb0..e9e8bc6 100755 --- a/doc/salome/gui/SUPERV/whdata/whfwdata.js +++ b/doc/salome/gui/SUPERV/whdata/whfwdata.js @@ -1,3 +1,4 @@ +// WebHelp 5.10.001 var gWEA = new Array(); function aWE() { diff --git a/doc/salome/gui/SUPERV/whdata/whfwdata0.htm b/doc/salome/gui/SUPERV/whdata/whfwdata0.htm index 64fc07e..2792815 100755 --- a/doc/salome/gui/SUPERV/whdata/whfwdata0.htm +++ b/doc/salome/gui/SUPERV/whdata/whfwdata0.htm @@ -1,6 +1,8 @@ - + + + @@ -10,459 +12,482 @@ - + diff --git a/doc/salome/gui/SUPERV/whdata/whgdata.js b/doc/salome/gui/SUPERV/whdata/whgdata.js index 7293273..77e0107 100755 --- a/doc/salome/gui/SUPERV/whdata/whgdata.js +++ b/doc/salome/gui/SUPERV/whdata/whgdata.js @@ -1,3 +1,4 @@ +// WebHelp 5.10.001 var gIEA = new Array(); function aGE(sName, sDef) { diff --git a/doc/salome/gui/SUPERV/whdata/whgdata0.htm b/doc/salome/gui/SUPERV/whdata/whgdata0.htm index 9fbefcb..9d256b1 100755 --- a/doc/salome/gui/SUPERV/whdata/whgdata0.htm +++ b/doc/salome/gui/SUPERV/whdata/whgdata0.htm @@ -1,6 +1,8 @@ - + + + diff --git a/doc/salome/gui/SUPERV/whdata/whglo.htm b/doc/salome/gui/SUPERV/whdata/whglo.htm index d00c260..dc5a677 100755 --- a/doc/salome/gui/SUPERV/whdata/whglo.htm +++ b/doc/salome/gui/SUPERV/whdata/whglo.htm @@ -1,6 +1,8 @@ - + + + diff --git a/doc/salome/gui/SUPERV/whdata/whglo.js b/doc/salome/gui/SUPERV/whdata/whglo.js index ded3d57..e0519af 100755 --- a/doc/salome/gui/SUPERV/whdata/whglo.js +++ b/doc/salome/gui/SUPERV/whdata/whglo.js @@ -1,3 +1,4 @@ +// WebHelp 5.10.001 var gaFileMapping = new Array(); function fileMapping(sBK, sEK, sFileName, nNum) { diff --git a/doc/salome/gui/SUPERV/whdata/whidata.js b/doc/salome/gui/SUPERV/whdata/whidata.js index c8c2a05..9f0eb15 100755 --- a/doc/salome/gui/SUPERV/whdata/whidata.js +++ b/doc/salome/gui/SUPERV/whdata/whidata.js @@ -1,3 +1,4 @@ +// WebHelp 5.10.001 // const strings var gIEA = new Array(); function aIE() diff --git a/doc/salome/gui/SUPERV/whdata/whidx.htm b/doc/salome/gui/SUPERV/whdata/whidx.htm index c0aa175..0a0deed 100755 --- a/doc/salome/gui/SUPERV/whdata/whidx.htm +++ b/doc/salome/gui/SUPERV/whdata/whidx.htm @@ -1,13 +1,15 @@ - + + + - \ No newline at end of file diff --git a/doc/salome/gui/SUPERV/whdata/whidx.js b/doc/salome/gui/SUPERV/whdata/whidx.js index ded3d57..e0519af 100755 --- a/doc/salome/gui/SUPERV/whdata/whidx.js +++ b/doc/salome/gui/SUPERV/whdata/whidx.js @@ -1,3 +1,4 @@ +// WebHelp 5.10.001 var gaFileMapping = new Array(); function fileMapping(sBK, sEK, sFileName, nNum) { diff --git a/doc/salome/gui/SUPERV/whdata/whtdata.js b/doc/salome/gui/SUPERV/whdata/whtdata.js index 64bcff9..d5428a7 100755 --- a/doc/salome/gui/SUPERV/whdata/whtdata.js +++ b/doc/salome/gui/SUPERV/whdata/whtdata.js @@ -1,3 +1,4 @@ +// WebHelp 5.10.001 var gTEA = new Array(); function aTE() { @@ -34,6 +35,11 @@ function tocEntry(fn_arguments) if (fn_arguments.length > 3) { this.sRefURL = fn_arguments[3]; + if (this.nType == 4) + { + if(this.sRefURL.lastIndexOf("/")!=this.sRefURL.length-1) + this.sRefURL+="/"; + } if (fn_arguments.length > 4) { this.sItemURL = fn_arguments[4]; diff --git a/doc/salome/gui/SUPERV/whdata/whtdata0.htm b/doc/salome/gui/SUPERV/whdata/whtdata0.htm index 127f786..0a6471c 100755 --- a/doc/salome/gui/SUPERV/whdata/whtdata0.htm +++ b/doc/salome/gui/SUPERV/whdata/whtdata0.htm @@ -1,30 +1,33 @@ - + + + - + diff --git a/doc/salome/gui/SUPERV/whgdhtml.htm b/doc/salome/gui/SUPERV/whgdhtml.htm index 01b6692..6ffb294 100755 --- a/doc/salome/gui/SUPERV/whgdhtml.htm +++ b/doc/salome/gui/SUPERV/whgdhtml.htm @@ -1,9 +1,9 @@ Glossary - + - + diff --git a/doc/salome/gui/SUPERV/whghost.js b/doc/salome/gui/SUPERV/whghost.js index 77751a1..56e1d56 100755 --- a/doc/salome/gui/SUPERV/whghost.js +++ b/doc/salome/gui/SUPERV/whghost.js @@ -1,3 +1,4 @@ +// WebHelp 5.10.004 var gbXML=false; var gaDef=new Array(); var gsBgColor="#ffffff"; @@ -8,6 +9,8 @@ var gsMargin="2pt"; var gsIndent="2pt"; var gsActiveBgColor="#cccccc"; var gbWhGHost=false; +var gbShowDef=true; +var gsGloId="Glo_" function setBackground(sBgImage) { @@ -43,22 +46,6 @@ function setIndent(sIndent) gsIndent=sIndent; } -function writeOneItem(oHTML,bDown,aDataCon,aCurIdxSet,n,aPos,nLevel) -{ - - var sHTML=""; - var nIdxSet=aCurIdxSet[n]; - var nIIdx=aPos[nIdxSet]; - var sRawKName = getItemName(aDataCon,nIdxSet,nIIdx); - var sKName=_textToHtml(sRawKName); - var nIndex=insertDef(sKName,_textToHtml_nonbsp(getDef(aDataCon,nIdxSet,nIIdx))); - if(nLevel==1){ - sHTML+="

        "+sKName+"

        "; - } - oHTML.addHTML(sHTML,1,bDown,true,sRawKName); -} - function insertDef(sKName,sDef) { var nLength=gaDef.length @@ -71,6 +58,7 @@ function showDef(nDef) { if(nDef"; + sHTML+=""+sKName+"

        "; + oHTML.addHTML(sHTML,nLength,bDown,true,sRawKName); + if(gbShowDef) + { + setTimeout("showDef(0);",100); + gbShowDef = false; + } + } +} + +function HighLight(nIndex) +{ + var oObj=getElement(getGloId(nIndex)); + if(oObj) + HighLightElement(oObj,gsActiveBgColor,"transparent"); +} + +function getGloId(nIndex) +{ + return gsGloId+nIndex; } function adjustPosition(bDown,aDataCon,aCurIdxSet,nLength,aPos) @@ -146,7 +176,7 @@ function loadGlo() var sLangId=aProj[0].sLangId; for(var i=0;i Index content - + - + @@ -15,11 +15,7 @@ <p>Your browser does not support frames. We recommend that you update your browser to a version that supports frames.</p><p>To view the Help system without frames click on this<a href="whgdata/whnvp30.htm">hyperlink.</a></p> diff --git a/doc/salome/gui/SUPERV/whphost.js b/doc/salome/gui/SUPERV/whphost.js index d4c80bb..9c91b49 100755 --- a/doc/salome/gui/SUPERV/whphost.js +++ b/doc/salome/gui/SUPERV/whphost.js @@ -1,3 +1,4 @@ +// WebHelp 5.10.005 var gaProj=new Array(); var gnChecked=0; var gsProjName=""; @@ -87,7 +88,7 @@ function whCom(sName,sComFile) var strFile= _getFullPath(getPath(), this.msComFile); var oDiv=getElement(this.msDivId); if(oDiv){ - if(gbIE4){ + if(gbIE4||gbOpera7){ var nIFrameHeight=oDiv.style.pixelHeight; var nIFrameWidth=oDiv.style.pixelWidth; var sHTML=""; + gsHTML=""; goDiv = oDiv; setTimeout("delayLoad()", 100); } @@ -119,11 +119,12 @@ function whCom(sName,sComFile) var sHTML=""; if(gbMac&&gbIE4) sHTML+="
        "; + else if(gbIE5) + sHTML+="
        "; + else if(gbIE4||gbWindows) + sHTML+="
        "; else - if (gbIE5) - sHTML+="
        "; - else - sHTML+="
        "; + sHTML+="
        "; sHTML+="
        "; return sHTML; } @@ -203,29 +204,68 @@ function getPath() goMan=new whComMan(); function addPane(sName,sFileName) { - goMan.addCom(sName,sFileName); + var oParam=new Object(); + oParam.sName=sName; + var oMsg=new whMessage(WH_MSG_GETPANE, this, 1, oParam); + if (SendMessage(oMsg)) + { + if (oMsg.oParam.bEnable) + goMan.addCom(sName,sFileName); + } + else + goMan.addCom(sName,sFileName); } function setShowPane(sName, bForce) { if ((gsFirstPane == "") || bForce) - gsFirstPane=sName; + { + var oMsg=new whMessage(WH_MSG_GETDEFPANE, this, 1, null); + if (SendMessage(oMsg)) + { + if (oMsg.oParam) + gsFirstPane = oMsg.oParam; + else + gsFirstPane=sName; + } + else + gsFirstPane=sName; + } } function window_OnLoad() { - if(gsProjName!="") + var oMsg=new whMessage(WH_MSG_GETCMD,this,1,null); + var bHidePane=false; + if (SendMessage(oMsg)) { - goMan.init(); - if(gsFirstPane!="") - goMan.show(gsFirstPane); - else - goMan.showById(0); - loadData2(gsProjName); + if(oMsg.oParam>0) + { + if(oMsg.oParam==1) + gsFirstPane="toc"; + else if(oMsg.oParam==2) + gsFirstPane="idx"; + else if(oMsg.oParam==3) + gsFirstPane="fts"; + else if(oMsg.oParam==4) + gsFirstPane="glo"; + } + else if(oMsg.oParam==0) + { + bHidePane=true; + } } - else if (gServerEnabled) + goMan.init(); + if(gsProjName!="") + loadData2(gsProjName); + if (bHidePane) + { + gsFirstPane=""; + var oMsg1=new whMessage(WH_MSG_HIDEPANE, this, 1, null) + SendMessage(oMsg1); + } + else { - goMan.init(); if(gsFirstPane!="") goMan.show(gsFirstPane); else @@ -249,7 +289,7 @@ function loadData2(strFile) function addProject(bPreferXML,sXMLName,sHTMLName) { var bLoadXML=bPreferXML; - if(!gbIE4&&!gbNav6) + if(!gbIE4&&!gbNav6&&!gbOpera7) return; if(gbIE4&&!gbIE5) bLoadXML=false; @@ -257,6 +297,8 @@ function addProject(bPreferXML,sXMLName,sHTMLName) bLoadXML=true; if(gbIE55||gbNav6) bLoadXML=true; + if(gbOpera7) + bLoadXML=false; if(bLoadXML) addProjectXML(sXMLName); else @@ -316,6 +358,8 @@ function putDataXML(xmlDoc,sdocPath) var sURL=RmtProject[i].getAttribute("url"); if(sURL) { + if(sURL.lastIndexOf("/")!=sURL.length-1) + sURL+="/"; aRProj[nCount]=new Object(); aRProj[nCount++].sPPath=_getFullPath(aRProj[0].sPPath,sURL); } @@ -326,11 +370,23 @@ function putDataXML(xmlDoc,sdocPath) { // on Netscape 6.0 under some situation the xml file cannot be loaded. // so we use pure html instead. - setTimeout("redirectToList();",100); + if (gnChecked == 0) + setTimeout("redirectToList();",100); + else + { + gnChecked++; + setTimeout("checkRemoteProject();", 1); + } } } } +function onLoadXMLError() +{ + gnChecked++; + setTimeout("checkRemoteProject();", 1); +} + function redirectToList() { if(gbReDirectThis) @@ -346,7 +402,7 @@ function putProjectInfo(aRProj) if(gnChecked!=0) { if(aRProj[0].sLangId!=gaProj[0].sLangId) - alert("The project: "+aRProj[0].sPPath+" is using a different language to the main project, which will cause the index and full text search functionality to be disabled for this remote project."); + alert("The merged Help system "+aRProj[0].sPPath+" is using a different language from the master Help system, which will cause the index and full-text search functionality to be disabled in the merged Help system."); } gaProj[gnChecked]=aRProj[0]; for(var i=1;i project description - + - + diff --git a/doc/salome/gui/SUPERV/whproj.js b/doc/salome/gui/SUPERV/whproj.js index 0e23515..ae38fa9 100755 --- a/doc/salome/gui/SUPERV/whproj.js +++ b/doc/salome/gui/SUPERV/whproj.js @@ -1,3 +1,4 @@ +// WebHelp 5.10.001 var gaProj=new Array(); gaProj[0]=new project(""); @@ -41,6 +42,8 @@ function addGlo(sFile) function addRemoteProject(sProjRelPath) { + if(sProjRelPath.lastIndexOf("/")!=sProjRelPath.length-1) + sProjRelPath+="/"; gaProj[gaProj.length]=new project(sProjRelPath); } diff --git a/doc/salome/gui/SUPERV/whproj.xml b/doc/salome/gui/SUPERV/whproj.xml index d16f189..4bd4a8d 100755 --- a/doc/salome/gui/SUPERV/whproj.xml +++ b/doc/salome/gui/SUPERV/whproj.xml @@ -1,3 +1,3 @@ - - + + diff --git a/doc/salome/gui/SUPERV/whproxy.js b/doc/salome/gui/SUPERV/whproxy.js index 222927a..d0ee298 100755 --- a/doc/salome/gui/SUPERV/whproxy.js +++ b/doc/salome/gui/SUPERV/whproxy.js @@ -1,3 +1,4 @@ +// WebHelp 5.10.001 var gbInited=false; var gWndStubPage=null; function getStubPage() @@ -60,4 +61,14 @@ function SendMessage(oMessage) return false; } -var gbWhProxy=true; \ No newline at end of file +var gbWhProxy=true; + +var gbPreview=false; +gbPreview=false; +if (gbPreview) + document.oncontextmenu=contextMenu; + +function contextMenu() +{ + return false; +} diff --git a/doc/salome/gui/SUPERV/whres.xml b/doc/salome/gui/SUPERV/whres.xml index 9634684..f3f010a 100755 --- a/doc/salome/gui/SUPERV/whres.xml +++ b/doc/salome/gui/SUPERV/whres.xml @@ -1,4 +1,4 @@ - + @@ -6,9 +6,13 @@ + + + + @@ -18,7 +22,11 @@ + + + + @@ -28,13 +36,21 @@ + + + + + + + + @@ -57,6 +73,7 @@ + @@ -160,14 +177,14 @@ - - - - + + + + diff --git a/doc/salome/gui/SUPERV/whskin_banner.htm b/doc/salome/gui/SUPERV/whskin_banner.htm index afe2d3f..39ed797 100755 --- a/doc/salome/gui/SUPERV/whskin_banner.htm +++ b/doc/salome/gui/SUPERV/whskin_banner.htm @@ -1,13 +1,14 @@ About WebHelp                                                                                    - + - + + SUPERVISION reference manual + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/doc/salome/gui/SUPERV/whskin_info.htm b/doc/salome/gui/SUPERV/whskin_info.htm index bf5eddc..d0d640e 100755 --- a/doc/salome/gui/SUPERV/whskin_info.htm +++ b/doc/salome/gui/SUPERV/whskin_info.htm @@ -1,20 +1,20 @@ -WebHelp 5.00 +WebHelp 5.50 - + -

        WebHelp 5.00 System Info

        +

        WebHelp 5.50 System Info

        - + - + - - - + + +
        Start Page supervision.html
        Start Page supervision.htm
        Skin Name Default
        Generating Time 11:30 02/18/2004
        Generating Time 13:18 03/01/2005
        Language ID 1033
        Compile Script webhelp5_compile_script.xml
        Compile Build Version 10.00.949
        Product Name WebHelp 5.00
        Authoring Tool Name RoboHelp 2002
        Compile Build Version 13.10.606
        Product Name WebHelp 5.50
        Authoring Tool Name RoboHelp X5
        \ No newline at end of file diff --git a/doc/salome/gui/SUPERV/whskin_mbars.htm b/doc/salome/gui/SUPERV/whskin_mbars.htm index 66e8c53..c4fa48a 100755 --- a/doc/salome/gui/SUPERV/whskin_mbars.htm +++ b/doc/salome/gui/SUPERV/whskin_mbars.htm @@ -1,6 +1,9 @@ - + WebHelp Navigation Mini-bar + + +\n"; + document.write(sStyle); +} + +function window_OnLoad() +{ + if(document.body) + { + if(gsBgImage&&gsBgImage.length>0) + { + document.body.background=gsBgImage; + } + if(gsBgColor&&gsBgColor.length>0) + { + document.body.bgColor=gsBgColor; + } + } + fnOnload(); + window_onResize(); +} + +function window_onResize() +{ + var oDiv = getElement("divlist"); + var oTitle = getElement("p_title"); + var oButton = getElement("tb_button"); + if (oDiv && oTitle && oButton) + { + oDiv.style.height = document.body.offsetHeight - oTitle.offsetHeight - oButton.offsetHeight - 8; + } +} +goTableFont=new whFont("Verdana","8pt","#000000","normal","normal","none"); +goFont=new whFont("Verdana","8pt","#000000","normal","normal","none"); +goHoverFont=new whFont("Verdana","8pt","#666666","normal","normal","none"); + + +setBackgroundcolor("White"); + +setFont("Table", "Tahoma","8pt","Navy","Normal","Normal","none"); +setListBackgroundcolor("White"); + +setFont("Normal", "Tahoma","8pt","Black","Normal","Normal","none"); +setFont("Hover", "Tahoma","8pt","Navy","Normal","Normal","underline"); +setActiveBgColor("Silver"); + +window.onload=window_OnLoad; +window.onresize = window_onResize; +writeStyle(); +//--> + + + + +

        Select a topic, then click Display

        +
        +
        +
        + + + +
        + + + + \ No newline at end of file diff --git a/doc/salome/gui/SUPERV/whskin_plist.htm b/doc/salome/gui/SUPERV/whskin_plist.htm index 35f0155..f7cf6d1 100755 --- a/doc/salome/gui/SUPERV/whskin_plist.htm +++ b/doc/salome/gui/SUPERV/whskin_plist.htm @@ -1,47 +1,38 @@ Navigation Pane - + - + \ No newline at end of file diff --git a/doc/salome/gui/SUPERV/whskin_tbars.htm b/doc/salome/gui/SUPERV/whskin_tbars.htm index 8b70544..6cb4902 100755 --- a/doc/salome/gui/SUPERV/whskin_tbars.htm +++ b/doc/salome/gui/SUPERV/whskin_tbars.htm @@ -1,6 +1,9 @@ - + WebHelp Navigation Toolbar + + + "; + var sStyle=""; document.write(sStyle); } } } -function button(sText, nWidth, nHeight) +function button(sText,nWidth,nHeight) { - this.sText = sText; - this.nWidth = nWidth; - this.nHeight = nHeight; + this.sText=sText; + this.nWidth=nWidth; + this.nHeight=nHeight; - this.aImgs = new Array(); - var i = 0; - while (button.arguments.length > i + 3) + this.aImgs=new Array(); + var i=0; + while(button.arguments.length>i+3) { - this.aImgs[i] = button.arguments[3 + i]; - i ++; + this.aImgs[i]=button.arguments[3+i]; + i++; } } -// project info +//project info function setRelStartPage(sPath) { - if (gsPPath.length == 0) + if(gsPPath.length==0) { - gsPPath = _getFullPath(_getPath(document.location.href), _getPath(sPath)); - gsStartPage = _getFullPath(_getPath(document.location.href), sPath); - gsRelCurPagePath = _getRelativeFileName(gsStartPage, document.location.href); + gsPPath=_getFullPath(_getPath(document.location.href),_getPath(sPath)); + gsStartPage=_getFullPath(_getPath(document.location.href),sPath); + gsRelCurPagePath=_getRelativeFileName(gsStartPage,document.location.href); } } -function getImage(oImage, sType) +function getImage(oImage,sType) { var sImg=""; - if (oImage && oImage.aImgs && (oImage.aImgs.length > 0)) + if(oImage&&oImage.aImgs&&(oImage.aImgs.length>0)) { - sImg+="\""+ 0) - sImg+=" width=" + oImage.nWidth; - if (oImage.nHeight > 0) - sImg+=" height=" + oImage.nHeight; - sImg+=" border=no>"; + sImg+="\""+sType+"\"0) + sImg+=" width="+oImage.nWidth; + if(oImage.nHeight>0) + sImg+=" height="+oImage.nHeight; + sImg+=" border=0>"; } return sImg; } function addTocInfo(sTocPath) { - gaPaths[gaPaths.length] = sTocPath; + gaPaths[gaPaths.length]=sTocPath; } -function addAvenueInfo(sName, sPrev, sNext) +function addAvenueInfo(sName,sPrev,sNext) { - gaAvenues[gaAvenues.length] = new avenueInfo(sName, sPrev, sNext); + gaAvenues[gaAvenues.length]=new avenueInfo(sName,sPrev,sNext); } -function addButton(sType, nStyle, sText, sHref, sOnClick, sOnMouseOver, sOnLoad, nWidth, nHeight, sImg1, sImg2, sImg3) +function addButton(sType,nStyle,sText,sHref,sOnClick,sOnMouseOver,sOnLoad,nWidth,nHeight,sImg1,sImg2,sImg3) { - var sButton = ""; + var sButton=""; var nBtn=gaButtons.length; - if (sType == "prev") + if(sType=="prev") { - if (canGo(false)) + if(canGo(false)) { - var sTitle = "Previous Topic"; - goPrev = new button(sText, nWidth, nHeight, sImg1, sImg2, sImg3); - sButton = ""; - if (nStyle == BTN_TEXT) - sButton += goPrev.sText; + var sTitle="Previous Topic"; + goPrev=new button(sText,nWidth,nHeight,sImg1,sImg2,sImg3); + sButton=""; + if(nStyle==BTN_TEXT) + sButton+=goPrev.sText; else - sButton += getImage(goPrev, sTitle); - sButton += ""; + sButton+=getImage(goPrev,sTitle); + sButton+=""; } } - else if (sType == "next") + else if(sType=="next") { - if (canGo(true)) + if(canGo(true)) { - var sTitle = "Next Topic"; - goNext = new button(sText, nWidth, nHeight, sImg1, sImg2, sImg3); - sButton = ""; - if (nStyle == BTN_TEXT) - sButton += goNext.sText; + var sTitle="Next Topic"; + goNext=new button(sText,nWidth,nHeight,sImg1,sImg2,sImg3); + sButton=""; + if(nStyle==BTN_TEXT) + sButton+=goNext.sText; else - sButton += getImage(goNext, sTitle); - sButton += ""; + sButton+=getImage(goNext,sTitle); + sButton+=""; } } - else if (sType == "show") + else if(sType=="show") { - if (isTopicOnly()) + if(isTopicOnly()&&(!gbOpera6||gbOpera7)) { - var sTitle = "Show Navigation Component"; - goShow = new button(sText, nWidth, nHeight, sImg1, sImg2, sImg3); - sButton = ""; - if (nStyle == BTN_TEXT) - sButton += goShow.sText; + var sTitle="Show Navigation Component"; + goShow=new button(sText,nWidth,nHeight,sImg1,sImg2,sImg3); + sButton=""; + if(nStyle==BTN_TEXT) + sButton+=goShow.sText; else - sButton += getImage(goShow, sTitle); - sButton += ""; + sButton+=getImage(goShow,sTitle); + sButton+=""; } } - else if (sType == "hide") + else if(sType=="hide") { - if (!isTopicOnly()) + if(!isTopicOnly()&&!gbOpera6) { - var sTitle = "Hide Navigation Component"; - goHide = new button(sText, nWidth, nHeight, sImg1, sImg2, sImg3); - sButton = ""; - if (nStyle == BTN_TEXT) - sButton += goHide.sText; + var sTitle="Hide Navigation Component"; + goHide=new button(sText,nWidth,nHeight,sImg1,sImg2,sImg3); + sButton=""; + if(nStyle==BTN_TEXT) + sButton+=goHide.sText; else - sButton += getImage(goHide, sTitle); - sButton += ""; + sButton+=getImage(goHide,sTitle); + sButton+=""; } } - else if (sType == "shownav") + else if(sType=="shownav") { - - if (isShowHideEnable()) + if(isShowHideEnable()) { - var sTitle = "Show Navigation Component"; - goShowNav = new button(sText, nWidth, nHeight, sImg1, sImg2, sImg3); - sButton = ""; - if (nStyle == BTN_TEXT) - sButton += goShowNav.sText; + var sTitle="Show Navigation Component"; + goShowNav=new button(sText,nWidth,nHeight,sImg1,sImg2,sImg3); + sButton=""; + if(nStyle==BTN_TEXT) + sButton+=goShowNav.sText; else - sButton += getImage(goShowNav, sTitle); - sButton += ""; + sButton+=getImage(goShowNav,sTitle); + sButton+=""; } } - else if (sType == "hidenav") + else if(sType=="hidenav") { - if (isShowHideEnable()) + if(isShowHideEnable()) { - var sTitle = "Hide Navigation Component"; - goHideNav = new button(sText, nWidth, nHeight, sImg1, sImg2, sImg3); - sButton = ""; - if (nStyle == BTN_TEXT) - sButton += goHideNav.sText; + var sTitle="Hide Navigation Component"; + goHideNav=new button(sText,nWidth,nHeight,sImg1,sImg2,sImg3); + sButton=""; + if(nStyle==BTN_TEXT) + sButton+=goHideNav.sText; else - sButton += getImage(goHideNav, sTitle); - sButton += ""; + sButton+=getImage(goHideNav,sTitle); + sButton+=""; } } - else if (sType == "synctoc") + else if(sType=="synctoc") { - if (gaPaths.length > 0) + if(gaPaths.length>0) { - var sTitle = "Sync TOC"; - goSync = new button(sText, nWidth, nHeight, sImg1, sImg2, sImg3); - sButton = ""; - if (nStyle == BTN_TEXT) - sButton += goSync.sText; + var sTitle="Sync TOC"; + goSync=new button(sText,nWidth,nHeight,sImg1,sImg2,sImg3); + sButton=""; + if(nStyle==BTN_TEXT) + sButton+=goSync.sText; else - sButton += getImage(goSync, sTitle); - sButton += ""; + sButton+=getImage(goSync,sTitle); + sButton+=""; } } - else if (sType == "websearch") + else if(sType=="websearch") { - if (gsSearchFormHref.length > 0) + if(gsSearchFormHref.length>0) { - var sTitle = "WebSearch"; - goWebSearch = new button(sText, nWidth, nHeight, sImg1, sImg2, sImg3); - sButton = ""; - if (nStyle == BTN_TEXT) - sButton += goWebSearch.sText; + var sTitle="WebSearch"; + goWebSearch=new button(sText,nWidth,nHeight,sImg1,sImg2,sImg3); + sButton=""; + if(nStyle==BTN_TEXT) + sButton+=goWebSearch.sText; else - sButton += getImage(goWebSearch, sTitle); - sButton += ""; + sButton+=getImage(goWebSearch,sTitle); + sButton+=""; } } - else if (sType == "searchform") + else if(sType=="searchform") { - gaButtons[nBtn] = "NeedSearchForm"; - gaTypes[nBtn] = sType; + gaButtons[nBtn]="NeedSearchForm"; + gaTypes[nBtn]=sType; } - if (sButton.length != 0) + if(sButton.length!=0) { - if (nStyle == BTN_TEXT) - sButton += " "; - gaButtons[nBtn] = "" + sButton + ""; - gaTypes[nBtn] = sType; + if(nStyle==BTN_TEXT) + sButton+=" "; + gaButtons[nBtn]=""+sButton+""; + gaTypes[nBtn]=sType; } } function isSyncEnabled() { - if (!gbCheckSync) + if(!gbCheckSync) { var oMsg=new whMessage(WH_MSG_ISSYNCSSUPPORT,this,1,null); if(SendMessage(oMsg)) @@ -250,30 +250,30 @@ function isSyncEnabled() function isInPopup() { - return (window.name.indexOf("BSSCPopup") != -1); + return (window.name.indexOf("BSSCPopup")!=-1); } function getIntopicBar(sAlign) { - var sHTML = ""; - if (gaButtons.length > 0) + var sHTML=""; + if(gaButtons.length>0) { - sHTML += "
        "; + sHTML+="
        "; - sHTML += ""; - for (var i = 0; i < gaButtons.length; i++) + sHTML+="
        "; + for(var i=0;i 0) + if(isInPopup()) return; + if(gaButtons.length>0) { - var sHTML = ""; - if (nAligns != 0) + var sHTML=""; + if(nAligns!=0) { - sHTML += "
        " - if (nAligns & 1) - sHTML += ""; - if (nAligns & 2) - sHTML += ""; - if (nAligns & 4) - sHTML += ""; - sHTML += "
        " + getIntopicBar("left") + "" + getIntopicBar("center") + "" + getIntopicBar("right") + "
        "; + sHTML+="" + if(nAligns&1) + sHTML+=""; + if(nAligns&2) + sHTML+=""; + if(nAligns&4) + sHTML+=""; + sHTML+="
        "+getIntopicBar("left")+""+getIntopicBar("center")+""+getIntopicBar("right")+"
        "; document.write(sHTML); } } @@ -302,45 +302,45 @@ function writeIntopicBar(nAligns) function sendAveInfoOut() { - if (!isInPopup()) - setTimeout("sendAveInfo();", 100); + if(!isInPopup()) + setTimeout("sendAveInfo();",100); } function sendAveInfo() { - var oMsg = new whMessage(WH_MSG_AVENUEINFO, this, 1, gaAvenues); + var oMsg=new whMessage(WH_MSG_AVENUEINFO,this,1,gaAvenues); SendMessage(oMsg); } function onNext() { - var oMsg = new whMessage(WH_MSG_NEXT, this, 1, null); + var oMsg=new whMessage(WH_MSG_NEXT,this,1,null); SendMessage(oMsg); } function onPrev() { - var oMsg = new whMessage(WH_MSG_PREV, this, 1, null); + var oMsg=new whMessage(WH_MSG_PREV,this,1,null); SendMessage(oMsg); } function createSyncInfo() { - var oParam = new Object(); - if (gsPPath.length == 0) - gsPPath = _getPath(document.location.href); - oParam.sPPath = gsPPath; - oParam.sTPath = document.location.href; - oParam.aPaths = gaPaths; + var oParam=new Object(); + if(gsPPath.length==0) + gsPPath=_getPath(document.location.href); + oParam.sPPath=gsPPath; + oParam.sTPath=document.location.href; + oParam.aPaths=gaPaths; return oParam; } function syncWithShow() { - if (isTopicOnly()) + if(isTopicOnly()) show(); - else + else { sync(); showTocPane(); @@ -349,86 +349,86 @@ function syncWithShow() function showTocPane() { - var oMsg = new whMessage(WH_MSG_SHOWTOC, this, 1, null); + var oMsg=new whMessage(WH_MSG_SHOWTOC,this,1,null); SendMessage(oMsg); } function sendSyncInfo() { - if (!isInPopup()) + if(!isInPopup()) { - var oParam = null; - if (gaPaths.length > 0) + var oParam=null; + if(gaPaths.length>0) { - oParam = createSyncInfo(); + oParam=createSyncInfo(); } - var oMsg = new whMessage(WH_MSG_SYNCINFO, this, 1, oParam); + var oMsg=new whMessage(WH_MSG_SYNCINFO,this,1,oParam); SendMessage(oMsg); } } function sendInvalidSyncInfo() { - if (!isInPopup()) + if(!isInPopup()) { - var oMsg = new whMessage(WH_MSG_SYNCINFO, this, 1, null); + var oMsg=new whMessage(WH_MSG_SYNCINFO,this,1,null); SendMessage(oMsg); } } function enableWebSearch(bEnable) { - if (!isInPopup()) + if(!isInPopup()) { - var oMsg = new whMessage(WH_MSG_ENABLEWEBSEARCH, this, 1, bEnable); + var oMsg=new whMessage(WH_MSG_ENABLEWEBSEARCH,this,1,bEnable); SendMessage(oMsg); } } function autoSync(nSync) { - if (nSync == 0) return; - if (isInPopup()) return; - if (isOutMostTopic()) + if(nSync==0) return; + if(isInPopup()) return; + if(isOutMostTopic()) sync(); } function isOutMostTopic() { - if (gnOutmostTopic == -1) + if(gnOutmostTopic==-1) { - var oMessage = new whMessage(WH_MSG_ISINFRAMESET, this, 1 , null); - if (SendMessage(oMessage)) - gnOutmostTopic = 0; + var oMessage=new whMessage(WH_MSG_ISINFRAMESET,this,1,null); + if(SendMessage(oMessage)) + gnOutmostTopic=0; else - gnOutmostTopic = 1; + gnOutmostTopic=1; } - return (gnOutmostTopic == 1); + return (gnOutmostTopic==1); } function sync() { - if (gaPaths.length > 0) + if(gaPaths.length>0) { - var oParam = createSyncInfo(); - var oMessage = new whMessage(WH_MSG_SYNCTOC, this, 1, oParam); + var oParam=createSyncInfo(); + var oMessage=new whMessage(WH_MSG_SYNCTOC,this,1,oParam); SendMessage(oMessage); } } -function avenueInfo(sName, sPrev, sNext) +function avenueInfo(sName,sPrev,sNext) { - this.sName = sName; - this.sPrev = sPrev; - this.sNext = sNext; + this.sName=sName; + this.sPrev=sPrev; + this.sNext=sNext; } function getCurrentAvenue() { - var oParam = new Object(); - oParam.sAvenue = null; - var oMessage = new whMessage(WH_MSG_GETCURRENTAVENUE, this, 1, oParam); + var oParam=new Object(); + oParam.sAvenue=null; + var oMessage=new whMessage(WH_MSG_GETCURRENTAVENUE,this,1,oParam); SendMessage(oMessage); return oParam.sAvenue; } @@ -437,37 +437,37 @@ function unRegisterListener() { sendInvalidSyncInfo(); enableWebSearch(false); - if (whtopic_foldUnload) + if(whtopic_foldUnload) whtopic_foldUnload(); } function onSendMessage(oMsg) { - var nMsgId = oMsg.nMessageId; - if (nMsgId == WH_MSG_GETAVIAVENUES) + var nMsgId=oMsg.nMessageId; + if(nMsgId==WH_MSG_GETAVIAVENUES) { - oMsg.oParam.aAvenues = gaAvenues; + oMsg.oParam.aAvenues=gaAvenues; return false; } - else if (nMsgId == WH_MSG_GETTOCPATHS) + else if(nMsgId==WH_MSG_GETTOCPATHS) { - if (isOutMostTopic()) + if(isOutMostTopic()) { - oMsg.oParam.oTocInfo = createSyncInfo(); + oMsg.oParam.oTocInfo=createSyncInfo(); return false; } else return true; } - else if (nMsgId == WH_MSG_NEXT) + else if(nMsgId==WH_MSG_NEXT) { goAvenue(true); } - else if (nMsgId == WH_MSG_PREV) + else if(nMsgId==WH_MSG_PREV) { goAvenue(false); } - else if (nMsgId == WH_MSG_WEBSEARCH) + else if(nMsgId==WH_MSG_WEBSEARCH) { websearch(); } @@ -476,60 +476,60 @@ function onSendMessage(oMsg) function goAvenue(bNext) { - var sTopic = null; - var sAvenue = getCurrentAvenue(); - var nAvenue = -1; - if (sAvenue != null && sAvenue != "") + var sTopic=null; + var sAvenue=getCurrentAvenue(); + var nAvenue=-1; + if(sAvenue!=null&&sAvenue!="") { - for (var i = 0; i < gaAvenues.length ; i ++) + for(var i=0;i 0 && bNext) + if(gaAvenues[i].sNext!=null&&gaAvenues[i].sNext.length>0&&bNext) { - sTopic = gaAvenues[i].sNext; + sTopic=gaAvenues[i].sNext; break; } - else if (gaAvenues[i].sPrev != null && gaAvenues[i].sPrev.length > 0 && !bNext) + else if(gaAvenues[i].sPrev!=null&&gaAvenues[i].sPrev.length>0&&!bNext) { - sTopic = gaAvenues[i].sPrev; + sTopic=gaAvenues[i].sPrev; break; } } } - if (sTopic != null && sTopic != "") + if(sTopic!=null&&sTopic!="") { - if (gsPPath != null && gsPPath != "") + if(gsPPath!=null&&gsPPath!="") { - sFullTopicPath = _getFullPath(gsPPath, sTopic); - document.location = sFullTopicPath; + sFullTopicPath=_getFullPath(gsPPath,sTopic); + document.location=sFullTopicPath; } } } function canGo(bNext) { - for (var i = 0; i < gaAvenues.length ; i ++) + for(var i=0;i 0 && bNext) || - (gaAvenues[i].sPrev != null && gaAvenues[i].sPrev.length > 0 && !bNext)) + if((gaAvenues[i].sNext!=null&&gaAvenues[i].sNext.length>0&&bNext)|| + (gaAvenues[i].sPrev!=null&&gaAvenues[i].sPrev.length>0&&!bNext)) return true; } return false; @@ -537,34 +537,34 @@ function canGo(bNext) function show() { - if (gsStartPage != "") - window.location = gsStartPage + "#" + gsRelCurPagePath; + if(gsStartPage!="") + window.location=gsStartPage+"#"+gsRelCurPagePath; } function hide() { - if (goFrame != null) + if(goFrame!=null) { - goFrame.location = window.location; + goFrame.location=window.location; } } function isTopicOnly() { - if (gnTopicOnly == -1) + if(gnTopicOnly==-1) { - var oParam = new Object(); - oParam.oFrame = null; - var oMsg = new whMessage(WH_MSG_GETSTARTFRAME, this, 1, oParam); - if (SendMessage(oMsg)) + var oParam=new Object(); + oParam.oFrame=null; + var oMsg=new whMessage(WH_MSG_GETSTARTFRAME,this,1,oParam); + if(SendMessage(oMsg)) { - goFrame = oParam.oFrame; - gnTopicOnly = 0; + goFrame=oParam.oFrame; + gnTopicOnly=0; } else - gnTopicOnly = 1; + gnTopicOnly=1; } - if (gnTopicOnly == 1) + if(gnTopicOnly==1) return true; else return false; @@ -572,88 +572,150 @@ function isTopicOnly() function websearch() { - if (gbNav4) + if(gbNav4) { - if (document.ehelpform) + if(document.ehelpform) document.ehelpform.submit(); } else { - if (window.ehelpform) + if(window.ehelpform) window.ehelpform.submit(); } } function addSearchFormHref(sHref) { - gsSearchFormHref = sHref; + gsSearchFormHref=sHref; enableWebSearch(true); } function searchB(nForm) { - var sValue = eval("document.searchForm" + nForm + ".searchString.value"); - var oMsg = new whMessage(WH_MSG_SEARCHTHIS, this, 1, sValue); + var sValue=eval("document.searchForm"+nForm+".searchString.value"); + var oMsg=new whMessage(WH_MSG_SEARCHTHIS,this,1,sValue); SendMessage(oMsg); } function getSearchFormHTML() { - var sHTML = ""; - gnForm ++; - var sFormName = "searchForm" + gnForm; - var sButton = "
        " - sButton += ""; - if ("" == "text") + var sHTML=""; + gnForm++; + var sFormName="searchForm"+gnForm; + var sButton="" + sButton+=""; + if(""=="text") { - sButton+=""; + sButton+=""; } - else if ("" == "image") + else if(""=="image") { - sButton+="" + sButton+="" sButton+=""; } - sButton += "
        "; - sHTML ="" + sButton + ""; + sButton+=""; + sHTML=""+sButton+""; return sHTML; } function showHidePane(bShow) { var oMsg=null; - if (bShow) - oMsg=new whMessage(WH_MSG_SHOWPANE, this, 1, null); + if(bShow) + oMsg=new whMessage(WH_MSG_SHOWPANE,this,1,null); else - oMsg=new whMessage(WH_MSG_HIDEPANE, this, 1, null); + oMsg=new whMessage(WH_MSG_HIDEPANE,this,1,null); SendMessage(oMsg); } function isShowHideEnable() { - if (gbIE4) + if(gbIE4) return true; else return false; } + +function PickupDialog_Invoke() +{ + if(!gbIE4||gbMac) + { + if(typeof(_PopupMenu_Invoke)=="function") + return _PopupMenu_Invoke(PickupDialog_Invoke.arguments); + } + else + { + if(PickupDialog_Invoke.arguments.length>2) + { + var sPickup="whskin_pickup.htm"; + var sPickupPath=gsPPath+sPickup; + if(gbIE4) + { + var sFrame=PickupDialog_Invoke.arguments[1]; + var aTopics=new Array(); + for(var i=2;i1) + { + var nWidth=300; + var nHeight=180; + var nScreenWidth=screen.width; + var nScreenHeight=screen.height; + var nLeft=(nScreenWidth-nWidth)/2; + var nTop=(nScreenHeight-nHeight)/2; + if(gbIE4) + { + var vRet=window.showModalDialog(sPickupPath,aTopics,"dialogHeight:"+nHeight+"px;dialogWidth:"+nWidth+"px;resizable:yes;status:no;scroll:no;help:no;center:yes;"); + if(vRet) + { + var sURL=vRet.m_url; + if(sFrame) + window.open(sURL,sFrame); + else + window.open(sURL,"_self"); + } + } + } + else if(aTopics.length==1) + { + var sURL=aTopics[0].m_sURL + if(sFrame) + window.open(sURL,sFrame); + else + window.open(sURL,"_self"); + } + } + } + } +} + if(window.gbWhUtil&&window.gbWhMsg&&window.gbWhVer&&window.gbWhProxy) { - RegisterListener("bsscright", WH_MSG_GETAVIAVENUES); - RegisterListener("bsscright", WH_MSG_GETTOCPATHS); - RegisterListener("bsscright", WH_MSG_NEXT); - RegisterListener("bsscright", WH_MSG_PREV); - RegisterListener("bsscright", WH_MSG_WEBSEARCH); - if (gbMac && gbIE4) + RegisterListener("bsscright",WH_MSG_GETAVIAVENUES); + RegisterListener("bsscright",WH_MSG_GETTOCPATHS); + RegisterListener("bsscright",WH_MSG_NEXT); + RegisterListener("bsscright",WH_MSG_PREV); + RegisterListener("bsscright",WH_MSG_WEBSEARCH); + if(gbMac&&gbIE4) { - if (typeof(window.onunload) != "unknown") - whtopic_foldUnload = window.onunload; + if(typeof(window.onunload)!="unknown") + if(window.onunload.toString!=unRegisterListener.toString) + whtopic_foldUnload=window.onunload; } else { - if (window.onunload) - whtopic_foldUnload = window.onunload; + if(window.onunload) + if(window.onunload.toString!=unRegisterListener.toString) + whtopic_foldUnload=window.onunload; } - window.onunload = unRegisterListener; + window.onunload=unRegisterListener; setButtonFont("show","","10pt","","","",""); gbWhTopic=true; diff --git a/doc/salome/gui/SUPERV/whutils.js b/doc/salome/gui/SUPERV/whutils.js index 7fa6c28..85fae7e 100755 --- a/doc/salome/gui/SUPERV/whutils.js +++ b/doc/salome/gui/SUPERV/whutils.js @@ -1,19 +1,26 @@ +// WebHelp 5.10.004 var gsFileName=""; +var gsDivName=""; var xmlDoc=null; var sdocPath=null; var gsInsertBeforeEndHTML=""; var sReplaceStringsSrc=new Array(); +var gsDivName="dataDiv"; +var gnLoadDivNum=0; sReplaceStringsSrc[0]="&"; sReplaceStringsSrc[1]=">"; sReplaceStringsSrc[2]="<"; sReplaceStringsSrc[3]="""; -sReplaceStringsSrc[4]=" "; +sReplaceStringsSrc[4]=String.fromCharCode(8364); +sReplaceStringsSrc[5]=" "; + var sReplaceStringsDst=new Array(); sReplaceStringsDst[0]="&"; sReplaceStringsDst[1]=">"; sReplaceStringsDst[2]="<"; sReplaceStringsDst[3]="\""; -sReplaceStringsDst[4]=" "; +sReplaceStringsDst[4]=String.fromCharCode(128); +sReplaceStringsDst[5]=" "; var goHighLighted=null; function _getRelativePath(strParentPath,strCurrentPath) @@ -45,7 +52,7 @@ function _getRelativePath(strParentPath,strCurrentPath) return strCurrentPath; } -function _getRelativeFileName(strParentPath, strCurrentPath) +function _getRelativeFileName(strParentPath,strCurrentPath) { strParentPath=_replaceSlash(strParentPath); strParentPath=_getPath(strParentPath); @@ -108,7 +115,7 @@ function _getFullPath(sPath,sRelPath) { sRelPath=sRelPath.substring(nPathPos+3); sFullPath=sFullPath.substring(0,sFullPath.length-1); - var nPos2 = sFullPath.lastIndexOf("/"); + var nPos2=sFullPath.lastIndexOf("/"); if(nPos2!=-1) sFullPath=sFullPath.substring(0,nPos2+1); else @@ -123,7 +130,7 @@ function _getFullPath(sPath,sRelPath) function _isAbsPath(strPath) { var strUpper=strPath.toUpperCase(); - return (strUpper.indexOf(":")!=-1); + return (strUpper.indexOf(":")!=-1||strUpper.indexOf("\\\\")==0); } function _replaceSlash(strURL) @@ -166,21 +173,29 @@ function insertItemIntoArray(oArray,i,obj) function loadData(sFileName) { - if(!getElement("dataDiv")) + var i=gnLoadDivNum; + var sName=gsDivName+gnLoadDivNum++; + loadData_2(sFileName,sName); +} + +function loadData_2(sFileName,sDivName) +{ + if(!getElement(sDivName)) { - if(!insertDataDiv()) + if(!insertDataDiv(sDivName)) { gsFileName=sFileName; + gsDivName=sDivName; return; } } var sHTML=""; if(gbMac) - sHTML+=""; + sHTML+=""; else - sHTML+=""; + sHTML+=""; - var oDivCon=getElement("dataDiv"); + var oDivCon=getElement(sDivName); if(oDivCon) { if(gbNav6) @@ -231,21 +246,21 @@ function checkState() if(state==4) { var err=xmlDoc.parseError; - if(err.errorCode!=0) - alert(err.reason); - else + if(err.errorCode==0) putDataXML(xmlDoc,sdocPath); + else + onLoadXMLError(); } } } -function insertDataDiv() +function insertDataDiv(sName) { var sHTML=""; if(gbMac) - sHTML+="
        "; + sHTML+="
        "; else - sHTML+="
        "; + sHTML+="
        "; if((gbIE5||gbNav6)&&document.body) document.body.insertAdjacentHTML("beforeEnd",sHTML); else @@ -264,7 +279,7 @@ function insertWhenBodyReady() { document.body.insertAdjacentHTML("beforeEnd",gsInsertBeforeEndHTML); gsInsertBeforeEndHTML=""; - loadData(gsFileName); + loadData_2(gsFileName,gsDivName); } else { @@ -274,9 +289,12 @@ function insertWhenBodyReady() function window_BUnload() { - var oDivCon=getElement("dataDiv"); - if(oDivCon) - oDivCon.innerHTML=""; + for(var i=0;i='0'&&sBStr.charAt(i)<='9') + { + sNum+=sBStr.charAt(i++); + } + if(sNum!=""){ + var nNum=parseInt(sNum,16); + sText+=String.fromCharCode(nNum); + sBStr=sBStr.substring(i); + } + nPos=sBStr.indexOf('%'); + } + sText+=sBStr; + return sText; +} + +function excapeSingleQuotandSlash(str) +{ + if(str==null) return null; + var nPos=0; + var sRes=""; + var nPosNew=str.indexOf("\\",nPos); + while(nPosNew!=-1){ + sRes+=str.substring(nPos,nPosNew+1)+"\\"; + nPos=nPosNew+1; + nPosNew=str.indexOf("\\",nPos); + } + if(nPos=4) +if(!gbOpera&&!gbKonqueror&&!gbSafari) // opera can mimic IE or Netscape by settings. { - if(navigator.appName=="Netscape") + gbIE=(navigator.appName.indexOf("Microsoft")!=-1); + gbNav=(gAgent.indexOf('mozilla')!=-1) && ((gAgent.indexOf('spoofer')==-1) && (gAgent.indexOf('compatible')==-1)); + if(gnVerMajor>=4) { - gbNav4=true; - if(gnVerMajor>=5) - gbNav6=true; + if(navigator.appName=="Netscape") + { + gbNav4=true; + if(gnVerMajor>=5) + gbNav6=true; + } + gbIE4=(navigator.appName.indexOf("Microsoft")!=-1); + } + if(gbNav6) + { + var nPos=gAgent.indexOf("gecko"); + if(nPos!=-1) + { + var nPos2=gAgent.indexOf("/", nPos); + if(nPos2!=-1) + { + var nVersion=parseFloat(gAgent.substring(nPos2+1)); + if(nVersion>=20010726) + { + gbNav61=true; + if (nVersion>=20020823) + gbNav7=true; + } + } + } + }else if(gbIE4) + { + var nPos=gAgent.indexOf("msie"); + if(nPos!=-1) + { + var nVersion=parseFloat(gAgent.substring(nPos+5)); + if(nVersion>=5) + { + gbIE5=true; + if(nVersion>=5.5) + gbIE55=true; + } + } } - gbIE4=(navigator.appName.indexOf("Microsoft")!=-1); } -if(gbNav6) +else if (gbOpera) { - document.gnPageWidth=innerWidth; - document.gnPageHeight=innerHeight; - var nPos=gAgent.indexOf("netscape"); + var nPos = gAgent.indexOf("opera"); if(nPos!=-1) { - var nVersion=parseFloat(gAgent.substring(nPos+10)); - if(nVersion>=6.1) - gbNav61=true; + var nVersion=parseFloat(gAgent.substring(nPos+6)); + if(nVersion>=6) + { + gbOpera6=true; + if(nVersion>=7) + gbOpera7=true; + } } -}else if(gbIE4) +} +else if (gbKonqueror) { - var nPos=gAgent.indexOf("msie"); + var nPos = gAgent.indexOf("konqueror"); if(nPos!=-1) { - var nVersion=parseFloat(gAgent.substring(nPos+5)); - if(nVersion>=5) - gbIE5=true; - if(nVersion>=5.5) - gbIE55=true; + var nVersion = parseFloat(gAgent.substring(nPos+10)); + if (nVersion >= 3) + { + gbKonqueror3=true; + } } } diff --git a/doc/salome/gui/SUPERV/whxdata/whftdata0.xml b/doc/salome/gui/SUPERV/whxdata/whftdata0.xml new file mode 100755 index 0000000..1d6db61 --- /dev/null +++ b/doc/salome/gui/SUPERV/whxdata/whftdata0.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/salome/gui/SUPERV/whxdata/whfts.xml b/doc/salome/gui/SUPERV/whxdata/whfts.xml new file mode 100755 index 0000000..799655d --- /dev/null +++ b/doc/salome/gui/SUPERV/whxdata/whfts.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/doc/salome/gui/SUPERV/whxdata/whfwdata0.xml b/doc/salome/gui/SUPERV/whxdata/whfwdata0.xml new file mode 100755 index 0000000..be7ea77 --- /dev/null +++ b/doc/salome/gui/SUPERV/whxdata/whfwdata0.xml @@ -0,0 +1,479 @@ + + + 22,33, + 8,16,19,20,2,22,23,28,31,33,34, + 6, + 33, + 8,16,19,20,2,23,28,31,34, + 6, + 16,34, + 6, + 1,24,5,19,26, + 7,29, + 6, + 4, + 22, + 6,29,30, + 22,25, + 12,20,28,30,34, + 21,34, + 22,36, + 3,4,10,22, + 3,4,5,10,19,2,22,23,34, + 3, + 1,24,32, + 32, + 0,7, + 2, + 4,10,13,14,16,21,23,25,26,32,34, + 9,11,15,23, + 22,33, + 23, + 9,18,20,34, + 2,36,23,25,31, + 3,4,1,24,5,14,35,17,30,31, + 3,6,15, + 13,22,33, + 4,2,23, + 6,33,34, + 7, + 1,24,5,34, + 10,13,22,23,37,27,29,33, + 1,24,5,22,30, + 23, + 4,6,9,17,20,23, + 32, + 17,22,29, + 22,33, + 11, + 36,23,25, + 2, + 22, + 26,31, + 13,22,33, + 30, + 4,1,24,5,6,10,14,35,16,17,19,20,22,37,28,30,31, + 31, + 21,29,33, + 7, + 23, + 35,26,31,34, + 22, + 4,15,28,31, + 35,26,29,34, + 21,22,37, + 26, + 18,29,33, + 7, + 34, + 21, + 1,24,5,6,7,22,26,28,33, + 32, + 6,22, + 4,1,24,5,6,9,10,11,35,16,17,19,20,2,26,27,29,30,31,32, + 4, + 3,4,1,24,5,6,8,9,10,11,12,14,15,35,16,17,19,20,2,36,23,37,26,27,28,29,30,31,32, + 22, + 2, + 4,26, + 1,24,5,34, + 18,33, + 36, + 0,4,5,7,13,16,17,19,21,22,27,33, + 17, + 0,4,7,18,33, + 1,24,5,34, + 22,33, + 29,34, + 34, + 1,24,5,16, + 0,7,13,2,33,34, + 0,34, + 7, + 0,4,21,23,34, + 27, + 0,7,34, + 10,11,23, + 6,21,23,34, + 4,1,24,5,6,9,10,14,17,19,20,37, + 21, + 22, + 0,6,7,8,18,21,22,32,33,34, + 22, + 4,9,34, + 23, + 0,4,35,22,33, + 33, + 7, + 4,9,10,11,15,16,22,37,26,33,34, + 0,4,7,35,16, + 2,23, + 4, + 2, + 0,4,13,35,18,21,26,29,34, + 6,7,9,10,13,16,19,22,27,29,32,33, + 22,33, + 7,2,22,33, + 0,4,7,13,21,22,33,34, + 4,6,8,35,17,21,2,29,33, + 11,12,34, + 33, + 13, + 32, + 1,24,5,6,7, + 30, + 21, + 4,1,24,5,10,14,35,16,17,19,20,22,28,31, + 14, + 0,2,34, + 13,21, + 6,35,26, + 21, + 21, + 13, + 4, + 22, + 36,31, + 23,25, + 25, + 22,33, + 4,5,7,10,14,15,19,21,36,27, + 4,14,34, + 15, + 33, + 22,33, + 22,36,37,29,33, + 22,33, + 27, + 3,1,24,5,15,16,22,28, + 36, + 13,19,22,29,33, + 22, + 17, + 35,34, + 10,2,22,33, + 0,4,7,8,13,19,21,22,29,33, + 7,8,13,17,21,22,26,29,32,33,34, + 4,14,15,16,34, + 7,16,34, + 16, + 7, + 22,33, + 3,4,7,15,21, + 34, + 22, + 4,16, + 4,14,15,16,17,19,20,21,36,34, + 33, + 17,21,34, + 17, + 14,16, + 7,22,29,33, + 4,18,2,22,27,29,32,33, + 6, + 0,13,18,21, + 16,26, + 0,4,1,24,5,7,10,35,17,2,22,23,26,29,30,31,33,34, + 10,2, + 4, + 26,31, + 6, + 4,7,15,18,21,22,33, + 30, + 33, + 4,16, + 7,13,33, + 0, + 9,2,22,26,31,33, + 4,13, + 31, + 2, + 0,4,18, + 0,3,4,1,24,5,6,7,8,9,10,12,13,14,15,16,17,19,20,21,2,22,36,23,25,37,26,27,28,29,31,32,33,34, + 37, + 0,21,27, + 27, + 8,27, + 4,6, + 26, + 33, + 21, + 4,22, + 6, + 7,2, + 29, + 33, + 33, + 33, + 4,10,14,16,19,27,29,30,32, + 3,4,1,24,5,7,8,12,13,14,15,16,20,22,26,27,28,31,33, + 13, + 29, + 13, + 14,19,36,34, + 2, + 36, + 22, + 4, + 22, + 7,34, + 4, + 1,24,5,34, + 7,2,22,33, + 22, + 0,22,29,33, + 19, + 22,34, + 22, + 3,4,7,15,18,21,22,33, + 0,3,4,7,13,35,18,2,22,29,31,33,34, + 20,34, + 12,20,28, + 22,33, + 33, + 4, + 21,34, + 8, + 4,5,27, + 29, + 13, + 2, + 21, + 14,15,27,30, + 1,24,5, + 7,8,29, + 8,29, + 22,33, + 6, + 22,29,33, + 7,8,22,26,29,32,34, + 33, + 36, + 2, + 4, + 4,20,2, + 2,23, + 0,10,11,13,19,21,2,22,23,31,33,34, + 4, + 1,24,5,26, + 4,15,21, + 25,30,34, + 17, + 23, + 0,4,22,29,33,34, + 22, + 0,36, + 4,10,12,14,16,19,20,27,28,29,32,34, + 16,23, + 13,22, + 33, + 4,15,27, + 23, + 22, + 0,9, + 6, + 3,4,1,24,5,6,9,10,11,14,15,35,16,17,19,20,2,23,26,27,29,30,31,32, + 17,21,34, + 4,6,29, + 22, + 6,7,21,23, + 3,1,24,5,12,14,15,20,28,34, + 4,19,27, + 14,19,23,29,34, + 0,14,21,37,30,34, + 33, + 11,2,23,25, + 4,2,23,34, + 23, + 22,33, + 3,1,24,5,7,16,22,28,33, + 2, + 4,7,14,18,26,34, + 4,9,10,14,16,28,29,31,34, + 0,4,22,26,32, + 0,3,4,5,6,7,8,10,12,13,15,35,17,18,19,21,2,22,36,25,37,26,28,29,31,32,33,34, + 6,23, + 17, + 21, + 37,26,31, + 34, + 1,24,5,19,28,31, + 0,3,4,7,12,15,18,20,21,2,28,33, + 4,9,14,20, + 29, + 16,21,29,32, + 4, + 3,4,1,24,5,8,9,11,12,15,35,17,19,20,2,23,25,26,28,31,32, + 34, + 23, + 1,24,5,22, + 33, + 7,2,22,33, + 0,3,4,7,13,35,17,18,21,2,22,26,29,31,33,34, + 13,21, + 33, + 4,26,31,33, + 0,3,4,7,35,17,26,29,31,33, + 3,5,6,8,12,14,15,35,25,28, + 6,34, + 22,33, + 4, + 29,33, + 34, + 10,2,36, + 23,25, + 4,21, + 2,23,34, + 4,1,24,5,6,8,9,11,14,35,17,20,2,23,37,26,31, + 0,3,4,6,7,11,13,35,18,19,2,22,36,23,26,31,33,34, + 6,23, + 13,15, + 3,12,15,20,22,28, + 7, + 7,33, + 21,2,36,25, + 13, + 34, + 18,22,33, + 17, + 21, + 4,7,21, + 21, + 17,22,37,26,33,34, + 4, + 4,7,15,22,27,33, + 23, + 6, + 3,12,14,15,19,20,28,34, + 27, + 2, + 18, + 7, + 4, + 34, + 37,26,31, + 7,27, + 16,27, + 25, + 26, + 28,34, + 25, + 4,7,18,21,22,36, + 0,6,36, + 19,25,26, + 29, + 37,33, + 8,22,29,32,34, + 22,23,33, + 3,4,1,24,5,6,8,9,11,12,15,35,17,20,2,23,37,26,28,31, + 7,8,22,29,30,33, + 18,21,22,26,33, + 13, + 4,21,37,30, + 4,14,22,23,26,29, + 16,17,19,21, + 7,15, + 10,14,2,22,36, + 16,19,20, + 4, + 14, + 3,4,8,12,14,15,16,19,37,28, + 4, + 14, + 35, + 0,4,7,13,15,35,18,21,22,33, + 5,35,17,22,23,29,31,34, + 22, + 6,22,33, + 7, + 4, + 10,18,22,33, + 4, + 2, + 0,4,22,32,33, + 13,21, + 21,34, + 13, + 13, + 3,17, + 4,16,19,20,22,28, + 22,36,29,30,32,33, + 8,22,29,33, + 7,22,29,33, + 32,34, + 29,34, + 0,19,26, + 16, + 7, + 2, + 7,23,29, + 0,37,26,31,34, + 36, + 3, + 36, + 22,33, + 7,14,21,23,27,33, + 0,4,1,24,6,8,9,10,13,15,16,17,19,20,21,2,22,23,25,37,26,27,29,30,32,34, + 14, + 7,8,29,32,34, + 0,4,13,33, + 33, + 8,18,22,26,27,29, + 4, + 6, + 0, + 33, + 17, + 26, + 4, + 4,22, + 6,13, + 7,13,22,36,26,33, + 3,5,6,7,8,12,15,35,22,25,28,33, + 4,10,14,16,19,27,29,30,32, + 18, + 0,18,22,33, + 18,22,33, + 4, + 13,22,33, + 4,26, + 4,11,13,2,22,33, + 0,3,4,7,13,17,22,31,32,33, + 22,33, + 4, + 37, + 23, + 4,1,24,5,6,8,9,11,14,35,17,20,2,23,37,26,31, + 16,29,30, + 15, + 6,7,19,21,22,27,29,33,34, + 34, + 32, + 31, + 0,3,7,13,35,22,26,31,33,34, + 33, + 4,1,24,5,6,9,10,17,20,23,25,26,27,34, + 2, + 14,25, + 21, + 7,8,29, + 16, + 4,36,23,26, + 6,21, + 22, + 11,22,23,29, + 6,23,29, + 33, + 4,1,24,5,7,9,10,12,13,14,35,17,18,19,2,22,23,26,28,29,30,31,32,33,34, + 4,1,24,6,9,10,14,35,16,17,20,36,23,25,37,27,30, + 6,18, + 4, + 20, + 33, + 16,19,20,36, + 8,26, + 3,4,1,24,5,6,8,9,10,11,12,16,17,19,20,2,23,25,37,26,27,28,29,31,32, + 2, + 6, + + diff --git a/doc/salome/gui/SUPERV/whxdata/whgdata0.xml b/doc/salome/gui/SUPERV/whxdata/whgdata0.xml new file mode 100755 index 0000000..0075ff8 --- /dev/null +++ b/doc/salome/gui/SUPERV/whxdata/whgdata0.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/salome/gui/SUPERV/whxdata/whglo.xml b/doc/salome/gui/SUPERV/whxdata/whglo.xml new file mode 100755 index 0000000..0f1cd68 --- /dev/null +++ b/doc/salome/gui/SUPERV/whxdata/whglo.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/doc/salome/gui/SUPERV/whxdata/whidx.xml b/doc/salome/gui/SUPERV/whxdata/whidx.xml new file mode 100755 index 0000000..ac66bb9 --- /dev/null +++ b/doc/salome/gui/SUPERV/whxdata/whidx.xml @@ -0,0 +1,4 @@ + + + + diff --git a/doc/salome/gui/SUPERV/whxdata/whtdata0.xml b/doc/salome/gui/SUPERV/whxdata/whtdata0.xml new file mode 100755 index 0000000..736f086 --- /dev/null +++ b/doc/salome/gui/SUPERV/whxdata/whtdata0.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/salome/gui/SUPERV/whxdata/whtoc.xml b/doc/salome/gui/SUPERV/whxdata/whtoc.xml new file mode 100755 index 0000000..a271ba7 --- /dev/null +++ b/doc/salome/gui/SUPERV/whxdata/whtoc.xml @@ -0,0 +1,4 @@ + + + + diff --git a/idl/SUPERV.idl b/idl/SUPERV.idl index f52bf13..4019616 100644 --- a/idl/SUPERV.idl +++ b/idl/SUPERV.idl @@ -227,6 +227,12 @@ This interface contains a set of methods necessary for management of a %graph. */ interface SuperG : Engines::Component, SALOMEDS::Driver { //////////////// + +//DumpPython is defined in SALOME_Component.idl (SALOMEDS::Driver) +// SALOMEDS::TMPFile DumpPython( in SALOMEDS::Study theStudy , +// in boolean isPublished , +// out boolean isValisScript ) ; + /*! Constructs a graph with possibility to read/edit it \param aGraph %aGraphName or %aGraphXmlFile @@ -827,19 +833,24 @@ This interface includes a set of methods used for management of the graphs in %S in SUPERV::Port InputPort ) ; /*! - Imports a graph into a file with XML format + Imports a graph from a file with XML format \param anXmlFile String parameter defining the name of the XML file. \return True, if the graph has been successfully imported. */ boolean Import( in string anXmlFile ) ; /*! - Exports a graph from a file with XML format + Exports a graph to files with XML format and Python format \param anXmlFile String parameter defining the name of the XML file. - \return True, if the graph has been successfully imported. + \return True, if the graph has been successfully exported. */ boolean Export( in string anXmlFile ) ; + /*! + Exports a graph to a string in python format + */ + string SavePY( in boolean importSuperV ) ; + /*! Returns True if the graph is read Only. */ diff --git a/resources/SUPERVCatalog.xml b/resources/SUPERVCatalog.xml index 03dedd6..575f774 100644 --- a/resources/SUPERVCatalog.xml +++ b/resources/SUPERVCatalog.xml @@ -16,7 +16,7 @@ Supervisor SUPERV ARS - 2.2.0 + 3.0.0 Supervisor component 1 ModuleSupervision.png diff --git a/src/GraphBase/DataFlowBase_ComputingNode.cxx b/src/GraphBase/DataFlowBase_ComputingNode.cxx index 8b1d3e7..5978f09 100644 --- a/src/GraphBase/DataFlowBase_ComputingNode.cxx +++ b/src/GraphBase/DataFlowBase_ComputingNode.cxx @@ -589,7 +589,8 @@ void GraphBase::ComputingNode::SetMacroDatas( GraphBase::Graph * aGraph , cdebug << " " << Name() << " " << anOutPort->PortName() << " " << anOutPort->PortType() << " " << anOutPort->Kind() << " " << anOutPort->PortStatus() << endl ; if ( anOutPort->IsDataConnected() ) { - aGraphOfMacroGraph->AddInputData( Name() , anInPort->PortName() , *(anOutPort->Value()) ) ; +//JR 30.03.2005 aGraphOfMacroGraph->AddInputData( Name() , anInPort->PortName() , *(anOutPort->Value()) ) ; + aGraphOfMacroGraph->AddInputData( Name() , anInPort->PortName() , anOutPort->Value() ) ; anOutPort->PortStatus( ExternConnected ) ; } } @@ -685,15 +686,15 @@ GraphBase::OutDataStreamPort * GraphBase::ComputingNode::AddOutDataStreamPort( c bool GraphBase::ComputingNode::CheckLoop(GraphBase::LoopNode * aLoopNode , GraphBase::EndOfLoopNode * anEndLoopNode ) const { - cdebug_in << Name() << "->GraphBase::ComputingNode::CheckLoop( " << aLoopNode->Name() << " , " + cdebug_in << Name() << "->ComputingNode::CheckLoop( " << aLoopNode->Name() << " , " << anEndLoopNode->Name() << ") LinkedNodesSize " << LinkedNodesSize() << endl; int i ; if ( LinkedNodesSize() == 0 && !IsDataFlowNode() && !IsDataStreamNode() ) { - cdebug_out << Name() << "->GraphBase::ComputingNode::CheckLoop( " << aLoopNode->Name() + cdebug_out << Name() << "->ComputingNode::CheckLoop( " << aLoopNode->Name() << " , " << anEndLoopNode->Name() << ") LinkedNodesSize " - << LinkedNodesSize() << " false" << endl; + << LinkedNodesSize() << " WARNING false" << endl; return false ; } // We check that all nodes linked to that node go to the end of LoopNode : @@ -702,14 +703,14 @@ bool GraphBase::ComputingNode::CheckLoop(GraphBase::LoopNode * aLoopNode , cdebug << i << ". " << Name() << " Linked to " << aNode->Name() << endl ; if ( !aNode->IsEndLoopNode() || aNode != anEndLoopNode ) { if ( !aNode->CheckLoop( aLoopNode , anEndLoopNode ) ) { - cdebug_out << Name() << "->GraphBase::ComputingNode::CheckLoop( " << aLoopNode->Name() + cdebug_out << Name() << "->ComputingNode::CheckLoop( " << aLoopNode->Name() << " , " << anEndLoopNode->Name() << ") LinkedNodesSize " - << LinkedNodesSize() << " false" << endl; + << LinkedNodesSize() << " WARNING false" << endl; return false ; } } } - cdebug_out << Name() << "->GraphBase::ComputingNode::CheckLoop( " << aLoopNode->Name() << " , " + cdebug_out << Name() << "->ComputingNode::CheckLoop( " << aLoopNode->Name() << " , " << anEndLoopNode->Name() << ") LinkedNodesSize " << LinkedNodesSize() << " true" << endl; return true ; @@ -717,15 +718,15 @@ bool GraphBase::ComputingNode::CheckLoop(GraphBase::LoopNode * aLoopNode , bool GraphBase::ComputingNode::CheckEndLoop(GraphBase::LoopNode * aLoopNode , GraphBase::EndOfLoopNode * anEndLoopNode ) const { - cdebug_in << Name() << "->GraphBase::ComputingNode::CheckEndLoop( " << aLoopNode->Name() << " , " + cdebug_in << Name() << "->ComputingNode::CheckEndLoop( " << aLoopNode->Name() << " , " << anEndLoopNode->Name() << ") LinkedFromNodesSize " << LinkedFromNodesSize() << endl; int i ; if ( LinkedFromNodesSize() == 0 ) { - cdebug_out << Name() << "->GraphBase::ComputingNode::CheckEndLoop( " << aLoopNode->Name() + cdebug_out << Name() << "->ComputingNode::CheckEndLoop( " << aLoopNode->Name() << " , " << anEndLoopNode->Name() << ") LinkedFromNodesSize " - << LinkedFromNodesSize() << " false" << endl; + << LinkedFromNodesSize() << " WARNING false" << endl; return false ; } // We have to check that all nodes linked from that node go to the beginning of LoopNode : @@ -734,19 +735,128 @@ bool GraphBase::ComputingNode::CheckEndLoop(GraphBase::LoopNode * aLoopNode , cdebug << i << ". " << Name() << " Linked from " << aNode->Name() << endl ; if ( !aNode->IsLoopNode() || aNode != aLoopNode ) { if ( !aNode->CheckEndLoop( aLoopNode , anEndLoopNode ) ) { - cdebug_out << Name() << "->GraphBase::ComputingNode::CheckEndLoop( " << aLoopNode->Name() + cdebug_out << Name() << "->ComputingNode::CheckEndLoop( " << aLoopNode->Name() << " , " << anEndLoopNode->Name() << ") LinkedFromNodesSize " - << LinkedFromNodesSize() << " false" << endl; + << LinkedFromNodesSize() << " WARNING false" << endl; return false ; } } } - cdebug_out << Name() << "->GraphBase::ComputingNode::CheckEndLoop( " << aLoopNode->Name() << " , " + cdebug_out << Name() << "->ComputingNode::CheckEndLoop( " << aLoopNode->Name() << " , " << anEndLoopNode->Name() << ") LinkedFromNodesSize " << LinkedFromNodesSize() << " true" << endl; return true ; } +bool GraphBase::ComputingNode::InitBranchOfSwitchDone(bool AllInit , + GraphBase::EndOfSwitchNode * anEndSwitchNode ) { + bool sts = BranchOfSwitchDone( false ) ; + if ( !sts && !AllInit && anEndSwitchNode != this ) { +// Common Node in branchs : + cdebug << Name() << "->ComputingNode::InitBranchOfSwitchDone WARNING false" + << endl ; + return false ; + } + int i ; + if ( !IsGOTONode() && anEndSwitchNode != this ) { + for ( i = 0 ; i < LinkedNodesSize() ; i++ ) { + GraphBase::ComputingNode * aNode ; + aNode = (GraphBase::ComputingNode * ) LinkedNodes( i ) ; + if ( !aNode->InitBranchOfSwitchDone( AllInit , anEndSwitchNode ) ) { + return false ; + } + } + } + return true ; +} + +bool GraphBase::ComputingNode::CheckSwitch(GraphBase::EndOfSwitchNode * anEndSwitchNode ) { + cdebug_in << Name() << "->ComputingNode::CheckSwitch( " + << anEndSwitchNode->Name() << " ) " << Kind() << endl; + if ( anEndSwitchNode == this ) { + } +// if it is a SwitchNode, continue the check at the corresponding EndSwitchNode + else if ( IsSwitchNode() ) { + GraphBase::EndOfSwitchNode * anOtherEndSwitchNode ; + anOtherEndSwitchNode = (GraphBase::EndOfSwitchNode * ) ((GraphBase::SwitchNode * ) this)->CoupledNode() ; + cdebug << Name() << "->ComputingNode::CheckSwitch will Check " + << anOtherEndSwitchNode->Name() << endl ; + if ( !anOtherEndSwitchNode->CheckSwitch( anEndSwitchNode ) ) { + cdebug_out << Name() << "->ComputingNode::CheckSwitch " + << anOtherEndSwitchNode->Name() << " WARNING false" << endl; + return false ; + } + } + else { + int i ; + for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) { + GraphBase::OutPort * anOutPort = GetChangeNodeOutPort( i ) ; + if ( !anOutPort->IsDataStream() ) { + int j ; + for ( j = 0 ; j < anOutPort->InPortsSize() ; j++ ) { + GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( j ) ; + if ( !anInPort->IsDataStream() ) { + GraphBase::ComputingNode * aNode ; + aNode = GraphOfNode()->GetChangeGraphNode( anInPort->NodeName() ) ; + GraphBase::LoopNode * aLoopNode = NULL ; + GraphBase::EndOfLoopNode * aEndLoopNode = NULL ; + if ( IsLoopNode() ) { + aEndLoopNode = (GraphBase::EndOfLoopNode * ) ((GraphBase::LoopNode * ) this)->CoupledNode() ; + cdebug << Name() << "->ComputingNode::CheckSwitch LoopNode " << Name() << " coupled to " + << aEndLoopNode << " " << aEndLoopNode->Name() << " aNode " << aNode << endl ; + } + else if ( IsEndLoopNode() ) { + aLoopNode = (GraphBase::LoopNode * ) ((GraphBase::EndOfLoopNode * ) this)->CoupledNode() ; + cdebug << Name() << "->ComputingNode::CheckSwitch EndLoopNode " << Name() + << " coupled to " + << aLoopNode << " " << aLoopNode->Name() << " aNode " << aNode << endl ; + } + if ( aNode == NULL ) { + cdebug << Name() << "->ComputingNode::CheckSwitch ignore " + << anInPort->NodeName() << "( " << anInPort->PortName() << " )" << endl ; + } + else if ( aNode == anEndSwitchNode ) { + ((GraphBase::EndOfSwitchNode * ) aNode)->DecrEndSwitchInPortLinked( anInPort ) ; + } + else if ( aNode->BranchOfSwitchDone() ) { + cdebug << Name() << "->ComputingNode::CheckSwitch will NOT Check " + << anInPort->NodeName() << "( " << anInPort->PortName() << " ) : already checked" + << endl ; + } + else if ( IsLoopNode() && aNode == aEndLoopNode ) { + cdebug << Name() << "->ComputingNode::CheckSwitch will NOT Check " + << anInPort->NodeName() << "( " << anInPort->PortName() << " )" << endl ; + } + else if ( IsEndLoopNode() && aNode == aLoopNode ) { + cdebug << Name() << "->ComputingNode::CheckSwitch will NOT Check " + << anInPort->NodeName() << "( " << anInPort->PortName() << " )" << endl ; + } + else if ( aNode->IsGOTONode() ) { + cdebug << Name() << "->ComputingNode::CheckSwitch will NOT Check " + << anInPort->NodeName() << "( " << anInPort->PortName() << " )" << endl ; + anEndSwitchNode->SetSwitchWithGOTO() ; + } + else { + cdebug << Name() << "->ComputingNode::CheckSwitch will Check " + << anInPort->NodeName() << "( " << anInPort->PortName() << " )" << endl ; + if ( !aNode->CheckSwitch( anEndSwitchNode ) ) { + cdebug_out << Name() << "->ComputingNode::CheckSwitch " + << anEndSwitchNode->Name() << " WARNING false" << endl; + return false ; + } +// aNode->BranchOfSwitchDone( true ) ; + } + } + } + } + } + } + BranchOfSwitchDone( true ) ; + cdebug_out << Name() << "->ComputingNode::CheckSwitch BranchOfSwitchDone == true " + << anEndSwitchNode->Name() << " true" << endl; + return true ; +} + #include #include #include @@ -1207,6 +1317,7 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName , const ListOfFuncName FuncNames , const ListOfPythonFunctions PythonFunctions , int XCoordinate , int YCoordinate ) const { + cdebug_in << "ComputingNode::SavePY " << Name() << endl ; // san - Presumably, data stream graphs should be always saved with kind = DataStreamGraph // JR : the bug was at line 927 : && HasDataStream() != 0 was missing if ( IsDataFlowNode() || ( IsDataStreamNode() && HasDataStream() == 0 ) ) { @@ -1215,7 +1326,7 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName , f << " " << Name() << ".SetCoupled( '" << ((GraphBase::GOTONode * ) this)->CoupledNodeName() << "' )" << endl ; } - } + } else if ( IsDataStreamNode() && HasDataStream() != 0 ) { f << " " << Name() << " = StreamGraph( '" << Name() << "' )" << endl ; long Timeout ; @@ -1312,6 +1423,8 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName , // strcpy( EndName , "End" ) ; // strcat( EndName , Name() ) ; char * EndName = aCoupledNode->Name() ; + cdebug << "ComputingNode::SavePY Node " << Name() << " EndName " << EndName + << endl ; if ( IsLoopNode() ) { int i ; SUPERV::ListOfStrings aPyMore = *PythonFunctions[1] ; @@ -1499,7 +1612,11 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName , } } } - delete [] EndName ; + cdebug << "ComputingNode::SavePY Node " << Name() << " EndName " << EndName + << endl ; +// PAL8507 +//JR 24.02.2005 Debug !!!... : I should not delete myself : what a stupid thing ! +// delete [] EndName ; } } @@ -1627,6 +1744,9 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName , } } + cdebug_out << "ComputingNode::SavePY " ; + NodeInfo( *_fdebug ) ; + cdebug << endl ; return true ; } diff --git a/src/GraphBase/DataFlowBase_ComputingNode.hxx b/src/GraphBase/DataFlowBase_ComputingNode.hxx index 35145a8..ba8bd6a 100644 --- a/src/GraphBase/DataFlowBase_ComputingNode.hxx +++ b/src/GraphBase/DataFlowBase_ComputingNode.hxx @@ -26,6 +26,7 @@ namespace GraphBase { class LoopNode ; class EndOfLoopNode ; + class EndOfSwitchNode ; class ComputingNode : public StreamNode { @@ -159,9 +160,12 @@ namespace GraphBase { // const SALOME_ModuleCatalog::Service * Service() const ; SUPERV::SDate FirstCreation() const ; SUPERV::SDate LastModification() const ; - char* Author() const { return my_strdup( _Author ) ; } ; - char* EditorRelease() const { return my_strdup( _EditorRelease ) ; } ; - char * Comment() const { return my_strdup( _Comment ) ; } ; +//JR 17.02.2005 Memory Leak char* Author() const { return my_strdup( _Author ) ; } ; + char* Author() const { return _Author ; } ; +//JR 17.02.2005 Memory Leak char* EditorRelease() const { return my_strdup( _EditorRelease ) ; } ; + char* EditorRelease() const { return _EditorRelease ; } ; +//JR 17.02.2005 Memory Leak char * Comment() const { return my_strdup( _Comment ) ; } ; + char * Comment() const { return _Comment ; } ; int XCoordinate() const { return _X ; } ; int YCoordinate() const { return _Y ; } ; @@ -270,6 +274,8 @@ namespace GraphBase { GraphBase::EndOfLoopNode * anEndLoopNode ) const ; bool CheckEndLoop(GraphBase::LoopNode * aLoopNode , GraphBase::EndOfLoopNode * anEndLoopNode ) const ; + bool InitBranchOfSwitchDone( bool AllInit , GraphBase::EndOfSwitchNode * anEndSwitchNode ) ; + bool CheckSwitch(GraphBase::EndOfSwitchNode * anEndSwitchNode ) ; // const GraphBase::ListOfParameters * GetListOfParameters() const ; diff --git a/src/GraphBase/DataFlowBase_DataNode.cxx b/src/GraphBase/DataFlowBase_DataNode.cxx index fa2e10f..b0644c8 100644 --- a/src/GraphBase/DataFlowBase_DataNode.cxx +++ b/src/GraphBase/DataFlowBase_DataNode.cxx @@ -79,8 +79,9 @@ void GraphBase::DataNode::DataService( CORBA::ORB_ptr ORB , DefPortsOfNode( ORB , aService , NamePtr() , Kind() , Graph_prof_debug , Graph_fdebug ) ; - if ( _Created ) + if ( _Created ) { delete _DataFlowDataPorts ; + } SALOME_ModuleCatalog::Service aReversedService ; aReversedService.ServiceName = aService.ServiceName ; aReversedService.ServiceinParameter = aService.ServiceoutParameter ; diff --git a/src/GraphBase/DataFlowBase_DataPort.cxx b/src/GraphBase/DataFlowBase_DataPort.cxx index 1f6d837..c2f9e8f 100644 --- a/src/GraphBase/DataFlowBase_DataPort.cxx +++ b/src/GraphBase/DataFlowBase_DataPort.cxx @@ -33,7 +33,7 @@ using namespace std; GraphBase::DataPort::DataPort() : Port() { pthread_mutex_init( &_MutexWait , NULL ) ; - _State = SUPERV::UndefinedState ; + _PortState = SUPERV::UndefinedState ; _Done = false ; InitialValues( CORBA::Any() ) ; } @@ -44,7 +44,7 @@ GraphBase::DataPort::DataPort( const char *const * NodeName , const SALOME_ModuleCatalog::DataStreamDependency aDependency ) : Port( NodeName , aserviceParameter , aKind , aDependency ) { pthread_mutex_init( &_MutexWait , NULL ) ; - _State = SUPERV::UndefinedState ; + _PortState = SUPERV::UndefinedState ; _Done = false ; InitialValues( CORBA::Any() ) ; } @@ -54,7 +54,8 @@ GraphBase::DataPort::~DataPort() { void GraphBase::DataPort::InitialValues(CORBA::Any aValue ) { _theValue = new CORBA::Any( aValue ) ; - string _Type = CORBA::string_dup(GetServicesParameter().Parametertype) ; +//JR 24.02.2005 Memory Leak string _Type = CORBA::string_dup(GetServicesParameter().Parametertype) ; + string _Type = string( GetServicesParameter().Parametertype ) ; const char * Type = _Type.c_str(); CORBA::Any InitialValue ; cdebug << "InitialValues " << NodeName() << " " << PortName() << " " << PortType() @@ -113,6 +114,7 @@ void GraphBase::DataPort::Value( const CORBA::Any & aDataValue ) { Value( aValue ) ; } +#define ValueTrace 0 void GraphBase::DataPort::Value( const CORBA::Any * aDataValue ) { // cdebug << pthread_self() << " Value(aDataValue) --> pthread_mutex_lock " << &_MutexWait // << endl ; @@ -125,20 +127,27 @@ void GraphBase::DataPort::Value( const CORBA::Any * aDataValue ) { delete _theValue ; - string _Type = CORBA::string_dup( GetServicesParameter().Parametertype ) ; - const char * Type = _Type.c_str() ; +//JR 21.02.2005 Debug Memory leak : string _Type = CORBA::string_dup( GetServicesParameter().Parametertype ) ; +// const char * Type = _Type.c_str() ; + const char * Type = GetServicesParameter().Parametertype ; _Value = &_theValue ; +#if ValueTrace cdebug << "NewValue " << NodeName() << " " << PortName() << " " << PortType() << " : " << aDataValue << " kind " << aDataValue->type()->kind() << " " ; +#endif switch (aDataValue->type()->kind()) { // Input Value case CORBA::tk_string: { // Input string Value char * t; *aDataValue >>= t; +#if ValueTrace cdebug << t << " (string)" ; +#endif if ( !strcmp( Type , "string" ) ) { // SuperVision Value _theValue = aDataValue ; *_theValue >>= t; +#if ValueTrace cdebug << " == Value( " << t << ") (string)"; +#endif } else { CORBA::Any * theValue = new CORBA::Any() ; @@ -148,14 +157,18 @@ void GraphBase::DataPort::Value( const CORBA::Any * aDataValue ) { sscanf( t , "%ld" , &l ) ; *theValue <<= l ; *theValue >>= l; +#if ValueTrace cdebug << " --> Value( " << l << ") (long) kind " << theValue->type()->kind() ; +#endif } else if ( !strcmp( Type , "float" ) || !strcmp( Type , "double" ) ) { double d ; sscanf( t , "%lf" , &d ) ; *theValue <<= d ; *theValue >>= d; +#if ValueTrace cdebug << " --> Value( " << d << ") (double) kind " << theValue->type()->kind() ; +#endif } else { // Default CORBA::Object_ptr ObjRef ; @@ -167,24 +180,32 @@ void GraphBase::DataPort::Value( const CORBA::Any * aDataValue ) { *theValue <<= CORBA::Object::_nil() ; } *theValue >>= ObjRef ; +#if ValueTrace cdebug << " --> Value( " << ObjectToString( ObjRef ) << ") (object reference) kind " << theValue->type()->kind() ; +#endif } _theValue = theValue ; *_Value = theValue ; +//JR 21.02.2005 Debug Memory leak : + delete aDataValue ; } break; } case CORBA::tk_long: { // Input long Value long l; *aDataValue >>= l; +#if ValueTrace cdebug << "Value( " << l << ") (long)"; +#endif if ( !strcmp( Type , "boolean" ) || !strcmp( Type , "char" ) || !strcmp( Type , "short" ) || !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) { // SuperVision Value _theValue = aDataValue ; *_Value = aDataValue ; *_theValue >>= l; +#if ValueTrace cdebug << " == Value( " << l << ") (long)"; +#endif } else { CORBA::Any * theValue = new CORBA::Any() ; @@ -194,35 +215,47 @@ void GraphBase::DataPort::Value( const CORBA::Any * aDataValue ) { *theValue <<= t ; char *tt ; *theValue >>= tt ; +#if ValueTrace cdebug << " --> Value( " << t << ") (string) kind " << theValue->type()->kind() ; +#endif } else if ( !strcmp( Type , "float" ) || !strcmp( Type , "double" ) ) { double d = l ; *theValue <<= d ; *theValue >>= d ; +#if ValueTrace cdebug << " --> Value( " << d << ") (double) kind " << theValue->type()->kind() ; +#endif } else { // Default CORBA::Object_ptr ObjRef ; *theValue <<= CORBA::Object::_nil() ; *theValue >>= ObjRef ; +#if ValueTrace cdebug << " --> Value( " << ObjectToString( ObjRef ) << ") (object reference) kind " << theValue->type()->kind() ; +#endif } _theValue = theValue ; *_Value = theValue ; +//JR 21.02.2005 Debug Memory leak : + delete aDataValue ; } break; } case CORBA::tk_double: { // Input double Value double d; *aDataValue >>= d; +#if ValueTrace cdebug << "Value( " << d << ") (double)"; +#endif if ( !strcmp( Type , "float" ) || !strcmp( Type , "double" ) ) { // SuperVision Value _theValue = aDataValue ; *_Value = aDataValue ; *_theValue >>= d; +#if ValueTrace cdebug << " == Value( " << d << ") (double)"; +#endif } else { CORBA::Any * theValue = new CORBA::Any() ; @@ -232,31 +265,41 @@ void GraphBase::DataPort::Value( const CORBA::Any * aDataValue ) { *theValue <<= t ; char *tt ; *theValue >>= tt ; +#if ValueTrace cdebug << " --> Value( " << t << ") (string) kind " << theValue->type()->kind() ; +#endif } 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; +#if ValueTrace cdebug << " --> Value( " << l << ") (long) kind " << theValue->type()->kind() ; +#endif } else { // Default CORBA::Object_ptr ObjRef ; *theValue <<= CORBA::Object::_nil() ; *theValue >>= ObjRef ; +#if ValueTrace cdebug << " --> Value( " << ObjectToString( ObjRef ) << ") (object reference) kind " << theValue->type()->kind() ; +#endif } _theValue = theValue ; *_Value = theValue ; +//JR 21.02.2005 Debug Memory leak : + delete aDataValue ; } break; } case CORBA::tk_objref: { // Input objref Value CORBA::Object_ptr obj ; *aDataValue >>= obj; +#if ValueTrace cdebug << "Value( " << ObjectToString( obj ) << ") (object reference)"; +#endif if ( strcmp( Type , "string" ) && strcmp( Type , "boolean" ) && strcmp( Type , "char" ) && strcmp( Type , "short" ) && strcmp( Type , "long" ) && @@ -264,30 +307,40 @@ void GraphBase::DataPort::Value( const CORBA::Any * aDataValue ) { _theValue = aDataValue ; *_Value = aDataValue ; *_theValue >>= obj; +#if ValueTrace cdebug << " == Value( " << ObjectToString( obj ) << ") (object reference)"; +#endif } else { CORBA::Any * theValue = new CORBA::Any() ; if ( !strcmp( Type , "string" ) ) { *theValue <<= ObjectToString( obj ) ; *theValue >>= obj ; +#if ValueTrace cdebug << " --> Value( " << ObjectToString( obj ) << ") (string) kind " << theValue->type()->kind() ; +#endif } 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; +#if ValueTrace cdebug << " --> Value( " << l << ") (long) kind " << theValue->type()->kind() ; +#endif } else if ( !strcmp( Type , "float" ) || !strcmp( Type , "double" ) ) { double d = (double ) 0. ; *theValue <<= d ; *theValue >>= d; +#if ValueTrace cdebug << " --> Value( " << d << ") (double) kind " << theValue->type()->kind() ; +#endif } _theValue = theValue ; *_Value = theValue ; +//JR 21.02.2005 Debug Memory leak : + delete aDataValue ; } break; } @@ -297,7 +350,9 @@ void GraphBase::DataPort::Value( const CORBA::Any * aDataValue ) { break; } } +#if ValueTrace cdebug << endl ; +#endif if ( pthread_mutex_unlock( &_MutexWait ) ) { perror( "unlock DataValue" ) ; exit( 0 ) ; @@ -307,42 +362,9 @@ void GraphBase::DataPort::Value( const CORBA::Any * aDataValue ) { } -void GraphBase::DataPort::Value( const CORBA::Any ** aDataSharedValue ) { - delete _theValue ; - _theValue = *aDataSharedValue ; - _Value = aDataSharedValue ; -// Done( true ) ; - -#if 0 - MESSAGE( NodePortName() << " : " << hex << _Value << " " ); - switch (_theValue->type()->kind()) { - case CORBA::tk_string: - char * t; - *_theValue >>= t; - MESSAGE( "Value( " << t << ") (string)"); - break; - case CORBA::tk_double: - double d; - *_theValue >>= d; - MESSAGE( "Value( " << d << ") (double)"); - break; - case CORBA::tk_long: - long l; - *_theValue >>= l; - MESSAGE( "Value( " << l << ") (long)"); - break; - case CORBA::tk_objref: - MESSAGE( "Value( " << ") (object reference)"); - break; - default: - MESSAGE( "Value" << " (other(tk_string,tk_double,tk_long,tk_objref)) ERROR"); - break; - } - MESSAGE(); -#endif -} - -CORBA::Any const * GraphBase::DataPort::Value() const { +// PAL8506 +//JR 30.03.2005 Memory Leak + Debug(crash) CORBA::Any const * GraphBase::DataPort::Value() const { +const CORBA::Any GraphBase::DataPort::Value() const { pthread_mutex_t * aMutexWait = (pthread_mutex_t *) &_MutexWait ; // cdebug << pthread_self() << " Value() --> pthread_mutex_lock " << aMutexWait << endl ; if ( pthread_mutex_lock( aMutexWait ) ) { @@ -351,7 +373,8 @@ CORBA::Any const * GraphBase::DataPort::Value() const { } // cdebug << pthread_self() << " Value() --> pthread_mutex_locked " << aMutexWait << endl ; const CORBA::Any *const Value = *_Value ; - CORBA::Any * theValue ; +//JR 30.03.2005 CORBA::Any * theValue ; + CORBA::Any theValue ; // cdebug << pthread_self() << " Value " << NodeName() << " " << PortName() << " " // << PortType() << " _Value " << _Value << " *_Value " << *_Value << " Value->type " // << Value->type() ; @@ -361,24 +384,30 @@ CORBA::Any const * GraphBase::DataPort::Value() const { else { // cdebug << " Null" << endl ; } - if ( Done() ) { - theValue = new CORBA::Any( *Value ) ; - switch ( theValue->type()->kind() ) { + if ( PortDone() ) { +//JR 21.02.2005 Debug Memory leak : theValue = new CORBA::Any( *Value ) ; +//JR 30.03.2005 theValue = (CORBA::Any * ) Value ; + theValue = *Value ; +//JR 30.03.2005 switch ( theValue->type()->kind() ) { + switch ( theValue.type()->kind() ) { case CORBA::tk_string: { char * t; - *theValue >>= t; +//JR 30.03.2005 *theValue >>= t; + theValue >>= t; // cdebug << "GraphBase::DataPort::Value() : " << t << " (string) " << endl ; break; } case CORBA::tk_double: { double d; - *theValue >>= d; +//JR 30.03.2005 *theValue >>= d; + theValue >>= d; // cdebug << "GraphBase::DataPort::Value() : " << d << " (double) " << endl ; break; } case CORBA::tk_long: { long l; - *theValue >>= l; +//JR 30.03.2005 *theValue >>= l; + theValue >>= l; // cdebug << "GraphBase::DataPort::Value() : " << l << " (long) " << endl ; break; } @@ -386,7 +415,8 @@ CORBA::Any const * GraphBase::DataPort::Value() const { CORBA::Object_ptr obj ; char * retstr ; try { - *theValue >>= obj ; +//JR 30.03.2005 *theValue >>= obj ; + theValue >>= obj ; retstr = ObjectToString( obj ); // cdebug << "GraphBase::DataPort::Value() : " << retstr // << "(object reference) " << endl; @@ -405,7 +435,9 @@ CORBA::Any const * GraphBase::DataPort::Value() const { } else { // cdebug << "GraphBase::DataPort::InitialValue() " << endl ; - theValue = new CORBA::Any( *Value ) ; +//JR 21.02.2005 Debug Memory leak : theValue = new CORBA::Any( *Value ) ; +//JR 30.03.2005 theValue = (CORBA::Any * ) Value ; + theValue = *Value ; } if ( pthread_mutex_unlock( aMutexWait ) ) { perror( "unlock DataValue" ) ; @@ -418,7 +450,6 @@ CORBA::Any const * GraphBase::DataPort::Value() const { bool GraphBase::DataPort::BoolValue() const { bool RetVal = false ; - long val ; pthread_mutex_t * aMutexWait = (pthread_mutex_t *) &_MutexWait ; // cdebug << pthread_self() << " BoolValue() --> pthread_mutex_lock " << aMutexWait << endl ; if ( pthread_mutex_lock( aMutexWait ) ) { @@ -428,6 +459,14 @@ bool GraphBase::DataPort::BoolValue() const { // cdebug << pthread_self() << " BoolValue() --> pthread_mutex_locked " << aMutexWait // << endl ; if ( (*_Value)->type()->kind() == CORBA::tk_long ) { + long val ; + **_Value >>= val ; + if ( val ) { + RetVal = true ; + } + } + else if ( (*_Value)->type()->kind() == CORBA::tk_boolean ) { + bool val ; **_Value >>= val ; if ( val ) { RetVal = true ; @@ -437,26 +476,21 @@ bool GraphBase::DataPort::BoolValue() const { perror( "unlock DataValue" ) ; exit( 0 ) ; } -// cdebug << pthread_self() << " BoolValue() --> pthread_mutex_unlocked " << aMutexWait -// << endl ; +// cdebug << pthread_self() << " " << NodeName() << "( " << PortName() << " ) BoolValue " << RetVal << endl ; return RetVal ; } -const CORBA::Any ** GraphBase::DataPort::ValuePtr() const { - return _Value ; -} - void GraphBase::DataPort::StringValue(ostream & f ) const { pthread_mutex_t * aMutexWait = (pthread_mutex_t *) &_MutexWait ; -// cdebug << pthread_self() << " StringValue() --> pthread_mutex_lock " << aMutexWait -// << endl ; +// cdebug_in << pthread_self() << " StringValue() --> pthread_mutex_lock " << aMutexWait +// << endl ; if ( pthread_mutex_lock( aMutexWait ) ) { perror( "lock DataValue" ) ; exit( 0 ) ; } // cdebug << pthread_self() << " StringValue() --> pthread_mutex_locked " << aMutexWait // << endl ; - if ( Done() ) { + if ( PortDone() ) { // cdebug << "StringValue " << NodeName() << " " << PortName() << " " << PortType() // << " _Value " << _Value << " *_Value " // << *_Value << " " << endl ; @@ -493,14 +527,14 @@ void GraphBase::DataPort::StringValue(ostream & f ) const { } } else { - f << " Default (undefined) NOT DONE" ; + f << " Default (undefined) DATAPORT NOT DONE" ; } if ( pthread_mutex_unlock( aMutexWait ) ) { perror( "unlock DataValue" ) ; exit( 0 ) ; } -// cdebug << pthread_self() << " StringValue() --> pthread_mutex_unlocked " << aMutexWait -// << endl ; +// cdebug_out << pthread_self() << " StringValue() --> pthread_mutex_unlocked " << aMutexWait +// << endl ; } diff --git a/src/GraphBase/DataFlowBase_DataPort.hxx b/src/GraphBase/DataFlowBase_DataPort.hxx index 0dd2c29..89bf02a 100644 --- a/src/GraphBase/DataFlowBase_DataPort.hxx +++ b/src/GraphBase/DataFlowBase_DataPort.hxx @@ -40,10 +40,14 @@ namespace GraphBase { CORBA::Any const * _InitialValue ; CORBA::Any const * _theValue ; CORBA::Any const * * _Value ; - SUPERV::GraphState _State ; +//JR 08.03.2005 : the fields (and corresponding methods) _PortState and _Done are redundant +// probably. That should be clarified when I shall have time enough + SUPERV::GraphState _PortState ; bool _Done ; pthread_mutex_t _MutexWait ; + void Value( const CORBA::Any * aValue ) ; + public : DataPort() ; @@ -55,21 +59,22 @@ namespace GraphBase { void InitialValues(CORBA::Any aValue ) ; void Value (const CORBA::Any & aValue ) ; - void Value( const CORBA::Any * aValue ) ; - void Value( const CORBA::Any ** aValue ) ; - CORBA::Any const * Value() const ; +// void Value( const CORBA::Any * aValue ) ; +// void Value( const CORBA::Any ** aValue ) ; +// CORBA::Any const * Value() const ; + const CORBA::Any Value() const ; bool BoolValue() const ; - const CORBA::Any ** ValuePtr() const ; +// const CORBA::Any ** ValuePtr() const ; - void State( SUPERV::GraphState aState ) { - _State = aState ; } ; - SUPERV::GraphState State() { return _State ; } ; + void PortState( SUPERV::GraphState aPortState ) { + _PortState = aPortState ; } ; + SUPERV::GraphState PortState() { return _PortState ; } ; - void Done( bool aDone ) { + void PortDone( bool aDone ) { // cdebug << "ChgDone(.) " << NodeName() << " " << PortName() << " " // << _Done << " -> " << aDone << endl ; _Done = aDone ; } ; - const bool Done() const { return ( _Done ) ; } ; + const bool PortDone() const { return ( _Done ) ; } ; void StringValue(ostream & f) const ; diff --git a/src/GraphBase/DataFlowBase_EndOfSwitchNode.cxx b/src/GraphBase/DataFlowBase_EndOfSwitchNode.cxx index dc3e23c..867cafd 100644 --- a/src/GraphBase/DataFlowBase_EndOfSwitchNode.cxx +++ b/src/GraphBase/DataFlowBase_EndOfSwitchNode.cxx @@ -74,3 +74,49 @@ GraphBase::EndOfSwitchNode::~EndOfSwitchNode() { // delete [] _Comment; } +bool GraphBase::EndOfSwitchNode::DecrEndSwitchInPortLinked( GraphBase::InPort * anInPort ) { + bool RetVal = true ; +// if ( !anInPort->BranchOfSwitchLinked() ) { + RetVal = anInPort->BranchOfSwitchLinked( true ) ; +//JR 16.02.2005 : except for DefaultPort + if ( !anInPort->IsGate() ) { + _EndSwitchInPortLinkedNumber -= 1 ; + } + cdebug << Name() + << "->EndOfSwitchNode::DecrEndSwitchInPortLinked EndSwitchInPortLinkedNumber " + << _EndSwitchInPortLinkedNumber << " InPort '" << anInPort->PortName() << "' of " + << anInPort->NodeName() << " RetVal " << RetVal << endl ; +// } +// else { +// cdebug << "EndOfSwitchNode::DecrEndSwitchInPortLinked EndSwitchInPortLinkedNumber " +// << _EndSwitchInPortLinkedNumber << " InPort " << anInPort->PortName() +// << " already done RetVal " << RetVal << endl ; +// } + return RetVal ; +} + +bool GraphBase::EndOfSwitchNode::CheckEndSwitchInPortsLinked() { +// Check that all inports of the EndSwitchNode will have a value only once + if ( _EndSwitchInPortLinkedNumber != 0 ) { + cdebug << Name() + << "->EndOfSwitchNode::CheckEndSwitchInPortsLinked EndSwitchInPortLinkedNumber " + << _EndSwitchInPortLinkedNumber << endl ; + if ( !SwitchWithGOTO() ) { + return false ; // Some InPort is not linked + } + } +// Check that all inports of the EndSwitchNode are reachable in that branch(es) + int i ; + for ( i = 0 ; i < GetNodeInPortsSize()-1 ; i++ ) { + if ( !GetChangeNodeInPort( i )->IsDataStream() && + !GetChangeNodeInPort( i )->BranchOfSwitchLinked() ) { + cdebug << Name() << "->EndOfSwitchNode::CheckEndSwitchInPortsLinked " + << GetNodeInPort( i )->PortName() << " have no link in that branch" + << endl ; + if ( !SwitchWithGOTO() ) { + return false ; // that InPort is not linked + } + } + } + return true ; // Ok : all InPorts are linked +} diff --git a/src/GraphBase/DataFlowBase_EndOfSwitchNode.hxx b/src/GraphBase/DataFlowBase_EndOfSwitchNode.hxx index f362634..93e2599 100644 --- a/src/GraphBase/DataFlowBase_EndOfSwitchNode.hxx +++ b/src/GraphBase/DataFlowBase_EndOfSwitchNode.hxx @@ -19,6 +19,9 @@ namespace GraphBase { class EndOfSwitchNode : public GOTONode { private: + + int _EndSwitchInPortLinkedNumber ; // For Check from Branches to EndOfSwitch links + bool _SwitchWithGOTO ; public: @@ -41,6 +44,20 @@ namespace GraphBase { ofstream * Graph_fdebug = NULL ) ; virtual ~EndOfSwitchNode() ; + void InitEndSwitchInPortLinked() { // without StreamInPorts and Default + _EndSwitchInPortLinkedNumber = GetNodeInPortsSize() - DataStreamInPortsNumber() - 1 ; + _SwitchWithGOTO = false ; + int i ; + for ( i = 0 ; i < GetNodeInPortsSize()-1 ; i++ ) { + GetChangeNodeInPort( i )->BranchOfSwitchLinked( false ) ; + } } ; + bool DecrEndSwitchInPortLinked( GraphBase::InPort * anInPort ) ; + void SetSwitchWithGOTO() { + _SwitchWithGOTO = true ; } ; + bool SwitchWithGOTO() { + return _SwitchWithGOTO ; } ; + bool CheckEndSwitchInPortsLinked() ; + }; }; diff --git a/src/GraphBase/DataFlowBase_FactoryNode.hxx b/src/GraphBase/DataFlowBase_FactoryNode.hxx index 0212946..d499287 100644 --- a/src/GraphBase/DataFlowBase_FactoryNode.hxx +++ b/src/GraphBase/DataFlowBase_FactoryNode.hxx @@ -63,12 +63,15 @@ namespace GraphBase { Engines::Component_var Component() const { return _ObjComponent ; } ; void SetComponent(Engines::Component_var anObjComponent) { _ObjComponent = anObjComponent ; } ; - char * ComponentName() const { return my_strdup( _ComponentName ) ; } ; - char * InterfaceName() const { return my_strdup( _InterfaceName ) ; } ; +//JR 17.02.2005 Memory Leak char * ComponentName() const { return my_strdup( _ComponentName ) ; } ; + char * ComponentName() const { return _ComponentName ; } ; +//JR 17.02.2005 Memory Leak char * InterfaceName() const { return my_strdup( _InterfaceName ) ; } ; + char * InterfaceName() const { return _InterfaceName ; } ; char * Computer() const { // cdebug_in << "GraphBase::FactoryNode::Computer returns '" << _Computer << "'" // << endl; - return my_strdup( _Computer ) ; } ; +//JR 17.02.2005 Memory Leak return my_strdup( _Computer ) ; } ; + return _Computer ; } ; bool ComponentName( const char * aComponentName ) ; bool InterfaceName( const char * anInterfaceName ) ; diff --git a/src/GraphBase/DataFlowBase_GOTONode.cxx b/src/GraphBase/DataFlowBase_GOTONode.cxx index c7e779e..b01509e 100644 --- a/src/GraphBase/DataFlowBase_GOTONode.cxx +++ b/src/GraphBase/DataFlowBase_GOTONode.cxx @@ -93,40 +93,53 @@ GraphBase::GOTONode::~GOTONode() { // delete [] _Comment; } +#define CoupledNodeTrace 0 void GraphBase::GOTONode::CoupledNode( GraphBase::InLineNode * aCoupledNode ) { +#if CoupledNodeTrace cdebug << this << " " << Name() << " GraphBase::GOTONode::CoupledNode( " ; +#endif if ( aCoupledNode ) { CoupledNodeName( aCoupledNode->Name() ) ; +#if CoupledNodeTrace cdebug << aCoupledNode->Name() ; +#endif } else { +#if CoupledNodeTrace cdebug << "NULL" ; +#endif } +#if CoupledNodeTrace cdebug << " )" << endl ; +#endif _CoupledNode = aCoupledNode ; } const GraphBase::InLineNode * GraphBase::GOTONode::CoupledNode() const { -// cdebug << this << " " << Name() << " GraphBase::GOTONode::CoupledNode() --> " ; -// if ( _CoupledNode ) { -// cdebug << _CoupledNode->Name() ; -// } -// else { -// cdebug << "NULL" ; -// } -// cdebug << endl ; +#if CoupledNodeTrace + cdebug << this << " " << Name() << " GraphBase::GOTONode::CoupledNode() --> " ; + if ( _CoupledNode ) { + cdebug << _CoupledNode->Name() ; + } + else { + cdebug << "NULL" ; + } + cdebug << endl ; +#endif return _CoupledNode ; } GraphBase::InLineNode * GraphBase::GOTONode::CoupledNode() { -// cdebug << this << " " << Name() << " GraphBase::GOTONode::CoupledNode() --> " ; -// if ( _CoupledNode ) { -// cdebug << _CoupledNode->Name() ; -// } -// else { -// cdebug << "NULL" ; -// } -// cdebug << endl ; +#if CoupledNodeTrace + cdebug << this << " " << Name() << " GraphBase::GOTONode::CoupledNode() --> " ; + if ( _CoupledNode ) { + cdebug << _CoupledNode->Name() ; + } + else { + cdebug << "NULL" ; + } + cdebug << endl ; +#endif return _CoupledNode ; } @@ -136,24 +149,23 @@ void GraphBase::GOTONode::CoupledNodeName( const char * aCoupledNodeName ) { } _CoupledNodeName = new char [ strlen( aCoupledNodeName ) + 1 ] ; strcpy( _CoupledNodeName , aCoupledNodeName ) ; - cdebug << this << " " << Name() << " GraphBase::GOTONode::CoupledNodeName() --> " ; - if ( _CoupledNodeName ) { - cdebug << _CoupledNodeName ; - } - else { - cdebug << "NULL" ; - } - cdebug << endl ; +#if CoupledNodeTrace + cdebug << this << " " << Name() << " GraphBase::GOTONode::CoupledNodeName() --> " + << (void * ) _CoupledNodeName << " = " << _CoupledNodeName << endl ; +#endif } char * GraphBase::GOTONode::CoupledNodeName() const { +#if CoupledNodeTrace cdebug << this << " " << Name() << " GraphBase::GOTONode::CoupledNodeName() --> " ; if ( _CoupledNodeName ) { - cdebug << _CoupledNodeName ; + cdebug << (void * ) _CoupledNodeName << " = " << _CoupledNodeName << endl ; } else { - cdebug << "NULL" ; + cdebug << "NULL" << endl ; } - return my_strdup( _CoupledNodeName ) ; +#endif +//JR 17.02.2005 Memory Leak return my_strdup( _CoupledNodeName ) ; + return _CoupledNodeName ; } //bool GraphBase::GOTONode::SaveXML( ostream &f , char *Tabs , @@ -163,7 +175,8 @@ bool GraphBase::GOTONode::SaveXML( QDomDocument & Graph , QDomElement & info , GraphBase::ListOfPythonFunctions aPythonFunction ; if ( PyFuncName() ) { aFuncNames.resize( 1 ) ; - aFuncNames[0] = CORBA::string_dup( PyFuncName() ) ; +//JR 24.02.2005 Memory Leak aFuncNames[0] = CORBA::string_dup( PyFuncName() ) ; + aFuncNames[0] = string( PyFuncName() ) ; aPythonFunction.resize( 1 ) ; aPythonFunction[0] = PythonFunction() ; } @@ -184,7 +197,8 @@ bool GraphBase::GOTONode::SavePY( ostream &f , const char * aGraphName , GraphBase::ListOfPythonFunctions aPythonFunction ; if ( PyFuncName() ) { aFuncNames.resize( 1 ) ; - aFuncNames[0] = CORBA::string_dup( PyFuncName() ) ; +//JR 24.02.2005 Memory Leak aFuncNames[0] = CORBA::string_dup( PyFuncName() ) ; + aFuncNames[0] = string( PyFuncName() ) ; aPythonFunction.resize( 1 ) ; aPythonFunction[0] = PythonFunction() ; } diff --git a/src/GraphBase/DataFlowBase_Graph.cxx b/src/GraphBase/DataFlowBase_Graph.cxx index 169fc9a..ede3e29 100644 --- a/src/GraphBase/DataFlowBase_Graph.cxx +++ b/src/GraphBase/DataFlowBase_Graph.cxx @@ -140,36 +140,45 @@ GraphBase::ListOfSNodes * GraphBase::Graph::GetNodes() const { ( igoto == 1 && aCNode->IsGOTONode() ) ) { if ( aCNode->IsFactoryNode() ) { GraphBase::FactoryNode * aFNode = (GraphBase::FactoryNode * ) aCNode ; - (*_list_nodes)[ind].theComponentName = CORBA::string_dup( aFNode->ComponentName()); - (*_list_nodes)[ind].theInterfaceName = CORBA::string_dup( aFNode->InterfaceName()); +//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theComponentName = CORBA::string_dup( aFNode->ComponentName()); + (*_list_nodes)[ind].theComponentName = string( aFNode->ComponentName()); +//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theInterfaceName = CORBA::string_dup( aFNode->InterfaceName()); + (*_list_nodes)[ind].theInterfaceName = string( aFNode->InterfaceName()); } else { - (*_list_nodes)[ind].theComponentName = CORBA::string_dup( "" ); - (*_list_nodes)[ind].theInterfaceName = CORBA::string_dup( "" ); + (*_list_nodes)[ind].theComponentName = string( "" ); + (*_list_nodes)[ind].theInterfaceName = string( "" ); } - (*_list_nodes)[ind].theName = CORBA::string_dup( aCNode->Name() ); +//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theName = CORBA::string_dup( aCNode->Name() ); + (*_list_nodes)[ind].theName = string( aCNode->Name() ); (*_list_nodes)[ind].theKind = aCNode->Kind(); if ( aCNode->IsInLineNode() || aCNode->IsMacroNode() ) { GraphBase::InLineNode * aINode = (GraphBase::InLineNode * ) aCNode ; (*_list_nodes)[ind].theListOfFuncName.resize( 1 ) ; - (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aINode->PyFuncName() ) ; +//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aINode->PyFuncName() ) ; + (*_list_nodes)[ind].theListOfFuncName[0] = string( aINode->PyFuncName() ) ; (*_list_nodes)[ind].theListOfPythonFunctions.resize( 1 ) ; (*_list_nodes)[ind].theListOfPythonFunctions[0] = aINode->PythonFunction() ; } if ( aCNode->IsGOTONode() ) { GraphBase::GOTONode * aGNode = (GraphBase::GOTONode * ) aCNode ; (*_list_nodes)[ind].theListOfFuncName.resize( 1 ) ; - (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aGNode->PyFuncName() ) ; +//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aGNode->PyFuncName() ) ; + (*_list_nodes)[ind].theListOfFuncName[0] = string( aGNode->PyFuncName() ) ; (*_list_nodes)[ind].theListOfPythonFunctions.resize( 1 ) ; (*_list_nodes)[ind].theListOfPythonFunctions[0] = aGNode->PythonFunction() ; } if ( aCNode->IsLoopNode() ) { GraphBase::LoopNode * aLNode = (GraphBase::LoopNode * ) aCNode ; - (*_list_nodes)[ind].theCoupledNode = CORBA::string_dup( aLNode->CoupledNode()->Name() ) ; +//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theCoupledNode = CORBA::string_dup( aLNode->CoupledNode()->Name() ) ; + (*_list_nodes)[ind].theCoupledNode = string( aLNode->CoupledNode()->Name() ) ; (*_list_nodes)[ind].theListOfFuncName.resize( 3 ) ; - (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aLNode->PyFuncName() ) ; - (*_list_nodes)[ind].theListOfFuncName[1] = CORBA::string_dup( aLNode->PyMoreName() ) ; - (*_list_nodes)[ind].theListOfFuncName[2] = CORBA::string_dup( aLNode->PyNextName() ) ; +//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aLNode->PyFuncName() ) ; + (*_list_nodes)[ind].theListOfFuncName[0] = string( aLNode->PyFuncName() ) ; +//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theListOfFuncName[1] = CORBA::string_dup( aLNode->PyMoreName() ) ; + (*_list_nodes)[ind].theListOfFuncName[1] = string( aLNode->PyMoreName() ) ; +//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theListOfFuncName[2] = CORBA::string_dup( aLNode->PyNextName() ) ; + (*_list_nodes)[ind].theListOfFuncName[2] = string( aLNode->PyNextName() ) ; (*_list_nodes)[ind].theListOfPythonFunctions.resize( 3 ) ; (*_list_nodes)[ind].theListOfPythonFunctions[0] = aLNode->PythonFunction() ; (*_list_nodes)[ind].theListOfPythonFunctions[1] = aLNode->MorePythonFunction() ; @@ -177,38 +186,46 @@ GraphBase::ListOfSNodes * GraphBase::Graph::GetNodes() const { } else if ( aCNode->IsSwitchNode() ) { GraphBase::SwitchNode * aSNode = (GraphBase::SwitchNode * ) aCNode ; - (*_list_nodes)[ind].theCoupledNode = CORBA::string_dup( aSNode->CoupledNode()->Name() ) ; +//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theCoupledNode = CORBA::string_dup( aSNode->CoupledNode()->Name() ) ; + (*_list_nodes)[ind].theCoupledNode = string( aSNode->CoupledNode()->Name() ) ; (*_list_nodes)[ind].theListOfFuncName.resize( 1 ) ; - (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aSNode->PyFuncName() ) ; +//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aSNode->PyFuncName() ) ; + (*_list_nodes)[ind].theListOfFuncName[0] = string( aSNode->PyFuncName() ) ; (*_list_nodes)[ind].theListOfPythonFunctions.resize( 1 ) ; (*_list_nodes)[ind].theListOfPythonFunctions[0] = aSNode->PythonFunction() ; } else if ( aCNode->IsEndLoopNode() ) { GraphBase::EndOfLoopNode * aELNode = (GraphBase::EndOfLoopNode * ) aCNode ; - (*_list_nodes)[ind].theCoupledNode = CORBA::string_dup( aELNode->CoupledNode()->Name() ) ; +//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theCoupledNode = CORBA::string_dup( aELNode->CoupledNode()->Name() ) ; + (*_list_nodes)[ind].theCoupledNode = string( aELNode->CoupledNode()->Name() ) ; (*_list_nodes)[ind].theListOfFuncName.resize( 1 ) ; - (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aELNode->PyFuncName() ) ; +//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aELNode->PyFuncName() ) ; + (*_list_nodes)[ind].theListOfFuncName[0] = string( aELNode->PyFuncName() ) ; (*_list_nodes)[ind].theListOfPythonFunctions.resize( 1 ) ; (*_list_nodes)[ind].theListOfPythonFunctions[0] = aELNode->PythonFunction() ; } else if ( aCNode->IsEndSwitchNode() ) { GraphBase::EndOfSwitchNode * aESNode = (GraphBase::EndOfSwitchNode * ) aCNode ; - (*_list_nodes)[ind].theCoupledNode = CORBA::string_dup( aESNode->CoupledNode()->Name() ) ; +//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theCoupledNode = CORBA::string_dup( aESNode->CoupledNode()->Name() ) ; + (*_list_nodes)[ind].theCoupledNode = string( aESNode->CoupledNode()->Name() ) ; (*_list_nodes)[ind].theListOfFuncName.resize( 1 ) ; - (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aESNode->PyFuncName() ) ; +//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aESNode->PyFuncName() ) ; + (*_list_nodes)[ind].theListOfFuncName[0] = string( aESNode->PyFuncName() ) ; (*_list_nodes)[ind].theListOfPythonFunctions.resize( 1 ) ; (*_list_nodes)[ind].theListOfPythonFunctions[0] = aESNode->PythonFunction() ; } else if ( aCNode->IsMacroNode() ) { GraphBase::Graph * aGraph = (GraphBase::Graph * ) aCNode ; - (*_list_nodes)[ind].theCoupledNode = CORBA::string_dup( aGraph->CoupledNode()->Name() ) ; +//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theCoupledNode = CORBA::string_dup( aGraph->CoupledNode()->Name() ) ; + (*_list_nodes)[ind].theCoupledNode = string( aGraph->CoupledNode()->Name() ) ; (*_list_nodes)[ind].theListOfFuncName.resize( 1 ) ; - (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aGraph->PyFuncName() ) ; +//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aGraph->PyFuncName() ) ; + (*_list_nodes)[ind].theListOfFuncName[0] = string( aGraph->PyFuncName() ) ; (*_list_nodes)[ind].theListOfPythonFunctions.resize( 1 ) ; (*_list_nodes)[ind].theListOfPythonFunctions[0] = aGraph->PythonFunction() ; } else { - (*_list_nodes)[ind].theCoupledNode = CORBA::string_dup( "" ) ; + (*_list_nodes)[ind].theCoupledNode = string( "" ) ; } // (*_list_nodes)[ind].theDataStreamInArgsNumber = aCNode->DataStreamInPortsNumber() ; // (*_list_nodes)[ind].theDataStreamOutArgsNumber = aCNode->DataStreamOutPortsNumber() ; @@ -322,16 +339,20 @@ GraphBase::ListOfSNodes * GraphBase::Graph::GetNodes() const { } (*_list_nodes)[ind].theFirstCreation = aCNode->FirstCreation(); (*_list_nodes)[ind].theLastModification = aCNode->LastModification(); - (*_list_nodes)[ind].theEditorRelease = CORBA::string_dup( aCNode->EditorRelease()); - (*_list_nodes)[ind].theAuthor = CORBA::string_dup( aCNode->Author()); +//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theEditorRelease = CORBA::string_dup( aCNode->EditorRelease()); + (*_list_nodes)[ind].theEditorRelease = string( aCNode->EditorRelease()); +//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theAuthor = CORBA::string_dup( aCNode->Author()); if ( aCNode->IsFactoryNode() ) { GraphBase::FactoryNode * aFNode = (GraphBase::FactoryNode * ) aCNode ; - (*_list_nodes)[ind].theContainer = CORBA::string_dup( aFNode->Computer()); +//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theContainer = CORBA::string_dup( aFNode->Computer()); + (*_list_nodes)[ind].theContainer = string( aFNode->Computer()); } else { - (*_list_nodes)[ind].theContainer = CORBA::string_dup( "" ); +//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theContainer = CORBA::string_dup( "" ); + (*_list_nodes)[ind].theContainer = string( "" ); } - (*_list_nodes)[ind].theComment = CORBA::string_dup( aCNode->Comment()); +//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theComment = CORBA::string_dup( aCNode->Comment()); + (*_list_nodes)[ind].theComment = string( aCNode->Comment()); (*_list_nodes)[ind].theCoords.theX = aCNode->XCoordinate(); (*_list_nodes)[ind].theCoords.theY = aCNode->YCoordinate(); #if 0 @@ -342,10 +363,14 @@ GraphBase::ListOfSNodes * GraphBase::Graph::GetNodes() const { if ( anInPort->IsBus() ) { nports += 1 ; (*_list_nodes)[ind].theListOfParameters.resize( nports ) ; - (*_list_nodes)[ind].theListOfParameters[ nports-1 ].theInParameter.Parametertype = CORBA::string_dup( anInPort->PortType() ) ; - (*_list_nodes)[ind].theListOfParameters[ nports-1 ].theInParameter.Parametername = CORBA::string_dup( anInPort->PortName() ) ; - (*_list_nodes)[ind].theListOfParameters[ nports-1 ].theOutParameter.Parametertype = CORBA::string_dup( aCNode->GetNodeOutPort( anInPort->PortIndex() )->PortType() ) ; - (*_list_nodes)[ind].theListOfParameters[ nports-1 ].theOutParameter.Parametername = CORBA::string_dup( aCNode->GetNodeOutPort( anInPort->PortIndex() )->PortName() ) ; +//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theListOfParameters[ nports-1 ].theInParameter.Parametertype = CORBA::string_dup( anInPort->PortType() ) ; + (*_list_nodes)[ind].theListOfParameters[ nports-1 ].theInParameter.Parametertype = string( anInPort->PortType() ) ; +//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theListOfParameters[ nports-1 ].theInParameter.Parametername = CORBA::string_dup( anInPort->PortName() ) ; + (*_list_nodes)[ind].theListOfParameters[ nports-1 ].theInParameter.Parametername = string( anInPort->PortName() ) ; +//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theListOfParameters[ nports-1 ].theOutParameter.Parametertype = CORBA::string_dup( aCNode->GetNodeOutPort( anInPort->PortIndex() )->PortType() ) ; + (*_list_nodes)[ind].theListOfParameters[ nports-1 ].theOutParameter.Parametertype = string( aCNode->GetNodeOutPort( anInPort->PortIndex() )->PortType() ) ; +//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theListOfParameters[ nports-1 ].theOutParameter.Parametername = CORBA::string_dup( aCNode->GetNodeOutPort( anInPort->PortIndex() )->PortName() ) ; + (*_list_nodes)[ind].theListOfParameters[ nports-1 ].theOutParameter.Parametername = string( aCNode->GetNodeOutPort( anInPort->PortIndex() )->PortName() ) ; } } #endif @@ -367,30 +392,46 @@ GraphBase::ListOfSLinks * GraphBase::Graph::GetLinks(bool AllLinks ) const { // All the links from _LinksList are taken // vector< InNode *> Nodes = InNodes() ; + cdebug_in << "Graph::GetLinks( " << AllLinks << " ) " << endl ; int ind = 0 ; int k ; for ( k = 0 ; k < GraphNodesSize() ; k++ ) { GraphBase::ComputingNode * fromNode = GraphNodes( k ) ; +// cdebug << "GraphBase::Graph::GetLinks k" << k << ". :" << fromNode->Name() << endl ; int i ; for ( i = 0 ; i < fromNode->GetNodeOutPortsSize() ; i++ ) { const GraphBase::OutPort* fromPort = fromNode->GetNodeOutPort( i ) ; +// cdebug << "GraphBase::Graph::GetLinks k" << k << ". :" << fromNode->Name() +// << " i" << i << ". : " << fromPort->PortName() << endl ; int j ; for ( j = 0 ; j < fromPort->InPortsSize() ; j++ ) { const GraphBase::InPort* toPort = fromPort->InPorts( j ) ; +// cdebug << "GraphBase::Graph::GetLinks k" << k << ". : fromNode " << fromNode << " = " +// << fromNode->Name() << " i" << i << ". : fromPort " << fromPort << " = " +// << fromPort->PortName() << " j" << j << ". : toPort " << toPort << " = " +// << toPort->NodeName() << "( " << toPort->PortName() << " )" << endl ; if ( toPort->IsPortConnected() ) { // Desole pour ce cast mais avec les maps difficile de faire const ... - const GraphBase::ComputingNode * toNode = ((GraphBase::Graph * ) this)->GetGraphNode( toPort->NodeName() ) ; +// const GraphBase::ComputingNode * toNode = ((GraphBase::Graph * ) this)->GetGraphNode( toPort->NodeName() ) ; +// cdebug << "GraphBase::Graph::GetLinks " << fromNode->Name() << " (" +// << fromPort->PortName() << " ) IsPortConnected" << fromPort->IsPortConnected() +// << " --> toNode " << toNode << " " << toPort->NodeName() << "( " +// << toPort->PortName() << " ) " << " " << fromPort->InPortsSize() << " ports" +// << endl ; 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 ; +// 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() ); +//JR 23.02.2005 Memory Leak (*_list_links)[ind].FromNodeName = CORBA::string_dup( fromNode->Name() ); + (*_list_links)[ind].FromNodeName = string( fromNode->Name() ); (*_list_links)[ind].FromServiceParameterName = fromPort->GetServicesParameter().Parametername; - (*_list_links)[ind].ToNodeName = CORBA::string_dup( toPort->NodeName() ); +//JR 23.02.2005 Memory Leak (*_list_links)[ind].ToNodeName = CORBA::string_dup( toPort->NodeName() ); + (*_list_links)[ind].ToNodeName = string( toPort->NodeName() ); (*_list_links)[ind].ToServiceParameterName = toPort->GetServicesParameter().Parametername; - (*_list_links)[ind].aLinkValue = *fromPort->Value() ; +//JR 30.03.2005 (*_list_links)[ind].aLinkValue = *fromPort->Value() ; + (*_list_links)[ind].aLinkValue = fromPort->Value() ; if ( toPort->IsEndSwitch() ) { (*_list_links)[ind++].aListOfCoords = *(fromPort->Coords()) ; } @@ -400,15 +441,17 @@ GraphBase::ListOfSLinks * GraphBase::Graph::GetLinks(bool AllLinks ) const { } } else { - cdebug << "GraphBase::Graph::GetLinks " << fromNode->Name() << " " - << fromPort->PortName() << " ) " << fromPort->PortStatus() - << " --> " << toPort->NodeName() << "( " << toPort->PortName() << " ) " - << " " << toPort->PortStatus() << " " << fromPort->InPortsSize() << " ports ignored" << endl ; +// cdebug << "GraphBase::Graph::GetLinks " << fromNode->Name() << " " +// << fromPort->PortName() << " ) " << fromPort->PortStatus() +// << " --> " << toPort->NodeName() << "( " << toPort->PortName() << " ) " +// << " " << toPort->PortStatus() << " " << fromPort->InPortsSize() +// << " ports ignored" << endl ; } } } } + cdebug_out << "Graph::GetLinks( " << AllLinks << " ) " << endl ; return _list_links; } @@ -422,11 +465,14 @@ GraphBase::SLink * GraphBase::Graph::GetLink( GraphBase::ComputingNode * aNode , GraphBase::InPort* toPort ) { GraphBase::SLink * _link = new GraphBase::SLink ; GraphBase::OutPort* fromPort = toPort->GetOutPort() ; - _link->FromNodeName = CORBA::string_dup( fromPort->NodeName() ); +//JR 24.02.2005 Memory Leak _link->FromNodeName = CORBA::string_dup( fromPort->NodeName() ); + _link->FromNodeName = string( fromPort->NodeName() ); _link->FromServiceParameterName = fromPort->GetServicesParameter().Parametername; - _link->ToNodeName = CORBA::string_dup( toPort->NodeName() ); +//JR 24.02.2005 Memory Leak _link->ToNodeName = CORBA::string_dup( toPort->NodeName() ); + _link->ToNodeName = string( toPort->NodeName() ); _link->ToServiceParameterName = toPort->GetServicesParameter().Parametername; - CORBA::Any aSPValue = *fromPort->Value() ; +//JR 30.03.2005 CORBA::Any aSPValue = *fromPort->Value() ; + CORBA::Any aSPValue = fromPort->Value() ; _link->aLinkValue = aSPValue; _link->aListOfCoords = *(toPort->Coords()) ; return _link; @@ -450,12 +496,15 @@ GraphBase::ListOfSLinks * GraphBase::Graph::GetDatas() const { // input ports. Input(s) of a DataFlow match one or several output-virtual-dataport for ( j = 0 ; j < fromDataPort->InPortsSize() ; j++ ) { _list_datalinks->resize( ind+1 ); - (*_list_datalinks)[ind].FromNodeName = CORBA::string_dup( aDataNode->Name() ); +//JR 24.02.2005 Memory Leak (*_list_datalinks)[ind].FromNodeName = CORBA::string_dup( aDataNode->Name() ); + (*_list_datalinks)[ind].FromNodeName = string( aDataNode->Name() ); (*_list_datalinks)[ind].FromServiceParameterName = fromDataPort->GetServicesParameter().Parametername; const GraphBase::InPort* toPort = fromDataPort->InPorts( j ) ; - (*_list_datalinks)[ind].ToNodeName = CORBA::string_dup( toPort->NodeName() ); +//JR 24.02.2005 Memory Leak (*_list_datalinks)[ind].ToNodeName = CORBA::string_dup( toPort->NodeName() ); + (*_list_datalinks)[ind].ToNodeName = string( toPort->NodeName() ); (*_list_datalinks)[ind].ToServiceParameterName = toPort->GetServicesParameter().Parametername; - CORBA::Any aSPValue = *fromDataPort->Value() ; +//JR 30.03.2005 CORBA::Any aSPValue = *fromDataPort->Value() ; + CORBA::Any aSPValue = fromDataPort->Value() ; (*_list_datalinks)[ind].aLinkValue = aSPValue; (*_list_datalinks)[ind++].aListOfCoords = *(toPort->Coords()) ; } @@ -463,27 +512,6 @@ GraphBase::ListOfSLinks * GraphBase::Graph::GetDatas() const { } } -#if 0 -// Output(s) of a DataFlow match only one input-virtual-dataport - for ( i = 0 ; i < aDataNode->GetNodeOutDataNodePortsSize() ; i++ ) { - GraphBase::InPort* toDataPort = aDataNode->GetChangeNodeOutDataNodePort( i ) ; - const GraphBase::OutPort* fromPort = toDataPort->GetLink() ; - if ( fromPort->IsDataConnected() ) { - _list_datalinks->length( ind+1 ); - _list_datalinks[ind].FromNodeName = CORBA::string_dup( fromPort->NodeName() ); - _list_datalinks[ind].FromServiceParameterName = fromPort->GetServicesParameter().Parametername; - _list_datalinks[ind].ToNodeName = CORBA::string_dup( aDataNode->Name() ); - _list_datalinks[ind].ToServiceParameterName = toDataPort->GetServicesParameter().Parametername; -// SALOME_SuperVisionBase::ServicesParameterValue aSPValue; - CORBA::Any aSPValue = *fromPort->Value() ; -// aSPValue.Value = CORBA::string_dup( fromPort->Value() ); -// aSPValue.Kind = fromPort->Kind(); - _list_datalinks[ind].aLinkValue = aSPValue; - _list_datalinks[ind++].aListOfCoords = toDataPort->Coords() ; - } - } -#endif - return _list_datalinks ; } @@ -550,13 +578,24 @@ bool GraphBase::Graph::ReNameNode( const char* OldNodeName , GraphBase::ComputingNode * aNode = GetChangeGraphNode( index ) ; // Update 'ToNode's Map from 'aNode' - cdebug << "Graph::ReNameNode " << aNode->Name() << " LinkedNodesSize " + cdebug << "Graph::ReNameNode " << aNode->Name() << " LinkedNodesSize : " << aNode->LinkedNodesSize() << endl ; for ( i = 0 ; i < aNode->LinkedNodesSize() ; i++ ) { GraphBase::StreamNode * ToNode = aNode->LinkedNodes( i ) ; ToNode->ReNameLinkedFromNode( OldNodeName , NewNodeName ) ; } -// Update 'FomNode's Map to 'aNode' +// Rename in _MapOfLinkedNodes of 'FromNode' + cdebug << "Graph::ReNameNode " << aNode->Name() << " LinkedFromNodesSize : " + << aNode->LinkedFromNodesSize() << endl ; + for ( i = 0 ; i < aNode->LinkedFromNodesSize() ; i++ ) { + GraphBase::StreamNode * FromNode = aNode->LinkedFromNodes( i ) ; + if ( FromNode->GetLinkedNodeIndex( OldNodeName ) >= 0 ) { + FromNode->ReNameLinkedNode( OldNodeName , NewNodeName ) ; + } + else { + FromNode->ReNameStreamLinkedNode( OldNodeName , NewNodeName ) ; + } + } // Inports 'anInPort' of 'aNode' for ( i = aNode->GetNodeInPortsSize()-1 ; i >= 0 ; i-- ) { GraphBase::InPort * anInPort = aNode->GetChangeNodeInPort( i ) ; @@ -583,14 +622,17 @@ bool GraphBase::Graph::ReNameNode( const char* OldNodeName , else { FromNode = this ; } -// Rename in _MapOfLinkedFromNodes of 'FromNode' cdebug << " fromConnected " << anOutPort->NodeName() << endl ; +#if 0 +//JR 26.01.2005 : a same node may be renamed severeal times. So this is done above +// Rename in _MapOfLinkedFromNodes of 'FromNode' if ( anInPort->IsDataStream() ) { FromNode->ReNameStreamLinkedNode( OldNodeName , NewNodeName ) ; } else { FromNode->ReNameLinkedNode( OldNodeName , NewNodeName ) ; } +#endif } char* OldNodePortName = new char[ strlen( OldNodeName ) + strlen( aNode->GetChangeNodeInPort( i )->PortName() ) + 3 ] ; @@ -616,6 +658,24 @@ bool GraphBase::Graph::ReNameNode( const char* OldNodeName , } } RetVal = true ; +// PAL8508 +//JR 02.02.2005 DEBUG : ReName in the CoupledNode was missing + if ( aNode->IsLoopNode() || aNode->IsEndLoopNode() || + aNode->IsSwitchNode() || aNode->IsEndSwitchNode() ) { + GraphBase::GOTONode * theCoupledNode = NULL ; + theCoupledNode = (GraphBase::GOTONode * ) ((GraphBase::GOTONode * ) aNode)->CoupledNode() ; + theCoupledNode->CoupledNodeName( aNode->Name() ) ; + } + else if ( aNode->IsInLineNode() ) { + GraphBase::OutPort * anOutPort = aNode->GetNodeInGate()->GetOutPort() ; + if ( anOutPort ) { + GraphBase::ComputingNode * aLinkedNode ; + aLinkedNode = GetChangeGraphNode( anOutPort->NodeName() ) ; + if ( aLinkedNode->IsGOTONode() ) { + ((GraphBase::GOTONode * ) aLinkedNode)->CoupledNodeName( aNode->Name() ) ; + } + } + } } else { cdebug << "ERROR Node not found" << endl ; @@ -650,6 +710,20 @@ bool GraphBase::Graph::RemoveNode( const char* aNodeName ) { << aNode->LinkedFromNodes( i )->Name() << endl ; } } +//PAL8177-PAL8509 +//JR 24.03.2005 : Debug : CoupledNode field of GOTONodes was not erased + if ( aNode->IsInLineNode() ) { + GraphBase::OutPort * anOutPort = aNode->GetNodeInGate()->GetOutPort() ; + if ( anOutPort ) { + GraphBase::ComputingNode * aLinkedNode ; + aLinkedNode = GetChangeGraphNode( anOutPort->NodeName() ) ; + if ( aLinkedNode->IsGOTONode() ) { + cdebug << "Graph::RemoveNode erase CoupledNode " << aLinkedNode->Name() << endl ; + ((GraphBase::GOTONode * ) aLinkedNode)->CoupledNode( NULL ) ; + ((GraphBase::GOTONode * ) aLinkedNode)->CoupledNodeName( "" ) ; + } + } + } if ( !aNode->IsEndSwitchNode() ) { if ( aNode->GetNodeInPortsSize() ) { for ( i = aNode->GetNodeInPortsSize()-1 ; i >= 0 ; i-- ) { @@ -730,7 +804,7 @@ bool GraphBase::Graph::RemoveNode( const char* aNodeName ) { int k ; for ( k = anOutPort->InPortsSize() - 1 ; k >= 0 ; k-- ) { GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( k ) ; - if ( strcmp( anInPort->NodeName() , aNode->Name() ) == 0 ) { + if ( !strcmp( anInPort->NodeName() , aNode->Name() ) ) { // InPort of the EndSwitchNode cdebug << " to InPort" << j << ". " << anInPort->NodeName() << "( " << anInPort->PortName() << ") " @@ -773,6 +847,8 @@ bool GraphBase::Graph::RemoveNode( const char* aNodeName ) { if ( !anInPort->IsExternConnected() ) { GraphBase::ComputingNode * ToNode = GetChangeGraphNode( anInPort->NodeName() ) ; RetVal = anInPort->RemoveOutPort() ; +// JR 04.02.2005 : Bug if it is a link to an EndSwitchNode. The InPort may be multiple linked !!! +// PAL7990 if ( !RetVal ) { cdebug << "anOutPort->RemoveOutPort Error RetVal " << RetVal << endl ; break ; @@ -795,6 +871,41 @@ bool GraphBase::Graph::RemoveNode( const char* aNodeName ) { cdebug << "anOutPort->RemoveInPort( anInPort ) Error RetVal " << RetVal << endl ; break ; } + if ( ToNode->IsEndSwitchNode() ) { + int i ; + int done = false ; + for ( i = 0 ; i < ToNode->LinkedFromNodesSize() ; i++ ) { + GraphBase::StreamNode * fromNode = ToNode->LinkedFromNodes( i ) ; +// Not the node that we are deleting ... : + if ( strcmp( fromNode->Name() , aNode->Name() ) ) { + int j ; + for ( j = 0 ; j < fromNode->GetNodeOutPortsSize() ; j++ ) { + GraphBase::OutPort * fromOutPort = fromNode->GetChangeNodeOutPort( j ) ; + int k ; + for ( k = 0 ; k < fromOutPort->InPortsSize() ; k++ ) { + if ( strcmp( ToNode->Name() , fromOutPort->InPorts( k )->NodeName() ) == 0 ) { + if ( strcmp( anInPort->PortName() , fromOutPort->InPorts( k )->PortName() ) == 0 ) { +// Restore an OutPort in the InPort + anInPort->ChangeOutPort( fromOutPort ) ; + cdebug << "Graph::RemoveNode reestablish " << fromOutPort->NodeName() << "( " + << fromOutPort->PortName() << " ) in the InPort of EndSwitch : " + << ToNode->Name() << "( " << anInPort->PortName() << " )" + << anInPort->Kind() << " " << anInPort->PortStatus() << endl; + done = true ; + break ; + } + } + } + if ( done ) { + break ; + } + } + if ( done ) { + break ; + } + } + } + } } } if ( !RetVal ) { @@ -803,6 +914,9 @@ bool GraphBase::Graph::RemoveNode( const char* aNodeName ) { } } } + if ( aNode->LinkedNodesSize() || aNode->LinkedFromNodesSize() ) { + RetVal = 0 ; + } cdebug << "Graph::RemoveNode " << aNode->Name() << " : " << aNode->GetNodeInPortsSize() << " InPorts " << aNode->GetNodeOutPortsSize() << " OutPorts " << aNode->LinkedNodesSize() << " LinkedNodes " << aNode->LinkedFromNodesSize() @@ -823,10 +937,11 @@ bool GraphBase::Graph::RemoveNode( const char* aNodeName ) { char * theCoupledNodeName = NULL ; int CoupledIndex = -1 ; if ( aNode->IsEndLoopNode() || aNode->IsEndSwitchNode() ) { - theCoupledNode = ((GraphBase::GOTONode * ) aNode)->CoupledNode() ; theCoupledNodeName = ((GraphBase::GOTONode * ) aNode)->CoupledNodeName() ; - CoupledIndex = GetGraphNodeIndex( theCoupledNode->Name() ) ; + theCoupledNode = ((GraphBase::GOTONode * ) aNode)->CoupledNode() ; } + cdebug << "Node" << index << " " << _GraphNodes[ index ]->Name() << " will be deleted" + << endl ; delete aNode ; _GraphNodesSize -= 1 ; for ( i = index ; i < _GraphNodesSize ; i++ ) { @@ -835,8 +950,13 @@ bool GraphBase::Graph::RemoveNode( const char* aNodeName ) { } _GraphNodes.resize( _GraphNodesSize+1 ) ; _MapOfGraphNodes.erase( aNodeName ) ; +// PAL8510 // Delete of the LoopNode of that EndLoopNode or of the SwitchNode of that EndSwitchNode : if ( theCoupledNode ) { +//JR 02.02.2005 DEBUG : CoupledIndex must be here after the delete of aNode (not before) + CoupledIndex = GetGraphNodeIndex( theCoupledNodeName ) ; + cdebug << "CoupledNode" << CoupledIndex << " " << _GraphNodes[ CoupledIndex ]->Name() + << " will be deleted" << endl ; delete theCoupledNode ; _GraphNodesSize -= 1 ; for ( i = CoupledIndex ; i < _GraphNodesSize ; i++ ) { @@ -850,10 +970,24 @@ bool GraphBase::Graph::RemoveNode( const char* aNodeName ) { } } else { - cdebug << "Node not found ERROR " << index << endl ; + cdebug << "Graph::RemoveNode Node not found ERROR " << index << endl ; } - cdebug_out << "GraphBase::Graph::RemoveNode " << RetVal << endl; +#if 1 + cdebug << "Graph::RemoveNode " << _GraphNodesSize << " known nodes" << endl; + for ( i = 0 ; i < _GraphNodesSize ; i++ ) { + cdebug << "Node" << i << _GraphNodes[ i ]->Name() << endl ; + } + map< string , int >::iterator aMapOfGraphNodesIterator ; + i = 0 ; + for ( aMapOfGraphNodesIterator = _MapOfGraphNodes.begin() ; + aMapOfGraphNodesIterator != _MapOfGraphNodes.end() ; aMapOfGraphNodesIterator++ ) { + cdebug << "MapOfGraphNodes " << i++ << " " << aMapOfGraphNodesIterator->first << " --> " + << aMapOfGraphNodesIterator->second << " - 1" << endl ; + } +#endif + + cdebug_out << "Graph::RemoveNode " << RetVal << endl; return RetVal ; } @@ -971,9 +1105,10 @@ bool GraphBase::Graph::AddLink( GraphBase::ComputingNode *fromNode , return false ; } - cdebug_in << "GraphBase::Graph::AddLink(" << fromNode->Name() << "(" - << fromPort->PortName() << " " << fromPort->PortStatus() << ") ---> " << toNode->Name() << "(" - << toPort->PortName() << " " << toPort->PortStatus() << ") )" << endl; + cdebug_in << "Graph::AddLink( " << fromNode->Name() << "(" + << fromPort->PortName() << " " << fromPort->PortStatus() << ") " << fromPort->Kind() + << " ---> " << toNode->Name() << "(" << toPort->PortName() << " " << toPort->PortStatus() + << ") " << toPort->Kind() << " )" << endl; if ( fromPort->IsDataConnected() || fromPort->IsExternConnected() ) { if ( !fromPort->RemoveInPort() ) { // There is only one ===> RemoveOutPort() cdebug_out << "GraphBase::Graph::AddLink(" << fromNode->Name() << "(" @@ -1028,15 +1163,39 @@ bool GraphBase::Graph::AddLink( GraphBase::ComputingNode *fromNode , } } } - else if ( !toNode->IsEndSwitchNode() || - ( toNode->IsEndSwitchNode() && toPort->IsGate() ) ) { - if ( !RemoveLink( fromNode->Name() , fromPort->PortName() , +//PAL8511 +// JR 17.01.2005 : toPort is already linked : RemoveLink + else if ( !toNode->IsEndSwitchNode() ) { +// else if ( !toNode->IsEndSwitchNode() || +// ( toNode->IsEndSwitchNode() && toPort->IsGate() ) ) { +//JR Debug : the fromPort was wrong ! +// if ( !RemoveLink( fromNode->Name() , fromPort->PortName() , + if ( !RemoveLink( toPort->GetOutPort()->NodeName() , toPort->GetOutPort()->PortName() , toNode->Name() , toPort->PortName() ) ) { cdebug << "RemoveLink(AddLink) toNode->IsEndSwitchNode Error." << endl ; cdebug_out << "GraphBase::Graph::AddLink" << endl; return false ; } } +//PAL8511 +//JR Debug 15.02.2005 : Not multiple links in that case except if toPort is the DefaultPort + else if ( fromNode->IsSwitchNode() && toNode->IsEndSwitchNode() && !toPort->IsGate() ) { + cdebug << "fromNode->IsSwitchNode() && toNode->IsEndSwitchNode toPort(NotGate)Error." + << endl ; + cdebug_out << "GraphBase::Graph::AddLink" << endl; + return false ; + } + } +//PAL7990 +//JR 24.03.2005 : No Link between OutPort of SwitchNode to InPort of EndSwitchNode except if +// they have the same name for a special case : +// Switch with no branch ==> Default is applied always : GraphSyrControl example + else if ( fromNode->IsSwitchNode() && !fromPort->IsGate() && + toNode->IsEndSwitchNode() && !toPort->IsGate() && + strcmp( fromPort->PortName() , toPort->PortName() ) ) { + cdebug << "fromNode->IsSwitchNode() && toNode->IsEndSwitchNode Error." << endl ; + cdebug_out << "GraphBase::Graph::AddLink" << endl; + return false ; } else if ( fromNode->IsGOTONode() && fromPort->InPortsSize() ) { if ( !RemoveLink( fromNode->Name() , fromPort->PortName() , @@ -1057,7 +1216,26 @@ bool GraphBase::Graph::AddLink( GraphBase::ComputingNode *fromNode , } - if ( toNode->IsEndSwitchNode() && !toPort->IsGate() ) { +// JR 12.01.2005 : an OutPort of a SwitchNode connected to a Gate can be connected only to Gate + if ( !toNode->IsDataFlowNode() && !toNode->IsDataStreamNode() && + fromNode->IsSwitchNode() && fromPort->IsSwitch() && !toPort->IsGate() ) { + cdebug << "toPort->AddLink Error( fromPort->IsSwitch() && !toPort->IsGate())." << endl ; + cdebug_out << "GraphBase::Graph::AddLink 0" << endl; + return false ; + } +//JR 11.02.2005 : SwitchNode(Default) may be only linked to EndSwitchNode(Default) +// SwitchNode(Param) may be linked to EndSwitchNode(Param) +// SwitchNode(Param-UserDefault) may be linked to EndSwitchNode(Default) + else if ( fromNode->IsSwitchNode() && toNode->IsEndSwitchNode() && + !( ( fromPort->IsGate() && toPort->IsGate() ) || + ( !fromPort->IsGate() ) ) ) { +// ( !fromPort->IsGate() && !toPort->IsGate() ) ) ) { + cdebug << "SwitchNode(Default) may be only linked to EndSwitchNode(Default) AddLink Error." + << endl ; + cdebug_out << "GraphBase::Graph::AddLink 0" << endl; + return false ; + } + else if ( toNode->IsEndSwitchNode() && !toPort->IsGate() ) { // if ( !toPort->IsEndSwitch() || !fromPort->AddInPort( toPort ) ) { if ( !fromPort->AddInPort( toPort ) ) { cdebug << "toNode->IsEndSwitchNode() : !fromPort->AddInPort( toPort ) AddLink Error." @@ -1069,12 +1247,6 @@ bool GraphBase::Graph::AddLink( GraphBase::ComputingNode *fromNode , toPort->Kind( SUPERV::EndSwitchParameter ) ; } } -// JR 12.01.2005 : an OutPort of a SwitchNode connected to a Gate can be connected only to Gate - else if ( fromNode->IsSwitchNode() && fromPort->IsSwitch() && !toPort->IsGate() ) { - cdebug << "toPort->AddLink Error( fromPort->IsSwitch() && !toPort->IsGate())." << endl ; - cdebug_out << "GraphBase::Graph::AddLink 0" << endl; - return false ; - } else if ( !fromPort->AddInPort( toPort ) ) { // --> MapOfInports in the OutPort cdebug << "!fromPort->AddLink Error." << endl ; cdebug_out << "GraphBase::Graph::AddLink 0" << endl; @@ -1140,7 +1312,8 @@ bool GraphBase::Graph::AddLink( GraphBase::ComputingNode *fromNode , } if ( fromNode->IsSwitchNode() ) { if ( !fromPort->IsDataStream() ) { - if ( fromPort->IsInLine() && toPort->IsGate() && !toNode->IsEndSwitchNode() ) { +//JR 08.02.2005 if ( fromPort->IsInLine() && toPort->IsGate() && !toNode->IsEndSwitchNode() ) { + if ( fromPort->IsInLine() && toPort->IsGate() ) { fromPort->Kind( SUPERV::SwitchParameter ) ; } else if ( !fromPort->IsGate() && !toPort->IsGate() ){ @@ -1184,7 +1357,7 @@ bool GraphBase::Graph::RemoveLink( const char* FromNodeName , if ( anInPort && ( anInPort->IsPortConnected() || anInPort->IsDataConnected() || anInPort->IsExternConnected() ) ) { -// JR 13.01.2005 : Bug if it is a link to an EndSwitchNode. The OutPort may be an other one !!! +// JR 13.01.2005 : DeBug : if it is a link to an EndSwitchNode. The OutPort may be an other one !!! GraphBase::ComputingNode * fromNode = GetChangeGraphNode( FromNodeName ) ; GraphBase::OutPort * anOutPort = NULL ; if ( toNode->IsEndSwitchNode() ) { @@ -1206,10 +1379,17 @@ bool GraphBase::Graph::RemoveLink( const char* FromNodeName , fromNode->RemoveLinkedNode( toNode ) ; } } - if ( fromNode->IsSwitchNode() && !anOutPort->IsGate() && !toNode->IsEndSwitchNode() ) { - anOutPort->Kind( SUPERV::InLineParameter ) ; +//JR PAL7990 : a SwitchPort is an OutPort of a SwitchNode connected to a InGate Port +//Debug : change the kind only if there is no other InGate connected to the OutPort + if ( fromNode->IsSwitchNode() && !anOutPort->IsGate() && anOutPort->InPortsSize() == 0 ) { + if ( !toNode->IsEndSwitchNode() ) { + anOutPort->Kind( SUPERV::InLineParameter ) ; + } + else if ( !anInPort->IsGate() ) { + anOutPort->Kind( SUPERV::InLineParameter ) ; + } } -// JR 13.01.2005 : Bug if it is a link to an EndSwitchNode. The InPort may be linked !!! +// JR 13.01.2005 : DeBug : if it is a link to an EndSwitchNode. The InPort may be multiple linked !!! if ( toNode->IsEndSwitchNode() ) { int i ; int done = false ; @@ -1221,13 +1401,16 @@ bool GraphBase::Graph::RemoveLink( const char* FromNodeName , int k ; for ( k = 0 ; k < fromOutPort->InPortsSize() ; k++ ) { if ( strcmp( toNode->Name() , fromOutPort->InPorts( k )->NodeName() ) == 0 ) { + if ( strcmp( anInPort->PortName() , fromOutPort->InPorts( k )->PortName() ) == 0 ) { // Restore an OutPort in the InPort - anInPort->ChangeOutPort( fromOutPort ) ; - cdebug << "Graph::RemoveLink reestablish " << fromOutPort->NodeName() << "( " - << fromOutPort->PortName() << " ) in the InPort of EndSwitch : " - << toNode->Name() << "( " << anInPort->PortName() << " )" << endl; - done = true ; - break ; + anInPort->ChangeOutPort( fromOutPort ) ; + cdebug << "Graph::RemoveLink reestablish " << fromOutPort->NodeName() << "( " + << fromOutPort->PortName() << " ) in the InPort of EndSwitch : " + << toNode->Name() << "( " << anInPort->PortName() << " )" + << anInPort->Kind() << " " << anInPort->PortStatus() << endl; + done = true ; + break ; + } } } if ( done ) { @@ -1258,8 +1441,10 @@ bool GraphBase::Graph::GetLink(const char* ToNodeName , GraphBase::InPort * anInPort = toNode->GetChangeInPort( ToServiceParameterName ) ; if ( anInPort && !anInPort->IsNotConnected() ) { GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ; - *FromNodeName = my_strdup( anOutPort->NodeName() ) ; - *FromServiceParameterName = my_strdup( anOutPort->PortName() ) ; +//JR 17.02.2005 Memory Leak *FromNodeName = my_strdup( anOutPort->NodeName() ) ; + *FromNodeName = (char * ) anOutPort->NodeName() ; +//JR 17.02.2005 Memory Leak *FromServiceParameterName = my_strdup( anOutPort->PortName() ) ; + *FromServiceParameterName = (char * ) anOutPort->PortName() ; RetVal = true ; } else { @@ -1405,7 +1590,7 @@ bool GraphBase::Graph::ChangeInputData( const char * ToNodeName , RetVal = true ; fromPort->Value( aValue ) ; fromPort->PortStatus( DataConnected ) ; - toPort->State( SUPERV::ReadyState ) ; + toPort->PortState( SUPERV::ReadyState ) ; } else { cdebug << "ERROR ChangeInputData fromPort not found" << endl ; @@ -1423,6 +1608,7 @@ bool GraphBase::Graph::ChangeInputData( const char * ToNodeName , return RetVal ; } +#if 0 // To restore InputData in CreateService bool GraphBase::Graph::AddInputData( const char* ToNodeName , const char* ToServiceParameterName , @@ -1486,6 +1672,7 @@ bool GraphBase::Graph::AddInputData( const char* ToNodeName , cdebug_out << "GraphBase::Graph::AddInputData " << RetVal << endl; return RetVal ; } +#endif bool GraphBase::Graph::AddOutputData( const char* FromNodeName , const char* FromServiceParameterName , @@ -1503,8 +1690,8 @@ bool GraphBase::Graph::AddOutputData( const char* FromNodeName , // RetVal = AddLink( fromNode , fromPort , // (GraphBase::ComputingNode * ) this , toDataNodePort ) ; anOutPort->Value( aValue ) ; - anOutPort->State( SUPERV::ReadyState ) ; - anOutPort->Done( true ) ; + anOutPort->PortState( SUPERV::ReadyState ) ; + anOutPort->PortDone( true ) ; cdebug << *anOutPort ; #ifdef _DEBUG_ anOutPort->StringValue( *_fdebug ) ; @@ -1519,6 +1706,8 @@ bool GraphBase::Graph::AddOutputData( const char* FromNodeName , return RetVal ; } +//JR This is used by StreamGraphs to list "CODES" and after that there is instances +// for each Code (Nodes). map< string , GraphBase::Service * > GraphBase::Graph::MapOfServiceNames() { return _MapOfServiceNames ; } @@ -1538,12 +1727,13 @@ bool GraphBase::Graph::SetServiceOfMap( GraphBase::Service * aService ) { return true ; } -int GraphBase::Graph::GetServiceNameNumber( SALOME_ModuleCatalog::Service aService ) { - GraphBase::Service * theService = _MapOfServiceNames[ (char * ) aService.ServiceName ] ; - if ( theService == NULL ) { - return 1 ; - } - return theService->NewInstance() ; +//PAL7961 +//JR Debug 25.03.2005 : with multiple instances et delete of instances, it was wrong +//Bug created with the developpement of StreamGraphs +int GraphBase::Graph::GetNewServiceInstanceNumber( char * aServiceName ) { + int InstanceNumber = _MapOfServiceInstanceNumber[ aServiceName ] + 1 ; + _MapOfServiceInstanceNumber[ aServiceName ] = InstanceNumber ; + return InstanceNumber ; } void GraphBase::Graph::SetGraphPorts() { @@ -1552,7 +1742,7 @@ void GraphBase::Graph::SetGraphPorts() { for ( i = 0 ; i < GetNodeInDataNodePortsSize() ; i++ ) { GraphBase::OutPort * anOutPort = GetChangeNodeInDataNodePort( i ) ; cdebug << "SetGraphPorts Out" << i << " " << anOutPort->PortName() << " " << anOutPort->PortType() - << " " << anOutPort->Kind() << " " << anOutPort->PortStatus() << " " << anOutPort->State() << endl ; + << " " << anOutPort->Kind() << " " << anOutPort->PortStatus() << " " << anOutPort->PortState() << endl ; if ( !anOutPort->IsGate() ) { anOutPort->PortStatus( ExternConnected ) ; } @@ -1560,7 +1750,7 @@ void GraphBase::Graph::SetGraphPorts() { for ( i = 0 ; i < GetNodeOutDataNodePortsSize() ; i++ ) { GraphBase::InPort * anInPort = GetChangeNodeOutDataNodePort( i ) ; cdebug << "SetGraphPorts In" << i << " " << anInPort->PortName() << " " << anInPort->PortType() - << " " << anInPort->Kind() << " " << anInPort->PortStatus() << " " << anInPort->State() << endl ; + << " " << anInPort->Kind() << " " << anInPort->PortStatus() << " " << anInPort->PortState() << endl ; if ( !anInPort->IsGate() ) { GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ; anOutPort->PortStatus( ExternConnected ) ; @@ -1591,7 +1781,8 @@ bool GraphBase::Graph::CreateService() { // if ( GraphMacroLevel() == 0 ) { for ( dostore = 0 ; dostore <= 2 ; dostore++ ) { if ( dostore == 1 ) { - aService.ServiceName = Name() ; +//JR 17.02.2005 Memory Leak aService.ServiceName = Name() ; + aService.ServiceName = my_strdup( Name() ) ; aService.ServiceinParameter.length( 0 ) ; aService.ServiceinParameter.length( innbr ) ; aService.ServiceoutParameter.length( 0 ) ; @@ -1606,6 +1797,7 @@ bool GraphBase::Graph::CreateService() { OutNumberOfValues.resize( outnbr ) ; } else if ( dostore == 2 ) { +//JR Creation of the Service (and of the Ports) with GraphBase::DataNode::DataService : cdebug << "GraphBase::Graph::CreateService ->DataService innbr " << innbr << " instreamnbr " << instreamnbr << " outnbr " << outnbr << " outstreamnbr " << outstreamnbr << endl ; @@ -1743,7 +1935,7 @@ bool GraphBase::Graph::CreateService() { } // } -#if 0 +#if 1 cdebug << "DataFlowNode ServiceName " << aService.ServiceName << " InPorts " << innbr << " OutPorts " << outnbr << endl ; for ( i = 0 ; i < innbr ; i++ ) { @@ -1849,7 +2041,9 @@ bool GraphBase::Graph::CreateService() { if ( !anInPort->IsGate() && anInPort->IsDataConnected() ) { if ( !AddInputData( anInPort->NodeName() , anInPort->PortName() , - anInPort->GetOutPort()->ValuePtr() ) ) { +//JR 21.02.2005 Debug Memory leak : anInPort->GetOutPort()->ValuePtr() ) ) { +//JR 30.03.2005 *anInPort->GetOutPort()->Value() ) ) { + anInPort->GetOutPort()->Value() ) ) { cdebug << "CreateService In" << j << " " << anInPort->NodeName() << "(" << anInPort->PortName() << ") " << anInPort->PortStatus() << " --> AddInputData ERROR" << endl ; RetVal = false ; @@ -1890,6 +2084,10 @@ bool GraphBase::Graph::CreateService() { } } +#ifdef _DEBUG_ + ListPorts( *_Graph_fdebug , 0 ) ; +#endif + cdebug_out << "GraphBase::Graph::CreateService " << RetVal << endl; return RetVal ; } @@ -2016,6 +2214,10 @@ bool GraphBase::Graph::InLineServices() { } bool GraphBase::Graph::Sort( int & SubStreamGraphsNumber ) { +#ifdef _DEBUG_ + ListPorts( *_Graph_fdebug , 0 ) ; +#endif + int i ; int j ; int NotSortedNumber = GraphNodesSize() ; @@ -2173,8 +2375,10 @@ bool GraphBase::Graph::Sort( int & SubStreamGraphsNumber ) { return false ; // Loop in the Graph } + cdebug << "Graph::Sort " << _NodesNumber[ 0 ] << " HeadNodes :" << endl ; for ( i= 0 ; i <= _NodesNumber[ 0 ] ; i++ ) { (_SortedNodes[ 0 ])[ i ]->HeadNode( true ) ; + cdebug << " " << i << ". : " << (_SortedNodes[ 0 ])[ i ]->Name() << endl ; } // Give a subgraph/substreamgraph number > 0 to HeadNodes (level 0) @@ -2430,12 +2634,32 @@ bool GraphBase::Graph::ValidLoops() const { return true ; } +bool GraphBase::Graph::ValidSwitchs() const { + cdebug_in << "GraphBase::Graph::ValidSwitchs" << endl; + + int i ; + GraphBase::ComputingNode * aNode ; + for ( i = 0 ; i < GraphNodesSize() ; i++ ) { + aNode = GraphNodes( i ) ; + if ( aNode->IsSwitchNode() ) { + GraphBase::SwitchNode * aSwitchNode = (GraphBase::SwitchNode * ) aNode ; + if ( !aSwitchNode->CheckSwitch() ) { + cdebug_out << "GraphBase::Graph::ValidSwitchs false aSwitchNode " << aSwitchNode->Name() + << endl; + return false ; + } + } + } + cdebug_out << "GraphBase::Graph::ValidSwitchs true" << endl; + return true ; +} + // Controle de la coherence des noeuds de calcul // Enregistrement dans la liste des noeuds "tete" de graphe bool GraphBase::Graph::ComputingNodes() const { bool RetVal = true ; - cdebug << "GraphExecutor::GraphControl::ComputingNodes ()" << endl; + cdebug << "GraphExecutor::Graph::ComputingNodes ()" << endl; // list aComputingNodesList = _G->ComputingNodesList() ; // list::iterator aNode = aComputingNodesList.begin(); @@ -2447,6 +2671,8 @@ bool GraphBase::Graph::ComputingNodes() const { GraphBase::ComputingNode * aNode ; for ( i = 0 ; i < GraphNodesSize() ; i++ ) { aNode = GraphNodes( i ) ; + cdebug << "Graph::ComputingNodes " << i << ". " << aNode->Name() << " Head " << aNode->IsHeadNode() + << endl ; // 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 ((*aNode)->GetNodeInPortsSize() == 0) @@ -2532,10 +2758,12 @@ bool GraphBase::Graph::LinkLoopNodes(bool & NewLink ) { GraphBase::GOTONode * aGOTONode = (GraphBase::GOTONode * ) aNode ; GraphBase::OutPort *anOutGate = aGOTONode->GetChangeNodeOutGate() ; if ( anOutGate->IsNotConnected() ) { - RetVal = aGOTONode->CoupledNode() != NULL; - if ( RetVal ) { - RetVal = AddLink( aGOTONode , anOutGate , - aGOTONode->CoupledNode() , aGOTONode->CoupledNode()->GetChangeNodeInGate() ); + if ( aGOTONode->CoupledNode() ) { + cdebug << "Graph::LinkLoopNodes aNode " << aNode << " : " << aNode->Name() + << aGOTONode->CoupledNode() << " : " << aGOTONode->CoupledNode()->Name() + << endl ; + RetVal = 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 ; @@ -2689,7 +2917,7 @@ SUPERV::GraphState GraphBase::Graph::PortState( } } if ( anOutPort ) { - aRet = anOutPort->State() ; + aRet = anOutPort->PortState() ; // cdebug << "GraphBase::Graph::PortState --> " << aRet << endl ; } } @@ -2702,13 +2930,18 @@ SUPERV::GraphState GraphBase::Graph::PortState( return aRet ; } -const CORBA::Any * GraphBase::Graph::PortInData( const char* ToNodeName , - const char* ToServiceParameterName ) { - const CORBA::Any * aRet = new CORBA::Any() ; +#define TracePortInOutData 0 +//JR 30.03.2005const CORBA::Any * GraphBase::Graph::PortInData( const char* ToNodeName , +const CORBA::Any GraphBase::Graph::PortInData( const char* ToNodeName , + const char* ToServiceParameterName ) { +//JR 30.03.2005 const CORBA::Any * aRet = new CORBA::Any() ; + CORBA::Any aRet = CORBA::Any() ; char *theNode ; char *aPort ; -// cdebug_in << "GraphBase::Graph::PortInData " << ToNodeName << " " -// << ToServiceParameterName << endl ; +#if TracePortInOutData + cdebug_in << "GraphBase::Graph::PortInData " << ToNodeName << " " + << ToServiceParameterName << endl ; +#endif NodePort( ToNodeName , ToServiceParameterName , &theNode , &aPort ) ; GraphBase::ComputingNode * aNode = GetChangeGraphNode( theNode ) ; @@ -2719,10 +2952,19 @@ const CORBA::Any * GraphBase::Graph::PortInData( const char* ToNodeName , if ( anInPort ) { anOutPort = anInPort->GetOutPort() ; if ( anOutPort ) { +#if TracePortInOutData + cdebug << "-->PortInData " << ToNodeName << " " << ToServiceParameterName << " " + << endl ; +#endif aRet = anOutPort->Value() ; +#if TracePortInOutData + cdebug << "<--PortInData " << ToNodeName << " " << ToServiceParameterName << " " ; + anOutPort->StringValue( *GraphBase::Base::_fdebug ) ; + cdebug << endl ; cdebug << "Graph::PortInData OutPort value " << anOutPort->NodeName() << "(" << anOutPort->PortName() << ") --> InPort " << anInPort->NodeName() << "(" << anInPort->PortName() << ") " << anInPort->PortStatus() << endl ; +#endif } else { cdebug << "Graph::PortInData GraphBase::Graph::PortInData " << ToNodeName << " " @@ -2740,17 +2982,23 @@ const CORBA::Any * GraphBase::Graph::PortInData( const char* ToNodeName , } delete theNode ; delete aPort ; -// cdebug_out << "GraphBase::Graph::PortInData " << endl ; +#if TracePortInOutData + cdebug_out << "GraphBase::Graph::PortInData " << endl ; +#endif return aRet ; } -const CORBA::Any * GraphBase::Graph::PortOutData( const char* FromNodeName , - const char* FromServiceParameterName ) { - const CORBA::Any * aRet = new CORBA::Any() ; +//JR 30.03.2005const CORBA::Any * GraphBase::Graph::PortOutData( const char* FromNodeName , +const CORBA::Any GraphBase::Graph::PortOutData( const char* FromNodeName , + const char* FromServiceParameterName ) { +//JR 30.03.2005 const CORBA::Any * aRet = new CORBA::Any() ; + CORBA::Any aRet = CORBA::Any() ; char *theNode ; char *aPort ; -// cdebug_in << "GraphBase::Graph::PortOutData " << FromNodeName << " " -// << FromServiceParameterName << endl ; +#if TracePortInOutData + cdebug_in << "GraphBase::Graph::PortOutData " << FromNodeName << " " + << FromServiceParameterName << endl ; +#endif NodePort( FromNodeName , FromServiceParameterName , &theNode , &aPort ) ; GraphBase::ComputingNode * aNode = GetChangeGraphNode( theNode ) ; @@ -2759,7 +3007,16 @@ const CORBA::Any * GraphBase::Graph::PortOutData( const char* FromNodeName , GraphBase::OutPort *anOutPort ; anOutPort = aNode->GetChangeOutPort( aPort ); if ( anOutPort ) { +#if TracePortInOutData + cdebug << "-->PortOutData " << FromNodeName << " " << FromServiceParameterName << " " + << endl ; +#endif aRet = anOutPort->Value() ; +#if TracePortInOutData + cdebug << "<--PortOutData " << FromNodeName << " " << FromServiceParameterName << " " ; + anOutPort->StringValue( *GraphBase::Base::_fdebug ) ; + cdebug << endl ; +#endif } else { cdebug << "GraphBase::Graph::PortOutData " << FromNodeName << " " @@ -2772,7 +3029,9 @@ const CORBA::Any * GraphBase::Graph::PortOutData( const char* FromNodeName , } delete theNode ; delete aPort ; -// cdebug_out << "GraphBase::Graph::PortOutData " << endl ; +#if TracePortInOutData + cdebug_out << "GraphBase::Graph::PortOutData " << endl ; +#endif return aRet ; } @@ -2822,6 +3081,6 @@ bool GraphBase::Graph::StartComponent(const int aThread , } } */ - cdebug_out << aThread << " GraphBase::Graph::StartComponent " << RetVal << endl; + cdebug_out << aThread << " GraphBase::Graph::StartComponent " << RetVal << endl; return RetVal ; } diff --git a/src/GraphBase/DataFlowBase_Graph.hxx b/src/GraphBase/DataFlowBase_Graph.hxx index 6f4e1fd..108d1c1 100644 --- a/src/GraphBase/DataFlowBase_Graph.hxx +++ b/src/GraphBase/DataFlowBase_Graph.hxx @@ -70,11 +70,13 @@ namespace GraphBase { vector _QueueNodes ; bool _ParallelExecutionNodes ; -// For generated NodeNames with ServiceName : number of Nodes using -// the same ServiceName. It is not the same Service if it belongs to +// For StreamGraphs. It is not the same Service if it belongs to // a different Interface and/or a different Component ... map< string , GraphBase::Service * > _MapOfServiceNames ; +// For automactic rename of nodes if unique names in graphs + map< string , int > _MapOfServiceInstanceNumber ; + // Total number of SubGraphs int _SubGraphsNumber ; // _SubGraphs[ SubGraphNumero ] [ NodeNumero ] @@ -155,6 +157,8 @@ namespace GraphBase { void DelGraphNodeIndex( const char *name ) { _MapOfGraphNodes.erase( name ) ; } ; + int GetGraphNodeSize() const { + return _MapOfGraphNodes.size() ; } const GraphBase::ComputingNode * GetGraphNode( const int index ) const { const ComputingNode * aNode = GetChangeGraphNode( index ) ; return aNode ; } ; @@ -244,10 +248,12 @@ namespace GraphBase { if ( aState == SUPERV::DoneState ) aRet = true ; return aRet ; } ; - const CORBA::Any * PortInData( const char* ToNodeName , - const char* ToServiceParameterName ) ; - const CORBA::Any * PortOutData( const char* FromNodeName , - const char* FromServiceParameterName ) ; +//JR 30.03.2005 const CORBA::Any * PortInData( const char* ToNodeName , + const CORBA::Any PortInData( const char* ToNodeName , + const char* ToServiceParameterName ) ; +//JR 30.03.2005 const CORBA::Any * PortOutData( const char* FromNodeName , + const CORBA::Any PortOutData( const char* FromNodeName , + const char* FromServiceParameterName ) ; bool LoadXml( CORBA::ORB_ptr Orb , const char* anXmlFile , GraphBase::ListOfSGraphs & aListOfDataFlows ) ; @@ -285,9 +291,9 @@ namespace GraphBase { bool ChangeInputData( const char* ToNodeName , const char* ToParameterName , const CORBA::Any aValue ) ; - bool AddInputData( const char* ToNodeName , - const char* ToParameterName , - const CORBA::Any ** aValue ) ; +// bool AddInputData( const char* ToNodeName , +// const char* ToParameterName , +// const CORBA::Any ** aValue ) ; bool AddOutputData( const char* FromNodeName , const char* FromParameterName , @@ -300,6 +306,7 @@ namespace GraphBase { bool Sort( int & SubStreamGraphsNumber ) ; bool ValidLoops() const ; + bool ValidSwitchs() const ; bool ComputingNodes() const ; bool LinkLoopNodes(bool & NewLink ) ; bool DataServerNodes() const ; @@ -310,7 +317,7 @@ namespace GraphBase { map< string , GraphBase::Service * > MapOfServiceNames() ; GraphBase::Service * GetServiceOfMap( char * name ) ; bool SetServiceOfMap( GraphBase::Service * aService ) ; - int GetServiceNameNumber( SALOME_ModuleCatalog::Service aService ) ; + int GetNewServiceInstanceNumber( char * aServiceName ) ; SUPERV::ListOfStrings * LevelNodes(long aLevel ) ; long ThreadsMax() { diff --git a/src/GraphBase/DataFlowBase_InLineNode.cxx b/src/GraphBase/DataFlowBase_InLineNode.cxx index 4d763aa..71e0016 100644 --- a/src/GraphBase/DataFlowBase_InLineNode.cxx +++ b/src/GraphBase/DataFlowBase_InLineNode.cxx @@ -168,7 +168,8 @@ bool GraphBase::InLineNode::SaveXML( QDomDocument & Graph , QDomElement & info , GraphBase::ListOfPythonFunctions aPythonFunction ; if ( PyFuncName() ) { aFuncNames.resize( 1 ) ; - aFuncNames[0] = CORBA::string_dup( PyFuncName() ) ; +//JR 24.02.2005 Memory Leak aFuncNames[0] = CORBA::string_dup( PyFuncName() ) ; + aFuncNames[0] = string( PyFuncName() ) ; aPythonFunction.resize( 1 ) ; aPythonFunction[0] = PythonFunction() ; } @@ -184,7 +185,8 @@ bool GraphBase::InLineNode::SavePY(ostream &f , const char * aGraphName , GraphBase::ListOfPythonFunctions aPythonFunction ; if ( PyFuncName() ) { aFuncNames.resize( 1 ) ; - aFuncNames[0] = CORBA::string_dup( PyFuncName() ) ; +//JR 24.02.2005 Memory Leak aFuncNames[0] = CORBA::string_dup( PyFuncName() ) ; + aFuncNames[0] = string( PyFuncName() ) ; aPythonFunction.resize( 1 ) ; aPythonFunction[0] = PythonFunction() ; } diff --git a/src/GraphBase/DataFlowBase_InLineNode.hxx b/src/GraphBase/DataFlowBase_InLineNode.hxx index ab18858..d3fdfa3 100644 --- a/src/GraphBase/DataFlowBase_InLineNode.hxx +++ b/src/GraphBase/DataFlowBase_InLineNode.hxx @@ -73,7 +73,8 @@ namespace GraphBase { const SUPERV::ListOfStrings * PythonFunction() const { return &_PythonFunction ; } ; char * PyFuncName() const { - return my_strdup( _FuncName ) ; } ; +//JR 17.02.2005 Memory Leak return my_strdup( _FuncName ) ; } ; + return _FuncName ; } ; void PyRunMethod( PyObject * MyPyRunMethod ) { _MyPyRunMethod = MyPyRunMethod ; } ; PyObject * PyRunMethod() { diff --git a/src/GraphBase/DataFlowBase_InPort.cxx b/src/GraphBase/DataFlowBase_InPort.cxx index 9f8f7b5..7e0dedb 100644 --- a/src/GraphBase/DataFlowBase_InPort.cxx +++ b/src/GraphBase/DataFlowBase_InPort.cxx @@ -34,7 +34,7 @@ char ** _PortStateName ; GraphBase::InPort::InPort() : Port() { - _State = SUPERV::UndefinedState ; + _PortState = SUPERV::UndefinedState ; _OutPort = NULL ; _InitialOutPort = NULL ; } @@ -45,7 +45,7 @@ GraphBase::InPort::InPort( const SUPERV::KindOfPort aKind , const SALOME_ModuleCatalog::DataStreamDependency aDependency ) : Port( Name , aserviceParameter , aKind , aDependency ) { - _State = SUPERV::UndefinedState ; + _PortState = SUPERV::UndefinedState ; _OutPort = NULL ; _InitialOutPort = NULL ; } @@ -118,6 +118,9 @@ bool GraphBase::InPort::RemoveOutPort() { if ( !IsEndSwitch() ) { RemoveCoords() ; } + else { + Kind( SUPERV::InLineParameter ) ; + } return true ; } @@ -136,8 +139,8 @@ ostream & operator<< (ostream &f ,const GraphBase::InPort &P) { return f; } -ostream & operator<< (ostream &f ,const SUPERV::GraphState & aState ) { - switch (aState) { +ostream & operator<< (ostream &f ,const SUPERV::GraphState & aPortState ) { + switch (aPortState) { case SUPERV::UndefinedState : f << "UndefinedState"; break; diff --git a/src/GraphBase/DataFlowBase_InPort.hxx b/src/GraphBase/DataFlowBase_InPort.hxx index 5716725..89217ab 100644 --- a/src/GraphBase/DataFlowBase_InPort.hxx +++ b/src/GraphBase/DataFlowBase_InPort.hxx @@ -39,9 +39,10 @@ namespace GraphBase { private: - SUPERV::GraphState _State ; + SUPERV::GraphState _PortState ; OutPort * _OutPort ; OutPort * _InitialOutPort ; + bool _BranchOfSwitchLinked ; // For Check from Branches to EndOfSwitch links public: @@ -58,24 +59,26 @@ namespace GraphBase { cdebug << "GraphBase::InPort::destroy " << PortName() << " " << NodeName() << endl ; } ; - void State( SUPERV::GraphState aState ) { + void PortState( SUPERV::GraphState aPortState ) { // cdebug << pthread_self() << " " << PortName() << " from " // << NodeName() << " SUPERV::GraphState " << _State << " " -// << " --> " << aState << " _EndSwitchPort " +// << " --> " << aPortState << " _EndSwitchPort " // << IsEndSwitch() << endl ; - _State = aState ; } ; - SUPERV::GraphState State() { return _State ; } ; + _PortState = aPortState ; } ; + SUPERV::GraphState PortState() { return _PortState ; } ; OutPort * GetOutPort() { return _OutPort ; } ; OutPort * GetOutPort() const { return _OutPort ; } ; const StatusOfPort PortStatus() const ; + bool IsNotConnected() const ; // bool IsConnected() const ; bool IsPortConnected() const ; bool IsDataConnected() const ; bool IsExternConnected() const ; + bool AddOutPort( OutPort * anOutPort ) { if ( _OutPort ) return false ; @@ -91,6 +94,15 @@ namespace GraphBase { return false ; } ; bool RemoveOutPort() ; + bool BranchOfSwitchLinked( bool aInPortLinked ) { + if ( aInPortLinked && _BranchOfSwitchLinked ) { + return false ; // Already setted + } + _BranchOfSwitchLinked = aInPortLinked ; + return true ; } ; + bool BranchOfSwitchLinked() { + return _BranchOfSwitchLinked ; } ; + void StringValue(ostream & f ) const ; } ; diff --git a/src/GraphBase/DataFlowBase_LoopNode.cxx b/src/GraphBase/DataFlowBase_LoopNode.cxx index b062881..2e4e15c 100644 --- a/src/GraphBase/DataFlowBase_LoopNode.cxx +++ b/src/GraphBase/DataFlowBase_LoopNode.cxx @@ -104,9 +104,12 @@ bool GraphBase::LoopNode::SaveXML( QDomDocument & Graph , QDomElement & info , aPythonFunction[2] = NextPythonFunction() ; GraphBase::ListOfFuncName aFuncNames ; aFuncNames.resize( 3 ) ; - aFuncNames[0] = CORBA::string_dup( PyFuncName() ) ; - aFuncNames[1] = CORBA::string_dup( PyMoreName() ) ; - aFuncNames[2] = CORBA::string_dup( PyNextName() ) ; +//JR 24.02.2005 Memory Leak aFuncNames[0] = CORBA::string_dup( PyFuncName() ) ; + aFuncNames[0] = string( PyFuncName() ) ; +//JR 24.02.2005 Memory Leak aFuncNames[1] = CORBA::string_dup( PyMoreName() ) ; + aFuncNames[1] = string( PyMoreName() ) ; +//JR 24.02.2005 Memory Leak aFuncNames[2] = CORBA::string_dup( PyNextName() ) ; + aFuncNames[2] = string( PyNextName() ) ; char * CoupledName = "" ; if ( CoupledNode() ) { CoupledName = CoupledNode()->Name() ; @@ -127,9 +130,12 @@ bool GraphBase::LoopNode::SavePY( ostream &f , const char * aGraphName , aPythonFunction[2] = NextPythonFunction() ; GraphBase::ListOfFuncName aFuncNames ; aFuncNames.resize( 3 ) ; - aFuncNames[0] = CORBA::string_dup( PyFuncName() ) ; - aFuncNames[1] = CORBA::string_dup( PyMoreName() ) ; - aFuncNames[2] = CORBA::string_dup( PyNextName() ) ; +//JR 24.02.2005 Memory Leak aFuncNames[0] = CORBA::string_dup( PyFuncName() ) ; + aFuncNames[0] = string( PyFuncName() ) ; +//JR 24.02.2005 Memory Leak aFuncNames[1] = CORBA::string_dup( PyMoreName() ) ; + aFuncNames[1] = string( PyMoreName() ) ; +//JR 24.02.2005 Memory Leak aFuncNames[2] = CORBA::string_dup( PyNextName() ) ; + aFuncNames[2] = string( PyNextName() ) ; return GraphBase::ComputingNode::SavePY( f , aGraphName , "" , "" , "" , CoupledNode() , aFuncNames , aPythonFunction , diff --git a/src/GraphBase/DataFlowBase_LoopNode.hxx b/src/GraphBase/DataFlowBase_LoopNode.hxx index 45d80ca..abfb20d 100644 --- a/src/GraphBase/DataFlowBase_LoopNode.hxx +++ b/src/GraphBase/DataFlowBase_LoopNode.hxx @@ -65,7 +65,8 @@ namespace GraphBase { return aMorePythonFunction ; } ; char * PyMoreName() { - return my_strdup( _MoreName ) ; } ; +//JR 17.02.2005 Memory Leak return my_strdup( _MoreName ) ; } ; + return _MoreName ; } ; void PyMoreMethod( PyObject * MyPyMoreMethod ) { _MyPyMoreMethod = MyPyMoreMethod ; } ; @@ -86,7 +87,8 @@ namespace GraphBase { return aNextPythonFunction ; } ; char * PyNextName() { - return my_strdup( _NextName ) ; } ; +//JR 17.02.2005 Memory Leak return my_strdup( _NextName ) ; } ; + return _NextName ; } ; void PyNextMethod( PyObject * MyPyNextMethod ) { _MyPyNextMethod = MyPyNextMethod ; } ; diff --git a/src/GraphBase/DataFlowBase_OutPort.cxx b/src/GraphBase/DataFlowBase_OutPort.cxx index 61d6cfa..d03f937 100644 --- a/src/GraphBase/DataFlowBase_OutPort.cxx +++ b/src/GraphBase/DataFlowBase_OutPort.cxx @@ -103,17 +103,21 @@ bool GraphBase::OutPort::RemoveInPort() { } int index = 1 ; GraphBase::InPort * toPort = _InPorts[ index - 1 ] ; - cdebug << "OutPort::RemoveInPort " << NodeName() << "( " << PortName() << " " << PortStatus() << " ) --> " - << toPort->NodeName() << "( " << toPort->PortName() << " " << toPort->PortStatus() - << " )" << endl ; _InPortsSize -= 1 ; _InPorts.resize( _InPortsSize ) ; _Links.resize( _InPortsSize ) ; _MapOfInPorts.erase( toPort->NodePortName() ) ; if ( _InPortsSize == 0 ) { PortStatus(NotConnected ) ; + if ( IsSwitch() ) { + Kind( SUPERV::InLineParameter ) ; + } } toPort->RemoveOutPort() ; + cdebug << "OutPort::RemoveInPort " << NodeName() << "( " << PortName() << " " << PortStatus() + << " " << Kind() << " ) _InPortsSize " << _InPortsSize << " --> " + << toPort->NodeName() << "( " << toPort->PortName() << " " << toPort->PortStatus() + << " " << toPort->Kind() << " )" << endl ; return true ; } @@ -138,6 +142,9 @@ bool GraphBase::OutPort::RemoveInPort( GraphBase::InPort * toPort ) { _MapOfInPorts.erase( toPort->NodePortName() ) ; if ( _InPortsSize == 0 ) { PortStatus(NotConnected ) ; + if ( IsSwitch() ) { + Kind( SUPERV::InLineParameter ) ; + } } toPort->RemoveOutPort() ; return true ; diff --git a/src/GraphBase/DataFlowBase_Port.hxx b/src/GraphBase/DataFlowBase_Port.hxx index 44a93b7..6077468 100644 --- a/src/GraphBase/DataFlowBase_Port.hxx +++ b/src/GraphBase/DataFlowBase_Port.hxx @@ -62,6 +62,8 @@ namespace GraphBase { const SALOME_ModuleCatalog::DataStreamDependency aDependency = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED ) : ServicesParameter( aserviceParameter ) { _NodeName = NodeName ; +// cdebug << "Port::Port _NodeName " << _NodeName << " = " << (void * ) *_NodeName +// << " = " << _NodeName << " in Port " << PortName() << endl ; _Port = SUPERV::Port::_nil() ; _KindOfPort = aKindOfPort ; if ( IsDataStream() ) { @@ -71,13 +73,16 @@ namespace GraphBase { _Dependency = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED ; } } ; virtual ~Port() { - cdebug << "~Port" << endl ; } ; + cdebug << "~Port _NodeName " << *_NodeName << endl ; } ; SUPERV::Port_var ObjRef() const { return _Port ; } ; void ObjRef(SUPERV::Port_var aPort) { _Port = aPort ; } ; - const char * NodeName() const { return *_NodeName ; } ; + const char * NodeName() const { +// cdebug << "Port::NodeName _NodeName " << _NodeName << " = " << (void * ) *_NodeName +// << " = " << *_NodeName << " in Port " << PortName() << endl ; + return *_NodeName ; } ; const char * NodePortName() const { // cout << "NodePortName " << hex << (void *) _NodeName << " " // << dec << _NodeName << endl ; diff --git a/src/GraphBase/DataFlowBase_PortsOfNode.cxx b/src/GraphBase/DataFlowBase_PortsOfNode.cxx index e464f54..4c4c04d 100644 --- a/src/GraphBase/DataFlowBase_PortsOfNode.cxx +++ b/src/GraphBase/DataFlowBase_PortsOfNode.cxx @@ -112,14 +112,14 @@ void GraphBase::PortsOfNode::DefPortsOfNode( aPortKind = SUPERV::InLineParameter ; } for ( i = 0 ; i < _NodeInPortsSize ; i++ ) { - cdebug << "DefPortsOfNode delete In" << i << ". " << _NodeInPorts[i] + cdebug << "DefPortsOfNode delete In" << i << ". " << _NodeInPorts[i]->PortName() << endl ; _MapOfNodeInPorts.erase( _NodeInPorts[i]->PortName() ) ; delete _NodeInPorts[i] ; } _NodeInPorts.resize( 0 ); for ( i = 0 ; i < _NodeOutPortsSize ; i++ ) { - cdebug << "DefPortsOfNode delete Out" << i << ". " << _NodeOutPorts[i]->PortName() + cdebug << "DefPortsOfNode delete Out" << i << ". " << _NodeOutPorts[i]->PortName() << endl ; _MapOfNodeOutPorts.erase( _NodeOutPorts[i]->PortName() ) ; delete _NodeOutPorts[i] ; @@ -156,7 +156,8 @@ void GraphBase::PortsOfNode::DefPortsOfNode( } cdebug << "NodeInPortsSize " << _NodeInPortsSize << endl ; for ( i = iVec ; i < _NodeInPortsSize ; i++ ) { - string _aParametername = CORBA::string_dup(aService.ServiceinParameter[i-iVec].Parametername) ; +//JR 24.02.2005 Memory Leak string _aParametername = CORBA::string_dup(aService.ServiceinParameter[i-iVec].Parametername) ; + string _aParametername = string(aService.ServiceinParameter[i-iVec].Parametername) ; const char *aParametername = _aParametername.c_str() ; if ( _MapOfNodeInPorts[ aParametername ] ) { if ( !DataFlowOrComputing && @@ -175,7 +176,7 @@ void GraphBase::PortsOfNode::DefPortsOfNode( _NodeInPorts[i] = new GraphBase::InPort( NodeName , aServiceParameter , aPortKind ); _NodeInPorts[i]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ; -// cdebug << i << ". " << *_NodeInPorts[i] << " " << _NodeInPorts[i]->Kind() << endl ; + cdebug << i << ". " << *_NodeInPorts[i] << " " << _NodeInPorts[i]->Kind() << endl ; } } iVec += aService.ServiceinParameter.length() ; @@ -224,7 +225,8 @@ void GraphBase::PortsOfNode::DefPortsOfNode( } cdebug << "NodeOutPortsSize " << _NodeOutPortsSize << endl ; for ( i = iVec ; i < _NodeOutPortsSize ; i++ ) { - string _aParametername = CORBA::string_dup(aService.ServiceoutParameter[i-iVec].Parametername) ; +//JR 24.02.2005 Memory Leak string _aParametername = CORBA::string_dup(aService.ServiceoutParameter[i-iVec].Parametername) ; + string _aParametername = string(aService.ServiceoutParameter[i-iVec].Parametername) ; const char *aParametername = _aParametername.c_str() ; if ( _MapOfNodeOutPorts[ aParametername ] ) { if ( !DataFlowOrComputing && @@ -243,7 +245,7 @@ void GraphBase::PortsOfNode::DefPortsOfNode( _NodeOutPorts[i] = new GraphBase::OutPort( NodeName , aServiceParameter , aPortKind ); _NodeOutPorts[i]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ; -// cdebug << i << ". " << *_NodeOutPorts[i] << " " << _NodeOutPorts[i]->Kind() << endl ; + cdebug << i << ". " << *_NodeOutPorts[i] << " " << _NodeOutPorts[i]->Kind() << endl ; } } iVec += aService.ServiceoutParameter.length() ; diff --git a/src/GraphBase/DataFlowBase_Service.cxx b/src/GraphBase/DataFlowBase_Service.cxx index 1df079f..85b8f79 100644 --- a/src/GraphBase/DataFlowBase_Service.cxx +++ b/src/GraphBase/DataFlowBase_Service.cxx @@ -57,7 +57,7 @@ void GraphBase::Service::SetService( const SALOME_ModuleCatalog::Service aServic _Service.ServiceoutDataStreamParameter[ i ].Parameterdependency = aService.ServiceoutDataStreamParameter[ i ].Parameterdependency ; } // cdebug << "GraphBase::Service::SetService : " << _Service << endl ; - _Instance = 0 ; +// _Instance = 0 ; } ostream & operator<< (ostream & f ,const SALOME_ModuleCatalog::Service & s ) { diff --git a/src/GraphBase/DataFlowBase_Service.hxx b/src/GraphBase/DataFlowBase_Service.hxx index 0c4f57a..84a9240 100644 --- a/src/GraphBase/DataFlowBase_Service.hxx +++ b/src/GraphBase/DataFlowBase_Service.hxx @@ -40,7 +40,7 @@ namespace GraphBase { private: SALOME_ModuleCatalog::Service _Service ; - int _Instance ; +// int _Instance ; public: @@ -52,8 +52,8 @@ namespace GraphBase { } ; Service( const char * aServiceName ) { _Service.ServiceName = CORBA::string_dup( aServiceName ) ; - cdebug << "GraphBase::Service::Service : " << _Service << endl ; - _Instance = 0 ; } ; + cdebug << "GraphBase::Service::Service : " << _Service << endl ; } ; +// _Instance = 0 ; } ; virtual ~Service() { cdebug << "GraphBase::Service::~Service" << endl ; } ; @@ -75,13 +75,14 @@ namespace GraphBase { const SALOME_ModuleCatalog::ListOfServicesDataStreamParameter ServiceOutStreamParameter() const { return _Service.ServiceoutDataStreamParameter ; } ; - const int Instances() const { return _Instance ; } ; - int NewInstance() { _Instance += 1 ; - return _Instance ; } ; - void Instance( int Inst = 1 ) { if ( Inst == 1 ) - _Instance += 1 ; - else - _Instance = Inst ; } ; } ; +// const int Instances() const { return _Instance ; } ; +// int NewInstance() { _Instance += 1 ; +// return _Instance ; } ; +// void Instance( int Inst = 1 ) { if ( Inst == 1 ) +// _Instance += 1 ; +// else +// _Instance = Inst ; } ; } ; + } ; } ; diff --git a/src/GraphBase/DataFlowBase_StreamNode.cxx b/src/GraphBase/DataFlowBase_StreamNode.cxx index b3048d7..fb0a7a1 100644 --- a/src/GraphBase/DataFlowBase_StreamNode.cxx +++ b/src/GraphBase/DataFlowBase_StreamNode.cxx @@ -170,7 +170,8 @@ bool GraphBase::StreamNode::RemoveLinkedNode( GraphBase::StreamNode * ToNode , map< string , int >::iterator aMapOfLinkedNodesIterator ; int i = 0 ; for ( aMapOfLinkedNodesIterator = _MapOfLinkedNodes.begin() ; - aMapOfLinkedNodesIterator != _MapOfLinkedNodes.end() ; aMapOfLinkedNodesIterator++ ) { + aMapOfLinkedNodesIterator != _MapOfLinkedNodes.end() && i < _LinkedNodesSize ; + aMapOfLinkedNodesIterator++ ) { cdebug << "_MapOfLinkedNodes" << i++ << " of " << Name() << " : " << aMapOfLinkedNodesIterator->first << " --> " << aMapOfLinkedNodesIterator->second << endl ; @@ -180,7 +181,8 @@ bool GraphBase::StreamNode::RemoveLinkedNode( GraphBase::StreamNode * ToNode , map< string , int >::iterator aMapOfLinkedFromNodesIterator ; int ifrom = 0 ; for ( aMapOfLinkedFromNodesIterator = ToNode->_MapOfLinkedFromNodes.begin() ; - aMapOfLinkedFromNodesIterator != ToNode->_MapOfLinkedFromNodes.end() ; aMapOfLinkedFromNodesIterator++ ) { + aMapOfLinkedFromNodesIterator != ToNode->_MapOfLinkedFromNodes.end() && + ifrom < ToNode->_LinkedFromNodesSize ; aMapOfLinkedFromNodesIterator++ ) { cdebug << "_MapOfLinkedFromNodes" << ifrom++ << " of " << ToNode->Name() << " : " << aMapOfLinkedFromNodesIterator->first << " --> " << aMapOfLinkedFromNodesIterator->second << endl ; @@ -262,22 +264,36 @@ bool GraphBase::StreamNode::RemoveLinkedNode( GraphBase::StreamNode * ToNode , map< string , int >::iterator aMapOfLinkedNodesIterator1 ; int ii = 0 ; for ( aMapOfLinkedNodesIterator1 = _MapOfLinkedNodes.begin() ; - aMapOfLinkedNodesIterator1 != _MapOfLinkedNodes.end() ; aMapOfLinkedNodesIterator1++ ) { - cdebug << "_MapOfLinkedNodes" << ii++ << " of " << Name() << " : " - << aMapOfLinkedNodesIterator1->first << " --> " << aMapOfLinkedNodesIterator1->second - << " " << _LinkedNodes[ aMapOfLinkedNodesIterator1->second - 1 ]->Name() << endl ; + aMapOfLinkedNodesIterator1 != _MapOfLinkedNodes.end() && ii < _LinkedNodesSize ; + aMapOfLinkedNodesIterator1++ ) { + if ( aMapOfLinkedNodesIterator1->second ) { + cdebug << "_MapOfLinkedNodes" << ii++ << " of " << Name() << " : " + << aMapOfLinkedNodesIterator1->first << " --> " << aMapOfLinkedNodesIterator1->second + << " " << _LinkedNodes[ aMapOfLinkedNodesIterator1->second - 1 ]->Name() << endl ; + } + else { + cdebug << "_MapOfLinkedNodes" << ii << " of " << Name() << " : " + << aMapOfLinkedNodesIterator1->second - 1 << endl ; + } } #endif #if 1 map< string , int >::iterator aMapOfLinkedFromNodesIterator1 ; int iifrom = 0 ; for ( aMapOfLinkedFromNodesIterator1 = ToNode->_MapOfLinkedFromNodes.begin() ; - aMapOfLinkedFromNodesIterator1 != ToNode->_MapOfLinkedFromNodes.end() ; aMapOfLinkedFromNodesIterator1++ ) { - cdebug << "_MapOfLinkedFromNodes" << iifrom++ << " of " << ToNode->Name() << " : " - << aMapOfLinkedFromNodesIterator1->first << " --> " - << aMapOfLinkedFromNodesIterator1->second << " " - << ToNode->_LinkedFromNodes[ aMapOfLinkedFromNodesIterator1->second - 1 ]->Name() - << endl ; + aMapOfLinkedFromNodesIterator1 != ToNode->_MapOfLinkedFromNodes.end() && + iifrom < ToNode->_LinkedFromNodesSize ; aMapOfLinkedFromNodesIterator1++ ) { + if ( aMapOfLinkedFromNodesIterator1->second ) { + cdebug << "_MapOfLinkedFromNodes" << iifrom++ << " of " << ToNode->Name() << " : " + << aMapOfLinkedFromNodesIterator1->first << " --> " + << aMapOfLinkedFromNodesIterator1->second << " " + << ToNode->_LinkedFromNodes[ aMapOfLinkedFromNodesIterator1->second - 1 ]->Name() + << endl ; + } + else { + cdebug << "_MapOfLinkedFromNodes" << iifrom << " of " << ToNode->Name() << " : " + << aMapOfLinkedFromNodesIterator1->second - 1 << endl ; + } } #endif cdebug_out << "StreamNode::RemoveLinkedNode between " << Name() << " and " << ToNode->Name() @@ -288,7 +304,7 @@ bool GraphBase::StreamNode::RemoveLinkedNode( GraphBase::StreamNode * ToNode , void GraphBase::StreamNode::ReNameLinkedNode( const char* OldNodeName , const char* NewNodeName ) { cdebug_in << Name() << "->GraphBase::StreamNode::ReNameLinkedNode (" << OldNodeName << " , " - << NewNodeName << ")" << endl; + << NewNodeName << ") _LinkedNodesSize " << _LinkedNodesSize << endl; int index = GetLinkedNodeIndex( OldNodeName ) ; if ( index >= 0 ) { // _MapOfLinkedNodes.erase( OldNodeName ) ; @@ -299,13 +315,25 @@ void GraphBase::StreamNode::ReNameLinkedNode( const char* OldNodeName , cdebug << "GraphBase::StreamNode::ReNameLinkedNode ERROR " << OldNodeName << " not found in " << Name() << endl ; } +#if 1 + map< string , int >::iterator aMapOfLinkedNodesIterator1 ; + int ii = 0 ; + for ( aMapOfLinkedNodesIterator1 = _MapOfLinkedNodes.begin() ; + aMapOfLinkedNodesIterator1 != _MapOfLinkedNodes.end() && ii < _LinkedNodesSize ; + aMapOfLinkedNodesIterator1++ ) { + cdebug << "_MapOfLinkedNodes" << ii++ << " of " << Name() << " : " + << aMapOfLinkedNodesIterator1->first << " --> " << aMapOfLinkedNodesIterator1->second + << " " << _LinkedNodes[ aMapOfLinkedNodesIterator1->second - 1 ]->Name() << endl ; + } +#endif cdebug_out << Name() << "->GraphBase::StreamNode::ReNameLinkedNode" << endl ; } void GraphBase::StreamNode::ReNameLinkedFromNode( const char* OldNodeName , const char* NewNodeName ) { - cdebug_in << Name() << "->GraphBase::StreamNode::ReNameLinkedFromNode (" << OldNodeName << " , " - << NewNodeName << ")" << endl; + cdebug_in << Name() << "->GraphBase::StreamNode::ReNameLinkedFromNode (" << OldNodeName + << " , " << NewNodeName << ") _LinkedFromNodesSize " << _LinkedFromNodesSize + << endl; int index = GetLinkedFromNodeIndex( OldNodeName ) ; if ( index >= 0 ) { // _MapOfLinkedFromNodes.erase( OldNodeName ) ; @@ -316,6 +344,19 @@ void GraphBase::StreamNode::ReNameLinkedFromNode( const char* OldNodeName , cdebug << Name() << "->GraphBase::StreamNode::ReNameLinkedFromNode ERROR " << OldNodeName << " not found in " << Name() << endl ; } +#if 1 + map< string , int >::iterator aMapOfLinkedFromNodesIterator1 ; + int iifrom = 0 ; + for ( aMapOfLinkedFromNodesIterator1 = _MapOfLinkedFromNodes.begin() ; + aMapOfLinkedFromNodesIterator1 != _MapOfLinkedFromNodes.end() && + iifrom < _LinkedFromNodesSize ; aMapOfLinkedFromNodesIterator1++ ) { + cdebug << "_MapOfLinkedFromNodes" << iifrom++ << " of " << Name() << " : " + << aMapOfLinkedFromNodesIterator1->first << " --> " + << aMapOfLinkedFromNodesIterator1->second << " " + << _LinkedFromNodes[ aMapOfLinkedFromNodesIterator1->second - 1 ]->Name() + << endl ; + } +#endif cdebug_out << Name() << "->GraphBase::StreamNode::ReNameLinkedFromNode" << endl ; } diff --git a/src/GraphBase/DataFlowBase_StreamNode.hxx b/src/GraphBase/DataFlowBase_StreamNode.hxx index 122d152..63398c7 100644 --- a/src/GraphBase/DataFlowBase_StreamNode.hxx +++ b/src/GraphBase/DataFlowBase_StreamNode.hxx @@ -51,6 +51,8 @@ namespace GraphBase { vector _LinkedStreamNodes ; vector _LinkedInStreamPortsNumber ; + bool _NodeDoneInBranchOfSwitch ; + bool _HeadNode ; int _LevelNumber ; int _SortedIndex ; @@ -84,8 +86,15 @@ namespace GraphBase { public: - char * Name() const { return my_strdup( _Name ) ; } ; - const char *const * NamePtr() const { return &_Name ; } ; +//JR 17.02.2005 Memory Leak char * Name() const { return my_strdup( _Name ) ; } ; + char * Name() const { +// cdebug << "StreamNode::Name " << (void * ) _Name << " = " << _Name << endl ; +//JR 21.02.2005 Memory Leak return my_strdup( _Name ) ; } ; + return _Name ; } ; + const char *const * NamePtr() const { +// cdebug << "StreamNode::NamePtr " << (void ** ) &_Name << " = Name " << (void * ) _Name +// << " = " << _Name << endl ; + return &_Name ; } ; bool Name( const char * aName ) ; SUPERV::KindOfNode Kind() const { @@ -207,6 +216,16 @@ namespace GraphBase { StreamNode * LinkedStreamNodes( int i ) const { return _LinkedStreamNodes[ i ] ; } ; + bool BranchOfSwitchDone( bool aNodeDoneInBranchOfSwitch ) { + bool prevalue = _NodeDoneInBranchOfSwitch ; + _NodeDoneInBranchOfSwitch = aNodeDoneInBranchOfSwitch ; + if ( prevalue && !aNodeDoneInBranchOfSwitch ) { + return false ; + } + return true ; } ; + bool BranchOfSwitchDone() { + return _NodeDoneInBranchOfSwitch ; } ; + void HeadNode( bool aHeadNode ) { _HeadNode = aHeadNode ; } ; const bool IsHeadNode() const { return _HeadNode ; } ; diff --git a/src/GraphBase/DataFlowBase_SwitchNode.cxx b/src/GraphBase/DataFlowBase_SwitchNode.cxx index e75a394..ada6a21 100644 --- a/src/GraphBase/DataFlowBase_SwitchNode.cxx +++ b/src/GraphBase/DataFlowBase_SwitchNode.cxx @@ -14,6 +14,8 @@ using namespace std; //#include #include "DataFlowBase_SwitchNode.hxx" +#include "DataFlowBase_EndOfSwitchNode.hxx" +#include "DataFlowBase_Graph.hxx" GraphBase::SwitchNode::SwitchNode() : GraphBase::GOTONode::GOTONode() { @@ -73,3 +75,259 @@ GraphBase::SwitchNode::~SwitchNode() { // delete [] _Comment; } +bool GraphBase::SwitchNode::CheckSwitch() const { + GraphBase::EndOfSwitchNode * anEndSwitchNode ; + anEndSwitchNode = (GraphBase::EndOfSwitchNode * ) CoupledNode() ; + cdebug_in << Name() << "->SwitchNode::CheckSwitch EndSwitchNode " + << anEndSwitchNode->Name() << endl; + int i ; + +//All nodes between Switch and EndSwitch will have _BranchOfSwitchDone to false +//When we have to execute such a node in a switchbranch, if _BranchOfSwitchDone is true we have +// an error ; else we set _BranchOfSwitchDone to true + for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) { + GraphBase::OutPort * anOutPort = GetChangeNodeOutPort( i ) ; + if ( anOutPort->IsSwitch() || anOutPort->IsGate() ) { + int j ; + for ( j = 0 ; j < anOutPort->InPortsSize() ; j++ ) { + GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( j ) ; + GraphBase::ComputingNode * aNode ; + aNode = GraphOfNode()->GetChangeGraphNode( anInPort->NodeName() ) ; + if ( aNode && aNode != anEndSwitchNode ) { + aNode->InitBranchOfSwitchDone( true , anEndSwitchNode ) ; + } + } + } + } + + bool DefaultConnected = false ; +//OutPorts of the SwitchNode + for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) { + GraphBase::OutPort * anOutPort = GetChangeNodeOutPort( i ) ; + if ( anOutPort->IsSwitch() || anOutPort->IsGate() ) { +// We have a branch of the switch + cdebug << endl << Name() << "->SwitchNode::CheckSwitch OutPort " << anOutPort->PortName() + << " " << anOutPort->PortStatus() << " " << anOutPort->Kind() + << " SWITCHBRANCH" << endl ; + +//JR 11.02.2005 : if Default is not connected and if Default is true at execution time, the SwitchNode +// execution will be aborted +//Behavior : in that case, that means that a SwitchBranch should be a DefaultBranch and it is not the case ! +//1. DEFAULT_OUTPORT +//JR 07.04.2005 Debug : an OutPort of the SwitchNode may be linked to the DefaultPort of +// the EndSwitchNode <==> +// SwitchNode( Default ) --> EndSwitchNode( Default ) + bool EndSwitchNode_Default = false ; + if ( anOutPort->InPortsSize() ) { + GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( 0 ) ; + GraphBase::ComputingNode * aNode ; + aNode = GraphOfNode()->GetChangeGraphNode( anInPort->NodeName() ) ; + if ( aNode == anEndSwitchNode ) { + EndSwitchNode_Default = true ; + } + } +//JR 07.04.2005 if ( anOutPort->IsGate() ) { + if ( anOutPort->IsGate() || EndSwitchNode_Default ) { + if ( anOutPort->InPortsSize() == 0 ) { +// DefaultPort of the SwitchNode is not connected + cdebug_out << Name() << "->SwitchNode::CheckSwitch EndSwitchNode " + << anEndSwitchNode->Name() << " OutPort " << anOutPort->PortName() << " " + << anOutPort->InPortsSize() << " InPortsSize EndSwitch(Default) " + << anEndSwitchNode->GetNodeInGate()->PortStatus() << "WARNING" << endl; + } + else { +// But the DefaultPort of the EndSwitchNode is connected : so there is a branch going to +// that DefaultPort + cdebug_out << Name() << "->SwitchNode::CheckSwitch EndSwitchNode " + << anEndSwitchNode->Name() << " OutPort " << anOutPort->PortName() << " " + << " " << anOutPort->PortStatus() << " " << anOutPort->InPortsSize() << " InPortsSize " + << endl ; + DefaultConnected = true ; + + anEndSwitchNode->InitEndSwitchInPortLinked() ; + +// That DefaultBranch have to go directly to the EndSwitchNode + GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( 0 ) ; + GraphBase::ComputingNode * aNode ; + aNode = GraphOfNode()->GetChangeGraphNode( anInPort->NodeName() ) ; + if ( aNode != anEndSwitchNode ) { + cdebug_out << Name() << "->SwitchNode::CheckSwitch EndSwitchNode " + << anEndSwitchNode->Name() << " for OutPort " << anOutPort->PortName() + << " linked to " << aNode->Name() << " WARNING false" << endl; + return false ; + } + cdebug << endl << Name() << " Check of " << anOutPort->PortName() << " switch port branch" + << " to EndSwitchNode" << endl ; +// All of InPorts of the EndSwitchNode have to be done : + int k ; + for ( k = 0 ; k < GetNodeOutPortsSize() ; k++ ) { + GraphBase::OutPort * anOutPort = GetChangeNodeOutPort( k ) ; + if ( !anOutPort->IsGate() ) { + GraphBase::InPort * anInPort ; + anInPort = anEndSwitchNode->GetChangeInPort( anOutPort->PortName() ) ; + if ( anInPort && !anEndSwitchNode->DecrEndSwitchInPortLinked( anInPort ) ) { + cdebug_out << Name() << "->SwitchNode::CheckSwitch EndSwitchNode " + << anEndSwitchNode->Name() << " for port " << anInPort->PortName() + << " WARNING false" << endl; + return false ; + } + else { + cdebug_out << Name() << "->SwitchNode::CheckSwitch EndSwitchNode " + << anEndSwitchNode->Name() << " OutPort " << anOutPort->PortName() + << " " << anOutPort->PortStatus() << " " << anOutPort->Kind() + << " not in EndSwitchNode : IGNORED" + << endl; + } + } + else { + cdebug_out << Name() << "->SwitchNode::CheckSwitch EndSwitchNode " + << anEndSwitchNode->Name() << " OutPort " << anOutPort->PortName() + << " " << anOutPort->PortStatus() << " " << anOutPort->Kind() + << " SwitchPort or Gate : IGNORED" + << endl; + } + } +// Check that all InPorts of the EndSwitchNode have a value : + if ( !anEndSwitchNode->CheckEndSwitchInPortsLinked() ) { + cdebug_out << Name() << "->SwitchNode::CheckSwitch EndSwitchNode " + << anEndSwitchNode->Name() << " " << aNode->Name() + << " WARNING false" << endl; + return false ; + } + } + } + +//2. SWITCH_OUTPORT + else { +// We have a SwitchPort which is connected to Gates +// We initialize the _NodeDoneInBranchOfSwitch field to false for each node of the +// InPortsSize() branch(es) + int j ; + for ( j = 0 ; j < anOutPort->InPortsSize() ; j++ ) { + GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( j ) ; + GraphBase::ComputingNode * aNode ; + aNode = GraphOfNode()->GetChangeGraphNode( anInPort->NodeName() ) ; + if ( aNode && aNode != anEndSwitchNode ) { + if ( !aNode->InitBranchOfSwitchDone( false , anEndSwitchNode ) ) { + cdebug << Name() << "->ComputingNode::InitBranchOfSwitchDone WARNING false" + << " Node common to two or more branchs of switch" << endl ; + return false ; + } + } + } + + anEndSwitchNode->InitEndSwitchInPortLinked() ; + +// At first all of not SwitchPort should have to be done also : +// Not Switch Branches (Gate not connected to a switch port of a SwitchNode) : +// They are always executed except if we execute the DefaultBranch ... + cdebug << "1. " << Name() << "->SwitchNode::CheckSwitch at first NOT_SWITCH_BRANCH_OUTPORT FOR " + << anOutPort->PortName() + << " " << anOutPort->PortStatus() << " " << anOutPort->Kind() << endl ; + for ( j = 0 ; j < GetNodeOutPortsSize() ; j++ ) { + GraphBase::OutPort * anOutPort = GetChangeNodeOutPort( j ) ; + if ( !anOutPort->IsSwitch() && !anOutPort->IsGate() ) { + int k ; + for ( k = 0 ; k < anOutPort->InPortsSize() ; k++ ) { + GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( k ) ; + GraphBase::ComputingNode * aNode ; + aNode = GraphOfNode()->GetChangeGraphNode( anInPort->NodeName() ) ; + if ( aNode ) { + const GraphBase::InPort * anInGatePort = aNode->GetNodeInGate() ; + cdebug << Name() << "->SwitchNode::CheckSwitch InPort" << k << ". " + << anInPort->PortName() << " of " << aNode->Name() << " :" << endl ; +// Direct Connexion to the EndSwitchNode : always executed (except for DefaultBranch) + if ( aNode == anEndSwitchNode ) { + if ( !anEndSwitchNode->DecrEndSwitchInPortLinked( anInPort ) ) { + cdebug_out << Name() << "->SwitchNode::CheckSwitch EndSwitchNode " + << anEndSwitchNode->Name() << " for port " << anInPort->PortName() + << " WARNING false" << endl; + return false ; + } + cdebug << Name() << "->SwitchNode::CheckSwitch Check of '" + << anOutPort->PortName() << "' " << anOutPort->Kind() + << " NOT switch port Branch to EndSwitchNode " + << aNode->Name() << " is done" << endl ; + } +// Check that InGate is not linked from a SwitchPort or a GatePort of the SwitchNode : + else if ( !anInGatePort->GetOutPort() ) { + cdebug << Name() << "->SwitchNode::CheckSwitch Check of '" + << anOutPort->PortName() << "' " << anOutPort->Kind() + << " NOT switch port Branch to node " + << aNode->Name() << " will be done" << endl ; + if ( !aNode->CheckSwitch( anEndSwitchNode ) ) { + cdebug_out << Name() << "->SwitchNode::CheckSwitch EndSwitchNode " + << anEndSwitchNode->Name() << " " << aNode->Name() + << " WARNING false" << endl; + return false ; + } + cdebug << Name() << "->SwitchNode::CheckSwitch Check of '" + << anOutPort->PortName() << "' " << anOutPort->Kind() + << " NOT switch port Branch to node " + << aNode->Name() << " is done" << endl ; + } + else { + cdebug << Name() << "->SwitchNode::CheckSwitch Check of '" + << anOutPort->PortName() << "' " << anOutPort->Kind() + << " NOT switch port Branch to node " + << aNode->Name() << " has InGate connected IGNORED for that branch" << endl ; + } + } + } + } + } + + cdebug << "2. "<< Name() << "->SwitchNode::CheckSwitch and now SWITCH_BRANCH_OUTPORT " + << anOutPort->PortName() + << " " << anOutPort->PortStatus() << " " << anOutPort->Kind() << endl ; +// And all links from the switchport anOutPort (connected to Gates) will be checked + for ( j = 0 ; j < anOutPort->InPortsSize() ; j++ ) { + GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( j ) ; + GraphBase::ComputingNode * aNode ; + aNode = GraphOfNode()->GetChangeGraphNode( anInPort->NodeName() ) ; + if ( aNode == NULL ) { + cdebug << Name() << "->SwitchNode::CheckSwitch Check of " << anOutPort->PortName() + << " switch port branch " + << aNode->Name() << " ignored" << endl ; + } + + + else { +// That branch does not go directly to the EndSwitchNode +// Control the OutPorts Values of the SwitchNode through the branch + cdebug << Name() << " Check of " << anOutPort->PortName() + << " switch port Branch to node " + << aNode->Name() << endl ; + if ( !aNode->CheckSwitch( anEndSwitchNode ) ) { + cdebug_out << Name() << "->SwitchNode::CheckSwitch EndSwitchNode " + << anEndSwitchNode->Name() << " " << aNode->Name() << " WARNING false" + << endl; + return false ; + } + } + } +// Check that all InPorts of the EndSwitchNode have a value : + if ( !anEndSwitchNode->CheckEndSwitchInPortsLinked() ) { + cdebug_out << Name() << "->SwitchNode::CheckSwitch EndSwitchNode " + << anEndSwitchNode->Name() << " CheckEndSwitchInPortsLinked WARNING false" + << endl; + return false ; + } + else { + cdebug << Name() << "->SwitchNode::CheckSwitch OutPort " << anOutPort->PortName() + << " " << anOutPort->PortStatus() << " " << anOutPort->Kind() + << " SWITCHBRANCH IS OK" << endl << endl ; + } + } + } + else { + cdebug << Name() << "->SwitchNode::CheckSwitch OutPort " << anOutPort->PortName() + << " " << anOutPort->PortStatus() << " " << anOutPort->Kind() << " NOTSWITCHBRANCH" + << " IGNORED" << endl ; + } + } + cdebug_out << Name() << "->SwitchNode::CheckSwitch EndSwitchNode " + << anEndSwitchNode->Name() << " true" << endl; + return true ; +} + diff --git a/src/GraphBase/DataFlowBase_SwitchNode.hxx b/src/GraphBase/DataFlowBase_SwitchNode.hxx index de44def..0c093f1 100644 --- a/src/GraphBase/DataFlowBase_SwitchNode.hxx +++ b/src/GraphBase/DataFlowBase_SwitchNode.hxx @@ -41,6 +41,7 @@ namespace GraphBase { ofstream * Graph_fdebug = NULL ) ; virtual ~SwitchNode() ; + bool CheckSwitch() const ; }; }; diff --git a/src/GraphBase/DataFlowBase_XmlHandler.cxx b/src/GraphBase/DataFlowBase_XmlHandler.cxx index 7578329..068dc83 100644 --- a/src/GraphBase/DataFlowBase_XmlHandler.cxx +++ b/src/GraphBase/DataFlowBase_XmlHandler.cxx @@ -357,7 +357,7 @@ bool GraphBase::XmlHandler::endElement( const QString&, else if ( qName == "streamgraph-deltatime" ) { if ( fieldvalue[depth] == NULLSTRING ) return returnfalse( this , "depth3-3" , qName ) ; - sscanf( fieldvalue[depth].c_str() ,"%lf" , (int * ) &aNode.theDeltaTime ) ; + sscanf( fieldvalue[depth].c_str() ,"%lf" , (double * ) &aNode.theDeltaTime ) ; fieldvalue[depth] = NULLSTRING ; step[depth]++ ; step[4] = 0 ; diff --git a/src/GraphBase/DataFlowBase_XmlHandler.hxx b/src/GraphBase/DataFlowBase_XmlHandler.hxx index d92285b..b4f3d9e 100755 --- a/src/GraphBase/DataFlowBase_XmlHandler.hxx +++ b/src/GraphBase/DataFlowBase_XmlHandler.hxx @@ -29,6 +29,8 @@ #define INCLUDE_MENUITEM_DEF #define QT_ALTERNATE_QTSMANIP +#include "DataFlowBase_Graph.hxx" + #include #include #include @@ -37,7 +39,6 @@ //#include //#include CORBA_CLIENT_HEADER(SALOME_SuperVision) -#include "DataFlowBase_Graph.hxx" #define maxlevel 7 diff --git a/src/GraphBase/Makefile.in b/src/GraphBase/Makefile.in index a119495..208f161 100644 --- a/src/GraphBase/Makefile.in +++ b/src/GraphBase/Makefile.in @@ -92,7 +92,8 @@ LIB_CLIENT_IDL = Logger.idl \ SALOMEDS.idl \ SUPERV.idl \ SALOMEDS_Attributes.idl \ - SALOME_Exception.idl + SALOME_Exception.idl \ + SALOME_GenericObj.idl # Executables targets BIN = SuperVisionBase_CheckOfUndefined BIN_SRC = diff --git a/src/GraphEditor/DataFlowEditor_DataFlow.hxx b/src/GraphEditor/DataFlowEditor_DataFlow.hxx index 1bc4096..b2931a7 100644 --- a/src/GraphEditor/DataFlowEditor_DataFlow.hxx +++ b/src/GraphEditor/DataFlowEditor_DataFlow.hxx @@ -205,12 +205,14 @@ namespace GraphEditor { const char * ToParameterName , const CORBA::Any aValue = CORBA::Any() ) ; - const CORBA::Any * GetInData( const char * ToNodeName , - const char * ToParameterName ) ; - const CORBA::Any * GetOutData( const char * FromNodeName , - const char * FromParameterName ) ; - - bool IsValid() ; +//JR 30.03.2005 const CORBA::Any * GetInData( const char * ToNodeName , + const CORBA::Any GetInData( const char * ToNodeName , + const char * ToParameterName ) ; +//JR 30.03.2005 const CORBA::Any * GetOutData( const char * FromNodeName , + const CORBA::Any GetOutData( const char * FromNodeName , + const char * FromParameterName ) ; + + bool IsValid(bool kLoopSwitch = true ) ; bool IsExecutable() ; void Executing() ; // asv : removed a bool parameter, use Editing() to set _Executing = false diff --git a/src/GraphEditor/DataFlowEditor_DataFlow.lxx b/src/GraphEditor/DataFlowEditor_DataFlow.lxx index 93bfb43..d69cc14 100644 --- a/src/GraphEditor/DataFlowEditor_DataFlow.lxx +++ b/src/GraphEditor/DataFlowEditor_DataFlow.lxx @@ -407,21 +407,25 @@ inline bool GraphEditor::DataFlow::AddInputData( const char* ToNodeName , return Graph()->AddInputData( ToNodeName , ToParameterName , aValue ) ; } ; -inline const CORBA::Any *GraphEditor::DataFlow::GetInData( +//JR 30.03.2005inline const CORBA::Any *GraphEditor::DataFlow::GetInData( +inline const CORBA::Any GraphEditor::DataFlow::GetInData( const char * ToNodeName , const char * ToParameterName ) { return GraphEditor::OutNode::GetInData( ToNodeName , ToParameterName ) ; } -inline const CORBA::Any *GraphEditor::DataFlow::GetOutData( +//JR 30.03.2005inline const CORBA::Any *GraphEditor::DataFlow::GetOutData( +inline const CORBA::Any GraphEditor::DataFlow::GetOutData( const char * FromNodeName , const char * FromParameterName ) { return GraphEditor::OutNode::GetOutData( FromNodeName , FromParameterName ) ; } -inline bool GraphEditor::DataFlow::IsValid() { - return GraphEditor::OutNode::IsValid() ; +//JR Optional parameter kLoopSwitch (default = true) : +//In some cases we do not need to check the validity of loops and switchs +inline bool GraphEditor::DataFlow::IsValid(bool kLoopSwitch ) { + return GraphEditor::OutNode::IsValid( kLoopSwitch ) ; } inline bool GraphEditor::DataFlow::IsExecutable() { @@ -466,14 +470,14 @@ inline bool GraphEditor::DataFlow::IsReadOnly() { } inline long GraphEditor::DataFlow::LevelMax() { - if ( !IsValid() ) { + if ( !IsValid( false ) ) { return 0 ; } return Graph()->LevelMax() ; } inline SUPERV::ListOfStrings * GraphEditor::DataFlow::LevelNodes(long aLevel ) { - if ( !IsValid() ) { + if ( !IsValid( false ) ) { return ((SUPERV::ListOfStrings * ) NULL ) ; } return Graph()->LevelNodes( aLevel ) ; diff --git a/src/GraphEditor/DataFlowEditor_InNode.hxx b/src/GraphEditor/DataFlowEditor_InNode.hxx index 3fbbd72..0bb2a91 100644 --- a/src/GraphEditor/DataFlowEditor_InNode.hxx +++ b/src/GraphEditor/DataFlowEditor_InNode.hxx @@ -180,11 +180,14 @@ namespace GraphEditor { SUPERV::SDate LastModification() const { return _ComputingNode->LastModification() ; } ; char* Author() const { - return my_strdup( _ComputingNode->Author() ) ; } +//JR 17.02.2005 Memory Leak return my_strdup( _ComputingNode->Author() ) ; } + return _ComputingNode->Author() ; } char* EditorRelease() const { - return my_strdup( _ComputingNode->EditorRelease() ) ; } ; +//JR 17.02.2005 Memory Leak return my_strdup( _ComputingNode->EditorRelease() ) ; } ; + return _ComputingNode->EditorRelease() ; } ; char * Comment() const { - return my_strdup( _ComputingNode->Comment() ) ; } ; +//JR 17.02.2005 Memory Leak return my_strdup( _ComputingNode->Comment() ) ; } ; + return _ComputingNode->Comment() ; } ; bool Author( const char * anAuthor ) { return _ComputingNode->Author( anAuthor ) ; } ; bool EditorRelease( const char* anEditorRelease ) { diff --git a/src/GraphEditor/DataFlowEditor_OutNode.cxx b/src/GraphEditor/DataFlowEditor_OutNode.cxx index e0dfda4..95bd6c0 100644 --- a/src/GraphEditor/DataFlowEditor_OutNode.cxx +++ b/src/GraphEditor/DataFlowEditor_OutNode.cxx @@ -206,7 +206,8 @@ bool GraphEditor::OutNode::LoadDataFlow( const GraphBase::SGraph * aDataFlow ) { cdebug << "GraphEditor::OutNode::LoadDataFlow() LoadDatas GraphNodesSize " << Graph()->GraphNodesSize() << endl; RetVal = LoadDatas( aMapOfNodes , (*aDataFlow).Datas ) ; } - cdebug_out << "GraphEditor::OutNode::LoadDataFlow done GraphNodesSize " << Graph()->GraphNodesSize() << endl; + cdebug_out << "GraphEditor::OutNode::LoadDataFlow done GraphNodesSize " << Graph()->GraphNodesSize() + << " RetVal " << RetVal << endl; return RetVal ; } @@ -445,6 +446,7 @@ bool GraphEditor::OutNode::LoadNodes(map< string , int > & aMapOfNodes , bool GraphEditor::OutNode::LoadLinks(map< string , int > & aMapOfNodes , const GraphBase::ListOfSLinks &aListOfLinks ) { bool RetVal = true ; + bool RetAddLink ; cdebug_in << "GraphEditor::OutNode::LoadLinks" << endl ; // MESSAGE( "GraphEditor::OutNode::LoadLinks" ); int i , j ; @@ -458,21 +460,16 @@ bool GraphEditor::OutNode::LoadLinks(map< string , int > & aMapOfNodes , << aLink.ToServiceParameterName.c_str() << " )" << endl ; if ( Graph()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] ) && Graph()->GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] ) ) { -// GraphBase::ComputingNode * aFromNode = (GraphBase::ComputingNode * ) Graph()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] ) ; -// const GraphBase::OutPort * anOutPort = aFromNode->GetOutPort( aLink.FromServiceParameterName.c_str() ) ; - RetVal = AddLink( Graph()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() , - aLink.FromServiceParameterName.c_str() , - Graph()->GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() , - aLink.ToServiceParameterName.c_str() ) ; -// , *anOutPort->Value() ) ; +//JR 08.02.2005 : Rule of CEA : a bad graph may be stored in a xml + RetAddLink = AddLink( Graph()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() , + aLink.FromServiceParameterName.c_str() , + Graph()->GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() , + aLink.ToServiceParameterName.c_str() ) ; } else { RetVal = false ; } -// aLink.aLinkValue ) ; - if ( !RetVal ) - break ; - else { + if ( RetVal && RetAddLink ) { for ( j = 0 ; j < (int ) aLink.aListOfCoords.size() ; j++ ) { RetVal = AddLinkCoord( Graph()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() , aLink.FromServiceParameterName.c_str() , @@ -488,13 +485,14 @@ bool GraphEditor::OutNode::LoadLinks(map< string , int > & aMapOfNodes , delete aLinkFromNodeName ; delete aLinkToNodeName ; } - cdebug_out << "GraphEditor::OutNode::LoadLinks" << endl ; + cdebug_out << "GraphEditor::OutNode::LoadLinks " << RetVal << endl ; return RetVal ; } bool GraphEditor::OutNode::LoadDatas(map< string , int > & aMapOfNodes , const GraphBase::ListOfSLinks &aListOfDatas ) { bool RetVal = true ; + bool RetAddLink ; cdebug_in << "GraphEditor::OutNode::LoadDatas" << endl ; // MESSAGE( "GraphEditor::OutNode::LoadDatas" ); int i ; @@ -509,15 +507,15 @@ bool GraphEditor::OutNode::LoadDatas(map< string , int > & aMapOfNodes , // << aMapOfNodes[ aLinkFromNodeName->c_str() ] << endl ; // cout << " " << aLink.ToNodeName.c_str() << " " // << aMapOfNodes[ aLinkToNodeName->c_str() ] << endl ; - RetVal = Graph()->AddInputData( Graph()->GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() , - aLink.ToServiceParameterName.c_str() , - aLink.aLinkValue ) ; + RetAddLink = Graph()->AddInputData( Graph()->GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() , + aLink.ToServiceParameterName.c_str() , + aLink.aLinkValue ) ; delete aLinkFromNodeName ; delete aLinkToNodeName ; if ( !RetVal ) break ; } - cdebug_out << "GraphEditor::OutNode::LoadDatas" << endl ; + cdebug_out << "GraphEditor::OutNode::LoadDatas " << RetVal << endl ; return RetVal ; } @@ -540,7 +538,7 @@ bool GraphEditor::OutNode::SaveXml(const char* filename) { // cout << "GraphEditor::OutNode::SaveXML " << xml << endl ; // f << xml << endl ; // } - cdebug_out << "GraphEditor::OutNode::SaveXml" << endl; + cdebug_out << "GraphEditor::OutNode::SaveXml " << test << endl; return test; } @@ -690,7 +688,9 @@ GraphEditor::InNode * GraphEditor::OutNode::AddNode( if ( aNodeName ) { delete [] aNodeName ; } - int num = Graph()->GetServiceNameNumber( NodeService ) ; +// int num = Graph()->GetServiceNameNumber( NodeService ) ; + char * aServiceName = (CORBA::String_member ) NodeService.ServiceName ; + int num = Graph()->GetNewServiceInstanceNumber( aServiceName ) ; ostringstream astr ; astr << num << ends ; const char * n_instance = astr.str().c_str() ; @@ -732,7 +732,8 @@ GraphEditor::InNode * GraphEditor::OutNode::AddNode( for ( i = 0 ; i < NodeService.ServiceinDataStreamParameter.length() ; i++ ) { GraphBase::InDataStreamPort * aDataStreamPort ; aDataStreamPort = Nd->ComputingNode()->AddInDataStreamPort( - my_strdup( NodeService.ServiceinDataStreamParameter[i].Parametername ) , +//JR 17.02.2005 Memory Leak my_strdup( NodeService.ServiceinDataStreamParameter[i].Parametername ) , + NodeService.ServiceinDataStreamParameter[i].Parametername , NodeService.ServiceinDataStreamParameter[i].Parametertype , NodeService.ServiceinDataStreamParameter[i].Parameterdependency , SUPERV::DataStreamParameter ) ; @@ -740,7 +741,8 @@ GraphEditor::InNode * GraphEditor::OutNode::AddNode( for ( i = 0 ; i < NodeService.ServiceoutDataStreamParameter.length() ; i++ ) { GraphBase::OutDataStreamPort * aDataStreamPort ; aDataStreamPort = Nd->ComputingNode()->AddOutDataStreamPort( - my_strdup( NodeService.ServiceoutDataStreamParameter[i].Parametername ) , +//JR 17.02.2005 Memory Leak my_strdup( NodeService.ServiceoutDataStreamParameter[i].Parametername ) , + NodeService.ServiceoutDataStreamParameter[i].Parametername , NodeService.ServiceoutDataStreamParameter[i].Parametertype , NodeService.ServiceoutDataStreamParameter[i].Parameterdependency , SUPERV::DataStreamParameter ) ; @@ -759,8 +761,13 @@ GraphEditor::InNode * GraphEditor::OutNode::AddNode( cdebug << "ERROR NodeName is NULL or already exists." << endl ; } // delete [] aNodeName ; - cdebug_out << "GraphEditor::OutNode::AddNode" << endl; _Valid = false ; + if ( Nd == NULL ) { + cdebug_out << "GraphEditor::OutNode::AddNode : NULL" << endl; + } + else { + cdebug_out << "GraphEditor::OutNode::AddNode : " << Nd << " " << Nd->Name() << endl; + } return Nd ; } @@ -931,7 +938,9 @@ bool GraphEditor::OutNode::UnValid() { return RetVal ; } -bool GraphEditor::OutNode::Valid() { +//JR Optional parameter kLoopSwitch (default = true) : +//In some cases we do not need to check the validity of loops and switchs +bool GraphEditor::OutNode::Valid(bool kLoopSwitch ) { if ( _Valid ) return true ; @@ -966,21 +975,30 @@ bool GraphEditor::OutNode::Valid() { if ( Graph()->IsDataStreamNode() ) { StreamGraph()->SubStreamGraphsNumber( SubStreamGraphsNumber ) ; } - if ( !Graph()->ValidLoops() ) { - cdebug_out << "This DataFlow have not valid Loops." << endl ; - return false ; + + Graph()->InLineServices() ; + + if ( kLoopSwitch ) { + if ( !Graph()->ValidLoops() ) { + cdebug_out << "This DataFlow have not valid Loops." << endl ; + return false ; + } + if ( !Graph()->ValidSwitchs() ) { + cdebug_out << "This DataFlow have not valid Switchs." << endl ; + return false ; + } } // CreateService() ; - Graph()->InLineServices() ; - Graph()->ComputingNodes() ; - _Valid = true ; + if ( kLoopSwitch ) { + _Valid = true ; + } cdebug_out << "GraphEditor::OutNode::Valid " << _Valid << endl; - return _Valid ; + return true ; } bool GraphEditor::OutNode::Executable() { @@ -1022,22 +1040,26 @@ bool GraphEditor::OutNode::Executable() { return _Executable ; } -const CORBA::Any *GraphEditor::OutNode::GetInData( +//JR 30.03.2005const CORBA::Any *GraphEditor::OutNode::GetInData( +const CORBA::Any GraphEditor::OutNode::GetInData( const char * ToNodeName , const char * ToParameterName ) { // cdebug_in << "GraphEditor::OutNode::GetInData " << ToNodeName // << " " << ToParameterName << endl ; - const CORBA::Any * retdata = Graph()->PortInData( ToNodeName , ToParameterName ) ; +//JR 30.03.2005 const CORBA::Any * retdata = Graph()->PortInData( ToNodeName , ToParameterName ) ; + const CORBA::Any retdata = Graph()->PortInData( ToNodeName , ToParameterName ) ; // cdebug_out << "GraphEditor::OutNode::GetInData" << endl ; return retdata ; } -const CORBA::Any *GraphEditor::OutNode::GetOutData( +//JR 30.03.2005const CORBA::Any *GraphEditor::OutNode::GetOutData( +const CORBA::Any GraphEditor::OutNode::GetOutData( const char * FromNodeName , const char * FromParameterName ) { // cdebug_in << "GraphEditor::OutNode::GetOutData " << FromNodeName // << " " << FromParameterName << endl ; - const CORBA::Any * retdata = Graph()->PortOutData( FromNodeName , FromParameterName ) ; +//JR 30.03.2005 const CORBA::Any * retdata = Graph()->PortOutData( FromNodeName , FromParameterName ) ; + const CORBA::Any retdata = Graph()->PortOutData( FromNodeName , FromParameterName ) ; // cdebug_out << "GraphEditor::OutNode::GetOutData" << endl ; return retdata ; } @@ -1433,6 +1455,7 @@ bool GraphEditor::OutNode::SaveXML( ostream & f , QDomDocument & GraphQDom , bool GraphEditor::OutNode::SavePY( ostream & f , bool importSuperV ) { int i ; int j ; + const GraphBase::ListOfSLinks * Links ; if ( importSuperV ) { f << endl << "# Generated python file of Graph " << Graph()->Name() << endl << endl ; @@ -1549,7 +1572,7 @@ bool GraphEditor::OutNode::SavePY( ostream & f , bool importSuperV ) { } } - const GraphBase::ListOfSLinks * Links = Graph()->GetLinks() ; + Links = Graph()->GetLinks() ; // bool intervar ; // map< string , int > aMapOfOutPorts ; first = true ; diff --git a/src/GraphEditor/DataFlowEditor_OutNode.hxx b/src/GraphEditor/DataFlowEditor_OutNode.hxx index 0daf930..a439910 100644 --- a/src/GraphEditor/DataFlowEditor_OutNode.hxx +++ b/src/GraphEditor/DataFlowEditor_OutNode.hxx @@ -50,7 +50,7 @@ namespace GraphEditor { CORBA::ORB_ptr _Orb; - bool Valid() ; + bool Valid(bool kLoopSwitch = true ) ; bool Executable() ; bool LoadNodes( map< string , int > & aMapOfNodes , @@ -74,8 +74,6 @@ namespace GraphEditor { bool fromparam , bool toparam , bool wdata ) const; - bool SavePY(ostream &f , bool importSuperV ) ; - void DateModification() ; // asv 20.09.04 added from GraphExecutor::FiniteStateMachine class (removed from there) @@ -134,6 +132,8 @@ namespace GraphEditor { bool SaveXml(const char* myFileName ) ; bool SavePy(const char* myFileName ) ; + bool SavePY(ostream &f , bool importSuperV ) ; + // get all DataFlow informations (for a .XML file) : GraphBase::ListOfSGraphs * GetDataFlows( GraphBase::ListOfSGraphs * aListOfDataFlows ) ; @@ -272,9 +272,9 @@ namespace GraphEditor { const int index , long &X , long &Y ) ; - bool IsValid() { + bool IsValid(bool kLoopSwitch = true ) { if ( !_Valid ) - Valid() ; + Valid( kLoopSwitch ) ; return _Valid ; } ; bool IsNotValid() const { return !_Valid ; } ; @@ -302,10 +302,12 @@ namespace GraphEditor { // in-port of type "InPortType". Called from IsLinksCompatible() and Link_Impl::IsValid(). bool IsCompatible( const char* OutPortType, const char* InPortType ) const; - const CORBA::Any *GetInData( const char *ToNodeName , - const char *ToParameterName ) ; - const CORBA::Any *GetOutData( const char *FromNodeName , - const char *FromParameterName ) ; +//JR 30.03.2005 const CORBA::Any *GetInData( const char *ToNodeName , + const CORBA::Any GetInData( const char *ToNodeName , + const char *ToParameterName ) ; +//JR 30.03.2005 const CORBA::Any *GetOutData( const char *FromNodeName , + const CORBA::Any GetOutData( const char *FromNodeName , + const char *FromParameterName ) ; } ; }; diff --git a/src/GraphEditor/Makefile.in b/src/GraphEditor/Makefile.in index 4c991c4..d5223ca 100644 --- a/src/GraphEditor/Makefile.in +++ b/src/GraphEditor/Makefile.in @@ -51,7 +51,8 @@ LIB_CLIENT_IDL = SALOME_ModuleCatalog.idl \ SALOME_Component.idl \ SALOMEDS.idl \ SUPERV.idl \ - SALOME_Exception.idl + SALOME_Exception.idl \ + SALOME_GenericObj.idl # Executables targets #BIN = SuperVisionEditor_CheckOfUndefined diff --git a/src/GraphExecutor/DataFlowExecutor_DataFlow.cxx b/src/GraphExecutor/DataFlowExecutor_DataFlow.cxx index a1da842..801e9f1 100644 --- a/src/GraphExecutor/DataFlowExecutor_DataFlow.cxx +++ b/src/GraphExecutor/DataFlowExecutor_DataFlow.cxx @@ -126,13 +126,13 @@ bool GraphExecutor::DataFlow::InputOfAny( const char * ToServiceParameterName , GraphBase::OutPort * anOutPort ; anOutPort = Graph()->GetChangeInDataNodePort( ToServiceParameterName ) ; cdebug << pthread_self() << "GraphExecutor::DataFlow::InputOfAny " << Graph()->Name() - << " " << State() << " " << ToServiceParameterName << " " << anOutPort->State() - << " Done : " << anOutPort->Done() << endl ; + << " " << State() << " " << ToServiceParameterName << " " << anOutPort->PortState() + << " Done : " << anOutPort->PortDone() << endl ; RetVal = AddInputData( Graph()->Name() , ToServiceParameterName , aValue ) ; - anOutPort->State( SUPERV::ReadyState ) ; + anOutPort->PortState( SUPERV::ReadyState ) ; // There is only one port : - anOutPort->ChangeInPorts( 0 )->State( SUPERV::ReadyState ) ; - anOutPort->Done( true ) ; + anOutPort->ChangeInPorts( 0 )->PortState( SUPERV::ReadyState ) ; + anOutPort->PortDone( true ) ; // There is only one inport of a Node in an ReversedOutport of a graph : GraphExecutor::InNode * anInNode = (GraphExecutor::InNode * ) Graph()->GetChangeGraphNode( anOutPort->InPorts( 0 )->NodeName() )->GetInNode() ; cdebug << pthread_self() << "GraphExecutor::DataFlow::InputOfAny : " << anInNode->Name() @@ -218,7 +218,8 @@ bool GraphExecutor::DataFlow::OutputOfAny( const char * aNodeName , << " sended recursively to the MacroNode coupled to that graph" << endl ; Graph()->CoupledNode()->GraphEditor()->Executor()->OutputOfAny( Graph()->CoupledNodeName() , ToParameterName , - *anOutPort->Value() ) ; +//JR 30.03.2005 *anOutPort->Value() ) ; + anOutPort->Value() ) ; } else { cdebug << "GraphExecutor::DataFlow::OutputOfAny to Graph " << ToNodeName diff --git a/src/GraphExecutor/DataFlowExecutor_DataFlow.hxx b/src/GraphExecutor/DataFlowExecutor_DataFlow.hxx index bc6b495..d91484b 100644 --- a/src/GraphExecutor/DataFlowExecutor_DataFlow.hxx +++ b/src/GraphExecutor/DataFlowExecutor_DataFlow.hxx @@ -121,13 +121,15 @@ namespace GraphExecutor { bool IsRunning(const char * aNodeName ) ; bool IsDone(const char * aNodeName ) ; bool IsSuspended(const char * aNodeName ) ; - bool IsDone(const char * aNodeName , - const char * anOutServiceParameterName ) ; - - const CORBA::Any *GetInData( const char * ToNodeName , - const char * ToParameterName ) ; - const CORBA::Any *GetOutData( const char * FromNodeName , - const char * FromParameterName ) ; + bool PortDone( const char * aNodeName , + const char * anOutServiceParameterName ) ; + +//JR 30.03.2005 const CORBA::Any *GetInData( const char * ToNodeName , + const CORBA::Any GetInData( const char * ToNodeName , + const char * ToParameterName ) ; +//JR 30.03.2005 const CORBA::Any *GetOutData( const char * FromNodeName , + const CORBA::Any GetOutData( const char * FromNodeName , + const char * FromParameterName ) ; long Threads() ; diff --git a/src/GraphExecutor/DataFlowExecutor_DataFlow.lxx b/src/GraphExecutor/DataFlowExecutor_DataFlow.lxx index 377f542..67c8948 100644 --- a/src/GraphExecutor/DataFlowExecutor_DataFlow.lxx +++ b/src/GraphExecutor/DataFlowExecutor_DataFlow.lxx @@ -180,11 +180,10 @@ inline bool GraphExecutor::DataFlow::IsSuspended(const char * aNodeName ) { return GraphExecutor::OutNode::IsSuspended( aNodeName ) ; } -inline bool GraphExecutor::DataFlow::IsDone( - const char * aNodeName , - const char * anOutServiceParameterName ) { - return GraphExecutor::OutNode::IsDone( aNodeName , - anOutServiceParameterName ) ; +inline bool GraphExecutor::DataFlow::PortDone( const char * aNodeName , + const char * anOutServiceParameterName ) { + return GraphExecutor::OutNode::PortDone( aNodeName , + anOutServiceParameterName ) ; } inline bool GraphExecutor::DataFlow::ReadyWait() { @@ -213,13 +212,15 @@ inline bool GraphExecutor::DataFlow::SuspendedWait(const char * aNodeName ) { return GraphExecutor::OutNode::SuspendedWait( aNodeName ) ; } -inline const CORBA::Any *GraphExecutor::DataFlow::GetInData( +//JR 30.03.2005inline const CORBA::Any *GraphExecutor::DataFlow::GetInData( +inline const CORBA::Any GraphExecutor::DataFlow::GetInData( const char * ToNodeName , const char * ToParameterName ) { return GraphExecutor::OutNode::GetInData( ToNodeName , ToParameterName ) ; } -inline const CORBA::Any *GraphExecutor::DataFlow::GetOutData( +//JR 30.03.2005inline const CORBA::Any *GraphExecutor::DataFlow::GetOutData( +inline const CORBA::Any GraphExecutor::DataFlow::GetOutData( const char * FromNodeName , const char * FromParameterName ) { return GraphExecutor::OutNode::GetOutData( FromNodeName , diff --git a/src/GraphExecutor/DataFlowExecutor_FiniteStateMachine.cxx b/src/GraphExecutor/DataFlowExecutor_FiniteStateMachine.cxx index c563b25..0ed6762 100644 --- a/src/GraphExecutor/DataFlowExecutor_FiniteStateMachine.cxx +++ b/src/GraphExecutor/DataFlowExecutor_FiniteStateMachine.cxx @@ -125,7 +125,7 @@ void * start_function( void *p ) ; #define NumberOfEvents GraphExecutor::NumberOfEvents GraphExecutor::FiniteStateMachine::FiniteStateMachine() { -// cdebug_in << "FiniteStateMachine::FiniteStateMachine" << endl; + MESSAGE( "FiniteStateMachine::FiniteStateMachine" ) ; _ControlStateName[ VoidState ] = "VoidState" ; _ControlStateName[ ToSuspendStartState ]= "ToSuspendStartState" ; @@ -355,6 +355,10 @@ GraphExecutor::FiniteStateMachine::FiniteStateMachine() { // SuspendedExecutingState : NO ResumeEvent 13-03-2003 _TransitionTable[ SuspendedExecutingState ][ SuccessEvent ] = SuccessedExecutingState ; _ActionTable[ SuccessedExecutingState ][ SuccessEvent ] = Executing_SuccessAction; +//JR 24.03.2005 : Debug for PAL8176 : abort of GOTONode +// ErrorEvent + _TransitionTable[ SuccessedState ][ ErrorEvent ] = ErroredExecutingState ; + _ActionTable[ ErroredExecutingState ][ ErrorEvent ] = Executing_ErrorAction; // ErrorEvent _TransitionTable[ ExecutingState ][ ErrorEvent ] = ErroredExecutingState ; _ActionTable[ ErroredExecutingState ][ ErrorEvent ] = Executing_ErrorAction; @@ -459,8 +463,7 @@ GraphExecutor::FiniteStateMachine::FiniteStateMachine() { _GraphExecutingNumber = 0 ; _PyInitModule = false ; _DbgFileNumber = 0 ; -// cdebug_out << "FiniteStateMachine::FiniteStateMachine _TransitionTable " -// << endl; + MESSAGE( "FiniteStateMachine::FiniteStateMachine _TransitionTable " ) ; } void * start_function( void *p ) { @@ -494,17 +497,19 @@ void GraphExecutor::FiniteStateMachine::Executed() { for ( aPyFunction = _MapOfPyFunctions.begin() ; aPyFunction != _MapOfPyFunctions.end() ; aPyFunction++ ) { if ( !strcmp( aPyFunction->first.c_str() , "PyObjRef" ) || !strcmp( aPyFunction->first.c_str() , "PyObjIor" ) ) { - //cout << "GraphExecutor::FiniteStateMachine::Executed " << aPyFunction->first << " keeped ..."<< endl ; + MESSAGE( "GraphExecutor::FiniteStateMachine::Executed " << aPyFunction->first << " keeped ..." + ) ; } else { - //cout << "GraphExecutor::FiniteStateMachine::Executed " << aPyFunction->first << " erased ..."<< endl ; + MESSAGE( "GraphExecutor::FiniteStateMachine::Executed " << aPyFunction->first << " erased ..." + ) ; _MapOfPyFunctions.erase( aPyFunction->first ) ; } } } else { - //cout << "GraphExecutor::FiniteStateMachine::Executed _GraphExecutingNumber " << _GraphExecutingNumber - // << " != 0 ==> no erase" << endl ; + MESSAGE( "GraphExecutor::FiniteStateMachine::Executed _GraphExecutingNumber " + << _GraphExecutingNumber << " != 0 ==> no erase" ) ; } PyUnLock() ; return ; @@ -553,28 +558,25 @@ PyObject * GraphExecutor::FiniteStateMachine::PyFunction( const char * aPyFuncNa PyObject * PyFunctionMapped = _MapOfPyFunctions[ aPyFuncName ] ; if ( _GraphExecutingNumber > 1 && !PyObjRefIor ) { RetVal = PyFunctionMapped ; - //cout << "GraphExecutor::FiniteStateMachine::PyFunction( '" << aPyFuncName << "' ) --> " ; + MESSAGE( "GraphExecutor::FiniteStateMachine::PyFunction( '" << aPyFuncName << "' ) --> " ) ; if ( RetVal ) { - //cout << RetVal << " ob_refcnt " << RetVal->ob_refcnt ; + MESSAGE( RetVal << " ob_refcnt " << RetVal->ob_refcnt ) ; } else { - //cout << " NULL" ; + MESSAGE( " NULL" ) ; } - //cout << endl ; } else { RetVal = PyFunctionMapped ; - //cout << "GraphExecutor::FiniteStateMachine::PyFunction( '" << aPyFuncName << "' ) --> " ; + MESSAGE( "GraphExecutor::FiniteStateMachine::PyFunction( '" << aPyFuncName << "' ) --> " ) ; if ( RetVal && PyObjRefIor ) { - //cout << RetVal << " " << RetVal->ob_refcnt << endl ; + MESSAGE( RetVal << " " << RetVal->ob_refcnt ) ; } else if ( RetVal ) { - //cout << RetVal << " " << RetVal->ob_refcnt << endl ; -// _MapOfPyFunctions.erase( aPyFuncName ) ; -// cout << "GraphExecutor::FiniteStateMachine::PyFunction( '" << aPyFuncName << "' ) erased --> NULL" << endl ; + MESSAGE( RetVal << " " << RetVal->ob_refcnt ) ; } else { - //cout << " NULL" << endl ; + MESSAGE( " NULL" ) ; } } @@ -585,15 +587,15 @@ bool GraphExecutor::FiniteStateMachine::PyFunction( const char * aPyFuncName , P bool RetVal = false ; if ( _MapOfPyFunctions[ aPyFuncName ] != NULL ) { - //PyObject * aPyFunc = _MapOfPyFunctions[ aPyFuncName ] ; - //cout << "GraphExecutor::FiniteStateMachine::PyFunction( '" << aPyFuncName << "' , " << aPyFunction - // << " ) ob_refcnt " << aPyFunction->ob_refcnt << " already mapped : " << aPyFunc << " ob_refcnt " - // << aPyFunc->ob_refcnt << endl ; + PyObject * aPyFunc = _MapOfPyFunctions[ aPyFuncName ] ; + MESSAGE( "GraphExecutor::FiniteStateMachine::PyFunction( '" << aPyFuncName << "' , aPyFunction " + << aPyFunction << " ) ob_refcnt " << aPyFunction->ob_refcnt << " already mapped : " + << aPyFunc << " ob_refcnt " << aPyFunc->ob_refcnt ) ; } else { _MapOfPyFunctions[ aPyFuncName ] = aPyFunction ; - //cout << "GraphExecutor::FiniteStateMachine::PyFunction( '" << aPyFuncName << "' , " << aPyFunction - // << " ) ob_refcnt " << aPyFunction->ob_refcnt << " mapped" << endl ; + MESSAGE( "GraphExecutor::FiniteStateMachine::PyFunction( '" << aPyFuncName << "' ) " << aPyFunction + << " ) ob_refcnt " << aPyFunction->ob_refcnt << " mapped" ) ; RetVal = true ; } @@ -602,6 +604,7 @@ bool GraphExecutor::FiniteStateMachine::PyFunction( const char * aPyFuncName , P bool GraphExecutor::FiniteStateMachine::ErasePyFunction( const char * aPyFuncName ) { + MESSAGE( "GraphExecutor::FiniteStateMachine::ErasePyFunction( '" << aPyFuncName << "' )" ) ; if ( _MapOfPyFunctions[ aPyFuncName ] != NULL ) { _MapOfPyFunctions.erase( aPyFuncName ) ; return true ; @@ -678,7 +681,7 @@ void GraphExecutor::FiniteStateMachine::JoinThread() { exit( 0 ) ; } else { - MESSAGE( pthread_self() << " FiniteStateMachine:JoinThread pthread_joined : " << _Thread ); +// MESSAGE( pthread_self() << " FiniteStateMachine:JoinThread pthread_joined : " << _Thread ); _ThreadList.pop_front() ; } } diff --git a/src/GraphExecutor/DataFlowExecutor_InNode.cxx b/src/GraphExecutor/DataFlowExecutor_InNode.cxx index 4fa3a64..c504a20 100644 --- a/src/GraphExecutor/DataFlowExecutor_InNode.cxx +++ b/src/GraphExecutor/DataFlowExecutor_InNode.cxx @@ -386,18 +386,22 @@ GraphExecutor::InNode::~InNode() { } void GraphExecutor::InNode::LockDataWait() { +// cdebug_in << "GraphExecutor::InNode::LockDataWait " << endl ; if ( pthread_mutex_lock( &_MutexDataWait ) ) { perror("Ready pthread_mutex_lock ") ; exit( 0 ) ; } _DataWait = true ; +// cdebug_out << "GraphExecutor::InNode::LockDataWait " << endl ; } void GraphExecutor::InNode::UnLockDataWait() { +// cdebug_in << "GraphExecutor::InNode::UnLockDataWait " << endl ; _DataWait = false ; if ( pthread_mutex_unlock( &_MutexDataWait ) ) { perror("Ready pthread_mutex_unlock ") ; exit( 0 ) ; } +// cdebug_out << "GraphExecutor::InNode::UnLockDataWait " << endl ; } Engines::Component_var GraphExecutor::InNode::Component() const { @@ -405,10 +409,12 @@ Engines::Component_var GraphExecutor::InNode::Component() const { return _FactoryNode->Component() ; } else { - CORBA::Any const * anAnyComponent = GetChangeNodeInPort( 0 )->GetOutPort()->Value() ; // this +//JR 30.03.2005 CORBA::Any const * anAnyComponent = GetChangeNodeInPort( 0 )->GetOutPort()->Value() ; // this + const CORBA::Any anAnyComponent = GetChangeNodeInPort( 0 )->GetOutPort()->Value() ; // this CORBA::Object_ptr obj ; try { - *anAnyComponent >>= obj ; +//JR 30.03.2005 *anAnyComponent >>= obj ; + anAnyComponent >>= obj ; return Engines::Component::_narrow( obj ) ; } catch( ... ) { @@ -782,10 +788,15 @@ bool GraphExecutor::InNode::Kill() { } } } +// PAL8003 +// JR 24.03.2005 Debug it may have be killed if we have Suspend-Resume-Kill + if ( !RetVal && IsKilled() ) { + RetVal = true ; + } cdebug_out << "GraphExecutor::InNode::Kill " << Name() << " " << ThreadNo() << " " << Automaton()->StateName( State() ) << " Threads " << _OutNode->Threads() << " SuspendedThreads " << _OutNode->SuspendedThreads() - << " EventQSize " << _OutNode->EventQSize() << endl ; + << " EventQSize " << _OutNode->EventQSize() << " returns " << RetVal << endl ; return RetVal ; } @@ -1322,12 +1333,12 @@ void GraphExecutor::InNode::InitialState() for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) { if ( GetNodeOutPort(i)->IsDataStream() ) { - GetChangeNodeOutPort(i)->State( SUPERV::ReadyState ) ; - GetChangeNodeOutPort(i)->Done( true ) ; + GetChangeNodeOutPort(i)->PortState( SUPERV::ReadyState ) ; + GetChangeNodeOutPort(i)->PortDone( true ) ; } else if ( i != 0 || !IsGOTONode() ) { - GetChangeNodeOutPort(i)->State( SUPERV::WaitingState ) ; - GetChangeNodeOutPort(i)->Done( false ) ; + GetChangeNodeOutPort(i)->PortState( SUPERV::WaitingState ) ; + GetChangeNodeOutPort(i)->PortDone( false ) ; } } @@ -1337,17 +1348,22 @@ void GraphExecutor::InNode::InitialState() GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ; if ( IsHeadNode() && IsLoopNode() && anInPort->IsLoop() ) { anOutPort->PortStatus( DataConnected ); - anOutPort->State( SUPERV::ReadyState ) ; - anOutPort->Done( true ) ; - CORBA::Any * anAny = new CORBA::Any() ; - *anAny <<= (long ) 1 ; + anOutPort->PortState( SUPERV::ReadyState ) ; + anOutPort->PortDone( true ) ; +//JR 21.02.2005 Debug Memory leak : CORBA::Any * anAny = new CORBA::Any() ; + CORBA::Any anAny = CORBA::Any() ; +//JR 21.02.2005 Debug Memory leak : *anAny <<= (long ) 1 ; + anAny <<= (long ) 1 ; anOutPort->Value( anAny ) ; _InitLoop = true ; + cdebug << "InPort" << i << " " << anInPort->PortName() << " " << anInPort->PortStatus() + << " OutPort " << anOutPort->PortStatus() << theAutomaton->StateName( anOutPort->PortState() ) + << " InitLoop HeadNode" << endl ; } // JR 15_09_2004 if backward link from GOTONode or EndLoopNode ==> DataConnected else if ( anInPort->IsGate() && anOutPort ) { - anOutPort->State( SUPERV::WaitingState ) ; - anOutPort->Done( false ) ; + anOutPort->PortState( SUPERV::WaitingState ) ; + anOutPort->PortDone( false ) ; const GraphBase::ComputingNode * aFromNode = _OutNode->Graph()->GetGraphNode( anOutPort->NodeName() ) ; //JR if ( aFromNode->IsGOTONode() || aFromNode->IsEndLoopNode() ) { if ( aFromNode->IsGOTONode() || ( IsLoopNode() && CoupledNode() == aFromNode ) ) { @@ -1355,9 +1371,16 @@ void GraphExecutor::InNode::InitialState() // before was "else if ( IsOneOfInlineNodes() )" // IsOneOfInline() == ( Inline || IsOneOfGOTO() ), so Inline are removed.. anOutPort->PortStatus( DataConnected ); - anOutPort->State( SUPERV::ReadyState ) ; - anOutPort->Done( true ) ; + anOutPort->PortState( SUPERV::ReadyState ) ; + anOutPort->PortDone( true ) ; } + cdebug << "InPort" << i << " " << anInPort->PortName() << " " << anInPort->PortStatus() + << " OutPort " << anOutPort->PortStatus() << theAutomaton->StateName( anOutPort->PortState() ) + << " Gate HeadNode" << endl ; + } + else { + cdebug << Name() << " IsHeadNode " << IsHeadNode() << " InPort" << i << " " << anInPort->PortName() + << " " << anInPort->PortStatus() << endl ; } if ( anInPort->IsGate() && anOutPort == NULL ) { Pc-- ; @@ -1366,21 +1389,21 @@ void GraphExecutor::InNode::InitialState() else if ( anOutPort ) { if ( anOutPort->IsDataConnected() || anOutPort->IsDataStream() ) { Pc-- ; - anOutPort->State( SUPERV::ReadyState ) ; - anOutPort->Done( true ) ; + anOutPort->PortState( SUPERV::ReadyState ) ; + anOutPort->PortDone( true ) ; cdebug << "InPort" << i << " " << anInPort->PortName() << " " << anInPort->PortStatus() - << " " << theAutomaton->StateName( anOutPort->State() ) << " Pc " << Pc << endl ; + << " " << theAutomaton->StateName( anOutPort->PortState() ) << " Pc " << Pc << endl ; } else if ( anOutPort->IsPortConnected() ) { - anOutPort->State( SUPERV::WaitingState ) ; - anOutPort->Done( false ) ; + anOutPort->PortState( SUPERV::WaitingState ) ; + anOutPort->PortDone( false ) ; cdebug << "InPort" << i << " " << anInPort->PortName() << " " << " " << anInPort->PortStatus() - << " " << theAutomaton->StateName( anOutPort->State() ) << " Pc " << Pc << endl ; + << " " << theAutomaton->StateName( anOutPort->PortState() ) << " Pc " << Pc << endl ; } else { cdebug << "InPort" << i << " " << anInPort->PortName() << " " << anInPort->PortStatus() << " OutPort " << anOutPort->NodeName() << " " << anOutPort->PortName() << " " - << theAutomaton->StateName( anOutPort->State() ) << " Pc " << Pc << endl ; + << theAutomaton->StateName( anOutPort->PortState() ) << " Pc " << Pc << endl ; } } else { @@ -1391,37 +1414,36 @@ void GraphExecutor::InNode::InitialState() if ( !anOutPort->IsDataStream() || anInPort->IsDataStream() ) { cdebug << "InPort" << i << " state change : " << anInPort->PortName() << " from OutPort " << anOutPort->PortName() << " from Node " << anOutPort->NodeName() - << " with state " << theAutomaton->StateName( anOutPort->State() ) << endl ; - GetChangeNodeInPort(i)->State( anOutPort->State() ) ; + << " with state of OutPort : " << theAutomaton->StateName( anOutPort->PortState() ) << endl ; + GetChangeNodeInPort(i)->PortState( anOutPort->PortState() ) ; } else if ( anOutPort->IsDataConnected() ) { cdebug << "InPort" << i << " state change : " << anInPort->PortName() << " from OutPort " << anOutPort->PortName() << " from Node " << anOutPort->NodeName() << " with state ReadyState" << endl ; - GetChangeNodeInPort(i)->State( SUPERV::ReadyState ) ; + GetChangeNodeInPort(i)->PortState( SUPERV::ReadyState ) ; } else { cdebug << "InPort" << i << " state NOT changed : " << anInPort->PortName() << " from OutPort " << anOutPort->PortName() << " " << anOutPort->PortStatus() << " from Node " << anOutPort->NodeName() - << " with state " << anOutPort->State() << endl ; + << " with state " << theAutomaton->StateName( anOutPort->PortState() ) << endl ; } } if ( anOutPort ) { cdebug << "InPort" << i << " : " << anInPort->PortName() << " from OutPort " << anOutPort->PortName() << " from Node " << anOutPort->NodeName() << " with state " ; - if ( anOutPort->State() == SUPERV::WaitingState ) { + if ( anOutPort->PortState() == SUPERV::WaitingState ) { cdebug << "WaitingState" ; } - else if ( anOutPort->State() == SUPERV::ReadyState ) { + else if ( anOutPort->PortState() == SUPERV::ReadyState ) { cdebug << "ReadyState" ; } else { cdebug << "???" ; } - cdebug << " PortConnected(" - << anOutPort->IsPortConnected() << ") DataConnected(" - << anOutPort->IsDataConnected() << ")" << endl ; + cdebug << " OutPortStatus " << anOutPort->PortStatus() << " State " + << theAutomaton->StateName( anOutPort->PortState() ) << endl ; } } @@ -1442,7 +1464,7 @@ void GraphExecutor::InNode::InitialState() for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) { cdebug << "OutPort" << i << " : " << GetNodeOutPort(i)->PortName() << " " - << theAutomaton->StateName( GetChangeNodeOutPort(i)->State() ) + << theAutomaton->StateName( GetChangeNodeOutPort(i)->PortState() ) << " " << GetNodeOutPort(i)->Kind() << endl ; } @@ -1533,7 +1555,7 @@ const long GraphExecutor::InNode::CpuUsed( bool tot ) { CORBA::Long cpu = 0 ; // cout << "Begin CpuUsed " << Name() << " CpuUsed : " << cpu << " State " // << theAutomaton->StateName( _currentState ) << endl ; - cdebug_in << "GraphExecutor::InNode::CpuUsed( " << tot << " )" << Name() << endl ; +// cdebug_in << "GraphExecutor::InNode::CpuUsed( " << tot << " )" << Name() << endl ; if ( IsOneOfInLineNodes() ) { // cdebug << "CpuUsed " << Name() << " --> PyCpuUsed()" << endl ; // cout << "CpuUsed " << Name() << " --> PyCpuUsed()" << endl ; @@ -1554,7 +1576,7 @@ const long GraphExecutor::InNode::CpuUsed( bool tot ) { } } } - cdebug_out << "GraphExecutor::InNode::CpuUsed " << Name() << " CpuUsed : " << cpu << endl ; +// cdebug_out << "GraphExecutor::InNode::CpuUsed " << Name() << " CpuUsed : " << cpu << endl ; // cout << "End CpuUsed " << Name() << " CpuUsed : " << cpu << " State " // << theAutomaton->StateName( _currentState ) << endl ; return cpu ; diff --git a/src/GraphExecutor/DataFlowExecutor_InNode.hxx b/src/GraphExecutor/DataFlowExecutor_InNode.hxx index 1b25ab5..c8bf760 100644 --- a/src/GraphExecutor/DataFlowExecutor_InNode.hxx +++ b/src/GraphExecutor/DataFlowExecutor_InNode.hxx @@ -342,8 +342,12 @@ namespace GraphExecutor { bool Resume() ; bool Stop() ; - void CreateNewThread( bool k_create ) { _createNewThread = k_create ; } ; - void CreateNewThreadIf( bool k_create ) { _createNewThreadIf = k_create ; } ; + void CreateNewThread( bool k_create ) { +// cdebug << Name() << " CreateNewThread " << k_create << endl ; + _createNewThread = k_create ; } ; + void CreateNewThreadIf( bool k_create ) { +// cdebug << Name() << " CreateNewThreadIf( " << k_create << " )" << endl ; + _createNewThreadIf = k_create ; } ; bool CreateNewThread() { return _createNewThread ; } ; bool CreateNewThreadIf() { return _createNewThreadIf ; } ; void NewThread( pthread_t aThread ) ; @@ -462,7 +466,7 @@ namespace GraphExecutor { ServicesAnyData * InParametersList ) ; void InOutParametersSet( int nOutParams , ServicesAnyData * OutParametersList ) ; - bool OutParametersSet( bool Err , SUPERV::GraphState NewState , + bool OutParametersSet( bool Err , SUPERV::GraphState PortState , int nOutParams , ServicesAnyData * OutParametersList ) ; void coutbegin() ; @@ -475,7 +479,8 @@ namespace GraphExecutor { long PyCpu() ; bool PyRunSimpleString( char* thePyString ); - PyObject * PyEvalCallObject( PyObject * MyPyRunMethod , + PyObject * PyEvalCallObject( const char *method , + PyObject * MyPyRunMethod , PyObject * ArgsList ) ; } ; diff --git a/src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx b/src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx index b33fa38..5a28405 100644 --- a/src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx +++ b/src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx @@ -70,15 +70,17 @@ static void UpperCase(std::string& rstr) #endif } - +#define SendEventTrace 0 int GraphExecutor::InNode::SendEvent( const GraphExecutor::NodeEvent anEvent ) { _CurrentEvent = (GraphExecutor::NodeEvent ) anEvent ; - cdebug << pthread_self() << "/" << ThreadNo() << " -->SendEvent Node " << Name() - << " ControlState : " - << Automaton()->ControlStateName( ControlState() ) - << " Event : " << Automaton()->EventName( anEvent ) - << " State : " << Automaton()->StateName( State() ) << " _RewindStack " << _RewindStack << endl; +#if SendEventTrace + cdebug_in << pthread_self() << "/" << ThreadNo() << " -->SendEvent Node " << Name() + << " ControlState : " + << Automaton()->ControlStateName( ControlState() ) + << " Event : " << Automaton()->EventName( anEvent ) + << " State : " << Automaton()->StateName( State() ) << " _RewindStack " << _RewindStack << endl; +#endif _OldState = State() ; _NextState = Automaton()->NextState( _OldState , anEvent ) ; @@ -91,6 +93,13 @@ int GraphExecutor::InNode::SendEvent( const GraphExecutor::NodeEvent anEvent ) { else { _NextAction = Automaton()->NextAction( _NextState , anEvent ) ; } +#if SendEventTrace + cdebug << pthread_self() << "/" << ThreadNo() << "NextState( " << _OldState << " , " + << Automaton()->EventName( anEvent ) << " ) --> _NextState = " << _NextState + << " NextAction( " << _NextState << " , " << Automaton()->EventName( anEvent ) + << " ) --> _NextAction = " + << Automaton()->ActionName( _NextAction ) << endl ; +#endif // State( _NextState ) ; // if ( _OldState == GraphExecutor::SuccessedExecutingState || @@ -98,6 +107,7 @@ int GraphExecutor::InNode::SendEvent( const GraphExecutor::NodeEvent anEvent ) { // DoneAction() ; // } +#if SendEventTrace cdebug << pthread_self() << "/" << ThreadNo() << " SendedEvent Node " << Name() << endl << " ControlState : " << Automaton()->ControlStateName( ControlState() ) << endl @@ -107,29 +117,22 @@ int GraphExecutor::InNode::SendEvent( const GraphExecutor::NodeEvent anEvent ) { << " Action : " << Automaton()->ActionName( _NextAction ) << 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( _OldState ) << endl - << " Event : " << Automaton()->EventName( anEvent ) << endl - << " NextState : " << Automaton()->StateName( _NextState ) << endl - << " Action : " << Automaton()->ActionName( _NextAction ) << endl - << " CreateNewThread " << CreateNewThread() << endl ; #endif int sts = executeAction() ; - cdebug << pthread_self() << "/" << ThreadNo() << " <--- SendEvent Node " << Name() - << " Event : " << Automaton()->EventName( anEvent ) - << " State : " << Automaton()->StateName( State() ) - << endl; +#if SendEventTrace + cdebug_out << pthread_self() << "/" << ThreadNo() << " <--- SendEvent Node " << Name() + << " Event : " << Automaton()->EventName( anEvent ) + << " State : " << Automaton()->StateName( State() ) + << endl; +#endif return sts ; } +#define ActionsTrace 0 // ReadyAction - RunningAction - DoneAction - SuspendedAction : // for StateWait( ReadyW - RunningW - DoneW - SuspendedW ) void GraphExecutor::InNode::ReadyAction() { @@ -137,9 +140,11 @@ void GraphExecutor::InNode::ReadyAction() { perror("Ready pthread_mutex_lock ") ; exit( 0 ) ; } +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << "ReadyAction pthread_cond_broadcast _ReadyWait " << Name() << endl ; +#endif if ( pthread_cond_broadcast( &_ReadyWait ) ) { perror("Ready pthread_cond_broadcast ") ; } @@ -154,9 +159,11 @@ void GraphExecutor::InNode::RunningAction() { perror("Running pthread_mutex_lock ") ; exit( 0 ) ; } +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << "RunningAction pthread_cond_broadcast _RunningWait " << Name() << endl ; +#endif // That activate the pthread_cond_wait for RunninWait if ( pthread_cond_broadcast( &_RunningWait ) ) { perror("Running pthread_cond_broadcast ") ; @@ -172,9 +179,11 @@ void GraphExecutor::InNode::DoneAction() { perror("Done pthread_mutex_lock ") ; exit( 0 ) ; } +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << "DoneAction pthread_cond_broadcast _DoneWait " << Name() << endl ; +#endif if ( pthread_cond_broadcast( &_DoneWait ) ) { perror("Done pthread_cond_broadcast ") ; } @@ -189,9 +198,11 @@ void GraphExecutor::InNode::SuspendedAction() { perror("Suspended pthread_mutex_lock ") ; exit( 0 ) ; } +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << "SuspendedAction pthread_cond_broadcast _SuspendedWait " << Name() << endl ; +#endif if ( pthread_cond_broadcast( &_SuspendedWait ) ) { perror("Suspended pthread_cond_broadcast ") ; } @@ -218,14 +229,18 @@ GraphExecutor::InNode * GraphExecutor::InNode::SuspendAction() { perror("SuspendAction pthread_cond_wait ") ; } _OutNode->ResumeThread() ; +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << " pthread_cond " << Name() << " SuspendAction pthread_cond_waited" << Automaton()->StateName( State() ) << endl ; +#endif } else { +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << " pthread_cond " << Name() << " NO SuspendAction pthread_cond_wait" << Automaton()->StateName( State() ) << endl ; +#endif } // SendEvent( _aResumeEvent ) ; ===> Mutex with myself ! _SuspendSync = false ; @@ -248,17 +263,23 @@ GraphExecutor::InNode * GraphExecutor::InNode::SuspendAction() { exit( 0 ) ; } if ( _ResumeSync ) { +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << " pthread_cond " << Name() << " SuspendAction pthread_cond_signal _ResumeWait" << endl ; +#endif if ( pthread_cond_signal( &_ResumeWait ) ) { perror("SuspendAction pthread_cond_signal _ResumeWait ") ; } +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << " pthread_cond " << Name() << " SuspendAction pthread_cond_signaled _ResumeWait " << endl ; +#endif } else { +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << " pthread_cond " << Name() << " NO SuspendAction pthread_cond_signal _ResumeWait" << endl ; +#endif _ResumeSync = true ; } if ( pthread_mutex_unlock( &_MutexWait ) ) { @@ -286,18 +307,24 @@ bool GraphExecutor::InNode::ResumeAction( GraphExecutor::NodeEvent aResumeEvent } _aResumeEvent = aResumeEvent ; if ( _SuspendSync ) { +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << " pthread_cond " << Name() << " ResumeAction pthread_cond_signal" << endl ; +#endif if ( pthread_cond_signal( &_SuspendWait ) ) { perror("ResumeAction pthread_cond_signal ") ; } +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << " pthread_cond " << Name() << " ResumeAction pthread_cond_signaled _SuspendWait " << endl ; +#endif RetVal = true ; } else { +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << " pthread_cond " << Name() << " NO ResumeAction pthread_cond_signal" << endl ; +#endif if ( pthread_self() == ThreadNo() ) { RetVal = false ; /*/ Ne pas s'attendre soi-meme !...*/ } @@ -317,22 +344,28 @@ bool GraphExecutor::InNode::ResumeAction( GraphExecutor::NodeEvent aResumeEvent exit( 0 ) ; } if ( !_ResumeSync ) { +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << " pthread_cond " << Name() << " ResumeAction pthread_cond_wait _ResumeWait " << Automaton()->StateName( State() ) << endl ; +#endif _ResumeSync = true ; if ( pthread_cond_wait( &_ResumeWait , &_MutexWait ) ) { perror("ResumeAction pthread_cond_wait ") ; } +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << " pthread_cond " << Name() << " ResumeAction pthread_cond_waited _ResumeWait" << Automaton()->StateName( State() ) << endl ; +#endif RetVal = true ; } else { +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << " pthread_cond " << Name() << " NO ResumeAction pthread_cond_wait _ResumeWait" << Automaton()->StateName( State() ) << endl ; +#endif RetVal = false ; } _ResumeSync = false ; @@ -341,8 +374,10 @@ bool GraphExecutor::InNode::ResumeAction( GraphExecutor::NodeEvent aResumeEvent exit( 0 ) ; } } +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << "GraphExecutor::InNodeThreads::ResumeAction RetVal " << RetVal << endl ; +#endif return RetVal ; } @@ -450,30 +485,38 @@ void GraphExecutor::InNode::ThreadStartedAction() { exit( 0 ) ; } if ( !_ThreadStartedSync ) { +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << "pthread_cond " << Name() << " ThreadStarted pthread_cond_wait" << endl ; +#endif _ThreadStartedSync = true ; if ( pthread_cond_wait( &_ThreadStartedWait , &_MutexWait ) ) { perror("ThreadStarted pthread_cond_wait ") ; } +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << "pthread_cond " << Name() << " ThreadStarted pthread_cond_waited" << endl ; +#endif } else { +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << "pthread_cond " << Name() << " NO ThreadStarted pthread_cond_wait" << endl ; +#endif //Debug : _ThreadStartedSync = false ; if ( pthread_cond_signal( &_ThreadStartedWait ) ) { perror("ThreadStart pthread_cond_signal ") ; } //Debug +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << "pthread_cond " << Name() << " NO ThreadStarted pthread_cond_signaled" << endl ; +#endif } if ( pthread_mutex_unlock( &_MutexWait ) ) { perror("ThreadStarted pthread_mutex_unlock ") ; @@ -487,30 +530,38 @@ void GraphExecutor::InNode::ThreadStartAction() { exit( 0 ) ; } if ( _ThreadStartedSync ) { +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << "pthread_cond " << Name() << " ThreadStart pthread_cond_signal" << endl ; +#endif _ThreadStartedSync = false ; if ( pthread_cond_signal( &_ThreadStartedWait ) ) { perror("ThreadStart pthread_cond_broadcast ") ; } +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << "pthread_cond " << Name() << " ThreadStart pthread_cond_signaled" << endl ; +#endif } else { +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << "pthread_cond " << Name() << " NO ThreadStart pthread_cond_signal" << endl ; +#endif _ThreadStartedSync = true ; //Debug : if ( pthread_cond_wait( &_ThreadStartedWait , &_MutexWait ) ) { perror("ThreadStarted pthread_cond_wait ") ; } //Debug +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << "pthread_cond " << Name() << " NO ThreadStart pthread_cond_waited" << endl ; +#endif } if ( pthread_mutex_unlock( &_MutexWait ) ) { perror("ThreadStart pthread_mutex_unlock ") ; @@ -521,22 +572,27 @@ void GraphExecutor::InNode::ThreadStartAction() { int GraphExecutor::InNode::executeAction() { int oldRewindStack = ( _RewindStack > MAXSTACKTHREADSIZE ) ; if ( !CreateNewThread() && oldRewindStack ) { +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << " executeAction start Thread _RewindStack " << _RewindStack << " > " << MAXSTACKTHREADSIZE << " CreateNewThread " << CreateNewThread() << " " << Automaton()->ActionName( _NextAction ) << "(" << Name() << ")" << endl; +#endif CreateNewThread( true ) ; + _OutNode->IncrCreatedThreads() ; ThreadNo( 0 ) ; } if ( CreateNewThread() ) { CreateNewThread( false ) ; if ( ThreadNo() == 0 ) { _RewindStack = 1 ; +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << " executeAction start Thread _RewindStack " << _RewindStack << " " << Automaton()->ActionName( _NextAction ) << "(" << Name() << ")" << endl; +#endif pthread_t T; int pthread_sts = 1 ; // _OutNode->PushEvent( NULL , GraphExecutor::NewThreadEvent , @@ -549,7 +605,8 @@ int GraphExecutor::InNode::executeAction() { << 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 ; + cdebug << _OutNode->CreatedThreads() << " was created (and exited)" << endl ; + cdebug << "It seems to me that with gdb we are limited to 256 threads" << endl ; } else { cdebug << pthread_sts << endl ; @@ -558,19 +615,25 @@ int GraphExecutor::InNode::executeAction() { delete [] msg ; pthread_exit( msg ) ; } +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << "executeAction has created thread " << T << endl ; +#endif ThreadStartedAction() ; +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << "executeAction the thread " << T << " has called NewThread and will call ExecuteAction for node " << Name() << endl ; +#endif } else { +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << " executeAction restart Thread _RewindStack " << _RewindStack << " " << Automaton()->StateName( State() ) << " " << Automaton()->ActionName( _NextAction ) << "(" << Name() << ") ReStartAction ==>" << endl; +#endif State( GraphExecutor::SuspendedSuccessedState ) ; if ( !ReStartAction( this , GraphExecutor::ReStartEvent ) ) { cdebug << pthread_self() << "/" << ThreadNo() @@ -579,9 +642,11 @@ int GraphExecutor::InNode::executeAction() { << ") ERROR-DEBUG " << endl; } else { +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << " executeAction NO CALL " << Automaton()->ActionName( _NextAction ) << "(" << Name() << ")" << endl; +#endif } } } @@ -589,21 +654,27 @@ int GraphExecutor::InNode::executeAction() { if ( _CurrentEvent == ExecuteEvent ) { _RewindStack += 1 ; } +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << " executeAction call " << Automaton()->ActionName( _NextAction ) << "(" << Name() << ") _RewindStack " << _RewindStack << endl; +#endif return ExecuteAction() ; } return 1 ; } void GraphExecutor::InNode::coutbegin() { +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << " run_function begin" << " " << Name() << " " << Automaton()->StateName( State() ) << endl ; +#endif } void GraphExecutor::InNode::coutexit() { +#if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << " run_function pthread_exit _RewindStack " << _RewindStack << " " << Name() << " " << Automaton()->StateName( State() ) << endl ; +#endif } void * run_function(void *p) { GraphExecutor::InNode *aNode = (GraphExecutor::InNode *) p; @@ -635,12 +706,14 @@ void * run_function(void *p) { int GraphExecutor::InNode::ExecuteAction() { int sts ; +#if ActionsTrace const char * nextactionname = Automaton()->ActionName( _NextAction ) ; const char * statename = Automaton()->StateName( State() ) ; const char * nextstatename = Automaton()->StateName( _NextState ) ; cdebug_in << pthread_self() << "/" << ThreadNo() << " --> ExecuteAction " << nextactionname << " " << statename << " NextState " << nextstatename << endl ; +#endif State( _NextState ) ; switch ( _NextAction ) { @@ -771,8 +844,10 @@ int GraphExecutor::InNode::ExecuteAction() { return 0 ; } } +#if ActionsTrace cdebug_out << pthread_self() << "/" << ThreadNo() << "<-- ExecuteAction " << nextactionname << endl ; +#endif return sts ; } @@ -787,11 +862,13 @@ int GraphExecutor::InNode::VoidAction() { return 1; } - +#define SomeDataReadyTrace 0 int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() { +#if SomeDataReadyTrace cdebug << pthread_self() << "/" << ThreadNo() << " --> DataWaiting_SomeDataReadyAction from " << DataFromNode() << " to " << Name() << endl; +#endif unsigned int k; int InReady = 0 ; int res = 1; @@ -800,39 +877,55 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() { bool SwitchFinished = false ; if ( IsLoopNode() ) { - GraphBase::OutPort * anOutLoopPort = GetChangeNodeInLoop()->GetOutPort() ; + GraphBase::OutPort * anOutLoopPort = GetChangeNodeInLoop()->GetOutPort() ; // DoLoop Port if ( anOutLoopPort && anOutLoopPort->BoolValue() ) { LoopBeginning = true ; // Beginning of Loop } } if ( IsEndLoopNode() ) { - GraphBase::OutPort * anOutLoopPort = GetChangeNodeInLoop()->GetOutPort() ; + GraphBase::OutPort * anOutLoopPort = GetChangeNodeInLoop()->GetOutPort() ; // DoLoop Port if ( anOutLoopPort && !anOutLoopPort->BoolValue() ) { LoopFinished = true ; // End of Loop } } - if ( IsEndSwitchNode() ) { - GraphBase::OutPort * anOutGateSwitchPort = GetChangeNodeInGate()->GetOutPort() ; + if ( IsEndSwitchNode() && strcmp( GOTONode()->CoupledNode()->Name() , DataFromNode() ) ) { + GraphBase::OutPort * anOutGateSwitchPort = GetChangeNodeInGate()->GetOutPort() ; // Default Port +//JR 09.02.2005 : SomeDataReady is not from the SwitchNode if ( anOutGateSwitchPort && !anOutGateSwitchPort->BoolValue() ) { +//JR 09.02.2005 : the OutPort of the SwitchNode connected to the default port is closed ===> +// Here after we consider that that DefaultPort is Ready (even if it's value is false) SwitchFinished = true ; // End of Switch } } +#if SomeDataReadyTrace cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " LoopFinished " << LoopFinished << " LoopBeginning " << LoopBeginning << " SwitchFinished " << SwitchFinished << endl ; +#endif for ( k = 0 ; k < (unsigned int ) GetNodeInPortsSize() ; k++ ) { GraphBase::InPort * anInPort = GetChangeNodeInPort(k) ; GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ; - cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort " << anInPort->PortName() << " " << anInPort->State() << " " << anInPort->PortStatus() << endl ; +#if SomeDataReadyTrace + cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort " << anInPort->PortName() << " " << anInPort->PortState() << " " << anInPort->PortStatus() ; + if ( anOutPort ) { + cdebug << " from OutPort " << anOutPort->NodeName() << "( " << anOutPort->PortName() + << " )" ; + } + cdebug<< endl ; +#endif if ( anInPort->IsGate() && anOutPort == NULL ) { InReady += 1 ; - anInPort->State( SUPERV::ReadyState ) ; + anInPort->PortState( SUPERV::ReadyState ) ; +#if SomeDataReadyTrace cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " " << anInPort->PortName() << " ControlPort inactive." << endl ; +#endif } -// That InPort get its value from an other node +// That InPort get its value from an other node : the node of anOutPort linked to that anInPort is +// different from the sender of SomeDataReady (DataFromNode) else if ( strcmp( DataFromNode() , anOutPort->NodeName() ) ) { - if ( anInPort->State() == SUPERV::ReadyState ) { + if ( anInPort->PortState() == SUPERV::ReadyState ) { InReady += 1 ; +#if SomeDataReadyTrace cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " " << anInPort->PortName() << " Was Done from Node " << anOutPort->NodeName() << "( " << anOutPort->PortName() @@ -843,10 +936,12 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() { } #endif cdebug << endl ; +#endif } else if ( IsLoopNode() && anInPort->IsDataConnected() ) { - anInPort->State( SUPERV::ReadyState ) ; + anInPort->PortState( SUPERV::ReadyState ) ; InReady += 1 ; +#if SomeDataReadyTrace cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " " << anInPort->PortName() << " Was Done from Node " << anOutPort->NodeName() << "( " << anOutPort->PortName() @@ -857,10 +952,12 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() { } #endif cdebug << endl ; +#endif } else if ( LoopFinished ) { - anInPort->State( SUPERV::ReadyState ) ; + anInPort->PortState( SUPERV::ReadyState ) ; InReady += 1 ; +#if SomeDataReadyTrace cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " " << anInPort->PortName() << " Was Done from Node " << anOutPort->NodeName() << "( " << anOutPort->PortName() @@ -871,10 +968,12 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() { } #endif cdebug << endl ; +#endif } else if ( anInPort->IsGate() && SwitchFinished ) { - anInPort->State( SUPERV::ReadyState ) ; + anInPort->PortState( SUPERV::ReadyState ) ; InReady += 1 ; +#if SomeDataReadyTrace cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " " << anInPort->PortName() << " Was Done from Node " << anOutPort->NodeName() << "( " << anOutPort->PortName() @@ -885,15 +984,19 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() { } #endif cdebug << endl ; +#endif } else if ( anInPort->IsGate() && _OutNode->Graph()->GetGraphNode( anOutPort->NodeName() )->IsGOTONode() ) { // GateOutPort of GOTONodes are always opened - anInPort->State( SUPERV::ReadyState ) ; + anInPort->PortState( SUPERV::ReadyState ) ; InReady += 1 ; - CORBA::Any * anAny = new CORBA::Any() ; - *anAny <<= (long ) 1 ; +//JR 21.02.2005 Debug Memory leak : CORBA::Any * anAny = new CORBA::Any() ; + CORBA::Any anAny = CORBA::Any() ; +//JR 21.02.2005 Debug Memory leak : *anAny <<= (long ) 1 ; + anAny <<= (long ) 1 ; _OutNode->Graph()->GetGraphNode( anOutPort->NodeName() )->GetChangeNodeOutGate()->Value( anAny ) ; +#if SomeDataReadyTrace cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " " << anInPort->PortName() << " Was Done from Node " << anOutPort->NodeName() << "( " << anOutPort->PortName() @@ -904,24 +1007,30 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() { } #endif cdebug << endl ; +#endif } else { +#if SomeDataReadyTrace cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " " << anInPort->PortName() << " Was NOT Done from Node " << anOutPort->NodeName() << "( " << anOutPort->PortName() << ") " << " " << Automaton()->StateName( State() ) << " DataConnected " << anInPort->IsDataConnected() << " LoopBeginning " << LoopBeginning << endl ; +#endif } } -// That InPort get its value from the sending node +// That InPort get its value from the sending node (DataFromNode) else if ( anInPort->IsGate() ) { - const CORBA::Any * theValue = anOutPort->Value() ; +//JR 30.03.2005 const CORBA::Any * theValue = anOutPort->Value() ; + const CORBA::Any theValue = anOutPort->Value() ; long GateOpened ; - (*theValue) >>= GateOpened ; +//JR 30.03.2005 (*theValue) >>= GateOpened ; + theValue >>= GateOpened ; if ( GateOpened != 0 ) { InReady += 1 ; - anInPort->State( SUPERV::ReadyState ) ; + anInPort->PortState( SUPERV::ReadyState ) ; +#if SomeDataReadyTrace cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " " << anInPort->PortName() << " Gate is Opened from Node " << anOutPort->NodeName() << "( " << anOutPort->PortName() @@ -932,9 +1041,11 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() { } #endif cdebug << endl ; +#endif } else if ( LoopFinished ) { - anInPort->State( SUPERV::ReadyState ) ; + anInPort->PortState( SUPERV::ReadyState ) ; +#if SomeDataReadyTrace cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " " << anInPort->PortName() << " GATE IS CLOSED from Node " << anOutPort->NodeName() << "( " << anOutPort->PortName() @@ -945,8 +1056,10 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() { } #endif cdebug << endl ; +#endif } else { +#if SomeDataReadyTrace cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " " << anInPort->PortName() << " GATE IS CLOSED from Node " << anOutPort->NodeName() << "( " << anOutPort->PortName() @@ -957,13 +1070,16 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() { } #endif cdebug << endl ; +#endif } } - else if ( anOutPort->Done() ) { + else if ( anOutPort->PortDone() ) { InReady += 1 ; - anInPort->State( SUPERV::ReadyState ) ; - cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " " - << anInPort->PortName() << " " << anInPort->PortStatus() << " is Done from Node " + anInPort->PortState( SUPERV::ReadyState ) ; +#if SomeDataReadyTrace + cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort " + << anInPort->PortName() << " " << anInPort->PortStatus() << " " + << Automaton()->StateName( anInPort->PortState() ) << " is Done from Node " << anOutPort->NodeName() << "( " << anOutPort->PortName() << ") " << anOutPort->PortStatus() << " " ; #ifdef _DEBUG_ @@ -972,6 +1088,7 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() { } #endif cdebug << endl ; +#endif // MacroNode : give immediately the value to the corresponding graph if ( IsMacroNode() ) { cout << "SomeDataReadyAction " << GraphMacroNode() << " " << GraphMacroNode()->Name() @@ -980,15 +1097,18 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() { cdebug << "SomeDataReadyAction MacroNode " << aMacroGraph->Graph()->Name() << " --> InputOfAny " << InReady << "/" << GetNodeInPortsSize() << " InPorts are Ready" << endl ; // GraphMacroNode()->MacroObject()->InputOfAny( anInPort->PortName() , *anOutPort->Value() ) ; - aMacroGraph->InputOfAny( anInPort->PortName() , *anOutPort->Value() ) ; +//JR 30.03.2005 aMacroGraph->InputOfAny( anInPort->PortName() , *anOutPort->Value() ) ; + aMacroGraph->InputOfAny( anInPort->PortName() , anOutPort->Value() ) ; } } else { +#if SomeDataReadyTrace cdebug << pthread_self() << "/" << ThreadNo() << " Node " << Name() << "( " << anInPort->PortName() << ") " << anInPort->PortStatus() << " is NOT Done from Node " << anOutPort->NodeName() << "( " << anOutPort->PortName() << ") " - << anOutPort->PortStatus() << " " ; + << anOutPort->PortStatus() << " " << endl ; +#endif } } @@ -999,34 +1119,51 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() { res = SendEvent( GraphExecutor::NotAllDataReadyEvent ); } +#if SomeDataReadyTrace cdebug << pthread_self() << "/" << ThreadNo() << " <-- DataWaiting_SomeDataReadyAction " << Name() << endl; +#endif return res ; } +#define TraceDataReadyAction 0 int GraphExecutor::InNode::DataUndef_NotAllDataReadyAction() { CreateNewThreadIf( false ) ; -// cdebug << pthread_self() << " for " << ThreadNo() -// << " DataUndef_NotAllDataReadyAction " << Name() << endl; +#if TraceDataReadyAction + cdebug << pthread_self() << " for " << ThreadNo() + << " DataUndef_NotAllDataReadyAction " << Name() << endl; +#endif return 1; } int GraphExecutor::InNode::DataUndef_AllDataReadyAction() { -// cdebug << pthread_self() << "/" << ThreadNo() -// << " --> DataUndef_AllDataReadyAction " << Name() -// << " CreateNewThreadIf " << CreateNewThreadIf() << " IsLockedDataWait " -// << IsLockedDataWait() ; +#if TraceDataReadyAction + cdebug << pthread_self() << "/" << ThreadNo() + << " --> DataUndef_AllDataReadyAction " << Name() + << " CreateNewThreadIf " << CreateNewThreadIf() << " IsLockedDataWait " + << IsLockedDataWait() ; +#endif if ( IsLockedDataWait() ) { - cdebug << "DataUndef_AllDataReadyAction() WOULD DEAD-LOCK" << endl ; +#if TraceDataReadyAction + cdebug << "DataUndef_AllDataReadyAction() " << Name() << "WOULD DEAD-LOCK" << endl ; +#endif return 0 ; // ==> DataUndef_AllDataReadyAction() after UnLockDataWait() } -// cdebug << endl ; +#if TraceDataReadyAction + cdebug << "InNode::DataUndef_AllDataReadyAction CreateNewThread( CreateNewThreadIf() ) " + << CreateNewThreadIf() << endl ; +#endif CreateNewThread( CreateNewThreadIf() ) ; if ( !CreateNewThread() ) { -// cdebug << "Thread " << ThreadNo() << "-->" << pthread_self() << endl ; +#if TraceDataReadyAction + cdebug << "Thread " << ThreadNo() << "-->" << pthread_self() << endl ; +#endif ThreadNo( pthread_self() ) ; } + else { + _OutNode->IncrCreatedThreads() ; + } _OutNode->PushEvent( this , GraphExecutor::AllDataReadyEvent , GraphExecutor::DataReadyState ) ; ReadyAction() ; @@ -1067,8 +1204,10 @@ int GraphExecutor::InNode::DataUndef_AllDataReadyAction() { return 0; } } -// cdebug << pthread_self() << "/" << ThreadNo() -// << " <-- DataUndef_AllDataReadyAction " << Name() << endl; +#if TraceDataReadyAction + cdebug << pthread_self() << "/" << ThreadNo() + << " <-- DataUndef_AllDataReadyAction " << Name() << endl; +#endif return 1; } @@ -1121,11 +1260,13 @@ int GraphExecutor::InNode::DataReady_StopAction() { #include +#define TraceDataReady_ExecuteAction 0 int GraphExecutor::InNode::DataReady_ExecuteAction() { - int i; -// cdebug << pthread_self() << "/" << ThreadNo() << " --> DataReady_ExecuteAction " -// << Name() << endl; +#if TraceDataReady_ExecuteAction + cdebug << pthread_self() << "/" << ThreadNo() << " --> DataReady_ExecuteAction " + << Name() << endl; +#endif _OutNode->PushEvent( this , GraphExecutor::ExecuteEvent , GraphExecutor::ExecutingState ) ; @@ -1155,7 +1296,9 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { Engines::Container_var myContainer ; Engines::Component_var myObjComponent ; if ( !IsFactoryNode() ) { -// cdebug << ThreadNo() << "No Component : NO StartComponent & No Ping" << endl ; +#if TraceDataReady_ExecuteAction + cdebug << ThreadNo() << "No Component : NO StartComponent & No Ping" << endl ; +#endif if ( IsComputingNode() ) { ObjInterface( true ) ; CORBA::Object_ptr obj ; @@ -1173,7 +1316,8 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { // << Computer() ; // _OutNode->Graph()->ObjImpl()->sendMessage( NOTIF_STEP, astr.str().c_str() ) ; Err = !_OutNode->Graph()->StartComponent( ThreadNo() , Computer() , - my_strdup( ComponentName() ) , +//JR 17.02.2005 Memory Leak my_strdup( ComponentName() ) , + ComponentName() , myContainer , myObjComponent ) ; ObjInterface( false ) ; SetContainer( myContainer ) ; @@ -1182,8 +1326,10 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { else { myContainer = Container() ; myObjComponent = Component() ; -// cdebug << ThreadNo() << "Component known : NO StartComponent & Ping" -// << endl ; +#if TraceDataReady_ExecuteAction + cdebug << ThreadNo() << "Component known : NO StartComponent & Ping" + << endl ; +#endif try { myObjComponent->ping() ; } @@ -1196,21 +1342,27 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { if ( Err || ControlState() == SUPERV::ToKillState || ControlState() == SUPERV::ToKillDoneState || ControlState() == SUPERV::ToStopState ) { +#if TraceDataReady_ExecuteAction cdebug << ThreadNo() << "StartComponent Error or ToKillState" << endl ; - MESSAGE(pthread_self() << "Executor::InNode::DataReady_ExecuteAction of " << Name() - << " ControlState " << Automaton()->ControlStateName( ControlState() ) - << " BEFORE execution ThreadNo " << ThreadNo() ) ; +// MESSAGE(pthread_self() << "Executor::InNode::DataReady_ExecuteAction of " << Name() +// << " ControlState " << Automaton()->ControlStateName( ControlState() ) +// << " BEFORE execution ThreadNo " << ThreadNo() ) ; +#endif Err = true ; } else { if ( ControlState() == SUPERV::ToSuspendState ) { +#if TraceDataReady_ExecuteAction cdebug << ThreadNo() << "ToSuspendState before running." << endl ; MESSAGE(ThreadNo() << "ToSuspendState before running.") ; +#endif } if ( !Err ) { // ostringstream astr ; // astr << "Graph " << _OutNode->Graph()->Name() << " Run of Node " << Name() ; // _OutNode->Graph()->ObjImpl()->sendMessage( NOTIF_STEP, astr.str().c_str() ) ; +#if TraceDataReady_ExecuteAction + int i; cdebug << ThreadNo() << " Run( '" << ServiceName() << "'" ; for ( i = 0 ; i < (int ) ServiceInParameter().length() ; i++ ) { cdebug << " , " << InParametersList[ i ].Name << "[kind" @@ -1226,6 +1378,7 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { << (*InLineNode()->PythonFunction()).length() ; } cdebug << ")" << endl ; +#endif if ( IsOneOfInLineNodes() ) { bool StsPyDynInvoke = true; @@ -1237,9 +1390,11 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { bool CopyInOut = false ; if ( IsInLineNode() && /*InLineNode()->PyRunMethod() &&*/ strlen( InLineNode()->PyFuncName() ) ) { +#if TraceDataReady_ExecuteAction cdebug << ThreadNo() << " !ObjInterface " << Name() << " PyFuncName '" << InLineNode()->PyFuncName() << "' IsInLineNode PyDynInvoke" << endl ; +#endif StsPyDynInvoke = PyDynInvoke( InLineNode()->PyRunMethod() , InLineNode()->PyFuncName() , &InParametersList[0] , ServiceInParameter().length() , @@ -1257,9 +1412,11 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { // if ( GetNodeInLoop()->GetOutPort()->BoolValue() && if ( _InitLoop ) { if ( strlen( InLineNode()->PyFuncName() ) ) { // InLoop Port = true ==> Init() +#if TraceDataReady_ExecuteAction cdebug << ThreadNo() << " !ObjInterface " << Name() << " IsLoopNode PyDynInvoke '" << InLineNode()->PyFuncName() << "' InitLoop " << LoopNode()->PyRunMethod() << endl ; +#endif StsPyDynInvoke = PyDynInvoke( InLineNode()->PyRunMethod() , InLineNode()->PyFuncName() , &InParametersList[1] , ServiceInParameter().length() , @@ -1270,18 +1427,24 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { CopyOutIn = true ; } else { +#if TraceDataReady_ExecuteAction cdebug << ThreadNo() << " !ObjInterface " << Name() << " IsLoopNode NO PyDynInvoke Void PyFuncName InitLoop" << endl ; +#endif } +#if TraceDataReady_ExecuteAction cdebug << ThreadNo() << " !ObjInterface " << Name() << " IsLoopNode _InitLoop Reset after Init() Python Function" << endl ; +#endif _InitLoop = false ; } else if ( LoopNode()->PyNextMethod() && strlen( LoopNode()->PyNextName() ) ){ // InLoop Port = false ==> Next() +#if TraceDataReady_ExecuteAction cdebug << ThreadNo() << " !ObjInterface " << Name() << " IsLoopNode PyDynInvoke '" << LoopNode()->PyNextName() << "' " << LoopNode()->PyNextMethod() << endl ; +#endif StsPyDynInvoke = PyDynInvoke( LoopNode()->PyNextMethod() , LoopNode()->PyNextName() , &InParametersList[1] , ServiceInParameter().length() , @@ -1292,21 +1455,25 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { CopyOutIn = true ; } else { +#if TraceDataReady_ExecuteAction cdebug << ThreadNo() << " !ObjInterface " << Name() << " IsLoopNode NO PyDynInvoke Void PyFuncName NextLoop" << endl ; +#endif } if ( StsPyDynInvoke ) { if ( CopyOutIn ) { +#if TraceDataReady_ExecuteAction cdebug << ThreadNo() << " !ObjInterface " << Name() << " IsLoopNode PyDynInvoke '" << LoopNode()->PyMoreName() << "' Copy of " << ServiceInParameter().length() << " OutParameters" << endl ; +#endif int i ; // Start at 1 : Do not copy InLoop ( InLoop == true <==> Init ; InLoop == false <==> Next ) for ( i = 1 ; i <= (int ) ServiceInParameter().length() ; i++ ) { InParametersList[i].Value = OutParametersList[i].Value ; InParametersList[i].Name = OutParametersList[i].Name ; -//#if 0 +#if TraceDataReady_ExecuteAction switch ( InParametersList[i].Value.type()->kind() ) { case CORBA::tk_string : char * t; @@ -1315,12 +1482,26 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { << InParametersList[i].Name.c_str() << " Value(string) " << t << endl ; break ; - case CORBA::tk_double : - double d; - InParametersList[i].Value >>= d; + case CORBA::tk_boolean: + bool b ; + InParametersList[i].Value >>= (CORBA::Any::to_boolean ) b; cdebug << "ArgOut->In" << i << " : " << InParametersList[i].Name.c_str() - << " Value(double) " << d << endl ; + << " Value(boolean) " << b << endl ; + break ; + case CORBA::tk_char: + unsigned char c ; + InParametersList[i].Value >>= (CORBA::Any::to_char ) c; + cdebug << "ArgOut->In" << i << " : " + << InParametersList[i].Name.c_str() + << " Value(char) " << c << endl ; + break ; + case CORBA::tk_short: + short s ; + InParametersList[i].Value >>= s; + cdebug << "ArgOut->In" << i << " : " + << InParametersList[i].Name.c_str() + << " Value(short) " << s << endl ; break ; case CORBA::tk_long : long l; @@ -1329,6 +1510,20 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { << InParametersList[i].Name.c_str() << " Value(long) " << l << endl ; break ; + case CORBA::tk_float : + float f; + InParametersList[i].Value >>= f; + cdebug << "ArgOut->In" << i << " : " + << InParametersList[i].Name.c_str() + << " Value(float) " << f << endl ; + break ; + case CORBA::tk_double : + double d; + InParametersList[i].Value >>= d; + cdebug << "ArgOut->In" << i << " : " + << InParametersList[i].Name.c_str() + << " Value(double) " << d << endl ; + break ; case CORBA::tk_objref : CORBA::Object_ptr obj ; char * retstr ; @@ -1350,13 +1545,15 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { << InParametersList[i].Name.c_str() << " Value(other) ERROR" << endl ; } -//#endif +#endif } } if ( LoopNode()->PyMoreMethod() && strlen( LoopNode()->PyMoreName() ) ) { +#if TraceDataReady_ExecuteAction cdebug << ThreadNo() << " !ObjInterface " << Name() << " IsLoopNode PyDynInvoke '" << LoopNode()->PyMoreName() << "' " << LoopNode()->PyMoreMethod() << endl ; +#endif StsPyDynInvoke = PyDynInvoke( LoopNode()->PyMoreMethod() , LoopNode()->PyMoreName() , &InParametersList[1] , ServiceInParameter().length() , @@ -1366,9 +1563,11 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { } } else { +#if TraceDataReady_ExecuteAction cdebug << ThreadNo() << " !ObjInterface " << Name() << " IsLoopNode PyDynInvoke '" << LoopNode()->PyMoreName() << "' No MoreMethod" << endl ; +#endif CopyInOut = true ; } } @@ -1382,9 +1581,11 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { } else if ( IsSwitchNode() && /*InLineNode()->PyRunMethod() &&*/ strlen( InLineNode()->PyFuncName() ) ) { -// cdebug << ThreadNo() << " !ObjInterface " << Name() << " PyFuncName '" -// << InLineNode()->PyFuncName() -// << "' IsSwitchNode PyDynInvoke" << endl ; +#if TraceDataReady_ExecuteAction + cdebug << ThreadNo() << " !ObjInterface " << Name() << " PyFuncName '" + << InLineNode()->PyFuncName() + << "' IsSwitchNode PyDynInvoke" << endl ; +#endif StsPyDynInvoke = PyDynInvoke( InLineNode()->PyRunMethod() , InLineNode()->PyFuncName() , &InParametersList[0] , ServiceInParameter().length() , @@ -1396,9 +1597,11 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { // else if ( IsGOTONode() && (*GOTONode()->PythonFunction()).length() && else if ( IsGOTONode() && /*InLineNode()->PyRunMethod() &&*/ strlen( InLineNode()->PyFuncName() ) ) { -// cdebug << ThreadNo() << " !ObjInterface " << Name() << " PyFuncName '" -// << InLineNode()->PyFuncName() -// << "' IsGOTONode PyDynInvoke" << endl ; +#if TraceDataReady_ExecuteAction + cdebug << ThreadNo() << " !ObjInterface " << Name() << " PyFuncName '" + << InLineNode()->PyFuncName() + << "' IsGOTONode PyDynInvoke" << endl ; +#endif StsPyDynInvoke = PyDynInvoke( InLineNode()->PyRunMethod() , InLineNode()->PyFuncName() , &InParametersList[0] , ServiceInParameter().length() , @@ -1410,9 +1613,11 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { // else if ( IsEndSwitchNode() && (*InLineNode()->PythonFunction()).length() && else if ( ( IsEndSwitchNode() ) && InLineNode()->PyRunMethod() && strlen( InLineNode()->PyFuncName() ) ) { -// cdebug << ThreadNo() << " !ObjInterface " << Name() << " PyFuncName '" -// << InLineNode()->PyFuncName() -// << "' IsSwitchNode PyDynInvoke" << endl ; +#if TraceDataReady_ExecuteAction + cdebug << ThreadNo() << " !ObjInterface " << Name() << " PyFuncName '" + << InLineNode()->PyFuncName() + << "' IsSwitchNode PyDynInvoke" << endl ; +#endif StsPyDynInvoke = PyDynInvoke( InLineNode()->PyRunMethod() , InLineNode()->PyFuncName() , &InParametersList[0] , ServiceInParameter().length() , @@ -1423,9 +1628,11 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { } else if ( ( IsEndLoopNode() ) && InLineNode()->PyRunMethod() && strlen( InLineNode()->PyFuncName() ) ) { +#if TraceDataReady_ExecuteAction cdebug << ThreadNo() << " !ObjInterface " << Name() << " PyFuncName '" << InLineNode()->PyFuncName() << "' IsSwitchNode PyDynInvoke" << endl ; +#endif StsPyDynInvoke = PyDynInvoke( InLineNode()->PyRunMethod() , InLineNode()->PyFuncName() , &InParametersList[0] , ServiceInParameter().length() + 1 , @@ -1439,9 +1646,11 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { if ( (!ItIsaLoop && ( InLineNode()->PyRunMethod() == NULL || strlen( InLineNode()->PyFuncName() ) == 0 ) ) || CopyInOut ) { // This is a void Python Function : without code (No PyFuncName) -// cdebug << ThreadNo() << " !ObjInterface " << Name() -// << " Copy of " << ServiceInParameter().length() -// << " OutParameters" << endl ; +#if TraceDataReady_ExecuteAction + cdebug << ThreadNo() << " !ObjInterface " << Name() + << " Copy of " << ServiceInParameter().length() + << " OutParameters" << endl ; +#endif int i ; int argout0 = 0 ; int argin0 = 0 ; @@ -1450,47 +1659,76 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { argin0 = 1 ; // after DoLoop if ( IsLoopNode() ) { // More() is void // OutParametersList[0].Value = InParametersList[0].Value ; // DoLoop +#if TraceDataReady_ExecuteAction cdebug << Name() << " Not Beginning of loop and non void EndLoop : DoLoop = EndLoop(DoLoop)" << endl ; +#endif GraphExecutor::InNode * anEndLoopNode = (GraphExecutor::InNode * ) CoupledNode()->GetInNode() ; - OutParametersList[0].Value = *anEndLoopNode->GetNodeOutLoop()->Value() ; // DoLoop = EndLoop(DoLoop) +//JR 30.03.2005 OutParametersList[0].Value = *anEndLoopNode->GetNodeOutLoop()->Value() ; // DoLoop = EndLoop(DoLoop) + OutParametersList[0].Value = anEndLoopNode->GetNodeOutLoop()->Value() ; // DoLoop = EndLoop(DoLoop) } } - 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 << "ArgOut->In" << argin0 + i << " : " - << InParametersList[argin0 + i].Name.c_str() - << " Value(string) " - << OutParametersList[argout0 + i].Name.c_str() << endl ; - break ; - case CORBA::tk_double : - cdebug << "ArgOut->In" << argin0 + i << " : " - << InParametersList[argin0 + i].Name.c_str() - << " Value(double) " - << OutParametersList[argout0 + i].Name.c_str() << endl ; - break ; - case CORBA::tk_long : - cdebug << "ArgOut->In" << argin0 + i << " : " - << InParametersList[argin0 + i].Name.c_str() - << " Value(long) " - << OutParametersList[argout0 + i ].Name.c_str() << endl ; - break ; - case CORBA::tk_objref : - cdebug << "ArgOut->In" << argin0 + i << " : " - << InParametersList[argin0 + i].Name.c_str() - << " Value(object reference) " - << OutParametersList[argout0 + i].Name.c_str() << endl ; - break ; - default : - cdebug << "ArgOut->In" << argin0 + i << " : " - << InParametersList[argin0 + i].Name.c_str() - << " Value(other) ERROR " - << OutParametersList[argout0 + i].Name.c_str() << endl ; +//PAL8072 ==> PAL8512 +//JR 24.03.2005 : Debug : void InLine Python function : check of the number of Input Ports +// equals the number of Output Ports was missing + if ( ServiceInParameter().length() != ServiceOutParameter().length() ) { + StsPyDynInvoke = false ; + } + else { + for ( i = 0 ; i < (int ) ServiceInParameter().length() ; i++ ) { + OutParametersList[argout0 + i].Value = InParametersList[argin0 + i].Value ; +#if TraceDataReady_ExecuteAction + switch ( InParametersList[argin0 + i].Value.type()->kind() ) { + case CORBA::tk_string : + cdebug << "ArgOut->In" << argin0 + i << " : " + << InParametersList[argin0 + i].Name.c_str() + << " Value(string) " + << OutParametersList[argout0 + i].Name.c_str() << endl ; + break ; + case CORBA::tk_boolean: + cdebug << "ArgOut->In" << argin0 + i << " : " + << InParametersList[argin0 + i].Name.c_str() + << " Value(boolean) " + << OutParametersList[argout0 + i].Name.c_str() << endl ; + break ; + case CORBA::tk_char: + cdebug << "ArgOut->In" << argin0 + i << " : " + << InParametersList[argin0 + i].Name.c_str() + << " Value(char) " + << OutParametersList[argout0 + i].Name.c_str() << endl ; + break ; + case CORBA::tk_short: + cdebug << "ArgOut->In" << argin0 + i << " : " + << InParametersList[argin0 + i].Name.c_str() + << " Value(short) " + << OutParametersList[argout0 + i].Name.c_str() << endl ; + break ; + case CORBA::tk_long : + cdebug << "ArgOut->In" << argin0 + i << " : " + << InParametersList[argin0 + i].Name.c_str() + << " Value(long) " + << OutParametersList[argout0 + i ].Name.c_str() << endl ; + break ; + case CORBA::tk_double : + cdebug << "ArgOut->In" << argin0 + i << " : " + << InParametersList[argin0 + i].Name.c_str() + << " Value(double) " + << OutParametersList[argout0 + i].Name.c_str() << endl ; + break ; + case CORBA::tk_objref : + cdebug << "ArgOut->In" << argin0 + i << " : " + << InParametersList[argin0 + i].Name.c_str() + << " Value(object reference) " + << OutParametersList[argout0 + i].Name.c_str() << endl ; + break ; + default : + cdebug << "ArgOut->In" << argin0 + i << " : " + << InParametersList[argin0 + i].Name.c_str() + << " Value(other) ERROR " + << OutParametersList[argout0 + i].Name.c_str() << endl ; + } +#endif } -//#endif } } if ( !StsPyDynInvoke ) { @@ -1512,7 +1750,9 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { else { try { try { +#if TraceDataReady_ExecuteAction cdebug << "DynInvoke -> Names " << _OutNode->Graph()->Name() << " " << Name() << endl ; +#endif DynInvoke( myObjComponent, "Names" , _OutNode->Graph()->Name() , Name() ) ; } @@ -1522,7 +1762,9 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { // for DataStreamNodes : call of SetProperties ===> environment variables in the component/container if ( ComputingNode()->HasDataStream() ) { try { +#if TraceDataReady_ExecuteAction cdebug << "DynInvoke -> SetProperties " << _OutNode->Graph()->Name() << " " << Name() << endl ; +#endif Engines::FieldsDict_var dict = new Engines::FieldsDict; dict->length( 4 ); dict[ 0 ].key = CORBA::string_dup( "CAL_MACHINE"); @@ -1552,10 +1794,12 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { } } if ( !Err && IsComputingNode() ) { +#if TraceDataReady_ExecuteAction cdebug << ThreadNo() << " !ObjInterface " << Name() << " IsComputingNode DynInvoke" << endl ; cdebug << ServiceInParameter().length()-1 << " input parameters and " << ServiceOutParameter().length() << " output parameters" << endl ; +#endif IsLoading( false ) ; DynInvoke( myObjComponent, ServiceName() , @@ -1563,10 +1807,12 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { &OutParametersList[0] , ServiceOutParameter().length() ) ; } else if ( !Err && IsFactoryNode() ) { +#if TraceDataReady_ExecuteAction cdebug << ThreadNo() << " !ObjInterface " << Name() << " IsFactoryNode DynInvoke" << endl ; cdebug << ServiceInParameter().length() << " input parameters and " << ServiceOutParameter().length() << " output parameters" << endl ; +#endif IsLoading( false ) ; DynInvoke( myObjComponent, ServiceName() , @@ -1637,11 +1883,15 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { } else { GraphExecutor::DataFlow * aMacroGraph = GraphMacroNode()->CoupledNode()->GraphEditor()->Executor() ; +#if TraceDataReady_ExecuteAction cdebug << ThreadNo() << " DataReady_ExecuteAction " << aMacroGraph << " " << aMacroGraph->Graph()->Name() << " ->DoneWait()" << " State " << aMacroGraph->State() << endl; +#endif aMacroGraph->DoneWait() ; +#if TraceDataReady_ExecuteAction cdebug << ThreadNo() << " DataReady_ExecuteAction " << Name() << " State " << aMacroGraph->State() << endl; +#endif if ( aMacroGraph->State() == SUPERV::DoneState ) { PortState = SUPERV::ReadyState ; NewState = GraphExecutor::DataReadyState ; @@ -1671,7 +1921,9 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { SendEvent( NewEvent ) ; } -// cdebug << ThreadNo() << " <-- DataReady_ExecuteAction " << Name() << endl; +#if TraceDataReady_ExecuteAction + cdebug << ThreadNo() << " <-- DataReady_ExecuteAction " << Name() << endl; +#endif return 1 ; } @@ -1738,9 +1990,9 @@ int GraphExecutor::InNode::Executing_SuccessAction() { // cdebug << ThreadNo() << " --> Executing_SuccessAction " << Name() << endl; _OutNode->PushEvent( this , GraphExecutor::SuccessedExecutingEvent , GraphExecutor::SuccessedState ) ; - MESSAGE(pthread_self() << "Executor::InNode::Executing_SuccessAction of " << Name() - << " ControlState " << Automaton()->ControlStateName( ControlState() ) - << " AFTER execution ThreadNo " << ThreadNo() ) ; +// MESSAGE(pthread_self() << "Executor::InNode::Executing_SuccessAction of " << Name() +// << " ControlState " << Automaton()->ControlStateName( ControlState() ) +// << " AFTER execution ThreadNo " << ThreadNo() ) ; SUPERV::ControlState aControl = ControlState() ; switch ( aControl ) { case SUPERV::VoidState : { @@ -1826,64 +2078,74 @@ void GraphExecutor::InNode::SetWaitingStates(GraphExecutor::InNode * EndNode ) { int j ; bool docdebug = false ; State( GraphExecutor::DataWaitingState ) ; +// cdebug << "SetWaitingStates " << Name() << " " << Automaton()->StateName( State() ) << endl ; for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) { GraphBase::InPort * anInPort = GetChangeNodeInPort( i ) ; - cdebug << "SetWaitingStates InPort " << Name() << "( " << anInPort->PortName() << " ) " - << anInPort->PortStatus() << " " << anInPort->State() << endl ; +// cdebug << "SetWaitingStates InPort " << Name() << "( " << anInPort->PortName() << " ) " +// << anInPort->PortStatus() << " " << anInPort->State() << endl ; +// PAL8513 // JR Debug 07.01.2005 : Close the Gates instead of open !!! if ( anInPort->IsGate() ) { // Loop : Close the doors GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ; if ( anOutPort ) { - CORBA::Any * anAny = new CORBA::Any() ; +//JR 21.02.2005 Debug Memory leak : CORBA::Any * anAny = new CORBA::Any() ; + CORBA::Any anAny = CORBA::Any() ; // *anAny <<= (long ) 1 ; - *anAny <<= (long ) 0 ; +//JR 21.02.2005 Debug Memory leak : *anAny <<= (long ) 0 ; + anAny <<= (long ) 0 ; anOutPort->Value( anAny ) ; - anInPort->State( SUPERV::WaitingState ) ; + anInPort->PortState( SUPERV::WaitingState ) ; +// delete anAny ; } } - else if ( anInPort->State() != SUPERV::WaitingState && + else if ( anInPort->PortState() != SUPERV::WaitingState && !anInPort->IsDataConnected() ) { if ( !docdebug ) { - cdebug << ThreadNo() - << " --> GraphExecutor::InNodeThreads::SetWaitingStates " << Name() << endl; +// cdebug << ThreadNo() +// << " --> GraphExecutor::InNodeThreads::SetWaitingStates " << Name() << endl; docdebug = true ; } if ( !anInPort->IsDataStream() ) { - anInPort->State( SUPERV::WaitingState ) ; + anInPort->PortState( SUPERV::WaitingState ) ; } } - cdebug << " --> " << Name() << "( " << anInPort->PortName() << " ) " - << anInPort->PortStatus() << " " << anInPort->State() << endl ; +// cdebug << " --> " << Name() << "( " << anInPort->PortName() << " ) " +// << anInPort->PortStatus() << " " << anInPort->State() << endl ; } for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) { GraphBase::OutPort * anOutPort = GetChangeNodeOutPort( i ) ; +// PAL8514 +//JR 07.03.2005 Debug : Reset of Done flag in OutPorts !... : + if ( !anOutPort->IsDataStream() ) { + anOutPort->PortDone( false ) ; + } for ( j = 0 ; j < anOutPort->InPortsSize() ; j++ ) { if ( !( IsGOTONode() && anOutPort->IsGate() ) && !( IsEndLoopNode() && ( anOutPort->IsGate() || anOutPort->IsLoop() ) ) && !anOutPort->IsDataStream() && !anOutPort->ChangeInPorts( j )->IsDataStream() && !anOutPort->ChangeInPorts( j )->IsExternConnected() ) { - cdebug << ThreadNo() - << " InNodeThreads::SetWaitingStates OutPort " - << Name() << "/" << anOutPort->ChangeInPorts( j )->NodeName() << "( " - << anOutPort->PortName() << " " << anOutPort->PortStatus() << " ) --> InPort " - << anOutPort->ChangeInPorts( j )->NodeName() << "( " - << anOutPort->ChangeInPorts( j )->PortName() << " " - << anOutPort->ChangeInPorts( j )->PortStatus() << " )" << endl; +// cdebug << ThreadNo() +// << " InNodeThreads::SetWaitingStates OutPort " +// << Name() << "/" << anOutPort->ChangeInPorts( j )->NodeName() << "( " +// << anOutPort->PortName() << " " << anOutPort->PortStatus() << " ) --> InPort " +// << anOutPort->ChangeInPorts( j )->NodeName() << "( " +// << anOutPort->ChangeInPorts( j )->PortName() << " " +// << anOutPort->ChangeInPorts( j )->PortStatus() << " )" << endl; GraphBase::ComputingNode * aToNode ; aToNode = _OutNode->Graph()->GetChangeGraphNode( anOutPort->ChangeInPorts( j )->NodeName() ) ; -// JR 12.01.2005 : the OutPort linked to the InPort of a EndSwitchNode was changed so final +// JR 12.01.2005 Debug : the OutPort linked to the InPort of a EndSwitchNode was changed so final // values of InPorts of EndSwitchNode may be wrong if ( !aToNode->IsEndSwitchNode() && strcmp( anOutPort->ChangeInPorts( j )->GetOutPort()->NodeName() , Name() ) ) { // After EndLoopNode or GOTONode the Input Ports of LoopNode or LabelNode have their values from // EndLoopNode or GOTONode. But if there is several nested loops we should re-establish. - cdebug << ThreadNo() - << " InNodeThreads::SetWaitingStates Node " << Name() << " " - << anOutPort->ChangeInPorts( j )->GetOutPort()->NodeName() << "( " - << anOutPort->ChangeInPorts( j )->GetOutPort()->PortName() << " ) != " - << Name() << " : Restored to " << anOutPort->NodeName() << "( " - << anOutPort->PortName() << " )" << endl ; +// cdebug << ThreadNo() +// << " InNodeThreads::SetWaitingStates Node " << Name() << " " +// << anOutPort->ChangeInPorts( j )->GetOutPort()->NodeName() << "( " +// << anOutPort->ChangeInPorts( j )->GetOutPort()->PortName() << " ) != " +// << Name() << " : Restored to " << anOutPort->NodeName() << "( " +// << anOutPort->PortName() << " )" << endl ; anOutPort->ChangeInPorts( j )->ChangeOutPort( anOutPort ) ; } GraphExecutor::InNode * aNode = (GraphExecutor::InNode * ) aToNode->GetInNode() ; @@ -1895,6 +2157,7 @@ void GraphExecutor::InNode::SetWaitingStates(GraphExecutor::InNode * EndNode ) { } } +#define SuccessActionTrace 0 int GraphExecutor::InNode::Successed_SuccessAction() { cdebug << ThreadNo() << " --> Successed_SuccessAction " << Name() << endl; int res = 1; @@ -1909,15 +2172,20 @@ int GraphExecutor::InNode::Successed_SuccessAction() { DoneAction() ; if ( IsMacroNode() ) { +#if SuccessActionTrace cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction " << Name() << " LinkedNodes->SomeDataReady already done" << endl ; +#endif return 1; } +//JR 09.02.2005 : That complicated part of the code manages LOOPS and GOTO if ( IsGOTONode() || ( IsEndLoopNode() && GetNodeInLoop()->GetOutPort()->BoolValue() ) ) { +#if SuccessActionTrace cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction " << Name() << " SetWaitingStates " << endl ; +#endif const GraphBase::OutPort * aGateOutPort ; if ( IsGOTONode() ) { aGateOutPort = GetNodeOutGate() ; @@ -1933,41 +2201,72 @@ int GraphExecutor::InNode::Successed_SuccessAction() { for ( i = 0 ; i < aGateOutPort->InPortsSize() ; i++ ) { const GraphBase::InPort * anInPort = aGateOutPort->InPorts( i ) ; aLabelNode = (GraphExecutor::InNode *) _OutNode->Graph()->GetChangeGraphNode( anInPort->NodeName() )->GetInNode() ; +#if SuccessActionTrace cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction " << Name() << " will Loop to HeadNode " << aLabelNode->Name() << " from port " << anInPort->PortName() << endl ; aLabelNode->SetWaitingStates( this ) ; +#endif // JR 07.01.2005 Debug : Open the Gate of the coupledNode closed by SetWaitingStates GraphBase::OutPort * anOutPort = aLabelNode->GetChangeNodeInGate()->GetOutPort() ; if ( anOutPort ) { - CORBA::Any * anAny = new CORBA::Any() ; - *anAny <<= (long ) 1 ; +//JR 21.02.2005 Debug Memory leak : CORBA::Any * anAny = new CORBA::Any() ; + CORBA::Any anAny = CORBA::Any() ; +//JR 21.02.2005 Debug Memory leak : *anAny <<= (long ) 1 ; + anAny <<= (long ) 1 ; anOutPort->Value( anAny ) ; - aLabelNode->GetChangeNodeInGate()->State( SUPERV::ReadyState ) ; + aLabelNode->GetChangeNodeInGate()->PortState( SUPERV::ReadyState ) ; +// delete anAny ; } for ( j = 0 ; j < aLabelNode->GetNodeInPortsSize() ; j++ ) { const GraphBase::InPort * anInPort = aLabelNode->GetNodeInPort( j ) ; if ( anInPort->GetOutPort() ) { +#if SuccessActionTrace cdebug << aLabelNode->Name() << "(" << anInPort->PortName() << ") value : " << anInPort->GetOutPort()->NodeName() << "(" << anInPort->GetOutPort()->PortName() << ")" << endl ; +#endif } } - for ( j = 0 ; j < GetNodeOutPortsSize() ; j++ ) { - GraphBase::OutPort * aBusParamOutPort = GetChangeNodeOutPort( j ) ; - if ( !aBusParamOutPort->IsGate() ) { - GraphBase::InPort * aBusParamChangeInPort = NULL ; - if ( aBusParamOutPort->IsLoop() ) { +//PAL8176 ==> PAL8516 +//JR 24.03.2005 Debug : the number of OutPorts of a GOTONode and of InPorts of its linked +// InLine node must be the same + if ( GetNodeOutPortsSize() != aLabelNode-> GetNodeInPortsSize() ) { + cdebug << pthread_self() << "/" << ThreadNo() + << " Successed_SuccessAction # number of ports " << GetNodeOutPortsSize() + << " != " << aLabelNode-> GetNodeInPortsSize() << endl ; + SendEvent( GraphExecutor::ErrorEvent ) ; + return 0 ; + } + else { + for ( j = 0 ; j < GetNodeOutPortsSize() ; j++ ) { + GraphBase::OutPort * aBusParamOutPort = GetChangeNodeOutPort( j ) ; + if ( !aBusParamOutPort->IsGate() ) { + GraphBase::InPort * aBusParamChangeInPort = NULL ; + if ( aBusParamOutPort->IsLoop() ) { // For EndLoop do not copy EndLoop(DoLoop) in Loop(InLoop) // aBusParamChangeInPort = aLabelNode->GetChangeNodeInLoop() ; - } - else { - aBusParamChangeInPort = aLabelNode->GetChangeInPort( aBusParamOutPort->PortName() ) ; - } - if ( aBusParamChangeInPort ) { - aBusParamChangeInPort->ChangeOutPort( aBusParamOutPort ) ; - cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction " << Name() << " ChangeOutPort to HeadNode " - << aLabelNode->Name() << "(" << aBusParamChangeInPort->PortName() << ") from port " - << aBusParamOutPort->PortName() << endl ; + } + else { + aBusParamChangeInPort = aLabelNode->GetChangeInPort( aBusParamOutPort->PortName() ) ; + } + if ( aBusParamChangeInPort ) { + aBusParamChangeInPort->ChangeOutPort( aBusParamOutPort ) ; +#if SuccessActionTrace + cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction " << Name() << " ChangeOutPort to HeadNode " + << aLabelNode->Name() << "(" << aBusParamChangeInPort->PortName() << ") from port " + << aBusParamOutPort->PortName() << endl ; +#endif + } + else if ( IsGOTONode() ) { +//PAL8176 ==> PAL8516 +//JR 24.03.2005 Debug : the names of OutPorts of a GOTONode and of InPorts of its linked +// InLine node must be the same + cdebug << pthread_self() << "/" << ThreadNo() + << " Successed_SuccessAction # names of ports " + << aBusParamOutPort->PortName() << endl ; + SendEvent( GraphExecutor::ErrorEvent ) ; + return 0 ; + } } } } @@ -1979,8 +2278,10 @@ int GraphExecutor::InNode::Successed_SuccessAction() { if ( firsttoNode == NULL && aLabelNode->ThreadNo() == pthread_self() ) { firsttoNode = aLabelNode ; +#if SuccessActionTrace cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction firsttoNode " << aLabelNode->Name() << endl ; +#endif } else if ( firstzeroNode == NULL && aLabelNode->ThreadNo() == 0 ) { @@ -1988,23 +2289,27 @@ int GraphExecutor::InNode::Successed_SuccessAction() { } else { SomeDataNodes.push_back( aLabelNode ) ; +#if SuccessActionTrace cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction " << Name() << " push " << aLabelNode->Name() << " " << SomeDataNodes.size() << endl ; +#endif } } - 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 < 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::InPort * aGateInPort = aLabelNode->GetNodeInGate() ; if ( aGateInPort ) { if ( aGateInPort->GetOutPort() ) { +//JR 21.02.2005 Debug Memory leak : aGateInPort->GetOutPort()->Value( aGateOutPort->Value() ) ; +//JR 30.03.2005 aGateInPort->GetOutPort()->Value( *aGateOutPort->Value() ) ; aGateInPort->GetOutPort()->Value( aGateOutPort->Value() ) ; } if ( !aLabelNode->IsLockedDataWait() ) { @@ -2013,8 +2318,10 @@ int GraphExecutor::InNode::Successed_SuccessAction() { if ( firsttoNode == NULL && aLabelNode->ThreadNo() == pthread_self() ) { firsttoNode = aLabelNode ; +#if SuccessActionTrace cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction firsttoNode " << aLabelNode->Name() << endl ; +#endif } else if ( firstzeroNode == NULL && aLabelNode->ThreadNo() == 0 ) { @@ -2022,9 +2329,11 @@ int GraphExecutor::InNode::Successed_SuccessAction() { } else { SomeDataNodes.push_back( aLabelNode ) ; +#if SuccessActionTrace cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction " << Name() << " push " << aLabelNode->Name() << " " << SomeDataNodes.size() << endl ; +#endif } } } @@ -2037,36 +2346,51 @@ int GraphExecutor::InNode::Successed_SuccessAction() { } } +// JR 09.02.2005 : this is not a EndLoop or a GOTO : else { +#if SuccessActionTrace cdebug << ThreadNo() << " Successed_SuccessAction of " << Name() << " with " << LinkedNodesSize() << " linked nodes :" ; +#endif for ( i = 0 ; i < LinkedNodesSize() ; i++ ) { if ( LinkedNodes( i )->IsDataFlowNode() ) { linkednodesnumber -= 1 ; } +#if SuccessActionTrace cdebug << " " << LinkedNodes( i )->Name() ; +#endif } +#if SuccessActionTrace cdebug << endl; +#endif for ( i = 0 ; i < LinkedNodesSize() ; i++ ) { +// If this is a LoopNode and if DoLoopPort == false, we go directly to the EndOfLoopNode and +// we do not activate Nodes within the loop bool IgnoreForEndLoop = false ; +// If this is a SwitchNode and if DefaultOutPort == true, we may activate Nodes within Switch +// or we may activate directly the EnSwitch +// BUT the NotSwitchBranch(es) are NOT activated : + bool IgnoreForDefaultSwitch = false ; GraphBase::ComputingNode * aComputingNode ; aComputingNode = (GraphBase::ComputingNode * ) LinkedNodes( i ) ; toNode = (GraphExecutor::InNode *) aComputingNode->GetInNode() ; +#if SuccessActionTrace cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction of " << Name() - << " [" << i << "] " << LinkedNodes( i )->Name() << " toNode " << toNode << " IgnoreForEndLoop " - << IgnoreForEndLoop ; + << " [" << i << "] " << LinkedNodes( i )->Name() << " toNode " << toNode + << " IgnoreForEndLoop " << IgnoreForEndLoop ; if ( toNode ) { cdebug << " " << toNode->Kind() << endl ; } +#endif if ( toNode && !toNode->IsDataFlowNode() ) { if ( IsComputingNode() && toNode->IsInLineNode() ) { GraphBase::InPort * toGateInPort = toNode->GetChangeNodeInGate() ; - toGateInPort->State( SUPERV::ReadyState ) ; + toGateInPort->PortState( SUPERV::ReadyState ) ; GraphBase::OutPort * GateOutPort = toGateInPort->GetOutPort() ; if ( GateOutPort ) { GateOutPort->PortStatus( DataConnected ); - GateOutPort->State( SUPERV::ReadyState ) ; - GateOutPort->Done( true ) ; + GateOutPort->PortState( SUPERV::ReadyState ) ; + GateOutPort->PortDone( true ) ; } } } @@ -2079,13 +2403,17 @@ int GraphExecutor::InNode::Successed_SuccessAction() { else { // toNode is the EndLoopNode GraphBase::InPort * toLoopInPort ; toLoopInPort = toNode->GetChangeNodeInLoop() ; - if ( toLoopInPort->State() != SUPERV::ReadyState ) { - toLoopInPort->State( SUPERV::ReadyState ) ; + if ( toLoopInPort->PortState() != SUPERV::ReadyState ) { + toLoopInPort->PortState( SUPERV::ReadyState ) ; } } } } else if ( toNode && IsSwitchNode() ) { + const GraphBase::OutPort * anOutGatePort = GetNodeOutGate() ; + if ( anOutGatePort->BoolValue() && anOutGatePort->InPortsSize() ) { // DefaultPort is activated + IgnoreForDefaultSwitch = true ; + } } else if ( toNode && toNode->IsInLineNode() ) { int j ; @@ -2096,115 +2424,245 @@ int GraphExecutor::InNode::Successed_SuccessAction() { if ( toNode && !IgnoreForEndLoop ) { if ( toNode && toNode->IsLoopNode() ) { GraphBase::InPort * toLoopInPort = toNode->GetChangeNodeInLoop() ; - toLoopInPort->State( SUPERV::ReadyState ) ; + toLoopInPort->PortState( SUPERV::ReadyState ) ; GraphBase::OutPort * LoopOutPort = toLoopInPort->GetOutPort() ; LoopOutPort->PortStatus( DataConnected ); - LoopOutPort->State( SUPERV::ReadyState ) ; - LoopOutPort->Done( true ) ; - CORBA::Any * anAny = new CORBA::Any() ; // InitLoop - *anAny <<= (long ) 1 ; + LoopOutPort->PortState( SUPERV::ReadyState ) ; + LoopOutPort->PortDone( true ) ; +//JR 21.02.2005 Debug Memory leak : CORBA::Any * anAny = new CORBA::Any() ; // InitLoop + CORBA::Any anAny = CORBA::Any() ; // InitLoop +//JR 21.02.2005 Debug Memory leak : *anAny <<= (long ) 1 ; + anAny <<= (long ) 1 ; LoopOutPort->Value( anAny ) ; +// delete anAny ; int j ; for ( j = 0 ; j < toNode->GetNodeInPortsSize() ; j++ ) { toNode->GetChangeNodeInPort( j )->InitialOutPort() ; } } - cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction " << toNode->Name() << "->SendSomeDataReady( " - << Name() << " )" << endl ; - res = toNode->SendSomeDataReady( Name() ) ; - if ( res ) { - if ( firsttoNode == NULL && - toNode->ThreadNo() == pthread_self() ) { - firsttoNode = toNode ; - cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction firsttoNode " - << toNode->Name() << endl ; - } - else if ( firstzeroNode == NULL && - toNode->ThreadNo() == 0 ) { - firstzeroNode = toNode ; +// If the DefaultPort of that SwitchNode is connected to the DefaultPort od the EndSwitchNode +// the NotSwitchBranch(es) are NOT activated : +// If the DefaultPort of that SwitchNode is connected to SwitchBranch(es) +// the NotSwitchBranch(es) are NOT activated : + bool activatetoNode = true ; + if ( IgnoreForDefaultSwitch ) { +#if SuccessActionTrace + cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction search " + << toNode->Name() << " among linked nodes to DefaultPort of " << Name() << endl ; +#endif + activatetoNode = false ; + const GraphBase::OutPort * anOutGatePort = GetNodeOutGate() ; + const GraphBase::InPort * anInPort = NULL ; + int j ; + for ( j = 0 ; j < anOutGatePort->InPortsSize() ; j++ ) { + anInPort = anOutGatePort->InPorts( j ) ; + const GraphBase::ComputingNode * aNode ; + aNode = _OutNode->Graph()->GetGraphNode( anInPort->NodeName() ) ; + if ( aNode ) { +#if SuccessActionTrace + cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction try " + << aNode << " " << aNode->Name() << " == " << toNode << " " << toNode->Name() + << endl ; +#endif + } + if ( aNode && (const GraphBase::ComputingNode * ) toNode->ComputingNode() == aNode ) { +// toNode is connected to the DefaultPort of that SwitchNode : + activatetoNode = true ; + break ; + } } - else { - SomeDataNodes.push_back( toNode ) ; - cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction " << Name() << " push " - << toNode->Name() << " " << SomeDataNodes.size() << endl ; +// if ( activatetoNode ) { +// cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction found " +// << toNode->Name() << " among linked nodes to DefaultPort of " << Name() +// << endl ; +// } +// else { +// cdebug << pthread_self() << "/" << ThreadNo() +// << " Successed_SuccessAction does NOT found " +// << toNode->Name() << " among linked nodes to DefaultPort of " << Name() +// << endl ; +// } + } + if ( activatetoNode ) { +#if SuccessActionTrace + cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction " + << toNode->Name() << "->SendSomeDataReady( " << Name() << " )" << endl ; +#endif + res = toNode->SendSomeDataReady( Name() ) ; + if ( res ) { + if ( firsttoNode == NULL && + toNode->ThreadNo() == pthread_self() ) { + firsttoNode = toNode ; +#if SuccessActionTrace + cdebug << pthread_self() << "/" << ThreadNo() + << " Successed_SuccessAction firsttoNode " << toNode->Name() << endl ; +#endif + } + else if ( firstzeroNode == NULL && + toNode->ThreadNo() == 0 ) { + firstzeroNode = toNode ; + } + else { + SomeDataNodes.push_back( toNode ) ; +#if SuccessActionTrace + cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction " + << Name() << " push " + << toNode->Name() << " " << SomeDataNodes.size() << endl ; +#endif + } } } } } } +//PAL8517 +//JR 10.02.2005 : Debug at the end of execution of a SwitchNode : +// Here after we may start execution of only one SwitchBranch or of the Default +// But with activation of only one SwitchBranch we may activate several nodes of that SwitchBranch and +// we may activate several nodes of NotSwitchBranch ( a NotSwitchBranch is a Branch of the Switch +// where GatePorts of Nodes are not connected ; that Branches are always executed for each of SwitchBranch +// BUT are not executed when Default is activated). +// So the bug is that all input ports of the corresponding EndSwitchNode must have the status NOTDONE ! +// (Only if Default OutPort is closed and Default InPort is closed) + if ( IsSwitchNode() ) { + GraphBase::InLineNode * anEndSwitchNode = GOTONode()->CoupledNode() ; + if ( !GetNodeOutGate()->BoolValue() && anEndSwitchNode->GetNodeInGate()->GetOutPort() && + !anEndSwitchNode->GetNodeInGate()->GetOutPort()->BoolValue() ) { +#if SuccessActionTrace + cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction " << anEndSwitchNode->Name() + << " reset of InPort()->OutPort()->Done flag in EndSwitch" << endl ; +#endif + int i ; + for ( i = 0 ; i < anEndSwitchNode->GetNodeInPortsSize() ; i++ ) { + GraphBase::OutPort * anOutPort = anEndSwitchNode->GetChangeNodeInPort( i )->GetOutPort() ; +//PAL8519 +//JR 08.03.2005 Debug : update of state only if not a StreamPort + if ( anOutPort && strcmp( anOutPort->NodeName() , Name() ) && + !anOutPort->IsDataStream() ) { +#if SuccessActionTrace + cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction " + << anEndSwitchNode->Name() << " InPort " + << anEndSwitchNode->GetChangeNodeInPort( i )->PortName() << " NOTDONE from " + << anOutPort->NodeName() << " " << anOutPort->PortName() << endl ; +#endif + anEndSwitchNode->GetChangeNodeInPort( i )->PortState( SUPERV::WaitingState ) ; + anEndSwitchNode->GetChangeNodeInPort( i )->GetOutPort()->PortDone( false ) ; + } + else { +#if SuccessActionTrace + cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction " + << anEndSwitchNode->Name() << " InPort " + << anEndSwitchNode->GetChangeNodeInPort( i )->PortName() << " NOT Changed : directly from " + << anOutPort->NodeName() << " " << anOutPort->PortName() << endl ; +#endif + } + } + } + else { +#if SuccessActionTrace + cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction " << Name() + << " " << Kind() << " OutGate->Value " << GetNodeOutGate()->BoolValue() + << " NO reset of InPort()->OutPort()->Done flag in EndSwitch" << endl ; +#endif + } + } + +// firsttoNode : node that has the same ThreadNo() as the current node and that have to be activated +// firstzeroNode : node that has a null ThreadNo() and that have to be activated if ( firsttoNode == NULL && firstzeroNode ) { firsttoNode = firstzeroNode ; +#if SuccessActionTrace cdebug << pthread_self() << "/" << ThreadNo() - << " Successed_SuccessAction firsttoNode = firstzeroNode " + << " Successed_SuccessAction firsttoNode = firstzeroNode " << firsttoNode->Name() << endl ; +#endif } else if ( firsttoNode && firstzeroNode ) { SomeDataNodes.push_back( firstzeroNode ) ; +#if SuccessActionTrace cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction " << Name() << " push firstzeroNode " << firstzeroNode->Name() << " " << SomeDataNodes.size() << endl ; +#endif + firstzeroNode = NULL ; } else { +#if SuccessActionTrace cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction " << Name() << " firsttoNode " << firsttoNode << " firstzeroNode " << firstzeroNode << endl ; +#endif } while ( SomeDataNodes.size() ) { GraphExecutor::InNode *aNode = SomeDataNodes.front() ; SomeDataNodes.pop_front() ; -// cdebug << pthread_self() << "/" << ThreadNo() -// << " Successed_SuccessAction pop " -// << SomeDataNodes.size() << " " << aNode->Name() << endl ; +#if SuccessActionTrace + cdebug << pthread_self() << "/" << ThreadNo() + << " Successed_SuccessAction pop size " + << SomeDataNodes.size() << " " << aNode->Name() << endl ; +#endif if ( aNode->State() == GraphExecutor::DataReadyState ) { +#if SuccessActionTrace + cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction pop CreateNewThreadIf( true )" + << endl ; +#endif aNode->CreateNewThreadIf( true ) ; + _OutNode->IncrCreatedThreads() ; aNode->UnLockDataWait() ; res = aNode->DataUndef_AllDataReadyAction() ; } else { -// cdebug << pthread_self() << "/" << ThreadNo() << " ERROR " -// << aNode->Name() << " " -// << Automaton()->StateName( aNode->State() ) << endl ; +#if SuccessActionTrace + cdebug << pthread_self() << "/" << ThreadNo() << " ERROR " + << aNode->Name() << " " + << Automaton()->StateName( aNode->State() ) << endl ; +#endif } } if ( firsttoNode ) { -// cdebug << pthread_self() << "/" << ThreadNo() -// << " Successed_SuccessAction start firsttoNode " -// << SomeDataNodes.size() << " " << firsttoNode->Name() << endl ; +#if SuccessActionTrace + cdebug << pthread_self() << "/" << ThreadNo() + << " Successed_SuccessAction start firsttoNode " + << SomeDataNodes.size() << " " << firsttoNode->Name() << endl ; +#endif firsttoNode->CreateNewThreadIf( false ) ; firsttoNode->RewindStack( RewindStack() ) ; if ( firsttoNode->State() == GraphExecutor::SuccessedState ) { -// cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() -// << " : " << firsttoNode->Name() << " " -// << Automaton()->StateName( firsttoNode->State() ) -// << " --> DataWaitingState for Thread " -// << firsttoNode->ThreadNo() << endl ; +#if SuccessActionTrace + cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() + << " : " << firsttoNode->Name() << " " + << Automaton()->StateName( firsttoNode->State() ) + << " --> DataWaitingState for Thread " + << firsttoNode->ThreadNo() << endl ; +#endif firsttoNode->State( GraphExecutor::DataWaitingState ) ; } -// pthread_t OldT = firsttoNode->ThreadNo() ; firsttoNode->ThreadNo( pthread_self() ) ; // On continue avec le meme thread -// cdebug << pthread_self() << "/" << ThreadNo() << " firsttoNode " -// << firsttoNode->Name() << "Thread(" << OldT << "-->" -// << firsttoNode->ThreadNo() << ")" << endl ; ThreadNo( 0 ) ; -// cdebug << ThreadNo() << " Successed_SuccessAction " << Name() -// << " for " << firsttoNode->Name() -// << " !firsttoNode->CreateNewThreadIf() " -// << !firsttoNode->CreateNewThreadIf() -// << " " << Automaton()->StateName( firsttoNode->State() ) ; +#if SuccessActionTrace + cdebug << ThreadNo() << " Successed_SuccessAction " << Name() + << " for " << firsttoNode->Name() + << " !firsttoNode->CreateNewThreadIf() " + << !firsttoNode->CreateNewThreadIf() + << " " << Automaton()->StateName( firsttoNode->State() ) ; if ( firsttoNode->State() == GraphExecutor::DataReadyState ) { cdebug << endl ; - firsttoNode->UnLockDataWait() ; - res = firsttoNode->DataUndef_AllDataReadyAction() ; - } else { cdebug << " ERROR " << endl ; } +#endif + if ( firsttoNode->State() == GraphExecutor::DataReadyState ) { + firsttoNode->UnLockDataWait() ; + res = firsttoNode->DataUndef_AllDataReadyAction() ; + } } else { -// cdebug << ThreadNo() << " Successed_SuccessAction " << Name() -// << " NO DataReady ==> ThreadNo( 0 ) firsttoNode == NULL LINKEDnodesnumber " << linkednodesnumber << endl ; +#if SuccessActionTrace + cdebug << ThreadNo() << " Successed_SuccessAction " << Name() + << " NO DataReady ==> ThreadNo( 0 ) firsttoNode == NULL LINKEDnodesnumber " << linkednodesnumber << endl ; +#endif ThreadNo( 0 ) ; } @@ -2214,24 +2672,31 @@ int GraphExecutor::InNode::Successed_SuccessAction() { // _OutNode->CheckAllDone() ; // } -// cdebug << pthread_self() << "/" << ThreadNo() -// << " <-- Successed_SuccessAction " << Name() << " linkednodesnumber " -// << linkednodesnumber << endl; +#if SuccessActionTrace + cdebug << pthread_self() << "/" << ThreadNo() + << " <-- Successed_SuccessAction " << Name() << " linkednodesnumber " + << linkednodesnumber << endl; +#endif return 1 ; } +#define SendSomeDataReadyTrace 0 bool GraphExecutor::InNode::SendSomeDataReady( char * FromNodeName ) { bool RetVal = false ; if ( IsDataFlowNode() ) { +#if SendSomeDataReadyTrace cdebug << ThreadNo() << "InNode::SendSomeDataReady ----> " << Name() << " send Result to graph " << Name() << endl; +#endif } else { -// cdebug << pthread_self() << "/" << ThreadNo() << " ----> " << FromNodeName -// << " send SomeDataReady to " << Name() << " " -// << Automaton()->StateName( State() ) -// << " CreateNewThreadIf() " << CreateNewThreadIf() -// << " LockedDataWait " << IsLockedDataWait() << endl; +#if SendSomeDataReadyTrace + cdebug << pthread_self() << "/" << ThreadNo() << " ----> " << FromNodeName + << " send SomeDataReady to " << Name() << " " + << Automaton()->StateName( State() ) + << " CreateNewThreadIf() " << CreateNewThreadIf() + << " LockedDataWait " << IsLockedDataWait() << endl; +#endif #if 0 //cout << pthread_self() << "/" << ThreadNo() << " ----> " << FromNodeName << " send SomeDataReady to " << Name() << " " @@ -2242,10 +2707,12 @@ bool GraphExecutor::InNode::SendSomeDataReady( char * FromNodeName ) { if ( State() == GraphExecutor::SuccessedState || State() == GraphExecutor::SuspendedSuccessedState || State() == GraphExecutor::SuspendedSuccessedToReStartState ) { -// cdebug << ThreadNo() << " " << FromNodeName -// << " : " << Name() << " " << Automaton()->StateName( State() ) -// << " --> DataWaitingState for Thread " -// << ThreadNo() << " " << endl ; +#if SendSomeDataReadyTrace + cdebug << ThreadNo() << " " << FromNodeName + << " : " << Name() << " " << Automaton()->StateName( State() ) + << " --> DataWaitingState for Thread " + << ThreadNo() << " " << endl ; +#endif State( GraphExecutor::DataWaitingState ) ; } // We begin that LoopNode if SendSomeDataReady does not come from the corresponding EndLoopNode @@ -2368,7 +2835,7 @@ int GraphExecutor::InNode::SuspendedSuccessed_ReStartAction() { GraphExecutor::ReStartedState ) ; int i ; for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) { - GetChangeNodeInPort( i )->State( SUPERV::ReadyState ) ; + GetChangeNodeInPort( i )->PortState( SUPERV::ReadyState ) ; } SendEvent( ExecuteEvent ) ; cdebug << ThreadNo() << " SuspendedSuccessed_ReStartAction " << Name() << endl; @@ -2381,7 +2848,7 @@ int GraphExecutor::InNode::SuspendedErrored_ReStartAction() { GraphExecutor::ReStartedState ) ; int i ; for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) { - GetChangeNodeInPort( i )->State( SUPERV::ReadyState ) ; + GetChangeNodeInPort( i )->PortState( SUPERV::ReadyState ) ; } SendEvent( ExecuteEvent ) ; cdebug << ThreadNo() << " SuspendedErrored_ReStartAction " << Name() << endl; @@ -2428,42 +2895,60 @@ int GraphExecutor::InNode::SuspendedErrored_ReStartAndSuspendAction() { return 1 ; } +#define InParametersSetTrace 0 void GraphExecutor::InNode::InParametersSet( bool & Err , int nInParams , ServicesAnyData * InParametersList ) { int i ; - cdebug << ThreadNo() << " InParametersSet " << Name() << endl ; +#if InParametersSetTrace + cdebug << pthread_self() << "/" << ThreadNo() << " InParametersSet " << Name() << endl ; +#endif for ( i = 0 ; i < nInParams ; i++ ) { ServicesAnyData D = InParametersList[i]; GraphBase::InPort * anInPort = GetChangeNodeInPort(i) ; GraphBase::OutPort * theOutPort = anInPort->GetOutPort() ; if ( anInPort->IsGate() && theOutPort == NULL ) { +#if InParametersSetTrace cdebug << ThreadNo() << " ArgIn" << i << " " << D.Name << " " << anInPort->GetServicesParameter().Parametertype << " is inactive. " << anInPort->Kind() << endl ; +#endif } - else if ( anInPort->State() == SUPERV::ReadyState ) { + else if ( anInPort->PortState() == SUPERV::ReadyState ) { if ( anInPort->IsGate() ) { - CORBA::Any * anAny = new CORBA::Any() ; - *anAny <<= (long ) 0 ; +//JR 21.02.2005 Debug Memory leak : CORBA::Any * anAny = new CORBA::Any() ; + CORBA::Any anAny = CORBA::Any() ; +//JR 21.02.2005 Debug Memory leak : *anAny <<= (long ) 0 ; + anAny <<= (long ) 0 ; theOutPort->Value( anAny ) ; +// delete anAny ; } if ( !anInPort->IsDataStream() && !anInPort->IsDataConnected() ) { - anInPort->State( SUPERV::WaitingState ) ; + anInPort->PortState( SUPERV::WaitingState ) ; } - D.Name = CORBA::string_dup( anInPort->GetServicesParameter().Parametername ) ; - cdebug << ThreadNo() << " ArgIn" << i << " " << anInPort->Kind() - << " " << anInPort->State() ; - 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() ; +//JR 18.02.2005 Debug Memory leak : delete does not destroy that string ... +// D.Name = CORBA::string_dup( anInPort->GetServicesParameter().Parametername ) ; + D.Name = anInPort->PortName() ; +//JR 30.03.2005 const CORBA::Any * AnyPtr = theOutPort->Value() ; + const CORBA::Any AnyRef = theOutPort->Value() ; +#if InParametersSetTrace + cdebug << ThreadNo() << " ArgIn" << i << " " << anInPort->Kind() << " " + << anInPort->PortState() << " " << D.Name << " " + << anInPort->GetServicesParameter().Parametertype << endl ; +#endif +//JR 30.03.2005 D.Value = * AnyPtr ; // CORBA::Any + D.Value = AnyRef ; // CORBA::Any +//JR 18.02.2005 Debug Memory leak : string _Type = CORBA::string_dup( anInPort->GetServicesParameter().Parametertype ) ; +// const char * Type = _Type.c_str() ; + const char * Type = anInPort->GetServicesParameter().Parametertype ; switch ( D.Value.type()->kind() ) { // { string , long , double , objref } case CORBA::tk_string: char * t; D.Value >>= t; +#if InParametersSetTrace cdebug << t << " (string)" ; +#endif if ( !strcmp( Type , "string" ) ) { } else if ( !strcmp( Type , "boolean" ) ) { @@ -2480,7 +2965,9 @@ void GraphExecutor::InNode::InParametersSet( bool & Err , sscanf( t , "%ld" , &d ) ; c = (short ) d ; D.Value <<= (CORBA::Any::from_char ) c ; +#if InParametersSetTrace cdebug << "string '" << t << "' --> " << d << " --> char " << c ; +#endif // theOutPort->Value( D.Value ) ; } else if ( !strcmp( Type , "short" ) ) { @@ -2489,14 +2976,18 @@ void GraphExecutor::InNode::InParametersSet( bool & Err , sscanf( t , "%ld" , &d ) ; s = (short ) d ; D.Value <<= s ; +#if InParametersSetTrace cdebug << "string '" << t << "' --> " << d << " --> short " << s ; +#endif // theOutPort->Value( D.Value ) ; } else if ( !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) { long l ; sscanf( t , "%ld" , &l ) ; D.Value <<= l ; +#if InParametersSetTrace cdebug << "string '" << t << " --> long " << l ; +#endif // theOutPort->Value( D.Value ) ; } else if ( !strcmp( Type , "float" ) ) { @@ -2504,15 +2995,19 @@ void GraphExecutor::InNode::InParametersSet( bool & Err , sscanf( t , "%lf" , &d ) ; float f = d ; D.Value <<= f ; +#if InParametersSetTrace cdebug << "string '" << t << "' --> " << setw(25) << setprecision(18) << d << " --> float " << " = " << setw(25) << setprecision(18) << f ; +#endif // theOutPort->Value( D.Value ) ; } else if ( !strcmp( Type , "double" ) ) { double d ; sscanf( t , "%lf" , &d ) ; D.Value <<= d ; +#if InParametersSetTrace cdebug << "string '" << t << " --> double " << setw(25) << setprecision(18) << d ; +#endif // theOutPort->Value( D.Value ) ; } // else if ( !strcmp( Type , "objref" ) ) { @@ -2530,12 +3025,23 @@ void GraphExecutor::InNode::InParametersSet( bool & Err , // else { // cdebug << " (other ERROR)" << endl ; // } +#if InParametersSetTrace cdebug << " --> call_kind " << D.Value.type()->kind() << endl ; +#endif break; case CORBA::tk_long: +#if InParametersSetTrace + cdebug << ThreadNo() << " " << Name() << " ArgIn" << i << " " << D.Name << " " + << anInPort->GetServicesParameter().Parametertype << " " << anInPort->Kind() + << " " ; + theOutPort->StringValue( *GraphBase::Base::_fdebug ) ; + cdebug << endl ; +#endif long l; D.Value >>= l; +#if InParametersSetTrace cdebug << l << " (long)" << endl ; +#endif if ( !strcmp( Type , "string" ) ) { char t[40] ; sprintf( t , "%ld" , l ) ; @@ -2582,12 +3088,16 @@ void GraphExecutor::InNode::InParametersSet( bool & Err , // else { // cdebug << " (other ERROR)" << endl ; // } +#if InParametersSetTrace cdebug << " --> call_kind " << D.Value.type()->kind() << endl ; +#endif break; case CORBA::tk_double: double d; D.Value >>= d; +#if InParametersSetTrace cdebug << d << " (double)" << endl ; +#endif if ( !strcmp( Type , "string" ) ) { char t[40] ; sprintf( t , "%lf" , d ) ; @@ -2634,7 +3144,9 @@ void GraphExecutor::InNode::InParametersSet( bool & Err , // else { // cdebug << " (other ERROR)" << endl ; // } +#if InParametersSetTrace cdebug << " --> call_kind " << D.Value.type()->kind() << endl ; +#endif break; case CORBA::tk_objref: if ( !strcmp( Type , "string" ) ) { @@ -2690,7 +3202,9 @@ void GraphExecutor::InNode::InParametersSet( bool & Err , try { D.Value >>= obj ; retstr = ObjectToString( obj ) ; +#if InParametersSetTrace cdebug << retstr << endl ; +#endif } catch( ... ) { if ( i != 0 ) { @@ -2702,7 +3216,9 @@ void GraphExecutor::InNode::InParametersSet( bool & Err , // else { // cdebug << " (other ERROR)" << endl ; // } +#if InParametersSetTrace cdebug << " --> call_kind " << D.Value.type()->kind() << endl ; +#endif break; default: cdebug << " (other ERROR) " << D.Value.type()->kind() << endl ; @@ -2710,8 +3226,8 @@ void GraphExecutor::InNode::InParametersSet( bool & Err , } else { cdebug << ThreadNo() << " In" << i << " : wrong state ERROR State " - << anInPort->State() << " NameState " - << Automaton()->StateName( anInPort->State() ) << " PortName " + << anInPort->PortState() << " NameState " + << Automaton()->StateName( anInPort->PortState() ) << " PortName " << anInPort->PortName() << " Parametername " << anInPort->GetServicesParameter().Parametername << endl ; Err = true ; @@ -2722,16 +3238,23 @@ void GraphExecutor::InNode::InParametersSet( bool & Err , void GraphExecutor::InNode::InOutParametersSet( int nOutParams , ServicesAnyData * OutParametersList ) { +#if InParametersSetTrace + cdebug << pthread_self() << "/" << ThreadNo() << " InOutParametersSet " << Name() << endl ; +#endif int i ; for ( i = 0 ; i < nOutParams ; i++ ) { ServicesAnyData D = OutParametersList[i] ; - D.Name = GetChangeNodeOutPort(i)->GetServicesParameter().Parametername; - string _Type = CORBA::string_dup(GetChangeNodeOutPort(i)->GetServicesParameter().Parametertype) ; - const char * Type = _Type.c_str() ; - bool OutDone = GetChangeNodeOutPort(i)->Done() ; - cdebug << ThreadNo() << " ArgOut" << i << " " << D.Name << " Done(" - << OutDone << ") " << Type << " : " << endl ; +//JR 18.02.2005 Debug Memory leak : delete does not destroy that string ... +// D.Name = CORBA::string_dup(GetChangeNodeOutPort(i)->GetServicesParameter().Parametername); + D.Name = GetChangeNodeOutPort(i)->PortName() ; +//JR 18.02.2005 Debug Memory leak : string _Type = CORBA::string_dup(GetChangeNodeOutPort(i)->GetServicesParameter().Parametertype) ; + const char * Type = GetChangeNodeOutPort(i)->GetServicesParameter().Parametertype ; +#if InParametersSetTrace + bool OutDone = GetChangeNodeOutPort(i)->PortDone() ; + cdebug << ThreadNo() << " ArgOut" << i << " " << D.Name << " PortDone( " << OutDone << " ) Type : " + << Type << endl ; +#endif if ( !strcmp( Type , "string" ) ) { D.Value <<= (char *) NULL ; } @@ -2761,7 +3284,7 @@ void GraphExecutor::InNode::InOutParametersSet( int nOutParams , else { D.Value <<= CORBA::Object::_nil() ; } -//#if 0 +#if InParametersSetTrace switch (D.Value.type()->kind()) { // { string , long , double , objref } case CORBA::tk_string: char * t; @@ -2813,39 +3336,47 @@ void GraphExecutor::InNode::InOutParametersSet( int nOutParams , default: cdebug << ThreadNo() << " " << "(other ERROR)" << endl ; } -//#endif +#endif OutParametersList[i] = D ; } } +#define OutParametersSetTrace 0 bool GraphExecutor::InNode::OutParametersSet( bool Err , - SUPERV::GraphState NewState , + SUPERV::GraphState PortState , int nOutParams , ServicesAnyData * OutParametersList ) { bool RetVal = true ; int i ; GraphBase::OutPort * aGateOutPort = NULL ; bool OrSwitch = false ; - cdebug_in << "OutParametersSet " << Name() << " nOutParams " << nOutParams << " NewState " - << NewState << endl ; -// cout << "OutParametersSet " << Name() << " nOutParams " << nOutParams << " NewState " << NewState << endl ; + bool DefaultSwitch = false ; +#if OutParametersSetTrace + cdebug_in << "OutParametersSet " << Name() << " nOutParams " << nOutParams << " NewPortState " + << PortState << endl ; +#endif +// cout << "OutParametersSet " << Name() << " nOutParams " << nOutParams << " NewPortState " << PortState << endl ; if ( nOutParams && !IsMacroNode() ) { GraphBase::OutPort * anOutPort ; for ( i = 0 ; i < nOutParams ; i++ ) { anOutPort = GetChangeNodeOutPort(i) ; if ( Err ) { - anOutPort->State( NewState ) ; - anOutPort->Done( true ) ; + anOutPort->PortState( PortState ) ; + anOutPort->PortDone( true ) ; } else { - cdebug << ThreadNo() << " " << "Out" << i << " " << Name() << " " +#if OutParametersSetTrace + cdebug << ThreadNo() << "OutParametersSet " << "Out" << i << " " << Name() << " " << anOutPort->PortName() << " " << anOutPort->Kind() ; +#endif ServicesAnyData D = OutParametersList[i] ; switch (D.Value.type()->kind()) { // { string , long , double , objref } case CORBA::tk_string: { char * t; D.Value >>= t; +#if OutParametersSetTrace cdebug << ThreadNo() << " " << t << "(string)" << endl ; +#endif break; } case CORBA::tk_boolean: { @@ -2853,7 +3384,9 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err , D.Value >>= (CORBA::Any::to_boolean ) b; long l = (long ) b ; D.Value <<= l ; +#if OutParametersSetTrace cdebug << ThreadNo() << " " << b << "(boolean)" << endl ; +#endif break; } case CORBA::tk_char: { @@ -2861,7 +3394,9 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err , D.Value >>= (CORBA::Any::to_char ) c; long l = (long ) c ; D.Value <<= l ; +#if OutParametersSetTrace cdebug << ThreadNo() << " " << c << "(char)" << endl ; +#endif break; } case CORBA::tk_short: { @@ -2869,13 +3404,17 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err , D.Value >>= s; long l = (long ) s ; D.Value <<= l ; +#if OutParametersSetTrace cdebug << ThreadNo() << " " << s << "(short)" << endl ; +#endif break; } case CORBA::tk_long: { long l; D.Value >>= l; +#if OutParametersSetTrace cdebug << ThreadNo() << " " << l << "(long)" << endl ; +#endif break; } case CORBA::tk_float: { @@ -2883,158 +3422,205 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err , D.Value >>= f; double d = (double ) f ; D.Value <<= d ; +#if OutParametersSetTrace cdebug << ThreadNo() << " " << f << "(float)" << endl ; +#endif break; } case CORBA::tk_double: { double d; D.Value >>= d; +#if OutParametersSetTrace cdebug << ThreadNo() << " " << d << "(double)" << endl ; +#endif break; } case CORBA::tk_objref: { try { CORBA::Object_ptr obj ; - char * retstr ; D.Value >>= obj ; +#if OutParametersSetTrace + char * retstr ; retstr = ObjectToString( obj ) ; cdebug << ThreadNo() << retstr << endl ; +#endif } catch( ... ) { cdebug << "ToString( object ) Catched ERROR" << endl ; + RetVal = false ; } break; } default: { cdebug << ThreadNo() << " " << "(other ERROR)" << endl ; + RetVal = false ; } } OutParametersList[i] = D ; if ( !anOutPort->IsDataStream() ) { if ( anOutPort->IsGate() ) { aGateOutPort = anOutPort ; +#if OutParametersSetTrace cdebug << " Gate " ; +#endif long l = 1; OutParametersList[i].Value <<= l; anOutPort->Value( OutParametersList[i].Value ); } else if ( anOutPort->IsLoop() ) { +#if OutParametersSetTrace cdebug << " Loop " ; +#endif anOutPort->Value( OutParametersList[i].Value ); // InLoop Port of EndLoopNode is ready : - anOutPort->ChangeInPorts(0)->State( SUPERV::ReadyState ) ; + anOutPort->ChangeInPorts(0)->PortState( SUPERV::ReadyState ) ; } else if ( anOutPort->IsSwitch() ) { +#if OutParametersSetTrace cdebug << " Switch " ; +#endif anOutPort->Value( OutParametersList[i].Value ); if ( anOutPort->InPortsSize() && anOutPort->ChangeInPorts( 0 )->IsGate() ) { +//JR 09.02.2005 : OrSwitch is the OR of all SwitchBranches : +//It controls that there is only one SwitchBranch activated +//If it's final value is false ==> activation of the Default to GOTO to EndSwitchNode +//DefaultSwitch is true if a SwitchPort is linked to the DefaultPort of the EndSwitchNode if ( OrSwitch && anOutPort->BoolValue() ) { cdebug << "GraphExecutor::InNodeThreads::OutParameters more than one switch is true ERROR" << endl ; RetVal = false ; } - else { - OrSwitch = OrSwitch | anOutPort->BoolValue() ; - cdebug << "InNodeThreads::OutParameters OrSwitch = true" << endl ; + else if ( anOutPort->BoolValue() ) { +//JR 09.02.2005 Debug : case of a SwitchPort linked to the DefaultPort of the EndSwitchNode : + if ( !strcmp( anOutPort->ChangeInPorts( 0 )->NodeName() , GOTONode()->CoupledNodeName() ) ) { + DefaultSwitch = anOutPort->BoolValue() ; + } + else { + OrSwitch = OrSwitch | anOutPort->BoolValue() ; + } +#if OutParametersSetTrace + cdebug << "InNodeThreads::OutParameters OrSwitch " << OrSwitch << "DefaultSwitch " + << DefaultSwitch << endl ; +#endif } } - cdebug << "OutParametersSet OrSwitch " << OrSwitch ; } else { +#if OutParametersSetTrace cdebug << " Param " ; +#endif anOutPort->Value( OutParametersList[i].Value ); } - anOutPort->State( NewState ) ; - anOutPort->Done( true ) ; + anOutPort->PortState( PortState ) ; + anOutPort->PortDone( true ) ; } +#if OutParametersSetTrace + cdebug << "OutParametersSet OrSwitch " << OrSwitch << "DefaultSwitch " + << DefaultSwitch << endl ; +#endif int j ; for ( j = 0 ; j < anOutPort->InPortsSize() ; j++ ) { +#if OutParametersSetTrace + cdebug << ThreadNo() << "OutParametersSet " << "Out" << i << " " << Name() << " " + << anOutPort->PortName() << " " << anOutPort->Kind() << " --> " + << anOutPort->ChangeInPorts( j )->NodeName() << "( " + << anOutPort->ChangeInPorts( j )->PortName() << anOutPort->ChangeInPorts( j )->Kind() + << " )" << endl ; +#endif bool fromGOTO = false ; const char * ToNodeName = anOutPort->ChangeInPorts( j )->NodeName() ; if ( !strcmp( ToNodeName , _OutNode->Graph()->Name() ) && _OutNode->Graph()->GraphMacroLevel() != 0 ) { +#if OutParametersSetTrace cdebug << "OutParametersSet ToNodeName " << _OutNode->Graph()->Name() << " CoupledNode " << _OutNode->Graph()->CoupledNodeName() << _OutNode->Graph()->CoupledNode() << endl ; cdebug << " GraphExecutor " << _OutNode->Graph()->CoupledNode()->GraphEditor()->Executor() << endl ; +#endif _OutNode->Graph()->CoupledNode()->GraphEditor()->Executor()->OutputOfAny( _OutNode->Graph()->CoupledNodeName() , anOutPort->ChangeInPorts( j )->PortName() , - *anOutPort->Value() ) ; +//JR 30.03.2005 *anOutPort->Value() ) ; + anOutPort->Value() ) ; } else { GraphBase::ComputingNode * ToNode = _OutNode->Graph()->GetChangeGraphNode( ToNodeName ) ; if ( ToNode ) { // cout << "OutParametersSet ToNodeName " << ToNodeName << endl ; - cdebug << "OutParametersSet ToNodeName " << ToNodeName << " " << ToNode->Name() << endl ; +// cdebug << "OutParametersSet ToNodeName " << ToNodeName << " " << ToNode->Name() << endl ; GraphBase::OutPort * aGOTOPort = ToNode->GetChangeNodeInGate()->GetOutPort() ; if ( aGOTOPort ) { fromGOTO = aGOTOPort->IsGOTO() ; } if ( anOutPort->ChangeInPorts( j )->IsEndSwitch() || fromGOTO ) { +#if OutParametersSetTrace cdebug << anOutPort->ChangeInPorts( j )->NodeName() << "(" << anOutPort->ChangeInPorts( j )->PortName() << "," - << anOutPort->ChangeInPorts( j )->Kind() << ") WILL BE changed from " + << anOutPort->ChangeInPorts( j )->Kind() << ") CHANGED from " << anOutPort->ChangeInPorts( j )->GetOutPort()->NodeName() << "(" << anOutPort->ChangeInPorts( j )->GetOutPort()->PortName() - << ") to " << anOutPort->NodeName() << "(" - << anOutPort->PortName() << ")" << endl ; + << " to " << anOutPort->ChangeInPorts( j )->GetOutPort()->Kind() + << ") : Done " << anOutPort->PortDone() << " State " + << Automaton()->StateName( anOutPort->ChangeInPorts( j )->PortState() ) << endl ; +#endif anOutPort->ChangeInPorts( j )->ChangeOutPort( anOutPort ) ; } else { +#if OutParametersSetTrace 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 ; + << " " << anOutPort->ChangeInPorts( j )->GetOutPort()->Kind() + << ") " << endl ; +#endif } } } } -//#if 0 - switch (anOutPort->Value()->type()->kind()) { +#if OutParametersSetTrace + switch ( anOutPort->Value().type()->kind() ) { case CORBA::tk_string: char * t; - (*anOutPort->Value()) >>= 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; + 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; + anOutPort->Value() >>= (CORBA::Any::to_char ) c; cdebug << ThreadNo() << " Out" << i << " : " << c << "(char)" << endl ; break; case CORBA::tk_short: short s; - (*anOutPort->Value()) >>= s; + anOutPort->Value() >>= s; cdebug << ThreadNo() << " Out" << i << " : " << s << "(short)" << endl ; break; case CORBA::tk_long: long l; - (*anOutPort->Value()) >>= l; + anOutPort->Value() >>= l; cdebug << ThreadNo() << " Out" << i << " : " << l << "(long)" << endl ; break; case CORBA::tk_float: float f; - (*anOutPort->Value()) >>= f; + anOutPort->Value() >>= f; cdebug << ThreadNo() << " Out" << i << " : " << f << "(float)" << endl ; break; case CORBA::tk_double: double d; - (*anOutPort->Value()) >>= 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 ; + anOutPort->Value() >>= obj ; retstr = ObjectToString( obj ); cdebug << ThreadNo() << " Out" << i << " : " << "ToString( object ) " << retstr << endl ; @@ -3042,41 +3628,79 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err , catch ( ... ) { cdebug << ThreadNo() << " Out" << i << " : " << "ToString( object ) " << "Catched ERROR" << endl ; + RetVal = false ; } 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() ; +//JR 09.02.2005 : OrSwitch is the OR of all SwitchBranches : +//It controls that there is only one SwitchBranch activated +//If it's final value is false ==> activation of the Default to GOTO to EndSwitchNode +//DefaultSwitch is true if a SwitchPort (SwitchBranch) is linked to the DefaultPort of the EndSwitchNode + if ( !OrSwitch && !DefaultSwitch ) { + if ( aGateOutPort->InPortsSize() && aGateOutPort->ChangeInPorts( 0 ) ) { +#if OutParametersSetTrace + cdebug << ThreadNo() << " " << "OutGate " << Name() << " Open of " + << aGateOutPort->PortName() << " " << aGateOutPort->Kind() << " WITH DefaultPort" << endl ; +#endif + long l = 1; + OutParametersList[0].Value <<= l ; + aGateOutPort->Value( OutParametersList[0].Value ) ; + } + else { +#if OutParametersSetTrace + cdebug << ThreadNo() << " " << "OutGate " << Name() << " " + << aGateOutPort->PortName() << " " << aGateOutPort->Kind() << " NOT CONNECTED ERROR" << endl ; +#endif + RetVal = false ; + } + } +//JR 07.04.2005 Debug : reset only if it is not a default switch (SwitchBranch or +// SwitchParameter of SwitchNode connected to the InDefaultPort of +// EndSwitchNode) +// else { + else if ( !DefaultSwitch ) { +#if OutParametersSetTrace + cdebug << ThreadNo() << " " << "OutGate " << Name() << " Close of " + << aGateOutPort->PortName() << " " << aGateOutPort->Kind() << " NO DefaultPort" + << " OrSwitch " << OrSwitch << " DefaultSwitch " << DefaultSwitch << endl ; +#endif 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 ) ; + if ( !OrSwitch || DefaultSwitch ) { // DefaultPort or DefaultSwitch int i ; for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) { GraphBase::InPort * anInPort ; anInPort = CoupledNode()->GetChangeInPort( GetNodeOutPort( i )->PortName() ) ; - if ( anInPort ) { +//PAL8518 +//JR 16.02.2005 Debug : Change InPorts of EndSwitchNode that have the same name as an OutPort of +// the SwitchNode even if it is the DefaultPort : GraphSwitchCheckDefault1.xml +// if ( anInPort && !anInPort->IsGate() ) { + if ( anInPort && anInPort->GetOutPort() ) { +#if OutParametersSetTrace + cdebug << "OutParametersSet " << Name() << " " << anInPort->NodeName() << "( " + << anInPort->PortName() << " ) linked from " << anInPort->GetOutPort()->NodeName() + << "( " << anInPort->GetOutPort()->PortName() << " ) CHANGED TO linked from " + << GetChangeNodeOutPort( i )->NodeName() << "( " + << GetChangeNodeOutPort( i )->PortName() << " )" << endl ; +#endif anInPort->ChangeOutPort( GetChangeNodeOutPort( i ) ) ; } } } } } - cdebug_out << "OutParametersSet " << Name() << " nOutParams " << nOutParams << " NewState " - << NewState << " RetVal " << RetVal << endl ; +#if OutParametersSetTrace + cdebug_out << "OutParametersSet " << Name() << " nOutParams " << nOutParams << " NewPortState " + << PortState << " RetVal " << RetVal << endl ; +#endif return RetVal ; } diff --git a/src/GraphExecutor/DataFlowExecutor_OutNode.cxx b/src/GraphExecutor/DataFlowExecutor_OutNode.cxx index e143daa..db8a488 100644 --- a/src/GraphExecutor/DataFlowExecutor_OutNode.cxx +++ b/src/GraphExecutor/DataFlowExecutor_OutNode.cxx @@ -463,20 +463,24 @@ bool GraphExecutor::OutNode::Valid() { if ( Graph()->IsDataStreamNode() ) { StreamGraph()->SubStreamGraphsNumber( SubStreamGraphsNumber ) ; } + Graph()->InLineServices() ; + if ( !Graph()->ValidLoops() ) { cdebug_out << "This DataFlow have not valid Loops." << endl ; return false ; } + if ( !Graph()->ValidSwitchs() ) { + cdebug_out << "This DataFlow have not valid Switchs." << endl ; + return false ; + } // CreateService() ; - Graph()->InLineServices() ; - Graph()->ComputingNodes() ; _Valid = true ; - cdebug_out << "GraphExecutor::OutNode::Valid" << endl; + cdebug_out << "GraphExecutor::OutNode::Valid " << _Valid << endl; return _Valid ; } @@ -500,8 +504,8 @@ bool GraphExecutor::OutNode::Executable() { bool GraphExecutor::OutNode::Run( const bool AndSuspend ) { bool RetVal = false ; - cdebug_in << pthread_self() << "GraphExecutor::OutNode::Run( AndSuspend " << AndSuspend << " )" - << endl; + cdebug_in << pthread_self() << "GraphExecutor::OutNode::Run( AndSuspend " << AndSuspend + << " ) State " << theAutomaton->StateName( State() ) << endl; if ( Executable() ) { _ControlState = SUPERV::VoidState ; @@ -537,7 +541,10 @@ bool GraphExecutor::OutNode::Run( const bool AndSuspend ) { if ( anInNode->IsOneOfInLineNodes() ) { if ( !anInNode->InitPythonFunctions( true ) ) { anInNode->State( GraphExecutor::ErroredState ) ; +// PAL 8515 +//JR 24.03.2005 debug : State and done flags were missing State( GraphExecutor::ErroredState ) ; + Done( true ) ; cdebug_out << "GraphExecutor::OutNode::Run InitPythonFunctions ERROR " << anInNode->Name() << endl ; return false ; @@ -582,6 +589,10 @@ bool GraphExecutor::OutNode::Run( const bool AndSuspend ) { cdebug << pthread_self() << "GraphExecutor::OutNode::Run Start of HeadNode " << i << " " << anInNode->Name() << endl ; if ( anInNode->State() != GraphExecutor::DataReadyState ) { +// PAL 8515 +//JR 24.03.2005 debug : State and done flags were missing + State( GraphExecutor::ErroredState ) ; + Done( true ) ; cdebug << "GraphExecutor::OutNode::Run inconsistency State of Node " << anInNode->Name() << " : " << anInNode->State() << endl ; cdebug_out << "GraphExecutor::OutNode::Run State ERROR" << endl ; @@ -591,6 +602,7 @@ bool GraphExecutor::OutNode::Run( const bool AndSuspend ) { // GraphExecutor::DataReadyState ) ; // We say that we have to create a thread for that HeadNode 'anInNode' anInNode->CreateNewThread( true ) ; + IncrCreatedThreads() ; anInNode->DataFromNode( Graph()->Name() ) ; // AndSuspend == true <==> Start() if ( AndSuspend ) { @@ -599,6 +611,10 @@ bool GraphExecutor::OutNode::Run( const bool AndSuspend ) { // We send SomeDataReadyEvent // It is a HeadNode ==> AllDataReadyEvent ==> InNode::executeAction() ==> pthread_create if ( !anInNode->SendEvent( GraphExecutor::SomeDataReadyEvent ) ) { +// PAL 8515 +//JR 24.03.2005 debug : State and done flags were missing + State( GraphExecutor::ErroredState ) ; + Done( true ) ; cdebug << "InNode::SendEvent( SomeDataReadyEvent ) ERROR Node " << anInNode->Name() << endl ; cdebug_out << "GraphExecutor::OutNode::Run SendEvent ERROR" << endl ; @@ -610,6 +626,10 @@ bool GraphExecutor::OutNode::Run( const bool AndSuspend ) { // AndSuspend == false <==> Run() else if ( anInNode->IsMacroNode() ) { if ( !anInNode->SendEvent( GraphExecutor::SomeDataReadyEvent ) ) { +// PAL 8515 +//JR 24.03.2005 debug : State and done flags were missing + State( GraphExecutor::ErroredState ) ; + Done( true ) ; cdebug << "InNode::SendEvent( SomeDataReadyEvent ) ERROR Node " << anInNode->Name() << endl ; cdebug_out << "GraphExecutor::OutNode::Run SendEvent ERROR" << endl ; @@ -625,6 +645,10 @@ bool GraphExecutor::OutNode::Run( const bool AndSuspend ) { else if ( !anInNode->IsMacroNode() ) { // It is a HeadNode ==> AllDataReadyEvent ==> InNode::executeAction() ==> pthread_create if ( !anInNode->SendEvent( GraphExecutor::ExecuteEvent ) ) { +// PAL 8515 +//JR 24.03.2005 debug : State and done flags were missing + State( GraphExecutor::ErroredState ) ; + Done( true ) ; cdebug << "InNode::SendEvent( ExecuteEvent ) ERROR Node " << anInNode->Name() << endl ; cdebug_out << "GraphExecutor::OutNode::Run SendEvent ERROR" << endl ; @@ -652,9 +676,17 @@ bool GraphExecutor::OutNode::Run( const bool AndSuspend ) { RetVal = true ; } } + else { +// PAL 8515 +//JR 24.03.2005 debug : State and done flags were missing + State( GraphExecutor::ErroredState ) ; + Done( true ) ; + cdebug_out << "GraphExecutor::OutNode::Run Not Executable ERROR " << endl ; + return false ; + } cdebug_out << pthread_self() << "GraphExecutor::OutNode::Run " << Graph()->Name() - << " GraphMacroLevel " + << " State " << theAutomaton->StateName( State() ) << " GraphMacroLevel " << Graph()->GraphMacroLevel() << " RetVal " << RetVal << endl ; return RetVal ; } @@ -743,8 +775,18 @@ void GraphExecutor::OutNode::CheckAllDone() { << EventQSize() << endl ; cdebug << "================================================================================" << endl ; +//PAL8520 +//JR 23.02.2005, Debug : siftEvents() must be inside the pthread_mutex_lock + if ( pthread_mutex_lock( &_MutexWait ) ) { + perror("EventLoop pthread_mutex_lock ") ; + exit( 0 ) ; + } // asv : fix for 6798 and other bugs: "sift" the event queue after execution siftEvents(); + if ( pthread_mutex_unlock( &_MutexWait ) ) { + perror("PushEvent pthread_mutex_unlock ") ; + exit( 0 ) ; + } // asv : 25.10.04 : calling Editing() to indicate stop of execution Graph()->GraphEditor()->Editing(); @@ -817,9 +859,9 @@ void GraphExecutor::OutNode::NewThread() { exit( 0 ) ; } _Threads += 1 ; - cdebug << "NewThread : " << _Threads << " running threads " - << _SuspendedThreads << " suspended threads" - << endl ; +// cdebug << "NewThread : " << _Threads << " running threads " +// << _SuspendedThreads << " suspended threads" +// << endl ; if ( pthread_mutex_unlock( &_MutexWait ) ) { perror("pthread_mutex_unlock _NewThread") ; exit( 0 ) ; @@ -835,9 +877,9 @@ void GraphExecutor::OutNode::ExitThread( pthread_t ThreadNumber ) { ThreadNumber = pthread_self() ; } _Threads -= 1 ; - cdebug << pthread_self() << " ExitThread( " << ThreadNumber << " ) " << _Threads << " running threads " - << _SuspendedThreads << " suspended threads" - << endl ; +// cdebug << pthread_self() << " ExitThread( " << ThreadNumber << " ) " << _Threads << " running threads " +// << _SuspendedThreads << " suspended threads" +// << endl ; theAutomaton->JoinThread( ThreadNumber ) ; if ( pthread_cond_signal( &_JoinWait ) ) { perror("ExitThread pthread_cond_signal ") ; @@ -1178,8 +1220,18 @@ SUPERV::GraphState GraphExecutor::OutNode::AutomatonGraphState(GraphExecutor::Au return aGraphState ; } +//JR 07.04.2005, Debug : access to _EventNodes must be inside the pthread_mutex_lock int GraphExecutor::OutNode::GetListSize() { - return _EventNodes.size(); + if ( pthread_mutex_lock( &_MutexWait ) ) { + perror("PushEvent pthread_mutex_lock ") ; + exit( 0 ) ; + } + int eventnbr = _EventNodes.size(); + if ( pthread_mutex_unlock( &_MutexWait ) ) { + perror("PushEvent pthread_mutex_unlock ") ; + exit( 0 ) ; + } + return eventnbr ; } bool GraphExecutor::OutNode::PushEvent( GraphExecutor::InNode * aNode , @@ -1197,8 +1249,8 @@ bool GraphExecutor::OutNode::PushEvent( GraphExecutor::InNode * aNode , _States.push_back( aState ) ; pthread_cond_broadcast( &_EventWait ); - cdebug << pthread_self() << " PushEvent Threads " << Threads() << " SuspendedThreads " - << SuspendedThreads() << " pthread_cond_broadcast _EventWait " << &_EventWait << endl ; +// cdebug << pthread_self() << " PushEvent Threads " << Threads() << " SuspendedThreads " +// << SuspendedThreads() << " pthread_cond_broadcast _EventWait " << &_EventWait << endl ; if ( aNode ) { // cdebug << aNode->ThreadNo() << " PushEvent " << aNode->Name() ; // cdebug << " " << aNode->Automaton()->EventName( anEvent ) @@ -1213,15 +1265,16 @@ bool GraphExecutor::OutNode::PushEvent( GraphExecutor::InNode * aNode , } // cdebug_out << "PushEvent Threads " << Threads() << " SuspendedThreads " // << SuspendedThreads() << endl ; -#if 0 - if ( _EventNodes.size() > 101 ) { - while ( _EventNodes.size() > 31 ) { - _EventNodes.pop_front() ; - _Events.pop_front() ; - _States.pop_front() ; - } + +//PAL8520 +//JR 21.02.2005 Debug : old events should be removed at creation time for python-clients + int EventNodesSize = _EventNodes.size() ; + if ( EventNodesSize > Graph()->GraphNodesSize()*70 ) { + siftEvents(); +// cdebug << "OutNode::PushEvent " << _EventNodes.size() << " in queue instead of " +// << EventNodesSize << endl ; } -#endif + if ( pthread_mutex_unlock( &_MutexWait ) ) { perror("PushEvent pthread_mutex_unlock ") ; exit( 0 ) ; @@ -1237,24 +1290,28 @@ bool GraphExecutor::OutNode::Event( char ** aNodeName , SUPERV::GraphEvent & anEvent , SUPERV::GraphState & aState , bool WithWait ) { +//PAL8520 +//JR 23.02.2005, Debug : siftEvents() must be inside the pthread_mutex_lock + if ( pthread_mutex_lock( &_MutexWait ) ) { + perror("EventLoop pthread_mutex_lock ") ; + exit( 0 ) ; + } // asv : fixing problem of loops with large number of iterations (>5000) // experimentally was found that number of non-handled by GUI events = (number_of_nodes x 7) // or 7 events for each node - so what we want to do here is remove "old" events for nodes // "on the fly". Once again it is done in Stop(), Kill(), Done() functions. - if ( _EventNodes.size() > (unsigned int)Graph()->GraphNodesSize()*7 ) + int EventNodessize = _EventNodes.size() ; + if ( EventNodessize > Graph()->GraphNodesSize()*7 ) siftEvents(); int ThreadsNumber ; int SuspendedThreadsNumber ; bool cdebuginout = false ; if ( _EventNodes.size() > 0 ) { -// cdebug_in << "GraphExecutor::OutNode::Event " << _EventNodes.size() << " in queue" << endl ; +// cdebug_in << "GraphExecutor::OutNode::Event " << _EventNodes.size() << " in queue instead of " +// << EventNodessize << endl ; cdebuginout = true ; } - if ( pthread_mutex_lock( &_MutexWait ) ) { - perror("EventLoop pthread_mutex_lock ") ; - exit( 0 ) ; - } _JustStarted = false ; ThreadsNumber = Threads() ; SuspendedThreadsNumber = SuspendedThreads() ; @@ -1709,8 +1766,8 @@ bool GraphExecutor::OutNode::IsSuspended( const char * NodeName ) { return aret ; } -bool GraphExecutor::OutNode::IsDone( const char * NodeName , - const char * ServiceParameterName ) { +bool GraphExecutor::OutNode::PortDone( const char * NodeName , + const char * ServiceParameterName ) { // cdebug_in << "GraphExecutor::OutNode::IsDone " << NodeName << " " // << ServiceParameterName<< endl; bool aret = Graph()->PortDone( NodeName , ServiceParameterName ) ; @@ -1856,7 +1913,15 @@ bool GraphExecutor::OutNode::Resume() { bool GraphExecutor::OutNode::Kill() { bool RetVal = false ; cdebug_in << "GraphExecutor::OutNode::Kill" - << " EventQSize " << EventQSize() << endl; + << " EventQSize " << EventQSize() << " State " + << theAutomaton->StateName( State() ) << endl; + if ( IsDone() ) { + cdebug_out << "GraphExecutor::OutNode::Kill " << RetVal + << " Threads " << _Threads << " SuspendedThreads " << _SuspendedThreads + << " EventQSize " << EventQSize() << " State " + << theAutomaton->StateName( State() ) << endl ; + return RetVal ; + } _ControlState = SUPERV::ToSuspendState ; int i ; for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) { @@ -1875,6 +1940,12 @@ bool GraphExecutor::OutNode::Kill() { RetVal = true ; } } +//PAL8003 +// JR 24.03.2005 Debug : the node may have been killed + else if ( aNode->IsKilled() ) { + cdebug << aNode->Name() << " killed" << endl ; + RetVal = true ; + } else if ( aNode->IsWaiting() || aNode->IsDone() ) { cdebug << aNode->Name() << " not killed : " << theAutomaton->StateName( aNode->State() ) << endl ; @@ -1901,16 +1972,27 @@ bool GraphExecutor::OutNode::Kill() { MESSAGE(aNode->Name() << " " << theAutomaton->StateName( aNode->State() ) ) ; cdebug << aNode->Name() << " " << theAutomaton->StateName( aNode->State() ) << endl ; } - cdebug_out << "GraphExecutor::OutNode::Kill " << RetVal - << " Threads " << _Threads << " SuspendedThreads " << _SuspendedThreads - << " EventQSize " << EventQSize() << endl ; + if ( pthread_mutex_lock( &_MutexWait ) ) { + perror("EventLoop pthread_mutex_lock ") ; + exit( 0 ) ; + } +//PAL8520 +//JR 23.02.2005, Debug : siftEvents() must be inside the pthread_mutex_lock // remove "extra" events from the event queue siftEvents(); + if ( pthread_mutex_unlock( &_MutexWait ) ) { + perror("PushEvent pthread_mutex_unlock ") ; + exit( 0 ) ; + } // asv : 25.10.04 : calling Editing() to indicate stop of execution Graph()->GraphEditor()->Editing(); + cdebug_out << "GraphExecutor::OutNode::Kill " << RetVal + << " Threads " << _Threads << " SuspendedThreads " << _SuspendedThreads + << " EventQSize " << EventQSize() << endl ; + return RetVal ; } @@ -2077,20 +2159,24 @@ long GraphExecutor::OutNode::LastLevelDone() { } -const CORBA::Any *GraphExecutor::OutNode::GetInData( const char * NodeName , - const char * ServiceParameterName ) { +//JR 30.03.2005const CORBA::Any *GraphExecutor::OutNode::GetInData( const char * NodeName , +const CORBA::Any GraphExecutor::OutNode::GetInData( const char * NodeName , + const char * ServiceParameterName ) { // cdebug_in << "GraphExecutor::OutNode::GetInData " << NodeName << " " // << ServiceParameterName << endl ; - const CORBA::Any * retdata = Graph()->PortInData( NodeName , ServiceParameterName ) ; +//JR 30.03.2005 const CORBA::Any * retdata = Graph()->PortInData( NodeName , ServiceParameterName ) ; + const CORBA::Any retdata = Graph()->PortInData( NodeName , ServiceParameterName ) ; // cdebug_out << "GraphExecutor::OutNode::GetInData" << endl ; return retdata ; } -const CORBA::Any *GraphExecutor::OutNode::GetOutData( const char * NodeName , +//JR 30.03.2005const CORBA::Any *GraphExecutor::OutNode::GetOutData( const char * NodeName , +const CORBA::Any GraphExecutor::OutNode::GetOutData( const char * NodeName , const char * ServiceParameterName ) { // cdebug_in << "GraphExecutor::OutNode::GetOutData " << NodeName << " " // << ServiceParameterName << endl ; - const CORBA::Any * retdata = Graph()->PortOutData( NodeName , ServiceParameterName ) ; +//JR 30.03.2005 const CORBA::Any * retdata = Graph()->PortOutData( NodeName , ServiceParameterName ) ; + const CORBA::Any retdata = Graph()->PortOutData( NodeName , ServiceParameterName ) ; // cdebug_out << "GraphExecutor::OutNode::GetOutData" << endl ; return retdata ; } diff --git a/src/GraphExecutor/DataFlowExecutor_OutNode.hxx b/src/GraphExecutor/DataFlowExecutor_OutNode.hxx index 277d93f..5716375 100644 --- a/src/GraphExecutor/DataFlowExecutor_OutNode.hxx +++ b/src/GraphExecutor/DataFlowExecutor_OutNode.hxx @@ -63,6 +63,7 @@ namespace GraphExecutor { pthread_cond_t _JoinWait ; bool _JustStarted ; int _Threads ; // Number of threads + long _CreatedThreads ; int _SuspendedThreads ; list< char * > _EventNodes ; list< GraphExecutor::NodeEvent > _Events ; @@ -171,6 +172,11 @@ namespace GraphExecutor { return _Graph->ThreadNo() ; } ; long Thread( const char * NodeName ) ; + void IncrCreatedThreads() { + _CreatedThreads += 1 ; } ; + long CreatedThreads() { + return _CreatedThreads ; } ; + bool PushEvent( GraphExecutor::InNode * aNode , GraphExecutor::NodeEvent anEvent , GraphExecutor::AutomatonState aState ) ; @@ -232,8 +238,8 @@ namespace GraphExecutor { bool IsRunning( const char * NodeName ) ; bool IsDone( const char * NodeName ) ; bool IsSuspended( const char * NodeName ) ; - bool IsDone( const char * NodeName , - const char * ServiceParameterName ) ; + bool PortDone( const char * NodeName , + const char * ServiceParameterName ) ; long LastLevelDone() ; bool ReadyWait() ; @@ -245,10 +251,12 @@ namespace GraphExecutor { bool DoneWait( const char * NodeName ) ; bool SuspendedWait( const char * NodeName ) ; - const CORBA::Any *GetInData( const char *ToNodeName , - const char *ToParameterName ) ; - const CORBA::Any *GetOutData( const char *FromNodeName , - const char *FromParameterName ) ; +//JR 30.03.2005 const CORBA::Any *GetInData( const char *ToNodeName , + const CORBA::Any GetInData( const char *ToNodeName , + const char *ToParameterName ) ; +//JR 30.03.2005 const CORBA::Any *GetOutData( const char *FromNodeName , + const CORBA::Any GetOutData( const char *FromNodeName , + const char *FromParameterName ) ; const long CpuUsed() ; const long CpuUsed( const char *aNodeName ) ; }; diff --git a/src/GraphExecutor/DataFlowExecutor_PyDynInvoke.cxx b/src/GraphExecutor/DataFlowExecutor_PyDynInvoke.cxx index 6dcdb43..1f54017 100644 --- a/src/GraphExecutor/DataFlowExecutor_PyDynInvoke.cxx +++ b/src/GraphExecutor/DataFlowExecutor_PyDynInvoke.cxx @@ -155,21 +155,7 @@ PyObject * GraphExecutor::InNode::InitPyDynInvoke( char * PyFuncName , if ( strlen( PyFuncName ) ) { Automaton()->PyLock() ; - thePyRunMethod = Automaton()->PyFunction( PyFuncName ) ; - - //thePyRunMethod = NULL; - // asv 28.02.05 : VERY BAD fix of the following problem: after change of a function, - // the changes are NOT taken into account by Automation - it returns PyObject of the OLD function. - // so here we force re-automating the PyObject EVERY TIME, regardless if the function has changed or not. - // Once again - it is a very bad solution, it fully discards the whole idea of automation, - // here is it done as a quick fix for a bug. - // A better solution (to be implemented): store the PyObject NOT in Automation map, but in - // InLine node itself! And if the method is changed - remove the PyObject and force to regenerate it. - // But this means that PyObject must be stored in Editor's data model. - // asv 01.03.05 : the fix is not needed, the described bug is not reproduced. To investigate: - // WHERE PyObject is removed from Automation map on function change. - if ( (*aPythonFunction).length() ) { if ( thePyRunMethod == NULL ) { unsigned int i ; @@ -237,6 +223,7 @@ extern "C" PyObject * PyRunMethod( PyObject * dummy , PyObject * Args ) { return Result ; } +#define PyDynInvokeTrace 0 bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , const char *method , ServicesAnyData * inParams , int nInParams , @@ -249,13 +236,19 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , int n_out = nOutParams ; const char * sname; +#if PyDynInvokeTrace cdebug_in << ThreadNo() << "GraphExecutor::InNode::PyDynInvoke Node " << Name() << " method " << method << " " << n_in << " InArgs " << n_out << " OutArgs MyPyRunMethod " ; +#endif if ( MyPyRunMethod ) { +#if PyDynInvokeTrace cdebug << MyPyRunMethod << " " << MyPyRunMethod->ob_refcnt << endl ; +#endif } else { +#if PyDynInvokeTrace cdebug << " NULL" << endl ; +#endif return false ; } @@ -286,71 +279,89 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , case CORBA::tk_string : { char * t ; data >>= t ; - ArgValue = Py_BuildValue( "s" , t ) ; + PyObject * ArgValue = Py_BuildValue( "s" , t ) ; PyTuple_SetItem( ArgsList , i , ArgValue ) ; +#if PyDynInvokeTrace cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value " << t << " (string) " << " ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt" << ArgValue->ob_refcnt << endl ; +#endif break ; } case CORBA::tk_boolean : { bool b ; data >>= (CORBA::Any::to_boolean ) b ; - ArgValue = Py_BuildValue( "b" , b ) ; + PyObject * ArgValue = Py_BuildValue( "b" , b ) ; PyTuple_SetItem( ArgsList , i , ArgValue ) ; +#if PyDynInvokeTrace cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value " << b << " (boolean) ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt" << ArgValue->ob_refcnt << endl ; +#endif break ; } case CORBA::tk_char : { unsigned char c ; data >>= (CORBA::Any::to_char ) c ; - ArgValue = Py_BuildValue( "c" , c ) ; + PyObject * ArgValue = Py_BuildValue( "c" , c ) ; PyTuple_SetItem( ArgsList , i , ArgValue ) ; +#if PyDynInvokeTrace cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value " << c << " (char) ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt" << ArgValue->ob_refcnt << endl ; +#endif break ; } case CORBA::tk_short : { short s ; data >>= s ; - ArgValue = Py_BuildValue( "h" , s ) ; + PyObject * ArgValue = Py_BuildValue( "h" , s ) ; PyTuple_SetItem( ArgsList , i , ArgValue ) ; +#if PyDynInvokeTrace cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value " << s << " (short) ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt" << ArgValue->ob_refcnt << endl ; +#endif break ; } case CORBA::tk_long : { long l ; data >>= l ; - ArgValue = Py_BuildValue( "l" , l ) ; + PyObject * ArgValue = Py_BuildValue( "l" , l ) ; +#if PyDynInvokeTrace + cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value " << l + << " ArgValue->ob_refcnt" << ArgValue->ob_refcnt << endl ; +#endif PyTuple_SetItem( ArgsList , i , ArgValue ) ; +#if PyDynInvokeTrace cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value " << l << " (long) ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt" << ArgValue->ob_refcnt << endl ; +#endif break ; } case CORBA::tk_float : { float f ; data >>= f ; - ArgValue = Py_BuildValue( "f" , f ) ; + PyObject * ArgValue = Py_BuildValue( "f" , f ) ; PyTuple_SetItem( ArgsList , i , ArgValue ) ; +#if PyDynInvokeTrace cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value " << f << " (float) ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt" << ArgValue->ob_refcnt << endl ; +#endif break ; } case CORBA::tk_double : { double d ; data >>= d ; - ArgValue = Py_BuildValue( "d" , d ) ; + PyObject * ArgValue = Py_BuildValue( "d" , d ) ; PyTuple_SetItem( ArgsList , i , ArgValue ) ; +#if PyDynInvokeTrace cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value " << d << " (double) ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt" << ArgValue->ob_refcnt << endl ; +#endif break ; } case CORBA::tk_objref : { @@ -360,22 +371,30 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , IORObjRef = ObjectToString( ObjRef ) ; ObjValue = Py_BuildValue( "s" , IORObjRef ) ; PyTuple_SetItem( MyPyObjRefList , 0 , ObjValue ) ; +#if PyDynInvokeTrace cdebug << "ArgIn" << i << " : " << sname << " " << method << " " << " Value " << IORObjRef << " (objref) " << MyPyObjRef->ob_refcnt << "/" << MyPyObjRefList->ob_refcnt << endl ; +#endif // ResultObj = PyEval_CallObject( MyPyObjRef , MyPyObjRefList ) ; - ResultObj = PyEvalCallObject( MyPyObjRef , MyPyObjRefList ) ; + ResultObj = PyEvalCallObject( "PyObjRef" , MyPyObjRef , MyPyObjRefList ) ; +#if PyDynInvokeTrace cdebug << "ObjValue->ob_refcnt" << ObjValue->ob_refcnt << endl ; +#endif ArgValue = Py_BuildValue( "O" , ResultObj ) ; PyTuple_SetItem( ArgsList , i , ArgValue ) ; +#if PyDynInvokeTrace cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value (objref) ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt" << ArgValue->ob_refcnt << endl ; cdebug << "MyPyObjRefList->ob_refcnt " << MyPyObjRefList->ob_refcnt-1 << endl ; +#endif Py_DECREF( MyPyObjRefList ) ; if ( CORBA::is_nil( ObjRef ) ) { ResultObj = NULL ; } else { +#if PyDynInvokeTrace cdebug << "ResultObj->ob_refcnt " << ResultObj->ob_refcnt-1 << endl ; +#endif Py_DECREF( ResultObj ) ; } break ; @@ -387,9 +406,11 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , } // Result = PyEval_CallObject( MyPyRunMethod , ArgsList ) ; - Result = PyEvalCallObject( MyPyRunMethod , ArgsList ) ; + Result = PyEvalCallObject( method , MyPyRunMethod , ArgsList ) ; +#if PyDynInvokeTrace cdebug << "ArgsList->ob_refcnt" << ArgsList->ob_refcnt << endl ; +#endif if ( Result == NULL ) { cdebug_out << "GraphExecutor::InNode::PyDynInvoke Node " << Name() << " " << method << " Error Result == NULL" @@ -403,6 +424,7 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , switch ( data.type()->kind() ) { case CORBA::tk_string : { char * t = "" ; + PyObject * ArgValue ; if ( PyTuple_Check( Result ) ) { ArgValue = PyTuple_GetItem( Result , i ) ; } @@ -411,18 +433,22 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , } if ( !PyString_Check( ArgValue ) ) { cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (string)" << endl ; + RetVal = false ; } else { t = PyString_AsString( ArgValue ) ; } data <<= t ; +#if PyDynInvokeTrace cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << t << " (string)" - << " ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt" + << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt" << ArgValue->ob_refcnt << endl ; +#endif break ; } case CORBA::tk_boolean : { bool b = false ; + PyObject * ArgValue ; if ( PyTuple_Check( Result ) ) { ArgValue = PyTuple_GetItem( Result , i ) ; } @@ -431,38 +457,48 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , } if ( !PyInt_Check( ArgValue ) ) { cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (boolean)" << endl ; + RetVal = false ; } else { b = PyInt_AsLong( ArgValue ) ; } data <<= (CORBA::Any::from_boolean ) b ; +#if PyDynInvokeTrace cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << b << " (boolean)" - << " ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt" + << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt" << ArgValue->ob_refcnt << endl ; +#endif break ; } case CORBA::tk_char : { unsigned char c = 0 ; + PyObject * ArgValue ; if ( PyTuple_Check( Result ) ) { ArgValue = PyTuple_GetItem( Result , i ) ; } else { ArgValue = Result ; } - if ( !PyInt_Check( ArgValue ) ) { +//JR 04.04.2005 Debug if ( !PyInt_Check( ArgValue ) ) { +//Difficult to understand that behavior ... Python char type is a string of length 1 ! + if ( !PyString_Check( ArgValue ) ) { cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (char)" << endl ; + RetVal = false ; } else { c = PyInt_AsLong( ArgValue ) ; } data <<= (CORBA::Any::from_char ) c ; +#if PyDynInvokeTrace cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << c << " (char)" - << " ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt" + << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt" << ArgValue->ob_refcnt << endl ; +#endif break ; } case CORBA::tk_short : { short s = 0 ; + PyObject * ArgValue ; if ( PyTuple_Check( Result ) ) { ArgValue = PyTuple_GetItem( Result , i ) ; } @@ -471,18 +507,22 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , } if ( !PyInt_Check( ArgValue ) ) { cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (short)" << endl ; + RetVal = false ; } else { s = PyInt_AsLong( ArgValue ) ; } data <<= s ; +#if PyDynInvokeTrace cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << s << " (short)" - << " ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt" + << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt" << ArgValue->ob_refcnt << endl ; +#endif break ; } case CORBA::tk_long : { long l = 0 ; + PyObject * ArgValue ; if ( PyTuple_Check( Result ) ) { ArgValue = PyTuple_GetItem( Result , i ) ; } @@ -497,15 +537,19 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , } else { cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (CORBA::tk_long)" << endl ; + RetVal = false ; } data <<= l ; +#if PyDynInvokeTrace cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << l << " (long)" - << " ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt" + << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt" << ArgValue->ob_refcnt << endl ; +#endif break ; } case CORBA::tk_float : { float f = 0 ; + PyObject * ArgValue ; if ( PyTuple_Check( Result ) ) { ArgValue = PyTuple_GetItem( Result , i ) ; } @@ -514,18 +558,22 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , } if ( !PyFloat_Check( ArgValue ) ) { cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (float)" << endl ; + RetVal = false ; } else { f = PyFloat_AsDouble( ArgValue ) ; } data <<= f ; +#if PyDynInvokeTrace cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << f << " (float)" - << " ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt" + << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt" << ArgValue->ob_refcnt << endl ; +#endif break ; } case CORBA::tk_double : { double d = 0 ; + PyObject * ArgValue ; if ( PyTuple_Check( Result ) ) { ArgValue = PyTuple_GetItem( Result , i ) ; } @@ -534,14 +582,17 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , } if ( !PyFloat_Check( ArgValue ) ) { cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (double)" << endl ; + RetVal = false ; } else { d = PyFloat_AsDouble( ArgValue ) ; } data <<= d ; +#if PyDynInvokeTrace cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << d << " (double)" - << " ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt" + << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt" << ArgValue->ob_refcnt << endl ; +#endif break ; } case CORBA::tk_objref : { @@ -553,32 +604,44 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , else { ObjIor = Result ; } +#if PyDynInvokeTrace cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << "(object reference) " - << " ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ObjIor->ob_refcnt" + << " Result->ob_refcnt" << Result->ob_refcnt << " ObjIor->ob_refcnt" << ObjIor->ob_refcnt << endl ; +#endif Py_INCREF( ObjIor ) ; // PyObject_Print( ObjIor , stdout , 0 ) ; PyTuple_SetItem( MyPyObjIorList , 0 , ObjIor ) ; // ResultIor = PyEval_CallObject( MyPyObjIor , MyPyObjIorList ) ; - ResultIor = PyEvalCallObject( MyPyObjIor , MyPyObjIorList ) ; + ResultIor = PyEvalCallObject( "PyObjIor" , MyPyObjIor , MyPyObjIorList ) ; +#if PyDynInvokeTrace cdebug << "ObjIor->ob_refcnt " << ObjIor->ob_refcnt-1 << endl ; +#endif Py_DECREF( ObjIor ) ; +#if PyDynInvokeTrace cdebug << "MyPyObjIorList->ob_refcnt " << MyPyObjIorList->ob_refcnt-1 << endl ; +#endif Py_DECREF( MyPyObjIorList ) ; +#if PyDynInvokeTrace cdebug << "MyPyObjIor->ob_refcnt " << MyPyObjIor->ob_refcnt << endl ; +#endif if ( ResultIor ) { char * IOR = NULL ; IOR = PyString_AsString( ResultIor ) ; ObjRef = StringToObject( IOR ) ; data <<= ObjRef ; IORObjRef = ObjectToString( ObjRef ) ; +#if PyDynInvokeTrace cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << IORObjRef << " (objref) " << endl ; +#endif if ( CORBA::is_nil( ObjRef ) ) { ResultIor = NULL ; } else { +#if PyDynInvokeTrace cdebug << "ResultIor->ob_refcnt " << ResultIor->ob_refcnt-1 << endl ; +#endif Py_DECREF( ResultIor ) ; } } @@ -591,22 +654,40 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , } default : { cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << "(other ERROR)" << endl ; + RetVal = false ; } } outParams[i].Value = data ; } - cdebug << "Result->ob_refcnt" << Result->ob_refcnt-1 << endl ; +// int k ; +// for ( k = 0 ; k < n_out ; k++ ) { +// cdebug << "Result" << k << "->ob_refcnt " << PyTuple_GetItem( Result , k )->ob_refcnt << endl ; +// Py_DECREF( PyTuple_GetItem( Result , k ) ) ; +// } + +#if PyDynInvokeTrace + cdebug << "InNode::PyDynInvoke Result->ob_refcnt " << Result->ob_refcnt-1 << endl ; +#endif Py_DECREF( Result ) ; } - cdebug << "GraphExecutor::InNode::PyDynInvoke ArgsList->ob_refcnt" - << ArgsList->ob_refcnt-1 << endl ; +// int k ; +// for ( k = 0 ; k < n_in ; k++ ) { +// cdebug << "ArgsList" << k << "->ob_refcnt " << PyTuple_GetItem( ArgsList , k )->ob_refcnt << endl ; +// Py_DECREF( PyTuple_GetItem( ArgsList , k ) ) ; +// } + +#if PyDynInvokeTrace + cdebug << "InNode::PyDynInvoke ArgsList->ob_refcnt " << ArgsList->ob_refcnt-1 << endl ; +#endif Py_DECREF( ArgsList ) ; } +#if PyDynInvokeTrace cdebug_out << "GraphExecutor::InNode::PyDynInvoke Node " << Name() << " method " << method << " " << RetVal << endl ; +#endif return RetVal ; @@ -618,12 +699,16 @@ bool GraphExecutor::InNode::PyRunSimpleString( char* thePyString ) bool aRet; try { MESSAGE( pthread_self() << "Python method beginning : " << thePyString ); +#if PyDynInvokeTrace cdebug_in << pthread_self() << "Python method beginning : " << thePyString << endl ; +#endif aRet = PyRun_SimpleString( thePyString ); // asv : 20.01.05 : changes involved with switching to old (HEAD) KERNEL //aRet = _OutNode->SuperVisionContainer()->ActivatePythonExecution( thePyString ) ; MESSAGE( pthread_self() << "Python method finished." ); +#if PyDynInvokeTrace cdebug_out << pthread_self() << "Python method finished." << endl ; +#endif } catch( ... ) { MESSAGE( pthread_self() << "ERROR: Exception caught running Python method." ); cdebug_out << pthread_self() << "ERROR: Exception caught running Python method." @@ -639,23 +724,25 @@ bool GraphExecutor::InNode::PyRunSimpleString( char* thePyString ) return aRet; } -PyObject * GraphExecutor::InNode::PyEvalCallObject( PyObject * MyPyRunMethod , +PyObject * GraphExecutor::InNode::PyEvalCallObject( const char *method , + PyObject * MyPyRunMethod , PyObject * ArgsList ) { - cdebug_in << "Executor::InNode::PyEvalCallObject " << Name() << endl ; +// cdebug_in << "Executor::InNode::PyEvalCallObject " << Name() << endl ; PyObject * Result = NULL ; try { - MESSAGE( pthread_self() << "PyEval_CallObject method beginning : " ); - cdebug << pthread_self() << "PyEval_CallObject method beginning : " << Name() << endl ; +// MESSAGE( pthread_self() << "PyEval_CallObject " << Name() << " method beginning : " << method ); +// cdebug << pthread_self() << "PyEval_CallObject " << Name() << " method beginning : " << method << endl ; Result = PyEval_CallObject( MyPyRunMethod , ArgsList ) ; // asv : 20.01.05 : changes involved with switching to old (HEAD) KERNEL //Result = _OutNode->SuperVisionContainer()->ActivatePythonExecution( MyPyRunMethod , ArgsList ) ; - MESSAGE( pthread_self() << "PyEval_CallObject method finished. Result " << Result ); - cdebug << pthread_self() << "PyEval_CallObject method finished. Result " << Result << endl ; - cdebug_out << "Executor::InNode::PyEvalCallObject " << Name() << endl ; +// MESSAGE( pthread_self() << "PyEval_CallObject method finished. Result " << Result ); +// cdebug << pthread_self() << "PyEval_CallObject method finished. Result " << Result << endl ; +// cdebug_out << "Executor::InNode::PyEvalCallObject " << Name() << endl ; } catch( ... ) { - MESSAGE( pthread_self() << "ERROR: Exception caught PyEval_CallObject Python method. Result " << Result ); - cdebug << pthread_self() << "ERROR: Exception caught PyEval_CallObject Python method. Result " - << Result << endl ; + MESSAGE( pthread_self() << "ERROR: Exception caught PyEval_CallObject " << Name() + << " Python method " << method << ". Result " << Result ); + cdebug << pthread_self() << "ERROR: Exception caught PyEval_CallObject " << Name() + << " Python method " << method << ". Result " << Result << endl ; MESSAGE( " Python was reinitialized. Previous Python definitions are lost Py_IsInitialized " << Py_IsInitialized() ); //JR ===> fatal error in python : no current thread // asv : 20.01.05 : changes involved with switching to old (HEAD) KERNEL @@ -668,8 +755,9 @@ PyObject * GraphExecutor::InNode::PyEvalCallObject( PyObject * MyPyRunMethod , if ( Result == NULL ) { Kill() ; // Reset of _ThreadId } - cdebug_out << "Executor::InNode::PyEvalCallObject ERROR catched " << Name() - << " Py_IsInitialized " << Py_IsInitialized() << endl ; +// cdebug << "Executor::InNode::PyEvalCallObject ERROR catched " << Name() +// << " Py_IsInitialized " << Py_IsInitialized() << endl ; } +// cdebug_out << "Executor::InNode::PyEvalCallObject " << Name() << endl ; return Result ; } diff --git a/src/GraphExecutor/Makefile.in b/src/GraphExecutor/Makefile.in index 97cf9df..b10fe35 100644 --- a/src/GraphExecutor/Makefile.in +++ b/src/GraphExecutor/Makefile.in @@ -38,7 +38,8 @@ LIB_CLIENT_IDL = SALOME_ModuleCatalog.idl \ SALOME_Component.idl \ SALOMEDS.idl \ SUPERV.idl \ - SALOME_Exception.idl + SALOME_Exception.idl \ + SALOME_GenericObj.idl # Executables targets #BIN = SuperVisionExecutor_CheckOfUndefined diff --git a/src/SUPERVGUI/Makefile.in b/src/SUPERVGUI/Makefile.in index 52c9472..d8a5415 100644 --- a/src/SUPERVGUI/Makefile.in +++ b/src/SUPERVGUI/Makefile.in @@ -39,15 +39,16 @@ EXPORT_HEADERS = SUPERVGUI.h # .po files to transform in .qm PO_FILES = \ - SUPERV_icons.po \ + SUPERV_images.po \ SUPERV_msg_en.po \ SUPERV_msg_fr.po # Libraries targets -LIB = libSUPERVGUI.la +LIB = libSUPERV.la LIB_SRC = SUPERVGUI.cxx \ + SUPERVGUI_DataModel.cxx \ SUPERVGUI_ArrayView.cxx \ SUPERVGUI_Canvas.cxx \ SUPERVGUI_CanvasArray.cxx \ @@ -91,16 +92,18 @@ LIB_CLIENT_IDL = SALOMEDS.idl \ SALOME_ModuleCatalog.idl \ SALOME_Component.idl \ SUPERV.idl \ - SALOME_Exception.idl + SALOME_Exception.idl \ + SALOME_GenericObj.idl LIB_SERVER_IDL = -CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) \ - -ftemplate-depth-42 -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(BOOST_CPPFLAGS) \ + -ftemplate-depth-42 -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome LDFLAGS+=$(PYTHON_LIBS) $(QT_MT_LIBS) $(VTK_LIBS) $(OGL_LIBS) \ - -lSalomeGUI -lSalomeNS -lqsplitterP -lEvent \ + -lSalomeApp -lsuit -lSalomeNS -lEvent \ -lSalomeLifeCycleCORBA -lSalomeNotification -lSUPERVGraph \ - -L${KERNEL_ROOT_DIR}/lib/salome -LIBS+= + -L${KERNEL_ROOT_DIR}/lib/salome -L${GUI_ROOT_DIR}/lib/salome +#-lqsplitterP +LIBS+= @CONCLUDE@ diff --git a/src/SUPERVGUI/SUPERVGUI.cxx b/src/SUPERVGUI/SUPERVGUI.cxx index d8055e4..e0f0a7d 100644 --- a/src/SUPERVGUI/SUPERVGUI.cxx +++ b/src/SUPERVGUI/SUPERVGUI.cxx @@ -27,35 +27,50 @@ using namespace std; #include "SUPERVGUI.h" - -#include "QAD_Resource.h" -#include "QAD_FileDlg.h" -#include "QAD_Application.h" -#include "QAD_StudyFrame.h" -#include "QAD_RightFrame.h" -#include "QAD_LeftFrame.h" -#include "QAD_ViewFrame.h" -#include "QAD_ObjectBrowser.h" -#include "QAD_ObjectBrowserItem.h" -#include "QAD_MessageBox.h" - -#include "SALOME_Selection.h" +#include "SUPERVGUI_DataModel.h" + +#include "SALOMEDSClient.hxx" +#include +using namespace boost; + +#include "CAM_Application.h" +#include "OB_Browser.h" +#include "OB_ListItem.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_ImportOperation.h" +#include "SalomeApp_NameDlg.h" +#include "SalomeApp_SelectionMgr.h" +#include "SalomeApp_Study.h" +#include "SUIT_Desktop.h" +#include "SUIT_FileDlg.h" +#include "SUIT_MessageBox.h" +#include "SUIT_Operation.h" +#include "SUIT_ResourceMgr.h" +#include "SUIT_Session.h" +#include "SUIT_Study.h" + +#include "SUPERVGraph_ViewManager.h" + +#include "SALOME_ListIO.hxx" #include "SALOME_ListIteratorOfListIO.hxx" #include "SALOME_InteractiveObject.hxx" -#include "SALOMEGUI_ImportOperation.h" -#include "SALOMEGUI_NameDlg.h" #include "Utils_ORB_INIT.hxx" #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) +#include int SUPERVGUI::factory = 0; -SUPERVGUI Supervision(""); +extern "C" { + Standard_EXPORT CAM_Module* createModule() { + return new SUPERVGUI(); + } +} -SUPERVGUI::SUPERVGUI(const QString& theName, QObject* theParent) - : SALOMEGUI( theName, theParent ), - desktop(0), + +SUPERVGUI::SUPERVGUI() + : SalomeApp_Module( "SUPERV" ), study(0), browser(0) //info(0) @@ -86,35 +101,146 @@ SUPERVGUI::~SUPERVGUI() { }; } -void SUPERVGUI::init(QAD_Desktop* parent) { - Trace("SUPERVGUI::init") - if (desktop==0) { - desktop = parent; - study = desktop->getActiveStudy(); - SALOME_NamingService* namingService = desktop->getNameService(); - loadEngine(namingService); - browser = new SUPERVGUI_Service(namingService); - //info = new SUPERVGUI_Information(); - cursor = desktop->cursor(); - connect(desktop->getMainFrame(), SIGNAL(windowActivated(QWidget*)), this, SLOT(setMain(QWidget*))); - - int anId = 300; - parent->menuBar()->changeItem(anId,parent->getComponentUserName("SUPERV")); - - }; +SUPERVGUI* SUPERVGUI::Supervision() { + CAM_Application* anApp = dynamic_cast( SUIT_Session::session()->activeApplication() ); + if ( anApp ) { + SUPERVGUI* aSupervModule = dynamic_cast( anApp->activeModule() ); + return aSupervModule; + } + return NULL; +} + +void SUPERVGUI::createSupervAction( const int id, const QString& po_id, const QString& icon_id, const int key, const bool toggle ) +{ + QIconSet icon; + QWidget* parent = application()->desktop(); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + QPixmap pix; + if ( icon_id.length() ) + pix = resMgr->loadPixmap( "SUPERV", tr( icon_id ) ); + else + pix = resMgr->loadPixmap( "SUPERV", tr( QString( "ICO_" )+po_id ) ); + if ( !pix.isNull() ) + icon = QIconSet( pix ); + + QString tooltip = tr( QString( "TOP_" )+po_id ), + menu = tr( QString( "MEN_" )+po_id ), + status_bar = tr( QString( "STB_" )+po_id ); + + createAction( id, tooltip, icon, menu, status_bar, key, parent, toggle, this, SLOT( OnGUIEvent() ) ); } +void SUPERVGUI::initialize( CAM_Application* app ) +{ + SalomeApp_Module::initialize( app ); + + SALOME_NamingService* namingService = (( SalomeApp_Application* )application())->namingService(); + loadEngine(namingService); + + browser = new SUPERVGUI_Service(namingService); + //info = new SUPERVGUI_Information(); + cursor = application()->desktop()->cursor(); + + // ----- create actions -------------- + createSupervAction( 301, "IMPORT" ); + createSupervAction( 302, "EXPORT" ); + + createSupervAction( 303, "NEW" ); + createSupervAction( 304, "MODIFY" ); + + createSupervAction( 305, "RELOAD" ); + createSupervAction( 306, "RUN" ); + createSupervAction( 307, "KILL" ); + createSupervAction( 308, "SUSPEND/RESUME" ); + createSupervAction( 309, "ADDNODE" ); + createSupervAction( 310, "STEPBYSTEP" ); + + // ----- create menu ----------------- + int fileId = createMenu( tr( "MEN_FILE" ), -1, -1 ); + createMenu( 301, fileId, 10 ); + createMenu( 302, fileId, 10 ); + createMenu( separator(), fileId, 10 ); + + int editId = createMenu( tr( "MEN_EDIT" ), -1, -1 ); + createMenu( separator(), fileId, 7 ); + createMenu( 303, editId, -1 ); + createMenu( 304, editId, -1 ); + + int supervId = createMenu( tr( "MEN_SUPERV" ), -1, -1, 10/*, 300*/ ); + createMenu( 305, supervId, -1 ); + createMenu( 309, supervId, -1 ); + createMenu( separator(), fileId, 3 ); + createMenu( 306, supervId, -1 ); + createMenu( 310, supervId, -1 ); + createMenu( 307, supervId, -1 ); + createMenu( 308, supervId, -1 ); + + // ----- create toolbars ------------- + int supervisorId = createTool( tr( "TOOL_SUPERVISOR" ) ); + createTool( 301, supervisorId ); + createTool( 302, supervisorId ); + createTool( 303, supervisorId ); + createTool( 304, supervisorId ); + createTool( 305, supervisorId ); + createTool( 309, supervisorId ); + + int executionId = createTool( tr( "TOOL_EXECUTION" ) ); + createTool( 306, executionId ); + createTool( 310, executionId ); + createTool( 307, executionId ); + createTool( 308, executionId ); + +} + + void SUPERVGUI::activateModule( SUIT_Study* theStudy ) +{ + SalomeApp_Module::activateModule( theStudy ); + + //--------------------------------------- + setMenuShown( true ); + setToolShown( true ); + + study = application()->activeStudy(); + + connect( application()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ), + this, SLOT( setMain( SUIT_ViewWindow* ) ) ); -QAD_StudyFrame* SUPERVGUI::createGraph() { - QAD_StudyFrame* aStudyFrame = study->newWindow3d(study->getNextStudyFrameName(), - VIEW_GRAPHSUPERV, false); - if (aStudyFrame) { - connect(study, - SIGNAL(supervStudyFrameClosing(QAD_ViewFrame*)), - &Supervision, - SLOT(onGraphClosed(QAD_ViewFrame*))); +} + +QString SUPERVGUI::engineIOR() const +{ + if ( !CORBA::is_nil( engine ) ) + return QString( getApp()->orb()->object_to_string( engine)); + return QString( "" ); +} + +void SUPERVGUI::deactivateModule( SUIT_Study* theStudy ) +{ + setMenuShown( false ); + setToolShown( false ); + + disconnect( application()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ), + this, SLOT( setMain( SUIT_ViewWindow* ) ) ); + //--------------------------------------- + + SalomeApp_Module::deactivateModule( theStudy ); +} + +CAM_DataModel* SUPERVGUI::createDataModel() +{ + return new SUPERVGUI_DataModel( this ); +} + +SUIT_ViewWindow* SUPERVGUI::createGraph() { + SUPERVGraph_ViewManager* aVM = new SUPERVGraph_ViewManager( study, application()->desktop(), new SUPERVGraph_Viewer() ); + SUIT_ViewWindow* aVW = aVM->createViewWindow(); + if ( aVW ) { + connect( aVM, + SIGNAL( deleteView( SUIT_ViewWindow* ) ), + this, + SLOT( onGraphClosed( SUIT_ViewWindow* ) ) ); } - return aStudyFrame; + return aVW; } @@ -124,20 +250,21 @@ void SUPERVGUI::loadEngine(SALOME_NamingService* namingService) { SALOME_LifeCycleCORBA LCC(namingService); Engines::Component_var objComponent = LCC.FindOrLoad_Component("SuperVisionContainer", "SUPERV"); if (CORBA::is_nil(objComponent)) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_LOAD_SUPERV")); + QMessageBox::warning(application()->desktop(), tr("ERROR"), tr("MSG_CANT_LOAD_SUPERV")); return; }; SUPERV::SuperG_var aSuperVisionComponent; aSuperVisionComponent = SUPERV::SuperG::_narrow(objComponent); if (CORBA::is_nil(aSuperVisionComponent)) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_NARROW_SUPERV")); + QMessageBox::warning(application()->desktop(), tr("ERROR"), tr("MSG_CANT_NARROW_SUPERV")); return; }; // engine = new SUPERV::SuperG_var; engine = aSuperVisionComponent; } + /* bool SUPERVGUI::information(SUPERV_CNode node, bool isReadOnly) { Trace("SUPERVGUI::information") @@ -146,12 +273,7 @@ bool SUPERVGUI::information(SUPERV_CNode node, bool isReadOnly) { */ void SUPERVGUI::putInfo(const char* mess) { Trace("SUPERVGUI::putInfo") - desktop->putInfo(mess); -} - -QAD_Desktop* SUPERVGUI::getDesktop() { - Trace("SUPERVGUI::getDesktop") - return(desktop); + application()->putInfo(mess); } SUPERV_Engine SUPERVGUI::getEngine() { @@ -190,7 +312,7 @@ void SUPERVGUI::unregisterGraph(SUPERVGUI_Main* theGraph) { } -bool SUPERVGUI::isContains(QAD_Study* theStudy, const QString theKey) { +bool SUPERVGUI::isContains(SUIT_Study* theStudy, const QString theKey) { SUPERVGUI_Main* aMain; for (aMain = myGraphList.first(); aMain; aMain = myGraphList.next()) { if ((aMain->getStudy() == theStudy) && (aMain->getHashCode() == theKey)) @@ -200,17 +322,17 @@ bool SUPERVGUI::isContains(QAD_Study* theStudy, const QString theKey) { } -void SUPERVGUI::onGraphClosed(QAD_ViewFrame* theViewFrame) { - if(SUPERVGraph_ViewFrame* supervFrame = dynamic_cast(theViewFrame)){ - disconnect(study, 0 , this, 0); +void SUPERVGUI::onGraphClosed(SUIT_ViewWindow* theViewWindow) { + if( SUPERVGraph_ViewFrame* supervFrame = dynamic_cast(theViewWindow) ) { + disconnect(supervFrame->getViewManager(), 0 , this, 0); SUPERVGraph_View* view = supervFrame->getViewWidget(); SUPERVGUI_Main* aGraph = dynamic_cast(view); - if (aGraph) { + if ( aGraph ) { unregisterGraph(aGraph); SUPERV_Graph aDataFlow = aGraph->getDataflow(); if ( !SUPERV_isNull( aDataFlow ) ) { if ( aDataFlow->IsExecuting() ) { - const int aMsgResult = QMessageBox::warning(QAD_Application::getDesktop(), + const int aMsgResult = QMessageBox::warning(application()->desktop(), tr("WARNING"), tr("MSG_DF_RUNNING"), tr("MSG_DF_EXECUTION"), @@ -248,20 +370,21 @@ void SUPERVGUI::onGraphClosed(QAD_ViewFrame* theViewFrame) { } } -void SUPERVGUI::setMain(QWidget* w) { +void SUPERVGUI::setMain( SUIT_ViewWindow* w) { main = 0; - QAD_StudyFrame* aStudyFrame = dynamic_cast(w); - if (!aStudyFrame) return; + if ( !w ) return; - study = aStudyFrame->getStudy(); - if (!study) return; + study = w->getViewManager()->study(); + if (!study) { + cout<<" setMain(...) : NULL study!"; + return; + } - QAD_ViewFrame* viewFrame = aStudyFrame->getRightFrame()->getViewFrame(); - if(SUPERVGraph_ViewFrame* supervFrame = dynamic_cast(viewFrame)){ + if(SUPERVGraph_ViewFrame* supervFrame = dynamic_cast(w)){ SUPERVGraph_View* view = supervFrame->getViewWidget(); if (view) { main = dynamic_cast(view); - connect(&Supervision, SIGNAL(KillMainThread(bool)), main->getMyThread(), SLOT(KillThread(bool))); + connect(this, SIGNAL(KillMainThread(bool)), main->getMyThread(), SLOT(KillThread(bool))); } } Trace("SUPERVGUI::setMain - main: "<getMainFrame()->activeWindow()))->getLeftFrame()->getObjectBrowser(); + OB_Browser* aBrowser = (( SalomeApp_Application* )application())->objectBrowser(); SUPERV_Graph aDataFlow; QString aIORName; - QAD_ObjectBrowserItem* item = (QAD_ObjectBrowserItem*)(aBrowser->getListView()->currentItem()); - SALOMEDS::SObject_var aObj = desktop->getActiveStudy()->getStudyDocument()->FindObjectID(item->getEntry().latin1()); - SALOMEDS::GenericAttribute_var anAttr; + OB_ListItem* item = (OB_ListItem*)(aBrowser->getListView()->currentItem()); + _PTR(SObject) aObj + ( (( SalomeApp_Study* )(application()->activeStudy()))->studyDS()->FindObjectID(item->text(2).latin1()) ); + _PTR(GenericAttribute) anAttr; if (aObj->FindAttribute(anAttr, "AttributeIOR")) { - SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - Standard_CString ior = anIOR->Value(); - aIORName = ior; + _PTR(AttributeIOR) anIOR ( anAttr ); + aIORName = QString(anIOR->Value().c_str()); if (isContains(study, aIORName)) { - if (QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), + if (QMessageBox::warning(application()->desktop(), tr("WARNING"), tr("MSG_GRAPH_DISPLAYED").arg(""), QMessageBox::Yes, QMessageBox::No) == QMessageBox::No) return; } - //aDataFlow = engine->getStreamGraph(ior); - aDataFlow = engine->getGraph(ior); + //aDataFlow = engine->getStreamGraph(anIOR->Value().c_str()); + aDataFlow = engine->getGraph(anIOR->Value().c_str()); if (SUPERV_isNull(aDataFlow)) { QMessageBox::warning(0, tr("ERROR"), tr("MSG_ACCESS_BAD_IOR")); return; @@ -303,38 +426,46 @@ void SUPERVGUI::displayDataflow() { } */ } - QAD_StudyFrame* aStudyFrame = createGraph(); - SUPERVGraph_ViewFrame* aViewFrame = dynamic_cast - (aStudyFrame->getRightFrame()->getViewFrame()); - if(aViewFrame) { - main = new SUPERVGUI_Main(aViewFrame, desktop, aDataFlow); - registerGraph(aIORName, main); - study->showFrame(aStudyFrame); + SUPERVGraph_ViewFrame* aViewFrame = dynamic_cast( createGraph() ); + if( aViewFrame ) { + main = new SUPERVGUI_Main( aViewFrame, application()->desktop(), aDataFlow ); + registerGraph( aIORName, main ); + aViewFrame->show(); } } void SUPERVGUI::renameDataflow() { - SALOME_Selection* Sel = SALOME_Selection::Selection( study->getSelection() ); - SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); + SALOME_ListIO aList; + aList.Clear(); + (( SalomeApp_Application* )application())->selectionMgr()->selectedObjects( aList ); + + SALOME_ListIteratorOfListIO It( aList ); for ( ; It.More(); It.Next() ) { Handle(SALOME_InteractiveObject) IObject = It.Value(); - SALOMEDS::Study_var aStudy = study->getStudyDocument(); - SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() ); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeName_var aName; - if ( !obj->_is_nil() ) { - if (obj->FindAttribute(anAttr, "AttributeName")) { - aName = SALOMEDS::AttributeName::_narrow(anAttr); - QString nm = QString( aName->Value() ); - nm = SALOMEGUI_NameDlg::getName( QAD_Application::getDesktop(), nm ); + _PTR(Study) aStudy = (( SalomeApp_Study* )study)->studyDS(); + _PTR(SObject) obj ( aStudy->FindObjectID( IObject->getEntry() ) ); + _PTR(GenericAttribute) anAttr; + if ( obj ) { + if ( obj->FindAttribute(anAttr, "AttributeName") ) { + _PTR(AttributeName) aName ( anAttr ); + QString nm = QString( aName->Value().c_str() ); + nm = SalomeApp_NameDlg::getName( application()->desktop(), nm ); if ( !nm.isEmpty() ) { // sak : 24.11.04 : fix for PAL6898 : if rename fails (study locked), // a message box is displayed, and cursor is "wait cursor". We think that "wait cursor" // is not neccessary here, because the rename operation is fast. //QApplication::setOverrideCursor( Qt::waitCursor ); - study->renameIObject( IObject, nm ); + //study->renameIObject( IObject, nm ); + + //---> + aName->SetValue( nm.latin1() ); + //rename Interactive object + IObject->setName( ( char* )nm.latin1() ); + //<--- + + updateObjBrowser(); //QApplication::restoreOverrideCursor(); } } @@ -345,17 +476,17 @@ void SUPERVGUI::renameDataflow() { void SUPERVGUI::exportDataflow() { Trace("SUPERVGUI::exportDataflow") if ( main==0 ) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_EXPORT")); + QMessageBox::warning(application()->desktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_EXPORT")); } else if ( SUPERV_isNull( main->getDataflow() ) ) { // should not normally happen.. - QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_EXPORT")); + QMessageBox::warning(application()->desktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_EXPORT")); } else { - QString f = QAD_FileDlg::getFileName(QAD_Application::getDesktop(), - "", - "*.xml", - tr("TTL_EXPORT_DATAFLOW"), - false); + QString f = SUIT_FileDlg::getFileName(application()->desktop(), + "", + "*.xml", + tr("TTL_EXPORT_DATAFLOW"), + false); if ( !f.isEmpty() ) { // asv : bug [VSR Bugs and Improvements in Supervisor] 1.8 : when exporting a file, @@ -371,7 +502,7 @@ void SUPERVGUI::exportDataflow() { QFile::remove( aBackupFile ); } else { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_BAD_WRITING").arg(aBackupFile)); + QMessageBox::warning(application()->desktop(), tr("ERROR"), tr("MSG_BAD_WRITING").arg(aBackupFile)); } } } @@ -408,6 +539,13 @@ QString SUPERVGUI::createBackupFile( const QString& theOriginalFileName ) { return theBackupFileName; } +void SUPERVGUI::windows( QMap& mappa ) const +{ + mappa.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft ); + mappa.insert( SalomeApp_Application::WT_PyConsole, Qt::DockBottom ); + mappa.insert( SalomeApp_Application::WT_LogWindow, Qt::DockBottom ); +} + void SUPERVGUI::newDataflow() { createDataflow( New ); } @@ -424,9 +562,9 @@ bool SUPERVGUI::createDataflow( const NEW_DF_MODE mode ) { Trace("SUPERVGUI::createDataflow, mode = " << mode ); // asv : 27.01.05 : fix for PAL7823 : if the study is locked - warn the user and return. - SALOMEDS::Study_var aStudy = study->getStudyDocument(); + _PTR(Study) aStudy = (( SalomeApp_Study* )study)->studyDS(); if ( aStudy->GetProperties()->IsLocked() ) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("WRN_WARNING"), tr("WRN_STUDY_LOCKED")); + QMessageBox::warning(application()->desktop(), tr("WRN_WARNING"), tr("WRN_STUDY_LOCKED")); return false; } @@ -435,13 +573,13 @@ bool SUPERVGUI::createDataflow( const NEW_DF_MODE mode ) { QString f; // file name. declared here because may be used below in error msg construction.. if ( mode == Import || mode == Modify ) { // 0. import or modify existing dataflow - select XML file QString title = QString( "TLT_CREATE_DF_%1" ).arg( mode ); - f = QAD_FileDlg::getFileName( QAD_Application::getDesktop(), "", "*.xml", tr( title ), true ); + f = SUIT_FileDlg::getFileName( application()->desktop(), "", "*.xml", tr( title ), true ); if ( f.isEmpty() ) // pressed Cancel in file select dialog return false; // check if study already contains a graph imported from the same file if ( isContains( study, f ) ) { - if ( QMessageBox::warning( QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_GRAPH_DISPLAYED").arg(f), + if ( QMessageBox::warning( application()->desktop(), tr("WARNING"), tr("MSG_GRAPH_DISPLAYED").arg(f), QMessageBox::Yes, QMessageBox::No) == QMessageBox::No ) return false; } @@ -454,23 +592,21 @@ bool SUPERVGUI::createDataflow( const NEW_DF_MODE mode ) { if ( CORBA::is_nil( aGraph ) ) { QString msg( mode == New ? tr("MSG_CANT_CREATE_DF") : tr("MSG_BAD_FILE").arg(f) ); - QAD_MessageBox::warn1( QAD_Application::getDesktop(), tr("ERROR"), tr(msg), tr("BUT_OK") ); + SUIT_MessageBox::warn1( application()->desktop(), tr("ERROR"), tr(msg), tr("BUT_OK") ); return false; } // 2. create a ViewFrame object - QAD_StudyFrame* aStudyFrame = createGraph(); - SUPERVGraph_ViewFrame* aViewFrame = dynamic_cast - (aStudyFrame->getRightFrame()->getViewFrame()); + SUPERVGraph_ViewFrame* aViewFrame = dynamic_cast( createGraph() ); if ( aViewFrame ) { // 3. bind Graph and ViewFrame == create SUPERVGUI_Main object - main = new SUPERVGUI_Main(aViewFrame, desktop, aGraph); + main = new SUPERVGUI_Main( aViewFrame, application()->desktop(), aGraph ); if ( mode == New ) main->addNode(); else registerGraph( f, main ); - study->showFrame(aStudyFrame); + aViewFrame->show(); } return true; @@ -481,7 +617,7 @@ void SUPERVGUI::reloadDataflow() { if ( main ) main->sync(); else - QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_RELOAD")); + QMessageBox::warning(application()->desktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_RELOAD")); } void SUPERVGUI::runDataflow() { @@ -489,7 +625,7 @@ void SUPERVGUI::runDataflow() { if ( main ) main->run( /*andSuspend=*/false ); else - QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_RUN")); + QMessageBox::warning(application()->desktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_RUN")); } void SUPERVGUI::stepByStep() { @@ -497,7 +633,7 @@ void SUPERVGUI::stepByStep() { if ( main ) main->run( /*andSuspend=*/true ); else - QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_RUN")); + QMessageBox::warning(application()->desktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_RUN")); } void SUPERVGUI::killDataflow() { @@ -505,7 +641,7 @@ void SUPERVGUI::killDataflow() { if ( main ) main->kill(); else - QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_KILL")); + QMessageBox::warning(application()->desktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_KILL")); } void SUPERVGUI::suspendResumeDataflow() { @@ -513,7 +649,7 @@ void SUPERVGUI::suspendResumeDataflow() { if ( main ) main->suspendResume(); else - QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_SUSPEND")); + QMessageBox::warning(application()->desktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_SUSPEND")); } void SUPERVGUI::showComponents() { @@ -522,17 +658,17 @@ void SUPERVGUI::showComponents() { if ( main->isEditable() ) main->addNode(); else - QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOTEDITABLE")); + QMessageBox::warning(application()->desktop(), tr("WARNING"), tr("MSG_NOTEDITABLE")); } else - QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_ADD")); + QMessageBox::warning(application()->desktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_ADD")); } -bool SUPERVGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext, const QString& theParent, const QString& theObject) { +/*bool SUPERVGUI::CustomPopup(QPopupMenu* popup, const QString& theContext, const QString& theParent, const QString& theObject) { Trace("SUPERVGUI::customPopup"); - Supervision.init(parent); + Supervision.init(); if(popup->count() > 3) { // Temporary code: is to be deleted soon popup->removeItem(QAD_Display_Popup_ID); @@ -542,40 +678,45 @@ bool SUPERVGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QStrin if (id < 0 && id != -1) popup->removeItem(id); // separator // Temporary code end } - SALOME_Selection* Sel = SALOME_Selection::Selection(study->getSelection() ); - if ((Sel==NULL) || (Sel->IObjectCount() == 0)) return false; - - if (Sel->IObjectCount() == 1) { - Handle(SALOME_InteractiveObject) anIObj = Sel->firstIObject(); - - // insert SUPERV-specific popup items here + + SALOME_ListIO aList; + aList.Clear(); + (( SalomeApp_Application* )application())->selectionMgr()->selectedObjects( aList ); + if ( aList.Extent() == 0 ) return false; + + if ( aList.Extent() == 1 ) { + Handle(SALOME_InteractiveObject) anIObj = aList.First(); + + // 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(); + } + if (ownObj) + popup->insertItem(tr("MSG_DELETE"), this, SLOT(deleteObject())); + } - bool isDataflow, ownObj; - whatIsSelected(anIObj, ownObj, isDataflow); + if ( aList.Extent() > 1 ) { + int aIObjCount = 0; + SALOME_ListIteratorOfListIO It_forCheckOwner( aList ); + for(;It_forCheckOwner.More();It_forCheckOwner.Next()) { + Handle(SALOME_InteractiveObject) anIObj = It_forCheckOwner.Value(); + bool aIsOwner, aIsDataflow; + whatIsSelected(anIObj, aIsOwner, aIsDataflow); - 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 (aIsOwner) aIObjCount++; } + if ( aIObjCount == aList.Extent() ) //all selected objects belong to Supervision + popup->insertItem(tr("MSG_DELETE"), this, SLOT(deleteObject())); + } + return(true); -} + }*/ @@ -589,24 +730,21 @@ void SUPERVGUI::whatIsSelected(const Handle(SALOME_InteractiveObject)& theObj, b if (theObj.IsNull()) return; - SALOMEDS::Study_var aStudy = study->getStudyDocument(); - SALOMEDS::SObject_var obj = aStudy->FindObjectID( theObj->getEntry() ); - - if ( !obj->_is_nil() ) { - SALOMEDS::SComponent_var comp = obj->GetFatherComponent(); - if ( !comp->_is_nil() ) { - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeName_var aName; + _PTR(Study) aStudy = (( SalomeApp_Study* )study)->studyDS(); + _PTR(SObject) obj ( aStudy->FindObjectID( theObj->getEntry() ) ); + + if ( obj ) { + _PTR(SComponent) comp ( obj->GetFatherComponent() ); + if ( comp ) { + _PTR(GenericAttribute) anAttr; if (comp->FindAttribute(anAttr, "AttributeName")) { - aName = SALOMEDS::AttributeName::_narrow(anAttr); - QString compName(aName->Value()); - //if (compName.compare(STUDY_SUPERVISION) == 0) { - if (compName.compare(QAD_Application::getDesktop()->getComponentUserName("SUPERV")) == 0) { - SALOMEDS::GenericAttribute_var anAttr; + _PTR(AttributeName) aName ( anAttr ); + QString compName(aName->Value().c_str()); + if ( compName.compare( (( CAM_Application* )application())->moduleTitle( moduleName() ) ) == 0 ) { + _PTR(GenericAttribute) anAttr; if (obj->FindAttribute(anAttr, "AttributeIOR")) { - SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - //SUPERV_Graph aDataFlow = engine->getStreamGraph(anIOR->Value()); - SUPERV_Graph aDataFlow = engine->getGraph(anIOR->Value()); + _PTR(AttributeIOR) anIOR ( anAttr ); + SUPERV_Graph aDataFlow = engine->getGraph(anIOR->Value().c_str()); if (!SUPERV_isNull(aDataFlow)) { if (aDataFlow->IsStreamGraph()) { if (!SUPERV_isNull(aDataFlow->ToStreamGraph())) @@ -616,8 +754,8 @@ void SUPERVGUI::whatIsSelected(const Handle(SALOME_InteractiveObject)& theObj, b theIsDataflow = true; } } - CORBA::String_var anObjectID = obj->GetID(); - CORBA::String_var aComponentID = comp->GetID(); + CORBA::String_var anObjectID = obj->GetID().c_str(); + CORBA::String_var aComponentID = comp->GetID().c_str(); if (strcmp(anObjectID, aComponentID)) theIsOwner = true; } } @@ -626,117 +764,122 @@ void SUPERVGUI::whatIsSelected(const Handle(SALOME_InteractiveObject)& theObj, b } void SUPERVGUI::deleteObject() { - SALOME_Selection* Sel = SALOME_Selection::Selection(study->getSelection() ); - if ((Sel==NULL) || (Sel->IObjectCount() == 0)) return; + SALOME_ListIO aList; + aList.Clear(); + (( SalomeApp_Application* )application())->selectionMgr()->selectedObjects( aList ); + if ( aList.Extent() == 0 ) return; // sak : 24.11.04 : fix for PAL6899 : if the study is locked - warn the user and return. - SALOMEDS::Study_var aStudy = study->getStudyDocument(); + _PTR(Study) aStudy = (( SalomeApp_Study* )study)->studyDS(); if ( aStudy->GetProperties()->IsLocked() ) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("WRN_WARNING"), tr("WRN_STUDY_LOCKED")); + QMessageBox::warning(application()->desktop(), tr("WRN_WARNING"), tr("WRN_STUDY_LOCKED")); return; } // sak : 24.11.04 : fix for PAL6901 : Incorrect deletion of the objects : pressing ESC button // emitted "YES" button click, now it is corrected, and treated as "NO" button click. - if (QMessageBox::warning(QAD_Application::getDesktop(), + if (QMessageBox::warning(application()->desktop(), tr("WARNING"), tr("MSG_ASK_DELETE"), QMessageBox::No, QMessageBox::Yes) != QMessageBox::Yes) return; - SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); + SALOME_ListIteratorOfListIO It( aList ); for(;It.More();It.Next()) { Handle(SALOME_InteractiveObject) anIObj = It.Value(); bool aIsOwner, aIsDataflow; whatIsSelected(anIObj, aIsOwner, aIsDataflow); - SALOMEDS::SObject_var aObj = aStudy->FindObjectID( anIObj->getEntry() ); - if (!aObj->_is_nil()) { - QAD_Operation* op = new SALOMEGUI_ImportOperation( study ); - SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder(); + _PTR(SObject) aObj ( aStudy->FindObjectID( anIObj->getEntry() ) ); + if ( aObj ) { + SUIT_Operation* op = new SalomeApp_ImportOperation( application() ); + _PTR(StudyBuilder) aBuilder ( aStudy->NewBuilder() ); op->start(); - aBuilder->RemoveObjectWithChildren(aObj); - op->finish(); + aBuilder->RemoveObjectWithChildren( aObj ); + op->commit(); } } - Sel->ClearIObjects() ; + (( SalomeApp_Application* )application())->selectionMgr()->clearSelected(); } -bool SUPERVGUI::OnGUIEvent(int command, QAD_Desktop* parent) { - Supervision.init(parent); +void SUPERVGUI::OnGUIEvent() +{ + const QObject* obj = sender(); + if ( !obj || !obj->inherits( "QAction" ) ) + return; + int id = actionId((QAction*)obj); + if ( id != -1 ) + OnGUIEvent( id ); +} + +bool SUPERVGUI::OnGUIEvent(int command) { switch (command) { case 301: - Supervision.importDataflow(); + importDataflow(); return(false); case 302: - Supervision.exportDataflow(); + exportDataflow(); return(false); case 303: - Supervision.newDataflow(); + newDataflow(); return(false); case 304: - Supervision.modifyDataflow(); + modifyDataflow(); return(false); case 305: - Supervision.reloadDataflow(); + reloadDataflow(); return(false); case 306: - Supervision.runDataflow(); + runDataflow(); return(false); case 307: - Supervision.killDataflow(); + killDataflow(); return(false); case 308: - Supervision.suspendResumeDataflow(); + suspendResumeDataflow(); return(false); case 309: - Supervision.showComponents(); + showComponents(); return(false); case 310: - Supervision.stepByStep(); + stepByStep(); return(false); default: - QMessageBox::warning(QAD_Application::getDesktop(), "Supervision Error", "Unknown Command From Salome"); + QMessageBox::warning(application()->desktop(), "Supervision Error", "Unknown Command From Salome"); return(false); } } -bool SUPERVGUI::SetSettings(QAD_Desktop* parent) { +/*bool SUPERVGUI::SetSettings() { Trace("SUPERVGUI::SetSettings"); - Supervision.init(parent); + Supervision.init(); return(true); -} + }*/ -void SUPERVGUI::DefinePopup(QString& theContext, QString& theParent, QString& theObject) { +/*void SUPERVGUI::DefinePopup(QString& theContext, QString& theParent, QString& theObject) { theObject = ""; theContext = ""; -} + }*/ -bool SUPERVGUI::ActiveStudyChanged(QAD_Desktop* parent) { +bool SUPERVGUI::ActiveStudyChanged() { Trace("SUPERVGUI::activeStudyChanged"); - study = desktop->getActiveStudy(); + study = application()->activeStudy(); return true; } -void SUPERVGUI::SupportedViewType (int* buffer, int bufferSize) +/*void SUPERVGUI::SupportedViewType (int* buffer, int bufferSize) { if (!buffer || !bufferSize) return; buffer[0] = (int)VIEW_GRAPHSUPERV; -} +}*/ -extern "C" -{ - Standard_EXPORT SALOMEGUI* GetComponentGUI() { - return &Supervision; - } -} diff --git a/src/SUPERVGUI/SUPERVGUI.h b/src/SUPERVGUI/SUPERVGUI.h index 32b6b23..d35d4ac 100644 --- a/src/SUPERVGUI/SUPERVGUI.h +++ b/src/SUPERVGUI/SUPERVGUI.h @@ -31,30 +31,30 @@ // Acces a l`ihm de SALOME // ----------------------- -#include "QAD_Desktop.h" - - #include "SUPERVGUI_Def.h" #include "SUPERVGUI_Service.h" #include "SUPERVGUI_Main.h" -//#include "SUPERVGUI_Information.h" -#include "SALOMEGUI.h" +#include "SalomeApp_Module.h" + +class SUIT_Study; // Definition de la classe principale du module de supervision // ----------------------------------------------------------- -class SUPERVGUI: public SALOMEGUI { +class SUPERVGUI: public SalomeApp_Module { Q_OBJECT public: - SUPERVGUI( const QString&, QObject* = 0 ); + SUPERVGUI(); virtual ~SUPERVGUI(); - QAD_Desktop* getDesktop(); + static SUPERVGUI* Supervision(); + + virtual void initialize( CAM_Application* ); + virtual QString engineIOR() const; SUPERV_Engine getEngine(); - QAD_Study* getActiveStudy() - { return study; }; + SUIT_Study* getActiveStudy() { return study; } SUPERVGUI_Service* getBrowser(); QCursor getCursor(); @@ -72,27 +72,25 @@ class SUPERVGUI: public SALOMEGUI { void suspendResumeDataflow(); void showComponents(); - void init(QAD_Desktop* parent); SUPERVGUI_Main* getMain(); - bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); - bool SetSettings(QAD_Desktop* parent); - void DefinePopup(QString & theContext, - QString & theParent, - QString & theObject ) ; - bool CustomPopup(QAD_Desktop* parent, - QPopupMenu* popup, - const QString & theContext, - const QString & theParent, - const QString & theObject); - bool ActiveStudyChanged( QAD_Desktop* parent ); - void SupportedViewType (int* buffer, int bufferSize); - - bool isContains(QAD_Study* theStudy, const QString theKey); + bool OnGUIEvent(int theCommandID); + //bool SetSettings(); + //void DefinePopup(QString & theContext, + // QString & theParent, + // QString & theObject ) ; + //bool CustomPopup(QPopupMenu* popup, + // const QString & theContext, + // const QString & theParent, + // const QString & theObject); + bool ActiveStudyChanged(); + //void SupportedViewType (int* buffer, int bufferSize); + + bool isContains(SUIT_Study* theStudy, const QString theKey); void registerGraph(QString theName, SUPERVGUI_Main* theGraph); void unregisterGraph(SUPERVGUI_Main* theGraph); - QAD_StudyFrame* createGraph(); + SUIT_ViewWindow* createGraph(); /** Returns: theIsOwner = true if Selected object belongs to Suipervision. @@ -108,15 +106,25 @@ class SUPERVGUI: public SALOMEGUI { */ static QString createBackupFile( const QString& theOriginalFileName ); + virtual void windows( QMap& ) const; + signals: void KillMainThread(bool theValue); private slots: - void setMain(QWidget* w); + void setMain(SUIT_ViewWindow* w); void displayDataflow(); void renameDataflow(); void deleteObject(); - void onGraphClosed(QAD_ViewFrame* ); + void onGraphClosed( SUIT_ViewWindow* ); + void OnGUIEvent(); + + public slots: + virtual void activateModule( SUIT_Study* ); + virtual void deactivateModule( SUIT_Study* ); + + protected: + virtual CAM_DataModel* createDataModel(); private: void loadEngine(SALOME_NamingService* namingService); @@ -128,9 +136,11 @@ class SUPERVGUI: public SALOMEGUI { // but some differences still exist. These differences are implemented using NEW_DF_MODE param. bool createDataflow( const NEW_DF_MODE f ); + void createSupervAction( const int id, const QString& po_id, const QString& icon_id = QString(""), + const int key = 0, const bool toggle = false ); + static int factory; - QAD_Desktop* desktop; - QAD_Study* study; + SUIT_Study* study; SUPERV_Engine engine; SUPERVGUI_Service* browser; //SUPERVGUI_Information* info; @@ -140,9 +150,4 @@ class SUPERVGUI: public SALOMEGUI { QPtrList myGraphList; }; - -// Acces a l'instance unique de la classe du module de l'interface graphique de la supervision -// ------------------------------------------------------------------------------------------- -extern SUPERVGUI Supervision; - #endif diff --git a/src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.cxx b/src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.cxx index 57ba909..37b498c 100644 --- a/src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.cxx +++ b/src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.cxx @@ -10,6 +10,19 @@ using namespace std; +#include "SALOMEDSClient.hxx" +#include "SALOMEDS_SObject.hxx" +#include "SALOMEDS_Study.hxx" +#include +using namespace boost; + +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" +#include "SalomeApp_Study.h" +#include "SUIT_Session.h" + +#include "SALOME_ListIO.hxx" + #include "SUPERVGUI_BrowseNodeDlg.h" #include "SUPERVGUI_CanvasNode.h" #include "SUPERVGUI_CanvasPort.h" @@ -69,7 +82,12 @@ bool SUPERVGUI_PortField::setNewValue() { if ( aTxt.isNull() || aTxt.isEmpty() ) return false; if ( aTxt.find( "Unknown" ) < 0 ) { - return myPort->Input( Supervision.getEngine()->StringValue( aTxt ) ); + SUPERVGUI* aSupMod = SUPERVGUI::Supervision(); + if ( !aSupMod ) { + MESSAGE("NULL Supervision module!"); + return false; + } + return myPort->Input( aSupMod->getEngine()->StringValue( aTxt ) ); } return false; } @@ -92,7 +110,7 @@ bool SUPERVGUI_PortField::eventFilter( QObject* o, QEvent* e ) * Constructor (SUPERVGUI_CanvasNode) */ SUPERVGUI_BrowseNodeDlg::SUPERVGUI_BrowseNodeDlg( SUPERVGUI_CanvasNode* theNode ) - : QDialog( QAD_Application::getDesktop(), 0, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ) + : QDialog( SUIT_Session::session()->activeApplication()->desktop(), 0, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ) { myNodeCanvas = theNode; @@ -107,9 +125,6 @@ void SUPERVGUI_BrowseNodeDlg::init() SUPERV_CNode aEngine = myNodeCanvas->getEngine(); - mySelection = SALOME_Selection::Selection( Supervision.getActiveStudy()->getSelection() ); -// mySelection->ClearIObjects(); - setName( "SUPERVGUI_BrowseNodeDlg" ); setCaption( tr( "TIT_BROWSENODE" ) + aEngine->Name() ); @@ -180,7 +195,11 @@ void SUPERVGUI_BrowseNodeDlg::init() if ( !myIsEditable ) aBtnLayout->addStretch(); - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) ); + SUPERVGUI* aSupMod = SUPERVGUI::Supervision(); + if ( aSupMod ) connect( (( SalomeApp_Application* )(aSupMod->getActiveStudy()->application()))->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) ); + else MESSAGE("NULL Supervision module!"); + myNodeCanvas->getMain()->lockedGraph(true); } @@ -253,22 +272,37 @@ void SUPERVGUI_BrowseNodeDlg::onFieldActivated() void SUPERVGUI_BrowseNodeDlg::onSelectionChanged() { if ( myActiveField ) { - if( mySelection->IObjectCount() == 1 ) { - Handle( SALOME_InteractiveObject ) anIO = mySelection->firstIObject(); + + SALOME_ListIO aList; + aList.Clear(); + + SUPERVGUI* aSupMod = SUPERVGUI::Supervision(); + if ( !aSupMod ) { + MESSAGE("NULL Supervision module!"); + return; + } + + (( SalomeApp_Application* )(aSupMod->getActiveStudy()->application())) + ->selectionMgr()->selectedObjects( aList ); + + if( aList.Extent() == 1 ) { + Handle( SALOME_InteractiveObject ) anIO = aList.First(); if ( anIO->hasEntry() ) { - SALOMEDS::SObject_var aObj = Supervision.getActiveStudy()-> - getStudyDocument()->FindObjectID( anIO->getEntry() ); + _PTR(SObject) aObj ( dynamic_cast( aSupMod->getActiveStudy() )-> + studyDS()->FindObjectID( anIO->getEntry() ) ); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeIOR_var anIOR; - Standard_CString ior = ""; + _PTR(GenericAttribute) anAttr; + QString ior(""); if (aObj->FindAttribute( anAttr, "AttributeIOR" ) ) { - anIOR = SALOMEDS::AttributeIOR::_narrow( anAttr ); - ior = anIOR->Value(); + _PTR(AttributeIOR) anIOR ( anAttr ); + ior = anIOR->Value().c_str(); } else { - ior = aObj->GetStudy()->ConvertObjectToIOR( aObj ); + SALOMEDS_Study* aSStudy = dynamic_cast( aObj->GetStudy().get() ); + SALOMEDS_SObject* aSSObj = dynamic_cast( aObj.get() ); + if ( aSStudy && aSSObj ) + ior = aSStudy->ConvertObjectToIOR( aSSObj->GetObject() ).c_str(); } myActiveField->setData( ior ); } @@ -281,7 +315,7 @@ void SUPERVGUI_BrowseNodeDlg::onSelectionChanged() * Constructor (SUPERVGUI_CanvasPort) */ SUPERVGUI_GetValueDlg::SUPERVGUI_GetValueDlg( SUPERVGUI_CanvasPort* thePort ) - : QDialog( QAD_Application::getDesktop(), 0, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ) + : QDialog( SUIT_Session::session()->activeApplication()->desktop(), 0, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ) { myPortCanvas = thePort; @@ -293,9 +327,6 @@ void SUPERVGUI_GetValueDlg::init() myOKBtn = 0; setSizeGripEnabled( true ); - mySelection = SALOME_Selection::Selection( Supervision.getActiveStudy()->getSelection() ); -// mySelection->ClearIObjects(); - setName( "SUPERVGUI_GetValueDlg" ); setCaption( tr( "TIT_SETVALUE_PORT" ) ); @@ -345,8 +376,12 @@ void SUPERVGUI_GetValueDlg::init() aBtnLayout->addStretch(); myField->updateGUI(); - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) ); + SUPERVGUI* aSupMod = SUPERVGUI::Supervision(); + if ( aSupMod ) connect( (( SalomeApp_Application* )(aSupMod->getActiveStudy()->application()))->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) ); + else MESSAGE("NULL Supervision module!"); + myPortCanvas->getMain()->lockedGraph(true); } @@ -375,7 +410,7 @@ void SUPERVGUI_GetValueDlg::accept() { myPortCanvas->getMain()->getCanvas()->update(); } else { - if ( QMessageBox::warning( QAD_Application::getDesktop(), + if ( QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr( "ERROR" ), tr( "MSG_CANT_SETVAL" ), QMessageBox::Retry, QMessageBox::Abort) == QMessageBox::Retry ) return; @@ -401,22 +436,36 @@ void SUPERVGUI_GetValueDlg::reject() { */ void SUPERVGUI_GetValueDlg::onSelectionChanged() { - if( mySelection->IObjectCount() == 1 ) { - Handle( SALOME_InteractiveObject ) anIO = mySelection->firstIObject(); + SALOME_ListIO aList; + aList.Clear(); + + SUPERVGUI* aSupMod = SUPERVGUI::Supervision(); + if ( !aSupMod ) { + MESSAGE("NULL Supervision module!"); + return; + } + + (( SalomeApp_Application* )(aSupMod->getActiveStudy()->application())) + ->selectionMgr()->selectedObjects( aList ); + + if( aList.Extent() == 1 ) { + Handle( SALOME_InteractiveObject ) anIO = aList.First(); if ( anIO->hasEntry() ) { - SALOMEDS::SObject_var aObj = Supervision.getActiveStudy()-> - getStudyDocument()->FindObjectID( anIO->getEntry() ); + _PTR(SObject) aObj ( dynamic_cast( aSupMod->getActiveStudy() )-> + studyDS()->FindObjectID( anIO->getEntry() ) ); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeIOR_var anIOR; - Standard_CString ior = ""; + _PTR(GenericAttribute) anAttr; + QString ior(""); if (aObj->FindAttribute( anAttr, "AttributeIOR" ) ) { - anIOR = SALOMEDS::AttributeIOR::_narrow( anAttr ); - ior = anIOR->Value(); + _PTR(AttributeIOR) anIOR ( anAttr ); + ior = anIOR->Value().c_str(); } else { - ior = aObj->GetStudy()->ConvertObjectToIOR( aObj ); + SALOMEDS_Study* aSStudy = dynamic_cast( aObj->GetStudy().get() ); + SALOMEDS_SObject* aSSObj = dynamic_cast( aObj.get() ); + if ( aSStudy && aSSObj ) + ior = aSStudy->ConvertObjectToIOR( aSSObj->GetObject() ).c_str(); } myField->setData( ior ); } @@ -430,7 +479,7 @@ void SUPERVGUI_GetValueDlg::onSelectionChanged() // ---------------------------- SUPERVGUI_StreamInDlg::SUPERVGUI_StreamInDlg(SUPERVGUI_CanvasStreamPortIn* thePort) - :QDialog( QAD_Application::getDesktop(), "", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) + :QDialog( SUIT_Session::session()->activeApplication()->desktop(), "", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) { myPortCanvas = thePort; init(); @@ -529,7 +578,7 @@ void SUPERVGUI_StreamInDlg::accept() { //------------------------------------------------------------------------- SUPERVGUI_StreamOutDlg::SUPERVGUI_StreamOutDlg(SUPERVGUI_CanvasStreamPortOut* thePort) - :QDialog( QAD_Application::getDesktop(), "", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) + :QDialog( SUIT_Session::session()->activeApplication()->desktop(), "", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) { myPortCanvas = thePort; init(); diff --git a/src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.h b/src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.h index e330d33..19563ce 100644 --- a/src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.h +++ b/src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.h @@ -13,8 +13,6 @@ #include #include "SUPERVGUI_Def.h" -#include "SALOME_Selection.h" - /** * Class for ports values management (for internal using) @@ -79,7 +77,6 @@ private: bool myIsEditable; QPtrList myPortsList; SUPERVGUI_PortField* myActiveField; - SALOME_Selection* mySelection; }; /** @@ -108,7 +105,6 @@ private: SUPERVGUI_CanvasPort* myPortCanvas; - SALOME_Selection* mySelection; }; diff --git a/src/SUPERVGUI/SUPERVGUI_Canvas.cxx b/src/SUPERVGUI/SUPERVGUI_Canvas.cxx index 58d6e2a..dd99c80 100644 --- a/src/SUPERVGUI/SUPERVGUI_Canvas.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Canvas.cxx @@ -12,7 +12,9 @@ using namespace std; #include "SUPERVGUI_CanvasNode.h" #include "SUPERVGUI_CanvasPort.h" #include "SUPERVGUI_CanvasLink.h" -#include "QAD_Config.h" + +#include "SUIT_ResourceMgr.h" +#include "SUIT_Session.h" //#define CHECKTIME @@ -88,11 +90,9 @@ SUPERVGUI_Canvas::SUPERVGUI_Canvas(SUPERVGUI_Main* m): setDoubleBuffering(true); QColor aColor(MAIN_COLOR); - QString aRed = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorRed"); - QString aGreen = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorGreen"); - QString aBlue = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorBlue"); - if( (!aRed.isEmpty()) && (!aGreen.isEmpty()) && (!aBlue.isEmpty()) ) - aColor = QColor(aRed.toInt(), aGreen.toInt(), aBlue.toInt()); + //aColor = QColor(SUIT_Session::session()->resourceMgr()->integerValue( "SUPERVGraph", "BackgroundColorRed" ), + // SUIT_Session::session()->resourceMgr()->integerValue( "SUPERVGraph", "BackgroundColorGreen" ), + // SUIT_Session::session()->resourceMgr()->integerValue( "SUPERVGraph", "BackgroundColorBlue" ) ); setBackgroundColor(aColor); } diff --git a/src/SUPERVGUI/SUPERVGUI_Canvas.h b/src/SUPERVGUI/SUPERVGUI_Canvas.h index 10e82ed..16fe993 100644 --- a/src/SUPERVGUI/SUPERVGUI_Canvas.h +++ b/src/SUPERVGUI/SUPERVGUI_Canvas.h @@ -35,7 +35,7 @@ class SUPERVGUI_Canvas: public QCanvas { void merge(); void sync(); - void setAsFromStudy(bool theToStudy); + //void setAsFromStudy(bool theToStudy); void addView(QCanvasView* theView); diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasArray.cxx b/src/SUPERVGUI/SUPERVGUI_CanvasArray.cxx index 7e18e79..baeafa5 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasArray.cxx +++ b/src/SUPERVGUI/SUPERVGUI_CanvasArray.cxx @@ -10,9 +10,11 @@ using namespace std; #include "SUPERVGUI_CanvasArray.h" #include "SUPERVGUI_Main.h" #include "SUPERVGUI_BrowseNodeDlg.h" -#include "QAD_Config.h" #include "SUPERVGUI_CanvasCellNodePrs.h" +#include "SUIT_ResourceMgr.h" +#include "SUIT_Session.h" + #include #define TEXT_MARGIN 5 @@ -82,11 +84,9 @@ SUPERVGUI_CanvasArray::SUPERVGUI_CanvasArray(SUPERVGUI_Main* m): setDoubleBuffering(true); QColor aColor(MAIN_COLOR); - QString aRed = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorRed"); - QString aGreen = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorGreen"); - QString aBlue = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorBlue"); - if( (!aRed.isEmpty()) && (!aGreen.isEmpty()) && (!aBlue.isEmpty()) ) - aColor = QColor(aRed.toInt(), aGreen.toInt(), aBlue.toInt()); + //aColor = QColor(SUIT_Session::session()->resourceMgr()->integerValue( "SUPERVGraph", "BackgroundColorRed" ), + // SUIT_Session::session()->resourceMgr()->integerValue( "SUPERVGraph", "BackgroundColorGreen" ), + // SUIT_Session::session()->resourceMgr()->integerValue( "SUPERVGraph", "BackgroundColorBlue" ) ); setBackgroundColor(aColor); } diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasControlNode.cxx b/src/SUPERVGUI/SUPERVGUI_CanvasControlNode.cxx index 7f8bb38..0049dad 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasControlNode.cxx +++ b/src/SUPERVGUI/SUPERVGUI_CanvasControlNode.cxx @@ -15,9 +15,10 @@ using namespace std; #include "SUPERVGUI.h" #include "SUPERVGUI_Canvas.h" -#include "QAD_FileDlg.h" -#include "QAD_Application.h" +#include "SUIT_FileDlg.h" +#include "SUIT_Session.h" +#include #include //===================================================================== @@ -274,22 +275,22 @@ void SUPERVGUI_CanvasMacroNode::exportDataflow() aGraph = aMacro->FlowObjRef(); } if (SUPERV_isNull(aGraph)) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_EXPORT")); + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_EXPORT")); return; } else { - QString aFileName = QAD_FileDlg::getFileName(QAD_Application::getDesktop(), - "", - "*.xml", - tr("TTL_EXPORT_DATAFLOW"), - false); + QString aFileName = SUIT_FileDlg::getFileName(SUIT_Session::session()->activeApplication()->desktop(), + "", + "*.xml", + tr("TTL_EXPORT_DATAFLOW"), + false); if ( !aFileName.isEmpty() ) { // asv : bug [VSR Bugs and Improvements in Supervisor] 1.8 : when exporting a file, // a backup copy of an existing file must be created (in case Export fails..) QString aBackupFile = SUPERVGUI::createBackupFile( aFileName ); if (!aGraph->Export(aFileName.latin1())) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_BAD_WRITING").arg(aBackupFile)); + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_BAD_WRITING").arg(aBackupFile)); } // remove a backup file if export was successfull else if ( !aBackupFile.isNull() && !aBackupFile.isEmpty() ) { diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasNode.cxx b/src/SUPERVGUI/SUPERVGUI_CanvasNode.cxx index 0104b9e..3eaa873 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasNode.cxx +++ b/src/SUPERVGUI/SUPERVGUI_CanvasNode.cxx @@ -18,9 +18,10 @@ using namespace std; #include "SUPERVGUI_Information.h" #include "SUPERVGUI_Library.h" -#include "SALOMEGUI_NameDlg.h" -#include "QAD_MessageBox.h" -#include "QAD_Message.h" +#include "SalomeApp_NameDlg.h" +#include "SUIT_MessageBox.h" +#include "LogWindow.h" +#include "SUIT_Session.h" SUPERVGUI_CanvasNode::SUPERVGUI_CanvasNode(QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode, bool theIsCell): @@ -341,13 +342,13 @@ bool SUPERVGUI_CanvasNode::setNodeName(QString aName) { // TODO: update name of all the links to this node } else { - QMessageBox::warning( QAD_Application::getDesktop(), tr( "ERROR" ), tr( "MSG_CANT_RENAMENODE" ) ); + QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr( "ERROR" ), tr( "MSG_CANT_RENAMENODE" ) ); } return result; } void SUPERVGUI_CanvasNode::rename() { - QString aName = SALOMEGUI_NameDlg::getName(QAD_Application::getDesktop(), myNode->Name()); + QString aName = SalomeApp_NameDlg::getName( SUIT_Session::session()->activeApplication()->desktop(), myNode->Name() ); if (!aName.isEmpty()) { setNodeName(aName); } @@ -397,7 +398,7 @@ void SUPERVGUI_CanvasNode::suspendResume() { int n = queryList("SUPERVGUI_CanvasNode")->count(); if (myNode->IsSuspended()) { if (!((n==1)? myMain->getDataflow()->Resume() : myNode->Resume())) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_RESUMENODE")); + QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_RESUMENODE") ); } else { sync(); @@ -405,10 +406,10 @@ void SUPERVGUI_CanvasNode::suspendResume() { } } else { if (!((n==1)? myMain->getDataflow()->Suspend() : myNode->Suspend())) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_SUSPENDNODE")); + QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_SUSPENDNODE") ); } else { syncOnEvent(SUPERV::SuspendReadyState); - myMain->getMessage()->setMessage(tr("MSG_NODE_SUSPENDED1")+myNode->Name()+tr("MSG_NODE_SUSPENDED2")); + myMain->getMessage()->putMessage(tr("MSG_NODE_SUSPENDED1")+myNode->Name()+tr("MSG_NODE_SUSPENDED2")); } } } @@ -417,10 +418,10 @@ void SUPERVGUI_CanvasNode::kill() { Trace("SUPERVGUI_CanvasNode::kill"); int n = queryList("SUPERVGUI_CanvasNode")->count(); if (!((n==1)? myMain->getDataflow()->Kill() : myNode->Kill())) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_KILLNODE")); + QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_KILLNODE") ); } else { syncOnEvent(SUPERV_Kill); - myMain->getMessage()->setMessage(tr("MSG_NODE_KILLED1")+myNode->Name()+tr("MSG_NODE_KILLED2")); + myMain->getMessage()->putMessage(tr("MSG_NODE_KILLED1")+myNode->Name()+tr("MSG_NODE_KILLED2")); } } /* asv : 15.12.04 : commented out stopRestart() in Main and CanvasNode because it's not called from anywhere, @@ -431,11 +432,11 @@ void SUPERVGUI_CanvasNode::stopRestart() { int n = queryList("SUPERVGUI_CanvasNode")->count(); if ((myNode->State() == SUPERV_Stop) || (myNode->State() == SUPERV_Kill)) { if (!((n==1)? myMain->getDataflow()->Run() : myNode->ReStart())) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_RESTARTNODE")); + QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_RESTARTNODE") ); } } else { if (!((n==1)? myMain->getDataflow()->Stop() : myNode->Stop())) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_STOPNODE")); + QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_STOPNODE") ); } } } @@ -454,7 +455,7 @@ void SUPERVGUI_CanvasNode::changeInformation() { void SUPERVGUI_CanvasNode::configure() { Trace("SUPERVGUI_CanvasNode::configure"); - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_NOT_IMPLEMENTED")); // kloss : a faire : lancer l'ihm DATA + QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_NOT_IMPLEMENTED") ); // kloss : a faire : lancer l'ihm DATA } void SUPERVGUI_CanvasNode::showPython() @@ -662,5 +663,5 @@ void SUPERVGUI_CanvasNode::exportToLib() { if ( !CORBA::is_nil( anINode ) ) SUPERVGUI_Library::getLibrary()->Export( anINode ); else - QAD_MessageBox::error1( QAD_Application::getDesktop(), tr( "ERROR" ), tr( "MSG_BAD_INODE" ), tr( "OK" ) ); + SUIT_MessageBox::error1( SUIT_Session::session()->activeApplication()->desktop(), tr( "ERROR" ), tr( "MSG_BAD_INODE" ), tr( "OK" ) ); } diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasPort.cxx b/src/SUPERVGUI/SUPERVGUI_CanvasPort.cxx index 1a5c30b..72196a4 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasPort.cxx +++ b/src/SUPERVGUI/SUPERVGUI_CanvasPort.cxx @@ -16,6 +16,7 @@ using namespace std; #include "SUPERVGUI.h" #include "SUPERVGUI_BrowseNodeDlg.h" +#include "SalomeApp_Study.h" SUPERVGUI_CanvasPort::SUPERVGUI_CanvasPort(QObject* theParent, SUPERVGUI_Main* theMain, SUPERV::Port_ptr thePort): QObject(theParent), @@ -176,7 +177,7 @@ void SUPERVGUI_CanvasPort::browse() { QString aMes(getEngine()->IsInput()? tr("MSG_IPORT_VAL") : tr("MSG_OPORT_VAL")); aMes += getEngine()->ToString(); - QMessageBox::information(QAD_Application::getDesktop(), tr("MSG_INFO"), aMes); + QMessageBox::information(SUIT_Session::session()->activeApplication()->desktop(), tr("MSG_INFO"), aMes); } void SUPERVGUI_CanvasPort::copy() @@ -213,10 +214,11 @@ QPopupMenu* SUPERVGUI_CanvasPortIn::getPopupMenu(QWidget* theParent) void SUPERVGUI_CanvasPortIn::setValue(const char* theValue) { - if (getEngine()->Input(Supervision.getEngine()->StringValue(theValue))) + SUPERVGUI* aSupMod = SUPERVGUI::Supervision(); + if (aSupMod && getEngine()->Input(aSupMod->getEngine()->StringValue(theValue))) update(); // sync(); else - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_SETVAL")); + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_SETVAL")); } void SUPERVGUI_CanvasPortIn::setInput() @@ -292,8 +294,8 @@ void SUPERVGUI_CanvasPortOut::toStudy() Trace("SUPERVGUI_CanvasPortOut::toStudy"); // asv 08.02.05 : added && !myInStudy - fix for PAL8105 - if ( getMain()->getStudy()->getStudyDocument()->GetProperties()->IsLocked() && !myInStudy ) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("WRN_WARNING"), + if ( (( SalomeApp_Study* )(getMain()->getStudy()))->studyDS()->GetProperties()->IsLocked() && !myInStudy ) { + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("WRN_WARNING"), tr("WRN_STUDY_LOCKED")); return; } diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasView.cxx b/src/SUPERVGUI/SUPERVGUI_CanvasView.cxx index ad96187..75fe69c 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasView.cxx +++ b/src/SUPERVGUI/SUPERVGUI_CanvasView.cxx @@ -18,8 +18,7 @@ using namespace std; #include "SUPERVGUI_CanvasNodePrs.h" #include "SUPERVGUI_Clipboard.h" -#include "QAD_Config.h" -#include "QAD_MessageBox.h" +#include "SUIT_MessageBox.h" #include #include @@ -652,8 +651,8 @@ void SUPERVGUI_CanvasView::endSketch(SUPERVGUI_CanvasPort* thePort) // asv : 13.12.04 : introducing a check for ports' types compatibility (Bugs and Improvements p.1.16, PAL7380) if ( !aLinkEngine->IsValid() ) { - const int id = QAD_MessageBox::warn2( this, tr( "TLT_INVALID_LINK" ), tr( "MSG_INVALID_LINK" ), - tr( "Keep" ), tr( "Remove" ), 0, 1, 0 ); + const int id = SUIT_MessageBox::warn2( this, tr( "TLT_INVALID_LINK" ), tr( "MSG_INVALID_LINK" ), + tr( "Keep" ), tr( "Remove" ), 0, 1, 0 ); if ( id == 1 ) { // "Remove" was selected in Message Box aLink->remove(); // the new link did not live long... } diff --git a/src/SUPERVGUI/SUPERVGUI_Clipboard.cxx b/src/SUPERVGUI/SUPERVGUI_Clipboard.cxx index a26faf8..fab39c4 100644 --- a/src/SUPERVGUI/SUPERVGUI_Clipboard.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Clipboard.cxx @@ -136,7 +136,14 @@ QStringList getAllFunctions( SUPERV::Graph_var dataflow ) { void SUPERVGUI_Clipboard::pasteNode() { Trace("SUPERVGUI_Main::pasteNode"); SUPERV::CNode_var aNode = getCopyNode(); - SUPERVGUI_Main* aMain = Supervision.getMain(); + + SUPERVGUI* aSupMod = SUPERVGUI::Supervision(); + if ( !aSupMod ) { + MESSAGE("NULL Supervision module!"); + return; + } + + SUPERVGUI_Main* aMain = aSupMod->getMain(); if ( !CORBA::is_nil( aNode ) && aMain ) { if ( !aMain->ReadyToModify() ) // null dataflow or executing, .. @@ -154,12 +161,12 @@ void SUPERVGUI_Clipboard::pasteNode() { SUPERV::FNode::_narrow(aNode)->GetInterfaceName(), *SUPERV::FNode::_narrow(aNode)->Service() ); if (CORBA::is_nil(aFNode)) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_CREATE_NODE")); + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_CREATE_NODE")); return; } SUPERV::INode_var aDummyEndNode; - Supervision.getBrowser()->addNode(SUPERV::CNode::_narrow(aFNode), aDummyEndNode, myXCopyNode, myYCopyNode); + aSupMod->getBrowser()->addNode(SUPERV::CNode::_narrow(aFNode), aDummyEndNode, myXCopyNode, myYCopyNode); } break; @@ -167,12 +174,12 @@ void SUPERVGUI_Clipboard::pasteNode() { { SUPERV::CNode_var aCNode = dataflow->CNode(*SUPERV::CNode::_narrow(aNode)->Service()); if (CORBA::is_nil(aCNode)) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_CREATE_NODE")); + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_CREATE_NODE")); return; } SUPERV::INode_var aDummyEndNode; - Supervision.getBrowser()->addNode(aCNode, aDummyEndNode, myXCopyNode, myYCopyNode); + aSupMod->getBrowser()->addNode(aCNode, aDummyEndNode, myXCopyNode, myYCopyNode); } break; @@ -200,13 +207,13 @@ void SUPERVGUI_Clipboard::pasteNode() { SUPERV::INode_var aINode = dataflow->INode( aFName, aFunc ); if (CORBA::is_nil(aINode)) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_CREATE_NODE")); + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_CREATE_NODE")); return; } copyPorts( aNode, aINode ); SUPERV::INode_var aDummyEndNode; - Supervision.getBrowser()->addNode(SUPERV::CNode::_narrow(aINode), aDummyEndNode, myXCopyNode, myYCopyNode); + aSupMod->getBrowser()->addNode(SUPERV::CNode::_narrow(aINode), aDummyEndNode, myXCopyNode, myYCopyNode); } break; @@ -256,12 +263,12 @@ void SUPERVGUI_Clipboard::pasteNode() { SUPERV::INode_var aEndNode; SUPERV::LNode_var aStartNode = dataflow->LNode(aInitFName, aInitFunc, aMoreFName, aMoreFunc, aNextFName, aNextFunc, aEndNode); if (CORBA::is_nil(aStartNode) || CORBA::is_nil(aEndNode)) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_CREATE_NODE")); + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_CREATE_NODE")); return; } copyPorts( aNode, SUPERV::INode::_narrow( aStartNode ) ); - Supervision.getBrowser()->addNode(SUPERV::CNode::_narrow(aStartNode), aEndNode, myXCopyNode, myYCopyNode); + aSupMod->getBrowser()->addNode(SUPERV::CNode::_narrow(aStartNode), aEndNode, myXCopyNode, myYCopyNode); } break; @@ -289,14 +296,14 @@ void SUPERVGUI_Clipboard::pasteNode() { SUPERV::INode_var aEndNode; SUPERV::SNode_var aStartNode = dataflow->SNode(aFName, aFunc, aEndNode); if (CORBA::is_nil(aStartNode) || CORBA::is_nil(aEndNode)) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_CREATE_NODE")); + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_CREATE_NODE")); return; } copyPorts( aNode, SUPERV::INode::_narrow( aStartNode ) ); SUPERV::INode_var aNodeEnd = SUPERV::SNode::_narrow(aNode)->Coupled(); copyPorts( SUPERV::CNode::_narrow( aNodeEnd ), aEndNode ); - Supervision.getBrowser()->addNode(SUPERV::CNode::_narrow(aStartNode), aEndNode, myXCopyNode, myYCopyNode); + aSupMod->getBrowser()->addNode(SUPERV::CNode::_narrow(aStartNode), aEndNode, myXCopyNode, myYCopyNode); } break; @@ -323,13 +330,13 @@ void SUPERVGUI_Clipboard::pasteNode() { // create the Engine's node SUPERV::GNode_var aGNode = dataflow->GNode(aFName, aFunc, ""); if (CORBA::is_nil(aGNode)) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_CREATE_NODE")); + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_CREATE_NODE")); return; } copyPorts( aNode, SUPERV::INode::_narrow( aGNode ) ); SUPERV::INode_var aDummyEndNode; - Supervision.getBrowser()->addNode(SUPERV::CNode::_narrow(aGNode), aDummyEndNode, myXCopyNode, myYCopyNode); + aSupMod->getBrowser()->addNode(SUPERV::CNode::_narrow(aGNode), aDummyEndNode, myXCopyNode, myYCopyNode); } break; @@ -347,12 +354,12 @@ void SUPERVGUI_Clipboard::pasteNode() { SUPERV::Graph_var aMacroNode = dataflow->GraphMNode(aGraph); if (CORBA::is_nil(aMacroNode)) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_CREATE_NODE")); + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_CREATE_NODE")); return; } SUPERV::INode_var aDummyEndNode; - Supervision.getBrowser()->addNode(SUPERV::CNode::_narrow(aMacroNode), aDummyEndNode, myXCopyNode, myYCopyNode); + aSupMod->getBrowser()->addNode(SUPERV::CNode::_narrow(aMacroNode), aDummyEndNode, myXCopyNode, myYCopyNode); */ } break; @@ -367,7 +374,14 @@ void SUPERVGUI_Clipboard::pasteNode() { void SUPERVGUI_Clipboard::pastePort( SUPERVGUI_CanvasNode* node ) { SUPERV::Port_var aPort = getCopyPort(); - SUPERVGUI_Main* aMain = Supervision.getMain(); + + SUPERVGUI* aSupMod = SUPERVGUI::Supervision(); + if ( !aSupMod ) { + MESSAGE("NULL Supervision module!"); + return; + } + + SUPERVGUI_Main* aMain = aSupMod->getMain(); if ( !CORBA::is_nil(aPort) && aMain ) { SUPERV::INode_var aNode = node->getInlineNode(); @@ -379,7 +393,7 @@ void SUPERVGUI_Clipboard::pastePort( SUPERVGUI_CanvasNode* node ) //check if port with such name is alredy exists QStringList aNames = node->getPortsNamesIN(aNode, true); if (aNames.contains(aName)) - QMessageBox::warning( QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_PORT_EXIST") ); + QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_PORT_EXIST") ); else { aMain->Editing(); // PAL6170: GUI->Engine: setting "Editing" flag, why here? -> PAL7960 aPastePort = aNode->InPort(aName.latin1(), aType.latin1()); @@ -389,7 +403,7 @@ void SUPERVGUI_Clipboard::pastePort( SUPERVGUI_CanvasNode* node ) //check if port with such name is already exists QStringList aNames = node->getPortsNamesIN(aNode, false); if (aNames.contains(aName)) - QMessageBox::warning( QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_PORT_EXIST") ); + QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_PORT_EXIST") ); else { aMain->Editing(); // PAL6170: GUI->Engine: setting "Editing" flag, why here? -> PAL7960 aPastePort = aNode->OutPort(aName.latin1(), aType.latin1()); diff --git a/src/SUPERVGUI/SUPERVGUI_Clipboard.h b/src/SUPERVGUI/SUPERVGUI_Clipboard.h index 4ac5d8c..26dce84 100644 --- a/src/SUPERVGUI/SUPERVGUI_Clipboard.h +++ b/src/SUPERVGUI/SUPERVGUI_Clipboard.h @@ -32,8 +32,8 @@ #include "utilities.h" #include "SALOME_LifeCycleCORBA.hxx" -#include "QAD_Application.h" -#include "QAD_Desktop.h" +#include "SUIT_Session.h" +#include "SUIT_Desktop.h" #include CORBA_CLIENT_HEADER(SUPERV) class SUPERVGUI_CanvasNode; @@ -51,7 +51,7 @@ public: static SUPERVGUI_Clipboard* getClipboard() { if ( !myCB ) - myCB = new SUPERVGUI_Clipboard( QAD_Application::getDesktop() ); + myCB = new SUPERVGUI_Clipboard( SUIT_Session::session()->activeApplication()->desktop() ); return myCB; } diff --git a/src/SUPERVGUI/SUPERVGUI_DataModel.cxx b/src/SUPERVGUI/SUPERVGUI_DataModel.cxx new file mode 100644 index 0000000..f6c6a98 --- /dev/null +++ b/src/SUPERVGUI/SUPERVGUI_DataModel.cxx @@ -0,0 +1,72 @@ +#include "SUPERVGUI_DataModel.h" + +//======================================================================= +// name : SUPERVGUI_DataModel::SUPERVGUI_DataModel +// Purpose : Constructor +//======================================================================= +SUPERVGUI_DataModel::SUPERVGUI_DataModel( CAM_Module* theModule ) +: SalomeApp_DataModel( theModule ) +{ +} + +//======================================================================= +// name : SUPERVGUI_DataModel::~SUPERVGUI_DataModel +// Purpose : Destructor +//======================================================================= +SUPERVGUI_DataModel::~SUPERVGUI_DataModel() +{ +} + +//================================================================ +// Function : open +// Purpose : +//================================================================ +bool SUPERVGUI_DataModel::open( const QString& str, CAM_Study* study ) +{ + return SalomeApp_DataModel::open( str, study ); +} + +//================================================================ +// Function : save +// Purpose : +//================================================================ +bool SUPERVGUI_DataModel::save() +{ + return SalomeApp_DataModel::save(); +} + +//================================================================ +// Function : saveAs +// Purpose : +//================================================================ +bool SUPERVGUI_DataModel::saveAs( const QString& str, CAM_Study* study ) +{ + return SalomeApp_DataModel::saveAs( str, study ); +} + +//================================================================ +// Function : close +// Purpose : +//================================================================ +bool SUPERVGUI_DataModel::close() +{ + return SalomeApp_DataModel::close(); +} + +//================================================================ +// Function : close +// Purpose : +//================================================================ +bool SUPERVGUI_DataModel::isModified() const +{ + return false; +} + +//================================================================ +// Function : isSaved +// Purpose : +//================================================================ +bool SUPERVGUI_DataModel::isSaved() const +{ + return false; +} diff --git a/src/SUPERVGUI/SUPERVGUI_DataModel.h b/src/SUPERVGUI/SUPERVGUI_DataModel.h new file mode 100644 index 0000000..b21a692 --- /dev/null +++ b/src/SUPERVGUI/SUPERVGUI_DataModel.h @@ -0,0 +1,31 @@ +#ifndef SUPERVGUI_DATAMODEL_H +#define SUPERVGUI_DATAMODEL_H + +#include + +/* + Class : SUPERVGUI_DataModel + Description : Base class of data model +*/ + +class SUPERVGUI_DataModel : public SalomeApp_DataModel +{ +public: + SUPERVGUI_DataModel ( CAM_Module* theModule ); + virtual ~SUPERVGUI_DataModel(); + + virtual bool open( const QString&, CAM_Study* ); + virtual bool save(); + virtual bool saveAs( const QString&, CAM_Study* ); + virtual bool close(); + + virtual bool isModified() const ; + virtual bool isSaved() const ; + +signals: + void opened(); + void saved(); + void closed(); +}; + +#endif diff --git a/src/SUPERVGUI/SUPERVGUI_Information.cxx b/src/SUPERVGUI/SUPERVGUI_Information.cxx index fe1c270..0b6d820 100644 --- a/src/SUPERVGUI/SUPERVGUI_Information.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Information.cxx @@ -27,9 +27,11 @@ using namespace std; #include "SUPERVGUI_Information.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_MessageBox.h" + +#include "CAM_Application.h" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" + #include #include #include @@ -40,7 +42,7 @@ using namespace std; Constructor */ SUPERVGUI_Information::SUPERVGUI_Information(SUPERV_CNode node, bool isReadOnly) - : QDialog( QAD_Application::getDesktop(), "", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) + : QDialog( SUIT_Session::session()->activeApplication()->desktop(), "", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) { Trace("SUPERVGUI_Information::SUPERVGUI_Information"); setCaption( tr( "TLT_INFORMATIONS" ) ); @@ -88,8 +90,8 @@ SUPERVGUI_Information::SUPERVGUI_Information(SUPERV_CNode node, bool isReadOnly) compnameV->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); compnameV->setMinimumSize( 200, 0 ); compnameV->setReadOnly( true/*isReadOnly*/ ); - compnameV->setText( QAD_Application::getDesktop()->getComponentUserName( - SUPERV::FNode::_narrow(node)->GetComponentName()) ); + compnameV->setText( dynamic_cast( SUIT_Session::session()->activeApplication() )-> + moduleTitle(SUPERV::FNode::_narrow(node)->GetComponentName()) ); intnameL = new QLabel( tr( "INTERFACE_NAME_LBL" ), TopGroup ); intnameV = new QLineEdit( TopGroup ); diff --git a/src/SUPERVGUI/SUPERVGUI_Library.cxx b/src/SUPERVGUI/SUPERVGUI_Library.cxx index d9473ed..4af1b37 100644 --- a/src/SUPERVGUI/SUPERVGUI_Library.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Library.cxx @@ -30,8 +30,9 @@ #include "SUPERVGUI_Main.h" #include "SUPERVGUI.h" -#include "QAD_MessageBox.h" -#include "QAD_Application.h" +#include "SUIT_Application.h" +#include "SUIT_MessageBox.h" +#include "SUIT_Session.h" #include #include @@ -100,12 +101,12 @@ bool SUPERVGUI_Library::createLibFile() const { return true; } else { - QAD_MessageBox::error1( (QWidget*)QAD_Application::getDesktop(), tr( "ERROR" ), tr( "MSG_ERROR_LIB1" ), tr( "OK" ) ); + SUIT_MessageBox::error1( (QWidget*)(SUIT_Session::session()->activeApplication()->desktop()), tr( "ERROR" ), tr( "MSG_ERROR_LIB1" ), tr( "OK" ) ); return false; // error opening library file for writing } } catch ( ... ) { - QAD_MessageBox::error1( (QWidget*)QAD_Application::getDesktop(), tr( "ERROR" ), tr( "MSG_ERROR_LIB_IO" ), tr( "OK" ) ); + SUIT_MessageBox::error1( (QWidget*)(SUIT_Session::session()->activeApplication()->desktop()), tr( "ERROR" ), tr( "MSG_ERROR_LIB_IO" ), tr( "OK" ) ); } return false; } @@ -135,7 +136,7 @@ void saveStrings( QDomDocument doc, QDomElement element, const char* theNameAtt, bool SUPERVGUI_Library::Export( SUPERV::INode_var theNode ) const { try { if ( CORBA::is_nil( theNode ) ) { - QAD_MessageBox::error1( (QWidget*)QAD_Application::getDesktop(), tr( "ERROR" ), tr( "MSG_ERROR_LIB_NIL_NODE" ), tr( "OK" ) ); + SUIT_MessageBox::error1( (QWidget*)(SUIT_Session::session()->activeApplication()->desktop()), tr( "ERROR" ), tr( "MSG_ERROR_LIB_NIL_NODE" ), tr( "OK" ) ); return false; // null node } @@ -158,8 +159,8 @@ bool SUPERVGUI_Library::Export( SUPERV::INode_var theNode ) const { xmlOk = ( !rootElement.isNull() ); } if ( !xmlOk ) { - const int toRecreate = QAD_MessageBox::error2( (QWidget*)QAD_Application::getDesktop(), tr( "ERROR" ), - tr( "MSG_ERROR_LIB_IS_RECREATE" ), tr( "BUT_YES" ), tr( "BUT_NO" ), 1, 0, 0 ); + const int toRecreate = SUIT_MessageBox::error2( (QWidget*)(SUIT_Session::session()->activeApplication()->desktop()), tr( "ERROR" ), + tr( "MSG_ERROR_LIB_IS_RECREATE" ), tr( "BUT_YES" ), tr( "BUT_NO" ), 1, 0, 0 ); if ( toRecreate ) { // user selected to recreate a bad XML file libFile.close(); // in case it was opened by doc.setContent() if ( !createLibFile() ) @@ -179,7 +180,7 @@ bool SUPERVGUI_Library::Export( SUPERV::INode_var theNode ) const { SUPERV::GNode_var aTmpNode = SUPERV::GNode::_narrow( theNode ); theNode = aTmpNode->Coupled(); if ( CORBA::is_nil( theNode ) ) { - QAD_MessageBox::error1( (QWidget*)QAD_Application::getDesktop(), tr( "ERROR" ), tr( "MSG_ERROR_LIB_NIL_COUPLED" ), tr( "OK" ) ); + SUIT_MessageBox::error1( (QWidget*)(SUIT_Session::session()->activeApplication()->desktop()), tr( "ERROR" ), tr( "MSG_ERROR_LIB_NIL_COUPLED" ), tr( "OK" ) ); return false; // null coupled node } } @@ -210,12 +211,12 @@ bool SUPERVGUI_Library::Export( SUPERV::INode_var theNode ) const { if ( theNode->IsLoop() ) { SUPERV::LNode_var aLoopNode = SUPERV::LNode::_narrow( theNode ); if ( CORBA::is_nil( aLoopNode ) ) { - QAD_MessageBox::error1( (QWidget*)QAD_Application::getDesktop(), tr( "ERROR" ), tr( "MSG_ERROR_LIB_BAD_LOOP" ), tr( "OK" ) ); + SUIT_MessageBox::error1( (QWidget*)(SUIT_Session::session()->activeApplication()->desktop()), tr( "ERROR" ), tr( "MSG_ERROR_LIB_BAD_LOOP" ), tr( "OK" ) ); return false; } SUPERV::INode_var aEndLoopNode = aLoopNode->Coupled(); if ( CORBA::is_nil( aEndLoopNode ) ) { - QAD_MessageBox::error1( (QWidget*)QAD_Application::getDesktop(), tr( "ERROR" ), tr( "MSG_ERROR_LIB_BAD_LOOP" ), tr( "OK" ) ); + SUIT_MessageBox::error1( (QWidget*)(SUIT_Session::session()->activeApplication()->desktop()), tr( "ERROR" ), tr( "MSG_ERROR_LIB_BAD_LOOP" ), tr( "OK" ) ); return false; } // save init, more, next, end-loop functions of the Loop node @@ -229,12 +230,12 @@ bool SUPERVGUI_Library::Export( SUPERV::INode_var theNode ) const { if ( theNode->IsSwitch() ) { SUPERV::SNode_var aSwitchNode = SUPERV::SNode::_narrow( theNode ); if ( CORBA::is_nil( aSwitchNode ) ) { - QAD_MessageBox::error1( (QWidget*)QAD_Application::getDesktop(), tr( "ERROR" ), tr( "MSG_ERROR_LIB_BAD_SWITCH" ), tr( "OK" ) ); + SUIT_MessageBox::error1( (QWidget*)(SUIT_Session::session()->activeApplication()->desktop()), tr( "ERROR" ), tr( "MSG_ERROR_LIB_BAD_SWITCH" ), tr( "OK" ) ); return false; } SUPERV::INode_var aEndSwitchNode = aSwitchNode->Coupled(); if ( CORBA::is_nil( aEndSwitchNode ) ) { - QAD_MessageBox::error1( (QWidget*)QAD_Application::getDesktop(), tr( "ERROR" ), tr( "MSG_ERROR_LIB_BAD_SWITCH" ), tr( "OK" ) ); + SUIT_MessageBox::error1( (QWidget*)(SUIT_Session::session()->activeApplication()->desktop()), tr( "ERROR" ), tr( "MSG_ERROR_LIB_BAD_SWITCH" ), tr( "OK" ) ); return false; } // save EndSwitch function @@ -263,7 +264,7 @@ bool SUPERVGUI_Library::Export( SUPERV::INode_var theNode ) const { return true; } else { // error opening library file for final writing - QAD_MessageBox::error1( (QWidget*)QAD_Application::getDesktop(), tr( "ERROR" ), tr( "MSG_ERROR_LIB_WRITE" ), tr( "OK" ) ); + SUIT_MessageBox::error1( (QWidget*)(SUIT_Session::session()->activeApplication()->desktop()), tr( "ERROR" ), tr( "MSG_ERROR_LIB_WRITE" ), tr( "OK" ) ); return false; } } // try @@ -271,7 +272,7 @@ bool SUPERVGUI_Library::Export( SUPERV::INode_var theNode ) const { } // should get here only in case of exception - QAD_MessageBox::error1( (QWidget*)QAD_Application::getDesktop(), tr( "ERROR" ), tr( "MSG_ERROR_EXPORT_EXCEPTION" ), tr( "OK" ) ); + SUIT_MessageBox::error1( (QWidget*)(SUIT_Session::session()->activeApplication()->desktop()), tr( "ERROR" ), tr( "MSG_ERROR_EXPORT_EXCEPTION" ), tr( "OK" ) ); return false; } @@ -419,12 +420,12 @@ bool SUPERVGUI_Library::Import( SUPERV::Graph_var theDataflow, SUPERV::INode_va return true; } default: // wrong kind of node error - QAD_MessageBox::error1( (QWidget*)QAD_Application::getDesktop(), tr( "ERROR" ), tr( "MSG_ERROR_IMPORT_BAD_KIND_OF_NODE" ), tr( "OK" ) ); + SUIT_MessageBox::error1( (QWidget*)(SUIT_Session::session()->activeApplication()->desktop()), tr( "ERROR" ), tr( "MSG_ERROR_IMPORT_BAD_KIND_OF_NODE" ), tr( "OK" ) ); return false; } // switch ( kind_of_node ) } // if ( index >= 0...) else { - QAD_MessageBox::error1( (QWidget*)QAD_Application::getDesktop(), tr( "ERROR" ), tr( "MSG_ERROR_IMPORT_BAD_INDEX" ), tr( "OK" ) ); + SUIT_MessageBox::error1( (QWidget*)(SUIT_Session::session()->activeApplication()->desktop()), tr( "ERROR" ), tr( "MSG_ERROR_IMPORT_BAD_INDEX" ), tr( "OK" ) ); } } // if ( getNodes() ) else { @@ -436,7 +437,7 @@ bool SUPERVGUI_Library::Import( SUPERV::Graph_var theDataflow, SUPERV::INode_va // Normally we get here ONLY if an exception occured. All other paths of execution must return before. // But - who knows, maybe we can get here by some other means.. anyway, it's an error and we report it here - QAD_MessageBox::error1( (QWidget*)QAD_Application::getDesktop(), tr( "ERROR" ), tr( "MSG_ERROR_IMPORT_EXCEPTION" ), tr( "OK" ) ); + SUIT_MessageBox::error1( (QWidget*)(SUIT_Session::session()->activeApplication()->desktop()), tr( "ERROR" ), tr( "MSG_ERROR_IMPORT_EXCEPTION" ), tr( "OK" ) ); return false; } @@ -446,7 +447,7 @@ bool SUPERVGUI_Library::Import( SUPERV::Graph_var theDataflow, SUPERV::INode_va bool SUPERVGUI_Library::getNodes( QDomDocument& doc, QDomNodeList& theNodes ) const { QFile libFile( GetLibraryFileName() ); // open existing library file if ( !libFile.exists() ) { - QAD_MessageBox::error1( (QWidget*)QAD_Application::getDesktop(), tr( "ERROR" ), tr( "MSG_ERROR_IMPORT_LIB_NO_XML" ), tr( "OK" ) ); + SUIT_MessageBox::error1( (QWidget*)(SUIT_Session::session()->activeApplication()->desktop()), tr( "ERROR" ), tr( "MSG_ERROR_IMPORT_LIB_NO_XML" ), tr( "OK" ) ); return false; } @@ -458,7 +459,7 @@ bool SUPERVGUI_Library::getNodes( QDomDocument& doc, QDomNodeList& theNodes ) co if ( xmlOk ) xmlOk = ( doc.doctype().name() == DOCTYPE && doc.elementsByTagName( ROOT_ELEMENT ).length() == 1 ); if ( !xmlOk ) { - QAD_MessageBox::error1( (QWidget*)QAD_Application::getDesktop(), tr( "ERROR" ), tr( "MSG_ERROR_IMPORT_LIB_BAD_XML" ), tr( "OK" ) ); + SUIT_MessageBox::error1( (QWidget*)(SUIT_Session::session()->activeApplication()->desktop()), tr( "ERROR" ), tr( "MSG_ERROR_IMPORT_LIB_BAD_XML" ), tr( "OK" ) ); return false; } @@ -618,11 +619,16 @@ SUPERVGUI_LibDlg::~SUPERVGUI_LibDlg() {} void SUPERVGUI_LibDlg::add() { const int i = myLB->currentItem(); if ( i >= 0 && i < myLB->count() ) { - SUPERV::Graph_var aDataflow = Supervision.getMain()->getDataflow(); + SUPERVGUI* aSupMod = SUPERVGUI::Supervision(); + if ( !aSupMod ) { + MESSAGE("NULL Supervision module!"); + return; + } + SUPERV::Graph_var aDataflow = aSupMod->getMain()->getDataflow(); SUPERV::INode_var aNode, aEndNode; if ( SUPERVGUI_Library::getLibrary()->Import( aDataflow, aNode, aEndNode, i ) ) { SUPERVGUI_Service::addNode( SUPERV::CNode::_narrow( aNode ), aEndNode, myX, myY ); - Supervision.getMain()->sync(); + aSupMod->getMain()->sync(); } else { // all errors must be reported to user in Import(), MB shown, etc.. } // so we don't need to report errors if Import() returned false. diff --git a/src/SUPERVGUI/SUPERVGUI_Main.cxx b/src/SUPERVGUI/SUPERVGUI_Main.cxx index d6e4701..e8c624e 100644 --- a/src/SUPERVGUI/SUPERVGUI_Main.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Main.cxx @@ -27,23 +27,29 @@ using namespace std; -#include "QAD_Splitter.h" -#include "QAD_LeftFrame.h" -#include "QAD_ObjectBrowser.h" -#include "QAD_ObjectBrowserItem.h" -#include "QAD_PyEditor.h" -#include "QAD_Message.h" -#include "QAD_FileDlg.h" -#include "QAD_Application.h" -#include "QAD_RightFrame.h" -#include "QAD_SpinBoxDbl.h" -#include "QAD_MessageBox.h" +#include "SALOMEDSClient.hxx" +#include "SALOMEDS_Study.hxx" +#include "SALOMEDS_SObject.hxx" +#include +using namespace boost; #include "NOTIFICATION.hxx" #include "SALOME_Event.hxx" -#include "SALOMEGUI_ImportOperation.h" #include "SUPERVGraph_ViewFrame.h" +#include "LogWindow.h" +#include "OB_Browser.h" +#include "OB_ListItem.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_ImportOperation.h" +#include "SalomeApp_Study.h" +#include "SUIT_FileDlg.h" +#include "SUIT_MessageBox.h" +#include "SUIT_Operation.h" +#include "SUIT_Session.h" +#include "SUIT_Study.h" +#include "QtxDblSpinBox.h" + #include "SUPERVGUI.h" #include "SUPERVGUI_Def.h" #include "SUPERVGUI_Main.h" @@ -53,30 +59,13 @@ using namespace std; #include "SUPERVGUI_CanvasPort.h" #include +#include #include #include #include #include -// PAL8065: san -- Safe access to widgets from secondary thread -typedef TVoidMemFunEvent TCanvasArrayEvent; -typedef TVoidMemFunEvent TCanvasEvent; - -class UpdateEvent : public SALOME_Event -{ - public: - UpdateEvent( QAD_Study* study, bool updSel = true ) : myStudy( study ), myUpdateSel( updSel ) {} - virtual void Execute(){ - if ( myStudy ) myStudy->updateObjBrowser( myUpdateSel ); - } - - private: - QAD_Study* myStudy; - bool myUpdateSel; -}; -// PAL8065: san - -SUPERVGUI_Main::SUPERVGUI_Main(SUPERVGraph_ViewFrame* theParent, QAD_Desktop* theDesktop, SUPERV_Graph theDataFlow ) +SUPERVGUI_Main::SUPERVGUI_Main(SUPERVGraph_ViewFrame* theParent, SUIT_Desktop* theDesktop, SUPERV_Graph theDataFlow ) : SUPERVGraph_View(theParent), myLogged( false ), myFiltered( false ), @@ -99,9 +88,12 @@ SUPERVGUI_Main::SUPERVGUI_Main(SUPERVGraph_ViewFrame* theParent, QAD_Desktop* th } } -void SUPERVGUI_Main::init(QAD_Desktop* theDesktop) { +void SUPERVGUI_Main::init(SUIT_Desktop* theDesktop) { Trace("SUPERVGUI_Main::init"); - if (theDesktop) myNService = theDesktop->getNameService(); + SUIT_Application* anActApp = SUIT_Session::session()->activeApplication(); + + if (theDesktop) + myNService = dynamic_cast( anActApp )->namingService(); myHashCode = "New"; myCopyNum = 0; choosing = false; @@ -113,34 +105,41 @@ void SUPERVGUI_Main::init(QAD_Desktop* theDesktop) { myCurrentView = CANVAS; myIsFromStudy = false; myLastGraph = 0; - study = theDesktop->getActiveStudy(); - - SALOMEDS::Study_var studyDoc = study->getStudyDocument(); + study = anActApp->activeStudy(); + + //mkr: Supervision module already connected to the + //active study. So, we have to commented this code! + /*_PTR(Study) studyDoc = (( SalomeApp_Study* )study)->studyDS(); bool aLocked = studyDoc->GetProperties()->IsLocked(); - SALOMEDS::StudyBuilder_var builder = studyDoc->NewBuilder(); - SALOMEDS::SComponent_var father = studyDoc->FindComponent(STUDY_SUPERVISION); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeName_var aName; - SALOMEDS::AttributePixMap_var aPixmap; - if (father->_is_nil()) { - QAD_Operation* op = new SALOMEGUI_ImportOperation( study ); + _PTR(StudyBuilder) builder ( studyDoc->NewBuilder() ); + _PTR(SComponent) father = studyDoc->FindComponent(STUDY_SUPERVISION); + if ( !father ) { + SUIT_Operation* op = new SalomeApp_ImportOperation( study->application() ); op->start(); if (aLocked) studyDoc->GetProperties()->SetLocked(false); father = builder->NewComponent(STUDY_SUPERVISION); - anAttr = builder->FindOrCreateAttribute(father, "AttributeName"); - aName = SALOMEDS::AttributeName::_narrow(anAttr); - aName->SetValue(QAD_Application::getDesktop()->getComponentUserName( "SUPERV" ) ); + _PTR(GenericAttribute) anAttr = builder->FindOrCreateAttribute(father, "AttributeName"); + _PTR(AttributeName) aName ( anAttr ); + aName->SetValue( dynamic_cast( study->application() )->moduleTitle( "SUPERV" ).latin1() ); anAttr = builder->FindOrCreateAttribute(father, "AttributePixMap"); - aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + _PTR(AttributePixMap) aPixmap ( anAttr ); aPixmap->SetPixMap( "ICON_OBJBROWSER_Supervision" ); - builder->DefineComponentInstance(father, Supervision.getEngine()); + SUPERVGUI* aSupMod = SUPERVGUI::Supervision(); + if ( !aSupMod ) { + MESSAGE("NULL Supervision module!"); + return; + } + + builder->DefineComponentInstance(father, SalomeApp_Application::orb()->object_to_string(aSupMod->getEngine())); + //dynamic_cast( studyDoc )->ConvertObjectToIOR(aSupMod->getEngine())); if (aLocked) studyDoc->GetProperties()->SetLocked(true); - op->finish(); + op->commit(); }; + */ - objectBrowser = study->getActiveStudyFrame()->getLeftFrame()->getObjectBrowser(); + objectBrowser = dynamic_cast( study->application() )->objectBrowser(); myArray = new SUPERVGUI_CanvasArray(this); myArrayView = new SUPERVGUI_ArrayView(myArray, this); @@ -148,7 +147,7 @@ void SUPERVGUI_Main::init(QAD_Desktop* theDesktop) { myCanvas = new SUPERVGUI_Canvas(this); myCanvasView = new SUPERVGUI_CanvasView(myCanvas, this); - message = study->getActiveStudyFrame()->getRightFrame()->getMessage(); + message = dynamic_cast( study->application() )->logWindow(); notification = new NOTIFICATION_Consumer(); QBoxLayout * layout = new QVBoxLayout(this); @@ -176,14 +175,21 @@ SUPERVGUI_Main::~SUPERVGUI_Main() { Trace("SUPERVGUI_Main::~SUPERVGUI_Main"); // close all opened SubGraphs - QMap::iterator it; + QMap::iterator it; for (it = mySubGraphs.begin(); it != mySubGraphs.end(); ++it) { it.data()->removeEventFilter(this); it.data()->disconnect(); - it.data()->close(); - - QAD_Study* aStudy = it.data()->getStudy(); - aStudy->removeStudyFrame(it.data()); + //it.data()->close(); + + //QAD_Study* aStudy = it.data()->getStudy(); + //aStudy->removeStudyFrame(it.data()); + //remove view from internal view manager's list of views + //it.data()->getViewManager()->removeView(it.data()); + SUIT_ViewManager* aVM = it.data()->getViewManager(); + STD_Application* anApp = dynamic_cast( SUIT_Session::session()->activeApplication() ); + if ( anApp ) anApp->removeViewManager(aVM); + if ( aVM ) delete aVM; + } mySubGraphs.clear(); mySubGraphMap.clear(); @@ -232,7 +238,7 @@ void SUPERVGUI_Main::filterNotification() { myLogFile = fopen( myLogFileName.latin1(), "a" ); if ( myLogFile == NULL ) { myLogged = false; - QMessageBox::warning( QAD_Application::getDesktop(), tr("ERROR"), tr( "ERR_CANT_OPEN_LOG_FILE" ) ); + QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr( "ERR_CANT_OPEN_LOG_FILE" ) ); } } } @@ -292,18 +298,24 @@ void SUPERVGUI_Main::sync() { t += dataflow->Name(); setCaption(t); - - // PAL8065: san - ProcessVoidEvent( new UpdateEvent( study ) ); + + //study->updateObjBrowser(); + //mkr: we have to update object browser only if there are some ports datas in the study + //or if dataflow is in the study itself. It is done in the + //1) putDataStudy(...) method (it called when we put in study data of port + // or if port is in study and execution is finished) + //2) addDataflowToStudy() method (it is called as a slot when we add in study dataflow itself). + //So, we commented updateObjBrowser function here! + //SUPERVGUI* aSupMod = SUPERVGUI::Supervision(); + //if ( aSupMod ) aSupMod->updateObjBrowser(); + //else MESSAGE("NULL Supervision module!"); if (myCurrentView == CANVASTABLE) { - // PAL8065: san - ProcessVoidEvent( new TCanvasArrayEvent( myArray, &SUPERVGUI_CanvasArray::sync ) ); - ProcessVoidEvent( new TCanvasArrayEvent( myArray, &SUPERVGUI_CanvasArray::update ) ); + myArray->sync(); + myArray->update(); } else { - // PAL8065: san - ProcessVoidEvent( new TCanvasEvent( myCanvas, &SUPERVGUI_Canvas::sync ) ); - ProcessVoidEvent( new TCanvasEvent( myCanvas, &SUPERVGUI_Canvas::update ) ); + myCanvas->sync(); + myCanvas->update(); } } @@ -358,11 +370,11 @@ void SUPERVGUI_Main::insertFile() { if ( !ReadyToModify() ) // null dataflow or executing, .. return; - QString f = QAD_FileDlg::getFileName(QAD_Application::getDesktop(), - "", - "*.xml", - tr("MSG_GRAPH_INSERT"), - true); + QString f = SUIT_FileDlg::getFileName(SUIT_Session::session()->activeApplication()->desktop(), + "", + "*.xml", + tr("MSG_GRAPH_INSERT"), + true); if ( !f.isEmpty() ) { // not Cancel, but "OK" was pressed with valid file name Editing(); // PAL6170: GUI->Engine: setting "Editing" flag, why here? -> see 7960 @@ -377,7 +389,7 @@ void SUPERVGUI_Main::insertFile() { } sync(); } else { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_BAD_FILE").arg(f)); + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_BAD_FILE").arg(f)); } } } @@ -385,18 +397,23 @@ void SUPERVGUI_Main::insertFile() { void SUPERVGUI_Main::copy() { Trace("SUPERVGUI_Main::copy"); if (dataflow->ThreadsMax() == 0) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOTHING_COPY")); + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("WARNING"), tr("MSG_NOTHING_COPY")); + return; + } + + SUPERVGUI* aSupMod = SUPERVGUI::Supervision(); + if ( !aSupMod ) { + MESSAGE("NULL Supervision module!"); return; } - QAD_StudyFrame* aStudyFrame = Supervision.createGraph(); - SUPERVGraph_ViewFrame* aViewFrame = dynamic_cast - (aStudyFrame->getRightFrame()->getViewFrame()); - if(aViewFrame){ + + SUPERVGraph_ViewFrame* aViewFrame = dynamic_cast( aSupMod->createGraph() ); + if( aViewFrame ) { SUPERV_Graph aNewGraph; // = dataflow->StreamCopy(); - if (dataflow->IsStreamGraph()) { + if ( dataflow->IsStreamGraph() ) { SUPERV_StreamGraph aSGraph = dataflow->ToStreamGraph(); - if (SUPERV_isNull(aSGraph)) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_CANT_COPY")); + if ( SUPERV_isNull(aSGraph) ) { + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("WARNING"), tr("MSG_CANT_COPY")); return; } aNewGraph = aSGraph->StreamCopy(); @@ -408,9 +425,9 @@ void SUPERVGUI_Main::copy() { aNewName += dataflow->Name(); aNewGraph->SetName(aNewName); /*SUPERVGUI_Main* m = */new SUPERVGUI_Main(aViewFrame, - Supervision.getDesktop(), - aNewGraph); - study->showFrame(aStudyFrame); + aSupMod->application()->desktop(),//getDesktop(), + aNewGraph); + aViewFrame->show(); } } @@ -427,30 +444,35 @@ void SUPERVGUI_Main::openSubGraph(SUPERV_CNode theNode, bool correct) // display SubGraph if (SUPERV_isNull(aGraph)) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOACCESS")); + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("WARNING"), tr("MSG_NOACCESS")); return; } else { QString aGraphName = aGraph->Name(); - QAD_StudyFrame* aStudyFrame; + SUIT_ViewWindow* aStudyFrame; if (mySubGraphs.contains(aGraphName)) { aStudyFrame = mySubGraphs[aGraphName]; aStudyFrame->setActiveWindow(); aStudyFrame->setFocus(); } else { - aStudyFrame = Supervision.createGraph(); - if (aStudyFrame) { - SUPERVGraph_ViewFrame* aViewFrame = dynamic_cast - (aStudyFrame->getRightFrame()->getViewFrame()); - if(aViewFrame) { + SUPERVGUI* aSupMod = SUPERVGUI::Supervision(); + if ( !aSupMod ) { + MESSAGE("NULL Supervision module!"); + return; + } + + aStudyFrame = aSupMod->createGraph(); + if ( aStudyFrame ) { + SUPERVGraph_ViewFrame* aViewFrame = dynamic_cast( aStudyFrame ); + if( aViewFrame ) { /*SUPERVGUI_Main* m = */new SUPERVGUI_Main(aViewFrame, - Supervision.getDesktop(), - aGraph); + aSupMod->application()->desktop(),//getDesktop(), + aGraph); // connect(aStudyFrame, SIGNAL(sfStudyFrameClosing(QAD_StudyFrame*)), // this, SLOT(onSubGraphClosed(QAD_StudyFrame*))); - connect(aStudyFrame, SIGNAL(sfStudyFrameActivated(QAD_StudyFrame*)), - this, SLOT(onSubGraphActivated(QAD_StudyFrame*))); + connect(aSupMod->application()->desktop(), SIGNAL(windowActivated( SUIT_ViewWindow* )), + this, SLOT(onSubGraphActivated( SUIT_ViewWindow* ))); aStudyFrame->installEventFilter(this); mySubGraphs.insert(aGraphName, aStudyFrame); @@ -459,7 +481,7 @@ void SUPERVGUI_Main::openSubGraph(SUPERV_CNode theNode, bool correct) } } } - study->showFrame(aStudyFrame); + aStudyFrame->show(); if (!correct) myLastGraph = aStudyFrame; } } @@ -468,28 +490,27 @@ void SUPERVGUI_Main::openSubGraph(SUPERV_CNode theNode, bool correct) bool SUPERVGUI_Main::eventFilter( QObject* o, QEvent* e) { // workaround to get close event - if (o->inherits("QAD_StudyFrame") && e->type() == QEvent::Close) { - QAD_StudyFrame* aFrame = (QAD_StudyFrame*) o; + if (o->inherits("SUIT_ViewWindow"/*"QAD_StudyFrame"*/) && e->type() == QEvent::Close) { + SUIT_ViewWindow* aFrame = (SUIT_ViewWindow*) o; onSubGraphClosed(aFrame); } return SUPERVGraph_View::eventFilter(o, e); } // workaround to fix PAL6255 -> opened SubGraph is not on top -void SUPERVGUI_Main::onSubGraphActivated(QAD_StudyFrame* theStudyFrame) +void SUPERVGUI_Main::onSubGraphActivated(SUIT_ViewWindow* theStudyFrame) { if (myLastGraph) { - QAD_StudyFrame* aFrame = myLastGraph; + SUIT_ViewWindow* aFrame = myLastGraph; myLastGraph = 0; aFrame->setActiveWindow(); aFrame->setFocus(); } } -void SUPERVGUI_Main::onSubGraphClosed(QAD_StudyFrame* theStudyFrame) +void SUPERVGUI_Main::onSubGraphClosed(SUIT_ViewWindow* theStudyFrame) { - QAD_ViewFrame* viewFrame = theStudyFrame->getRightFrame()->getViewFrame(); - if(SUPERVGraph_ViewFrame* supervFrame = dynamic_cast(viewFrame)){ + if ( SUPERVGraph_ViewFrame* supervFrame = dynamic_cast( theStudyFrame ) ) { theStudyFrame->removeEventFilter(this); disconnect(theStudyFrame, 0, this, 0); @@ -524,19 +545,19 @@ void SUPERVGUI_Main::run( const bool andSuspend ) { Editing(); // remove old executor, update GUI (all nodes to "No Status") if ( !dataflow->IsValid() ) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_DF_NOTVALID")); + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_DF_NOTVALID")); } else if (!dataflow->IsExecutable()) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_DF_NOTEXECUTABLE")); + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_DF_NOTEXECUTABLE")); } else if (myCanvasView->isAnyLinkCreating()) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CRL_NOTCOMPLETE")); + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CRL_NOTCOMPLETE")); } else { myRunTime = QDateTime::currentDateTime(); const bool result = andSuspend ? dataflow->Start() : dataflow->Run(); if ( !result ) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_DF_BADEXECUTE")); + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_DF_BADEXECUTE")); if ( dataflow->State() == SUPERV::ErrorState ) { kill(); } @@ -548,7 +569,7 @@ void SUPERVGUI_Main::run( const bool andSuspend ) { } } else { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_DF_RUNNING")); + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_DF_RUNNING")); } } @@ -559,14 +580,14 @@ void SUPERVGUI_Main::kill() { return; if (dataflow->IsEditing()) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_DF_NOTRUNNING")); + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_DF_NOTRUNNING")); } else if (dataflow->Kill()) { - getMessage()->setMessage( tr("MSG_GRAPH_KILLED") ); + getMessage()->putMessage( tr("MSG_GRAPH_KILLED") ); sync(); } else { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANTKILL_DF")); + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANTKILL_DF")); } } @@ -575,19 +596,19 @@ void SUPERVGUI_Main::suspendResume() { if ((SUPERV_isNull(dataflow))) return; if (dataflow->IsEditing()) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_DF_NOTRUNNING")); + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_DF_NOTRUNNING")); } else if (dataflow->State() == SUPERV_Suspend) { if (dataflow->Resume()) { myThread->startThread(tr("MSG_DF_RESUMED")); } else { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_RESUME")); + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_RESUME")); } } else { if (dataflow->Suspend()) { sync(); - getMessage()->setMessage( tr("MSG_GRAPH_SUSPENDED") ); + getMessage()->putMessage( tr("MSG_GRAPH_SUSPENDED") ); } else { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_SUSPEND")); + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_SUSPEND")); } } } @@ -622,8 +643,14 @@ void SUPERVGUI_Main::addNode() { if ( !ReadyToModify() ) // null dataflow or executing, .. return; + SUPERVGUI* aSupMod = SUPERVGUI::Supervision(); + if ( !aSupMod ) { + MESSAGE("NULL Supervision module!"); + return; + } + //Editing(); // PAL6170: GUI->Engine: setting "Editing" flag, commented: PAL7960 - Supervision.getBrowser()->choose(); + aSupMod->getBrowser()->choose(); } /** @@ -746,12 +773,12 @@ SUPERV_Graph SUPERVGUI_Main::getDataflow() { return(dataflow); } -QAD_Message* SUPERVGUI_Main::getMessage() { +LogWindow* SUPERVGUI_Main::getMessage() { Trace("SUPERVGUI_Main::getMessage"); return(message); } -QAD_Study* SUPERVGUI_Main::getStudy() { +SUIT_Study* SUPERVGUI_Main::getStudy() { Trace("SUPERVGUI_Main::getStudy"); return(study); } @@ -767,8 +794,8 @@ void SUPERVGUI_Main::showPopup(QPopupMenu* p, QMouseEvent* e) { if (myIsLocked) return; //if (dataflow->IsExecuting()) return; - //if (QAD_Application::getDesktop()->getActiveComponent().compare(STUDY_SUPERVISION) !=0) return; - if (QAD_Application::getDesktop()->getActiveComponent().compare(QAD_Application::getDesktop()->getComponentUserName( "SUPERV" ) ) !=0) return; + CAM_Application* anApp = ( CAM_Application* )(SUIT_Session::session()->activeApplication()); + if ( anApp->activeModule()->moduleName().compare( anApp->moduleTitle( "SUPERV" ) ) !=0 ) return; if (e->button() == RightButton) { p->exec(e->globalPos()); @@ -785,44 +812,47 @@ void SUPERVGUI_Main::changeInformation() { void SUPERVGUI_Main::chooseData(QListViewItem* item) { Trace("SUPERVGUI_Main::chooseData"); if (choosing) { - QString id = ((QAD_ObjectBrowserItem*)item)->getEntry(); - if (!id.isEmpty()) { - SALOMEDS::SObject_var object = study->getStudyDocument()->FindObjectID(id.latin1()); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeIOR_var anIOR; - Standard_CString ior = ""; - if (object->FindAttribute(anAttr, "AttributeIOR")) { - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - ior = anIOR->Value(); - - // asv : 13.12.04 : commented out use of portIn field, but it seems that it - // should be replaced with some analogious code... selection of IOR was done - - // put its value into port. - //portIn->setValue(ior); - - // stop selection - choosing = false; - setCursor(Supervision.getCursor()); - objectBrowser->setCursor(Supervision.getCursor()); - Supervision.putInfo(""); - } - } + QString id = ((OB_ListItem*)item)->text(2);// <=> get entry + if (!id.isEmpty()) { + _PTR(SObject) object ( (( SalomeApp_Study* )study)->studyDS()->FindObjectID(id.latin1()) ); + _PTR(GenericAttribute) anAttr; + if (object->FindAttribute(anAttr, "AttributeIOR")) { + _PTR(AttributeIOR) anIOR ( anAttr ); + + // asv : 13.12.04 : commented out use of portIn field, but it seems that it + // should be replaced with some analogious code... selection of IOR was done - + // put its value into port. + //portIn->setValue(ior); + + SUPERVGUI* aSupMod = SUPERVGUI::Supervision(); + if ( !aSupMod ) { + MESSAGE("NULL Supervision module!"); + return; + } + + // stop selection + choosing = false; + setCursor(aSupMod->getCursor()); + objectBrowser->setCursor(aSupMod->getCursor()); + aSupMod->putInfo(""); + } + } } } -SALOMEDS::SObject_var SearchOrCreateSOWithName(const SALOMEDS::Study_var theStudy, - const SALOMEDS::StudyBuilder_var theBuilder, - const SALOMEDS::SObject_var theSO, - const char* theName, - bool* theDoneSomething ) { - SALOMEDS::SObject_var aResult; - SALOMEDS::AttributeName_var aName; - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::ChildIterator_var anIterator = theStudy->NewChildIterator(theSO); +_PTR(SObject) SearchOrCreateSOWithName( _PTR(Study) const theStudy, + _PTR(StudyBuilder) const theBuilder, + _PTR(SObject) const theSO, + const char* theName, + bool* theDoneSomething ) { + _PTR(SObject) aResult; + _PTR(AttributeName) aName; + _PTR(GenericAttribute) anAttr; + _PTR(ChildIterator) anIterator ( theStudy->NewChildIterator(theSO) ); for (; anIterator->More(); anIterator->Next()) { if (anIterator->Value()->FindAttribute(anAttr, "AttributeName")) { - aName = SALOMEDS::AttributeName::_narrow(anAttr); - if (strcmp(aName->Value(), theName) == 0) { + aName = anAttr; + if (strcmp(aName->Value().c_str(), theName) == 0) { aResult = anIterator->Value(); break; } @@ -830,14 +860,14 @@ SALOMEDS::SObject_var SearchOrCreateSOWithName(const SALOMEDS::Study_var theStud } // if aResule was found then theDoneSomething=false and we return - *theDoneSomething = aResult->_is_nil(); + *theDoneSomething = !aResult ? 1 : 0;//->_is_nil(); if ( !*theDoneSomething ) return aResult; // add new SObject aResult = theBuilder->NewObject( theSO ); anAttr = theBuilder->FindOrCreateAttribute(aResult, "AttributeName"); - aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName = anAttr; aName->SetValue(theName); return aResult; } @@ -846,48 +876,51 @@ SALOMEDS::SObject_var SearchOrCreateSOWithName(const SALOMEDS::Study_var theStud * Return true if dataflow is already in the study */ bool SUPERVGUI_Main::isDataflowInStudy() const { - SALOMEDS::Study_var aStudy = study->getStudyDocument(); - SALOMEDS::SObject_var aSO = aStudy->FindObjectIOR( dataflow->getIOR() ); - return ( !CORBA::is_nil( aSO ) ); + _PTR(Study) aStudy = (( SalomeApp_Study* )study)->studyDS(); + _PTR(SObject) aSO ( aStudy->FindObjectIOR( dataflow->getIOR() ) ); + return ( aSO ? true : false ); } /** * Create a "Supervision" object in the Study and a "dataflow" object under it * aDoneSomething will be true if "Supervision" or "dataflow" object were created (not found). */ -SALOMEDS::SObject_var createDataflowSObj( QAD_Study* study, - SUPERV::Graph_var dataflow, - SALOMEDS::StudyBuilder_var aBuilder, - bool& aDoneSomething ) { - SALOMEDS::Study_var aStudy = study->getStudyDocument(); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeName_var aName; - SALOMEDS::AttributeIOR_var anIORAttr; - SALOMEDS::AttributePixMap_var aPixmap; +_PTR(SObject) createDataflowSObj( SUIT_Study* study, + SUPERV::Graph_var dataflow, + _PTR(StudyBuilder) aBuilder, + bool& aDoneSomething ) { + _PTR(Study) aStudy = (( SalomeApp_Study* )study)->studyDS(); + _PTR(GenericAttribute) anAttr; + _PTR(AttributeName) aName; // Find or create "Supervisor -> aNewDataflow_1" SObjects in the study - SALOMEDS::SObject_var aSO = aStudy->FindObjectIOR( dataflow->getIOR() ); - if ( aSO->_is_nil() ) { // dataflow SObject not found in the study + _PTR(SObject) aSO = aStudy->FindObjectIOR( dataflow->getIOR() ); + if ( !aSO ) { // dataflow SObject not found in the study aDoneSomething = true; - SALOMEDS::SComponent_ptr aComponent = aStudy->FindComponent(STUDY_SUPERVISION); - if ( aComponent->_is_nil() ) { // is supervision component not found, then create it - aComponent = aBuilder->NewComponent(STUDY_SUPERVISION); + _PTR(SComponent) aComponent = aStudy->FindComponent(STUDY_SUPERVISION); + if ( aComponent ) { // if component found, create name and icon for it to display it in object browser anAttr = aBuilder->FindOrCreateAttribute(aComponent, "AttributeName"); - aName = SALOMEDS::AttributeName::_narrow(anAttr); - aName->SetValue(QAD_Application::getDesktop()->getComponentUserName( "SUPERV" ) ); + aName = anAttr; + aName->SetValue( (( CAM_Application* )(study->application()))->moduleTitle( "SUPERV" ).latin1() ); anAttr = aBuilder->FindOrCreateAttribute(aComponent, "AttributePixMap"); - aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + _PTR(AttributePixMap) aPixmap ( anAttr ); aPixmap->SetPixMap( "ICON_OBJBROWSER_Supervision" ); - aBuilder->DefineComponentInstance(aComponent, Supervision.getEngine()); + + SUPERVGUI* aSupMod = SUPERVGUI::Supervision(); + if ( aSupMod ) + aBuilder->DefineComponentInstance(aComponent, SalomeApp_Application::orb()->object_to_string(aSupMod->getEngine())); + //dynamic_cast( aStudy )->ConvertObjectToIOR(aSupMod->getEngine())); + else MESSAGE("NULL Supervision module!"); + } // create dataflow SObject ("aNewDataflow_1") aSO = aBuilder->NewObject(aComponent); anAttr = aBuilder->FindOrCreateAttribute(aSO, "AttributeName"); - aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName = anAttr; aName->SetValue(dataflow->Name()); anAttr = aBuilder->FindOrCreateAttribute(aSO, "AttributeIOR"); - anIORAttr = SALOMEDS::AttributeIOR::_narrow(anAttr); + _PTR(AttributeIOR) anIORAttr ( anAttr ); anIORAttr->SetValue(dataflow->getIOR()); } @@ -896,17 +929,22 @@ SALOMEDS::SObject_var createDataflowSObj( QAD_Study* study, void SUPERVGUI_Main::addDataflowToStudy() { bool isCreated; - SALOMEDS::StudyBuilder_var aBuilder = study->getStudyDocument()->NewBuilder(); + _PTR(StudyBuilder) aBuilder ( (( SalomeApp_Study* )study)->studyDS()->NewBuilder() ); aBuilder->NewCommand(); - SALOMEDS::SObject_var aDF = createDataflowSObj( study, dataflow, aBuilder, isCreated ); - if ( !CORBA::is_nil( aDF ) ) { + _PTR(SObject) aDF ( createDataflowSObj( study, dataflow, aBuilder, isCreated ) ); + if ( aDF ) { aBuilder->CommitCommand(); // what is this register/unregister?? don't know.. - Supervision.unregisterGraph(this); - Supervision.registerGraph(dataflow->getIOR(), this); + SUPERVGUI* aSupMod = SUPERVGUI::Supervision(); + if ( !aSupMod ) { + MESSAGE("NULL Supervision module!"); + return; + } + aSupMod->unregisterGraph(this); + aSupMod->registerGraph(dataflow->getIOR(), this); if ( !myThread->running() ) - study->updateObjBrowser(); + aSupMod->updateObjBrowser(); } else { MESSAGE( "ERROR: failed to find or create dataflow SObject" ); @@ -922,12 +960,9 @@ bool SUPERVGUI_Main::putDataStudy( SUPERV_Port p, const char* inout ) { if (isIn) return true; else isIn = true; - SALOMEDS::Study_var aStudy = study->getStudyDocument(); - const bool aLocked = aStudy->GetProperties()->IsLocked(); - SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder(); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeIOR_var anIORAttr; - SALOMEDS::AttributePixMap_var aPixmap; + _PTR(Study) aStudy = (( SalomeApp_Study* )study)->studyDS(); + const bool aLocked = aStudy->GetProperties()->IsLocked(); + _PTR(StudyBuilder) aBuilder ( aStudy->NewBuilder() ); bool aDoneSomething = false; // asv 23.11.04 : fix for PAL6852 if the study is locked -- then we can't put anything in it. @@ -948,9 +983,9 @@ bool SUPERVGUI_Main::putDataStudy( SUPERV_Port p, const char* inout ) { aBuilder->NewCommand(); // Find or create "Supervisor -> aNewDataflow_1" SObjects in the study - SALOMEDS::SObject_var aSO = createDataflowSObj( study, dataflow, aBuilder, aDoneSomething ); + _PTR(SObject) aSO = createDataflowSObj( study, dataflow, aBuilder, aDoneSomething ); - if ( CORBA::is_nil( aSO ) ) { + if ( !aSO ) { MESSAGE( "ERROR: putDataStudy() could not find or create dataflow SObject" ); aBuilder->AbortCommand(); isIn = false; @@ -966,12 +1001,12 @@ bool SUPERVGUI_Main::putDataStudy( SUPERV_Port p, const char* inout ) { aSO = SearchOrCreateSOWithName( aStudy, aBuilder, aSO, p->Name(), &aDoneSomething ); // get port SO // create IOR attribute for port SObject (usually with "return" name) - anAttr = aBuilder->FindOrCreateAttribute(aSO, "AttributeIOR"); - anIORAttr = SALOMEDS::AttributeIOR::_narrow(anAttr); + _PTR(GenericAttribute) anAttr ( aBuilder->FindOrCreateAttribute(aSO, "AttributeIOR") ); + _PTR(AttributeIOR) anIORAttr ( anAttr ); // if we have not created anything (all SObject already existed) and we have the same IORAttribute // on the needed SObject -> then don't do anything! it's already there! - if ( !aDoneSomething && strcmp(anIORAttr->Value(), p->ToString()) == 0 ) { + if ( !aDoneSomething && strcmp(anIORAttr->Value().c_str(), p->ToString()) == 0 ) { aBuilder->AbortCommand(); isIn = false; return true; @@ -995,8 +1030,10 @@ bool SUPERVGUI_Main::putDataStudy( SUPERV_Port p, const char* inout ) { if ( aDriver->CanPublishInStudy( anObject ) ) { SALOMEDS::SObject_var aTmpSO;// = aSO; - aTmpSO = aDriver->PublishInStudy( aStudy, aTmpSO, anObject, "" ); - aBuilder->Addreference(aSO, aTmpSO); + SALOMEDS_Study* aSStudy = dynamic_cast( aStudy.get() ); + if ( !aSStudy ) return false; + aTmpSO = aDriver->PublishInStudy( aSStudy->GetStudy(), aTmpSO, anObject, "" ); + aBuilder->Addreference(aSO, _PTR(SObject)(new SALOMEDS_SObject( aTmpSO )) ); } else { // can't publish object: abort transaction MESSAGE( "CanPublishInStudy() returned FALSE. ok, AbortCommand.." ); @@ -1006,8 +1043,8 @@ bool SUPERVGUI_Main::putDataStudy( SUPERV_Port p, const char* inout ) { } } else { // component has no driver, but could store IORs (like Calculator) - SALOMEDS::SObject_var anIORSO = aStudy->FindObjectIOR( p->ToString() ); - if ( !CORBA::is_nil( anIORSO ) ) + _PTR(SObject) anIORSO ( aStudy->FindObjectIOR( p->ToString() ) ); + if ( anIORSO ) aBuilder->Addreference(aSO, anIORSO); else { // Hm... the object (==port value) was not found, so we don't publish it. MESSAGE( "The object (==port value) was not found, so we don't publish it" ); @@ -1034,8 +1071,12 @@ bool SUPERVGUI_Main::putDataStudy( SUPERV_Port p, const char* inout ) { else aBuilder->AbortCommand(); - if ( !myThread->running() ) - study->updateObjBrowser(); + if ( !myThread->running() ) { + SUPERVGUI* aSupMod = SUPERVGUI::Supervision(); + if ( aSupMod ) + aSupMod->updateObjBrowser(); + else MESSAGE("NULL Supervision module!"); + } isIn = false; return true; @@ -1078,7 +1119,7 @@ void SUPERVGUI_Main::syncNotification() { mess += " / " ; mess += node; mess += " / " ; mess += type; mess += " / " ; mess += message; - getMessage()->setMessage(mess.latin1()); + getMessage()->putMessage(mess.latin1()); }; }; } @@ -1164,7 +1205,11 @@ void SUPERVGUI_Main::startTimer() { } void SUPERVGUI_Main::executionFinished() { - getStudy()->updateObjBrowser(); + SUPERVGUI* aSupMod = SUPERVGUI::Supervision(); + if ( aSupMod ) + aSupMod->updateObjBrowser(); + else MESSAGE("NULL Supervision module!"); + myCanvas->update(); myArray->update(); } @@ -1222,7 +1267,7 @@ bool SUPERVGUI_Main::ReadyToModify() { if ( CORBA::is_nil( dataflow ) ) return false; if ( dataflow->IsExecuting() ) { - bool quit = QAD_MessageBox::warn2( QAD_Application::getDesktop(), // 0=Yes, 1=No + bool quit = SUIT_MessageBox::warn2( SUIT_Session::session()->activeApplication()->desktop(), // 0=Yes, 1=No tr("WARNING"), tr("MSG_GRAPH_ISRUN"), tr( "BUT_YES" ), tr( "BUT_CANCEL" ), 0, 1, 0 ); if ( quit ) // user selected NOT to kill dataflow and NOT to add new node return false; @@ -1248,9 +1293,11 @@ void SUPERVGUI_Thread::startThread(const char* m) { if (!myIsActive) { myIsActive = true; - start(); - myMain->getMessage()->setMessage(m); + + myMain->getMessage()->putMessage(m); myMain->sync(); + + start(); } } @@ -1304,20 +1351,20 @@ void SUPERVGUI_Thread::run() if ( !myIsActive ) { switch ( myMain->getDataflow()->State() ) { case SUPERV_Editing : - myMain->getMessage()->setMessage( myMain->getDataflow()->IsReadOnly()? + myMain->getMessage()->putMessage( myMain->getDataflow()->IsReadOnly()? tr("MSG_GRAPH_READONLY"): tr("MSG_GRAPH_EDITING") ); break; case SUPERV_Suspend : - myMain->getMessage()->setMessage( tr("MSG_GRAPH_SUSPENDED") ); + myMain->getMessage()->putMessage( tr("MSG_GRAPH_SUSPENDED") ); break; case SUPERV_Done : - myMain->getMessage()->setMessage( tr("MSG_GRAPH_FINISHED") ); + myMain->getMessage()->putMessage( tr("MSG_GRAPH_FINISHED") ); break; case SUPERV_Error : - myMain->getMessage()->setMessage( tr("MSG_GRAPH_ABORTED") ); + myMain->getMessage()->putMessage( tr("MSG_GRAPH_ABORTED") ); break; case SUPERV_Kill: - myMain->getMessage()->setMessage( tr("MSG_GRAPH_KILLED") ); + myMain->getMessage()->putMessage( tr("MSG_GRAPH_KILLED") ); break; } // end of switch @@ -1334,7 +1381,7 @@ void SUPERVGUI_Thread::run() Constructor */ SUPERVGUI_DSGraphParameters::SUPERVGUI_DSGraphParameters(SUPERV_Graph theGraph, bool isReadOnly) - : QDialog( QAD_Application::getDesktop(), "", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) + : QDialog( SUIT_Session::session()->activeApplication()->desktop(), "", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) { Trace("SUPERVGUI_DSGraphParameters::SUPERVGUI_DSGraphParameters"); setCaption( tr( "TLT_DSGRAPHPARAMS" ) ); @@ -1358,7 +1405,7 @@ SUPERVGUI_DSGraphParameters::SUPERVGUI_DSGraphParameters(SUPERV_Graph theGraph, QLabel* DeltaTimeL = new QLabel( tr( "DELTATIME_LBL" ), TopGroup ); TopGroupLayout->addWidget( DeltaTimeL, 0, 0 ); - myDeltaTime = new QAD_SpinBoxDbl( TopGroup, 0.0, 1.0, 0.1); + myDeltaTime = new QtxDblSpinBox( 0.0, 1.0, 0.1, TopGroup ); myDeltaTime->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); TopGroupLayout->addWidget( myDeltaTime, 0, 1 ); diff --git a/src/SUPERVGUI/SUPERVGUI_Main.h b/src/SUPERVGUI/SUPERVGUI_Main.h index 274a179..de7bc80 100644 --- a/src/SUPERVGUI/SUPERVGUI_Main.h +++ b/src/SUPERVGUI/SUPERVGUI_Main.h @@ -29,7 +29,6 @@ #define SUPERVGUI_Main_H #include "SUPERVGraph_ViewFrame.h" -#include "QAD_Desktop.h" #include "SUPERVGUI_Canvas.h" #include "SUPERVGUI_CanvasView.h" #include "SUPERVGUI_ArrayView.h" @@ -38,10 +37,10 @@ #include #include -class QAD_Study; -class QAD_ObjectBrowser; -class QAD_Message; -class QAD_SpinBoxDbl; +class SUIT_Study; +class OB_Browser; +class LogWindow; +class QtxDblSpinBox; class QLineEdit; class QComboBox; class NOTIFICATION_Consumer; @@ -55,7 +54,7 @@ class SUPERVGUI_Main: public SUPERVGraph_View { friend class SUPERVGUI_Thread; public: - SUPERVGUI_Main(SUPERVGraph_ViewFrame*, QAD_Desktop*, SUPERV_Graph); + SUPERVGUI_Main(SUPERVGraph_ViewFrame*, SUIT_Desktop*/*QAD_Desktop**/, SUPERV_Graph); virtual ~SUPERVGUI_Main(); void run( const bool andSuspend ); @@ -71,8 +70,8 @@ class SUPERVGUI_Main: public SUPERVGraph_View { SUPERVGUI_Canvas* getCanvas(); SUPERVGUI_CanvasView* getCanvasView(); SUPERV_Graph getDataflow(); - QAD_Message* getMessage(); - QAD_Study* getStudy(); + LogWindow* getMessage(); + SUIT_Study* getStudy(); bool isArrayShown(); void showPopup(QPopupMenu* p, QMouseEvent* e); @@ -151,28 +150,28 @@ class SUPERVGUI_Main: public SUPERVGraph_View { void filterNotification(); void changeDSGraphParameters(); - void onSubGraphClosed(QAD_StudyFrame* ); - void onSubGraphActivated(QAD_StudyFrame* ); + void onSubGraphClosed( SUIT_ViewWindow* ); + void onSubGraphActivated( SUIT_ViewWindow* ); private slots: void chooseData(QListViewItem* item); void checkExecution(); private: - void init(QAD_Desktop* parent); + void init(SUIT_Desktop* parent); void syncNotification(); bool isFiltered(char* graph, char* node, char* type, char* message, char* sender, long counter, char* date, long stamp); void closeEvent(QCloseEvent*); SUPERV_Graph dataflow; - QMap mySubGraphs; - QMap mySubGraphMap; - QAD_StudyFrame* myLastGraph; + QMap mySubGraphs; + QMap mySubGraphMap; + SUIT_ViewWindow* myLastGraph; - QAD_Study* study; - QAD_ObjectBrowser* objectBrowser; - QAD_Message* message; + SUIT_Study* study; + OB_Browser* objectBrowser; + LogWindow* message; GraphViewType myCurrentView; SUPERVGUI_CanvasArray* myArray; @@ -222,7 +221,7 @@ class SUPERVGUI_Thread : public QObject, public QThread { void KillThread(bool theValue); protected: - void run(); + virtual void run(); private: bool myIsActive; @@ -248,7 +247,7 @@ class SUPERVGUI_DSGraphParameters: public QDialog { void setData(); - QAD_SpinBoxDbl* myDeltaTime; + QtxDblSpinBox* myDeltaTime; QLineEdit* myTimeOut; QComboBox* myDataStreamTrace; diff --git a/src/SUPERVGUI/SUPERVGUI_ManagePortsDlg.cxx b/src/SUPERVGUI/SUPERVGUI_ManagePortsDlg.cxx index 956133d..9d24066 100644 --- a/src/SUPERVGUI/SUPERVGUI_ManagePortsDlg.cxx +++ b/src/SUPERVGUI/SUPERVGUI_ManagePortsDlg.cxx @@ -10,6 +10,9 @@ using namespace std; +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" + #include "SUPERVGUI_ManagePortsDlg.h" #include "SUPERVGUI_CanvasNode.h" #include "SUPERVGUI_CanvasPort.h" @@ -127,7 +130,7 @@ static const char* const down_pix_data[] = { * Constructor */ SUPERVGUI_ManagePortsDlg::SUPERVGUI_ManagePortsDlg( SUPERVGUI_CanvasNode* theNode ) - : QDialog( QAD_Application::getDesktop(), 0, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ) + : QDialog( SUIT_Session::session()->activeApplication()->desktop(), 0, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ) { myNode = theNode; myLastItem = 0; @@ -421,7 +424,7 @@ void SUPERVGUI_ManagePortsDlg::addPort( QListBox* theLB ) { } } if ( found ) - QMessageBox::warning( QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_PORT_EXIST") ); + QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_PORT_EXIST") ); else new PortListItem( theLB, name, myTypeCombo->currentText() ); } @@ -551,7 +554,7 @@ void SUPERVGUI_ManagePortsDlg::itemChanged( QListBoxItem * item ) { * Port parameters dialog definition (taken from SUPERVGUI_Node.cxx without change) */ SUPERVGUI_PortParamsDlg::SUPERVGUI_PortParamsDlg(const QStringList& thePortsNames) - : QDialog(QAD_Application::getDesktop(), 0, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ), + : QDialog(SUIT_Session::session()->activeApplication()->desktop(), 0, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ), myPortsNames( thePortsNames ) { setSizeGripEnabled( true ); @@ -598,9 +601,9 @@ SUPERVGUI_PortParamsDlg::SUPERVGUI_PortParamsDlg(const QStringList& thePortsName void SUPERVGUI_PortParamsDlg::clickOnOk() { if (getName().isEmpty() || getType().isEmpty()) - QMessageBox::warning( QAD_Application::getDesktop(), tr( "ERROR" ), tr( "MSG_CANT_CREATE_PORT" ) ); + QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr( "ERROR" ), tr( "MSG_CANT_CREATE_PORT" ) ); else if (myPortsNames.contains(getName())) - QMessageBox::warning( QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_PORT_EXIST") ); + QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_PORT_EXIST") ); else accept(); } diff --git a/src/SUPERVGUI/SUPERVGUI_Notification.cxx b/src/SUPERVGUI/SUPERVGUI_Notification.cxx index 0121236..e991427 100644 --- a/src/SUPERVGUI/SUPERVGUI_Notification.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Notification.cxx @@ -32,8 +32,9 @@ using namespace std; #include "SUPERVGUI_CanvasNode.h" #include "NOTIFICATION.hxx" -#include "QAD_Message.h" -#include "QAD_FileDlg.h" +#include "SUIT_Desktop.h" +#include "SUIT_FileDlg.h" +#include "SUIT_Session.h" #include #include @@ -52,7 +53,7 @@ using namespace std; Constructor */ SUPERVGUI_Notification::SUPERVGUI_Notification( SUPERVGUI_Main* m ) - : QDialog( QAD_Application::getDesktop(), "", TRUE, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ), + : QDialog( SUIT_Session::session()->activeApplication()->desktop(), "", TRUE, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ), myMain( m ) { setCaption( tr( "TLT_FILTER_NOTIFY" ) ); @@ -206,11 +207,11 @@ void SUPERVGUI_Notification::loggedClicked() */ void SUPERVGUI_Notification::browseClicked() { - QString fn = QAD_FileDlg::getFileName( this, - myFileEdit->text(), - tr( "ALL_FILES" ), - tr( "CHOOSE_LOG_FILES_TLT" ), - false ); + QString fn = SUIT_FileDlg::getFileName( this, + myFileEdit->text(), + tr( "ALL_FILES" ), + tr( "CHOOSE_LOG_FILES_TLT" ), + false ); if ( !fn.isEmpty() ) myFileEdit->setText( fn ); } diff --git a/src/SUPERVGUI/SUPERVGUI_Service.cxx b/src/SUPERVGUI/SUPERVGUI_Service.cxx index 953784f..788cd8e 100644 --- a/src/SUPERVGUI/SUPERVGUI_Service.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Service.cxx @@ -30,11 +30,16 @@ using namespace std; #include "SUPERVGUI_Main.h" #include "SUPERVGUI_Library.h" #include "SUPERVGUI.h" -#include "QAD_Tools.h" -#include "QAD_FileDlg.h" + +#include "CAM_Application.h" +#include "SUIT_Desktop.h" +#include "SUIT_FileDlg.h" +#include "SUIT_Session.h" +#include "SUIT_Tools.h" #include "SALOME_NamingService.hxx" #include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog) +#include #include #include #include @@ -95,7 +100,7 @@ static const char * InterfaceIcon[] = { SUPERVGUI_Service::SUPERVGUI_Service(SALOME_NamingService* ns): - QDialog(QAD_Application::getDesktop(), 0, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), + QDialog(SUIT_Session::session()->activeApplication()->desktop(), 0, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), naming(ns), myMFile(0) { setSizeGripEnabled( true ); @@ -278,7 +283,7 @@ void SUPERVGUI_Service::initialise() { return; } - QAD_ResourceMgr* aResMgr = QAD_Desktop::createResourceManager(); + SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); SALOME_ModuleCatalog::ListOfComponents_var lComponents = (*aModuleCatalog)->GetComponentList(); long nbComp = lComponents->length(); @@ -288,10 +293,9 @@ void SUPERVGUI_Service::initialise() { myComponentItem->setSelectable(false); QString aIconName = C->component_icone(); if (!aIconName.isEmpty()) { - QString resDir = aResMgr->findFile(aIconName, C->componentname()) ; - if (resDir) { - resDir = QAD_Tools::addSlash(resDir); - QPixmap aIcone(resDir + aIconName); + QString resFilePath = aResMgr->path(aResMgr->resSection(), C->componentname(), aIconName) ; + if ( resFilePath ) { + QPixmap aIcone(resFilePath); QIconSet aIconSet(aIcone); myComponentItem->setPixmap(0, aIconSet.pixmap(QIconSet::Small, QIconSet::Normal)); } else { @@ -361,8 +365,17 @@ SUPERVGUI_Service::~SUPERVGUI_Service() { } void SUPERVGUI_Service::addComputeNode() { - QAD_Desktop* aDesktop = QAD_Application::getDesktop(); - SUPERVGUI_Main* aMain = Supervision.getMain(); + SUIT_Desktop* aDesktop = SUIT_Session::session()->activeApplication()->desktop(); + CAM_Application* anApp = ( CAM_Application* )(SUIT_Session::session()->activeApplication()); + if ( !anApp ) return; + + SUPERVGUI* aSupMod = SUPERVGUI::Supervision(); + if ( !aSupMod ) { + MESSAGE("NULL Supervision module!"); + return; + } + + SUPERVGUI_Main* aMain = aSupMod->getMain(); if (aMain==0) { QMessageBox::warning(aDesktop, tr("WARNING"), tr("MSG_NO_SUPERVISION_WINDOW")); } else if (!aMain->isEditable()) { @@ -383,7 +396,7 @@ void SUPERVGUI_Service::addComputeNode() { const char* service = item->text(0).latin1(); const char* interface = item->parent()->text(0).latin1(); const char* component = item->parent()->parent()->text(0).latin1(); - SALOME_ModuleCatalog::Acomponent_ptr myComponent = (*aModuleCatalog)->GetComponent(aDesktop->getComponentName(component)); + SALOME_ModuleCatalog::Acomponent_ptr myComponent = (*aModuleCatalog)->GetComponent(anApp->moduleName(component)); if ( myComponent == NULL ) { QMessageBox::warning(aDesktop, tr("ERROR"), tr("MSG_CANT_CHOOSE_SERVICE")); } @@ -409,8 +422,17 @@ void SUPERVGUI_Service::addComputeNode() { } void SUPERVGUI_Service::addFactoryNode() { - QAD_Desktop* aDesktop = QAD_Application::getDesktop(); - SUPERVGUI_Main* aMain = Supervision.getMain(); + SUIT_Desktop* aDesktop = SUIT_Session::session()->activeApplication()->desktop(); + CAM_Application* anApp = ( CAM_Application* )(SUIT_Session::session()->activeApplication()); + if ( !anApp ) return; + + SUPERVGUI* aSupMod = SUPERVGUI::Supervision(); + if ( !aSupMod ) { + MESSAGE("NULL Supervision module!"); + return; + } + + SUPERVGUI_Main* aMain = aSupMod->getMain(); if (aMain==0) { QMessageBox::warning(aDesktop, tr("WARNING"), tr("MSG_NO_SUPERVISION_WINDOW")); } else if (!aMain->isEditable()) { @@ -430,7 +452,7 @@ void SUPERVGUI_Service::addFactoryNode() { if (item->isSelected()) { const char* service = item->text(0).latin1(); const char* interface = item->parent()->text(0).latin1(); - const char* component = aDesktop->getComponentName(item->parent()->parent()->text(0).latin1()); + const char* component = anApp->moduleName(item->parent()->parent()->text(0).latin1()); SALOME_ModuleCatalog::Acomponent_ptr myComponent = (*aModuleCatalog)->GetComponent(component); if (myComponent==NULL) { QMessageBox::warning(aDesktop, tr("ERROR"), tr("MSG_CANT_CHOOSE_SERVICE")); @@ -467,12 +489,18 @@ void SUPERVGUI_Service::addFactoryNode() { void SUPERVGUI_Service::addInlineNode() { - SUPERVGUI_Main* aMain = Supervision.getMain(); + SUPERVGUI* aSupMod = SUPERVGUI::Supervision(); + if ( !aSupMod ) { + MESSAGE("NULL Supervision module!"); + return; + } + + SUPERVGUI_Main* aMain = aSupMod->getMain(); if (aMain==0) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NO_SUPERVISION_WINDOW")); + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("WARNING"), tr("MSG_NO_SUPERVISION_WINDOW")); } else if (!aMain->isEditable()) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_CREATE_NODE")); + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_CREATE_NODE")); } else { int aSel = myTypeCombo->currentItem(); @@ -540,12 +568,18 @@ void SUPERVGUI_Service::addInlineNode() { } void SUPERVGUI_Service::addMacroNode() { - SUPERVGUI_Main* aMain = Supervision.getMain(); + SUPERVGUI* aSupMod = SUPERVGUI::Supervision(); + if ( !aSupMod ) { + MESSAGE("NULL Supervision module!"); + return; + } + + SUPERVGUI_Main* aMain = aSupMod->getMain(); if (aMain==0) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NO_SUPERVISION_WINDOW")); + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("WARNING"), tr("MSG_NO_SUPERVISION_WINDOW")); } else if (!aMain->isEditable()) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_CREATE_NODE")); + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_CREATE_NODE")); } else { if ( myMFile ) { @@ -570,7 +604,7 @@ void SUPERVGUI_Service::addMacroNode() { addNode( aNode, aDummyEndNode, myX, myY ); } else { - QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NONODE_TOADD")); + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("WARNING"), tr("MSG_NONODE_TOADD")); } } } @@ -583,18 +617,18 @@ void SUPERVGUI_Service::loadGraph() { return; } - QString aFileName = QAD_FileDlg::getFileName(QAD_Application::getDesktop(), - "", - "*.xml", - tr("MSG_GRAPH_INSERT"), - true); + QString aFileName = SUIT_FileDlg::getFileName(SUIT_Session::session()->activeApplication()->desktop(), + "", + "*.xml", + tr("MSG_GRAPH_INSERT"), + true); if (aFileName.isEmpty()) return; myMacroPane->clear(); myMFile = new QFile(aFileName); if (!myMFile->open(IO_ReadOnly)) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_LOADSCRIPT")); delete myMFile; myMFile = 0; return; @@ -602,7 +636,7 @@ void SUPERVGUI_Service::loadGraph() { QTextStream* aStream = new QTextStream(myMFile); if (aStream->atEnd()) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_EMTY_FILE")); delete aStream; myMFile->close(); @@ -634,7 +668,13 @@ void SUPERVGUI_Service::choose() { void SUPERVGUI_Service::showEvent(QShowEvent* theEvent) { - SUPERVGUI_Main* aMain = Supervision.getMain(); + SUPERVGUI* aSupMod = SUPERVGUI::Supervision(); + if ( !aSupMod ) { + MESSAGE("NULL Supervision module!"); + return; + } + + SUPERVGUI_Main* aMain = aSupMod->getMain(); if (aMain && (!aMain->isArrayShown())) { aMain->getArrayView()->viewportToContents(0, 0, myX, myY); //aMain->getGraph()->viewportToContents(0, 0, myX, myY); @@ -750,16 +790,16 @@ void SUPERVGUI_PythonEditPane::initPyFunctions( QTextStream& theStream ) { * Load existing Python script */ void SUPERVGUI_PythonEditPane::loadFile() { - QString aFileName = QAD_FileDlg::getFileName(QAD_Application::getDesktop(), - "", - "*.py", - tr("TIT_LOADSCRIPT"), - true); + QString aFileName = SUIT_FileDlg::getFileName(SUIT_Session::session()->activeApplication()->desktop(), + "", + "*.py", + tr("TIT_LOADSCRIPT"), + true); if (aFileName.isEmpty()) return; QFile aFile( aFileName ); if (!aFile.open(IO_ReadOnly)) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_LOADSCRIPT")); return; } @@ -770,7 +810,7 @@ void SUPERVGUI_PythonEditPane::loadFile() { QTextStream aFileReader(&aFile); if ( aFileReader.atEnd() ) { - QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_EMTY_FILE")); + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_EMTY_FILE")); aFile.close(); return; } @@ -894,7 +934,7 @@ void SUPERVGUI_PythonEditPane::library() { * Edit Python dialog */ SUPERVGUI_EditPythonDlg::SUPERVGUI_EditPythonDlg( bool isLoop ) - :QDialog(QAD_Application::getDesktop(), 0, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) + :QDialog(SUIT_Session::session()->activeApplication()->desktop(), 0, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { setSizeGripEnabled( true ); setCaption(tr("TIT_FUNC_PYTHON")); @@ -945,7 +985,13 @@ SUPERVGUI_EditPythonDlg::SUPERVGUI_EditPythonDlg( bool isLoop ) * PS theEndNode is passed only for Loop and Switch nodes (EndLoop and EndSwitch) */ void SUPERVGUI_Service::addNode( SUPERV::CNode_var theNode, SUPERV::INode_var theEndNode, int& theX, int& theY ) { - SUPERVGUI_Main* aMain = Supervision.getMain(); + SUPERVGUI* aSupMod = SUPERVGUI::Supervision(); + if ( !aSupMod ) { + MESSAGE("NULL Supervision module!"); + return; + } + + SUPERVGUI_Main* aMain = aSupMod->getMain(); if ( !CORBA::is_nil( theNode ) && aMain ) { diff --git a/src/SUPERVGUI/SUPERV_images.po b/src/SUPERVGUI/SUPERV_images.po new file mode 100644 index 0000000..0d0e8a0 --- /dev/null +++ b/src/SUPERVGUI/SUPERV_images.po @@ -0,0 +1,67 @@ +# SUPERV SUPERVGUI : GUI for Supervisor component +# +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +# +# +# +# File : SupervisionGUI_icons.po +# Module : SUPERV + +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"POT-Creation-Date: 2001-09-11 12:08:44 PM CEST\n" +"PO-Revision-Date: 2005-05-12 12:33+0400\n" +"Last-Translator: FULLNAME \n" +"Content-Type: text/plain; charset=iso-8859-1\n" + +#: QAD_ObjectBrowser.cxx:140 +msgid "ICON_OBJBROWSER_Supervision" +msgstr "Superv_tree_superv.png" + +msgid "ICO_IMPORT" +msgstr "import.gif" + +msgid "ICO_EXPORT" +msgstr "export.gif" + +msgid "ICO_NEW" +msgstr "edit.png" + +msgid "ICO_MODIFY" +msgstr "modify.png" + +msgid "ICO_RELOAD" +msgstr "reload.png" + +msgid "ICO_ADDNODE" +msgstr "components.png" + +msgid "ICO_RUN" +msgstr "run.png" + +msgid "ICO_STEPBYSTEP" +msgstr "steps.png" + +msgid "ICO_KILL" +msgstr "kill.png" + +msgid "ICO_SUSPEND/RESUME" +msgstr "suspend-resume.gif" diff --git a/src/SUPERVGUI/SUPERV_msg_en.po b/src/SUPERVGUI/SUPERV_msg_en.po index 0bcbcd7..19bb638 100644 --- a/src/SUPERVGUI/SUPERV_msg_en.po +++ b/src/SUPERVGUI/SUPERV_msg_en.po @@ -836,3 +836,109 @@ msgstr "Import Dataflow" msgid "TLT_CREATE_DF_1" msgstr "Modify Dataflow" + +### Menu of SUPERV module ### +msgid "TOP_IMPORT" +msgstr "Import Dataflow" + +msgid "MEN_IMPORT" +msgstr "Import Dataflow" + +msgid "STB_IMPORT" +msgstr "Import Datalow" + +msgid "TOP_EXPORT" +msgstr "Export Dataflow" + +msgid "MEN_EXPORT" +msgstr "Export Dataflow" + +msgid "STB_EXPORT" +msgstr "Export Dataflow" + +msgid "TOP_NEW" +msgstr "New Dataflow" + +msgid "MEN_NEW" +msgstr "New Dataflow" + +msgid "STB_NEW" +msgstr "Create New Dataflow" + +msgid "TOP_MODIFY" +msgstr "Modify Dataflow" + +msgid "MEN_MODIFY" +msgstr "Modify Dataflow" + +msgid "STB_MODIFY" +msgstr "Modify Dataflow" + +msgid "TOP_RELOAD" +msgstr "Reload Dataflow" + +msgid "MEN_RELOAD" +msgstr "Reload" + +msgid "STB_RELOAD" +msgstr "Reload Dataflow" + +msgid "TOP_ADDNODE" +msgstr "Add Node to Dataflow" + +msgid "MEN_ADDNODE" +msgstr "Add Node to Dataflow" + +msgid "STB_ADDNODE" +msgstr "Add Node to Dataflow" + +msgid "TOP_RUN" +msgstr "Run Dataflow" + +msgid "MEN_RUN" +msgstr "Run" + +msgid "STB_RUN" +msgstr "Run Dataflow" + +msgid "TOP_STEPBYSTEP" +msgstr "Step by Step execution" + +msgid "MEN_STEPBYSTEP" +msgstr "Step by Step" + +msgid "STB_STEPBYSTEP" +msgstr "Step by Step execution" + +msgid "TOP_KILL" +msgstr "Kill Running" + +msgid "MEN_KILL" +msgstr "Kill" + +msgid "STB_KILL" +msgstr "Kill Running" + +msgid "TOP_SUSPEND/RESUME" +msgstr "Suspend or Resume" + +msgid "MEN_SUSPEND/RESUME" +msgstr "Suspend/Resume" + +msgid "STB_SUSPEND/RESUME" +msgstr "Suspend or Resume" + +msgid "MEN_SUPERV" +msgstr "Supervisor" + +msgid "MEN_FILE" +msgstr "File" + +msgid "MEN_EDIT" +msgstr "Edit" + +msgid "TOOL_SUPERVISOR" +msgstr "Supervisor" + +msgid "TOOL_EXECUTION" +msgstr "Execution" diff --git a/src/Supervision/CNode_Impl.cxx b/src/Supervision/CNode_Impl.cxx index 03bba44..ac129a1 100644 --- a/src/Supervision/CNode_Impl.cxx +++ b/src/Supervision/CNode_Impl.cxx @@ -197,7 +197,7 @@ bool CNode_Impl::Delete() { DeletePorts() ; RetVal = DataFlowEditor()->RemoveNode( Name() ) ; if ( RetVal ) { - RetVal = DataFlowEditor()->UnValid() ; + DataFlowEditor()->UnValid() ; } } endService( "CNode_Impl::Delete" ); @@ -609,7 +609,8 @@ SUPERV::Port_ptr CNode_Impl::Port( const char * ServiceParameterName ) { hasinput = DataFlowEditor()->HasInput( anInPort->PortName() ) ; } if ( hasinput ) { - const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ; +//JR 30.03.2005 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ; + const CORBA::Any anAny = anInPort->GetOutPort()->Value() ; myPort = new Port_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , DataFlowEditor() , @@ -617,7 +618,7 @@ SUPERV::Port_ptr CNode_Impl::Port( const char * ServiceParameterName ) { // ServiceParameterName , (GraphBase::Port * ) anInPort , true , - anAny ) ; + &anAny ) ; } else { myPort = new Port_Impl( _Orb , _Poa , _ContId , @@ -653,7 +654,8 @@ SUPERV::Port_ptr CNode_Impl::Port( const char * ServiceParameterName ) { beginService( "CNode_Impl::Port" ); begin = false ; } - const CORBA::Any * anAny = anOutPort->Value() ; +//JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ; + const CORBA::Any anAny = anOutPort->Value() ; myPort = new Port_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , DataFlowEditor() , @@ -661,7 +663,7 @@ SUPERV::Port_ptr CNode_Impl::Port( const char * ServiceParameterName ) { // ServiceParameterName , (GraphBase::Port * ) anOutPort , false , - anAny ) ; + &anAny ) ; PortableServer::ObjectId * id = myPort->getId() ; CORBA::Object_var obj = _poa->id_to_reference(*id); iobject = SUPERV::Port::_narrow(obj) ; @@ -805,14 +807,15 @@ SUPERV::Port_ptr CNode_Impl::GetOutPort( const char *aParameterName ) { if ( anOutPort && !anOutPort->IsDataStream() ) { Outobject = anOutPort->ObjRef() ; if ( CORBA::is_nil( Outobject ) ) { - const CORBA::Any * anAny = anOutPort->Value() ; +//JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ; + const CORBA::Any anAny = anOutPort->Value() ; myOutPort = new Port_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , DataFlowEditor() , DataFlowNode() , (GraphBase::Port * ) anOutPort , false , - anAny ) ; + &anAny ) ; if ( myOutPort ) { PortableServer::ObjectId * id = myOutPort->getId() ; CORBA::Object_var obj = _poa->id_to_reference(*id) ; @@ -858,14 +861,15 @@ SUPERV::StreamPort_ptr CNode_Impl::GetOutStreamPort( const char *aParameterName if ( anOutPort && anOutPort->IsDataStream() ) { Outobject = SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ; if ( CORBA::is_nil( Outobject ) ) { - const CORBA::Any * anAny = anOutPort->Value() ; +//JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ; + const CORBA::Any anAny = anOutPort->Value() ; myOutStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , DataFlowEditor() , DataFlowNode() , (GraphBase::Port * ) anOutPort , false , - anAny ) ; + &anAny ) ; if ( myOutStreamPort ) { PortableServer::ObjectId * id = myOutStreamPort->getId() ; CORBA::Object_var obj = _poa->id_to_reference(*id) ; @@ -1001,14 +1005,15 @@ SUPERV::ListOfPorts * CNode_Impl::Ports() { // << "/" << anInPort->IsNotConnected() ) ; Port_Impl * myPort ; if ( DataFlowNode()->HasInput( anInPort->PortName() ) ) { - const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ; +//JR 30.03.2005 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ; + const CORBA::Any anAny = anInPort->GetOutPort()->Value() ; myPort = new Port_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , DataFlowEditor() , DataFlowNode() , (GraphBase::Port * ) anInPort , true , - anAny ) ; + &anAny ) ; } else { myPort = new Port_Impl( _Orb , _Poa , _ContId , @@ -1051,14 +1056,15 @@ SUPERV::ListOfPorts * CNode_Impl::Ports() { } else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) { // MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ; - const CORBA::Any * anAny = anOutPort->Value() ; +//JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ; + const CORBA::Any anAny = anOutPort->Value() ; Port_Impl * myPort = new Port_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , DataFlowEditor() , DataFlowNode() , (GraphBase::Port * ) anOutPort , false , - anAny ) ; + &anAny ) ; PortableServer::ObjectId * id = myPort->getId() ; CORBA::Object_var obj = _poa->id_to_reference(*id); SUPERV::Port_var iobject ; @@ -1095,14 +1101,15 @@ SUPERV::ListOfPorts * CNode_Impl::Ports() { } Port_Impl * myPort ; if ( anOutPort->IsDataConnected() ) { - const CORBA::Any * anAny = anOutPort->Value() ; +//JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ; + const CORBA::Any anAny = anOutPort->Value() ; myPort = new Port_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , DataFlowEditor() , DataFlowNode() , (GraphBase::Port * ) anOutPort , true , - anAny ) ; + &anAny ) ; } else { myPort = new Port_Impl( _Orb , _Poa , _ContId , @@ -1141,14 +1148,15 @@ SUPERV::ListOfPorts * CNode_Impl::Ports() { } Port_Impl * myPort ; if ( anInPort->IsDataConnected() ) { - const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ; +//JR 30.03.2005 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ; + const CORBA::Any anAny = anInPort->GetOutPort()->Value() ; myPort = new Port_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , DataFlowEditor() , DataFlowNode() , (GraphBase::Port * ) anInPort , false , - anAny ) ; + &anAny ) ; } else { myPort = new Port_Impl( _Orb , _Poa , _ContId , @@ -1219,14 +1227,15 @@ SUPERV::ListOfStreamPorts * CNode_Impl::StreamPorts() { << "/" << anInPort->IsNotConnected() ) ; StreamPort_Impl * myStreamPort ; if ( DataFlowNode()->HasInput( anInPort->PortName() ) ) { - const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ; +//JR 30.03.2005 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ; + const CORBA::Any anAny = anInPort->GetOutPort()->Value() ; myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , DataFlowEditor() , DataFlowNode() , (GraphBase::Port * ) anInPort , true , - anAny ) ; + &anAny ) ; } else { myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId , @@ -1270,14 +1279,15 @@ SUPERV::ListOfStreamPorts * CNode_Impl::StreamPorts() { } else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) { MESSAGE( "OutStreamPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ; - const CORBA::Any * anAny = anOutPort->Value() ; +//JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ; + const CORBA::Any anAny = anOutPort->Value() ; StreamPort_Impl * myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , DataFlowEditor() , DataFlowNode() , (GraphBase::Port * ) anOutPort , false , - anAny ) ; + &anAny ) ; PortableServer::ObjectId * id = myStreamPort->getId() ; CORBA::Object_var obj = _poa->id_to_reference(*id); SUPERV::StreamPort_var iobject ; @@ -1313,14 +1323,15 @@ SUPERV::ListOfStreamPorts * CNode_Impl::StreamPorts() { } StreamPort_Impl * myStreamPort ; if ( anOutPort->IsDataConnected() ) { - const CORBA::Any * anAny = anOutPort->Value() ; +//JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ; + const CORBA::Any anAny = anOutPort->Value() ; myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , DataFlowEditor() , DataFlowNode() , (GraphBase::Port * ) anOutPort , true , - anAny ) ; + &anAny ) ; } else { myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId , @@ -1360,14 +1371,15 @@ SUPERV::ListOfStreamPorts * CNode_Impl::StreamPorts() { } StreamPort_Impl * myStreamPort ; if ( anInPort->IsDataConnected() ) { - const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ; +//JR 30.03.2005 const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ; + const CORBA::Any anAny = anInPort->GetOutPort()->Value() ; myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , DataFlowEditor() , DataFlowNode() , (GraphBase::Port * ) anInPort , false , - anAny ) ; + &anAny ) ; } else { myStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId , diff --git a/src/Supervision/FNode_Impl.cxx b/src/Supervision/FNode_Impl.cxx index 391f4c1..88bdca8 100644 --- a/src/Supervision/FNode_Impl.cxx +++ b/src/Supervision/FNode_Impl.cxx @@ -98,8 +98,9 @@ bool FNode_Impl::Delete() { if ( DataFlowEditor()->IsEditing() ) { DeletePorts() ; RetVal = DataFlowEditor()->RemoveNode( Name() ) ; - if ( RetVal ) - RetVal = DataFlowEditor()->IsValid() ; + if ( RetVal ) { + DataFlowEditor()->UnValid() ; + } } // endService( "FNode_Impl::Delete" ); return RetVal ; diff --git a/src/Supervision/GNode_Impl.cxx b/src/Supervision/GNode_Impl.cxx index 7c770df..303cf3d 100644 --- a/src/Supervision/GNode_Impl.cxx +++ b/src/Supervision/GNode_Impl.cxx @@ -170,7 +170,7 @@ bool GNode_Impl::Delete() { DeletePorts() ; RetVal = DataFlowEditor()->RemoveNode( Name() ) ; if ( RetVal ) - RetVal = DataFlowEditor()->IsValid() ; + DataFlowEditor()->UnValid() ; } endService( "GNode_Impl::Delete" ); return RetVal ; diff --git a/src/Supervision/Graph_Impl.cxx b/src/Supervision/Graph_Impl.cxx index 125b051..25b3e3a 100644 --- a/src/Supervision/Graph_Impl.cxx +++ b/src/Supervision/Graph_Impl.cxx @@ -368,6 +368,15 @@ bool Graph_Impl::Export(const char * anXmlFile ) { return RetVal ; } +char * Graph_Impl::SavePY( bool importSuperV ) { + beginService( "Graph_Impl::SavePY" ); + ostringstream fstring ; + bool RetVal ; + RetVal = DataFlowEditor()->SavePY( fstring , importSuperV ) ; + fstring << ends ; + endService( "Graph_Impl::SavePY" ); + return CORBA::string_dup( fstring.str().c_str() ); +} SUPERV::CNode_ptr Graph_Impl::CNode( const SALOME_ModuleCatalog::Service &NodeService ) { beginService( "Graph_Impl::CNode" ); SUPERV::CNode_var iobject = SUPERV::CNode::_nil() ; @@ -522,9 +531,10 @@ SUPERV::LNode_ptr Graph_Impl::LNode( const char * InitName , myEndNode->SetObjRef( SUPERV::ELNode::_duplicate( iendobject ) ) ; myNode->SetCoupled( myEndNode->BaseNode()->Name() ) ; myEndNode->SetCoupled( myNode->BaseNode()->Name() ) ; - Link( myNode->Port( "DoLoop" ) , myEndNode->Port( "DoLoop" ) ) ; +//JR 25.01.2005 That links are already done in SetCoupled above ... +// Link( myNode->Port( "DoLoop" ) , myEndNode->Port( "DoLoop" ) ) ; // Link( myEndNode->Port( "DoLoop" ) , myNode->Port( "InitLoop" ) ) ; - Link( myEndNode->Port( "DoLoop" ) , myNode->Port( "DoLoop" ) ) ; +// Link( myEndNode->Port( "DoLoop" ) , myNode->Port( "DoLoop" ) ) ; } } anEndOfLoop = SUPERV::ELNode::_duplicate( iendobject ) ; @@ -821,7 +831,8 @@ SUPERV::Graph_var Graph_Impl::LoadDataFlows( GraphExecutor::DataFlow * aDataFlow const GraphBase::InPort * anInPort = aMacroNode->GetNodeInPort( q ) ; if ( anInPort->IsDataConnected() ) { const char* aMacroGraphInPortName = aMacroGraph->GetNodeInPort( q )->PortName(); - if ( !aMacroGraphExecutor->InputOfAny( aMacroGraphInPortName, *anInPort->GetOutPort()->Value(),false ) ) { +//JR 30.03.2005 if ( !aMacroGraphExecutor->InputOfAny( aMacroGraphInPortName, *anInPort->GetOutPort()->Value(),false ) ) { + if ( !aMacroGraphExecutor->InputOfAny( aMacroGraphInPortName, anInPort->GetOutPort()->Value(),false ) ) { return SUPERV::Graph::_duplicate( SUPERV::Graph::_nil() ) ; } else { @@ -1379,8 +1390,15 @@ SUPERV::ListOfNodes * Graph_Impl::Nodes() { RetVal->Graphs.length(0) ; if ( !IsMacro() ) { int i ; + cout << DataFlowEditor()->Graph()->GetGraphNodeSize() << " Nodes in the Map and " + << DataFlowEditor()->Graph()->GraphNodesSize() << " Nodes int the Vector" << endl ; for ( i = 0 ; i < DataFlowEditor()->Graph()->GraphNodesSize() ; i++ ) { GraphBase::ComputingNode * aNode = DataFlowEditor()->Graph()->GraphNodes( i ) ; +#if 1 + cout << i << ". Vector : " << aNode->Name() << " Map : " + << DataFlowEditor()->Graph()->GetGraphNode( aNode->Name() )->Name() + << endl ; +#endif RetVal = SetNode( RetVal , aNode ) ; } #if 0 @@ -1476,8 +1494,10 @@ SUPERV::ListOfLinks * Graph_Impl::Links( GraphBase::ComputingNode * theNode , // << anOutPort->PortName() << ") --> " << aNode->Name() << "(" // << anInPort->PortName() << ")" ) ; if ( theNode == NULL || - ( theNode != NULL && !theNode->IsEndSwitchNode() && - !strcmp( theNode->Name() , aNode->Name() ) ) ) { +//PAL8521 +//JR 14.02.2005 : Debug : we must see also that links ! +// ( theNode != NULL && !theNode->IsEndSwitchNode() && + !strcmp( theNode->Name() , aNode->Name() ) ) { if ( anInPort->IsLoop() || anOutPort->IsLoop() || ( aNode->IsEndLoopNode() && !strcmp( aNode->CoupledNode()->Name() , anOutPort->NodeName() ) ) ) { @@ -1546,7 +1566,9 @@ SUPERV::ListOfLinks * Graph_Impl::Links( GraphBase::ComputingNode * theNode , if ( theNode == NULL || !strcmp( theNode->Name() , aNode->Name() ) ) { if ( !anInPort->IsDataStream() ) { - if ( theNode || ( toNode->IsEndSwitchNode() && !aNode->IsSwitchNode() ) ) { +//PAL8521 +//JR 14.02.2005 : Debug : we must see also that links ! +// if ( theNode || ( toNode->IsEndSwitchNode() && !aNode->IsSwitchNode() ) ) { if ( anInputParam == NULL || !strcmp( anInPort->PortName() , anInputParam ) ) { if ( anInPort->IsLoop() || anOutPort->IsLoop() || @@ -1593,7 +1615,7 @@ SUPERV::ListOfLinks * Graph_Impl::Links( GraphBase::ComputingNode * theNode , // << anOutPort->PortName() << ") --> " << toNode->Name() << "(" // << anInPort->PortName() << ")" << " skipped" ) ; } - } +// } } } } diff --git a/src/Supervision/Graph_Impl.hxx b/src/Supervision/Graph_Impl.hxx index 3469f05..9e48ef5 100644 --- a/src/Supervision/Graph_Impl.hxx +++ b/src/Supervision/Graph_Impl.hxx @@ -107,6 +107,8 @@ class Graph_Impl : public POA_SUPERV::Graph , virtual bool Export(const char * aXmlFile ) ; + virtual char * SavePY( bool importSuperV ) ; + virtual SUPERV::CNode_ptr CNode( const SALOME_ModuleCatalog::Service &NodeService ) ; virtual SUPERV::FNode_ptr FNode( diff --git a/src/Supervision/INode_Impl.cxx b/src/Supervision/INode_Impl.cxx index 8797369..fe5d9ef 100644 --- a/src/Supervision/INode_Impl.cxx +++ b/src/Supervision/INode_Impl.cxx @@ -151,7 +151,7 @@ bool INode_Impl::Delete() { DeletePorts() ; RetVal = DataFlowEditor()->RemoveNode( Name() ) ; if ( RetVal ) - RetVal = DataFlowEditor()->UnValid() ; + DataFlowEditor()->UnValid() ; } // endService( "INode_Impl::Delete" ); return RetVal ; @@ -243,14 +243,15 @@ SUPERV::Port_ptr INode_Impl::OutPort( const char *aParameterName , if ( anOutPort ) { Outobject = anOutPort->ObjRef() ; if ( CORBA::is_nil( Outobject ) ) { - const CORBA::Any * anAny = anOutPort->Value() ; +//JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ; + const CORBA::Any anAny = anOutPort->Value() ; myOutPort = new Port_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , DataFlowEditor() , DataFlowNode() , (GraphBase::Port * ) anOutPort , false , - anAny ) ; + &anAny ) ; if ( myOutPort ) { PortableServer::ObjectId * id = myOutPort->getId() ; CORBA::Object_var obj = _poa->id_to_reference(*id) ; @@ -336,14 +337,15 @@ SUPERV::StreamPort_ptr INode_Impl::OutStreamPort( const char * aParameterName , if ( anOutPort ) { Outobject = SUPERV::StreamPort::_narrow( anOutPort->ObjRef() ) ; if ( CORBA::is_nil( Outobject ) ) { - const CORBA::Any * anAny = anOutPort->Value() ; +//JR 30.03.2005 const CORBA::Any * anAny = anOutPort->Value() ; + const CORBA::Any anAny = anOutPort->Value() ; myOutStreamPort = new StreamPort_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , DataFlowEditor() , DataFlowNode() , (GraphBase::Port * ) anOutPort , false , - anAny ) ; + &anAny ) ; if ( myOutStreamPort ) { PortableServer::ObjectId * id = myOutStreamPort->getId() ; CORBA::Object_var obj = _poa->id_to_reference(*id) ; diff --git a/src/Supervision/LNode_Impl.cxx b/src/Supervision/LNode_Impl.cxx index 05907bd..00d1823 100644 --- a/src/Supervision/LNode_Impl.cxx +++ b/src/Supervision/LNode_Impl.cxx @@ -94,7 +94,7 @@ void LNode_Impl::destroy() { aCoupled->destroy() ; } // Valid() only after deletion of the corresponding EndLoopNode : - DataFlowEditor()->IsValid() ; + DataFlowEditor()->UnValid() ; } endService( "LNode_Impl::Destroy" ); } diff --git a/src/Supervision/Makefile.in b/src/Supervision/Makefile.in index 60bce4d..1573c67 100755 --- a/src/Supervision/Makefile.in +++ b/src/Supervision/Makefile.in @@ -78,14 +78,15 @@ LIB_CLIENT_IDL = SALOME_ModuleCatalog.idl \ SALOME_Component.idl \ SALOMEDS.idl \ SUPERV.idl \ - SALOME_Exception.idl + SALOME_Exception.idl \ + SALOME_GenericObj.idl # Executables targets #BIN = SuperV_CheckOfUndefined BIN_SRC = BIN_SERVER_IDL = -CPPFLAGS+= $(PYTHON_INCLUDES) $(QT_MT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) \ +CPPFLAGS+= $(PYTHON_INCLUDES) $(QT_MT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(BOOST_CPPFLAGS)\ -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += -g -D__x86__ -D__linux__ -ftemplate-depth-42 -Wall \ -I${KERNEL_ROOT_DIR}/include/salome diff --git a/src/Supervision/Port_Impl.cxx b/src/Supervision/Port_Impl.cxx index 6aba031..8ca4b76 100644 --- a/src/Supervision/Port_Impl.cxx +++ b/src/Supervision/Port_Impl.cxx @@ -557,8 +557,8 @@ bool Port_Impl::IsDone() { if ( _DataFlowEditor ) { GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ; if ( _DataFlowExecutor ) { - RetVal = _DataFlowExecutor->IsDone( _DataFlowPort->NodeName() , - _DataFlowPort->PortName() ) ; + RetVal = _DataFlowExecutor->PortDone( _DataFlowPort->NodeName() , + _DataFlowPort->PortName() ) ; } } // endService( "Port_Impl::IsDone" ); diff --git a/src/Supervision/SNode_Impl.cxx b/src/Supervision/SNode_Impl.cxx index 3b6e210..3ea6e50 100644 --- a/src/Supervision/SNode_Impl.cxx +++ b/src/Supervision/SNode_Impl.cxx @@ -91,7 +91,7 @@ void SNode_Impl::destroy() { aCoupled->destroy() ; } // Valid() only after deletion of the corresponding EndSwitchNode : - DataFlowEditor()->IsValid() ; + DataFlowEditor()->UnValid() ; } endService( "SNode_Impl::Destroy" ); } diff --git a/src/Supervision/SuperV.py b/src/Supervision/SuperV.py index 7b7acbd..f68f82a 100644 --- a/src/Supervision/SuperV.py +++ b/src/Supervision/SuperV.py @@ -15,6 +15,7 @@ try : from salome import naming_service from salome import CORBA from salome import sg + from salome import SALOMEDS import SALOME_ModuleCatalog import SUPERV import SUPERV_idl @@ -54,6 +55,44 @@ SuperVision = lcc.FindOrLoadComponent("SuperVisionContainer","SUPERV") modulecatalog = naming_service.Resolve("/Kernel/ModulCatalog") +def createDataflowStudyObject( theStudy , aDataFlow , aBuilder ) : + aStudyObject = theStudy.FindObjectIOR( aDataFlow.G.getIOR() ) + if aStudyObject == None : + aComponent = theStudy.FindComponent( "SUPERV" ) + if aComponent == None : + print "createDataflowStudyObject Component SUPERV is None" + aComponent = aBuilder.NewComponent( "SUPERV" ) + anAttr = aBuilder.FindOrCreateAttribute(aComponent, "AttributeName") + aName = anAttr._narrow( SALOMEDS.AttributeName ) + aName.SetValue( modulecatalog.GetComponentInfo( "SUPERV" ).username ) + anAttr = aBuilder.FindOrCreateAttribute( aComponent , "AttributePixMap" ) + aPixmap = anAttr._narrow( SALOMEDS.AttributePixMap ) + aPixmap.SetPixMap( "ICON_OBJBROWSER_Supervision" ); + aBuilder.DefineComponentInstance( aComponent , SuperVision ) + print "createDataflowStudyObject Component SUPERV is created" + aStudyObject = aBuilder.NewObject( aComponent ) + anAttr = aBuilder.FindOrCreateAttribute( aStudyObject , "AttributeName" ) + aName = anAttr._narrow( SALOMEDS.AttributeName ) + aName.SetValue( aDataFlow.Name() ) + anAttr = aBuilder.FindOrCreateAttribute( aStudyObject , "AttributeIOR" ) + anIORAttr = anAttr._narrow( SALOMEDS.AttributeIOR ) + anIORAttr.SetValue( aDataFlow.G.getIOR() ) + return aStudyObject + +def addDataflowToStudy( theStudy , aDataFlow ) : + aBuilder = theStudy.NewBuilder() + aBuilder.NewCommand() + aStudyObject = createDataflowStudyObject( theStudy , aDataFlow , aBuilder ) + if aStudyObject != None : + aBuilder.CommitCommand() + sg.updateObjBrowser( 1 ) + print "addDataflowToStudy aStudyObject ",aDataFlow.Name()," added in study" + #theStudy.updateObjBrowser() + else : + print "addDataflowToStudy ERROR aStudyObject is None" + aBuilder.AbortCommand() + return aBuilder,aStudyObject + def PortInputFloat(obj, x): return obj.Input( SuperVision.AnyValue( CORBA.Any(CORBA.TC_double, x))) diff --git a/src/Supervision/SuperV_Impl.cxx b/src/Supervision/SuperV_Impl.cxx index ad556e9..fcf7415 100644 --- a/src/Supervision/SuperV_Impl.cxx +++ b/src/Supervision/SuperV_Impl.cxx @@ -89,6 +89,160 @@ void SuperV_Impl::Destroy() { endService( "SuperV_Impl::Destroy" ); } +Engines::TMPFile * SuperV_Impl::DumpPython( CORBA::Object_ptr theStudy , + CORBA::Boolean isPublished , + CORBA::Boolean & isValidScript ) { + beginService( "Super_Impl::DumpPython" ); + bool success = true ; + SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow( theStudy ) ; +// typedef sequence TMPFile; + Engines::TMPFile_var aStreamPythonvar ; + SALOMEDS::SObject_var aStudyObject ; + SALOMEDS::SObject_var aStudyObjectValue ; + SUPERV::StreamGraph_var aStreamGraph ; + char * aGraph ; + string aStringGraph ; + string aStringRebuildData ; + aStringGraph = + "### This file is generated by SALOME automatically by dump python funcitonality\n" + "### of Supervisor component\n\n"; + aStringRebuildData = "def RebuildData( theStudy ) :\n" ; + if ( CORBA::is_nil( aStudy ) ) { + MESSAGE( "aStudy is_nil" ) ; + success = false ; + } + else { + SALOMEDS::SObject_var aStudyObject = aStudy->FindComponent( ComponentDataType() ) ; + if ( CORBA::is_nil( aStudyObject ) ) { + MESSAGE( "aStudyObject is_nil" ) ; + success = false ; + } + else { + SALOMEDS::ChildIterator_var aStudyChildIterator = aStudy->NewChildIterator( aStudyObject ) ; + bool importSuperV = true ; + for ( aStudyChildIterator->InitEx( true ) ; aStudyChildIterator->More() ; + aStudyChildIterator->Next() ) { + aStudyObjectValue = aStudyChildIterator->Value() ; + int aDepth = aStudyObjectValue->Depth() ; + char * aStudyObjectValueIOR = aStudyObjectValue->GetIOR() ; + MESSAGE( "Super_Impl::DumpPython aStudyObjectValueIOR " << aStudyObjectValueIOR + << " Depth " << aDepth ) ; + if ( strlen( aStudyObjectValueIOR ) ) { + CORBA::Object_var obj = CORBA::Object::_nil() ; + try { + obj = _Orb->string_to_object( aStudyObjectValueIOR ) ; + if ( !CORBA::is_nil( obj ) ) { + aStreamGraph = SUPERV::StreamGraph::_narrow( obj ) ; + if ( !CORBA::is_nil( aStreamGraph ) ) { + MESSAGE( "aStreamGraph " << aStreamGraph->Name() ) ; + aStreamGraph->IsValid() ; + aGraph = aStreamGraph->SavePY( importSuperV ) ; + importSuperV = false ; + aStringGraph += string( aGraph ) ; + aStringRebuildData += " " ; + aStringRebuildData += aStreamGraph->Name() ; + aStringRebuildData += " = Def" ; + aStringRebuildData += aStreamGraph->Name() ; + aStringRebuildData += "()\n" ; + aStringRebuildData += " aBuilder,aStudyObject" ; + ostringstream astr ; + astr << aDepth ; + aStringRebuildData += astr.str() ; + aStringRebuildData += " = addDataflowToStudy( theStudy , " ; + aStringRebuildData += aStreamGraph->Name() ; + aStringRebuildData += " )\n" ; + isValidScript = true ; + } + else { + MESSAGE( "Super_Impl::DumpPython aStreamGraph is_nil ERROR" ) ; + success = false ; + break ; + } + } + } + catch ( ... ) { + char * aStudyObjectName = aStudyObjectValue->GetName() ; + ostringstream newastr ; + ostringstream astr ; + if ( strlen( aStudyObjectName ) ) { + MESSAGE( "Super_Impl::DumpPython aStudyObjectName " << aStudyObjectName ) ; + aStringRebuildData += " aStudyObject" ; + astr << aDepth ; + aStringRebuildData += astr.str() ; + aStringRebuildData += " = aBuilder.NewObject( aStudyObject" ; + newastr << (aDepth - 1 ) ; + aStringRebuildData += newastr.str() ; + aStringRebuildData += " )\n" ; + aStringRebuildData += " anAttr = aBuilder.FindOrCreateAttribute( aStudyObject" ; + aStringRebuildData += astr.str() ; + aStringRebuildData += " , 'AttributeName' )\n" ; + aStringRebuildData += " aName = anAttr._narrow( SALOMEDS.AttributeName )\n" ; + aStringRebuildData += " aName.SetValue( '" ; + aStringRebuildData += aStudyObjectName ; + aStringRebuildData += "' )\n" ; + } + else { + MESSAGE( "Super_Impl::DumpPython strlen( aStudyObjectName ) == 0 ERROR" ) ; + success = false ; + break ; + } + MESSAGE( "Super_Impl::DumpPython aStudyObjectValueIOR " << aStudyObjectValueIOR ) ; +//String in fact + aStringRebuildData += " anAttr = aBuilder.FindOrCreateAttribute( aStudyObject" ; + aStringRebuildData += astr.str() ; + aStringRebuildData += " , 'AttributeIOR')\n"; + aStringRebuildData += " anIORAttr = anAttr._narrow( SALOMEDS.AttributeIOR )\n"; + aStringRebuildData += " anIORAttr.SetValue( '" ; + aStringRebuildData += aStudyObjectValueIOR ; + aStringRebuildData += "' )\n" ; + } + } + else { + char * aStudyObjectName = aStudyObjectValue->GetName() ; + if ( strlen( aStudyObjectName ) ) { + MESSAGE( "Super_Impl::DumpPython aStudyObjectName " << aStudyObjectName << " Depth " + << aDepth ) ; + aStringRebuildData += " aStudyObject" ; + ostringstream astr ; + astr << aDepth ; + aStringRebuildData += astr.str() ; + aStringRebuildData += " = aBuilder.NewObject( aStudyObject" ; + ostringstream newastr ; + newastr << (aDepth - 1 ) ; + aStringRebuildData += newastr.str() ; + aStringRebuildData += " )\n" ; + aStringRebuildData += " anAttr = aBuilder.FindOrCreateAttribute( aStudyObject" ; + aStringRebuildData += astr.str() ; + aStringRebuildData += " , 'AttributeName' )\n" ; + aStringRebuildData += " aName = anAttr._narrow( SALOMEDS.AttributeName )\n" ; + aStringRebuildData += " aName.SetValue( '" ; + aStringRebuildData += aStudyObjectName ; + aStringRebuildData += "' )\n" ; + } + else { + MESSAGE( "Super_Impl::DumpPython strlen( aStudyObjectName ) == 0 ERROR" ) ; + success = false ; + break ; + } + } + } + } + } + if ( !success ) { + isValidScript = false ; + endService( "Super_Impl::DumpPython ERROR" ); + return new Engines::TMPFile( 0 ) ; + } + aStringRebuildData += " sg.updateObjBrowser( 1 )\n" ; + aStringRebuildData += " return 1\n" ; + aStringGraph += aStringRebuildData ; + int aLen = strlen( aStringGraph.c_str() ) ; + CORBA::Octet * anOctetBuffer = (CORBA::Octet * ) aStringGraph.c_str() ; + aStreamPythonvar = new Engines::TMPFile ( aLen+1 , aLen+1 , anOctetBuffer ,1 ) ; + endService( "Super_Impl::DumpPython" ); + return aStreamPythonvar._retn() ; +} + // void SuperV_Impl::Save(const char *IORSComponent, const char *aUrlOfFile) { SALOMEDS::TMPFile* SuperV_Impl::Save(SALOMEDS::SComponent_ptr theComponent, const char* theURL, diff --git a/src/Supervision/SuperV_Impl.hxx b/src/Supervision/SuperV_Impl.hxx index 6cfb02f..7be243c 100644 --- a/src/Supervision/SuperV_Impl.hxx +++ b/src/Supervision/SuperV_Impl.hxx @@ -65,6 +65,10 @@ class SuperV_Impl : public POA_SUPERV::SuperG , virtual ~SuperV_Impl() ; virtual void Destroy() ; + Engines::TMPFile * DumpPython( CORBA::Object_ptr theStudy , + CORBA::Boolean isPublished , + CORBA::Boolean & isValidScript ) ; + // void Save(const char* IORSComponent, const char* aUrlOfFile); // void Load(const char* IORSComponent, const char* aUrlOfFile); SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent, diff --git a/src/Supervision/Value_Impl.cxx b/src/Supervision/Value_Impl.cxx index 9b948e6..96e7d75 100644 --- a/src/Supervision/Value_Impl.cxx +++ b/src/Supervision/Value_Impl.cxx @@ -154,6 +154,7 @@ bool Value_Impl::Input( const CORBA::Any * anAny ) { } CORBA::Any * Value_Impl::ToAny() { + beginService( "Value_Impl::ToAny" ); CORBA::Any * anAny ; if ( _DataFlowEditor ) { char * name ; @@ -163,6 +164,7 @@ CORBA::Any * Value_Impl::ToAny() { else { name = _DataFlowEditor->Graph()->Name() ; } + MESSAGE( "ToAny " << name<< "( " << _ParameterName << " )" ) ; if ( _InputPort ) { if ( _DataFlowNode ) { _InputValue = _DataFlowNode->HasInput( _ParameterName ) ; @@ -172,12 +174,14 @@ CORBA::Any * Value_Impl::ToAny() { } GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ; if ( _DataFlowExecutor ) { - anAny = new CORBA::Any( * _DataFlowExecutor->GetInData( name , - _ParameterName ) ) ; +//JR 30.03.2005 anAny = new CORBA::Any( * _DataFlowExecutor->GetInData( name , + anAny = new CORBA::Any( _DataFlowExecutor->GetInData( name , + _ParameterName ) ) ; } else if ( _InputValue ) { - anAny = new CORBA::Any( * _DataFlowEditor->GetInData( name , - _ParameterName ) ) ; +//JR 30.03.2005 anAny = new CORBA::Any( * _DataFlowEditor->GetInData( name , + anAny = new CORBA::Any( _DataFlowEditor->GetInData( name , + _ParameterName ) ) ; } else { anAny = new CORBA::Any( *_Any ) ; @@ -186,8 +190,9 @@ CORBA::Any * Value_Impl::ToAny() { else { GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ; if ( _DataFlowExecutor ) { - anAny = new CORBA::Any( * _DataFlowExecutor->GetOutData( name , - _ParameterName ) ) ; +//JR 30.03.2005 anAny = new CORBA::Any( * _DataFlowExecutor->GetOutData( name , + anAny = new CORBA::Any( _DataFlowExecutor->GetOutData( name , + _ParameterName ) ) ; } else { anAny = new CORBA::Any( *_Any ) ; @@ -197,12 +202,14 @@ CORBA::Any * Value_Impl::ToAny() { else { anAny = new CORBA::Any( *_Any ) ; } + endService( "Value_Impl::ToAny" ); return anAny ; } char * Value_Impl::ToString() { // beginService( "Value_Impl::ToString" ); - CORBA::Any anAny = *ToAny() ; +//JR 22.03.2005 Memory Leak CORBA::Any anAny = *ToAny() ; + CORBA::Any anAny ; if ( _DataFlowEditor ) { char * name ; if ( _DataFlowNode ) { @@ -211,7 +218,7 @@ char * Value_Impl::ToString() { else { name = _DataFlowEditor->Graph()->Name() ; } -// cout << "Value_Impl::ToString " << name << " " << _ParameterName << " " ; +// MESSAGE( "ToString " << name<< "( " << _ParameterName << " )" ) ; if ( _InputPort ) { if ( _DataFlowNode ) { _InputValue = _DataFlowNode->HasInput( _ParameterName ) ; @@ -221,15 +228,20 @@ char * Value_Impl::ToString() { } GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ; if ( _DataFlowExecutor ) { -// cout << "_DataFlowExecutor->GetInData" << endl ; - anAny = * _DataFlowExecutor->GetInData( name , - _ParameterName ) ; +// cout << "-->_DataFlowExecutor->GetInData " << name << " " << _ParameterName << endl ; +//JR 30.03.2005 const CORBA::Any * AnyPtr = _DataFlowExecutor->GetInData( name , + const CORBA::Any AnyRef = _DataFlowExecutor->GetInData( name , + _ParameterName ) ; +//JR 30.03.2005 cout << "<--_DataFlowExecutor->GetInData " << AnyPtr << endl ; +//JR 30.03.2005 anAny = * AnyPtr ; + anAny = AnyRef ; } else if ( _InputValue ) { // cout << "_DataFlowEditor->GetInData _DataFlowNode " << _DataFlowNode // << " _InputValue " << _InputValue << endl ; - anAny = * _DataFlowEditor->GetInData( name , - _ParameterName ) ; +//JR 30.03.2005 anAny = * _DataFlowEditor->GetInData( name , + anAny = _DataFlowEditor->GetInData( name , + _ParameterName ) ; } else { anAny = *_Any ; @@ -238,8 +250,13 @@ char * Value_Impl::ToString() { else { GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ; if ( _DataFlowExecutor ) { - anAny = * _DataFlowExecutor->GetOutData( name , - _ParameterName ) ; +// cout << "-->_DataFlowExecutor->GetOutData " << name << " " << _ParameterName << endl ; +//JR 30.03.2005 const CORBA::Any * AnyPtr = _DataFlowExecutor->GetOutData( name , + const CORBA::Any AnyRef = _DataFlowExecutor->GetOutData( name , + _ParameterName ) ; +//JR 30.03.2005 cout << "<--_DataFlowExecutor->GetOutData " << AnyPtr << endl ; +//JR 30.03.2005 anAny = * AnyPtr ; + anAny = AnyRef ; } else { anAny = *_Any ; @@ -315,27 +332,31 @@ bool Value_Impl::IsIOR() { _InputValue = _DataFlowEditor->HasInput( _ParameterName ) ; } if ( _InputValue && _DataFlowEditor->IsEditing() ) { - anAny = * _DataFlowEditor->GetInData( name , - _ParameterName ) ; +//JR 30.03.2005 anAny = * _DataFlowEditor->GetInData( name , + anAny = _DataFlowEditor->GetInData( name , + _ParameterName ) ; } else { GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ; if ( _DataFlowExecutor ) { - anAny = * _DataFlowExecutor->GetInData( name , - _ParameterName ) ; +//JR 30.03.2005 anAny = * _DataFlowExecutor->GetInData( name , + anAny = _DataFlowExecutor->GetInData( name , + _ParameterName ) ; } } } else { if ( _InputValue && _DataFlowEditor->IsEditing() ) { - anAny = * _DataFlowEditor->GetOutData( name , - _ParameterName ) ; +//JR 30.03.2005 anAny = * _DataFlowEditor->GetOutData( name , + anAny = _DataFlowEditor->GetOutData( name , + _ParameterName ) ; } else { GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ; if ( _DataFlowExecutor ) { - anAny = * _DataFlowExecutor->GetOutData( name , - _ParameterName ) ; +//JR 30.03.2005 anAny = * _DataFlowExecutor->GetOutData( name , + anAny = _DataFlowExecutor->GetOutData( name , + _ParameterName ) ; } } }