From: barate Date: Thu, 26 Aug 2010 14:24:20 +0000 (+0000) Subject: Allow usage of BatchManager_eClient methods in Python X-Git-Tag: V1_2_0rc1~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a681deffb699972968f974885a8a6d576d880af8;hp=983b9637d51178045574789ef0429bb5dd3b40d4;p=tools%2Flibbatch.git Allow usage of BatchManager_eClient methods in Python --- diff --git a/src/Core/Batch_BatchManager_eClient.cxx b/src/Core/Batch_BatchManager_eClient.cxx index 1a6a488..a754645 100644 --- a/src/Core/Batch_BatchManager_eClient.cxx +++ b/src/Core/Batch_BatchManager_eClient.cxx @@ -141,7 +141,7 @@ namespace Batch { } - void BatchManager_eClient::importOutputFiles( const Job & job, const string directory ) throw(EmulationException) + void BatchManager_eClient::importOutputFiles( const Job & job, const string directory ) { Parametre params = job.getParametre(); Versatile V = params[OUTFILE]; @@ -187,7 +187,7 @@ namespace Batch { } - MpiImpl *BatchManager_eClient::FactoryMpiImpl(string mpiImpl) throw(EmulationException) + MpiImpl *BatchManager_eClient::FactoryMpiImpl(string mpiImpl) { if(mpiImpl == "lam") return new MpiImpl_LAM(); diff --git a/src/Core/Batch_BatchManager_eClient.hxx b/src/Core/Batch_BatchManager_eClient.hxx index 188a2df..326c58b 100644 --- a/src/Core/Batch_BatchManager_eClient.hxx +++ b/src/Core/Batch_BatchManager_eClient.hxx @@ -51,7 +51,7 @@ namespace Batch { BatchManager_eClient(const Batch::FactBatchManager * parent, const char* host="localhost", CommunicationProtocolType protocolType = SSH, const char* mpiImpl="mpich1"); virtual ~BatchManager_eClient(); - void importOutputFiles( const Job & job, const std::string directory ) throw(EmulationException); + void importOutputFiles( const Job & job, const std::string directory ); void setUsername(const std::string & username) {_username = username;} @@ -62,7 +62,7 @@ namespace Batch { std::string generateTemporaryFileName(const std::string & prefix); std::string createAndOpenTemporaryFile(const std::string & prefix, std::ofstream & outputStream); - MpiImpl* FactoryMpiImpl(std::string mpiImpl) throw(EmulationException); + MpiImpl* FactoryMpiImpl(std::string mpiImpl); void exportInputFiles(const Job & job); const std::string & getTmpDir(); diff --git a/src/Python/libBatch_Swig.i b/src/Python/libBatch_Swig.i index fb131ed..ac94be8 100644 --- a/src/Python/libBatch_Swig.i +++ b/src/Python/libBatch_Swig.i @@ -32,7 +32,7 @@ ========== Certaines classes ont des methodes surchargees et SWIG ne gere pas bien ces surcharges, d'ou un probleme d'utilisation en Python de celles-ci. - En bref, �a ne marche pas et il faudra corriger le probleme... + En bref, ca ne marche pas et il faudra corriger le probleme... TODO : corriger le probleme de surcharge des methodes en Python @@ -61,9 +61,13 @@ #include "Batch_JobId.hxx" #include "Batch_JobInfo.hxx" +#include "Batch_CommunicationProtocol.hxx" + #include "Batch_BatchManager.hxx" +#include "Batch_BatchManager_eClient.hxx" #include "Batch_BatchManagerCatalog.hxx" #include "Batch_FactBatchManager.hxx" +#include "Batch_FactBatchManager_eClient.hxx" %} /* Les classes exportees en Python */ @@ -76,9 +80,13 @@ %include Batch_JobId.hxx %include Batch_JobInfo.hxx +%include Batch_CommunicationProtocol.hxx + %include Batch_BatchManager.hxx +%include Batch_BatchManager_eClient.hxx %include Batch_BatchManagerCatalog.hxx %include Batch_FactBatchManager.hxx +%include Batch_FactBatchManager_eClient.hxx %include Batch_Constants.hxx diff --git a/src/Python/libBatch_Swig_typemap.i b/src/Python/libBatch_Swig_typemap.i index 543cb7a..e0958b2 100644 --- a/src/Python/libBatch_Swig_typemap.i +++ b/src/Python/libBatch_Swig_typemap.i @@ -210,3 +210,11 @@ typedef int Py_ssize_t; $1 = E; } +// Dynamic cast to FactBatchManager_eClient if necessary +%typemap(out) Batch::FactBatchManager * +{ + if(dynamic_cast($1)) + $result=SWIG_NewPointerObj((void*)$1,$descriptor(Batch::FactBatchManager_eClient *),$owner); + else + $result=SWIG_NewPointerObj((void*)$1,$descriptor(Batch::FactBatchManager *),$owner); +}