Version: 9.15.0
YACS::HMI::GuiExecutor Class Reference

#include <GuiExecutor.hxx>

Inheritance diagram for YACS::HMI::GuiExecutor:
Collaboration diagram for YACS::HMI::GuiExecutor:

Public Member Functions

 GuiExecutor (YACS::ENGINE::Proc *proc)
 
virtual ~GuiExecutor ()
 
void closeContext ()
 
void startResumeDataflow (bool initialize=false)
 
bool checkEndOfDataflow (bool display=true)
 
void killDataflow ()
 
void suspendDataflow ()
 
void resumeDataflow ()
 
void stopDataflow ()
 
void resetDataflow ()
 
void setStepByStepMode ()
 
void setContinueMode ()
 
void setBreakpointMode ()
 
void setStopOnError (bool aMode)
 
void unsetStopOnError ()
 
void saveState (const std::string &xmlFile)
 
void setLoadStateFile (std::string xmlFile)
 
YACS_ORB::executionMode getCurrentExecMode ()
 
int getExecutorState ()
 
void setBreakpointList (std::list< std::string > breakpointList)
 
void addBreakpoint (std::string breakpoint)
 
void removeBreakpoint (std::string breakpoint)
 
void setNextStepList (std::list< std::string > nextStepList)
 
void setInPortValue (YACS::ENGINE::DataPort *port, std::string value)
 
void registerStatusObservers ()
 
bool isRunning () const
 
bool isStopOnError () const
 
void setEngineRef (YACS_ORB::YACS_Gen_ptr ref)
 
YACS::ENGINE::ProcgetProc ()
 
std::string getErrorDetails (YACS::ENGINE::Node *node)
 
std::string getErrorReport (YACS::ENGINE::Node *node)
 
std::string getContainerLog ()
 
std::string getContainerLog (YACS::ENGINE::Node *node)
 
void shutdownProc ()
 
void setShutdownLevel (int level)
 
int getShutdownLevel ()
 
YACS::ExecutorState updateSchema (std::string jobState)
 
virtual bool event (QEvent *e)
 

Protected Member Functions

void setBPList ()
 

Protected Attributes

YACS::ENGINE::Proc_proc
 
QtGuiContext_context
 
YACS_ORB::YACS_Gen_var _engineRef
 
YACS_ORB::ProcExec_var _procRef
 
YACS_ORB::Observer_var _observerRef
 
YACS::ExecutionMode _execMode
 
GuiObserver_i_serv
 
bool _isRunning
 
bool _isSuspended
 
bool _isStopOnError
 
int _shutdownLevel
 
std::list< std::string > _breakpointList
 
std::string _loadStateFile
 

Detailed Description

Definition at line 46 of file GuiExecutor.hxx.

Constructor & Destructor Documentation

◆ GuiExecutor()

GuiExecutor::GuiExecutor ( YACS::ENGINE::Proc proc)

Definition at line 46 of file GuiExecutor.cxx.

47 {
48  DEBTRACE("GuiExecutor::GuiExecutor");
49 
50  _proc = proc;
52 
53  _engineRef = YACS_ORB::YACS_Gen::_nil();
54  _procRef = YACS_ORB::ProcExec::_nil();
55  _observerRef = YACS_ORB::Observer::_nil();
56 
58  _serv = 0;
59 
60  _isRunning = false;
61  _isSuspended = false;
62  _isStopOnError = false;
64 
65  _loadStateFile = "";
66  _breakpointList.clear();
67  if(getSSLMode())
68  {
69  KERNEL::getLauncherSA();
70  }
71 }
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
QtGuiContext * _context
YACS_ORB::ProcExec_var _procRef
YACS_ORB::Observer_var _observerRef
GuiObserver_i * _serv
YACS::ENGINE::Proc * _proc
YACS::ExecutionMode _execMode
std::string _loadStateFile
YACS_ORB::YACS_Gen_var _engineRef
std::list< std::string > _breakpointList
static QtGuiContext * getQtCurrent()
@ CONTINUE
Definition: define.hxx:76

References driver_internal::_proc, YACS::CONTINUE, and DEBTRACE.

◆ ~GuiExecutor()

GuiExecutor::~GuiExecutor ( )
virtual

Definition at line 74 of file GuiExecutor.cxx.

75 {
76  DEBTRACE("GuiExecutor::~GuiExecutor");
77 }

References DEBTRACE.

Member Function Documentation

◆ addBreakpoint()

void GuiExecutor::addBreakpoint ( std::string  breakpoint)

Definition at line 348 of file GuiExecutor.cxx.

349 {
350  DEBTRACE("addBreakpoint " << breakpoint);
351  if (!_context)
352  {
353  DEBTRACE("context closed");
354  return;
355  }
356  _breakpointList.push_back(breakpoint);
357  setBPList();
358  if ((_execMode == YACS::CONTINUE) && ! _breakpointList.empty())
359  {
360  _context->getGMain()->_breakpointsModeAct->setChecked(true);
362  }
363 }
QAction * _breakpointsModeAct
Definition: GenericGui.hxx:111
YACS::HMI::GenericGui * getGMain()

References YACS::CONTINUE, and DEBTRACE.

Referenced by YACS::HMI::SchemaNodeItem::toggleState().

◆ checkEndOfDataflow()

bool GuiExecutor::checkEndOfDataflow ( bool  display = true)

Definition at line 161 of file GuiExecutor.cxx.

162 {
163  DEBTRACE("GuiExecutor::checkEndOfDataFlow");
164  if (_isRunning)
165  {
166  if (CORBA::is_nil(_procRef))
167  {
168  DEBTRACE("Runtime error: connection lost on a running scheme");
169  _isRunning = false;
170  return false;
171  }
172  if (_procRef->isNotFinished())
173  {
174  DEBTRACE("Remote Execution Already running...");
175  return false;
176  }
177  else
178  {
179  _isRunning = false;
180  // --- TODO: cleaning on server ...
181  }
182  }
183  return true;
184 }

References DEBTRACE.

◆ closeContext()

void GuiExecutor::closeContext ( )

Definition at line 79 of file GuiExecutor.cxx.

80 {
81  DEBTRACE("GuiExecutor::closeContext");
82  _context = 0;
83 }

References DEBTRACE.

◆ event()

bool GuiExecutor::event ( QEvent e)
virtual

Definition at line 498 of file GuiExecutor.cxx.

499 {
500  DEBTRACE("GuiExecutor::event");
501  YACSEvent *yev = dynamic_cast<YACSEvent*>(e);
502  if (!yev) return false;
503  int numid = yev->getYACSEvent().first;
504  string event = yev->getYACSEvent().second;
505  DEBTRACE("<" << numid << "," << event << ">");
506  if (!_context)
507  {
508  DEBTRACE("context closed");
509  return true;
510  }
511  if (event == "executor") // --- Executor notification: state
512  {
513  int execState = _procRef->getExecutorState();
514  list<string> nextSteps;
515  if ((execState == YACS::WAITINGTASKS) || (execState == YACS::PAUSED))
516  {
517  YACS_ORB::stringArray_var nstp = _procRef->getTasksToLoad();
518  for (CORBA::ULong i=0; i<nstp->length(); i++)
519  nextSteps.push_back(nstp[i].in());
520  if (execState == YACS::PAUSED)
521  _isSuspended = true;
522  }
523  SubjectProc *sproc = _context->getSubjectProc();
524  sproc->update(YACS::HMI::UPDATEPROGRESS, execState, sproc);
525  }
526  else // --- Node notification
527  {
528  if (! _serv->_engineToGuiMap.count(numid))
529  return true;
530  int state = _procRef->getNodeState(numid);
531  int iGui = _serv->_engineToGuiMap[numid];
532  YASSERT(_context->_mapOfExecSubjectNode.count(iGui));
534  DEBTRACE("node " << snode->getName() << " state=" << state);
535 
536  if (event == "progress") { // --- Update progress bar
537  std::string progress = _procRef->getNodeProgress(numid);
538  snode->setProgress( progress );
539  snode->update(YACS::HMI::PROGRESS, state, snode);
540  }
541  else { // --- Update node ports
542  YACS::ENGINE::Node *node = snode->getNode();
543  list<InputPort*> inports = node->getLocalInputPorts();
544  list<InputPort*>::iterator iti = inports.begin();
545  for ( ; iti != inports.end(); ++iti)
546  {
547  string val = _procRef->getInPortValue(numid, (*iti)->getName().c_str());
548  DEBTRACE("node " << snode->getName() << " inport " << (*iti)->getName()
549  << " value " << val);
550  YASSERT(_context->_mapOfSubjectDataPort.count(*iti));
552  port->setExecValue(val);
553  port->update(YACS::HMI::UPDATEPROGRESS, 0, port);
554  }
555  list<OutputPort*> outports = node->getLocalOutputPorts();
556  list<OutputPort*>::iterator ito = outports.begin();
557  for ( ; ito != outports.end(); ++ito)
558  {
559  string val = _procRef->getOutPortValue(numid, (*ito)->getName().c_str());
560  DEBTRACE("node " << snode->getName() << " outport " << (*ito)->getName()
561  << " value " << val);
562  YASSERT(_context->_mapOfSubjectDataPort.count(*ito));
564  port->setExecValue(val);
565  port->update(YACS::HMI::UPDATEPROGRESS, 0, port);
566  }
567  snode->update(YACS::HMI::UPDATEPROGRESS, state, snode);
568  }
569  }
570 
571  return true;
572 }
#define YASSERT(val)
YASSERT macro is always defined, used like assert, but throw a YACS::Exception instead of abort.
Definition: YacsTrace.hxx:59
Base class for all nodes.
Definition: Node.hxx:70
virtual std::list< InputPort * > getLocalInputPorts() const =0
virtual std::list< OutputPort * > getLocalOutputPorts() const =0
YACS::HMI::SubjectProc * getSubjectProc()
Definition: guiContext.hxx:52
std::map< YACS::ENGINE::DataPort *, YACS::HMI::SubjectDataPort * > _mapOfSubjectDataPort
Definition: guiContext.hxx:71
std::map< int, YACS::HMI::SubjectNode * > _mapOfExecSubjectNode
Definition: guiContext.hxx:77
virtual bool event(QEvent *e)
std::map< int, int > _engineToGuiMap
void setExecValue(std::string value)
virtual std::string getName()
virtual void update(GuiEvent event, int type, Subject *son)
virtual YACS::ENGINE::Node * getNode()
virtual void update(GuiEvent event, int type, Subject *son)
virtual void setProgress(std::string newProgress)
std::pair< int, std::string > getYACSEvent() const
@ PAUSED
Definition: define.hxx:69
@ WAITINGTASKS
Definition: define.hxx:68

References DEBTRACE, YACS::ENGINE::Node::getLocalInputPorts(), YACS::ENGINE::Node::getLocalOutputPorts(), YACS::HMI::SubjectNode::getName(), YACS::HMI::SubjectNode::getNode(), YACS::HMI::YACSEvent::getYACSEvent(), yacsorb.CORBAEngineTest::i, YACS::PAUSED, YACS::HMI::PROGRESS, YACS::HMI::SubjectDataPort::setExecValue(), YACS::HMI::Subject::setProgress(), yacsorb.CORBAEngineTest::state, YACS::HMI::Subject::update(), YACS::HMI::SubjectNode::update(), YACS::HMI::UPDATEPROGRESS, YACS::WAITINGTASKS, and YASSERT.

◆ getContainerLog() [1/2]

std::string GuiExecutor::getContainerLog ( )

Definition at line 443 of file GuiExecutor.cxx.

444 {
445  DEBTRACE("GuiExecutor::getContainerLog");
446  std::string msg="";
447  if (!CORBA::is_nil(_engineRef))
448  {
449  Engines::Container_var cont= _engineRef->GetContainerRef();
450  CORBA::String_var logname = cont->logfilename();
451  DEBTRACE(logname);
452  msg=logname;
453  std::string::size_type pos = msg.find(":");
454  msg=msg.substr(pos+1);
455  }
456  return msg;
457 }

References DEBTRACE.

◆ getContainerLog() [2/2]

std::string GuiExecutor::getContainerLog ( YACS::ENGINE::Node node)

Definition at line 459 of file GuiExecutor.cxx.

460 {
461  DEBTRACE("GuiExecutor::getContainerLog(YACS::ENGINE::Node* node)");
462  std::string msg;
463  if (_serv)
464  {
465  int engineId=_serv->getEngineId(node->getNumId());
466  CORBA::String_var logname = _procRef->getContainerLog(engineId);
467  msg=logname;
468  std::string::size_type pos = msg.find(":");
469  msg=msg.substr(pos+1);
470  }
471  return msg;
472 }
int getNumId()
return node instance identifiant, unique for each node instance
Definition: Node.cxx:643
int getEngineId(int guiId)

References DEBTRACE, and YACS::ENGINE::Node::getNumId().

◆ getCurrentExecMode()

YACS_ORB::executionMode GuiExecutor::getCurrentExecMode ( )

Definition at line 306 of file GuiExecutor.cxx.

307 {
308  DEBTRACE("GuiExecutor::getCurrentExecMode");
309  switch (_execMode)
310  {
311  case YACS::CONTINUE: return YACS_ORB::CONTINUE;
314  default: return YACS_ORB::CONTINUE;
315  }
316 }
@ STEPBYSTEP
Definition: yacsgui.idl:31
@ STOPBEFORENODES
Definition: yacsgui.idl:31
@ CONTINUE
Definition: yacsgui.idl:31
@ STEPBYSTEP
Definition: define.hxx:77
@ STOPBEFORENODES
Definition: define.hxx:78

References YACS_ORB::CONTINUE, YACS::CONTINUE, DEBTRACE, YACS_ORB::STEPBYSTEP, YACS::STEPBYSTEP, YACS_ORB::STOPBEFORENODES, and YACS::STOPBEFORENODES.

◆ getErrorDetails()

std::string GuiExecutor::getErrorDetails ( YACS::ENGINE::Node node)

Definition at line 421 of file GuiExecutor.cxx.

422 {
423  DEBTRACE("GuiExecutor::getErrorDetails");
424  if (_serv)
425  {
426  int engineId=_serv->getEngineId(node->getNumId());
427  return _procRef->getErrorDetails(engineId);
428  }
429  return "---";
430 }

References DEBTRACE, and YACS::ENGINE::Node::getNumId().

◆ getErrorReport()

std::string GuiExecutor::getErrorReport ( YACS::ENGINE::Node node)

Definition at line 432 of file GuiExecutor.cxx.

433 {
434  DEBTRACE("GuiExecutor::getErrorReport");
435  if (_serv)
436  {
437  int engineId=_serv->getEngineId(node->getNumId());
438  return _procRef->getErrorReport(engineId);
439  }
440  return "---";
441 }

References DEBTRACE, and YACS::ENGINE::Node::getNumId().

Referenced by YACS::HMI::EditionProc::update().

◆ getExecutorState()

int GuiExecutor::getExecutorState ( )

Definition at line 318 of file GuiExecutor.cxx.

319 {
320  DEBTRACE("GuiExecutor::getExecutorState");
321  if (_isRunning || !CORBA::is_nil(_procRef))
322  return _procRef->getExecutorState();
323  else if (CORBA::is_nil(_procRef))
325  else
326  return YACS::FINISHED;
327 }
@ NOTYETINITIALIZED
Definition: define.hxx:65
@ FINISHED
Definition: define.hxx:70

References DEBTRACE, YACS::FINISHED, and YACS::NOTYETINITIALIZED.

◆ getProc()

YACS::ENGINE::Proc* YACS::HMI::GuiExecutor::getProc ( )
inline

Definition at line 86 of file GuiExecutor.hxx.

86 { return _proc; };

References _proc.

◆ getShutdownLevel()

int YACS::HMI::GuiExecutor::getShutdownLevel ( )
inline

Definition at line 93 of file GuiExecutor.hxx.

93 {return _shutdownLevel;}

References _shutdownLevel.

Referenced by YACS::HMI::EditionProc::EditionProc().

◆ isRunning()

bool YACS::HMI::GuiExecutor::isRunning ( ) const
inline

Definition at line 82 of file GuiExecutor.hxx.

82 { return _isRunning; };

References _isRunning.

◆ isStopOnError()

bool YACS::HMI::GuiExecutor::isStopOnError ( ) const
inline

Definition at line 83 of file GuiExecutor.hxx.

83 { return _isStopOnError; }

References _isStopOnError.

◆ killDataflow()

void GuiExecutor::killDataflow ( )

Definition at line 186 of file GuiExecutor.cxx.

187 {
188  DEBTRACE("GuiExecutor::killDataflow");
189  if (_isRunning)
190  _procRef->stopExecution();
191 }

References DEBTRACE.

◆ registerStatusObservers()

void GuiExecutor::registerStatusObservers ( )

Definition at line 386 of file GuiExecutor.cxx.

387 {
388  DEBTRACE("GuiExecutor::registerStatusObservers");
389  if (CORBA::is_nil(_procRef))
390  {
391  DEBTRACE("Runtime error (yacsgui): Lost connection on YACS executor");
392  return;
393  }
394  if (CORBA::is_nil(_observerRef))
395  {
396  _serv = new GuiObserver_i(_proc);
397  _serv->SetImpl(this);
398  _observerRef = _serv->_this();
399  }
400  DEBTRACE("---");
402  _serv->setConversion();
403  DEBTRACE("---");
404  std::list<Node*> aNodeSet = _proc->getAllRecursiveConstituents();
405  for ( std::list<Node*>::iterator it = aNodeSet.begin(); it != aNodeSet.end(); it++ )
406  {
407  _procRef->addObserver(_observerRef, _serv->getEngineId((*it)->getNumId()) , "status");
408  _procRef->addObserver(_observerRef, _serv->getEngineId((*it)->getNumId()) , "progress");
409  }
410  _procRef->addObserver(_observerRef, _serv->getEngineId(_proc->getNumId()) , "executor");
411 }
virtual std::list< Node * > getAllRecursiveConstituents()
Idem getAllRecursiveNodes, but this node is NOT included.
void SetImpl(GuiExecutor *impl)
void SetRemoteProc(YACS_ORB::ProcExec_ptr engineProc)

References driver_internal::_proc, and DEBTRACE.

◆ removeBreakpoint()

void GuiExecutor::removeBreakpoint ( std::string  breakpoint)

Definition at line 365 of file GuiExecutor.cxx.

366 {
367  DEBTRACE("removeBreakpoint " << breakpoint);
368  _breakpointList.remove(breakpoint);
369  setBPList();
370 }

References DEBTRACE.

Referenced by YACS::HMI::SchemaNodeItem::toggleState().

◆ resetDataflow()

void GuiExecutor::resetDataflow ( )

Definition at line 217 of file GuiExecutor.cxx.

218 {
219  DEBTRACE("GuiExecutor::resetDataflow");
220  //update _isRunning
222  if (_isRunning)
223  _procRef->stopExecution();
225 
226  if (!_isRunning)
227  {
228  _isRunning = true;
229  _procRef->setExecMode(YACS_ORB::STEPBYSTEP);
230  //full reset: set all nodes in error to READY state and start execution
231  _procRef->RestartFromState("");
232  }
233 }
bool checkEndOfDataflow(bool display=true)

References DEBTRACE, and YACS_ORB::STEPBYSTEP.

◆ resumeDataflow()

void GuiExecutor::resumeDataflow ( )

Definition at line 200 of file GuiExecutor.cxx.

201 {
202  DEBTRACE("GuiExecutor::resumeDataflow");
203  if (_isRunning)
204  {
205  _procRef->setExecMode(getCurrentExecMode());
206  _procRef->resumeCurrentBreakPoint();
207  }
208 }
YACS_ORB::executionMode getCurrentExecMode()

References DEBTRACE.

◆ saveState()

void GuiExecutor::saveState ( const std::string &  xmlFile)

Definition at line 285 of file GuiExecutor.cxx.

286 {
287  DEBTRACE("GuiExecutor::saveState " << xmlFile);
288  bool StartFinish = (getExecutorState() == YACS::NOTYETINITIALIZED ||
290  if ( _isRunning ||
291  !(CORBA::is_nil(_procRef)) && StartFinish ) {
292  if ( !_procRef->saveState(xmlFile.c_str()) ) {
293  string what = "Impossible to open file for writing: " + xmlFile;
294  throw Exception(what);
295  }
296  }
297 }

References DEBTRACE, YACS::FINISHED, and YACS::NOTYETINITIALIZED.

◆ setBPList()

void GuiExecutor::setBPList ( )
protected

Definition at line 574 of file GuiExecutor.cxx.

575 {
576  DEBTRACE("GuiExecutor::setBPList");
577  if (_isRunning)
578  {
579  YACS_ORB::stringArray listOfBreakPoints;
580  listOfBreakPoints.length(_breakpointList.size());
581  int i=0;
582  for (list<string>::iterator it = _breakpointList.begin(); it != _breakpointList.end(); ++it)
583  listOfBreakPoints[i++] = (*it).c_str();
584  _procRef->setListOfBreakPoints(listOfBreakPoints);
585  }
586 }
sequence< string > stringArray
Definition: yacsgui.idl:33

References DEBTRACE, and yacsorb.CORBAEngineTest::i.

◆ setBreakpointList()

void GuiExecutor::setBreakpointList ( std::list< std::string >  breakpointList)

Definition at line 330 of file GuiExecutor.cxx.

331 {
332  DEBTRACE("GuiExecutor::setBreakpointList");
333  if (!_context)
334  {
335  DEBTRACE("context closed");
336  return;
337  }
338  _breakpointList.clear();
339  _breakpointList = breakpointList;
340  setBPList();
341  if ((_execMode == YACS::CONTINUE) && ! _breakpointList.empty())
342  {
343  _context->getGMain()->_breakpointsModeAct->setChecked(true);
345  }
346 }

References YACS::CONTINUE, and DEBTRACE.

◆ setBreakpointMode()

void GuiExecutor::setBreakpointMode ( )

Definition at line 252 of file GuiExecutor.cxx.

253 {
254  DEBTRACE("GuiExecutor::setBreakpointMode");
256  if (_isRunning)
257  _procRef->setExecMode(YACS_ORB::STOPBEFORENODES);
258 }

References DEBTRACE, YACS_ORB::STOPBEFORENODES, and YACS::STOPBEFORENODES.

◆ setContinueMode()

void GuiExecutor::setContinueMode ( )

Definition at line 244 of file GuiExecutor.cxx.

245 {
246  DEBTRACE("GuiExecutor::setContinueMode");
248  if (_isRunning)
249  _procRef->setExecMode(YACS_ORB::CONTINUE);
250 }

References YACS_ORB::CONTINUE, YACS::CONTINUE, and DEBTRACE.

◆ setEngineRef()

void GuiExecutor::setEngineRef ( YACS_ORB::YACS_Gen_ptr  ref)

Definition at line 415 of file GuiExecutor.cxx.

416 {
417  DEBTRACE("GuiExecutor::setEngineRef");
418  _engineRef = ref;
419 }
def ref(target, callback=None)
Definition: CONNECTOR.py:120

References DEBTRACE, and gui.CONNECTOR::ref().

◆ setInPortValue()

void GuiExecutor::setInPortValue ( YACS::ENGINE::DataPort port,
std::string  value 
)

Definition at line 482 of file GuiExecutor.cxx.

483 {
484  DEBTRACE("GuiExecutor::setInPortValue");
485 
486  YACS::ENGINE::Node* node = port->getNode();
487  YACS::ENGINE::ComposedNode* rootNode = node->getRootNode();
488 
489  std::string nodeName;
490  if(rootNode == node)
491  nodeName = node->getName();
492  else
493  nodeName = rootNode->getChildName(node);
494 
495  std::string msg = _procRef->setInPortValue(nodeName.c_str(), port->getName().c_str(), value.c_str());
496 }
Base class for all composed nodes.
std::string getChildName(const Node *node) const
std::string getName() const
Definition: DataPort.hxx:55
virtual ComposedNode * getRootNode() const
Definition: Node.cxx:431
const std::string & getName() const
Definition: Node.hxx:125
Node * getNode() const
Definition: Port.hxx:46

References DEBTRACE, YACS::ENGINE::ComposedNode::getChildName(), YACS::ENGINE::DataPort::getName(), YACS::ENGINE::Node::getName(), YACS::ENGINE::Port::getNode(), and YACS::ENGINE::Node::getRootNode().

Referenced by YACS::HMI::EditionElementaryNode::onCommitData(), and YACS::HMI::TreeView::onCommitData().

◆ setLoadStateFile()

void GuiExecutor::setLoadStateFile ( std::string  xmlFile)

Definition at line 299 of file GuiExecutor.cxx.

300 {
301  DEBTRACE("GuiExecutor::setLoadStateFile " << xmlFile);
302  _loadStateFile = xmlFile;
303 }

References DEBTRACE.

Referenced by YACS::HMI::GenericGui::onRunLoadedSchema().

◆ setNextStepList()

void GuiExecutor::setNextStepList ( std::list< std::string >  nextStepList)

Definition at line 372 of file GuiExecutor.cxx.

373 {
374  DEBTRACE("GuiExecutor::setNextStepList");
375  if (_isRunning)
376  {
377  YACS_ORB::stringArray listOfNextStep;
378  listOfNextStep.length(nextStepList.size());
379  int i=0;
380  for (list<string>::iterator it = nextStepList.begin(); it != nextStepList.end(); ++it)
381  listOfNextStep[i++] = (*it).c_str();
382  _procRef->setStepsToExecute(listOfNextStep);
383  }
384 }

References DEBTRACE, and yacsorb.CORBAEngineTest::i.

◆ setShutdownLevel()

void YACS::HMI::GuiExecutor::setShutdownLevel ( int  level)
inline

Definition at line 92 of file GuiExecutor.hxx.

92 {_shutdownLevel=level;}

References _shutdownLevel.

Referenced by YACS::HMI::EditionProc::onLevelChange().

◆ setStepByStepMode()

void GuiExecutor::setStepByStepMode ( )

Definition at line 236 of file GuiExecutor.cxx.

237 {
238  DEBTRACE("GuiExecutor::setStepByStepMode");
240  if (_isRunning)
241  _procRef->setExecMode(YACS_ORB::STEPBYSTEP);
242 }

References DEBTRACE, YACS_ORB::STEPBYSTEP, and YACS::STEPBYSTEP.

◆ setStopOnError()

void GuiExecutor::setStopOnError ( bool  aMode)

Definition at line 260 of file GuiExecutor.cxx.

261 {
262  DEBTRACE("GuiExecutor::setStopOnError " << aMode);
263  if (_isRunning)
264  {
265 #ifdef WIN32
266  _procRef->setStopOnError(aMode, (getenv("TEMP") + string("\\dumpStateOnError_") + getenv("USER") + string(".xml")).c_str());
267 #else
268  _procRef->setStopOnError(aMode, (string("/tmp/dumpStateOnError_") + getenv("USER") + string(".xml")).c_str());
269 #endif
270  _isStopOnError = true;
271  }
272 }

References DEBTRACE.

Referenced by YACS::HMI::GenericGui::onRunLoadedSchema().

◆ shutdownProc()

void GuiExecutor::shutdownProc ( )

Definition at line 474 of file GuiExecutor.cxx.

475 {
476  DEBTRACE("GuiExecutor::shutdownProc " << _shutdownLevel << "," << _isRunning);
478  if (!_isRunning)
479  _procRef->shutdownProc(_shutdownLevel);
480 }

References DEBTRACE.

◆ startResumeDataflow()

void GuiExecutor::startResumeDataflow ( bool  initialize = false)

Definition at line 85 of file GuiExecutor.cxx.

86 {
87  DEBTRACE("GuiExecutor::runDataflow " << initialize);
88  if (!_context)
89  {
90  DEBTRACE("context closed");
91  return;
92  }
93  if (CORBA::is_nil(_engineRef))
94  {
95  DEBTRACE("Create YACS ORB engine!");
97  CORBA::ORB_ptr orb = runTime->getOrb();
98  SALOME_NamingService_Wrapper namingService(orb);
99  //int iii(0); std::cin >> iii;
100  {
101  SALOME_LifeCycleCORBA lcc(&namingService);
102  ostringstream containerName;
103  containerName << "localhost/YACSContainer";
104  Engines::EngineComponent_var comp = lcc.FindOrLoad_Component(containerName.str().c_str(), "YACS" );
105  _engineRef =YACS_ORB::YACS_Gen::_narrow(comp);
106  YASSERT(!CORBA::is_nil(_engineRef));
107  }
108  }
109 
110  checkEndOfDataflow(); // --- to allow change of the _isRunning state
111 
112  if (_isRunning)
113  {
114  if (_isSuspended)
115  {
116  _procRef->setExecMode(getCurrentExecMode());
117  _procRef->resumeCurrentBreakPoint();
118  _isSuspended = false;
119  }
120  return;
121  }
122 
123  _isRunning = true;
124 
125  if (CORBA::is_nil(_procRef))
126  {
127  DEBTRACE("init _procRef");
128  _procRef = _engineRef->LoadProc(_context->getFileName().toUtf8());
130  DEBTRACE("_procRef init");
131  }
132 
133  YASSERT(!CORBA::is_nil(_procRef));
134 
135  if (initialize)
136  _procRef->setExecMode(YACS_ORB::STEPBYSTEP);
137  else
138  _procRef->setExecMode(getCurrentExecMode());
139  setBPList();
140 
141  if (_loadStateFile.empty())
142  {
143  DEBTRACE("Run from scratch!");
144  _procRef->Run();
145  }
146  else
147  {
148  DEBTRACE("Run from STATE!");
149  try
150  {
151  _procRef->RunFromState(_loadStateFile.c_str());
152  }
153  catch (...)
154  {
155  DEBTRACE("Runtime error: execution from the loaded state failed")
156  return;
157  }
158  }
159 }
CORBA::ORB_ptr getOrb() const
YACSRUNTIMESALOME_EXPORT RuntimeSALOME * getSALOMERuntime()
CORBA::ORB_ptr orb
Definition: yacsSrv.cxx:39

References yacsorb.CORBAEngineTest::comp, DEBTRACE, YACS::ENGINE::RuntimeSALOME::getOrb(), YACS::ENGINE::getSALOMERuntime(), orb, YACS_ORB::STEPBYSTEP, and YASSERT.

Referenced by YACS::HMI::GenericGui::onRunLoadedSchema().

◆ stopDataflow()

void GuiExecutor::stopDataflow ( )

Definition at line 210 of file GuiExecutor.cxx.

211 {
212  DEBTRACE("GuiExecutor::stopDataflow");
213  if (_isRunning)
214  _procRef->stopExecution();
215 }

References DEBTRACE.

◆ suspendDataflow()

void GuiExecutor::suspendDataflow ( )

Definition at line 193 of file GuiExecutor.cxx.

194 {
195  DEBTRACE("GuiExecutor::suspendDataflow");
196  if (_isRunning)
197  _procRef->setExecMode(YACS_ORB::STEPBYSTEP);
198 }

References DEBTRACE, and YACS_ORB::STEPBYSTEP.

◆ unsetStopOnError()

void GuiExecutor::unsetStopOnError ( )

Definition at line 274 of file GuiExecutor.cxx.

275 {
276  DEBTRACE("GuiExecutor::unsetStopOnError");
277  if (_isRunning)
278  {
279  _procRef->unsetStopOnError();
280  _isStopOnError = false;
281  }
282 }

References DEBTRACE.

◆ updateSchema()

YACS::ExecutorState GuiExecutor::updateSchema ( std::string  jobState)

Definition at line 588 of file GuiExecutor.cxx.

589 {
591 
592  int numid;
593  int state;
594  std::list<Node*> aNodeSet = _proc->getAllRecursiveConstituents();
595  for ( std::list<Node*>::iterator it = aNodeSet.begin(); it != aNodeSet.end(); it++ ){
596 
597  numid = (*it)->getNumId();
598 
599  state = _proc->getNodeState(numid);
600  SubjectNode *snode = _context->_mapOfExecSubjectNode[numid];
601 
602  YACS::ENGINE::Node *node = snode->getNode();
603  list<InputPort*> inports = node->getLocalInputPorts();
604  list<InputPort*>::iterator iti = inports.begin();
605  for ( ; iti != inports.end(); ++iti)
606  {
607  string val = _proc->getInPortValue(numid, (*iti)->getName().c_str());
608  YASSERT(_context->_mapOfSubjectDataPort.count(*iti));
610  port->setExecValue(val);
611  port->update(YACS::HMI::UPDATEPROGRESS, 0, port);
612  }
613  list<OutputPort*> outports = node->getLocalOutputPorts();
614  list<OutputPort*>::iterator ito = outports.begin();
615  for ( ; ito != outports.end(); ++ito)
616  {
617  string val = _proc->getOutPortValue(numid, (*ito)->getName().c_str());
618  YASSERT(_context->_mapOfSubjectDataPort.count(*ito));
620  port->setExecValue(val);
621  port->update(YACS::HMI::UPDATEPROGRESS, 0, port);
622  }
623  snode->update(YACS::HMI::UPDATEPROGRESS, state, snode);
624  }
626  switch(state){
627  case YACS::LOADED:
628  case YACS::ACTIVATED:
629  if(jobState!="RUNNING")
630  execState = YACS::FINISHED;
631  else
632  execState = YACS::RUNNING;
633  break;
634  case YACS::FAILED:
635  case YACS::DONE:
636  execState = YACS::FINISHED;
637  break;
638  case YACS::SUSPENDED:
639  execState = YACS::PAUSED;
640  break;
641  }
642  SubjectProc *sproc = _context->getSubjectProc();
643  sproc->update(YACS::HMI::UPDATEPROGRESS, execState, sproc);
644 
645  return execState;
646 }
ComposedNode * getRootNode() const
virtual YACS::StatesForNode getEffectiveState() const
Return the node state in the context of its father.
Definition: Node.cxx:538
std::string getInPortValue(int nodeNumId, std::string portName)
Definition: Proc.cxx:265
std::string getOutPortValue(int nodeNumId, std::string portName)
Definition: Proc.cxx:341
YACS::StatesForNode getNodeState(int numId)
Definition: Proc.cxx:210
ExecutorState
Definition: define.hxx:64
@ RUNNING
Definition: define.hxx:67
@ FAILED
Definition: define.hxx:51
@ LOADED
Definition: define.hxx:39
@ ACTIVATED
Definition: define.hxx:41
@ DONE
Definition: define.hxx:43
@ SUSPENDED
Definition: define.hxx:44

References driver_internal::_proc, YACS::ACTIVATED, YACS::DONE, YACS::FAILED, YACS::FINISHED, YACS::ENGINE::Node::getLocalInputPorts(), YACS::ENGINE::Node::getLocalOutputPorts(), YACS::HMI::SubjectNode::getNode(), YACS::LOADED, YACS::NOTYETINITIALIZED, YACS::PAUSED, YACS::RUNNING, YACS::HMI::SubjectDataPort::setExecValue(), yacsorb.CORBAEngineTest::state, YACS::SUSPENDED, YACS::HMI::Subject::update(), YACS::HMI::SubjectNode::update(), YACS::HMI::UPDATEPROGRESS, and YASSERT.

Referenced by YACS::HMI::BatchJobsListDialog::get_dump_file().

Member Data Documentation

◆ _breakpointList

std::list<std::string> YACS::HMI::GuiExecutor::_breakpointList
protected

Definition at line 117 of file GuiExecutor.hxx.

◆ _context

QtGuiContext* YACS::HMI::GuiExecutor::_context
protected

Definition at line 103 of file GuiExecutor.hxx.

◆ _engineRef

YACS_ORB::YACS_Gen_var YACS::HMI::GuiExecutor::_engineRef
protected

Definition at line 105 of file GuiExecutor.hxx.

◆ _execMode

YACS::ExecutionMode YACS::HMI::GuiExecutor::_execMode
protected

Definition at line 109 of file GuiExecutor.hxx.

◆ _isRunning

bool YACS::HMI::GuiExecutor::_isRunning
protected

Definition at line 112 of file GuiExecutor.hxx.

Referenced by isRunning().

◆ _isStopOnError

bool YACS::HMI::GuiExecutor::_isStopOnError
protected

Definition at line 114 of file GuiExecutor.hxx.

Referenced by isStopOnError().

◆ _isSuspended

bool YACS::HMI::GuiExecutor::_isSuspended
protected

Definition at line 113 of file GuiExecutor.hxx.

◆ _loadStateFile

std::string YACS::HMI::GuiExecutor::_loadStateFile
protected

Definition at line 118 of file GuiExecutor.hxx.

◆ _observerRef

YACS_ORB::Observer_var YACS::HMI::GuiExecutor::_observerRef
protected

Definition at line 107 of file GuiExecutor.hxx.

◆ _proc

YACS::ENGINE::Proc* YACS::HMI::GuiExecutor::_proc
protected

Definition at line 102 of file GuiExecutor.hxx.

Referenced by getProc().

◆ _procRef

YACS_ORB::ProcExec_var YACS::HMI::GuiExecutor::_procRef
protected

Definition at line 106 of file GuiExecutor.hxx.

◆ _serv

GuiObserver_i* YACS::HMI::GuiExecutor::_serv
protected

Definition at line 110 of file GuiExecutor.hxx.

◆ _shutdownLevel

int YACS::HMI::GuiExecutor::_shutdownLevel
protected

Definition at line 115 of file GuiExecutor.hxx.

Referenced by getShutdownLevel(), and setShutdownLevel().


The documentation for this class was generated from the following files: