From 611820b83f45f0772306b4ea9b3667159a781415 Mon Sep 17 00:00:00 2001 From: prascle Date: Thu, 20 Apr 2006 21:44:22 +0000 Subject: [PATCH] PR: swig for file transfer --- src/LifeCycleCORBA_SWIG/TestLifeCycleCORBA.py | 4 ++- .../libSALOME_LifeCycleCORBA.i | 36 ++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/LifeCycleCORBA_SWIG/TestLifeCycleCORBA.py b/src/LifeCycleCORBA_SWIG/TestLifeCycleCORBA.py index a03a556be..3d71bf21b 100644 --- a/src/LifeCycleCORBA_SWIG/TestLifeCycleCORBA.py +++ b/src/LifeCycleCORBA_SWIG/TestLifeCycleCORBA.py @@ -5,7 +5,9 @@ import os import Engines import LifeCycleCORBA -host = os.getenv( 'HOST' ) +import Utils_Identity +host = Utils_Identity.getShortHostName() +#host = os.getenv( 'HOST' ) lcc = LifeCycleCORBA.LifeCycleCORBA() diff --git a/src/LifeCycleCORBA_SWIG/libSALOME_LifeCycleCORBA.i b/src/LifeCycleCORBA_SWIG/libSALOME_LifeCycleCORBA.i index c9f3f0d3c..07cca118a 100644 --- a/src/LifeCycleCORBA_SWIG/libSALOME_LifeCycleCORBA.i +++ b/src/LifeCycleCORBA_SWIG/libSALOME_LifeCycleCORBA.i @@ -24,6 +24,7 @@ %{ #include "utilities.h" #include "SALOME_LifeCycleCORBA.hxx" +#include "SALOME_FileTransferCORBA.hxx" #include "SALOME_NamingService.hxx" #include "ServiceUnreachable.hxx" @@ -86,7 +87,7 @@ struct omniORBpyAPI { } -%typemap(python,out) Engines::Container_ptr, Engines::Component_ptr +%typemap(python,out) Engines::Container_ptr, Engines::Component_ptr, Engines::fileRef_ptr { MESSAGE("typemap out on CORBA object ptr"); SCRUTE($1); @@ -94,6 +95,13 @@ struct omniORBpyAPI { SCRUTE($result); } +%typemap(python,out) std::string, + string +{ + MESSAGE("typemap out on std::string"); + SCRUTE($1); + $result = PyString_FromString($1.c_str()); +} %typemap(typecheck) const Engines::MachineParameters &, Engines::MachineParameters const & @@ -101,6 +109,31 @@ struct omniORBpyAPI { $1 = PyDict_Check($input); } +%typemap(typecheck) std::string, + string +{ + $1 = PyString_Check($input); +} + +%typemap(python,in) std::string, + string +{ + MESSAGE("typemap in on std::string"); + std::string str; + if (PyString_Check($input) == 1) + { + char* value = PyString_AsString($input); + str = value; + $1 = str; + } + else + { + MESSAGE("Not a string"); + PyErr_SetString(PyExc_TypeError,"Must Be a Python string"); + return NULL; + } +} + %typemap(python,in) const Engines::MachineParameters & { @@ -174,3 +207,4 @@ struct omniORBpyAPI { } %include "SALOME_LifeCycleCORBA.hxx" +%include "SALOME_FileTransferCORBA.hxx" -- 2.39.2