X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGraphEditor%2FDataFlowEditor_DataFlow.lxx;h=d69cc14cb8b51132539e79ba63fa16142586bcc7;hb=0991b07b8dd33ee360159c092073cda3a82f407f;hp=1a783e87227fbb88ab3ee199888cbaaa919318af;hpb=c472be64ad2486a50e224af7c02e34eefaca9304;p=modules%2Fsuperv.git diff --git a/src/GraphEditor/DataFlowEditor_DataFlow.lxx b/src/GraphEditor/DataFlowEditor_DataFlow.lxx index 1a783e8..d69cc14 100644 --- a/src/GraphEditor/DataFlowEditor_DataFlow.lxx +++ b/src/GraphEditor/DataFlowEditor_DataFlow.lxx @@ -44,31 +44,32 @@ inline char * GraphEditor::DataFlow::DataFlowInfo() { inline char * GraphEditor::DataFlow::DataNodeInfo() { ostringstream s; IsValid() ; - GraphBase::DataNode::DataNodeInfo( s ) ; + Graph()->DataNodeInfo( s ) ; return CORBA::string_dup( s.str().c_str() ); } inline char * GraphEditor::DataFlow::NodeInfo( const char * aNodeName ) { ostringstream s; - if ( GetGraphNode( aNodeName ) ) - GetGraphNode( aNodeName )->NodeInfo( s ) ; + if ( Graph()->GetGraphNode( aNodeName ) ) + Graph()->GetGraphNode( aNodeName )->NodeInfo( s ) ; else s << aNodeName << " not found" << ends ; 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,35 +88,36 @@ 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() ; -inline GraphBase::SNode * GraphEditor::DataFlow::GetInfo() const { - return GraphEditor::OutNode::GetInfo() ; -} ; +//inline GraphBase::SNode * GraphEditor::DataFlow::GetInfo() const { +// return GraphEditor::OutNode::GetInfo() ; +//} ; -inline GraphBase::ListOfNodes * GraphEditor::DataFlow::GetNodes() const { - return GraphEditor::OutNode::GetNodes() ; +inline GraphBase::ListOfSNodes * GraphEditor::DataFlow::GetNodes() const { + return Graph()->GetNodes() ; } ; -inline GraphBase::ListOfLinks * GraphEditor::DataFlow::GetLinks() const { - return GraphEditor::OutNode::GetLinks() ; +inline GraphBase::ListOfSLinks * GraphEditor::DataFlow::GetLinks() const { + return Graph()->GetLinks() ; } ; -inline GraphBase::ListOfGraphs * GraphEditor::DataFlow::GetGraphs() const { - return GraphEditor::OutNode::GetGraphs() ; +inline GraphBase::ListOfSGraphs * GraphEditor::DataFlow::GetGraphs() const { + return Graph()->GetGraphs() ; } ; -inline GraphBase::ListOfLinks * GraphEditor::DataFlow::GetDatas() const { - return GraphEditor::OutNode::GetDatas() ; +inline GraphBase::ListOfSLinks * GraphEditor::DataFlow::GetDatas() const { + return Graph()->GetDatas() ; } ; inline const SALOME_ModuleCatalog::Service * GraphEditor::DataFlow::GetService() { IsValid() ; - return GraphEditor::OutNode::GetService() ; + return Graph()->GetService() ; } ; inline GraphEditor::InNode * GraphEditor::DataFlow::AddNode( @@ -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 ; } ; @@ -188,8 +197,8 @@ inline bool GraphEditor::DataFlow::ReNameNode( const char* OldNodeName , inline const SALOME_ModuleCatalog::Service * GraphEditor::DataFlow::NodeService( const char * aNodeName ) { - if ( GetGraphNode( aNodeName ) ) { - return GetGraphNode( aNodeName )->GetService() ; + if ( Graph()->GetGraphNode( aNodeName ) ) { + return Graph()->GetGraphNode( aNodeName )->GetService() ; } return NULL ; } @@ -240,18 +249,24 @@ 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 ) { - if ( _ReadOnly ) { - return false ; + 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 ! + _EditedAfterExecution = true ; + return GraphEditor::OutNode::AddLink( FromNodeName , + FromServiceParameterName , + ToNodeName , + ToServiceParameterName ) ; +// , *theValue ) ; +// } + } } - CORBA::Any const * theValue = GetNode( FromNodeName )->GetOutPort( FromServiceParameterName )->Value() ; // Keep the type ! - _EditedAfterExecution = true ; - return GraphEditor::OutNode::AddLink( FromNodeName , - FromServiceParameterName , - ToNodeName , - ToServiceParameterName , - *theValue ) ; + return false ; } ; inline bool GraphEditor::DataFlow::GetLink(const char* ToNodeName , @@ -266,8 +281,7 @@ inline bool GraphEditor::DataFlow::GetLink(const char* ToNodeName , inline GraphBase::SLink * GraphEditor::DataFlow::GetLink( GraphBase::ComputingNode * aNode , const char* ToServiceParameterName ) { - return GraphBase::Graph::GetLink( aNode , - aNode->GetChangeInPort( ToServiceParameterName ) ) ; + return Graph()->GetLink( aNode , aNode->GetChangeInPort( ToServiceParameterName ) ) ; } inline bool GraphEditor::DataFlow::AddLinkCoord( @@ -387,80 +401,52 @@ 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 GraphBase::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 ) ; + return Graph()->AddInputData( ToNodeName , ToParameterName , aValue ) ; } ; -inline const CORBA::Any *GraphEditor::DataFlow::GetInData( +//JR 30.03.2005inline const CORBA::Any *GraphEditor::DataFlow::GetInData( +inline const CORBA::Any GraphEditor::DataFlow::GetInData( const char * ToNodeName , const char * ToParameterName ) { return GraphEditor::OutNode::GetInData( ToNodeName , ToParameterName ) ; } -inline const CORBA::Any *GraphEditor::DataFlow::GetOutData( +//JR 30.03.2005inline const CORBA::Any *GraphEditor::DataFlow::GetOutData( +inline const CORBA::Any GraphEditor::DataFlow::GetOutData( const char * FromNodeName , const char * FromParameterName ) { return GraphEditor::OutNode::GetOutData( FromNodeName , FromParameterName ) ; } -inline bool GraphEditor::DataFlow::IsValid() { - return GraphEditor::OutNode::IsValid() ; +//JR Optional parameter kLoopSwitch (default = true) : +//In some cases we do not need to check the validity of loops and switchs +inline bool GraphEditor::DataFlow::IsValid(bool kLoopSwitch ) { + return GraphEditor::OutNode::IsValid( kLoopSwitch ) ; } inline bool GraphEditor::DataFlow::IsExecutable() { return GraphEditor::OutNode::IsExecutable() ; } +inline void GraphEditor::DataFlow::Executing() { + cdebug << "Editor::DataFlow::Executing() : set _Executing = true " << endl ; + _Executing = true ; +} + inline bool GraphEditor::DataFlow::IsExecuting() { - if ( _DataFlowExecutor ) { - if ( _DataFlowExecutor->IsDone() ) { - _Executing = false ; - } - else { - _Executing = true ; - } - } - else { - _Executing = false ; - } return _Executing ; } + +inline void GraphEditor::DataFlow::Editing() { + cdebug << "Editor::DataFlow::Editing() : set _Executing = false " << endl ; + _Executing = false ; +} + inline bool GraphEditor::DataFlow::IsEditing() { return !IsExecuting() ; } @@ -473,41 +459,54 @@ inline bool GraphEditor::DataFlow::EditedAfterExecution() { return _EditedAfterExecution ; } +inline bool GraphEditor::DataFlow::UnValid() { + Editing() ; + EditedAfterExecution( true ) ; + return GraphEditor::OutNode::UnValid() ; +} + inline bool GraphEditor::DataFlow::IsReadOnly() { return _ReadOnly ; } inline long GraphEditor::DataFlow::LevelMax() { - if ( !IsValid() ) { + if ( !IsValid( false ) ) { return 0 ; } - return GraphBase::Graph::LevelMax() ; + return Graph()->LevelMax() ; } inline SUPERV::ListOfStrings * GraphEditor::DataFlow::LevelNodes(long aLevel ) { - if ( !IsValid() ) { + if ( !IsValid( false ) ) { return ((SUPERV::ListOfStrings * ) NULL ) ; } - return GraphBase::Graph::LevelNodes( aLevel ) ; + return Graph()->LevelNodes( aLevel ) ; } inline long GraphEditor::DataFlow::ThreadsMax() { if ( !IsValid() ) { return 0 ; } - return GraphBase::Graph::ThreadsMax() ; + return Graph()->ThreadsMax() ; } -inline long GraphEditor::DataFlow::GraphsNumber() { +inline long GraphEditor::DataFlow::SubGraphsNumber() { if ( !IsValid() ) { return 0 ; } - return GraphBase::Graph::GraphsNumber() ; + return Graph()->SubGraphsNumber() ; +} + +inline long GraphEditor::DataFlow::SubStreamGraphsNumber() { + if ( !IsValid() ) { + return 0 ; + } + return StreamGraph()->SubStreamGraphsNumber() ; } inline void GraphEditor::DataFlow::Executor( GraphExecutor::DataFlow * DataFlowExecutor ) { - _Executing = true ; +// _Executing = true ; _DataFlowExecutor = DataFlowExecutor ; }