From: prascle Date: Mon, 3 Apr 2006 09:12:26 +0000 (+0000) Subject: PR: mergefrom branch BR_OCC_For_3_1_0b1 tag mergeto_BR_PR_V320b1_31mar06 X-Git-Tag: T3_2_0b1_pre1~23 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=790d3b3f065f657d734dd183387ceff189418cf6;p=modules%2Fkernel.git PR: mergefrom branch BR_OCC_For_3_1_0b1 tag mergeto_BR_PR_V320b1_31mar06 --- diff --git a/configure.ac b/configure.ac index fe3a6b398..b897ecaaa 100644 --- a/configure.ac +++ b/configure.ac @@ -305,6 +305,17 @@ dnl localbatch_ok is set to yes by CHECK_LOCAL WITH_BATCH=no test x$openpbs_ok = xyes || test x$lsf_ok = xyes || test x$localbatch_ok = xyes && WITH_BATCH=yes + +AC_ARG_ENABLE(batch, + [AC_HELP_STRING([--enable-batch],[Batch [default=yes]])], + [case "${enableval}" in + yes) test x$openpbs_ok = xyes || test x$lsf_ok = xyes || test x$localbatch_ok = xyes && WITH_BATCH=yes;; + no) WITH_BATCH=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-batch) ;; + esac],[test x$openpbs_ok = xyes || test x$lsf_ok = xyes || test x$localbatch_ok = xyes && WITH_BATCH=yes]) + +echo Batch mode = $WITH_BATCH + AC_SUBST(WITH_BATCH) AM_CONDITIONAL(WITH_BATCH, [test x"$WITH_BATCH" = xyes]) @@ -365,7 +376,12 @@ function check_fatal_error { # -------------------------------------- -basic_mandatory_products="cc_ok threads_ok python_ok swig_ok hdf5_ok occ_ok" +if test x$corba_gen = xtrue; then + basic_mandatory_products="cc_ok threads_ok python_ok swig_ok hdf5_ok occ_ok" +else + basic_mandatory_products="cc_ok threads_ok python_ok hdf5_ok occ_ok" +fi + echo --- General mandatory products - Light configuration: summary $basic_mandatory_products check_fatal_error $basic_mandatory_products diff --git a/doc/SALOME_Application.txt b/doc/SALOME_Application.txt index 83e016276..890291cb0 100644 --- a/doc/SALOME_Application.txt +++ b/doc/SALOME_Application.txt @@ -7,7 +7,7 @@ SALOME Application Concept. Configuration for one or more computers rst2html doc.txt > doc.html -This document corresponds to SALOME2 3.1. (alpha version) +This document corresponds to SALOME2 3.2. (alpha version) +-------------------------------------------+ | **WORK in PROGRESS, INCOMPLETE DOCUMENT** | @@ -55,6 +55,12 @@ computer. Application Directory --------------------- +Two ways for creation of an application directory +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +First way - references to different module directories +'''''''''''''''''''''''''''''''''''''''''''''''''''''' + The script createAppli.sh in ${KERNEL_ROOT_DIR}/bin/salome creates an application directory with the given path in parameter. ${APPLI} is a path relative to ${HOME}. @@ -68,6 +74,23 @@ configure his own application. These files are described after, the list is: - CatalogResources.xml - SalomeApp.xml +Second way - one single virtual install directory +''''''''''''''''''''''''''''''''''''''''''''''''' + +The user must create an application directory in which he copies +appli_install.sh, appli_clean.sh and virtual_salome.py, +from ${KERNEL_ROOT_DIR}/bin/salome. + +appli_install.sh needs to be edited, to define a list of modules with their +install paths. +Then, the script appli_install.sh creates a virtual installation of SALOME +in the application directory (bin, lib, doc, share...), with, +for each file (executable, script, data,library, resources...), +symbolic links to the actual file. + +General rules +------------- + Directory ${APPLI} must be created on each computer of the application. The easiest way is to use the same relative path (to ${HOME}) on each computer. (Sometimes it is not possible to use the same path everywhere, for instance @@ -78,15 +101,22 @@ The ${APPLI} directory contains scripts for environment and runs. Environment scripts must be configured (by the user) on each computer. All the environment scripts are in the ${APPLI}/env.d directory. -The script ${APPLI}/envd sources **all** the files in ${APPLI}/env.d in +The script ${APPLI}/envd sources **all** the files (\*.sh) in ${APPLI}/env.d in alphanumeric order (after edition, think to remove backup files). the envd script is used by run scripts. -Proposal for env.d scripts -~~~~~~~~~~~~~~~~~~~~~~~~~~ +env.d scripts +~~~~~~~~~~~~~ + Each user **must define** his own configuration for these scripts, following -the above rules. **The following is only an example not working as it is**. +the above rules. With the virtual installation (second way, above), env.d +scripts are built by appli_install.sh (given it's parameters). Otherwise, the +scripts must be manually defined. + + + **The following is only an example proposed by createAppli.sh, + not working as it is**. atFirst.sh Sets the computer configuration not directly related to SALOME, @@ -118,7 +148,7 @@ runAppli runSession Launches a shell script in the SALOME application environment, with access - to the current SALOME session (naming service), if any. + to the current (last launched) SALOME session (naming service), if any. Without arguments, the script is interactive. With arguments, the script executes the command in the SALOME application environment. @@ -152,6 +182,7 @@ SalomeApp.xml This file is similar to the default given in ${GUI_ROOT_DIR}/share/salome/resources + CatalogRessources.xml This files describes all the computer the application can use. The given example is minimal and suppose ${APPLI} is the same relative path @@ -161,4 +192,87 @@ CatalogRessources.xml appliPath="my/specific/path/on/this/computer" +Examples of use +--------------- + +Launch a SALOME session with a GUI interface +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Launch is done with a command like:: + + ./runAppli --logger + +The --logger option means here : collect all the traces from the all the +distributed process, via CORBA, in a single file : logger.log. + +There are a lot of options, a complete list is given by:: + + ./runAppli --help + +Note that, without argument, runAppli is a non interactive Python application, +and, with arguments, runAppli is an interactive Python interpreter. + +Several options are already defined by default in SalomeApp.xml files. Optional +arguments given in the command override the SalomeApp.xml configuration. + +Several sessions can run simultaneously, each session use a different port for +CORBA naming service, so the sessions are totally separated from each other. + +When the GUI is closed, the different SALOME servers are still running. + +Close a SALOME session, kill all the servers +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Inside the interactive python interpreter you get when you use runAppli +with arguments, you can kill all the servers of your session with:: + + >>> killLocalPort() + +or the servers of all the sessions with:: + + >>> killAllPorts() + +If you have no active Python interpreter connected to your session, you can +kill all the SALOME servers of **all the sessions** on a given computer:: + + ./runSession killSalome.py + +Remember! it's the same in *Windows (R) operating system* [#]_ : +use the start menu to stop... + +When you use only one session at a time, you don't need more. + +To kill a given session (when several session are running), one needs +the naming service port number:: + + ./runSession killSalomeWithPort 2810 + +Note that the port number of the last launched session can be found on Linux, +in the prompt, within a runSession shell (see below). + +It is also possible to get the Naming Service host and port number of +the last launched session with:: + + ./runSession NSparam.py + +.. [#] Microsoft and Windows are either registered trademarks or trademarks of + Microsoft Corporation in the United States and/or other countries. + +Different uses of the runSession shell interpreter +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +runSession invoked without arguments gives an interactive shell with the full +environment of SALOME (PATH, LD_LIBRARY_PATH, PYTHONPATH, other variables). +If there are running sessions of the same SALOME application, runSession +connects to the last launched session (i.e. gets the naming service references +of the session: hostname and port) + +On Linux, the shell prompt (bash) gives information on naming service +references, hostname and port:: + + [NS=cli76cc:2811]prascle@cli76cc:~/SALOME2/Run/Virtual$ + +If there is no running session, prompt looks like:: + + [NS=:]prascle@cli76cc:~/SALOME2/Run/Virtual$ diff --git a/doc/salome/tui/KERNEL/doxyfile b/doc/salome/tui/KERNEL/doxyfile index 1cb1191e8..c19b684b2 100755 --- a/doc/salome/tui/KERNEL/doxyfile +++ b/doc/salome/tui/KERNEL/doxyfile @@ -56,17 +56,23 @@ WARN_LOGFILE = log.txt #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- -INPUT = ../../../share/salome/idl/SALOME_ModuleCatalog.idl \ - ../../../share/salome/idl/SALOMEDS.idl \ - ../../../share/salome/idl/SALOME_Exception.idl \ - ../../../share/salome/idl/SALOMEDS_Attributes.idl \ - ../../../share/salome/idl/SALOME_Component.idl \ - ../../../share/salome/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx \ - ../../../share/salome/src/NamingService/SALOME_NamingService.hxx \ - ../../../share/salome/src/NamingService/SALOME_NamingService.cxx \ - ../../../share/salome/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx -FILE_PATTERNS = -RECURSIVE = NO +INPUT = ../../../../share/salome/idl/SALOME_ModuleCatalog.idl \ + ../../../../share/salome/idl/SALOMEDS.idl \ + ../../../../share/salome/idl/SALOME_Exception.idl \ + ../../../../share/salome/idl/SALOMEDS_Attributes.idl \ + ../../../../share/salome/idl/SALOME_Component.idl \ + ../../../../share/salome/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx \ + ../../../../share/salome/src/NamingService/SALOME_NamingService.hxx \ + ../../../../share/salome/src/NamingService/SALOME_NamingService.cxx \ + ../../../../share/salome/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx \ + ../../../../build/salome/bin/salome \ + ../../../../build/salome/src/Batch_SWIG \ + ../../../../build/salome/src/Communication_SWIG \ + ../../../../build/salome/src/LifeCycleCORBA_SWIG \ + ../../../../build/salome/src/LifeCycleCORBA_SWIG \ + ../../../../build/salome/src/NOTIFICATION_SWIG +FILE_PATTERNS = *.idl *.hxx *.cxx python_extension_must_be_here +RECURSIVE = YES EXCLUDE = EXCLUDE_SYMLINKS = NO EXCLUDE_PATTERNS = diff --git a/doc/salome/tui/Makefile.am b/doc/salome/tui/Makefile.am index 09511f953..a1e17c6a6 100644 --- a/doc/salome/tui/Makefile.am +++ b/doc/salome/tui/Makefile.am @@ -16,10 +16,26 @@ userdoc: cp -fr $(srcdir)/KERNEL ./INPUT; \ cd INPUT; \ sed 's|../../../share/salome|@top_srcdir@|' ./doxyfile > ./doxyfile1; \ + sed 's|../../../build/salome|@top_builddir@|' ./doxyfile1 > ./doxyfile2; \ + mv -f doxyfile2 doxyfile1; \ + echo "DOXYGEN SUPPORT PYTHON - $(DOXYGEN_WITH_PYTHON)"; \ + if( test "x$(DOXYGEN_WITH_PYTHON)" = "xyes"); then \ + sed 's|python_extension_must_be_here|*.py|' ./doxyfile1 > ./doxyfile2; \ + mv -f doxyfile2 doxyfile1; \ + $(DOXYGEN) -u ./doxyfile1; \ + else \ + sed 's|python_extension_must_be_here||' ./doxyfile1 > ./doxyfile2; \ + mv -f doxyfile2 doxyfile1; \ + fi; \ + if( test "x$(DOXYGEN_WITH_STL)" = "xyes"); then \ + sed -e 's|BUILTIN_STL_SUPPORT = NO|BUILTIN_STL_SUPPORT = YES|' ./doxyfile1 > ./doxyfile2; \ + mv -f doxyfile2 doxyfile1; \ + fi; \ mv -f doxyfile1 doxyfile; \ $(DOXYGEN) ./doxyfile; \ cd ..; - $(INSTALL) -d $(docdir)/tui/KERNEL; + $(INSTALL) -d $(docdir)/tui/KERNEL; + cp -fr KERNEL $(docdir)/tui cp -fr $(srcdir)/KERNEL/sources/static/*.* $(docdir)/tui/KERNEL; cp -fr $(srcdir)/KERNEL/sources/ $(docdir)/tui/KERNEL; cp -fr $(srcdir)/KERNEL/HTML/ $(docdir)/tui/KERNEL; diff --git a/idl/SALOME_TestModuleCatalog.idl b/idl/SALOME_TestModuleCatalog.idl index 80f5be229..b497fdb11 100644 --- a/idl/SALOME_TestModuleCatalog.idl +++ b/idl/SALOME_TestModuleCatalog.idl @@ -27,7 +27,7 @@ #include "SALOME_Component.idl" -module SuperVisionTest { +module CatalogTest { interface Adder ; diff --git a/salome_adm/unix/config_files/check_htmlgen.m4 b/salome_adm/unix/config_files/check_htmlgen.m4 index 6f46e9fba..8e42b102e 100644 --- a/salome_adm/unix/config_files/check_htmlgen.m4 +++ b/salome_adm/unix/config_files/check_htmlgen.m4 @@ -12,6 +12,49 @@ then AC_MSG_WARN(doxygen not found) doxygen_ok=no fi +if test "x$doxygen_ok" = "xyes" +then + version=`$DOXYGEN --version` + AC_MSG_RESULT(doxygen version $version) + case "$version" in + 1.4.4*) + DOXYGEN_WITH_PYTHON=yes + DOXYGEN_WITH_STL=no + ;; + 1.4.5*) + DOXYGEN_WITH_PYTHON=yes + DOXYGEN_WITH_STL=yes + ;; + 1.4.6*) + DOXYGEN_WITH_PYTHON=yes + DOXYGEN_WITH_STL=yes + ;; + 1.4.7*) + DOXYGEN_WITH_PYTHON=yes + DOXYGEN_WITH_STL=yes + ;; + 1.4.8*) + DOXYGEN_WITH_PYTHON=yes + DOXYGEN_WITH_STL=yes + ;; + 1.4.9*) + DOXYGEN_WITH_PYTHON=yes + DOXYGEN_WITH_STL=yes + ;; + [1-9].[5-9]*) + DOXYGEN_WITH_PYTHON=yes + DOXYGEN_WITH_STL=yes + ;; + *) + DOXYGEN_WITH_PYTHON=no + DOXYGEN_WITH_STL=no + ;; + esac + AC_MSG_RESULT(doxygen with support STL - $DOXYGEN_WITH_STL) + AC_MSG_RESULT(doxygen with support PYTHON - $DOXYGEN_WITH_PYTHON) + AC_SUBST(DOXYGEN_WITH_PYTHON) + AC_SUBST(DOXYGEN_WITH_STL) +fi dnl AC_SUBST(DOXYGEN) graphviz_ok=yes diff --git a/src/SALOMEDS/Makefile.am b/src/SALOMEDS/Makefile.am index 7a8263368..f0b80d248 100644 --- a/src/SALOMEDS/Makefile.am +++ b/src/SALOMEDS/Makefile.am @@ -307,7 +307,7 @@ libSalomeDS_la_SOURCES = \ SALOMEDS_TMPFile_i.hxx libSalomeDS_la_CPPFLAGS = $(COMMON_CPPFLAGS) -libSalomeDS_la_LDFLAGS = -no-undefined -version-info=0:0:0 +libSalomeDS_la_LDFLAGS = -Wl,-E -no-undefined -version-info=0:0:0 @LDEXPDYNFLAGS@ libSalomeDS_la_LIBADD = $(COMMON_LIBS) # diff --git a/src/SALOMEDS/SALOMEDS.cxx b/src/SALOMEDS/SALOMEDS.cxx index 4a35577e1..c0a6bf309 100644 --- a/src/SALOMEDS/SALOMEDS.cxx +++ b/src/SALOMEDS/SALOMEDS.cxx @@ -26,27 +26,34 @@ // Module : SALOME // $Header$ -#ifndef WNT +#ifdef WNT #include #include #include #include +#include #include #include +#include +#include #include #else #include "SALOMEDS.hxx" #include "SALOMEDS_StudyManager.hxx" #include "SALOMEDS_Study.hxx" +#include "SALOMEDS_StudyBuilder.hxx" #include "SALOMEDS_SObject.hxx" #include "SALOMEDS_SComponent.hxx" #include "SALOMEDSClient.hxx" +#include "SALOMEDSClient_IParameters.hxx" +#include "SALOMEDS_IParameters.hxx" #include "SALOMEDS_StudyManager_i.hxx" #endif // IDL headers #include #include CORBA_SERVER_HEADER(SALOMEDS) +#include using namespace SALOMEDS; @@ -92,26 +99,70 @@ SALOMEDSClient_StudyManager* StudyManagerFactory() SALOMEDSClient_Study* StudyFactory(SALOMEDS::Study_ptr theStudy) { + if(CORBA::is_nil(theStudy)) return NULL; return new SALOMEDS_Study(theStudy); } SALOMEDSClient_SObject* SObjectFactory(SALOMEDS::SObject_ptr theSObject) { + if(CORBA::is_nil(theSObject)) return NULL; return new SALOMEDS_SObject(theSObject); } SALOMEDSClient_SComponent* SComponentFactory(SALOMEDS::SComponent_ptr theSComponent) { + if(CORBA::is_nil(theSComponent)) return NULL; return new SALOMEDS_SComponent(theSComponent); } +SALOMEDSClient_StudyBuilder* BuilderFactory(SALOMEDS::StudyBuilder_ptr theBuilder) +{ + if(CORBA::is_nil(theBuilder)) return NULL; + return new SALOMEDS_StudyBuilder(theBuilder); +} + SALOMEDSClient_StudyManager* CreateStudyManager(CORBA::ORB_ptr orb, PortableServer::POA_ptr root_poa) { - SALOMEDS_StudyManager_i * aStudyManager_i = new SALOMEDS_StudyManager_i(orb, root_poa); - // Activate the objects. This tells the POA that the objects are ready to accept requests. - PortableServer::ObjectId_var aStudyManager_iid = root_poa->activate_object(aStudyManager_i); - aStudyManager_i->register_name("/myStudyManager"); + cout << "############## CreateStudyManager" << endl; + SALOME_NamingService namingService(orb); + CORBA::Object_var obj = namingService.Resolve( "/myStudyManager" ); + SALOMEDS::StudyManager_var theManager = SALOMEDS::StudyManager::_narrow( obj ); + if( CORBA::is_nil(theManager) ) { + SALOMEDS_StudyManager_i * aStudyManager_i = new SALOMEDS_StudyManager_i(orb, root_poa); + // Activate the objects. This tells the POA that the objects are ready to accept requests. + PortableServer::ObjectId_var aStudyManager_iid = root_poa->activate_object(aStudyManager_i); + aStudyManager_i->register_name("/myStudyManager"); + } return new SALOMEDS_StudyManager(); } +SALOMEDSClient_IParameters* GetIParameters(const _PTR(AttributeParameter)& ap) +{ + return new SALOMEDS_IParameters(ap); +} + + +SALOMEDS::SObject_ptr ConvertSObject(const _PTR(SObject)& theSObject) +{ + + SALOMEDS_SObject* so = _CAST(SObject, theSObject); + if(!theSObject || !so) return SALOMEDS::SObject::_nil(); + return so->GetSObject(); +} + +SALOMEDS::Study_ptr ConvertStudy(const _PTR(Study)& theStudy) +{ + SALOMEDS_Study* study = _CAST(Study, theStudy); + if(!theStudy || !study) return SALOMEDS::Study::_nil(); + return study->GetStudy(); +} + +SALOMEDS::StudyBuilder_ptr ConvertBuilder(const _PTR(StudyBuilder)& theBuilder) +{ + SALOMEDS_StudyBuilder* builder = _CAST(StudyBuilder, theBuilder); + if(!theBuilder || !builder) return SALOMEDS::StudyBuilder::_nil(); + return builder->GetBuilder(); +} + + } diff --git a/src/SALOMEDS/SALOMEDS_IParameters.hxx b/src/SALOMEDS/SALOMEDS_IParameters.hxx index 4111e83f9..9c0e95760 100644 --- a/src/SALOMEDS/SALOMEDS_IParameters.hxx +++ b/src/SALOMEDS/SALOMEDS_IParameters.hxx @@ -24,11 +24,12 @@ #include #include "SALOMEDSClient.hxx" +#include "SALOMEDSClient_IParameters.hxx" /*! Class which an interface to store the parameters of the objects */ -class SALOMEDS_IParameters +class SALOMEDS_IParameters: public SALOMEDSClient_IParameters { public: SALOMEDS_IParameters(const _PTR(AttributeParameter)& ap); @@ -127,17 +128,17 @@ public: /*! Enables/Disables the dumping visual parameters */ - static void setDumpPython(_PTR(Study) study, const std::string& theID = ""); + virtual void setDumpPython(_PTR(Study) study, const std::string& theID = ""); /*! Returns whether there is the dumping visual parameters */ - static bool isDumpPython(_PTR(Study) study, const std::string& theID = ""); + virtual bool isDumpPython(_PTR(Study) study, const std::string& theID = ""); /*! Returns a default name of the component where the visula parameters are stored. */ - static std::string getDefaultVisualComponent(); + virtual std::string getDefaultVisualComponent(); private: _PTR(AttributeParameter) _ap; diff --git a/src/SALOMEDS/SALOMEDS_SComponent.cxx b/src/SALOMEDS/SALOMEDS_SComponent.cxx index f061fcc5f..3f104bcfe 100644 --- a/src/SALOMEDS/SALOMEDS_SComponent.cxx +++ b/src/SALOMEDS/SALOMEDS_SComponent.cxx @@ -76,15 +76,14 @@ bool SALOMEDS_SComponent::ComponentIOR(std::string& theID) SALOMEDS::SComponent_ptr SALOMEDS_SComponent::GetSComponent() { - if (_isLocal) { - if (!CORBA::is_nil(_corba_impl)) return SALOMEDS::SComponent::_narrow(GetCORBAImpl()); - SALOMEDS::SComponent_var aSCO = - SALOMEDS_SComponent_i::New(Handle(SALOMEDSImpl_SComponent)::DownCast(GetLocalImpl()), _orb); + if(_isLocal) { + if(!CORBA::is_nil(_corba_impl)) return SALOMEDS::SComponent::_duplicate(SALOMEDS::SComponent::_narrow(GetCORBAImpl())); + SALOMEDS::SComponent_var aSCO = SALOMEDS_SComponent_i::New(Handle(SALOMEDSImpl_SComponent)::DownCast(GetLocalImpl()), _orb); + _corba_impl = SALOMEDS::SComponent::_duplicate(aSCO); return aSCO._retn(); } else { - return SALOMEDS::SComponent::_narrow(GetCORBAImpl()); + return SALOMEDS::SComponent::_duplicate(SALOMEDS::SComponent::_narrow(GetCORBAImpl())); } - return SALOMEDS::SComponent::_nil(); } diff --git a/src/SALOMEDS/SALOMEDS_SObject.cxx b/src/SALOMEDS/SALOMEDS_SObject.cxx index 233c5fca8..d11a3cb1c 100644 --- a/src/SALOMEDS/SALOMEDS_SObject.cxx +++ b/src/SALOMEDS/SALOMEDS_SObject.cxx @@ -33,6 +33,7 @@ #include "SALOMEDS_SComponent.hxx" #include "SALOMEDS_GenericAttribute.hxx" #include "SALOMEDS_Study.hxx" +#include "SALOMEDS_SObject_i.hxx" #include "SALOMEDSImpl_SComponent.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" @@ -310,12 +311,13 @@ CORBA::Object_ptr SALOMEDS_SObject::GetObject() SALOMEDS::SObject_ptr SALOMEDS_SObject::GetSObject() { if(_isLocal) { - if(!CORBA::is_nil(_corba_impl)) return _corba_impl; + if(!CORBA::is_nil(_corba_impl)) return SALOMEDS::SObject::_duplicate(_corba_impl); SALOMEDS::SObject_var aSO = SALOMEDS_SObject_i::New(_local_impl, _orb); + _corba_impl = SALOMEDS::SObject::_duplicate(aSO); return aSO._retn(); } else { - return _corba_impl; + return SALOMEDS::SObject::_duplicate(_corba_impl); } return SALOMEDS::SObject::_nil(); } diff --git a/src/SALOMEDS/SALOMEDS_SObject.hxx b/src/SALOMEDS/SALOMEDS_SObject.hxx index f947d1ad0..6ac8f1d26 100644 --- a/src/SALOMEDS/SALOMEDS_SObject.hxx +++ b/src/SALOMEDS/SALOMEDS_SObject.hxx @@ -33,7 +33,6 @@ #include #include CORBA_SERVER_HEADER(SALOMEDS) -#include "SALOMEDS_SObject_i.hxx" #include "SALOMEDSImpl_SObject.hxx" class Standard_EXPORT SALOMEDS_SObject: public virtual SALOMEDSClient_SObject diff --git a/src/SALOMEDS/SALOMEDS_Study.cxx b/src/SALOMEDS/SALOMEDS_Study.cxx index 67220592e..c3e572f21 100644 --- a/src/SALOMEDS/SALOMEDS_Study.cxx +++ b/src/SALOMEDS/SALOMEDS_Study.cxx @@ -665,7 +665,7 @@ SALOMEDS::Study_ptr SALOMEDS_Study::GetStudy() if (_isLocal) { SALOMEDS::Locker lock; - if (!CORBA::is_nil(_corba_impl)) return _corba_impl; + if (!CORBA::is_nil(_corba_impl)) return SALOMEDS::Study::_duplicate(_corba_impl); std::string anIOR = _local_impl->GetTransientReference().ToCString(); SALOMEDS::Study_var aStudy; if (!_local_impl->IsError() && anIOR != "") { @@ -676,15 +676,17 @@ SALOMEDS::Study_ptr SALOMEDS_Study::GetStudy() aStudy = aStudy_servant->_this(); _local_impl->SetTransientReference(_orb->object_to_string(aStudy)); } + _corba_impl = SALOMEDS::Study::_duplicate(aStudy); return aStudy._retn(); } else { - return _corba_impl; + return SALOMEDS::Study::_duplicate(_corba_impl); } return SALOMEDS::Study::_nil(); } + _PTR(AttributeParameter) SALOMEDS_Study::GetCommonParameters(const string& theID, int theSavePoint) { SALOMEDSClient_AttributeParameter* AP = NULL; diff --git a/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx b/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx index e11a77eb4..d7c12eb6d 100644 --- a/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx @@ -32,6 +32,7 @@ #include "SALOMEDS_SComponent.hxx" #include "SALOMEDS_GenericAttribute.hxx" #include "SALOMEDS_StudyManager.hxx" +#include "SALOMEDS_StudyBuilder_i.hxx" #include "SALOMEDS_Driver_i.hxx" @@ -515,6 +516,21 @@ void SALOMEDS_StudyBuilder::SetIOR(const _PTR(SObject)& theSO, const std::string else _corba_impl->SetIOR(aSO->GetCORBAImpl(), (char*)theValue.c_str()); } +SALOMEDS::StudyBuilder_ptr SALOMEDS_StudyBuilder::GetBuilder() +{ + if(_isLocal) { + if(!CORBA::is_nil(_corba_impl)) return SALOMEDS::StudyBuilder::_duplicate(_corba_impl); + SALOMEDS_StudyBuilder_i* servant = new SALOMEDS_StudyBuilder_i(_local_impl, _orb); + SALOMEDS::StudyBuilder_var aBuilder = servant->StudyBuilder::_this(); + _corba_impl = SALOMEDS::StudyBuilder::_duplicate(aBuilder); + return aBuilder._retn(); + } + else { + return SALOMEDS::StudyBuilder::_duplicate(_corba_impl); + } + return SALOMEDS::StudyBuilder::_nil(); +} + void SALOMEDS_StudyBuilder::init_orb() { ORB_INIT &init = *SINGLETON_::Instance(); diff --git a/src/SALOMEDS/SALOMEDS_StudyBuilder.hxx b/src/SALOMEDS/SALOMEDS_StudyBuilder.hxx index a40e19e4c..0db1647ab 100644 --- a/src/SALOMEDS/SALOMEDS_StudyBuilder.hxx +++ b/src/SALOMEDS/SALOMEDS_StudyBuilder.hxx @@ -80,6 +80,8 @@ public: virtual void SetComment(const _PTR(SObject)& theSO, const std::string& theValue); virtual void SetIOR(const _PTR(SObject)& theSO, const std::string& theValue); + SALOMEDS::StudyBuilder_ptr GetBuilder(); + private: void CheckLocked(); void init_orb(); diff --git a/src/SALOMEDSClient/Makefile.am b/src/SALOMEDSClient/Makefile.am index f74e21151..cf4b48561 100644 --- a/src/SALOMEDSClient/Makefile.am +++ b/src/SALOMEDSClient/Makefile.am @@ -48,6 +48,7 @@ salomeinclude_HEADERS=\ SALOMEDSClient_UseCaseBuilder.hxx \ SALOMEDSClient_UseCaseIterator.hxx \ SALOMEDSClient_ClientFactory.hxx \ + SALOMEDSClient_IParameters.hxx \ SALOMEDSClient.hxx # @@ -79,5 +80,5 @@ libSalomeDSClient_la_SOURCES = \ libSalomeDSClient_la_CPPFLAGS = $(COMMON_CPPFLAGS) -libSalomeDSClient_la_LDFLAGS = -no-undefined -version-info=0:0:0 +libSalomeDSClient_la_LDFLAGS = -Wl,-E -no-undefined -version-info=0:0:0 libSalomeDSClient_la_LIBADD = $(COMMON_LIBS) diff --git a/src/SALOMEDSClient/SALOMEDSClient_ClientFactory.cxx b/src/SALOMEDSClient/SALOMEDSClient_ClientFactory.cxx index 4b5e23b59..4e29d1b5d 100644 --- a/src/SALOMEDSClient/SALOMEDSClient_ClientFactory.cxx +++ b/src/SALOMEDSClient/SALOMEDSClient_ClientFactory.cxx @@ -13,20 +13,36 @@ static void* _libHandle = NULL; #define SOBJECT_FACTORY "SObjectFactory" #define SCOMPONENT_FACTORY "SComponentFactory" #define STUDY_FACTORY "StudyFactory" +#define BUILDER_FACTORY "BuilderFactory" #define STUDYMANAGER_FACTORY "StudyManagerFactory" #define STUDYMANAGER_CREATE "CreateStudyManager" +#define GET_PARAMETERS "GetIParameters" +#define CONVERT_SOBJECT "ConvertSObject" +#define CONVERT_STUDY "ConvertStudy" +#define CONVERT_BUILDER "ConvertBuilder" typedef SALOMEDSClient_SObject* (*SOBJECT_FACTORY_FUNCTION) (SALOMEDS::SObject_ptr); typedef SALOMEDSClient_SComponent* (*SCOMPONENT_FACTORY_FUNCTION) (SALOMEDS::SComponent_ptr); typedef SALOMEDSClient_Study* (*STUDY_FACTORY_FUNCTION) (SALOMEDS::Study_ptr); typedef SALOMEDSClient_StudyManager* (*STUDYMANAGER_FACTORY_FUNCTION) (); +typedef SALOMEDSClient_StudyBuilder* (*BUILDER_FACTORY_FUNCTION) (SALOMEDS::StudyBuilder_ptr); typedef SALOMEDSClient_StudyManager* (*STUDYMANAGER_CREATE_FUNCTION) (CORBA::ORB_ptr, PortableServer::POA_ptr); +typedef SALOMEDSClient_IParameters* (*GET_PARAMETERS_FACTORY) (const _PTR(AttributeParameter)&); +typedef SALOMEDS::SObject_ptr (*CONVERT_SOBJECT_FUNCTION) (const _PTR(SObject)&); +typedef SALOMEDS::Study_ptr (*CONVERT_STUDY_FUNCTION) (const _PTR(Study)&); +typedef SALOMEDS::StudyBuilder_ptr (*CONVERT_BUILDER_FUNCTION) (const _PTR(StudyBuilder)&); + static SOBJECT_FACTORY_FUNCTION aSObjectFactory = NULL; static SCOMPONENT_FACTORY_FUNCTION aSComponentFactory = NULL; static STUDY_FACTORY_FUNCTION aStudyFactory = NULL; +static BUILDER_FACTORY_FUNCTION aBuilderFactory = NULL; static STUDYMANAGER_FACTORY_FUNCTION aManagerFactory = NULL; static STUDYMANAGER_CREATE_FUNCTION aCreateFactory = NULL; +static GET_PARAMETERS_FACTORY aGetIParameters = NULL; +static CONVERT_SOBJECT_FUNCTION aConvertSObject = NULL; +static CONVERT_STUDY_FUNCTION aConvertStudy = NULL; +static CONVERT_BUILDER_FUNCTION aConvertBuilder = NULL; using namespace std; @@ -78,6 +94,22 @@ _PTR(Study) ClientFactory::Study(SALOMEDS::Study_ptr theStudy) return _PTR(Study)(study); } +_PTR(StudyBuilder) ClientFactory::StudyBuilder(SALOMEDS::StudyBuilder_ptr theStudyBuilder) +{ + SALOMEDSClient_StudyBuilder* studyBuilder = NULL; + +#ifdef WIN32 + if(!_libHandle) _libHandle = ::LoadLibrary(SALOMEDS_LIB_NAME); + if(!aBuilderFactory) aBuilderFactory = (BUILDER_FACTORY_FUNCTION)::GetProcAddress(_libHandle, BUILDER_FACTORY); +#else + if(!_libHandle) _libHandle = dlopen(SALOMEDS_LIB_NAME, RTLD_LAZY | RTLD_GLOBAL); + if(!aBuilderFactory) aBuilderFactory = (BUILDER_FACTORY_FUNCTION) dlsym(_libHandle, BUILDER_FACTORY); +#endif + + if(aBuilderFactory) studyBuilder = aBuilderFactory(theStudyBuilder); + return _PTR(StudyBuilder)(studyBuilder); +} + _PTR(StudyManager) ClientFactory::StudyManager() { SALOMEDSClient_StudyManager* manager = NULL; @@ -110,3 +142,73 @@ _PTR(StudyManager) ClientFactory::createStudyManager(CORBA::ORB_ptr orb, Portabl return _PTR(StudyManager)(manager); } +_PTR(IParameters) ClientFactory::getIParameters(const _PTR(AttributeParameter)& ap) +{ + SALOMEDSClient_IParameters* interface = NULL; + +#ifdef WIN32 + if(!_libHandle) _libHandle = ::LoadLibrary(SALOMEDS_LIB_NAME); + if(!aGetIParameters) aGetIParameters = (GET_PARAMETERS_FACTORY)::GetProcAddress(_libHandle, GET_PARAMETERS); +#else + if(!_libHandle) _libHandle = dlopen(SALOMEDS_LIB_NAME, RTLD_LAZY | RTLD_GLOBAL); + if(!aGetIParameters) aGetIParameters = (GET_PARAMETERS_FACTORY) dlsym(_libHandle, GET_PARAMETERS); +#endif + + if(aGetIParameters) interface = aGetIParameters(ap); + return _PTR(IParameters)(interface); +} + +SALOMEDS::SObject_ptr ClientFactory::crbSObject(const _PTR(SObject)& theSObject) +{ + SALOMEDS::SObject_var so; + +#ifdef WIN32 + if(!_libHandle) _libHandle = ::LoadLibrary(SALOMEDS_LIB_NAME); + if(!aConvertSObject) aConvertSObject = (CONVERT_SOBJECT_FUNCTION)::GetProcAddress(_libHandle, CONVERT_SOBJECT); +#else + if(!_libHandle) _libHandle = dlopen(SALOMEDS_LIB_NAME, RTLD_LAZY | RTLD_GLOBAL); + if(!aConvertSObject) aConvertSObject = (CONVERT_SOBJECT_FUNCTION) dlsym(_libHandle, CONVERT_SOBJECT); +#endif + + if(aConvertSObject) so = aConvertSObject(theSObject); + + if(CORBA::is_nil(so)) return SALOMEDS::SObject::_nil(); + return so._retn(); +} + + +SALOMEDS::Study_ptr ClientFactory::crbStudy(const _PTR(Study)& theStudy) +{ + SALOMEDS::Study_var study; + +#ifdef WIN32 + if(!_libHandle) _libHandle = ::LoadLibrary(SALOMEDS_LIB_NAME); + if(!aConvertStudy) aConvertStudy = (CONVERT_STUDY_FUNCTION)::GetProcAddress(_libHandle, CONVERT_STUDY); +#else + if(!_libHandle) _libHandle = dlopen(SALOMEDS_LIB_NAME, RTLD_LAZY | RTLD_GLOBAL); + if(!aConvertStudy) aConvertStudy = (CONVERT_STUDY_FUNCTION) dlsym(_libHandle, CONVERT_STUDY); +#endif + + if(aConvertStudy) study = aConvertStudy(theStudy); + + if(CORBA::is_nil(study)) return SALOMEDS::Study::_nil(); + return study._retn(); +} + +SALOMEDS::StudyBuilder_ptr ClientFactory::crbStudyBuilder(const _PTR(StudyBuilder)& theStudyBuilder) +{ + SALOMEDS::StudyBuilder_var studyBuilder; + +#ifdef WIN32 + if(!_libHandle) _libHandle = ::LoadLibrary(SALOMEDS_LIB_NAME); + if(!aConvertBuilder)aConvertBuilder = (CONVERT_BUILDER_FUNCTION)::GetProcAddress(_libHandle, CONVERT_BUILDER); +#else + if(!_libHandle) _libHandle = dlopen(SALOMEDS_LIB_NAME, RTLD_LAZY | RTLD_GLOBAL); + if(!aConvertBuilder) aConvertBuilder = (CONVERT_BUILDER_FUNCTION) dlsym(_libHandle, CONVERT_BUILDER); +#endif + + if(aConvertBuilder) studyBuilder = aConvertBuilder(theStudyBuilder); + + if(CORBA::is_nil(studyBuilder)) return SALOMEDS::StudyBuilder::_nil(); + return studyBuilder._retn(); +} diff --git a/src/SALOMEDSClient/SALOMEDSClient_ClientFactory.hxx b/src/SALOMEDSClient/SALOMEDSClient_ClientFactory.hxx index 85929293d..ae9ff5d5b 100644 --- a/src/SALOMEDSClient/SALOMEDSClient_ClientFactory.hxx +++ b/src/SALOMEDSClient/SALOMEDSClient_ClientFactory.hxx @@ -30,6 +30,7 @@ #include "SALOMEDSClient_SComponent.hxx" #include "SALOMEDSClient_Study.hxx" #include "SALOMEDSClient_StudyManager.hxx" +#include "SALOMEDSClient_IParameters.hxx" #include @@ -55,6 +56,11 @@ public: */ static _PTR(Study) Study(SALOMEDS::Study_ptr theStudy); + /*! + * Returns a client StudyBuilder wrapper that corresponds %theStudy + */ + static _PTR(StudyBuilder) StudyBuilder(SALOMEDS::StudyBuilder_ptr theBuilder); + /*! * Returns a client StudyManager wrapper */ @@ -65,7 +71,27 @@ public: */ static _PTR(StudyManager) createStudyManager(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa); - + /*! + * Returns an IParameters interface + */ + static _PTR(IParameters) getIParameters(const _PTR(AttributeParameter)& ap); + + + /*! + * Returns a CORBA SObject that corresponds %theStudy + */ + static SALOMEDS::SObject_ptr crbSObject(const _PTR(SObject)& theSObject); + + /*! + * Returns a CORBA Study that corresponds %theStudy + */ + static SALOMEDS::Study_ptr crbStudy(const _PTR(Study)& theStudy); + + /*! + * Returns a CORBA StudyBuilder that corresponds %theStudyBuilder + */ + static SALOMEDS::StudyBuilder_ptr crbStudyBuilder(const _PTR(StudyBuilder)& theStudyBuilder); + }; #endif diff --git a/src/SALOMEDSClient/SALOMEDSClient_IParameters.hxx b/src/SALOMEDSClient/SALOMEDSClient_IParameters.hxx new file mode 100644 index 000000000..66419ca82 --- /dev/null +++ b/src/SALOMEDSClient/SALOMEDSClient_IParameters.hxx @@ -0,0 +1,146 @@ +// Copyright (C) 2006 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +#ifndef SALOMEDSClient_IParameters_H +#define SALOMEDSClient_IParameters_H + +#include +#include +#include + +#include "SALOMEDSClient_definitions.hxx" +#include "SALOMEDSClient_AttributeParameter.hxx" + +/*! + Class which an interface to store the parameters of the objects +*/ +class SALOMEDSClient_IParameters +{ +public: + + virtual ~SALOMEDSClient_IParameters() {} + + /*! + Appends a string value to a named list. + Returns a number of the added value. + Note: the name of the list MUST be unique + */ + virtual int append(const std::string& listName, const std::string& value) = 0; + + /*! + Returns a number elements in the list + */ + virtual int nbValues(const std::string& listName) = 0; + + /*! + Returns a list of values in the list + */ + virtual std::vector getValues(const std::string& listName) = 0; + + /*! + Returns a value with given %index, where %index is in range [0:nbValues-1] + */ + virtual std::string getValue(const std::string& listName, int index) = 0; + + /*! + Returns a list all entries lists + */ + virtual std::vector getLists() = 0; + + /*! + Sets a new named parameter value for the given entry + */ + virtual void setParameter(const std::string& entry, const std::string& parameterName, const std::string& value) = 0; + + /*! + Gets a named parameter value for the given entry + */ + virtual std::string getParameter(const std::string& entry, const std::string& parameterName) = 0; + + /*! + Returns all parameter names of the given entry + */ + virtual std::vector getAllParameterNames(const std::string& entry) = 0; + + /*! + Returns all parameter values of the given entry + */ + virtual std::vector getAllParameterValues(const std::string& entry) = 0; + + /*! + Returns a number of parameters of the given entry + */ + virtual int getNbParameters(const std::string& entry) = 0; + + /*! + Returns a list all entries + */ + virtual std::vector getEntries() = 0; + + /*! + Sets a global named property value + */ + virtual void setProperty(const std::string& name, const std::string& value) = 0; + + /*! + Gets a value of global named property + */ + virtual std::string getProperty(const std::string& name) = 0; + + /*! + Returns a list all properties + */ + virtual std::vector getProperties() = 0; + + /*! + Breaks a value string in two parts which is divided by %separator. + If fromEnd is True the search of separator starts from the end of the string + */ + virtual std::vector parseValue(const std::string& value, const char separator, bool fromEnd = true) = 0; + + + /*! + Returns encoded entry that is a relative entry for the component + */ + virtual std::string encodeEntry(const std::string& entry, const std::string& compName) = 0; + + /*! + Returns decoded entry that is an absolute entry + */ + virtual std::string decodeEntry(const std::string& entry) = 0; + + /*! + Enables/Disables the dumping visual parameters, static implementation is supposed + */ + virtual void setDumpPython(_PTR(Study) study, const std::string& theID = "") = 0; + + /*! + Returns whether there is the dumping visual parameters, static implementation is supposed + */ + virtual bool isDumpPython(_PTR(Study) study, const std::string& theID = "") = 0; + + /*! + Returns a default name of the component where the visula parameters are stored. + Static implementation is supposed + */ + virtual std::string getDefaultVisualComponent() = 0; + +}; + + +#endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx index f3f68e2da..464ae7bc2 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx @@ -209,7 +209,7 @@ Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::Open(const TCollection_Asc if (isASCII) { Handle(TColStd_HSequenceOfAsciiString) aFilesToRemove = new TColStd_HSequenceOfAsciiString; - aFilesToRemove->Append(aHDFUrl); + aFilesToRemove->Append("hdf_from_ascii.hdf"); SALOMEDSImpl_Tool::RemoveTemporaryFiles(SALOMEDSImpl_Tool::GetDirFromPath(aHDFUrl), aFilesToRemove, true); } diff --git a/src/Utils/Utils_SALOME_Exception.hxx b/src/Utils/Utils_SALOME_Exception.hxx index c870618aa..45cdaaf00 100644 --- a/src/Utils/Utils_SALOME_Exception.hxx +++ b/src/Utils/Utils_SALOME_Exception.hxx @@ -32,7 +32,11 @@ # include # include +#ifdef _DEBUG_ # define LOCALIZED(message) #message , __FILE__ , __LINE__ +#else +# define LOCALIZED(message) #message +#endif #if defined UTILS_EXPORTS #if defined WIN32