Salome HOME
Merge branch 'master' of ssh://git.salome-platform.org/modules/kernel
[modules/kernel.git] / src / LifeCycleCORBA_SWIG / libSALOME_LifeCycleCORBA.i
index 3990d9d866774c54e9b20e800c6e760f251a4886..73715750474c2a68555350062aa56bddeed3cc67 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -6,7 +6,7 @@
 // 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
@@ -119,18 +119,21 @@ omniORBpyAPI* api;
   }
 }
 
-%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) const Engines::MachineParameters &
+// We use a dictionary to represent ContainerParameters structure instead of the CORBA
+// structure itself because it would require a transformation from the Python
+// ContainerParameters structure, generated by omniOrbPy, to a C++ ContainerParameters
+// structure, generated by omniOrb, and this would be quite complex.
+%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) const Engines::ContainerParameters &
 {
   $1 = PyDict_Check($input)? 1 : 0;
 }
 
-%typemap(in) const Engines::MachineParameters &
+%typemap(in) const Engines::ContainerParameters &
 {
-  //printf("typemap in on Engines::MachineParameters\n");
-  MESSAGE("typemap in on Engines::MachineParameters");
+  MESSAGE("typemap in on Engines::ContainerParameters");
   if (PyDict_Check($input) == 1)
     {
-      Engines::MachineParameters *param = new Engines::MachineParameters ;
+      Engines::ContainerParameters *param = new Engines::ContainerParameters ;
       SALOME_LifeCycleCORBA::preSet(*param);
 
       PyObject *key, *value;
@@ -142,29 +145,33 @@ omniORBpyAPI* api;
            {
              param->container_name = CORBA::string_dup(PyString_AsString(value));
            }
+         else if (strcmp(keystr,"resource_name")==0)
+           {
+             param->resource_params.name = CORBA::string_dup(PyString_AsString(value));
+           }
          else if (strcmp(keystr,"hostname")==0)
            {
-             param->hostname = CORBA::string_dup(PyString_AsString(value));
+             param->resource_params.hostname = CORBA::string_dup(PyString_AsString(value));
            }
          else if (strcmp(keystr,"OS")==0)
            {
-             param->OS = CORBA::string_dup(PyString_AsString(value));
+             param->resource_params.OS = CORBA::string_dup(PyString_AsString(value));
            }
          else if (strcmp(keystr,"mem_mb")==0)
            {
-             param->mem_mb = PyLong_AsLong(value);
+             param->resource_params.mem_mb = PyLong_AsLong(value);
            }
          else if (strcmp(keystr,"cpu_clock")==0)
            {
-             param->cpu_clock = PyLong_AsLong(value);
+             param->resource_params.cpu_clock = PyLong_AsLong(value);
            }
          else if (strcmp(keystr,"nb_proc_per_node")==0)
            {
-             param->nb_proc_per_node = PyLong_AsLong(value);
+             param->resource_params.nb_proc_per_node = PyLong_AsLong(value);
            }
          else if (strcmp(keystr,"nb_node")==0)
            {
-             param->nb_node = PyLong_AsLong(value);
+             param->resource_params.nb_node = PyLong_AsLong(value);
            }
          else if (strcmp(keystr,"isMPI")==0)
            {
@@ -175,28 +182,24 @@ omniORBpyAPI* api;
          else if (strcmp(keystr,"mode")==0)
              param->mode = CORBA::string_dup(PyString_AsString(value));
          else if (strcmp(keystr,"policy")==0)
-             param->policy = CORBA::string_dup(PyString_AsString(value));
+             param->resource_params.policy = CORBA::string_dup(PyString_AsString(value));
          else if (strcmp(keystr,"parallelLib")==0)
            {
              param->parallelLib = CORBA::string_dup(PyString_AsString(value));
            }
-         else if (strcmp(keystr,"nb_component_nodes")==0)
-           {
-             param->nb_component_nodes = PyLong_AsLong(value);
-           }
        }
       $1 = param;
     }
   else 
     {
-       MESSAGE("Not a dictionnary");
-       PyErr_SetString(PyExc_TypeError,"Must Be a Python Dictionnary");
+       MESSAGE("Not a ContainerParameters struct");
+       PyErr_SetString(PyExc_TypeError,"Must Be a Python ContainerParameters object");
        return NULL;
     }
 }
 
 
-%typemap(freearg) const Engines::MachineParameters &
+%typemap(freearg) const Engines::ContainerParameters &
 {
   MESSAGE("delete $1");
   delete $1;