From c9c171f4983a52674e0d5f0840af69911f44192d Mon Sep 17 00:00:00 2001 From: mpv Date: Thu, 18 Oct 2012 06:12:06 +0000 Subject: [PATCH] Initial integration of SimanIO support and SIMAN study interfaces --- idl/SALOMEDS.idl | 76 ++++++++++ idl/SALOME_Component.idl | 49 ++++++- salome_adm/cmake_files/FindSIMANIO.cmake | 137 ++++++++++++++++++ salome_adm/cmake_files/Makefile.am | 1 + salome_adm/cmake_files/am2cmake.py | 1 + salome_adm/unix/config_files/Makefile.am | 3 +- salome_adm/unix/config_files/check_simanio.m4 | 96 ++++++++++++ 7 files changed, 361 insertions(+), 2 deletions(-) create mode 100644 salome_adm/cmake_files/FindSIMANIO.cmake create mode 100644 salome_adm/unix/config_files/check_simanio.m4 diff --git a/idl/SALOMEDS.idl b/idl/SALOMEDS.idl index 4502aaeb6..b08ac293f 100644 --- a/idl/SALOMEDS.idl +++ b/idl/SALOMEDS.idl @@ -557,6 +557,76 @@ during each working session. void attach(in SALOMEDS::Observer theObserver, in boolean modify); }; + //=========================================================================== + /*! \brief %SimanStudy Interface + + The Siman (simulation management) study is an interface extension to the %Study + with functions for working with SIMAN server. Is allows to get data from SIMAN (check-out operation) + and to store it back (check-in operation). + This interface is correctly working if SALOME is compiled with SimanIO library, launched with siman + option and connection to SIMAN server is established and alive. Only one study per application, + checked out from the SIMAN is SimanStudy. For other studies all functionality is unaccessible. +*/ + + interface SimanStudy + { + +//! No connection with SIMAN server + exception SimanStudyNoConnection {}; +//! There is no SimanStudy with: study with checked out data. + exception SimanStudyNotExists {}; + +/*! \brief The ID of the study in SIMAN server + + This is equivalent to the methods setStudyId() & getStudyId() +*/ + attribute string StudyId; + +/*! \brief The ID of the scenario in SIMAN server + + This is equivalent to the methods setScenarioId() & getScenarioId() +*/ + attribute string ScenarioId; +/*! \brief The ID of the user in SIMAN server + + This is equivalent to the methods setUserId() & getUserId() +*/ + attribute string UserId; + +/*! \brief Get data from SIMAN and put it to the given study + + This method is called for just created study to make it referenced + by this Siman study. Also it fills this study by the checked out + data from SIMAN server. + Warning: StudyID, ScenarioID and User Id must be set before calling of this method! + + \param theTarget referenced study for checking out +*/ + void CheckOut(in Study theTarget); + +/*! \brief Get data from the source study and store in SIMAN + + It works only with already checked out study. + \param theModuleName name of the module the check in must be perfrormed for. If empty, check in is performed for all modules. +*/ + void CheckIn(in string theModuleName); + +/*! \brief Returns the %Study with checked out data + + If study is null, there is no such study in this application instance, or Salome was + launched without siman option. +*/ + Study getReferencedStudy(); + +/*! + Private method, returns an implementation of this Study. + \param theHostname is a hostname of the caller + \param thePID is a process ID of the caller + \param isLocal is set True if the Study is launched locally with the caller +*/ + long long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal); +}; + //========================================================================== /*! \brief %Study Builder Interface @@ -985,6 +1055,12 @@ Gets the list of open studies */ long long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal); +/*! \brief Returns the siman study based on the given study. + + Creates a new Siman study, or returns just a previously created. + \return Siman study, or none if it is not siman mode +*/ + SimanStudy GetSimanStudy(); }; diff --git a/idl/SALOME_Component.idl b/idl/SALOME_Component.idl index 9d55e154b..6dda46929 100644 --- a/idl/SALOME_Component.idl +++ b/idl/SALOME_Component.idl @@ -60,12 +60,17 @@ module Engines }; typedef sequence FieldsDict; + typedef sequence ListOfOptions; + typedef sequence ListOfIdentifiers; interface EngineComponent ; interface fileRef ; interface fileTransfer ; interface Salome_file; + interface DataContainer; + typedef sequence ListOfData; + /*! \brief Interface of the %Container. This interface defines the process of loading and registration of new components in %SALOME application @@ -225,6 +230,30 @@ module Engines PyScriptNode createPyScriptNode(in string nodeName, in string code) raises(SALOME::SALOME_Exception); }; + /*! \brief Interface to pass data files from the client side to the SALOME Container. + + Passes data from client side to the SALOME container (where component engine is running) + size via the CORBA bus as a stream of bytes. + */ + + interface DataContainer + { + + //! This operation returns the stream with the data file content. + TMPFile get(); + + //! Returns the name of the document corresponding to this data container. + string name(); + + //! Returns the identifier of the document corresponding to this data container. + string identifier(); + + //! Returns the extension (type) of the document corresponding to this data container. + //! It is taked from the SIMAN URL. + string extension(); + }; + + /*! \brief Interface of the %component. This interface is used for interaction between the %container and the %component and between the components inside the container. @@ -453,7 +482,25 @@ module Engines \return an information about the given object. */ string getObjectInfo(in long studyId, in string entry); - } ; + + //! Generic Import operation to let the component to import data, corresponding to it. + /*! + + \param studyId indentifier of the study where the data must be placed + \param data data for import: usually this is just imported file content + \param options additional options for Importat operation + \return the sequence of identifiers of the importedData in the component (to use later in the export function) + */ + ListOfIdentifiers importData(in long studyId, in DataContainer data, in ListOfOptions options); + + //! Generic Export operation to ket the component export all modified data corresponding to it. + /*! + + \param studyId identifier of the study that contains the exported data + */ + ListOfData getModifiedData(in long studyId); + +} ; /*! \brief Base interface of the %component that supports exporting data. diff --git a/salome_adm/cmake_files/FindSIMANIO.cmake b/salome_adm/cmake_files/FindSIMANIO.cmake new file mode 100644 index 000000000..47e0c3a58 --- /dev/null +++ b/salome_adm/cmake_files/FindSIMANIO.cmake @@ -0,0 +1,137 @@ +# Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +# +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# 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/ or email : webmaster.salome@opencascade.com +# + +# ------ + +MESSAGE(STATUS "Check for SimanIO ...") + +# ------ + +IF(SIMANIO_IS_MANDATORY STREQUAL 0) + SET(SIMANIO_IS_MANDATORY 0) + SET(SIMANIO_IS_OPTIONAL 1) +ENDIF(SIMANIO_IS_MANDATORY STREQUAL 0) +IF(SIMANIO_IS_OPTIONAL STREQUAL 0) + SET(SIMANIO_IS_MANDATORY 1) + SET(SIMANIO_IS_OPTIONAL 0) +ENDIF(SIMANIO_IS_OPTIONAL STREQUAL 0) +IF(NOT SIMANIO_IS_MANDATORY AND NOT SIMANIO_IS_OPTIONAL) + SET(SIMANIO_IS_MANDATORY 0) + SET(SIMANIO_IS_OPTIONAL 1) +ENDIF(NOT SIMANIO_IS_MANDATORY AND NOT SIMANIO_IS_OPTIONAL) + +# ------ + +SET(SIMANIO_STATUS 1) +IF(WITHOUT_SIMANIO OR WITH_SIMANIO STREQUAL 0) + SET(SIMANIO_STATUS 0) + MESSAGE(STATUS "SimanIO disabled from command line.") +ENDIF(WITHOUT_SIMANIO OR WITH_SIMANIO STREQUAL 0) + +# ------ + +IF(SIMANIO_STATUS) + IF(WITH_SIMANIO) + SET(SIMANIO_ROOT_USER ${WITH_SIMANIO}) + ELSE(WITH_SIMANIO) + SET(SIMANIO_ROOT_USER $ENV{SIMANIO_ROOT_DIR}) + ENDIF(WITH_SIMANIO) +ENDIF(SIMANIO_STATUS) + +# ----- + +IF(SIMANIO_STATUS) + IF(SIMANIO_ROOT_USER) + SET(SIMANIO_FIND_PATHS_OPTION NO_DEFAULT_PATH) + ELSE(SIMANIO_ROOT_USER) + SET(SIMANIO_FIND_PATHS_OPTION) + ENDIF(SIMANIO_ROOT_USER) +ENDIF(SIMANIO_STATUS) + +# ----- + +IF(SIMANIO_STATUS) + IF(SIMANIO_ROOT_USER) + SET(SIMANIO_INCLUDE_PATHS ${SIMANIO_ROOT_USER} ${SIMANIO_ROOT_USER}/include) + ELSE(SIMANIO_ROOT_USER) + SET(SIMANIO_INCLUDE_PATHS) + ENDIF(SIMANIO_ROOT_USER) + SET(SIMANIO_INCLUDE_TO_FIND SimanIO_Link.hxx) + FIND_PATH(SIMANIO_INCLUDE_DIR ${SIMANIO_INCLUDE_TO_FIND} PATHS ${SIMANIO_INCLUDE_PATHS} ${SIMANIO_FIND_PATHS_OPTION}) + IF(SIMANIO_INCLUDE_DIR) + IF(SIMANIO_ROOT_USER) + SET(SIMANIO_CPPFLAGS -I${SIMANIO_INCLUDE_DIR}) + ENDIF(SIMANIO_ROOT_USER) + MESSAGE(STATUS "${SIMANIO_INCLUDE_TO_FIND} found in ${SIMANIO_INCLUDE_DIR}") + ELSE(SIMANIO_INCLUDE_DIR) + SET(SIMANIO_STATUS 0) + IF(SIMANIO_ROOT_USER) + MESSAGE(STATUS "${SIMANIO_INCLUDE_TO_FIND} not found in ${SIMANIO_INCLUDE_PATHS}, check your SimanIO installation.") + ELSE(SIMANIO_ROOT_USER) + MESSAGE(STATUS "${SIMANIO_INCLUDE_TO_FIND} not found on system, try to use WITH_SIMANIO option or SIMANIO_ROOT environment variable.") + ENDIF(SIMANIO_ROOT_USER) + ENDIF(SIMANIO_INCLUDE_DIR) +ENDIF(SIMANIO_STATUS) + +# ---- + +IF(SIMANIO_STATUS) + IF(SIMANIO_ROOT_USER) + SET(SIMANIO_LIB_PATHS ${SIMANIO_ROOT_USER}/lib) + ELSE(SIMANIO_ROOT_USER) + SET(SIMANIO_LIB_PATHS) + ENDIF(SIMANIO_ROOT_USER) +ENDIF(SIMANIO_STATUS) + +IF(SIMANIO_STATUS) + IF(WINDOWS) + FIND_LIBRARY(SIMANIO_LIB SimanIO PATHS ${SIMANIO_LIB_PATHS} ${SIMANIO_FIND_PATHS_OPTION}) + ELSE(WINDOWS) + FIND_LIBRARY(SIMANIO_LIB SimanIO PATHS ${SIMANIO_LIB_PATHS} ${SIMANIO_FIND_PATHS_OPTION}) + ENDIF(WINDOWS) + SET(SIMANIO_LIBS) + IF(SIMANIO_LIB) + SET(SIMANIO_LIBS ${SIMANIO_LIBS} ${SIMANIO_LIB}) + MESSAGE(STATUS "SimanIO lib found: ${SIMANIO_LIB}") + ELSE(SIMANIO_LIB) + SET(SIMANIO_STATUS 0) + IF(SIMANIO_ROOT_USER) + MESSAGE(STATUS "SimanIO lib not found in ${SIMANIO_LIB_PATHS}, check your SimanIO installation.") + ELSE(SIMANIO_ROOT_USER) + MESSAGE(STATUS "SimanIO lib not found on system, try to use WITH_SIMANIO option or SIMANIO_ROOT environment variable.") + ENDIF(SIMANIO_ROOT_USER) + ENDIF(SIMANIO_LIB) +ENDIF(SIMANIO_STATUS) + +# ---- + +IF(SIMANIO_STATUS) + SET(WITH_SIMANIO 1) +ELSE(SIMANIO_STATUS) + IF(SIMANIO_IS_MANDATORY) + MESSAGE(FATAL_ERROR "SimanIO not found ... mandatory ... abort") + ELSE(SIMANIO_IS_MANDATORY) + MESSAGE(STATUS "SimanIO not found ... optional ... disabled") + ENDIF(SIMANIO_IS_MANDATORY) +ENDIF(SIMANIO_STATUS) + +# ------ diff --git a/salome_adm/cmake_files/Makefile.am b/salome_adm/cmake_files/Makefile.am index b21d38c4e..efebf61e5 100644 --- a/salome_adm/cmake_files/Makefile.am +++ b/salome_adm/cmake_files/Makefile.am @@ -39,6 +39,7 @@ FindPTHREADS.cmake \ FindPYTHON.cmake \ FindSWIG.cmake \ FindSPHINX.cmake \ +FindSIMANIO.cmake \ install_python_from_idl.cmake \ install_and_compile_python_file.cmake \ InstallAndCompilePythonFile.cmake diff --git a/salome_adm/cmake_files/am2cmake.py b/salome_adm/cmake_files/am2cmake.py index 20f0e9c7b..e28a495a8 100644 --- a/salome_adm/cmake_files/am2cmake.py +++ b/salome_adm/cmake_files/am2cmake.py @@ -504,6 +504,7 @@ class CMakeFile(object): INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindDOXYGEN.cmake) INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindLIBBATCH.cmake) INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindSPHINX.cmake) + INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindSIMANIO.cmake) """) pass else: diff --git a/salome_adm/unix/config_files/Makefile.am b/salome_adm/unix/config_files/Makefile.am index f92e4c144..b1a26650a 100644 --- a/salome_adm/unix/config_files/Makefile.am +++ b/salome_adm/unix/config_files/Makefile.am @@ -83,7 +83,8 @@ check_libxml.m4 \ check_paco++.m4 \ local_install.m4 \ hack_libtool.m4 \ -check_tbb.m4 +check_tbb.m4 \ +check_simanio.m4 dist_salome4depr_DATA=\ $(DEPRECATED_FILES) diff --git a/salome_adm/unix/config_files/check_simanio.m4 b/salome_adm/unix/config_files/check_simanio.m4 new file mode 100644 index 000000000..6c3f57cb3 --- /dev/null +++ b/salome_adm/unix/config_files/check_simanio.m4 @@ -0,0 +1,96 @@ +`dnl Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +dnl +dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +dnl +dnl This library is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Lesser General Public +dnl License as published by the Free Software Foundation; either +dnl version 2.1 of the License. +dnl +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Lesser General Public License for more details. +dnl +dnl You should have received a copy of the GNU Lesser General Public +dnl License along with this library; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +dnl +dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +dnl + +AC_DEFUN([CHECK_SIMANIO],[ + +SIMANIO_CPPFLAGS="" +SIMANIO_LIBS="" + +AC_CHECKING(for SimanIO location) +AC_ARG_WITH(simanio, + [AC_HELP_STRING([--with-simanio=DIR],[root directory path to SimanIO installation])], + [SIMANIODIR="$withval" + AC_MSG_RESULT("select $withval as path to SimanIO installation") + ]) + +if test "x$SIMANIO_DIR" = "x" ; then + # no --with-simanio option used + if test "x$SIMANIO_ROOT_DIR" != "x" ; then + # SIMANIO_ROOT_DIR environment variable defined + SIMANIODIR=$SIMANIO_ROOT_DIR + fi +fi + +AC_MSG_RESULT(\$SIMANIODIR = ${SIMANIODIR}) + +CPPFLAGS_old="${CPPFLAGS}" +LIBS_old=$LIBS + +LIB_SUFFIX="${LIB_LOCATION_SUFFIX}" + +if test "x${SIMANIODIR}" != "x" ; then + SIMANIO_CPPFLAGS="-I${SIMANIODIR}/include" + SIMANIO_LIBS="-L${SIMANIODIR}/lib" +fi + +if test "x${SIMANIODIR}" = "x/usr" ; then + SIMANIO_CPPFLAGS="" + SIMANIO_LIBS="" +fi + +simanio_ok=no +simanio_headers_ok=no +simanio_binaries_ok=no + +dnl SIMANIO headers +#AC_CHECKING(for SimanIO headers) + +simanio_headers_ok=yes +if test "x${SIMANIODIR}" != "x" ; then + AC_CHECK_FILE(${SIMANIODIR}/include/SimanIO_Link.hxx, + simanio_headers_ok=yes, + simanio_headers_ok=no) +fi + +if test "x${simanio_headers_ok}" = "xno" ; then + SIMANIO_CPPFLAGS="SIMANIO_CPPFLAGS_NOT_DEFINED" +else + #AC_MSG_RESULT(\$SIMANIO_CPPFLAGS = ${SIMANIO_CPPFLAGS}) + AC_CHECK_FILE(${SIMANIODIR}/lib/libSimanIO.so, + simanio_lib_ok=yes, + simanio_lib_ok=no) +fi +#AC_MSG_RESULT(for SimanIO libraries: $simanio_lib_ok) + +if test "x${simanio_headers_ok}" = "xyes" ; then + if test "x${simanio_lib_ok}" = "xyes" ; then + SIMANIO_LIBS="-L${SIMANIODIR}/lib -lSimanIO" + simanio_ok=yes + fi +fi + +AC_MSG_RESULT(for simanio: $simanio_ok) + +AC_SUBST(SIMANIO_CPPFLAGS) +AC_SUBST(SIMANIO_LIBS) + +])dnl -- 2.39.2