From f7bbe166dadeecf550291cabd71ed189ee328fb4 Mon Sep 17 00:00:00 2001 From: ribes Date: Wed, 26 Sep 2007 09:23:42 +0000 Subject: [PATCH] - Adding CallBack method --- src/Container/Component_i.cxx | 28 ++++++++++++-- src/Container/SALOME_Component_i.hxx | 5 +++ src/Container/Salome_file_i.cxx | 2 + .../SALOME_ParallelComponent_i.cxx | 37 +++++++++++++++++++ .../SALOME_ParallelComponent_i.hxx | 4 ++ .../SALOME_ParallelContainer_i.cxx | 2 +- 6 files changed, 74 insertions(+), 4 deletions(-) diff --git a/src/Container/Component_i.cxx b/src/Container/Component_i.cxx index 2e4875611..08b3e46e8 100644 --- a/src/Container/Component_i.cxx +++ b/src/Container/Component_i.cxx @@ -611,7 +611,8 @@ void Engines_Component_i::beginService(const char *serviceName) (*it).second >>= value; // ---todo: replace __GNUC__ test by an autoconf macro AC_CHECK_FUNC. #if defined __GNUC__ - int ret = setenv(cle.c_str(), value, overwrite); +// int ret = setenv(cle.c_str(), value, overwrite); + setenv(cle.c_str(), value, overwrite); #else //CCRT porting : setenv not defined in stdlib.h std::string s(cle); @@ -619,7 +620,8 @@ void Engines_Component_i::beginService(const char *serviceName) s+=value; // char* cast because 1st arg of linux putenv function // is not a const char* ! - int ret=putenv((char *)s.c_str()); +// int ret=putenv((char *)s.c_str()); + putenv((char *)s.c_str()); //End of CCRT porting #endif MESSAGE("--- setenv: "<second; + std::string file_port_name = begin->first; + configureSalome_file(service_name, file_port_name, file); file->recvFiles(); } } @@ -967,9 +971,27 @@ Engines_Component_i::checkOutputFilesToService(const char* service_name) for(;begin!=end;begin++) { Salome_file_i * file = begin->second; + std::string file_port_name = begin->first; + configureSalome_file(service_name, file_port_name, file); file->recvFiles(); } } } +//============================================================================= +/*! + * C++ method: used to configure the Salome_file into the runtime. + * \param service_name name of the service that use this Salome_file + * \param file_port_name name of the Salome_file + * \param file Salome_file C++ object + */ +//============================================================================= +void +Engines_Component_i::configureSalome_file(std::string service_name, + std::string file_port_name, + Salome_file_i * file) +{ + // By default this method does nothing +} + diff --git a/src/Container/SALOME_Component_i.hxx b/src/Container/SALOME_Component_i.hxx index c18d3d245..de8a42e0e 100644 --- a/src/Container/SALOME_Component_i.hxx +++ b/src/Container/SALOME_Component_i.hxx @@ -129,6 +129,11 @@ public: long CpuUsed() ; void CancelThread() ; + virtual void configureSalome_file(std::string service_name, + std::string file_port_name, + Salome_file_i * file); + + protected: int _studyId; // -1: not initialised; 0: multiStudy; >0: study static bool _isMultiStudy; diff --git a/src/Container/Salome_file_i.cxx b/src/Container/Salome_file_i.cxx index 720c62031..67de70206 100644 --- a/src/Container/Salome_file_i.cxx +++ b/src/Container/Salome_file_i.cxx @@ -710,10 +710,12 @@ Salome_file_i::recvFiles() { if (files_not_ok != "") { + std::cerr << "tutu" << std::endl; SALOME::ExceptionStruct es; es.type = SALOME::INTERNAL_ERROR; std::string text = "files not ready : " + files_not_ok; es.text = CORBA::string_dup(text.c_str()); + std::cerr << "titi" << std::endl; throw SALOME::SALOME_Exception(es); } else diff --git a/src/ParallelContainer/SALOME_ParallelComponent_i.cxx b/src/ParallelContainer/SALOME_ParallelComponent_i.cxx index 946423890..870c4dd92 100644 --- a/src/ParallelContainer/SALOME_ParallelComponent_i.cxx +++ b/src/ParallelContainer/SALOME_ParallelComponent_i.cxx @@ -1050,6 +1050,8 @@ Engines_Parallel_Component_i::checkInputFilesToService(const char* service_name) for(;begin!=end;begin++) { Engines::Parallel_Salome_file_proxy_impl * file = begin->second; + std::string file_port_name = begin->first; + configureSalome_file(service_name, file_port_name, file); file->recvFiles(); } } @@ -1067,17 +1069,29 @@ Engines_Parallel_Component_i::checkOutputFilesToService(const char* service_name for(;begin!=end;begin++) { Engines::Parallel_Salome_file_proxy_impl * file = begin->second; + std::string file_port_name = begin->first; + configureSalome_file(service_name, file_port_name, file); file->recvFiles(); } } } +//============================================================================= +/*! + * C++ method: Used by the Parallel Component to deploy a Parallel Salome_file + */ +//============================================================================= void Engines_Parallel_Component_i::send_parallel_proxy_object(CORBA::Object_ptr proxy_ref) { _proxy = _orb->object_to_string(proxy_ref); } +//============================================================================= +/*! + * C++ method: Used by the Parallel Component to deploy a Parallel Salome_file + */ +//============================================================================= void Engines_Parallel_Component_i::wait_parallel_object_proxy() { char * proxy = NULL; @@ -1089,7 +1103,30 @@ Engines_Parallel_Component_i::wait_parallel_object_proxy() { } } +//============================================================================= +/*! + * C++ method: Used by the Parallel Component to deploy a Parallel Salome_file + */ +//============================================================================= char * Engines_Parallel_Component_i::get_parallel_proxy_object() { return _proxy; } + + +//============================================================================= +/*! + * C++ method: used to configure the Salome_file into the runtime. + * \param service_name name of the service that use this Salome_file + * \param file_port_name name of the Salome_file + * \param file Parallel Salome_file C++ object + */ +//============================================================================= +void +Engines_Parallel_Component_i::configureSalome_file(std::string service_name, + std::string file_port_name, + Engines::Parallel_Salome_file_proxy_impl * file) +{ + // By default this method does nothing +} + diff --git a/src/ParallelContainer/SALOME_ParallelComponent_i.hxx b/src/ParallelContainer/SALOME_ParallelComponent_i.hxx index cad498524..afebfc896 100644 --- a/src/ParallelContainer/SALOME_ParallelComponent_i.hxx +++ b/src/ParallelContainer/SALOME_ParallelComponent_i.hxx @@ -137,6 +137,10 @@ public: void wait_parallel_object_proxy(); char * get_parallel_proxy_object(); + virtual void configureSalome_file(std::string service_name, + std::string file_port_name, + Engines::Parallel_Salome_file_proxy_impl * file); + protected: int _studyId; // -1: not initialised; 0: multiStudy; >0: study static bool _isMultiStudy; diff --git a/src/ParallelContainer/SALOME_ParallelContainer_i.cxx b/src/ParallelContainer/SALOME_ParallelContainer_i.cxx index b1063f369..9fbf89e85 100644 --- a/src/ParallelContainer/SALOME_ParallelContainer_i.cxx +++ b/src/ParallelContainer/SALOME_ParallelContainer_i.cxx @@ -704,7 +704,7 @@ Engines_Parallel_Container_i::createParallelInstance(string genericRegisterName, // in the nameing service. _numInstanceMutex.lock() ; // lock on the instance number _numInstance++ ; - int numInstance = _numInstance ; +// int numInstance = _numInstance ; _numInstanceMutex.unlock() ; } cerr << "Node " << getMyRank() << " entering in paco_barrier()" << endl; -- 2.39.2