]> SALOME platform Git repositories - modules/superv.git/commitdiff
Salome HOME
Implementation of improvement PAL8551 : Supervision message "Dataflow is not
authormkr <mkr@opencascade.com>
Tue, 18 Oct 2005 12:03:13 +0000 (12:03 +0000)
committermkr <mkr@opencascade.com>
Tue, 18 Oct 2005 12:03:13 +0000 (12:03 +0000)
valid" shoud be more explicit.

12 files changed:
idl/SUPERV.idl
src/GraphBase/DataFlowBase_Base.cxx
src/GraphBase/DataFlowBase_Base.hxx
src/GraphBase/DataFlowBase_ComputingNode.cxx
src/GraphBase/DataFlowBase_DataNode.cxx
src/GraphBase/DataFlowBase_Graph.cxx
src/GraphEditor/DataFlowEditor_OutNode.cxx
src/SUPERVGUI/SUPERVGUI_CanvasView.cxx
src/SUPERVGUI/SUPERVGUI_Main.cxx
src/Supervision/Graph_Impl.cxx
src/Supervision/Graph_Impl.hxx
src/Supervision/Link_Impl.cxx

index f52bf13bd70a82370e78782fa7570f99a874496b..5a0668ae191d763d8c57e02b0ef47dcaa602b749 100644 (file)
@@ -967,6 +967,10 @@ 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 message string explaning to user situation when some action was aborted
+     */
+    string ErrorMessage();
     
   } ;
 
index f7ddcc9da6f44b883a113c8de9968ea57aafd105..2fc0896f4865f50d2040a1f5cafe282cf16a335a 100644 (file)
@@ -38,6 +38,7 @@ char *FACTORYSERVER = "localhost/FactoryServer" ;
 GraphBase::Base::Base() {
   _prof_debug = NULL ;
   _fdebug = NULL ;
+  _message = "";
 }
 
 void GraphBase::Base::SetDebug( CORBA::ORB_ptr ORB ,
@@ -70,6 +71,16 @@ CORBA::Object_ptr GraphBase::Base::StringToObject( char * obj ) const {
   return _Orb->string_to_object( obj );
 }
 
+void GraphBase::Base::SetMessage( string theMessage)
+{
+  _message = theMessage;
+}
+
+string GraphBase::Base::GetMessage()
+{
+  return _message;
+}
+
 string DataStreamTypeToString( const SALOME_ModuleCatalog::DataStreamType aDataStreamType ) {
   string aIdlType ;
   switch ( aDataStreamType ) {
index 495d795f8bff95ac31241c37d3a60ecfd326e9ef..7dd7aede479cefa2ac136b91355baf4500e8690f 100644 (file)
@@ -189,6 +189,7 @@ namespace GraphBase {
 
       int      * _prof_debug ;
       ofstream * _fdebug ;
+      string     _message;
                      
       Base() ;
       virtual ~Base() {} ;
@@ -199,6 +200,9 @@ namespace GraphBase {
       char * ObjectToString( CORBA::Object_ptr obj ) const ;
       CORBA::Object_ptr StringToObject(char * obj ) const ;
 
+      void SetMessage( string theMessage);
+      string GetMessage();
+
   } ;
 
 # ifdef _DEBUG_
index 8b1d3e7c67cd466075f5da5d2f4411277dc657f7..4ed3c5bbc79cbf6a49fa2d82756c14502cca851a 100644 (file)
@@ -694,6 +694,9 @@ bool GraphBase::ComputingNode::CheckLoop(GraphBase::LoopNode * aLoopNode ,
     cdebug_out << Name() << "->GraphBase::ComputingNode::CheckLoop( " << aLoopNode->Name()
                << " , " << anEndLoopNode->Name() << ") LinkedNodesSize "
                << LinkedNodesSize() << " false" << endl;
+    string aMes = string("There is no any node linked to the start ") + aLoopNode->Name() +
+      string(" Loop node.");
+    GraphOfNode()->SetMessage( aMes );
     return false ;
   }
 // We check that all nodes linked to that node go to the end of LoopNode :
@@ -705,6 +708,9 @@ bool GraphBase::ComputingNode::CheckLoop(GraphBase::LoopNode * aLoopNode ,
         cdebug_out << Name() << "->GraphBase::ComputingNode::CheckLoop( " << aLoopNode->Name()
                    << " , " << anEndLoopNode->Name() << ") LinkedNodesSize "
                    << LinkedNodesSize() << " false" << endl;
+       string aMes = string("Not all nodes linked to the start ") + aLoopNode->Name() +
+         string(" Loop node go to the end of ") + anEndLoopNode->Name() + string(" EndLoop node.");
+       GraphOfNode()->SetMessage( aMes );
         return false ;
       }
     }
@@ -726,6 +732,9 @@ bool GraphBase::ComputingNode::CheckEndLoop(GraphBase::LoopNode * aLoopNode ,
     cdebug_out << Name() << "->GraphBase::ComputingNode::CheckEndLoop( " << aLoopNode->Name()
                << " , " << anEndLoopNode->Name() << ") LinkedFromNodesSize "
                << LinkedFromNodesSize() << " false" << endl;
+    string aMes = string("There is no any node linked to the ") + anEndLoopNode->Name() +
+      string(" EndLoop node.");
+    GraphOfNode()->SetMessage( aMes );
     return false ;
   }
 // We have to check that all nodes linked from that node go to the beginning of LoopNode : 
@@ -737,6 +746,9 @@ bool GraphBase::ComputingNode::CheckEndLoop(GraphBase::LoopNode * aLoopNode ,
         cdebug_out << Name() << "->GraphBase::ComputingNode::CheckEndLoop( " << aLoopNode->Name()
                    << " , " << anEndLoopNode->Name() << ") LinkedFromNodesSize "
                    << LinkedFromNodesSize() << " false" << endl;
+       string aMes = string("Not all nodes linked to the ") + anEndLoopNode->Name() +
+         string(" EndLoop node go to the start of ") + aLoopNode->Name() + string(" Loop node.");
+       GraphOfNode()->SetMessage( aMes );
         return false ;
       }
     }
index fa2e10f1bbffdb44dc41d09b54954bc9e3739281..f225b473c878dc3865e49de7f2f8d27e70b8e50a 100644 (file)
@@ -113,6 +113,9 @@ int GraphBase::DataNode::CheckDataServerNodes() const {
         cdebug << "InPort " << anOutPort->PortName() << " " << anOutPort->PortType() << " "
                << anOutPort->PortStatus() << " of DataFlow " << Name() << " has NO Data. GraphMacroLevel "
                << GraphMacroLevel() << endl ;
+       string aMes = string("Input port ") + anOutPort->PortName() + string(" of ") + Name() +
+         string(" dataflow has NO data.");
+       ((GraphBase::Base*)this)->SetMessage( aMes );
         ierr++ ;
       }
     }
index 7997b587eda0daaca97dd297530f6e74898ee05e..24d4bbcf6d8ccc9f16832def1f11c5075d538005 100644 (file)
@@ -1864,6 +1864,9 @@ bool GraphBase::Graph::CreateService() {
                             anInPort->GetOutPort()->ValuePtr() ) ) {
           cdebug << "CreateService In" << j << " " << anInPort->NodeName() << "(" << anInPort->PortName() << ") "
                  << anInPort->PortStatus() << " --> AddInputData ERROR" << endl ;
+         string aMes = string("Error in adding input data of ") + anInPort->PortName() + 
+           string(" port of ") + anInPort->NodeName() + string(" node into service of the graph.");
+         SetMessage( aMes );
           RetVal = false ;
        }
         else {
@@ -1877,6 +1880,9 @@ bool GraphBase::Graph::CreateService() {
         if ( !AddLink( this , GetChangeInDataNodePort( anInPort->NodePortName() ) , aToNode , anInPort ) ) {
           cdebug << "CreateService In" << j << " " << anInPort->NodeName() << "(" << anInPort->PortName() << ") "
                  << anInPort->PortStatus() << " --> AddInLink ERROR" << endl ;
+         string aMes = string("Error in adding link from ") + anInPort->PortName() + 
+           string(" input port of ") + anInPort->NodeName() + string(" node.");
+         SetMessage( aMes );
           RetVal = false ;
        }
         else {
@@ -1897,6 +1903,10 @@ bool GraphBase::Graph::CreateService() {
         if ( !AddLink( aToNode , anOutPort , this , anInPort ) ) {
           cdebug << "       --> " << Name() << "(" << anInPort->PortName()
                  << ") " << anInPort->PortStatus() << " AddOutLink ERROR" << endl ;
+         string aMes = string("Error in adding link from ") + anOutPort->PortName() + string(" output port of ") +
+           aToNode->Name() + " node to " + anInPort->PortName() + string(" input port of ") + 
+           Name() + string(" node.");
+         SetMessage( aMes );
           RetVal = false ;
        }
         else {
@@ -2124,6 +2134,8 @@ bool GraphBase::Graph::Sort( int & SubStreamGraphsNumber ) {
 // will wait for data(s) from node(s) not executed or not executing for ever
       if ( !NewSorted ) {
         cdebug << "Loop detected level " << _LevelsNumber << endl ;
+       string aMes = string("Loop in the graph : graph will wait for data(s) from node(s) not executed or not executing for ever => dead lock.");
+       SetMessage( aMes );
        return false ; // Loop in the Graph
       }
 //      cdebug << "Bilan level " << _LevelsNumber << " : " << endl ;
@@ -2187,6 +2199,8 @@ bool GraphBase::Graph::Sort( int & SubStreamGraphsNumber ) {
     }
     if ( AllSortedNodes != GraphNodesSize() ) {
       cdebug << "Loop detected level " << _LevelsNumber << endl ;
+      string aMes = string("Loop in the graph : graph will wait for data(s) from node(s) not executed or not executing for ever => dead lock.");
+      SetMessage( aMes );
       return false ; // Loop in the Graph
     }
 
@@ -2522,6 +2536,10 @@ bool GraphBase::Graph::LinkLoopNodes(bool & NewLink ) {
 //            cdebug << "GraphBase::Graph::CreateService AddLink ERROR " << aLoopNode->CoupledNode()->Name()
 //                   << "( " << aLoopNode->CoupledNode()->GetChangeNodeOutPort( j )->PortName() << " ) --> "
 //                   << aLoopNode->Name() << "( " << anInPort->PortName() << " )" << endl ;
+           string aMes = string("Error in adding link from output port ") + aLoopNode->CoupledNode()->GetChangeNodeOutPort( j )->PortName() +
+             string(" of ") + aLoopNode->CoupledNode()->Name() + string(" EndLoop node to input port ") + anInPort->PortName() +
+             string(" of corresponding ") + aLoopNode->Name() + string(" Loop node.");
+           SetMessage( aMes );
             RetVal = false ;
          }
           else {
@@ -2537,6 +2555,10 @@ bool GraphBase::Graph::LinkLoopNodes(bool & NewLink ) {
 //            cdebug << "GraphBase::Graph::CreateService AddLink ERROR " << aLoopNode->Name() << "( "
 //                   << aLoopNode->GetChangeNodeOutPort( j )->PortName() << " ) --> "
 //                   << aLoopNode->CoupledNode()->Name() << "( " << anInPort->PortName() << " )" << endl ;
+           string aMes = string("Error in adding link from output port ") + aLoopNode->GetChangeNodeOutPort( j )->PortName() +
+             string(" of ") + aLoopNode->Name() + string(" Loop node to input port ") + anInPort->PortName() +
+             string(" of corresponding ") + aLoopNode->CoupledNode()->Name() + string(" EndLoop node.");
+           SetMessage( aMes );
             RetVal = false ;
          }
           else {
@@ -2556,8 +2578,18 @@ bool GraphBase::Graph::LinkLoopNodes(bool & NewLink ) {
        // cdebug << "GraphBase::Graph::CreateService AddLink ERROR " << aGOTONode->Name() << "( "
        //        << anOutGate->PortName() << " ) --> " << aGOTONode->CoupledNode()->Name() << "( "
        //        << aGOTONode->CoupledNode()->GetChangeNodeInGate()->PortName() << " )" << endl ;
-         if ( !RetVal )
-           NewLink = true;
+         if ( !RetVal ) {
+           NewLink = true; // why ??? in this case new link isn't created
+           string aMes = string("Error in adding link from output Gate port ") + anOutGate->PortName() +
+             string(" of GOTO node named ") + aGOTONode->Name() + string(" to input Gate port ") +
+             aGOTONode->CoupledNode()->GetChangeNodeInGate()->PortName() + string(" of its coupled node named ") +
+             aGOTONode->CoupledNode()->Name() + string(".");
+           SetMessage( aMes );
+         }
+       }
+       else {
+         string aMes = string("GOTO node named ") + aGOTONode->Name() + string(" has no coupled node.");
+         SetMessage( aMes );
        }
       }
     }
@@ -2593,6 +2625,8 @@ bool GraphBase::Graph::DataServerNodes() const {
 //  list<GraphExecutor::InNode *> aComputingNodesList = _G->ComputingNodesList() ;
 //  list<GraphExecutor::InNode *>::iterator aNode = aComputingNodesList.begin();
   if ( GraphNodesSize() == 0 ) {
+    string aMes = string("Graph ") + Name() + string(" has NO nodes.");
+    ((GraphBase::Base*)this)->SetMessage( aMes );
     ierr++ ;
   }
   else {
@@ -2605,6 +2639,8 @@ bool GraphBase::Graph::DataServerNodes() const {
         if ( !strlen( FaNode->Computer() ) ) {
 //          cdebug << "ComputerName missing for node " << FaNode->Name() ;
           if ( !strlen( FaNode->Computer() ) ) {
+           string aMes = string("ComputerName missing for node ") + FaNode->Name() + string(".");
+           ((GraphBase::Base*)this)->SetMessage( aMes );
             ierr++ ;
             cdebug << endl ;
           }
index 5af740efb7668bf1b434eea02ac27bb50162a16d..da5121901fa0ede30fa52726b7a90408eff7def6 100644 (file)
@@ -1712,10 +1712,15 @@ bool GraphEditor::OutNode::IsLinksCompatible() {
     b = IsCompatible( anOutPort->PortType(), anInPort->PortType() );
     cdebug << "GraphEditor::OutNode::IsLinksCompatible:  "<<aLink.FromNodeName << "("<<aLink.FromServiceParameterName
       <<")  -->  "<<aLink.ToNodeName<<"("<<aLink.ToServiceParameterName<<") = " << (b ? "OK" : "Not compatible (ERROR)") << endl;
-    if ( !b )
+    if ( !b ) {
       MESSAGE( "Graph structure ERROR: type of port \""<<aLink.FromServiceParameterName<<"\" of node \""
              <<aLink.FromNodeName<<"\" is not compatible with type of linked port \""
              <<aLink.ToServiceParameterName<<"\" of node \""<<aLink.ToNodeName<<"\"" ); 
+      string aMes = string("Type of port ") + aLink.FromServiceParameterName + string(" of node ") + aLink.FromNodeName +
+       string(" is not compatible with type of linked port ") + aLink.ToServiceParameterName + string(" of node ") +
+       aLink.ToNodeName + string(".");
+      Graph()->SetMessage( aMes );
+    }
   }
   return b;
 }
index 7495b39fdf259f664b5eb31551a6410e67b83dbe..9d9911de8f0b7d7366333799a7a1bb5c780f838a 100644 (file)
@@ -663,8 +663,9 @@ void SUPERVGUI_CanvasView::endSketch(SUPERVGUI_CanvasPort* thePort)
 
     // asv : 13.12.04 : introducing a check for ports' types compatibility (Bugs and Improvements p.1.16, PAL7380)
     if ( !aLinkEngine->IsValid() ) { 
-      const int id = QAD_MessageBox::warn2( this, tr( "TLT_INVALID_LINK" ), tr( "MSG_INVALID_LINK" ), 
-                                          tr( "Keep" ), tr( "Remove" ), 0, 1, 0 );
+      const int id = QAD_MessageBox::warn2( this, tr( "TLT_INVALID_LINK" ), 
+                                           tr( "MSG_INVALID_LINK" ) + QString(" : ") + QString(myMain->getDataflow()->ErrorMessage()), 
+                                           tr( "Keep" ), tr( "Remove" ), 0, 1, 0 );
       if ( id == 1 ) { // "Remove" was selected in Message Box
        aLink->remove(); // the new link did not live long...
       }
index a363a7152717b41b4997731726116615c7141294..a542e7a6d34a7a6f2704f95952fbe5c3ce5e3555 100644 (file)
@@ -536,10 +536,10 @@ void SUPERVGUI_Main::run( const bool andSuspend ) {
     Editing(); // remove old executor, update GUI (all nodes to "No Status")
 
     if ( !dataflow->IsValid() ) {
-      QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_DF_NOTVALID"));
+      QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_DF_NOTVALID") + QString(" : ") + QString(dataflow->ErrorMessage()));
     } 
     else if (!dataflow->IsExecutable()) {
-      QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_DF_NOTEXECUTABLE"));
+      QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_DF_NOTEXECUTABLE") + QString(" : ") + QString(dataflow->ErrorMessage()));
     } 
     else if (myCanvasView->isAnyLinkCreating()) {
       QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CRL_NOTCOMPLETE"));
index d30f6940cbf02b0c83e1672561a7317f34c91584..4709044ff953a01ebbbd29637eb26aeeb2f6184a 100644 (file)
@@ -2497,3 +2497,14 @@ void Graph_Impl::Editing() {
   }
 }
 
+/**
+ * Returns message string explaning to user situation when some action was aborted
+ */
+char* Graph_Impl::ErrorMessage() {
+  if ( DataFlowEditor() ) {
+    return my_strdup(DataFlowEditor()->Graph()->GetMessage().c_str());
+  }
+  else if ( DataFlowExecutor() ) {
+    return my_strdup(DataFlowExecutor()->Graph()->GetMessage().c_str());
+  }
+}
index 3469f055758ef5bc95e9e3a344fd292d0dac7515..6c018579de24a385db7181977de345ca9c48c325 100644 (file)
@@ -208,6 +208,8 @@ class Graph_Impl : public POA_SUPERV::Graph ,
 
     virtual void Editing(); // Destroy Executor and use only Editor and its data model
 
+    virtual char* ErrorMessage();
+
 private:
     bool run( const bool andSuspend = false ); // Run() calls run( false ), Start() calls run( true );
 
index 1331b30321bd694840221a0ced412fd1515d8e23..6b7ebaf28110ef00500c61d35edc6b7e91daee12 100644 (file)
@@ -279,7 +279,14 @@ bool Link_Impl::Coords( const long index , long & X , long & Y ) {
  */ 
 bool Link_Impl::IsValid() {
   if ( InPort() && OutPort() ) {
-    return DataFlowEditor()->IsCompatible( OutPort()->Type(), InPort()->Type() );
+    bool aRetVal = DataFlowEditor()->IsCompatible( OutPort()->Type(), InPort()->Type() );
+    if ( !aRetVal ) {
+      string aMes = string("Type ") + OutPort()->Type() + string(" of port ") + OutPort()->Name() + 
+       string(" is not compatible with type ") + InPort()->Type() + string(" of linked port ") + 
+       InPort()->Name() + string(".");
+      DataFlowEditor()->Graph()->SetMessage( aMes );
+    }
+    return aRetVal;
   }
   return false;
 }