Salome HOME
[EDF30399] : Expose replay-dir parameter to define directory holding scenarii in...
[modules/yacs.git] / src / runtime / PythonNode.hxx
index e3c5e6a51cb8d8a961008307f50e35418b253a54..e15b42fbb7c0ee4e7ba433260a51d75a5e0ed12c 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2006-2022  CEA/DEN, EDF R&D
+// Copyright (C) 2006-2024  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -28,6 +28,8 @@
 
 #include <Python.h>
 
+#include <set>
+
 namespace YACS
 {
   namespace ENGINE
@@ -35,10 +37,12 @@ namespace YACS
     class YACSRUNTIMESALOME_EXPORT PythonEntry
     {
     public:
+      static bool IsProxy( PyObject *ob );
       /*! return true only if ob is a proxy and destroy flag set to true*/
       static bool GetDestroyStatus( PyObject *ob );
       static void DoNotTouchFileIfProxy( PyObject *ob );
       static void UnlinkOnDestructorIfProxy( PyObject *ob );
+      static void IfProxyDoSomething( PyObject *ob, const char *meth );
     protected:
       PythonEntry();
       ~PythonEntry();
@@ -56,7 +60,6 @@ namespace YACS
       void loadRemoteContext(InlineNode *reqNode, Engines::Container_ptr objContainer, bool isInitializeRequested);
       static std::string GetContainerLog(const std::string& mode, Container *container, const Task *askingTask);
       virtual bool hasImposedResource()const;
-      static void IfProxyDoSomething( PyObject *ob, const char *meth );
     protected:
       PyObject *_context;
       PyObject *_pyfuncSer;
@@ -104,9 +107,11 @@ namespace YACS
       PythonNode* cloneNode(const std::string& name);
       virtual std::string typeName() { return "YACS__ENGINE__PythonNode"; }
       void applyDPLScope(ComposedNode *gfn);
+      void setSqueezeStatusWithExceptions(bool sqStatus, const std::vector<std::string>& squeezeExceptions);
       void setSqueezeStatus(bool sqStatus) { _autoSqueeze=sqStatus; }
       bool getSqueezeStatus() const { return _autoSqueeze; }
       void squeezeMemorySafe();
+      static void ExecuteLocalInternal(const std::string& codeStr, PyObject *context, std::string& errorDetails);
     private:
       void executeLocalInternal(const std::string& codeStr);
     protected:
@@ -121,6 +126,8 @@ namespace YACS
       static const char DPL_INFO_NAME[];
     protected:
       bool _autoSqueeze = false;
+      //! list on output port name excluded from the squeeze mecanism
+      std::set<std::string> _nonSqueezableOutputNodes;
       Engines::PyScriptNode_var _pynode;
     };