From 937a8aba1da07a48d60b93c5ec40c64d6ab5a7f9 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Fri, 12 Jun 2015 18:36:31 +0200 Subject: [PATCH] Addition of notification mechanism in evalyfx. --- src/engine/ForEachLoop.cxx | 7 +++- src/engine/ForEachLoop.hxx | 2 + src/evalyfx/CMakeLists.txt | 4 +- src/evalyfx/YACSEvalExecParams.hxx | 36 +++++++++++++++++ src/evalyfx/YACSEvalObserver.cxx | 34 ++++++++++++++++ src/evalyfx/YACSEvalObserver.hxx | 48 +++++++++++++++++++++++ src/evalyfx/YACSEvalYFX.cxx | 19 ++++++++- src/evalyfx/YACSEvalYFX.hxx | 6 +++ src/evalyfx/YACSEvalYFXPattern.cxx | 62 ++++++++++++++++++++++++++++-- src/evalyfx/YACSEvalYFXPattern.hxx | 22 +++++++++-- src/evalyfx_swig/evalyfx.i | 11 ++++++ src/evalyfx_swig/test0.xml | 8 ++-- 12 files changed, 244 insertions(+), 15 deletions(-) create mode 100644 src/evalyfx/YACSEvalExecParams.hxx create mode 100644 src/evalyfx/YACSEvalObserver.cxx create mode 100644 src/evalyfx/YACSEvalObserver.hxx diff --git a/src/engine/ForEachLoop.cxx b/src/engine/ForEachLoop.cxx index e8bab99d1..f9b969e51 100644 --- a/src/engine/ForEachLoop.cxx +++ b/src/engine/ForEachLoop.cxx @@ -1078,7 +1078,7 @@ void ForEachLoop::resetState(int level) std::string ForEachLoop::getProgress() const { - int nbElems = _splitterNode.getNumberOfElements(); + int nbElems(getNbOfElementsToBeProcessed()); std::stringstream aProgress; if (nbElems > 0) aProgress << _currentIndex << "/" << nbElems; @@ -1087,6 +1087,11 @@ std::string ForEachLoop::getProgress() const return aProgress.str(); } +int ForEachLoop::getNbOfElementsToBeProcessed() const +{ + return _splitterNode.getNumberOfElements(); +} + /*! * This method allows to retrieve the state of \a this during execution or after. This method works even if this is \b NOT complete, or during execution or after a failure in \a this. * The typical usage of this method is to retrieve the results of items that passed successfully to avoid to lose all of them if only one fails. diff --git a/src/engine/ForEachLoop.hxx b/src/engine/ForEachLoop.hxx index 03333be63..1e0655409 100644 --- a/src/engine/ForEachLoop.hxx +++ b/src/engine/ForEachLoop.hxx @@ -192,6 +192,8 @@ namespace YACS virtual std::string typeName() {return "YACS__ENGINE__ForEachLoop";} virtual void resetState(int level); std::string getProgress() const; + int getCurrentIndex() const { return _currentIndex; } + int getNbOfElementsToBeProcessed() const; #ifndef SWIG std::vector getPassedResults(Executor *execut, std::vector& outputs, std::vector& nameOfOutputs) const; void assignPassedResults(const std::vector& passedIds, const std::vector& passedOutputs, const std::vector& nameOfOutputs); diff --git a/src/evalyfx/CMakeLists.txt b/src/evalyfx/CMakeLists.txt index 8779522e4..4b0683eaa 100644 --- a/src/evalyfx/CMakeLists.txt +++ b/src/evalyfx/CMakeLists.txt @@ -61,7 +61,6 @@ SET(YACSevalYFX_LIBRARIES ${LIBXML2_LIBRARIES} ) -# no more than 4 files should be installed SET(YACSEvalYFX_HEADERS YACSEvalYFXExport.hxx YACSEvalYFX.hxx @@ -69,6 +68,8 @@ SET(YACSEvalYFX_HEADERS YACSEvalSeqAny.hxx YACSEvalResource.hxx YACSEvalSession.hxx + YACSEvalObserver.hxx + YACSEvalExecParams.hxx ) SET(YACSevalYFX_SOURCES @@ -78,6 +79,7 @@ SET(YACSevalYFX_SOURCES YACSEvalSeqAny.cxx YACSEvalResource.cxx YACSEvalSession.cxx + YACSEvalObserver.cxx ) ADD_LIBRARY(YACSevalYFX ${YACSevalYFX_SOURCES}) diff --git a/src/evalyfx/YACSEvalExecParams.hxx b/src/evalyfx/YACSEvalExecParams.hxx new file mode 100644 index 000000000..80e0cf65d --- /dev/null +++ b/src/evalyfx/YACSEvalExecParams.hxx @@ -0,0 +1,36 @@ +// Copyright (C) 2012-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, 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 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// Author : Anthony Geay (EDF R&D) + +#ifndef __YACSEVALEXECPARAMS_HXX__ +#define __YACSEVALEXECPARAMS_HXX__ + +#include "YACSEvalYFXExport.hxx" + +class YACSEvalExecParams +{ +public: + YACSEVALYFX_EXPORT YACSEvalExecParams():_stopASAPAfterError(true) { } + YACSEVALYFX_EXPORT bool getStopASAPAfterErrorStatus() const { return _stopASAPAfterError; } + YACSEVALYFX_EXPORT void setStopASAPAfterErrorStatus(bool newStatus) { _stopASAPAfterError=newStatus; } +private: + bool _stopASAPAfterError; +}; + +#endif diff --git a/src/evalyfx/YACSEvalObserver.cxx b/src/evalyfx/YACSEvalObserver.cxx new file mode 100644 index 000000000..ba34bc5ad --- /dev/null +++ b/src/evalyfx/YACSEvalObserver.cxx @@ -0,0 +1,34 @@ +// Copyright (C) 2012-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, 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 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// Author : Anthony Geay (EDF R&D) + +#include "YACSEvalObserver.hxx" + +void YACSEvalObserver::incrRef() const +{ + _cnt++; +} + +bool YACSEvalObserver::decrRef() const +{ + bool ret(--_cnt==0); + if(ret) + delete this; + return ret; +} diff --git a/src/evalyfx/YACSEvalObserver.hxx b/src/evalyfx/YACSEvalObserver.hxx new file mode 100644 index 000000000..f9221fea7 --- /dev/null +++ b/src/evalyfx/YACSEvalObserver.hxx @@ -0,0 +1,48 @@ +// Copyright (C) 2012-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, 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 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// Author : Anthony Geay (EDF R&D) + +#ifndef __YACSEVALOBSERVER_HXX__ +#define __YACSEVALOBSERVER_HXX__ + +#include "YACSEvalYFXExport.hxx" + +#include + +class YACSEvalYFX; + +class YACSEvalObserver +{ +public: + YACSEVALYFX_EXPORT YACSEvalObserver():_cnt(1) { } + YACSEVALYFX_EXPORT YACSEvalObserver(const YACSEvalObserver& other):_cnt(1) { }// counter must be equal to 1 even in case of copy + YACSEVALYFX_EXPORT void incrRef() const; + YACSEVALYFX_EXPORT bool decrRef() const; + YACSEVALYFX_EXPORT int getCnt() const { return _cnt; } + YACSEVALYFX_EXPORT virtual void notifyNumberOfSamplesToEval(YACSEvalYFX *sender, int nbOfSamples) = 0; + YACSEVALYFX_EXPORT virtual void notifyNewNumberOfPassedItems(YACSEvalYFX *sender, int sampleId) = 0; + //YACSEVALYFX_EXPORT virtual void warningHappen(const std::string& warnDetails) = 0; + //YACSEVALYFX_EXPORT virtual void errorHappen(const std::string& errorDetails) = 0; +private: + virtual ~YACSEvalObserver() { } +private: + mutable int _cnt; +}; + +#endif diff --git a/src/evalyfx/YACSEvalYFX.cxx b/src/evalyfx/YACSEvalYFX.cxx index a96558401..aba327e74 100644 --- a/src/evalyfx/YACSEvalYFX.cxx +++ b/src/evalyfx/YACSEvalYFX.cxx @@ -46,7 +46,6 @@ private: PyThreadState *_save; }; - YACSEvalYFX *YACSEvalYFX::BuildFromFile(const std::string& xmlOfScheme) { YACS::ENGINE::RuntimeSALOME::setRuntime(); @@ -114,7 +113,9 @@ bool YACSEvalYFX::run(YACSEvalSession *session, int& nbOfBranches) nbOfBranches=_pattern->assignNbOfBranches(); mySession->launch(); YACS::ENGINE::Executor exe; + exe.setKeepGoingProperty(!_params.getStopASAPAfterErrorStatus()); // + _pattern->emitStart(); { MyAutoThreadSaver locker; exe.RunW(getUndergroundGeneratedGraph()); @@ -122,6 +123,20 @@ bool YACSEvalYFX::run(YACSEvalSession *session, int& nbOfBranches) return getUndergroundGeneratedGraph()->getState()==YACS::DONE; } +void YACSEvalYFX::registerObserver(YACSEvalObserver *observer) +{ + if(!_pattern) + throw YACS::Exception("YACSEvalYFX::registerObserver : no pattern !"); + _pattern->registerObserver(observer); +} + +YACSEvalObserver *YACSEvalYFX::getObserver() +{ + if(!_pattern) + throw YACS::Exception("YACSEvalYFX::getObserver : no pattern !"); + return _pattern->getObserver(); +} + std::vector YACSEvalYFX::getResults() const { return _pattern->getResults(); @@ -134,7 +149,7 @@ YACS::ENGINE::Proc *YACSEvalYFX::getUndergroundGeneratedGraph() const YACSEvalYFX::YACSEvalYFX(YACS::ENGINE::Proc *scheme, bool ownScheme):_pattern(0) { - _pattern=YACSEvalYFXPattern::FindPatternFrom(scheme,ownScheme); + _pattern=YACSEvalYFXPattern::FindPatternFrom(this,scheme,ownScheme); } void YACSEvalYFX::checkPortsForEvaluation(const std::vector< YACSEvalInputPort * >& inputs, const std::vector< YACSEvalOutputPort * >& outputs) const diff --git a/src/evalyfx/YACSEvalYFX.hxx b/src/evalyfx/YACSEvalYFX.hxx index 4c9ecfe9e..a25d10e08 100644 --- a/src/evalyfx/YACSEvalYFX.hxx +++ b/src/evalyfx/YACSEvalYFX.hxx @@ -22,6 +22,7 @@ #define __YACSEVALYFX_HXX__ #include "YACSEvalYFXExport.hxx" +#include "YACSEvalExecParams.hxx" #include #include @@ -34,6 +35,7 @@ namespace YACS } } +class YACSEvalObserver; class YACSEvalSeqAny; class YACSEvalSession; class YACSEvalYFXPattern; @@ -46,6 +48,7 @@ class YACSEvalYFX public: YACSEVALYFX_EXPORT static YACSEvalYFX *BuildFromFile(const std::string& xmlOfScheme); YACSEVALYFX_EXPORT static YACSEvalYFX *BuildFromScheme(YACS::ENGINE::Proc *scheme); + YACSEVALYFX_EXPORT YACSEvalExecParams *getParams() const { return &_params; } YACSEVALYFX_EXPORT std::vector< YACSEvalInputPort * > getFreeInputPorts() const; YACSEVALYFX_EXPORT std::vector< YACSEvalOutputPort * > getFreeOutputPorts() const; YACSEVALYFX_EXPORT void lockPortsForEvaluation(const std::vector< YACSEvalInputPort * >& inputsOfInterest, const std::vector< YACSEvalOutputPort * >& outputsOfInterest); @@ -53,6 +56,8 @@ public: YACSEVALYFX_EXPORT bool isLocked() const; YACSEVALYFX_EXPORT YACSEvalListOfResources *giveResources(); YACSEVALYFX_EXPORT bool run(YACSEvalSession *session, int& nbOfBranches); + YACSEVALYFX_EXPORT void registerObserver(YACSEvalObserver *observer); + YACSEVALYFX_EXPORT YACSEvalObserver *getObserver(); YACSEVALYFX_EXPORT std::vector getResults() const; // YACSEVALYFX_EXPORT YACS::ENGINE::Proc *getUndergroundGeneratedGraph() const; @@ -62,6 +67,7 @@ private: void checkPortsForEvaluation(const std::vector< YACSEvalInputPort * >& inputs, const std::vector< YACSEvalOutputPort * >& outputs) const; private: YACSEvalYFXPattern *_pattern; + mutable YACSEvalExecParams _params; }; #endif diff --git a/src/evalyfx/YACSEvalYFXPattern.cxx b/src/evalyfx/YACSEvalYFXPattern.cxx index d951044a3..f27e1f527 100644 --- a/src/evalyfx/YACSEvalYFXPattern.cxx +++ b/src/evalyfx/YACSEvalYFXPattern.cxx @@ -21,10 +21,12 @@ #include "YACSEvalYFXPattern.hxx" #include "YACSEvalResource.hxx" #include "YACSEvalSeqAny.hxx" +#include "YACSEvalObserver.hxx" #include "YACSEvalAutoPtr.hxx" #include "ElementaryNode.hxx" #include "RuntimeSALOME.hxx" +#include "Dispatcher.hxx" #include "InputPort.hxx" #include "LinkInfo.hxx" #include "TypeCode.hxx" @@ -67,7 +69,7 @@ std::vector< YACSEvalOutputPort *> YACSEvalYFXPattern::getFreeOutputPorts() cons return ret; } -YACSEvalYFXPattern *YACSEvalYFXPattern::FindPatternFrom(YACS::ENGINE::Proc *scheme, bool ownScheme) +YACSEvalYFXPattern *YACSEvalYFXPattern::FindPatternFrom(YACSEvalYFX *boss, YACS::ENGINE::Proc *scheme, bool ownScheme) { if(!scheme) throw YACS::Exception("YACSEvalYFXPattern::FindPatternFrom : input scheme must be not null !"); @@ -75,7 +77,7 @@ YACSEvalYFXPattern *YACSEvalYFXPattern::FindPatternFrom(YACS::ENGINE::Proc *sche YACS::ENGINE::ComposedNode *zeRunNode(0); bool isMatchingRunOnlyPattern(YACSEvalYFXRunOnlyPattern::IsMatching(scheme,zeRunNode)); if(isMatchingRunOnlyPattern) - return new YACSEvalYFXRunOnlyPattern(scheme,ownScheme,zeRunNode); + return new YACSEvalYFXRunOnlyPattern(boss,scheme,ownScheme,zeRunNode); } throw YACS::Exception("YACSEvalYFXPattern::FindPatternFrom : no pattern found for the input scheme !"); } @@ -148,7 +150,18 @@ void YACSEvalYFXPattern::CheckNodeIsOK(YACS::ENGINE::ComposedNode *node) }*/ } -YACSEvalYFXPattern::YACSEvalYFXPattern(YACS::ENGINE::Proc *scheme, bool ownScheme):_scheme(scheme),_ownScheme(ownScheme),_rm(new ResourcesManager_cpp),_res(0) +void YACSEvalYFXPattern::registerObserver(YACSEvalObserver *observer) +{ + if(_observer==observer) + return ; + if(_observer) + _observer->decrRef(); + _observer=observer; + if(_observer) + _observer->incrRef(); +} + +YACSEvalYFXPattern::YACSEvalYFXPattern(YACSEvalYFX *boss, YACS::ENGINE::Proc *scheme, bool ownScheme):_boss(boss),_scheme(scheme),_ownScheme(ownScheme),_rm(new ResourcesManager_cpp),_res(0),_observer(0) { } @@ -224,11 +237,38 @@ void YACSEvalYFXPattern::cleanScheme() YACSEvalYFXPattern::~YACSEvalYFXPattern() { + if(_observer) + _observer->decrRef(); delete _rm; delete _res; } -YACSEvalYFXRunOnlyPattern::YACSEvalYFXRunOnlyPattern(YACS::ENGINE::Proc *scheme, bool ownScheme, YACS::ENGINE::ComposedNode *runNode):YACSEvalYFXPattern(scheme,ownScheme),_runNode(runNode),_generatedGraph(0) +///////////////////// + +class YACSEvalYFXRunOnlyPatternInternalObserver : public YACS::ENGINE::Observer +{ +public: + YACSEvalYFXRunOnlyPatternInternalObserver(YACSEvalYFXRunOnlyPattern *boss):_boss(boss) { if(!_boss) throw YACS::Exception("YACSEvalYFXRunOnlyPatternInternalObserver constructor : null boss not supported :)"); } + void notifyObserver(YACS::ENGINE::Node *object, const std::string& event); +private: + YACSEvalYFXRunOnlyPattern *_boss; +}; + +void YACSEvalYFXRunOnlyPatternInternalObserver::notifyObserver(YACS::ENGINE::Node *object, const std::string& event) +{ + YACS::ENGINE::ForEachLoop *object2(dynamic_cast(object)); + if(!object2) + return ; + YACSEvalObserver *obs(_boss->getObserver()); + if(!obs) + return ; + if(event=="progress") + obs->notifyNewNumberOfPassedItems(_boss->getBoss(),object2->getCurrentIndex()); +} + +///////////////////// + +YACSEvalYFXRunOnlyPattern::YACSEvalYFXRunOnlyPattern(YACSEvalYFX *boss, YACS::ENGINE::Proc *scheme, bool ownScheme, YACS::ENGINE::ComposedNode *runNode):YACSEvalYFXPattern(boss,scheme,ownScheme),_runNode(runNode),_generatedGraph(0),_FEInGeneratedGraph(0),_obs(new YACSEvalYFXRunOnlyPatternInternalObserver(this)) { if(!_runNode) throw YACS::Exception("YACSEvalYFXRunOnlyPattern : internal run node must be not null !"); @@ -236,6 +276,11 @@ YACSEvalYFXRunOnlyPattern::YACSEvalYFXRunOnlyPattern(YACS::ENGINE::Proc *scheme, buildOutputPorts(); } +YACSEvalYFXRunOnlyPattern::~YACSEvalYFXRunOnlyPattern() +{ + delete _obs; +} + void YACSEvalYFXRunOnlyPattern::setOutPortsOfInterestForEvaluation(const std::vector& outputsOfInterest) { checkNonLocked(); @@ -283,6 +328,7 @@ void YACSEvalYFXRunOnlyPattern::generateGraph() n0->setScript(n0Script.str()); // YACS::ENGINE::ForEachLoop *n1(r->createForEachLoop(oss.str(),pyobjTC)); + _FEInGeneratedGraph=n1; _generatedGraph->edAddChild(n1); _generatedGraph->edAddCFLink(n0,n1); _generatedGraph->edAddDFLink(sender,n1->edGetSeqOfSamplesPort()); @@ -427,6 +473,14 @@ std::vector YACSEvalYFXRunOnlyPattern::getResults() const return ret; } +void YACSEvalYFXRunOnlyPattern::emitStart() const +{ + YACSEvalObserver *obs(getObserver()); + if(!obs) + return ; + obs->notifyNumberOfSamplesToEval(getBoss(),_FEInGeneratedGraph->getNbOfElementsToBeProcessed()); +} + bool YACSEvalYFXRunOnlyPattern::IsMatching(YACS::ENGINE::Proc *scheme, YACS::ENGINE::ComposedNode *& runNode) { std::list nodes(scheme->getChildren()); diff --git a/src/evalyfx/YACSEvalYFXPattern.hxx b/src/evalyfx/YACSEvalYFXPattern.hxx index b37c0e29e..2e2a9ca75 100644 --- a/src/evalyfx/YACSEvalYFXPattern.hxx +++ b/src/evalyfx/YACSEvalYFXPattern.hxx @@ -31,13 +31,17 @@ namespace YACS { class Proc; class TypeCode; + class ForEachLoop; class ComposedNode; class InputPyPort; } } +class YACSEvalYFX; +class YACSEvalObserver; class YACSEvalListOfResources; class ResourcesManager_cpp; +class YACSEvalYFXRunOnlyPatternInternalObserver; class YACSEvalYFXPattern { @@ -45,13 +49,16 @@ public: virtual ~YACSEvalYFXPattern(); std::vector< YACSEvalInputPort *> getFreeInputPorts() const; std::vector< YACSEvalOutputPort *> getFreeOutputPorts() const; - static YACSEvalYFXPattern *FindPatternFrom(YACS::ENGINE::Proc *scheme, bool ownScheme); + static YACSEvalYFXPattern *FindPatternFrom(YACSEvalYFX *boss, YACS::ENGINE::Proc *scheme, bool ownScheme); bool isAlreadyComputedResources() const; void checkNonAlreadyComputedResources() const; void checkAlreadyComputedResources() const; void checkLocked() const; void checkNonLocked() const; static void CheckNodeIsOK(YACS::ENGINE::ComposedNode *node); + void registerObserver(YACSEvalObserver *observer); + YACSEvalObserver *getObserver() const { return _observer; } + YACSEvalYFX *getBoss() const { return _boss; } virtual void setOutPortsOfInterestForEvaluation(const std::vector& outputs) = 0; virtual void resetOutputsOfInterest() = 0; virtual void generateGraph() = 0; @@ -62,10 +69,11 @@ public: virtual YACSEvalListOfResources *giveResources() = 0; virtual YACS::ENGINE::Proc *getUndergroundGeneratedGraph() const = 0; virtual std::vector getResults() const = 0; + virtual void emitStart() const = 0; public: static const char DFT_PROC_NAME[]; protected: - YACSEvalYFXPattern(YACS::ENGINE::Proc *scheme, bool ownScheme); + YACSEvalYFXPattern(YACSEvalYFX *boss, YACS::ENGINE::Proc *scheme, bool ownScheme); YACS::ENGINE::TypeCode *createSeqTypeCodeFrom(YACS::ENGINE::Proc *scheme, const std::string& zeType); void setResources(YACSEvalListOfResources *res); void resetResources(); @@ -75,10 +83,12 @@ protected: private: void cleanScheme(); private: + YACSEvalYFX *_boss; bool _ownScheme; YACS::ENGINE::Proc *_scheme; ResourcesManager_cpp *_rm; YACSEvalListOfResources *_res; + mutable YACSEvalObserver *_observer; protected: std::vector< YACSEvalInputPort > _inputs; std::vector< YACSEvalOutputPort > _outputs; @@ -87,7 +97,8 @@ protected: class YACSEvalYFXRunOnlyPattern : public YACSEvalYFXPattern { public: - YACSEvalYFXRunOnlyPattern(YACS::ENGINE::Proc *scheme, bool ownScheme, YACS::ENGINE::ComposedNode *runNode); + YACSEvalYFXRunOnlyPattern(YACSEvalYFX *boss, YACS::ENGINE::Proc *scheme, bool ownScheme, YACS::ENGINE::ComposedNode *runNode); + ~YACSEvalYFXRunOnlyPattern(); void setOutPortsOfInterestForEvaluation(const std::vector& outputsOfInterest); void resetOutputsOfInterest(); void generateGraph(); @@ -98,6 +109,9 @@ public: YACSEvalListOfResources *giveResources(); YACS::ENGINE::Proc *getUndergroundGeneratedGraph() const; std::vector getResults() const; + void emitStart() const; + // + YACS::ENGINE::ForEachLoop *getUndergroundForEach() const { return _FEInGeneratedGraph; } static bool IsMatching(YACS::ENGINE::Proc *scheme, YACS::ENGINE::ComposedNode *& runNode); public: static const char GATHER_NODE_NAME[]; @@ -108,6 +122,8 @@ private: YACS::ENGINE::ComposedNode *_runNode; std::vector _outputsOfInterest; YACS::ENGINE::Proc *_generatedGraph; + YACS::ENGINE::ForEachLoop *_FEInGeneratedGraph; + YACSEvalYFXRunOnlyPatternInternalObserver *_obs; }; #endif diff --git a/src/evalyfx_swig/evalyfx.i b/src/evalyfx_swig/evalyfx.i index 1999ce562..4395e90dd 100644 --- a/src/evalyfx_swig/evalyfx.i +++ b/src/evalyfx_swig/evalyfx.i @@ -330,17 +330,28 @@ public: std::string getCorbaConfigFileName() const; }; +class YACSEvalExecParams +{ +public: + bool getStopASAPAfterErrorStatus() const; + void setStopASAPAfterErrorStatus(bool newStatus); +private: + YACSEvalExecParams(); +}; + class YACSEvalYFX { public: static YACSEvalYFX *BuildFromFile(const std::string& xmlOfScheme); static YACSEvalYFX *BuildFromScheme(YACS::ENGINE::Proc *schema); + YACSEvalExecParams *getParams() const; std::vector getFreeInputPorts() const; std::vector getFreeOutputPorts() const; void unlockAll(); bool isLocked() const; YACS::ENGINE::Proc *getUndergroundGeneratedGraph() const; YACSEvalListOfResources *giveResources(); + //void registerObserver(YACSEvalObserver *observer); %extend { void lockPortsForEvaluation(PyObject *inputsOfInterest, PyObject *outputsOfInterest) diff --git a/src/evalyfx_swig/test0.xml b/src/evalyfx_swig/test0.xml index e23ae1c98..35d09848f 100644 --- a/src/evalyfx_swig/test0.xml +++ b/src/evalyfx_swig/test0.xml @@ -43,12 +43,12 @@ node0 c node1 d - - node0b - 1.3 - node1e 2.5 + + node0b + 1.3 + -- 2.30.2