Salome HOME
merge from OCC_development_for_3_2_0a2 tag mergeto_BR_auto_V310_10mar06
authorprascle <prascle>
Sun, 12 Mar 2006 15:58:32 +0000 (15:58 +0000)
committerprascle <prascle>
Sun, 12 Mar 2006 15:58:32 +0000 (15:58 +0000)
77 files changed:
bin/createAppli.sh
bin/runNS.sh
bin/runSalome.py
configure.ac
idl/SALOMEDS.idl
idl/SALOMEDS_Attributes.idl
salome_adm/unix/DEPRECATED/make_commence.in
salome_adm/unix/DEPRECATED/make_conclude.in
salome_adm/unix/config_files/Makefile.am
salome_adm/unix/config_files/acx_pthread.m4
salome_adm/unix/config_files/check_boost.m4
salome_adm/unix/config_files/check_cas.m4
salome_adm/unix/config_files/check_msg2qm.m4 [deleted file]
salome_adm/unix/config_files/check_pyqt.m4 [deleted file]
salome_adm/unix/config_files/check_qwt.m4 [deleted file]
salome_adm/unix/config_files/check_sip.m4 [deleted file]
salome_adm/unix/config_files/check_vtk.m4 [deleted file]
salome_adm/unix/config_files/enable_pthreads.m4
src/CASCatch/CASCatch.hxx [new file with mode: 0644]
src/CASCatch/Makefile.am
src/Container/Container_i.cxx
src/HDFPersist/HDFdataset.cc
src/KERNEL_PY/Makefile.am
src/KERNEL_PY/iparameters.py [new file with mode: 0755]
src/Makefile.am
src/SALOMEDS/Makefile.am
src/SALOMEDS/SALOMEDS.cxx
src/SALOMEDS/SALOMEDS_AttributeParameter.cxx [new file with mode: 0644]
src/SALOMEDS/SALOMEDS_AttributeParameter.hxx [new file with mode: 0644]
src/SALOMEDS/SALOMEDS_AttributeParameter_i.cxx [new file with mode: 0644]
src/SALOMEDS/SALOMEDS_AttributeParameter_i.hxx [new file with mode: 0644]
src/SALOMEDS/SALOMEDS_Attributes.hxx
src/SALOMEDS/SALOMEDS_ClientAttributes.hxx
src/SALOMEDS/SALOMEDS_Driver_i.cxx
src/SALOMEDS/SALOMEDS_Driver_i.hxx
src/SALOMEDS/SALOMEDS_IParameters.cxx [new file with mode: 0644]
src/SALOMEDS/SALOMEDS_IParameters.hxx [new file with mode: 0644]
src/SALOMEDS/SALOMEDS_Study.cxx
src/SALOMEDS/SALOMEDS_Study.hxx
src/SALOMEDS/SALOMEDS_Study_i.cxx
src/SALOMEDS/SALOMEDS_Study_i.hxx
src/SALOMEDS/SALOMEDS_TMPFile_i.cxx [new file with mode: 0644]
src/SALOMEDS/SALOMEDS_TMPFile_i.hxx [new file with mode: 0644]
src/SALOMEDS/Test/Makefile.am [new file with mode: 0644]
src/SALOMEDS/Test/SALOMEDSTest.cxx [new file with mode: 0644]
src/SALOMEDS/Test/SALOMEDSTest.hxx [new file with mode: 0644]
src/SALOMEDS/Test/TestSALOMEDS.cxx [new file with mode: 0644]
src/SALOMEDS/Test/TestSALOMEDS.py [new file with mode: 0644]
src/SALOMEDSClient/Makefile.am
src/SALOMEDSClient/SALOMEDSClient.hxx
src/SALOMEDSClient/SALOMEDSClient_AttributeParameter.hxx [new file with mode: 0644]
src/SALOMEDSClient/SALOMEDSClient_ClientFactory.cxx [new file with mode: 0644]
src/SALOMEDSClient/SALOMEDSClient_ClientFactory.hxx [new file with mode: 0644]
src/SALOMEDSClient/SALOMEDSClient_Study.hxx
src/SALOMEDSImpl/Makefile.am
src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.cxx [new file with mode: 0644]
src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.hxx [new file with mode: 0644]
src/SALOMEDSImpl/SALOMEDSImpl_Attributes.hxx
src/SALOMEDSImpl/SALOMEDSImpl_Driver.hxx
src/SALOMEDSImpl/SALOMEDSImpl_IParameters.cxx [new file with mode: 0644]
src/SALOMEDSImpl/SALOMEDSImpl_IParameters.hxx [new file with mode: 0644]
src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx
src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx
src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx
src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.cxx [new file with mode: 0644]
src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.hxx [new file with mode: 0644]
src/SALOMEDSImpl/Test/Makefile.am [new file with mode: 0644]
src/SALOMEDSImpl/Test/SALOMEDSImplTest.cxx [new file with mode: 0644]
src/SALOMEDSImpl/Test/SALOMEDSImplTest.hxx [new file with mode: 0644]
src/SALOMEDSImpl/Test/TestSALOMEDSImpl.cxx [new file with mode: 0644]
src/SALOMEDSImpl/Test/TestSALOMEDSImpl.py [new file with mode: 0644]
src/SALOMEDSImpl/testDS.cxx
src/TOOLSDS/SALOMEDS_Tool.cxx
src/TOOLSDS/SALOMEDS_Tool.hxx
src/Utils/Makefile.am
src/Utils/Utils_SignalsHandler.cxx [deleted file]
src/Utils/Utils_SignalsHandler.h [deleted file]

index 1ff6ed6def573fd3c20538caec9fa47e80559aa4..36c6146b4b9a9bacff5ebe675ca28cbf4aacabf2 100755 (executable)
@@ -3,11 +3,11 @@
 comName=`which $0`
 rep=`dirname $comName`
 
-if [ $# -ne 1 ]
+if [ $# -ne 1 ]; then
   echo "--- usage:"
   echo $0 AppliName
   echo "--- In which AppliName is a directory to create with SALOME application scripts"
-elif [ -d $1]
+elif [ -d $1 ]; then
   echo $1 "directory already exists, nothing done"
 else
   mkdir -p $1
index b5c155a6c46fda66161d8dbd41b64cd6c461fe17..589d2db5046093c7fbfe531e2a14393af234cb28 100755 (executable)
@@ -18,7 +18,7 @@ touch ${BaseDir}/logs/${Username}/dummy
 
 echo "Name Service... "
 aSedCommand="s/.*NameService=corbaname::`hostname`:\([[:digit:]]*\)/\1/"
-aPort=`sed -e"$aSedCommand" $OMNIORB_CONFIG`
+aPort=`cat $OMNIORB_CONFIG | grep NameService | sed -e"$aSedCommand"`
 omniNames -start $aPort -logdir ${BaseDir}/logs/${Username} &
 
 # In LifeCycleCORBA, FactoryServer is started with rsh on the requested
index 7961b2878d91955f9b0927c08b717ca5fa4df2ba..8b19f288ecb08f1942fcad2d7924d4c7470423b7 100755 (executable)
@@ -395,7 +395,10 @@ class LoggerServer(Server):
 
 class SessionServer(Server):
     def __init__(self,args):
-        self.args=args
+        self.args = args.copy()
+        # Bug 11512 (Problems with runSalome --xterm on Mandrake and Debian Sarge)
+        self.args['xterm']=0
+        #
         self.initArgs()
         self.SCMD1=['SALOME_Session_Server']
         self.SCMD2=[]
@@ -423,7 +426,7 @@ class SessionServer(Server):
             self.SCMD2+=['SUPERV']
         if self.args['gui']:
             self.SCMD2+=['GUI']
-        if self.args['splash']:
+        if self.args['splash'] and self.args['gui']:
             self.SCMD2+=['SPLASH']
         if self.args['noexcepthandler']:
             self.SCMD2+=['noexcepthandler']
index c055d364c8254afc85b3d46c32ad1bdceae824cd..7fe63445cf8a2e5aa2fbe0c6db2e19d4d5ddfbc5 100644 (file)
@@ -506,8 +506,10 @@ AC_OUTPUT([ \
        ./src/ResourcesManager/Makefile \
        ./src/RessourcesCatalog/Makefile \
        ./src/SALOMEDS/Makefile \
+       ./src/SALOMEDS/Test/Makefile \
        ./src/SALOMEDSClient/Makefile \
        ./src/SALOMEDSImpl/Makefile \
+       ./src/SALOMEDSImpl/Test/Makefile \
        ./src/SALOMELocalTrace/Makefile \
        ./src/SALOMELocalTrace/Test/Makefile \
        ./src/SALOMETraceCollector/Makefile \
index 3e73dda8cb2f1ed2a35252054b2b355fd1173541..4c21467c8720ddaf9f7f8a15e8ef11c57691b395 100644 (file)
@@ -97,6 +97,7 @@ during each working session.
   interface ChildIterator;
   interface Driver;
   interface AttributeStudyProperties;
+  interface AttributeParameter;
   interface UseCaseIterator;
   interface UseCaseBuilder;
 
@@ -370,6 +371,29 @@ during each working session.
 
     boolean DumpStudy(in string thePath, in string theBaseName, in boolean isPublished);
 
+/*!
+    Returns an AttributeParameter used to store common parameters for given %theSavePoint.
+    \param theID identifies a common parameters set (Example: "Interface Applicative")
+    \param theSavePoint is number of a set of parameters as there can be several sets
+*/
+    AttributeParameter GetCommonParameters(in string theID, in long theSavePoint);
+
+/*!
+    Returns an AttributeParameter used to store parameters for given %theModuleName.
+    \param theID identifies a common parameters set (Example: "Interface Applicative")
+    \param theModuleName is a name of the module (Example: "Geometry")
+    \param theSavePoint is number of a set of parameters as there can be several sets
+*/
+    AttributeParameter GetModuleParameters(in string theID, in string theModuleName, in long theSavePoint);
+
+
+/*!
+    Returns a default Python script to restore visual parameters for given %theModuleName.
+    \param theID identifies a common parameters set (Example: "Interface Applicative")
+    \param theModuleName is a name of the module (Example: "Geometry")
+*/
+    string GetDefaultScript(in string theID, in string theModuleName);
+
 /*!
     Private method, returns an implementation of this Study.
    \param theHostname is a hostname of the caller
index 80afd5603f13bc71423e054829d2875302ccbcf5..9306818dcd344598e74281d710ab0697bdf1c0af 100644 (file)
@@ -1334,5 +1334,130 @@ Sets the item to be selectable
 */
     boolean IsScript();
   };
+  //==========================================================================
+/*! \brief %AttributeParameter interface
+
+    Attribute is a universal container of basic types
+*/
+  //==========================================================================
+  interface AttributeParameter : GenericAttribute
+  {
+/*!
+  Associates a integer value with the ID
+  \param theID        An ID of a parameter.
+  \param theValue     A value of the parameter
+*/
+    void SetInt(in string theID, in long theValue);
+/*!
+  Returns a int value associated with the given ID
+  \param theID        An ID of a parameter.
+*/
+    long GetInt(in string theID);
+
+/*!
+  Associates a real value with the ID
+  \param theID        An ID of a parameter.
+  \param theValue     A value of the parameter
+*/
+    void SetReal(in string theID, in double theValue);
+/*!
+  Returns a real value associated with the given ID
+  \param theID        An ID of a parameter.
+*/
+    double GetReal(in string theID);
+
+/*!
+  Associates a string value with the ID
+  \param theID        An ID of a parameter.
+  \param theValue     A value of the parameter
+*/
+    void SetString(in string theID, in string theValue);
+/*!
+  Returns a string value associated with the given ID
+  \param theID        An ID of a parameter.
+*/
+    string GetString(in string theID);
+  
+/*!
+  Associates a boolean value with the ID
+  \param theID        An ID of a parameter.
+  \param theValue     A value of the parameter
+*/
+    void SetBool(in string theID, in boolean theValue);
+/*!
+  Returns a boolean value associated with the given ID
+  \param theID        An ID of a parameter.
+*/
+    boolean GetBool(in string theID);
+  
+/*!
+  Associates an array of real values with the ID
+  \param theID        An ID of a parameter.
+  \param theArray     The array of real values
+*/
+    void SetRealArray(in string theID, in DoubleSeq theArray);
+/*!
+  Returns an array of real values associated with the ID
+  \param theID        An ID of a parameter.
+*/
+    DoubleSeq GetRealArray(in string theID);
+
+/*!
+  Associates an array of integer values with the ID
+  \param theID        An ID of a parameter.
+  \param theArray     The array of integer values
+*/
+    void SetIntArray(in string theID, in LongSeq theArray);
+/*!
+  Returns an array of integer values associated with the ID
+  \param theID        An ID of a parameter.
+*/
+    LongSeq GetIntArray(in string theID);
+
+/*!
+  Associates an array of string values with the ID
+  \param theID        An ID of a parameter.
+  \param theArray     The array of string values
+*/
+    void SetStrArray(in string theID, in StringSeq theArray);
+/*!
+  Returns an array of string values associated with the ID
+  \param theID        An ID of a parameter.
+*/
+    StringSeq GetStrArray(in string theID);
+/*!
+  Returns True if for the ID of given type was assigned a value in the attribute
+  \param theID        An ID of a parameter.
+  \param theType      A type of parameter [0(Int), 1(Real), 2(Boolean), 3(String), 4(RealArray), 5(IntArray), 6(StrArray)].
+*/
+    boolean IsSet(in string theID, in long theType);
+/*!
+  Removes a parameter with given ID and Type, returns True if succeded
+  \param theID        An ID of a parameter.
+  \param theType      A type of parameter [0(Int), 1(Real), 2(Boolean), 3(String), 4(RealArray), 5(IntArray), 6(StrArray)].
+*/
+    boolean RemoveID(in string theID, in long theType);
+/*!
+   Returns a father attribute of this attribute
+*/
+    AttributeParameter GetFather();
+/*!
+   Returns True if this attribute has a father attribute
+*/
+    boolean HasFather();
+/*!
+   Returns True if this attribute is a root attribute
+*/
+    boolean IsRoot();
+/*!
+   Clears the content of the attribute
+*/
+    void Clear();
+/*!   
+  Returns a sequence of ID's of the give type
+  \param theType      A type of parameter [0(Int), 1(Real), 2(Boolean), 3(String), 4(RealArray), 5(IntArray), 6(StrArray)].
+ */ 
+    StringSeq GetIDs(in long theType);
+  };
 };
 #endif
index 62ec60a22f9a1678c70041447bae5052a949d98f..5517078df46b7f1050e5540de9395d95cd72d980 100644 (file)
@@ -42,6 +42,8 @@ CXX_DEPEND_FLAG = @CXX_DEPEND_FLAG@
 # BOOST Library
 
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
+BOOST_LIBSUFFIX = @BOOST_LIBSUFFIX@
+BOOST_LIBS = @BOOST_LIBS@
 
 # OpenPBS
 
index 890d757086826569dba0aef1a2fe4fdb005350b9..a668346284c35de9c194f8926704d1f4eee7204e 100644 (file)
@@ -139,10 +139,14 @@ $(DEST_SHAREDPYSCRIPTS): $(PYTHON_SHARED_SITE)/%: %
 
 check: test
 
-tests: test
+tests: unittest
 
 test: $(LIB) $(TEST_PROGS:%=$(top_builddir)/bin/salome/%) 
 
+unittest: 
+       @if test "x$(UNIT_TEST_PROG)" != "x"; then      \
+          $(top_builddir)/bin/salome/$(UNIT_TEST_PROG); \
+       fi;
 
 # copy header file in $(inc_builddir)
 #
index ed69ac4a91c1fdcaffff01042886422d71acfb91..fde1071757e779a4390158756ccd5e231743d5ea 100644 (file)
@@ -51,17 +51,12 @@ check_lam.m4 \
 check_lsf.m4 \
 check_mpi.m4 \
 check_mpich.m4 \
-check_msg2qm.m4 \
 check_omniorb.m4 \
 check_opengl.m4 \
 check_openpbs.m4 \
-check_pyqt.m4 \
 check_qt.m4 \
-check_qwt.m4 \
-check_sip.m4 \
 check_sockets.m4 \
 check_swig.m4 \
-check_vtk.m4 \
 check_withihm.m4 \
 enable_pthreads.m4 \
 production.m4 \
index bedf51c32afc45cafcb0042f397995ee0c781468..87c8686732ab3e0bb7966e34105a1d3676cd2dd2 100644 (file)
@@ -1,3 +1,5 @@
+dnl Paul RASCLE: modification for Linux: -pthread required by boost...
+dnl
 dnl Available from the GNU Autoconf Macro Archive at:
 dnl http://www.gnu.org/software/ac-archive/htmldoc/acx_pthread.html
 dnl
@@ -62,6 +64,12 @@ acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -m
 # pthread-config: use pthread-config program (for GNU Pth library)
 
 case "${host_cpu}-${host_os}" in
+        *linux*)
+
+        # On linux "none" works, but boost requires -pthread, so, try first "-pthread"
+acx_pthread_flags="-pthread pthreads none -Kthread -kthread lthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
+        ;;
+
         *solaris*)
 
         # On Solaris (at least, for some versions), libc contains stubbed
index 6176ef192eb06c95fb816dd2737b3fe2060c9f7e..37ff78d4f2484352371a3d9af704b70faf98752e 100644 (file)
@@ -23,67 +23,117 @@ AC_DEFUN([CHECK_BOOST],[
 
 AC_CHECKING(for BOOST Library)
 
+AC_REQUIRE([ENABLE_PTHREADS])dnl
+
 AC_LANG_SAVE
 AC_LANG_CPLUSPLUS
 
-AC_SUBST(BOOST_CPPFLAGS)
 BOOST_CPPFLAGS=""
-
-AC_SUBST(BOOST_LIBS)
+BOOST_LIBSUFFIX="-mt"
 BOOST_LIBS=""
 
-AC_SUBST(BOOST_LIBTHREAD)
-BOOST_LIBTHREAD=""
+AC_CHECKING(for BOOST location)
+AC_ARG_WITH(boost,
+   [AC_HELP_STRING([--with-boost=DIR],[root directory path to BOOST library installation])],
+   [BOOSTDIR="$withval"
+    AC_MSG_RESULT("select $withval as path to BOOST library")
+   ])
 
-boost_ok=no
+AC_MSG_RESULT(\$BOOSTDIR = ${BOOSTDIR})
 
-if test -z "${BOOSTDIR}"; then
-  AC_CHECK_HEADER(boost/shared_ptr.hpp,boost_ok=yes,boost_ok=no)
-  if test boost_ok = no ; then
-    AC_MSG_WARN(You must provide BOOSTDIR variable)
-  fi
-else
-  AC_MSG_RESULT(\$BOOSTDIR = ${BOOSTDIR})
+CPPFLAGS_old="${CPPFLAGS}"
+LIBS_old=$LIBS
 
-  dnl BOOST headers
-  AC_CHECKING(for boost/shared_ptr.hpp header file)
-  CPPFLAGS_old="${CPPFLAGS}"
+if test "x${BOOSTDIR}" != "x" ; then
   BOOST_CPPFLAGS="-I${BOOSTDIR}/include"
-  CPPFLAGS="${CPPFLAGS} ${BOOST_CPPFLAGS}"
-
-  AC_CHECK_HEADER(boost/shared_ptr.hpp,boost_ok=yes,boost_ok=no)
-
-  CPPFLAGS="${CPPFLAGS_old}"
-
-  if test "x${boost_ok}" = "xyes" ; then
-    AC_MSG_RESULT(\$BOOST_CPPFLAGS = ${BOOST_CPPFLAGS})
-    dnl BOOST libs
-    AC_CHECKING(for libboost_thread-mt.so library file)
-    AC_CHECK_FILE(${BOOSTDIR}/lib/libboost_thread-mt.so,boost_ok=yes,boost_ok=no)
-    if test "x${boost_ok}" = "xyes" ; then
-      BOOST_LIBTHREAD="boost_thread-mt"
-      AC_MSG_RESULT(\$BOOST_LIBTHREAD = ${BOOST_LIBTHREAD})
-    else
-      AC_CHECKING(for libboost_thread.so library file)
-      AC_CHECK_FILE(${BOOSTDIR}/lib/libboost_thread.so,boost_ok=yes,boost_ok=no)
-      if test "x${boost_ok}" = "xyes" ; then
-        BOOST_LIBTHREAD="boost_thread"
-        AC_MSG_RESULT(\$BOOST_LIBTHREAD = ${BOOST_LIBTHREAD})
-      fi
+  BOOST_LIBS="-L${BOOSTDIR}/lib"
+fi
+
+boost_ok=no
+boost_headers_ok=no
+boost_binaries_ok=no
+
+dnl BOOST headers
+AC_CHECKING(for BOOST headers)
+CPPFLAGS="${CPPFLAGS_old} ${BOOST_CPPFLAGS}"
+
+boost_include_dir_ok=yes
+if test "x${BOOSTDIR}" != "x" ; then
+  AC_CHECK_FILE(${BOOSTDIR}/include/boost/shared_ptr.hpp,
+                boost_include_dir_ok=yes,
+                boost_include_dir_ok=no)
+fi
+
+if test "x${boost_include_dir_ok}" = "xyes" ; then
+  AC_TRY_COMPILE([#include <boost/shared_ptr.hpp>],
+                 [boost::shared_ptr<int>(new int)],
+                 boost_headers_ok=yes,
+                 boost_headers_ok=no)
+fi
+
+if test "x${boost_headers_ok}" = "xno" ; then
+  BOOST_CPPFLAGS="BOOST_CPPFLAGS_NOT_DEFINED"
+else
+  AC_MSG_RESULT(\$BOOST_CPPFLAGS = ${BOOST_CPPFLAGS})
+fi
+AC_MSG_RESULT(for boost headers: $boost_headers_ok)
+
+if test "x${boost_headers_ok}" = "xyes" ; then
+  dnl BOOST binaries
+  AC_CHECKING(for BOOST binaries)
+  boost_lib_dir_ok=yes
+  if test "x${BOOSTDIR}" != "x" ; then
+    AC_CHECK_FILE(${BOOSTDIR}/lib/libboost_thread${BOOST_LIBSUFFIX}.so,
+                  boost_lib_dir_ok=yes,
+                  boost_lib_dir_ok=no)
+    if test "x${boost_lib_dir_ok}" = "xno" ; then
+      BOOST_LIBSUFFIX=""
+      AC_CHECK_FILE(${BOOSTDIR}/lib/libboost_thread${BOOST_LIBSUFFIX}.so,
+                    boost_lib_dir_ok=yes,
+                    boost_lib_dir_ok=no)
     fi
-    if test "x${boost_ok}" = "xyes" ; then
-      if test "x${BOOSTDIR}" = "x/usr" ; then
-        BOOST_LIBS=""
-      else
-        BOOST_LIBS="-L${BOOSTDIR}/lib"
-      fi
-      AC_MSG_RESULT(\$BOOST_LIBS = ${BOOST_LIBS})
+  fi
+  if test "x${boost_lib_dir_ok}" = "xyes" ; then
+    LIBS="${LIBS_old} ${BOOST_LIBS} -lboost_thread${BOOST_LIBSUFFIX}"
+    AC_TRY_LINK([#include <boost/thread/thread.hpp>],
+                [struct TBody{ void operator()(){} }; boost::thread(TBody())],
+                boost_binaries_ok=yes,
+                boost_binaries_ok=no)
+    if test "x${boost_binaries_ok}" = "xno" ; then
+      BOOST_LIBSUFFIX=""
+      LIBS="${LIBS_old} ${BOOST_LIBS} -lboost_thread${BOOST_LIBSUFFIX}"
+      AC_TRY_LINK([#include <boost/thread/thread.hpp>],
+                  [struct TBody{ void operator()(){} }; boost::thread(TBody())],
+                  boost_binaries_ok=yes,
+                  boost_binaries_ok=no)
     fi
   fi
 fi
 
+if test "x${boost_binaries_ok}" = "xno" ; then
+  BOOST_LIBS="BOOST_LIBS_NOT_FOUND"
+  BOOST_LIBSUFFIX="-not-defined"
+else
+  AC_MSG_RESULT(\$BOOST_LIBSUFFIX = ${BOOST_LIBSUFFIX})
+  AC_MSG_RESULT(\$BOOST_LIBS = ${BOOST_LIBS})
+fi
+AC_MSG_RESULT(for boost binaries: $boost_binaries_ok)
+
+CPPFLAGS="${CPPFLAGS_old}"
+LIBS="${LIBS_old}"
+
+if test "x${boost_headers_ok}" = "xyes" ; then
+  if test "x${boost_binaries_ok}" = "xyes" ; then
+    boost_ok=yes
+  fi
+fi
+
 AC_MSG_RESULT(for boost: $boost_ok)
 
+AC_SUBST(BOOST_CPPFLAGS)
+AC_SUBST(BOOST_LIBSUFFIX)
+AC_SUBST(BOOST_LIBS)
+
 AC_LANG_RESTORE
 
 ])dnl
index 7acf7f8f8713841401100cdf2a83c055ac850990..2db76b8753ba1dba215a459582afb36ca9484bf7 100644 (file)
@@ -143,15 +143,6 @@ case $host_os in
 esac
   CPPFLAGS="$CPPFLAGS $CAS_CPPFLAGS"
 
-  if test -n $KERNEL_ROOT_DIR; then
-      if test -d $KERNEL_ROOT_DIR/include/salome; then
-          CAS_CPPFLAGS="$CAS_CPPFLAGS -I$KERNEL_ROOT_DIR/include/salome"
-         CPPFLAGS="$CPPFLAGS -I$KERNEL_ROOT_DIR/include/salome"
-      fi
-  fi
-  CAS_CPPFLAGS="$CAS_CPPFLAGS -I${ROOT_BUILDDIR}/include/salome"
-  CPPFLAGS="$CPPFLAGS -I${ROOT_BUILDDIR}/salome_adm/unix"
-
   echo
   echo testing config.h
 
diff --git a/salome_adm/unix/config_files/check_msg2qm.m4 b/salome_adm/unix/config_files/check_msg2qm.m4
deleted file mode 100755 (executable)
index db3b359..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-# Check availability of Qt's msg2qm tool binary distribution
-#
-# Author : Jerome Roy (CEA, 2003)
-#
-
-AC_DEFUN([CHECK_MSG2QM],[
-
-AC_CHECKING(for msg2qm)
-
-msg2qm_ok=no
-
-AC_ARG_WITH(msg2qm,
-           [  --with-msg2qm=DIR               root directory path of MSG2QM installation],
-           MSG2QM_DIR="$withval",MSG2QM_DIR="")
-
-if test "x$MSG2QM_DIR" = "x" ; then
-
-# no --with-MSG2QM-dir option used
-
-   if test "x$MSG2QM_ROOT" != "x" ; then
-
-    # MSG2QM_ROOT environment variable defined
-      MSG2QM_DIR=$MSG2QM_ROOT
-
-   else
-
-    # search MSG2QM binaries in PATH variable
-      AC_PATH_PROG(TEMP, msg2qm)
-      if test "x$TEMP" != "x" ; then
-         MSG2QM_DIR=`dirname $TEMP`
-      fi
-      
-   fi
-# 
-fi
-
-# look for msg2qm in ${MSG2QM_DIR} directory
-if test -f ${MSG2QM_DIR}/msg2qm ; then
-   msg2qm_ok=yes
-   MSG2QM="${MSG2QM_DIR}/msg2qm"
-   AC_MSG_RESULT(Using MSG2QM executable in ${MSG2QM_DIR})
-else
-   # if not found, look for msg2qm in ${MSG2QM_DIR}/bin directory
-   if test -f ${MSG2QM_DIR}/bin/msg2qm ; then
-      msg2qm_ok=yes
-      MSG2QM="${MSG2QM_DIR}/bin/msg2qm"
-      AC_MSG_RESULT(Using MSG2QM executable in ${MSG2QM_DIR}/bin)
-   else            
-      AC_MSG_WARN("Cannot find MSG2QM executable")
-   fi
-fi
-
-AC_SUBST(MSG2QM)
-AC_MSG_RESULT(for MSG2QM: $msg2qm_ok)
-])dnl
diff --git a/salome_adm/unix/config_files/check_pyqt.m4 b/salome_adm/unix/config_files/check_pyqt.m4
deleted file mode 100644 (file)
index 2b6ae67..0000000
+++ /dev/null
@@ -1,307 +0,0 @@
-dnl Copyright (C) 2003  CEA/DEN, EDF R&D
-
-AC_DEFUN([CHECK_PYQT],[
-AC_REQUIRE([CHECK_PYTHON])dnl
-AC_REQUIRE([CHECK_QT])dnl
-AC_REQUIRE([CHECK_SIP])dnl
-
-AC_LANG_SAVE
-AC_LANG_CPLUSPLUS
-
-AC_ARG_WITH(pyqt,
-    [  --with-pyqt=DIR      root directory path to PyQt installation ],
-    [PYQTDIR="$withval"
-      AC_MSG_RESULT("select $withval as path to PyQt")
-    ])
-
-AC_ARG_WITH(pyqt_sips,
-    [  --with-pyqt_sips=DIR      a directory path to PyQt sips installation ],
-    [PYQT_SIPS="$withval"
-      AC_MSG_RESULT("select $withval as path to PyQt sips")
-    ])
-
-
-AC_ARG_WITH(pyuic,
-    [  --with-pyuic=EXEC pyuic executable ],
-    [PYUIC="$withval"
-      AC_MSG_RESULT("select $withval as pyqt executable")
-    ])
-
-AC_CHECKING(for pyqt)
-
-pyqt_ok=yes
-
-dnl look for pyuic
-pyqt_uic_ok=no
-if test "x$PYUIC" != x; then
-  dnl try withval value
-  AC_CHECK_FILE($PYUIC,pyqt_uic_ok=yes,pyqt_uic_ok=no)
-fi
-if test "x$pyqt_uic_ok" = "xno"; then
-  dnl try ${PYQTDIR}
-  if test "x${PYQTDIR}" != "x"; then
-    if test -d ${PYQTDIR} ; then
-      AC_CHECK_FILE(${PYQTDIR}/pyuic,pyqt_uic_ok=yes,pyqt_uic_ok=no)
-      if test "x$pyqt_uic_ok" = "xyes"; then
-        PYUIC="${PYQTDIR}/pyuic"
-      fi
-    fi
-  fi   
-fi
-if test "x$pyqt_uic_ok" = "xno"; then
-  dnl try ${SIPDIR}
-  if test "x${SIPDIR}" != "x"; then
-    if test -d ${SIPDIR} ; then
-      AC_CHECK_FILE(${SIPDIR}/pyuic,pyqt_uic_ok=yes,pyqt_uic_ok=no)
-      if test "x$pyqt_uic_ok" = "xyes"; then
-        PYUIC="${SIPDIR}/pyuic"
-      fi
-    fi
-  fi   
-fi
-if test "x$pyqt_uic_ok" = "xno"; then
-  dnl try ${PYTHONHOME}/bin
-  if test "x${PYTHONHOME}" != "x"; then
-    if test -d ${PYTHONHOME}/bin ; then
-      AC_CHECK_FILE(${PYTHONHOME}/bin/pyuic,pyqt_uic_ok=yes,pyqt_uic_ok=no)
-      if test "x$pyqt_uic_ok" = "xyes"; then
-        PYUIC="${PYTHONHOME}/bin/pyuic"
-      fi
-    fi
-  fi   
-fi
-if test "x$pyqt_uic_ok" = "xno"; then
-  dnl try /usr/bin
-  AC_CHECK_FILE(/usr/bin/pyuic,pyqt_uic_ok=yes,pyqt_uic_ok=no)
-  if test "x$pyqt_uic_ok" = "xyes"; then
-    PYUIC="/usr/bin/pyuic"
-  fi
-fi
-if test "x$pyqt_uic_ok" = "xno"; then
-  pyqt_ok=no
-fi
-
-dnl look for PyQt libs
-pyqt_lib_ok=no
-if test "x${PYQTDIR}" != "x"; then
-  dnl try {PYQTDIR}
-  AC_CHECK_FILE(${PYQTDIR}/libqtcmodule.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
-  if test "x$pyqt_lib_ok" = "xyes"; then
-    if test "x${PYQTDIR}" = "x/usr/lib"
-    then
-      PYQT_LIBS="-lqtcmodule"
-    else
-      PYQT_LIBS="-L${PYQTDIR} -lqtcmodule"
-    fi
-  else 
-    AC_CHECK_FILE(${PYQTDIR}/qt.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
-    if test "x$pyqt_lib_ok" = "xyes"; then
-      if test "x${PYQTDIR}" = "x/usr/lib"
-      then
-        PYQT_LIBS=""
-      else
-        PYQT_LIBS="-L${PYQTDIR}"
-      fi
-    fi
-  fi
-  if test "x$pyqt_lib_ok" = "xno"; then
-    dnl try {PYQTDIR}/lib
-    if test -d {PYQTDIR}/lib; then
-      AC_CHECK_FILE(${PYQTDIR}/lib/libqtcmodule.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
-      if test "x$pyqt_lib_ok" = "xyes"; then
-        PYQT_LIBS="-L${PYQTDIR}/lib -lqtcmodule"
-      else 
-        AC_CHECK_FILE(${PYQTDIR}/lib/qt.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
-        if test "x$pyqt_lib_ok" = "xyes"; then
-          PYQT_LIBS="-L${PYQTDIR}/lib"
-        fi
-      fi
-    fi
-  fi
-  if test "x$pyqt_lib_ok" = "xno"; then
-    dnl try {PYQTDIR}/lib/python${PYTHON_VERSION}/site-packages
-    if test -d {PYQTDIR}/lib/python${PYTHON_VERSION}/site-packages; then
-      AC_CHECK_FILE(${PYQTDIR}/lib/python${PYTHON_VERSION}/site-packages/libqtcmodule.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
-      if test "x$pyqt_lib_ok" = "xyes"; then
-        PYQT_LIBS="-L${PYQTDIR}/lib/python${PYTHON_VERSION}/site-packages -lqtcmodule"
-      else 
-        AC_CHECK_FILE(${PYQTDIR}/lib/python${PYTHON_VERSION}/site-packages/qt.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
-        if test "x$pyqt_lib_ok" = "xyes"; then
-          PYQT_LIBS="-L${PYQTDIR}/lib/python${PYTHON_VERSION}/site-packages"
-        fi
-      fi
-    fi
-  fi
-fi
-if test "x$pyqt_lib_ok" = "xno"; then
-  dnl try ${SIPDIR}
-  if test "x${SIPDIR}" != "x"; then
-    if test -d ${SIPDIR} ; then
-      AC_CHECK_FILE(${SIPDIR}/libqtcmodule.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
-      if test "x$pyqt_lib_ok" = "xyes"; then
-        if test "x${SIPDIR}" = "x/usr/lib"
-        then
-          PYQT_LIBS="-lqtcmodule"
-        else
-          PYQT_LIBS="-L${SIPDIR} -lqtcmodule"
-        fi
-      else 
-        AC_CHECK_FILE(${SIPDIR}/qt.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
-        if test "x$pyqt_lib_ok" = "xyes"; then
-          if test "x${SIPDIR}" = "x/usr/lib"
-          then
-            PYQT_LIBS=""
-          else
-            PYQT_LIBS="-L${SIPDIR}"
-          fi
-        fi
-      fi
-    fi
-  fi
-fi
-if test "x$pyqt_lib_ok" = "xno"; then
-  dnl try ${PYTHONHOME}/lib/python${PYTHON_VERSION}/site-packages
-  if test "x${PYTHONHOME}" != "x"; then
-    if test -d ${PYTHONHOME}/lib/python${PYTHON_VERSION}/site-packages ; then
-      AC_CHECK_FILE(${PYTHONHOME}/lib/python${PYTHON_VERSION}/site-packages/libqtcmodule.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
-      if test "x$pyqt_lib_ok" = "xyes"; then
-        PYQT_LIBS="-L${PYTHONHOME}/lib/python${PYTHON_VERSION}/site-packages -lqtcmodule"
-      else 
-        AC_CHECK_FILE(${PYTHONHOME}/lib/python${PYTHON_VERSION}/site-packages/qt.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
-        if test "x$pyqt_lib_ok" = "xyes"; then
-          PYQT_LIBS="-L${PYTHONHOME}/lib/python${PYTHON_VERSION}/site-packages"
-        fi
-      fi
-    fi
-  fi   
-fi
-if test "x$pyqt_lib_ok" = "xno"; then
-  dnl try /usr/lib/python${PYTHON_VERSION}/site-packages
-  AC_CHECK_FILE(/usr/lib/python${PYTHON_VERSION}/site-packages/libqtcmodule.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
-  if test "x$pyqt_lib_ok" = "xyes"; then
-    PYQT_LIBS="-L/usr/lib/python${PYTHON_VERSION}/site-packages -lqtcmodule"
-  else 
-    AC_CHECK_FILE(/usr/lib/python${PYTHON_VERSION}/site-packages/qt.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
-    if test "x$pyqt_lib_ok" = "xyes"; then
-      PYQT_LIBS="-L/usr/lib/python${PYTHON_VERSION}/site-packages"
-    fi
-  fi
-fi
-if test "x$pyqt_lib_ok" = "xno"; then
-  pyqt_ok=no
-fi
-
-dnl look for PyQt sips
-pyqt_sips_ok=no
-dnl try ${PYQT_SIPS} or ${PYQT_SIPS}/qt
-if test "x${PYQT_SIPS}" != "x"; then
-  AC_CHECK_FILE(${PYQT_SIPS}/qglobal.sip,pyqt_sips_ok=yes,pyqt_sips_ok=no)
-  if test "x$pyqt_sips_ok" = "xno"; then
-    AC_CHECK_FILE(${PYQT_SIPS}/qt/qglobal.sip,pyqt_sips_ok=yes,pyqt_sips_ok=no)
-    if test "x$pyqt_sips_ok" = "xyes"; then
-      PYQT_SIPS="${PYQT_SIPS}/qt"
-    fi
-  fi
-fi
-if test "x$pyqt_sips_ok" = "xno"; then
-  dnl try ${PYQTDIR}/sip
-  if test "x${PYQTDIR}" != "x"; then
-    if test -d ${PYQTDIR}/sip ; then
-      AC_CHECK_FILE(${PYQTDIR}/sip/qglobal.sip,pyqt_sips_ok=yes,pyqt_sips_ok=no)
-      if test "x$pyqt_sips_ok" = "xyes"; then
-        PYQT_SIPS="${PYQTDIR}/sip"
-      else
-        AC_CHECK_FILE(${PYQTDIR}/sip/qt/qglobal.sip,pyqt_sips_ok=yes,pyqt_sips_ok=no)
-        if test "x$pyqt_sips_ok" = "xyes"; then
-          PYQT_SIPS="${PYQTDIR}/sip/qt"
-        fi
-      fi
-    fi
-  fi
-fi
-if test "x$pyqt_sips_ok" = "xno"; then
-  dnl try ${SIPDIR}/sip
-  if test "x${SIPDIR}" != "x"; then
-    if test -d ${SIPDIR}/sip ; then
-      AC_CHECK_FILE(${SIPDIR}/sip/qglobal.sip,pyqt_sips_ok=yes,pyqt_sips_ok=no)
-      if test "x$pyqt_sips_ok" = "xyes"; then
-        PYQT_SIPS="${SIPDIR}/sip"
-      else
-        AC_CHECK_FILE(${SIPDIR}/sip/qt/qglobal.sip,pyqt_sips_ok=yes,pyqt_sips_ok=no)
-        if test "x$pyqt_sips_ok" = "xyes"; then
-          PYQT_SIPS="${SIPDIR}/sip/qt"
-        fi
-      fi
-    fi
-  fi
-fi
-if test "x$pyqt_sips_ok" = "xno"; then
-  dnl try /usr/share/sip
-  if test -d /usr/share/sip ; then
-    AC_CHECK_FILE(/usr/share/sip/qglobal.sip,pyqt_sips_ok=yes,pyqt_sips_ok=no)
-    if test "x$pyqt_sips_ok" = "xyes"; then
-      PYQT_SIPS="/usr/share/sip"
-    else
-      AC_CHECK_FILE(/usr/share/sip/qt/qglobal.sip,pyqt_sips_ok=yes,pyqt_sips_ok=no)
-      if test "x$pyqt_sips_ok" = "xyes"; then
-        PYQT_SIPS="/usr/share/sip/qt"
-      fi
-    fi
-  fi
-fi
-if test "x$pyqt_sips_ok" = "xno"; then
-  pyqt_ok=no
-else
-  PYQT_INCLUDES="-I$PYQT_SIPS"
-  
-  dnl Additional sip flags required for correct wrappers compilation
-  AC_MSG_CHECKING(which qt classes should be excluded)
-
-  PYQT_SIPFLAGS=""
-
-  CXXFLAGS_old=$CXXFLAGS
-  CXXFLAGS="$CXXFLAGS $QT_INCLUDES"
-  LIBS_old=$LIBS
-  LIBS="$LIBS $QT_LIBS"
-
-  AC_TRY_COMPILE([#include <qcdestyle.h>],
-                 [new QCDEStyle();],,PYQT_SIPFLAGS="$PYQT_SIPFLAGS -x Qt_STYLE_CDE")
-  AC_TRY_COMPILE([#include <qinterlacestyle.h>],
-                 [new QInterlaceStyle();],,PYQT_SIPFLAGS="$PYQT_SIPFLAGS -x Qt_STYLE_INTERLACE")
-  AC_TRY_COMPILE([#include <qmotifstyle.h>],
-                 [new QMotifStyle();],,PYQT_SIPFLAGS="$PYQT_SIPFLAGS -x Qt_STYLE_MOTIF")
-  AC_TRY_COMPILE([#include <qmotifplusstyle.h>],
-                 [new QMotifPlusStyle();],,PYQT_SIPFLAGS="$PYQT_SIPFLAGS -x Qt_STYLE_MOTIFPLUS")
-  AC_TRY_COMPILE([#include <qplatinumstyle.h>],
-                 [new QPlatinumStyle();],,PYQT_SIPFLAGS="$PYQT_SIPFLAGS -x Qt_STYLE_PLATINUM")
-  AC_TRY_COMPILE([#include <qsgistyle.h>],
-                 [new QSGIStyle();],,PYQT_SIPFLAGS="$PYQT_SIPFLAGS -x Qt_STYLE_SGI")
-  AC_TRY_COMPILE([#include <qwindowsstyle.h>],
-                 [new QWindowsStyle();],,PYQT_SIPFLAGS="$PYQT_SIPFLAGS -x Qt_STYLE_WINDOWS")
-  AC_TRY_COMPILE([#include <qwindowsxpstyle.h>],
-                 [new QWindowsXPStyle();],,PYQT_SIPFLAGS="$PYQT_SIPFLAGS -x Qt_STYLE_WINDOWSXP")
-
-  LIBS="$LIBS -lqassistantclient"
-  AC_TRY_LINK([#include <qassistantclient.h>],
-              [new QAssistantClient("foo");],,PYQT_SIPFLAGS="$PYQT_SIPFLAGS -x Qt_ASSISTANTCLIENT")
-
-  AC_MSG_RESULT(done)
-
-  CXXFLAGS=$CXXFLAGS_old
-  LIBS=$LIBS_old
-fi
-
-AC_SUBST(PYQT_INCLUDES)
-AC_SUBST(PYQT_LIBS)
-AC_SUBST(PYQT_SIPS)
-AC_SUBST(PYUIC)
-AC_SUBST(PYQT_SIPFLAGS)
-
-AC_LANG_RESTORE
-
-AC_MSG_RESULT(for pyqt: $pyqt_ok)
-
-])dnl
-dnl
-
-
diff --git a/salome_adm/unix/config_files/check_qwt.m4 b/salome_adm/unix/config_files/check_qwt.m4
deleted file mode 100644 (file)
index abfccc7..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-dnl Copyright (C) 2003  CEA/DEN, EDF R&D
-
-AC_DEFUN([CHECK_QWT],[
-AC_REQUIRE([CHECK_QT])dnl
-
-AC_CHECKING(for qwt)
-
-qwt_ok=yes
-
-dnl were is qwt ?
-
-AC_ARG_WITH(qwt,
-    [  --with-qwt=DIR     directory path to QWT installation ],
-    [QWTHOME="$withval"
-      AC_MSG_RESULT("select $withval as path to QWT")
-    ])
-
-AC_ARG_WITH(qwt_inc,
-    [  --with-qwt_inc=DIR   directory path to QWT includes ],
-    [QWT_INCLUDES="$withval"
-      AC_MSG_RESULT("select $withval as path to QWT includes")
-    ])
-
-if test -z "$QWTHOME"; then
-  AC_MSG_RESULT(QWTHOME not defined)
-  exits_ok=no  
-  if test "x$exits_ok" = "xno"; then
-     for d in /usr/local /usr ; do
-        AC_CHECK_FILE(${d}/lib/libqwt.so,exits_ok=yes,exits_ok=no)
-        if test "x$exits_ok" = "xyes"; then
-           QWTHOME=$d
-           AC_MSG_RESULT(libqwt.so detected in $d/lib)
-        fi
-     done
-  fi
-  if test "x$exits_ok" = "xno"; then
-     for d in `echo $LD_LIBRARY_PATH | sed -e "s/:/ /g"` ; do
-        if test -f $d/libqwt.so ; then
-           AC_MSG_RESULT(libqwt.so detected in $d)
-           QWTHOME=$d
-           QWTHOME=`echo ${QWTHOME} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
-           exits_ok=yes
-           break
-        fi
-     done
-  fi
-  if test "x$exits_ok" = "xyes"; then
-     if test -z "$QWT_INCLUDES"; then
-        QWT_INCLUDES=$QWTHOME"/include/qwt"
-        if test ! -f $QWT_INCLUDES/qwt.h ; then
-          QWT_INCLUDES=$QWTHOME"/include"
-        fi
-        if test ! -f $QWT_INCLUDES/qwt.h ; then
-          QWT_INCLUDES=/usr/lib/qt3/include/qwt
-        fi
-     fi
-  fi
-else
-  if test -z "$QWT_INCLUDES"; then
-     QWT_INCLUDES="$QWTHOME/include"
-  fi           
-fi
-
-if test "x$qwt_ok" = xno -o ! -d "$QWTHOME" ; then
-  AC_MSG_RESULT(no)
-  AC_MSG_WARN(qwt not found)
-  qwt_ok=no
-else
-   AC_LANG_SAVE
-   AC_LANG_CPLUSPLUS
-   CPPFLAGS_old=$CPPFLAGS
-   CPPFLAGS="$CPPFLAGS -I$QWT_INCLUDES"
-   CPPFLAGS="$CPPFLAGS $QT_INCLUDES"
-
-   AC_CHECK_HEADER(qwt.h,qwt_ok=yes,qwt_ok=no) 
-
-   CPPFLAGS=$CPPFLAGS_old
-
-   if test "x$qwt_ok" = xno ; then
-     AC_MSG_RESULT(no)
-     AC_MSG_WARN(qwt not found)
-  else
-     qwt_ok=yes
-  fi
-
-if  test "x$qwt_ok" = "xyes"
-then
-  AC_MSG_CHECKING(linking qwt library)
-  LIBS_old=$LIBS
-  if test "x$QTDIR" = "x/usr"
-  then
-    LIBS="$LIBS -lqt-mt"
-  else
-    LIBS="$LIBS -L$QTDIR/lib -lqt-mt"
-  fi
-  if test "x$QWTHOME" = "x/usr"
-  then
-    LIBS="$LIBS -lqwt"
-  else
-    LIBS="$LIBS -L$QWTHOME/lib -lqwt"
-  fi
-
-  CXXFLAGS_old=$CXXFLAGS
-  CXXFLAGS="$CXXFLAGS $QT_INCLUDES -I$QWT_INCLUDES"
-
-  AC_CACHE_VAL(salome_cv_lib_qwt,[
-    AC_TRY_LINK(
-#include <qapplication.h>
-#include <qwt_plot.h>
-,   int n;
-    char **s;
-    QApplication a(n, s);
-    QwtPlot* p;
-    a.setMainWidget(p);
-    a.exec();,
-    eval "salome_cv_lib_qwt=yes",eval "salome_cv_lib_qwt=no")
-  ])
-  qwt_ok="$salome_cv_lib_qwt"
-
-  if  test "x$qwt_ok" = "xno"
-  then
-    AC_MSG_RESULT(unable to link with qwt library)
-    AC_MSG_RESULT(QWTHOME environment variable may be wrong)
-  else
-    QWT_INCLUDES="-I$QWT_INCLUDES"
-    if test "x$QWTHOME" = "x/usr"
-    then
-      QWT_LIBS=" -lqwt"
-    else
-      QWT_LIBS="-L$QWTHOME/lib -lqwt"
-    fi
-
-    AC_SUBST(QWT_INCLUDES)
-    AC_SUBST(QWT_LIBS)
-
-    AC_MSG_RESULT(yes)
-  fi
-
-  LIBS=$LIBS_old
-  CXXFLAGS=$CXXFLAGS_old
-
-fi
-
-
-  AC_LANG_RESTORE
-
-fi
-
-
-])dnl
-dnl
diff --git a/salome_adm/unix/config_files/check_sip.m4 b/salome_adm/unix/config_files/check_sip.m4
deleted file mode 100644 (file)
index 4158e99..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-dnl Copyright (C) 2003  CEA/DEN, EDF R&D
-
-AC_DEFUN([CHECK_SIP],[
-AC_REQUIRE([CHECK_PYTHON])dnl
-AC_REQUIRE([CHECK_QT])dnl
-
-sip_ok=yes
-
-AC_ARG_WITH(sip,
-    [  --with-sip=EXEC sip executable ],
-    [SIP="$withval"
-      AC_MSG_RESULT("select $withval as sip executable")
-    ], [
-      AC_PATH_PROG(SIP, sip)
-    ])
-
-if test "x$SIP" = "x" ; then
-    sip_ok=no
-    AC_MSG_RESULT(sip not in PATH variable)
-else
-    version=`$SIP -V`
-    AC_MSG_RESULT(sip version is $version)
-    case "$version" in
-         3.2*)
-           SIP_VERS=v3_old ;;
-         3.3*)
-           SIP_VERS=v3_old ;;
-         3.4*)
-           SIP_VERS=v3_old ;;
-         3.5*)
-           SIP_VERS=v3_old ;;
-         3.6*)
-           SIP_VERS=v3_old ;;
-         3.7*)
-           SIP_VERS=v3_old ;;
-         3.8*)
-           SIP_VERS=v3_old ;;
-         3.9*)
-           SIP_VERS=v3_old ;;
-         3.10*)
-           SIP_VERS=v3_new ;;
-         4.1*)
-           SIP_VERS=v4_old ;;
-         4.2*)
-           SIP_VERS=v4_new ;;
-         *)
-           AC_MSG_RESULT(sip version $version not supported)
-           SIP_VERS=unsupported ;;
-    esac
-
-    sip_ok=no
-    dnl Search sip.h file
-    if test "x$SIPDIR" != "x" ; then
-        dnl look for sip.h in ${SIPDIR}
-        AC_CHECK_FILE(${SIPDIR}/sip.h,sip_ok=yes,sip_ok=no)
-       if test "x$sip_ok" = "xyes" ; then
-           SIP_INCLUDES="-I${SIPDIR}"
-       fi
-        if test "x$sip_ok" = "xno" ; then
-            dnl look for sip.h in ${SIPDIR}/include/python${PYTHON_VERSION}
-           if test -d ${SIPDIR}/include/python${PYTHON_VERSION} ; then
-               AC_CHECK_FILE(${SIPDIR}/include/python${PYTHON_VERSION}/sip.h,sip_ok=yes,sip_ok=no)
-               if test "x$sip_ok" = "xyes" ; then
-                   SIP_INCLUDES="-I${SIPDIR}/include/python${PYTHON_VERSION}"
-               fi
-           fi
-       fi
-    fi
-    if test "x$sip_ok" = "xno" ; then
-        dnl look for sip.h in ${PYTHON_PREFIX}/include/python${PYTHON_VERSION}
-       if test -d ${PYTHON_PREFIX}/include/python${PYTHON_VERSION} ; then
-            AC_CHECK_FILE(${PYTHON_PREFIX}/include/python${PYTHON_VERSION}/sip.h,sip_ok=yes,sip_ok=no)
-           if test "x$sip_ok" = "xyes" ; then
-               SIP_INCLUDES="${PYTHON_INCLUDES}"
-            fi
-       fi
-    fi
-    if test "x$sip_ok" = "xno" ; then
-        dnl look for sip.h in /usr/include/python${PYTHON_VERSION}
-       if test -d /usr/include/python${PYTHON_VERSION} ; then
-            AC_CHECK_FILE(/usr/include/python${PYTHON_VERSION}/sip.h,sip_ok=yes,sip_ok=no)
-           if test "x$sip_ok" = "xyes" ; then
-               SIP_INCLUDES="/usr/include/python${PYTHON_VERSION}"
-            fi
-       fi
-    fi
-       
-    dnl Search (lib)sip.so file
-    sip_lib_ok=no
-    if test "x$SIPDIR" != "x" ; then
-        dnl look for (lib)sip.so in ${SIPDIR}
-        AC_CHECK_FILE(${SIPDIR}/libsip.so,sip_lib_ok=yes,sip_lib_ok=no)
-       if test "x$sip_lib_ok" = "xyes" ; then
-            if test "x${SIPDIR}" = "x/usr/lib"
-            then
-              SIP_LIBS="-lsip"
-            else
-              SIP_LIBS="-L${SIPDIR} -lsip"
-            fi
-       else
-           AC_CHECK_FILE(${SIPDIR}/sip.so,sip_lib_ok=yes,sip_lib_ok=no)
-           if test "x$sip_lib_ok" = "xyes" ; then
-              if test "x${SIPDIR}" = "x/usr/lib"
-              then
-                SIP_LIBS=""
-              else
-                SIP_LIBS="-L${SIPDIR}"
-              fi
-           fi
-       fi
-
-        if test "x$sip_lib_ok" = "xno" ; then
-            dnl look for (lib)sip.so in ${SIPDIR}/lib/python${PYTHON_VERSION}/site-packages
-           if test -d ${SIPDIR}/lib/python${PYTHON_VERSION}/site-packages ; then
-               AC_CHECK_FILE(${SIPDIR}/lib/python${PYTHON_VERSION}/site-packages/libsip.so,sip_lib_ok=yes,sip_lib_ok=no)
-               if test "x$sip_lib_ok" = "xyes" ; then
-                   SIP_LIBS="-L${SIPDIR}/lib/python${PYTHON_VERSION}/site-packages -lsip"
-               else
-                   AC_CHECK_FILE(${SIPDIR}/lib/python${PYTHON_VERSION}/site-packages/sip.so,sip_lib_ok=yes,sip_lib_ok=no)
-                   if test "x$sip_lib_ok" = "xyes" ; then
-                       SIP_LIBS="-L${SIPDIR}/lib/python${PYTHON_VERSION}/site-packages"
-                   fi
-               fi
-           fi
-       fi
-    fi
-    if test "x$sip_lib_ok" = "xno" ; then
-        dnl look for (lib)sip.so in ${PYTHON_PREFIX}/lib/python${PYTHON_VERSION}/site-packages
-       if test -d ${PYTHON_PREFIX}/lib/python${PYTHON_VERSION}/site-packages ; then
-            AC_CHECK_FILE(${PYTHON_PREFIX}/lib/python${PYTHON_VERSION}/site-packages/libsip.so,sip_lib_ok=yes,sip_lib_ok=no)
-           if test "x$sip_lib_ok" = "xyes" ; then
-               SIP_LIBS="-L${PYTHON_PREFIX}/lib/python${PYTHON_VERSION}/site-packages -lsip"
-           else
-               AC_CHECK_FILE(${PYTHON_PREFIX}/lib/python${PYTHON_VERSION}/site-packages/sip.so,sip_lib_ok=yes,sip_lib_ok=no)
-                if test "x$sip_lib_ok" = "xyes" ; then
-                   SIP_LIBS="-L${PYTHON_PREFIX}/lib/python${PYTHON_VERSION}/site-packages"
-                fi
-           fi
-       fi
-    fi
-    if test "x$sip_lib_ok" = "xno" ; then
-        dnl look for (lib)sip.so in /usr/lib/python${PYTHON_VERSION}/site-packages
-       if test -d /usr/lib/python${PYTHON_VERSION}/site-packages ; then
-            AC_CHECK_FILE(/usr/lib/python${PYTHON_VERSION}/site-packages/libsip.so,sip_lib_ok=yes,sip_lib_ok=no)
-           if test "x$sip_lib_ok" = "xyes" ; then
-               SIP_LIBS="-L$/usr/lib/python${PYTHON_VERSION}/site-packages -lsip"
-           else
-               AC_CHECK_FILE(/usr/lib/python${PYTHON_VERSION}/site-packages/sip.so,sip_lib_ok=yes,sip_lib_ok=no)
-                if test "x$sip_lib_ok" = "xyes" ; then
-                   SIP_LIBS="-L/usr/lib/python${PYTHON_VERSION}/site-packages"
-               fi
-            fi
-       fi
-    fi
-    if test "x$sip_lib_ok" = "xno" ; then
-        sip_ok=no
-    fi
-fi
-
-AC_SUBST(SIP)
-AC_SUBST(SIP_INCLUDES)
-AC_SUBST(SIP_LIBS)
-AC_SUBST(SIP_VERS)
-
-AC_MSG_RESULT(for sip: $sip_ok)
-
-])dnl
-dnl
diff --git a/salome_adm/unix/config_files/check_vtk.m4 b/salome_adm/unix/config_files/check_vtk.m4
deleted file mode 100644 (file)
index 5d06c91..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-dnl  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
-dnl
-dnl
-dnl
-
-AC_DEFUN([CHECK_VTK],[
-AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_PROG_CXX])dnl
-AC_REQUIRE([AC_PROG_CPP])dnl
-AC_REQUIRE([AC_PROG_CXXCPP])dnl
-
-AC_CHECKING(for VTK)
-
-AC_LANG_SAVE
-AC_LANG_CPLUSPLUS
-
-AC_SUBST(VTK_INCLUDES)
-AC_SUBST(VTK_LIBS)
-AC_SUBST(VTKPY_MODULES)
-
-VTK_INCLUDES=""
-VTK_LIBS=""
-VTKPY_MODULES=""
-
-vtk_ok=no
-
-AC_PATH_X
-
-if test "x$OpenGL_ok" != "xyes"
-then
-   AC_MSG_WARN(vtk needs OpenGL correct configuration, check configure output)
-fi
-
-if test "x$x_libraries" != "x"
-then
-   LXLIB="-L$x_libraries"
-else
-   LXLIB=""
-fi
-
-if test "x$x_libraries" = "x/usr/lib"
-then
-   LXLIB=""
-fi
-
-if test "x$x_libraries" = "x/usr/lib"
-then
-   LXLIB=""
-fi
-
-if test "x$x_libraries" = "x/usr/lib"
-then
-   LXLIB=""
-fi
-
-LOCAL_INCLUDES="$OGL_INCLUDES"
-LOCAL_LIBS="-lvtkCommon -lvtkGraphics -lvtkImaging -lvtkFiltering -lvtkIO -lvtkRendering -lvtkHybrid $OGL_LIBS $LXLIB -lX11 -lXt"
-TRY_LINK_LIBS="-lvtkCommon $OGL_LIBS $LXLIB -lX11 -lXt"
-
-if test -z "$VTKHOME"
-then 
-   AC_MSG_WARN(undefined VTKHOME variable which specify where vtk was compiled)
-   if test -f /usr/include/vtk/vtkPlane.h ; then
-      AC_MSG_RESULT(trying /usr)
-      VTKHOME="/usr"
-   fi
-fi
-
-if test ! -z "$VTKHOME"
-then
-   LOCAL_INCLUDES="-I$VTKHOME/include/vtk $LOCAL_INCLUDES"
-   LOCAL_LIBS="-L$VTKHOME/lib/vtk $LOCAL_LIBS"
-   TRY_LINK_LIBS="-L$VTKHOME/lib/vtk $TRY_LINK_LIBS"
-fi
-
-dnl vtk headers
-CPPFLAGS_old="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS $LOCAL_INCLUDES"
-
-AC_CHECK_HEADER(vtkPlane.h,vtk_ok="yes",vtk_ok="no")
-
- CPPFLAGS="$CPPFLAGS_old"
-
- if  test "x$vtk_ok" = "xyes"
- then
-   VTK_INCLUDES="$LOCAL_INCLUDES"
-
- dnl vtk libraries
-
-   AC_MSG_CHECKING(linking VTK library)
-
-  LIBS_old="$LIBS"
-#  LIBS="$LIBS $TRY_LINK_LIBS"
-  LIBS="$LIBS $LOCAL_LIBS"
-  CPPFLAGS_old="$CPPFLAGS"
-  CPPFLAGS="$CPPFLAGS $VTK_INCLUDES"
-
- dnl  VTKPY_MODULES="$VTKHOME/python"
-
-   AC_CACHE_VAL(salome_cv_lib_vtk,[
-     AC_TRY_LINK(
-#include "vtkPlane.h"
-,   vtkPlane *p = vtkPlane::New();,
-    eval "salome_cv_lib_vtk=yes",eval "salome_cv_lib_vtk=no")
-  ])
-  vtk_ok="$salome_cv_lib_vtk"
-  LIBS="$LIBS_old"
-  CPPFLAGS="$CPPFLAGS_old"
-
-fi
-
-if  test "x$vtk_ok" = "xno"
-then
-  AC_MSG_RESULT("no")
-  AC_MSG_WARN(unable to link with vtk library)
-else
-  AC_MSG_RESULT("yes")
-  VTK_LIBS="$LOCAL_LIBS"
-  VTK_MT_LIBS="$LOCAL_LIBS"
-fi
-
-AC_MSG_RESULT("for vtk: $vtk_ok")
-
-AC_LANG_RESTORE
-
-# Save cache
-AC_CACHE_SAVE
-
-])dnl
-
-
index 2844fbaee749901ec417d01a85b7f03db00e8658..37f878bc67a10fbb2c430172540ead8f4b5bd5ba 100644 (file)
@@ -31,14 +31,16 @@ dnl
 AC_DEFUN([ENABLE_PTHREADS],[
 AC_REQUIRE([ACX_PTHREAD])
 
-if test x"$acx_pthread_ok" = xyes; then
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
- CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
- LIBS="$LIBS $PTHREAD_LIBS"
-  threads_ok=yes
-else
-  threads_ok=no
+if test x"$enable_pthreads_done" != xyes; then
+  if test x"$acx_pthread_ok" = xyes; then
+    CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+    CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
+    LIBS="$LIBS $PTHREAD_LIBS"
+    threads_ok=yes
+  else
+    threads_ok=no
+  fi
+  enable_pthreads_done=yes
 fi
-enable_pthreads_done=yes
 ])dnl
 dnl
diff --git a/src/CASCatch/CASCatch.hxx b/src/CASCatch/CASCatch.hxx
new file mode 100644 (file)
index 0000000..a5af66a
--- /dev/null
@@ -0,0 +1,55 @@
+// Copyright (C) 2005  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/
+//
+
+#ifndef _CASCatch_HeaderFile
+#define _CASCatch_HeaderFile
+
+#include <Standard_Failure.hxx>
+#include <Standard_ErrorHandler.hxx>
+
+
+#ifdef try
+#  undef try
+#endif
+
+#ifdef catch
+#  undef catch
+#endif
+
+#ifdef NO_CXX_EXCEPTION
+#  if defined(DO_ABORT)
+#    define CASCatch_TRY \
+       Standard_ErrorHandler _Function; \
+       K_SETJMP = 1 ; \
+       if(DoesNotAbort(_Function))
+#   else  //If DO_ABORT is not defined
+#     define CASCatch_TRY \
+        Standard_ErrorHandler _Function; \
+        if(DoesNotAbort(_Function))
+#   endif //DO_ABORT
+#   define CASCatch_CATCH(Error)   \
+      else if(_Function.Catches(STANDARD_TYPE(Error)))
+#else
+#  define CASCatch_TRY try
+#  define CASCatch_CATCH catch
+#endif //NO_CXX_EXCEPTION
+
+
+#endif
index ba1f24b0a309c939d5cc09522be8feaa695c90fb..c8c2c673e4f2523a60b4873acfdaa97c0eaa646d 100644 (file)
@@ -5,17 +5,5 @@
 include $(top_srcdir)/salome_adm/unix/make_common_starter.am
 
 
-salomeinclude_HEADERS      = CASCatch_Failure.hxx \
-                             CASCatch_CatchSignals.hxx \
-                             CASCatch_ErrorHandler.hxx
+salomeinclude_HEADERS   = CASCatch.hxx 
 
-# Libraries targets
-lib_LTLIBRARIES         = libCASCatch.la 
-libCASCatch_la_SOURCES  = CASCatch_Failure.cxx \
-                          CASCatch_ErrorHandler.cxx \
-                          CASCatch_CatchSignals.cxx
-
-libCASCatch_la_LDFLAGS  = -no-undefined -version-info=0:0:0
-libCASCatch_la_CPPFLAGS = @CAS_CPPFLAGS@
-libCASCatch_la_CXXFLAGS = @CAS_CXXFLAGS@
-libCASCatch_la_LIBADD   = @CAS_KERNEL@ @CAS_MATH@
index 96779e09fd65fdb2080c6f9162ce8f69ef3c2f06..0af3362a3d74eed19235ce4b90824ea130be6102 100644 (file)
@@ -423,8 +423,11 @@ Engines_Container_i::create_component_instance(const char*genericRegisterName,
       SCRUTE(iors);
       Py_RELEASE_NEW_THREAD;
   
-      CORBA::Object_var obj = _orb->string_to_object(iors.c_str());
-      iobject = Engines::Component::_narrow( obj ) ;
+      if( iors!="" )
+      {
+       CORBA::Object_var obj = _orb->string_to_object(iors.c_str());
+       iobject = Engines::Component::_narrow( obj ) ;
+      }
       return iobject._retn();
     }
   
index 789f6e1a6f4f053a7b8f6df82ceea9cee25a0347..f4e7caf5c3b7273ea88b1a37f616dbf35ea53179 100644 (file)
@@ -159,7 +159,7 @@ void HDFdataset::GetDim(hdf_size dim[])
       else
        ndim = _ndim;
       _dim = new hdf_size[ndim];
-      if ((ret == HDFdatasetGetDim(_id,_dim)) < 0)
+      if ((ret = HDFdatasetGetDim(_id,_dim)) < 0)
        throw HDFexception("Can't determine the size dimensions of the dataset ");
     }
 
index 6950167fe1c9f7fe742d988ee113d4c754123046..e4ee6443f6d0bd4587f02fe950f34b756b804217 100755 (executable)
@@ -38,7 +38,8 @@ pkgpython_PYTHON = \
        salome_study.py \
        salome_iapp.py \
        salome_ComponentGUI.py \
-       omnipatch.py
+       omnipatch.py \
+       iparameters.py
 
 sharedpkgpython_PYTHON = kernel_shared_modules.py
 
diff --git a/src/KERNEL_PY/iparameters.py b/src/KERNEL_PY/iparameters.py
new file mode 100755 (executable)
index 0000000..96abfbe
--- /dev/null
@@ -0,0 +1,199 @@
+import salome
+import string
+import SALOME
+import SALOMEDS
+import SALOME_Session_idl
+
+PT_INTEGER = 0
+PT_REAL = 1
+PT_BOOLEAN = 2
+PT_STRING = 3
+PT_REALARRAY = 4
+PT_INTARRAY = 5
+PT_STRARRAY = 6
+
+_AP_LISTS_LIST_ = "AP_LISTS_LIST"
+_AP_ENTRIES_LIST_ = "AP_ENTRIES_LIST"
+_AP_PROPERTIES_LIST_ = "AP_PROPERTIES_LIST"
+_AP_DUMP_PYTHON_ = "AP_DUMP_PYTHON"
+
+vp_session = None
+
+def getSession():
+    global vp_session
+    if vp_session is None:
+        vp_session = salome.naming_service.Resolve("/Kernel/Session")
+        vp_session = vp_session._narrow(SALOME.Session)
+        pass
+    return vp_session 
+
+class IParameters:
+    def __init__(self, attributeParameter):
+        """Initializes the instance"""
+        self._ap = attributeParameter
+        pass
+
+    def append(self, listName, value):
+        """Appends a value to the named list"""
+        if self._ap is None: return -1
+        v = []
+        if self._ap.IsSet(listName, PT_STRARRAY) == 0:
+            if self._ap.IsSet(_AP_LISTS_LIST_, PT_STRARRAY) == 0: self._ap.SetStrArray(_AP_LISTS_LIST_, v);
+            if listName != _AP_ENTRIES_LIST_ and listName != _AP_PROPERTIES_LIST_:
+                self.append(_AP_LISTS_LIST_, listName)
+                pass
+            self._ap.SetStrArray(listName, v)
+            pass
+        
+        v = self._ap.GetStrArray(listName)
+        v.append(value)
+        self._ap.SetStrArray(listName, v)
+        return (len(v)-1)
+    
+    def nbValues(self, listName):
+        """Returns a number of values in the named list"""
+        if self._ap is None: return -1
+        if self._ap.IsSet(listName, PT_STRARRAY) == 0: return 0
+        v = self._ap.GetStrArray(listName)
+        return len(v)
+
+    def getValues(self, listName):
+        """Returns a list of values in the named list"""
+        v = []
+        if self._ap is None: return v
+        if self._ap.IsSet(listName, PT_STRARRAY) == 0: return v
+        return self._ap.GetStrArray(listName)
+
+    def getLists(self):
+        """Returns a list of named lists' names"""
+        v = []
+        if self._ap is None: return v
+        if self._ap.IsSet(_AP_LISTS_LIST_, PT_STRARRAY) == 0: return v
+        return self._ap.GetStrArray(_AP_LISTS_LIST_)
+
+    def setParameter(self, entry, parameterName, value):
+        """Sets a value of the named parameter for the entry"""
+        if self._ap is None: return
+        v = []
+        if self._ap.IsSet(entry, PT_STRARRAY) ==0: 
+            self.append(_AP_ENTRIES_LIST_, entry) #Add the entry to the internal list of entries
+            self._ap.SetStrArray(entry, v)
+            pass
+        
+        v = self._ap.GetStrArray(entry)
+        v.append(parameterName)
+        v.append(value)
+        self._ap.SetStrArray(entry, v)
+        pass
+
+    def getParameter(self, entry, parameterName):
+        """Returns a value of the named parameter for the entry"""
+        if self._ap is None: return ""
+        if self._ap.IsSet(entry, PT_STRARRAY) == 0: return ""
+        v = self._ap.GetStrArray(entry)
+        length = len(v);
+        i = 0
+        while i<length:
+            if v[i] == parameterName: return v[i+1]
+            i+=1
+            pass
+        
+        return ""
+
+    def getAllParameterNames(self, entry):
+        """Returns all parameter names of the given entry"""
+        v = []
+        names = []
+        if self._ap is None: return v
+        if self._ap.IsSet(entry, PT_STRARRAY) == 0: return v
+        v = self._ap.GetStrArray(entry)
+        length = len(v)
+        i = 0
+        while i<length:
+            names.append(v[i])
+            i+=2
+            pass
+        
+        return names
+
+    def getAllParameterValues(self, entry):
+        """Returns all parameter values of the given entry"""
+        v = []
+        values = []
+        if self._ap is None: return v
+        if self._ap.IsSet(entry, PT_STRARRAY) == 0: return v
+        v = self._ap.GetStrArray(entry)
+        length = len(v)
+        i = 1
+        while i<length:
+            values.append(v[i]+1)
+            i+=2
+            pass
+        
+        return values
+
+    def getNbParameters(self, entry):
+        """Returns a number of parameters of the entry"""
+        if self._ap is None: return -1
+        if self._ap.IsSet(entry, PT_STRARRAY) == 0: return -1
+        return len(self._ap.GetStrArray(entry))/2
+
+    def getEntries(self):
+        """Returns all entries"""
+        v = []
+        if self._ap is None: return v
+        if self._ap.IsSet(_AP_ENTRIES_LIST_, PT_STRARRAY) == 0: return v
+        return self._ap.GetStrArray(_AP_ENTRIES_LIST_)
+
+    def setProperty(self, name, value):
+        """Sets a property value"""
+        if self._ap is None: return
+        if self._ap.IsSet(name, PT_STRING) == 0: 
+            self.append(_AP_PROPERTIES_LIST_, name) #Add the property to the internal list of properties
+            pass
+        self._ap.SetString(name, value)
+        pass
+
+    def getProperty(self, name):
+        """Returns a value of the named property"""
+        if self._ap is None: return ""
+        if self._ap.IsSet(name, PT_STRING) == 0: return ""
+        return self._ap.GetString(name)
+
+    def getProperties(self):
+        """Returns all propetries"""
+        v = []
+        if self._ap is None: return v
+        if self._ap.IsSet(_AP_PROPERTIES_LIST_, PT_STRARRAY) == 0: return v
+        return self._ap.GetStrArray(_AP_PROPERTIES_LIST_)
+
+    def parseValue(self, value, separator, fromEnd):
+        """Breaks a value string in two parts which is divided by separator."""
+        v = []
+        pos = - 1
+        if fromEnd == 1: pos = value.rfind(separator)
+        else: pos = value.find(separator)
+
+        if pos < 0: 
+            v.append(value)
+            return v
+        
+        part1 = value[0:pos]
+        part2 = value[pos+1:len(value)]
+        v.append(part1)
+        v.append(part2)
+        return v
+
+    def setDumpPython(self, isDumping):
+        """Enables/Disables the dumping to Python"""
+        if self._ap is None: return
+        _ap.SetBool(_AP_DUMP_PYTHON_, isDumping)
+        pass
+
+    def isDumpPython(self):
+        """Returns whether there is the dumping to Python"""
+        if self._ap is None: return 0
+        if self._ap.IsSet(_AP_DUMP_PYTHON_, PT_BOOLEAN) == 0: return 0
+        return self._ap.GetBool(_AP_DUMP_PYTHON_)
+
+    pass
index 3520511e2ff82588889c4bd6f8a515a2dcab1320..3b43eb7e18d65a1c1e952abba7f9c100769ab3c7 100644 (file)
@@ -65,7 +65,9 @@ SUBDIR_CPPUNIT_CORBA = \
   SALOMETraceCollector/Test \
   Utils/Test \
   NamingService/Test \
-  LifeCycleCORBA/Test
+  LifeCycleCORBA/Test \
+  SALOMEDSImpl/Test \
+  SALOMEDS/Test
 
 SUBDIR_CPPUNIT_GENERAL = \
   UnitTests
index 97f736b5e7776ddbf8e063fd9624400ca20f99b7..7a8263368faa9fea6bdfc33afd5ea48a3721cc0d 100644 (file)
@@ -22,7 +22,8 @@ salomeinclude_HEADERS= \
        SALOMEDS_SComponent_i.hxx \
        SALOMEDS_SComponent.hxx \
        SALOMEDS_GenericAttribute_i.hxx \
-       SALOMEDS_GenericAttribute.hxx
+       SALOMEDS_GenericAttribute.hxx \
+       SALOMEDS_IParameters.hxx
 
 # Scripts to be installed
 dist_salomescript_DATA = SALOME_DriverPy.py
@@ -120,6 +121,7 @@ libSalomeDS_la_SOURCES =    \
        SALOMEDS_AttributeTableOfString_i.cxx \
        SALOMEDS_AttributeStudyProperties_i.cxx \
        SALOMEDS_AttributePythonObject_i.cxx \
+       SALOMEDS_AttributeParameter_i.cxx \
        SALOMEDS_SObject.cxx \
        SALOMEDS_SComponent.cxx \
        SALOMEDS_GenericAttribute.cxx \
@@ -158,6 +160,9 @@ libSalomeDS_la_SOURCES =    \
        SALOMEDS_AttributeTextHighlightColor.cxx \
        SALOMEDS_AttributeTreeNode.cxx \
        SALOMEDS_AttributeUserID.cxx \
+       SALOMEDS_TMPFile_i.cxx \
+       SALOMEDS_AttributeParameter.cxx \
+       SALOMEDS_IParameters.cxx \
        \
        Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx \
        Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx \
@@ -296,7 +301,10 @@ libSalomeDS_la_SOURCES =   \
        SALOMEDS_UseCaseBuilder.hxx \
        SALOMEDS_UseCaseBuilder_i.hxx \
        SALOMEDS_UseCaseIterator.hxx \
-       SALOMEDS_UseCaseIterator_i.hxx 
+       SALOMEDS_UseCaseIterator_i.hxx \
+       SALOMEDS_AttributeParameter.hxx \
+       SALOMEDS_AttributeParameter_i.hxx \
+       SALOMEDS_TMPFile_i.hxx
 
 libSalomeDS_la_CPPFLAGS = $(COMMON_CPPFLAGS)
 libSalomeDS_la_LDFLAGS  = -no-undefined -version-info=0:0:0
index ae488ad0a7421c26faf12a33d44c5e809a4a9310..4a35577e12f33e2a9988df814177a7faed6b20ac 100644 (file)
 //  Module : SALOME
 //  $Header$
 
-
 #ifndef WNT
 #include <SALOMEDS.hxx>
+#include <SALOMEDS_StudyManager.hxx>
+#include <SALOMEDS_Study.hxx>
+#include <SALOMEDS_SObject.hxx>
+#include <SALOMEDS_SComponent.hxx>
+#include <SALOMEDSClient.hxx>
+#include <SALOMEDS_StudyManager_i.hxx>
 #else
 #include "SALOMEDS.hxx"
+#include "SALOMEDS_StudyManager.hxx"
+#include "SALOMEDS_Study.hxx"
+#include "SALOMEDS_SObject.hxx"
+#include "SALOMEDS_SComponent.hxx"
+#include "SALOMEDSClient.hxx"
+#include "SALOMEDS_StudyManager_i.hxx"
 #endif
 
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+
 using namespace SALOMEDS;
 
 // PAL8065: san -- Global recursive mutex for SALOMEDS methods
@@ -55,3 +70,48 @@ void SALOMEDS::unlock()
 {
   Locker::MutexDS.unlock();
 }
+
+
+
+// srn: Added new library methods that create basic SALOMEDS objects (StudyManager, Study, SComponent, SObject)
+
+//=============================================================================
+/*!
+ * C factory, accessible with dlsym, after dlopen
+ */
+//=============================================================================
+
+
+extern "C"
+{
+
+SALOMEDSClient_StudyManager* StudyManagerFactory()
+{
+  return new SALOMEDS_StudyManager();
+}
+
+SALOMEDSClient_Study* StudyFactory(SALOMEDS::Study_ptr theStudy)
+{
+  return new SALOMEDS_Study(theStudy);
+}
+
+SALOMEDSClient_SObject* SObjectFactory(SALOMEDS::SObject_ptr theSObject)
+{
+  return new SALOMEDS_SObject(theSObject);
+}
+
+SALOMEDSClient_SComponent* SComponentFactory(SALOMEDS::SComponent_ptr theSComponent)
+{
+  return new SALOMEDS_SComponent(theSComponent);
+}
+
+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");
+  return new SALOMEDS_StudyManager();
+}
+
+}
diff --git a/src/SALOMEDS/SALOMEDS_AttributeParameter.cxx b/src/SALOMEDS/SALOMEDS_AttributeParameter.cxx
new file mode 100644 (file)
index 0000000..897ca78
--- /dev/null
@@ -0,0 +1,481 @@
+// Copyright (C) 2005  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/
+//
+//  File   : SALOMEDS_AttributeParameter.cxx
+//  Author : Sergey RUIN
+//  Module : SALOME
+
+#include "SALOMEDS_AttributeParameter.hxx"
+#include "SALOMEDS.hxx"
+
+#include <string>
+#include <TCollection_AsciiString.hxx> 
+
+//=======================================================================
+/*!
+ * Function : Constructor
+ * Purpose  : Creates a new instance of SALOMEDS_AttributeParameter
+ */
+//=======================================================================
+SALOMEDS_AttributeParameter::SALOMEDS_AttributeParameter(const Handle(SALOMEDSImpl_AttributeParameter)& theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+//=======================================================================
+/*!
+ * Function : Constructor
+ * Purpose  : Creates a new instance of SALOMEDS_AttributeParameter
+ */
+//=======================================================================
+SALOMEDS_AttributeParameter::SALOMEDS_AttributeParameter(SALOMEDS::AttributeParameter_ptr theAttr)
+:SALOMEDS_GenericAttribute(theAttr)
+{}
+
+//=======================================================================
+/*!
+ * Function : Destructor
+ * Purpose  : Destroys the instance of SALOMEDS_AttributeParameter
+ */
+//=======================================================================
+SALOMEDS_AttributeParameter::~SALOMEDS_AttributeParameter()
+{}
+
+//=======================================================================
+/*!
+ * Function : SetInt
+ * Purpose  : Associates a integer value with the ID
+ */
+//=======================================================================
+void SALOMEDS_AttributeParameter::SetInt(const string& theID, const int theValue) 
+{
+  CheckLocked();
+
+  if(_isLocal) {
+    SALOMEDS::Locker lock; 
+    Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetInt(theID, theValue);
+  }
+  else
+    SALOMEDS::AttributeParameter::_narrow(_corba_impl)->SetInt(theID.c_str(), theValue);
+}
+
+//=======================================================================
+/*!
+ * Function : GetInt
+ * Purpose  : Returns a int value associated with the given ID
+ */
+//=======================================================================
+int SALOMEDS_AttributeParameter::GetInt(const string& theID) 
+{
+  int aValue;
+  if(_isLocal) {
+    SALOMEDS::Locker lock; 
+    aValue = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetInt(theID);
+  }
+  else
+    aValue = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetInt(theID.c_str());
+  return aValue;
+}
+
+//=======================================================================
+/*!
+ * Function : SetReal
+ * Purpose  : Associates a double value with the ID
+ */
+//=======================================================================
+void SALOMEDS_AttributeParameter::SetReal(const string& theID, const double& theValue) 
+{
+  CheckLocked();
+
+  if(_isLocal) {
+    SALOMEDS::Locker lock; 
+    Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetReal(theID, theValue);
+  }
+  else
+    SALOMEDS::AttributeParameter::_narrow(_corba_impl)->SetReal(theID.c_str(), theValue);
+}
+//=======================================================================
+/*!
+ * Function : GetReal
+ * Purpose  : Returns a double value associated with the given ID
+ */
+//=======================================================================
+double SALOMEDS_AttributeParameter::GetReal(const string& theID) 
+{
+  double aValue;
+  if(_isLocal) {
+    SALOMEDS::Locker lock; 
+    aValue = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetReal(theID);
+  }
+  else
+    aValue = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetReal(theID.c_str());
+  return aValue;
+}
+
+//=======================================================================
+/*!
+ * Function : SetString
+ * Purpose  : Associates a string with the ID
+ */
+//=======================================================================
+void SALOMEDS_AttributeParameter::SetString(const string& theID, const string& theValue) 
+{
+  CheckLocked();
+
+  if(_isLocal) {
+    SALOMEDS::Locker lock; 
+    Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetString(theID, theValue);
+  }
+  else
+    SALOMEDS::AttributeParameter::_narrow(_corba_impl)->SetString(theID.c_str(), theValue.c_str());
+}
+//=======================================================================
+/*!
+ * Function : GetString
+ * Purpose  : Returns a string associated with the given ID
+ */
+//=======================================================================
+string SALOMEDS_AttributeParameter::GetString(const string& theID) 
+{
+  string aValue;
+  if(_isLocal) {
+    SALOMEDS::Locker lock; 
+    aValue = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetString(theID);
+  }
+  else
+    aValue = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetString(theID.c_str());
+  return aValue;
+}
+  
+//=======================================================================
+/*!
+ * Function : SetBool
+ * Purpose  : Associates a bool value with the ID
+ */
+//=======================================================================
+void SALOMEDS_AttributeParameter::SetBool(const string& theID, const bool& theValue) 
+{
+  CheckLocked();
+
+  if(_isLocal) {
+    SALOMEDS::Locker lock; 
+    Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetBool(theID, theValue);
+  }
+  else
+    SALOMEDS::AttributeParameter::_narrow(_corba_impl)->SetBool(theID.c_str(), theValue);
+}
+
+//=======================================================================
+/*!
+ * Function : GetBool
+ * Purpose  : Returns a bool value associated with the ID
+ */
+//=======================================================================
+bool SALOMEDS_AttributeParameter::GetBool(const string& theID) 
+{
+  if(_isLocal) {
+    SALOMEDS::Locker lock; 
+    return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetBool(theID);
+  }
+  else
+    return SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetBool(theID.c_str());
+}
+  
+//=======================================================================
+/*!
+ * Function : SetRealArray
+ * Purpose  : Associates an array of double values with the given ID
+ */
+//=======================================================================
+void SALOMEDS_AttributeParameter::SetRealArray(const string& theID, const vector<double>& theArray) 
+{
+  CheckLocked();
+
+  if(_isLocal) {
+    SALOMEDS::Locker lock; 
+    Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetRealArray(theID, theArray);
+  }
+  else {
+    SALOMEDS::DoubleSeq_var aSeq = new SALOMEDS::DoubleSeq;
+    int length = theArray.size();
+    if(length) {
+      aSeq->length(length);
+      for(int i = 0; i<length; i++) aSeq[i] = theArray[i];
+    }
+    SALOMEDS::AttributeParameter::_narrow(_corba_impl)->SetRealArray(theID.c_str(), aSeq);
+  }
+}
+//=======================================================================
+/*!
+ * Function : GetRealArray
+ * Purpose  : Returns an array of double values associated with the ID
+ */
+//=======================================================================
+vector<double> SALOMEDS_AttributeParameter::GetRealArray(const string& theID) 
+{
+  vector<double> v;
+  if(_isLocal) {
+    SALOMEDS::Locker lock; 
+    return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetRealArray(theID);
+  }
+  else {
+    SALOMEDS::DoubleSeq_var aSeq = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetRealArray(theID.c_str());    
+    int length = aSeq->length();
+    if(length) {
+      v.resize(length);
+      for(int i = 0; i < length; i++) v[i] = aSeq[i];
+    }
+  }
+  return v;
+}
+
+//=======================================================================
+/*!
+ * Function : SetIntArray
+ * Purpose  : Associates an array of int values with the given ID
+ */
+//=======================================================================
+void SALOMEDS_AttributeParameter::SetIntArray(const string& theID, const vector<int>& theArray) 
+{
+  CheckLocked();
+
+  if(_isLocal) {
+    SALOMEDS::Locker lock; 
+    Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetIntArray(theID, theArray);
+  }
+  else {
+    SALOMEDS::LongSeq_var aSeq = new SALOMEDS::LongSeq;
+    int length = theArray.size();
+    if(length) {
+      aSeq->length(length);
+      for(int i = 0; i<length; i++) aSeq[i] = theArray[i];
+    }
+    SALOMEDS::AttributeParameter::_narrow(_corba_impl)->SetIntArray(theID.c_str(), aSeq);
+  }
+}
+//=======================================================================
+/*!
+ * Function : GetIntArray
+ * Purpose  : Returns an array of int values associated with the ID
+ */
+//=======================================================================
+vector<int> SALOMEDS_AttributeParameter::GetIntArray(const string& theID) 
+{
+  vector<int> v;
+  if(_isLocal) {
+    SALOMEDS::Locker lock; 
+    return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetIntArray(theID);
+  }
+  else {
+    SALOMEDS::LongSeq_var aSeq = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetIntArray(theID.c_str());    
+    int length = aSeq->length();
+    if(length) {
+      v.resize(length);
+      for(int i = 0; i < length; i++) v[i] = aSeq[i];
+    }
+  }
+  return v;
+}
+
+//=======================================================================
+/*!
+ * Function : SetStrArray
+ * Purpose  : Associates an array of string values with the given ID
+ */
+//=======================================================================
+void SALOMEDS_AttributeParameter::SetStrArray(const string& theID, const vector<string>& theArray) 
+{
+  CheckLocked();
+
+  if(_isLocal) {
+    SALOMEDS::Locker lock; 
+    Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetStrArray(theID, theArray);
+  }
+  else {
+    SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq;
+    int length = theArray.size();
+    if(length) {
+      aSeq->length(length);
+      for(int i = 0; i<length; i++) aSeq[i] = CORBA::string_dup(theArray[i].c_str());
+    }
+    SALOMEDS::AttributeParameter::_narrow(_corba_impl)->SetStrArray(theID.c_str(), aSeq);
+  }
+}
+//=======================================================================
+/*!
+ * Function : GetStrArray
+ * Purpose  : Returns an array of string values associated with the ID
+ */
+//=======================================================================
+vector<string> SALOMEDS_AttributeParameter::GetStrArray(const string& theID) 
+{
+  vector<string> v;
+  if(_isLocal) {
+    SALOMEDS::Locker lock; 
+    return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetStrArray(theID);
+  }
+  else {
+    SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetStrArray(theID.c_str());    
+    int length = aSeq->length();
+    if(length) {
+      v.resize(length);
+      for(int i = 0; i < length; i++) v[i] = string(aSeq[i].in());
+    }
+  }
+  return v;
+}
+
+
+//=======================================================================
+/*!
+ * Function : IsSet
+ * Purpose  : Returns true if for the ID of given type was assigned \n
+ *            a value in the attribute
+ */
+//======================================================================= 
+bool SALOMEDS_AttributeParameter::IsSet(const string& theID, const int theType) 
+{
+  if(_isLocal) {
+    SALOMEDS::Locker lock; 
+    return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->IsSet(theID, (Parameter_Types)theType);
+  }
+  else 
+    return SALOMEDS::AttributeParameter::_narrow(_corba_impl)->IsSet(theID.c_str(), theType);
+}
+
+//=======================================================================
+/*!
+ * Function : RemoveID
+ * Purpose  : Removes a parameter with given ID
+ */
+//======================================================================= 
+bool SALOMEDS_AttributeParameter::RemoveID(const string& theID, const int theType) 
+{
+  CheckLocked();
+
+  if(_isLocal) {
+    SALOMEDS::Locker lock; 
+    return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->RemoveID(theID, (Parameter_Types)theType);
+  }
+  else
+    return SALOMEDS::AttributeParameter::_narrow(_corba_impl)->RemoveID(theID.c_str(), theType);
+}
+
+//=======================================================================
+/*!
+ * Function : GetFather
+ * Purpose  : Returns a father attribute for this attribute
+ */
+//=======================================================================
+_PTR(AttributeParameter) SALOMEDS_AttributeParameter::GetFather() 
+{
+  SALOMEDSClient_AttributeParameter* AP = NULL;
+  if(_isLocal) {
+    SALOMEDS::Locker lock; 
+    Handle(SALOMEDSImpl_AttributeParameter) AP_impl = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetFather();
+    if(AP_impl.IsNull()) return _PTR(AttributeParameter)(AP);
+    AP = new SALOMEDS_AttributeParameter(AP_impl);
+  }
+  else {
+    SALOMEDS::AttributeParameter_var AP_impl = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetFather();
+    if(CORBA::is_nil(AP_impl)) return _PTR(AttributeParameter)(AP);
+    AP = new SALOMEDS_AttributeParameter(AP_impl);
+  }
+  
+  return _PTR(AttributeParameter)(AP);
+}
+
+//=======================================================================
+/*!
+ * Function : HasFather
+ * Purpose  : Returns True if the attribute has a father attribute
+ */
+//======================================================================= 
+bool SALOMEDS_AttributeParameter::HasFather() 
+{
+  if(_isLocal) {
+    SALOMEDS::Locker lock; 
+    return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->HasFather();
+  }
+  else 
+    return SALOMEDS::AttributeParameter::_narrow(_corba_impl)->HasFather();
+}
+
+//=======================================================================
+/*!
+ * Function : IsRoot
+ * Purpose  : Returns True is the attribute is highest in an hierachy
+ */
+//=======================================================================
+bool SALOMEDS_AttributeParameter::IsRoot()
+{
+  if(_isLocal) {
+    SALOMEDS::Locker lock; 
+    return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->IsRoot();
+  }
+  else 
+    return SALOMEDS::AttributeParameter::_narrow(_corba_impl)->IsRoot();
+}
+
+//=======================================================================
+/*!
+ * Function : Clear
+ * Purpose  : Clears the content of the attribute
+ */
+//======================================================================= 
+void SALOMEDS_AttributeParameter::Clear() 
+{
+  if(_isLocal) {
+    SALOMEDS::Locker lock; 
+    Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->Clear();
+  }
+  else 
+    SALOMEDS::AttributeParameter::_narrow(_corba_impl)->Clear();
+}
+
+//=======================================================================
+/*!
+ * Function : GetIDs
+ * Purpose  : Returns an array of all ID's of the given type
+ */
+//=======================================================================
+vector<string> SALOMEDS_AttributeParameter::GetIDs(const int theType)
+{
+  vector<string> v;
+  if(_isLocal) {
+    SALOMEDS::Locker lock; 
+    Handle(SALOMEDSImpl_AttributeParameter) AP_impl = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl);
+    return AP_impl->GetIDs((Parameter_Types)theType);
+  }
+  else {
+    SALOMEDS::AttributeParameter_var AP_impl = SALOMEDS::AttributeParameter::_narrow(_corba_impl);
+    SALOMEDS::StringSeq_var CorbaSeq = AP_impl->GetIDs(theType);
+    int length = CorbaSeq->length();
+    if(length) {
+      v.resize(length);
+      for(int i = 0; i <length; i++) v[i] = string(CorbaSeq[i].in());
+    }
+  }
+
+  return v;
+}
diff --git a/src/SALOMEDS/SALOMEDS_AttributeParameter.hxx b/src/SALOMEDS/SALOMEDS_AttributeParameter.hxx
new file mode 100644 (file)
index 0000000..9a7d0dd
--- /dev/null
@@ -0,0 +1,77 @@
+// Copyright (C) 2005  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/
+//
+//  File   : SALOMEDS_AttributeParameter.hxx
+//  Author : Sergey RUIN
+//  Module : SALOME
+
+#ifndef SALOMEDS_AttributeParameter_HeaderFile
+#define SALOMEDS_AttributeParameter_HeaderFile
+
+#include "SALOMEDSClient_AttributeParameter.hxx"
+#include "SALOMEDS_GenericAttribute.hxx"
+#include "SALOMEDSImpl_AttributeParameter.hxx"
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+class SALOMEDS_AttributeParameter: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeParameter
+{
+public:  
+  SALOMEDS_AttributeParameter(const Handle(SALOMEDSImpl_AttributeParameter)& theAttr);
+  SALOMEDS_AttributeParameter(SALOMEDS::AttributeParameter_ptr theAttr);
+  ~SALOMEDS_AttributeParameter();
+
+  virtual void SetInt(const std::string& theID, const int theValue);
+  virtual int GetInt(const std::string& theID);
+
+  virtual void SetReal(const std::string& theID, const double& theValue);
+  virtual double GetReal(const std::string& theID);
+
+  virtual void SetString(const std::string& theID, const std::string& theValue);
+  virtual std::string GetString(const std::string& theID);
+  
+  virtual void SetBool(const std::string& theID, const bool& theValue);
+  virtual bool GetBool(const std::string& theID);
+  
+  virtual void SetRealArray(const std::string& theID, const std::vector<double>& theArray);
+  virtual std::vector<double> GetRealArray(const std::string& theID);
+  
+  virtual void SetIntArray(const std::string& theID, const std::vector<int>& theArray);
+  virtual std::vector<int> GetIntArray(const std::string& theID);
+
+  virtual void SetStrArray(const std::string& theID, const std::vector<std::string>& theArray);
+  virtual std::vector<std::string> GetStrArray(const std::string& theID);
+
+  virtual bool IsSet(const std::string& theID, const int theType);
+  
+  virtual bool RemoveID(const std::string& theID, const int theType);
+
+  virtual _PTR(AttributeParameter) GetFather();
+  virtual bool HasFather();
+  virtual bool IsRoot();
+  
+  virtual void Clear();
+
+  virtual std::vector<std::string> GetIDs(const int theType);
+};
+
+#endif
diff --git a/src/SALOMEDS/SALOMEDS_AttributeParameter_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeParameter_i.cxx
new file mode 100644 (file)
index 0000000..ff5023d
--- /dev/null
@@ -0,0 +1,347 @@
+// Copyright (C) 2005  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/
+//
+//  File   : SALOMEDS_AttributeParameter_i.cxx
+//  Author : Sergey RUIN
+//  Module : SALOME
+
+
+#include "SALOMEDS_AttributeParameter_i.hxx"
+#include "SALOMEDS.hxx"
+#include <TCollection_AsciiString.hxx>
+
+#include <vector>
+
+using namespace std;
+
+//=======================================================================
+/*!
+ * Function : SetInt
+ * Purpose  : Associates a integer value with the ID
+ */
+//=======================================================================
+void SALOMEDS_AttributeParameter_i::SetInt(const char* theID, CORBA::Long theValue)
+{
+  SALOMEDS::Locker lock; 
+  CheckLocked();
+  Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->SetInt(theID, theValue);
+}
+
+//=======================================================================
+/*!
+ * Function : GetInt
+ * Purpose  : Returns a int value associated with the given ID
+ */
+//=======================================================================
+CORBA::Long SALOMEDS_AttributeParameter_i::GetInt(const char* theID)
+{
+  SALOMEDS::Locker lock; 
+  return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetInt(theID);
+}
+
+//=======================================================================
+/*!
+ * Function : SetReal
+ * Purpose  : Associates a double value with the ID
+ */
+//=======================================================================
+void SALOMEDS_AttributeParameter_i::SetReal(const char* theID, const CORBA::Double theValue)
+{
+  SALOMEDS::Locker lock; 
+  CheckLocked();
+  Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->SetReal(theID, theValue);
+}
+
+//=======================================================================
+/*!
+ * Function : GetReal
+ * Purpose  : Returns a double value associated with the given ID
+ */
+//=======================================================================
+CORBA::Double SALOMEDS_AttributeParameter_i::GetReal(const char* theID)
+{
+  SALOMEDS::Locker lock; 
+  return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetReal(theID);
+}
+
+//=======================================================================
+/*!
+ * Function : SetString
+ * Purpose  : Associates a string with the ID
+ */
+//=======================================================================
+void SALOMEDS_AttributeParameter_i::SetString(const char* theID, const char* theValue)
+{
+  SALOMEDS::Locker lock; 
+  CheckLocked();
+  Handle(SALOMEDSImpl_AttributeParameter) impl = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl);
+  impl->SetString(theID, theValue);
+}
+
+//=======================================================================
+/*!
+ * Function : GetString
+ * Purpose  : Returns a string associated with the given ID
+ */
+//=======================================================================
+char* SALOMEDS_AttributeParameter_i::GetString(const char* theID)
+{
+  SALOMEDS::Locker lock; 
+  Handle(SALOMEDSImpl_AttributeParameter) impl = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl);
+  CORBA::String_var c_s = CORBA::string_dup(impl->GetString(theID).c_str());
+  return c_s._retn();
+}
+
+//=======================================================================
+/*!
+ * Function : SetBool
+ * Purpose  : Associates a bool value with the ID
+ */
+//=======================================================================  
+void SALOMEDS_AttributeParameter_i::SetBool(const char* theID, CORBA::Boolean theValue)
+{
+  SALOMEDS::Locker lock; 
+  CheckLocked();
+  Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->SetBool(theID, theValue);
+}
+
+//=======================================================================
+/*!
+ * Function : GetBool
+ * Purpose  : Returns a bool value associated with the ID
+ */
+//=======================================================================
+CORBA::Boolean SALOMEDS_AttributeParameter_i::GetBool(const char* theID)
+{
+  SALOMEDS::Locker lock; 
+  return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetBool(theID);
+}
+  
+//=======================================================================
+/*!
+ * Function : SetRealArray
+ * Purpose  : Associates an array of double values with the given ID
+ */
+//=======================================================================
+void SALOMEDS_AttributeParameter_i::SetRealArray(const char* theID, const SALOMEDS::DoubleSeq& theArray)
+{
+  SALOMEDS::Locker lock; 
+  CheckLocked();
+  vector<double> v;
+  int length = theArray.length();
+  if(length) {
+    v.resize(length);
+    for(int i = 0; i<length; i++) v[i] = theArray[i];
+  }
+  Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->SetRealArray(theID, v);
+}
+
+//=======================================================================
+/*!
+ * Function : GetRealArray
+ * Purpose  : Returns an array of double values associated with the ID
+ */
+//=======================================================================
+SALOMEDS::DoubleSeq* SALOMEDS_AttributeParameter_i::GetRealArray(const char* theID)
+{
+  SALOMEDS::Locker lock; 
+  SALOMEDS::DoubleSeq_var aSeq = new SALOMEDS::DoubleSeq;
+  vector<double> v = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetRealArray(theID);
+  int length = v.size();
+  if(length) {
+    aSeq->length(length);
+    for(int i = 0; i<length; i++) aSeq[i] = v[i];
+  }
+  return aSeq._retn();
+}
+//=======================================================================
+/*!
+ * Function : SetIntArray
+ * Purpose  : Associates an array of int values with the given ID
+ */
+//=======================================================================
+void SALOMEDS_AttributeParameter_i::SetIntArray(const char* theID, const SALOMEDS::LongSeq& theArray)
+{
+  SALOMEDS::Locker lock; 
+  CheckLocked();
+  vector<int> v;
+  int length = theArray.length();
+  if(length) {
+    v.resize(length);
+    for(int i = 0; i<length; i++) v[i] = theArray[i];
+  }
+  Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->SetIntArray(theID, v);
+}
+
+//=======================================================================
+/*!
+ * Function : GetIntArray
+ * Purpose  : Returns an array of int values associated with the ID
+ */
+//=======================================================================
+SALOMEDS::LongSeq* SALOMEDS_AttributeParameter_i::GetIntArray(const char* theID)
+{
+  SALOMEDS::Locker lock; 
+  SALOMEDS::LongSeq_var aSeq = new SALOMEDS::LongSeq;
+  vector<int> v = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetIntArray(theID);
+  int length = v.size();
+  if(length) {
+    aSeq->length(length);
+    for(int i = 0; i<length; i++) aSeq[i] = v[i];
+  }
+  return aSeq._retn();
+}
+  
+//=======================================================================
+/*!
+ * Function : SetStrArray
+ * Purpose  : Associates an array of string values with the given ID
+ */
+//=======================================================================
+void SALOMEDS_AttributeParameter_i::SetStrArray(const char* theID, const SALOMEDS::StringSeq& theArray)
+{
+  SALOMEDS::Locker lock; 
+  CheckLocked();
+  vector<string> v;
+  int length = theArray.length();
+  if(length) {
+    v.resize(length);
+    for(int i = 0; i<length; i++) v[i] = string(theArray[i].in());
+  }
+  Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->SetStrArray(theID, v);
+}
+
+//=======================================================================
+/*!
+ * Function : GetStrArray
+ * Purpose  : Returns an array of string values associated with the ID
+ */
+//=======================================================================
+SALOMEDS::StringSeq* SALOMEDS_AttributeParameter_i::GetStrArray(const char* theID)
+{
+  SALOMEDS::Locker lock; 
+  SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq;
+  vector<string> v = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetStrArray(theID);
+  int length = v.size();
+  if(length) {
+    aSeq->length(length);
+    for(int i = 0; i<length; i++) aSeq[i] = CORBA::string_dup(v[i].c_str());
+  }
+  return aSeq._retn();
+}
+  
+//=======================================================================
+/*!
+ * Function : IsSet
+ * Purpose  : Returns true if for the ID of given type was assigned \n
+ *            a value in the attribute
+ */
+//=======================================================================
+CORBA::Boolean SALOMEDS_AttributeParameter_i::IsSet(const char* theID, CORBA::Long theType)
+{
+  SALOMEDS::Locker lock; 
+  return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->IsSet(theID, (Parameter_Types)theType);
+}
+
+//=======================================================================
+/*!
+ * Function : RemoveID
+ * Purpose  : Removes a parameter with given ID
+ */
+//=======================================================================  
+CORBA::Boolean SALOMEDS_AttributeParameter_i::RemoveID(const char* theID, CORBA::Long theType)
+{
+  SALOMEDS::Locker lock; 
+  CheckLocked();
+  return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->RemoveID(theID, (Parameter_Types)theType);
+}
+
+//=======================================================================
+/*!
+ * Function : GetFather
+ * Purpose  : Returns a father attribute for this attribute
+ */
+//=======================================================================
+SALOMEDS::AttributeParameter_ptr SALOMEDS_AttributeParameter_i::GetFather()
+{
+  SALOMEDS::Locker lock; 
+  Handle(SALOMEDSImpl_AttributeParameter) impl = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl);
+  SALOMEDS_AttributeParameter_i* attr = new SALOMEDS_AttributeParameter_i(impl, _orb);
+  return attr->AttributeParameter::_this();
+}
+
+//=======================================================================
+/*!
+ * Function : HasFather
+ * Purpose  : Returns True if the attribute has a father attribute
+ */
+//=======================================================================
+CORBA::Boolean SALOMEDS_AttributeParameter_i::HasFather()
+{
+  SALOMEDS::Locker lock; 
+  return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->HasFather();
+}
+
+//=======================================================================
+/*!
+ * Function : IsRoot
+ * Purpose  : Returns True is the attribute is highest in an hierachy
+ */
+//=======================================================================
+CORBA::Boolean SALOMEDS_AttributeParameter_i::IsRoot()
+{
+  SALOMEDS::Locker lock; 
+  return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->IsRoot();
+}
+
+//=======================================================================
+/*!
+ * Function : IsRoot
+ * Purpose  : Clears the content of the attribute
+ */
+//=======================================================================
+void SALOMEDS_AttributeParameter_i::Clear()
+{
+  SALOMEDS::Locker lock; 
+  Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->Clear();
+}
+
+
+//=======================================================================
+/*!
+ * Function : GetIDs
+ * Purpose  : Returns an array of all ID's of the given type
+ */
+//=======================================================================
+SALOMEDS::StringSeq* SALOMEDS_AttributeParameter_i::GetIDs(CORBA::Long theType)
+{
+  SALOMEDS::Locker lock; 
+  SALOMEDS::StringSeq_var CorbaSeq = new SALOMEDS::StringSeq;
+  vector<string> A = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetIDs((Parameter_Types)theType);
+
+  if(A.size()) {
+    int length = A.size();
+    CorbaSeq->length(length);
+    for (int i = 0; i < length; i++) CorbaSeq[i] = CORBA::string_dup(A[i].c_str());;
+  }
+
+  return CorbaSeq._retn();
+}
diff --git a/src/SALOMEDS/SALOMEDS_AttributeParameter_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeParameter_i.hxx
new file mode 100644 (file)
index 0000000..c393a20
--- /dev/null
@@ -0,0 +1,89 @@
+// Copyright (C) 2005  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/
+//
+//  File   : SALOMEDS_AttributeParameter_i.hxx
+//  Author : Sergey RUIN
+//  Module : SALOME
+//  $Header:
+
+#ifndef SALOMEDS_AttributeParameter_i_HeaderFile
+#define SALOMEDS_AttributeParameter_i_HeaderFile
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDSImpl_AttributeParameter.hxx"
+
+/*!
+ Class: SALOMEDS_AttributeParameter
+ Description : AttributeParameter is a universal container of basic types 
+*/
+
+class SALOMEDS_AttributeParameter_i: public virtual POA_SALOMEDS::AttributeParameter,
+                                    public virtual SALOMEDS_GenericAttribute_i 
+{
+public:
+  
+  SALOMEDS_AttributeParameter_i(const Handle(SALOMEDSImpl_AttributeParameter)& theAttr, CORBA::ORB_ptr orb) 
+    :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; 
+
+  ~SALOMEDS_AttributeParameter_i() {};
+
+
+  virtual void SetInt(const char* theID, CORBA::Long theValue);
+  virtual CORBA::Long GetInt(const char* theID);
+
+  virtual void SetReal(const char* theID, const CORBA::Double theValue);
+  virtual CORBA::Double GetReal(const char* theID);
+
+  virtual void SetString(const char* theID, const char* theValue);
+  virtual char* GetString(const char* theID);
+  
+  virtual void SetBool(const char* theID, CORBA::Boolean theValue);
+  virtual CORBA::Boolean GetBool(const char* theID);
+  
+  virtual void SetRealArray(const char* theID, const SALOMEDS::DoubleSeq& theArray);
+  virtual SALOMEDS::DoubleSeq* GetRealArray(const char* theID);
+
+  virtual void SetIntArray(const char* theID, const SALOMEDS::LongSeq& theArray);
+  virtual SALOMEDS::LongSeq* GetIntArray(const char* theID);
+
+  virtual void SetStrArray(const char* theID, const SALOMEDS::StringSeq& theArray);
+  virtual SALOMEDS::StringSeq* GetStrArray(const char* theID);
+  
+  virtual CORBA::Boolean IsSet(const char* theID, CORBA::Long theType);
+  
+  virtual CORBA::Boolean RemoveID(const char* theID, CORBA::Long theType);
+
+  virtual SALOMEDS::AttributeParameter_ptr GetFather();
+  virtual CORBA::Boolean HasFather();
+  virtual CORBA::Boolean IsRoot();
+
+  virtual void Clear();
+
+  virtual SALOMEDS::StringSeq* GetIDs(CORBA::Long theType);
+
+};
+
+
+
+
+#endif
index a0c5586ebf09daf4101a74a5685a40017e9cb5f0..e21925101805e30954c61d69232746a73d5f7d7d 100644 (file)
@@ -54,6 +54,7 @@
 #include "SALOMEDSImpl_AttributeFileType.hxx"
 #include "SALOMEDSImpl_AttributeFlags.hxx"
 #include "SALOMEDSImpl_AttributeGraphic.hxx"
+#include "SALOMEDSImpl_AttributeParameter.hxx"
 
 #include "SALOMEDS_GenericAttribute_i.hxx"
 #include "SALOMEDS_AttributeName_i.hxx"
@@ -84,6 +85,7 @@
 #include "SALOMEDS_AttributeFileType_i.hxx"
 #include "SALOMEDS_AttributeFlags_i.hxx"
 #include "SALOMEDS_AttributeGraphic_i.hxx"
+#include "SALOMEDS_AttributeParameter_i.hxx"
 
 #define __CreateCORBAAttribute(CORBA_Name) if (strcmp(aTypeOfAttribute, #CORBA_Name) == 0) { \
     Handle(SALOMEDSImpl_##CORBA_Name) A = Handle(SALOMEDSImpl_##CORBA_Name)::DownCast(theAttr); \
@@ -121,6 +123,7 @@ __CreateCORBAAttribute(AttributeFileType) \
 __CreateCORBAAttribute(AttributeFlags) \
 __CreateCORBAAttribute(AttributeGraphic) \
 __CreateCORBAAttribute(AttributeTreeNode) \
-__CreateCORBAAttribute(AttributeUserID)
+__CreateCORBAAttribute(AttributeUserID) \
+__CreateCORBAAttribute(AttributeParameter)
 
 #endif
index 47105d5f39c498e8b05e1d8da2a38dd442535ec0..c0bd6ecac2dc4ddd6fb09d58ae89007536f4a356 100644 (file)
@@ -55,6 +55,7 @@
 #include "SALOMEDSImpl_AttributeFileType.hxx"
 #include "SALOMEDSImpl_AttributeFlags.hxx"
 #include "SALOMEDSImpl_AttributeGraphic.hxx"
+#include "SALOMEDSImpl_AttributeParameter.hxx"
 
 #include "SALOMEDS_GenericAttribute.hxx"
 #include "SALOMEDS_AttributeName.hxx"
@@ -85,6 +86,7 @@
 #include "SALOMEDS_AttributeFileType.hxx"
 #include "SALOMEDS_AttributeFlags.hxx"
 #include "SALOMEDS_AttributeGraphic.hxx"
+#include "SALOMEDS_AttributeParameter.hxx"
 
 #define __CreateClientAttributeLocal(CORBA_Name) if (strcmp(aTypeOfAttribute.c_str(), #CORBA_Name) == 0) { \
     Handle(SALOMEDSImpl_##CORBA_Name) A = Handle(SALOMEDSImpl_##CORBA_Name)::DownCast(theGA); \
@@ -124,7 +126,8 @@ __CreateClientAttributeLocal(AttributeFileType) \
 __CreateClientAttributeLocal(AttributeFlags) \
 __CreateClientAttributeLocal(AttributeGraphic) \
 __CreateClientAttributeLocal(AttributeTreeNode) \
-__CreateClientAttributeLocal(AttributeUserID)
+__CreateClientAttributeLocal(AttributeUserID) \
+__CreateClientAttributeLocal(AttributeParameter)
 
 #define __CreateGenericClientAttributeCORBA \
 __CreateClientAttributeCORBA(AttributeReal) \
@@ -154,6 +157,7 @@ __CreateClientAttributeCORBA(AttributeFileType) \
 __CreateClientAttributeCORBA(AttributeFlags) \
 __CreateClientAttributeCORBA(AttributeGraphic) \
 __CreateClientAttributeCORBA(AttributeTreeNode) \
-__CreateClientAttributeCORBA(AttributeUserID)
+__CreateClientAttributeCORBA(AttributeUserID) \
+__CreateClientAttributeCORBA(AttributeParameter)
 
 #endif
index 2f4f085cafd11e210ed674aaf88580ed690da481..d9995703fbda47517320b58c020d53dc06eb2bb7 100644 (file)
@@ -20,6 +20,7 @@
 
 
 #include "SALOMEDS_Driver_i.hxx"
+#include <SALOMEDS_TMPFile_i.hxx>
 #include "utilities.h"
 #include "SALOMEDS_SObject_i.hxx"
 #include "SALOMEDS_SComponent_i.hxx"
@@ -33,44 +34,38 @@ SALOMEDS_Driver_i::~SALOMEDS_Driver_i()
 {
 }
 
-unsigned char* SALOMEDS_Driver_i::Save(const Handle(SALOMEDSImpl_SComponent)& theComponent,
-                                      const TCollection_AsciiString& theURL,
-                                      long& theStreamLength,
-                                      bool isMultiFile)
+Handle(SALOMEDSImpl_TMPFile) SALOMEDS_Driver_i::Save(const Handle(SALOMEDSImpl_SComponent)& theComponent,
+                                                    const TCollection_AsciiString& theURL,
+                                                    long& theStreamLength,
+                                                    bool isMultiFile)
 {  
   SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (theComponent, _orb);
-  SALOMEDS::TMPFile_var aStream;
   CORBA::String_var url = CORBA::string_dup(theURL.ToCString());
+
   SALOMEDS::unlock();
-  aStream = _driver->Save(sco.in(), url, isMultiFile);
+  SALOMEDS::TMPFile_var aStream = _driver->Save(sco.in(), url, isMultiFile);
+  Handle(SALOMEDSImpl_TMPFile) aTMPFile(new SALOMEDS_TMPFile_i(aStream._retn()));
+  theStreamLength = aTMPFile->Size();
   SALOMEDS::lock();
-  theStreamLength = aStream->length();
-  unsigned char* aRetStream = NULL;
-  if (theStreamLength > 0) {
-    aRetStream = new unsigned char[theStreamLength];
-    memcpy(aRetStream, aStream->NP_data(), theStreamLength);
-  }
-  return aRetStream;
+
+  return aTMPFile;
 }
 
-unsigned char* SALOMEDS_Driver_i::SaveASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent,
-                                           const TCollection_AsciiString& theURL,
-                                           long& theStreamLength,
-                                           bool isMultiFile)
+Handle(SALOMEDSImpl_TMPFile) SALOMEDS_Driver_i::SaveASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent,
+                                                         const TCollection_AsciiString& theURL,
+                                                         long& theStreamLength,
+                                                         bool isMultiFile)
 {
   SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (theComponent, _orb);
-  SALOMEDS::TMPFile_var aStream;
   CORBA::String_var url = CORBA::string_dup(theURL.ToCString());
+
   SALOMEDS::unlock();
-  aStream = _driver->SaveASCII(sco.in(), url, isMultiFile);
+  SALOMEDS::TMPFile_var aStream = _driver->SaveASCII(sco.in(), url, isMultiFile);
+  Handle(SALOMEDSImpl_TMPFile) aTMPFile(new SALOMEDS_TMPFile_i(aStream._retn()));
+  theStreamLength = aTMPFile->Size();
   SALOMEDS::lock();
-  theStreamLength = aStream->length();
-  unsigned char* aRetStream = NULL;
-  if (theStreamLength > 0) {
-    aRetStream = new unsigned char[theStreamLength];
-    memcpy(aRetStream, aStream->NP_data(), theStreamLength);
-  }
-  return aRetStream; 
+
+  return aTMPFile;
 }
   
 bool SALOMEDS_Driver_i::Load(const Handle(SALOMEDSImpl_SComponent)& theComponent,
@@ -92,6 +87,7 @@ bool SALOMEDS_Driver_i::Load(const Handle(SALOMEDSImpl_SComponent)& theComponent
   SALOMEDS::unlock();
   bool isOk = _driver->Load(sco.in(), aStream.in(), url, isMultiFile);
   SALOMEDS::lock();
+
   return isOk;
 }
 
@@ -114,12 +110,14 @@ bool SALOMEDS_Driver_i::LoadASCII(const Handle(SALOMEDSImpl_SComponent)& theComp
   SALOMEDS::unlock();
   bool isOk = _driver->LoadASCII(sco.in(), aStream.in(), url, isMultiFile);
   SALOMEDS::lock();
+
   return isOk;
 }
 
 void SALOMEDS_Driver_i::Close(const Handle(SALOMEDSImpl_SComponent)& theComponent)
 {
   SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (theComponent, _orb);
+
   SALOMEDS::unlock();
   _driver->Close(sco.in());
   SALOMEDS::lock();
@@ -134,9 +132,11 @@ TCollection_AsciiString SALOMEDS_Driver_i::IORToLocalPersistentID(const Handle(S
 {
   SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (theSObject, _orb);
   CORBA::String_var ior = CORBA::string_dup(IORString.ToCString());
+
   SALOMEDS::unlock();
   CORBA::String_var pers_string =_driver->IORToLocalPersistentID(so.in(), ior.in(), isMultiFile, isASCII);
   SALOMEDS::lock();
+
   return TCollection_AsciiString(pers_string);
 }
 
@@ -157,35 +157,30 @@ TCollection_AsciiString SALOMEDS_Driver_i::LocalPersistentIDToIOR(const Handle(S
 bool SALOMEDS_Driver_i::CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject)
 {
   SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (theObject, _orb);
+
   SALOMEDS::unlock();
   bool isOk = _driver->CanCopy(so.in());
   SALOMEDS::lock();
+
   return isOk;
 }
 
 
-unsigned char* SALOMEDS_Driver_i::CopyFrom(const Handle(SALOMEDSImpl_SObject)& theObject, 
-                                          int& theObjectID,
-                                          long& theStreamLength)
+Handle(SALOMEDSImpl_TMPFile) SALOMEDS_Driver_i::CopyFrom(const Handle(SALOMEDSImpl_SObject)& theObject, 
+                                                        int& theObjectID,
+                                                        long& theStreamLength)
 {
   SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (theObject, _orb);
-  SALOMEDS::TMPFile_var aStream;
-  CORBA::Long anObjectID;
 
   SALOMEDS::unlock();
-  aStream = _driver->CopyFrom(so.in(), anObjectID);
-  SALOMEDS::lock();
-
+  CORBA::Long anObjectID;
+  SALOMEDS::TMPFile_var aStream = _driver->CopyFrom(so.in(), anObjectID);
+  Handle(SALOMEDSImpl_TMPFile) aTMPFile(new SALOMEDS_TMPFile_i(aStream._retn()));
+  theStreamLength = aTMPFile->Size();
   theObjectID = anObjectID;
-  theStreamLength = aStream->length();
-
-  unsigned char* aRetStream = NULL;
-  if(theStreamLength > 0) {
-    aRetStream = new unsigned char[theStreamLength];
-    memcpy(aRetStream, aStream->NP_data(), theStreamLength);
-  }
+  SALOMEDS::lock();
 
-  return aRetStream;
+  return aTMPFile;
 }
 
 bool SALOMEDS_Driver_i::CanPaste(const TCollection_AsciiString& theComponentName, int theObjectID)
@@ -217,30 +212,24 @@ TCollection_AsciiString SALOMEDS_Driver_i::PasteInto(const unsigned char* theStr
   return TCollection_AsciiString((char*)ret_so->GetID());
 }
 
-unsigned char* SALOMEDS_Driver_i::DumpPython(const Handle(SALOMEDSImpl_Study)& theStudy, 
-                                            bool isPublished, 
-                                            bool& isValidScript,
-                                            long& theStreamLength)
+Handle(SALOMEDSImpl_TMPFile) SALOMEDS_Driver_i::DumpPython(const Handle(SALOMEDSImpl_Study)& theStudy, 
+                                                          bool isPublished, 
+                                                          bool& isValidScript,
+                                                          long& theStreamLength)
 {
   SALOMEDS_Study_i *  st_servant = new SALOMEDS_Study_i (theStudy, _orb);
   SALOMEDS::Study_var st  = SALOMEDS::Study::_narrow(st_servant->_this());
-  Engines::TMPFile_var aStream;
-  CORBA::Boolean aValidScript, aPublished;
-  aPublished = isPublished;
   Engines::Component_ptr aComponent = Engines::Component::_narrow(_driver);
+
   SALOMEDS::unlock();
-  aStream = aComponent->DumpPython(st.in(), aPublished, aValidScript);
-  SALOMEDS::lock();
+  CORBA::Boolean aValidScript, aPublished = isPublished;
+  Engines::TMPFile_var aStream = aComponent->DumpPython(st.in(), aPublished, aValidScript);
+  Handle(SALOMEDSImpl_TMPFile) aTMPFile(new Engines_TMPFile_i(aStream._retn()));
+  theStreamLength = aTMPFile->Size();
   isValidScript = aValidScript;
-  theStreamLength = aStream->length();
-  unsigned char* aRetStream = NULL;
-
-  if(theStreamLength > 0) {
-    aRetStream = new unsigned char[theStreamLength];
-    memcpy(aRetStream, aStream->NP_data(), theStreamLength);
-  }
+  SALOMEDS::lock();
 
-  return aRetStream;
+  return aTMPFile;
 }
 
 //###############################################################################################################
index ae49cdba2ebb6171b0d6fa67704f6101eaac1693..cf689687b282c0c0288c66b2abaae2768e77af12 100644 (file)
@@ -52,15 +52,15 @@ public:
       return TCollection_AsciiString(ior);
     }
 
-  virtual unsigned char* Save(const Handle(SALOMEDSImpl_SComponent)& theComponent,
-                             const TCollection_AsciiString& theURL,
-                             long& theStreamLength,
-                             bool isMultiFile);
-
-  virtual unsigned char* SaveASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent,
-                                  const TCollection_AsciiString& theURL,
-                                  long& theStreamLength,
-                                  bool isMultiFile);
+  virtual Handle(SALOMEDSImpl_TMPFile) Save(const Handle(SALOMEDSImpl_SComponent)& theComponent,
+                                           const TCollection_AsciiString& theURL,
+                                           long& theStreamLength,
+                                           bool isMultiFile);
+
+  virtual Handle(SALOMEDSImpl_TMPFile) SaveASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent,
+                                                const TCollection_AsciiString& theURL,
+                                                long& theStreamLength,
+                                                bool isMultiFile);
   
   virtual bool Load(const Handle(SALOMEDSImpl_SComponent)& theComponent,
                    const unsigned char* theStream,
@@ -95,10 +95,10 @@ public:
 
   virtual bool CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject);
 
-  virtual unsigned char* CopyFrom(const Handle(SALOMEDSImpl_SObject)& theObject, 
-                                 int& theObjectID,
-                                 long& theStreamLength);
-
+  virtual Handle(SALOMEDSImpl_TMPFile) CopyFrom(const Handle(SALOMEDSImpl_SObject)& theObject, 
+                                               int& theObjectID,
+                                               long& theStreamLength);
+  
   virtual bool CanPaste(const TCollection_AsciiString& theComponentName, int theObjectID);
 
   virtual TCollection_AsciiString PasteInto(const unsigned char* theStream,
@@ -106,10 +106,10 @@ public:
                                            int theObjectID,
                                            const Handle(SALOMEDSImpl_SObject)& theObject);
 
-  virtual unsigned char* DumpPython(const Handle(SALOMEDSImpl_Study)& theStudy, 
-                                   bool isPublished, 
-                                   bool& isValidScript,
-                                   long& theStreamLength);
+  virtual Handle(SALOMEDSImpl_TMPFile) DumpPython(const Handle(SALOMEDSImpl_Study)& theStudy, 
+                                                 bool isPublished, 
+                                                 bool& isValidScript,
+                                                 long& theStreamLength);
 };
 
 #include "SALOME_NamingService.hxx"
diff --git a/src/SALOMEDS/SALOMEDS_IParameters.cxx b/src/SALOMEDS/SALOMEDS_IParameters.cxx
new file mode 100644 (file)
index 0000000..6540d9f
--- /dev/null
@@ -0,0 +1,279 @@
+// Copyright (C) 2005  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/
+//
+#include "SALOMEDS_IParameters.hxx"
+#include <utilities.h>
+
+#include <TCollection_AsciiString.hxx>
+
+using namespace std;
+
+#define PT_INTEGER   0
+#define PT_REAL      1
+#define PT_BOOLEAN   2
+#define PT_STRING    3
+#define PT_REALARRAY 4
+#define PT_INTARRAY  5
+#define PT_STRARRAY  6
+
+#define _AP_LISTS_LIST_ "AP_LISTS_LIST"
+#define _AP_ENTRIES_LIST_ "AP_ENTRIES_LIST"
+#define _AP_PROPERTIES_LIST_ "AP_PROPERTIES_LIST"
+#define _AP_DUMP_PYTHON_ "AP_DUMP_PYTHON"
+
+/*!
+  Constructor
+*/
+SALOMEDS_IParameters::SALOMEDS_IParameters(const _PTR(AttributeParameter)& ap)
+{
+  if(!ap) return;
+  _ap = ap;
+  _PTR(SObject) so = _ap->GetSObject();
+  _study = so->GetStudy();
+}
+
+SALOMEDS_IParameters::~SALOMEDS_IParameters()
+{
+  _compNames.clear();
+}
+
+int SALOMEDS_IParameters::append(const string& listName, const string& value)
+{
+  if(!_ap) return -1;
+  vector<string> v;
+  if(!_ap->IsSet(listName, PT_STRARRAY)) {
+    if(!_ap->IsSet(_AP_LISTS_LIST_, PT_STRARRAY)) _ap->SetStrArray(_AP_LISTS_LIST_, v);
+    if(listName != _AP_ENTRIES_LIST_ && 
+       listName != _AP_PROPERTIES_LIST_) {
+      append(_AP_LISTS_LIST_, listName);
+    }
+    _ap->SetStrArray(listName, v);
+  }
+  v = _ap->GetStrArray(listName);
+  v.push_back(value);
+  _ap->SetStrArray(listName, v);
+  return (v.size()-1);
+}
+
+int SALOMEDS_IParameters::nbValues(const string& listName)
+{
+  if(!_ap) return -1;
+  if(!_ap->IsSet(listName, PT_STRARRAY)) return 0;
+  vector<string> v = _ap->GetStrArray(listName);
+  return v.size();
+}
+
+vector<string> SALOMEDS_IParameters::getValues(const string& listName)
+{
+  vector<string> v;
+  if(!_ap) return v;
+  if(!_ap->IsSet(listName, PT_STRARRAY)) return v;
+  return _ap->GetStrArray(listName);
+}
+
+
+string SALOMEDS_IParameters::getValue(const string& listName, int index)
+{
+  if(!_ap) return "";
+  if(!_ap->IsSet(listName, PT_STRARRAY)) return "";
+  vector<string> v = _ap->GetStrArray(listName);
+  if(index >= v.size()) return ""; 
+  return v[index];
+}
+
+vector<string> SALOMEDS_IParameters::getLists()
+{
+  vector<string> v;
+  if(!_ap->IsSet(_AP_LISTS_LIST_, PT_STRARRAY)) return v;
+  return _ap->GetStrArray(_AP_LISTS_LIST_);
+}
+
+void SALOMEDS_IParameters::setParameter(const string& entry, const string& parameterName, const string& value)
+{
+  if(!_ap) return;
+  vector<string> v;
+  if(!_ap->IsSet(entry, PT_STRARRAY)) {
+    append(_AP_ENTRIES_LIST_, entry); //Add the entry to the internal list of entries
+    _ap->SetStrArray(entry, v);
+  }
+  v = _ap->GetStrArray(entry);
+  v.push_back(parameterName);
+  v.push_back(value);
+  _ap->SetStrArray(entry, v);
+}
+
+
+string SALOMEDS_IParameters::getParameter(const string& entry, const string& parameterName)
+{
+  if(!_ap) return "";
+  if(!_ap->IsSet(entry, PT_STRARRAY)) return "";
+  vector<string> v = _ap->GetStrArray(entry);
+  int length = v.size();
+  for(int i = 0; i<length; i+=1) {
+    if(v[i] == parameterName) return v[i+1];
+  }
+  return "";
+}
+
+
+vector<string> SALOMEDS_IParameters::getAllParameterNames(const string& entry)
+{
+  vector<string> v, names;
+  if(!_ap) return v; 
+  if(!_ap->IsSet(entry, PT_STRARRAY)) return v;
+  v = _ap->GetStrArray(entry);
+  int length = v.size();
+  for(int i = 0; i<length; i+=2) {
+    names.push_back(v[i]);
+  }
+  return names;
+}
+
+vector<string> SALOMEDS_IParameters::getAllParameterValues(const string& entry)
+{
+  vector<string> v, values;
+  if(!_ap) return v; 
+  if(!_ap->IsSet(entry, PT_STRARRAY)) return v;
+  v = _ap->GetStrArray(entry);
+  int length = v.size();
+  for(int i = 1; i<length; i+=2) {
+    values.push_back(v[i]);
+  }
+  return values; 
+}
+
+int SALOMEDS_IParameters::getNbParameters(const string& entry)
+{
+  if(!_ap) return -1;
+  if(!_ap->IsSet(entry, PT_STRARRAY)) return -1;
+  return  _ap->GetStrArray(entry).size()/2;
+}
+
+vector<string> SALOMEDS_IParameters::getEntries()
+{
+  vector<string> v;
+  if(!_ap) return v;
+  if(!_ap->IsSet(_AP_ENTRIES_LIST_, PT_STRARRAY)) return v;
+  return _ap->GetStrArray(_AP_ENTRIES_LIST_);
+}
+
+void SALOMEDS_IParameters::setProperty(const string& name, const std::string& value)
+{
+  if(!_ap) return;
+  if(!_ap->IsSet(name, PT_STRING)) {
+    append(_AP_PROPERTIES_LIST_, name); //Add the property to the internal list of properties
+  }
+  _ap->SetString(name, value);
+}
+
+string SALOMEDS_IParameters::getProperty(const string& name)
+{
+  if(!_ap) return "";
+  if(!_ap->IsSet(name, PT_STRING)) return "";
+  return _ap->GetString(name);
+}
+
+vector<string> SALOMEDS_IParameters::getProperties()
+{
+  vector<string> v;
+  if(!_ap) return v;
+  if(!_ap->IsSet(_AP_PROPERTIES_LIST_, PT_STRARRAY)) return v;
+  return _ap->GetStrArray(_AP_PROPERTIES_LIST_);
+}
+
+
+vector<string> SALOMEDS_IParameters::parseValue(const string& value, const char separator, bool fromEnd)
+{
+  TCollection_AsciiString val((char*)value.c_str());
+  vector<string> v;
+  int pos;
+  if(fromEnd) pos = val.SearchFromEnd(separator);
+  else pos = val.Search(separator);
+
+  if(pos < 0) {
+    v.push_back(value);
+    return v;
+  }
+
+  TCollection_AsciiString part1, part2;
+  part1 = val.SubString(1, pos-1);
+  part2 = val.SubString(pos+1, val.Length());
+  v.push_back(part1.ToCString());
+  v.push_back(part2.ToCString());
+  return v;
+}
+
+string SALOMEDS_IParameters::encodeEntry(const string& entry, const string& compName)
+{
+  string tail(entry, 6, entry.length()-1);
+  string newEntry(compName);
+  newEntry+=("_"+tail);
+  return newEntry;
+}
+
+string SALOMEDS_IParameters::decodeEntry(const string& entry)
+{
+  if(!_study) return entry;
+  int pos = entry.rfind("_");
+  if(pos < 0 || pos >= entry.length()) return entry;
+
+  string compName(entry, 0, pos), compID, tail(entry, pos+1, entry.length()-1);
+  
+  if(_compNames.find(compName) == _compNames.end()) {
+    _PTR(SObject) so = _study->FindComponent(compName);
+    if(!so) return entry;
+    compID = so->GetID();
+    _compNames[compName] = compID;
+  }
+  else compID = _compNames[compName];
+  string newEntry(compID);
+  newEntry += (":"+tail);
+  
+  return newEntry;
+}
+
+void SALOMEDS_IParameters::setDumpPython(_PTR(Study) study, const string& theID)
+{
+  string anID;
+  if(theID == "") anID = getDefaultVisualComponent();
+  else anID = theID;
+
+  _PTR(AttributeParameter) ap = study->GetCommonParameters(anID, 0);
+  ap->SetBool(_AP_DUMP_PYTHON_, true);
+}
+
+bool SALOMEDS_IParameters::isDumpPython(_PTR(Study) study, const string& theID)
+{
+  string anID;
+  if(theID == "") anID = getDefaultVisualComponent();
+  else anID = theID;
+
+  _PTR(AttributeParameter) ap = study->GetCommonParameters(anID, 0);
+  if(!ap) return false;
+  if(!ap->IsSet(_AP_DUMP_PYTHON_, PT_BOOLEAN)) return false;
+  return (bool)ap->GetBool(_AP_DUMP_PYTHON_);
+}
+
+string SALOMEDS_IParameters::getDefaultVisualComponent()
+{
+  return "Interface Applicative";
+}
+
+
+
diff --git a/src/SALOMEDS/SALOMEDS_IParameters.hxx b/src/SALOMEDS/SALOMEDS_IParameters.hxx
new file mode 100644 (file)
index 0000000..4111e83
--- /dev/null
@@ -0,0 +1,149 @@
+// Copyright (C) 2005  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 SALOMEDS_IParameters_H
+#define SALOMEDS_IParameters_H
+
+#include <string>
+#include <vector>
+#include <map>
+
+#include "SALOMEDSClient.hxx"
+
+/*! 
+  Class which an interface to store the parameters of the objects
+*/
+class SALOMEDS_IParameters
+{
+public:
+  SALOMEDS_IParameters(const _PTR(AttributeParameter)& ap); 
+
+  virtual ~SALOMEDS_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); 
+
+  /*!
+    Returns a number elements in the list
+   */
+  virtual int nbValues(const std::string& listName);
+
+  /*!
+    Returns a list of values in the list
+   */
+  virtual std::vector<std::string> getValues(const std::string& listName);
+
+  /*!
+    Returns a value with given %index, where %index is in range [0:nbValues-1]
+   */
+  virtual std::string getValue(const std::string& listName, int index);
+
+  /*!
+    Returns a list all entries lists
+   */
+  virtual std::vector<std::string> getLists();
+
+  /*!
+    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);
+
+  /*!
+    Gets a named parameter value for the given entry
+   */
+  virtual std::string getParameter(const std::string& entry, const std::string& parameterName);
+
+  /*!
+    Returns all parameter names of the given entry
+   */
+  virtual std::vector<std::string> getAllParameterNames(const std::string& entry);
+
+  /*!
+    Returns all parameter  values of the given entry
+   */
+  virtual std::vector<std::string> getAllParameterValues(const std::string& entry);
+
+  /*!
+    Returns a number of parameters of the given entry
+   */
+  virtual int getNbParameters(const std::string& entry);
+
+  /*!
+    Returns a list all entries 
+   */
+  virtual std::vector<std::string> getEntries();
+
+  /*!
+    Sets a global named property value
+   */
+  virtual void setProperty(const std::string& name, const std::string& value);
+
+  /*!
+    Gets a value of global named property
+   */
+  virtual std::string getProperty(const std::string& name);
+
+  /*!
+    Returns a list all properties 
+   */
+  virtual std::vector<std::string> getProperties();
+
+  /*!
+    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<std::string> parseValue(const std::string& value, const char separator, bool fromEnd = true);
+
+
+  /*!
+    Returns encoded entry that is a relative entry for the component
+   */
+  virtual std::string encodeEntry(const std::string& entry, const std::string& compName);
+
+  /*!
+    Returns decoded entry that is an absolute entry
+   */
+  virtual std::string decodeEntry(const std::string& entry);
+
+  /*!
+    Enables/Disables the dumping visual parameters
+   */
+  static 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 = "");  
+
+  /*!
+    Returns a default name of the component where the visula parameters are stored.
+  */
+  static std::string getDefaultVisualComponent();
+
+private:
+  _PTR(AttributeParameter) _ap;
+  _PTR(Study) _study;
+  std::map<std::string, std::string> _compNames;
+};
+
+
+#endif
index 17e3fcba0cdd81f819a9dd02112df47adf3fe8c0..67220592ea50bd39eb33faacca6a697daf9deeca 100644 (file)
@@ -34,6 +34,7 @@
 #include "SALOMEDS_ChildIterator.hxx"
 #include "SALOMEDS_SComponentIterator.hxx"
 #include "SALOMEDS_AttributeStudyProperties.hxx"
+#include "SALOMEDS_AttributeParameter.hxx"
 #include "SALOMEDS_UseCaseBuilder.hxx"
 
 #include "SALOMEDSImpl_SComponent.hxx"
@@ -42,6 +43,7 @@
 #include "SALOMEDSImpl_ChildIterator.hxx"
 #include "SALOMEDSImpl_SComponentIterator.hxx"
 #include "SALOMEDSImpl_AttributeStudyProperties.hxx"
+#include "SALOMEDSImpl_AttributeParameter.hxx"
 #include "SALOMEDSImpl_UseCaseBuilder.hxx"
 
 #include "SALOMEDS_Driver_i.hxx"
@@ -634,10 +636,10 @@ void SALOMEDS_Study::EnableUseCaseAutoFilling(bool isEnabled)
   else _corba_impl->EnableUseCaseAutoFilling(isEnabled);
 }
 
-bool SALOMEDS_Study::DumpStudy(const std::string& thePath, const std::string& theBaseName, bool isPublished)
+bool SALOMEDS_Study::DumpStudy(const string& thePath, const string& theBaseName, bool isPublished)
 {
   //SRN: Pure CORBA DumpStudy as it does more cleaning than the local one
-  bool ret = _corba_impl->DumpStudy((char*)thePath.c_str(), (char*)theBaseName.c_str(), isPublished);
+  bool ret = _corba_impl->DumpStudy(thePath.c_str(), theBaseName.c_str(), isPublished);
   return ret;
 }     
 
@@ -682,3 +684,34 @@ SALOMEDS::Study_ptr SALOMEDS_Study::GetStudy()
 
   return SALOMEDS::Study::_nil();
 }
+
+_PTR(AttributeParameter) SALOMEDS_Study::GetCommonParameters(const string& theID, int theSavePoint)
+{
+  SALOMEDSClient_AttributeParameter* AP = NULL;
+  if(theSavePoint >= 0) {
+    if (_isLocal) {
+      SALOMEDS::Locker lock;
+      AP = new SALOMEDS_AttributeParameter(_local_impl->GetCommonParameters(theID.c_str(), theSavePoint));
+    }
+    else {
+      AP = new SALOMEDS_AttributeParameter(_corba_impl->GetCommonParameters(theID.c_str(), theSavePoint));
+    }
+  }
+  return _PTR(AttributeParameter)(AP);
+}
+
+_PTR(AttributeParameter) SALOMEDS_Study::GetModuleParameters(const string& theID, 
+                                                            const string& theModuleName, int theSavePoint)
+{
+  SALOMEDSClient_AttributeParameter* AP = NULL;
+  if(theSavePoint > 0) {
+    if (_isLocal) {
+      SALOMEDS::Locker lock;
+      AP = new SALOMEDS_AttributeParameter(_local_impl->GetModuleParameters(theID.c_str(), theModuleName.c_str(), theSavePoint));
+    }
+    else {
+      AP = new SALOMEDS_AttributeParameter(_corba_impl->GetModuleParameters(theID.c_str(), theModuleName.c_str(), theSavePoint));
+    }
+  }
+  return _PTR(AttributeParameter)(AP);
+}
index db2ce6999c677162bb0196efa8bfb149bec7a6f1..8ac27aa70650964b8a7b79163850fe7ba7786b6c 100644 (file)
@@ -86,8 +86,10 @@ public:
   virtual _PTR(UseCaseBuilder) GetUseCaseBuilder();
   virtual void Close();
   virtual void EnableUseCaseAutoFilling(bool isEnabled);
-  virtual bool DumpStudy(const std::string& thePath, const std::string& theBaseName, bool isPublished); 
-
+  virtual bool DumpStudy(const std::string& thePath,const std::string& theBaseName,bool isPublished); 
+  virtual _PTR(AttributeParameter) GetCommonParameters(const std::string& theID, int theSavePoint);
+  virtual _PTR(AttributeParameter) GetModuleParameters(const std::string& theID, 
+                                                      const std::string& theModuleName, int theSavePoint);
   std::string ConvertObjectToIOR(CORBA::Object_ptr theObject);
   CORBA::Object_ptr ConvertIORToObject(const std::string& theIOR);     
 
index 1679b02d713af91f8348ac06cdb83b3bd885e289..d5f80fb03286edd0b5fa298a781ad32bd682105b 100644 (file)
@@ -27,6 +27,7 @@
 #include "SALOMEDS_UseCaseIterator_i.hxx"
 #include "SALOMEDS_GenericAttribute_i.hxx"
 #include "SALOMEDS_AttributeStudyProperties_i.hxx"
+#include "SALOMEDS_AttributeParameter_i.hxx"
 #include "SALOMEDS_ChildIterator_i.hxx"
 #include "SALOMEDS_Driver_i.hxx"
 #include "SALOMEDS.hxx"
@@ -35,7 +36,9 @@
 #include "SALOMEDSImpl_SComponent.hxx"
 #include "SALOMEDSImpl_UseCaseBuilder.hxx"
 #include "SALOMEDSImpl_AttributeStudyProperties.hxx"
+#include "SALOMEDSImpl_AttributeParameter.hxx"
 #include "SALOMEDSImpl_ChildIterator.hxx"
+#include "SALOMEDSImpl_IParameters.hxx"
 
 #include <TColStd_SequenceOfExtendedString.hxx>
 #include <TColStd_HSequenceOfAsciiString.hxx>
@@ -737,7 +740,9 @@ void SALOMEDS_Study_i::UndoPostponed(CORBA::Long theWay)
  *  Purpose  : 
  */
 //============================================================================
-CORBA::Boolean SALOMEDS_Study_i::DumpStudy(const char* thePath, const char* theBaseName, CORBA::Boolean isPublished)
+CORBA::Boolean SALOMEDS_Study_i::DumpStudy(const char* thePath, 
+                                          const char* theBaseName, 
+                                          CORBA::Boolean isPublished)
 {
   SALOMEDS::Locker lock; 
 
@@ -748,6 +753,49 @@ CORBA::Boolean SALOMEDS_Study_i::DumpStudy(const char* thePath, const char* theB
   return ret;
 }
 
+//============================================================================
+/*! Function : GetCommonParameters
+ *  Purpose  : 
+ */
+//============================================================================
+SALOMEDS::AttributeParameter_ptr SALOMEDS_Study_i::GetCommonParameters(const char* theID, CORBA::Long theSavePoint)
+{
+  SALOMEDS::Locker lock; 
+  
+  Handle(SALOMEDSImpl_AttributeParameter) anAttr = _impl->GetCommonParameters(theID, theSavePoint);
+  SALOMEDS_AttributeParameter_i* SP = new SALOMEDS_AttributeParameter_i(anAttr, _orb);
+  return SP->AttributeParameter::_this();
+}
+//============================================================================
+/*! Function : GetCommonModuleParameters
+ *  Purpose  : 
+ */
+//============================================================================
+SALOMEDS::AttributeParameter_ptr SALOMEDS_Study_i::GetModuleParameters(const char* theID, 
+                                                                      const char* theModuleName, 
+                                                                      CORBA::Long theSavePoint)
+{
+  SALOMEDS::Locker lock; 
+  
+  Handle(SALOMEDSImpl_AttributeParameter) anAttr = _impl->GetModuleParameters(theID, theModuleName, theSavePoint);
+  SALOMEDS_AttributeParameter_i* SP = new SALOMEDS_AttributeParameter_i(anAttr, _orb);
+  return SP->AttributeParameter::_this();
+}
+
+//============================================================================
+/*! Function : GetDefaultScript
+ *  Purpose  : 
+ */
+//============================================================================
+char* SALOMEDS_Study_i::GetDefaultScript(const char* theModuleName, const char* theShift)
+{
+  SALOMEDS::Locker lock; 
+
+  string script = SALOMEDSImpl_IParameters::getDefaultScript(_impl, theModuleName, theShift);
+  return CORBA::string_dup(script.c_str());
+}
+
 //===========================================================================
 //   PRIVATE FUNCTIONS
 //===========================================================================
index 33af33eeb2ec3644e1920a435c08816573ac7859..2915735c828718429a882e5371066e2cddfba016 100644 (file)
@@ -279,7 +279,14 @@ public:
                                                 // theWay = -1: get back to the list of postponed
 #endif
 
-  virtual CORBA::Boolean DumpStudy(const char* thePath, const char* theBaseName, CORBA::Boolean isPublished); 
+  virtual SALOMEDS::AttributeParameter_ptr GetCommonParameters(const char* theID, CORBA::Long theSavePoint);
+  virtual SALOMEDS::AttributeParameter_ptr GetModuleParameters(const char* theID, 
+                                                              const char* theModuleName, 
+                                                              CORBA::Long theSavePoint);
+
+  virtual char* GetDefaultScript(const char* theModuleName, const char* theShift);
+
+  virtual CORBA::Boolean DumpStudy(const char* thePath, const char* theBaseName, CORBA::Boolean isPublished);
 
   virtual Handle(SALOMEDSImpl_Study) GetImpl() { return _impl; }
 
diff --git a/src/SALOMEDS/SALOMEDS_TMPFile_i.cxx b/src/SALOMEDS/SALOMEDS_TMPFile_i.cxx
new file mode 100644 (file)
index 0000000..8f9a288
--- /dev/null
@@ -0,0 +1,96 @@
+// Copyright (C) 2005  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/
+//
+//  SALOME SALOMEDS : data structure of SALOME and sources of Salome data server 
+//  File   : SALOMEDSImpl_SObject.cxx
+//  Author : Sergey RUIN
+//  Module : SALOME
+
+
+#include "SALOMEDS_TMPFile_i.hxx"
+
+#include <Handle_Standard_Type.hxx>
+#include <Standard_Transient.hxx>
+
+#include <stdexcept>
+
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDS_TMPFile_i, SALOMEDSImpl_TMPFile )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDS_TMPFile_i, SALOMEDSImpl_TMPFile )
+
+SALOMEDS_TMPFile_i
+::SALOMEDS_TMPFile_i(SALOMEDS::TMPFile* theStream):
+  myStream(theStream)
+{}
+
+size_t
+SALOMEDS_TMPFile_i
+::Size()
+{
+  if(!&myStream.in())
+    return 0;
+
+  return myStream->length();
+}
+
+SALOMEDSImpl_TMPFile::TOctet&
+SALOMEDS_TMPFile_i
+::Get(size_t theIndex)
+{
+  if(!&myStream.in())
+    throw std::out_of_range("SALOMEDS_TMPFile_i::Get(size_t) const - !&myStream.in()");
+
+  if(theIndex < 0 || theIndex >= myStream->length())
+    throw std::out_of_range("SALOMEDS_TMPFile_i::Get(size_t) const - theIndex < 0 || theIndex >= myStream->length()");
+
+  return myStream[theIndex];
+}
+
+
+//-----------------------------------------------------------------------------
+IMPLEMENT_STANDARD_HANDLE( Engines_TMPFile_i, SALOMEDSImpl_TMPFile )
+IMPLEMENT_STANDARD_RTTIEXT( Engines_TMPFile_i, SALOMEDSImpl_TMPFile )
+
+Engines_TMPFile_i
+::Engines_TMPFile_i(Engines::TMPFile* theStream):
+  myStream(theStream)
+{}
+
+size_t
+Engines_TMPFile_i
+::Size()
+{
+  if(!&myStream.in())
+    return 0;
+
+  return myStream->length();
+}
+
+SALOMEDSImpl_TMPFile::TOctet&
+Engines_TMPFile_i
+::Get(size_t theIndex)
+{
+  if(!&myStream.in())
+    throw std::out_of_range("Engines_TMPFile_i::Get(size_t) const - !&myStream.in()");
+
+  if(theIndex < 0 || theIndex >= myStream->length())
+    throw std::out_of_range("Engines_TMPFile_i::Get(size_t) const - theIndex < 0 || theIndex >= myStream->length()");
+
+  return myStream[theIndex];
+}
diff --git a/src/SALOMEDS/SALOMEDS_TMPFile_i.hxx b/src/SALOMEDS/SALOMEDS_TMPFile_i.hxx
new file mode 100644 (file)
index 0000000..124d08d
--- /dev/null
@@ -0,0 +1,70 @@
+// Copyright (C) 2005  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/
+//
+
+#ifndef __SALOMEDSIMPL_TMPFILE_I_H__
+#define __SALOMEDSIMPL_TMPFILE_I_H__
+
+// IDL headers
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOME_Component)
+
+#include "SALOMEDSImpl_TMPFile.hxx"
+
+
+//-----------------------------------------------------------------------------
+DEFINE_STANDARD_HANDLE( SALOMEDS_TMPFile_i, SALOMEDSImpl_TMPFile );
+
+class SALOMEDS_TMPFile_i : public SALOMEDSImpl_TMPFile
+{
+public:
+  SALOMEDS_TMPFile_i(SALOMEDS::TMPFile* theStream);
+
+  virtual size_t Size();
+
+  virtual TOctet& Get(size_t);
+
+  DEFINE_STANDARD_RTTI( SALOMEDS_TMPFile_i );
+
+protected:
+  SALOMEDS::TMPFile_var myStream;
+};
+
+
+//-----------------------------------------------------------------------------
+DEFINE_STANDARD_HANDLE( Engines_TMPFile_i, SALOMEDSImpl_TMPFile );
+
+class Engines_TMPFile_i : public SALOMEDSImpl_TMPFile
+{
+public:
+  Engines_TMPFile_i(Engines::TMPFile* theStream);
+
+  virtual size_t Size();
+
+  virtual TOctet& Get(size_t);
+
+  DEFINE_STANDARD_RTTI( Engines_TMPFile_i );
+
+protected:
+  Engines::TMPFile_var myStream;
+};
+
+
+#endif
diff --git a/src/SALOMEDS/Test/Makefile.am b/src/SALOMEDS/Test/Makefile.am
new file mode 100644 (file)
index 0000000..893e949
--- /dev/null
@@ -0,0 +1,110 @@
+#
+#  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+#
+#
+#
+#  File   : Makefile.am
+#  Author : Paul RASCLE
+#  Module : KERNEL
+#  $Header$
+
+include $(top_srcdir)/salome_adm/unix/make_common_starter.am
+
+#
+# ===============================================================
+# Files to be installed
+# ===============================================================
+#
+# header files  
+salomeinclude_HEADERS= SALOMEDSTest.hxx
+
+# Scripts to be installed
+dist_salomescript_SCRIPTS = TestSALOMEDS.py
+
+#
+# ===============================================================
+# Local definitions
+# ===============================================================
+#
+
+# This directory defines the subdirectory src in the top source directory.
+RPATH=../..
+
+# This local variable defines the list of CPPFLAGS common to all target in this package.
+COMMON_CPPFLAGS=\
+       @CPPUNIT_INCLUDES@ \
+       -I$(srcdir)/$(RPATH)/Basics               -I$(srcdir)/$(RPATH)/Basics/Test \
+       -I$(srcdir)/$(RPATH)/SALOMELocalTrace     -I$(srcdir)/$(RPATH)/SALOMELocalTrace/Test \
+       -I$(srcdir)/$(RPATH)/SALOMETraceCollector -I$(srcdir)/$(RPATH)/SALOMETraceCollector/Test \
+       -I$(srcdir)/$(RPATH)/NamingService        -I$(srcdir)/$(RPATH)/NamingService/Test \
+       -I$(srcdir)/$(RPATH)/Utils                -I$(srcdir)/$(RPATH)/Utils/Test \
+       -I$(srcdir)/$(RPATH)/ResourcesManager \
+       -I$(srcdir)/$(RPATH)/LifeCycleCORBA \
+       -I$(srcdir)/$(RPATH)/SALOMEDSClient \
+       -I$(srcdir)/$(RPATH)/SALOMEDSImpl         -I$(srcdir)/$(RPATH)/SALOMEDSImpl/Test \
+       -I$(top_builddir)/salome_adm/unix \
+       -I$(top_builddir)/idl \
+       @CAS_CPPFLAGS@ @CAS_CXXFLAGS@ \
+       @CORBA_CXXFLAGS@ @CORBA_INCLUDES@
+
+# This local variable defines the list of dependant libraries common to all target in this package.
+COMMON_LIBS =\
+       @CPPUNIT_LIBS@ \
+       $(RPATH)/Basics/libSALOMEBasics.la \
+       $(RPATH)/ResourcesManager/libSalomeResourcesManager.la \
+       $(RPATH)/Container/libSalomeContainer.la \
+       $(RPATH)/NamingService/libSalomeNS.la \
+       $(RPATH)/Registry/libRegistry.la \
+       $(RPATH)/Notification/libSalomeNotification.la \
+       $(RPATH)/Utils/Test/libUtilsTest.la \
+       $(RPATH)/Utils/libOpUtil.la \
+       $(RPATH)/SALOMELocalTrace/Test/libSALOMELocalTraceTest.la \
+       $(RPATH)/SALOMELocalTrace/libSALOMELocalTrace.la \
+       $(RPATH)/SALOMETraceCollector/Test/libSALOMETraceCollectorTest.la \
+       $(RPATH)/SALOMEDSImpl/Test/libSALOMEDSImplTest.la \
+       $(RPATH)/SALOMEDSImpl/libSalomeDSImpl.la \
+       $(RPATH)/SALOMEDSClient/libSalomeDSClient.la \
+       $(RPATH)/SALOMEDS/libSalomeDS.la \
+       $(top_builddir)/idl/libSalomeIDLKernel.la
+
+#
+# ===============================================================
+# Libraries targets
+# ===============================================================
+#
+lib_LTLIBRARIES = libSALOMEDSTest.la 
+libSALOMEDSTest_la_SOURCES = SALOMEDSTest.cxx
+libSALOMEDSTest_la_CPPFLAGS = $(COMMON_CPPFLAGS)
+libSALOMEDSTest_la_LDFLAGS  = -no-undefined -version-info=0:0:0
+libSALOMEDSTest_la_LIBADD    = $(COMMON_LIBS)
+
+#
+# ===============================================================
+# Executables targets
+# ===============================================================
+#
+bin_PROGRAMS = TestSALOMEDS
+TestSALOMEDS_SOURCES  = TestSALOMEDS.cxx
+TestSALOMEDS_CPPFLAGS = $(COMMON_CPPFLAGS)
+TestSALOMEDS_LDADD    = \
+       libSALOMEDSTest.la ../libSalomeDS.la \
+       $(RPATH)/NamingService/Test/libNamingServiceTest.la \
+       $(COMMON_LIBS)
+
diff --git a/src/SALOMEDS/Test/SALOMEDSTest.cxx b/src/SALOMEDS/Test/SALOMEDSTest.cxx
new file mode 100644 (file)
index 0000000..c67bdde
--- /dev/null
@@ -0,0 +1,190 @@
+// Copyright (C) 2006  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/
+//
+
+#include "SALOMEDSTest.hxx"
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <vector>
+#include <cstdlib>
+#include "utilities.h"
+#include "Utils_SALOME_Exception.hxx"
+#include "Utils_ORB_INIT.hxx"
+#include "Utils_SINGLETON.hxx"
+#include "OpUtil.hxx"
+
+#include "SALOMEDSClient.hxx"
+#include "SALOMEDSClient_ClientFactory.hxx"
+
+#include <TCollection_AsciiString.hxx>
+
+using namespace std;
+
+#define PT_INTEGER 0
+#define PT_REAL    1
+#define PT_BOOLEAN 2
+#define PT_STRING  3
+#define PT_REALARRAY 4
+#define PT_INTARRAY  5
+#define PT_STRARRAY  6
+
+
+#define TRACEFILE "/tmp/traceUnitTest.log"
+
+// ============================================================================
+/*!
+ * Set up the environment
+ */
+// ============================================================================
+
+void SALOMEDSTest::setUp()
+{
+  TCollection_AsciiString kernel(getenv("KERNEL_ROOT_DIR"));
+  TCollection_AsciiString subPath("/share/salome/resources");
+  TCollection_AsciiString csf_var = (kernel+subPath);
+  setenv("CSF_PluginDefaults", csf_var.ToCString(), 0);
+  setenv("CSF_SALOMEDS_ResourcesDefaults", csf_var.ToCString(), 0);
+
+  // --- trace on file
+  char *theFileName = TRACEFILE;
+
+  string s = "file:";
+  s += theFileName;
+  CPPUNIT_ASSERT(! setenv("SALOME_trace",s.c_str(),1)); // 1: overwrite
+
+  ofstream traceFile;
+  traceFile.open(theFileName, ios::out | ios::app);
+  CPPUNIT_ASSERT(traceFile); // file created empty, then closed
+  traceFile.close();
+
+  LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance();
+  CPPUNIT_ASSERT(bp1);
+
+  // --- Get or initialize the orb
+
+  int _argc = 1;
+  char* _argv[] = {""};
+  ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+  ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
+  _orb = init(_argc , _argv ) ;
+
+  sleep(2);
+
+  // --- Create a SALOME_NamingService instance
+
+  _NS = new SALOME_NamingService;
+
+  sleep(2);
+
+  _NS->init_orb(_orb) ;
+}
+
+// ============================================================================
+/*!
+ *  - delete trace classes
+ */
+// ============================================================================
+
+void 
+SALOMEDSTest::tearDown()
+{
+  LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance();
+  CPPUNIT_ASSERT(bp1);
+  bp1->deleteInstance(bp1);
+
+  delete _NS;
+}
+
+// ============================================================================
+/*!
+ * Check AttributeParameter
+ */
+// ============================================================================
+void SALOMEDSTest::testAttributeParameter()
+{
+  CORBA::Object_var obj = _orb->resolve_initial_references( "RootPOA" );
+  PortableServer::POA_var poa = PortableServer::POA::_narrow( obj );
+
+  PortableServer::POAManager_var pman = poa->the_POAManager();
+  pman->activate() ;
+
+  _PTR(StudyManager) sm = ClientFactory::createStudyManager(_orb, poa);
+
+  CPPUNIT_ASSERT(sm);
+
+  _PTR(Study) study = sm->NewStudy("Test");
+
+  CPPUNIT_ASSERT(study);
+
+  _PTR(AttributeParameter) _ap = study->GetCommonParameters("TestComp", 0);
+
+  CPPUNIT_ASSERT(_ap);
+
+  _ap->SetInt("IntValue", 1);
+  CPPUNIT_ASSERT(_ap->IsSet("IntValue", PT_INTEGER));
+  CPPUNIT_ASSERT(_ap->GetInt("IntValue") == 1);
+
+  _ap->SetReal("RealValue", 1.2);
+  CPPUNIT_ASSERT(_ap->IsSet("RealValue", PT_REAL));
+  CPPUNIT_ASSERT(_ap->GetReal("RealValue") == 1.2);
+
+  _ap->SetString("StringValue", "hello");
+  CPPUNIT_ASSERT(_ap->IsSet("StringValue", PT_STRING));
+  CPPUNIT_ASSERT(_ap->GetString("StringValue") == "hello");
+
+  _ap->SetBool("BoolValue", 0);
+  CPPUNIT_ASSERT(_ap->IsSet("BoolValue", PT_BOOLEAN));
+  CPPUNIT_ASSERT(!_ap->GetBool("BoolValue"));
+
+  _ap->SetBool("BoolValue", 0);
+  CPPUNIT_ASSERT(_ap->IsSet("BoolValue", PT_BOOLEAN));
+  CPPUNIT_ASSERT(!_ap->GetBool("BoolValue"));
+
+  vector<int> intArray;
+  intArray.push_back(0);
+  intArray.push_back(1);
+
+  _ap->SetIntArray("IntArray", intArray);
+  CPPUNIT_ASSERT(_ap->IsSet("IntArray", PT_INTARRAY));
+  CPPUNIT_ASSERT(_ap->GetIntArray("IntArray")[0] == 0);
+  CPPUNIT_ASSERT(_ap->GetIntArray("IntArray")[1] == 1); 
+
+  vector<double> realArray;
+  realArray.push_back(0.0);
+  realArray.push_back(1.1);
+  
+  _ap->SetRealArray("RealArray", realArray);
+  CPPUNIT_ASSERT(_ap->IsSet("RealArray", PT_REALARRAY));
+  CPPUNIT_ASSERT(_ap->GetRealArray("RealArray")[0] == 0.0);
+  CPPUNIT_ASSERT(_ap->GetRealArray("RealArray")[1] == 1.1); 
+
+  vector<string> strArray;
+  strArray.push_back("hello");
+  strArray.push_back("world");
+  
+  _ap->SetStrArray("StrArray", strArray);
+  CPPUNIT_ASSERT(_ap->IsSet("StrArray", PT_STRARRAY));
+  CPPUNIT_ASSERT(_ap->GetStrArray("StrArray")[0] == "hello");
+  CPPUNIT_ASSERT(_ap->GetStrArray("StrArray")[1] == "world"); 
+}
+
+
+
diff --git a/src/SALOMEDS/Test/SALOMEDSTest.hxx b/src/SALOMEDS/Test/SALOMEDSTest.hxx
new file mode 100644 (file)
index 0000000..3599819
--- /dev/null
@@ -0,0 +1,48 @@
+// Copyright (C) 2006  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/
+//
+
+#ifndef _SALOMEDSTEST_HXX_
+#define _SALOMEDSTEST_HXX_
+
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <CORBA.h>
+
+#include <SALOMEconfig.h>
+#include "SALOME_NamingService.hxx"
+
+class SALOMEDSTest : public CppUnit::TestFixture
+{
+  CPPUNIT_TEST_SUITE( SALOMEDSTest );
+  CPPUNIT_TEST( testAttributeParameter );
+  CPPUNIT_TEST_SUITE_END();
+
+public:
+
+  void setUp();
+  void tearDown();
+  void testAttributeParameter();
+
+protected:
+  CORBA::ORB_var _orb;
+  SALOME_NamingService* _NS;
+};
+
+#endif
diff --git a/src/SALOMEDS/Test/TestSALOMEDS.cxx b/src/SALOMEDS/Test/TestSALOMEDS.cxx
new file mode 100644 (file)
index 0000000..c2689ec
--- /dev/null
@@ -0,0 +1,35 @@
+// Copyright (C) 2005  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/
+//
+
+// --- include all SALOMEDS Test from basics until the present directory
+
+#include "SALOMELocalTraceTest.hxx"
+#include "SALOMEDSImplTest.hxx"
+#include "SALOMEDSTest.hxx"
+
+// --- Registers the fixture into the 'registry'
+
+CPPUNIT_TEST_SUITE_REGISTRATION( SALOMELocalTraceTest );
+CPPUNIT_TEST_SUITE_REGISTRATION( SALOMEDSImplTest );
+CPPUNIT_TEST_SUITE_REGISTRATION( SALOMEDSTest );
+
+// --- generic Main program from Basic/Test
+
+#include "BasicMainTest.hxx"
diff --git a/src/SALOMEDS/Test/TestSALOMEDS.py b/src/SALOMEDS/Test/TestSALOMEDS.py
new file mode 100644 (file)
index 0000000..faae31b
--- /dev/null
@@ -0,0 +1,29 @@
+
+import sys, os,signal,string,commands
+import runSalome
+import orbmodule
+import TestKiller
+
+# get SALOME environment :
+
+args, modules_list, modules_root_dir = runSalome.get_config()
+runSalome.set_env(args, modules_list, modules_root_dir)
+
+# launch CORBA naming server
+
+clt=orbmodule.client()
+
+# launch CORBA logger server
+
+myServer=runSalome.LoggerServer(args)
+myServer.run()
+clt.waitLogger("Logger")
+
+# execute Unit Test
+
+command = ['TestSALOMEDS']
+ret = os.spawnvp(os.P_WAIT, command[0], command)
+
+# kill Test process 
+
+TestKiller.killProcess(runSalome.process_id)
index a0b75a2b585a433c8cee82eb474e96d087739501..6593e94e49afa43d808dd7e58da796265ff20a4e 100644 (file)
@@ -36,6 +36,7 @@ salomeinclude_HEADERS=\
                 SALOMEDSClient_AttributeTextHighlightColor.hxx \
                 SALOMEDSClient_AttributeTreeNode.hxx \
                 SALOMEDSClient_AttributeUserID.hxx \
+               SALOMEDSClient_AttributeParameter.hxx \
                 SALOMEDSClient_ChildIterator.hxx \
                 SALOMEDSClient_GenericAttribute.hxx \
                 SALOMEDSClient_SComponent.hxx \
@@ -46,4 +47,36 @@ salomeinclude_HEADERS=\
                 SALOMEDSClient_StudyManager.hxx \
                 SALOMEDSClient_UseCaseBuilder.hxx \
                 SALOMEDSClient_UseCaseIterator.hxx \
+               SALOMEDSClient_ClientFactory.hxx \
                SALOMEDSClient.hxx
+
+#
+# ===============================================================
+# Local definitions
+# ===============================================================
+#
+
+# This local variable defines the list of CPPFLAGS common to all target in this package.
+COMMON_CPPFLAGS= \
+       -I$(top_builddir)/salome_adm/unix \
+       -I$(top_builddir)/idl \
+       @CORBA_CXXFLAGS@ @CORBA_INCLUDES@
+
+
+
+# This local variable defines the list of dependant libraries common to all target in this package.
+COMMON_LIBS =
+
+#
+# ===============================================================
+# Libraries targets
+# ===============================================================
+#
+lib_LTLIBRARIES = libSalomeDSClient.la
+libSalomeDSClient_la_SOURCES =         \
+       SALOMEDSClient_ClientFactory.cxx
+
+
+libSalomeDSClient_la_CPPFLAGS = $(COMMON_CPPFLAGS)
+libSalomeDSClient_la_LDFLAGS  = -no-undefined -version-info=0:0:0
+libSalomeDSClient_la_LIBADD   = $(COMMON_LIBS)
index e604320e0acfcc550096cb0f03806c4ce8a4195d..5adb67120cb979c36db5dad052f25c20333adfe5 100644 (file)
@@ -49,6 +49,7 @@
 #include "SALOMEDSClient_AttributeTextHighlightColor.hxx"
 #include "SALOMEDSClient_AttributeTreeNode.hxx"
 #include "SALOMEDSClient_AttributeUserID.hxx"
+#include "SALOMEDSClient_AttributeParameter.hxx"
 #include "SALOMEDSClient_ChildIterator.hxx"
 #include "SALOMEDSClient_GenericAttribute.hxx"
 #include "SALOMEDSClient_SComponent.hxx"
diff --git a/src/SALOMEDSClient/SALOMEDSClient_AttributeParameter.hxx b/src/SALOMEDSClient/SALOMEDSClient_AttributeParameter.hxx
new file mode 100644 (file)
index 0000000..e8c3f17
--- /dev/null
@@ -0,0 +1,71 @@
+// Copyright (C) 2005  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/
+//
+//  File   : SALOMEDSImpl_AttributeIOR.hxx
+//  Author : Sergey RUIN
+//  Module : SALOME
+
+#ifndef _SALOMEDSClient_AttributeParameter_HeaderFile
+#define _SALOMEDSClient_AttributeParameter_HeaderFile
+
+#include "SALOMEDSClient_definitions.hxx" 
+#include "SALOMEDSClient_GenericAttribute.hxx" 
+#include <string>
+#include <vector>
+
+class SALOMEDSClient_AttributeParameter : public virtual SALOMEDSClient_GenericAttribute 
+{
+
+public:
+
+  virtual void SetInt(const std::string& theID, const int theValue) = 0;
+  virtual int GetInt(const std::string& theID) = 0;
+
+  virtual void SetReal(const std::string& theID, const double& theValue) = 0;
+  virtual double GetReal(const std::string& theID) = 0;
+
+  virtual void SetString(const std::string& theID, const std::string& theValue) = 0;
+  virtual std::string GetString(const std::string& theID) = 0;
+  
+  virtual void SetBool(const std::string& theID, const bool& theValue) = 0;
+  virtual bool GetBool(const std::string& theID) = 0;
+  
+  virtual void SetRealArray(const std::string& theID, const std::vector<double>& theArray) = 0;
+  virtual std::vector<double> GetRealArray(const std::string& theID) = 0;
+  
+  virtual void SetIntArray(const std::string& theID, const std::vector<int>& theArray) = 0;
+  virtual std::vector<int> GetIntArray(const std::string& theID) = 0;
+
+  virtual void SetStrArray(const std::string& theID, const std::vector<std::string>& theArray) = 0;
+  virtual std::vector<std::string> GetStrArray(const std::string& theID) = 0;
+
+  virtual bool IsSet(const std::string& theID, const int theType) = 0;
+  
+  virtual bool RemoveID(const std::string& theID, const int theType) = 0;
+
+  virtual _PTR(AttributeParameter) GetFather() = 0;
+  virtual bool HasFather() = 0;
+  virtual bool IsRoot() = 0;
+  
+  virtual void Clear() = 0;
+
+  virtual std::vector<std::string> GetIDs(const int theType) = 0;
+};
+
+#endif
diff --git a/src/SALOMEDSClient/SALOMEDSClient_ClientFactory.cxx b/src/SALOMEDSClient/SALOMEDSClient_ClientFactory.cxx
new file mode 100644 (file)
index 0000000..4b5e23b
--- /dev/null
@@ -0,0 +1,112 @@
+#include "SALOMEDSClient_ClientFactory.hxx"
+
+#ifdef WIN32
+#include <windows.h>
+static HMODULE _libHandle = 0;
+#define SALOMEDS_LIB_NAME "SalomeDS.dll"
+#else
+#include <dlfcn.h>
+static void* _libHandle = NULL;
+#define SALOMEDS_LIB_NAME "libSalomeDS.so"
+#endif
+
+#define SOBJECT_FACTORY      "SObjectFactory"
+#define SCOMPONENT_FACTORY   "SComponentFactory"
+#define STUDY_FACTORY        "StudyFactory"
+#define STUDYMANAGER_FACTORY "StudyManagerFactory"
+#define STUDYMANAGER_CREATE  "CreateStudyManager"
+
+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_StudyManager* (*STUDYMANAGER_CREATE_FUNCTION) (CORBA::ORB_ptr, PortableServer::POA_ptr);
+
+static SOBJECT_FACTORY_FUNCTION aSObjectFactory = NULL;
+static SCOMPONENT_FACTORY_FUNCTION aSComponentFactory = NULL;
+static STUDY_FACTORY_FUNCTION aStudyFactory = NULL;
+static STUDYMANAGER_FACTORY_FUNCTION aManagerFactory = NULL;
+static STUDYMANAGER_CREATE_FUNCTION aCreateFactory = NULL;
+
+using namespace std;
+
+_PTR(SObject) ClientFactory::SObject(SALOMEDS::SObject_ptr theSObject)
+{
+  SALOMEDSClient_SObject* so = NULL;
+
+#ifdef WIN32
+  if(!_libHandle) _libHandle = ::LoadLibrary(SALOMEDS_LIB_NAME);
+  if(!aSObjectFactory) aSObjectFactory = (SOBJECT_FACTORY_FUNCTION)::GetProcAddress(_libHandle, SOBJECT_FACTORY);
+#else
+  if(!_libHandle) _libHandle = dlopen(SALOMEDS_LIB_NAME, RTLD_LAZY | RTLD_GLOBAL);
+  if(!aSObjectFactory) aSObjectFactory = (SOBJECT_FACTORY_FUNCTION) dlsym(_libHandle, SOBJECT_FACTORY);
+#endif
+
+  if(aSObjectFactory) so = aSObjectFactory(theSObject); 
+  return _PTR(SObject)(so);
+}
+
+_PTR(SComponent) ClientFactory::SComponent(SALOMEDS::SComponent_ptr theSComponent)
+{
+  SALOMEDSClient_SComponent* sco = NULL; 
+
+#ifdef WIN32
+  if(!_libHandle) _libHandle = ::LoadLibrary(SALOMEDS_LIB_NAME);
+  if(!aSComponentFactory) aSComponentFactory = (SCOMPONENT_FACTORY_FUNCTION)::GetProcAddress(_libHandle, SCOMPONENT_FACTORY);
+#else
+  if(!_libHandle) _libHandle = dlopen(SALOMEDS_LIB_NAME, RTLD_LAZY | RTLD_GLOBAL);
+  if(!aSComponentFactory) aSComponentFactory = (SCOMPONENT_FACTORY_FUNCTION) dlsym(_libHandle, SCOMPONENT_FACTORY);
+#endif
+
+  if(aSComponentFactory) sco = aSComponentFactory(theSComponent); 
+  return _PTR(SComponent)(sco);
+}
+
+_PTR(Study) ClientFactory::Study(SALOMEDS::Study_ptr theStudy)
+{
+  SALOMEDSClient_Study* study = NULL;
+
+#ifdef WIN32
+  if(!_libHandle) _libHandle = ::LoadLibrary(SALOMEDS_LIB_NAME);
+  if(!aStudyFactory) aStudyFactory = (STUDY_FACTORY_FUNCTION)::GetProcAddress(_libHandle, STUDY_FACTORY);
+#else
+  if(!_libHandle) _libHandle = dlopen(SALOMEDS_LIB_NAME, RTLD_LAZY | RTLD_GLOBAL);
+  if(!aStudyFactory) aStudyFactory = (STUDY_FACTORY_FUNCTION) dlsym(_libHandle, STUDY_FACTORY);
+#endif
+
+  if(aStudyFactory) study = aStudyFactory(theStudy); 
+  return _PTR(Study)(study);
+}
+
+_PTR(StudyManager) ClientFactory::StudyManager()
+{
+  SALOMEDSClient_StudyManager* manager = NULL;
+
+#ifdef WIN32
+  if(!_libHandle) _libHandle = ::LoadLibrary(SALOMEDS_LIB_NAME);
+  if(!aManagerFactory) aManagerFactory = (STUDYMANAGER_FACTORY_FUNCTION)::GetProcAddress(_libHandle, STUDYMANAGER_FACTORY);
+#else
+  if(!_libHandle) _libHandle = dlopen(SALOMEDS_LIB_NAME, RTLD_LAZY | RTLD_GLOBAL);
+  if(!aManagerFactory) aManagerFactory = (STUDYMANAGER_FACTORY_FUNCTION) dlsym(_libHandle, STUDYMANAGER_FACTORY);
+#endif
+
+  if(aManagerFactory) manager = aManagerFactory(); 
+  return _PTR(StudyManager)(manager);
+}
+
+_PTR(StudyManager) ClientFactory::createStudyManager(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa)
+{
+  SALOMEDSClient_StudyManager* manager = NULL;
+
+#ifdef WIN32
+  if(!_libHandle) _libHandle = ::LoadLibrary(SALOMEDS_LIB_NAME);
+  if(!aCreateFactory) aCreateFactory = (STUDYMANAGER_CREATE_FUNCTION)::GetProcAddress(_libHandle, STUDYMANAGER_CREATE);
+#else
+  if(!_libHandle) _libHandle = dlopen(SALOMEDS_LIB_NAME, RTLD_LAZY | RTLD_GLOBAL);
+  if(!aCreateFactory) aCreateFactory = (STUDYMANAGER_CREATE_FUNCTION) dlsym(_libHandle, STUDYMANAGER_CREATE);
+#endif
+
+  if(aCreateFactory)  manager = aCreateFactory(orb, poa);
+  return _PTR(StudyManager)(manager);
+}
+
diff --git a/src/SALOMEDSClient/SALOMEDSClient_ClientFactory.hxx b/src/SALOMEDSClient/SALOMEDSClient_ClientFactory.hxx
new file mode 100644 (file)
index 0000000..8592929
--- /dev/null
@@ -0,0 +1,71 @@
+// Copyright (C) 2006  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/
+//
+//  File   : SALOMEDSClient_ClientFactory.hxx
+//  Author : Sergey RUIN
+//  Module : SALOME
+//  $Header:
+
+#ifndef SALOMEDSClient_ClientFactory_HeaderFile
+#define SALOMEDSClient_ClientFactory_HeaderFile
+
+#include "SALOMEDSClient_definitions.hxx" 
+#include "SALOMEDSClient_SObject.hxx"
+#include "SALOMEDSClient_SComponent.hxx"
+#include "SALOMEDSClient_Study.hxx"
+#include "SALOMEDSClient_StudyManager.hxx"
+
+#include <string>
+
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(SALOMEDS)
+
+class ClientFactory {
+
+public:
+  /*!
+   *  Returns a client SObject wrapper that corresponds %theSObject
+   */
+  static _PTR(SObject) SObject(SALOMEDS::SObject_ptr theSObject);
+
+  /*!
+   *  Returns a client SComponent wrapper that corresponds %theSComponent
+   */
+  static _PTR(SComponent) SComponent(SALOMEDS::SComponent_ptr theSComponent);
+
+  /*!
+   *  Returns a client Study wrapper that corresponds %theStudy
+   */
+  static _PTR(Study) Study(SALOMEDS::Study_ptr theStudy);
+
+  /*!
+   *  Returns a client StudyManager wrapper
+   */
+  static _PTR(StudyManager) StudyManager();
+
+  /*!
+   *  Creates and returns a client StudyManager wrapper
+   */
+  static _PTR(StudyManager) createStudyManager(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa);
+
+  
+};
+
+#endif
index 4a33f2b9d243c43cb1f2ad088de963367de7774e..d9873090cc71acd28262e23d2ec1e3e818fedf7c 100644 (file)
@@ -30,6 +30,7 @@
 #include "SALOMEDSClient_definitions.hxx"
 #include "SALOMEDSClient_SComponentIterator.hxx"
 #include "SALOMEDSClient_StudyBuilder.hxx"
+#include "SALOMEDSClient_AttributeParameter.hxx"
 #include "SALOMEDSClient_SObject.hxx"
 #include "SALOMEDSClient_SComponent.hxx"
 #include "SALOMEDSClient_UseCaseBuilder.hxx"
@@ -79,7 +80,12 @@ public:
   virtual _PTR(UseCaseBuilder) GetUseCaseBuilder() = 0;
   virtual void Close() = 0;
   virtual void EnableUseCaseAutoFilling(bool isEnabled) = 0;
-  virtual bool DumpStudy(const std::string& thePath, const std::string& theBaseName, bool isPublished) = 0; 
+  virtual bool DumpStudy(const std::string& thePath, 
+                        const std::string& theBaseName, 
+                        bool isPublished) = 0;
+  virtual _PTR(AttributeParameter) GetCommonParameters(const std::string& theID, int theSavePoint) = 0;
+  virtual _PTR(AttributeParameter) GetModuleParameters(const std::string& theID, 
+                                                      const std::string& theModuleName, int theSavePoint) = 0;
 };
 
 
index 1600013c5dcf86eb0c29d8ccebfffdfd5c907aaf..22cd3b6ea3ecfc3e5dea8980a03a569225291c82 100644 (file)
@@ -47,6 +47,7 @@ salomeinclude_HEADERS= \
        SALOMEDSImpl_AttributeName.hxx \
        SALOMEDSImpl_AttributeComment.hxx \
        SALOMEDSImpl_AttributeReference.hxx \
+       SALOMEDSImpl_AttributeParameter.hxx \
        SALOMEDSImpl_UseCaseBuilder.hxx \
        SALOMEDSImpl_UseCaseIterator.hxx \
        SALOMEDSImpl_SComponentIterator.hxx \
@@ -54,7 +55,9 @@ salomeinclude_HEADERS= \
        SALOMEDSImpl_Study.hxx \
        SALOMEDSImpl_StudyManager.hxx \
        SALOMEDSImpl_OCAFApplication.hxx \
-       SALOMEDSImpl_ChildNodeIterator.hxx
+       SALOMEDSImpl_ChildNodeIterator.hxx \
+       SALOMEDSImpl_IParameters.hxx \
+       SALOMEDSImpl_TMPFile.hxx
 
 #
 # ===============================================================
@@ -65,6 +68,8 @@ salomeinclude_HEADERS= \
 # This local variable defines the list of CPPFLAGS common to all target in this package.
 COMMON_CPPFLAGS=\
        @CAS_CPPFLAGS@ @CAS_CXXFLAGS@ \
+       -I$(srcdir)/../Basics \
+       -I$(srcdir)/../SALOMELocalTrace \
        -I$(srcdir)/../HDFPersist \
        @HDF5_INCLUDES@
 
@@ -123,6 +128,7 @@ libSalomeDSImpl_la_SOURCES =\
        SALOMEDSImpl_AttributeName.cxx \
        SALOMEDSImpl_AttributeComment.cxx \
        SALOMEDSImpl_AttributeReference.cxx \
+       SALOMEDSImpl_AttributeParameter.cxx \
        SALOMEDSImpl_ChildNodeIterator.cxx \
        SALOMEDSImpl_UseCaseBuilder.cxx \
        SALOMEDSImpl_UseCaseIterator.cxx \
@@ -130,6 +136,8 @@ libSalomeDSImpl_la_SOURCES =\
        SALOMEDSImpl_StudyBuilder.cxx \
        SALOMEDSImpl_Study.cxx \
        SALOMEDSImpl_StudyManager.cxx \
+       SALOMEDSImpl_IParameters.cxx \
+       SALOMEDSImpl_TMPFile.cxx \
        \
        SALOMEDSImpl_AttributeComment.hxx \
        SALOMEDSImpl_AttributeDrawable.hxx \
diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.cxx
new file mode 100644 (file)
index 0000000..929dec9
--- /dev/null
@@ -0,0 +1,765 @@
+// Copyright (C) 2005  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/
+//
+//  File   : SALOMEDSImpl_AttributeParameter.cxx
+//  Author : Sergey RUIN
+//  Module : SALOME
+
+
+#include "SALOMEDSImpl_AttributeParameter.hxx"
+#include <Standard_Failure.hxx>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <strstream>
+
+using namespace std;
+
+
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeParameter, SALOMEDSImpl_GenericAttribute )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeParameter, SALOMEDSImpl_GenericAttribute )
+
+
+// Purpose: Each character in the string is replaced by 3 characters: '%' and hex number 
+//          of the character (2 characters)
+string convertString(const string& S)
+{
+  int length = S.size();
+  const char *s = S.c_str();
+  char *c = new char[3], *buffer = new char[length*3+1];
+  buffer[length*3] = (char)0;
+  for(int i = 0, pos = 0; i<length; i++, pos+=3) {
+    int val = (int)s[i];
+    buffer[pos] = '%';
+    sprintf(c, "%x", val);
+    buffer[pos+1] = c[0]; 
+    buffer[pos+2] = c[1];
+  }
+
+  string RS(buffer); 
+  delete c;
+  delete buffer;
+  return RS;
+}
+
+//Restors a string converted by the function convertString
+string restoreString(const string& S)
+{
+  int length = S.size();
+  char *c = new char[3], *buffer = new char[length/3+1];
+  buffer[length/3] = (char)0;
+  const char *s = S.c_str();
+  for(int i = 0, pos = 0; i<length; i+=3, pos++) {
+    c[0] = s[i+1];
+    c[1] = s[i+2];
+    c[2] = (char)0;
+    int val = strtol(c, NULL, 16);
+    buffer[pos] = (char)val;
+  }
+
+  string RS(buffer); 
+  delete c;
+  delete buffer;
+  return RS;
+}
+
+//=======================================================================
+/*!
+ * Function : GetID
+ * Purpose  : Returns GUID of the attribute
+ */
+//=======================================================================
+const Standard_GUID& SALOMEDSImpl_AttributeParameter::GetID ()
+{
+  static Standard_GUID ParemeterID ("BA75F3A1-E40B-46b8-8D24-B1D3C3BB1A8C");
+  return ParemeterID;
+}   
+
+//=======================================================================
+/*!
+ * Function : Set
+ * Purpose  : Adds an attribute to the label
+ */
+//=======================================================================
+Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_AttributeParameter::Set (const TDF_Label& L) 
+{
+  Handle(SALOMEDSImpl_AttributeParameter) A;
+  if (!L.FindAttribute(SALOMEDSImpl_AttributeParameter::GetID(), A)) {
+    A = new  SALOMEDSImpl_AttributeParameter(); 
+    L.AddAttribute(A);
+  }
+
+  return A;
+}
+
+//=======================================================================
+/*!
+ * Function : SetInt
+ * Purpose  : Associates a integer value with the ID
+ */
+//=======================================================================
+void SALOMEDSImpl_AttributeParameter::SetInt(const string& theID, const int& theValue)
+{
+  CheckLocked();
+
+  Backup();
+
+  _ints[theID] = theValue;
+
+  SetModifyFlag(); 
+}
+
+//=======================================================================
+/*!
+ * Function : GetInt
+ * Purpose  : Returns a int value associated with the given ID
+ */
+//=======================================================================
+int SALOMEDSImpl_AttributeParameter::GetInt(const string& theID)
+{
+  if(!IsSet(theID, PT_INTEGER)) Standard_Failure::Raise("Invalid ID");
+  return _ints[theID];
+}
+
+//=======================================================================
+/*!
+ * Function : SetReal
+ * Purpose  : Associates a double value with the ID
+ */
+//=======================================================================
+void SALOMEDSImpl_AttributeParameter::SetReal(const string& theID, const double& theValue)
+{
+  CheckLocked();
+
+  Backup();
+
+  _reals[theID] = theValue;
+
+  SetModifyFlag(); 
+}
+
+//=======================================================================
+/*!
+ * Function : GetReal
+ * Purpose  : Returns a double value associated with the given ID
+ */
+//=======================================================================
+double SALOMEDSImpl_AttributeParameter::GetReal(const string& theID)
+{
+  if(!IsSet(theID, PT_REAL)) Standard_Failure::Raise("Invalid ID");
+  return _reals[theID];
+}
+
+//=======================================================================
+/*!
+ * Function : SetString
+ * Purpose  : Associates a string with the ID
+ */
+//=======================================================================
+void SALOMEDSImpl_AttributeParameter::SetString(const string& theID, const string& theValue)
+{
+  CheckLocked();
+
+  Backup();
+
+  _strings[theID] = theValue;
+
+  SetModifyFlag(); 
+}
+
+//=======================================================================
+/*!
+ * Function : GetString
+ * Purpose  : Returns a string associated with the given ID
+ */
+//=======================================================================
+string SALOMEDSImpl_AttributeParameter::GetString(const string& theID)
+{
+  if(!IsSet(theID, PT_STRING)) Standard_Failure::Raise("Invalid ID");
+  return _strings[theID];
+}
+
+//=======================================================================
+/*!
+ * Function : SetBool
+ * Purpose  : Associates a bool value with the ID
+ */
+//=======================================================================
+void SALOMEDSImpl_AttributeParameter::SetBool(const string& theID, const bool& theValue)
+{
+  CheckLocked();
+
+  Backup();
+
+  _bools[theID] = theValue;
+
+  SetModifyFlag(); 
+}
+
+//=======================================================================
+/*!
+ * Function : GetBool
+ * Purpose  : Returns a bool value associated with the ID
+ */
+//=======================================================================
+bool SALOMEDSImpl_AttributeParameter::GetBool(const string& theID)
+{
+  if(!IsSet(theID, PT_BOOLEAN)) Standard_Failure::Raise("Invalid ID");
+  return _bools[theID];
+}
+
+//=======================================================================
+/*!
+ * Function : SetRealArray
+ * Purpose  : Associates an array of double values with the given ID
+ */
+//=======================================================================
+void SALOMEDSImpl_AttributeParameter::SetRealArray(const string& theID, const vector<double>& theArray)
+{
+  CheckLocked();
+
+  Backup();
+
+  _realarrays[theID] = theArray;
+
+  SetModifyFlag(); 
+}
+
+//=======================================================================
+/*!
+ * Function : GetRealArray
+ * Purpose  : Returns double values associated with the ID
+ */
+//=======================================================================
+vector<double> SALOMEDSImpl_AttributeParameter::GetRealArray(const string& theID)
+{
+  if(!IsSet(theID, PT_REALARRAY)) Standard_Failure::Raise("Invalid ID");
+  return _realarrays[theID];
+}
+
+//=======================================================================
+/*!
+ * Function : SetIntArray
+ * Purpose  : Associates an array of int values with the given ID
+ */
+//=======================================================================
+void SALOMEDSImpl_AttributeParameter::SetIntArray(const string& theID, const vector<int>& theArray)
+{
+  CheckLocked();
+
+  Backup();
+
+  _intarrays[theID] = theArray;
+
+  SetModifyFlag(); 
+}
+
+//=======================================================================
+/*!
+ * Function : GetIntArray
+ * Purpose  : Returns int values associated with the ID
+ */
+//=======================================================================
+vector<int> SALOMEDSImpl_AttributeParameter::GetIntArray(const string& theID)
+{
+  if(!IsSet(theID, PT_INTARRAY)) Standard_Failure::Raise("Invalid ID");
+  return _intarrays[theID];
+}
+
+//=======================================================================
+/*!
+ * Function : SetStrArray
+ * Purpose  : Associates an array of string values with the given ID
+ */
+//=======================================================================
+void SALOMEDSImpl_AttributeParameter::SetStrArray(const string& theID, const vector<string>& theArray)
+{
+  CheckLocked();
+
+  Backup();
+
+  _strarrays[theID] = theArray;
+
+  SetModifyFlag(); 
+}
+
+//=======================================================================
+/*!
+ * Function : GetStrArray
+ * Purpose  : Returns string values associated with the ID
+ */
+//=======================================================================
+vector<string> SALOMEDSImpl_AttributeParameter::GetStrArray(const string& theID)
+{
+  if(!IsSet(theID, PT_STRARRAY)) Standard_Failure::Raise("Invalid ID");
+  return _strarrays[theID];
+}
+
+//=======================================================================
+/*!
+ * Function : IsSet
+ * Purpose  : Returns true if for the ID of given type was assigned \n
+ *            a value in the attribute
+ */
+//=======================================================================
+bool SALOMEDSImpl_AttributeParameter::IsSet(const string& theID, const Parameter_Types theType)
+{
+  switch(theType) {
+  case PT_INTEGER: {
+    if(_ints.find(theID) != _ints.end()) return true;
+    break;
+  }
+  case PT_REAL: {
+    if(_reals.find(theID) != _reals.end()) return true;
+    break;
+  }
+  case PT_BOOLEAN: {
+    if(_bools.find(theID) != _bools.end()) return true;
+    break;
+  }
+  case PT_STRING: {
+    if(_strings.find(theID) != _strings.end()) return true;
+    break;
+  }
+  case PT_REALARRAY: {
+    if(_realarrays.find(theID) != _realarrays.end()) return true;
+    break;
+  }
+  case PT_INTARRAY: {
+    if(_intarrays.find(theID) != _intarrays.end()) return true;
+    break;
+  }
+  case PT_STRARRAY: {
+    if(_strarrays.find(theID) != _strarrays.end()) return true;
+    break;
+  }
+  default: return false;
+  }
+
+  return false;
+}
+
+//=======================================================================
+/*!
+ * Function : RemoveID
+ * Purpose  : Removes a parameter with given ID
+ */
+//=======================================================================
+bool SALOMEDSImpl_AttributeParameter::RemoveID(const string& theID, const Parameter_Types theType)
+{
+  Backup();
+  SetModifyFlag(); 
+
+  switch(theType) {
+  case PT_INTEGER: {
+    if(_ints.erase(theID)) return true;
+    break;
+  }
+  case PT_REAL: {
+    if(_reals.erase(theID)) return true;
+    break;
+  }
+  case PT_BOOLEAN: {
+    if(_bools.erase(theID)) return true;
+    break;
+  }
+  case PT_STRING: {
+    if(_strings.erase(theID)) return true;
+    break;
+  }
+  case PT_REALARRAY: {
+    if(_realarrays.erase(theID)) return true;
+    break;
+  }
+  case PT_INTARRAY: {
+    if(_intarrays.erase(theID)) return true;
+    break;
+  }
+  case PT_STRARRAY: {
+    if(_strarrays.erase(theID)) return true;
+    break;
+  }
+  default: return false;
+  }
+
+
+  return false;
+}
+
+
+//=======================================================================
+/*!
+ * Function : GetFather
+ * Purpose  : Returns a father attribute for this attribute
+ */
+//=======================================================================
+Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_AttributeParameter::GetFather()
+{
+  Handle(SALOMEDSImpl_AttributeParameter) aFather;
+  TDF_Label L = Label();
+  if(L.IsRoot()) return aFather;
+
+  while(!L.IsRoot()) {
+    L = L.Father();
+    if(L.FindAttribute(SALOMEDSImpl_AttributeParameter::GetID(), aFather)) break; 
+  }
+
+  return aFather;
+}
+
+//=======================================================================
+/*!
+ * Function : HasFather
+ * Purpose  : Returns True if the attribute has a father attribute
+ */
+//=======================================================================
+bool SALOMEDSImpl_AttributeParameter::HasFather()
+{
+  TDF_Label L = Label();
+  if(L.IsRoot()) return false;
+  while(!L.IsRoot()) {
+    L = L.Father();
+    if(L.IsAttribute(SALOMEDSImpl_AttributeParameter::GetID())) return true; 
+  }
+
+  return false;
+}
+
+//=======================================================================
+/*!
+ * Function : IsRoot
+ * Purpose  : Returns True is the attribute is highest in an hierachy
+ */
+//=======================================================================
+bool SALOMEDSImpl_AttributeParameter::IsRoot()
+{
+  return ((HasFather())?false:true);
+}           
+
+//=======================================================================
+/*!
+ * Function : Clear
+ * Purpose  : Clears the content of the attribute
+ */
+//=======================================================================
+void SALOMEDSImpl_AttributeParameter::Clear()
+{
+  Backup();
+
+  _ints.clear();
+  _reals.clear();
+  _bools.clear();
+  _strings.clear();
+  _realarrays.clear();
+  _intarrays.clear();
+  _strarrays.clear();
+
+  SetModifyFlag(); 
+}
+
+//=======================================================================
+/*!
+ * Function : GetIDs
+ * Purpose  : Returns an array of all ID's of the given type
+ */
+//=======================================================================
+vector<string> SALOMEDSImpl_AttributeParameter::GetIDs(const Parameter_Types theType)
+{
+  
+  vector<string> anArray;
+  int i = 0;
+
+  switch(theType) {
+  case PT_INTEGER: {
+    if(_ints.size()) {
+      anArray.resize(_ints.size());
+      for(map<string,int>::const_iterator p = _ints.begin(); p != _ints.end(); p++, i++) 
+       anArray[i] =  p->first;
+    }
+    break;
+  }
+  case PT_REAL: {
+    if(_reals.size()) {
+      anArray.resize(_reals.size());
+      for(map<string,double>::const_iterator p = _reals.begin(); p != _reals.end(); p++, i++) 
+       anArray[i] = p->first;
+    }
+    break;
+  }
+  case PT_BOOLEAN: {
+    if(_bools.size()) {
+      anArray.resize(_bools.size());
+      for(map<string,bool>::const_iterator p = _bools.begin(); p != _bools.end(); p++, i++) 
+       anArray[i] = p->first;
+    }
+    break;
+  }
+  case PT_STRING: {
+    if(_strings.size()) {
+      anArray.resize(_strings.size());
+      for(map<string,string>::const_iterator p = _strings.begin(); p!= _strings.end(); p++) 
+       anArray[i] = p->first;
+    }
+    break;
+  }
+  case PT_REALARRAY: {
+    if(_realarrays.size()) {
+      anArray.resize(_realarrays.size());
+      for(map< string, vector<double> >::const_iterator p = _realarrays.begin(); p!= _realarrays.end(); p++) 
+       anArray[i] = p->first;
+    }
+    break;
+  }
+  case PT_INTARRAY: {
+    if(_intarrays.size()) {
+      anArray.resize(_intarrays.size());
+      for(map< string, vector<int> >::const_iterator p = _intarrays.begin(); p!= _intarrays.end(); p++) 
+       anArray[i] = p->first;
+    }
+    break;
+  }
+  case PT_STRARRAY: {
+    if(_strarrays.size()) {
+      anArray.resize(_strarrays.size());
+      for(map< string, vector<string> >::const_iterator p = _strarrays.begin(); p!= _strarrays.end(); p++) 
+       anArray[i] = p->first;
+    }
+    break;
+  }
+  default: return anArray;
+  }
+
+  return anArray;
+}
+
+//=======================================================================
+/*!
+ * Function : ID
+ * Purpose  : Rteurns an GUID of the attribute
+ */
+//=======================================================================
+const Standard_GUID& SALOMEDSImpl_AttributeParameter::ID () const { return GetID(); } 
+
+
+Handle(TDF_Attribute) SALOMEDSImpl_AttributeParameter::NewEmpty () const
+{  
+  return new SALOMEDSImpl_AttributeParameter(); 
+}
+
+//=======================================================================
+/*!
+ * Function : Restore
+ * Purpose  : Restors the content of the attribute from another
+ */
+//=======================================================================
+void SALOMEDSImpl_AttributeParameter::Restore(const Handle(TDF_Attribute)& with) 
+{
+  Handle(SALOMEDSImpl_AttributeParameter) A = Handle(SALOMEDSImpl_AttributeParameter)::DownCast (with);
+  _ints.clear();
+  _reals.clear();
+  _bools.clear();
+  _strings.clear();
+  _realarrays.clear();
+  _intarrays.clear();
+  _strarrays.clear();
+  
+  for(map<string,int>::const_iterator p = A->_ints.begin(); p!= A->_ints.end(); p++) _ints[p->first] = p->second;
+  for(map<string,double>::const_iterator p = A->_reals.begin(); p!= A->_reals.end(); p++) _reals[p->first] = p->second;
+  for(map<string,bool>::const_iterator p = A->_bools.begin(); p!= A->_bools.end(); p++) _bools[p->first] = p->second;
+  for(map<string,string>::const_iterator p = A->_strings.begin(); p!= A->_strings.end(); p++) 
+    _strings[p->first] = p->second;
+  for(map< string,vector<double> >::const_iterator p = A->_realarrays.begin(); p!= A->_realarrays.end(); p++) 
+    _realarrays[p->first] = p->second;  
+  for(map< string,vector<int> >::const_iterator p = A->_intarrays.begin(); p!= A->_intarrays.end(); p++) 
+    _intarrays[p->first] = p->second;  
+  for(map< string,vector<string> >::const_iterator p = A->_strarrays.begin(); p!= A->_strarrays.end(); p++) 
+    _strarrays[p->first] = p->second; 
+}
+
+//=======================================================================
+/*!
+ * Function : Paste
+ * Purpose  : Pastes the content of attribute to another
+ */
+//=======================================================================
+void SALOMEDSImpl_AttributeParameter::Paste (const Handle(TDF_Attribute)& into,
+                                            const Handle(TDF_RelocationTable)& RT) const
+{
+  into->Restore(this);
+}
+
+//=======================================================================
+/*!
+ * Function : Save
+ * Purpose  : Saves a content of the attribute as a string
+ */
+//=======================================================================
+TCollection_AsciiString SALOMEDSImpl_AttributeParameter::Save() 
+{ 
+  ostrstream buffer;
+  char *tmpBuffer = new char[255];
+
+  buffer << _ints.size() << " ";
+
+  for(map<string,int>::const_iterator p = _ints.begin(); p != _ints.end(); p++) {
+    buffer << convertString(p->first) << " " << p->second << " ";
+  }
+
+  buffer << _reals.size() << " ";
+  for(map<string,double>::const_iterator p =_reals.begin(); p != _reals.end(); p++) {
+    sprintf(tmpBuffer, "%.64e", p->second);
+    buffer << convertString(p->first) << " " << tmpBuffer << " ";
+  }
+
+  buffer << _bools.size() << " ";
+  for(map<string,bool>::const_iterator p = _bools.begin(); p != _bools.end(); p++) {
+     buffer << convertString(p->first) << " " << p->second << " ";
+  }
+
+  buffer << _strings.size() << " ";
+  for(map<string,string>::const_iterator p = _strings.begin(); p != _strings.end(); p++) {
+    buffer << convertString(p->first) << " " <<  convertString(p->second) << " ";
+  }
+
+  buffer << _realarrays.size() << " ";
+  for(map< string,vector<double> >::const_iterator p = _realarrays.begin(); p != _realarrays.end(); p++) {
+    vector<double> v(p->second);
+    sprintf(tmpBuffer, " %s %d ", convertString(p->first).c_str(), v.size());
+    buffer << tmpBuffer;
+    for(int i = 0; i<v.size(); i++) {
+      sprintf(tmpBuffer, " %.64e ", v[i]);
+      buffer << tmpBuffer;
+    }
+  }
+
+  buffer << _intarrays.size() << " ";
+  for(map< string,vector<int> >::const_iterator p = _intarrays.begin(); p != _intarrays.end(); p++) {
+    vector<int> v(p->second);
+    sprintf(tmpBuffer, " %s %d ", convertString(p->first).c_str(), v.size());
+    buffer << tmpBuffer;
+    for(int i = 0; i<v.size(); i++) {
+      sprintf(tmpBuffer, " %d ", v[i]);
+      buffer << tmpBuffer;
+    }
+  }
+
+  buffer << _strarrays.size() << " ";
+  for(map< string,vector<string> >::const_iterator p = _strarrays.begin(); p != _strarrays.end(); p++) {
+    vector<string> v(p->second);
+    sprintf(tmpBuffer, " %s %d ", convertString(p->first).c_str(), v.size());
+    buffer << tmpBuffer;
+    for(int i = 0; i<v.size(); i++) {
+      buffer << " " << convertString(v[i]) << " ";
+    }
+  }
+
+  delete tmpBuffer;
+
+  TCollection_AsciiString AS((char*)buffer.rdbuf()->str());
+
+  return AS; 
+}
+
+//=======================================================================
+/*!
+ * Function : Load
+ * Purpose  : Restores the attribute from the string
+ */
+//=======================================================================
+void SALOMEDSImpl_AttributeParameter::Load(const TCollection_AsciiString& theValue) 
+{ 
+  Backup();
+
+  _ints.clear();
+  _reals.clear();
+  _bools.clear();
+  _strings.clear();
+  _realarrays.clear();
+  _intarrays.clear();
+
+  istrstream buffer(theValue.ToCString(), strlen(theValue.ToCString()));
+
+  int size, val, ival;
+  double val2;
+  string s, id;
+
+  buffer >> size;
+  for(int i = 1; i<=size; i++) {
+    buffer >> id >> val;
+    _ints[restoreString(id)] = val;
+  }
+
+  buffer >> size;
+  for(int i = 1; i<=size; i++) {
+    buffer >> id >> val2;
+    _reals[restoreString(id)] = val2;
+  }
+
+  buffer >> size;
+  for(int i = 1; i<=size; i++) {
+    buffer >> id >> val;
+    _bools[restoreString(id)] = val;
+  }
+
+  buffer >> size;
+  for(int i = 1; i<=size; i++) {
+    buffer >> id >> s;
+    _strings[restoreString(id)] = restoreString(s);
+  }
+  
+  buffer >> size;
+  for(int i = 1; i<=size; i++) {
+    buffer >> id >> val;
+    vector<double> v;
+    v.resize(val);
+    for(int j = 0; j<val; j++) {
+      buffer >> val2;
+      v[j] = val2;
+    }
+    _realarrays[restoreString(id)] = v;
+  }
+
+  buffer >> size;
+  for(int i = 1; i<=size; i++) {
+    buffer >> id >> val;
+    vector<int> v;
+    v.resize(val);
+    for(int j = 0; j<val; j++) {
+      buffer >> ival;
+      v[j] = ival;
+    }
+    _intarrays[restoreString(id)] = v;
+  }
+  
+  buffer >> size;
+  for(int i = 1; i<=size; i++) {
+    buffer >> id >> val;
+    vector<string> v;
+    v.resize(val);
+    for(int j = 0; j<val; j++) {
+      buffer >> s;
+      v[j] = restoreString(s);
+    }
+    _strarrays[restoreString(id)] = v;
+  }
+} 
diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.hxx
new file mode 100644 (file)
index 0000000..ab273ae
--- /dev/null
@@ -0,0 +1,119 @@
+// Copyright (C) 2005  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/
+//
+//  File   : SALOMEDSImpl_AttributeIOR.hxx
+//  Author : Sergey RUIN
+//  Module : SALOME
+
+#ifndef _SALOMEDSImpl_AttributeParameter_HeaderFile
+#define _SALOMEDSImpl_AttributeParameter_HeaderFile
+
+#include <Standard_DefineHandle.hxx>
+#include <TDF_Attribute.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+#include <TDF_Label.hxx> 
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+
+#include <vector>
+#include <string>
+#include <map>
+
+class Standard_GUID;
+class Handle(TDF_Attribute);
+class Handle(TDF_RelocationTable);
+
+
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeParameter, SALOMEDSImpl_GenericAttribute )
+
+enum Parameter_Types {PT_INTEGER, PT_REAL, PT_BOOLEAN, PT_STRING, PT_REALARRAY, PT_INTARRAY, PT_STRARRAY};
+
+/*!
+ Class: SALOMEDSImpl_AttributeParameter
+ Description : AttributeParameter is a universal container of basic types 
+*/
+
+class SALOMEDSImpl_AttributeParameter : public SALOMEDSImpl_GenericAttribute 
+{
+
+private:
+  
+  std::map<std::string, int>                     _ints;
+  std::map<std::string, double>                  _reals;
+  std::map<std::string, std::string>             _strings;
+  std::map<std::string, bool>                    _bools;
+  std::map< std::string, vector<double> >        _realarrays;
+  std::map< std::string, vector<int> >           _intarrays;
+  std::map< std::string, vector<std::string> >   _strarrays;
+
+public:
+  Standard_EXPORT static const Standard_GUID& GetID() ;
+
+  Standard_EXPORT  SALOMEDSImpl_AttributeParameter():SALOMEDSImpl_GenericAttribute("AttributeParameter") {}
+  Standard_EXPORT  static Handle(SALOMEDSImpl_AttributeParameter) Set (const TDF_Label& L);
+
+
+  Standard_EXPORT void SetInt(const std::string& theID, const int& theValue);
+  Standard_EXPORT int GetInt(const std::string& theID);
+
+  Standard_EXPORT void SetReal(const std::string& theID, const double& theValue);
+  Standard_EXPORT double GetReal(const std::string& theID);
+
+  Standard_EXPORT void SetString(const std::string& theID, const std::string& theValue);
+  Standard_EXPORT std::string GetString(const std::string& theID);
+  
+  Standard_EXPORT void SetBool(const std::string& theID, const bool& theValue);
+  Standard_EXPORT bool GetBool(const std::string& theID);
+  
+  Standard_EXPORT void SetRealArray(const std::string& theID, const std::vector<double>& theArray);
+  Standard_EXPORT std::vector<double> GetRealArray(const std::string& theID);
+  
+  Standard_EXPORT void SetIntArray(const std::string& theID, const std::vector<int>& theArray);
+  Standard_EXPORT std::vector<int> GetIntArray(const std::string& theID);
+
+  Standard_EXPORT void SetStrArray(const std::string& theID, const std::vector<std::string>& theArray);
+  Standard_EXPORT std::vector<std::string> GetStrArray(const std::string& theID);
+
+  Standard_EXPORT bool IsSet(const std::string& theID, const Parameter_Types theType);
+  
+  Standard_EXPORT bool RemoveID(const std::string& theID, const Parameter_Types theType);
+
+  Standard_EXPORT Handle(SALOMEDSImpl_AttributeParameter) GetFather();
+  Standard_EXPORT bool HasFather();
+  Standard_EXPORT bool IsRoot();
+
+  Standard_EXPORT std::vector<std::string> GetIDs(const Parameter_Types theType);
+
+  Standard_EXPORT void Clear();
+
+  Standard_EXPORT  virtual TCollection_AsciiString Save();
+  Standard_EXPORT  virtual void Load(const TCollection_AsciiString& theValue); 
+
+  Standard_EXPORT  const Standard_GUID& ID() const;
+  Standard_EXPORT  void Restore(const Handle(TDF_Attribute)& with) ;
+  Standard_EXPORT  Handle_TDF_Attribute NewEmpty() const;
+  Standard_EXPORT  void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+  
+  Standard_EXPORT ~SALOMEDSImpl_AttributeParameter() {}
+
+public:
+  DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeParameter )
+};
+
+#endif
index e593350f0c3484684d11c2b54ce9f531b66da013..4be4e027e9fb23dd63c649a882ab1637730903a7 100644 (file)
@@ -63,6 +63,7 @@ public :
 #include "SALOMEDSImpl_AttributeFileType.hxx"
 #include "SALOMEDSImpl_AttributeFlags.hxx"
 #include "SALOMEDSImpl_AttributeGraphic.hxx"
+#include "SALOMEDSImpl_AttributeParameter.hxx"
 
 
 #define __AttributeTypeToGUIDForSObject \
@@ -93,7 +94,8 @@ public :
        if(theType == "AttributeFileType") return SALOMEDSImpl_AttributeFileType::GetID(); \
        if(theType == "AttributeFlags") return SALOMEDSImpl_AttributeFlags::GetID(); \
         if(theType == "AttributeGraphic") return SALOMEDSImpl_AttributeGraphic::GetID(); \
-       if(theType == "AttributeReference") return SALOMEDSImpl_AttributeReference::GetID();
+       if(theType == "AttributeReference") return SALOMEDSImpl_AttributeReference::GetID(); \
+       if(theType == "AttributeParameter") return SALOMEDSImpl_AttributeParameter::GetID();
 
 
 #define __FindOrCreateAttributeLocked(ClassName) if (strcmp(aTypeOfAttribute.ToCString(), #ClassName) == 0) { \
@@ -129,6 +131,7 @@ __FindOrCreateAttributeLocked(AttributeTableOfInteger) \
 __FindOrCreateAttributeLocked(AttributeTableOfReal) \
 __FindOrCreateAttributeLocked(AttributeTableOfString) \
 __FindOrCreateAttributeLocked(AttributePythonObject) \
+__FindOrCreateAttributeLocked(AttributeParameter) \
 __FindOrCreateAttribute(AttributePersistentRef) \
 __FindOrCreateAttribute(AttributeDrawable) \
 __FindOrCreateAttribute(AttributeSelectable) \
index e3d53663a3eee5ca0d45a9218f2149767a63112b..4a59e0b7bf607af9527612ce044e435dc87067a9 100644 (file)
@@ -23,6 +23,7 @@
 #include <TCollection_AsciiString.hxx>
 #include <SALOMEDSImpl_SComponent.hxx>
 #include <SALOMEDSImpl_SObject.hxx>
+#include <SALOMEDSImpl_TMPFile.hxx>
 
 
 class SALOMEDSImpl_Driver
@@ -31,15 +32,15 @@ public:
 
   virtual TCollection_AsciiString GetIOR() = 0;
 
-  virtual unsigned char* Save(const Handle(SALOMEDSImpl_SComponent)& theComponent,
-                             const TCollection_AsciiString& theURL,
-                             long& theStreamLength,
-                             bool isMultiFile) = 0;
+  virtual Handle(SALOMEDSImpl_TMPFile) Save(const Handle(SALOMEDSImpl_SComponent)& theComponent,
+                                           const TCollection_AsciiString& theURL,
+                                           long& theStreamLength,
+                                           bool isMultiFile) = 0;
 
-  virtual unsigned char* SaveASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent,
-                                  const TCollection_AsciiString& theURL,
-                                  long& theStreamLength,
-                                  bool isMultiFile) = 0;
+  virtual Handle(SALOMEDSImpl_TMPFile) SaveASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent,
+                                                const TCollection_AsciiString& theURL,
+                                                long& theStreamLength,
+                                                bool isMultiFile) = 0;
   
   virtual bool Load(const Handle(SALOMEDSImpl_SComponent)& theComponent,
                    const unsigned char* theStream,
@@ -70,10 +71,10 @@ public:
 
   virtual bool CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject) = 0;
 
-  virtual unsigned char* CopyFrom(const Handle(SALOMEDSImpl_SObject)& theObject, 
-                                 int& theObjectID,
-                                 long& theStreamLength) = 0;
-
+  virtual Handle(SALOMEDSImpl_TMPFile) CopyFrom(const Handle(SALOMEDSImpl_SObject)& theObject, 
+                                               int& theObjectID,
+                                               long& theStreamLength) = 0;
+  
   virtual bool CanPaste(const TCollection_AsciiString& theComponentName, int theObjectID) = 0;
 
   virtual TCollection_AsciiString PasteInto(const unsigned char* theStream,
@@ -81,10 +82,10 @@ public:
                                            int theObjectID,
                                            const Handle(SALOMEDSImpl_SObject)& theObject) = 0;
 
-  virtual unsigned char* DumpPython(const Handle(SALOMEDSImpl_Study)& theStudy, 
-                                    bool isPublished, 
-                                   bool& isValidScript,
-                                   long& theStreamLength) = 0;
+  virtual Handle(SALOMEDSImpl_TMPFile) DumpPython(const Handle(SALOMEDSImpl_Study)& theStudy, 
+                                                 bool isPublished, 
+                                                 bool& isValidScript,
+                                                 long& theStreamLength) = 0;
 };
 
 class SALOMEDSImpl_DriverFactory
diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_IParameters.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_IParameters.cxx
new file mode 100644 (file)
index 0000000..02115ab
--- /dev/null
@@ -0,0 +1,361 @@
+// Copyright (C) 2005  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/
+//
+#include "SALOMEDSImpl_IParameters.hxx"
+#include <utilities.h>
+
+#include <TCollection_AsciiString.hxx>
+
+#include "SALOMEDSImpl_SObject.hxx"
+#include "SALOMEDSImpl_ChildIterator.hxx"
+
+using namespace std;
+
+#define _AP_LISTS_LIST_ "AP_LISTS_LIST"
+#define _AP_ENTRIES_LIST_ "AP_ENTRIES_LIST"
+#define _AP_PROPERTIES_LIST_ "AP_PROPERTIES_LIST"
+#define _AP_DUMP_PYTHON_ "AP_DUMP_PYTHON"
+
+/*!
+  Constructor
+*/
+SALOMEDSImpl_IParameters::SALOMEDSImpl_IParameters(const Handle(SALOMEDSImpl_AttributeParameter)& ap)
+{
+  if(ap.IsNull()) return;
+  _ap = ap;
+  Handle(SALOMEDSImpl_SObject) so = _ap->GetSObject();
+  _study = so->GetStudy();
+}
+
+SALOMEDSImpl_IParameters::~SALOMEDSImpl_IParameters()
+{
+  _compNames.clear();
+}
+
+int SALOMEDSImpl_IParameters::append(const string& listName, const string& value)
+{
+  if(_ap.IsNull()) return -1;
+  vector<string> v;
+  if(!_ap->IsSet(listName, PT_STRARRAY)) {
+    if(!_ap->IsSet(_AP_LISTS_LIST_, PT_STRARRAY)) _ap->SetStrArray(_AP_LISTS_LIST_, v);
+    if(listName != _AP_ENTRIES_LIST_ && 
+       listName != _AP_PROPERTIES_LIST_) {
+      append(_AP_LISTS_LIST_, listName);
+    }
+    _ap->SetStrArray(listName, v);
+  }
+  v = _ap->GetStrArray(listName);
+  v.push_back(value);
+  _ap->SetStrArray(listName, v);
+  return (v.size()-1);
+}
+
+int SALOMEDSImpl_IParameters::nbValues(const string& listName)
+{
+  if(_ap.IsNull()) return -1;
+  if(!_ap->IsSet(listName, PT_STRARRAY)) return 0;
+  vector<string> v = _ap->GetStrArray(listName);
+  return v.size();
+}
+
+vector<string> SALOMEDSImpl_IParameters::getValues(const string& listName)
+{
+  vector<string> v;
+  if(_ap.IsNull()) return v;
+  if(!_ap->IsSet(listName, PT_STRARRAY)) return v;
+  return _ap->GetStrArray(listName);
+}
+
+
+string SALOMEDSImpl_IParameters::getValue(const string& listName, int index)
+{
+  if(_ap.IsNull()) return "";
+  if(!_ap->IsSet(listName, PT_STRARRAY)) return "";
+  vector<string> v = _ap->GetStrArray(listName);
+  if(index >= v.size()) return ""; 
+  return v[index];
+}
+
+vector<string> SALOMEDSImpl_IParameters::getLists()
+{
+  vector<string> v;
+  if(!_ap->IsSet(_AP_LISTS_LIST_, PT_STRARRAY)) return v;
+  return _ap->GetStrArray(_AP_LISTS_LIST_);
+}
+
+void SALOMEDSImpl_IParameters::setParameter(const string& entry, const string& parameterName, const string& value)
+{
+  if(_ap.IsNull()) return;
+  vector<string> v;
+  if(!_ap->IsSet(entry, PT_STRARRAY)) {
+    append(_AP_ENTRIES_LIST_, entry); //Add the entry to the internal list of entries
+    _ap->SetStrArray(entry, v);
+  }
+  v = _ap->GetStrArray(entry);
+  v.push_back(parameterName);
+  v.push_back(value);
+  _ap->SetStrArray(entry, v);
+}
+
+
+string SALOMEDSImpl_IParameters::getParameter(const string& entry, const string& parameterName)
+{
+  if(_ap.IsNull()) return "";
+  if(!_ap->IsSet(entry, PT_STRARRAY)) return "";
+  vector<string> v = _ap->GetStrArray(entry);
+  int length = v.size();
+  for(int i = 0; i<length; i+=1) {
+    if(v[i] == parameterName) return v[i+1];
+  }
+  return "";
+}
+
+
+vector<string> SALOMEDSImpl_IParameters::getAllParameterNames(const string& entry)
+{
+  vector<string> v, names;
+  if(_ap.IsNull()) return v; 
+  if(!_ap->IsSet(entry, PT_STRARRAY)) return v;
+  v = _ap->GetStrArray(entry);
+  int length = v.size();
+  for(int i = 0; i<length; i+=2) {
+    names.push_back(v[i]);
+  }
+  return names;
+}
+
+vector<string> SALOMEDSImpl_IParameters::getAllParameterValues(const string& entry)
+{
+  vector<string> v, values;
+  if(_ap.IsNull()) return v; 
+  if(!_ap->IsSet(entry, PT_STRARRAY)) return v;
+  v = _ap->GetStrArray(entry);
+  int length = v.size();
+  for(int i = 1; i<length; i+=2) {
+    values.push_back(v[i]);
+  }
+  return values; 
+}
+
+int SALOMEDSImpl_IParameters::getNbParameters(const string& entry)
+{
+  if(_ap.IsNull()) return -1;
+  if(!_ap->IsSet(entry, PT_STRARRAY)) return -1;
+  return  _ap->GetStrArray(entry).size()/2;
+}
+
+vector<string> SALOMEDSImpl_IParameters::getEntries()
+{
+  vector<string> v;
+  if(_ap.IsNull()) return v;
+  if(!_ap->IsSet(_AP_ENTRIES_LIST_, PT_STRARRAY)) return v;
+  return _ap->GetStrArray(_AP_ENTRIES_LIST_);
+}
+
+void SALOMEDSImpl_IParameters::setProperty(const string& name, const std::string& value)
+{
+  if(_ap.IsNull()) return;
+  if(!_ap->IsSet(name, PT_STRING)) {
+    append(_AP_PROPERTIES_LIST_, name); //Add the property to the internal list of properties
+  }
+  _ap->SetString(name, value);
+}
+
+string SALOMEDSImpl_IParameters::getProperty(const string& name)
+{
+  if(_ap.IsNull()) return "";
+  if(!_ap->IsSet(name, PT_STRING)) return "";
+  return _ap->GetString(name);
+}
+
+vector<string> SALOMEDSImpl_IParameters::getProperties()
+{
+  vector<string> v;
+  if(_ap.IsNull()) return v;
+  if(!_ap->IsSet(_AP_PROPERTIES_LIST_, PT_STRARRAY)) return v;
+  return _ap->GetStrArray(_AP_PROPERTIES_LIST_);
+}
+
+string SALOMEDSImpl_IParameters::decodeEntry(const string& entry)
+{
+  if(!_study) return entry;
+  int pos = entry.rfind("_");
+  if(pos < 0 || pos >= entry.length()) return entry;
+
+  string compName(entry, 0, pos), compID, tail(entry, pos+1, entry.length()-1);
+  
+  if(_compNames.find(compName) == _compNames.end()) {
+    Handle(SALOMEDSImpl_SObject) so = _study->FindComponent((char*)compName.c_str());
+    if(!so) return entry;
+    compID = so->GetID().ToCString();
+    _compNames[compName] = compID;
+  }
+  else compID = _compNames[compName];
+  string newEntry(compID);
+  newEntry += (":"+tail);
+  
+  return newEntry;
+}
+
+
+bool SALOMEDSImpl_IParameters::isDumpPython(const Handle(SALOMEDSImpl_Study)& study, const string& theID)
+{
+  string anID;
+  if(theID == "") anID = getDefaultVisualComponent();
+  else anID = theID;
+
+  Handle(SALOMEDSImpl_AttributeParameter) ap = study->GetCommonParameters((char*)anID.c_str(), 0);
+  if(ap.IsNull()) return false;
+  if(!ap->IsSet(_AP_DUMP_PYTHON_, PT_BOOLEAN)) return false;
+  return (bool)ap->GetBool(_AP_DUMP_PYTHON_);
+}
+
+
+int SALOMEDSImpl_IParameters::getLastSavePoint(const Handle(SALOMEDSImpl_Study)& study, const string& theID)
+{
+  string anID;
+  if(theID == "") anID = getDefaultVisualComponent();
+  else anID = theID;
+
+
+  Handle(SALOMEDSImpl_SObject) so = study->FindComponent((char*)anID.c_str());
+  if(so.IsNull()) return -1;
+
+  Handle(SALOMEDSImpl_StudyBuilder) builder = study->NewBuilder();
+  Handle(SALOMEDSImpl_ChildIterator) anIter ( study->NewChildIterator( so ) );
+  int tag = -1;
+  for(; anIter->More(); anIter->Next())
+  {
+    Handle(SALOMEDSImpl_SObject) val( anIter->Value() );
+    Handle(SALOMEDSImpl_GenericAttribute) genAttr;
+    if(builder->FindAttribute(val, genAttr, "AttributeParameter")) tag = val->Tag();
+  }
+
+  return tag;
+}
+
+
+
+string SALOMEDSImpl_IParameters::getStudyScript(const Handle(SALOMEDSImpl_Study)& study, int savePoint, const std::string& theID)
+{
+  string anID;
+  if(theID == "") anID = getDefaultVisualComponent();
+  else anID = theID;
+
+  Handle(SALOMEDSImpl_AttributeParameter) ap = study->GetCommonParameters((char*)anID.c_str(), savePoint);
+  SALOMEDSImpl_IParameters ip(ap);
+
+  string dump("");
+
+  dump += "import iparameters\n";
+  dump += "ipar = iparameters.IParameters(salome.myStudy.GetCommonParameters(\""+anID+"\", 1))\n\n";
+  
+  
+  vector<string> v = ip.getProperties();
+  if(v.size() > 0) {
+    dump += "#Set up visual properties:\n";
+    for(int i = 0; i<v.size(); i++) {
+      string prp = ip.getProperty(v[i]);
+      dump += "ipar.setProperty(\""+v[i]+"\", \""+prp+"\")\n";
+    }
+  }
+
+  v = ip.getLists();
+  if(v.size() > 0) {
+    dump += "#Set up lists:\n";
+    for(int i = 0; i<v.size(); i++) {
+      vector<string> lst = ip.getValues(v[i]);
+      dump += "# fill list "+v[i]+"\n";
+      for(int j = 0; j < lst.size(); j++)
+       dump += "ipar.append(\""+v[i]+"\", \""+lst[j]+"\")\n";
+    }
+  }
+
+  return dump;
+}
+
+string SALOMEDSImpl_IParameters::getDefaultScript(const Handle(SALOMEDSImpl_Study)& study, 
+                                             const string& moduleName, 
+                                             const string& shift, 
+                                             const string& theID)
+{
+  string anID;
+  if(theID == "") anID = getDefaultVisualComponent();
+  else anID = theID;
+
+  string dump("");
+
+  int savePoint = SALOMEDSImpl_IParameters::getLastSavePoint(study, anID);
+  if(savePoint < 0) return dump;
+  SALOMEDSImpl_IParameters ip = SALOMEDSImpl_IParameters(study->GetCommonParameters(anID.c_str(), savePoint));
+  if(!isDumpPython(study)) return dump;
+
+  Handle(SALOMEDSImpl_AttributeParameter) ap = study->GetModuleParameters(anID.c_str(), moduleName.c_str(), savePoint);
+  ip = SALOMEDSImpl_IParameters(ap);
+
+
+  dump += shift +"import iparameters\n";
+  dump += shift + "ipar = iparameters.IParameters(theStudy.GetModuleParameters(\""+anID+"\", \""+moduleName+"\", 1))\n\n";
+  
+  vector<string> v = ip.getProperties();
+  if(v.size() > 0) {
+    dump += shift +"#Set up visual properties:\n";
+    for(int i = 0; i<v.size(); i++) {
+      string prp = ip.getProperty(v[i]);
+      dump += shift +"ipar.setProperty(\""+v[i]+"\", \""+prp+"\")\n";
+    }
+  }
+
+  v = ip.getLists();
+  if(v.size() > 0) {
+    dump +=  shift +"#Set up lists:\n";
+    for(int i = 0; i<v.size(); i++) {
+      vector<string> lst = ip.getValues(v[i]);
+      dump += shift +"# fill list "+v[i]+"\n";
+      for(int j = 0; j < lst.size(); j++)
+       dump += shift +"ipar.append(\""+v[i]+"\", \""+lst[j]+"\")\n";
+    }
+  }
+
+  v = ip.getEntries();
+  if(v.size() > 0) {
+    dump += shift + "#Set up entries:\n";
+    for(int i = 0; i<v.size(); i++) {
+      vector<string> names = ip.getAllParameterNames(v[i]);
+      vector<string> values = ip.getAllParameterValues(v[i]);
+      string decodedEntry = ip.decodeEntry(v[i]);
+      Handle(SALOMEDSImpl_SObject) so = study->FindObjectID((char*)decodedEntry.c_str());
+      string so_name("");
+      if(!so.IsNull()) so_name = so->GetName().ToCString();
+      dump += shift + "# set up entry " + v[i] +" ("+so_name+")" + " parameters" + "\n";
+      for(int j = 0; j < names.size() && j < values.size(); j++)
+       dump += shift + "ipar.setParameter(\"" + v[i] + "\", \"" + names[j] + "\", \"" + values[j] + "\")\n";
+    }
+  }
+  
+  return dump;  
+}
+
+
+string SALOMEDSImpl_IParameters::getDefaultVisualComponent()
+{
+  return "Interface Applicative";
+}
+
+
diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_IParameters.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_IParameters.hxx
new file mode 100644 (file)
index 0000000..4e6d505
--- /dev/null
@@ -0,0 +1,153 @@
+// Copyright (C) 2005  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 SALOMEDSImpl_IParameters_H
+#define SALOMEDSImpl_IParameters_H
+
+#include <string>
+#include <vector>
+#include <map>
+
+#include "SALOMEDSImpl_AttributeParameter.hxx"
+#include "SALOMEDSImpl_Study.hxx"
+
+/*! 
+  Class which an interface to store the parameters of the objects
+*/
+class SALOMEDSImpl_IParameters
+{
+public:
+  SALOMEDSImpl_IParameters(const Handle(SALOMEDSImpl_AttributeParameter)& ap); 
+
+  virtual ~SALOMEDSImpl_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); 
+
+  /*!
+    Returns a number elements in the list
+   */
+  virtual int nbValues(const std::string& listName);
+
+  /*!
+    Returns a list of values in the list
+   */
+  virtual std::vector<std::string> getValues(const std::string& listName);
+
+  /*!
+    Returns a value with given %index, where %index is in range [0:nbValues-1]
+   */
+  virtual std::string getValue(const std::string& listName, int index);
+
+  /*!
+    Returns a list all entries lists
+   */
+  virtual std::vector<std::string> getLists();
+
+  /*!
+    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);
+
+  /*!
+    Gets a named parameter value for the given entry
+   */
+  virtual std::string getParameter(const std::string& entry, const std::string& parameterName);
+
+  /*!
+    Returns all parameter names of the given entry
+   */
+  virtual std::vector<std::string> SALOMEDSImpl_IParameters::getAllParameterNames(const std::string& entry);
+
+  /*!
+    Returns all parameter  values of the given entry
+   */
+  virtual std::vector<std::string> SALOMEDSImpl_IParameters::getAllParameterValues(const std::string& entry);
+
+  /*!
+    Returns a number of parameters of the given entry
+   */
+  virtual int getNbParameters(const std::string& entry);
+
+  /*!
+    Returns a list all entries 
+   */
+  virtual std::vector<std::string> getEntries();
+
+  /*!
+    Sets a global named property value
+   */
+  virtual void setProperty(const std::string& name, const std::string& value);
+
+  /*!
+    Gets a value of global named property
+   */
+  virtual std::string getProperty(const std::string& name);
+
+  /*!
+    Returns a list all properties 
+   */
+  virtual std::vector<std::string> getProperties();
+
+  /*!
+    Returns decoded entry that is an absolute entry
+   */
+  virtual std::string decodeEntry(const std::string& entry);
+
+
+  /*!
+    Returns whether there is the dumping visual parameters
+   */
+  static bool isDumpPython(const Handle(SALOMEDSImpl_Study)& study, const string& theID = "");  
+
+  /*!
+    Returns an ID of the last save point
+  */
+  static int getLastSavePoint(const Handle(SALOMEDSImpl_Study)& study, const std::string& theID = "");
+
+  /*!
+    Returns a Python script for the study, which sets up visual parameters
+  */
+  static std::string getStudyScript(const Handle(SALOMEDSImpl_Study)& study, int savePoint, const std::string& theID = "");
+
+  /*!
+    Returns a default Python script that set ups visual parameters for the given module
+    shift is a string that contain spaces to make valid Python script indentaion
+  */
+  static std::string getDefaultScript(const Handle(SALOMEDSImpl_Study)& study, 
+                                     const std::string& moduleName, 
+                                     const std::string& shift,
+                                     const std::string& theID = "");
+
+  /*!
+    Returns a default name of the component where the visula parameters are stored.
+  */
+  static std::string getDefaultVisualComponent();
+
+private:
+  Handle(SALOMEDSImpl_AttributeParameter) _ap;
+  Handle(SALOMEDSImpl_Study) _study;
+  std::map<std::string, std::string> _compNames;
+};
+
+
+#endif
index b3452db044d2ac1b670a243bff2e516fe9532312..ff3b3112e8e7f10af8db78348b4c6710d959b2ca 100644 (file)
@@ -46,6 +46,7 @@ using namespace std;
 #include "SALOMEDSImpl_AttributeReference.hxx"
 #include "SALOMEDSImpl_StudyHandle.hxx"
 #include "SALOMEDSImpl_Tool.hxx"
+#include "SALOMEDSImpl_IParameters.hxx"
 
 IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_Study, MMgt_TShared )
 IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_Study, MMgt_TShared )
@@ -1303,6 +1304,19 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath,
   fp << "import " << aBatchModeScript << "\n" << endl;
   fp << "sys.path.insert( 0, \'" << thePath << "\')\n" << endl;
 
+
+  //Check if it's necessary to dump visual parameters
+  bool isDumpVisuals = SALOMEDSImpl_IParameters::isDumpPython(this);
+  int lastSavePoint = -1;
+  if(isDumpVisuals) {
+    lastSavePoint = SALOMEDSImpl_IParameters::getLastSavePoint(this);
+    if(lastSavePoint > 0) {
+      fp << SALOMEDSImpl_IParameters::getStudyScript(this, lastSavePoint);
+      fp << "\n" << endl;
+    }
+  }
+  
+
   Handle(TColStd_HSequenceOfAsciiString) aSeqOfFileNames = new TColStd_HSequenceOfAsciiString;
 
   //Iterate all components and create the componponents specific scripts.
@@ -1345,7 +1359,7 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath,
 
     bool isValidScript;
     long aStreamLength  = 0;
-    unsigned char* aStream = aDriver->DumpPython(this, isPublished, isValidScript, aStreamLength);
+    Handle(SALOMEDSImpl_TMPFile) aStream = aDriver->DumpPython(this, isPublished, isValidScript, aStreamLength);
     if ( !isValidScript )
       isOk = false;
 
@@ -1379,16 +1393,18 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath,
     }
 
     //Output the Python script generated by the component in the newly created file.
-    fp2 << aStream;
+    fp2 << aStream->Data();
     fp2.close();
 
-    if (aStream != NULL) delete [] aStream;
-
     //Add to the main script a call to RebuildData of the generated by the component the Python script
     fp << "import " << aScriptName << endl;
     fp << aScriptName << ".RebuildData(" << aBatchModeScript << ".myStudy)" << endl;
   }
 
+  if(isDumpVisuals) { //Output the call to Session's method restoreVisualState
+    fp << "iparameters.getSession().restoreVisualState(1)" << endl;
+  }
+
   fp << "salome.sg.updateObjBrowser(1)" << endl;
 
   fp.close();
@@ -1500,3 +1516,55 @@ void SALOMEDSImpl_Study::Modify()
   _errorCode = "";
   _doc->Modify();
 }
+
+//============================================================================
+/*! Function : 
+ *  Purpose  :
+ */
+//============================================================================
+Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_Study::GetCommonParameters(const char* theID, int theSavePoint)
+{
+  if(theSavePoint < 0) return NULL;
+  Handle(SALOMEDSImpl_StudyBuilder) builder = NewBuilder();
+  Handle(SALOMEDSImpl_SObject) so = FindComponent((char*)theID);
+  if(so.IsNull()) so = builder->NewComponent((char*)theID); 
+  Handle(SALOMEDSImpl_SObject) newSO;
+  if(theSavePoint == 0) //Get an attribute that is placed on the component itself.
+    newSO = so;
+  else
+    newSO = builder->NewObjectToTag(so, theSavePoint);
+  return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(builder->FindOrCreateAttribute(newSO, "AttributeParameter"));
+}
+
+//============================================================================
+/*! Function : 
+ *  Purpose  :
+ */
+//============================================================================
+Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_Study::GetModuleParameters(const char* theID, 
+                                                                               const char* theModuleName,
+                                                                               int theSavePoint)
+{
+  if(theSavePoint <= 0) return NULL;
+  Handle(SALOMEDSImpl_AttributeParameter) main_ap = GetCommonParameters(theID, theSavePoint);
+  Handle(SALOMEDSImpl_SObject) main_so = main_ap->GetSObject();
+  Handle(SALOMEDSImpl_AttributeParameter) par;
+
+  Handle(SALOMEDSImpl_ChildIterator) it = NewChildIterator(main_so);
+  string moduleName(theModuleName);
+  for(; it->More(); it->Next()) {
+    Handle(SALOMEDSImpl_SObject) so(it->Value());
+    Handle(SALOMEDSImpl_GenericAttribute) ga;
+    if(so->FindAttribute(ga, "AttributeParameter")) {
+      par = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(ga);
+      if(!par->IsSet("AP_MODULE_NAME", (Parameter_Types)3)) continue; //3 -> PT_STRING
+      if(par->GetString("AP_MODULE_NAME") == moduleName) return par;
+    }
+  }
+
+  Handle(SALOMEDSImpl_StudyBuilder) builder = NewBuilder();
+  Handle(SALOMEDSImpl_SObject) so = builder->NewObject(main_so);
+  par  = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(builder->FindOrCreateAttribute(so, "AttributeParameter"));
+  par->SetString("AP_MODULE_NAME", moduleName);
+  return par;
+}
index d87b4ec8dc8d3946f92e5026e8d2c03f37e50e2a..c22b2cd77643afe79139fdd4d03b157e5e14c09f 100644 (file)
@@ -56,6 +56,7 @@ DEFINE_STANDARD_HANDLE( SALOMEDSImpl_Study, MMgt_TShared )
 #include "SALOMEDSImpl_UseCaseBuilder.hxx"
 #include "SALOMEDSImpl_AttributeStudyProperties.hxx"
 #include "SALOMEDSImpl_AttributeIOR.hxx"
+#include "SALOMEDSImpl_AttributeParameter.hxx"
 #include "SALOMEDSImpl_Callback.hxx"
 #include "SALOMEDSImpl_Driver.hxx" 
 #include "SALOMEDSImpl_ChildIterator.hxx" 
@@ -254,9 +255,9 @@ public:
   Standard_EXPORT virtual bool HasCurrentContext() { return !_current.IsNull(); }
 
   Standard_EXPORT virtual bool DumpStudy(const TCollection_AsciiString& thePath, 
-                        const TCollection_AsciiString& theBaseName, 
-                        bool isPublished,
-                        SALOMEDSImpl_DriverFactory* theFactory);
+                                        const TCollection_AsciiString& theBaseName, 
+                                        bool isPublished,
+                                        SALOMEDSImpl_DriverFactory* theFactory);
 
   Standard_EXPORT static TCollection_AsciiString GetDumpStudyComment(const char* theComponentName = 0);
 
@@ -268,6 +269,12 @@ public:
   //This method marks the study as being modified
   Standard_EXPORT void Modify();
 
+  Standard_EXPORT Handle(SALOMEDSImpl_AttributeParameter) GetCommonParameters(const char* theID, int theSavePoint);
+
+  Standard_EXPORT Handle(SALOMEDSImpl_AttributeParameter) GetModuleParameters(const char* theID, 
+                                                                             const char* theModuleName,
+                                                                             int theSavePoint);
+
 public:
   DEFINE_STANDARD_RTTI( SALOMEDSImpl_Study )
 
index f4a25f644a80812211a11b140d01d9fe799d307b..f3f68e2da6fb1d29a10f59d826c0c2303145fee5 100644 (file)
@@ -624,7 +624,7 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl,
 
              if (Engine != NULL)
                {
-                 unsigned char* aStream;
+                 Handle(SALOMEDSImpl_TMPFile) aStream;
                  long length;
 
                   if (theASCII) aStream = Engine->SaveASCII(sco,
@@ -643,7 +643,7 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl,
 
                    HDFdataset *hdf_dataset = new HDFdataset("FILE_STREAM", hdf_sco_group, HDF_STRING, aHDFSize, 1);
                    hdf_dataset->CreateOnDisk();
-                   hdf_dataset->WriteOnDisk(aStream);  //Save the stream in the HDF file
+                   hdf_dataset->WriteOnDisk(aStream->Data());  //Save the stream in the HDF file
                    hdf_dataset->CloseOnDisk();
                  }
 
@@ -663,8 +663,6 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl,
                  hdf_dataset=0; //will be deleted by hdf_sco_AuxFiles destructor
                  // Creation of the persistance reference  attribute
                  Translate_IOR_to_persistentID (sco, Engine, theMultiFile, theASCII);
-
-                 if(aStream != NULL) delete [] aStream;
                }
            }
          hdf_sco_group->CloseOnDisk();
@@ -741,6 +739,16 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl,
       _errorCode = "HDFexception ! ";
       return false;
     }
+  catch(std::exception& exc)
+    {
+      _errorCode = const_cast<char*>(exc.what());
+      return false;
+    }
+  catch(...)
+    {
+      _errorCode = "Unknown exception ! ";
+      return false;
+    }
   if (theASCII) { // save file in ASCII format
     HDFascii::ConvertFromHDFToASCII(aUrl.ToCString(), true);
   }
@@ -892,12 +900,11 @@ bool SALOMEDSImpl_StudyManager::CopyLabel(const Handle(SALOMEDSImpl_Study)& theS
       Handle(SALOMEDSImpl_SObject) aSO = theSourceStudy->FindObjectID(anEntry.ToCString());
       int anObjID;
       long aLen;
-      unsigned char* aStream = theEngine->CopyFrom(aSO, anObjID, aLen);
+      Handle(SALOMEDSImpl_TMPFile) aStream = theEngine->CopyFrom(aSO, anObjID, aLen);
       TCollection_ExtendedString aResStr("");
       for(a = 0; a < aLen; a++) {
-       aResStr += TCollection_ExtendedString(ToExtCharacter((Standard_Character)aStream[a]));
+       aResStr += TCollection_ExtendedString(ToExtCharacter(Standard_Character(aStream->Get(a))));
       }
-      if(aStream != NULL) delete [] aStream;
       SALOMEDSImpl_AttributeInteger::Set(aAuxTargetLabel, anObjID);
       SALOMEDSImpl_AttributeName::Set(aAuxTargetLabel, aResStr);
       continue;
diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.cxx
new file mode 100644 (file)
index 0000000..64f677a
--- /dev/null
@@ -0,0 +1,40 @@
+// Copyright (C) 2005  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/
+//
+//  SALOME SALOMEDS : data structure of SALOME and sources of Salome data server 
+//  File   : SALOMEDSImpl_SObject.cxx
+//  Author : Sergey RUIN
+//  Module : SALOME
+
+
+#include "SALOMEDSImpl_TMPFile.hxx"
+
+#include <Handle_Standard_Type.hxx>
+#include <Standard_Transient.hxx>
+
+
+IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_TMPFile, MMgt_TShared )
+IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_TMPFile, MMgt_TShared )
+
+SALOMEDSImpl_TMPFile::TOctet*
+SALOMEDSImpl_TMPFile
+::Data()
+{
+  return &Get(0);
+}
diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.hxx
new file mode 100644 (file)
index 0000000..6ecd798
--- /dev/null
@@ -0,0 +1,47 @@
+// Copyright (C) 2005  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/
+//
+
+#ifndef __SALOMEDSIMPL_TMPFILE_H__
+#define __SALOMEDSIMPL_TMPFILE_H__
+
+//Handle definition
+#include <MMgt_TShared.hxx>
+#include <Handle_MMgt_TShared.hxx>
+#include <Standard_DefineHandle.hxx>
+
+
+DEFINE_STANDARD_HANDLE( SALOMEDSImpl_TMPFile, MMgt_TShared );
+
+
+struct SALOMEDSImpl_TMPFile : public MMgt_TShared
+{
+  typedef unsigned char TOctet;
+
+  virtual size_t Size() = 0;
+
+  virtual TOctet* Data();
+
+  virtual TOctet& Get(size_t) = 0;
+
+  DEFINE_STANDARD_RTTI( SALOMEDSImpl_TMPFile );
+};
+
+
+#endif 
diff --git a/src/SALOMEDSImpl/Test/Makefile.am b/src/SALOMEDSImpl/Test/Makefile.am
new file mode 100644 (file)
index 0000000..8ff0435
--- /dev/null
@@ -0,0 +1,106 @@
+#
+#  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+#
+#
+#
+#  File   : Makefile.am
+#  Author : Paul RASCLE
+#  Module : KERNEL
+#  $Header$
+
+include $(top_srcdir)/salome_adm/unix/make_common_starter.am
+
+#
+# ===============================================================
+# Files to be installed
+# ===============================================================
+#
+# header files  
+salomeinclude_HEADERS= SALOMEDSImplTest.hxx
+
+# Scripts to be installed
+dist_salomescript_SCRIPTS = TestSALOMEDSImpl.py
+
+#
+# ===============================================================
+# Local definitions
+# ===============================================================
+#
+
+# This directory defines the subdirectory src in the top source directory.
+RPATH=../..
+
+# This local variable defines the list of CPPFLAGS common to all target in this package.
+COMMON_CPPFLAGS=\
+       @CPPUNIT_INCLUDES@ \
+       -I$(srcdir)/$(RPATH)/Basics -I$(srcdir)/$(RPATH)/Basics/Test \
+       -I$(srcdir)/$(RPATH)/SALOMELocalTrace -I$(srcdir)/$(RPATH)/SALOMELocalTrace/Test \
+       -I$(srcdir)/$(RPATH)/SALOMETraceCollector -I$(srcdir)/$(RPATH)/SALOMETraceCollector/Test \
+       -I$(srcdir)/$(RPATH)/NamingService -I$(srcdir)/$(RPATH)/NamingService/Test \
+       -I$(srcdir)/$(RPATH)/Utils -I$(srcdir)/$(RPATH)/Utils/Test \
+       -I$(srcdir)/$(RPATH)/ResourcesManager \
+       -I$(srcdir)/$(RPATH)/LifeCycleCORBA \
+       -I$(srcdir)/$(RPATH)/SALOMEDSImpl \
+       -I$(top_builddir)/salome_adm/unix \
+       -I$(top_builddir)/idl \
+       @CAS_CPPFLAGS@ @CAS_CXXFLAGS@ \
+       @CORBA_CXXFLAGS@ @CORBA_INCLUDES@
+
+# This local variable defines the list of dependant libraries common to all target in this package.
+COMMON_LIBS =\
+       @CPPUNIT_LIBS@ \
+       $(RPATH)/Basics/libSALOMEBasics.la \
+       $(RPATH)/ResourcesManager/libSalomeResourcesManager.la \
+       $(RPATH)/Container/libSalomeContainer.la \
+       $(RPATH)/NamingService/libSalomeNS.la \
+       $(RPATH)/Registry/libRegistry.la \
+       $(RPATH)/Notification/libSalomeNotification.la \
+       $(RPATH)/Utils/Test/libUtilsTest.la \
+       $(RPATH)/Utils/libOpUtil.la \
+       $(RPATH)/SALOMELocalTrace/Test/libSALOMELocalTraceTest.la \
+       $(RPATH)/SALOMELocalTrace/libSALOMELocalTrace.la \
+       $(RPATH)/SALOMETraceCollector/Test/libSALOMETraceCollectorTest.la \
+       $(RPATH)/SALOMEDSImpl/libSalomeDSImpl.la \
+       $(top_builddir)/idl/libSalomeIDLKernel.la
+
+#
+# ===============================================================
+# Libraries targets
+# ===============================================================
+#
+lib_LTLIBRARIES = libSALOMEDSImplTest.la 
+libSALOMEDSImplTest_la_SOURCES = SALOMEDSImplTest.cxx
+libSALOMEDSImplTest_la_CPPFLAGS = $(COMMON_CPPFLAGS)
+libSALOMEDSImplTest_la_LDFLAGS  = -no-undefined -version-info=0:0:0
+libSALOMEDSImplTest_la_LIBADD    = $(COMMON_LIBS)
+
+#
+# ===============================================================
+# Executables targets
+# ===============================================================
+#
+bin_PROGRAMS = TestSALOMEDSImpl
+TestSALOMEDSImpl_SOURCES  = TestSALOMEDSImpl.cxx
+TestSALOMEDSImpl_CPPFLAGS = $(COMMON_CPPFLAGS)
+TestSALOMEDSImpl_LDADD    = \
+       libSALOMEDSImplTest.la ../libSalomeDSImpl.la \
+       $(RPATH)/NamingService/Test/libNamingServiceTest.la \
+       $(COMMON_LIBS)
+
diff --git a/src/SALOMEDSImpl/Test/SALOMEDSImplTest.cxx b/src/SALOMEDSImpl/Test/SALOMEDSImplTest.cxx
new file mode 100644 (file)
index 0000000..7ce2e54
--- /dev/null
@@ -0,0 +1,129 @@
+// Copyright (C) 2006  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/
+//
+
+#include "SALOMEDSImplTest.hxx"
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <vector>
+#include <cstdlib>
+#include "utilities.h"
+
+#include "SALOMEDSImpl_AttributeParameter.hxx"
+#include "SALOMEDSImpl_StudyManager.hxx"
+#include "SALOMEDSImpl_Study.hxx"
+#include "SALOMEDSImpl_StudyBuilder.hxx"
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+
+#include <TCollection_AsciiString.hxx>
+
+using namespace std;
+
+// ============================================================================
+/*!
+ * Set up the environment
+ */
+// ============================================================================
+
+void SALOMEDSImplTest::setUp()
+{
+  TCollection_AsciiString kernel(getenv("KERNEL_ROOT_DIR"));
+  TCollection_AsciiString subPath("/share/salome/resources");
+  TCollection_AsciiString csf_var = (kernel+subPath);
+  setenv("CSF_PluginDefaults", csf_var.ToCString(), 0);
+  setenv("CSF_SALOMEDS_ResourcesDefaults", csf_var.ToCString(), 0);
+}
+
+// ============================================================================
+/*!
+ *  - delete trace classes
+ */
+// ============================================================================
+
+void 
+SALOMEDSImplTest::tearDown()
+{
+}
+
+// ============================================================================
+/*!
+ * Check setting int value
+ */
+// ============================================================================
+void SALOMEDSImplTest::testAttributeParameter()
+{
+  Handle(SALOMEDSImpl_StudyManager) sm = new SALOMEDSImpl_StudyManager();
+  Handle(SALOMEDSImpl_Study) study = sm->NewStudy("Test");
+  Handle(SALOMEDSImpl_AttributeParameter) _ap = study->GetCommonParameters("TestComp", 0);
+
+  CPPUNIT_ASSERT(!_ap.IsNull());
+
+  _ap->SetInt("IntValue", 1);
+  CPPUNIT_ASSERT(_ap->IsSet("IntValue", PT_INTEGER));
+  CPPUNIT_ASSERT(_ap->GetInt("IntValue") == 1);
+
+  _ap->SetReal("RealValue", 1.2);
+  CPPUNIT_ASSERT(_ap->IsSet("RealValue", PT_REAL));
+  CPPUNIT_ASSERT(_ap->GetReal("RealValue") == 1.2);
+
+  _ap->SetString("StringValue", "hello");
+  CPPUNIT_ASSERT(_ap->IsSet("StringValue", PT_STRING));
+  CPPUNIT_ASSERT(_ap->GetString("StringValue") == "hello");
+
+  _ap->SetBool("BoolValue", 0);
+  CPPUNIT_ASSERT(_ap->IsSet("BoolValue", PT_BOOLEAN));
+  CPPUNIT_ASSERT(!_ap->GetBool("BoolValue"));
+
+  _ap->SetBool("BoolValue", 0);
+  CPPUNIT_ASSERT(_ap->IsSet("BoolValue", PT_BOOLEAN));
+  CPPUNIT_ASSERT(!_ap->GetBool("BoolValue"));
+
+  vector<int> intArray;
+  intArray.push_back(0);
+  intArray.push_back(1);
+
+  _ap->SetIntArray("IntArray", intArray);
+  CPPUNIT_ASSERT(_ap->IsSet("IntArray", PT_INTARRAY));
+  CPPUNIT_ASSERT(_ap->GetIntArray("IntArray")[0] == 0);
+  CPPUNIT_ASSERT(_ap->GetIntArray("IntArray")[1] == 1); 
+
+  vector<double> realArray;
+  realArray.push_back(0.0);
+  realArray.push_back(1.1);
+  
+  _ap->SetRealArray("RealArray", realArray);
+  CPPUNIT_ASSERT(_ap->IsSet("RealArray", PT_REALARRAY));
+  CPPUNIT_ASSERT(_ap->GetRealArray("RealArray")[0] == 0.0);
+  CPPUNIT_ASSERT(_ap->GetRealArray("RealArray")[1] == 1.1); 
+
+  vector<string> strArray;
+  strArray.push_back("hello");
+  strArray.push_back("world");
+  
+  _ap->SetStrArray("StrArray", strArray);
+  CPPUNIT_ASSERT(_ap->IsSet("StrArray", PT_STRARRAY));
+  CPPUNIT_ASSERT(_ap->GetStrArray("StrArray")[0] == "hello");
+  CPPUNIT_ASSERT(_ap->GetStrArray("StrArray")[1] == "world"); 
+
+}
+
+
+
diff --git a/src/SALOMEDSImpl/Test/SALOMEDSImplTest.hxx b/src/SALOMEDSImpl/Test/SALOMEDSImplTest.hxx
new file mode 100644 (file)
index 0000000..0abba82
--- /dev/null
@@ -0,0 +1,39 @@
+// Copyright (C) 2006  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/
+//
+
+#ifndef _SALOMEDSImplTEST_HXX_
+#define _SALOMEDSImplTEST_HXX_
+
+#include <cppunit/extensions/HelperMacros.h>
+
+class SALOMEDSImplTest : public CppUnit::TestFixture
+{
+  CPPUNIT_TEST_SUITE( SALOMEDSImplTest );
+  CPPUNIT_TEST( testAttributeParameter );
+  CPPUNIT_TEST_SUITE_END();
+
+public:
+
+  void setUp();
+  void tearDown();
+  void testAttributeParameter();
+};
+
+#endif
diff --git a/src/SALOMEDSImpl/Test/TestSALOMEDSImpl.cxx b/src/SALOMEDSImpl/Test/TestSALOMEDSImpl.cxx
new file mode 100644 (file)
index 0000000..2456fc6
--- /dev/null
@@ -0,0 +1,31 @@
+// Copyright (C) 2005  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/
+//
+
+// --- include all SALOMEDSImpl Test from basics until the present directory
+
+#include "SALOMEDSImplTest.hxx"
+
+// --- Registers the fixture into the 'registry'
+
+CPPUNIT_TEST_SUITE_REGISTRATION( SALOMEDSImplTest );
+
+// --- generic Main program from Basic/Test
+
+#include "BasicMainTest.hxx"
diff --git a/src/SALOMEDSImpl/Test/TestSALOMEDSImpl.py b/src/SALOMEDSImpl/Test/TestSALOMEDSImpl.py
new file mode 100644 (file)
index 0000000..985241a
--- /dev/null
@@ -0,0 +1,29 @@
+
+import sys, os,signal,string,commands
+import runSalome
+import orbmodule
+import TestKiller
+
+# get SALOME environment :
+
+args, modules_list, modules_root_dir = runSalome.get_config()
+runSalome.set_env(args, modules_list, modules_root_dir)
+
+# launch CORBA naming server
+
+clt=orbmodule.client()
+
+# launch CORBA logger server
+
+myServer=runSalome.LoggerServer(args)
+myServer.run()
+clt.waitLogger("Logger")
+
+# execute Unit Test
+
+command = ['TestSALOMEDSImpl']
+ret = os.spawnvp(os.P_WAIT, command[0], command)
+
+# kill Test process 
+
+TestKiller.killProcess(runSalome.process_id)
index 8adcc07b57df3aca835959cac70afc1107d15605..0f8f2f61ba7757d4204443310110063f34b74d3e 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <stdio.h>
 #include <iostream> 
+#include <vector>
 
 #include <TColStd_HSequenceOfTransient.hxx>
 #include <TCollection_AsciiString.hxx>
@@ -37,6 +38,8 @@
 #include "SALOMEDSImpl_StudyBuilder.hxx"
 #include "SALOMEDSImpl_SObject.hxx"
 #include "SALOMEDSImpl_SComponent.hxx"
+#include "SALOMEDSImpl_AttributeParameter.hxx"
+
 //#include "SALOMEDSImpl_.hxx"
 
 int main (int argc, char * argv[])
@@ -81,15 +84,106 @@ int main (int argc, char * argv[])
   aBuilder->RemoveObject(aSubSO);
   cout << "Remove: done" << endl;
 
+  cout << "Check AttributeTreeNode " << endl;
+  aTDFAttr =  aBuilder->FindOrCreateAttribute(aSO, "AttributeTreeNode");  
+  cout << Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aTDFAttr)->Type() << endl;
+  cout << "Check AttributeTreeNode : done " << endl;
+
+  aTDFAttr =  aBuilder->FindOrCreateAttribute(aSO, "AttributeParameter");  
+  cout << Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aTDFAttr)->Type() << endl;
+
   cout << "Check the attributes on SObject" << endl;
   Handle(TColStd_HSequenceOfTransient) aSeq = aSO->GetAllAttributes();
   for(int i = 1; i <= aSeq->Length(); i++) 
     cout << "Found: " << Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aSeq->Value(i))->Type() << endl;
 
-  cout << "Check AttributeTreeNode " << endl;
-  aTDFAttr =  aBuilder->FindOrCreateAttribute(aSO, "AttributeTreeNode");  
-  cout << Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aTDFAttr)->Type() << endl;
-  cout << "Check AttributeTreeNode : done " << endl;
+
+
+  cout << "Check AttributeParameter "   << endl;
+
+  Handle(SALOMEDSImpl_AttributeParameter) AP = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(aTDFAttr);
+
+  cout << "AttributeParameter with type : " << AP->Type() << endl;
+  
+  AP->SetInt("1", 123);
+  cout << "IsSet for int: " << AP->IsSet("1", PT_INTEGER) << " value : " << AP->GetInt("1") << endl;
+  //for(int i = 2; i < 5; i++) AP->SetInt(i, i*i);
+
+  AP->SetReal("1", 123.123);
+  cout << "IsSet for real: " << AP->IsSet("1", PT_REAL) << " value : " << AP->GetReal("1") << endl;
+  //for(int i = 2; i < 5; i++) AP->SetReal(i, 0.1);
+
+  AP->SetString("1", "value is 123.123!");
+  cout << "IsSet for string: " << AP->IsSet("1", PT_STRING) << " value : " << AP->GetString("1") << endl; 
+  /*
+  for(int i = 2; i < 5; i++) {
+    TCollection_AsciiString s((double)(1.0/i));
+    cout << "Setting for " << i << " value : " << s  << endl;
+    AP->SetString(i, s); 
+  }
+  */
+
+  AP->SetBool("1", true);
+  cout << "IsSet for bool: " << AP->IsSet("1", PT_BOOLEAN) << " value : " << AP->GetBool("1") << endl;
+  //for(int i = 2; i < 5; i++) AP->SetBool(i, 0);
+  
+  vector<double> v;
+  v.push_back(111.111);
+  v.push_back(222.22222);
+  v.push_back(333.3333333);
+  AP->SetRealArray("1", v);
+  cout << "IsSet for array: " << AP->IsSet("1", PT_REALARRAY);
+  vector<double> v2 = AP->GetRealArray("1");
+  cout.precision(10);
+  cout << " values :  "; 
+  for(int i = 0; i<v2.size(); i++) cout << v2[i] << " ";
+  cout << endl;
+  
+  v[0] = 211.111;
+  v[1] = 422.22222;
+  v[2] = 633.3333333;
+  AP->SetRealArray("2", v);
+
+  vector<int> vi;
+  vi.push_back(1);
+  vi.push_back(2);
+  AP->SetIntArray("2", vi);
+  
+  vector<string> vs;
+  vs.push_back("hello, ");
+  vs.push_back("world!");
+  AP->SetStrArray("3", vs);        
+
+  TCollection_AsciiString as = AP->Save();
+  cout << "AS = " << as << endl;
+  AP->Load(as);
+  
+  cout << "Restored string with id = 1 is: " << AP->GetString("1") << endl;
+  cout << "Restored int with id = 2 is: " << AP->GetInt("1")  << endl;
+  cout << "Restored real with id = 3 is: " << AP->GetReal("1")  << endl;
+  cout << "Restored bool with id = 1 is: " << AP->GetBool("1")  << endl;
+  
+  v2 = AP->GetRealArray("2");
+  cout << "Restored real array with id = 2 is: ";
+  for(int i = 0; i<v2.size(); i++) cout << v2[i] << " ";
+  cout << endl;
+
+  vi = AP->GetIntArray("2");
+  cout << "Restored int array with id = 2 is: ";
+  for(int i = 0; i<vi.size(); i++) cout << vi[i] << " ";
+  cout << endl;
+  
+  vs = AP->GetStrArray("3");
+  cout << "Restored string array with id = 2 is: ";
+  for(int i = 0; i<vs.size(); i++) cout << vs[i] << " ";
+  cout << endl;
+
+  cout << "Check RemoveID 1 with type PT_INTEGER" << endl;
+  AP->RemoveID("1", PT_INTEGER);
+  cout << "IsSet with id = 1, type = PT_INTEGER : " << AP->IsSet("1", PT_INTEGER)  << endl;
+  cout << "Check RemoveID is done" << endl;
+  
+  cout << "Check AttributeParameter : done"   << endl;
 
   cout << "Test finished " << endl;    
   return 0;
index fa13a1eb42756a3ed27dbcdae66f5ab00c00a053..90263d1de00ff4116a630f832d185439c0931316 100644 (file)
@@ -150,112 +150,133 @@ void SALOMEDS_Tool::RemoveTemporaryFiles(const std::string& theDirectory,
 // function : PutFilesToStream
 // purpose  : converts the files from a list 'theFiles' to the stream
 //============================================================================
-SALOMEDS::TMPFile* 
-SALOMEDS_Tool::PutFilesToStream(const std::string& theFromDirectory,
-                               const SALOMEDS::ListOfFileNames& theFiles,
-                               const int theNamesOnly)
+namespace
 {
-  int i, aLength = theFiles.length();
-  if(aLength == 0)
-//    return NULL;
-    return (new SALOMEDS::TMPFile);
-
-  //Get a temporary directory for saved a file
-  TCollection_AsciiString aTmpDir(const_cast<char*>(theFromDirectory.c_str()));
-
-  long aBufferSize = 0;
-  long aCurrentPos;
-
-  int aNbFiles = 0;
-  int* aFileNameSize= new int[aLength];
-  long* aFileSize= new long[aLength];
-
-  //Determine the required size of the buffer
-
-  for(i=0; i<aLength; i++) {
-
-    //Check if the file exists
+  SALOMEDS::TMPFile* 
+  PutFilesToStream(const std::string& theFromDirectory,
+                  const SALOMEDS::ListOfFileNames& theFiles,
+                  const SALOMEDS::ListOfFileNames& theFileNames,
+                  const int theNamesOnly)
+  {
+    int i, aLength = theFiles.length();
+    if(aLength == 0)
+      return (new SALOMEDS::TMPFile);
+    
+    //Get a temporary directory for saved a file
+    TCollection_AsciiString aTmpDir(const_cast<char*>(theFromDirectory.c_str()));
+    
+    long aBufferSize = 0;
+    long aCurrentPos;
+    
+    int aNbFiles = 0;
+    int* aFileNameSize= new int[aLength];
+    long* aFileSize= new long[aLength];
     
-    if (!theNamesOnly) { // mpv 15.01.2003: if only file names must be stroed, then size of files is zero
-      TCollection_AsciiString aFullPath = aTmpDir + CORBA::string_dup(theFiles[i]);   
-      OSD_Path anOSDPath(aFullPath);
-      OSD_File anOSDFile(anOSDPath);
-      if(!anOSDFile.Exists()) continue;
+    //Determine the required size of the buffer
+    
+    for(i=0; i<aLength; i++) {
+      
+      //Check if the file exists
+      
+      if (!theNamesOnly) { // mpv 15.01.2003: if only file names must be stroed, then size of files is zero
+       TCollection_AsciiString aFullPath = aTmpDir + const_cast<char*>(theFiles[i].in());   
+       OSD_Path anOSDPath(aFullPath);
+       OSD_File anOSDFile(anOSDPath);
+       if(!anOSDFile.Exists()) continue;
 #ifdef WNT
-      ifstream aFile(aFullPath.ToCString(), ios::binary);
+       ifstream aFile(aFullPath.ToCString(), ios::binary);
 #else
-      ifstream aFile(aFullPath.ToCString());
+       ifstream aFile(aFullPath.ToCString());
 #endif
-      aFile.seekg(0, ios::end);
-      aFileSize[i] = aFile.tellg();
-      aBufferSize += aFileSize[i];              //Add a space to store the file
-    }
-    aFileNameSize[i] = strlen(theFiles[i])+1;
-    aBufferSize += aFileNameSize[i];          //Add a space to store the file name
-    aBufferSize += (theNamesOnly)?4:12;       //Add 4 bytes: a length of the file name,
-                                              //    8 bytes: length of the file itself
-    aNbFiles++;
-  } 
-
-  aBufferSize += 4;      //4 bytes for a number of the files that will be written to the stream;
-  unsigned char* aBuffer = new unsigned char[aBufferSize];  
-  if(aBuffer == NULL)
-//    return NULL; 
-    return (new SALOMEDS::TMPFile);
-
-  //Initialize 4 bytes of the buffer by 0
-  memset(aBuffer, 0, 4); 
-  //Copy the number of files that will be written to the stream
-  memcpy(aBuffer, &aNbFiles, ((sizeof(int) > 4) ? 4 : sizeof(int))); 
-
-
-  aCurrentPos = 4;
-
-  for(i=0; i<aLength; i++) {
-    ifstream *aFile;
-    if (!theNamesOnly) { // mpv 15.01.2003: we don't open any file if theNamesOnly = true
-      TCollection_AsciiString aFullPath = aTmpDir + CORBA::string_dup(theFiles[i]);
-      OSD_Path anOSDPath(aFullPath);
-      OSD_File anOSDFile(anOSDPath);
-      if(!anOSDFile.Exists()) continue;
+       aFile.seekg(0, ios::end);
+       aFileSize[i] = aFile.tellg();
+       aBufferSize += aFileSize[i];              //Add a space to store the file
+      }
+      aFileNameSize[i] = strlen(theFileNames[i])+1;
+      aBufferSize += aFileNameSize[i];          //Add a space to store the file name
+      aBufferSize += (theNamesOnly)?4:12;       //Add 4 bytes: a length of the file name,
+      //    8 bytes: length of the file itself
+      aNbFiles++;
+    } 
+    
+    aBufferSize += 4;      //4 bytes for a number of the files that will be written to the stream;
+    unsigned char* aBuffer = new unsigned char[aBufferSize];  
+    if(aBuffer == NULL)
+      return (new SALOMEDS::TMPFile);
+    
+    //Initialize 4 bytes of the buffer by 0
+    memset(aBuffer, 0, 4); 
+    //Copy the number of files that will be written to the stream
+    memcpy(aBuffer, &aNbFiles, ((sizeof(int) > 4) ? 4 : sizeof(int))); 
+    
+    
+    aCurrentPos = 4;
+    
+    for(i=0; i<aLength; i++) {
+      ifstream *aFile;
+      if (!theNamesOnly) { // mpv 15.01.2003: we don't open any file if theNamesOnly = true
+       TCollection_AsciiString aFullPath = aTmpDir + const_cast<char*>(theFiles[i].in());
+       OSD_Path anOSDPath(aFullPath);
+       OSD_File anOSDFile(anOSDPath);
+       if(!anOSDFile.Exists()) continue;
 #ifdef WNT
-      aFile = new ifstream(aFullPath.ToCString(), ios::binary);
+       aFile = new ifstream(aFullPath.ToCString(), ios::binary);
 #else
-      aFile = new ifstream(aFullPath.ToCString());
+       aFile = new ifstream(aFullPath.ToCString());
 #endif  
-    }
-    //Initialize 4 bytes of the buffer by 0
-    memset((aBuffer + aCurrentPos), 0, 4); 
-    //Copy the length of the file name to the buffer
-    memcpy((aBuffer + aCurrentPos), (aFileNameSize + i), ((sizeof(int) > 4) ? 4 : sizeof(int))); 
-    aCurrentPos += 4;
-
-    //Copy the file name to the buffer
-    memcpy((aBuffer + aCurrentPos), theFiles[i], aFileNameSize[i]);
-    aCurrentPos += aFileNameSize[i];
-    
-    if (!theNamesOnly) { // mpv 15.01.2003: we don't copy file content to the buffer if !theNamesOnly
-      //Initialize 8 bytes of the buffer by 0
-      memset((aBuffer + aCurrentPos), 0, 8); 
-      //Copy the length of the file to the buffer
-      memcpy((aBuffer + aCurrentPos), (aFileSize + i), ((sizeof(long) > 8) ? 8 : sizeof(long)));
-      aCurrentPos += 8;
+      }
+      //Initialize 4 bytes of the buffer by 0
+      memset((aBuffer + aCurrentPos), 0, 4); 
+      //Copy the length of the file name to the buffer
+      memcpy((aBuffer + aCurrentPos), (aFileNameSize + i), ((sizeof(int) > 4) ? 4 : sizeof(int))); 
+      aCurrentPos += 4;
       
-      aFile->seekg(0, ios::beg);
-      aFile->read((char *)(aBuffer + aCurrentPos), aFileSize[i]);
-      aFile->close();
-      delete(aFile);
-      aCurrentPos += aFileSize[i];
+      //Copy the file name to the buffer
+      memcpy((aBuffer + aCurrentPos), theFileNames[i], aFileNameSize[i]);
+      aCurrentPos += aFileNameSize[i];
+      
+      if (!theNamesOnly) { // mpv 15.01.2003: we don't copy file content to the buffer if !theNamesOnly
+       //Initialize 8 bytes of the buffer by 0
+       memset((aBuffer + aCurrentPos), 0, 8); 
+       //Copy the length of the file to the buffer
+       memcpy((aBuffer + aCurrentPos), (aFileSize + i), ((sizeof(long) > 8) ? 8 : sizeof(long)));
+       aCurrentPos += 8;
+       
+       aFile->seekg(0, ios::beg);
+       aFile->read((char *)(aBuffer + aCurrentPos), aFileSize[i]);
+       aFile->close();
+       delete(aFile);
+       aCurrentPos += aFileSize[i];
+      }
     }
+    
+    delete[] aFileNameSize;
+    delete[] aFileSize;
+    
+    
+    CORBA::Octet* anOctetBuf =  (CORBA::Octet*)aBuffer;
+    
+    return (new SALOMEDS::TMPFile(aBufferSize, aBufferSize, anOctetBuf, 1));
   }
-
-  delete[] aFileNameSize;
-  delete[] aFileSize;
   
-  
-  CORBA::Octet* anOctetBuf =  (CORBA::Octet*)aBuffer;
-  
-  return (new SALOMEDS::TMPFile(aBufferSize, aBufferSize, anOctetBuf, 1));
+}
+
+
+SALOMEDS::TMPFile* 
+SALOMEDS_Tool::PutFilesToStream(const std::string& theFromDirectory,
+                               const SALOMEDS::ListOfFileNames& theFiles,
+                               const int theNamesOnly)
+{
+  SALOMEDS::ListOfFileNames aFileNames(theFiles);
+  return ::PutFilesToStream(theFromDirectory,theFiles,aFileNames,theNamesOnly);
+}
+
+
+SALOMEDS::TMPFile* 
+SALOMEDS_Tool::PutFilesToStream(const SALOMEDS::ListOfFileNames& theFiles,
+                               const SALOMEDS::ListOfFileNames& theFileNames)
+{
+  return ::PutFilesToStream("",theFiles,theFileNames,0);
 }
 
 //============================================================================
index c36de54e7d4fcfd362ac94cb4f0d1e5078bcf772..7c7f33a0f49db2c86b26f69343d8e8d1abe9f525 100644 (file)
@@ -64,6 +64,10 @@ public:
                                             const SALOMEDS::ListOfFileNames& theFiles,
                                             const int theNamesOnly = 0);
 
+  // Converts files listed in <theFiles> which will be named as pointed in the <theFileNames> into a byte sequence TMPFile
+  static SALOMEDS::TMPFile* PutFilesToStream(const SALOMEDS::ListOfFileNames& theFiles,
+                                            const SALOMEDS::ListOfFileNames& theFileNames);
+
   // Converts a byte sequence <theStream> to files and places them in <theToDirectory>
   static SALOMEDS::ListOfFileNames_var PutStreamToFiles(const SALOMEDS::TMPFile& theStream,
                                                        const std::string& theToDirectory,
index 5194571929201c9abd0ce00b6502a94fc988a9ae..617fae441e2f8f69cfffff8daa4506d952fed88d 100644 (file)
@@ -41,7 +41,6 @@ salomeinclude_HEADERS =\
        Utils_SINGLETON.hxx \
        Utils_DESTRUCTEUR_GENERIQUE.hxx \
        Utils_ExceptHandlers.hxx \
-       Utils_SignalsHandler.h \
        Utils_Mutex.hxx
 
 # Scripts to be exported
@@ -58,7 +57,6 @@ libOpUtil_la_SOURCES =\
        Utils_Identity.cxx Utils_ORB_INIT.cxx \
        Utils_DESTRUCTEUR_GENERIQUE.cxx \
        Utils_ExceptHandlers.cxx \
-       Utils_SignalsHandler.cxx \
        Utils_Mutex.cxx
 
 libOpUtil_la_LDFLAGS  = -no-undefined -version-info=0:0:0
diff --git a/src/Utils/Utils_SignalsHandler.cxx b/src/Utils/Utils_SignalsHandler.cxx
deleted file mode 100644 (file)
index 019633f..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-//  KERNEL Utils : common utils for KERNEL
-//  Copyright (C) 2003  CEA
-//
-//  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.org
-
-
-#include <stdexcept>
-#include <stdio.h>
-#include <signal.h>
-
-#include "Utils_SignalsHandler.h"
-
-
-//============================================================================
-//function : Handler 
-//purpose  : univisal handler for signals
-//============================================================================
-static void Handler(int theSigId)
-{
-  char aMessage[256] = "";
-  sprintf(aMessage,"Signal with ID = %d was cautch!",theSigId);
-  throw std::runtime_error(aMessage);
-}
-
-
-//=======================================================================
-//function : SetSigHandler
-//purpose  : Redefine signal handlers. If the handler of the signal is
-//           set as SIG_IGN. That's why the shells often ignore some 
-//           signal when starting child processes. We keep it.
-//=======================================================================
-static void SetSignalHandler(Utils_SignalsHandler::TSigHandlerCont& theSigHandlerCont,
-                                     int theSigId)
-{
-  TSigHandler anOldHandler = signal(theSigId,&Handler);
-  if(anOldHandler == SIG_IGN)
-    signal(theSigId,SIG_IGN);  
-  theSigHandlerCont[theSigId] = anOldHandler;
-}
-
-static TSigHandler StoreSignalHandler(Utils_SignalsHandler::TSigHandlerCont& theSigHandlerCont,
-                                     int theSigId)
-{
-  TSigHandler anOldHandler = signal(theSigId,&Handler);
-  signal(theSigId,anOldHandler);
-  if(anOldHandler == SIG_IGN)
-    signal(theSigId,SIG_IGN);  
-  theSigHandlerCont[theSigId] = anOldHandler;
-  return anOldHandler;
-}
-
-static void RestoreSigHandler(TSigHandler theSigHandler,
-                             int theSigId)
-{
-  signal(theSigId,theSigHandler);
-}
-
-
-//=======================================================================
-//function : Utils_SignalsHandler
-//purpose  : Constructor
-//=======================================================================
-Utils_SignalsHandler::Utils_SignalsHandler()
-{
-  // asv 28.02.05 : some signals are not defined on Windows.. why?  I don't know..
-#ifndef WNT
-  StoreSignalHandler(mySigHandlerCont,SIGHUP); // floating point exception
-  StoreSignalHandler(mySigHandlerCont,SIGQUIT); // quit
-  StoreSignalHandler(mySigHandlerCont,SIGBUS); // bus error
-#ifndef __osf1__
-  StoreSignalHandler(mySigHandlerCont,SIGSTKFLT); // stack fault.
-#endif
-#endif
-  StoreSignalHandler(mySigHandlerCont,SIGFPE); // floating point exception  
-  StoreSignalHandler(mySigHandlerCont,SIGINT); // interrupt
-  StoreSignalHandler(mySigHandlerCont,SIGILL); // illegal instruction
-  StoreSignalHandler(mySigHandlerCont,SIGTERM); // termination
-  StoreSignalHandler(mySigHandlerCont,SIGSEGV); // segmentation 
-  //StoreSignalHandler(mySigHandlerCont,SIGABRT); // abort (ANSI).  
-  // portage CCRT
-  //  StoreSignalHandler(mySigHandlerCont,SIGSTKFLT); // stack fault.  
-}
-
-
-//=======================================================================
-//function : Utils_SignalsHandler
-//purpose  : destructor
-//=======================================================================
-Utils_SignalsHandler::~Utils_SignalsHandler() 
-{
-  TSigHandlerCont::iterator anIter = mySigHandlerCont.begin();
-  TSigHandlerCont::iterator anIterEnd = mySigHandlerCont.end();
-  for(; anIter != anIterEnd; anIter++)
-    RestoreSigHandler(anIter->second,anIter->first);
-}
-
-
-//=======================================================================
-//function : SetSigHandler
-//purpose  : sets new handler for pointed signal
-//=======================================================================
-TSigHandler Utils_SignalsHandler::SetSigHandler(int theSigId, 
-                                               TSigHandler theSigHandler)
-{
-  TSigHandler anOldHandler = signal(theSigId,theSigHandler);
-  if(anOldHandler == SIG_IGN)
-    signal(theSigId,SIG_IGN);  
-  mySigHandlerCont[theSigId] = anOldHandler;
-  return anOldHandler;
-}
diff --git a/src/Utils/Utils_SignalsHandler.h b/src/Utils/Utils_SignalsHandler.h
deleted file mode 100644 (file)
index 44228ba..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-//  KERNEL Utils : common utils for KERNEL
-//  Copyright (C) 2003  CEA
-//
-//  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.org
-
-#ifndef _UTILS_SIGNALSHANDLER_H_
-#define _UTILS_SIGNALSHANDLER_H_
-
-
-#if defined UTILS_EXPORTS
-#if defined WIN32
-#define UTILS_EXPORT __declspec( dllexport )
-#else
-#define UTILS_EXPORT
-#endif
-#else
-#if defined WNT
-#define UTILS_EXPORT __declspec( dllimport )
-#else
-#define UTILS_EXPORT
-#endif
-#endif
-
-#include <map>
-typedef void (*TSigHandler)(int);
-
-
-class UTILS_EXPORT Utils_SignalsHandler{
- public:
-  Utils_SignalsHandler();
-  ~Utils_SignalsHandler();
-
-  TSigHandler GetSigHandler(int theSigId);
-  TSigHandler SetSigHandler(int theSigId, TSigHandler theSigHandler);
-  typedef std::map<int,TSigHandler> TSigHandlerCont;
-
- private:
-  TSigHandlerCont mySigHandlerCont;
-};
-
-
-class UTILS_EXPORT Utils_CASSignalsHandler: private Utils_SignalsHandler{
- public:
-  Utils_CASSignalsHandler();
-};
-
-
-#endif