From: jfa Date: Fri, 7 Mar 2008 07:47:14 +0000 (+0000) Subject: Join modifications from BR_Dev_For_4_0 tag V4_1_1. X-Git-Tag: mergefrom_BR_Dev_For_4_0_07Mar2008 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=HEAD;p=modules%2Fsuperv.git Join modifications from BR_Dev_For_4_0 tag V4_1_1. --- diff --git a/adm_local/unix/make_commence.in b/adm_local/unix/make_commence.in index 3e8f8b8..d1a7049 100644 --- a/adm_local/unix/make_commence.in +++ b/adm_local/unix/make_commence.in @@ -1,6 +1,8 @@ # common directories to put headerfiles inc_builddir=$(top_builddir)/include/salome +MODULE_NAME=@MODULE_NAME@ + @SET_MAKE@ SHELL=/bin/sh @@ -138,7 +140,7 @@ OMNIORB_LIBS = @OMNIORB_LIBS@ OMNIORB_CXXFLAGS = @OMNIORB_CXXFLAGS@ OMNIORB_IDL = @OMNIORB_IDL@ -OMNIORB_IDLCXXFLAGS = @OMNIORB_IDLCXXFLAGS@ +OMNIORB_IDLCXXFLAGS = -Wba @OMNIORB_IDLCXXFLAGS@ OMNIORB_IDLPYFLAGS = @OMNIORB_IDLPYFLAGS@ -I$(top_srcdir)/idl -I$(top_builddir)/idl/salome -I$(KERNEL_ROOT_DIR)/idl/salome OMNIORB_IDL_CLN_H = @OMNIORB_IDL_CLN_H@ @@ -223,7 +225,7 @@ idldir=${prefix}/idl/salome sharedpydir=@exec_prefix@/lib@LIB_LOCATION_SUFFIX@/python$(PYTHON_VERSION)/site-packages/salome/shared_modules incmakedir=${prefix}/salome_adm/unix -docdir=${prefix}/doc/salome +docdir=${prefix}/share/doc/salome # # begin of package rules @@ -273,11 +275,21 @@ ac_cxx_partial_specialization.m4 python.m4 \ ac_cxx_typename.m4 check_pthreads.m4 check_cas.m4 \ ac_cc_warnings.m4 check_swig.m4 +ifeq ($(SUPERV_WITH_GUI),yes) ACLOCAL_GUI = \ check_vtk.m4 check_opengl.m4 check_qt.m4 \ check_GUI.m4 check_corba_in_GUI.m4 $(top_srcdir)/aclocal.m4: $(ACLOCAL_SRC:%=@KERNEL_ROOT_DIR@/salome_adm/unix/config_files/%) \ $(ACLOCAL_GUI:%=@GUI_ROOT_DIR@/adm_local/unix/config_files/%) - cd $(top_srcdir) ; aclocal --acdir=adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files \ - -I @GUI_ROOT_DIR@/adm_local/unix/config_files + cd $(top_srcdir) ; aclocal -I adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files \ + -I @GUI_ROOT_DIR@/adm_local/unix/config_files +endif + +ifeq ($(SUPERV_WITH_GUI),no) +$(top_srcdir)/aclocal.m4: $(ACLOCAL_SRC:%=@KERNEL_ROOT_DIR@/salome_adm/unix/config_files/%) \ + $(ACLOCAL_GUI:%=@GUI_ROOT_DIR@/adm_local/unix/config_files/%) + cd $(top_srcdir) ; aclocal -I adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_file +s +endif + diff --git a/build_configure b/build_configure index 9590506..5de36b8 100755 --- a/build_configure +++ b/build_configure @@ -12,6 +12,23 @@ ORIG_DIR=`pwd` CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"` +######################################################################## +# Check --with-kernel option + +SUPERV_WITH_GUI="yes" + +for option +do + case $option in + -with-ihm | --with-ihm) + SUPERV_WITH_GUI="yes" + break;; + -without-ihm | --without-ihm | -with-ihm=no | --with-ihm=no) + SUPERV_WITH_GUI="no" + break;; + esac +done + ######################################################################## # Test if the KERNEL_ROOT_DIR is set correctly @@ -29,9 +46,11 @@ fi ######################################################################## # Test if the GUI_ROOT_DIR is set correctly -if test ! -d "${GUI_ROOT_DIR}"; then +if test ${SUPERV_WITH_GUI} = yes; then + if test ! -d "${GUI_ROOT_DIR}"; then echo "failed : GUI_ROOT_DIR variable is not correct !" exit + fi fi ######################################################################## @@ -211,8 +230,15 @@ else echo -n "Creating 'configure' script ... " fi -aclocal -I adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \ - -I ${GUI_ROOT_DIR}/adm_local/unix/config_files +if test ${SUPERV_WITH_GUI} = yes; then + aclocal -I adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \ + -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files/DEPRECATED \ + -I ${GUI_ROOT_DIR}/adm_local/unix/config_files +else + aclocal -I adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \ + -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files/DEPRECATED +fi + if autoconf then echo "done" diff --git a/configure.in.base b/configure.in.base index 056ea39..b4e0be0 100644 --- a/configure.in.base +++ b/configure.in.base @@ -16,17 +16,21 @@ # AC_INIT(src) -AC_CONFIG_AUX_DIR(${KERNEL_ROOT_DIR}/salome_adm/unix/config_files) +AC_CONFIG_AUX_DIR(${KERNEL_ROOT_DIR}/salome_adm/unix/config_files/DEPRECATED) AC_CANONICAL_HOST PACKAGE=salome AC_SUBST(PACKAGE) -VERSION=3.2.0 -XVERSION=0x030200 +VERSION=4.1.1 +XVERSION=0x040101 AC_SUBST(VERSION) AC_SUBST(XVERSION) +# set up MODULE_NAME variable for dynamic construction of directories (resources, etc.) +MODULE_NAME=superv +AC_SUBST(MODULE_NAME) + dnl dnl Initialize source and build root directories dnl @@ -200,14 +204,6 @@ AC_SUBST_FILE(CORBA) corba=make_$ORB CORBA=adm_local/unix/$corba -echo -echo --------------------------------------------- -echo testing openGL -echo --------------------------------------------- -echo - -CHECK_OPENGL - echo echo --------------------------------------------- echo testing QT @@ -216,21 +212,41 @@ echo CHECK_QT -echo -echo --------------------------------------------- -echo testing MSG2QM -echo --------------------------------------------- -echo +dnl +dnl --------------------------------------------- +dnl testing WITHIHM +dnl --------------------------------------------- +dnl -CHECK_MSG2QM +CHECK_WITHIHM -echo -echo --------------------------------------------- -echo testing VTK -echo --------------------------------------------- -echo +if test "X$WITHIHM" = "Xyes"; then + + echo + echo --------------------------------------------- + echo testing openGL + echo --------------------------------------------- + echo + + CHECK_OPENGL -CHECK_VTK + echo + echo --------------------------------------------- + echo testing MSG2QM + echo --------------------------------------------- + echo + + CHECK_MSG2QM + + echo + echo --------------------------------------------- + echo testing VTK + echo --------------------------------------------- + echo + + CHECK_VTK + +fi echo echo --------------------------------------------- @@ -264,25 +280,28 @@ echo CHECK_HTML_GENERATORS -echo -echo -echo --------------------------------------------- -echo Testing GUI -echo --------------------------------------------- -echo - -CHECK_SALOME_GUI - -echo -echo --------------------------------------------- -echo Testing full GUI -echo --------------------------------------------- -echo - -CHECK_CORBA_IN_GUI -if test "x${CORBA_IN_GUI}" != "xyes"; then - echo "failed : For configure SUPERV module necessary full GUI !" - exit +if test "X$WITHIHM" = "Xyes"; then + + echo + echo + echo --------------------------------------------- + echo Testing GUI + echo --------------------------------------------- + echo + + CHECK_SALOME_GUI + + echo + echo --------------------------------------------- + echo Testing full GUI + echo --------------------------------------------- + echo + + CHECK_CORBA_IN_GUI + if test "x${CORBA_IN_GUI}" != "xyes"; then + echo "failed : For configure SUPERV module necessary full GUI !" + exit + fi fi echo --------------------------------------------- @@ -299,7 +318,12 @@ echo --------------------------------------------- echo echo Configure -variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok boost_ok occ_ok doxygen_ok graphviz_ok Kernel_ok" +if test "X$WITHIHM" = "Xyes"; then + variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok boost_ok occ_ok doxygen_ok graphviz_ok Kernel_ok" +fi +if test "X$WITHIHM" = "Xno"; then + variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok qt_ok hdf5_ok omniORB_ok boost_ok occ_ok Kernel_ok" +fi for var in $variables do @@ -329,7 +353,7 @@ else fi # make other build directories -for rep in salome_adm adm_local doc bin/salome include/salome lib${LIB_LOCATION_SUFFIX}/salome share/salome/resources idl +for rep in salome_adm adm_local doc bin/salome include/salome lib${LIB_LOCATION_SUFFIX}/salome share/salome/resources/${MODULE_NAME} idl do # if test ! -d $rep ; then # eval mkdir $rep 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 5ae943a..531a709 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 @@ -1,131 +1,132 @@ - - - - - -Filtering and storing output messages - - - - - - - - - - - - - -

Filtering and logging - output messages

- -

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

- -

 

- -

To set filtering parameters:

- -

 

- -

Before execution of your graph right-click - 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:

- -

 

- -

- -

            

- -

In - this dialog box you can specify a file, where all output messages will - be put, and choose the type of messages for logging by every node composing - your graph.

- - - - + + + + + +Filtering and storing output messages + + + + + + + + + + + + + +

Filtering and logging + output messages

+ +

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

+ +

 

+ +

To set filtering parameters:

+ +

 

+ +

Before the execution of your graph right-click + 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:

+ +

 

+ +

+ +

            

+ +

In this dialog box you can specify a file + for all output messages sent by the component for notification purposes + and choose the type of messages for logging by every node composing your + graph.

+ + + + diff --git a/doc/salome/gui/SUPERV/index.html b/doc/salome/gui/SUPERV/index.html new file mode 100755 index 0000000..d73632a --- /dev/null +++ b/doc/salome/gui/SUPERV/index.html @@ -0,0 +1,180 @@ + + +Supervisor Module Reference Manual + + + + + + + + + + + + + diff --git a/doc/salome/tui/SUPERV/sources/bg_salome.gif b/doc/salome/tui/SUPERV/sources/bg_salome.gif deleted file mode 100755 index 677b704..0000000 Binary files a/doc/salome/tui/SUPERV/sources/bg_salome.gif and /dev/null differ diff --git a/idl/SUPERV.idl b/idl/SUPERV.idl index 959ddb7..4814940 100644 --- a/idl/SUPERV.idl +++ b/idl/SUPERV.idl @@ -671,19 +671,21 @@ executed for performing calculations, as well as input and output parameters for */ SUPERV::Port OutPort( in string aParameterName , in string aParameterType ) ; -/*! Creates an Input DataStreamPort in an Inline node. -\param aParameterName This value sets the name of the parameter which will be defined in this port. -\param aParameterType This value sets the type of the parameter which will be defined in this port. -*/ - SUPERV::StreamPort InStreamPort( in string aParameterName , in SALOME_ModuleCatalog::DataStreamType aParameterType , in SALOME_ModuleCatalog::DataStreamDependency aDependency ) ; + /*! Creates an Input DataStreamPort in an Inline node. + \param aParameterName This value sets the name of the parameter which will be defined in this port. + \param aParameterType This value sets the type of the parameter which will be defined in this port. + */ + SUPERV::StreamPort InStreamPort (in string aParameterName, in string aParameterType, + in SALOME_ModuleCatalog::DataStreamDependency aDependency); -/*! Creates an Output DataStreamPort in an Inline node. -\param aParameterName This value sets the name of the parameter which will be defined in this port. -\param aParameterType This value sets the type of the parameter which will be defined in this port. -*/ - SUPERV::StreamPort OutStreamPort( in string aParameterName , in SALOME_ModuleCatalog::DataStreamType aParameterType , in SALOME_ModuleCatalog::DataStreamDependency aDependency ) ; + /*! Creates an Output DataStreamPort in an Inline node. + \param aParameterName This value sets the name of the parameter which will be defined in this port. + \param aParameterType This value sets the type of the parameter which will be defined in this port. + */ + SUPERV::StreamPort OutStreamPort (in string aParameterName, in string aParameterType, + in SALOME_ModuleCatalog::DataStreamDependency aDependency); + }; - } ; /*! \brief %GNode class This class is necessary for management of GOTO/EndLoop/EndSwitch nodes in the dataflow. @@ -784,7 +786,7 @@ This interface includes a set of methods used for management of the graphs in %S SUPERV::FNode FNode( in string aComponentName , in string anInterfaceName , in SALOME_ModuleCatalog::Service aService , - in boolean isCimpl ) ; + in SALOME_ModuleCatalog::ImplType implType ) ; /*! Creates an InLine Node in a Graph. */ @@ -990,7 +992,19 @@ This interface includes a set of methods used for management of the graphs in %S /*! Forces use of Editor's data model and destroy of Executor */ void Editing(); - + + /*! Returns the default name of container for C component + */ + string DefaultCContainerName(); + + /*! Returns the default name of container for Python component + */ + string DefaultPythonContainerName(); + + /*! Returns the last container name associated with the ComponentName component + */ + string ContainerNameForComponent( in string ComponentName ); + } ; diff --git a/resources/SalomeApp.xml b/resources/SalomeApp.xml index 4848fae..70797d4 100644 --- a/resources/SalomeApp.xml +++ b/resources/SalomeApp.xml @@ -6,6 +6,6 @@
- +
diff --git a/src/GraphBase/DataFlowBase_Base.cxx b/src/GraphBase/DataFlowBase_Base.cxx index dc00155..2f75014 100644 --- a/src/GraphBase/DataFlowBase_Base.cxx +++ b/src/GraphBase/DataFlowBase_Base.cxx @@ -34,6 +34,7 @@ char *SuperVision_Version = "3.0" ; char *NULLSTRING = "" ; char *FACTORYSERVER = "localhost/FactoryServer" ; +char *FACTORYSERVERPY = "localhost/FactoryServerPy" ; GraphBase::Base::Base() { _prof_debug = NULL ; @@ -66,14 +67,14 @@ char * GraphBase::Base::ObjectToString( CORBA::Object_ptr obj ) const { return _Orb->object_to_string( obj ); } -CORBA::Object_ptr GraphBase::Base::StringToObject( char * obj ) const { +CORBA::Object_ptr GraphBase::Base::StringToObject( const char * obj ) const { return _Orb->string_to_object( obj ); } ostream & GraphBase::Base::AnyValue( const CORBA::Any & anAny ) { switch (anAny.type()->kind()) { case CORBA::tk_string: { - char * t; + const char * t; anAny >>= t; *_fdebug << " " << t << " (tk_string)" << endl ; break; @@ -97,7 +98,7 @@ ostream & GraphBase::Base::AnyValue( const CORBA::Any & anAny ) { break; } case CORBA::tk_long: { - long l; + CORBA::Long l; anAny >>= l; *_fdebug << " " << l << "(tk_long)" << endl ; break; @@ -150,6 +151,7 @@ ostream & GraphBase::Base::AnyValue( const CORBA::Any & anAny ) { return *_fdebug ; } +/* string DataStreamTypeToString( const SALOME_ModuleCatalog::DataStreamType aDataStreamType ) { string aIdlType ; switch ( aDataStreamType ) { @@ -210,6 +212,19 @@ SALOME_ModuleCatalog::DataStreamType StringToDataStreamType( const char * aIdlTy } return aDataStreamType ; } +*/ +int StringToDataStreamType (const char * aIdlType) +{ + int aDataStreamType; + if (!strcmp(aIdlType, "Unknown")) aDataStreamType = 0; //SALOME_ModuleCatalog::DATASTREAM_UNKNOWN + else if (!strcmp(aIdlType, "int")) aDataStreamType = 1; //SALOME_ModuleCatalog::DATASTREAM_INTEGER + else if (!strcmp(aIdlType, "float")) aDataStreamType = 2; //SALOME_ModuleCatalog::DATASTREAM_FLOAT + else if (!strcmp(aIdlType, "double")) aDataStreamType = 3; //SALOME_ModuleCatalog::DATASTREAM_DOUBLE + else if (!strcmp(aIdlType, "string")) aDataStreamType = 4; //SALOME_ModuleCatalog::DATASTREAM_STRING + else if (!strcmp(aIdlType, "bool")) aDataStreamType = 5; //SALOME_ModuleCatalog::DATASTREAM_BOOLEAN + else aDataStreamType = 0; //SALOME_ModuleCatalog::DATASTREAM_UNKNOWN + return aDataStreamType; +} string KindOfDataStreamTraceToString( SUPERV::KindOfDataStreamTrace aDataStreamTrace ) { string aTrace ; @@ -250,7 +265,24 @@ string DataStreamDependencyToString( const SALOME_ModuleCatalog::DataStreamDepen return aDependency; } -string DataStreamToString( const SALOME_ModuleCatalog::DataStreamType aDataStreamType ) { +string DataStreamToString (const char* aDataStreamType) +{ + string aStreamType ; + string type (aDataStreamType); + + if (type == "Unknown") aStreamType = "Unknown"; + else if (type == "int") aStreamType = "ENTIER"; + else if (type == "float") aStreamType = "REEL"; + else if (type == "double") aStreamType = "DOUBLE"; + else if (type == "string") aStreamType = "CHAINE"; + else if (type == "bool") aStreamType = "LOGIQUE"; + else aStreamType = "?"; + + return aStreamType; +} + +/* +string DataStreamToString( const char* aDataStreamType ) { string aStreamType ; switch ( aDataStreamType ) { case SALOME_ModuleCatalog::DATASTREAM_UNKNOWN : { @@ -312,4 +344,4 @@ ostream & operator<< (ostream & f ,const SALOME_ModuleCatalog::DataStreamType & return f; } - +*/ diff --git a/src/GraphBase/DataFlowBase_Base.hxx b/src/GraphBase/DataFlowBase_Base.hxx index 4dd042e..60cb36e 100644 --- a/src/GraphBase/DataFlowBase_Base.hxx +++ b/src/GraphBase/DataFlowBase_Base.hxx @@ -55,6 +55,7 @@ extern char *SuperVision_Version ; extern char *NULLSTRING ; extern char *FACTORYSERVER ; +extern char *FACTORYSERVERPY ; inline char * my_strdup( const char * s ) { if (s == NULL) return NULL; @@ -82,14 +83,14 @@ inline char * my_strblkdup( const char * s ) { return t; } -string DataStreamTypeToString( const SALOME_ModuleCatalog::DataStreamType aDataStreamType ) ; -SALOME_ModuleCatalog::DataStreamType StringToDataStreamType( const char * aIdlType ) ; +//string DataStreamTypeToString( const SALOME_ModuleCatalog::DataStreamType aDataStreamType ) ; +int StringToDataStreamType( const char * aIdlType ) ; string KindOfDataStreamTraceToString( SUPERV::KindOfDataStreamTrace aDataStreamTrace ) ; string DataStreamDependencyToString( const SALOME_ModuleCatalog::DataStreamDependency aDataStreamDependency ) ; -string DataStreamToString( const SALOME_ModuleCatalog::DataStreamType aDataStreamType ) ; +string DataStreamToString( const char* aDataStreamType ) ; //enum StatusOfPort { NotConnected , PortConnected , PortAndDataConnected , enum StatusOfPort { NotConnected , PortConnected , @@ -198,7 +199,7 @@ namespace GraphBase { int * prof_debug , ofstream * fdebug ) ; char * ObjectToString( CORBA::Object_ptr obj ) const ; - CORBA::Object_ptr StringToObject(char * obj ) const ; + CORBA::Object_ptr StringToObject(const char * obj ) const ; ostream & AnyValue( const CORBA::Any & anAny ); @@ -221,6 +222,6 @@ namespace GraphBase { } ; -ostream & operator<< (ostream &,const SALOME_ModuleCatalog::DataStreamType &); +//ostream & operator<< (ostream &,const SALOME_ModuleCatalog::DataStreamType &); #endif diff --git a/src/GraphBase/DataFlowBase_ComputingNode.cxx b/src/GraphBase/DataFlowBase_ComputingNode.cxx index 0439956..e77cb75 100644 --- a/src/GraphBase/DataFlowBase_ComputingNode.cxx +++ b/src/GraphBase/DataFlowBase_ComputingNode.cxx @@ -31,6 +31,39 @@ using namespace std; #include "DataFlowBase_StreamGraph.hxx" //#include "DataFlowBase_LoopNode.hxx" +// Screen single quotes +static string protectQuotes (const string theText) +{ + string aRes (theText); + unsigned int pos; + + // screen back slash + for (pos = 0; pos < aRes.size(); pos++) { + pos = aRes.find("\\", pos); + if (pos < 0 || pos > aRes.size()) break; + + aRes.insert(pos, "\\"); + pos++; + + // screen symbol after back slash (except single quote, which will be processed below) + if (pos + 1 < aRes.size() && aRes[pos + 1] != '\'') { + aRes.insert(pos + 1, "\\"); + pos += 2; + } + } + + // screen single quote + for (pos = 0; pos < aRes.size(); pos++) { + pos = aRes.find("'", pos); + if (pos < 0 || pos > aRes.size()) break; + + aRes.insert(pos, "\\"); + pos++; + } + + return aRes; +} + static void InitFields( //SUPERV::KindOfNode &_Kind , SUPERV::SDate &_FirstCreation , SUPERV::SDate &_LastModification , @@ -55,7 +88,7 @@ static void InitFields( //SUPERV::KindOfNode &_Kind , _FirstCreation.Hour = _LastModification.Hour = Tm->tm_hour; _FirstCreation.Day = _LastModification.Day = Tm->tm_mday; _FirstCreation.Month = _LastModification.Month = Tm->tm_mon + 1; - _FirstCreation.Year = _LastModification.Year = Tm->tm_year + 1900; + _FirstCreation.Year = _LastModification.Year = Tm->tm_year + 1900; _EditorRelease = new char[ strlen( SuperVision_Version ) + 1 ] ; strcpy( _EditorRelease , SuperVision_Version ) ; @@ -151,7 +184,7 @@ GraphBase::ComputingNode::ComputingNode( CORBA::ORB_ptr ORB , // cout << "GraphBase::ComputingNode::ComputingNode NO SetDebug" << endl ; // } DefPortsOfNode( ORB , SALOME_ModuleCatalog::Service() , NamePtr() , Kind() , Graph_prof_debug , Graph_fdebug ) ; - cdebug << "GraphBase::ComputingNode::ComputingNode " << this + cdebug << "GraphBase::ComputingNode::ComputingNode " << this << " Name '" << Name() << "' " << _FirstCreation << " " << _LastModification << endl ; } @@ -192,7 +225,7 @@ GraphBase::ComputingNode::ComputingNode( CORBA::ORB_ptr ORB , _FirstCreation.Hour = _LastModification.Hour = Tm->tm_hour; _FirstCreation.Day = _LastModification.Day = Tm->tm_mday; _FirstCreation.Month = _LastModification.Month = Tm->tm_mon + 1; - _FirstCreation.Year = _LastModification.Year = Tm->tm_year + 1900; + _FirstCreation.Year = _LastModification.Year = Tm->tm_year + 1900; if ( NodeEditorRelease != NULLSTRING ) { _EditorRelease = new char[ strlen( NodeEditorRelease ) + 1 ] ; @@ -247,7 +280,7 @@ GraphBase::ComputingNode::ComputingNode( CORBA::ORB_ptr ORB , DefPortsOfNode( ORB , aService , NamePtr() , Kind() , Graph_prof_debug , Graph_fdebug ) ; - cdebug << "GraphBase::ComputingNode::ComputingNode " << this + cdebug << "GraphBase::ComputingNode::ComputingNode " << this << " Name '" << Name() << "' KindOfNode " << Kind() << " ServiceName '" << ServiceName() << "' In(" << ServiceInParameter().length() @@ -257,7 +290,7 @@ GraphBase::ComputingNode::ComputingNode( CORBA::ORB_ptr ORB , } GraphBase::ComputingNode::~ComputingNode() { - cdebug << "GraphBase::ComputingNode::~ComputingNode " << this + cdebug << "GraphBase::ComputingNode::~ComputingNode " << this << " Name() "<< Name() << " _Comment " << (void *) _Comment << " " << _Comment << " " << endl ; } @@ -276,7 +309,7 @@ GraphBase::ComputingNode::~ComputingNode() { SUPERV::SDate GraphBase::ComputingNode::FirstCreation () const { // cdebug << "GraphBase::ComputingNode::FirstCreation " -// << " Name '" << Name() << "' " << _FirstCreation << " " +// << " Name '" << Name() << "' " << _FirstCreation << " " // << _LastModification << endl ; return _FirstCreation; } @@ -295,7 +328,7 @@ void GraphBase::ComputingNode::LastModification(const SUPERV::SDate aDate ) { bool GraphBase::ComputingNode::EditorRelease(const char * c){ if ( _EditorRelease && _EditorRelease != NULLSTRING ) - delete _EditorRelease; + delete [] _EditorRelease; _EditorRelease = my_strdup(c); return true ; } @@ -351,7 +384,7 @@ void GraphBase::ComputingNode::NodePort( const char * NodeName , bool GraphBase::ComputingNode::IsLinked(const char * ToServiceParameterName, bool isInput ) { bool RetVal = false ; if ( isInput ) { // mkr : PAL8060 - // we have to know the type of the port, because of input and output ports + // we have to know the type of the port, because of input and output ports // belong to one node may have the same names const GraphBase::InPort * thePort = GetInPort( ToServiceParameterName ) ; if ( thePort ) { @@ -421,8 +454,8 @@ void GraphBase::ComputingNode::SetMacroPorts( GraphBase::Graph * aGraph ) { << " " << anInPort->Kind() << endl ; GraphBase::InPort * aNewInPort ; if ( anInPort->IsDataStream() ) { - aNewInPort = AddInDataStreamPort( anInPort->PortName() , StringToDataStreamType( anInPort->PortType() ) , - anInPort->Dependency() , anInPort->Kind() ) ; + aNewInPort = AddInDataStreamPort( anInPort->PortName(), anInPort->PortType(), + anInPort->Dependency(), anInPort->Kind() ) ; } else if ( anInPort->IsParam() || anInPort->IsInLine() ) { aNewInPort = AddInPort( anInPort->PortName() , anInPort->PortType() , anInPort->Kind() ) ; @@ -433,8 +466,8 @@ void GraphBase::ComputingNode::SetMacroPorts( GraphBase::Graph * aGraph ) { cdebug << "SetMacroPorts Out" << i << " " << anOutPort->PortName() << " " << anOutPort->PortType() << " " << anOutPort->Kind() << endl ; if ( anOutPort->IsDataStream() ) { - AddOutDataStreamPort( anOutPort->PortName() , StringToDataStreamType( anOutPort->PortType() ) , - anOutPort->Dependency() , anOutPort->Kind() ) ; + AddOutDataStreamPort( anOutPort->PortName(), anOutPort->PortType(), + anOutPort->Dependency(), anOutPort->Kind() ) ; } else if ( anOutPort->IsParam() || anOutPort->IsInLine() ) { AddOutPort( anOutPort->PortName() , anOutPort->PortType() , anOutPort->Kind() ) ; @@ -848,8 +881,8 @@ void GraphBase::ComputingNode::DelOutDataStreamPort( const char * OutputParamete GraphBase::PortsOfNode::DelOutPort( OutputParameterName ) ; } -GraphBase::InDataStreamPort * GraphBase::ComputingNode::AddInDataStreamPort( const char * InputParameterName , - const SALOME_ModuleCatalog::DataStreamType InputParameterType , +GraphBase::InDataStreamPort * GraphBase::ComputingNode::AddInDataStreamPort( const char * InputParameterName, + const char * InputParameterType, const SALOME_ModuleCatalog::DataStreamDependency aDependency , const SUPERV::KindOfPort aKindOfPort , int index ) { @@ -858,7 +891,7 @@ GraphBase::InDataStreamPort * GraphBase::ComputingNode::AddInDataStreamPort( con aDataStreamPort = (GraphBase::InDataStreamPort * ) GraphBase::PortsOfNode::AddInPort( _ORB , NamePtr() , Kind() , InputParameterName , - DataStreamTypeToString( InputParameterType ).c_str() , + InputParameterType , aKindOfPort , index , _Graph_prof_debug , @@ -869,17 +902,17 @@ GraphBase::InDataStreamPort * GraphBase::ComputingNode::AddInDataStreamPort( con } return aDataStreamPort ; } -GraphBase::OutDataStreamPort * GraphBase::ComputingNode::AddOutDataStreamPort( const char * OutputParameterName , - const SALOME_ModuleCatalog::DataStreamType OutputParameterType , +GraphBase::OutDataStreamPort * GraphBase::ComputingNode::AddOutDataStreamPort( const char * OutputParameterName, + const char * OutputParameterType, const SALOME_ModuleCatalog::DataStreamDependency aDependency , const SUPERV::KindOfPort aKindOfPort , int index ) { // IncrDataStreamOutPorts() ; GraphBase::OutDataStreamPort * aDataStreamPort ; - aDataStreamPort = (GraphBase::OutDataStreamPort * ) GraphBase::PortsOfNode::AddOutPort( _ORB , NamePtr() , - Kind() , - OutputParameterName , - DataStreamTypeToString( OutputParameterType ).c_str() , + aDataStreamPort = (GraphBase::OutDataStreamPort * ) GraphBase::PortsOfNode::AddOutPort( _ORB , NamePtr(), + Kind(), + OutputParameterName, + OutputParameterType, aKindOfPort , index , _Graph_prof_debug , @@ -940,7 +973,7 @@ bool GraphBase::ComputingNode::CheckEndLoop(GraphBase::LoopNode * aLoopNode , << LinkedFromNodesSize() << " ERROR false" << endl; return false ; } -// We have to check that all nodes linked from that node go to the beginning of LoopNode : +// We have to check that all nodes linked from that node go to the beginning of LoopNode : for ( i = 0 ; i < LinkedFromNodesSize() ; i++ ) { GraphBase::ComputingNode * aNode = (GraphBase::ComputingNode * ) LinkedFromNodes( i ) ; cdebug << i << ". " << Name() << " Linked from " << aNode->Name() << endl ; @@ -1315,8 +1348,8 @@ bool GraphBase::ComputingNode::SaveXML( QDomDocument & Graph , QDomElement & inf DataStreamlist.appendChild(inParameter) ; QDomElement inParametertype = Graph.createElement("inParameter-type") ; QString aType ; - aType = aType.setNum( StringToDataStreamType( anInPort->PortType() ) ) ; - cdebug << "SaveXML " << anInPort->PortType() << " --> " << StringToDataStreamType( anInPort->PortType() ) + aType = aType.setNum( StringToDataStreamType(anInPort->PortType()) ) ; + cdebug << "SaveXML " << anInPort->PortType() << " --> " << anInPort->PortType() << " " << aType << endl ; aField = Graph.createTextNode( aType ) ; inParameter.appendChild(inParametertype) ; @@ -1375,8 +1408,8 @@ bool GraphBase::ComputingNode::SaveXML( QDomDocument & Graph , QDomElement & inf DataStreamlist.appendChild(outParameter) ; QDomElement outParametertype = Graph.createElement("outParameter-type") ; QString aType ; - aType = aType.setNum( StringToDataStreamType( anOutPort->PortType() ) ) ; - cdebug << "SaveXML " << anOutPort->PortType() << " --> " << StringToDataStreamType( anOutPort->PortType() ) + aType = aType.setNum( StringToDataStreamType(anOutPort->PortType()) ) ; + cdebug << "SaveXML " << anOutPort->PortType() << " --> " << anOutPort->PortType() << " " << aType << endl ; aField = Graph.createTextNode( aType ) ; outParameter.appendChild(outParametertype) ; @@ -1409,7 +1442,7 @@ bool GraphBase::ComputingNode::SaveXML( QDomDocument & Graph , QDomElement & inf cdebug << "SaveXML NumberOfValues " << ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() << endl ; } } -// f << Tabs << "" << endl ; +// f << Tabs << "" << endl ; // f << Tabs << "" << endl ; QDomElement PyFunctionlist = Graph.createElement("PyFunction-list") ; @@ -1574,15 +1607,15 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName , } f << " " << Name() << "_ServiceinStreamParameter = []" << endl ; for ( i = 0 ; i < (int ) ServiceInStreamParameter().length() ; i++ ) { - f << " " << Name() << "_ServiceinStreamParameter.append( SALOME_ModuleCatalog.ServicesDataStreamParameter( SALOME_ModuleCatalog." - << ServiceInStreamParameter()[i].Parametertype << " , '" + f << " " << Name() << "_ServiceinStreamParameter.append( SALOME_ModuleCatalog.ServicesDataStreamParameter( '" + << ServiceInStreamParameter()[i].Parametertype << "' , '" << ServiceInStreamParameter()[i].Parametername << "' , SALOME_ModuleCatalog." << ServiceInStreamParameter()[i].Parameterdependency << " ) )" << endl ; } f << " " << Name() << "_ServiceoutStreamParameter = []" << endl ; for ( i = 0 ; i < (int ) ServiceOutStreamParameter().length() ; i++ ) { - f << " " << Name() << "_ServiceoutStreamParameter.append( SALOME_ModuleCatalog.ServicesDataStreamParameter( SALOME_ModuleCatalog." - << ServiceOutStreamParameter()[i].Parametertype << " , '" + f << " " << Name() << "_ServiceoutStreamParameter.append( SALOME_ModuleCatalog.ServicesDataStreamParameter( '" + << ServiceOutStreamParameter()[i].Parametertype << "' , '" << ServiceOutStreamParameter()[i].Parametername << "' , SALOME_ModuleCatalog." << ServiceOutStreamParameter()[i].Parameterdependency << " ) )" << endl ; } @@ -1612,7 +1645,7 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName , if ( PythonFunctions.size() ) { aPyFunc = *PythonFunctions[0] ; for ( i = 0 ; i < (int ) aPyFunc.length() ; i++ ) { - f << " " << "Py" << Name() << ".append( '" << aPyFunc[i] << "' )" << endl ; + f << " " << "Py" << Name() << ".append( '" << protectQuotes(aPyFunc[i].in()) << "' )" << endl; } } if ( IsInLineNode() ) { @@ -1652,12 +1685,15 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName , SUPERV::ListOfStrings aPyMore = *PythonFunctions[1] ; SUPERV::ListOfStrings aPyNext = *PythonFunctions[2] ; f << " " << "PyMore" << Name() << " = []" << endl ; + for ( i = 0 ; i < (int ) aPyMore.length() ; i++ ) { - f << " " << "PyMore" << Name() << ".append( '" << aPyMore[i] << "' )" << endl ; + f << " " << "PyMore" << Name() << ".append( '" + << protectQuotes(aPyMore[i].in()) << "' )" << endl; } f << " " << "PyNext" << Name() << " = []" << endl ; for ( i = 0 ; i < (int ) aPyNext.length() ; i++ ) { - f << " " << "PyNext" << Name() << ".append( '" << aPyNext[i] << "' )" << endl ; + f << " " << "PyNext" << Name() << ".append( '" + << protectQuotes(aPyNext[i].in()) << "' )" << endl ; } f << " " << Name() << "," << EndName << " = " << aGraphName << ".LNode( '" << FuncNames[0].c_str() << "' , Py" << Name() << " , '" @@ -1672,8 +1708,8 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName , SUPERV::ListOfStrings aPyFunc = *aCoupledNode->PythonFunction() ; f << " " << "Py" << aCoupledNode->Name() << " = []" << endl ; for ( i = 0 ; i < (int ) aPyFunc.length() ; i++ ) { - f << " " << "Py" << aCoupledNode->Name() << ".append( '" << aPyFunc[i] << "' )" - << endl ; + f << " " << "Py" << aCoupledNode->Name() << ".append( '" + << protectQuotes(aPyFunc[i].in()) << "' )" << endl; } f << " " << EndName << ".SetPyFunction( '" << aCoupledNode->PyFuncName() << "' , Py" << aCoupledNode->Name() << " )" << endl ; for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) { @@ -1691,9 +1727,8 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName , } else if ( anInPort->IsDataStream() ) { f << " " << "I" << Name() << anInPort->PortName() << " = " << Name() - << ".InStreamPort( '" << anInPort->PortName() - << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anInPort->PortType() ) - << " , SALOME_ModuleCatalog." << anInPort->Dependency() << " )" << endl ; + << ".InStreamPort( '" << anInPort->PortName() << "' , '" << anInPort->PortType() + << "' , SALOME_ModuleCatalog." << anInPort->Dependency() << " )" << endl ; SUPERV::KindOfSchema aKindOfSchema ; SUPERV::KindOfInterpolation aKindOfInterpolation ; SUPERV::KindOfExtrapolation aKindOfExtrapolation ; @@ -1717,8 +1752,8 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName , else if ( anOutPort->IsDataStream() ) { f << " " << "O" << Name() << anOutPort->PortName() << " = " << Name() << ".OutStreamPort( '" << anOutPort->PortName() - << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anOutPort->PortType() ) - << " , SALOME_ModuleCatalog." << anOutPort->Dependency() << " )" << endl ; + << "' , '" << anOutPort->PortType() + << "' , SALOME_ModuleCatalog." << anOutPort->Dependency() << " )" << endl ; long aNumberOfValues ; aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ; f << " " << "O" << Name() << anOutPort->PortName() << ".SetNumberOfValues( " << aNumberOfValues << " )" @@ -1741,8 +1776,8 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName , else if ( anInPort->IsDataStream() ) { f << " " << "I" << EndName << anInPort->PortName() << " = " << EndName << ".InStreamPort( '" << anInPort->PortName() - << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anInPort->PortType() ) - << " , SALOME_ModuleCatalog." << anInPort->Dependency() << " )" << endl ; + << "' , '" << anInPort->PortType() + << "' , SALOME_ModuleCatalog." << anInPort->Dependency() << " )" << endl ; SUPERV::KindOfSchema aKindOfSchema ; SUPERV::KindOfInterpolation aKindOfInterpolation ; SUPERV::KindOfExtrapolation aKindOfExtrapolation ; @@ -1762,8 +1797,8 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName , else if ( anOutPort->IsDataStream() ) { f << " " << "O" << EndName << anOutPort->PortName() << " = " << EndName << ".OutStreamPort( '" << anOutPort->PortName() - << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anOutPort->PortType() ) - << " , SALOME_ModuleCatalog." << anOutPort->Dependency() << " )" << endl ; + << "' , '" << anOutPort->PortType() + << "' , SALOME_ModuleCatalog." << anOutPort->Dependency() << " )" << endl ; long aNumberOfValues ; aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ; f << " " << "O" << EndName << anOutPort->PortName() << ".SetNumberOfValues( " << aNumberOfValues << " )" @@ -1782,8 +1817,8 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName , SUPERV::ListOfStrings aPyFunc = *aCoupledNode->PythonFunction() ; f << " " << "Py" << aCoupledNode->Name() << " = []" << endl ; for ( i = 0 ; i < (int ) aPyFunc.length() ; i++ ) { - f << " " << "Py" << aCoupledNode->Name() << ".append( '" << aPyFunc[i] << "' )" - << endl ; + f << " " << "Py" << aCoupledNode->Name() << ".append( '" + << protectQuotes(aPyFunc[i].in()) << "' )" << endl; } f << " " << EndName << ".SetPyFunction( '" << aCoupledNode->PyFuncName() << "' , Py" << aCoupledNode->Name() << " )" << endl ; for ( i = 0 ; i < aCoupledNode->GetNodeInPortsSize() ; i++ ) { @@ -1803,8 +1838,8 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName , else if ( anInPort->IsDataStream() ) { f << " " << "I" << EndName << anInPort->PortName() << " = " << EndName << ".InStreamPort( '" << anInPort->PortName() - << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anInPort->PortType() ) - << " , SALOME_ModuleCatalog." << anInPort->Dependency() << " )" << endl ; + << "' , '" << anInPort->PortType() + << "' , SALOME_ModuleCatalog." << anInPort->Dependency() << " )" << endl ; SUPERV::KindOfSchema aKindOfSchema ; SUPERV::KindOfInterpolation aKindOfInterpolation ; SUPERV::KindOfExtrapolation aKindOfExtrapolation ; @@ -1830,8 +1865,8 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName , else if ( anOutPort->IsDataStream() ) { f << " " << "O" << EndName << anOutPort->PortName() << " = " << EndName << ".OutStreamPort( '" << anOutPort->PortName() - << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anOutPort->PortType() ) - << " , SALOME_ModuleCatalog." << anOutPort->Dependency() << " )" << endl ; + << "' , '" << anOutPort->PortType() + << "' , SALOME_ModuleCatalog." << anOutPort->Dependency() << " )" << endl ; long aNumberOfValues ; aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ; f << " " << "O" << EndName << anOutPort->PortName() << ".SetNumberOfValues( " << aNumberOfValues << " )" @@ -1932,8 +1967,8 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName , if ( anInPort->IsDataStream() ) { if ( IsOneOfInLineNodes() ) { f << " " << "I" << Name() << anInPort->PortName() << " = " - << Name() << ".InStreamPort( '" << anInPort->PortName() << "' , SALOME_ModuleCatalog." - << StringToDataStreamType( anInPort->PortType() ) << " , SALOME_ModuleCatalog." + << Name() << ".InStreamPort( '" << anInPort->PortName() << "' , '" + << anInPort->PortType() << "' , SALOME_ModuleCatalog." << anInPort->Dependency() << " )" << endl ; } else { @@ -1955,8 +1990,8 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName , if ( anOutPort->IsDataStream() ) { if ( IsOneOfInLineNodes() ) { f << " " << "O" << Name() << anOutPort->PortName() << " = " - << Name() << ".OutStreamPort( '" << anOutPort->PortName() << "' , SALOME_ModuleCatalog." - << StringToDataStreamType( anOutPort->PortType() ) << " , SALOME_ModuleCatalog." + << Name() << ".OutStreamPort( '" << anOutPort->PortName() << "' , '" + << anOutPort->PortType() << "' , SALOME_ModuleCatalog." << anOutPort->Dependency() << " )" << endl ; } else { @@ -2041,4 +2076,3 @@ ostream & operator<< (ostream &fOut,const SUPERV::SDate &D) { // cdebug_out << "operator<< GraphEditor::Date" << endl; return fOut; } - diff --git a/src/GraphBase/DataFlowBase_ComputingNode.hxx b/src/GraphBase/DataFlowBase_ComputingNode.hxx index bac84d5..981989b 100644 --- a/src/GraphBase/DataFlowBase_ComputingNode.hxx +++ b/src/GraphBase/DataFlowBase_ComputingNode.hxx @@ -227,12 +227,12 @@ namespace GraphBase { void DelOutDataStreamPort( const char * OutputParameterName ) ; InDataStreamPort * AddInDataStreamPort( const char * InputParameterName , - const SALOME_ModuleCatalog::DataStreamType InputParameterType , + const char * InputParameterType , const SALOME_ModuleCatalog::DataStreamDependency aDependency , const SUPERV::KindOfPort aKindOfPort , int index = -1 ) ; OutDataStreamPort * AddOutDataStreamPort( const char * OutputParameterName , - const SALOME_ModuleCatalog::DataStreamType OutputParameterType , + const char * OutputParameterType , const SALOME_ModuleCatalog::DataStreamDependency aDependency , const SUPERV::KindOfPort aKindOfPort , int index = -1 ) ; diff --git a/src/GraphBase/DataFlowBase_DataPort.cxx b/src/GraphBase/DataFlowBase_DataPort.cxx index ae0f79f..7b0a17e 100644 --- a/src/GraphBase/DataFlowBase_DataPort.cxx +++ b/src/GraphBase/DataFlowBase_DataPort.cxx @@ -71,31 +71,32 @@ void GraphBase::DataPort::InitialValues(CORBA::Any aValue ) { } else if ( !strcmp( Type , "boolean" ) ) { cdebug << "boolean" << endl ; - InitialValue <<= (long ) 0 ; + InitialValue <<= (CORBA::Long ) 0 ; } else if ( !strcmp( Type , "char" ) ) { cdebug << "char" << endl ; - InitialValue <<= (long ) 0 ; + InitialValue <<= (CORBA::Long ) 0 ; } else if ( !strcmp( Type , "short" ) ) { cdebug << "short" << endl ; - InitialValue <<= (long ) 0 ; + InitialValue <<= (CORBA::Long ) 0 ; } else if ( !strcmp( Type , "int" ) ) { cdebug << "long" << endl ; - InitialValue <<= (long ) 0 ; + InitialValue <<= (CORBA::Long ) 0 ; } else if ( !strcmp( Type , "long" ) ) { cdebug << "long" << endl ; - InitialValue <<= (long ) 0 ; + InitialValue <<= (CORBA::Long ) 0 ; } else if ( !strcmp( Type , "float" ) ) { cdebug << "float" << endl ; #ifdef REDHAT // mkr : debug for PAL12255 - InitialValue <<= (double ) 0. ; + InitialValue <<= (float ) 0. ; #else - double d = 0.; - InitialValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d)); +//JR double d = 0.; +//JR InitialValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d)); + InitialValue <<= (CORBA::Float) 0. ; #endif } @@ -104,8 +105,9 @@ void GraphBase::DataPort::InitialValues(CORBA::Any aValue ) { #ifdef REDHAT // mkr : debug for PAL12255 InitialValue <<= (double ) 0. ; #else - double d = 0.; - InitialValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d)); +//JR double d = 0.; +//JR InitialValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d)); + InitialValue <<= (CORBA::Double) 0. ; #endif } else { // Default @@ -115,7 +117,7 @@ void GraphBase::DataPort::InitialValues(CORBA::Any aValue ) { } // else { // cdebug << "InitialValues ERROR (other) " << Type << endl ; -// InitialValue <<= (long ) 0 ; +// InitialValue <<= (CORBA::Long ) 0 ; // } _InitialValue = new CORBA::Any( InitialValue ) ; _Value = &_InitialValue ; @@ -149,7 +151,7 @@ void GraphBase::DataPort::SetValue( const CORBA::Any * aDataValue ) { #endif switch (aDataValue->type()->kind()) { // Input Value case CORBA::tk_string: { // Input string Value - char * t; + const char * t; *aDataValue >>= t; #if ValueTrace cdebug << t << " (string)" ; @@ -165,12 +167,13 @@ void GraphBase::DataPort::SetValue( const CORBA::Any * aDataValue ) { CORBA::Any * theValue = new CORBA::Any() ; if ( !strcmp( Type , "boolean" ) || !strcmp( Type , "char" ) || !strcmp( Type , "short" ) || !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) { - long l ; - sscanf( t , "%ld" , &l ) ; + long ll ; + sscanf( t , "%ld" , &ll ) ; + CORBA::Long l = ll ; *theValue <<= l ; *theValue >>= l; #if ValueTrace - cdebug << " --> Value( " << l << ") (long) kind " << theValue->type()->kind() ; + cdebug << " --> Value( " << l << ") (CORBA::Long) kind " << theValue->type()->kind() ; #endif } else if ( !strcmp( Type , "float" ) || !strcmp( Type , "double" ) ) { @@ -179,7 +182,8 @@ void GraphBase::DataPort::SetValue( const CORBA::Any * aDataValue ) { #ifdef REDHAT // mkr : debug for PAL12255 *theValue <<= d ; #else - theValue->replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d)); +//JR theValue->replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d)); + *theValue <<= (CORBA::Double) d ; #endif *theValue >>= d ; #if ValueTrace @@ -216,11 +220,11 @@ void GraphBase::DataPort::SetValue( const CORBA::Any * aDataValue ) { } break; } - case CORBA::tk_long: { // Input long Value - long l; + case CORBA::tk_long: { // Input CORBA::Long Value + CORBA::Long l; *aDataValue >>= l; #if ValueTrace - cdebug << "Value( " << l << ") (long)"; + cdebug << "Value( " << l << ") (CORBA::Long)"; #endif if ( !strcmp( Type , "boolean" ) || !strcmp( Type , "char" ) || !strcmp( Type , "short" ) || !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) { // SuperVision Value @@ -228,16 +232,17 @@ void GraphBase::DataPort::SetValue( const CORBA::Any * aDataValue ) { *_Value = aDataValue ; *_theValue >>= l; #if ValueTrace - cdebug << " == Value( " << l << ") (long)"; + cdebug << " == Value( " << l << ") (CORBA::Long)"; #endif } else { CORBA::Any * theValue = new CORBA::Any() ; if ( !strcmp( Type , "string" ) ) { + long ll = l; char t[40] ; - sprintf( t , "%ld" , l ) ; + sprintf( t , "%ld" , ll ) ; *theValue <<= t ; - char *tt ; + const char *tt ; *theValue >>= tt ; #if ValueTrace cdebug << " --> Value( " << t << ") (string) kind " << theValue->type()->kind() ; @@ -248,7 +253,8 @@ void GraphBase::DataPort::SetValue( const CORBA::Any * aDataValue ) { #ifdef REDHAT // mkr : debug for PAL12255 *theValue <<= d ; #else - theValue->replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d)); +//JR theValue->replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d)); + *theValue <<= (CORBA::Double) d ; #endif *theValue >>= d ; @@ -305,7 +311,7 @@ void GraphBase::DataPort::SetValue( const CORBA::Any * aDataValue ) { char t[40] ; sprintf( t , "%lf" , d ) ; *theValue <<= t ; - char *tt ; + const char *tt ; *theValue >>= tt ; #if ValueTrace cdebug << " --> Value( " << t << ") (string) kind " << theValue->type()->kind() ; @@ -313,11 +319,11 @@ void GraphBase::DataPort::SetValue( const CORBA::Any * aDataValue ) { } else if ( !strcmp( Type , "boolean" ) || !strcmp( Type , "char" ) || !strcmp( Type , "short" ) || !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) { - long l = (long ) d ; + CORBA::Long l = (CORBA::Long ) d ; *theValue <<= l ; *theValue >>= l; #if ValueTrace - cdebug << " --> Value( " << l << ") (long) kind " << theValue->type()->kind() ; + cdebug << " --> Value( " << l << ") (CORBA::Long) kind " << theValue->type()->kind() ; #endif } else { // Default @@ -384,11 +390,16 @@ void GraphBase::DataPort::SetValue( const CORBA::Any * aDataValue ) { } else if ( !strcmp( Type , "boolean" ) || !strcmp( Type , "char" ) || !strcmp( Type , "short" ) || !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) { - long l = (long ) obj ; +#ifdef OMNI_LONG_IS_INT + long ll = (long ) obj ; + CORBA::Long l = (CORBA::Long ) ll ; +#else + CORBA::Long l = (CORBA::Long ) obj ; +#endif *theValue <<= l ; *theValue >>= l; #if ValueTrace - cdebug << " --> Value( " << l << ") (long) kind " << theValue->type()->kind() ; + cdebug << " --> Value( " << l << ") (CORBA::Long) kind " << theValue->type()->kind() ; #endif } else if ( !strcmp( Type , "float" ) || !strcmp( Type , "double" ) ) { @@ -396,7 +407,8 @@ void GraphBase::DataPort::SetValue( const CORBA::Any * aDataValue ) { #ifdef REDHAT // mkr : debug for PAL12255 *theValue <<= d ; #else - theValue->replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d)); +//JR theValue->replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d)); + *theValue <<= (CORBA::Double) d ; #endif *theValue >>= d; #if ValueTrace @@ -461,7 +473,7 @@ const CORBA::Any GraphBase::DataPort::Value() const { //JR 30.03.2005 switch ( theValue->type()->kind() ) { switch ( theValue.type()->kind() ) { case CORBA::tk_string: { - char * t; + const char * t; //JR 30.03.2005 *theValue >>= t; theValue >>= t; // cdebug << "GraphBase::DataPort::Value() : " << t << " (string) " << endl ; @@ -475,10 +487,10 @@ const CORBA::Any GraphBase::DataPort::Value() const { break; } case CORBA::tk_long: { - long l; + CORBA::Long l; //JR 30.03.2005 *theValue >>= l; theValue >>= l; -// cdebug << "GraphBase::DataPort::Value() : " << l << " (long) " << endl ; +// cdebug << "GraphBase::DataPort::Value() : " << l << " (CORBA::Long) " << endl ; break; } case CORBA::tk_objref: { @@ -533,7 +545,7 @@ bool GraphBase::DataPort::BoolValue() const { // cdebug << pthread_self() << " BoolValue() --> pthread_mutex_locked " << aMutexWait // << endl ; if ( (*_Value)->type()->kind() == CORBA::tk_long ) { - long val ; + CORBA::Long val ; **_Value >>= val ; if ( val ) { RetVal = true ; @@ -571,7 +583,7 @@ void GraphBase::DataPort::StringValue(ostream & f ) const { const CORBA::Any * theValue = *_Value ; switch (theValue->type()->kind()) { case CORBA::tk_string: - char * t; + const char * t; *theValue >>= t; f << t << " (string)" ; break; @@ -581,9 +593,9 @@ void GraphBase::DataPort::StringValue(ostream & f ) const { f << d << " (double)" ; break; case CORBA::tk_long: - long l; + CORBA::Long l; *theValue >>= l; - f << l << " (long)" ; + f << l << " (CORBA::Long)" ; break; case CORBA::tk_objref: CORBA::Object_ptr ObjRef ; diff --git a/src/GraphBase/DataFlowBase_Graph.cxx b/src/GraphBase/DataFlowBase_Graph.cxx index f364ab3..e5d0723 100644 --- a/src/GraphBase/DataFlowBase_Graph.cxx +++ b/src/GraphBase/DataFlowBase_Graph.cxx @@ -241,9 +241,9 @@ GraphBase::ListOfSNodes * GraphBase::Graph::GetNodes() const { const GraphBase::InPort * anInPort ; anInPort = aCNode->GetNodeInPort( iostream ) ; if ( anInPort->IsDataStream() ) { - cdebug << "GraphBase::Graph::GetNodes In" << iostream << " " << aCNode->Name() << " " << anInPort->NodeName() << " " << anInPort->PortName() - << endl ; - (*_list_nodes)[ind].theListOfInDataStreams[streamind].theDataStreamParameter.Parametertype = StringToDataStreamType( anInPort->PortType() ) ; + cdebug << "GraphBase::Graph::GetNodes In" << iostream << " " << aCNode->Name() + << " " << anInPort->NodeName() << " " << anInPort->PortName() << endl; + (*_list_nodes)[ind].theListOfInDataStreams[streamind].theDataStreamParameter.Parametertype = CORBA::string_dup( anInPort->PortType() ) ; (*_list_nodes)[ind].theListOfInDataStreams[streamind].theDataStreamParameter.Parametername = CORBA::string_dup( anInPort->PortName() ) ; (*_list_nodes)[ind].theListOfInDataStreams[streamind].theDataStreamParameter.Parameterdependency = anInPort->Dependency() ; SUPERV::KindOfSchema aKindOfSchema ; @@ -278,7 +278,7 @@ GraphBase::ListOfSNodes * GraphBase::Graph::GetNodes() const { if ( anOutPort->IsDataStream() ) { cdebug << "GraphBase::Graph::GetNodes Out" << iostream << " " << aCNode->Name() << " " << anOutPort->NodeName() << " " << anOutPort->PortName() << " " << endl ; - (*_list_nodes)[ind].theListOfOutDataStreams[streamind].theDataStreamParameter.Parametertype = StringToDataStreamType( anOutPort->PortType() ) ; + (*_list_nodes)[ind].theListOfOutDataStreams[streamind].theDataStreamParameter.Parametertype = CORBA::string_dup( anOutPort->PortType() ) ; (*_list_nodes)[ind].theListOfOutDataStreams[streamind].theDataStreamParameter.Parametername = CORBA::string_dup( anOutPort->PortName() ) ; (*_list_nodes)[ind].theListOfOutDataStreams[streamind].theDataStreamParameter.Parameterdependency = anOutPort->Dependency() ; long aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ; @@ -1103,10 +1103,10 @@ bool GraphBase::Graph::AddLink( const char* FromNodeName , CORBA::Any aValue ; //JR 29.09.2005 Debug for CEA : we do not do that for MacroNodes : if ( !fromNode->IsMacroNode() ) { - aValue <<= (long ) 1 ; + aValue <<= (CORBA::Long ) 1 ; } else { - aValue <<= (long ) 0 ; + aValue <<= (CORBA::Long ) 0 ; } fromPort->SetValue( aValue ) ; } @@ -1188,6 +1188,9 @@ bool GraphBase::Graph::AddLink( GraphBase::ComputingNode *fromNode , cdebug_out << "RemoveLink(AddLink) toPort->GetOutPort()->NodeName() RemoveLink Error." << endl ; return false ; } + if ( fromNode->IsGOTONode() && fromPort->IsGate() ) { // mkr : PAL12575 + ((GraphBase::GOTONode * ) fromNode)->CoupledNode( (GraphBase::InLineNode * ) toNode ) ; + } } if ( !fromNode->IsDataFlowNode() && !fromNode->IsDataStreamNode() && @@ -1487,6 +1490,22 @@ bool GraphBase::Graph::RemoveLink( const char* FromNodeName , } else { fromNode->RemoveLinkedNode( toNode ) ; + // mkr : PAL12575 --> + if ( fromNode->IsGOTONode() ) { + GraphBase::GOTONode * aGOTONode = (GraphBase::GOTONode * ) fromNode ; + if ( aGOTONode->CoupledNode() && strcmp( aGOTONode->CoupledNode()->Name(), toNode->Name() ) == 0 ) { + aGOTONode->CoupledNode(NULL); + aGOTONode->CoupledNodeName(""); + + // set ExternConnected status for output data port of GoTo node + for ( int aPortId = 0 ; aPortId < fromNode->GetNodeOutPortsSize() ; aPortId++ ) { + GraphBase::OutPort * anOutPort = fromNode->GetChangeNodeOutPort(aPortId) ; + if ( anOutPort->IsNotConnected() && !anOutPort->IsGate() ) + anOutPort->PortStatus( ExternConnected ) ; + } + } + } + // mkr : PAL12575 <-- } } //JR PAL7990 : a SwitchPort is an OutPort of a SwitchNode connected to a InGate Port @@ -1579,7 +1598,7 @@ bool GraphBase::Graph::AddInputData( const char* ToNodeName , bool isUnknown = false; switch (aValue.type()->kind()) { case CORBA::tk_string: - char * t; + const char * t; aValue >>= t; cdebug << t << " (string) " ; if ( !strcmp( t, "Unknown CORBA::Any Type" ) ) @@ -1592,9 +1611,9 @@ bool GraphBase::Graph::AddInputData( const char* ToNodeName , cdebug << d << " (double) " ; break; case CORBA::tk_long: - long l; + CORBA::Long l; aValue >>= l; - cdebug << l << " (long) " ; + cdebug << l << " (CORBA::Long) " ; break; case CORBA::tk_objref: cdebug << "(object reference) " ; @@ -1653,8 +1672,8 @@ bool GraphBase::Graph::AddInputData( const char* ToNodeName , else { cdebug << "ERROR Node and/or Port not found : " << aNodeName << " " << aPortName << endl ; } - delete aNodeName ; - delete aPortName ; + delete [] aNodeName ; + delete [] aPortName ; cdebug_out << "GraphBase::Graph::AddInputData " << RetVal << endl; return RetVal ; @@ -1669,7 +1688,7 @@ bool GraphBase::Graph::ChangeInputData( const char * ToNodeName , << ToServiceParameterName << "' , Any " ; switch (aValue.type()->kind()) { case CORBA::tk_string: - char * t; + const char * t; aValue >>= t; cdebug << t << " (string) " ; break; @@ -1679,9 +1698,9 @@ bool GraphBase::Graph::ChangeInputData( const char * ToNodeName , cdebug << d << " (double) " ; break; case CORBA::tk_long: - long l; + CORBA::Long l; aValue >>= l; - cdebug << l << " (long) " ; + cdebug << l << " (CORBA::Long) " ; break; case CORBA::tk_objref: cdebug << "(object reference) " ; @@ -1741,14 +1760,14 @@ bool GraphBase::Graph::AddInputData( const char* ToNodeName , cdebug << t << " (string) " ; break; case CORBA::tk_double: - double d; + CORBA::Double d; theValue >>= d; cdebug << d << " (double) " ; break; case CORBA::tk_long: - long l; + CORBA::Long l; theValue >>= l; - cdebug << l << " (long) " ; + cdebug << l << " (CORBA::Long) " ; break; case CORBA::tk_objref: cdebug << "(object reference) " ; @@ -2099,8 +2118,8 @@ bool GraphBase::Graph::CreateService() { // DataService( _Orb , aService , InPortsKind , OutPortsKind , Graph_prof_debug() , Graph_fdebug() ) ; for ( i = 0 ; i < innbr ; i++ ) { if ( InPortsKind[ i ] == SUPERV::DataStreamParameter ) { - GraphBase::InDataStreamPort * anInPort = AddInDataStreamPort( aService.ServiceinParameter[ i ].Parametername , - StringToDataStreamType( aService.ServiceinParameter[ i ].Parametertype ) , + GraphBase::InDataStreamPort * anInPort = AddInDataStreamPort( aService.ServiceinParameter[ i ].Parametername, + aService.ServiceinParameter[ i ].Parametertype, InDataStreamDependency[ i ] , SUPERV::DataStreamParameter ) ; anInPort->SetParams( InKindOfSchema[ i ] , @@ -2141,7 +2160,7 @@ bool GraphBase::Graph::CreateService() { for ( i = 0 ; i < outnbr ; i++ ) { if ( OutPortsKind[ i ] == SUPERV::DataStreamParameter ) { GraphBase::OutDataStreamPort * anOutPort = AddOutDataStreamPort( aService.ServiceoutParameter[ i ].Parametername , - StringToDataStreamType( aService.ServiceoutParameter[ i ].Parametertype ) , + aService.ServiceoutParameter[ i ].Parametertype , OutDataStreamDependency[ i ] , SUPERV::DataStreamParameter ) ; anOutPort->NumberOfValues( OutNumberOfValues[ i ] ) ; @@ -2291,7 +2310,7 @@ bool GraphBase::Graph::InLineServices() { } else if ( aINode->GetChangeNodeInPort(j)->IsDataStream() ) { aService.ServiceinDataStreamParameter.length( InStreamService+1 ) ; - aService.ServiceinDataStreamParameter[InStreamService].Parametertype = StringToDataStreamType( aINode->GetChangeNodeInPort(j)->PortType() ) ; + aService.ServiceinDataStreamParameter[InStreamService].Parametertype = CORBA::string_dup( aINode->GetChangeNodeInPort(j)->PortType() ) ; aService.ServiceinDataStreamParameter[InStreamService].Parametername = CORBA::string_dup( aINode->GetChangeNodeInPort(j)->PortName() ) ; aService.ServiceinDataStreamParameter[InStreamService++].Parameterdependency = aINode->GetChangeNodeInPort(j)->Dependency() ; aINode->IncrDataStreamInPorts() ; @@ -2334,7 +2353,7 @@ bool GraphBase::Graph::InLineServices() { } else if ( aINode->GetChangeNodeOutPort(j)->IsDataStream() ) { aService.ServiceoutDataStreamParameter.length( OutStreamService+1 ) ; - aService.ServiceoutDataStreamParameter[OutStreamService].Parametertype = StringToDataStreamType( aINode->GetChangeNodeOutPort(j)->PortType() ) ; + aService.ServiceoutDataStreamParameter[OutStreamService].Parametertype = CORBA::string_dup( aINode->GetChangeNodeOutPort(j)->PortType() ) ; aService.ServiceoutDataStreamParameter[OutStreamService].Parametername = CORBA::string_dup( aINode->GetChangeNodeOutPort(j)->PortName() ) ; aService.ServiceoutDataStreamParameter[OutStreamService++].Parameterdependency = aINode->GetChangeNodeOutPort(j)->Dependency() ; aINode->IncrDataStreamOutPorts() ; @@ -2773,6 +2792,59 @@ bool GraphBase::Graph::Sort( int & SubStreamGraphsNumber ) { return true ; } +// mkr : PAL12575 +bool GraphBase::Graph::ValidGOTO() { + cdebug_in << "GraphBase::Graph::ValidGOTO" << endl; + bool RetVal = true ; + int i, j ; + GraphBase::ComputingNode * aNode ; + for ( i = 0 ; i < GraphNodesSize() ; i++ ) { + aNode = GraphNodes( i ) ; + if ( aNode->IsGOTONode() ) { + GraphBase::GOTONode * aGoToNode = (GraphBase::GOTONode * ) aNode ; + GraphBase::InLineNode * aCoupledNode ; + aCoupledNode = (GraphBase::InLineNode * ) aGoToNode->CoupledNode() ; + if ( aCoupledNode ) { + ostringstream ErrorMessage ; + // 1. Check the number of ports (the number of OutPorts of a GOTONode and of InPorts of its linked + // InLine node must be the same) + if ( aNode->GetNodeOutPortsSize() != aCoupledNode->GetNodeInPortsSize() ) { + cdebug << "GraphBase::Graph::ValidGOTO : Different ports number!" << endl ; + ReSetMessages() ; + ErrorMessage << "Different ports number : the number of OutPorts of a " << aNode->Name() + << " node (GoTo node) and of InPorts of its linked " << aCoupledNode->Name() + << " node (InLine node) must be the same!\n" ; + SetMessages( ErrorMessage.str() ) ; + RetVal = false ; + } + // 2. Check ports names (the names of OutPorts of a GOTONode and of InPorts of its linked + // InLine node must be the same) + else { + for ( j = 0 ; j < aNode->GetNodeOutPortsSize() ; j++ ) { + GraphBase::OutPort * aBusParamOutPort = aNode->GetChangeNodeOutPort( j ) ; + if ( !aBusParamOutPort->IsGate() ) { + GraphBase::InPort * aBusParamChangeInPort = NULL ; + aBusParamChangeInPort = aCoupledNode->GetChangeInPort( aBusParamOutPort->PortName() ) ; + if ( !aBusParamChangeInPort ) { + cdebug << "GraphBase::Graph::ValidGOTO : Different names of ports!" << endl ; + ReSetMessages() ; + ErrorMessage << "Different names of ports : there is no input port of " << aCoupledNode->Name() + << " node (InLine node) coupled to " << aBusParamOutPort->PortName() + << " output port of a " << aNode->Name() + << " node (GoTo node)\n" ; + SetMessages( ErrorMessage.str() ) ; + RetVal = false ; + } + } + } + } + } + } + } + cdebug_out << "GraphBase::Graph::ValidGOTO RetVal " << RetVal << endl; + return RetVal ; +} + bool GraphBase::Graph::ValidLoops() const { cdebug_in << "GraphBase::Graph::ValidLoops" << endl; bool RetVal = true ; @@ -3020,7 +3092,7 @@ bool GraphBase::Graph::DataServerNodes() const { const GraphBase::OutPort * anOutPort = aNode->GetNodeOutPort(j) ; //JR Debug 06.06.2005 : if it is not a Gate ! // if ( anOutPort->IsNotConnected() ) { - if ( anOutPort->IsNotConnected() && !anOutPort->IsGate() ) { + if ( anOutPort->IsNotConnected() && !anOutPort->IsGate() && !aNode->IsGOTONode() ) { // mkr : PAL12575 cdebug << "Graph::DataServerNodes Add[Stream]LinkedNode for OutPort " << aNode->Name() << "( " << anOutPort->PortName() << " , " << anOutPort->PortStatus() << " )" << endl ; @@ -3183,8 +3255,8 @@ const CORBA::Any GraphBase::Graph::PortInData( const char* ToNodeName , cdebug << "GraphBase::Graph::PortInData " << ToNodeName << " " << ToServiceParameterName << " ERROR no Node" << endl ; } - delete theNode ; - delete aPort ; + delete [] theNode ; + delete [] aPort ; #if TracePortInOutData cdebug_out << "GraphBase::Graph::PortInData " << endl ; #endif @@ -3235,8 +3307,8 @@ const CORBA::Any GraphBase::Graph::PortOutData( const char* FromNodeName , cdebug << "GraphBase::Graph::PortOutData " << FromNodeName << " " << FromServiceParameterName << " ERROR no Node" << endl ; } - delete theNode ; - delete aPort ; + delete [] theNode ; + delete [] aPort ; #if TracePortInOutData cdebug_out << "GraphBase::Graph::PortOutData " << endl ; #endif diff --git a/src/GraphBase/DataFlowBase_Graph.hxx b/src/GraphBase/DataFlowBase_Graph.hxx index 0dab620..a5a026c 100644 --- a/src/GraphBase/DataFlowBase_Graph.hxx +++ b/src/GraphBase/DataFlowBase_Graph.hxx @@ -90,12 +90,14 @@ namespace GraphBase { // int _SubStreamGraphsSize ; // vector > _SubStreamGraphs ; - string _Messages ; + string _Messages ; - bool AddLink( GraphBase::ComputingNode *fromNode , - GraphBase::OutPort *fromPort , - GraphBase::ComputingNode *toNode , - GraphBase::InPort *toPort ) ; + map< string, string > _MapOfComponentNameContainer ; // mkr : PAL13947 + + bool AddLink( GraphBase::ComputingNode *fromNode , + GraphBase::OutPort *fromPort , + GraphBase::ComputingNode *toNode , + GraphBase::InPort *toPort ) ; public: @@ -340,6 +342,7 @@ namespace GraphBase { bool InLineServices() ; bool Sort( int & SubStreamGraphsNumber ) ; + bool ValidGOTO() ; // mkr : PAL12575 bool ValidLoops() const ; bool ValidSwitchs() const ; bool ComputingNodes() const ; @@ -372,6 +375,28 @@ namespace GraphBase { Engines::Container_var & myContainer , Engines::Component_var & objComponent ) ; + // mkr : PAL13947 + void InsertToMapOfComponentNameContainer( const char * theComponentName, + const char * theContainer) { + _MapOfComponentNameContainer[ theComponentName ] = theContainer ; + } + + // mkr : PAL13947 + const char * RetrieveFromMapOfComponentNameContainer( const char * theComponentName ) { + if ( _MapOfComponentNameContainer.empty() + || + _MapOfComponentNameContainer.find(theComponentName) == _MapOfComponentNameContainer.end() ) + return NULL ; + + return _MapOfComponentNameContainer[ theComponentName ].c_str() ; + } + + // mkr : PAL13947 + void ClearMapOfComponentNameContainer() { + if ( !_MapOfComponentNameContainer.empty() ) + _MapOfComponentNameContainer.clear(); + } + }; }; diff --git a/src/GraphBase/DataFlowBase_OutPort.cxx b/src/GraphBase/DataFlowBase_OutPort.cxx index 2f52c5a..776bc74 100644 --- a/src/GraphBase/DataFlowBase_OutPort.cxx +++ b/src/GraphBase/DataFlowBase_OutPort.cxx @@ -127,8 +127,9 @@ bool GraphBase::OutPort::RemoveInPort( GraphBase::InPort * toPort ) { int i ; int index = _MapOfInPorts[ toPort->NodePortName() ] ; if ( index <= 0 || index > _InPortsSize ) { - cdebug << "GraphBase::OutPort::RemoveInPort Error " << NodeName() << "( " << PortName()<< " ) --> " - << toPort->NodeName() << "( " << toPort->PortName() << " )" << endl ; +//JR NPAL14110 09.02.2007 : Not an error with MacroNodes ... + //JRcdebug << "GraphBase::OutPort::RemoveInPort Error " << NodeName() << "( " << PortName()<< " ) --> " + //JR << toPort->NodeName() << "( " << toPort->PortName() << " )" << endl ; return false ; } cdebug << "OutPort::RemoveInPort " << NodeName() << "(" << PortName() << ") --> " diff --git a/src/GraphBase/DataFlowBase_PortsOfNode.cxx b/src/GraphBase/DataFlowBase_PortsOfNode.cxx index 3fa9756..97a9b42 100644 --- a/src/GraphBase/DataFlowBase_PortsOfNode.cxx +++ b/src/GraphBase/DataFlowBase_PortsOfNode.cxx @@ -29,7 +29,7 @@ using namespace std; #include "DataFlowBase_PortsOfNode.hxx" -#define PortsOfNodeTrace 1 +#define PortsOfNodeTrace 0 GraphBase::PortsOfNode::PortsOfNode() : GraphBase::Service::Service( SALOME_ModuleCatalog::Service() ) { diff --git a/src/GraphBase/DataFlowBase_XmlHandler.cxx b/src/GraphBase/DataFlowBase_XmlHandler.cxx index 13d8095..3eccd79 100644 --- a/src/GraphBase/DataFlowBase_XmlHandler.cxx +++ b/src/GraphBase/DataFlowBase_XmlHandler.cxx @@ -718,7 +718,7 @@ bool GraphBase::XmlHandler::endElement( const QString&, case CORBA::tk_string: { //Mandrake 10.1/Salome 3 aLink.aLinkValue <<= (char *) NULL ; aLink.aLinkValue <<= (char *) "" ; - char * t; + const char * t; aLink.aLinkValue >>= t; #if TRACE MESSAGE( t << " (string)" ); @@ -730,7 +730,8 @@ bool GraphBase::XmlHandler::endElement( const QString&, #ifdef REDHAT // mkr : debug for PAL12255 aLink.aLinkValue <<= (double ) 0. ; #else - aLink.aLinkValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d)); +//JR aLink.aLinkValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d)); + aLink.aLinkValue <<= (CORBA::Double) 0. ; #endif aLink.aLinkValue >>= d; #if TRACE @@ -739,11 +740,11 @@ bool GraphBase::XmlHandler::endElement( const QString&, break; } case CORBA::tk_long: { - aLink.aLinkValue <<= (long ) 0 ; - long l; + aLink.aLinkValue <<= (CORBA::Long ) 0 ; + CORBA::Long l; aLink.aLinkValue >>= l; #if TRACE - MESSAGE( l << " (long)" ); + MESSAGE( l << " (CORBA::Long)" ); #endif break; } @@ -777,7 +778,7 @@ bool GraphBase::XmlHandler::endElement( const QString&, switch ( aLink.aLinkValue.type()->kind() ) { case CORBA::tk_string: { aLink.aLinkValue <<= fieldvalue[depth].c_str() ; - char * t; + const char * t; aLink.aLinkValue >>= t; #if TRACE MESSAGE( t << " (string)" ); @@ -791,8 +792,10 @@ bool GraphBase::XmlHandler::endElement( const QString&, aLink.aLinkValue <<= d; aLinkValue <<= d; #else - aLink.aLinkValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d)); - aLinkValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d)); +//JR aLink.aLinkValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d)); +//JR aLinkValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d)); + aLink.aLinkValue <<= (CORBA::Double) d; + aLinkValue <<= (CORBA::Double) d; #endif aLinkDoubleValue = new CORBA::Any( aLinkValue ); #if TRACE @@ -801,11 +804,12 @@ bool GraphBase::XmlHandler::endElement( const QString&, break; } case CORBA::tk_long: { - long l; - sscanf( fieldvalue[depth].c_str() , "%ld" , &l ) ; + long ll; + sscanf( fieldvalue[depth].c_str() , "%ld" , &ll ) ; + CORBA::Long l = ll ; aLink.aLinkValue <<= l; #if TRACE - MESSAGE( l << " (long)" ); + MESSAGE( l << " (CORBA::Long)" ); #endif break; } @@ -1135,7 +1139,7 @@ bool GraphBase::XmlHandler::endElement( const QString&, aPythonFunction[ ll ] = fieldvalue[depth].c_str() ; } else { - aPythonFunction[ ll ] = NULLSTRING ; + aPythonFunction[ ll ] = CORBA::String_var("") ; } if ( ll ) { aNode.theListOfPythonFunctions.resize( l ) ; diff --git a/src/GraphBase/Makefile.in b/src/GraphBase/Makefile.in index 7e28c7f..ad9a63d 100644 --- a/src/GraphBase/Makefile.in +++ b/src/GraphBase/Makefile.in @@ -97,16 +97,20 @@ LIB_CLIENT_IDL = Logger.idl \ # Executables targets BIN = SuperVisionBase_CheckOfUndefined BIN_SRC = -BIN_SERVER_IDL = +BIN_CLIENT_IDL = SALOME_Component.idl -CPPFLAGS+= $(PYTHON_INCLUDES) $(QT_MT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) \ - $(KERNEL_CXXFLAGS) +CPPFLAGS+= $(PYTHON_INCLUDES) $(QT_MT_INCLUDES) $(KERNEL_CXXFLAGS) CXXFLAGS+= -g -D__x86__ -D__linux__ -ftemplate-depth-42 -Wall \ $(KERNEL_CXXFLAGS) + +ifeq ($(OS),REDHAT) + CXXFLAGS+= -DREDHAT +endif + LDFLAGS+= $(SUPERV_LDFLAGS) $(CORBA_LIBS) -lSalomeNS -lSalomeLifeCycleCORBA -lOpUtil -lSALOMELocalTrace \ - -lc $(PYTHON_LIBS) $(QT_MT_LIBS) $(OGL_LIBS) \ - $(KERNEL_LDFLAGS) -LDFLAGSFORBIN=$(LDFLAGS) -lSalomeContainer -lSalomeResourcesManager -lRegistry -lSalomeNotification -lSALOMEBasics + -lc $(PYTHON_LIBS) $(QT_MT_LIBS) $(KERNEL_LDFLAGS) +LDFLAGSFORBIN= $(LDFLAGS) -lSalomeContainer -lSalomeResourcesManager -lRegistry -lSalomeNotification -lSALOMEBasics -lSalomeSuperVisionBase -lSalomeIDLKernel + //LIBS += -Xlinker -export-dynamic $(PYTHON_LIBS) @CONCLUDE@ diff --git a/src/GraphBase/SuperVisionBase_CheckOfUndefined.cxx b/src/GraphBase/SuperVisionBase_CheckOfUndefined.cxx index bf88ec6..3da2523 100644 --- a/src/GraphBase/SuperVisionBase_CheckOfUndefined.cxx +++ b/src/GraphBase/SuperVisionBase_CheckOfUndefined.cxx @@ -37,6 +37,10 @@ using namespace std; #include "DataFlowBase_Base.hxx" +#include CORBA_CLIENT_HEADER(SALOME_Component) + + + int _ArgC ; char ** _ArgV ; diff --git a/src/GraphEditor/DataFlowEditor_DataFlow.hxx b/src/GraphEditor/DataFlowEditor_DataFlow.hxx index c267e77..f539783 100644 --- a/src/GraphEditor/DataFlowEditor_DataFlow.hxx +++ b/src/GraphEditor/DataFlowEditor_DataFlow.hxx @@ -233,7 +233,7 @@ namespace GraphEditor { long SubStreamGraphsNumber() ; void Executor(GraphExecutor::DataFlow * DataFlowExecutor ) ; - GraphExecutor::DataFlow * GraphEditor::DataFlow::Executor() const ; + GraphExecutor::DataFlow * Executor() const ; }; diff --git a/src/GraphEditor/DataFlowEditor_OutNode.cxx b/src/GraphEditor/DataFlowEditor_OutNode.cxx index 00e9329..8e60fcc 100644 --- a/src/GraphEditor/DataFlowEditor_OutNode.cxx +++ b/src/GraphEditor/DataFlowEditor_OutNode.cxx @@ -349,6 +349,10 @@ bool GraphEditor::OutNode::LoadNodes(map< string , int > & aMapOfNodes , aNode.theAuthor.c_str() , aNode.theContainer.c_str() , aNode.theComment.c_str() , aNode.theCoords.theX , aNode.theCoords.theY ) ; + + // insert container into < ComponentName, Container > map for corresponding component + Graph()->InsertToMapOfComponentNameContainer( aNode.theComponentName.c_str(), aNode.theContainer.c_str() ) ; // mkr : PAL13947 + string * aNodetheName = new string( aNode.theName ) ; aMapOfNodes[ *aNodetheName ] = Graph()->GetGraphNodeIndex( anInNode->Name() ) ; if ( anInNode->IsOneOfInLineNodes() || anInNode->IsMacroNode() ) { @@ -1015,6 +1019,11 @@ bool GraphEditor::OutNode::Valid() { Graph()->ComputingNodes() ; #endif + if ( !Graph()->ValidGOTO() ) { // mkr : PAL12575 + cdebug << "Editor::OutNode::Valid This DataFlow have not valid GOTO(ValidGOTO)." << endl ; + RetVal = false ; + } + if ( RetVal ) { _Valid = true ; } @@ -1059,7 +1068,7 @@ bool GraphEditor::OutNode::Executable() { StreamGraph()->SubStreamGraphsNumber( SubStreamGraphsNumber ) ; Graph()->InLineServices() ; - + // if ( kLoopSwitch ) { if ( !Graph()->ValidLoops() ) { cdebug << "Editor::OutNode::Executable This DataFlow have not valid Loops(ValidLoops)." << endl ; @@ -1191,7 +1200,7 @@ bool GraphEditor::OutNode::LinkSaveXML( QDomDocument & Graph , QDomElement & lin valuetype.appendChild( aField ) ; switch (aLink.aLinkValue.type()->kind()) { case CORBA::tk_string: { - char* retstr ; + const char* retstr ; aLink.aLinkValue >>= retstr; // f << Tabs << " " << retstr << "" << endl ; QDomElement value = Graph.createElement( "value" ) ; @@ -1217,7 +1226,7 @@ bool GraphEditor::OutNode::LinkSaveXML( QDomDocument & Graph , QDomElement & lin break ; } case CORBA::tk_double: { - double d; + CORBA::Double d; aLink.aLinkValue >>= d; // f << Tabs << " " << d << "" << endl ; QDomElement value = Graph.createElement( "value" ) ; @@ -1230,7 +1239,7 @@ bool GraphEditor::OutNode::LinkSaveXML( QDomDocument & Graph , QDomElement & lin break ; } case CORBA::tk_long: { - long l; + CORBA::Long l; aLink.aLinkValue >>= l; // f << Tabs << " " << l << "" << endl ; QDomElement value = Graph.createElement( "value" ) ; @@ -1239,13 +1248,17 @@ bool GraphEditor::OutNode::LinkSaveXML( QDomDocument & Graph , QDomElement & lin aField = Graph.createTextNode( aKind ) ; datavalue.appendChild( value ) ; value.appendChild( aField ) ; -// MESSAGE( "ToString( long ) " << l ); +// MESSAGE( "ToString( CORBA::Long ) " << l ); break ; } case CORBA::tk_objref: { char* retstr ; CORBA::Object_ptr obj ; - aLink.aLinkValue >>= obj ; +#if OMNIORB_VERSION >= 4 + aLink.aLinkValue >>= (CORBA::Any::to_object)obj; +#else + aLink.aLinkValue >>= obj; +#endif retstr = _Orb->object_to_string(obj ); // f << Tabs << " " << retstr << "" << endl ; QDomElement value = Graph.createElement( "value" ) ; @@ -1336,19 +1349,19 @@ bool GraphEditor::OutNode::LinkSavePY( ostream &f , const char * aGraphName , << ".Input( " ; switch (aLink.aLinkValue.type()->kind()) { case CORBA::tk_string: { - char* retstr ; + const char* retstr ; aLink.aLinkValue >>= retstr; f << "'" << retstr << "'" ; break ; } case CORBA::tk_double: { - double d; + CORBA::Double d; aLink.aLinkValue >>= d; f << d ; break ; } case CORBA::tk_long: { - long l; + CORBA::Long l; aLink.aLinkValue >>= l; f << l ; break ; @@ -1356,7 +1369,11 @@ bool GraphEditor::OutNode::LinkSavePY( ostream &f , const char * aGraphName , case CORBA::tk_objref: { char* retstr ; CORBA::Object_ptr obj ; - aLink.aLinkValue >>= obj ; +#if OMNIORB_VERSION >= 4 + aLink.aLinkValue >>= (CORBA::Any::to_object)obj; +#else + aLink.aLinkValue >>= obj; +#endif retstr = _Orb->object_to_string(obj ); f << "'" << retstr << "'" ; break ; diff --git a/src/GraphEditor/DataFlowEditor_OutNode.hxx b/src/GraphEditor/DataFlowEditor_OutNode.hxx index 156d6a3..3dcc430 100644 --- a/src/GraphEditor/DataFlowEditor_OutNode.hxx +++ b/src/GraphEditor/DataFlowEditor_OutNode.hxx @@ -62,14 +62,14 @@ namespace GraphEditor { const GraphBase::ListOfSLinks &aDatas ) ; // bool GraphEditor::OutNode::LinkSaveXML( ostream &f , char *Tabs , - bool GraphEditor::OutNode::LinkSaveXML( QDomDocument & Graph , QDomElement & link , + bool LinkSaveXML( QDomDocument & Graph , QDomElement & link , GraphBase::SLink aLink , bool wdata ) const ; // bool SaveXML(ostream &f ) ;QDomDocument & Graph bool SaveXML( ostream & f , QDomDocument & Graph , bool aSuperGraph , QDomElement & supergraph ) ; - bool GraphEditor::OutNode::LinkSavePY( ostream &f , + bool LinkSavePY( ostream &f , const char *aGraphName , GraphBase::SLink aLink , bool fromparam , diff --git a/src/GraphEditor/Makefile.in b/src/GraphEditor/Makefile.in index 341562f..87bfd0e 100644 --- a/src/GraphEditor/Makefile.in +++ b/src/GraphEditor/Makefile.in @@ -58,12 +58,11 @@ LIB_CLIENT_IDL = SALOME_ModuleCatalog.idl \ BIN_SRC = BIN_SERVER_IDL = -CPPFLAGS+= $(PYTHON_INCLUDES) $(QT_MT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) \ - $(KERNEL_CXXFLAGS) +CPPFLAGS+= $(PYTHON_INCLUDES) $(QT_MT_INCLUDES) $(KERNEL_CXXFLAGS) CXXFLAGS+= -g -D__x86__ -D__linux__ -ftemplate-depth-42 -Wall \ $(KERNEL_CXXFLAGS) LDFLAGS+= -lSalomeNS -lSalomeLifeCycleCORBA -lSalomeSuperVisionBase -lOpUtil -lSALOMELocalTrace \ - -lc $(QT_MT_LIBS) $(OGL_LIBS) $(KERNEL_LDFLAGS) + -lc $(QT_MT_LIBS) $(KERNEL_LDFLAGS) #LIBS += -Xlinker -export-dynamic $(PYTHON_LIBS) diff --git a/src/GraphExecutor/DataFlowExecutor_DataFlow.cxx b/src/GraphExecutor/DataFlowExecutor_DataFlow.cxx index 25e0bdd..4552e07 100644 --- a/src/GraphExecutor/DataFlowExecutor_DataFlow.cxx +++ b/src/GraphExecutor/DataFlowExecutor_DataFlow.cxx @@ -239,8 +239,8 @@ bool GraphExecutor::DataFlow::OutputOfAny( const char * aNodeName , for ( i = 0 ; i < anOutPort->InPortsSize() ; i++ ) { const char * ToNodeName = anOutPort->ChangeInPorts( i )->NodeName() ; const char * ToParameterName = anOutPort->ChangeInPorts( i )->PortName() ; - GraphBase::ComputingNode * aComputingNode = Graph()->GetChangeGraphNode( ToNodeName ) ; if ( strcmp( ToNodeName , Name() ) ) { + GraphBase::ComputingNode * aComputingNode = Graph()->GetChangeGraphNode( ToNodeName ) ; GraphExecutor::InNode * aLinkedNode = (GraphExecutor::InNode * ) aComputingNode->GetInNode() ; cdebug << pthread_self() << "/" << aLinkedNode->ThreadNo() << "GraphExecutor::DataFlow::OutputOfAny to Node " @@ -293,8 +293,9 @@ bool GraphExecutor::DataFlow::OutputOfAny( const char * aNodeName , anOutPort->Value() ) ; } else { - cdebug << "GraphExecutor::DataFlow::OutputOfAny to Graph " << ToNodeName - << "(" << ToParameterName << ") ignored" << endl ; + cdebug << pthread_self() << "GraphExecutor::DataFlow::OutputOfAny to Node " + << ToNodeName << "(" << ToParameterName << ") from MacroNode " << aNodeName + << ") ignored" << endl ; } } cdebug_out << pthread_self() << "/" << ThreadNo() << " GraphExecutor::DataFlow::OutputOfAny " << RetVal @@ -302,6 +303,31 @@ bool GraphExecutor::DataFlow::OutputOfAny( const char * aNodeName , return RetVal ; } +//JR NPAL14110 09.02.2007 : SetWaitingStates was missing in SubGraph of MacroNode !... +bool GraphExecutor::DataFlow::SetWaitingStates( const char * ToServiceParameterName ) { + cdebug_in << pthread_self() << "/" << ThreadNo() << "GraphExecutor::DataFlow::SetWaitingStates( " + << ToServiceParameterName << " ) MacroGraph " << Name() << endl ; + bool RetVal = true ; + State( GraphExecutor::DataWaitingState ) ; + Done( false ) ; + GraphBase::OutPort * anOutPort ; + anOutPort = Graph()->GetChangeInDataNodePort( ToServiceParameterName ) ; + anOutPort->PortState( SUPERV::WaitingState ) ; + anOutPort->PortDone( false ) ; + cdebug << pthread_self() << "GraphExecutor::DataFlow::SetWaitingStates " << Name() + << " " << State() << " " << ToServiceParameterName << " " << anOutPort->PortState() + << " Done : " << anOutPort->PortDone() << endl ; + if ( ! anOutPort->IsGate() ) { + GraphExecutor::InNode * anInNode = (GraphExecutor::InNode * ) Graph()->GetChangeGraphNode( anOutPort->InPorts( 0 )->NodeName() )->GetInNode() ; + cdebug << pthread_self() << "GraphExecutor::DataFlow::SetWaitingStates : " + << anInNode->Name() << "->SetWaitingStates( NULL ) for Port " + << anOutPort->InPorts( 0 )->PortName() << endl ; + anInNode->SetWaitingStates( NULL ) ; + } + cdebug_out << "GraphExecutor::DataFlow::SetWaitingStates() " << RetVal << endl; + return RetVal ; +} + bool GraphExecutor::DataFlow::Kill() { cdebug_in << "GraphExecutor::DataFlow::Kill()" << endl; bool RetVal = GraphExecutor::OutNode::Kill() ; diff --git a/src/GraphExecutor/DataFlowExecutor_DataFlow.hxx b/src/GraphExecutor/DataFlowExecutor_DataFlow.hxx index caf4bf4..dc8038b 100644 --- a/src/GraphExecutor/DataFlowExecutor_DataFlow.hxx +++ b/src/GraphExecutor/DataFlowExecutor_DataFlow.hxx @@ -70,13 +70,14 @@ namespace GraphExecutor { bool ChangeInputData( const char * ToNodeName , const char * ToParameterName , const CORBA::Any aValue = CORBA::Any() ) ; + bool InputOfAny( const char * ToServiceParameterName , const CORBA::Any & aValue , const bool SomeDataReady = true ) ; - bool OutputOfAny( const char * aNodeName , const char * ToServiceParameterName , const CORBA::Any & aValue ) ; + bool SetWaitingStates( const char * ToServiceParameterName ) ; bool IsValid() ; bool IsExecutable() ; diff --git a/src/GraphExecutor/DataFlowExecutor_DynInvoke.cxx b/src/GraphExecutor/DataFlowExecutor_DynInvoke.cxx index 6580d65..b8ab049 100644 --- a/src/GraphExecutor/DataFlowExecutor_DynInvoke.cxx +++ b/src/GraphExecutor/DataFlowExecutor_DynInvoke.cxx @@ -65,7 +65,7 @@ void GraphExecutor::InNode::DynInvoke(Engines::Component_ptr objComponent , #if DynInvokeTrace switch ( Type ) { case CORBA::tk_string : { - char * t ; + const char * t ; data >>= t ; cdebug << "ArgIn" << i << " : " << ArgName << " Value " << t << " (string)" << endl ; @@ -84,25 +84,25 @@ void GraphExecutor::InNode::DynInvoke(Engines::Component_ptr objComponent , break ; } case CORBA::tk_short : { - short s ; + CORBA::Short s ; data >>= s ; cdebug << "ArgIn" << i << " : " << ArgName << " Value " << s << " (short)" << endl ; break ; } case CORBA::tk_long : { - long l ; + CORBA::Long l ; data >>= l ; - cdebug << "ArgIn" << i << " : " << ArgName << " Value " << l << " (long)" << endl ; + cdebug << "ArgIn" << i << " : " << ArgName << " Value " << l << " (CORBA::Long)" << endl ; break ; } case CORBA::tk_float : { - float f ; + CORBA::Float f ; data >>= f ; cdebug << "ArgIn" << i << " : " << ArgName << " Value " << f << " (float)" << endl ; break ; } case CORBA::tk_double : { - double d ; + CORBA::Double d ; data >>= d ; cdebug << "ArgIn" << i << " : " << ArgName << " Value " << d << " (double)" << endl ; break ; @@ -135,7 +135,7 @@ void GraphExecutor::InNode::DynInvoke(Engines::Component_ptr objComponent , #if DynInvokeTrace switch ( Type ) { case CORBA::tk_string : { - char * t ; + cont char * t ; data >>= t ; cdebug << "ArgOut" << i << " : " << ArgName << " Value " << t << " (string)" << endl ; break ; @@ -153,25 +153,25 @@ void GraphExecutor::InNode::DynInvoke(Engines::Component_ptr objComponent , break ; } case CORBA::tk_short : { - short s ; + CORBA::Short s ; data >>= s ; cdebug << "ArgOut" << i << " : " << ArgName << " Value " << s << " (short)" << endl ; break ; } case CORBA::tk_long : { - long l ; + CORBA::Long l ; data >>= l ; - cdebug << "ArgOut" << i << " : " << ArgName << " Value " << l << " (long)" << endl ; + cdebug << "ArgOut" << i << " : " << ArgName << " Value " << l << " (CORBA::Long)" << endl ; break ; } case CORBA::tk_float : { - float f ; + CORBA::Float f ; data >>= f ; cdebug << "ArgOut" << i << " : " << ArgName << " Value " << f << " (float)" << endl ; break ; } case CORBA::tk_double : { - double d ; + CORBA::Double d ; data >>= d ; cdebug << "ArgOut" << i << " : " << ArgName << " Value " << d << " (double)" << endl ; break ; @@ -196,8 +196,12 @@ void GraphExecutor::InNode::DynInvoke(Engines::Component_ptr objComponent , #endif } - req->invoke(); - + // IPAL9273, 9369, 9731 : replace blocking function invoke() with non blocking send_deferred() + // to provide the correct process of killing dataflow execution + req->send_deferred() ; + while( !req->poll_response() ) {} + req->get_response(); + if( req->env()->exception() ) { req->env()->exception()->_raise() ; return ; // pas utile ? diff --git a/src/GraphExecutor/DataFlowExecutor_FiniteStateMachine.cxx b/src/GraphExecutor/DataFlowExecutor_FiniteStateMachine.cxx index 8408f5c..36b70bf 100644 --- a/src/GraphExecutor/DataFlowExecutor_FiniteStateMachine.cxx +++ b/src/GraphExecutor/DataFlowExecutor_FiniteStateMachine.cxx @@ -728,6 +728,13 @@ void GraphExecutor::FiniteStateMachine::JoinThread( pthread_t aThread ) { } } +int GraphExecutor::FiniteStateMachine::ThreadsNumber() { + if( _ThreadList.begin() == _ThreadList.end() ) + return 0; + else + return _ThreadList.size(); +} + ostream & operator<< (ostream &f ,const GraphExecutor::AutomatonState & aState ) { switch (aState) { case GraphExecutor::UnKnownState : diff --git a/src/GraphExecutor/DataFlowExecutor_FiniteStateMachine.hxx b/src/GraphExecutor/DataFlowExecutor_FiniteStateMachine.hxx index 40f2c06..257c208 100644 --- a/src/GraphExecutor/DataFlowExecutor_FiniteStateMachine.hxx +++ b/src/GraphExecutor/DataFlowExecutor_FiniteStateMachine.hxx @@ -233,6 +233,8 @@ namespace GraphExecutor { void JoinThread() ; void JoinThread( pthread_t aThread ) ; + int ThreadsNumber() ; // mkr : IPAL14711 + const char * ControlStateName( const SUPERV::ControlState & aState ) const { return _ControlStateName[ aState ] ; } ; const char * StateName( const GraphExecutor::AutomatonState & aState ) const { diff --git a/src/GraphExecutor/DataFlowExecutor_InNode.cxx b/src/GraphExecutor/DataFlowExecutor_InNode.cxx index 028a970..bd312f4 100644 --- a/src/GraphExecutor/DataFlowExecutor_InNode.cxx +++ b/src/GraphExecutor/DataFlowExecutor_InNode.cxx @@ -1394,8 +1394,8 @@ void GraphExecutor::InNode::InitialState() 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 ; +//JR 21.02.2005 Debug Memory leak : *anAny <<= (CORBA::Long ) 1 ; + anAny <<= (CORBA::Long ) 1 ; anOutPort->SetValue( anAny ) ; _InitLoop = true ; cdebug << "InPort" << i << " " << anInPort->PortName() << " " << anInPort->PortStatus() @@ -1521,6 +1521,7 @@ void GraphExecutor::InNode::InitialState() } bool GraphExecutor::InNode::InitPythonFunctions(bool WithErr ) { + //JR Look at DataFlowExecutor for the meaning of WithErr cdebug_in << "GraphExecutor::InNode::InitPythonFunctions " << Name() << " WithErr " << WithErr << " PyFuncRunned() " << PyFuncRunned() << endl; bool Err = false ; @@ -1537,7 +1538,13 @@ bool GraphExecutor::InNode::InitPythonFunctions(bool WithErr ) { PyRunMethod = InitPyDynInvoke( InLineNode()->PyFuncName() , InLineNode()->PythonFunction() , OneErr ) ; - InLineNode()->PyRunMethod( PyRunMethod ) ; + // JR Debug : if we must have a python function and if we have not : error + if ( PyRunMethod ) { + InLineNode()->PyRunMethod( PyRunMethod ) ; + } + else if ( WithErr && strlen( InLineNode()->PyFuncName() ) ) { + OneErr = true ; + } } Err = Err || OneErr ; if ( OneErr && WithErr ) { @@ -1554,7 +1561,13 @@ bool GraphExecutor::InNode::InitPythonFunctions(bool WithErr ) { PyMoreMethod = InitPyDynInvoke( LoopNode()->PyMoreName() , LoopNode()->MorePythonFunction() , OneErr ) ; - LoopNode()->PyMoreMethod( PyMoreMethod ) ; + // JR Debug : if we must have a python function and if we have not : error + if ( PyMoreMethod ) { + LoopNode()->PyMoreMethod( PyMoreMethod ) ; + } + else if ( WithErr && strlen( LoopNode()->PyMoreName() ) ) { + OneErr = true ; + } } Err = Err || OneErr ; if ( OneErr && WithErr ) { @@ -1571,7 +1584,13 @@ bool GraphExecutor::InNode::InitPythonFunctions(bool WithErr ) { PyNextMethod = InitPyDynInvoke( LoopNode()->PyNextName() , LoopNode()->NextPythonFunction() , OneErr ) ; - LoopNode()->PyNextMethod( PyNextMethod ) ; + // JR Debug : if we must have a python function and if we have not : error + if ( PyNextMethod ) { + LoopNode()->PyNextMethod( PyNextMethod ) ; + } + else if ( WithErr && strlen( LoopNode()->PyNextName() ) ) { + OneErr = true ; + } } Err = Err || OneErr ; if ( OneErr && WithErr ) { @@ -1580,6 +1599,10 @@ bool GraphExecutor::InNode::InitPythonFunctions(bool WithErr ) { string( Name() ) ; _OutNode->Graph()->SetMessages( anErrorMessage ) ; } + //JR Debug 12854 + if ( Err ) { + PyFuncRunned( false ) ; + } cdebug << "GraphExecutor::InNode::InitPythonFunctions " << Name() << " PyRunMethod(Init) " << PyRunMethod << " PyMoreMethod " << PyMoreMethod << " PyNextMethod " << PyNextMethod << endl; @@ -1593,7 +1616,13 @@ bool GraphExecutor::InNode::InitPythonFunctions(bool WithErr ) { PyRunMethod = InitPyDynInvoke( InLineNode()->PyFuncName() , InLineNode()->PythonFunction() , OneErr ) ; - InLineNode()->PyRunMethod( PyRunMethod ) ; + // JR Debug : if we must have a python function and if we have not : error + if ( PyRunMethod != NULL ) { + InLineNode()->PyRunMethod( PyRunMethod ) ; + } + else if ( WithErr && strlen( InLineNode()->PyFuncName() ) ) { + OneErr = true ; + } } Err = Err || OneErr ; if ( OneErr && WithErr ) { @@ -1614,7 +1643,13 @@ bool GraphExecutor::InNode::InitPythonFunctions(bool WithErr ) { PyRunMethod = InitPyDynInvoke( InLineNode()->PyFuncName() , InLineNode()->PythonFunction() , OneErr ) ; - InLineNode()->PyRunMethod( PyRunMethod ) ; + // JR Debug : if we must have a python function and if we have not : error + if ( PyRunMethod != NULL ) { + InLineNode()->PyRunMethod( PyRunMethod ) ; + } + else if ( WithErr && strlen( InLineNode()->PyFuncName() ) ) { + OneErr = true ; + } } Err = Err || OneErr ; if ( OneErr && WithErr ) { @@ -1626,10 +1661,11 @@ bool GraphExecutor::InNode::InitPythonFunctions(bool WithErr ) { cdebug << "GraphExecutor::InNode::InitPythonFunctions " << Name() << " PyRunMethod " << PyRunMethod << endl; } } - Err = WithErr && Err ; + //JR Look at DataFlowExecutor : + // Err = WithErr && Err ; cdebug_out << "GraphExecutor::InNode::InitPythonFunctions " << Name() ; - if ( Err ) { - cdebug << " Error " << Err ; + if ( WithErr && Err ) { + cdebug << " Error " << WithErr && Err ; } cdebug << endl; return !Err ; @@ -1653,10 +1689,18 @@ const long GraphExecutor::InNode::CpuUsed( bool tot ) { cpu = Component()->CpuUsed_impl() ; } catch ( ... ) { - cdebug << "CpuUsed " << Name() << " --> Component()->CpuUsed_impl() ERROR catched " - << endl ; - State( GraphExecutor::ErroredState ) ; - _OutNode->State( GraphExecutor::ErroredState ) ; + if ( _OutNode->IsDone() ) { + cdebug << "CpuUsed " << Name() << " --> Component()->CpuUsed_impl() WARNING catched Graph is done " + << Automaton()->StateName( _OutNode->State() ) << endl ; + } + else { + cdebug << "CpuUsed " << Name() << " --> Component()->CpuUsed_impl() WARNING catched " + << Automaton()->StateName( _OutNode->State() ) << endl ; +//JR NPAL14110 09.02.2007 : If there is a shutdown of components ===> NodeState must not +// be aborted ... ==> Commented : + //JRState( GraphExecutor::ErroredState ) ; + //JR_OutNode->State( GraphExecutor::ErroredState ) ; + } cpu = -1 ; } } diff --git a/src/GraphExecutor/DataFlowExecutor_InNode.hxx b/src/GraphExecutor/DataFlowExecutor_InNode.hxx index 008c728..7b10bc3 100644 --- a/src/GraphExecutor/DataFlowExecutor_InNode.hxx +++ b/src/GraphExecutor/DataFlowExecutor_InNode.hxx @@ -459,7 +459,7 @@ namespace GraphExecutor { bool PyDynInvoke( PyObject * MyPyRunMethod , const char *method , ServicesAnyData * inParams , int nInParams , - ServicesAnyData * inParams , int nOutParams ) ; + ServicesAnyData * outParams, int nOutParams ) ; int Executing_SuspendAction() ; int SuspendedExecuting_ResumeAction() ; diff --git a/src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx b/src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx index 980aa50..ea4f238 100644 --- a/src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx +++ b/src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx @@ -85,6 +85,9 @@ int GraphExecutor::InNode::SendEvent( const GraphExecutor::NodeEvent anEvent ) { _OldState = State() ; _NextState = Automaton()->NextState( _OldState , anEvent ) ; if ( _NextState == _OldState ) { + string anErrorMessage = string( "Automaton error for node " ) + + string( Name() ) + " (SuperVision executor error)." ; + _OutNode->Graph()->SetMessages( anErrorMessage ) ; cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " GraphExecutor::InNodeThreads::SendEvent SameStates ERROR _OldState/_NextState " << _OldState << " Event " << Automaton()->EventName( anEvent ) << endl ; @@ -620,8 +623,8 @@ int GraphExecutor::InNode::executeAction() { char * msg = "Cannot pthread_create " ; perror( msg ) ; cdebug << ThreadNo() << " " << msg << " --> sleep(5)" << endl ; - cdebug << ThreadNo() << " PTHREAD_THREADS_MAX : " - << PTHREAD_THREADS_MAX << " pthread_create status : " ; + // cdebug << ThreadNo() << " PTHREAD_THREADS_MAX : " + // << PTHREAD_THREADS_MAX << " pthread_create status : " ; if ( pthread_sts == EAGAIN ) { cdebug << "EAGAIN(" << pthread_sts << ")" << endl ; cdebug << _OutNode->CreatedThreads() << " was created (and exited)" << endl ; @@ -634,6 +637,7 @@ int GraphExecutor::InNode::executeAction() { delete [] msg ; pthread_exit( msg ) ; } + _OutNode->setRunFuncThread( T ) ; // mkr : IPAL14711 #if ActionsTrace cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " executeAction has created thread " << T << endl ; @@ -888,7 +892,8 @@ int GraphExecutor::InNode::VoidAction() { int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() { #if SomeDataReadyActionTrace cdebug_in << pthread_self() << "/" << ThreadNo() << " " << Name() - << " DataWaiting_SomeDataReadyAction from " << DataFromNode() << endl; + << " DataWaiting_SomeDataReadyAction from " << DataFromNode() + << " " << GetNodeInPortsSize() << " Inport(s)" << endl; #endif unsigned int k; int InReady = 0 ; @@ -979,7 +984,8 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() { anOutPort = anInPort->GetOutPort() ; if ( anOutPort ) { #if SomeDataReadyActionTrace - cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort " + cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort" + << k << " " << anInPort->PortName() << " already setted to OutPort " << anOutPort->NodeName() << "( " << anOutPort->PortName() << " )" << endl ; #endif @@ -988,7 +994,8 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() { anOutPort = CoupledNode()->GetChangeOutPort( anInPort->PortName() ) ; if ( anOutPort ) { #if SomeDataReadyActionTrace - cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort " + cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort" + << k << " " << anInPort->PortName() << " change of OutPort from " << anInPort->GetOutPort()->NodeName() << "( " << anInPort->GetOutPort()->PortName() << " ) to " << anOutPort->NodeName() << "( " << anOutPort->PortName() << " )" @@ -996,7 +1003,8 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() { #endif } else { - cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort " + cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort" + << k << " " << anInPort->PortName() << " have NO OutPort ERROR " << endl ; return 0 ; } @@ -1007,7 +1015,8 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() { anOutPort = anInPort->GetOutPort() ; } #if SomeDataReadyActionTrace - cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort " + cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort" + << k << " " << anInPort->PortName() << " " << anInPort->PortState() << " " << anInPort->PortStatus() << " " << anInPort->Kind() ; if ( anOutPort ) { @@ -1044,6 +1053,21 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() { } #endif cdebug << endl ; +#endif +//JR 30.01.2007 : wrong debug for PAL12455 +#if 0 + // mkr : PAL12455 --> + // MacroNode : give immediately the value to the corresponding graph + if ( IsMacroNode() ) { + GraphExecutor::DataFlow * aMacroGraph = GraphMacroNode()->CoupledNode()->GraphEditor()->Executor() ; + cdebug << "SomeDataReadyAction MacroNode " << aMacroGraph->Name() << " --> InputOfAny " + << InReady << "/" << GetNodeInPortsSize() << " InPorts are Ready ( " + << anInPort->PortName() << " ) ===> InputOfAny" << endl ; +// GraphMacroNode()->MacroObject()->InputOfAny( anInPort->PortName() , *anOutPort->Value() ) ; +//JR 30.03.2005 aMacroGraph->InputOfAny( anInPort->PortName() , *anOutPort->Value() ) ; + aMacroGraph->InputOfAny( anInPort->PortName() , anOutPort->Value() ) ; + } + // mkr : PAL12455 <-- #endif } else if ( IsLoopNode() && anInPort->IsDataConnected() ) { @@ -1101,8 +1125,8 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() { InReady += 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 ; +//JR 21.02.2005 Debug Memory leak : *anAny <<= (CORBA::Long ) 1 ; + anAny <<= (CORBA::Long ) 1 ; _OutNode->Graph()->GetGraphNode( anOutPort->NodeName() )->GetChangeNodeOutGate()->SetValue( anAny ) ; #if SomeDataReadyActionTrace cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " " @@ -1134,7 +1158,7 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() { else if ( anInPort->IsGate() ) { //JR 30.03.2005 const CORBA::Any * theValue = anOutPort->Value() ; const CORBA::Any theValue = anOutPort->Value() ; - long GateOpened ; + CORBA::Long GateOpened ; //JR 30.03.2005 (*theValue) >>= GateOpened ; theValue >>= GateOpened ; if ( GateOpened != 0 ) { @@ -1228,10 +1252,32 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() { cdebug << pthread_self() << "/" << ThreadNo() << " Node " << Name() << " HasAllDataReady" << endl ; #endif +//JR 30.01.2007 Right Debug PAL12455 ---> +//That must be done only for DataConnected ports and only once + if ( IsMacroNode() ) { + GraphExecutor::DataFlow * aMacroGraph = GraphMacroNode()->CoupledNode()->GraphEditor()->Executor() ; + for ( k = 0 ; k < (unsigned int ) GetNodeInPortsSize() ; k++ ) { + GraphBase::InPort * anInPort = GetChangeNodeInPort(k) ; + GraphBase::OutPort * anOutPort ; + anOutPort = anInPort->GetOutPort() ; + if ( anInPort->IsDataConnected() ) { + cdebug << "SomeDataReadyAction MacroNode " << aMacroGraph->Name() + << " --> InputOfAny " << InReady << "/" << GetNodeInPortsSize() + << " InPorts are Ready ( " << anInPort->PortName() + << " ) ===> InputOfAny" << endl ; + aMacroGraph->InputOfAny( anInPort->PortName() , anOutPort->Value() ) ; + } + } + } +// <--- JR 30.01.2007 Right Debug PAL12455 HasAllDataReady( true ) ; // ==> Ready to execute res = 1 ; } else { // At least one Flag == 0 : +#if SomeDataReadyActionTrace + cdebug << pthread_self() << "/" << ThreadNo() << " Node " << Name() << " HasNOTAllDataReady " + << InReady << "/" << GetNodeInPortsSize() << " DoAllDataReadyIf " << DoAllDataReadyIf << endl ; +#endif HasAllDataReady( false ) ; res = SendEvent( GraphExecutor::NotAllDataReadyEvent ); } @@ -1780,7 +1826,7 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { //JR 29.09.2005 Debug for CEA (examples/GraphMacroNodes1) : // Set of value of the OutGate of the corresponding MacroNode was missing CORBA::Any anAny = CORBA::Any() ; - anAny <<= (long ) 1 ; + anAny <<= (CORBA::Long ) 1 ; GraphMacroNode()->GraphEditor()->Executor()->OutputOfAny( Name() , "Gate" , anAny ) ; #if TraceDataReady_ExecuteAction cdebug << "DataReady_ExecuteAction OutputOfAny( " << Name() << " , Gate , 1 )" << endl ; @@ -2310,7 +2356,7 @@ int GraphExecutor::InNode::Errored_ExecutingAction() { } #define SetWaitingStatesTrace 0 -// Set SUPERV::WaitingState to all InPorts +// Set SUPERV::WaitingState to all InPorts and Nodes void GraphExecutor::InNode::SetWaitingStates(GraphExecutor::InNode * EndNode ) { int i ; int j ; @@ -2332,9 +2378,9 @@ void GraphExecutor::InNode::SetWaitingStates(GraphExecutor::InNode * EndNode ) { if ( anOutPort ) { //JR 21.02.2005 Debug Memory leak : CORBA::Any * anAny = new CORBA::Any() ; CORBA::Any anAny = CORBA::Any() ; -// *anAny <<= (long ) 1 ; -//JR 21.02.2005 Debug Memory leak : *anAny <<= (long ) 0 ; - anAny <<= (long ) 0 ; +// *anAny <<= (CORBA::Long ) 1 ; +//JR 21.02.2005 Debug Memory leak : *anAny <<= (CORBA::Long ) 0 ; + anAny <<= (CORBA::Long ) 0 ; anOutPort->SetValue( anAny ) ; anInPort->PortState( SUPERV::WaitingState ) ; // delete anAny ; @@ -2357,6 +2403,17 @@ void GraphExecutor::InNode::SetWaitingStates(GraphExecutor::InNode * EndNode ) { cdebug << " --> InPort " << Name() << "( " << anInPort->PortName() << " ) " << anInPort->PortStatus() << " " << anInPort->PortState() << endl ; #endif +//JR NPAL14110 09.02.2007 : SetWaitingStates was missing in the corresponding SubGraph !... + if ( IsMacroNode() ) { + GraphExecutor::DataFlow * aMacroGraph = GraphMacroNode()->CoupledNode()->GraphEditor()->Executor() ; +#if SetWaitingStatesTrace + cdebug << ThreadNo() + << " --> GraphExecutor::InNodeThreads::SetWaitingStates MacroNode " << Name() + << " ---> MacroGraph " << aMacroGraph->Name() << " Inport " + << anInPort->PortName() << endl; +#endif + aMacroGraph->SetWaitingStates( anInPort->PortName() ) ; + } } for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) { GraphBase::OutPort * anOutPort = GetChangeNodeOutPort( i ) ; @@ -2507,8 +2564,8 @@ int GraphExecutor::InNode::Successed_SuccessAction() { if ( anOutPort ) { //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 ; +//JR 21.02.2005 Debug Memory leak : *anAny <<= (CORBA::Long ) 1 ; + anAny <<= (CORBA::Long ) 1 ; anOutPort->SetValue( anAny ) ; aLabelNode->GetChangeNodeInGate()->PortState( SUPERV::ReadyState ) ; // delete anAny ; @@ -2698,8 +2755,8 @@ int GraphExecutor::InNode::Successed_SuccessAction() { 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 ; +//JR 21.02.2005 Debug Memory leak : *anAny <<= (CORBA::Long ) 1 ; + anAny <<= (CORBA::Long ) 1 ; LoopOutPort->SetValue( anAny ) ; int j ; for ( j = 0 ; j < toNode->GetNodeInPortsSize() ; j++ ) { @@ -3193,14 +3250,15 @@ void GraphExecutor::InNode::InParametersSet( bool & Err , if ( anInPort->IsGate() ) { //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 ; +//JR 21.02.2005 Debug Memory leak : *anAny <<= (CORBA::Long ) 0 ; + anAny <<= (CORBA::Long ) 0 ; theOutPort->SetValue( anAny ) ; // delete anAny ; } - if ( !anInPort->IsDataStream() && + if ( !anInPort->IsDataStream() + && !anInPort->IsDataConnected() ) { - anInPort->PortState( SUPERV::WaitingState ) ; + anInPort->PortState( SUPERV::WaitingState ) ; } //JR 18.02.2005 Debug Memory leak : delete does not destroy that string ... // D.Name = CORBA::string_dup( anInPort->GetServicesParameter().Parametername ) ; @@ -3219,7 +3277,7 @@ void GraphExecutor::InNode::InParametersSet( bool & Err , const char * Type = anInPort->GetServicesParameter().Parametertype ; switch ( D.Value.type()->kind() ) { // { string , long , double , objref } case CORBA::tk_string: - char * t; + const char * t; D.Value >>= t; #if InParametersSetTrace cdebug << t << " (string)" ; @@ -3257,11 +3315,12 @@ void GraphExecutor::InNode::InParametersSet( bool & Err , // theOutPort->Value( D.Value ) ; } else if ( !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) { - long l ; - sscanf( t , "%ld" , &l ) ; + long ll ; + sscanf( t , "%ld" , &ll ) ; + CORBA::Long l = ll ; D.Value <<= l ; #if InParametersSetTrace - cdebug << "string '" << t << " --> long " << l ; + cdebug << "string '" << t << " --> CORBA::Long " << l ; #endif // theOutPort->Value( D.Value ) ; } @@ -3272,7 +3331,8 @@ void GraphExecutor::InNode::InParametersSet( bool & Err , #ifdef REDHAT // mkr : debug for PAL12255 D.Value <<= f ; #else - D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f)); +//JR D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f)); + D.Value <<= (CORBA::Float) f ; #endif #if InParametersSetTrace cdebug << "string '" << t << "' --> " << setw(25) << setprecision(18) << d << " --> float " << " = " @@ -3286,7 +3346,8 @@ void GraphExecutor::InNode::InParametersSet( bool & Err , #ifdef REDHAT // mkr : debug for PAL12255 D.Value <<= d ; #else - D.Value.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d)); +//JR D.Value.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d)); + D.Value <<= (CORBA::Double) d ; #endif #if InParametersSetTrace cdebug << "string '" << t << " --> double " << setw(25) << setprecision(18) << d ; @@ -3320,14 +3381,14 @@ void GraphExecutor::InNode::InParametersSet( bool & Err , theOutPort->StringValue( *GraphBase::Base::_fdebug ) ; cdebug << endl ; #endif - long l; + CORBA::Long l; D.Value >>= l; #if InParametersSetTrace - cdebug << l << " (long)" << endl ; + cdebug << l << " (CORBA::Long)" << endl ; #endif if ( !strcmp( Type , "string" ) ) { char t[40] ; - sprintf( t , "%ld" , l ) ; + sprintf( t , "%ld" , (long)l ) ; D.Value <<= t ; // theOutPort->Value( D.Value ) ; } @@ -3357,7 +3418,8 @@ void GraphExecutor::InNode::InParametersSet( bool & Err , #ifdef REDHAT // mkr : debug for PAL12255 D.Value <<= f ; #else - D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f)); +//JR D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f)); + D.Value <<= (CORBA::Float) f ; #endif // theOutPort->Value( D.Value ) ; } @@ -3367,7 +3429,8 @@ void GraphExecutor::InNode::InParametersSet( bool & Err , #ifdef REDHAT // mkr : debug for PAL12255 D.Value <<= d ; #else - D.Value.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d)); +//JR D.Value.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d)); + D.Value <<= (CORBA::Double) d ; #endif // theOutPort->Value( D.Value ) ; } @@ -3384,7 +3447,7 @@ void GraphExecutor::InNode::InParametersSet( bool & Err , #endif break; case CORBA::tk_double: - double d; + CORBA::Double d; D.Value >>= d; #if InParametersSetTrace cdebug << d << " (double)" << endl ; @@ -3414,8 +3477,8 @@ void GraphExecutor::InNode::InParametersSet( bool & Err , // theOutPort->Value( D.Value ) ; } else if ( !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) { - long l ; - l = (long ) d ; + CORBA::Long l ; + l = (CORBA::Long ) d ; D.Value <<= l ; // theOutPort->Value( D.Value ) ; } @@ -3425,7 +3488,8 @@ void GraphExecutor::InNode::InParametersSet( bool & Err , #ifdef REDHAT // mkr : debug for PAL12255 D.Value <<= f ; #else - D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f)); +//JR D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f)); + D.Value <<= (CORBA::Float) f ; #endif // theOutPort->Value( D.Value ) ; } @@ -3480,7 +3544,7 @@ void GraphExecutor::InNode::InParametersSet( bool & Err , // theOutPort->Value( D.Value ) ; } else if ( !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) { - long l = 0 ; + CORBA::Long l = 0 ; D.Value <<= l ; // theOutPort->Value( D.Value ) ; } @@ -3489,7 +3553,8 @@ void GraphExecutor::InNode::InParametersSet( bool & Err , #ifdef REDHAT // mkr : debug for PAL12255 D.Value <<= f ; #else - D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f)); +//JR D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f)); + D.Value <<= (CORBA::Float) f ; #endif // theOutPort->Value( D.Value ) ; } @@ -3498,7 +3563,8 @@ void GraphExecutor::InNode::InParametersSet( bool & Err , #ifdef REDHAT // mkr : debug for PAL12255 D.Value <<= d ; #else - D.Value.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d)); +//JR D.Value.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d)); + D.Value <<= (CORBA::Double) d ; #endif // theOutPort->Value( D.Value ) ; } @@ -3583,14 +3649,15 @@ void GraphExecutor::InNode::InOutParametersSet( int nOutParams , D.Value <<= s ; } else if ( !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) { - D.Value <<= (long ) 0 ; + D.Value <<= (CORBA::Long ) 0 ; } else if ( !strcmp( Type , "float" ) ) { float f = 0 ; #ifdef REDHAT // mkr : debug for PAL12255 D.Value <<= f ; #else - D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f)); +//JR D.Value.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f)); + D.Value <<= (CORBA::Float) f ; #endif } else if ( !strcmp( Type , "double" ) ) { @@ -3598,7 +3665,8 @@ void GraphExecutor::InNode::InOutParametersSet( int nOutParams , #ifdef REDHAT // mkr : debug for PAL12255 D.Value <<= d ; #else - D.Value.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d)); +//JR D.Value.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d)); + D.Value <<= (CORBA::Double) d ; #endif } else { @@ -3607,7 +3675,7 @@ void GraphExecutor::InNode::InOutParametersSet( int nOutParams , #if InParametersSetTrace switch (D.Value.type()->kind()) { // { string , long , double , objref } case CORBA::tk_string: - char * t; + const char * t; D.Value >>= t; cdebug << ThreadNo() << " " << t << "(string)" << endl ; break; @@ -3622,22 +3690,22 @@ void GraphExecutor::InNode::InOutParametersSet( int nOutParams , cdebug << ThreadNo() << " " << c << "(char)" << endl ; break; case CORBA::tk_short: - short s; + CORBA::Short s; D.Value >>= s; cdebug << ThreadNo() << " " << s << "(short)" << endl ; break; case CORBA::tk_long: - long l; + CORBA::Long l; D.Value >>= l; - cdebug << ThreadNo() << " " << l << "(long)" << endl ; + cdebug << ThreadNo() << " " << l << "(CORBA::Long)" << endl ; break; case CORBA::tk_float: - float f; + CORBA::Float f; D.Value >>= f; cdebug << ThreadNo() << " " << f << "(float)" << endl ; break; case CORBA::tk_double: - double d; + CORBA::Double d; D.Value >>= d; cdebug << ThreadNo() << " " << d << "(double)" << endl ; break; @@ -3696,7 +3764,7 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err , ServicesAnyData D = OutParametersList[i] ; switch (D.Value.type()->kind()) { // { string , long , double , objref } case CORBA::tk_string: { - char * t; + const char * t; D.Value >>= t; #if OutParametersSetTrace cdebug << ThreadNo() << " " << t << "(string)" << endl ; @@ -3706,7 +3774,7 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err , case CORBA::tk_boolean: { bool b ; D.Value >>= (CORBA::Any::to_boolean ) b; - long l = (long ) b ; + CORBA::Long l = (CORBA::Long ) b ; D.Value <<= l ; #if OutParametersSetTrace cdebug << ThreadNo() << " " << b << "(boolean)" << endl ; @@ -3716,7 +3784,7 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err , case CORBA::tk_char: { unsigned char c ; D.Value >>= (CORBA::Any::to_char ) c; - long l = (long ) c ; + CORBA::Long l = (CORBA::Long ) c ; D.Value <<= l ; #if OutParametersSetTrace cdebug << ThreadNo() << " " << c << "(char)" << endl ; @@ -3724,9 +3792,9 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err , break; } case CORBA::tk_short: { - short s; + CORBA::Short s; D.Value >>= s; - long l = (long ) s ; + CORBA::Long l = (CORBA::Long ) s ; D.Value <<= l ; #if OutParametersSetTrace cdebug << ThreadNo() << " " << s << "(short)" << endl ; @@ -3734,21 +3802,22 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err , break; } case CORBA::tk_long: { - long l; + CORBA::Long l; D.Value >>= l; #if OutParametersSetTrace - cdebug << ThreadNo() << " " << l << "(long)" << endl ; + cdebug << ThreadNo() << " " << l << "(CORBA::Long)" << endl ; #endif break; } case CORBA::tk_float: { - float f; + CORBA::Float f; D.Value >>= f; double d = (double ) f ; #ifdef REDHAT // mkr : debug for PAL12255 D.Value <<= d ; #else - D.Value.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d)); +//JR D.Value.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d)); + D.Value <<= (CORBA::Double) d ; #endif #if OutParametersSetTrace cdebug << ThreadNo() << " " << f << "(float)" << endl ; @@ -3756,7 +3825,7 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err , break; } case CORBA::tk_double: { - double d; + CORBA::Double d; D.Value >>= d; #if OutParametersSetTrace cdebug << ThreadNo() << " " << d << "(double)" << endl ; @@ -3795,7 +3864,7 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err , #if OutParametersSetTrace cdebug << " Gate " ; #endif - long l = 1; + CORBA::Long l = 1; OutParametersList[i].Value <<= l; anOutPort->SetValue( OutParametersList[i].Value ); } @@ -3868,6 +3937,10 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err , const char * ToNodeName = anOutPort->ChangeInPorts( j )->NodeName() ; if ( !strcmp( ToNodeName , _OutNode->Name() ) && _OutNode->Graph()->GraphMacroLevel() != 0 ) { +//JR NPAL14110 09.02.2007 : That must be done only at the end of SubGraph because we may +// have an output of the SubGraph in a Loop !... +// So that code must be done in CheckAllDone +#if 0 #if OutParametersSetTrace cdebug << "OutParametersSet ToNodeName " << _OutNode->Name() << " CoupledNode " << _OutNode->Graph()->CoupledNodeName() << _OutNode->Graph()->CoupledNode() @@ -3883,7 +3956,7 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err , << _OutNode->Graph()->CoupledNodeName() << " , " << anOutPort->ChangeInPorts( j )->PortName() << " , value )" << endl ; #endif - +#endif } else { GraphBase::ComputingNode * ToNode = _OutNode->Graph()->GetChangeGraphNode( ToNodeName ) ; @@ -3926,7 +3999,7 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err , #if OutParametersSetTrace switch ( anOutPort->Value().type()->kind() ) { case CORBA::tk_string: - char * t; + const char * t; (anOutPort->Value()) >>= t; cdebug << ThreadNo() << " Out" << i << " : " << t << "(string)" << endl ; break; @@ -3941,22 +4014,22 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err , cdebug << ThreadNo() << " Out" << i << " : " << c << "(char)" << endl ; break; case CORBA::tk_short: - short s; + CORBA::Short s; (anOutPort->Value()) >>= s; cdebug << ThreadNo() << " Out" << i << " : " << s << "(short)" << endl ; break; case CORBA::tk_long: - long l; + CORBA::Long l; (anOutPort->Value()) >>= l; - cdebug << ThreadNo() << " Out" << i << " : " << l << "(long)" << endl ; + cdebug << ThreadNo() << " Out" << i << " : " << l << "(CORBA::Long)" << endl ; break; case CORBA::tk_float: - float f; + CORBA::Float f; (anOutPort->Value()) >>= f; cdebug << ThreadNo() << " Out" << i << " : " << f << "(float)" << endl ; break; case CORBA::tk_double: - double d; + CORBA::Double d; (anOutPort->Value()) >>= d; cdebug << ThreadNo() << " Out" << i << " : " << d << "(double)" << endl ; break; @@ -4010,7 +4083,7 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err , << aGateOutPort->PortName() << " " << aGateOutPort->Kind() << " WITH DefaultPort" << endl ; #endif - long l = 1; + CORBA::Long l = 1; OutParametersList[0].Value <<= l ; aGateOutPort->SetValue( OutParametersList[0].Value ) ; } @@ -4037,7 +4110,7 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err , << aGateOutPort->PortName() << " " << aGateOutPort->Kind() << " NO DefaultPort" << " OrSwitch " << OrSwitch << " DefaultSwitch " << DefaultSwitch << endl ; #endif - long l = 0; + CORBA::Long l = 0; OutParametersList[0].Value <<= l ; aGateOutPort->SetValue( OutParametersList[0].Value ) ; } diff --git a/src/GraphExecutor/DataFlowExecutor_OutNode.cxx b/src/GraphExecutor/DataFlowExecutor_OutNode.cxx index fd8c1a1..55d1df5 100644 --- a/src/GraphExecutor/DataFlowExecutor_OutNode.cxx +++ b/src/GraphExecutor/DataFlowExecutor_OutNode.cxx @@ -31,6 +31,7 @@ using namespace std; #include "DataFlowExecutor_OutNode.hxx" #include "DataFlowEditor_DataFlow.hxx" +#include "DataFlowExecutor_DataFlow.hxx" // asv : 20.01.05 : changes involved with switching to old (HEAD) KERNEL //extern Engines_Container_i * _TheContainer ; @@ -55,6 +56,7 @@ GraphExecutor::OutNode::OutNode() { _ControlState = SUPERV::VoidState ; _State = GraphExecutor::UnKnownState ; _PyInitialized = false ; + _run_func_thread = 0; pthread_mutex_init( &_MutexWait , NULL ) ; pthread_mutex_init( &_PyMutexWait , NULL ) ; if ( pthread_cond_init( &_EventWait , NULL ) ) { @@ -96,6 +98,7 @@ GraphExecutor::OutNode::OutNode( CORBA::ORB_ptr ORB, _ControlState = SUPERV::VoidState ; _State = GraphExecutor::UnKnownState ; _PyInitialized = false ; + _run_func_thread = 0; _Orb = CORBA::ORB::_duplicate( ORB ) ; pthread_mutex_init( &_MutexWait , NULL ) ; pthread_mutex_init( &_PyMutexWait , NULL ) ; @@ -159,6 +162,7 @@ GraphExecutor::OutNode::OutNode( CORBA::ORB_ptr ORB, _ControlState = SUPERV::VoidState ; _State = GraphExecutor::UnKnownState ; _PyInitialized = false ; + _run_func_thread = 0; _Orb = CORBA::ORB::_duplicate( ORB ) ; pthread_mutex_init( &_MutexWait , NULL ) ; pthread_mutex_init( &_PyMutexWait , NULL ) ; @@ -519,6 +523,7 @@ bool GraphExecutor::OutNode::Run( const bool AndSuspend ) { _JustStarted = true ; RetVal = true ; int i ; + bool again = true ; for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) { GraphExecutor::InNode * anInNode = (GraphExecutor::InNode *) Graph()->GraphNodes( i )->GetInNode() ; anInNode->OutNode( this ) ; @@ -536,7 +541,12 @@ bool GraphExecutor::OutNode::Run( const bool AndSuspend ) { } anInNode->InitialState() ; if ( anInNode->IsOneOfInLineNodes() ) { - anInNode->InitPythonFunctions( false ) ; + //JR with Python2.3.4, we may get an error because of a normal previous error + bool sts = anInNode->InitPythonFunctions( false ) ; + if ( again && !sts ) { + sts = anInNode->InitPythonFunctions( false ) ; + again = false ; + } } } // One more time because inline nodes may share one definition of the same function @@ -573,6 +583,9 @@ bool GraphExecutor::OutNode::Run( const bool AndSuspend ) { } } */ + //JR Debug : if there was an error in initialisation of python functions, + // we must not try to execute the graph. + if ( RetVal ) { if ( Graph()->GraphMacroLevel() != 0 ) { cdebug << "GraphExecutor::OutNode::Run Execution starting GraphExecutor::Action_DataOk_RunService Node " << Name() << " GraphMacroLevel " << Graph()->GraphMacroLevel() << endl ; @@ -700,6 +713,19 @@ bool GraphExecutor::OutNode::Run( const bool AndSuspend ) { // Graph()->ObjImpl()->sendMessage( NOTIF_STEP, astr.str().c_str() ) ; RetVal = true ; } + //JR Debug + } + else { + State( GraphExecutor::ErroredState ) ; + Done( true ) ; + if ( IsDone() && Graph()->GraphMacroLevel() == 0 ) { + cdebug << " ==> theAutomaton->Executed() " << endl ; + theAutomaton->Executed() ; + } + else { + cdebug << " NO theAutomaton->Executed() " << endl ; + } + } } else { // PAL 8515 @@ -712,7 +738,7 @@ bool GraphExecutor::OutNode::Run( const bool AndSuspend ) { // two graphs execution with two different python functions with the same name // give aborted state for the second one //Example : GraphLoopSwitchOfSwitchNOTValid, GraphLoopSwitchs and GraphLoopSwitchsBranches - if ( IsDone() ) { + if ( IsDone() && Graph()->GraphMacroLevel() == 0 ) { cdebug << " ==> theAutomaton->Executed() " << endl ; theAutomaton->Executed() ; } @@ -814,9 +840,33 @@ void GraphExecutor::OutNode::CheckAllDone() { MESSAGE("================================================================================") ; cdebug << "================================================================================" << endl ; cdebug << Name() << " IS DONE : " << theAutomaton->StateName( AutomatonState() ) << " EventQSize " - << EventQSize() << endl ; + << EventQSize() << endl ; cdebug << "================================================================================" << endl ; + if ( Graph()->GraphMacroLevel() != 0 ) { +//JR NPAL14110 09.02.2007 : That must be done only at the end of SubGraph because we may +// have an output of the SubGraph in a Loop !... +// So that code must be done in CheckAllDone instead of OutParametersSet + cdebug << "CheckAllDone ToNodeName " << Name() << " CoupledNode " + << Graph()->CoupledNodeName() << Graph()->CoupledNode() + << endl ; + cdebug << "CheckAllDone GraphExecutor " << Graph()->CoupledNode()->GraphEditor()->Executor() << endl ; + const GraphBase::InPort * anInPort ; + GraphBase::OutPort * anOutPort ; + int i ; + for ( i = 0 ; i < Graph()->GetNodeOutDataNodePortsSize() ; i++ ) { + anInPort = Graph()->GetNodeOutDataNodePort( i ) ; + if ( !anInPort->IsGate() ) { + anOutPort = anInPort->GetOutPort() ; + Graph()->CoupledNode()->GraphEditor()->Executor()->OutputOfAny( Graph()->CoupledNodeName() , + anInPort->PortName() , + anOutPort->Value() ) ; + cdebug << "CheckAllDone OutputOfAny( " << Graph()->CoupledNodeName() << " , " + << anInPort->PortName() << " , value ) done" << endl ; + } + } + } + //PAL8520 //JR 23.02.2005, Debug : siftEvents() must be inside the pthread_mutex_lock if ( pthread_mutex_lock( &_MutexWait ) ) { @@ -935,7 +985,8 @@ void GraphExecutor::OutNode::ExitThread( pthread_t ThreadNumber ) { cdebug << pthread_self() << " ExitThread( " << ThreadNumber << " ) " << _Threads << " running threads " << _SuspendedThreads << " suspended threads IsDone() " << IsDone() ; - if ( IsDone() ) { + _run_func_thread = 0 ; // mkr : IPAL14711 + if ( IsDone() && Graph()->GraphMacroLevel() == 0 ) { cdebug << " ==> theAutomaton->Executed() " << endl ; theAutomaton->Executed() ; } @@ -2122,6 +2173,11 @@ bool GraphExecutor::OutNode::DoneWait() { perror("pthread_mutex_lock _DoneWait") ; exit( 0 ) ; } + while ( _run_func_thread || theAutomaton->ThreadsNumber() ) { + // mkr : IPAL14711 + // waiting for pthread_join in FiniteStateMachine + } + if ( Done() || IsKilled() ) Graph()->GraphEditor()->Editing(); // mkr : IPAL14572 : calling Editing() to indicate stop of execution cdebug_out << pthread_self() << " GraphExecutor::DoneWait " << this << " " << Name() << " " << State() << " : " << aret << endl ; return aret ; diff --git a/src/GraphExecutor/DataFlowExecutor_OutNode.hxx b/src/GraphExecutor/DataFlowExecutor_OutNode.hxx index 200d42b..4a2a7da 100644 --- a/src/GraphExecutor/DataFlowExecutor_OutNode.hxx +++ b/src/GraphExecutor/DataFlowExecutor_OutNode.hxx @@ -70,6 +70,8 @@ namespace GraphExecutor { list< GraphExecutor::NodeEvent > _Events ; list< GraphExecutor::AutomatonState > _States ; + pthread_t _run_func_thread ; + bool Valid() ; void UnValid() ; bool Executable() ; @@ -269,6 +271,8 @@ namespace GraphExecutor { const char *FromParameterName ) ; const long CpuUsed() ; const long CpuUsed( const char *aNodeName ) ; + + void setRunFuncThread( pthread_t theThread ) { _run_func_thread = theThread; } ; // mkr : IPAL14711 }; }; diff --git a/src/GraphExecutor/DataFlowExecutor_PyDynInvoke.cxx b/src/GraphExecutor/DataFlowExecutor_PyDynInvoke.cxx index 9e5a357..fbb8440 100644 --- a/src/GraphExecutor/DataFlowExecutor_PyDynInvoke.cxx +++ b/src/GraphExecutor/DataFlowExecutor_PyDynInvoke.cxx @@ -54,6 +54,15 @@ bool GraphExecutor::InNode::InitPython() { Py_InitModule( "InitPyRunMethod" , MethodPyRunMethod ) ; // asv : 20.01.05 : changes involved with switching to old (HEAD) KERNEL //_OutNode->SuperVisionContainer()->ActivatePythonExecution( "InitPyRunMethod" , MethodPyRunMethod ) ; + + // PAL10310: patch on omniORB + string aPyFunc; + aPyFunc = "import omnipatch\n" ; + if ( PyRun_SimpleString( (char *) aPyFunc.c_str() ) ) { + cdebug << ThreadNo() << " " << Name() << " PyRun_SimpleString ERROR " << endl << aPyFunc << endl ; + Automaton()->PyUnLock() ; + return false ; + } } // PyObject * Dictionnary = PyModule_GetDict( Module ) ; // InitPyDynInvokeError = PyErr_NewException( "InitPyDynInvokeError" , NULL , NULL ) ; @@ -97,8 +106,9 @@ bool GraphExecutor::InNode::InitPython() { aPyFunc += "import sys\n" ; aPyFunc += "import CORBA\n" ; aPyFunc += "import omniORB\n" ; + aPyFunc += "orb = CORBA.ORB_init( sys.argv , CORBA.ORB_ID )\n" ; aPyFunc += "def PyObjRef( IORObjStr ) :\n" ; - aPyFunc += " orb = CORBA.ORB_init( sys.argv , CORBA.ORB_ID )\n" ; + // aPyFunc += " orb = CORBA.ORB_init( sys.argv , CORBA.ORB_ID )\n" ; aPyFunc += " objref = orb.string_to_object( IORObjStr )\n" ; aPyFunc += " return objref\n" ; aPyFunc += "InitPyRunMethod.RunMethod( PyObjRef )\n" ; @@ -123,8 +133,9 @@ bool GraphExecutor::InNode::InitPython() { aPyFunc += "import sys\n" ; aPyFunc += "import CORBA\n" ; aPyFunc += "import omniORB\n" ; + aPyFunc += "orb = CORBA.ORB_init( sys.argv , CORBA.ORB_ID )\n" ; aPyFunc += "def PyObjIor( ObjRef ) :\n" ; - aPyFunc += " orb = CORBA.ORB_init( sys.argv , CORBA.ORB_ID )\n" ; + // aPyFunc += " orb = CORBA.ORB_init( sys.argv , CORBA.ORB_ID )\n" ; aPyFunc += " objIor = orb.object_to_string( ObjRef )\n" ; aPyFunc += " return objIor\n" ; aPyFunc += "InitPyRunMethod.RunMethod( PyObjIor )\n" ; @@ -172,6 +183,19 @@ 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 ; @@ -239,7 +263,7 @@ extern "C" PyObject * PyRunMethod( PyObject * dummy , PyObject * Args ) { return Result ; } -#define PyDynInvokeTrace 1 +#define PyDynInvokeTrace 0 bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , const char *method , ServicesAnyData * InParametersList , int nInParams , @@ -275,9 +299,9 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , PyObject * ArgsList = NULL ; PyObject * ArgValue = NULL ; PyObject * Result = NULL ; - PyObject * MyPyObjRefList = NULL ; + //PyObject * MyPyObjRefList = NULL ; PyObject * ResultObj = NULL ; - PyObject * MyPyObjIorList = NULL ; + //PyObject * MyPyObjIorList = NULL ; PyObject * ResultIor = NULL ; CORBA::Object_ptr ObjRef ; @@ -296,7 +320,7 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , sname = InParametersList[i].Name.c_str() ; switch ( data.type()->kind() ) { case CORBA::tk_string : { - char * t ; + const char * t ; data >>= t ; PyObject * ArgValue = Py_BuildValue( "s" , t ) ; PyTuple_SetItem( ArgsList , i , ArgValue ) ; @@ -332,7 +356,7 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , break ; } case CORBA::tk_short : { - short s ; + CORBA::Short s ; data >>= s ; PyObject * ArgValue = Py_BuildValue( "h" , s ) ; PyTuple_SetItem( ArgsList , i , ArgValue ) ; @@ -344,9 +368,16 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , break ; } case CORBA::tk_long : { - long l ; + CORBA::Long l ; data >>= l ; - PyObject * ArgValue = Py_BuildValue( "l" , l ) ; +// epa - Porting to 64-bit Linux:CORBA::Long is incorrectly treated as unsigned +// integer by Py_BuildValue("l", val) in Python 2.4.1. Using Py_BuildValue("i",val) +// seemsto help + PyObject * ArgValue = NULL; + if ( SIZEOF_LONG == 4 ) + ArgValue = Py_BuildValue( "l" , l ) ; + else + ArgValue = Py_BuildValue( "i" , l ) ; #if PyDynInvokeTrace cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value " << l << " ArgValue->ob_refcnt" << ArgValue->ob_refcnt << endl ; @@ -354,13 +385,13 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , PyTuple_SetItem( ArgsList , i , ArgValue ) ; #if PyDynInvokeTrace cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value " << l - << " (long) ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt" + << " (CORBA::Long) ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt" << ArgValue->ob_refcnt << endl ; #endif break ; } case CORBA::tk_float : { - float f ; + CORBA::Float f ; data >>= f ; PyObject * ArgValue = Py_BuildValue( "f" , f ) ; PyTuple_SetItem( ArgsList , i , ArgValue ) ; @@ -372,7 +403,7 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , break ; } case CORBA::tk_double : { - double d ; + CORBA::Double d ; data >>= d ; PyObject * ArgValue = Py_BuildValue( "d" , d ) ; PyTuple_SetItem( ArgsList , i , ArgValue ) ; @@ -384,27 +415,27 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , break ; } case CORBA::tk_objref : { - MyPyObjRefList = PyTuple_New( 1 ) ; - PyObject * ObjValue ; + //MyPyObjRefList = PyTuple_New( 1 ) ; + //PyObject * ObjValue ; #if OMNIORB_VERSION >= 4 data >>= (CORBA::Any::to_object ) ObjRef ; #else data >>= ObjRef ; #endif IORObjRef = ObjectToString( ObjRef ) ; - ObjValue = Py_BuildValue( "s" , IORObjRef ) ; - PyTuple_SetItem( MyPyObjRefList , 0 , ObjValue ) ; + //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 ; + cdebug << "ArgIn" << i << " : " << sname << " " << method << " " << " Value " << IORObjRef << " (objref) "<< endl ; + // << MyPyObjRef->ob_refcnt << "/" << MyPyObjRefList->ob_refcnt << endl ; #endif // ResultObj = PyEval_CallObject( MyPyObjRef , MyPyObjRefList ) ; - ResultObj = PyEvalCallObject( "PyObjRef" , MyPyObjRef , MyPyObjRefList ) ; + //ResultObj = PyEvalCallObject( "PyObjRef" , MyPyObjRef , MyPyObjRefList ) ; #if PyDynInvokeTrace - cdebug << "ObjValue->ob_refcnt" << ObjValue->ob_refcnt << endl ; + //cdebug << "ObjValue->ob_refcnt" << ObjValue->ob_refcnt << endl ; #endif - ArgValue = Py_BuildValue( "O" , ResultObj ) ; - PyTuple_SetItem( ArgsList , i , ArgValue ) ; + //ArgValue = Py_BuildValue( "O" , ResultObj ) ; + //PyTuple_SetItem( ArgsList , i , ArgValue ) ; #if PyDynInvokeTrace if ( ArgValue ) cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value (objref) ArgsList->ob_refcnt" @@ -412,22 +443,33 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , else cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value (objref) ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue is NULL" << endl ; - cdebug << "MyPyObjRefList->ob_refcnt " << MyPyObjRefList->ob_refcnt-1 << endl ; -#endif - Py_DECREF( MyPyObjRefList ) ; - if ( CORBA::is_nil( ObjRef ) ) { - ResultObj = NULL ; - } - else { -#if PyDynInvokeTrace - if ( ResultObj ) - cdebug << "ResultObj->ob_refcnt " << ResultObj->ob_refcnt-1 << endl ; - else - cdebug << "ResultObj is NULL" << endl ; -#endif - if ( ResultObj ) - Py_DECREF( ResultObj ) ; - } + //cdebug << "MyPyObjRefList->ob_refcnt " << MyPyObjRefList->ob_refcnt-1 << endl ; +#endif + ResultObj = PyObject_CallFunction( MyPyObjRef , "s",IORObjRef ) ; + if(ResultObj == NULL){ + PyErr_Print(); + ResultObj=Py_None; + Py_INCREF(ResultObj) ; + } + PyTuple_SetItem( ArgsList , i , ResultObj ) ; + cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value (objref) ArgsList->ob_refcnt" + << ArgsList->ob_refcnt << " ArgValue->ob_refcnt" << ResultObj->ob_refcnt << endl ; +// << ArgsList->ob_refcnt << " ArgValue->ob_refcnt" << ArgValue->ob_refcnt << endl ; + //cdebug << "MyPyObjRefList->ob_refcnt " << MyPyObjRefList->ob_refcnt-1 << endl ; + //Py_DECREF( MyPyObjRefList ) ; + //if ( CORBA::is_nil( ObjRef ) ) { + // ResultObj = NULL ; + //} + //else { + //#if PyDynInvokeTrace + //if ( ResultObj ) + //cdebug << "ResultObj->ob_refcnt " << ResultObj->ob_refcnt-1 << endl ; + //else + //cdebug << "ResultObj is NULL" << endl ; + //#endif + //if ( ResultObj ) + //Py_DECREF( ResultObj ) ; + //} break ; } default : { @@ -446,6 +488,7 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , if ( Result == NULL ) { cdebug_out << "GraphExecutor::InNode::PyDynInvoke Node " << Name() << " " << method << " Error Result == NULL" << endl ; + PyErr_Print(); RetVal = false ; } else { @@ -462,7 +505,7 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , else { ArgValue = Result ; } - if ( !PyString_Check( ArgValue ) ) { + if ( !ArgValue || !PyString_Check( ArgValue ) ) { cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (string)" << endl ; RetVal = false ; } @@ -471,9 +514,10 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , } data <<= t ; #if PyDynInvokeTrace - cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << t << " (string)" - << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt" - << ArgValue->ob_refcnt << endl ; + if ( ArgValue ) + cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << t << " (string)" + << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt" + << ArgValue->ob_refcnt << endl ; #endif break ; } @@ -486,7 +530,7 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , else { ArgValue = Result ; } - if ( !PyInt_Check( ArgValue ) ) { + if ( !ArgValue || !PyInt_Check( ArgValue ) ) { cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (boolean)" << endl ; RetVal = false ; } @@ -495,9 +539,10 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , } data <<= (CORBA::Any::from_boolean ) b ; #if PyDynInvokeTrace - cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << b << " (boolean)" - << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt" - << ArgValue->ob_refcnt << endl ; + if ( ArgValue ) + cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << b << " (boolean)" + << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt" + << ArgValue->ob_refcnt << endl ; #endif break ; } @@ -513,7 +558,7 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , //JR 04.04.2005 Debug if ( !PyInt_Check( ArgValue ) ) { //Difficult to understand that behavior ... Python char type is a string of length 1 ! // or type is int ... - if ( !PyString_Check( ArgValue ) && !PyInt_Check( ArgValue ) ) { + if ( !ArgValue || !PyString_Check( ArgValue ) && !PyInt_Check( ArgValue ) ) { cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (char)" << endl ; RetVal = false ; } @@ -522,9 +567,10 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , } data <<= (CORBA::Any::from_char ) c ; #if PyDynInvokeTrace - cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << c << " (char)" - << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt" - << ArgValue->ob_refcnt << endl ; + if ( ArgValue ) + cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << c << " (char)" + << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt" + << ArgValue->ob_refcnt << endl ; #endif break ; } @@ -537,7 +583,7 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , else { ArgValue = Result ; } - if ( !PyInt_Check( ArgValue ) ) { + if ( !ArgValue || !PyInt_Check( ArgValue ) ) { cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (short)" << endl ; RetVal = false ; } @@ -546,14 +592,15 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , } data <<= s ; #if PyDynInvokeTrace - cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << s << " (short)" - << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt" - << ArgValue->ob_refcnt << endl ; + if ( ArgValue ) + cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << s << " (short)" + << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt" + << ArgValue->ob_refcnt << endl ; #endif break ; } case CORBA::tk_long : { - long l = 0 ; + CORBA::Long l = 0 ; PyObject * ArgValue ; if ( PyTuple_Check( Result ) ) { ArgValue = PyTuple_GetItem( Result , i ) ; @@ -561,10 +608,10 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , else { ArgValue = Result ; } - if ( PyLong_Check( ArgValue ) ) { + if ( ArgValue && PyLong_Check( ArgValue ) ) { l = PyLong_AsLong( ArgValue ) ; } - else if ( PyInt_Check( ArgValue ) ) { + else if ( ArgValue && PyInt_Check( ArgValue ) ) { l = PyInt_AsLong( ArgValue ) ; } else { @@ -573,9 +620,10 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , } data <<= l ; #if PyDynInvokeTrace - cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << l << " (long)" - << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt" - << ArgValue->ob_refcnt << endl ; + if ( ArgValue ) + cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << l << " (CORBA::Long)" + << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt" + << ArgValue->ob_refcnt << endl ; #endif break ; } @@ -588,35 +636,43 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , else { ArgValue = Result ; } - if ( !PyFloat_Check( ArgValue ) ) { - // mkr : bug PAL12454 - if ( PyLong_Check( ArgValue ) ) { - cdebug << "ArgOut" << i << " : " << sname << " " << method << " OK (long)" << endl ; - long l = PyLong_AsLong( ArgValue ); - f = (float) l; - } - else if ( PyInt_Check( ArgValue ) ) { - cdebug << "ArgOut" << i << " : " << sname << " " << method << " OK (int)" << endl ; - long l = PyInt_AsLong( ArgValue ); - f = (float) l; + if ( ArgValue ) { + if ( !PyFloat_Check( ArgValue ) ) { + // mkr : bug PAL12454 + if ( PyLong_Check( ArgValue ) ) { + cdebug << "ArgOut" << i << " : " << sname << " " << method << " OK (CORBA::Long)" << endl ; + CORBA::Long l = PyLong_AsLong( ArgValue ); + f = (float) l; + } + else if ( PyInt_Check( ArgValue ) ) { + cdebug << "ArgOut" << i << " : " << sname << " " << method << " OK (int)" << endl ; + CORBA::Long l = PyInt_AsLong( ArgValue ); + f = (float) l; + } + else { + cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (float)" << endl ; + RetVal = false ; + } } else { - cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (float)" << endl ; - RetVal = false ; + f = PyFloat_AsDouble( ArgValue ) ; } } - else { - f = PyFloat_AsDouble( ArgValue ) ; + else { + cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (float)" << endl ; + RetVal = false ; } #ifdef REDHAT // mkr : debug for PAL12255 data <<= f ; #else - data.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f)); +//JR data.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f)); + data <<= (CORBA::Float) f ; #endif #if PyDynInvokeTrace - cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << f << " (float)" - << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt" - << ArgValue->ob_refcnt << endl ; + if ( ArgValue ) + cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << f << " (float)" + << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt" + << ArgValue->ob_refcnt << endl ; #endif break ; } @@ -629,41 +685,49 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , else { ArgValue = Result ; } - if ( !PyFloat_Check( ArgValue ) ) { - // mkr : bug PAL12454 - if ( PyLong_Check( ArgValue ) ) { - cdebug << "ArgOut" << i << " : " << sname << " " << method << " OK (long)" << endl ; - long l = PyLong_AsLong( ArgValue ); - d = (double) l; - } - else if ( PyInt_Check( ArgValue ) ) { - cdebug << "ArgOut" << i << " : " << sname << " " << method << " OK (int)" << endl ; - long l = PyInt_AsLong( ArgValue ); - d = (double) l; + if ( ArgValue ) { + if ( !PyFloat_Check( ArgValue ) ) { + // mkr : bug PAL12454 + if ( PyLong_Check( ArgValue ) ) { + cdebug << "ArgOut" << i << " : " << sname << " " << method << " OK (CORBA::Long)" << endl ; + CORBA::Long l = PyLong_AsLong( ArgValue ); + d = (double) l; + } + else if ( PyInt_Check( ArgValue ) ) { + cdebug << "ArgOut" << i << " : " << sname << " " << method << " OK (int)" << endl ; + CORBA::Long l = PyInt_AsLong( ArgValue ); + d = (double) l; + } + else { + cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (float)" << endl ; + RetVal = false ; + } } else { - cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (float)" << endl ; - RetVal = false ; + d = PyFloat_AsDouble( ArgValue ) ; } } - else { - d = PyFloat_AsDouble( ArgValue ) ; + else { + cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (float)" << endl ; + RetVal = false ; } #ifdef REDHAT // mkr : debug for PAL12255 data <<= d ; #else - data.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d)); +//JR data.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d)); + data <<= (CORBA::Double) d ; #endif #if PyDynInvokeTrace - cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << d << " (double)" - << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt" - << ArgValue->ob_refcnt << endl ; + if ( ArgValue ) + cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << d << " (double)" + << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt" + << ArgValue->ob_refcnt << endl ; #endif break ; } case CORBA::tk_objref : { PyObject * ObjIor ; - MyPyObjIorList = PyTuple_New( 1 ) ; + //MyPyObjIorList = PyTuple_New( 1 ) ; if ( PyTuple_Check( Result ) ) { ObjIor = PyTuple_GetItem( Result , i ) ; } @@ -671,25 +735,28 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , ObjIor = Result ; } #if PyDynInvokeTrace - cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << "(object reference) " - << " Result->ob_refcnt" << Result->ob_refcnt << " ObjIor->ob_refcnt" - << ObjIor->ob_refcnt << endl ; + if ( ObjIor ) + cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << "(object reference) " + << " Result->ob_refcnt" << Result->ob_refcnt << " ObjIor->ob_refcnt" + << ObjIor->ob_refcnt << endl ; #endif - Py_INCREF( ObjIor ) ; + //Py_INCREF( ObjIor ) ; // PyObject_Print( ObjIor , stdout , 0 ) ; - PyTuple_SetItem( MyPyObjIorList , 0 , ObjIor ) ; + //PyTuple_SetItem( MyPyObjIorList , 0 , ObjIor ) ; // ResultIor = PyEval_CallObject( MyPyObjIor , MyPyObjIorList ) ; - ResultIor = PyEvalCallObject( "PyObjIor" , MyPyObjIor , MyPyObjIorList ) ; + //ResultIor = PyEvalCallObject( "PyObjIor" , MyPyObjIor , MyPyObjIorList ) ; + ResultIor = PyObject_CallFunction( MyPyObjIor , "O",ObjIor ) ; #if PyDynInvokeTrace - cdebug << "ObjIor->ob_refcnt " << ObjIor->ob_refcnt-1 << endl ; + if ( ObjIor ) + cdebug << "ObjIor->ob_refcnt " << ObjIor->ob_refcnt-1 << endl ; #endif - Py_DECREF( ObjIor ) ; + //Py_DECREF( ObjIor ) ; #if PyDynInvokeTrace - cdebug << "MyPyObjIorList->ob_refcnt " << MyPyObjIorList->ob_refcnt-1 << endl ; + //cdebug << "MyPyObjIorList->ob_refcnt " << MyPyObjIorList->ob_refcnt-1 << endl ; #endif - Py_DECREF( MyPyObjIorList ) ; + //Py_DECREF( MyPyObjIorList ) ; #if PyDynInvokeTrace - cdebug << "MyPyObjIor->ob_refcnt " << MyPyObjIor->ob_refcnt << endl ; + //cdebug << "MyPyObjIor->ob_refcnt " << MyPyObjIor->ob_refcnt << endl ; #endif if ( ResultIor ) { char * IOR = NULL ; @@ -756,6 +823,7 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , } } else { + PyErr_Print(); cdebug_out << "GraphExecutor::InNode::PyDynInvoke Error ResultIor == NULL Node " << Name() << " method " << method << " " << endl ; RetVal = false ; @@ -823,6 +891,9 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod , Py_DECREF( ArgsList ) ; } + fflush(stdout); + fflush(stderr); + #if 0 { int i ; diff --git a/src/GraphExecutor/Makefile.in b/src/GraphExecutor/Makefile.in index 1d57765..81151cb 100644 --- a/src/GraphExecutor/Makefile.in +++ b/src/GraphExecutor/Makefile.in @@ -63,8 +63,7 @@ LIB_CLIENT_IDL = SALOME_ModuleCatalog.idl \ BIN_SRC = BIN_SERVER_IDL = -CPPFLAGS+= $(PYTHON_INCLUDES) $(QT_MT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) \ - $(KERNEL_CXXFLAGS) +CPPFLAGS+= $(PYTHON_INCLUDES) $(QT_MT_INCLUDES) $(OCC_INCLUDES) $(KERNEL_CXXFLAGS) CXXFLAGS+= -g -D__x86__ -D__linux__ -ftemplate-depth-42 -Wall \ $(KERNEL_CXXFLAGS) @@ -73,8 +72,7 @@ ifeq ($(OS),REDHAT) endif LDFLAGS+= -export-dynamic -lSalomeNS -lSalomeLifeCycleCORBA -lSalomeSuperVisionBase -lSalomeSuperVisionEditor -lOpUtil -lSALOMELocalTrace\ - -lc $(QT_MT_LIBS) $(OGL_LIBS) \ - $(KERNEL_LDFLAGS) + -lc $(QT_MT_LIBS) $(KERNEL_LDFLAGS) #LIBS += -Xlinker -export-dynamic $(PYTHON_LIBS) diff --git a/src/Makefile.in b/src/Makefile.in index d31285f..f600625 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -31,6 +31,10 @@ VPATH=.:@srcdir@ @COMMENCE@ -SUBDIRS = GraphBase GraphEditor GraphExecutor Supervision SUPERVGUI +SUBDIRS = GraphBase GraphEditor GraphExecutor Supervision +ifeq (@WITHIHM@,yes) + SUBDIRS+= SUPERVGUI +endif + @MODULE@ diff --git a/src/SUPERVGUI/SUPERVGUI.cxx b/src/SUPERVGUI/SUPERVGUI.cxx index feb934f..aced7fe 100644 --- a/src/SUPERVGUI/SUPERVGUI.cxx +++ b/src/SUPERVGUI/SUPERVGUI.cxx @@ -164,9 +164,9 @@ void SUPERVGUI::initialize( CAM_Application* app ) createSupervAction( 309, "ADDNODE" , "ICO_ADDNODE" ); createSupervAction( 310, "STEPBYSTEP" , "ICO_STEPBYSTEP" ); - createSupervAction( 311, "POP_RENAME" ); + createSupervAction( 311, "POP_RENAME", "", Key_F2 ); createSupervAction( 312, "POP_DISPLAY" ); - createSupervAction( 313, "POP_DELETE" ); + createSupervAction( 313, "POP_DELETE", "", Key_Delete ); // ----- create menu ----------------- int fileId = createMenu( tr( "MEN_FILE" ), -1, -1 ); @@ -455,65 +455,76 @@ void SUPERVGUI::setMain( SUIT_ViewWindow* w) { } void SUPERVGUI::displayDataflow() { - Trace("SUPERVGUI::displayDataflow"); - OB_Browser* aBrowser = (( SalomeApp_Application* )application())->objectBrowser(); - SUPERV_Graph aDataFlow; - QString aIORName; - - OB_ListItem* item = (OB_ListItem*)(aBrowser->listView()->currentItem()); - _PTR(SObject) aObj - ( (( SalomeApp_Study* )(application()->activeStudy()))->studyDS()->FindObjectID(item->text(2).latin1()) ); - _PTR(GenericAttribute) anAttr; - if (aObj->FindAttribute(anAttr, "AttributeIOR")) { - _PTR(AttributeIOR) anIOR ( anAttr ); - aIORName = QString(anIOR->Value().c_str()); - if (isContains(study, aIORName)) { - if (QMessageBox::warning(application()->desktop(), tr("WARNING"), - tr("MSG_GRAPH_DISPLAYED").arg(""), - QMessageBox::Yes, QMessageBox::No) == QMessageBox::No) - return; - } - //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")); + Trace("SUPERVGUI::displayDataflow"); + + OB_Browser* aBrowser = getApp()->objectBrowser(); + OB_ListItem* item = (OB_ListItem*)(aBrowser->listView()->currentItem()); + + SalomeApp_Study* anAppStudy = (SalomeApp_Study*)(getApp()->activeStudy()); + _PTR(SObject) aObj (anAppStudy->studyDS()->FindObjectID(item->text(2).latin1())); + + SUPERV_Graph aDataFlow; + QString aIORName; + + _PTR(GenericAttribute) anAttr; + if (aObj->FindAttribute(anAttr, "AttributeIOR")) { + _PTR(AttributeIOR) anIOR ( anAttr ); + aIORName = QString(anIOR->Value().c_str()); + if (isContains(study, aIORName)) { + if (QMessageBox::warning(application()->desktop(), tr("WARNING"), + tr("MSG_GRAPH_DISPLAYED").arg(""), + QMessageBox::Yes, QMessageBox::No) == QMessageBox::No) return; - } - /* ASV: 20.10.04: fix for 6896 - if (aDataFlow->IsStreamGraph()) { - SUPERV_StreamGraph aDataFlowStream = aDataFlow->ToStreamGraph(); - if (SUPERV_isNull(aDataFlowStream)) { - QMessageBox::warning(0, tr("ERROR"), tr("MSG_ACCESS_BAD_IOR")); - return; - } - aDataFlow = aDataFlowStream; - } - */ } - SUPERVGraph_ViewFrame* aViewFrame; - if ( !myInitialViewFrame ) { - // first case : create a ViewFrame object - aViewFrame = dynamic_cast( createGraph() ); - } - else { - // second case : get empty initial view frame as new ViewFrame object - aViewFrame = myInitialViewFrame; - // mkr : PAL8237 : remove first "gag" Main from children - // srn: commented as it cases on application exit "X Windows error" - //aViewFrame->removeChild( aViewFrame->queryList("SUPERVGUI_Main")->first() ); + //SUPERV_Graph 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; } - if( aViewFrame ) { - main = new SUPERVGUI_Main( aViewFrame, application()->desktop(), aDataFlow ); - registerGraph( aIORName, main ); - aViewFrame->show(); + /* ASV: 20.10.04: fix for 6896 + if (aDataFlow->IsStreamGraph()) { + SUPERV_StreamGraph aDataFlowStream = aDataFlow->ToStreamGraph(); + if (SUPERV_isNull(aDataFlowStream)) { + QMessageBox::warning(0, tr("ERROR"), tr("MSG_ACCESS_BAD_IOR")); + return; + } + aDataFlow = aDataFlowStream; } + */ + } - if ( myInitialViewFrame ) { - myInitialViewFrame = 0; - myIVFBackgroundColor = QColor(); - } + SUPERVGraph_ViewFrame* aViewFrame; + if ( !myInitialViewFrame ) { + // first case : create a ViewFrame object + aViewFrame = dynamic_cast( createGraph() ); + } + else { + // second case : get empty initial view frame as new ViewFrame object + aViewFrame = myInitialViewFrame; + // mkr : IPAL12991 --> + SUPERVGraph_View* view = myInitialViewFrame->getViewWidget(); + if (view) + unregisterGraph(dynamic_cast(view)); + // mkr : IPAL12991 <-- + // mkr : PAL8237 : remove first "gag" Main from children + // srn: commented as it cases on application exit "X Windows error" + //aViewFrame->removeChild( aViewFrame->queryList("SUPERVGUI_Main")->first() ); + delete view; + } + + if ( aViewFrame ) { + main = new SUPERVGUI_Main( aViewFrame, application()->desktop(), aDataFlow ); + registerGraph( aIORName, main ); + aViewFrame->show(); + } + + if ( myInitialViewFrame ) { + myInitialViewFrame = 0; + myIVFBackgroundColor = QColor(); + } } @@ -562,8 +573,12 @@ void SUPERVGUI::renameDataflow() { if ( !SUPERV_isNull(aStreamDataFlow) ) aStreamDataFlow->SetName( nm.latin1() ); } - else + else { aDataFlow->SetName( nm.latin1() ); + } + + // update "Save" icon and menu state, if dataflow is published + SUPERVGUI_Main::setModifiedFlag(); } } // mkr : PAL7037 <-- @@ -707,6 +722,13 @@ bool SUPERVGUI::createDataflow( const NEW_DF_MODE mode, bool theInitialDF ) { else { // 2. get empty initial view frame as new ViewFrame object aViewFrame = myInitialViewFrame; + // mkr : IPAL12991 --> + if ( myInitialViewFrame ) { + SUPERVGraph_View* view = myInitialViewFrame->getViewWidget(); + if (view) + unregisterGraph(dynamic_cast(view)); + } + // mkr : IPAL12991 <-- // mkr : PAL8237 : remove first "gag" Main from children // srn: commented as it cases on application exit "X Windows error" //aViewFrame->removeChild( aViewFrame->queryList("SUPERVGUI_Main")->first() ); @@ -904,7 +926,7 @@ void SUPERVGUI::deleteObject() { if (QMessageBox::warning(application()->desktop(), tr("WARNING"), tr("MSG_ASK_DELETE"), - QMessageBox::No, QMessageBox::Yes) != QMessageBox::Yes) + QMessageBox::Yes, QMessageBox::No) != QMessageBox::Yes) return; SALOME_ListIteratorOfListIO It( aList ); @@ -1039,12 +1061,8 @@ void SUPERVGUI::fillInterfaceNameMap() { //get component SALOME_ModuleCatalog::Acomponent_ptr aComponent = (*aModuleCatalog)->GetComponent(aCompList[ind1]); if ( aComponent != NULL ) { - //get interface list - SALOME_ModuleCatalog::ListOfInterfaces_var anIntList = aComponent->GetInterfaceList(); - for (int ind2 = 0; ind2 < anIntList->length(); ind2++) { - const char* anIntName = anIntList[ind2]; - myInterfaceNameMap.insert(QString(anIntName), QString(aComponent->componentname())); - } + // mkr : PAL13135 + myInterfaceNameMap.insert(QString(aComponent->componentusername()), QString(aComponent->componentname())); } } } diff --git a/src/SUPERVGUI/SUPERVGUI_ArrayView.cxx b/src/SUPERVGUI/SUPERVGUI_ArrayView.cxx index 9b15978..da2af8a 100644 --- a/src/SUPERVGUI/SUPERVGUI_ArrayView.cxx +++ b/src/SUPERVGUI/SUPERVGUI_ArrayView.cxx @@ -193,8 +193,7 @@ void SUPERVGUI_ArrayView::contentsMouseMoveEvent(QMouseEvent* theEvent) { // QToolTip for title and label for SUPERVGUI_CanvasCellNode SUPERVGUI_ToolTip* aTT = new SUPERVGUI_ToolTip(this); - QPoint aPoint1 = inverseWorldMatrix().map(theEvent->pos()); - aTT->maybeTip(aPoint1); + aTT->maybeTip(theEvent->pos()); } void SUPERVGUI_ArrayView::contentsMouseReleaseEvent(QMouseEvent* theEvent) { @@ -205,67 +204,133 @@ void SUPERVGUI_ArrayView::contentsMouseReleaseEvent(QMouseEvent* theEvent) { } } -void SUPERVGUI_ToolTip::maybeTip(const QPoint& theP) { - // compute collision rectangle - QRect aSel(theP.x()-MARGIN, theP.y()-MARGIN, 1+2*MARGIN, 1+2*MARGIN); +void SUPERVGUI_ToolTip::maybeTip(const QPoint& thePos) { + // mkr : 23.11.2006 - PAL13957 - modifications for correct tooltips displaying after scroll or zoom + QPoint theP = ((QCanvasView*)parentWidget())->inverseWorldMatrix().map(thePos); + + int avX, avY; + ((QCanvasView*)parentWidget())->contentsToViewport(theP.x(), theP.y(), avX, avY); + QPoint avP(avX, avY); - QCanvasItemList l = ((QCanvasView*)parentWidget())->canvas()->collisions(aSel); - for (QCanvasItemList::Iterator it = l.begin(); it != l.end(); ++it) { + QWMatrix aWM = ((QCanvasView*)parentWidget())->worldMatrix(); + + // compute collision rectangle for nodes, ports + QRect aNodeSel(theP.x()-MARGIN, theP.y()-MARGIN, 1+2*MARGIN, 1+2*MARGIN); + + QCanvasItemList lN = ((QCanvasView*)parentWidget())->canvas()->collisions(aNodeSel); + for (QCanvasItemList::Iterator it = lN.begin(); it != lN.end(); ++it) + { // tooltip for node - if ((*it)->rtti() == SUPERVGUI_Canvas::Rtti_Node) { + if ((*it)->rtti() == SUPERVGUI_Canvas::Rtti_Node) + { SUPERVGUI_CanvasNodePrs* aNodePrs = (SUPERVGUI_CanvasNodePrs*) (*it); QObject* anObj = aNodePrs->getObject(theP); - if (anObj->inherits("SUPERVGUI_CanvasNode")) { - + if (anObj->inherits("SUPERVGUI_CanvasNode")) + { QRect aTitleRect = aNodePrs->getTitleRect(); QRect aLabelRect = aNodePrs->getLabelRect(); QRect aStatusRect = aNodePrs->getStatusRect(); if (aTitleRect.bottom()+1 == aLabelRect.top() && - aLabelRect.bottom()+1 == aStatusRect.top()) { - QRect aTipRect(aTitleRect.left(), aTitleRect.top(), aTitleRect.width(), - aTitleRect.height() + aLabelRect.height() + aStatusRect.height()); - tip(aTipRect, ((SUPERVGUI_CanvasNode*)anObj)->getToolTipText()); + aLabelRect.bottom()+1 == aStatusRect.top()) + { + ((QCanvasView*)parentWidget())->contentsToViewport((int)(aTitleRect.left()*aWM.m11()), + (int)(aTitleRect.top()*aWM.m22()), + avX, avY); + QRect avTipRect(avX, avY, + (int)(aTitleRect.width()*aWM.m11()), + (int)((aTitleRect.height() + aLabelRect.height() + aStatusRect.height())*aWM.m22())); + tip(avTipRect, ((SUPERVGUI_CanvasNode*)anObj)->getToolTipText()); return; } - if (aTitleRect.contains(theP, true)) { - tip(aTitleRect, ((SUPERVGUI_CanvasNode*)anObj)->getToolTipText()); + if (aTitleRect.contains(theP, true)) + { + ((QCanvasView*)parentWidget())->contentsToViewport((int)(aTitleRect.left()*aWM.m11()), + (int)(aTitleRect.top()*aWM.m22()), + avX, avY); + QRect avTipRect(avX, avY, + (int)(aTitleRect.width()*aWM.m11()), (int)(aTitleRect.height()*aWM.m22())); + tip(avTipRect, ((SUPERVGUI_CanvasNode*)anObj)->getToolTipText()); return; } - if (aLabelRect.contains(theP, true)) { - tip(aLabelRect, ((SUPERVGUI_CanvasNode*)anObj)->getToolTipText()); + if (aLabelRect.contains(theP, true)) + { + ((QCanvasView*)parentWidget())->contentsToViewport((int)(aLabelRect.left()*aWM.m11()), + (int)(aLabelRect.top()*aWM.m22()), + avX, avY); + QRect avTipRect(avX, avY, + (int)(aLabelRect.width()*aWM.m11()), (int)(aLabelRect.height()*aWM.m22())); + tip(avTipRect, ((SUPERVGUI_CanvasNode*)anObj)->getToolTipText()); return; } - if (aStatusRect.contains(theP, true)) { - tip(aStatusRect, ((SUPERVGUI_CanvasNode*)anObj)->getToolTipText()); + if (aStatusRect.contains(theP, true)) + { + ((QCanvasView*)parentWidget())->contentsToViewport((int)(aStatusRect.left()*aWM.m11()), + (int)(aStatusRect.top()*aWM.m22()), + avX, avY); + QRect avTipRect(avX, avY, + (int)(aStatusRect.width()*aWM.m11()), (int)(aStatusRect.height()*aWM.m22())); + tip(avTipRect, ((SUPERVGUI_CanvasNode*)anObj)->getToolTipText()); return; } } // tooltip for nodes' port - if (anObj->inherits("SUPERVGUI_CanvasPort")) { + if (anObj->inherits("SUPERVGUI_CanvasPort")) + { SUPERVGUI_CanvasPort* aPort = (SUPERVGUI_CanvasPort*)anObj; - tip(aPort->getPrs()->getPortRect(), - aPort->getEngine()->Type() + QString(" ") + aPort->getPrs()->getText()); + QRect aPortRect = aPort->getPrs()->getPortRect(); + ((QCanvasView*)parentWidget())->contentsToViewport((int)(aPortRect.left()*aWM.m11()), + (int)(aPortRect.top()*aWM.m22()), + avX, avY); + QRect avTipRect(avX, avY, + (int)(aPortRect.width()*aWM.m11()), (int)(aPortRect.height()*aWM.m22())); + tip(avTipRect, aPort->getEngine()->Type() + QString(" ") + aPort->getPrs()->getText()); return; } } + } + + // compute collision rectangle for links + QRect aLinkSel((int)( theP.x() + (theP.x()-avP.x())/aWM.m11() ) - MARGIN, + (int)( theP.y() + (theP.y()-avP.y())/aWM.m22() ) - MARGIN, + 1+2*MARGIN, 1+2*MARGIN); + + QCanvasItemList lL = ((QCanvasView*)parentWidget())->canvas()->collisions(aLinkSel); + for (QCanvasItemList::Iterator it = lL.begin(); it != lL.end(); ++it) + { // tootip for links' point - if ((*it)->rtti() == SUPERVGUI_Canvas::Rtti_LinkPoint) { - SUPERVGUI_CanvasPointPrs* aPrs = (SUPERVGUI_CanvasPointPrs*) (*it); - if (aPrs->getLink()->getMain()->getViewType() == CANVAS) - tip(aSel, aPrs->getLink()->getToolTipText()); - return; + if ((*it)->rtti() == SUPERVGUI_Canvas::Rtti_LinkPoint) + { + SUPERVGUI_CanvasPointPrs* aPrs = (SUPERVGUI_CanvasPointPrs*) (*it); + if (aPrs->getLink()->getMain()->getViewType() == CANVAS) + { + ((QCanvasView*)parentWidget())->contentsToViewport((int)(aLinkSel.left()*aWM.m11()), + (int)(aLinkSel.top()*aWM.m22()), + avX, avY); + QRect avTipRect(avX, avY, + (int)(aLinkSel.width()*aWM.m11()), (int)(aLinkSel.height()*aWM.m22())); + tip(avTipRect, aPrs->getLink()->getToolTipText()); + } + return; } // tooltip for links' edge - if ((*it)->rtti() == SUPERVGUI_Canvas::Rtti_LinkEdge) { - SUPERVGUI_CanvasEdgePrs* aPrs = (SUPERVGUI_CanvasEdgePrs*) (*it); - if (aPrs->getLink()->getMain()->getViewType() == CANVAS) - tip(aSel, aPrs->getLink()->getToolTipText()); - return; + if ((*it)->rtti() == SUPERVGUI_Canvas::Rtti_LinkEdge) + { + SUPERVGUI_CanvasEdgePrs* aPrs = (SUPERVGUI_CanvasEdgePrs*) (*it); + if (aPrs->getLink()->getMain()->getViewType() == CANVAS) + { + ((QCanvasView*)parentWidget())->contentsToViewport((int)(aLinkSel.left()*aWM.m11()), + (int)(aLinkSel.top()*aWM.m22()), + avX, avY); + QRect avTipRect(avX, avY, + (int)(aLinkSel.width()*aWM.m11()), (int)(aLinkSel.height()*aWM.m22())); + tip(avTipRect, aPrs->getLink()->getToolTipText()); + } + return; } - } + } } diff --git a/src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.cxx b/src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.cxx index a50fe23..5969c39 100644 --- a/src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.cxx +++ b/src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.cxx @@ -302,7 +302,88 @@ void SUPERVGUI_BrowseNodeDlg::onFieldActivated() myActiveField = (aField->isEditable())? aField : 0; } +namespace { + + QString getIORfromIO (const Handle(SALOME_InteractiveObject)& theIO, + SUPERVGUI * theModule) + { + QString ior (""); + if (!theIO->hasEntry()) return ior; + + SalomeApp_Study* anAppStudy = dynamic_cast(theModule->getActiveStudy()); + _PTR(SObject) aSObj (anAppStudy->studyDS()->FindObjectID(theIO->getEntry())); + + _PTR(GenericAttribute) anAttr; + if (aSObj->FindAttribute(anAttr, "AttributeIOR")) { + _PTR(AttributeIOR) anIOR (anAttr); + ior = anIOR->Value().c_str(); + return ior; + } + // old code, it is useless, because GetObject()> here will be NULL + // (because it is retrieved from by stored IOR) + /* + SALOMEDS_Study* aSStudy = dynamic_cast( aSObj->GetStudy().get() ); + SALOMEDS_SObject* aSSObj = dynamic_cast( aSObj.get() ); + if ( aSStudy && aSSObj ) + ior = aSStudy->ConvertObjectToIOR( aSSObj->GetObject() ).c_str(); + //*/ + + // new code + + // default value: null IOR (IOR:01000000010000000000...) + SalomeApp_Application* anApp = theModule->getApp(); + CORBA::Object_var aNullObj; + ior = anApp->orb()->object_to_string(aNullObj); + + // try to load a component data from an opened (presumably) study + _PTR(SComponent) aSComp = aSObj->GetFatherComponent(); + std::string aCompIOR; + if (!aSComp->ComponentIOR(aCompIOR)) { + std::string aCompDataType = aSComp->ComponentDataType(); + + // obtain a driver by a component data type + // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType + SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil(); + SALOME_LifeCycleCORBA * LCC = anApp->lcc(); + try { + CORBA::Object_var + anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType.c_str()); + if (CORBA::is_nil(anEngineObj)) + anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType.c_str()); + + if (!CORBA::is_nil(anEngineObj)) + anEngine = SALOMEDS::Driver::_narrow(anEngineObj); + } + catch (...) { + } + + if (!CORBA::is_nil(anEngine)) { + // try to load + _PTR(StudyBuilder) aStudyBuilder = aSObj->GetStudy()->NewBuilder(); + bool isOk = true; + try { + CORBA::String_var aDriverIOR = anApp->orb()->object_to_string(anEngine); + aStudyBuilder->LoadWith(aSComp, aDriverIOR.in()); + } + catch (...) { + isOk = false; + } + + if (isOk) { + // now try to obtain the IOR once again (after successfull component data loading) + if (aSObj->FindAttribute( anAttr, "AttributeIOR" )) { + _PTR(AttributeIOR) anIOR ( anAttr ); + ior = anIOR->Value().c_str(); + } + } + } // if (!CORBA::is_nil(anEngine)) + } // if (!aSComp->ComponentIOR(aCompIOR)) + + return ior; + } + +} // no name namespace /** * Slot, called when selection is changed @@ -310,7 +391,7 @@ void SUPERVGUI_BrowseNodeDlg::onFieldActivated() void SUPERVGUI_BrowseNodeDlg::onSelectionChanged() { if ( myActiveField ) { - + SALOME_ListIO aList; aList.Clear(); @@ -320,28 +401,13 @@ void SUPERVGUI_BrowseNodeDlg::onSelectionChanged() return; } - (( SalomeApp_Application* )(aSupMod->getActiveStudy()->application())) - ->selectionMgr()->selectedObjects( aList ); - - if( aList.Extent() == 1 ) { + SalomeApp_Application* anApp = aSupMod->getApp(); + anApp->selectionMgr()->selectedObjects( aList ); + + if ( aList.Extent() == 1 ) { Handle( SALOME_InteractiveObject ) anIO = aList.First(); if ( anIO->hasEntry() ) { - _PTR(SObject) aObj ( dynamic_cast( aSupMod->getActiveStudy() )-> - studyDS()->FindObjectID( anIO->getEntry() ) ); - - _PTR(GenericAttribute) anAttr; - QString ior(""); - - if (aObj->FindAttribute( anAttr, "AttributeIOR" ) ) { - _PTR(AttributeIOR) anIOR ( anAttr ); - ior = anIOR->Value().c_str(); - } - else { - 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(); - } + QString ior = ::getIORfromIO(anIO, aSupMod); myActiveField->setData( ior ); } } @@ -476,35 +542,20 @@ void SUPERVGUI_GetValueDlg::onSelectionChanged() { 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 ) { + + SalomeApp_Application* anApp = aSupMod->getApp(); + anApp->selectionMgr()->selectedObjects( aList ); + + if ( aList.Extent() == 1 ) { Handle( SALOME_InteractiveObject ) anIO = aList.First(); if ( anIO->hasEntry() ) { - _PTR(SObject) aObj ( dynamic_cast( aSupMod->getActiveStudy() )-> - studyDS()->FindObjectID( anIO->getEntry() ) ); - - _PTR(GenericAttribute) anAttr; - QString ior(""); - - if (aObj->FindAttribute( anAttr, "AttributeIOR" ) ) { - _PTR(AttributeIOR) anIOR ( anAttr ); - ior = anIOR->Value().c_str(); - } - else { - 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(); - } + QString ior = ::getIORfromIO(anIO, aSupMod); myField->setData( ior ); } } diff --git a/src/SUPERVGUI/SUPERVGUI_Canvas.cxx b/src/SUPERVGUI/SUPERVGUI_Canvas.cxx index b3070b1..ddb63f9 100644 --- a/src/SUPERVGUI/SUPERVGUI_Canvas.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Canvas.cxx @@ -52,8 +52,10 @@ ihmList->removeRef(ihmNode); \ ihmNode->merge(); \ ihmNode = getNode(aCNodeEnd); \ - ihmList->removeRef(ihmNode); \ - ihmNode->merge(); \ + if (ihmNode) { \ + ihmList->removeRef(ihmNode); \ + ihmNode->merge(); \ + } \ } \ } @@ -206,7 +208,7 @@ void SUPERVGUI_Canvas::sync() { */ void SUPERVGUI_Canvas::merge() { if (SUPERV_isNull(myMain->getDataflow())) return; - + SUPERVGUI_CanvasNode* ihmNode; QObjectList* ihmList = queryList("SUPERVGUI_CanvasNode"); SUPERV_Nodes nodes = myMain->getDataflow()->Nodes(); @@ -228,6 +230,43 @@ void SUPERVGUI_Canvas::merge() { UPDATECONTROLNODES(LNodes); UPDATECONTROLNODES(SNodes); + /* + n = nodes->LNodes.length(); + for (int i=0; iLNodes[i]); + SUPERV_CNode aCNodeEnd = SUPERV::CNode::_narrow(nodes->LNodes[i]->Coupled()); + ihmNode = getNode(aCNode); + SUPERVGUI_CanvasNode* ihmNodeEnd = getNode(aCNodeEnd); + if (ihmNode == NULL) { + myMain->addControlNode(aCNode, aCNodeEnd, false); + } else { + if (ihmNodeEnd) { + ihmNode->move(aCNode->X(), aCNode->Y()); + ihmList->removeRef(ihmNode); + ihmNode->merge(); + ihmNode = getNode(aCNodeEnd); + ihmList->removeRef(ihmNode); + ihmNode->merge(); + } + } + } + n = nodes->SNodes.length(); + for (int i=0; iSNodes[i]); + SUPERV_CNode aCNodeEnd = SUPERV::CNode::_narrow(nodes->SNodes[i]->Coupled()); + ihmNode = getNode(aCNode); + if (ihmNode == NULL) { + myMain->addControlNode(aCNode, aCNodeEnd, false); + } else { + ihmNode->move(aCNode->X(), aCNode->Y()); + ihmList->removeRef(ihmNode); + ihmNode->merge(); + ihmNode = getNode(aCNodeEnd); + ihmList->removeRef(ihmNode); + ihmNode->merge(); + } + } + //*/ QObjectListIt it(*ihmList); while ((ihmNode=(SUPERVGUI_CanvasNode*)it.current()) != 0) { diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasArray.cxx b/src/SUPERVGUI/SUPERVGUI_CanvasArray.cxx index 0e7dbb7..bbd3ffc 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasArray.cxx +++ b/src/SUPERVGUI/SUPERVGUI_CanvasArray.cxx @@ -45,7 +45,7 @@ else x += (CELL_WIDTH + CELL_SPACE); \ cell = getCellNode(aCNode); \ if (cell == NULL) { \ - SUPERVGUI_CanvasCellNode* aNode = new SUPERVGUI_CanvasCellNode(myMgr, this, myMain, aCNode); \ + SUPERVGUI_CanvasCellNode* aNode = SUPERVGUI_CanvasCellNode::Create(myMgr, this, myMain, aCNode); \ aNode->move(x, y); \ aNode->show(); \ aNode->sync(); \ @@ -67,12 +67,12 @@ SUPERV_CNode aCNodeEnd = SUPERV::CNode::_narrow(nodes->NodesName[co]->Coupled()); \ cell = getCellNode(aCNode); \ if (cell == NULL) { \ - SUPERVGUI_CanvasCellNode* aNode = new SUPERVGUI_CanvasCellNode( myMgr, this, myMain, aCNode); \ + SUPERVGUI_CanvasCellNode* aNode = SUPERVGUI_CanvasCellNode::Create(myMgr, this, myMain, aCNode); \ aNode->move(x, y); \ aNode->show(); \ aNode->sync(); \ y += (CELL_HEIGHT + CELL_SPACE); \ - SUPERVGUI_CanvasCellNode* aNodeEnd = new SUPERVGUI_CanvasCellEndNode( myMgr, this, myMain, aCNodeEnd, aNode); \ + SUPERVGUI_CanvasCellNode* aNodeEnd = SUPERVGUI_CanvasCellEndNode::Create(myMgr, this, myMain, aCNodeEnd, aNode); \ aNodeEnd->move(x, y); \ aNodeEnd->show(); \ aNodeEnd->sync(); \ @@ -283,7 +283,7 @@ SUPERVGUI_CanvasCellNode* SUPERVGUI_CanvasArray::getCellNode(SUPERV::CNode_ptr t SUPERVGUI_CanvasCellNode* SUPERVGUI_CanvasArray::addNode(SUPERV_CNode node) { Trace("SUPERVGUI_CanvasArray::addNode"); - SUPERVGUI_CanvasCellNode* n = new SUPERVGUI_CanvasCellNode( myMgr, this, myMain, node); + SUPERVGUI_CanvasCellNode* n = SUPERVGUI_CanvasCellNode::Create(myMgr, this, myMain, node); n->move(nodeX, nodeY); n->show(); update(); diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasControlNode.cxx b/src/SUPERVGUI/SUPERVGUI_CanvasControlNode.cxx index 5d9c498..4bfd924 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasControlNode.cxx +++ b/src/SUPERVGUI/SUPERVGUI_CanvasControlNode.cxx @@ -26,6 +26,7 @@ #include "SUPERVGUI_CanvasControlNode.h" #include "SUPERVGUI_CanvasControlNodePrs.h" #include "SUPERVGUI_CanvasCellNodePrs.h" +#include "SUPERVGUI_CanvasLink.h" #include "SUPERVGUI_Clipboard.h" #include "SUPERVGUI_Main.h" #include "SUPERVGUI.h" @@ -40,12 +41,22 @@ //===================================================================== // Compute node //===================================================================== -SUPERVGUI_CanvasComputeNode::SUPERVGUI_CanvasComputeNode( SUIT_ResourceMgr* mgr, QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode): - SUPERVGUI_CanvasNode( mgr, theParent, theMain, theNode) +SUPERVGUI_CanvasComputeNode::SUPERVGUI_CanvasComputeNode (SUIT_ResourceMgr* mgr, QObject* theParent, + SUPERVGUI_Main* theMain, SUPERV_CNode theNode): + SUPERVGUI_CanvasNode(mgr, theParent, theMain, theNode) { Trace("SUPERVGUI_CanvasComputeNode::SUPERVGUI_CanvasComputeNode"); } +SUPERVGUI_CanvasComputeNode* SUPERVGUI_CanvasComputeNode::Create + (SUIT_ResourceMgr* mgr, QObject* theParent, + SUPERVGUI_Main* theMain, SUPERV_CNode theNode) +{ + SUPERVGUI_CanvasComputeNode* aRet = new SUPERVGUI_CanvasComputeNode (mgr, theParent, theMain, theNode); + emit aRet->objectCreatedDeleted(); + return aRet; +} + QPopupMenu* SUPERVGUI_CanvasComputeNode::getPopupMenu(QWidget* theParent) { QPopupMenu* popup = SUPERVGUI_CanvasNode::getPopupMenu(theParent); @@ -67,16 +78,25 @@ QPopupMenu* SUPERVGUI_CanvasComputeNode::getPopupMenu(QWidget* theParent) //===================================================================== // Start control node //===================================================================== -SUPERVGUI_CanvasStartNode::SUPERVGUI_CanvasStartNode(SUIT_ResourceMgr* mgr, QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode): +SUPERVGUI_CanvasStartNode::SUPERVGUI_CanvasStartNode (SUIT_ResourceMgr* mgr, QObject* theParent, + SUPERVGUI_Main* theMain, SUPERV_CNode theNode): SUPERVGUI_CanvasNode( mgr, theParent, theMain, theNode), myCoupled(0) { Trace("SUPERVGUI_CanvasStartNode::SUPERVGUI_CanvasStartNode"); } +SUPERVGUI_CanvasStartNode* SUPERVGUI_CanvasStartNode::Create (SUIT_ResourceMgr* mgr, QObject* theParent, + SUPERVGUI_Main* theMain, SUPERV_CNode theNode) +{ + SUPERVGUI_CanvasStartNode* aRet = new SUPERVGUI_CanvasStartNode (mgr, theParent, theMain, theNode); + emit aRet->objectCreatedDeleted(); + return aRet; +} + SUPERVGUI_CanvasNodePrs* SUPERVGUI_CanvasStartNode::createPrs() const { - return new SUPERVGUI_CanvasStartNodePrs( resMgr(), getMain()->getCanvas(), + return new SUPERVGUI_CanvasStartNodePrs (resMgr(), getMain()->getCanvas(), (SUPERVGUI_CanvasStartNode*)this); } @@ -135,6 +155,8 @@ void SUPERVGUI_CanvasStartNode::remove() if (myCoupled) delete myCoupled; + emit objectCreatedDeleted(); // jfa : NPAL15529 + delete this; aCanvas->update(); @@ -176,8 +198,9 @@ void SUPERVGUI_CanvasStartNode::pastePort() //===================================================================== // End control node //===================================================================== -SUPERVGUI_CanvasEndNode::SUPERVGUI_CanvasEndNode(SUIT_ResourceMgr* mgr, QObject* theParent, SUPERVGUI_Main* theMain, - SUPERV_CNode theNode, SUPERVGUI_CanvasStartNode* theStart): +SUPERVGUI_CanvasEndNode::SUPERVGUI_CanvasEndNode (SUIT_ResourceMgr* mgr, QObject* theParent, + SUPERVGUI_Main* theMain, SUPERV_CNode theNode, + SUPERVGUI_CanvasStartNode* theStart): SUPERVGUI_CanvasNode(mgr, theParent, theMain, theNode), myCoupled(theStart) { @@ -185,6 +208,15 @@ SUPERVGUI_CanvasEndNode::SUPERVGUI_CanvasEndNode(SUIT_ResourceMgr* mgr, QObject* myCoupled->setCoupled(this); } +SUPERVGUI_CanvasEndNode* SUPERVGUI_CanvasEndNode::Create (SUIT_ResourceMgr* mgr, QObject* theParent, + SUPERVGUI_Main* theMain, SUPERV_CNode theNode, + SUPERVGUI_CanvasStartNode* theStart) +{ + SUPERVGUI_CanvasEndNode* aRet = new SUPERVGUI_CanvasEndNode (mgr, theParent, theMain, theNode, theStart); + emit aRet->objectCreatedDeleted(); + return aRet; +} + SUPERVGUI_CanvasNodePrs* SUPERVGUI_CanvasEndNode::createPrs() const { return new SUPERVGUI_CanvasEndNodePrs( resMgr(), getMain()->getCanvas(), @@ -213,12 +245,21 @@ QPopupMenu* SUPERVGUI_CanvasEndNode::getPopupMenu(QWidget* theParent) //===================================================================== // Goto control node //===================================================================== -SUPERVGUI_CanvasGotoNode::SUPERVGUI_CanvasGotoNode(SUIT_ResourceMgr* mgr, QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode): +SUPERVGUI_CanvasGotoNode::SUPERVGUI_CanvasGotoNode (SUIT_ResourceMgr* mgr, QObject* theParent, + SUPERVGUI_Main* theMain, SUPERV_CNode theNode): SUPERVGUI_CanvasNode(mgr, theParent, theMain, theNode) { Trace("SUPERVGUI_CanvasGotoNode::SUPERVGUI_CanvasGotoNode"); } +SUPERVGUI_CanvasGotoNode* SUPERVGUI_CanvasGotoNode::Create (SUIT_ResourceMgr* mgr, QObject* theParent, + SUPERVGUI_Main* theMain, SUPERV_CNode theNode) +{ + SUPERVGUI_CanvasGotoNode* aRet = new SUPERVGUI_CanvasGotoNode (mgr, theParent, theMain, theNode); + emit aRet->objectCreatedDeleted(); + return aRet; +} + SUPERVGUI_CanvasNodePrs* SUPERVGUI_CanvasGotoNode::createPrs() const { return new SUPERVGUI_CanvasGotoNodePrs( resMgr(), getMain()->getCanvas(), @@ -244,7 +285,43 @@ void SUPERVGUI_CanvasGotoNode::linkToNode() { if (aDlg->exec()) { QString aNodeName = aDlg->getName(); if (!aNodeName.isEmpty()) { //implement additional check from GUI side for bug PAL7007 + // mkr : here we should re/create (if it is not yet exists) a presentation for new + // Goto(OutGate)->CoupledNode(InGate) link, which will be created in SetCoupled method + + // check if GoTo node have coupled node + SUPERV_INode aCoupledNode = getGotoNode()->Coupled(); + if ( !SUPERV_isNull(aCoupledNode) ) + { // we got old coupled node + SUPERV_Port anInGatePort = aCoupledNode->GetInPort("InGate"); + SUPERV_Link anOldLinkEngine = anInGatePort->Link(); + if ( !SUPERV_isNull(anOldLinkEngine) ) + { // we got old link engine + SUPERVGUI_CanvasLink* anOldLinkPrs = getMain()->getCanvas()->getLink(anOldLinkEngine); + if ( anOldLinkPrs ) + { // delete old link presentation + delete anOldLinkPrs; + anOldLinkPrs = 0; + } + } + } + getGotoNode()->SetCoupled(aNodeName.latin1()); + + aCoupledNode = SUPERV::INode::_narrow(getMain()->getDataflow()->Node(aNodeName.latin1())); + if ( !SUPERV_isNull(aCoupledNode) ) + { // we got new coupled node + SUPERV_Port anInGatePort = aCoupledNode->GetInPort("InGate"); + SUPERV_Link aLinkEngine = anInGatePort->Link(); + if ( !SUPERV_isNull(aLinkEngine) ) + { // we got new link engine + if ( !getMain()->getCanvas()->getLink(aLinkEngine) ) + { // there is no presentation for such link engine => create it + SUPERVGUI_CanvasLink* aLink = new SUPERVGUI_CanvasLink(getMain()->getCanvas(), getMain(), aLinkEngine); + aLink->show(); + } + } + } + getMain()->getCanvas()->sync(); } } @@ -254,12 +331,21 @@ void SUPERVGUI_CanvasGotoNode::linkToNode() { //===================================================================== // Macro node //===================================================================== -SUPERVGUI_CanvasMacroNode::SUPERVGUI_CanvasMacroNode(SUIT_ResourceMgr* mgr, QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode): +SUPERVGUI_CanvasMacroNode::SUPERVGUI_CanvasMacroNode (SUIT_ResourceMgr* mgr, QObject* theParent, + SUPERVGUI_Main* theMain, SUPERV_CNode theNode): SUPERVGUI_CanvasComputeNode(mgr, theParent, theMain, theNode) { Trace("SUPERVGUI_CanvasMacroNode::SUPERVGUI_CanvasMacroNode"); } +SUPERVGUI_CanvasMacroNode* SUPERVGUI_CanvasMacroNode::Create (SUIT_ResourceMgr* mgr, QObject* theParent, + SUPERVGUI_Main* theMain, SUPERV_CNode theNode) +{ + SUPERVGUI_CanvasMacroNode* aRet = new SUPERVGUI_CanvasMacroNode (mgr, theParent, theMain, theNode); + emit aRet->objectCreatedDeleted(); + return aRet; +} + SUPERVGUI_CanvasNodePrs* SUPERVGUI_CanvasMacroNode::createPrs() const { return new SUPERVGUI_CanvasMacroNodePrs( resMgr(), getMain()->getCanvas(), @@ -344,9 +430,8 @@ void SUPERVGUI_CanvasMacroNode::remove() //===================================================================== // Cell node: node for table view //===================================================================== -SUPERVGUI_CanvasCellNode::SUPERVGUI_CanvasCellNode(SUIT_ResourceMgr* mgr, QObject* theParent, - SUPERVGUI_Main* theMain, - SUPERV_CNode theNode): +SUPERVGUI_CanvasCellNode::SUPERVGUI_CanvasCellNode (SUIT_ResourceMgr* mgr, QObject* theParent, + SUPERVGUI_Main* theMain, SUPERV_CNode theNode): SUPERVGUI_CanvasNode(mgr, theParent, theMain, theNode, true) { Trace("SUPERVGUI_CanvasCellNode::SUPERVGUI_CanvasCellNode"); @@ -363,6 +448,14 @@ SUPERVGUI_CanvasCellNode::SUPERVGUI_CanvasCellNode(SUIT_ResourceMgr* mgr, QObjec myIsControl = true; } +SUPERVGUI_CanvasCellNode* SUPERVGUI_CanvasCellNode::Create (SUIT_ResourceMgr* mgr, QObject* theParent, + SUPERVGUI_Main* theMain, SUPERV_CNode theNode) +{ + SUPERVGUI_CanvasCellNode* aRet = new SUPERVGUI_CanvasCellNode (mgr, theParent, theMain, theNode); + emit aRet->objectCreatedDeleted(); + return aRet; +} + SUPERVGUI_CanvasCellNode::~SUPERVGUI_CanvasCellNode() { } @@ -428,9 +521,8 @@ SUPERVGUI_CanvasNodePrs* SUPERVGUI_CanvasCellNode::createPrs() const return aPrs; } -SUPERVGUI_CanvasCellEndNode::SUPERVGUI_CanvasCellEndNode( SUIT_ResourceMgr* mgr, QObject* theParent, - SUPERVGUI_Main* theMain, - SUPERV_CNode theNode, +SUPERVGUI_CanvasCellEndNode::SUPERVGUI_CanvasCellEndNode (SUIT_ResourceMgr* mgr, QObject* theParent, + SUPERVGUI_Main* theMain, SUPERV_CNode theNode, SUPERVGUI_CanvasCellNode* theStart): SUPERVGUI_CanvasCellNode(mgr, theParent, theMain, theNode) { @@ -439,12 +531,25 @@ SUPERVGUI_CanvasCellEndNode::SUPERVGUI_CanvasCellEndNode( SUIT_ResourceMgr* mgr, //set end cell for start cell as pair myPairCell->setPairCell(dynamic_cast(this)); } + +SUPERVGUI_CanvasCellEndNode* SUPERVGUI_CanvasCellEndNode::Create (SUIT_ResourceMgr* mgr, QObject* theParent, + SUPERVGUI_Main* theMain, + SUPERV_CNode theNode, + SUPERVGUI_CanvasCellNode* theStart) +{ + SUPERVGUI_CanvasCellEndNode* aRet = + new SUPERVGUI_CanvasCellEndNode (mgr, theParent, theMain, theNode, theStart); + emit aRet->objectCreatedDeleted(); + return aRet; +} + /* bool SUPERVGUI_CanvasCellEndNode::setNodeName(QString theName) { return SUPERVGUI_CanvasNode::setNodeName(theName); } */ + //----------------------------------------------------------- //*************** Select Inline node dialog****************** // Taken from SUPERVGUI_ControlNode.cxx without change diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasControlNode.h b/src/SUPERVGUI/SUPERVGUI_CanvasControlNode.h index 8f6767f..ddb250e 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasControlNode.h +++ b/src/SUPERVGUI/SUPERVGUI_CanvasControlNode.h @@ -35,17 +35,23 @@ class SUPERVGUI_CanvasComputeNode : public SUPERVGUI_CanvasNode { Q_OBJECT public: - SUPERVGUI_CanvasComputeNode( SUIT_ResourceMgr*, QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode); + static SUPERVGUI_CanvasComputeNode* Create (SUIT_ResourceMgr*, QObject* theParent, + SUPERVGUI_Main* theMain, SUPERV_CNode theNode); virtual ~SUPERVGUI_CanvasComputeNode() {} virtual QPopupMenu* getPopupMenu(QWidget* theParent); + + protected: + SUPERVGUI_CanvasComputeNode (SUIT_ResourceMgr*, QObject* theParent, + SUPERVGUI_Main* theMain, SUPERV_CNode theNode); }; class SUPERVGUI_CanvasMacroNode : public SUPERVGUI_CanvasComputeNode { Q_OBJECT public: - SUPERVGUI_CanvasMacroNode( SUIT_ResourceMgr*, QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode); + static SUPERVGUI_CanvasMacroNode* Create (SUIT_ResourceMgr*, QObject* theParent, + SUPERVGUI_Main* theMain, SUPERV_CNode theNode); virtual ~SUPERVGUI_CanvasMacroNode() {} virtual QPopupMenu* getPopupMenu(QWidget* theParent); @@ -56,22 +62,27 @@ class SUPERVGUI_CanvasMacroNode : public SUPERVGUI_CanvasComputeNode { void exportDataflow(); protected: + SUPERVGUI_CanvasMacroNode (SUIT_ResourceMgr*, QObject* theParent, + SUPERVGUI_Main* theMain, SUPERV_CNode theNode); + virtual SUPERVGUI_CanvasNodePrs* createPrs() const; }; class SUPERVGUI_CanvasEndNode; -class SUPERVGUI_CanvasStartNode : public SUPERVGUI_CanvasNode { +class SUPERVGUI_CanvasStartNode : public SUPERVGUI_CanvasNode +{ Q_OBJECT public: - SUPERVGUI_CanvasStartNode( SUIT_ResourceMgr*, QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode); + static SUPERVGUI_CanvasStartNode* Create (SUIT_ResourceMgr*, QObject* theParent, + SUPERVGUI_Main* theMain, SUPERV_CNode theNode); virtual ~SUPERVGUI_CanvasStartNode() {} virtual bool setNodeName(QString aName); SUPERVGUI_CanvasEndNode* getCoupled() const { return myCoupled; } - + virtual QPopupMenu* getPopupMenu(QWidget* theParent); public slots: @@ -83,6 +94,9 @@ class SUPERVGUI_CanvasStartNode : public SUPERVGUI_CanvasNode { virtual void pastePort(); protected: + SUPERVGUI_CanvasStartNode (SUIT_ResourceMgr*, QObject* theParent, + SUPERVGUI_Main* theMain, SUPERV_CNode theNode); + virtual SUPERVGUI_CanvasNodePrs* createPrs() const; protected slots: @@ -93,7 +107,6 @@ class SUPERVGUI_CanvasStartNode : public SUPERVGUI_CanvasNode { void setCoupled(SUPERVGUI_CanvasEndNode* theEnd) { myCoupled = theEnd; } SUPERVGUI_CanvasEndNode* myCoupled; - }; @@ -101,8 +114,9 @@ class SUPERVGUI_CanvasEndNode : public SUPERVGUI_CanvasNode { Q_OBJECT public: - SUPERVGUI_CanvasEndNode( SUIT_ResourceMgr*, QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode, - SUPERVGUI_CanvasStartNode* theStart); + static SUPERVGUI_CanvasEndNode* Create (SUIT_ResourceMgr*, QObject* theParent, + SUPERVGUI_Main* theMain, SUPERV_CNode theNode, + SUPERVGUI_CanvasStartNode* theStart); virtual ~SUPERVGUI_CanvasEndNode() {} SUPERVGUI_CanvasStartNode* getCoupled() const { return myCoupled; } @@ -114,11 +128,14 @@ class SUPERVGUI_CanvasEndNode : public SUPERVGUI_CanvasNode { virtual void addInputPort();*/ protected: + SUPERVGUI_CanvasEndNode (SUIT_ResourceMgr*, QObject* theParent, + SUPERVGUI_Main* theMain, SUPERV_CNode theNode, + SUPERVGUI_CanvasStartNode* theStart); + virtual SUPERVGUI_CanvasNodePrs* createPrs() const; private: SUPERVGUI_CanvasStartNode* myCoupled; - }; @@ -126,7 +143,8 @@ class SUPERVGUI_CanvasGotoNode : public SUPERVGUI_CanvasNode { Q_OBJECT public: - SUPERVGUI_CanvasGotoNode( SUIT_ResourceMgr*, QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode); + static SUPERVGUI_CanvasGotoNode* Create (SUIT_ResourceMgr*, QObject* theParent, + SUPERVGUI_Main* theMain, SUPERV_CNode theNode); virtual ~SUPERVGUI_CanvasGotoNode() {} virtual QPopupMenu* getPopupMenu(QWidget* theParent); @@ -135,6 +153,9 @@ class SUPERVGUI_CanvasGotoNode : public SUPERVGUI_CanvasNode { void linkToNode(); protected: + SUPERVGUI_CanvasGotoNode (SUIT_ResourceMgr*, QObject* theParent, + SUPERVGUI_Main* theMain, SUPERV_CNode theNode); + virtual SUPERVGUI_CanvasNodePrs* createPrs() const; }; @@ -142,9 +163,9 @@ class SUPERVGUI_CanvasCellNode : public SUPERVGUI_CanvasNode { Q_OBJECT public: - SUPERVGUI_CanvasCellNode( SUIT_ResourceMgr*, QObject* theParent, - SUPERVGUI_Main* theMain, - SUPERV_CNode theNode); + static SUPERVGUI_CanvasCellNode* Create (SUIT_ResourceMgr*, QObject* theParent, + SUPERVGUI_Main* theMain, + SUPERV_CNode theNode); virtual ~SUPERVGUI_CanvasCellNode(); // asv : 26.01.05 : everything moved to CanvasNode::getPopupMenu() @@ -153,12 +174,16 @@ class SUPERVGUI_CanvasCellNode : public SUPERVGUI_CanvasNode { void setPairCell(SUPERVGUI_CanvasCellNode* thePairCell); SUPERVGUI_CanvasCellNode* getPairCell(); - virtual void sync(); + virtual void sync(); - // asv : 26.01.05 : decided to remove all "edition" operations on nodes in Table view - //virtual bool setNodeName(QString aName); + // asv : 26.01.05 : decided to remove all "edition" operations on nodes in Table view + //virtual bool setNodeName(QString aName); protected: + SUPERVGUI_CanvasCellNode (SUIT_ResourceMgr*, QObject* theParent, + SUPERVGUI_Main* theMain, + SUPERV_CNode theNode); + virtual SUPERVGUI_CanvasNodePrs* createPrs() const; protected: @@ -167,26 +192,31 @@ class SUPERVGUI_CanvasCellNode : public SUPERVGUI_CanvasNode { private: bool myIsControl; bool myIsStart; - }; -class SUPERVGUI_CanvasCellEndNode: public SUPERVGUI_CanvasCellNode { +class SUPERVGUI_CanvasCellEndNode : public SUPERVGUI_CanvasCellNode { public: - SUPERVGUI_CanvasCellEndNode( SUIT_ResourceMgr*, QObject* theParent, + static SUPERVGUI_CanvasCellEndNode* Create (SUIT_ResourceMgr*, QObject* theParent, + SUPERVGUI_Main* theMain, + SUPERV_CNode theNode, + SUPERVGUI_CanvasCellNode* theStart); + virtual ~SUPERVGUI_CanvasCellEndNode() {} + + // asv : 26.01.05 : decided to remove all "edition" operations on nodes in Table view + //virtual bool setNodeName(QString theName); + + protected: + SUPERVGUI_CanvasCellEndNode (SUIT_ResourceMgr*, QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode, SUPERVGUI_CanvasCellNode* theStart); - virtual ~SUPERVGUI_CanvasCellEndNode() {} - - // asv : 26.01.05 : decided to remove all "edition" operations on nodes in Table view - //virtual bool setNodeName(QString theName); }; -/** +/** * Taken from SUPERVGUI_ControlNode.h without change */ -class SUPERVGUI_SelectInlineDlg: public QDialog { +class SUPERVGUI_SelectInlineDlg : public QDialog { Q_OBJECT public: diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasLink.cxx b/src/SUPERVGUI/SUPERVGUI_CanvasLink.cxx index 70a1e38..3c957e6 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasLink.cxx +++ b/src/SUPERVGUI/SUPERVGUI_CanvasLink.cxx @@ -401,7 +401,8 @@ bool SUPERVGUI_CanvasLinkBuilder::canCreateEngine(SUPERVGUI_CanvasPort* thePort) // asv : 15.12.04 : NOT allow to connect Gate-to-InLine --> it does not make sence! // Out Gate port can be connected only to In Gate port - if ( aOutKind == SUPERV::GateParameter && aInKind != SUPERV::GateParameter ) + // mkr : NPAL14823 : Out Gate port can be connected to Inline port too + if ( aOutKind == SUPERV::GateParameter && aInKind != SUPERV::GateParameter && aInKind != SUPERV::InLineParameter ) return false; // In Gate can be connected to (receive links from) Gate port and InLine ports (important for Switch nodes) diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasNode.cxx b/src/SUPERVGUI/SUPERVGUI_CanvasNode.cxx index 54774c8..a13b244 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasNode.cxx +++ b/src/SUPERVGUI/SUPERVGUI_CanvasNode.cxx @@ -41,7 +41,8 @@ #include -SUPERVGUI_CanvasNode::SUPERVGUI_CanvasNode( SUIT_ResourceMgr* mgr, QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode, bool theIsCell): +SUPERVGUI_CanvasNode::SUPERVGUI_CanvasNode( SUIT_ResourceMgr* mgr, QObject* theParent, + SUPERVGUI_Main* theMain, SUPERV_CNode theNode, bool theIsCell): QObject(theParent), myMain(theMain), myNode(theNode), @@ -96,7 +97,6 @@ SUPERVGUI_CanvasNode::SUPERVGUI_CanvasNode( SUIT_ResourceMgr* mgr, QObject* theP // mkr : PAL8237 connect(this, SIGNAL(objectCreatedDeleted()), myMain, SLOT(onObjectCreatedDeleted())); - emit objectCreatedDeleted(); } SUPERVGUI_CanvasNode::~SUPERVGUI_CanvasNode() @@ -132,7 +132,6 @@ SUPERVGUI_CanvasNodePrs* SUPERVGUI_CanvasNode::createPrs() const //glNode->update(); //getGLContext()->insertObject( glNode, true /*false*/ ); // - return new SUPERVGUI_CanvasNodePrs( myMgr, myMain->getCanvas(), (SUPERVGUI_CanvasNode*)this); } diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasNode.h b/src/SUPERVGUI/SUPERVGUI_CanvasNode.h index 6124d3d..3560a8d 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasNode.h +++ b/src/SUPERVGUI/SUPERVGUI_CanvasNode.h @@ -41,7 +41,6 @@ class SUPERVGUI_CanvasNode : public QObject { Q_OBJECT public: - SUPERVGUI_CanvasNode( SUIT_ResourceMgr*, QObject*, SUPERVGUI_Main*, SUPERV_CNode theNode, bool theIsCell=false); virtual ~SUPERVGUI_CanvasNode(); // done to ignore port update when node is removed @@ -124,6 +123,9 @@ class SUPERVGUI_CanvasNode : public QObject { void exportToLib(); protected: + SUPERVGUI_CanvasNode (SUIT_ResourceMgr*, QObject*, SUPERVGUI_Main*, + SUPERV_CNode theNode, bool theIsCell=false); + // redefined by most of CanvasNode successors virtual SUPERVGUI_CanvasNodePrs* createPrs() const; SUIT_ResourceMgr* resMgr() const { return myMgr; } diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasNodePrs.cxx b/src/SUPERVGUI/SUPERVGUI_CanvasNodePrs.cxx index 9fc76b7..c5d107d 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasNodePrs.cxx +++ b/src/SUPERVGUI/SUPERVGUI_CanvasNodePrs.cxx @@ -777,7 +777,10 @@ void SUPERVGUI_CanvasNodePrs::setState(SUPERV::GraphState theState) break; } - long sec = myNode->getEngine()->CpuUsed(); + long sec = 0; + // IPAL9273, 9369, 9731 + if ( theState != SUPERV_Kill && myNode->getMain()->getDataflow()->State() != SUPERV_Kill ) + sec = myNode->getEngine()->CpuUsed(); char hms[9]; long s = sec/3600; hms[0]=(char)(((s/10)%10)+48); diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasPort.cxx b/src/SUPERVGUI/SUPERVGUI_CanvasPort.cxx index c8c6b5a..e7db50f 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasPort.cxx +++ b/src/SUPERVGUI/SUPERVGUI_CanvasPort.cxx @@ -34,7 +34,8 @@ #include "SalomeApp_Study.h" -SUPERVGUI_CanvasPort::SUPERVGUI_CanvasPort(QObject* theParent, SUPERVGUI_Main* theMain, SUPERV::Port_ptr thePort): +SUPERVGUI_CanvasPort::SUPERVGUI_CanvasPort (QObject* theParent, SUPERVGUI_Main* theMain, + SUPERV::Port_ptr thePort): QObject(theParent), myMain(theMain), myPrs(0), @@ -211,7 +212,8 @@ void SUPERVGUI_CanvasPort::copy() //*********************************************************** // Input Port //*********************************************************** -SUPERVGUI_CanvasPortIn::SUPERVGUI_CanvasPortIn(QObject* theParent, SUPERVGUI_Main* theMain, SUPERV::Port_ptr thePort): +SUPERVGUI_CanvasPortIn::SUPERVGUI_CanvasPortIn (QObject* theParent, SUPERVGUI_Main* theMain, + SUPERV::Port_ptr thePort): SUPERVGUI_CanvasPort(theParent, theMain, thePort) { Trace("SUPERVGUI_CanvasPortIn::SUPERVGUI_CanvasPortIn"); @@ -226,7 +228,9 @@ SUPERVGUI_CanvasPortIn::~SUPERVGUI_CanvasPortIn() QPopupMenu* SUPERVGUI_CanvasPortIn::getPopupMenu(QWidget* theParent) { QPopupMenu* popup = SUPERVGUI_CanvasPort::getPopupMenu(theParent); - bool editable = getEngine()->IsInput() && !getEngine()->IsLinked() && !getMain()->getDataflow()->IsExecuting(); + bool editable = (getEngine()->IsInput() && + !getEngine()->IsLinked() && + !getMain()->getDataflow()->IsExecuting()); if (!getEngine()->IsGate() && editable) popup->insertItem(tr("MSG_SETVALUE"), this, SLOT(setInput())); @@ -271,7 +275,8 @@ bool SUPERVGUI_CanvasPortIn::eventFilter(QObject* o, QEvent* e) //*********************************************************** // Output Port //*********************************************************** -SUPERVGUI_CanvasPortOut::SUPERVGUI_CanvasPortOut(QObject* theParent, SUPERVGUI_Main* theMain, SUPERV::Port_ptr thePort): +SUPERVGUI_CanvasPortOut::SUPERVGUI_CanvasPortOut (QObject* theParent, SUPERVGUI_Main* theMain, + SUPERV::Port_ptr thePort): SUPERVGUI_CanvasPort(theParent, theMain, thePort) { Trace("SUPERVGUI_CanvasPortOut::SUPERVGUI_CanvasPortOut"); diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasView.cxx b/src/SUPERVGUI/SUPERVGUI_CanvasView.cxx index 48dcf44..a771544 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasView.cxx +++ b/src/SUPERVGUI/SUPERVGUI_CanvasView.cxx @@ -459,7 +459,7 @@ void SUPERVGUI_CanvasView::contentsMouseMoveEvent(QMouseEvent* theEvent) // QToolTip for title and label for SUPERVGUI_CanvasNode SUPERVGUI_ToolTip* aTT = new SUPERVGUI_ToolTip(this); - aTT->maybeTip(p); + aTT->maybeTip(theEvent->pos()); busy = false; } diff --git a/src/SUPERVGUI/SUPERVGUI_Clipboard.cxx b/src/SUPERVGUI/SUPERVGUI_Clipboard.cxx index 0be9d3f..41b33d8 100644 --- a/src/SUPERVGUI/SUPERVGUI_Clipboard.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Clipboard.cxx @@ -157,10 +157,13 @@ void SUPERVGUI_Clipboard::pasteNode() { case SUPERV::FactoryNode : { - SUPERV::FNode_var aFNode = dataflow->FNode( SUPERV::FNode::_narrow(aNode)->GetComponentName(), - SUPERV::FNode::_narrow(aNode)->GetInterfaceName(), - *SUPERV::FNode::_narrow(aNode)->Service(), - SUPERV::FNode::_narrow(aNode)->IsCimpl()); // mkr : PAL11273 + SUPERV::FNode_var aNodeFNode = SUPERV::FNode::_narrow(aNode); + SALOME_ModuleCatalog::ImplType anImplType = SALOME_ModuleCatalog::SO; + if (!aNodeFNode->IsCimpl()) anImplType = SALOME_ModuleCatalog::PY; + SUPERV::FNode_var aFNode = dataflow->FNode(aNodeFNode->GetComponentName(), + aNodeFNode->GetInterfaceName(), + *aNodeFNode->Service(), + anImplType); // mkr : PAL11273 if (CORBA::is_nil(aFNode)) { QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_CREATE_NODE")); return; diff --git a/src/SUPERVGUI/SUPERVGUI_Main.cxx b/src/SUPERVGUI/SUPERVGUI_Main.cxx index b6fd64f..c0dd3ea 100644 --- a/src/SUPERVGUI/SUPERVGUI_Main.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Main.cxx @@ -74,7 +74,7 @@ using namespace boost; SUPERV::Port_ptr aPort = aPortList[p].in(); \ if ( !aPort->IsInput() && !aPort->IsGate() ) { \ bool aInStudy = dynamic_cast( aMain->getCanvas()->getPort(aPort) )->isInStudy(); \ - dynamic_cast( getCanvas()->getPort( getDataflow()->Node(aCNode->Name())->Port(aPort->Name()) ) )->setStudyState(aInStudy); \ + dynamic_cast( getCanvas()->getPort( getDataflow()->Node(aCNode->Name())->GetOutPort(aPort->Name()) ) )->setStudyState(aInStudy); \ } \ } \ } @@ -163,13 +163,13 @@ void SUPERVGUI_Main::init(SUIT_Desktop* theDesktop) { SalomeApp_Application* app = dynamic_cast( study->application() ); objectBrowser = app->objectBrowser(); - + myArray = new SUPERVGUI_CanvasArray( this, resMgr() ); myArrayView = new SUPERVGUI_ArrayView( myArray, this ); myCanvas = new SUPERVGUI_Canvas( this, resMgr() ); myCanvasView = new SUPERVGUI_CanvasView(myCanvas, this); - + message = app->logWindow(); notification = new NOTIFICATION_Consumer(); @@ -350,6 +350,11 @@ void SUPERVGUI_Main::sync() { //if ( aSupMod ) aSupMod->updateObjBrowser(); //else MESSAGE("NULL Supervision module!"); + // update "Save" icon and menu state, if dataflow is published + _PTR(Study) aStudy = ((SalomeApp_Study*)study)->studyDS(); + _PTR(SObject) aSO = aStudy->FindObjectIOR(dataflow->getIOR()); + if (aSO) SUPERVGUI_Main::setModifiedFlag(); + if (myCurrentView == CANVASTABLE) { myArray->sync(); myArray->update(); @@ -597,7 +602,7 @@ void SUPERVGUI_Main::onShowToolbar() void SUPERVGUI_Main::onObjectCreatedDeleted() { if ( study ) { - if ( STD_Application* app = dynamic_cast( study->application() ) ) { + if ( LightApp_Application* app = dynamic_cast( study->application() ) ) { ViewManagerList aVMList; app->viewManagers( SUPERVGraph_Viewer::Type(), aVMList ); SUIT_ViewManager* aVM; @@ -608,16 +613,20 @@ void SUPERVGUI_Main::onObjectCreatedDeleted() QObjectList* aMainList = aVW->queryList("SUPERVGUI_Main"); if ( aMainList->count() == 1 ) { SUPERVGUI_Main* aMain = dynamic_cast( aMainList->first() ); - if ( aMain ) - if ( !CORBA::is_nil( aMain->getDataflow() ) - && - !QString(aMain->getDataflow()->getIOR()).compare(getDataflow()->getIOR()) // equal dataflows - && - aMain != this ) // not equal mains + if ( aMain ) { + if (aMain != this && + !CORBA::is_nil(aMain->getDataflow()) && + !QString(aMain->getDataflow()->getIOR()).compare(getDataflow()->getIOR())) // equal dataflows aMain->getCanvas()->merge(); + } } } } + + // update "Save" icon and menu state, if dataflow is published + //_PTR(Study) aStudy = ((SalomeApp_Study*)study)->studyDS(); + //_PTR(SObject) aSO = aStudy->FindObjectIOR(dataflow->getIOR()); + //if (aSO) SUPERVGUI_Main::setModifiedFlag(); } } } @@ -649,7 +658,7 @@ void SUPERVGUI_Main::onPutInStudy( QString* theNodePortName ) } } } - SUPERVGUI_Main::setModifiedFlag(); + //SUPERVGUI_Main::setModifiedFlag(); } } } @@ -728,9 +737,11 @@ void SUPERVGUI_Main::run( const bool andSuspend ) { myRunTime = QDateTime::currentDateTime(); const bool result = andSuspend ? dataflow->Start() : dataflow->Run(); if ( !result ) { - QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_DF_BADEXECUTE")); + // PAL12902 + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_DF_BADEXECUTE") + QString(" : ") + QString(dataflow->Messages())); if ( dataflow->State() == SUPERV::ErrorState ) { - kill(); + // PAL12902 + if ( !dataflow->IsEditing() ) kill(); } } else { @@ -754,7 +765,9 @@ void SUPERVGUI_Main::kill() { QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_DF_NOTRUNNING")); } else if (dataflow->Kill()) { - getMessage()->putMessage( tr("MSG_GRAPH_KILLED") ); + // IPAL9273, 9369, 9731 : to avoid two equal messages about killing dataflow + // execution in the Message Console + //getMessage()->putMessage( tr("MSG_GRAPH_KILLED") ); sync(); } else { @@ -837,7 +850,7 @@ void SUPERVGUI_Main::addComputeNode(SUPERV_CNode theNode) { case CANVAS: case CONTROLFLOW: { - SUPERVGUI_CanvasNode* aNode = new SUPERVGUI_CanvasComputeNode( resMgr(), myCanvas, this, theNode); + SUPERVGUI_CanvasNode* aNode = SUPERVGUI_CanvasComputeNode::Create(resMgr(), myCanvas, this, theNode); aNode->move(theNode->X(), theNode->Y()); if (myCurrentView == CONTROLFLOW) aNode->hideAll(); aNode->show(); @@ -859,7 +872,7 @@ void SUPERVGUI_Main::addGOTONode(SUPERV_CNode theNode) { case CANVAS: case CONTROLFLOW: { - SUPERVGUI_CanvasNode* aNode = new SUPERVGUI_CanvasGotoNode( resMgr(), myCanvas, this, theNode); + SUPERVGUI_CanvasNode* aNode = SUPERVGUI_CanvasGotoNode::Create(resMgr(), myCanvas, this, theNode); aNode->move(theNode->X(), theNode->Y()); if (myCurrentView == CONTROLFLOW) aNode->hideAll(); aNode->show(); @@ -872,7 +885,8 @@ void SUPERVGUI_Main::addGOTONode(SUPERV_CNode theNode) { /** * Add Control node */ -void SUPERVGUI_Main::addControlNode(SUPERV_CNode theStartNode, SUPERV_CNode theEndNode, bool Update) { +void SUPERVGUI_Main::addControlNode(SUPERV_CNode theStartNode, SUPERV_CNode theEndNode, bool Update) +{ switch (myCurrentView) { case CANVASTABLE: myArray->destroy(); @@ -881,11 +895,13 @@ void SUPERVGUI_Main::addControlNode(SUPERV_CNode theStartNode, SUPERV_CNode theE case CANVAS: case CONTROLFLOW: { - SUPERVGUI_CanvasStartNode* aStartNode = new SUPERVGUI_CanvasStartNode( resMgr(), myCanvas, this, theStartNode); + SUPERVGUI_CanvasStartNode* aStartNode = + SUPERVGUI_CanvasStartNode::Create(resMgr(), myCanvas, this, theStartNode); aStartNode->move(theStartNode->X(), theStartNode->Y()); if (myCurrentView == CONTROLFLOW) aStartNode->hideAll(); - SUPERVGUI_CanvasEndNode* aEndNode = new SUPERVGUI_CanvasEndNode( resMgr(), myCanvas, this, theEndNode, aStartNode); + SUPERVGUI_CanvasEndNode* aEndNode = + SUPERVGUI_CanvasEndNode::Create(resMgr(), myCanvas, this, theEndNode, aStartNode); aEndNode->move(theEndNode->X(), theEndNode->Y()); if (myCurrentView == CONTROLFLOW) aEndNode->hideAll(); @@ -910,7 +926,7 @@ void SUPERVGUI_Main::addMacroNode(SUPERV_CNode theNode) { case CANVAS: case CONTROLFLOW: { - SUPERVGUI_CanvasNode* aNode = new SUPERVGUI_CanvasMacroNode( resMgr(), myCanvas, this, theNode); + SUPERVGUI_CanvasNode* aNode = SUPERVGUI_CanvasMacroNode::Create(resMgr(), myCanvas, this, theNode); aNode->move(theNode->X(), theNode->Y()); if (myCurrentView == CONTROLFLOW) aNode->hideAll(); aNode->show(); @@ -1119,6 +1135,8 @@ void SUPERVGUI_Main::addDataflowToStudy() { if ( !myThread->running() ) aSupMod->updateObjBrowser(); + + aSupMod->getApp()->updateActions(); } else { MESSAGE( "ERROR: failed to find or create dataflow SObject" ); @@ -1590,6 +1608,7 @@ void SUPERVGUI_Thread::main_thread_run(SUPERV_CNode& aNode, SUPERV::GraphEvent& { // in case node "said" something during changing state through notification mechanism - output it myMain->syncNotification(); + myMain->sync(); // mkr : NPAL14881 // "kill" or undefined event came if (( aEvent == SUPERV::UndefinedEvent && aState == SUPERV::UndefinedState ) || @@ -1614,6 +1633,7 @@ void SUPERVGUI_Thread::main_thread_run(SUPERV_CNode& aNode, SUPERV::GraphEvent& // execution is finished. just set a "finished" message(s) if ( !myIsActive ) { + QString aMess; switch ( myMain->getDataflow()->State() ) { case SUPERV_Editing : myMain->getMessage()->putMessage( myMain->getDataflow()->IsReadOnly()? @@ -1627,6 +1647,14 @@ void SUPERVGUI_Thread::main_thread_run(SUPERV_CNode& aNode, SUPERV::GraphEvent& break; case SUPERV_Error : myMain->getMessage()->putMessage( tr("MSG_GRAPH_ABORTED") ); + // PAL12866 --> + aMess = QString(myMain->getDataflow()->Messages()); + if ( !aMess.isEmpty() ) { + myMain->getMessage()->putMessage( tr("MSG_DF_BADEXECUTE") + QString(" : ") + aMess ); + QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), + tr("MSG_DF_BADEXECUTE") + QString(" : ") + aMess); + } + // PAL12866 <-- break; case SUPERV_Kill: myMain->getMessage()->putMessage( tr("MSG_GRAPH_KILLED") ); diff --git a/src/SUPERVGUI/SUPERVGUI_ManagePortsDlg.cxx b/src/SUPERVGUI/SUPERVGUI_ManagePortsDlg.cxx index 9e195ec..8437548 100644 --- a/src/SUPERVGUI/SUPERVGUI_ManagePortsDlg.cxx +++ b/src/SUPERVGUI/SUPERVGUI_ManagePortsDlg.cxx @@ -28,6 +28,7 @@ #include "SUPERVGUI_ManagePortsDlg.h" #include "SUPERVGUI_CanvasNode.h" +#include "SUPERVGUI_CanvasNodePrs.h" #include "SUPERVGUI_CanvasPort.h" #include "SUPERVGUI_CanvasControlNode.h" #include "SUPERVGUI_CanvasLink.h" @@ -289,9 +290,11 @@ void SUPERVGUI_ManagePortsDlg::init() connect( myTypeCombo, SIGNAL(activated(const QString&)), this, SLOT(typeChanged(const QString&))); // mkr: PAL12448 - connect( myInList,SIGNAL(rightButtonClicked(QListBoxItem*, const QPoint&)), this, SLOT(itemDeselect(QListBoxItem*, const QPoint&))); - connect( myOutList,SIGNAL(rightButtonClicked(QListBoxItem*, const QPoint&)), this, SLOT(itemDeselect(QListBoxItem*, const QPoint&))); - + connect( myInList, SIGNAL(rightButtonClicked(QListBoxItem*, const QPoint&)), + this, SLOT(itemDeselect(QListBoxItem*, const QPoint&))); + connect( myOutList, SIGNAL(rightButtonClicked(QListBoxItem*, const QPoint&)), + this, SLOT(itemDeselect(QListBoxItem*, const QPoint&))); + myNode->getMain()->lockedGraph( true ); // asv : 11.01.05 : if a node is a loop node, then only INPUT ports can be added/removed @@ -302,7 +305,9 @@ void SUPERVGUI_ManagePortsDlg::init() anUpOutputBtn->setEnabled( false ); aDownOutputBtn->setEnabled( false ); } - + + // NPAL15537: initialization moved here from showEvent() + init( myNode ); } /** @@ -312,9 +317,9 @@ SUPERVGUI_ManagePortsDlg::~SUPERVGUI_ManagePortsDlg() { } // mkr : PAL8060 -void SUPERVGUI_ManagePortsDlg::createLinkEngine( SUPERV::Port_ptr thePort, - QValueList< QPair< QString,QString > >& theOwnList, - QValueList< QPair< QString,QString > >& theCorrespList ) { +void SUPERVGUI_ManagePortsDlg::createLinkEngine (SUPERV::Port_ptr thePort, + QValueList< QPair< QString,QString > >& theOwnList, + QValueList< QPair< QString,QString > >& theCorrespList) { // pair for the given port QPair anOwnPair(QString(thePort->Node()->Name()), QString(thePort->Name())); int aNum = theOwnList.contains(anOwnPair); @@ -325,192 +330,130 @@ void SUPERVGUI_ManagePortsDlg::createLinkEngine( SUPERV::Port_ptr thePort, theOwnList.remove(theOwnList.at(anId)); theCorrespList.remove(theCorrespList.at(anId)); - SUPERV_Port aCorrespPort = myNode->getMain()->getDataflow()->Node(aCorrespPair.first)->Port(aCorrespPair.second); + SUPERV_Port aCorrespPort = + myNode->getMain()->getDataflow()->Node(aCorrespPair.first)->Port(aCorrespPair.second); SUPERV_Link aLinkEngine; if ( thePort->IsInput() ) aLinkEngine = myNode->getMain()->getDataflow()->Link(aCorrespPort, thePort); else aLinkEngine = myNode->getMain()->getDataflow()->Link(thePort, aCorrespPort); - SUPERVGUI_CanvasLink* aLink = new SUPERVGUI_CanvasLink(myNode->getMain()->getCanvas(), myNode->getMain(), aLinkEngine); + SUPERVGUI_CanvasLink* aLink = new SUPERVGUI_CanvasLink(myNode->getMain()->getCanvas(), + myNode->getMain(), aLinkEngine); aLink->show(); - + aNum--; - } + } } /** * Set the ports as entered by user (order, name/type, etc.) and close the dialog */ -void SUPERVGUI_ManagePortsDlg::accept() { +void SUPERVGUI_ManagePortsDlg::accept() +{ myNode->getMain()->Editing(); // PAL6170: GUI->Engine: setting "Editing" flag + // 1. set the ports to Engine's CNode SUPERV_INode aINode = myNode->getInlineNode(); if ( !SUPERV_isNull( aINode ) ) { int i; const bool isLoop = ( myNode->getNodeType() == SUPERV::LoopNode ); - // 1.1 delete all ports (delete CanvasPorts, they delete SUPERV_Ports) + // 1.1 form a list of ports to be removed QObjectList* oldPorts = myNode->queryList("SUPERVGUI_CanvasPort"); - QObjectListIt it( *oldPorts ); // iterate over the old ports - QObject *obj; // asv : 11.01.05 : fix for a bug: for Loop node, removal of an Input Port - // automatically removes the corresponding Output Port. So for Loops the + // automatically removes the corresponding Output Port. So for Loops the // oldPorts list should be filtered to include only Input Ports. // But I'll filter Gate-s as well.. - bool isAnyLinked = false; // check if any port from old ports is linked - // map PortName <-> (PortType, PortInputValue) for non linked input ports, which have input - QMap< QString, QPair< QString,QString > > InNameInput; QObjectList portsToRemove; - while ( (obj = it.current()) != 0 ) { - ++it; + QObject *obj; + QObjectListIt it ( *oldPorts ); // iterate over the old ports + for (; (obj = it.current()) != 0; ++it) { SUPERV::Port_var aPort = ((SUPERVGUI_CanvasPort*)obj)->getEngine(); - if ( !aPort->IsGate() && ( !isLoop || aPort->IsInput() ) ) { - portsToRemove.append( obj ); + if ( !aPort->IsGate() ) { + if ( !isLoop || aPort->IsInput() ) { + portsToRemove.append( obj ); + } } - // check if port has a link (output porst of Loop node are also checked) - if ( !aPort->IsGate() && aPort->IsLinked() && !isAnyLinked) - isAnyLinked = true; - // check if input port has an input value - if ( !aPort->IsGate() && aPort->IsInput() && aPort->HasInput() ) - InNameInput.insert( QString(aPort->Name()), - QPair(QString(aPort->Type()),QString(aPort->ToString())) ); } delete oldPorts; // delete the list, not the objects - // mkr : PAL8060 --> - QString aNodeName = myNode->getEngine()->Name(); - QValueList< QPair< QString,QString > > InPortsL, OutPortsL; - if ( isAnyLinked ) { - // if myNode has linked port(s), create two lists of In/Out ports (InPortsL, OutPortsL) to identify all links for myNode - QObjectList* list = myNode->getMain()->getCanvas()->queryList("SUPERVGUI_CanvasLink"); - QObjectListIt listit( *list ); - QObject *listobj; - while ( (listobj = listit.current()) != 0 ) { - ++listit; - SUPERV::Link_var aLink = ((SUPERVGUI_CanvasLink*)listobj)->getEngine(); - if ( aNodeName.compare(aLink->InPort()->Node()->Name()) == 0 - || - aNodeName.compare(aLink->OutPort()->Node()->Name()) == 0 ) { - QPair InPair(QString(aLink->InPort()->Node()->Name()), QString(aLink->InPort()->Name())); - QPair OutPair(QString(aLink->OutPort()->Node()->Name()), QString(aLink->OutPort()->Name())); - InPortsL.append(InPair); - OutPortsL.append(OutPair); - } - - if ( isLoop ) { - // put into In/Out lists all links for corresponding EndLoop node - QString aCoupledNodeName = ((SUPERVGUI_CanvasStartNode*)myNode)->getCoupled()->getEngine()->Name(); - if ( aCoupledNodeName.compare(aLink->InPort()->Node()->Name()) == 0 - || - aCoupledNodeName.compare(aLink->OutPort()->Node()->Name()) == 0 ) { - QPair InPair(QString(aLink->InPort()->Node()->Name()), QString(aLink->InPort()->Name())); - QPair OutPair(QString(aLink->OutPort()->Node()->Name()), QString(aLink->OutPort()->Name())); - InPortsL.append(InPair); - OutPortsL.append(OutPair); - } - } - } - } - // mkr : PAL8060 <-- - - // portsToRemove list contains: - // for Loop node: all INPUT ports except Gates - // for other Inline: all INPUT and OUTPUT ports except Gates - it = QObjectListIt( portsToRemove ); - while ( (obj = it.current()) != 0 ) { - ++it; - ((SUPERVGUI_CanvasPort*)obj)->remove(); - } - // 1.2 create new ports in INode and CanvasPort in myNode + // or just reorder existing ports PortListItem* item; - SUPERV_Port aPort; - for ( i = 0; i < myInList->count(); i++ ) { + for (i = 0; i < myInList->count(); i++) { item = (PortListItem*)myInList->item( i ); - aPort = aINode->InPort( item->PortName.latin1(), item->PortType.latin1() ); - if ( InNameInput.contains( item->PortName ) - && - item->PortType.compare(InNameInput[item->PortName].first) == 0 ) { - // i.e. aPort is input and had a value (not linked!) - // if ports' name and type didn't change and ports had an input value => set this value again - SUPERVGUI* aSupMod = SUPERVGUI::Supervision(); - if ( aSupMod ) - aPort->Input( aSupMod->getEngine()->StringValue( InNameInput[item->PortName].second ) ); - myNode->createPort( aPort.in() ); + // try existing ports + bool isExisting = false; + QObjectListIt itRem (portsToRemove); + QObject *objRem; + for (; (objRem = itRem.current()) != 0 && !isExisting; ++itRem) { + SUPERV::Port_var aPort = ((SUPERVGUI_CanvasPort*)objRem)->getEngine(); + if (item->PortName.compare(aPort->Name()) == 0 && + item->PortType.compare(aPort->Type()) == 0) { + // ports reordering + myNode->removeChild(objRem); + myNode->insertChild(objRem); + portsToRemove.remove(objRem); + isExisting = true; + } } - else { - myNode->createPort( aPort.in() ); - // mkr : PAL8060 - if ( !InPortsL.isEmpty() && !OutPortsL.isEmpty() ) - // create links for those input ports, which had links earlier - createLinkEngine( aPort, InPortsL, OutPortsL ); + if (!isExisting) { + // create a new port + SUPERV::Port_var aPort = aINode->InPort( item->PortName.latin1(), item->PortType.latin1() ); + myNode->createPort( aPort.in() ); } } - - if ( isLoop ) { + + // 1.3 create/reorder Out-ports + if (isLoop) { // asv : 11.01.05 : for Loop nodes do the same as in SUPERVGUI_CanvasStartNode::addInputPort() SUPERVGUI_CanvasStartNode* aStartLoopNode = (SUPERVGUI_CanvasStartNode*)myNode; aStartLoopNode->merge(); aStartLoopNode->getCoupled()->merge(); - - // mkr : PAL8060 --> - if ( !InPortsL.isEmpty() && !OutPortsL.isEmpty() ) { - - // 1) create old links for output ports of Loop node - QObjectList* aPortsOut = aStartLoopNode->queryList("SUPERVGUI_CanvasPortOut"); - QObjectListIt aPorstOutit( *aPortsOut ); - QObject *listobj; - while ( (listobj = aPorstOutit.current()) != 0 ) { - ++aPorstOutit; - - SUPERV::Port_var aPortOut = ((SUPERVGUI_CanvasPort*)listobj)->getEngine(); - createLinkEngine( aPortOut, OutPortsL, InPortsL ); - } - - // 2) create old links for input ports of EndLoop node - QObjectList* aPortsIn = aStartLoopNode->getCoupled()->queryList("SUPERVGUI_CanvasPortIn"); - QObjectListIt aPorstInit( *aPortsIn ); - while ( (listobj = aPorstInit.current()) != 0 ) { - ++aPorstInit; - - SUPERV::Port_var aPortIn = ((SUPERVGUI_CanvasPort*)listobj)->getEngine(); - createLinkEngine( aPortIn, InPortsL, OutPortsL ); - } - - // 3) create old links for output ports of EndLoop node - aPortsOut = aStartLoopNode->getCoupled()->queryList("SUPERVGUI_CanvasPortOut"); - aPorstOutit = QObjectListIt( *aPortsOut ); - while ( (listobj = aPorstOutit.current()) != 0 ) { - ++aPorstOutit; - - SUPERV::Port_var aPortOut = ((SUPERVGUI_CanvasPort*)listobj)->getEngine(); - createLinkEngine( aPortOut, OutPortsL, InPortsL ); - } + } + else { + // for non-loop nodes manage out-ports in the same way as in-ports + for (i = 0; i < myOutList->count(); i++) { + item = (PortListItem*)myOutList->item( i ); + // try existing ports + bool isExisting = false; + QObjectListIt itRem (portsToRemove); + QObject *objRem; + for (; (objRem = itRem.current()) != 0 && !isExisting; ++itRem) { + SUPERV::Port_var aPort = ((SUPERVGUI_CanvasPort*)objRem)->getEngine(); + if (item->PortName.compare(aPort->Name()) == 0 && + item->PortType.compare(aPort->Type()) == 0) { + // ports reordering + myNode->removeChild(objRem); + myNode->insertChild(objRem); + portsToRemove.remove(objRem); + isExisting = true; + } + } + if (!isExisting) { + // create a new port + SUPERV::Port_var aPort = aINode->OutPort(item->PortName.latin1(), item->PortType.latin1()); + myNode->createPort(aPort.in()); + } } - // mkr : PAL8060 <-- } - // creating Out-ports, except LoopNode-s - for ( i = 0; i < myOutList->count() && !isLoop; i++ ) { - item = (PortListItem*)myOutList->item( i ); - aPort = aINode->OutPort( item->PortName.latin1(), item->PortType.latin1() ); - myNode->createPort( aPort.in() ); - - // mkr : PAL8060 - if ( !InPortsL.isEmpty() && !OutPortsL.isEmpty() ) - // create links for those output ports, which had links earlier - createLinkEngine( aPort, OutPortsL, InPortsL ); - } + // 1.4 remove disappeared ports + QObjectListIt itRem ( portsToRemove ); + QObject *objRem; + for (; (objRem = itRem.current()) != 0; ++itRem) { + ((SUPERVGUI_CanvasPort*)objRem)->remove(); + } // 2. update the node's presentation + myNode->getPrs()->updatePorts(); myNode->getMain()->getCanvas()->update(); } - + // 3. close the dialog myNode->getMain()->lockedGraph( false ); QDialog::accept(); - close(); } /** @@ -522,14 +465,6 @@ void SUPERVGUI_ManagePortsDlg::reject() { close(); } -/** - * Update current values on show event - */ -void SUPERVGUI_ManagePortsDlg::showEvent( QShowEvent* theEvent ) { - init( myNode ); - QDialog::showEvent( theEvent ); -} - /** * Initialize In/Out tables with values from the given node */ @@ -555,12 +490,12 @@ void SUPERVGUI_ManagePortsDlg::init( const SUPERVGUI_CanvasNode* theNode ) { if ( aPorts[i]->IsGate() ) continue; if ( aPorts[i]->IsInput() - && - !myInList->findItem( QString( "%1 (%2)" ).arg( aPorts[i]->Name() ).arg( aPorts[i]->Type() ) ) ) // mkr : PAL11332 + && + !myInList->findItem( QString( "%1 (%2)" ).arg( aPorts[i]->Name() ).arg( aPorts[i]->Type() ) ) ) // mkr : PAL11332 new PortListItem( myInList, aPorts[i]->Name(), aPorts[i]->Type() ); if ( !aPorts[i]->IsInput() - && - !myOutList->findItem( QString( "%1 (%2)" ).arg( aPorts[i]->Name() ).arg( aPorts[i]->Type() ) ) ) // mkr : PAL11332 + && + !myOutList->findItem( QString( "%1 (%2)" ).arg( aPorts[i]->Name() ).arg( aPorts[i]->Type() ) ) ) // mkr : PAL11332 new PortListItem( myOutList, aPorts[i]->Name(), aPorts[i]->Type() ); } } @@ -573,8 +508,8 @@ void SUPERVGUI_ManagePortsDlg::addPort( QListBox* theLB ) { bool found = false; // check if already exists -- and don't allow if yes for ( int i = 0; i < theLB->count(); i++ ) { if ( ((PortListItem*)theLB->item(i))->PortName == name ) { - found = true; - break; + found = true; + break; } } if ( found ) @@ -652,6 +587,19 @@ bool isEditingItem( const QListBoxItem* item, const QListBox* theLB ) { * the last selected by user item in myInList or myOutList (myLastItem) */ void SUPERVGUI_ManagePortsDlg::nameChanged( const QString& name ) { + // mkr: IPAL12512 + if ( isEditingItem( myLastItem, myInList ) && myInList->findItem( QString( "%1 (%2)" ).arg( name ).arg( ((PortListItem*)myLastItem)->PortType )) + || + isEditingItem( myLastItem, myOutList ) && myOutList->findItem( QString( "%1 (%2)" ).arg( name ).arg( ((PortListItem*)myLastItem)->PortType ))) { + disconnect( myNameEdt, SIGNAL(textChanged(const QString&)), this, SLOT(nameChanged(const QString&))); + + myNameEdt->setText( ((PortListItem*)myLastItem)->PortName ); + + connect( myNameEdt, SIGNAL(textChanged(const QString&)), this, SLOT(nameChanged(const QString&))); + QMessageBox::warning( this, tr("ERROR"), tr("MSG_PORT_EXIST") ); + return; + } + if ( isEditingItem( myLastItem, myInList ) || isEditingItem( myLastItem, myOutList ) ) { ((PortListItem*)myLastItem)->PortName = name; //myLastItem->listBox()->repaint( true ); @@ -761,9 +709,12 @@ SUPERVGUI_PortParamsDlg::SUPERVGUI_PortParamsDlg(const QStringList& thePortsName void SUPERVGUI_PortParamsDlg::clickOnOk() { if (getName().isEmpty() || getType().isEmpty()) - QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), 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( this, tr("ERROR"), tr("MSG_PORT_EXIST") ); // mkr : IPAL10386 - else + else { accept(); + close(); + } } diff --git a/src/SUPERVGUI/SUPERVGUI_ManagePortsDlg.h b/src/SUPERVGUI/SUPERVGUI_ManagePortsDlg.h index ac6cd16..c603b93 100644 --- a/src/SUPERVGUI/SUPERVGUI_ManagePortsDlg.h +++ b/src/SUPERVGUI/SUPERVGUI_ManagePortsDlg.h @@ -81,7 +81,6 @@ protected slots: void itemDeselect(QListBoxItem* item, const QPoint& point); // mkr: PAL12448 protected: - virtual void showEvent( QShowEvent* theEvent ); void addPort( QListBox* ); void removePort( QListBox* ); void moveUp( QListBox* ); diff --git a/src/SUPERVGUI/SUPERVGUI_Service.cxx b/src/SUPERVGUI/SUPERVGUI_Service.cxx index 7a42fb6..9d9c9d2 100644 --- a/src/SUPERVGUI/SUPERVGUI_Service.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Service.cxx @@ -117,6 +117,8 @@ SUPERVGUI_Service::SUPERVGUI_Service(SALOME_NamingService* ns): aBaseLayoutV->setSpacing(10); QHBoxLayout* aBaseLayout = new QHBoxLayout(aCorbaPane); //!! + aBaseLayout->setMargin(5); + aBaseLayout->setSpacing(10); components = new QListView(aCorbaPane); components->addColumn(tr("COL_COMPONENTS")); @@ -127,6 +129,7 @@ SUPERVGUI_Service::SUPERVGUI_Service(SALOME_NamingService* ns): components->setColumnAlignment(3, AlignLeft); components->setSelectionMode(QListView::Extended); components->setRootIsDecorated(true); + // aBaseLayout->addWidget(components); aBaseLayoutV->addWidget(components); //!! @@ -137,11 +140,16 @@ SUPERVGUI_Service::SUPERVGUI_Service(SALOME_NamingService* ns): //NRI connect(aComputeCBtn, SIGNAL(clicked()), this, SLOT(addComputeNode())); //!! //NRI aComputeCBtn->setDefault(false); - QPushButton* aComputeBtn = new QPushButton(tr("TIT_ADDFNODE"), aCorbaPane); - connect(aComputeBtn, SIGNAL(clicked()), this, SLOT(addFactoryNode())); - aComputeBtn->setDefault(true); + QPushButton* aComputeBtnDef = new QPushButton(tr("TIT_ADDFNODE"), aCorbaPane); + connect(aComputeBtnDef, SIGNAL(clicked()), this, SLOT(addFactoryNodeDef())); + aComputeBtnDef->setDefault(true); + + QPushButton* aComputeBtnCust = new QPushButton(tr("TIT_ADDFNODE_CUST"), aCorbaPane); + connect(aComputeBtnCust, SIGNAL(clicked()), this, SLOT(addFactoryNodeCust())); + aComputeBtnCust->setDefault(true); - aBaseLayout->addWidget(aComputeBtn); + aBaseLayout->addWidget(aComputeBtnDef); + aBaseLayout->addWidget(aComputeBtnCust); //NRI aBaseLayout->addWidget(aComputeCBtn); //!! aBaseLayoutV->insertLayout(-1, aBaseLayout); @@ -255,22 +263,22 @@ SUPERVGUI_Service::SUPERVGUI_Service(SALOME_NamingService* ns): } -char* getDataStreamParameterName(int aType) +char* getDataStreamParameterName(const char * aType) { - switch(aType) { - case 1: + QString type (aType); + + if (aType == "int") // 1 return "integer"; - case 2: + if (aType == "float") // 2 return "float"; - case 3: + if (aType == "double") // 3 return "double"; - case 4: + if (aType == "string") // 4 return "string"; - case 6: + if (aType == "bool") // 6 ?? return "boolean"; - default: - return "unknown"; - } + + return "unknown"; } void SUPERVGUI_Service::initialise() { @@ -328,10 +336,11 @@ void SUPERVGUI_Service::initialise() { long nbStreamPortsOut = Service->ServiceoutDataStreamParameter.length(); for (int m=0; mServiceoutDataStreamParameter[m]); + SALOME_ModuleCatalog::ServicesDataStreamParameter* PortOut = + &(Service->ServiceoutDataStreamParameter[m]); QListViewItem* myPortOutItem = new QListViewItem(myServiceItem, (char*)PortOut->Parametername, - getDataStreamParameterName(PortOut->Parametertype), "DataStream Out"); + getDataStreamParameterName(PortOut->Parametertype), "DataStream Out"); myPortOutItem->setSelectable(false); } @@ -420,7 +429,7 @@ void SUPERVGUI_Service::addComputeNode() { } } -void SUPERVGUI_Service::addFactoryNode() { +void SUPERVGUI_Service::addFactoryNodeDef() { SUIT_Desktop* aDesktop = SUIT_Session::session()->activeApplication()->desktop(); CAM_Application* anApp = ( CAM_Application* )(SUIT_Session::session()->activeApplication()); if ( !anApp ) return; @@ -452,8 +461,10 @@ void SUPERVGUI_Service::addFactoryNode() { const char* service = item->text(0).latin1(); const char* interface = item->parent()->text(0).latin1(); //const char* component = anApp->moduleName(item->parent()->parent()->text(0).latin1()); - if ( aSupMod->getInterfaceNameMap().contains(item->parent()->text(0)) ) { - const char* component = aSupMod->getInterfaceNameMap().find(item->parent()->text(0)).data(); + // mkr : PAL13135 --> + if ( aSupMod->getInterfaceNameMap().contains(item->parent()->parent()->text(0)) ) { + const char* component = aSupMod->getInterfaceNameMap().find(item->parent()->parent()->text(0)).data(); + // mkr : PAL13135 <-- SALOME_ModuleCatalog::Acomponent_ptr myComponent = (*aModuleCatalog)->GetComponent(component); if (myComponent==NULL) { @@ -490,6 +501,115 @@ void SUPERVGUI_Service::addFactoryNode() { } } +void SUPERVGUI_Service::addFactoryNodeCust() { + 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()) { + QMessageBox::warning(aDesktop, tr("ERROR"), tr("MSG_CANT_CREATE_NODE")); + } else { + CORBA::Object_ptr obj = naming->Resolve("/Kernel/ModulCatalog"); + SALOME_ModuleCatalog::ModuleCatalog_var* aModuleCatalog = new SALOME_ModuleCatalog::ModuleCatalog_var; + *aModuleCatalog = SALOME_ModuleCatalog::ModuleCatalog::_narrow(obj); + if (CORBA::is_nil(*aModuleCatalog)) { + QMessageBox::warning(aDesktop, tr("ERROR"), tr("MSG_CANT_CHOOSE_SERVICE")); + } else { + QListViewItem* item; + bool b = false; + + QListViewItemIterator iSel(components); + int count = 0; + for (; iSel.current(); ++iSel) { // check : how many objects are selected (single or multi) + item = iSel.current(); + if (item->isSelected()) count++; + if ( count > 1) break; + } + + QListViewItemIterator i(components); + QString anAuthor, aContainer, aComment; + bool DoneSetting = false; + int aRes = 0; + for (; i.current(); ++i) { + item = i.current(); + if (item->isSelected()) { + const char* service = item->text(0).latin1(); + const char* interface = item->parent()->text(0).latin1(); + //const char* component = anApp->moduleName(item->parent()->parent()->text(0).latin1()); + // mkr : PAL13135 --> + if ( aSupMod->getInterfaceNameMap().contains(item->parent()->parent()->text(0)) ) { + const char* component = aSupMod->getInterfaceNameMap().find(item->parent()->parent()->text(0)).data(); + // mkr : PAL13135 <-- + + SALOME_ModuleCatalog::Acomponent_ptr myComponent = (*aModuleCatalog)->GetComponent(component); + if (myComponent==NULL) { + QMessageBox::warning(aDesktop, tr("ERROR"), tr("MSG_CANT_CHOOSE_SERVICE")); + } + else { + const SALOME_ModuleCatalog::Service* myService = myComponent->GetService(interface, service); + SUPERV_CNode aNode; + if ( myService->TypeOfNode == 0 ) { // ComputeNode + aNode = aMain->getDataflow()->CNode(*myService); + if (CORBA::is_nil( aNode ) ) { + QMessageBox::warning(aDesktop, tr("ERROR"), tr("MSG_CANT_CREATE_NODE")); + return; + } + } + else { // Factory Node + + SUPERVGUI_CustomSettings* aCSDialog = 0; + if ( count > 1 && !DoneSetting) { // multi selection + DoneSetting = true; + aCSDialog = new SUPERVGUI_CustomSettings(item, true, myComponent->implementation_type()); + } + else if ( count == 1 ) // single selection + aCSDialog = new SUPERVGUI_CustomSettings(item, false, myComponent->implementation_type()); + + if ( aCSDialog ) { + aRes = aCSDialog->exec(); + if (aRes) { + anAuthor = aCSDialog->Author(); + aContainer = aCSDialog->Container(); + aComment = aCSDialog->Comment(); + } + delete aCSDialog; + } + + aNode = aMain->getDataflow()->FNode(component, interface, *myService, myComponent->implementation_type()); // mkr : PAL11273 + if ( CORBA::is_nil( aNode ) ) { + QMessageBox::warning(aDesktop, tr("ERROR"), tr("MSG_CANT_CREATE_NODE")); + return; + } + + if (aRes) { + aNode->SetAuthor(anAuthor.latin1()); + SUPERV::FNode::_narrow(aNode)->SetContainer(aContainer.latin1()); + aNode->SetComment(aComment.latin1()); + } + + } + SUPERV::INode_var aDummyEndNode; + addNode( aNode, aDummyEndNode, myX, myY ); + b = true; + } + } + } + } + if ( !b ) { + QMessageBox::warning(aDesktop, tr("WARNING"), tr("MSG_NONODE_TOADD")); + } + } + } +} void SUPERVGUI_Service::addInlineNode() { SUPERVGUI* aSupMod = SUPERVGUI::Supervision(); @@ -704,9 +824,9 @@ void SUPERVGUI_Service::tabChanged(QWidget* theWidget) { -//***************************************************** +//*****************************************************/ // Pane for Python script editing -//***************************************************** +//*****************************************************/ SUPERVGUI_PythonEditPane::SUPERVGUI_PythonEditPane( QWidget* theParent, const bool isNodeCreation, int& theX, int& theY ) : myIsWithLibrary( isNodeCreation ), QFrame( theParent ), @@ -877,8 +997,10 @@ SUPERV_Strings SUPERVGUI_PythonEditPane::getFunction() { // it's user's responsibility to enter correct Python code, we don't do anything with it. // if (..) -- initial, while(..) -- my improvement, but also commented out -- needless. //if (!aLine.right(1).compare(" ")) // replaced with the line below -- loop - //while (aLine.at(aLine.length()-1).isSpace()) // remove trailing spaces - // aLine = aLine.remove(aLine.length()-1,1); + // uncommented by mkr to fix bugs IPAL12363, IPAL12885 --> + while (aLine.at(aLine.length()-1).isSpace()) // remove trailing spaces + aLine = aLine.remove(aLine.length()-1,1); + // <-- aStrings[i] = CORBA::string_dup(aLine.latin1()); } return aStrings._retn(); @@ -918,7 +1040,7 @@ void SUPERVGUI_PythonEditPane::autoIndentLine() { i = -1; while ( line[++i].isSpace() ) // append all isSpace() characters at beginning of line to spacesStr spacesStr += line[i]; - + // if ':' was found -- add more spaces to spacesStr line = line.stripWhiteSpace(); if ( line[ line.length()-1 ] == ':' ) { @@ -1057,3 +1179,166 @@ void SUPERVGUI_Service::addNode( SUPERV::CNode_var theNode, SUPERV::INode_var th } } +/*! + Constructor +*/ +SUPERVGUI_CustomSettings::SUPERVGUI_CustomSettings(QListViewItem* theItem, + bool isMultiSel, + bool isCimpl) + : QDialog( SUIT_Session::session()->activeApplication()->desktop(), "", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +{ + Trace("SUPERVGUI_CustomSettings::SUPERVGUI_CustomSettings"); + + SUPERVGUI* aSupMod = SUPERVGUI::Supervision(); + if ( !aSupMod ) { + MESSAGE("NULL Supervision module!"); + return; + } + + SUIT_Desktop* aDesktop = SUIT_Session::session()->activeApplication()->desktop(); + + setSizeGripEnabled( true ); + + QGridLayout* TopLayout = new QGridLayout( this ); + TopLayout->setSpacing( 6 ); + TopLayout->setMargin( 11 ); + + QGroupBox* TopGroup = new QGroupBox( this, "TopGroup" ); + TopGroup->setColumnLayout(0, Qt::Vertical ); + TopGroup->layout()->setSpacing( 0 ); + TopGroup->layout()->setMargin( 0 ); + QGridLayout* TopGroupLayout = new QGridLayout( TopGroup->layout() ); + TopGroupLayout->setAlignment( Qt::AlignTop ); + TopGroupLayout->setSpacing( 6 ); + TopGroupLayout->setMargin( 11 ); + + QLabel* authL = new QLabel( tr( "AUTHOR_LBL" ), TopGroup); + authV = new QLineEdit( TopGroup ); + authV->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + authV->setMinimumSize( 200, 0 ); + authV->setText( "" ); + + contL = new QLabel( tr( "CONTAINER_LBL" ), TopGroup ); + contV = new QLineEdit( TopGroup ); + contV->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + contV->setMinimumSize( 200, 0 ); + + QLabel* commL = new QLabel( tr( "COMMENT_LBL" ), TopGroup); + commV = new QMultiLineEdit( TopGroup ); + commV->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); + commV->setMinimumSize( 200, 100 ); + + if ( !aSupMod->getInterfaceNameMap().contains(theItem->parent()->parent()->text(0)) ) { + QMessageBox::warning(aDesktop, tr("WARNING"), tr("MSG_NONODE_TOADD")); + return; + } + const char* component = aSupMod->getInterfaceNameMap().find(theItem->parent()->parent()->text(0)).data(); + + QString aNodeDefComment; + if ( !isMultiSel ) { + // 1) set caption + const char* service = theItem->text(0).latin1(); + aNodeDefComment = QString(service) + QString(tr("COMMENT_FROM")) + QString(component); + setCaption( tr( "TLT_CUSTOMPARAMETERS_SINGLE" ) + aNodeDefComment ); + } + else { + // 1) set caption + aNodeDefComment = QString("Factory Node"); + setCaption( tr( "TLT_CUSTOMPARAMETERS_MULTI" ) ); + } + + // 2) set Container + SUPERVGUI_Main* aMain = aSupMod->getMain(); + if (aMain==0) { + QMessageBox::warning(aDesktop, tr("WARNING"), tr("MSG_NO_SUPERVISION_WINDOW")); + return; + } + const char* aContainer = aMain->getDataflow()->ContainerNameForComponent(component); + if ( aContainer && strlen(aContainer) > 0 ) + contV->setText( QString(aContainer) ); + else if ( isCimpl ) // C++ implementation + contV->setText( QString(aMain->getDataflow()->DefaultCContainerName()) ); + else // Python implementation + contV->setText( QString(aMain->getDataflow()->DefaultPythonContainerName()) ); + + // 3) set comment + commV->setText( aNodeDefComment ); + + TopGroupLayout->addWidget( authL, 1, 0 ); + TopGroupLayout->addWidget( authV, 1, 1 ); + TopGroupLayout->addWidget( contL, 2, 0 ); + TopGroupLayout->addWidget( contV, 2, 1 ); + TopGroupLayout->addWidget( commL, 7, 0 ); + TopGroupLayout->addMultiCellWidget( commV, 7, 8, 1, 1 ); + TopGroupLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Minimum, QSizePolicy::Expanding ), 8, 0 ); + TopGroupLayout->setColStretch( 1, 5 ); + + QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 0 ); + GroupButtons->layout()->setMargin( 0 ); + QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + GroupButtonsLayout->setSpacing( 6 ); + GroupButtonsLayout->setMargin( 11 ); + + QPushButton* okB = new QPushButton( tr( "BUT_OK" ), GroupButtons ); + connect( okB, SIGNAL( clicked() ), this, SLOT( okButton() ) ); + QPushButton* cancelB = new QPushButton( tr( "BUT_CANCEL" ), GroupButtons ); + connect( cancelB, SIGNAL( clicked() ), this, SLOT( koButton() ) ); + + GroupButtonsLayout->addWidget( okB, 0, 0 ); + GroupButtonsLayout->addItem ( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 ); + GroupButtonsLayout->addWidget( cancelB, 0, 2 ); + + TopLayout->addWidget( TopGroup, 0, 0 ); + TopLayout->addWidget( GroupButtons, 1, 0 ); + TopLayout->setRowStretch( 0, 1 ); + TopLayout->setRowStretch( 1, 0 ); + + resize(370,200); +} + +/*! + Destructor +*/ +SUPERVGUI_CustomSettings::~SUPERVGUI_CustomSettings() { + Trace("SUPERVGUI_CustomSettings::~SUPERVGUI_CustomSettings"); +} + +/*! + Get author +*/ +QString SUPERVGUI_CustomSettings::Author() { + return authV->text(); +} + +/*! + Get container +*/ +QString SUPERVGUI_CustomSettings::Container() { + return contV->text(); +} + +/*! + Get comment +*/ +QString SUPERVGUI_CustomSettings::Comment() { + return commV->text(); +} + +/*! + button slot +*/ +void SUPERVGUI_CustomSettings::okButton() { + Trace("SUPERVGUI_CustomSettings::okButton"); + accept(); +} + +/*! + button slot +*/ +void SUPERVGUI_CustomSettings::koButton() { + Trace("SUPERVGUI_CustomSettings::koButton"); + reject(); +} diff --git a/src/SUPERVGUI/SUPERVGUI_Service.h b/src/SUPERVGUI/SUPERVGUI_Service.h index 6fb1f56..f28da4c 100644 --- a/src/SUPERVGUI/SUPERVGUI_Service.h +++ b/src/SUPERVGUI/SUPERVGUI_Service.h @@ -115,7 +115,8 @@ private: private slots: void tabChanged(QWidget *); void addComputeNode(); - void addFactoryNode(); + void addFactoryNodeDef(); + void addFactoryNodeCust(); void addInlineNode(); void addMacroNode(); void typeNodeSelected(int theRow); @@ -210,4 +211,28 @@ private: SUPERVGUI_PythonEditPane* myNextPane; }; +class SUPERVGUI_CustomSettings: public QDialog { + Q_OBJECT + + public: + SUPERVGUI_CustomSettings(QListViewItem* theItem, bool isMultiSel, bool isCimpl); + virtual ~SUPERVGUI_CustomSettings(); + + QString Author(); + QString Container(); + QString Comment(); + + private slots: + void okButton(); + void koButton(); + + private: + + QLineEdit* authV; + QLineEdit* contV; + QLabel* contL; + + QMultiLineEdit* commV; +}; + #endif diff --git a/src/SUPERVGUI/SUPERV_msg_en.po b/src/SUPERVGUI/SUPERV_msg_en.po index 45a1d25..0c7e9f2 100644 --- a/src/SUPERVGUI/SUPERV_msg_en.po +++ b/src/SUPERVGUI/SUPERV_msg_en.po @@ -495,6 +495,12 @@ msgstr "Rename Dataflow" msgid "TLT_INFORMATIONS" msgstr "Informations" +msgid "TLT_CUSTOMPARAMETERS_SINGLE" +msgstr "Set Custom Parameters for " + +msgid "TLT_CUSTOMPARAMETERS_MULTI" +msgstr "Set Custom Parameters for a selected nodes" + msgid "TLT_DSGRAPHPARAMS" msgstr "Data Stream Graph Parameters" @@ -633,6 +639,9 @@ msgstr "Add Compute Node" msgid "TIT_ADDFNODE" msgstr "Add Node" +msgid "TIT_ADDFNODE_CUST" +msgstr "Add Node and Customize Parameters" + msgid "BTN_FACTORYNODE" msgstr "Factory" @@ -929,7 +938,7 @@ msgid "TOP_POP_DISPLAY" msgstr "Display Dataflow" msgid "MEN_POP_DISPLAY" -msgstr "Display" +msgstr "Show" msgid "STB_POP_DISPLAY" msgstr "Display Dataflow" diff --git a/src/Supervision/CNode_Impl.cxx b/src/Supervision/CNode_Impl.cxx index 3b2addf..6933b27 100644 --- a/src/Supervision/CNode_Impl.cxx +++ b/src/Supervision/CNode_Impl.cxx @@ -37,8 +37,6 @@ using namespace std; #include "StreamPort_Impl.hxx" -char *FACTORYSERVERPY = "localhost/FactoryServerPy" ; - CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb , PortableServer::POA_ptr poa , PortableServer::ObjectId * contId , diff --git a/src/Supervision/FNode_Impl.cxx b/src/Supervision/FNode_Impl.cxx index a7a801a..b136c7f 100644 --- a/src/Supervision/FNode_Impl.cxx +++ b/src/Supervision/FNode_Impl.cxx @@ -64,6 +64,13 @@ FNode_Impl::FNode_Impl( CORBA::ORB_ptr orb , // NodeKindOfNode ) ) ; DataFlowNode()->ComponentName( NodeComponentName ) ; DataFlowNode()->InterfaceName( NodeInterfaceName ) ; + + // mkr : PAL13947 --> + const char * aContainer = DataFlowEditor()->Graph()->RetrieveFromMapOfComponentNameContainer(NodeComponentName); + if ( aContainer ) // container for NodeComponentName component was found in the map + SetContainer( aContainer ); + // mkr : PAL13947 <-- + endService( "FNode_Impl::FNode_Impl" ); // cout << "<-- FNode_Impl::FNode_Impl" << endl ; } @@ -161,6 +168,10 @@ bool FNode_Impl::SetContainer( const char * aDataFlowContainer ) { // GraphExecutor::DataFlow * _DataFlowExecutor = DataFlowEditor()->Executor() ; // if ( DataFlowEditor()->IsEditing() ) { RetVal = DataFlowNode()->Computer( aDataFlowContainer ) ; + + // insert modified container into < ComponentName, Container > map + DataFlowEditor()->Graph()->InsertToMapOfComponentNameContainer( GetComponentName(), aDataFlowContainer ) ; // mkr : PAL13947 + // } // else if ( _DataFlowExecutor && ( _DataFlowExecutor->IsSuspended() || // _DataFlowExecutor->IsSuspended( DataFlowNode()->Name() ) ) ) { diff --git a/src/Supervision/GNode_Impl.cxx b/src/Supervision/GNode_Impl.cxx index 89228a5..bc12026 100644 --- a/src/Supervision/GNode_Impl.cxx +++ b/src/Supervision/GNode_Impl.cxx @@ -247,7 +247,8 @@ bool GNode_Impl::SetCoupled( const char * anInLineNode ) ( !IsGOTO() && ( IsLoop() || IsSwitch() || IsEndLoop() || IsEndSwitch() ) ) ) { DataFlowNode()->CoupledNode( CoupledINode ) ; if ( CoupledINode && IsSwitch() ) { - DataFlowEditor()->AddLink( Name() , "Default" ,CoupledINode->Name() , "Default" ) ; +//JR NPAL14793 05.02.2007 : do not add that link +// DataFlowEditor()->AddLink( Name() , "Default" ,CoupledINode->Name() , "Default" ) ; } else if ( CoupledINode && ( IsLoop() || IsEndLoop() ) ) { DataFlowEditor()->AddLink( Name() , "DoLoop" , CoupledINode->Name() , "DoLoop" ) ; diff --git a/src/Supervision/Graph_Impl.cxx b/src/Supervision/Graph_Impl.cxx index 7564fd6..bbc0fec 100644 --- a/src/Supervision/Graph_Impl.cxx +++ b/src/Supervision/Graph_Impl.cxx @@ -401,9 +401,20 @@ SUPERV::CNode_ptr Graph_Impl::CNode( const SALOME_ModuleCatalog::Service &NodeSe SUPERV::FNode_ptr Graph_Impl::FNode( const char * NodeComponentName , const char * NodeInterfaceName , const SALOME_ModuleCatalog::Service &NodeService , - bool isCimpl ) { + const SALOME_ModuleCatalog::ImplType ImplType ) { beginService( "Graph_Impl::FNode" ); SUPERV::FNode_var iobject = SUPERV::FNode::_nil() ; + bool isCimpl = true; + switch (ImplType) + { + case SALOME_ModuleCatalog::PY: + isCimpl = false; + break; + case SALOME_ModuleCatalog::SO: + case SALOME_ModuleCatalog::EXE: + default: + ; + } if ( DataFlowEditor()->IsEditing() && !DataFlowEditor()->IsReadOnly() && !IsMacro() ) { FNode_Impl * myNode = new FNode_Impl( _Orb , _Poa , _ContId , instanceName() , interfaceName() , @@ -516,12 +527,12 @@ SUPERV::LNode_ptr Graph_Impl::LNode( const char * InitName , SALOME_ModuleCatalog::Service aVoidService = SALOME_ModuleCatalog::Service() ; char * anEndName ; if ( strlen( InitName ) ) { - anEndName = new char( 3 + strlen( InitName ) + 1 ) ; + anEndName = new char[ 3 + strlen( InitName ) + 1 ]; strcpy( anEndName , "End" ) ; strcat( anEndName , InitName ) ; } else { - anEndName = new char( 3 + strlen( "Loop" ) + 1 ) ; + anEndName = new char[ 3 + strlen( "Loop" ) + 1 ]; strcpy( anEndName , "EndLoop" ) ; } ELNode_Impl * myEndNode = new ELNode_Impl( _Orb , _Poa , _ContId , @@ -589,10 +600,11 @@ SUPERV::SNode_ptr Graph_Impl::SNode( const char * FuncName , myEndNode->SetObjRef( SUPERV::ESNode::_duplicate( iendobject ) ) ; myNode->SetCoupled( myEndNode->BaseNode()->Name() ) ; myEndNode->SetCoupled( myNode->BaseNode()->Name() ) ; - if ( !Link( myNode->Port( "Default" ) , myEndNode->Port( "Default" ) ) ) { - iobject = SUPERV::SNode::_nil() ; - iendobject = SUPERV::ESNode::_nil() ; - } +//JR NPAL14793 05.02.2007 : do not add that link +// if ( !Link( myNode->Port( "Default" ) , myEndNode->Port( "Default" ) ) ) { +// iobject = SUPERV::SNode::_nil() ; +// iendobject = SUPERV::ESNode::_nil() ; +// } } } anEndOfSwitch = SUPERV::ESNode::_duplicate( iendobject ) ; @@ -812,6 +824,7 @@ SUPERV::Graph_var Graph_Impl::LoadDataFlows( GraphExecutor::DataFlow * aDataFlow GraphExecutor::DataFlow * aMacroGraphExecutor ; CreateExecutor( _Orb , instanceName() , aMacroGraphName , SUPERV::DataStreamGraph , dbgfile , &aMacroGraphExecutor ); + theAutomaton->Executed() ; // Decrement _GraphExecutingNumber for MacroSubGraph // set GraphMacroLevel for Executor's graph GraphBase::Graph* aMacroGraphExe = aMacroGraphExecutor->Graph(); @@ -2187,10 +2200,12 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph , map< string , int > & aM if ( RetVal ) { for ( i = 0 ; i < (int ) aGraphNodes->FNodes.length() ; i++ ) { SUPERV::FNode_var aNode = (aGraphNodes->FNodes)[ i ] ; + SALOME_ModuleCatalog::ImplType implType = SALOME_ModuleCatalog::SO; + if (!aNode->IsCimpl()) implType = SALOME_ModuleCatalog::PY; SUPERV::FNode_ptr myNode = FNode( aNode->GetComponentName() , aNode->GetInterfaceName() , *(aNode->Service()) , - aNode->IsCimpl() ) ; // mkr : PAL11273 + implType ) ; // mkr : PAL11273 if ( !CORBA::is_nil( myNode ) ) { myNode->SetName( aNode->Name() ) ; myNode->SetAuthor( aNode->Author() ) ; @@ -2245,10 +2260,10 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph , map< string , int > & aM SUPERV::ListOfStreamPorts myStreamPorts = *(aNode->StreamPorts()) ; for ( j = 0 ; j < (int ) myStreamPorts.length() ; j++ ) { if ( myStreamPorts[ j ]->IsInput() ) { - aPort = myNode->InStreamPort( myStreamPorts[ j ]->Name() , StringToDataStreamType( myStreamPorts[ j ]->Type() ) , myStreamPorts[ j ]->Dependency() ) ; + aPort = myNode->InStreamPort( myStreamPorts[ j ]->Name(), myStreamPorts[ j ]->Type(), myStreamPorts[ j ]->Dependency() ) ; } else { - aPort = myNode->OutStreamPort( myStreamPorts[ j ]->Name() , StringToDataStreamType( myStreamPorts[ j ]->Type() ) , myStreamPorts[ j ]->Dependency() ) ; + aPort = myNode->OutStreamPort( myStreamPorts[ j ]->Name(), myStreamPorts[ j ]->Type(), myStreamPorts[ j ]->Dependency() ) ; } } } @@ -2287,10 +2302,10 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph , map< string , int > & aM SUPERV::ListOfStreamPorts myStreamPorts = *(aNode->StreamPorts()) ; for ( j = 0 ; j < (int ) myStreamPorts.length() ; j++ ) { if ( myStreamPorts[ j ]->IsInput() ) { - aPort = myNode->InStreamPort( myStreamPorts[ j ]->Name() , StringToDataStreamType( myStreamPorts[ j ]->Type() ) , myStreamPorts[ j ]->Dependency() ) ; + aPort = myNode->InStreamPort( myStreamPorts[ j ]->Name(), myStreamPorts[ j ]->Type(), myStreamPorts[ j ]->Dependency() ) ; } else { - aPort = myNode->OutStreamPort( myStreamPorts[ j ]->Name() , StringToDataStreamType( myStreamPorts[ j ]->Type() ) , myStreamPorts[ j ]->Dependency() ) ; + aPort = myNode->OutStreamPort( myStreamPorts[ j ]->Name(), myStreamPorts[ j ]->Type(), myStreamPorts[ j ]->Dependency() ) ; } } } @@ -2336,10 +2351,10 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph , map< string , int > & aM SUPERV::ListOfStreamPorts myStreamPorts = *(aNode->StreamPorts()) ; for ( j = 0 ; j < (int ) myStreamPorts.length() ; j++ ) { if ( myStreamPorts[ j ]->IsInput() ) { - aPort = myNode->InStreamPort( myStreamPorts[ j ]->Name() , StringToDataStreamType( myStreamPorts[ j ]->Type() ) , myStreamPorts[ j ]->Dependency() ) ; + aPort = myNode->InStreamPort( myStreamPorts[ j ]->Name(), myStreamPorts[ j ]->Type(), myStreamPorts[ j ]->Dependency() ) ; } else { - aPort = myNode->OutStreamPort( myStreamPorts[ j ]->Name() , StringToDataStreamType( myStreamPorts[ j ]->Type() ) , myStreamPorts[ j ]->Dependency() ) ; + aPort = myNode->OutStreamPort( myStreamPorts[ j ]->Name(), myStreamPorts[ j ]->Type(), myStreamPorts[ j ]->Dependency() ) ; } } } @@ -2355,10 +2370,10 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph , map< string , int > & aM SUPERV::ListOfStreamPorts myStreamLoopPorts = *(myEndOfLoop->StreamPorts()) ; for ( j = 0 ; j < (int ) myStreamLoopPorts.length() ; j++ ) { if ( myStreamLoopPorts[ j ]->IsInput() ) { - aPort = myNode->InStreamPort( myStreamLoopPorts[ j ]->Name() , StringToDataStreamType( myStreamLoopPorts[ j ]->Type() ) , myStreamLoopPorts[ j ]->Dependency() ) ; + aPort = myNode->InStreamPort( myStreamLoopPorts[ j ]->Name(), myStreamLoopPorts[ j ]->Type(), myStreamLoopPorts[ j ]->Dependency() ) ; } else { - aPort = myNode->OutStreamPort( myStreamLoopPorts[ j ]->Name() , StringToDataStreamType( myStreamLoopPorts[ j ]->Type() ) , myStreamLoopPorts[ j ]->Dependency() ) ; + aPort = myNode->OutStreamPort( myStreamLoopPorts[ j ]->Name(), myStreamLoopPorts[ j ]->Type(), myStreamLoopPorts[ j ]->Dependency() ) ; } } } @@ -2399,10 +2414,10 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph , map< string , int > & aM SUPERV::ListOfStreamPorts myStreamPorts = *(aNode->StreamPorts()) ; for ( j = 0 ; j < (int ) myStreamPorts.length() ; j++ ) { if ( myStreamPorts[ j ]->IsInput() ) { - aPort = myNode->InStreamPort( myStreamPorts[ j ]->Name() , StringToDataStreamType( myStreamPorts[ j ]->Type() ) , myStreamPorts[ j ]->Dependency() ) ; + aPort = myNode->InStreamPort( myStreamPorts[ j ]->Name(), myStreamPorts[ j ]->Type(), myStreamPorts[ j ]->Dependency() ) ; } else { - aPort = myNode->OutStreamPort( myStreamPorts[ j ]->Name() , StringToDataStreamType( myStreamPorts[ j ]->Type() ) , myStreamPorts[ j ]->Dependency() ) ; + aPort = myNode->OutStreamPort( myStreamPorts[ j ]->Name(), myStreamPorts[ j ]->Type(), myStreamPorts[ j ]->Dependency() ) ; } } } @@ -2428,10 +2443,10 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph , map< string , int > & aM SUPERV::ListOfStreamPorts myStreamSwitchPorts = *(myEndOfSwitch->StreamPorts()) ; for ( j = 0 ; j < (int ) myStreamSwitchPorts.length() ; j++ ) { if ( myStreamSwitchPorts[ j ]->IsInput() ) { - aPort = anEndOfSwitch->InStreamPort( myStreamSwitchPorts[ j ]->Name() , StringToDataStreamType( myStreamSwitchPorts[ j ]->Type() ) , myStreamSwitchPorts[ j ]->Dependency() ) ; // mkr : IPAL11394 (add port to !EndSwitch! node) + aPort = anEndOfSwitch->InStreamPort( myStreamSwitchPorts[ j ]->Name(), myStreamSwitchPorts[ j ]->Type(), myStreamSwitchPorts[ j ]->Dependency() ) ; // mkr : IPAL11394 (add port to !EndSwitch! node) } else { - aPort = anEndOfSwitch->OutStreamPort( myStreamSwitchPorts[ j ]->Name() , StringToDataStreamType( myStreamSwitchPorts[ j ]->Type() ) , myStreamSwitchPorts[ j ]->Dependency() ) ; // mkr : IPAL11394 (add port to !EndSwitch! node) + aPort = anEndOfSwitch->OutStreamPort( myStreamSwitchPorts[ j ]->Name(), myStreamSwitchPorts[ j ]->Type(), myStreamSwitchPorts[ j ]->Dependency() ) ; // mkr : IPAL11394 (add port to !EndSwitch! node) } } } @@ -2552,3 +2567,27 @@ void Graph_Impl::Editing() { } } +/** + * Returns the default name of container for C component + */ +char* Graph_Impl::DefaultCContainerName() { + return ( CORBA::string_dup( FACTORYSERVER ) ); +} + +/** + * Returns the default name of container for Python component + */ +char* Graph_Impl::DefaultPythonContainerName() { + return ( CORBA::string_dup( FACTORYSERVERPY ) ); +} + +/*! + * Returns the last container name associated with theComponentName component + */ +char* Graph_Impl::ContainerNameForComponent( const char * theComponentName ) { + const char* aContainer = DataFlowEditor()->Graph()->RetrieveFromMapOfComponentNameContainer(theComponentName); + if ( aContainer ) + return my_strdup(aContainer); + else + return ""; +} diff --git a/src/Supervision/Graph_Impl.hxx b/src/Supervision/Graph_Impl.hxx index cf49d19..1be15cd 100644 --- a/src/Supervision/Graph_Impl.hxx +++ b/src/Supervision/Graph_Impl.hxx @@ -115,7 +115,7 @@ class Graph_Impl : public POA_SUPERV::Graph , const char * NodeComponentName , const char * InterfaceName , const SALOME_ModuleCatalog::Service &NodeService , - bool isCimpl ) ; // mkr : PAL11273 : C++ implementation by default + const SALOME_ModuleCatalog::ImplType ImplType ) ; // mkr : PAL11273 : C++ implementation by default virtual SUPERV::INode_ptr INode( const char * FuncName , const SUPERV::ListOfStrings & PythonFunction ) ; @@ -158,7 +158,7 @@ class Graph_Impl : public POA_SUPERV::Graph , virtual SUPERV::Link_ptr Link( SUPERV::Port_ptr OutPort , SUPERV::Port_ptr InPort ) ; - virtual SUPERV::ListOfNodes_var Graph_Impl::SetNode( SUPERV::ListOfNodes_var RetVal , + virtual SUPERV::ListOfNodes_var SetNode( SUPERV::ListOfNodes_var RetVal , GraphBase::ComputingNode * aNode ) ; virtual SUPERV::ListOfNodes * Nodes() ; virtual void SetNodeObjRef( GraphEditor::InNode * anInNode ) ; @@ -212,6 +212,10 @@ class Graph_Impl : public POA_SUPERV::Graph , virtual SUPERV::StreamGraph_ptr ToStreamGraph() ; virtual void Editing(); // Destroy Executor and use only Editor and its data model + + virtual char* DefaultCContainerName() ; + virtual char* DefaultPythonContainerName() ; + virtual char* ContainerNameForComponent( const char * theComponentName) ; private: bool run( const bool andSuspend = false ); // Run() calls run( false ), Start() calls run( true ); diff --git a/src/Supervision/INode_Impl.cxx b/src/Supervision/INode_Impl.cxx index a4c5a8b..f9af025 100644 --- a/src/Supervision/INode_Impl.cxx +++ b/src/Supervision/INode_Impl.cxx @@ -283,8 +283,8 @@ SUPERV::Port_ptr INode_Impl::OutPort( const char *aParameterName , return SUPERV::Port::_duplicate( Outobject ); } -SUPERV::StreamPort_ptr INode_Impl::InStreamPort( const char *aParameterName , - const SALOME_ModuleCatalog::DataStreamType aParameterType , +SUPERV::StreamPort_ptr INode_Impl::InStreamPort( const char * aParameterName , + const char * aParameterType , const SALOME_ModuleCatalog::DataStreamDependency aDependency ) { SUPERV::StreamPort_ptr Inobject = SUPERV::StreamPort::_nil() ; if ( DataFlowEditor()->Graph()->IsDataStreamNode() ) { @@ -338,7 +338,7 @@ SUPERV::StreamPort_ptr INode_Impl::InStreamPort( const char *aParameterName , } SUPERV::StreamPort_ptr INode_Impl::OutStreamPort( const char * aParameterName , - const SALOME_ModuleCatalog::DataStreamType aParameterType , + const char * aParameterType , const SALOME_ModuleCatalog::DataStreamDependency aDependency ) { StreamPort_Impl * myOutStreamPort = NULL ; SUPERV::StreamPort_ptr Outobject = SUPERV::StreamPort::_nil() ; diff --git a/src/Supervision/INode_Impl.hxx b/src/Supervision/INode_Impl.hxx index 1691195..3c12220 100644 --- a/src/Supervision/INode_Impl.hxx +++ b/src/Supervision/INode_Impl.hxx @@ -101,10 +101,10 @@ class INode_Impl : public CNode_Impl , const char * aParameterType ) ; virtual SUPERV::StreamPort_ptr InStreamPort( const char * aParameterName , - const SALOME_ModuleCatalog::DataStreamType aParameterType , + const char * aParameterType , const SALOME_ModuleCatalog::DataStreamDependency aDependency ) ; virtual SUPERV::StreamPort_ptr OutStreamPort( const char * aParameterName , - const SALOME_ModuleCatalog::DataStreamType aParameterType , + const char * aParameterType , const SALOME_ModuleCatalog::DataStreamDependency aDependency ) ; } ; diff --git a/src/Supervision/Makefile.in b/src/Supervision/Makefile.in index a60c80e..bace1d5 100755 --- a/src/Supervision/Makefile.in +++ b/src/Supervision/Makefile.in @@ -88,14 +88,14 @@ BIN = SuperV_Server_omniORB4 \ BIN_SRC = BIN_SERVER_IDL = -CPPFLAGS+= $(PYTHON_INCLUDES) $(QT_MT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(BOOST_CPPFLAGS)\ +CPPFLAGS+= $(PYTHON_INCLUDES) $(QT_MT_INCLUDES) $(OCC_INCLUDES) $(BOOST_CPPFLAGS)\ $(KERNEL_CXXFLAGS) CXXFLAGS += -g -D__x86__ -D__linux__ -ftemplate-depth-42 -Wall \ $(KERNEL_CXXFLAGS) $(SUPERV_LDFLAGS) LDFLAGS+= -lSalomeSuperVisionEditor -lSalomeSuperVisionExecutor -lSalomeSuperVisionBase \ -lSalomeContainer -lSalomeNotification -lSalomeNS -lSalomeLifeCycleCORBA \ -lOpUtil -lRegistry -lTOOLSDS -lSALOMELocalTrace \ - $(QT_MT_LIBS) $(KERNEL_LDFLAGS) + $(QT_MT_LIBS) $(KERNEL_LDFLAGS) $(CAS_KERNEL) #LIBS += -Xlinker -export-dynamic $(PYTHON_LIBS) LDFLAGSFORBIN += $(LDFLAGS) $(KERNEL_LDFLAGS) -lSalomeResourcesManager -lSALOMEBasics diff --git a/src/Supervision/SUPERV_shared_modules.py b/src/Supervision/SUPERV_shared_modules.py index 88fcfc3..8a2d3c3 100644 --- a/src/Supervision/SUPERV_shared_modules.py +++ b/src/Supervision/SUPERV_shared_modules.py @@ -25,7 +25,9 @@ # see salome_shared_modules.py # (avoids incomplete import at run time) -print "============== import SUPERV =======================" +from launchConfigureParser import verbose + +if verbose(): print "============== import SUPERV =======================" import SUPERV diff --git a/src/Supervision/SuperV.py b/src/Supervision/SuperV.py index f82a740..5a7aed0 100644 --- a/src/Supervision/SuperV.py +++ b/src/Supervision/SuperV.py @@ -833,7 +833,7 @@ class Graph(GNode): aService = NodeComponent.GetService( anInterface , aService ) #if SuperVision.Swig : #aService = Service_Swig( aService ) - aNode = self.G.FNode( aComponent , anInterface , aService, 1 ) + aNode = self.G.FNode( aComponent , anInterface , aService, SALOME_ModuleCatalog.SO ) if aNode != None : aNode.isCimpl = 1 myNode = FNode( aNode , self.G.Verbose ) @@ -935,6 +935,8 @@ class Graph(GNode): if self.G.Verbose : print ErrMsg return aLink + def Messages( self ): + return self.G.Messages() def Import( self , anXmlFileName ): return self.G.Import( anXmlFileName ) def Export( self , anXmlFileName ): diff --git a/src/Supervision/SuperV_Impl.cxx b/src/Supervision/SuperV_Impl.cxx index 541ec6b..510d76c 100644 --- a/src/Supervision/SuperV_Impl.cxx +++ b/src/Supervision/SuperV_Impl.cxx @@ -104,7 +104,7 @@ Engines::TMPFile * SuperV_Impl::DumpPython( CORBA::Object_ptr theStudy , string aStringGraph ; string aStringRebuildData ; aStringGraph = - "### This file is generated by SALOME automatically by dump python funcitonality\n" + "### This file is generated by SALOME automatically by dump python functionality\n" "### of Supervisor component\n\n"; aStringRebuildData = "def RebuildData( theStudy ) :\n" ; if ( CORBA::is_nil( aStudy ) ) { @@ -835,6 +835,7 @@ SUPERV::Graph_ptr SuperV_Impl::GraphE(const char * aGraphName ) { myGraph->SetObjRef( SUPERV::Graph::_duplicate( iobject ) ) ; } myGraph->ReadOnly() ; + myGraph->DataFlowEditor()->Graph()->ClearMapOfComponentNameContainer() ; // mkr : PAL13947 endService( "SuperV_Impl::GraphE" ); return SUPERV::Graph::_duplicate(iobject) ; } @@ -884,6 +885,7 @@ SUPERV::StreamGraph_ptr SuperV_Impl::StreamGraphE(const char * aGraphName ) { myStreamGraph->SetObjRef( SUPERV::StreamGraph::_duplicate( iobject ) ) ; } myStreamGraph->ReadOnly() ; + myStreamGraph->DataFlowEditor()->Graph()->ClearMapOfComponentNameContainer() ; // mkr : PAL13947 endService( "SuperV_Impl::StreamGraphE" ); return SUPERV::StreamGraph::_duplicate(iobject) ; } diff --git a/src/Supervision/Value_Impl.cxx b/src/Supervision/Value_Impl.cxx index 54be215..4e7675e 100644 --- a/src/Supervision/Value_Impl.cxx +++ b/src/Supervision/Value_Impl.cxx @@ -265,30 +265,33 @@ char * Value_Impl::ToString() { } ostringstream astr ; const char * retstr ; + string RetStr; int startstr = 0 ; switch (anAny.type()->kind()) { case CORBA::tk_string: { anAny >>= retstr; + RetStr = string(retstr); // MESSAGE( "ToString( string ) '" << retstr << "'" ); break ; } case CORBA::tk_long: { - long l; + CORBA::Long l; anAny >>= l; astr << l << ends ; - retstr = astr.str().c_str() ; -// MESSAGE( "ToString( long ) '" << l << " " << retstr << "'" ); + RetStr = astr.str() ; +// MESSAGE( "ToString( CORBA::Long ) '" << l << " " << retstr << "'" ); break ; } case CORBA::tk_double: { double d; anAny >>= d; astr << setw(25) << setprecision(18) << d << ends ; - retstr = astr.str().c_str() ; + RetStr = astr.str(); int i = 0 ; - while ( i < (int ) strlen( retstr ) && retstr[ i++ ] == ' ' ) { + while ( i < (int ) RetStr.length() && RetStr.at(i++) == ' ' ) { startstr = i ; } + RetStr = RetStr.substr(startstr) ; // MESSAGE( "ToString( double ) '" << d << "' '" << retstr << "' '" << &retstr[ startstr ] << "'"); break ; } @@ -300,22 +303,22 @@ char * Value_Impl::ToString() { #else anAny >>= obj ; #endif - retstr = _Orb->object_to_string( obj ); + RetStr = _Orb->object_to_string( obj ); // MESSAGE( "ToString( object ) '" << retstr << "'" ); } catch ( ... ) { - retstr = "object_to_string catched " ; + RetStr = "object_to_string catched " ; } break ; } default: { - retstr = "Unknown CORBA::Any Type" ; + RetStr = "Unknown CORBA::Any Type" ; // MESSAGE( retstr ); break ; } } // endService( "Value_Impl::ToString" ); - return CORBA::string_dup( &retstr[ startstr ] ) ; + return CORBA::string_dup( RetStr.c_str() ) ; } bool Value_Impl::IsIOR() { diff --git a/src/Supervision/batchmode_SuperV.py b/src/Supervision/batchmode_SuperV.py index 1aefbc1..ffa73f6 100644 --- a/src/Supervision/batchmode_SuperV.py +++ b/src/Supervision/batchmode_SuperV.py @@ -850,7 +850,7 @@ class Graph(GNode): aService = NodeComponent.GetService( anInterface , aService ) #if SuperVision.Swig : #aService = Service_Swig( aService ) - aNode = self.G.FNode( aComponent , anInterface , aService, 1 ) + aNode = self.G.FNode( aComponent , anInterface , aService, SALOME_ModuleCatalog.SO ) if aNode != None : aNode.isCimpl = 1 myNode = FNode( aNode , self.G.Verbose ) @@ -1024,6 +1024,8 @@ class Graph(GNode): if self.G.Verbose : print ErrMsg return aLink + def Messages( self ): + return self.G.Messages() def Import( self , anXmlFileName ): return self.G.Import( anXmlFileName ) def Export( self , anXmlFileName ):