Salome HOME
Merge from OCC_development_generic_2006
[modules/superv.git] / src / GraphEditor / DataFlowEditor_DataFlow.lxx
index e09bb9f6ec2d8769b22f27650afa8c15d19950ad..24f63f6f932c1423e893233dab6e184265c81c0f 100644 (file)
@@ -33,6 +33,8 @@ inline void GraphEditor::DataFlow::ReadOnly() {
   _ReadOnly = true ;
 }
 
+//JR 07.07.2005 : old code from the first prototype
+#if 0
 inline char * GraphEditor::DataFlow::DataFlowInfo() {
   ostringstream s;
   IsValid() ;
@@ -56,6 +58,7 @@ inline char * GraphEditor::DataFlow::NodeInfo( const char * aNodeName ) {
     s << aNodeName << " not found" << ends ;
   return CORBA::string_dup( s.str().c_str() );
 }
+#endif
 
 inline bool GraphEditor::DataFlow::LoadDataFlow( const GraphBase::SGraph * aDataFlow ) {
   if ( _ReadOnly )
@@ -292,7 +295,7 @@ inline bool GraphEditor::DataFlow::AddLinkCoord(
                          const int nXY ,
                          const int* X ,
                          const int* Y ) {
-  _EditedAfterExecution = true ;
+  //_EditedAfterExecution = true ; // mkr : fix for bug IPAL9818
   return GraphEditor::OutNode::AddLinkCoord( FromNodeName ,
                                              FromServiceParameterName ,
                                              ToNodeName ,
@@ -308,7 +311,7 @@ inline bool GraphEditor::DataFlow::AddLinkCoord(
                          const int index ,
                          const int X ,
                          const int Y ) {
-  _EditedAfterExecution = true ;
+  //_EditedAfterExecution = true ; // mkr : fix for bug IPAL9818
   return GraphEditor::OutNode::AddLinkCoord( FromNodeName ,
                                              FromServiceParameterName ,
                                              ToNodeName ,
@@ -324,7 +327,7 @@ inline bool GraphEditor::DataFlow::ChangeLinkCoord(
                          const int index ,
                          const int X ,
                          const int Y ) {
-  _EditedAfterExecution = true ;
+  //_EditedAfterExecution = true ; // mkr : fix for bug IPAL9818
   return GraphEditor::OutNode::ChangeLinkCoord( FromNodeName ,
                                                 FromServiceParameterName ,
                                                 ToNodeName ,
@@ -338,7 +341,7 @@ inline bool GraphEditor::DataFlow::RemoveLinkCoord(
                          const char* ToNodeName ,
                          const char* ToServiceParameterName ,
                          const int index ) {
-  _EditedAfterExecution = true ;
+  //_EditedAfterExecution = true ; // mkr : fix for bug IPAL9818
   return GraphEditor::OutNode::RemoveLinkCoord( FromNodeName ,
                                                 FromServiceParameterName ,
                                                 ToNodeName ,
@@ -407,20 +410,26 @@ inline bool GraphEditor::DataFlow::AddInputData( const char* ToNodeName ,
   return Graph()->AddInputData( ToNodeName , ToParameterName , aValue ) ; 
 } ;
 
-inline const CORBA::Any *GraphEditor::DataFlow::GetInData(
+//JR 30.03.2005inline const CORBA::Any *GraphEditor::DataFlow::GetInData(
+inline const CORBA::Any GraphEditor::DataFlow::GetInData(
                                    const char * ToNodeName ,
                                    const char * ToParameterName ) {
   return GraphEditor::OutNode::GetInData( ToNodeName ,
                                           ToParameterName ) ;
 }
-inline const CORBA::Any *GraphEditor::DataFlow::GetOutData(
+//JR 30.03.2005inline const CORBA::Any *GraphEditor::DataFlow::GetOutData(
+inline const CORBA::Any GraphEditor::DataFlow::GetOutData(
                                    const char * FromNodeName ,
                                    const char * FromParameterName ) {
   return GraphEditor::OutNode::GetOutData( FromNodeName ,
                                            FromParameterName ) ;
 }
 
+//JR Optional parameter kLoopSwitch (default = true) :
+//In some cases we do not need to check the validity of loops and switchs
+//inline bool GraphEditor::DataFlow::IsValid(bool kLoopSwitch ) {
 inline bool GraphEditor::DataFlow::IsValid() {
+//  return GraphEditor::OutNode::IsValid( kLoopSwitch ) ;
   return GraphEditor::OutNode::IsValid() ;
 }
 
@@ -428,29 +437,18 @@ inline bool GraphEditor::DataFlow::IsExecutable() {
   return GraphEditor::OutNode::IsExecutable() ;
 }
 
-inline void GraphEditor::DataFlow::Executing( bool b ) {
-  cdebug << "Executing _Executing = " << b << endl ;
-  _Executing = b ;
+inline void GraphEditor::DataFlow::Executing() {
+  cdebug << "Editor::DataFlow::Executing() : set _Executing = true " << endl ;
+  _Executing = true ;
 }
 
 inline bool GraphEditor::DataFlow::IsExecuting() {
-/*
-  if ( _DataFlowExecutor ) {
-    cdebug << " IsDone " << _DataFlowExecutor->IsDone() << " State " << _DataFlowExecutor->State() ;
-  }
-  cdebug << endl ;
-  if ( _Executing && _DataFlowExecutor ) {
-    if ( _DataFlowExecutor->IsDone() ) {
-      _Executing = false ;
-    }
-  }
-*/
   return _Executing ;
 }
 
 
 inline void GraphEditor::DataFlow::Editing() {
-  cdebug << "Editing _Executing = false " << endl ;
+  cdebug << "Editor::DataFlow::Editing() : set _Executing = false " << endl ;
   _Executing = false ;
 }
 
@@ -477,35 +475,49 @@ inline bool GraphEditor::DataFlow::IsReadOnly() {
 }
 
 inline long GraphEditor::DataFlow::LevelMax() {
-  if ( !IsValid() ) {
+//  if ( !IsValid( false ) ) {
+//  if ( !IsExecutable() ) {
+  // mkr : IPAL9974 -->
+  int SubStreamGraphsNumber = 0 ;
+  if ( !IsValid() || !Graph()->Sort( SubStreamGraphsNumber ) ) {
+  // mkr : IPAL9974 <-- 
     return 0 ;
   }
   return Graph()->LevelMax() ;
 }
 
 inline SUPERV::ListOfStrings * GraphEditor::DataFlow::LevelNodes(long aLevel ) {
-  if ( !IsValid() ) {
+//  if ( !IsValid( false ) ) {
+//  if ( !IsExecutable() ) {
+  if ( !IsValid() ) { // mkr : IPAL9974
     return ((SUPERV::ListOfStrings * ) NULL ) ;
   }
   return Graph()->LevelNodes( aLevel ) ;
 }
 
 inline long GraphEditor::DataFlow::ThreadsMax() {
-  if ( !IsValid() ) {
+//  if ( !IsValid() ) {
+//  if ( !IsExecutable() ) {
+  // mkr : IPAL9974 -->
+  int SubStreamGraphsNumber = 0 ;      
+  if ( !IsValid()  || !Graph()->Sort( SubStreamGraphsNumber ) ) {
+  // mkr : IPAL9974 <--
     return 0 ;
   }
   return Graph()->ThreadsMax() ;
 }
 
 inline long GraphEditor::DataFlow::SubGraphsNumber() {
-  if ( !IsValid() ) {
+//  if ( !IsValid() ) {
+  if ( !IsExecutable() ) {
     return 0 ;
   }
   return Graph()->SubGraphsNumber() ;
 }
 
 inline long GraphEditor::DataFlow::SubStreamGraphsNumber() {
-  if ( !IsValid() ) {
+//  if ( !IsValid() ) {
+  if ( !IsExecutable() ) {
     return 0 ;
   }
   return StreamGraph()->SubStreamGraphsNumber() ;