Salome HOME
Addition of notification mechanism in evalyfx.
authorAnthony Geay <anthony.geay@edf.fr>
Fri, 12 Jun 2015 16:36:31 +0000 (18:36 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Fri, 12 Jun 2015 16:36:31 +0000 (18:36 +0200)
12 files changed:
src/engine/ForEachLoop.cxx
src/engine/ForEachLoop.hxx
src/evalyfx/CMakeLists.txt
src/evalyfx/YACSEvalExecParams.hxx [new file with mode: 0644]
src/evalyfx/YACSEvalObserver.cxx [new file with mode: 0644]
src/evalyfx/YACSEvalObserver.hxx [new file with mode: 0644]
src/evalyfx/YACSEvalYFX.cxx
src/evalyfx/YACSEvalYFX.hxx
src/evalyfx/YACSEvalYFXPattern.cxx
src/evalyfx/YACSEvalYFXPattern.hxx
src/evalyfx_swig/evalyfx.i
src/evalyfx_swig/test0.xml

index e8bab99d16aba36c02572d23391dfcdb49f90db0..f9b969e51971bdaabf3f02f1b00b4340c2e5e9b9 100644 (file)
@@ -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.
index 03333be63f16d53074774876f3cfab722fdef8be..1e06554097687634b8804db652635ed165fe6ef2 100644 (file)
@@ -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<unsigned int> getPassedResults(Executor *execut, std::vector<SequenceAny *>& outputs, std::vector<std::string>& nameOfOutputs) const;
       void assignPassedResults(const std::vector<unsigned int>& passedIds, const std::vector<SequenceAny *>& passedOutputs, const std::vector<std::string>& nameOfOutputs);
index 8779522e49b5e3035454bb69cac85e3f4f83a0e8..4b0683eaa9d11a6614c8c3c0c97090f95c2a452b 100644 (file)
@@ -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 (file)
index 0000000..80e0cf6
--- /dev/null
@@ -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 (file)
index 0000000..ba34bc5
--- /dev/null
@@ -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 (file)
index 0000000..f9221fe
--- /dev/null
@@ -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 <string>
+
+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
index a96558401c5956af8d8c7336d746adb08297348c..aba327e7457aa083f5b7a83347ea624a215ad441 100644 (file)
@@ -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<YACSEvalSeqAny *> 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
index 4c9ecfe9e1593b81557c500a36dd05a58cd6a2f2..a25d10e088b88904566205f01f45bf37f168b09e 100644 (file)
@@ -22,6 +22,7 @@
 #define __YACSEVALYFX_HXX__
 
 #include "YACSEvalYFXExport.hxx"
+#include "YACSEvalExecParams.hxx"
 
 #include <string>
 #include <vector>
@@ -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<YACSEvalSeqAny *> 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
index d951044a34e89ed2c981444f96db70ce12932b89..f27e1f5273b492d5e64239a1da5b9d751e52f028 100644 (file)
 #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<YACS::ENGINE::ForEachLoop *>(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<YACSEvalOutputPort *>& 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<YACSEvalSeqAny *> 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<YACS::ENGINE::Node *> nodes(scheme->getChildren());
index b37c0e29eaf09f7ad1194c523a5b69343926f9c3..2e2a9ca75b3c0cd781927ba161db9b4bdf196e12 100644 (file)
@@ -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<YACSEvalOutputPort *>& 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<YACSEvalSeqAny *> 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<YACSEvalOutputPort *>& outputsOfInterest);
   void resetOutputsOfInterest();
   void generateGraph();
@@ -98,6 +109,9 @@ public:
   YACSEvalListOfResources *giveResources();
   YACS::ENGINE::Proc *getUndergroundGeneratedGraph() const;
   std::vector<YACSEvalSeqAny *> 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<YACSEvalOutputPort *> _outputsOfInterest;
   YACS::ENGINE::Proc *_generatedGraph;
+  YACS::ENGINE::ForEachLoop *_FEInGeneratedGraph;
+  YACSEvalYFXRunOnlyPatternInternalObserver *_obs;
 };
 
 #endif
index 1999ce562e5af912d3a8ddd5ed15586ee791bf01..4395e90ddec15e5a9763185409492046ce242ff9 100644 (file)
@@ -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<YACSEvalInputPort *> getFreeInputPorts() const;
   std::vector<YACSEvalOutputPort *> 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)
index e23ae1c986a0ee43c5bce1a637d18d6f1fe496a1..35d09848fd38e8a0fe1046d79c6b6475684da21d 100644 (file)
       <fromnode>node0</fromnode> <fromport>c</fromport>
       <tonode>node1</tonode> <toport>d</toport>
    </datalink>
-   <parameter>
-      <tonode>node0</tonode><toport>b</toport>
-      <value><double>1.3</double></value>
-   </parameter>
    <parameter>
       <tonode>node1</tonode><toport>e</toport>
       <value><double>2.5</double></value>
    </parameter>
+   <parameter>
+      <tonode>node0</tonode><toport>b</toport>
+      <value><double>1.3</double></value>
+   </parameter>
 </proc>