Salome HOME
Improve swig generation process on Windows platform.
[tools/medcoupling.git] / src / MEDCoupling_Swig / MEDCouplingRefCountObject.i
index 0db2e7e7ee9b41bf939ff930d498552398d66d92..fa29e6032415beaf0db0e8e00c0dbb70bf39c175 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2016  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
@@ -29,14 +29,14 @@ namespace INTERP_KERNEL
     %extend
     {
       std::string __str__() const
-        {
-          return std::string(self->what());
-        }
+      {
+        return std::string(self->what());
+      }
     }
   };
 }
 
-namespace ParaMEDMEM
+namespace MEDCoupling
 {
   class TimeLabel
   {
@@ -49,7 +49,7 @@ namespace ParaMEDMEM
   };
 }
 
-namespace ParaMEDMEM
+namespace MEDCoupling
 {
   typedef enum
     {
@@ -68,6 +68,7 @@ namespace ParaMEDMEM
   public:
     std::size_t getHeapMemorySize() const throw(INTERP_KERNEL::Exception);
     std::string getHeapMemorySizeStr() const throw(INTERP_KERNEL::Exception);
+    bool isObjectInTheProgeny(const BigMemoryObject *obj) const throw(INTERP_KERNEL::Exception);
     virtual std::size_t getHeapMemorySizeWithoutChildren() const throw(INTERP_KERNEL::Exception);
     virtual ~BigMemoryObject();
     %extend
@@ -77,14 +78,23 @@ namespace ParaMEDMEM
         std::vector<const BigMemoryObject *> c(self->getDirectChildren());
         PyObject *ret(PyList_New(c.size()));
         for(std::size_t i=0;i<c.size();i++)
-          PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(c[i]),SWIGTYPE_p_ParaMEDMEM__BigMemoryObject, 0 | 0 ));
+          PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(c[i]),SWIGTYPE_p_MEDCoupling__BigMemoryObject, 0 | 0 ));
+        return ret;
+      }
+
+      PyObject *getAllTheProgeny() const throw(INTERP_KERNEL::Exception)
+      {
+        std::vector<const BigMemoryObject *> c(self->getAllTheProgeny());
+        PyObject *ret(PyList_New(c.size()));
+        for(std::size_t i=0;i<c.size();i++)
+          PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(c[i]),SWIGTYPE_p_MEDCoupling__BigMemoryObject, 0 | 0 ));
         return ret;
       }
 
       static std::size_t GetHeapMemorySizeOfObjs(PyObject *objs) throw(INTERP_KERNEL::Exception)
       {
         std::vector<const BigMemoryObject *> cppObjs;
-        convertFromPyObjVectorOfObj<const ParaMEDMEM::BigMemoryObject *>(objs,SWIGTYPE_p_ParaMEDMEM__BigMemoryObject,"BigMemoryObject",cppObjs);
+        convertFromPyObjVectorOfObj<const MEDCoupling::BigMemoryObject *>(objs,SWIGTYPE_p_MEDCoupling__BigMemoryObject,"BigMemoryObject",cppObjs);
         return BigMemoryObject::GetHeapMemorySizeOfObjs(cppObjs);
       }
     }
@@ -105,6 +115,29 @@ namespace ParaMEDMEM
   protected:
     ~RefCountObject();
   };
+
+  class GlobalDict
+  {
+  public:
+    static GlobalDict *GetInstance() throw(INTERP_KERNEL::Exception);
+    bool hasKey(const std::string& key) const throw(INTERP_KERNEL::Exception);
+    std::string value(const std::string& key) const throw(INTERP_KERNEL::Exception);
+    std::vector<std::string> keys() const throw(INTERP_KERNEL::Exception);
+    void erase(const std::string& key) throw(INTERP_KERNEL::Exception);
+    void clear() throw(INTERP_KERNEL::Exception);
+    void setKeyValue(const std::string& key, const std::string& value) throw(INTERP_KERNEL::Exception);
+    void setKeyValueForce(const std::string& key, const std::string& value) throw(INTERP_KERNEL::Exception);
+  private:
+    GlobalDict();
+  public:
+    %extend
+    {
+      std::string __str__() const
+      {
+        return self->printSelf();
+      }
+    }
+  };
 }
 
 %inline
@@ -147,3 +180,12 @@ namespace ParaMEDMEM
     return std::string(script);
   }
 }
+
+%pythoncode %{
+def INTERPKERNELExceptionReduceFunct(a,b):
+    ret=InterpKernelException.__new__(a)
+    ret.__init__(*b)
+    return ret
+def INTERPKERNELExceptionReduce(self):
+    return INTERPKERNELExceptionReduceFunct,(InterpKernelException,(self.what(),))
+%}