valid" shoud be more explicit.
/*! 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();
} ;
GraphBase::Base::Base() {
_prof_debug = NULL ;
_fdebug = NULL ;
+ _message = "";
}
void GraphBase::Base::SetDebug( CORBA::ORB_ptr ORB ,
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 ) {
int * _prof_debug ;
ofstream * _fdebug ;
+ string _message;
Base() ;
virtual ~Base() {} ;
char * ObjectToString( CORBA::Object_ptr obj ) const ;
CORBA::Object_ptr StringToObject(char * obj ) const ;
+ void SetMessage( string theMessage);
+ string GetMessage();
+
} ;
# ifdef _DEBUG_
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 :
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 ;
}
}
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 :
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 ;
}
}
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++ ;
}
}
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 {
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 {
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 {
// 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 ;
}
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
}
// 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 {
// 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 {
// 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 );
}
}
}
// 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 {
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 ;
}
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;
}
// 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...
}
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"));
}
}
+/**
+ * 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());
+ }
+}
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 );
*/
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;
}