Salome HOME
DCQ:prepare 2.0.0
[modules/superv.git] / src / GraphEditor / DataFlowEditor_DataFlow.lxx
index 699c7a1ef4bb78bcfd19ee45adaa76469ddc3e34..1f82bf0d90447f779b7286cee9f8498314984d74 100644 (file)
@@ -57,18 +57,19 @@ inline char * GraphEditor::DataFlow::NodeInfo( const char * aNodeName ) {
   return CORBA::string_dup( s.str().c_str() );
 }
 
-inline bool GraphEditor::DataFlow::LoadDataFlow( const GraphBase::SGraph *aDataFlow ) {
+inline bool GraphEditor::DataFlow::LoadDataFlow( const GraphBase::SGraph * aDataFlow ) {
   if ( _ReadOnly )
     return false ;
   _EditedAfterExecution = true ;
   return GraphEditor::OutNode::LoadDataFlow( aDataFlow ) ; 
 } ;
 
-inline bool GraphEditor::DataFlow::LoadXml( const char* myFileName ) {
+inline bool GraphEditor::DataFlow::LoadXml( const char* myFileName ,
+                                            GraphBase::ListOfSGraphs & aListOfDataFlows ) {
   if ( _ReadOnly )
     return false ;
   _EditedAfterExecution = true ;
-  return GraphEditor::OutNode::LoadXml( myFileName ) ; 
+  return GraphEditor::OutNode::LoadXml( myFileName , aListOfDataFlows ) ; 
 } ;
 
 inline bool GraphEditor::DataFlow::LoadInfo( const GraphBase::SNode &aDataFlowInfo ) {
@@ -87,8 +88,9 @@ inline bool GraphEditor::DataFlow::SavePy(const char* myFileName ) {
 } ;
 
 // get all DataFlow informations (for a .XML file) :
-inline GraphBase::SGraph * GraphEditor::DataFlow::GetDataFlow() {
-   return GraphEditor::OutNode::GetDataFlow() ; 
+inline GraphBase::ListOfSGraphs * GraphEditor::DataFlow::GetDataFlows() {
+  GraphBase::ListOfSGraphs * aListOfDataFlows = new GraphBase::ListOfSGraphs;
+  return GraphEditor::OutNode::GetDataFlows( aListOfDataFlows ) ; 
 } ;
 
 //    void DateModification() ;
@@ -97,19 +99,19 @@ inline GraphBase::SGraph * GraphEditor::DataFlow::GetDataFlow() {
 //   return GraphEditor::OutNode::GetInfo() ; 
 //} ;
 
-inline GraphBase::ListOfNodes * GraphEditor::DataFlow::GetNodes() const {
+inline GraphBase::ListOfSNodes * GraphEditor::DataFlow::GetNodes() const {
    return Graph()->GetNodes() ; 
 } ;
 
-inline GraphBase::ListOfLinks * GraphEditor::DataFlow::GetLinks() const {
+inline GraphBase::ListOfSLinks * GraphEditor::DataFlow::GetLinks() const {
    return Graph()->GetLinks() ; 
 } ;
 
-inline GraphBase::ListOfGraphs * GraphEditor::DataFlow::GetGraphs() const {
+inline GraphBase::ListOfSGraphs * GraphEditor::DataFlow::GetGraphs() const {
    return Graph()->GetGraphs() ; 
 } ;
 
-inline GraphBase::ListOfLinks * GraphEditor::DataFlow::GetDatas() const {
+inline GraphBase::ListOfSLinks * GraphEditor::DataFlow::GetDatas() const {
    return Graph()->GetDatas() ; 
 } ;
 
@@ -161,7 +163,14 @@ inline GraphEditor::InNode * GraphEditor::DataFlow::AddNode(
                                         NodeComment , NodeX , NodeY ) ;
 //  MESSAGE( "<-- GraphEditor::DataFlow::AddNode( " << aNode->Name() << " )" ) ;
 //  cout << "<-- GraphEditor::DataFlow::AddNode( " << aNode->Name() << " )" << endl ;
-  cdebug_out << "GraphEditor::DataFlow::AddNode( " << aNode->Name() << " )" << endl ;
+  cdebug_out << "GraphEditor::DataFlow::AddNode( " ;
+  if ( aNode ) {
+    cdebug << aNode->Name() << " )" ;
+  }
+  else {
+    cdebug << "NULL ) Node not created" ;
+  }
+  cdebug << endl ;
   return aNode ;
 } ;
 
@@ -240,21 +249,21 @@ inline bool GraphEditor::DataFlow::HasInput(const char * ToServiceParameterName
 inline bool GraphEditor::DataFlow::AddLink( const char* FromNodeName ,
                                             const char* FromServiceParameterName ,
                                            const char* ToNodeName ,
-                                            const char* ToServiceParameterName ,
-                                           const CORBA::Any aValue ) {
+                                            const char* ToServiceParameterName ) {
+//                                         , const CORBA::Any aValue ) {
   if ( !_ReadOnly ) {
     GraphEditor::InNode * aFromNode = GetNode( FromNodeName ) ;
     if ( aFromNode ) {
-      GraphBase::OutPort * anOutPort = aFromNode->GetChangeOutPort( FromServiceParameterName ) ;
-      if ( anOutPort ) {
-        CORBA::Any const * theValue = anOutPort->Value() ; // Keep the type !
+//      GraphBase::OutPort * anOutPort = aFromNode->GetChangeOutPort( FromServiceParameterName ) ;
+//      if ( anOutPort ) {
+//        CORBA::Any const * theValue = anOutPort->Value() ; // Keep the type !
         _EditedAfterExecution = true ;
         return GraphEditor::OutNode::AddLink( FromNodeName ,
                                               FromServiceParameterName ,
                                               ToNodeName ,
-                                              ToServiceParameterName ,
-                                              *theValue ) ;
-      }
+                                              ToServiceParameterName ) ;
+//                                              , *theValue ) ;
+//      }
     }
   }
   return false ;
@@ -392,43 +401,12 @@ inline bool GraphEditor::DataFlow::RemoveLink(
 inline bool GraphEditor::DataFlow::AddInputData( const char* ToNodeName ,
                                                  const char* ToParameterName ,
                                                  const CORBA::Any aValue ) {
-#if 0
-  GraphBase::Node *toNode ;
-  GraphBase::InPort *toPort ;
-  char *aNode ;
-  char *aPort ;
-  NodePort( ToNodeName , ToParameterName , &aNode , &aPort ) ;
-  toNode = GetChangeGraphNode( aNode ) ;
-  if ( toNode ) {
-    toPort = toNode->GetChangeInPort( aPort ) ;
-    if ( toPort && ( toPort->IsConnected() ||
-                     toPort->IsDataConnected() ) ) {
-      RemoveLink( toNode->Name() , toPort->PortName() ) ;
-    }
-  }
-  else {
-    toPort = NULL ;
-  }
-  delete aNode ;
-  delete aPort ;
-#endif
   if ( !IsValid() ) {
     return false ;
   }
   return Graph()->AddInputData( ToNodeName , ToParameterName , aValue ) ; 
 } ;
 
-inline bool GraphEditor::DataFlow::AddInputSharedData(const char* ToNodeName1 ,
-                                                      const char* ToParameterName1 ,
-                                                      const char* ToNodeName2 ,
-                                                      const char* ToParameterName2 ) {
-  if ( !IsValid() ) {
-    return false ;
-  }
-  return GraphEditor::OutNode::AddInputData( ToNodeName1 , ToParameterName1 ,
-                                             ToNodeName2 , ToParameterName2 ) ;
-} ;
-
 inline const CORBA::Any *GraphEditor::DataFlow::GetInData(
                                    const char * ToNodeName ,
                                    const char * ToParameterName ) {
@@ -450,7 +428,14 @@ inline bool GraphEditor::DataFlow::IsExecutable() {
   return GraphEditor::OutNode::IsExecutable() ;
 }
 
+inline void GraphEditor::DataFlow::Executing() {
+  cdebug << "Executing _Executing = true " << endl ;
+  _Executing = true ;
+}
+
 inline bool GraphEditor::DataFlow::IsExecuting() {
+#if 0
+  //cout << " +++++> Old!" << endl;
   if ( _DataFlowExecutor ) {
     if ( _DataFlowExecutor->IsDone() ) {
       _Executing = false ;
@@ -462,9 +447,26 @@ inline bool GraphEditor::DataFlow::IsExecuting() {
   else {
     _Executing = false ;
   }
+#endif
+//  cdebug << "GraphEditor::DataFlow::IsExecuting _Executing " << _Executing << " DataFlowExecutor " << _DataFlowExecutor ;
+  if ( _DataFlowExecutor ) {
+    cdebug << " IsDone " << _DataFlowExecutor->IsDone() << " State " << _DataFlowExecutor->State() ;
+  }
+  cdebug << endl ;
+//  cout << "+++++++++++++> _Executing = " << _Executing << "  _DataFlowExecutor = " << _DataFlowExecutor << endl;
+  if ( _Executing && _DataFlowExecutor ) {
+    if ( _DataFlowExecutor->IsDone() ) {
+      _Executing = false ;
+    }
+  }
   return _Executing ;
 }
 
+inline void GraphEditor::DataFlow::Editing() {
+  cdebug << "Editing _Executing = false " << endl ;
+  _Executing = false ;
+}
+
 inline bool GraphEditor::DataFlow::IsEditing() {
   return !IsExecuting() ;
 }
@@ -518,7 +520,7 @@ inline long GraphEditor::DataFlow::SubStreamGraphsNumber() {
 
 inline void GraphEditor::DataFlow::Executor(
                                GraphExecutor::DataFlow * DataFlowExecutor ) {
-  _Executing = true ;
+//  _Executing = true ;
   _DataFlowExecutor = DataFlowExecutor ;
 }