Salome HOME
[EDF20032] : Useful tool for debugging
[modules/yacs.git] / src / engine_swig / pilot.i
index 642fb3518fc696bd23e95a5ee67d8fb415e65f6e..9a4c6b805f63bc9b5dbdc1756abf9acf84db9320 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2006-2016  CEA/DEN, EDF R&D
+// Copyright (C) 2006-2019  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
 #include "PointVisitor.hxx"
 #include "ForkBlocPoint.hxx"
 #include "LinkedBlocPoint.hxx"
+#include "NotSimpleCasePoint.hxx"
 #include "ElementaryPoint.hxx"
+#include "ObserverAsPlugin.hxx"
+#include "InGate.hxx"
   
 using namespace YACS::ENGINE;
 
@@ -111,6 +114,7 @@ using namespace YACS::ENGINE;
 %template()              std::pair<YACS::ENGINE::OutPort *,YACS::ENGINE::InPort *>;
 %template()              std::pair<YACS::ENGINE::InPort *,YACS::ENGINE::OutPort *>;
 %template()              std::pair< std::string, int >;
+%template()              std::pair< YACS::ENGINE::InGate *, bool>;
 %template(ItPy3TC)       IteratorPy3<YACS::ENGINE::TypeCode *>;
 //%template(TCmap)         std::map<std::string, YACS::ENGINE::TypeCode *>;
 REFCOUNT_TEMPLATE(TCmap,YACS::ENGINE::TypeCode)
@@ -138,6 +142,8 @@ REFCOUNT_TEMPLATE(CONTAINmap,YACS::ENGINE::Container)
 %template()              std::pair<std::string, std::string>;
 %template(propmap)       std::map<std::string, std::string>;
 %template(ItPy3Comp)     IteratorPy3<YACS::ENGINE::ComponentInstance *>;
+%template(listpairingatebool) std::list< std::pair< YACS::ENGINE::InGate *, bool> >;
+
 REFCOUNT_TEMPLATE(CompoInstmap,YACS::ENGINE::ComponentInstance)
 
 %include "exception.i"
@@ -445,6 +451,18 @@ EXCEPTION(YACS::ENGINE::ExecutorSwig::waitPause)
     return self->getValue();
   }
 }
+%extend YACS::ENGINE::Any
+{
+  PyObject *getBytes()
+  {
+    YACS::ENGINE::AtomAny *self2(dynamic_cast<YACS::ENGINE::AtomAny *>(self));
+    if(!self2)
+      throw YACS::Exception("getBytes : self is not an AtomAny !");
+    std::size_t len(0);
+    const char *pt(self2->getBytesValue(len));
+    return PyBytes_FromStringAndSize(pt,len);
+  }
+}
 
 %extend YACS::ENGINE::AnyInputPort
 {
@@ -576,6 +594,14 @@ namespace YACS
       ForkBlocPoint();
       ForkBlocPoint(const ForkBlocPoint&);
     };
+
+    class NotSimpleCasePoint : public BlocPoint
+    {
+    private:
+      ~NotSimpleCasePoint();
+      NotSimpleCasePoint();
+      NotSimpleCasePoint(const NotSimpleCasePoint&);
+    };
     
     class SetOfPoints
     {
@@ -634,6 +660,20 @@ namespace YACS
             PyObject *ret(PyObject_CallMethodObjArgs(_py,meth,ptPy,nullptr));
             Py_XDECREF(ret); Py_XDECREF(meth); Py_XDECREF(ptPy);
           }
+          void beginNotSimpleCasePoint(NotSimpleCasePoint *pt)
+          {
+            PyObject *ptPy(SWIG_NewPointerObj((void*)pt,SWIGTYPE_p_YACS__ENGINE__NotSimpleCasePoint,0));//$descriptor(YACS::ENGINE::NotSimpleCasePoint *)
+            PyObject *meth(PyString_FromString("beginNotSimpleCasePoint"));
+            PyObject *ret(PyObject_CallMethodObjArgs(_py,meth,ptPy,nullptr));
+            Py_XDECREF(ret); Py_XDECREF(meth); Py_XDECREF(ptPy);
+          }
+          void endNotSimpleCasePoint(NotSimpleCasePoint *pt)
+          {
+            PyObject *ptPy(SWIG_NewPointerObj((void*)pt,SWIGTYPE_p_YACS__ENGINE__NotSimpleCasePoint,0));
+            PyObject *meth(PyString_FromString("endNotSimpleCasePoint"));
+            PyObject *ret(PyObject_CallMethodObjArgs(_py,meth,ptPy,nullptr));
+            Py_XDECREF(ret); Py_XDECREF(meth); Py_XDECREF(ptPy);
+          }
         private:
           PyObject *_py;
         };
@@ -645,3 +685,37 @@ namespace YACS
   }
 }
 
+%rename(LoadObserversPluginIfAny) LoadObserversPluginIfAnySwig;
+%rename(UnLoadObserversPluginIfAny) UnLoadObserversPluginIfAnySwig;
+                                  
+%inline{
+  void LoadObserversPluginIfAnySwig(YACS::ENGINE::ComposedNode *rootNode, YACS::ENGINE::ExecutorSwig *executor)
+  {
+    YACS::ENGINE::LoadObserversPluginIfAny(rootNode,executor);
+  }
+
+  void UnLoadObserversPluginIfAnySwig()
+  {
+    YACS::ENGINE::UnLoadObserversPluginIfAny();
+  }
+
+  PyObject *ToBase64Swig(PyObject *bytes)
+  {
+    char *pt = nullptr;
+    Py_ssize_t length=0;
+    PyBytes_AsStringAndSize(bytes,&pt,&length);
+    std::string input(pt,length);
+    std::string ret(YACS::ENGINE::ToBase64(input));
+    return PyBytes_FromStringAndSize(ret.c_str(),ret.size());
+  }
+
+  PyObject *FromBase64Swig(PyObject *base64Str)
+  {
+    char *pt = nullptr;
+    Py_ssize_t length=0;
+    PyBytes_AsStringAndSize(base64Str,&pt,&length);
+    std::string input(pt,length);
+    std::string ret(YACS::ENGINE::FromBase64(input));
+    return PyBytes_FromStringAndSize(ret.c_str(),ret.size());
+  }
+}