Salome HOME
Merge remote-tracking branch 'origin/abn/bug_fixes' into V8_5_BR
[tools/medcoupling.git] / src / MEDCoupling_Swig / MEDCouplingRefCountObject.i
index cfd9fdfdd40d9d96d40b326c8ab37f4c8aae78d3..031f0c380697c1740d9e5cb6a48b5eada59e6436 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2013  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
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// 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
@@ -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
     {
@@ -62,12 +62,14 @@ namespace ParaMEDMEM
   int MEDCouplingSizeOfVoidStar();
   bool MEDCouplingByteOrder();
   const char *MEDCouplingByteOrderStr();
-
+  bool IsCXX11Compiled();
+  
   class BigMemoryObject
   {
   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 +79,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);
       }
     }
@@ -96,7 +107,6 @@ namespace ParaMEDMEM
     bool decrRef() const;
     void incrRef() const;
     int getRCValue() const;
-    RefCountObjectOnly& operator=(const RefCountObjectOnly& other);
   protected:
     ~RefCountObjectOnly();
   };
@@ -106,6 +116,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
@@ -130,6 +163,15 @@ namespace ParaMEDMEM
 #endif
   }
 
+  bool MEDCouplingHasSciPyBindings()
+  {
+#ifdef WITH_SCIPY
+    return true;
+#else
+    return false;
+#endif
+  }
+
   std::string MEDCouplingCompletionScript() throw(INTERP_KERNEL::Exception)
   {
     static const char script[]="import rlcompleter,readline\nreadline.parse_and_bind('tab:complete')";
@@ -139,3 +181,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(),))
+%}