]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Profiles and Localization management.
authorageay <ageay>
Fri, 4 May 2012 12:29:03 +0000 (12:29 +0000)
committerageay <ageay>
Fri, 4 May 2012 12:29:03 +0000 (12:29 +0000)
src/MEDLoader/Swig/MEDLoader.i
src/MEDLoader/Swig/MEDLoaderTypemaps.i

index 3902da9b2608215a76c0921d959edad9f299b426..148c2a1b66cb342f3f74bea091f9a1cddd727100 100644 (file)
@@ -692,10 +692,41 @@ namespace ParaMEDMEM
          return convertVecPairVecStToPy(ret);
        }
 
-       //void changePflsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
-       //void changeLocsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
-       //void changePflsNames(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
-       //void changeLocsNames(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
+       void changePflsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
+       {
+         std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
+         self->changePflsNames(v);
+       }
+
+       void changePflsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
+       {
+         std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
+         self->changePflsRefsNamesGen(v);
+       }
+
+       void changePflsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
+       {
+         std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
+         self->changePflsNamesInStruct(v);
+       }
+
+       void changeLocsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
+       {
+         std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
+         self->changeLocsNames(v);
+       }
+
+       void changeLocsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
+       {
+         std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
+         self->changeLocsRefsNamesGen(v);
+       }
+       
+       void changeLocsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
+       {
+         std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
+         self->changeLocsNamesInStruct(v);
+       }
      }
   };
 
index 08baefdecd5c631c4f92a22f5b401407b4b6d3ae..3a18f44fcb0320a94c467bae7ef6bb0e2fbc4d87 100644 (file)
@@ -204,3 +204,53 @@ PyObject *convertVecPairVecStToPy(const std::vector< std::pair<std::vector<std::
     }
   return ret;
 }
+
+std::vector< std::pair<std::vector<std::string>, std::string > > convertVecPairVecStFromPy(PyObject *pyLi)
+{
+  std::vector< std::pair<std::vector<std::string>, std::string > > ret;
+  const char *msg="convertVecPairVecStFromPy : Expecting PyList of Tuples of size 2 ! The first elt in tupe is a list of strings and the 2nd one a string !";
+  if(PyList_Check(pyLi))
+    {
+      int size=PyList_Size(pyLi);
+      ret.resize(size);
+      for(int i=0;i<size;i++)
+        {
+          PyObject *o=PyList_GetItem(pyLi,i);
+          if(PyTuple_Check(o))
+            {
+              std::pair<std::vector<std::string>, std::string> p;
+              int size2=PyTuple_Size(o);
+              if(size2!=2)
+                throw INTERP_KERNEL::Exception(msg);
+              PyObject *o0=PyTuple_GetItem(o,0);
+              if(PyList_Check(o0))
+                {
+                  int size2=PyList_Size(o0);
+                  p.first.resize(size2);
+                  for(int j=0;j<size2;j++)
+                    {
+                      PyObject *o0j=PyTuple_GetItem(o0,j);
+                      if(PyString_Check(o0j))
+                        {
+                          p.first[j]=std::string(PyString_AsString(o0j));
+                        }
+                      else
+                        throw INTERP_KERNEL::Exception(msg);
+                    }
+                }
+              else
+                throw INTERP_KERNEL::Exception(msg);
+              PyObject *o1=PyTuple_GetItem(o,1);
+              if(PyString_Check(o1))
+                p.second=std::string(PyString_AsString(o1));
+              else
+                throw INTERP_KERNEL::Exception(msg);
+              ret[i]=p;
+            }
+          else
+            throw INTERP_KERNEL::Exception(msg);
+        }
+      return ret;
+    }
+  throw INTERP_KERNEL::Exception(msg);
+}