1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 %module libMedCorba_Swig
25 %include "libMEDMEM_Swig.i"
28 #include "MEDMEM_convert.hxx"
29 #include "MEDMEM_Family_i.hxx"
30 #include "MEDMEM_Field_i.hxx"
31 #include "MEDMEM_FieldTemplate_i.hxx"
32 #include "MEDMEM_Group_i.hxx"
33 #include "MEDMEM_Med_i.hxx"
34 #include "MEDMEM_GMesh_i.hxx"
35 #include "MEDMEM_Mesh_i.hxx"
36 #include "MEDMEM_Support_i.hxx"
37 #include "Med_Gen_i.hxx"
39 using namespace MEDMEM;
40 using namespace MED_EN;
44 typemap in, out and typecheck for Corba Objects (MESH, FIELDDOUBLE, FIELDINT and
45 Support) between C++ and Python
47 WARNING (NB) to the user of those typmaps (SWIG wrapping for C++ routines
48 -------------------------------------------------------------------------
50 You have to be quite careful about the SWIG version your are currently
51 using, because CORBA pointeur _ptr or _var could be wrapped by SWIG using
52 their reference rather than the pointeur itself (differences detected using
53 SWIG 1.1.x, SWIG 1.3.13 and SWIG 1.3.17)
55 typecheck always says OK, as currently all overloaded methods HERE differ
56 only in nb of parameters (there are default ones)
59 #if defined(SWIGPYTHON)
60 %typemap(out) SALOME_MED::GMESH_ptr, SALOME_MED::MESH_ptr, SALOME_MED::FIELDDOUBLE_ptr,
61 SALOME_MED::FIELDINT_ptr, SALOME_MED::SUPPORT_ptr,
62 const SALOME_MED::GMESH_ptr, const SALOME_MED::MESH_ptr, const SALOME_MED::FIELDDOUBLE_ptr,
63 const SALOME_MED::FIELDINT_ptr, const SALOME_MED::SUPPORT_ptr
65 MESSAGE("typemap out sur Objet Corba version ptr");
69 // Get the orb corba python
71 PyObject* pdict = PyDict_New();
72 PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins());
73 PyRun_String("import CORBA", Py_single_input, pdict, pdict);
75 PyRun_String("o = CORBA.ORB_init([''], CORBA.ORB_ID);", Py_single_input,
78 PyObject* orb = PyDict_GetItemString(pdict, "o");
80 // Get the orb Corba C++
83 char *xargv = (char*)"";
85 CORBA::ORB_var ORB = CORBA::ORB_init(argc, argv);
87 string s = ORB->object_to_string($1);
89 PyObject * tmp = PyString_FromString(s.c_str());
91 PyObject * corbaObj = PyObject_CallMethod(orb, (char*)"string_to_object", (char*)"O", tmp);
94 // cast CORBA object, if necessary
96 // make target class name
97 // string className = "$1_type";
98 // className.replace( className.find(':'), 2, ".");
99 // className.erase( className.find("_ptr"));
101 // // get target class object
102 // string getClassCmd = ( "cls = " + className );
103 // PyRun_String("import SALOME_MED", Py_single_input, pdict, pdict);
104 // PyRun_String(getClassCmd.c_str(), Py_single_input, pdict, pdict);
105 // PyObject* cls = PyDict_GetItemString(pdict, "cls");
108 // $result = PyObject_CallMethod(corbaObj, (char*)"_narrow", (char*)"O", cls);
114 #if defined(SWIGPYTHON)
115 %typemap(out) SALOME_MED::GMESH_var, SALOME_MED::MESH_var, SALOME_MED::FIELDDOUBLE_var,
116 SALOME_MED::FIELDINT_var, SALOME_MED::SUPPORT_var,
117 const SALOME_MED::GMESH_var, const SALOME_MED::MESH_var, const SALOME_MED::FIELDDOUBLE_var,
118 const SALOME_MED::FIELDINT_var, const SALOME_MED::SUPPORT_var
120 MESSAGE("typemap out sur Objet Corba version var");
122 // Get the orb corba python
124 PyObject* pdict = PyDict_New();
125 PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins());
126 PyRun_String("import CORBA", Py_single_input, pdict, pdict);
128 PyRun_String("o = CORBA.ORB_init([''], CORBA.ORB_ID);", Py_single_input,
131 PyObject* orb = PyDict_GetItemString(pdict, "o");
133 // Get the orb Corba C++
136 char *xargv = (char*)"";
137 char **argv = &xargv;
138 CORBA::ORB_var ORB = CORBA::ORB_init(argc, argv);
140 string s = ORB->object_to_string(*$1);
142 PyObject * tmp = PyString_FromString(s.c_str());
144 $result = PyObject_CallMethod(orb, (char*)"string_to_object", (char*)"O", tmp);
149 #if defined(SWIGPYTHON)
150 %typemap(typecheck) SALOME_MED::GMESH_ptr, SALOME_MED::MESH_ptr, SALOME_MED::FIELDDOUBLE_ptr,
151 SALOME_MED::FIELDINT_ptr, SALOME_MED::SUPPORT_ptr,
152 const SALOME_MED::MESH_ptr, const SALOME_MED::FIELDDOUBLE_ptr,
153 const SALOME_MED::FIELDINT_ptr, const SALOME_MED::SUPPORT_ptr,
154 SALOME_MED::GMESH_var, SALOME_MED::MESH_var, SALOME_MED::FIELDDOUBLE_var,
155 SALOME_MED::FIELDINT_var, SALOME_MED::SUPPORT_var,
156 const SALOME_MED::MESH_var, const SALOME_MED::FIELDDOUBLE_var,
157 const SALOME_MED::FIELDINT_var, const SALOME_MED::SUPPORT_var
163 #if defined(SWIGPYTHON)
164 %typemap(in) const SALOME_MED::MESH_ptr &, SALOME_MED::MESH_ptr &
167 MESSAGE("typemap in sur Objet Corba MESH avec reference");
169 PyObject* pdict = PyDict_New();
170 PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins());
171 PyRun_String("import CORBA", Py_single_input, pdict, pdict);
173 PyRun_String("o = CORBA.ORB_init([''], CORBA.ORB_ID);", Py_single_input,
176 PyObject* orb = PyDict_GetItemString(pdict, "o");
178 // Ask omniORBpy to transform MESH (python Corba) ptr to IOR string
181 = PyObject_CallMethod(orb, (char*)"object_to_string", (char*)"O", $input);
183 if (iorMesh == Py_None)
185 char * s = PyString_AsString(PyObject_Str(iorMesh));
187 // Ask omniORB to convert IOR string to MESH (C++ Corba) ptr
190 char *xargv = (char*)"";
191 char **argv = &xargv;
192 CORBA::ORB_var ORB = CORBA::ORB_init(argc, argv);
193 CORBA::Object_var O = ORB->string_to_object(s);
195 SALOME_MED::MESH_ptr t = SALOME_MED::MESH::_narrow(O);
196 SCRUTE(CORBA::is_nil(t));
203 #if defined(SWIGPYTHON)
204 %typemap(in) const SALOME_MED::FIELDDOUBLE_ptr &,
205 SALOME_MED::FIELDDOUBLE_ptr &
208 MESSAGE("typemap in sur Objet Corba FIELDDOUBLE avec reference");
210 PyObject* pdict = PyDict_New();
211 PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins());
212 PyRun_String("import CORBA", Py_single_input, pdict, pdict);
214 PyRun_String("o = CORBA.ORB_init([''], CORBA.ORB_ID);", Py_single_input,
217 PyObject* orb = PyDict_GetItemString(pdict, "o");
219 // Ask omniORBpy to transform FIELDDOUBLE (python Corba) ptr to IOR string
221 PyObject* iorFieldDouble
222 = PyObject_CallMethod(orb, (char*)"object_to_string", (char*)"O", $input);
224 if (iorFieldDouble == Py_None)
226 char * s = PyString_AsString(PyObject_Str(iorFieldDouble));
228 // Ask omniORB to convert IOR string to FIELDDOUBLE (C++ Corba) ptr
231 char *xargv = (char*)"";
232 char **argv = &xargv;
233 CORBA::ORB_var ORB = CORBA::ORB_init(argc, argv);
234 CORBA::Object_var O = ORB->string_to_object(s);
236 SALOME_MED::FIELDDOUBLE_ptr t = SALOME_MED::FIELDDOUBLE::_narrow(O);
237 SCRUTE(CORBA::is_nil(t));
244 #if defined(SWIGPYTHON)
245 %typemap(in) const SALOME_MED::FIELDINT_ptr &,
246 SALOME_MED::FIELDINT_ptr &
249 MESSAGE("typemap in sur Objet Corba FIELDINT avec reference");
251 PyObject* pdict = PyDict_New();
252 PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins());
253 PyRun_String("import CORBA", Py_single_input, pdict, pdict);
255 PyRun_String("o = CORBA.ORB_init([''], CORBA.ORB_ID);", Py_single_input,
258 PyObject* orb = PyDict_GetItemString(pdict, "o");
260 // Ask omniORBpy to transform FIELDINT (python Corba) ptr to IOR string
262 PyObject* iorFieldInt
263 = PyObject_CallMethod(orb, (char*)"object_to_string", (char*)"O", $input);
265 if (iorFieldInt == Py_None)
267 char * s = PyString_AsString(PyObject_Str(iorFieldInt));
269 // Ask omniORB to convert IOR string to FIELDINT (C++ Corba) ptr
272 char *xargv = (char*)"";
273 char **argv = &xargv;
274 CORBA::ORB_var ORB = CORBA::ORB_init(argc, argv);
275 CORBA::Object_var O = ORB->string_to_object(s);
277 SALOME_MED::FIELDINT_ptr t = SALOME_MED::FIELDINT::_narrow(O);
278 SCRUTE(CORBA::is_nil(t));
285 #if defined(SWIGPYTHON)
286 %typemap(in) const SALOME_MED::FIELDDOUBLE_ptr,
287 SALOME_MED::FIELDDOUBLE_ptr
290 MESSAGE("typemap in sur Objet Corba FIELDDOUBLE sans reference");
292 PyObject* pdict = PyDict_New();
293 PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins());
294 PyRun_String("import CORBA", Py_single_input, pdict, pdict);
296 PyRun_String("o = CORBA.ORB_init([''], CORBA.ORB_ID);", Py_single_input,
299 PyObject* orb = PyDict_GetItemString(pdict, "o");
301 // Ask omniORBpy to transform FIELDDOUBLE (python Corba) ptr to IOR string
303 PyObject* iorFieldDouble
304 = PyObject_CallMethod(orb, (char*)"object_to_string", (char*)"O", $input);
306 if (iorFieldDouble == Py_None)
308 char * s = PyString_AsString(PyObject_Str(iorFieldDouble));
310 // Ask omniORB to convert IOR string to FIELDDOUBLE (C++ Corba) ptr
313 char *xargv = (char*)"";
314 char **argv = &xargv;
315 CORBA::ORB_var ORB = CORBA::ORB_init(argc, argv);
316 CORBA::Object_var O = ORB->string_to_object(s);
318 SALOME_MED::FIELDDOUBLE_ptr t = SALOME_MED::FIELDDOUBLE::_narrow(O);
319 SCRUTE(CORBA::is_nil(t));
326 #if defined(SWIGPYTHON)
327 %typemap(in) const SALOME_MED::FIELDINT_ptr,
328 SALOME_MED::FIELDINT_ptr
331 MESSAGE("typemap in sur Objet Corba FIELDINT sans reference");
333 PyObject* pdict = PyDict_New();
334 PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins());
335 PyRun_String("import CORBA", Py_single_input, pdict, pdict);
337 PyRun_String("o = CORBA.ORB_init([''], CORBA.ORB_ID);", Py_single_input,
340 PyObject* orb = PyDict_GetItemString(pdict, "o");
342 // Ask omniORBpy to transform FIELDINT (python Corba) ptr to IOR string
344 PyObject* iorFieldInt
345 = PyObject_CallMethod(orb, (char*)"object_to_string", (char*)"O", $input);
347 if (iorFieldInt == Py_None)
349 char * s = PyString_AsString(PyObject_Str(iorFieldInt));
351 // Ask omniORB to convert IOR string to FIELDINT (C++ Corba) ptr
354 char *xargv = (char*)"";
355 char **argv = &xargv;
356 CORBA::ORB_var ORB = CORBA::ORB_init(argc, argv);
357 CORBA::Object_var O = ORB->string_to_object(s);
359 SALOME_MED::FIELDINT_ptr t = SALOME_MED::FIELDINT::_narrow(O);
360 SCRUTE(CORBA::is_nil(t));
367 #if defined(SWIGPYTHON)
368 %typemap(in) const SALOME_MED::SUPPORT_ptr &, SALOME_MED::SUPPORT_ptr &
371 MESSAGE("typemap in sur Objet Corba SUPPORT avec reference");
373 PyObject* pdict = PyDict_New();
374 PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins());
375 PyRun_String("import CORBA", Py_single_input, pdict, pdict);
377 PyRun_String("o = CORBA.ORB_init([''], CORBA.ORB_ID);", Py_single_input,
380 PyObject* orb = PyDict_GetItemString(pdict, "o");
382 // Ask omniORBpy to transform SUPPORT (python Corba) ptr to IOR string
385 = PyObject_CallMethod(orb, (char*)"object_to_string", (char*)"O", $input);
387 if (iorSupport == Py_None)
389 char * s = PyString_AsString(PyObject_Str(iorSupport));
391 // Ask omniORB to convert IOR string to SUPPORT (C++ Corba) ptr
394 char *xargv = (char*)"";
395 char **argv = &xargv;
396 CORBA::ORB_var ORB = CORBA::ORB_init(argc, argv);
397 CORBA::Object_var O = ORB->string_to_object(s);
399 SALOME_MED::SUPPORT_ptr t = SALOME_MED::SUPPORT::_narrow(O);
400 SCRUTE(CORBA::is_nil(t));
407 #if defined(SWIGPYTHON)
408 %typemap(in) const SALOME_MED::SUPPORT_ptr, SALOME_MED::SUPPORT_ptr
411 MESSAGE("typemap in sur Objet Corba SUPPORT sans reference");
415 PyObject* pdict = PyDict_New();
416 PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins());
417 PyRun_String("import CORBA", Py_single_input, pdict, pdict);
419 PyRun_String("o = CORBA.ORB_init([''], CORBA.ORB_ID);", Py_single_input,
422 PyObject* orb = PyDict_GetItemString(pdict, "o");
424 // Ask omniORBpy to transform SUPPORT (python Corba) ptr to IOR string
427 = PyObject_CallMethod(orb, (char*)"object_to_string", (char*)"O", $input);
429 if (iorSupport == Py_None)
431 char * s = PyString_AsString(PyObject_Str(iorSupport));
433 // Ask omniORB to convert IOR string to SUPPORT (C++ Corba) ptr
436 char *xargv = (char*)"";
437 char **argv = &xargv;
438 CORBA::ORB_var ORB = CORBA::ORB_init(argc, argv);
439 CORBA::Object_var O = ORB->string_to_object(s);
441 SALOME_MED::SUPPORT_ptr t = SALOME_MED::SUPPORT::_narrow(O);
442 SCRUTE(CORBA::is_nil(t));
449 #if defined(SWIGPYTHON)
450 %typemap(in) const SALOME_MED::GMESH_ptr, SALOME_MED::GMESH_ptr
453 MESSAGE("typemap in sur Objet Corba MESH sans reference");
457 PyObject* pdict = PyDict_New();
458 PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins());
459 PyRun_String("import CORBA", Py_single_input, pdict, pdict);
461 PyRun_String("o = CORBA.ORB_init([''], CORBA.ORB_ID);", Py_single_input,
464 PyObject* orb = PyDict_GetItemString(pdict, "o");
466 // Ask omniORBpy to transform MESH (python Corba) ptr to IOR string
469 = PyObject_CallMethod(orb, (char*)"object_to_string", (char*)"O", $input);
471 if (iorMesh == Py_None)
473 char * s = PyString_AsString(PyObject_Str(iorMesh));
475 // Ask omniORB to convert IOR string to MESH (C++ Corba) ptr
478 char *xargv = (char*)"";
479 char **argv = &xargv;
480 CORBA::ORB_var ORB = CORBA::ORB_init(argc, argv);
481 CORBA::Object_var O = ORB->string_to_object(s);
483 SALOME_MED::GMESH_ptr t = SALOME_MED::GMESH::_narrow(O);
484 SCRUTE(CORBA::is_nil(t));
491 #if defined(SWIGPYTHON)
492 %typemap(in) const SALOME_MED::MESH_ptr, SALOME_MED::MESH_ptr
495 MESSAGE("typemap in sur Objet Corba MESH sans reference");
499 PyObject* pdict = PyDict_New();
500 PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins());
501 PyRun_String("import CORBA", Py_single_input, pdict, pdict);
503 PyRun_String("o = CORBA.ORB_init([''], CORBA.ORB_ID);", Py_single_input,
506 PyObject* orb = PyDict_GetItemString(pdict, "o");
508 // Ask omniORBpy to transform MESH (python Corba) ptr to IOR string
511 = PyObject_CallMethod(orb, (char*)"object_to_string", (char*)"O", $input);
513 if (iorMesh == Py_None)
515 char * s = PyString_AsString(PyObject_Str(iorMesh));
517 // Ask omniORB to convert IOR string to MESH (C++ Corba) ptr
520 char *xargv = (char*)"";
521 char **argv = &xargv;
522 CORBA::ORB_var ORB = CORBA::ORB_init(argc, argv);
523 CORBA::Object_var O = ORB->string_to_object(s);
525 SALOME_MED::MESH_ptr t = SALOME_MED::MESH::_narrow(O);
526 SCRUTE(CORBA::is_nil(t));
533 #if defined(SWIGPYTHON)
534 %typemap(in) const SALOME_MED::FIELDDOUBLE_ptr,
535 SALOME_MED::FIELDDOUBLE_ptr &
538 MESSAGE("typemap in sur Objet Corba FIELDDOUBLE sans reference");
542 PyObject* pdict = PyDict_New();
543 PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins());
544 PyRun_String("import CORBA", Py_single_input, pdict, pdict);
546 PyRun_String("o = CORBA.ORB_init([''], CORBA.ORB_ID);", Py_single_input,
549 PyObject* orb = PyDict_GetItemString(pdict, "o");
551 // Ask omniORBpy to transform FIELDDOUBLE (python Corba) ptr to IOR string
553 PyObject* iorFieldDouble
554 = PyObject_CallMethod(orb, (char*)"object_to_string", (char*)"O", $input);
556 if (iorFieldDouble == Py_None)
558 char * s = PyString_AsString(PyObject_Str(iorFieldDouble));
560 // Ask omniORB to convert IOR string to FIELDDOUBLE (C++ Corba) ptr
563 char *xargv = (char*)"";
564 char **argv = &xargv;
565 CORBA::ORB_var ORB = CORBA::ORB_init(argc, argv);
566 CORBA::Object_var O = ORB->string_to_object(s);
568 SALOME_MED::FIELDDOUBLE_ptr t = SALOME_MED::FIELDDOUBLE::_narrow(O);
569 SCRUTE(CORBA::is_nil(t));
576 #if defined(SWIGPYTHON)
577 %typemap(in) const SALOME_MED::FIELDINT_ptr,
578 SALOME_MED::FIELDINT_ptr
581 MESSAGE("typemap in sur Objet Corba FIELDINT sans reference");
585 PyObject* pdict = PyDict_New();
586 PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins());
587 PyRun_String("import CORBA", Py_single_input, pdict, pdict);
589 PyRun_String("o = CORBA.ORB_init([''], CORBA.ORB_ID);", Py_single_input,
592 PyObject* orb = PyDict_GetItemString(pdict, "o");
594 // Ask omniORBpy to transform FIELDINT (python Corba) ptr to IOR string
596 PyObject* iorFieldInt
597 = PyObject_CallMethod(orb, (char*)"object_to_string", (char*)"O", $input);
599 if (iorFieldInt == Py_None)
601 char * s = PyString_AsString(PyObject_Str(iorFieldInt));
603 // Ask omniORB to convert IOR string to FIELDINT (C++ Corba) ptr
606 char *xargv = (char*)"";
607 char **argv = &xargv;
608 CORBA::ORB_var ORB = CORBA::ORB_init(argc, argv);
609 CORBA::Object_var O = ORB->string_to_object(s);
611 SALOME_MED::FIELDINT_ptr t = SALOME_MED::FIELDINT::_narrow(O);
612 SCRUTE(CORBA::is_nil(t));
621 managing C++ exception in the Python API
625 class PyAllowThreadsGuard {
627 PyAllowThreadsGuard() { _save = PyEval_SaveThread(); }
628 ~PyAllowThreadsGuard() { PyEval_RestoreThread(_save); }
630 PyThreadState *_save;
633 PyAllowThreadsGuard guard;
638 SALOME_MED::FIELDDOUBLE_ptr createCorbaFieldDouble(SALOME_MED::SUPPORT_ptr,
640 bool ownCppPtr=false);
642 SALOME_MED::FIELDINT_ptr createCorbaFieldInt(SALOME_MED::SUPPORT_ptr,
644 bool ownCppPtr=false);
646 SALOME_MED::SUPPORT_ptr createCorbaSupport(const SUPPORT *);
648 FIELDDOUBLE * createLocalFieldDouble(const int, const int);
650 FIELDINT * createLocalFieldInt(const int, const int);
652 SALOME_MED::MESH_ptr createCorbaMesh(MESH * mesh);
655 SALOME_MED::FIELDDOUBLE_ptr createCorbaFieldDouble(SALOME_MED::SUPPORT_ptr mySupportIOR,FIELDDOUBLE * field, bool ownCppPtr=false)
659 // MT : Keep the local field name
660 // field->setName("Corba Double Field");
662 field->setDescription("Got From A Local One");
664 FIELDTEMPLATE_I<double,FullInterlace> *fieldimpl = new FIELDTEMPLATE_I<double,FullInterlace>(field, ownCppPtr);
666 SALOME_MED::FIELDDOUBLE_ptr fieldcorba2 = fieldimpl->_this();
672 MESSAGE("Test de tirarge sur le pointeur Corba Field dans le cxx");
674 char * name = fieldcorba2->getName();
680 // try to set support to field
681 ::MEDMEM::SUPPORT * sup = 0;
682 if ( SUPPORT_i * sup_i = Med_Gen_i::DownCast< SUPPORT_i * >( mySupportIOR ))
684 std::map < int,::MEDMEM::SUPPORT *>::iterator index_supp =
685 SUPPORT_i::supportMap.find( sup_i->getCorbaIndex() );
686 if ( index_supp != SUPPORT_i::supportMap.end() )
687 sup = index_supp->second;
691 field->setSupport( sup );
696 SALOME_MED::FIELDINT_ptr createCorbaFieldInt(SALOME_MED::SUPPORT_ptr mySupportIOR,FIELDINT * field, bool ownCppPtr=false)
700 // MT : Keep the local field name
701 // field->setName("Corba Integer Field");
703 field->setDescription("Got From A Local One");
705 FIELDTEMPLATE_I<int,FullInterlace> * fieldimpl = new FIELDTEMPLATE_I<int,FullInterlace>(field, ownCppPtr);
707 SALOME_MED::FIELDINT_ptr fieldcorba2 = fieldimpl->_this();
713 MESSAGE("Test de tirarge sur le pointeur Corba Field dans le cxx");
715 char * name = fieldcorba2->getName();
721 // try to set support to field
722 ::MEDMEM::SUPPORT * sup = 0;
723 if ( SUPPORT_i * sup_i = Med_Gen_i::DownCast< SUPPORT_i * >( mySupportIOR ))
725 std::map < int,::MEDMEM::SUPPORT *>::iterator index_supp =
726 SUPPORT_i::supportMap.find( sup_i->getCorbaIndex() );
727 if ( index_supp != SUPPORT_i::supportMap.end() )
728 sup = index_supp->second;
732 field->setSupport( sup );
737 SALOME_MED::SUPPORT_ptr createCorbaSupport(const SUPPORT * const support)
741 SUPPORT_i * supportimpl = new SUPPORT_i(support);
743 SALOME_MED::SUPPORT_ptr supportcorba =
744 supportimpl->POA_SALOME_MED::SUPPORT::_this();
748 SCRUTE(supportcorba);
753 SALOME_MED::MESH_ptr createCorbaMesh(MESH * mesh)
757 MESH_i * meshimpl = new MESH_i(mesh);
759 SALOME_MED::MESH_ptr meshcorba =
760 meshimpl->POA_SALOME_MED::MESH::_this();
769 FIELDDOUBLE * createLocalFieldDouble(const int NumberOfComponents,
770 const int LengthValue)
772 SCRUTE(NumberOfComponents);
775 //FIELD<double> * fieldloc = new FIELD<double>();
776 FIELDDOUBLE * fieldloc = new FIELDDOUBLE();
777 fieldloc -> allocValue(NumberOfComponents,LengthValue);
782 FIELDINT * createLocalFieldInt(const int NumberOfComponents,
783 const int LengthValue)
785 SCRUTE(NumberOfComponents);
788 //FIELD<int> * fieldloc = new FIELD<int>();
789 FIELDINT * fieldloc = new FIELDINT();
790 fieldloc -> allocValue(NumberOfComponents,LengthValue);