From 346b1c3663f9da44ad63eb301c1fac862288545f Mon Sep 17 00:00:00 2001 From: ribes Date: Mon, 14 Dec 2009 14:15:00 +0000 Subject: [PATCH] Merge from V5_1_main_20091214 --- idl/SALOME_Session.idl | 2 ++ src/Basics/Basics_DirUtils.cxx | 2 +- src/Basics/Basics_Utils.cxx | 10 +++++++ src/Basics/Basics_Utils.hxx | 9 ++++++ src/Container/Component_i.cxx | 15 +++++++++- src/Container/SALOME_Component_i.hxx | 2 ++ src/KERNEL_PY/salome_test.py | 5 ++-- .../SALOME_FileTransferCORBA.cxx | 1 + .../SALOME_ModuleCatalog_Server.cxx | 4 --- .../SALOME_ModuleCatalog_impl.cxx | 4 ++- src/NamingService/SALOME_NamingService.cxx | 1 + .../SALOME_ResourcesCatalog_Handler.cxx | 29 +++++++++++-------- src/SALOMEDS/SALOME_DriverPy.py | 3 +- .../SALOMEDSImpl_AttributeIOR.cxx | 2 +- src/SALOMEDSImpl/SALOMEDSImpl_IParameters.cxx | 1 - .../SALOMEDSImpl_ScalarVariable.cxx | 1 + src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx | 4 +++ src/SALOMELocalTrace/LocalTraceBufferPool.cxx | 1 + 18 files changed, 71 insertions(+), 25 deletions(-) diff --git a/idl/SALOME_Session.idl b/idl/SALOME_Session.idl index 502104a43..91d24cec9 100644 --- a/idl/SALOME_Session.idl +++ b/idl/SALOME_Session.idl @@ -89,6 +89,8 @@ module SALOME void ping(); //! Returns the PID of the server long getPID(); +//! Returns host name + string getHostname(); //! Get Active study ID long GetActiveStudyId(); //! Restores a state of the study at theSavePoint diff --git a/src/Basics/Basics_DirUtils.cxx b/src/Basics/Basics_DirUtils.cxx index e1682301f..613368ba0 100644 --- a/src/Basics/Basics_DirUtils.cxx +++ b/src/Basics/Basics_DirUtils.cxx @@ -24,7 +24,7 @@ // Module : SALOME // #include "Basics_DirUtils.hxx" - +#include #include #include diff --git a/src/Basics/Basics_Utils.cxx b/src/Basics/Basics_Utils.cxx index 10a12b74a..3be1e68c2 100644 --- a/src/Basics/Basics_Utils.cxx +++ b/src/Basics/Basics_Utils.cxx @@ -82,4 +82,14 @@ namespace Kernel_Utils return p; } + Localizer::Localizer() + { + myCurLocale = setlocale(LC_NUMERIC, 0); + setlocale(LC_NUMERIC, "C"); + } + + Localizer::~Localizer() + { + setlocale(LC_NUMERIC, myCurLocale.c_str()); + } } diff --git a/src/Basics/Basics_Utils.hxx b/src/Basics/Basics_Utils.hxx index ed99361c7..7ca83964a 100644 --- a/src/Basics/Basics_Utils.hxx +++ b/src/Basics/Basics_Utils.hxx @@ -34,6 +34,15 @@ namespace Kernel_Utils { BASICS_EXPORT std::string GetHostname(); + + class BASICS_EXPORT Localizer + { + public: + Localizer(); + ~Localizer(); + private: + std::string myCurLocale; + }; } #endif //_Basics_UTILS_HXX_ diff --git a/src/Container/Component_i.cxx b/src/Container/Component_i.cxx index 66d3cd22a..51e5b02d6 100644 --- a/src/Container/Component_i.cxx +++ b/src/Container/Component_i.cxx @@ -114,6 +114,7 @@ Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb, _contId = contId ; CORBA::Object_var o = _poa->id_to_reference(*contId); // container ior... _container=Engines::Container::_narrow(o); + setContainerName(); if(regist) { @@ -164,6 +165,7 @@ Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb, _orb = CORBA::ORB::_duplicate(orb); _poa = PortableServer::POA::_duplicate(poa); _container=Engines::Container::_duplicate(container); + setContainerName(); const CORBA::String_var ior = _orb->object_to_string(_container); if(regist) _myConnexionToRegistry = new RegistryConnexion(0, 0, ior,"theSession", _instanceName.c_str()); @@ -1046,6 +1048,17 @@ Engines_Component_i::configureSalome_file(std::string service_name, */ //============================================================================= std::string Engines_Component_i::getContainerName() +{ + return _containerName; +} +//============================================================================= +/*! + * C++ method: set the name of the container associated with this component (attribute _containerName) + * This name does not contains the "/Containers" string and all "/" are replaced by "_" + * \return the container name (reformatted) + */ +//============================================================================= +void Engines_Component_i::setContainerName() { CORBA::String_var containerName=_container->name(); std::string name(containerName); @@ -1053,5 +1066,5 @@ std::string Engines_Component_i::getContainerName() string::size_type slash =name.find_first_of('/'); if(slash != std::string::npos) name[slash]='_'; - return name; + _containerName=name; } diff --git a/src/Container/SALOME_Component_i.hxx b/src/Container/SALOME_Component_i.hxx index 652f637a7..364b4afcc 100644 --- a/src/Container/SALOME_Component_i.hxx +++ b/src/Container/SALOME_Component_i.hxx @@ -120,6 +120,7 @@ public: PortableServer::ObjectId * getId(); Engines_Container_i *GetContainerPtr(); std::string getContainerName(); + void setContainerName(); virtual bool setStudyId(CORBA::Long studyId); static bool isMultiStudy(); @@ -148,6 +149,7 @@ protected: std::string _instanceName ; std::string _interfaceName ; + std::string _containerName ; CORBA::ORB_var _orb; PortableServer::POA_var _poa; diff --git a/src/KERNEL_PY/salome_test.py b/src/KERNEL_PY/salome_test.py index c0818f45f..697feb2cf 100755 --- a/src/KERNEL_PY/salome_test.py +++ b/src/KERNEL_PY/salome_test.py @@ -261,8 +261,9 @@ print print "============= Test Supervisor =============================" print import salome_version -versions = salome_version.getVersions() -if versions[0] < 5: +version = salome_version.getVersions("GUI")[0] +if not version: version = salome_version.getVersions("KERNEL")[0] +if version < 5: # SUPERV module is avaiable comp = catalog.GetComponent("SUPERV") if comp is None: diff --git a/src/LifeCycleCORBA/SALOME_FileTransferCORBA.cxx b/src/LifeCycleCORBA/SALOME_FileTransferCORBA.cxx index 26e08da56..4601dce6f 100644 --- a/src/LifeCycleCORBA/SALOME_FileTransferCORBA.cxx +++ b/src/LifeCycleCORBA/SALOME_FileTransferCORBA.cxx @@ -28,6 +28,7 @@ #include "SALOME_LifeCycleCORBA.hxx" #include "utilities.h" #include "Basics_Utils.hxx" +#include using namespace std; diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx index 43c4b6d8c..9e5912f34 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx @@ -40,7 +40,6 @@ int main(int argc,char **argv) { // initialize the ORB CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); - // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb); try { CosNaming::NamingContext_var _rootContext, catalogContext; @@ -157,11 +156,9 @@ int main(int argc,char **argv) Utils_Timer timer; timer.Start(); timer.Stop(); - MESSAGE("SALOME_Registry_Server.cxx - orb->run()"); timer.ShowAbsolute(); #endif orb->run(); - std::cerr << "server returned from orb->run()" << std::endl; orb->destroy(); // mgr->deactivate(true,true); @@ -176,6 +173,5 @@ int main(int argc,char **argv) } END_OF( argv[0] ); - // delete myThreadTrace; return 0; } diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx index 865635705..621b34c03 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx @@ -27,6 +27,7 @@ // #include "SALOME_ModuleCatalog_impl.hxx" #include "SALOME_ModuleCatalog_Acomponent_impl.hxx" +#include #include #include #include "utilities.h" @@ -79,6 +80,8 @@ list splitStringToList(const string& theString, const string& theSeparat SALOME_ModuleCatalogImpl::SALOME_ModuleCatalogImpl(int argc, char** argv, CORBA::ORB_ptr orb) : _orb(orb) { if(MYDEBUG) MESSAGE("Catalog creation"); + /* Init libxml */ + xmlInitParser(); // Conversion rules for component types ComponentTypeConvert[GEOM] @@ -686,7 +689,6 @@ SALOME_ModuleCatalogImpl::_parse_xml_file(const char* file, MESSAGE("ModuleCatalog: could not parse file "< #include #include +#include using namespace std; diff --git a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx index be5a7661e..69ecec78b 100755 --- a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx +++ b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx @@ -145,13 +145,14 @@ void SALOME_ResourcesCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc) else { // Adding a machine - _resources_list[_resource.HostName] = _resource; - if(_resource.HostName == "localhost") - { - _resource.HostName = Kernel_Utils::GetHostname(); - _resource.DataForSort._hostName = Kernel_Utils::GetHostname(); - _resources_list[Kernel_Utils::GetHostname()] = _resource; - } + if(_resource.HostName == "localhost") + { + _resource.HostName = Kernel_Utils::GetHostname(); + _resource.DataForSort._hostName = Kernel_Utils::GetHostname(); + _resources_list[Kernel_Utils::GetHostname()] = _resource; + } + else + _resources_list[_resource.HostName] = _resource; } } else @@ -606,6 +607,7 @@ SALOME_ResourcesCatalog_Handler::ProcessMachine(xmlNodePtr machine_descr, Parser xmlNodePtr aCurSubNode = machine_descr->xmlChildrenNode; while(aCurSubNode != NULL) { + // Process components if ( !xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_components) ) { //If a component is given, it is in a module with the same name @@ -628,14 +630,17 @@ SALOME_ResourcesCatalog_Handler::ProcessMachine(xmlNodePtr machine_descr, Parser } } // Process modules - if ( !xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_modules) ) + else if ( !xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_modules) ) { + // If a module is given, we create an entry in componentsList and modulesList + // with the same name (module == component) if (xmlHasProp(aCurSubNode, (const xmlChar*)test_module_name)) { - xmlChar* module_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_module_name); - std::string aModuleName = (const char*)module_name; - resource.ModulesList.push_back(aModuleName); - xmlFree(module_name); + xmlChar* component_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_module_name); + std::string aComponentName = (const char*)component_name; + _resource.ComponentsList.push_back(aComponentName); + _resource.ModulesList.push_back(aComponentName); + xmlFree(component_name); } } aCurSubNode = aCurSubNode->next; diff --git a/src/SALOMEDS/SALOME_DriverPy.py b/src/SALOMEDS/SALOME_DriverPy.py index 87da46bd2..c76d4c9bd 100644 --- a/src/SALOMEDS/SALOME_DriverPy.py +++ b/src/SALOMEDS/SALOME_DriverPy.py @@ -23,7 +23,7 @@ ## @package SALOME_DriverPy # \brief python implementation of SALOMEDS::Driver interface # -# +# import SALOMEDS__POA ## Python implementation of generic SALOMEDS::Driver. @@ -35,7 +35,6 @@ class SALOME_DriverPy_i(SALOMEDS__POA.Driver): to provide persistence mechanism. """ def __init__ (self, componentDataType): - print "SALOME_DriverPy.__init__: ",componentDataType self._ComponentDataType = componentDataType def IORToLocalPersistentID(self, theSObject, IORString, isMultiFile, isASCII): diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx index 1c049a87f..965c83239 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx @@ -29,7 +29,7 @@ using namespace std; //to disable automatic genericobj management comment the following line -#define WITHGENERICOBJ +//#define WITHGENERICOBJ #ifdef WITHGENERICOBJ #include "SALOME_GenericObj_i.hh" diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_IParameters.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_IParameters.cxx index 6d4c99082..ff5cae558 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_IParameters.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_IParameters.cxx @@ -284,7 +284,6 @@ string SALOMEDSImpl_IParameters::getStudyScript(SALOMEDSImpl_Study* study, int s vector lst = ip.getValues(v[i]); dump += "# fill list "+v[i]+"\n"; for(int j = 0; j < lst.size(); j++) { - printf("### %s \nFind : %i\n",lst[j].c_str(), lst[j].find('\"')); if (lst[j].find('\"') == -1) dump += "ipar.append(\""+v[i]+"\", \""+lst[j]+"\")\n"; else diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_ScalarVariable.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_ScalarVariable.cxx index d40db227c..73803b063 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_ScalarVariable.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_ScalarVariable.cxx @@ -25,6 +25,7 @@ #include "SALOMEDSImpl_GenericVariable.hxx" #include #include +#include using namespace std; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx index 373058472..2b24641ad 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx @@ -28,6 +28,8 @@ using namespace std; +#include + #include "DF_Application.hxx" #include "DF_ChildIterator.hxx" @@ -904,6 +906,8 @@ string SALOMEDSImpl_Study::_GetStudyVariablesScript() if(myNoteBookVars.empty()) return dump; + + Kernel_Utils::Localizer loc; dump += "####################################################\n"; dump += "## Begin of NoteBook variables section ##\n"; diff --git a/src/SALOMELocalTrace/LocalTraceBufferPool.cxx b/src/SALOMELocalTrace/LocalTraceBufferPool.cxx index 1b384dc37..ac1712a44 100644 --- a/src/SALOMELocalTrace/LocalTraceBufferPool.cxx +++ b/src/SALOMELocalTrace/LocalTraceBufferPool.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #ifndef WIN32 #include -- 2.39.2