-// Copyright (C) 2006-2013 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2015 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
bool StartFinish = (getExecutorState() == YACS::NOTYETINITIALIZED ||
getExecutorState() == YACS::FINISHED);
if ( _isRunning ||
- !(CORBA::is_nil(_procRef)) && StartFinish )
- _procRef->saveState(xmlFile.c_str());
+ !(CORBA::is_nil(_procRef)) && StartFinish ) {
+ if ( !_procRef->saveState(xmlFile.c_str()) ) {
+ string what = "Impossible to open file for writing: " + xmlFile;
+ throw Exception(what);
+ }
+ }
}
void GuiExecutor::setLoadStateFile(std::string xmlFile)
for ( std::list<Node*>::iterator it = aNodeSet.begin(); it != aNodeSet.end(); it++ )
{
_procRef->addObserver(_observerRef, _serv->getEngineId((*it)->getNumId()) , "status");
+ _procRef->addObserver(_observerRef, _serv->getEngineId((*it)->getNumId()) , "progress");
}
_procRef->addObserver(_observerRef, _serv->getEngineId(_proc->getNumId()) , "executor");
}
SubjectNode *snode = _context->_mapOfExecSubjectNode[iGui];
DEBTRACE("node " << snode->getName() << " state=" << state);
- YACS::ENGINE::Node *node = snode->getNode();
- list<InputPort*> inports = node->getLocalInputPorts();
- list<InputPort*>::iterator iti = inports.begin();
- for ( ; iti != inports.end(); ++iti)
- {
- string val = _procRef->getInPortValue(numid, (*iti)->getName().c_str());
- DEBTRACE("node " << snode->getName() << " inport " << (*iti)->getName()
- << " value " << val);
- YASSERT(_context->_mapOfSubjectDataPort.count(*iti));
- SubjectDataPort* port = _context->_mapOfSubjectDataPort[*iti];
- port->setExecValue(val);
- port->update(YACS::HMI::UPDATEPROGRESS, 0, port);
- }
- list<OutputPort*> outports = node->getLocalOutputPorts();
- list<OutputPort*>::iterator ito = outports.begin();
- for ( ; ito != outports.end(); ++ito)
- {
- string val = _procRef->getOutPortValue(numid, (*ito)->getName().c_str());
- DEBTRACE("node " << snode->getName() << " outport " << (*ito)->getName()
- << " value " << val);
- YASSERT(_context->_mapOfSubjectDataPort.count(*ito));
- SubjectDataPort* port = _context->_mapOfSubjectDataPort[*ito];
- port->setExecValue(val);
- port->update(YACS::HMI::UPDATEPROGRESS, 0, port);
- }
- snode->update(YACS::HMI::UPDATEPROGRESS, state, snode);
+ if (event == "progress") { // --- Update progress bar
+ std::string progress = _procRef->getNodeProgress(numid);
+ snode->setProgress( progress );
+ snode->update(YACS::HMI::PROGRESS, state, snode);
+ }
+ else { // --- Update node ports
+ YACS::ENGINE::Node *node = snode->getNode();
+ list<InputPort*> inports = node->getLocalInputPorts();
+ list<InputPort*>::iterator iti = inports.begin();
+ for ( ; iti != inports.end(); ++iti)
+ {
+ string val = _procRef->getInPortValue(numid, (*iti)->getName().c_str());
+ DEBTRACE("node " << snode->getName() << " inport " << (*iti)->getName()
+ << " value " << val);
+ YASSERT(_context->_mapOfSubjectDataPort.count(*iti));
+ SubjectDataPort* port = _context->_mapOfSubjectDataPort[*iti];
+ port->setExecValue(val);
+ port->update(YACS::HMI::UPDATEPROGRESS, 0, port);
+ }
+ list<OutputPort*> outports = node->getLocalOutputPorts();
+ list<OutputPort*>::iterator ito = outports.begin();
+ for ( ; ito != outports.end(); ++ito)
+ {
+ string val = _procRef->getOutPortValue(numid, (*ito)->getName().c_str());
+ DEBTRACE("node " << snode->getName() << " outport " << (*ito)->getName()
+ << " value " << val);
+ YASSERT(_context->_mapOfSubjectDataPort.count(*ito));
+ SubjectDataPort* port = _context->_mapOfSubjectDataPort[*ito];
+ port->setExecValue(val);
+ port->update(YACS::HMI::UPDATEPROGRESS, 0, port);
+ }
+ snode->update(YACS::HMI::UPDATEPROGRESS, state, snode);
+ }
}
return true;