Salome HOME
merge from branch BR_For40_DSC tag mergeto_V4_1_0_maintainance_29may08
[modules/kernel.git] / src / Batch_SWIG / libBatch_Swig_typemap.i
index 9116e87984ec1530d446245828c8b9d24c875d11..06bdfce397181e69ab800a7e870fe20c171b2e7e 100644 (file)
@@ -1,3 +1,22 @@
+// Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// 
+// 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.
+// 
+// This library is distributed in the hope that it will be useful 
+// but WITHOUT ANY WARRANTY; without even the implied warranty of 
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public  
+// License along with this library; if not, write to the Free Software 
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
 /*
  * _typemap.i : 
  *
 
 
 # // construction d'un dictionnaire Python a partir d'un objet BatchManagerCatalog C++
-%typemap(out) map<string, Batch::FactBatchManager *> *
+%typemap(out) std::map<std::string, Batch::FactBatchManager *> *
 {
   $result = PyDict_New();
 
   // on itere sur toutes les clefs de la map
-  for(map<string, FactBatchManager *>::const_iterator it=(* $1).begin(); it!=(* $1).end(); it++) {
-    string key = (*it).first;
+  for(std::map<std::string, Batch::FactBatchManager *>::const_iterator it=(* $1).begin(); it!=(* $1).end(); it++) {
+    std::string key = (*it).first;
     PyObject * obj  = SWIG_NewPointerObj((void *) (*it).second, SWIGTYPE_p_Batch__FactBatchManager, 0);
     PyDict_SetItem($result, PyString_FromString(key.c_str()), obj);
   }
 
 
 # // construction d'un dictionnaire Python a partir d'un objet Parametre C++
-%typemap(out) Parametre
+%typemap(out) Batch::Parametre
 {
   $result = PyDict_New();
 
   // on itere sur toutes les clefs de la map, et on passe par la classe PyVersatile
        // qui convertit un Versatile en PyObject et vice versa
-  for(Parametre::const_iterator it=$1.begin(); it!=$1.end(); it++) {
-    string key = (*it).first;
-    PyVersatile PyV = (*it).second;
+  for(Batch::Parametre::const_iterator it=$1.begin(); it!=$1.end(); it++) {
+    std::string key = (*it).first;
+    Batch::PyVersatile PyV = (*it).second;
     PyDict_SetItem($result, PyString_FromString(key.c_str()), PyV);
   }
 }
 
 
 # // construction d'un objet Parametre C++ a partir d'un dictionnaire Python
-%typemap(in) Parametre & (Parametre PM)
+%typemap(in) Batch::Parametre & (Batch::Parametre PM)
 {
   if (!PyDict_Check($input)) {
     PyErr_SetString(PyExc_ValueError,"Expected a dictionnary");
        PyObject *key, *value;
        int pos = 0;
        while (PyDict_Next($input, &pos, &key, &value)) {
-               string mk = PyString_AsString(key);
-               PyVersatile PyV = value;
+               std::string mk = PyString_AsString(key);
+               Batch::PyVersatile PyV = value;
                PyV.setName(mk);
                PM[mk] = PyV;
        }
 
   $1 = &PM; // $1 est une reference donc on lui passe une adresse
   }
-  catch (GenericException & ex) {
-      string msg = ex.type + " : " + ex.message;
+  catch (Batch::GenericException & ex) {
+      std::string msg = ex.type + " : " + ex.message;
       PyErr_SetString(PyExc_RuntimeWarning, msg.c_str());
       return NULL;
   }
 
 
 # // construction d'un objet Parametre C++ a partir d'un dictionnaire Python
-%typemap(in) Parametre (Parametre PM)
+%typemap(in) Batch::Parametre (Batch::Parametre PM)
 {
   if (!PyDict_Check($input)) {
     PyErr_SetString(PyExc_ValueError,"Expected a dictionnary");
        PyObject *key, *value;
        int pos = 0;
        while (PyDict_Next($input, &pos, &key, &value)) {
-               string mk = PyString_AsString(key);
-               PyVersatile PyV = value;
+               std::string mk = PyString_AsString(key);
+               Batch::PyVersatile PyV = value;
                PyV.setName(mk);
                PM[mk] = PyV;
        }
 
   $1 = PM;
   }
-  catch (GenericException & ex) {
-      string msg = ex.type + " : " + ex.message;
+  catch (Batch::GenericException & ex) {
+      std::string msg = ex.type + " : " + ex.message;
       PyErr_SetString(PyExc_RuntimeWarning, msg.c_str());
       return NULL;
   }
 
 
 # // construction d'un dictionnaire Python a partir d'un objet Environnement C++
-%typemap(out) Environnement
+%typemap(out) Batch::Environnement
 {
   $result = PyDict_New();
 
   // on itere sur toutes les clefs de la map
-  for(Environnement::const_iterator it=$1.begin(); it!=$1.end(); it++) {
-    string key = (*it).first;
-    string val = (*it).second;
+  for(Batch::Environnement::const_iterator it=$1.begin(); it!=$1.end(); it++) {
+    std::string key = (*it).first;
+    std::string val = (*it).second;
     PyDict_SetItem($result, 
                   PyString_FromString(key.c_str()),
                   PyString_FromString(val.c_str()));
 
 
 # // construction d'un objet Environnement C++ a partir d'un dictionnaire Python
-%typemap(in) Environnement & (Environnement E)
+%typemap(in) Batch::Environnement & (Batch::Environnement E)
 {
   if (!PyDict_Check($input)) {
     PyErr_SetString(PyExc_ValueError,"Expected a dictionnary");
        PyObject *key, *value;
        int pos = 0;
        while (PyDict_Next($input, &pos, &key, &value)) {
-               string mk  = PyString_AsString(key);
-               string val = PyString_AsString(value);
+               std::string mk  = PyString_AsString(key);
+               std::string val = PyString_AsString(value);
                E[mk] = val;
        }
   
 
 
 # // construction d'un objet Environnement C++ a partir d'un dictionnaire Python
-%typemap(in) Environnement (Environnement E)
+%typemap(in) Batch::Environnement (Batch::Environnement E)
 {
   if (!PyDict_Check($input)) {
     PyErr_SetString(PyExc_ValueError,"Expected a dictionnary");
        PyObject *key, *value;
        int pos = 0;
        while (PyDict_Next($input, &pos, &key, &value)) {
-               string mk  = PyString_AsString(key);
-               string val = PyString_AsString(value);
+               std::string mk  = PyString_AsString(key);
+               std::string val = PyString_AsString(value);
                E[mk] = val;
        }
   
 
 
 # // construction d'une string Python a partir d'une string STL
-%typemap(python,out) string
+%typemap(python,out) std::string
 {
        $result = PyString_FromString($1.c_str());
 }