Version: 8.3.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 ( YACS::ENGINE::Proc proc)

Definition at line 44 of file GuiExecutor.cxx.

References YACS::CONTINUE, and DEBTRACE.

45 {
46  DEBTRACE("GuiExecutor::GuiExecutor");
47 
48  _proc = proc;
50 
51  _engineRef = YACS_ORB::YACS_Gen::_nil();
52  _procRef = YACS_ORB::ProcExec::_nil();
53  _observerRef = YACS_ORB::Observer::_nil();
54 
56  _serv = 0;
57 
58  _isRunning = false;
59  _isSuspended = false;
60  _isStopOnError = false;
62 
63  _loadStateFile = "";
64  _breakpointList.clear();
65 }
GuiExecutor::~GuiExecutor ( )
virtual

Definition at line 68 of file GuiExecutor.cxx.

References DEBTRACE.

69 {
70  DEBTRACE("GuiExecutor::~GuiExecutor");
71 }

Member Function Documentation

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

Definition at line 339 of file GuiExecutor.cxx.

References YACS::CONTINUE, and DEBTRACE.

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

340 {
341  DEBTRACE("addBreakpoint " << breakpoint);
342  if (!_context)
343  {
344  DEBTRACE("context closed");
345  return;
346  }
347  _breakpointList.push_back(breakpoint);
348  setBPList();
349  if ((_execMode == YACS::CONTINUE) && ! _breakpointList.empty())
350  {
351  _context->getGMain()->_breakpointsModeAct->setChecked(true);
353  }
354 }
bool GuiExecutor::checkEndOfDataflow ( bool  display = true)

Definition at line 152 of file GuiExecutor.cxx.

References DEBTRACE.

153 {
154  DEBTRACE("GuiExecutor::checkEndOfDataFlow");
155  if (_isRunning)
156  {
157  if (CORBA::is_nil(_procRef))
158  {
159  DEBTRACE("Runtime error: connection lost on a running scheme");
160  _isRunning = false;
161  return false;
162  }
163  if (_procRef->isNotFinished())
164  {
165  DEBTRACE("Remote Execution Already running...");
166  return false;
167  }
168  else
169  {
170  _isRunning = false;
171  // --- TODO: cleaning on server ...
172  }
173  }
174  return true;
175 }
void GuiExecutor::closeContext ( )

Definition at line 73 of file GuiExecutor.cxx.

References DEBTRACE.

74 {
75  DEBTRACE("GuiExecutor::closeContext");
76  _context = 0;
77 }
bool GuiExecutor::event ( QEvent e)
virtual

Definition at line 489 of file GuiExecutor.cxx.

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

490 {
491  DEBTRACE("GuiExecutor::event");
492  YACSEvent *yev = dynamic_cast<YACSEvent*>(e);
493  if (!yev) return false;
494  int numid = yev->getYACSEvent().first;
495  string event = yev->getYACSEvent().second;
496  DEBTRACE("<" << numid << "," << event << ">");
497  if (!_context)
498  {
499  DEBTRACE("context closed");
500  return true;
501  }
502  if (event == "executor") // --- Executor notification: state
503  {
504  int execState = _procRef->getExecutorState();
505  list<string> nextSteps;
506  if ((execState == YACS::WAITINGTASKS) || (execState == YACS::PAUSED))
507  {
508  YACS_ORB::stringArray_var nstp = _procRef->getTasksToLoad();
509  for (CORBA::ULong i=0; i<nstp->length(); i++)
510  nextSteps.push_back(nstp[i].in());
511  if (execState == YACS::PAUSED)
512  _isSuspended = true;
513  }
514  SubjectProc *sproc = _context->getSubjectProc();
515  sproc->update(YACS::HMI::UPDATEPROGRESS, execState, sproc);
516  }
517  else // --- Node notification
518  {
519  if (! _serv->_engineToGuiMap.count(numid))
520  return true;
521  int state = _procRef->getNodeState(numid);
522  int iGui = _serv->_engineToGuiMap[numid];
523  YASSERT(_context->_mapOfExecSubjectNode.count(iGui));
525  DEBTRACE("node " << snode->getName() << " state=" << state);
526 
527  if (event == "progress") { // --- Update progress bar
528  std::string progress = _procRef->getNodeProgress(numid);
529  snode->setProgress( progress );
530  snode->update(YACS::HMI::PROGRESS, state, snode);
531  }
532  else { // --- Update node ports
533  YACS::ENGINE::Node *node = snode->getNode();
534  list<InputPort*> inports = node->getLocalInputPorts();
535  list<InputPort*>::iterator iti = inports.begin();
536  for ( ; iti != inports.end(); ++iti)
537  {
538  string val = _procRef->getInPortValue(numid, (*iti)->getName().c_str());
539  DEBTRACE("node " << snode->getName() << " inport " << (*iti)->getName()
540  << " value " << val);
541  YASSERT(_context->_mapOfSubjectDataPort.count(*iti));
543  port->setExecValue(val);
544  port->update(YACS::HMI::UPDATEPROGRESS, 0, port);
545  }
546  list<OutputPort*> outports = node->getLocalOutputPorts();
547  list<OutputPort*>::iterator ito = outports.begin();
548  for ( ; ito != outports.end(); ++ito)
549  {
550  string val = _procRef->getOutPortValue(numid, (*ito)->getName().c_str());
551  DEBTRACE("node " << snode->getName() << " outport " << (*ito)->getName()
552  << " value " << val);
553  YASSERT(_context->_mapOfSubjectDataPort.count(*ito));
555  port->setExecValue(val);
556  port->update(YACS::HMI::UPDATEPROGRESS, 0, port);
557  }
558  snode->update(YACS::HMI::UPDATEPROGRESS, state, snode);
559  }
560  }
561 
562  return true;
563 }
std::string GuiExecutor::getContainerLog ( )

Definition at line 434 of file GuiExecutor.cxx.

References DEBTRACE.

435 {
436  DEBTRACE("GuiExecutor::getContainerLog");
437  std::string msg="";
438  if (!CORBA::is_nil(_engineRef))
439  {
440  Engines::Container_var cont= _engineRef->GetContainerRef();
441  CORBA::String_var logname = cont->logfilename();
442  DEBTRACE(logname);
443  msg=logname;
444  std::string::size_type pos = msg.find(":");
445  msg=msg.substr(pos+1);
446  }
447  return msg;
448 }
std::string GuiExecutor::getContainerLog ( YACS::ENGINE::Node node)

Definition at line 450 of file GuiExecutor.cxx.

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

451 {
452  DEBTRACE("GuiExecutor::getContainerLog(YACS::ENGINE::Node* node)");
453  std::string msg;
454  if (_serv)
455  {
456  int engineId=_serv->getEngineId(node->getNumId());
457  CORBA::String_var logname = _procRef->getContainerLog(engineId);
458  msg=logname;
459  std::string::size_type pos = msg.find(":");
460  msg=msg.substr(pos+1);
461  }
462  return msg;
463 }
YACS_ORB::executionMode GuiExecutor::getCurrentExecMode ( )

Definition at line 297 of file GuiExecutor.cxx.

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

298 {
299  DEBTRACE("GuiExecutor::getCurrentExecMode");
300  switch (_execMode)
301  {
302  case YACS::CONTINUE: return YACS_ORB::CONTINUE;
305  default: return YACS_ORB::CONTINUE;
306  }
307 }
std::string GuiExecutor::getErrorDetails ( YACS::ENGINE::Node node)

Definition at line 412 of file GuiExecutor.cxx.

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

413 {
414  DEBTRACE("GuiExecutor::getErrorDetails");
415  if (_serv)
416  {
417  int engineId=_serv->getEngineId(node->getNumId());
418  return _procRef->getErrorDetails(engineId);
419  }
420  return "---";
421 }
std::string GuiExecutor::getErrorReport ( YACS::ENGINE::Node node)

Definition at line 423 of file GuiExecutor.cxx.

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

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

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

Definition at line 309 of file GuiExecutor.cxx.

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

310 {
311  DEBTRACE("GuiExecutor::getExecutorState");
312  if (_isRunning || !CORBA::is_nil(_procRef))
313  return _procRef->getExecutorState();
314  else if (CORBA::is_nil(_procRef))
316  else
317  return YACS::FINISHED;
318 }
YACS::ENGINE::Proc* YACS::HMI::GuiExecutor::getProc ( )
inline

Definition at line 86 of file GuiExecutor.hxx.

References _proc.

86 { return _proc; };
int YACS::HMI::GuiExecutor::getShutdownLevel ( )
inline

Definition at line 93 of file GuiExecutor.hxx.

References _shutdownLevel.

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

93 {return _shutdownLevel;}
bool YACS::HMI::GuiExecutor::isRunning ( ) const
inline

Definition at line 82 of file GuiExecutor.hxx.

References _isRunning.

82 { return _isRunning; };
bool YACS::HMI::GuiExecutor::isStopOnError ( ) const
inline

Definition at line 83 of file GuiExecutor.hxx.

References _isStopOnError.

83 { return _isStopOnError; }
void GuiExecutor::killDataflow ( )

Definition at line 177 of file GuiExecutor.cxx.

References DEBTRACE.

178 {
179  DEBTRACE("GuiExecutor::killDataflow");
180  if (_isRunning)
181  _procRef->stopExecution();
182 }
void GuiExecutor::registerStatusObservers ( )

Definition at line 377 of file GuiExecutor.cxx.

References DEBTRACE.

378 {
379  DEBTRACE("GuiExecutor::registerStatusObservers");
380  if (CORBA::is_nil(_procRef))
381  {
382  DEBTRACE("Runtime error (yacsgui): Lost connection on YACS executor");
383  return;
384  }
385  if (CORBA::is_nil(_observerRef))
386  {
387  _serv = new GuiObserver_i(_proc);
388  _serv->SetImpl(this);
389  _observerRef = _serv->_this();
390  }
391  DEBTRACE("---");
393  _serv->setConversion();
394  DEBTRACE("---");
395  std::list<Node*> aNodeSet = _proc->getAllRecursiveConstituents();
396  for ( std::list<Node*>::iterator it = aNodeSet.begin(); it != aNodeSet.end(); it++ )
397  {
398  _procRef->addObserver(_observerRef, _serv->getEngineId((*it)->getNumId()) , "status");
399  _procRef->addObserver(_observerRef, _serv->getEngineId((*it)->getNumId()) , "progress");
400  }
401  _procRef->addObserver(_observerRef, _serv->getEngineId(_proc->getNumId()) , "executor");
402 }
void GuiExecutor::removeBreakpoint ( std::string  breakpoint)

Definition at line 356 of file GuiExecutor.cxx.

References DEBTRACE.

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

357 {
358  DEBTRACE("removeBreakpoint " << breakpoint);
359  _breakpointList.remove(breakpoint);
360  setBPList();
361 }
void GuiExecutor::resetDataflow ( )

Definition at line 208 of file GuiExecutor.cxx.

References DEBTRACE, and YACS_ORB::STEPBYSTEP.

209 {
210  DEBTRACE("GuiExecutor::resetDataflow");
211  //update _isRunning
213  if (_isRunning)
214  _procRef->stopExecution();
216 
217  if (!_isRunning)
218  {
219  _isRunning = true;
220  _procRef->setExecMode(YACS_ORB::STEPBYSTEP);
221  //full reset: set all nodes in error to READY state and start execution
222  _procRef->RestartFromState("");
223  }
224 }
void GuiExecutor::resumeDataflow ( )

Definition at line 191 of file GuiExecutor.cxx.

References DEBTRACE.

192 {
193  DEBTRACE("GuiExecutor::resumeDataflow");
194  if (_isRunning)
195  {
196  _procRef->setExecMode(getCurrentExecMode());
197  _procRef->resumeCurrentBreakPoint();
198  }
199 }
void GuiExecutor::saveState ( const std::string &  xmlFile)

Definition at line 276 of file GuiExecutor.cxx.

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

277 {
278  DEBTRACE("GuiExecutor::saveState " << xmlFile);
279  bool StartFinish = (getExecutorState() == YACS::NOTYETINITIALIZED ||
281  if ( _isRunning ||
282  !(CORBA::is_nil(_procRef)) && StartFinish ) {
283  if ( !_procRef->saveState(xmlFile.c_str()) ) {
284  string what = "Impossible to open file for writing: " + xmlFile;
285  throw Exception(what);
286  }
287  }
288 }
void GuiExecutor::setBPList ( )
protected

Definition at line 565 of file GuiExecutor.cxx.

References DEBTRACE, and CORBAEngineTest::i.

566 {
567  DEBTRACE("GuiExecutor::setBPList");
568  if (_isRunning)
569  {
570  YACS_ORB::stringArray listOfBreakPoints;
571  listOfBreakPoints.length(_breakpointList.size());
572  int i=0;
573  for (list<string>::iterator it = _breakpointList.begin(); it != _breakpointList.end(); ++it)
574  listOfBreakPoints[i++] = (*it).c_str();
575  _procRef->setListOfBreakPoints(listOfBreakPoints);
576  }
577 }
void GuiExecutor::setBreakpointList ( std::list< std::string >  breakpointList)

Definition at line 321 of file GuiExecutor.cxx.

References YACS::CONTINUE, and DEBTRACE.

322 {
323  DEBTRACE("GuiExecutor::setBreakpointList");
324  if (!_context)
325  {
326  DEBTRACE("context closed");
327  return;
328  }
329  _breakpointList.clear();
330  _breakpointList = breakpointList;
331  setBPList();
332  if ((_execMode == YACS::CONTINUE) && ! _breakpointList.empty())
333  {
334  _context->getGMain()->_breakpointsModeAct->setChecked(true);
336  }
337 }
void GuiExecutor::setBreakpointMode ( )

Definition at line 243 of file GuiExecutor.cxx.

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

244 {
245  DEBTRACE("GuiExecutor::setBreakpointMode");
247  if (_isRunning)
248  _procRef->setExecMode(YACS_ORB::STOPBEFORENODES);
249 }
void GuiExecutor::setContinueMode ( )

Definition at line 235 of file GuiExecutor.cxx.

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

236 {
237  DEBTRACE("GuiExecutor::setContinueMode");
239  if (_isRunning)
240  _procRef->setExecMode(YACS_ORB::CONTINUE);
241 }
void GuiExecutor::setEngineRef ( YACS_ORB::YACS_Gen_ptr  ref)

Definition at line 406 of file GuiExecutor.cxx.

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

407 {
408  DEBTRACE("GuiExecutor::setEngineRef");
409  _engineRef = ref;
410 }
void GuiExecutor::setInPortValue ( YACS::ENGINE::DataPort port,
std::string  value 
)

Definition at line 473 of file GuiExecutor.cxx.

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().

474 {
475  DEBTRACE("GuiExecutor::setInPortValue");
476 
477  YACS::ENGINE::Node* node = port->getNode();
478  YACS::ENGINE::ComposedNode* rootNode = node->getRootNode();
479 
480  std::string nodeName;
481  if(rootNode == node)
482  nodeName = node->getName();
483  else
484  nodeName = rootNode->getChildName(node);
485 
486  std::string msg = _procRef->setInPortValue(nodeName.c_str(), port->getName().c_str(), value.c_str());
487 }
void GuiExecutor::setLoadStateFile ( std::string  xmlFile)

Definition at line 290 of file GuiExecutor.cxx.

References DEBTRACE.

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

291 {
292  DEBTRACE("GuiExecutor::setLoadStateFile " << xmlFile);
293  _loadStateFile = xmlFile;
294 }
void GuiExecutor::setNextStepList ( std::list< std::string >  nextStepList)

Definition at line 363 of file GuiExecutor.cxx.

References DEBTRACE, and CORBAEngineTest::i.

364 {
365  DEBTRACE("GuiExecutor::setNextStepList");
366  if (_isRunning)
367  {
368  YACS_ORB::stringArray listOfNextStep;
369  listOfNextStep.length(nextStepList.size());
370  int i=0;
371  for (list<string>::iterator it = nextStepList.begin(); it != nextStepList.end(); ++it)
372  listOfNextStep[i++] = (*it).c_str();
373  _procRef->setStepsToExecute(listOfNextStep);
374  }
375 }
void YACS::HMI::GuiExecutor::setShutdownLevel ( int  level)
inline

Definition at line 92 of file GuiExecutor.hxx.

References _shutdownLevel.

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

92 {_shutdownLevel=level;}
void GuiExecutor::setStepByStepMode ( )

Definition at line 227 of file GuiExecutor.cxx.

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

228 {
229  DEBTRACE("GuiExecutor::setStepByStepMode");
231  if (_isRunning)
232  _procRef->setExecMode(YACS_ORB::STEPBYSTEP);
233 }
void GuiExecutor::setStopOnError ( bool  aMode)

Definition at line 251 of file GuiExecutor.cxx.

References DEBTRACE.

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

252 {
253  DEBTRACE("GuiExecutor::setStopOnError " << aMode);
254  if (_isRunning)
255  {
256 #ifdef WIN32
257  _procRef->setStopOnError(aMode, (getenv("TEMP") + string("\\dumpStateOnError_") + getenv("USER") + string(".xml")).c_str());
258 #else
259  _procRef->setStopOnError(aMode, (string("/tmp/dumpStateOnError_") + getenv("USER") + string(".xml")).c_str());
260 #endif
261  _isStopOnError = true;
262  }
263 }
void GuiExecutor::shutdownProc ( )

Definition at line 465 of file GuiExecutor.cxx.

References DEBTRACE.

466 {
467  DEBTRACE("GuiExecutor::shutdownProc " << _shutdownLevel << "," << _isRunning);
469  if (!_isRunning)
470  _procRef->shutdownProc(_shutdownLevel);
471 }
void GuiExecutor::startResumeDataflow ( bool  initialize = false)

Definition at line 79 of file GuiExecutor.cxx.

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

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

80 {
81  DEBTRACE("GuiExecutor::runDataflow " << initialize);
82  if (!_context)
83  {
84  DEBTRACE("context closed");
85  return;
86  }
87  if (CORBA::is_nil(_engineRef))
88  {
89  DEBTRACE("Create YACS ORB engine!");
91  CORBA::ORB_ptr orb = runTime->getOrb();
92  SALOME_NamingService namingService(orb);
93  SALOME_LifeCycleCORBA lcc(&namingService);
94  ostringstream containerName;
95  containerName << "localhost/YACSContainer" << QtGuiContext::getQtCurrent()->getStudyId();
96  Engines::EngineComponent_var comp = lcc.FindOrLoad_Component(containerName.str().c_str(), "YACS" );
97  _engineRef =YACS_ORB::YACS_Gen::_narrow(comp);
98  YASSERT(!CORBA::is_nil(_engineRef));
99  }
100 
101  checkEndOfDataflow(); // --- to allow change of the _isRunning state
102 
103  if (_isRunning)
104  {
105  if (_isSuspended)
106  {
107  _procRef->setExecMode(getCurrentExecMode());
108  _procRef->resumeCurrentBreakPoint();
109  _isSuspended = false;
110  }
111  return;
112  }
113 
114  _isRunning = true;
115 
116  if (CORBA::is_nil(_procRef))
117  {
118  DEBTRACE("init _procRef");
119  _procRef = _engineRef->LoadProc(_context->getFileName().toUtf8());
121  DEBTRACE("_procRef init");
122  }
123 
124  YASSERT(!CORBA::is_nil(_procRef));
125 
126  if (initialize)
127  _procRef->setExecMode(YACS_ORB::STEPBYSTEP);
128  else
129  _procRef->setExecMode(getCurrentExecMode());
130  setBPList();
131 
132  if (_loadStateFile.empty())
133  {
134  DEBTRACE("Run from scratch!");
135  _procRef->Run();
136  }
137  else
138  {
139  DEBTRACE("Run from STATE!");
140  try
141  {
142  _procRef->RunFromState(_loadStateFile.c_str());
143  }
144  catch (...)
145  {
146  DEBTRACE("Runtime error: execution from the loaded state failed")
147  return;
148  }
149  }
150 }
void GuiExecutor::stopDataflow ( )

Definition at line 201 of file GuiExecutor.cxx.

References DEBTRACE.

202 {
203  DEBTRACE("GuiExecutor::stopDataflow");
204  if (_isRunning)
205  _procRef->stopExecution();
206 }
void GuiExecutor::suspendDataflow ( )

Definition at line 184 of file GuiExecutor.cxx.

References DEBTRACE, and YACS_ORB::STEPBYSTEP.

185 {
186  DEBTRACE("GuiExecutor::suspendDataflow");
187  if (_isRunning)
188  _procRef->setExecMode(YACS_ORB::STEPBYSTEP);
189 }
void GuiExecutor::unsetStopOnError ( )

Definition at line 265 of file GuiExecutor.cxx.

References DEBTRACE.

266 {
267  DEBTRACE("GuiExecutor::unsetStopOnError");
268  if (_isRunning)
269  {
270  _procRef->unsetStopOnError();
271  _isStopOnError = false;
272  }
273 }
YACS::ExecutorState GuiExecutor::updateSchema ( std::string  jobState)

Definition at line 579 of file GuiExecutor.cxx.

References 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(), CORBAEngineTest::state, YACS::SUSPENDED, YACS::HMI::SubjectNode::update(), YACS::HMI::UPDATEPROGRESS, and YASSERT.

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

580 {
582 
583  int numid;
584  int state;
585  std::list<Node*> aNodeSet = _proc->getAllRecursiveConstituents();
586  for ( std::list<Node*>::iterator it = aNodeSet.begin(); it != aNodeSet.end(); it++ ){
587 
588  numid = (*it)->getNumId();
589 
590  state = _proc->getNodeState(numid);
591  SubjectNode *snode = _context->_mapOfExecSubjectNode[numid];
592 
593  YACS::ENGINE::Node *node = snode->getNode();
594  list<InputPort*> inports = node->getLocalInputPorts();
595  list<InputPort*>::iterator iti = inports.begin();
596  for ( ; iti != inports.end(); ++iti)
597  {
598  string val = _proc->getInPortValue(numid, (*iti)->getName().c_str());
599  YASSERT(_context->_mapOfSubjectDataPort.count(*iti));
601  port->setExecValue(val);
602  port->update(YACS::HMI::UPDATEPROGRESS, 0, port);
603  }
604  list<OutputPort*> outports = node->getLocalOutputPorts();
605  list<OutputPort*>::iterator ito = outports.begin();
606  for ( ; ito != outports.end(); ++ito)
607  {
608  string val = _proc->getOutPortValue(numid, (*ito)->getName().c_str());
609  YASSERT(_context->_mapOfSubjectDataPort.count(*ito));
611  port->setExecValue(val);
612  port->update(YACS::HMI::UPDATEPROGRESS, 0, port);
613  }
614  snode->update(YACS::HMI::UPDATEPROGRESS, state, snode);
615  }
616  state = _proc->getRootNode()->getEffectiveState();
617  switch(state){
618  case YACS::LOADED:
619  case YACS::ACTIVATED:
620  if(jobState!="RUNNING")
621  execState = YACS::FINISHED;
622  else
623  execState = YACS::RUNNING;
624  break;
625  case YACS::FAILED:
626  case YACS::DONE:
627  execState = YACS::FINISHED;
628  break;
629  case YACS::SUSPENDED:
630  execState = YACS::PAUSED;
631  break;
632  }
633  SubjectProc *sproc = _context->getSubjectProc();
634  sproc->update(YACS::HMI::UPDATEPROGRESS, execState, sproc);
635 
636  return execState;
637 }

Member Data Documentation

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

Definition at line 117 of file GuiExecutor.hxx.

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

Definition at line 103 of file GuiExecutor.hxx.

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

Definition at line 105 of file GuiExecutor.hxx.

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

Definition at line 109 of file GuiExecutor.hxx.

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

Definition at line 112 of file GuiExecutor.hxx.

Referenced by isRunning().

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

Definition at line 114 of file GuiExecutor.hxx.

Referenced by isStopOnError().

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

Definition at line 113 of file GuiExecutor.hxx.

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

Definition at line 118 of file GuiExecutor.hxx.

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

Definition at line 107 of file GuiExecutor.hxx.

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

Definition at line 102 of file GuiExecutor.hxx.

Referenced by getProc().

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

Definition at line 106 of file GuiExecutor.hxx.

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

Definition at line 110 of file GuiExecutor.hxx.

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: